j-perm 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
j_perm/ops/distinct.py CHANGED
@@ -20,11 +20,19 @@ def op_distinct(
20
20
  if not isinstance(lst, list):
21
21
  raise TypeError(f"{path} is not a list (distinct)")
22
22
 
23
+ key = step.get("key", None)
24
+ key_path = substitute(key, src)
25
+
23
26
  seen = set()
24
27
  unique = []
25
28
  for item in lst:
26
- if item not in seen:
27
- seen.add(item)
29
+ if key is not None:
30
+ filter_item = jptr_get(item, key_path)
31
+ else:
32
+ filter_item = item
33
+
34
+ if filter_item not in seen:
35
+ seen.add(filter_item)
28
36
  unique.append(item)
29
37
 
30
38
  lst[:] = unique
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: j-perm
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: jsom permutation library
5
5
  Author-email: Roman <kuschanow@gmail.com>
6
6
  License: MIT
@@ -43,7 +43,7 @@ built-in operations.
43
43
  ## Basic usage
44
44
 
45
45
  ```python
46
- from json_patch_applier import apply_actions
46
+ from j_perm import apply_actions
47
47
 
48
48
  source = {
49
49
  "users": [
@@ -90,7 +90,7 @@ result = apply_actions(actions, dest={}, source=source)
90
90
  ## Schema generation
91
91
 
92
92
  ```python
93
- from json_patch_applier import build_schema
93
+ from j_perm import build_schema
94
94
 
95
95
  schema = build_schema(script)
96
96
  ```
@@ -101,7 +101,7 @@ validation or introspection.
101
101
  ## Extending with custom operations
102
102
 
103
103
  ```python
104
- from json_patch_applier import register_op
104
+ from j_perm import register_op
105
105
 
106
106
  @register_op("my_op")
107
107
  def my_op(step, dest, src):
@@ -9,7 +9,7 @@ j_perm/ops/assert.py,sha256=p-wu1wcoPzrgT1VtKSoQAd8ff06unz-gvaETPGW3cB0,735
9
9
  j_perm/ops/copy.py,sha256=7cKQrRci31MxbVX7nuDGpuQDytTQ1rTF5RoL1FV2wlg,1068
10
10
  j_perm/ops/copy_d.py,sha256=kzzOCqOpVvEeNZ-ypIi7r__ei13E0aOQsLDi0QkDxuY,975
11
11
  j_perm/ops/delete.py,sha256=j4VZ-cnc_Txg7lgkJgJcQV9YDRIIXlTge9lRi03gPQk,893
12
- j_perm/ops/distinct.py,sha256=XrxdnACyBwGQknWJM9_ckxmQE6guTYIUkdo-kB3eHbA,786
12
+ j_perm/ops/distinct.py,sha256=U8BO14Nf5wLE19hR7-oNQuv2rWHTv7QKkViXfNn561E,994
13
13
  j_perm/ops/foreach.py,sha256=EYNiM2zpxOLvX5W23ajIHrBOpbqNdV4256EAUdac_es,1442
14
14
  j_perm/ops/replace_root.py,sha256=pUreYnQDC6jekLZMnDsRx1MsBVsKzWX-KMea5jHHqts,475
15
15
  j_perm/ops/set.py,sha256=27CdeSoQRP2hNqTXWMvFMqxEj3BISOX7iySZdLftxHs,1869
@@ -20,7 +20,7 @@ j_perm/utils/pointers.py,sha256=X1HSCag4t-qq5zTvBMRAlBKXwpHVNNZYJrdJRtyEr4g,2788
20
20
  j_perm/utils/special.py,sha256=KhKgrmR_pRyIbMubtV-62nNPzoLIMbxVBGpOPZQTTlA,1221
21
21
  j_perm/utils/subst.py,sha256=hPLtqgaRTzJmvDGuQxM9VnIMCKK08IAWo_gfhogb57s,4077
22
22
  j_perm/utils/tuples.py,sha256=0XsMId9J2T7MxtmpWQaNnbmxhileTs8Xm_vSPICkxNI,469
23
- j_perm-0.1.2.dist-info/METADATA,sha256=Dm-Hb_pjHubNY-JxhZZIpt8_J_EwhmiyVUG469Ej0KU,3205
24
- j_perm-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- j_perm-0.1.2.dist-info/top_level.txt,sha256=yveBxREqVn9DliNwmen1QWoxR0uta7bU5giS1CCffRI,7
26
- j_perm-0.1.2.dist-info/RECORD,,
23
+ j_perm-0.1.3.dist-info/METADATA,sha256=nQqj6jp30FxhTi39rghOfOYGU2gvuSR5bvxrE1p_81U,3169
24
+ j_perm-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ j_perm-0.1.3.dist-info/top_level.txt,sha256=yveBxREqVn9DliNwmen1QWoxR0uta7bU5giS1CCffRI,7
26
+ j_perm-0.1.3.dist-info/RECORD,,
File without changes