Merge pull request #13021 from AchmadFathoni/develop

Enforce SKDecimal 'name' parameter as string
This commit is contained in:
Matthias
2026-04-06 09:06:51 +02:00
committed by GitHub
+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,