iker-python-common 1.0.35__tar.gz → 1.0.37__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/PKG-INFO +1 -1
  2. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/argutils.py +41 -40
  3. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/dockerutils.py +2 -2
  4. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/retry.py +4 -5
  5. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/s3utils.py +2 -2
  6. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/testutils.py +2 -2
  7. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/PKG-INFO +1 -1
  8. iker_python_common-1.0.37/test/iker_tests/common/utils/argutils_test.py +565 -0
  9. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/csv_test.py +0 -1
  10. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/dockerutils_test.py +32 -17
  11. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/dtutils_test.py +16 -8
  12. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/funcutils_test.py +2 -2
  13. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/jsonutils_test.py +32 -20
  14. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/numutils_test.py +68 -35
  15. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/randutils_test.py +8 -4
  16. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/retry_test.py +36 -19
  17. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/s3utils_test.py +12 -6
  18. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/sequtils_test.py +201 -101
  19. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/shutils_test.py +36 -19
  20. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/span_test.py +17 -9
  21. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/strutils_test.py +48 -25
  22. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/testutils_test.py +6 -6
  23. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/typeutils_test.py +8 -5
  24. iker_python_common-1.0.35/test/iker_tests/common/utils/argutils_test.py +0 -257
  25. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/.editorconfig +0 -0
  26. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/.github/workflows/pr.yml +0 -0
  27. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/.github/workflows/push.yml +0 -0
  28. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/.gitignore +0 -0
  29. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/MANIFEST.in +0 -0
  30. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/README.md +0 -0
  31. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/VERSION +0 -0
  32. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/pyproject.toml +0 -0
  33. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/config/config.cfg +0 -0
  34. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/csv/data.csv +0 -0
  35. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/csv/data.tsv +0 -0
  36. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.baz/file.bar.baz +0 -0
  37. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.baz/file.foo.bar +0 -0
  38. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.baz/file.foo.baz +0 -0
  39. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
  40. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
  41. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
  42. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
  43. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/file.bar +0 -0
  44. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/file.baz +0 -0
  45. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/s3utils/dir.foo/file.foo +0 -0
  46. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.baz/file.bar.baz +0 -0
  47. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.baz/file.foo.bar +0 -0
  48. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.baz/file.foo.baz +0 -0
  49. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
  50. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
  51. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
  52. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
  53. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/file.bar +0 -0
  54. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/file.baz +0 -0
  55. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/resources/unittest/shutils/dir.foo/file.foo +0 -0
  56. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/setup.cfg +0 -0
  57. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/setup.py +0 -0
  58. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/__init__.py +0 -0
  59. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/__init__.py +0 -0
  60. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/config.py +0 -0
  61. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/csv.py +0 -0
  62. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/dbutils.py +0 -0
  63. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/dtutils.py +0 -0
  64. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/funcutils.py +0 -0
  65. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/jsonutils.py +0 -0
  66. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/logger.py +0 -0
  67. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/numutils.py +0 -0
  68. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/randutils.py +0 -0
  69. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/sequtils.py +0 -0
  70. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/shutils.py +0 -0
  71. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/span.py +0 -0
  72. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/strutils.py +0 -0
  73. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker/common/utils/typeutils.py +0 -0
  74. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/SOURCES.txt +0 -0
  75. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/dependency_links.txt +0 -0
  76. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/not-zip-safe +0 -0
  77. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/requires.txt +0 -0
  78. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/src/iker_python_common.egg-info/top_level.txt +0 -0
  79. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_test.py +0 -0
  80. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/__init__.py +0 -0
  81. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/config_test.py +0 -0
  82. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/dbutils_test.py +0 -0
  83. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/common/utils/logger_test.py +0 -0
  84. {iker_python_common-1.0.35 → iker_python_common-1.0.37}/test/iker_tests/docker_fixtures.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iker-python-common
3
- Version: 1.0.35
3
+ Version: 1.0.37
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -1,7 +1,8 @@
1
1
  import argparse
2
+ import dataclasses
2
3
  import inspect
4
+ import typing
3
5
  from collections.abc import Sequence
4
- from dataclasses import dataclass
5
6
  from typing import Any
6
7
 
7
8
  from iker.common.utils.typeutils import is_identical_type, type_origin
@@ -90,17 +91,29 @@ class ParserTree(object):
90
91
  return list(command for _, command in sorted(command_pairs)), namespace
91
92
 
92
93
 
93
- @dataclass(frozen=True)
94
+ @dataclasses.dataclass(frozen=True)
94
95
  class ArgParseSpec(object):
95
96
  flag: str | None = None
96
97
  name: str | None = None
97
98
  action: str | None = None
98
99
  default: Any = None
99
- type: type = None
100
+ type: typing.Type | None = None
100
101
  choices: list[Any] | None = None
101
102
  required: bool | None = None
102
103
  help: str | None = None
103
104
 
105
+ def make_kwargs(self) -> dict[str, Any]:
106
+ kwargs = dict(
107
+ action=self.action,
108
+ default=self.default,
109
+ type=self.type,
110
+ choices=self.choices,
111
+ required=self.required,
112
+ help=self.help,
113
+ )
114
+
115
+ return {key: value for key, value in kwargs.items() if value is not None}
116
+
104
117
 
105
118
  argparse_spec = ArgParseSpec
106
119
 
@@ -115,53 +128,41 @@ def make_argparse(func, parser: argparse.ArgumentParser = None) -> argparse.Argu
115
128
  sig = inspect.signature(func)
116
129
  for name, param in sig.parameters.items():
117
130
 
131
+ arg_name = f"--{name.replace('_', '-')}"
132
+
118
133
  if param.annotation is None:
119
- param_type = str
134
+ arg_type = str
120
135
  elif is_type_of(param.annotation, str, str | None, list[str], Sequence[str]):
121
- param_type = str
136
+ arg_type = str
122
137
  elif is_type_of(param.annotation, int, int | None, list[int], Sequence[int]):
123
- param_type = int
138
+ arg_type = int
124
139
  elif is_type_of(param.annotation, float, float | None, list[float], Sequence[float]):
125
- param_type = float
140
+ arg_type = float
126
141
  elif is_type_of(param.annotation, bool, bool | None, list[bool], Sequence[bool]):
127
- param_type = bool
142
+ arg_type = bool
128
143
  else:
129
- param_type = str
144
+ arg_type = str
130
145
 
131
- param_action = "append" if type_origin(param.annotation) in {list, Sequence} else None
132
- param_default = None if param.default is inspect.Parameter.empty else param.default
146
+ arg_action = "append" if type_origin(param.annotation) in {list, Sequence} else None
147
+ arg_default = None if param.default is inspect.Parameter.empty else param.default
133
148
 
134
- if not isinstance(param_default, ArgParseSpec):
135
- param_name = f"--{name.replace('_', '-')}"
149
+ if isinstance(arg_default, ArgParseSpec):
150
+ spec = arg_default
151
+ spec = dataclasses.replace(spec,
152
+ name=spec.name or arg_name,
153
+ type=spec.type if spec.type is not None else arg_type,
154
+ action=spec.action if spec.action is not None else arg_action)
136
155
 
137
- parser.add_argument(param_name,
138
- type=param_type,
139
- action=param_action,
140
- required=param_default is None,
141
- default=param_default)
156
+ if spec.flag is None:
157
+ parser.add_argument(spec.name, **spec.make_kwargs())
158
+ else:
159
+ parser.add_argument(spec.flag, spec.name, **spec.make_kwargs())
142
160
 
143
161
  else:
144
- spec = param_default
145
-
146
- param_flag = spec.flag
147
- param_name = spec.name or f"--{name.replace('_', '-')}"
148
- param_type = spec.type if spec.type is not None else param_type
149
- param_action = spec.action if spec.action is not None else param_action
150
-
151
- if param_flag is None:
152
- parser.add_argument(param_name,
153
- type=param_type,
154
- action=param_action,
155
- required=spec.default is None,
156
- default=spec.default,
157
- help=spec.help)
158
- else:
159
- parser.add_argument(param_flag,
160
- param_name,
161
- type=param_type,
162
- action=param_action,
163
- required=spec.default is None,
164
- default=spec.default,
165
- help=spec.help)
162
+ parser.add_argument(arg_name,
163
+ type=arg_type,
164
+ action=arg_action,
165
+ required=arg_default is None,
166
+ default=arg_default)
166
167
 
167
168
  return parser
@@ -1,7 +1,7 @@
1
1
  import contextlib
2
+ import dataclasses
2
3
  import re
3
4
  from collections.abc import Generator, Iterator
4
- from dataclasses import dataclass
5
5
  from typing import Any
6
6
 
7
7
  import docker
@@ -24,7 +24,7 @@ __all__ = [
24
24
  ]
25
25
 
26
26
 
27
- @dataclass
27
+ @dataclasses.dataclass
28
28
  class ImageName(object):
29
29
  registry_host: str | None
30
30
  registry_port: int | None
@@ -1,8 +1,7 @@
1
+ import abc
1
2
  import datetime
2
3
  import random
3
4
  import time
4
- from abc import ABC
5
- from abc import abstractmethod
6
5
 
7
6
  from iker.common.utils import logger
8
7
 
@@ -44,8 +43,8 @@ class Attempt(object):
44
43
  self.last_exception = last_exception
45
44
 
46
45
 
47
- class Retry(ABC):
48
- @abstractmethod
46
+ class Retry(abc.ABC):
47
+ @abc.abstractmethod
49
48
  def on_attempt(self, attempt: Attempt):
50
49
  """
51
50
  Updates the retry state on attempt
@@ -54,7 +53,7 @@ class Retry(ABC):
54
53
  """
55
54
  pass
56
55
 
57
- @abstractmethod
56
+ @abc.abstractmethod
58
57
  def execute(self, *args, **kwargs):
59
58
  pass
60
59
 
@@ -1,10 +1,10 @@
1
1
  import concurrent.futures
2
2
  import contextlib
3
+ import dataclasses
3
4
  import datetime
4
5
  import mimetypes
5
6
  import os
6
7
  import tempfile
7
- from dataclasses import dataclass
8
8
 
9
9
  import boto3
10
10
  from botocore.client import BaseClient
@@ -26,7 +26,7 @@ __all__ = [
26
26
  ]
27
27
 
28
28
 
29
- @dataclass
29
+ @dataclasses.dataclass
30
30
  class S3ObjectMeta(object):
31
31
  key: str
32
32
  last_modified: datetime.datetime
@@ -1,5 +1,5 @@
1
+ import abc
1
2
  import os
2
- from abc import ABC
3
3
  from decimal import Decimal
4
4
  from typing import Any, Protocol
5
5
 
@@ -83,7 +83,7 @@ class MockedCallable(Protocol):
83
83
  def __call__(self, *args, **kwargs) -> None: ...
84
84
 
85
85
 
86
- class CalleeMock(ABC):
86
+ class CalleeMock(abc.ABC):
87
87
 
88
88
  def __init__(self, valuer: MockedCallable | Any):
89
89
  self.calls = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iker-python-common
3
- Version: 1.0.35
3
+ Version: 1.0.37
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12