MCPcopy
hub / github.com/docopt/docopt / parse

Method parse

docopt.py:195–209  ·  view source on GitHub ↗
(class_, option_description)

Source from the content-addressed store, hash-verified

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

Callers 2

parse_defaultsFunction · 0.45
test_optionFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_optionFunction · 0.36