pydicom.valuerep.DS

pydicom.valuerep.DS(val: None | str | int | float | Decimal, auto_format: bool = False, validation_mode: int | None = None) None | str | DSfloat | DSdecimal[source]

Factory function for creating DS class instances.

Checks for blank string; if so, returns that, else calls DSfloat or DSdecimal to create the class instance. This avoids overriding DSfloat.__new__() (which carries a time penalty for large arrays of DS).

Similarly the string clean and check can be avoided and DSfloat called directly if a string has already been processed.