MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / match

Method match

preprocessor/docopt.py:112–130  ·  view source on GitHub ↗
(self, left, collected=None)

Source from the content-addressed store, hash-verified

110 return [self] if not types or type(self) in types else []
111
112 def match(self, left, collected=None):
113 collected = [] if collected is None else collected
114 pos, match = self.single_match(left)
115 if match is None:
116 return False, left, collected
117 left_ = left[:pos] + left[pos + 1:]
118 same_name = [a for a in collected if a.name == self.name]
119 if type(self.value) in (int, list):
120 if type(self.value) is int:
121 increment = 1
122 else:
123 increment = ([match.value] if type(match.value) is str
124 else match.value)
125 if not same_name:
126 match.value = increment
127 return True, left_, collected + [match]
128 same_name[0].value += increment
129 return True, left_, collected
130 return True, left_, collected + [match]
131
132
133class BranchPattern(Pattern):

Callers

nothing calls this directly

Calls 1

single_matchMethod · 0.45

Tested by

no test coverage detected