From 801bcc495b322474f32a78af73ad7453ad1b4b11 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Thu, 25 Jul 2013 23:30:33 -0400 Subject: [PATCH] PEP8 context_matching --- loopy/context_matching.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/loopy/context_matching.py b/loopy/context_matching.py index 0fdf82ba9..6f83982df 100644 --- a/loopy/context_matching.py +++ b/loopy/context_matching.py @@ -26,14 +26,13 @@ THE SOFTWARE. """ - - # {{{ id match objects class AllMatch(object): def __call__(self, identifier, tag): return True + class RegexIdentifierMatch(object): def __init__(self, id_re, tag_re=None): self.id_re = id_re @@ -50,6 +49,7 @@ class RegexIdentifierMatch(object): self.id_re.match(identifier) is not None and self.tag_re.match(tag) is not None) + class AlternativeMatch(object): def __init__(self, matches): self.matches = matches @@ -61,6 +61,7 @@ class AlternativeMatch(object): # }}} + # {{{ single id match parsing def parse_id_match(id_matches): @@ -109,6 +110,7 @@ def parse_id_match(id_matches): # }}} + # {{{ stack match objects # these match from the tail of the stack @@ -116,10 +118,12 @@ def parse_id_match(id_matches): class StackMatchBase(object): pass + class AllStackMatch(StackMatchBase): def __call__(self, stack): return True + class StackIdMatch(StackMatchBase): def __init__(self, id_match, up_match): self.id_match = id_match @@ -138,6 +142,7 @@ class StackIdMatch(StackMatchBase): else: return self.up_match(stack[:-1]) + class StackWildcardMatch(StackMatchBase): def __init__(self, up_match): self.up_match = up_match @@ -159,6 +164,7 @@ class StackWildcardMatch(StackMatchBase): # }}} + # {{{ stack match parsing def parse_stack_match(smatch): @@ -170,7 +176,8 @@ def parse_stack_match(smatch): arbitrary number of intervening stack levels. There is currently no way to match the top of the stack. - Each of the entries is an identifier match as understood by :func:`parse_id_match`. + Each of the entries is an identifier match as understood by + :func:`parse_id_match`. """ if isinstance(smatch, StackMatchBase): -- GitLab