File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/frequenz/sdk/timeseries Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,14 @@ def zero(cls) -> Self:
9797
9898 Returns:
9999 A quantity with value 0.0.
100+
101+ Raises:
102+ TypeError: If called on the base
103+ [`Quantity`][frequenz.sdk.timeseries.Quantity] class.
100104 """
105+ if cls is Quantity :
106+ raise TypeError ("Cannot instantiate a base Quantity class." )
107+
101108 _zero = cls ._zero_cache .get (cls , None )
102109 if _zero is None :
103110 _zero = cls .__new__ (cls )
@@ -118,8 +125,12 @@ def from_string(cls, string: str) -> Self:
118125
119126 Raises:
120127 ValueError: If the string does not match the expected format.
121-
128+ TypeError: If called on the base
129+ [`Quantity`][frequenz.sdk.timeseries.Quantity] class.
122130 """
131+ if cls is Quantity :
132+ raise TypeError ("Cannot instantiate a base Quantity class." )
133+
123134 split_string = string .split (" " )
124135
125136 if len (split_string ) != 2 :
You can’t perform that action at this time.
0 commit comments