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

Method parse

preprocessor/docopt.py:188–202  ·  view source on GitHub ↗
(class_, option_description)

Source from the content-addressed store, hash-verified

186
187 @classmethod
188 def parse(class_, option_description):
189 short, long, argcount, value = None, None, 0, False
190 options, _, description = option_description.strip().partition(' ')
191 options = options.replace(',', ' ').replace('=', ' ')
192 for s in options.split():
193 if s.startswith('--'):
194 long = s
195 elif s.startswith('-'):
196 short = s
197 else:
198 argcount = 1
199 if argcount:
200 matched = re.findall('\[default: (.*)\]', description, flags=re.I)
201 value = matched[0] if matched else None
202 return class_(short, long, argcount, value)
203
204 def single_match(self, left):
205 for n, pattern in enumerate(left):

Callers 1

parse_defaultsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected