Skip to content

Commit

Permalink
fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
msaipraneeth committed Jan 15, 2024
1 parent c342074 commit 93ae432
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions cmem_plugin_uuid/transform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -107,7 +107,7 @@ class UUID3(TransformPlugin):

def __init__(
self,
namespace: str | None,
namespace: str,
namespace_as_uuid: bool | None,
):
self.namespace = namespace
Expand All @@ -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
Expand Down Expand Up @@ -187,7 +187,7 @@ class UUID5(TransformPlugin):

def __init__(
self,
namespace: str | None,
namespace: str,
namespace_as_uuid: bool | None,
):
self.namespace = namespace
Expand All @@ -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
Expand All @@ -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",
Expand All @@ -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="",
),
],
)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmem_plugin_uuid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions tests/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 93ae432

Please sign in to comment.