dotted-notation 0.57.1__tar.gz → 0.57.2__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 (51) hide show
  1. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/CHANGELOG.md +9 -0
  2. {dotted_notation-0.57.1/dotted_notation.egg-info → dotted_notation-0.57.2}/PKG-INFO +1 -1
  3. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/base.py +3 -6
  4. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/results.py +0 -12
  5. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/utils.py +27 -0
  6. {dotted_notation-0.57.1 → dotted_notation-0.57.2/dotted_notation.egg-info}/PKG-INFO +1 -1
  7. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/pyproject.toml +1 -1
  8. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/LICENSE +0 -0
  9. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/MANIFEST.in +0 -0
  10. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/README.md +0 -0
  11. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/__init__.py +0 -0
  12. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/__main__.py +0 -0
  13. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/access.pxd +0 -0
  14. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/access.py +0 -0
  15. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/api.py +0 -0
  16. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/base.pxd +0 -0
  17. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/cli/__init__.py +0 -0
  18. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/cli/_compat.py +0 -0
  19. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/cli/formats.py +0 -0
  20. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/cli/main.py +0 -0
  21. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/containers.py +0 -0
  22. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/engine.pxd +0 -0
  23. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/engine.py +0 -0
  24. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/filters.pxd +0 -0
  25. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/filters.py +0 -0
  26. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/grammar.py +0 -0
  27. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/groups.pxd +0 -0
  28. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/groups.py +0 -0
  29. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/matchers.pxd +0 -0
  30. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/matchers.py +0 -0
  31. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/native.py +0 -0
  32. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/predicates.py +0 -0
  33. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/recursive.pxd +0 -0
  34. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/recursive.py +0 -0
  35. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/transforms.py +0 -0
  36. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/__init__.py +0 -0
  37. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/core.py +0 -0
  38. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/spark.py +0 -0
  39. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/spark_pyspark.py +0 -0
  40. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/sql.py +0 -0
  41. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/translators/sql_pg.py +0 -0
  42. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/utypes.py +0 -0
  43. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/wrappers.pxd +0 -0
  44. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted/wrappers.py +0 -0
  45. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted_notation.egg-info/SOURCES.txt +0 -0
  46. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted_notation.egg-info/dependency_links.txt +0 -0
  47. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted_notation.egg-info/entry_points.txt +0 -0
  48. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted_notation.egg-info/requires.txt +0 -0
  49. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/dotted_notation.egg-info/top_level.txt +0 -0
  50. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/setup.cfg +0 -0
  51. {dotted_notation-0.57.1 → dotted_notation-0.57.2}/setup.py +0 -0
@@ -3,6 +3,15 @@
3
3
  All notable changes to `dotted` are recorded here. Versions prior to
4
4
  the ones listed are omitted — browse git history for earlier entries.
5
5
 
6
+ ## [0.57.2]
7
+
8
+ ### Fixed
9
+ - A list, set or dict bound to a substitution no longer raises
10
+ `TypeError: unhashable type` when the path is parsed: `a=$(b)`
11
+ compares with the bound list, and `a|in:$(b)=True` tests containment
12
+ in it, or in a bound dict's keys, which need not sort against each
13
+ other.
14
+
6
15
  ## [0.57.1]
7
16
 
8
17
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotted_notation
3
- Version: 0.57.1
3
+ Version: 0.57.2
4
4
  Summary: Dotted notation for safe nested data traversal with optional chaining, pattern matching, and transforms
5
5
  Author-email: Frey Waid <logophage1@gmail.com>
6
6
  License-Expression: MIT
@@ -4,6 +4,7 @@ Base classes, sentinels, and infrastructure for the dotted element system.
4
4
  import collections
5
5
  import pyparsing as pp
6
6
 
7
+ from . import utils
7
8
  from .utypes import marker, ANY, BRANCH_CUT, BRANCH_SOFTCUT, resolve_types # noqa: F401
8
9
 
9
10
 
@@ -133,7 +134,7 @@ class Op:
133
134
  def __repr__(self):
134
135
  return f'{self.__class__.__name__}:{self.args}'
135
136
  def __hash__(self):
136
- return hash(self.args)
137
+ return utils.hash_of(self.args)
137
138
  def __eq__(self, op):
138
139
  return self.__class__ == op.__class__ and self.args == op.args
139
140
  def resolve(self, bindings, partial=False):
@@ -690,11 +691,7 @@ class Transform(Op):
690
691
  return self.operator()
691
692
 
692
693
  def __hash__(self):
693
- try:
694
- return hash(('transform', self.name, self.params))
695
- except TypeError:
696
- from .results import Dotted
697
- return hash(('transform', self.name, Dotted._hashable(self.params)))
694
+ return utils.hash_of(('transform', self.name, self.params))
698
695
 
699
696
  def __eq__(self, other):
700
697
  return (isinstance(other, Transform)
@@ -91,18 +91,6 @@ class Dotted:
91
91
  return ''.join(parts), Dotted({'ops': self.ops[:-1]})
92
92
  def __repr__(self):
93
93
  return f'{self.__class__.__name__}({list(self.ops)})'
94
- @staticmethod
95
- def _hashable(obj):
96
- """
97
- Recursively convert unhashable types to hashable equivalents.
98
- """
99
- if utils.is_list_like(obj):
100
- return tuple(Dotted._hashable(x) for x in obj)
101
- if utils.is_set_like(obj):
102
- return frozenset(Dotted._hashable(x) for x in obj)
103
- if utils.is_dict_like(obj):
104
- return tuple(sorted((k, Dotted._hashable(v)) for k, v in utils.mapping_entries(obj)))
105
- return obj
106
94
  def __hash__(self):
107
95
  if self._hash is None:
108
96
  # not hash(self.ops): a Dotted must not collide with its own ops tuple
@@ -189,6 +189,33 @@ def mapping_entries(node):
189
189
  return ((k, node[k]) for k in node)
190
190
 
191
191
 
192
+ def hashable(obj):
193
+ """
194
+ obj with its unhashable containers, at any depth, swapped for hashable
195
+ ones: a list-like for a tuple, a set-like for a frozenset, a dict-like
196
+ for a frozenset of its entries, which no more depends on their order
197
+ than the dict does and asks nothing of its keys but a hash.
198
+ """
199
+ if is_list_like(obj):
200
+ return tuple(hashable(x) for x in obj)
201
+ if is_set_like(obj):
202
+ return frozenset(hashable(x) for x in obj)
203
+ if is_dict_like(obj):
204
+ return frozenset((k, hashable(v)) for k, v in mapping_entries(obj))
205
+ return obj
206
+
207
+
208
+ def hash_of(obj):
209
+ """
210
+ The hash of obj, or of hashable(obj) when obj holds something
211
+ unhashable, such as a list bound to a substitution.
212
+ """
213
+ try:
214
+ return hash(obj)
215
+ except TypeError:
216
+ return hash(hashable(obj))
217
+
218
+
192
219
  def entries(node):
193
220
  """
194
221
  node as a lazy stream of (key, value) entries, by its interface, or
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotted_notation
3
- Version: 0.57.1
3
+ Version: 0.57.2
4
4
  Summary: Dotted notation for safe nested data traversal with optional chaining, pattern matching, and transforms
5
5
  Author-email: Frey Waid <logophage1@gmail.com>
6
6
  License-Expression: MIT
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "dotted_notation"
9
- version = "0.57.1"
9
+ version = "0.57.2"
10
10
  description = "Dotted notation for safe nested data traversal with optional chaining, pattern matching, and transforms"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.6"