diff --git a/cmem_plugin_uuid/transform/__init__.py b/cmem_plugin_uuid/transform/__init__.py index ccb6200..c0e0cb4 100644 --- a/cmem_plugin_uuid/transform/__init__.py +++ b/cmem_plugin_uuid/transform/__init__.py @@ -55,8 +55,8 @@ class UUID1(TransformPlugin): def __init__( self, - node: str | None, - clock_seq: str | None, + node: str, + clock_seq: str, ): self.node = node_to_int(node) if node else None self.clock_seq = clock_seq_to_int(clock_seq) if clock_seq else None @@ -107,7 +107,7 @@ class UUID3(TransformPlugin): def __init__( self, - namespace: str | None, + namespace: str, namespace_as_uuid: bool | None, ): self.namespace = namespace @@ -128,7 +128,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]: if self.namespace == "empty_value": result += [str(uuid.UUID(hex=namespace_hex(_, 3), version=3))] else: - result += [str(uuid.uuid3(namespace_uuid, _))] + result += [str(uuid.uuid3(namespace_uuid, _))] # type: ignore[arg-type] else: raise OSError("No input for UUID3") return result @@ -187,7 +187,7 @@ class UUID5(TransformPlugin): def __init__( self, - namespace: str | None, + namespace: str, namespace_as_uuid: bool | None, ): self.namespace = namespace @@ -208,7 +208,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]: if self.namespace == "empty_value": result += [str(uuid.UUID(hex=namespace_hex(_, 5), version=5))] else: - result += [str(uuid.uuid5(namespace_uuid, _))] + result += [str(uuid.uuid5(namespace_uuid, _))] # type: ignore[arg-type] else: raise OSError("No input for UUID5") return result @@ -235,7 +235,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]: 'Node value in the form "01:23:45:67:89:AB", 01-23-45-67-89-AB", or ' '"0123456789AB". If not given, a random 48-bit number is chosen.' ), - default_value=None, + default_value="", ), PluginParameter( name="clock_seq", @@ -244,7 +244,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]: "If clock sequence is given, it is used as the sequence number. " "Otherwise a random 14-bit number is chosen." ), - default_value=None, + default_value="", ), ], ) @@ -253,8 +253,8 @@ class UUID6(TransformPlugin): def __init__( self, - node: str | None, - clock_seq: str | None, + node: str, + clock_seq: str, ): self.node = node_to_int(node) if node else None self.clock_seq = clock_seq_to_int(clock_seq) if clock_seq else None diff --git a/cmem_plugin_uuid/utils.py b/cmem_plugin_uuid/utils.py index 31d0b42..c648143 100644 --- a/cmem_plugin_uuid/utils.py +++ b/cmem_plugin_uuid/utils.py @@ -79,8 +79,8 @@ def namespace_hex(value: str, uuid_version: int) -> str | None: def get_namespace_uuid( namespace_as_uuid: bool | None, - namespace: str | None, - uuid_version: int | None, + namespace: str, + uuid_version: int, ) -> uuid.UUID | None: """Return namespace UUID""" namespace_uuid = None diff --git a/tests/test_uuid.py b/tests/test_uuid.py index 5b78487..aa06ee3 100644 --- a/tests/test_uuid.py +++ b/tests/test_uuid.py @@ -23,8 +23,8 @@ def test_uuid1_without_input() -> None: """Test UUID1 without input""" result = UUID1( - node=None, - clock_seq=None, + node="", + clock_seq="", ).transform(inputs=[]) assert len(result) == 1 for item in result: @@ -35,8 +35,8 @@ def test_uuid1_with_value_input() -> None: """Test UUID1 with value input""" input_values = [["input1"], ["input2"]] result = UUID1( - node=None, - clock_seq=None, + node="", + clock_seq="", ).transform(inputs=input_values) assert len(result) == 2 # noqa: PLR2004 for item in result: @@ -325,8 +325,8 @@ def test_uuid5_with_empty_namespace() -> None: def test_uuid6_without_input() -> None: """Test UUID6 without input""" result = UUID6( - node=None, - clock_seq=None, + node="", + clock_seq="", ).transform(inputs=[]) assert len(result) == 1 for item in result: @@ -337,8 +337,8 @@ def test_uuid6_with_value_input() -> None: """Test UUID6 with value input""" input_values = [["input1"], ["input2"]] result = UUID6( - node=None, - clock_seq=None, + node="", + clock_seq="", ).transform(inputs=input_values) assert len(result) == 2 # noqa: PLR2004 for item in result: