iker-python-common 1.0.45__tar.gz → 1.0.46__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 (83) hide show
  1. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/PKG-INFO +1 -1
  2. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/sequtils.py +12 -0
  3. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/PKG-INFO +1 -1
  4. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/sequtils_test.py +120 -4
  5. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/.editorconfig +0 -0
  6. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/.github/workflows/pr.yml +0 -0
  7. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/.github/workflows/push.yml +0 -0
  8. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/.gitignore +0 -0
  9. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/MANIFEST.in +0 -0
  10. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/README.md +0 -0
  11. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/VERSION +0 -0
  12. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/pyproject.toml +0 -0
  13. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/config/config.cfg +0 -0
  14. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/csv/data.csv +0 -0
  15. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/csv/data.tsv +0 -0
  16. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.baz/file.bar.baz +0 -0
  17. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.baz/file.foo.bar +0 -0
  18. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.baz/file.foo.baz +0 -0
  19. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
  20. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
  21. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
  22. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
  23. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/file.bar +0 -0
  24. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/file.baz +0 -0
  25. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/s3utils/dir.foo/file.foo +0 -0
  26. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.baz/file.bar.baz +0 -0
  27. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.baz/file.foo.bar +0 -0
  28. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.baz/file.foo.baz +0 -0
  29. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
  30. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
  31. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
  32. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
  33. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/file.bar +0 -0
  34. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/file.baz +0 -0
  35. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/resources/unittest/shutils/dir.foo/file.foo +0 -0
  36. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/setup.cfg +0 -0
  37. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/setup.py +0 -0
  38. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/__init__.py +0 -0
  39. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/__init__.py +0 -0
  40. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/argutils.py +0 -0
  41. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/config.py +0 -0
  42. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/csv.py +0 -0
  43. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/dbutils.py +0 -0
  44. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/dockerutils.py +0 -0
  45. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/dtutils.py +0 -0
  46. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/funcutils.py +0 -0
  47. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/jsonutils.py +0 -0
  48. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/logger.py +0 -0
  49. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/numutils.py +0 -0
  50. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/randutils.py +0 -0
  51. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/retry.py +0 -0
  52. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/s3utils.py +0 -0
  53. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/shutils.py +0 -0
  54. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/span.py +0 -0
  55. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/strutils.py +0 -0
  56. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/testutils.py +0 -0
  57. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker/common/utils/typeutils.py +0 -0
  58. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/SOURCES.txt +0 -0
  59. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/dependency_links.txt +0 -0
  60. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/not-zip-safe +0 -0
  61. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/requires.txt +0 -0
  62. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/src/iker_python_common.egg-info/top_level.txt +0 -0
  63. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_test.py +0 -0
  64. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/__init__.py +0 -0
  65. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/argutils_test.py +0 -0
  66. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/config_test.py +0 -0
  67. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/csv_test.py +0 -0
  68. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/dbutils_test.py +0 -0
  69. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/dockerutils_test.py +0 -0
  70. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/dtutils_test.py +0 -0
  71. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/funcutils_test.py +0 -0
  72. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/jsonutils_test.py +0 -0
  73. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/logger_test.py +0 -0
  74. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/numutils_test.py +0 -0
  75. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/randutils_test.py +0 -0
  76. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/retry_test.py +0 -0
  77. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/s3utils_test.py +0 -0
  78. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/shutils_test.py +0 -0
  79. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/span_test.py +0 -0
  80. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/strutils_test.py +0 -0
  81. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/testutils_test.py +0 -0
  82. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/test/iker_tests/common/utils/typeutils_test.py +0 -0
  83. {iker_python_common-1.0.45 → iker_python_common-1.0.46}/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.45
3
+ Version: 1.0.46
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -558,6 +558,18 @@ class Seq(Generic[Tco], Sequence[Tco], Sized):
558
558
  def concat(self: SeqT, other: SeqT) -> SeqT:
559
559
  return type(self)(itertools.chain(self.data, other.data))
560
560
 
561
+ def pad_left(self: SeqT, n: int, value: Tco) -> SeqT:
562
+ return self if n <= 0 else type(self)(itertools.repeat(value, n)).concat(self)
563
+
564
+ def pad_right(self: SeqT, n: int, value: Tco) -> SeqT:
565
+ return self if n <= 0 else self.concat(type(self)(itertools.repeat(value, n)))
566
+
567
+ def pad_left_head(self: SeqT, n: int) -> SeqT:
568
+ return self if self.empty else self.pad_left(n, head(self.data))
569
+
570
+ def pad_right_last(self: SeqT, n: int) -> SeqT:
571
+ return self if self.empty else self.pad_right(n, last(self.data))
572
+
561
573
  def take_left(self: SeqT, n: int) -> SeqT:
562
574
  if n <= 0:
563
575
  return type(self)([])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iker-python-common
3
- Version: 1.0.45
3
+ Version: 1.0.46
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -1108,6 +1108,106 @@ class SeqTest(unittest.TestCase):
1108
1108
  actual = seq(data).count_if(func)
1109
1109
  self.assertEqual(actual, expect)
1110
1110
 
1111
+ data_pad_left = [
1112
+ ([], 0, -1, []),
1113
+ ([], -1, -1, []),
1114
+ ([], 1, -1, [-1]),
1115
+ ([], 5, -1, [-1, -1, -1, -1, -1]),
1116
+ ([0], 0, -1, [0]),
1117
+ ([0], -1, -1, [0]),
1118
+ ([0], 1, -1, [-1, 0]),
1119
+ ([0], 5, -1, [-1, -1, -1, -1, -1, 0]),
1120
+ ([0, 0, 0], 0, -1, [0, 0, 0]),
1121
+ ([0, 0, 0], -1, -1, [0, 0, 0]),
1122
+ ([0, 0, 0], 1, -1, [-1, 0, 0, 0]),
1123
+ ([0, 0, 0], 5, -1, [-1, -1, -1, -1, -1, 0, 0, 0]),
1124
+ ([1, 2, 3, 4, 5], 0, -1, [1, 2, 3, 4, 5]),
1125
+ ([1, 2, 3, 4, 5], -1, -1, [1, 2, 3, 4, 5]),
1126
+ ([1, 2, 3, 4, 5], 1, -1, [-1, 1, 2, 3, 4, 5]),
1127
+ ([1, 2, 3, 4, 5], 5, -1, [-1, -1, -1, -1, -1, 1, 2, 3, 4, 5]),
1128
+ ]
1129
+
1130
+ @ddt.idata(data_pad_left)
1131
+ @ddt.unpack
1132
+ def test_pad_left(self, data, n, value, expect):
1133
+ actual = seq(data).pad_left(n, value)
1134
+ self.assertEqual(actual.data, expect)
1135
+
1136
+ data_pad_right = [
1137
+ ([], 0, -1, []),
1138
+ ([], -1, -1, []),
1139
+ ([], 1, -1, [-1]),
1140
+ ([], 5, -1, [-1, -1, -1, -1, -1]),
1141
+ ([0], 0, -1, [0]),
1142
+ ([0], -1, -1, [0]),
1143
+ ([0], 1, -1, [0, -1]),
1144
+ ([0], 5, -1, [0, -1, -1, -1, -1, -1]),
1145
+ ([0, 0, 0], 0, -1, [0, 0, 0]),
1146
+ ([0, 0, 0], -1, -1, [0, 0, 0]),
1147
+ ([0, 0, 0], 1, -1, [0, 0, 0, -1]),
1148
+ ([0, 0, 0], 5, -1, [0, 0, 0, -1, -1, -1, -1, -1]),
1149
+ ([1, 2, 3, 4, 5], 0, -1, [1, 2, 3, 4, 5]),
1150
+ ([1, 2, 3, 4, 5], -1, -1, [1, 2, 3, 4, 5]),
1151
+ ([1, 2, 3, 4, 5], 1, -1, [1, 2, 3, 4, 5, -1]),
1152
+ ([1, 2, 3, 4, 5], 5, -1, [1, 2, 3, 4, 5, -1, -1, -1, -1, -1]),
1153
+ ]
1154
+
1155
+ @ddt.idata(data_pad_right)
1156
+ @ddt.unpack
1157
+ def test_pad_right(self, data, n, value, expect):
1158
+ actual = seq(data).pad_right(n, value)
1159
+ self.assertEqual(actual.data, expect)
1160
+
1161
+ data_pad_left_head = [
1162
+ ([], 0, []),
1163
+ ([], -1, []),
1164
+ ([], 1, []),
1165
+ ([], 5, []),
1166
+ ([0], 0, [0]),
1167
+ ([0], -1, [0]),
1168
+ ([0], 1, [0, 0]),
1169
+ ([0], 5, [0, 0, 0, 0, 0, 0]),
1170
+ ([0, 0, 0], 0, [0, 0, 0]),
1171
+ ([0, 0, 0], -1, [0, 0, 0]),
1172
+ ([0, 0, 0], 1, [0, 0, 0, 0]),
1173
+ ([0, 0, 0], 5, [0, 0, 0, 0, 0, 0, 0, 0]),
1174
+ ([1, 2, 3, 4, 5], 0, [1, 2, 3, 4, 5]),
1175
+ ([1, 2, 3, 4, 5], -1, [1, 2, 3, 4, 5]),
1176
+ ([1, 2, 3, 4, 5], 1, [1, 1, 2, 3, 4, 5]),
1177
+ ([1, 2, 3, 4, 5], 5, [1, 1, 1, 1, 1, 1, 2, 3, 4, 5]),
1178
+ ]
1179
+
1180
+ @ddt.idata(data_pad_left_head)
1181
+ @ddt.unpack
1182
+ def test_pad_left_head(self, data, n, expect):
1183
+ actual = seq(data).pad_left_head(n)
1184
+ self.assertEqual(actual.data, expect)
1185
+
1186
+ data_pad_right_last = [
1187
+ ([], 0, []),
1188
+ ([], -1, []),
1189
+ ([], 1, []),
1190
+ ([], 5, []),
1191
+ ([0], 0, [0]),
1192
+ ([0], -1, [0]),
1193
+ ([0], 1, [0, 0]),
1194
+ ([0], 5, [0, 0, 0, 0, 0, 0]),
1195
+ ([0, 0, 0], 0, [0, 0, 0]),
1196
+ ([0, 0, 0], -1, [0, 0, 0]),
1197
+ ([0, 0, 0], 1, [0, 0, 0, 0]),
1198
+ ([0, 0, 0], 5, [0, 0, 0, 0, 0, 0, 0, 0]),
1199
+ ([1, 2, 3, 4, 5], 0, [1, 2, 3, 4, 5]),
1200
+ ([1, 2, 3, 4, 5], -1, [1, 2, 3, 4, 5]),
1201
+ ([1, 2, 3, 4, 5], 1, [1, 2, 3, 4, 5, 5]),
1202
+ ([1, 2, 3, 4, 5], 5, [1, 2, 3, 4, 5, 5, 5, 5, 5, 5]),
1203
+ ]
1204
+
1205
+ @ddt.idata(data_pad_right_last)
1206
+ @ddt.unpack
1207
+ def test_pad_right_last(self, data, n, expect):
1208
+ actual = seq(data).pad_right_last(n)
1209
+ self.assertEqual(actual.data, expect)
1210
+
1111
1211
  data_take_left = [
1112
1212
  ([], 0, []),
1113
1213
  ([], 1, []),
@@ -1299,8 +1399,16 @@ class SeqTest(unittest.TestCase):
1299
1399
  lambda xs: "".join(xs),
1300
1400
  (True, True),
1301
1401
  ["1", "12", "123", "234", "345", "45", "5"]),
1302
- (["1", "2", "3", "4", "5"], 3, lambda xs: "".join(xs), (True, False), ["1", "12", "123", "234", "345"]),
1303
- (["1", "2", "3", "4", "5"], 3, lambda xs: "".join(xs), (False, True), ["123", "234", "345", "45", "5"]),
1402
+ (["1", "2", "3", "4", "5"],
1403
+ 3,
1404
+ lambda xs: "".join(xs),
1405
+ (True, False),
1406
+ ["1", "12", "123", "234", "345"]),
1407
+ (["1", "2", "3", "4", "5"],
1408
+ 3,
1409
+ lambda xs: "".join(xs),
1410
+ (False, True),
1411
+ ["123", "234", "345", "45", "5"]),
1304
1412
  (["1", "2", "3", "4", "5"],
1305
1413
  5,
1306
1414
  lambda xs: "".join(xs),
@@ -1466,8 +1574,16 @@ class SeqTest(unittest.TestCase):
1466
1574
  lambda xs: "".join(xs),
1467
1575
  (True, True),
1468
1576
  ["5", "45", "345", "234", "123", "12", "1"]),
1469
- (["1", "2", "3", "4", "5"], 3, lambda xs: "".join(xs), (True, False), ["345", "234", "123", "12", "1"]),
1470
- (["1", "2", "3", "4", "5"], 3, lambda xs: "".join(xs), (False, True), ["5", "45", "345", "234", "123"]),
1577
+ (["1", "2", "3", "4", "5"],
1578
+ 3,
1579
+ lambda xs: "".join(xs),
1580
+ (True, False),
1581
+ ["345", "234", "123", "12", "1"]),
1582
+ (["1", "2", "3", "4", "5"],
1583
+ 3,
1584
+ lambda xs: "".join(xs),
1585
+ (False, True),
1586
+ ["5", "45", "345", "234", "123"]),
1471
1587
  (["1", "2", "3", "4", "5"],
1472
1588
  5,
1473
1589
  lambda xs: "".join(xs),