Skip to content

Commit

Permalink
fix minor problems
Browse files Browse the repository at this point in the history
  • Loading branch information
MBueschelberger committed Dec 17, 2024
1 parent 00999e4 commit 3893290
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dsms/knowledge/kitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,12 @@ def validate_ktype_id(cls, value: Union[str, Enum]) -> KType:
from dsms import Session

if isinstance(value, str):
value = Session.ktypes.get(value)
if not value:
ktype = Session.ktypes.get(value)
if not ktype:
raise TypeError(
f"KType for `ktype_id={value}` does not exist."
)
value = ktype

return value.id

Expand Down
6 changes: 4 additions & 2 deletions dsms/knowledge/properties/custom_datatype/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def __get_validators__(cls) -> "Generator":
yield cls.validate

@classmethod
def validate(cls, v: "Any") -> "NumericalDataType":
def validate(
cls, v: "Any", *args, **kwargs # pylint: disable=W0613
) -> "NumericalDataType":
"""
Validate the input value as a valid NumericalDataType.
Expand All @@ -59,7 +61,7 @@ def validate(cls, v: "Any") -> "NumericalDataType":
TypeError: If the input value is not a float or int.
"""
if not isinstance(v, (float, int)):
raise TypeError(f"Expected float or int, got {type(v)}")
raise TypeError(f"Expected float or int, got {type(v)}: {v}")
obj = super().__new__(cls, v)
obj._kitem = None
obj._name = None
Expand Down
1 change: 1 addition & 0 deletions dsms/knowledge/webform.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ class Entry(BaseWebformModel):
relationMapping: Optional[RelationMapping] = Field(
None, description="Relation mapping of the entry"
)
required: Optional[bool] = Field(False, description="Required input")

def __setattr__(self, key, value) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = dsms_sdk
version = v2.1.0dev6
version = v2.1.0dev7
description = Python SDK core-package for working with the Dataspace Management System (DSMS).
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit 3893290

Please sign in to comment.