Skip to content

Commit

Permalink
"result =" instead of "result +=" when no input value, replaced OSErr…
Browse files Browse the repository at this point in the history
…or with ValueError for missing input value"
  • Loading branch information
muddymudskipper committed Jan 30, 2024
1 parent 4b7aaef commit 83558c0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cmem_plugin_uuid/transform/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""UUID6 transform plugin module"""
"""UUID transform plugin module"""
import re
import uuid
from collections.abc import Sequence
Expand Down Expand Up @@ -70,7 +70,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
str(uuid.uuid1(node=self.node, clock_seq=self.clock_seq)) for _ in collection
]
else:
result += [str(uuid.uuid1(node=self.node, clock_seq=self.clock_seq))]
result = [str(uuid.uuid1(node=self.node, clock_seq=self.clock_seq))]
return result


Expand Down Expand Up @@ -130,7 +130,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
else:
result += [str(uuid.uuid3(namespace_uuid, _))] # type: ignore[arg-type]
else:
raise OSError("No input for UUID3")
raise ValueError("No input for UUID3")
return result


Expand All @@ -150,7 +150,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
for collection in inputs:
result += [str(uuid.uuid4()) for _ in collection]
else:
result += [str(uuid.uuid4())]
result = [str(uuid.uuid4())]
return result


Expand Down Expand Up @@ -210,7 +210,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
else:
result += [str(uuid.uuid5(namespace_uuid, _))] # type: ignore[arg-type]
else:
raise OSError("No input for UUID5")
raise ValueError("No input for UUID5")
return result


Expand Down Expand Up @@ -268,7 +268,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
str(uuid6.uuid6(node=self.node, clock_seq=self.clock_seq)) for _ in collection
]
else:
result += [str(uuid6.uuid6(node=self.node, clock_seq=self.clock_seq))]
result = [str(uuid6.uuid6(node=self.node, clock_seq=self.clock_seq))]
return result


Expand Down Expand Up @@ -297,7 +297,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
except ValueError as exc:
raise ValueError(f"{_} is not a valid UUIDv1 string") from exc
else:
raise OSError("No input for UUID1 to UUID6")
raise ValueError("No input for UUID1 to UUID6")
return result


Expand All @@ -324,7 +324,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
for collection in inputs:
result += [str(uuid6.uuid7()) for _ in collection]
else:
result += [str(uuid6.uuid7())]
result = [str(uuid6.uuid7())]
return result


Expand All @@ -348,7 +348,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
for collection in inputs:
result += [str(uuid6.uuid8()) for _ in collection]
else:
result += [str(uuid6.uuid8())]
result = [str(uuid6.uuid8())]
return result


Expand Down Expand Up @@ -440,7 +440,7 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
for collection in inputs:
result += [self.convert_uuid(_) for _ in collection]
else:
raise OSError("No input for UUID Convert")
raise ValueError("No input for UUID Convert")
return result


Expand All @@ -460,5 +460,5 @@ def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]:
for collection in inputs:
result += [str(uuid.UUID(_).version) for _ in collection]
else:
raise OSError("No input for UUID Version")
raise ValueError("No input for UUID Version")
return result

0 comments on commit 83558c0

Please sign in to comment.