From 050043576a1b46880983f29496daa142063f12b5 Mon Sep 17 00:00:00 2001 From: aranega Date: Fri, 25 Oct 2024 10:34:58 -0600 Subject: [PATCH] Fix formatting --- iguala/__init__.py | 11 ++++++++++- iguala/matchers.py | 13 +++++++++---- iguala/paths.py | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/iguala/__init__.py b/iguala/__init__.py index 7d8e7f6..6d06b7e 100644 --- a/iguala/__init__.py +++ b/iguala/__init__.py @@ -2,5 +2,14 @@ from .matchers import as_matcher, cond, extended, is_, regex, save_as from .paths import as_path -__ALL__ = ["match", "as_matcher", "as_path", "is_not", "cond", "regex", "extended", "save_as"] +__ALL__ = [ + "match", + "as_matcher", + "as_path", + "is_not", + "cond", + "regex", + "extended", + "save_as", +] __version__ = "0.5.3-dev" diff --git a/iguala/matchers.py b/iguala/matchers.py index edca77a..b81beb5 100644 --- a/iguala/matchers.py +++ b/iguala/matchers.py @@ -38,7 +38,13 @@ def bindings(self): def __getitem__(self, key): if isinstance(key, slice): - return key.step([binding[key.start] for binding in self.bindings if key.start in binding]) + return key.step( + [ + binding[key.start] + for binding in self.bindings + if key.start in binding + ] + ) return [binding[key] for binding in self.bindings if key in binding] def __str__(self): @@ -176,8 +182,7 @@ def match_context(self, obj, context): return [context] -class LogicalMatcher(Matcher): - ... +class LogicalMatcher(Matcher): ... class NotMatcher(Matcher): @@ -603,4 +608,4 @@ def as_matcher(obj): cond = ConditionalMatcher regex = RegexMatcher is_ = IdentityMatcher -save_as = lambda alias: SaveNodeMatcher(alias, None) \ No newline at end of file +save_as = lambda alias: SaveNodeMatcher(alias, None) diff --git a/iguala/paths.py b/iguala/paths.py index f953710..ab92b31 100644 --- a/iguala/paths.py +++ b/iguala/paths.py @@ -148,7 +148,7 @@ def as_path(s, dictkey=False): # return LambdaPath(s) if not isinstance(s, str): return s.as_path() - if s == '_': + if s == "_": return WildcardPath() if s == "*": return ChildrenRecursivePath() @@ -162,6 +162,6 @@ def as_path(s, dictkey=False): NamedRecursivePath(as_path(s[:-1], dictkey=dictkey)), ) ) - if s.startswith('!'): + if s.startswith("!"): return WildcardPath(excluding=[s[1:]]) return dict_cls(s)