Enforce SKDecimal 'name' parameter as string

This commit is contained in:
Achmad Fathoni
2026-04-05 21:30:37 +07:00
parent 3a76235c48
commit de064505c5
+2 -2
View File
@@ -9,7 +9,7 @@ class SKDecimal(FloatDistribution):
*, *,
step: float | None = None, step: float | None = None,
decimals: int | None = None, decimals: int | None = None,
name=None, name: str | None = None,
): ):
""" """
FloatDistribution with a fixed step size. FloatDistribution with a fixed step size.
@@ -26,7 +26,7 @@ class SKDecimal(FloatDistribution):
raise ValueError("You must set one of decimals or step") raise ValueError("You must set one of decimals or step")
# Convert decimals to step # Convert decimals to step
self.step = step or (1 / 10**decimals if decimals else 1) self.step = step or (1 / 10**decimals if decimals else 1)
self.name = name self.name = name or ""
super().__init__( super().__init__(
low=round(low, decimals) if decimals else low, low=round(low, decimals) if decimals else low,