/
snap
/
core18
/
2999
/
usr
/
lib
/
python3.6
/
/snap/core18/2999/usr/lib/python3.6
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
0755
rm
distutils/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
html/
-
0755
rm
http/
-
0755
rm
importlib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
lib2to3/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
pydoc_data/
-
0755
rm
sqlite3/
-
0755
rm
test/
-
0755
rm
unittest/
-
0755
rm
urllib/
-
0755
rm
venv/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
xmlrpc/
-
0755
rm
__pycache__/
-
0755
rm
abc.py
8727
0644
edit
dl
rm
aifc.py
32454
0644
edit
dl
rm
antigravity.py
477
0644
edit
dl
rm
argparse.py
90568
0644
edit
dl
rm
ast.py
12166
0644
edit
dl
rm
asynchat.py
11328
0644
edit
dl
rm
asyncore.py
20159
0644
edit
dl
rm
base64.py
20378
0755
edit
dl
rm
bdb.py
23556
0644
edit
dl
rm
binhex.py
13954
0644
edit
dl
rm
bisect.py
2595
0644
edit
dl
rm
bz2.py
12478
0644
edit
dl
rm
calendar.py
23213
0644
edit
dl
rm
cgi.py
36791
0755
edit
dl
rm
cgitb.py
12018
0644
edit
dl
rm
chunk.py
5425
0644
edit
dl
rm
cmd.py
14860
0644
edit
dl
rm
code.py
10614
0644
edit
dl
rm
codecs.py
36276
0644
edit
dl
rm
codeop.py
5994
0644
edit
dl
rm
colorsys.py
4064
0644
edit
dl
rm
compileall.py
12125
0644
edit
dl
rm
configparser.py
53592
0644
edit
dl
rm
contextlib.py
13162
0644
edit
dl
rm
copy.py
8815
0644
edit
dl
rm
copyreg.py
7007
0644
edit
dl
rm
cProfile.py
5370
0755
edit
dl
rm
crypt.py
1864
0644
edit
dl
rm
csv.py
16180
0644
edit
dl
rm
datetime.py
82034
0644
edit
dl
rm
decimal.py
320
0644
edit
dl
rm
difflib.py
84377
0644
edit
dl
rm
dis.py
18132
0644
edit
dl
rm
doctest.py
104391
0644
edit
dl
rm
dummy_threading.py
2815
0644
edit
dl
rm
enum.py
33606
0644
edit
dl
rm
filecmp.py
9830
0644
edit
dl
rm
fileinput.py
14471
0644
edit
dl
rm
fnmatch.py
3166
0644
edit
dl
rm
formatter.py
15143
0644
edit
dl
rm
fractions.py
23639
0644
edit
dl
rm
ftplib.py
35617
0644
edit
dl
rm
functools.py
31346
0644
edit
dl
rm
genericpath.py
4756
0644
edit
dl
rm
getopt.py
7489
0644
edit
dl
rm
getpass.py
5994
0644
edit
dl
rm
gettext.py
21957
0644
edit
dl
rm
glob.py
5638
0644
edit
dl
rm
gzip.py
20334
0644
edit
dl
rm
hashlib.py
9533
0644
edit
dl
rm
heapq.py
22929
0644
edit
dl
rm
hmac.py
5057
0644
edit
dl
rm
imaplib.py
53295
0644
edit
dl
rm
imghdr.py
3795
0644
edit
dl
rm
imp.py
10669
0644
edit
dl
rm
inspect.py
116958
0644
edit
dl
rm
io.py
3517
0644
edit
dl
rm
ipaddress.py
74563
0644
edit
dl
rm
keyword.py
2209
0755
edit
dl
rm
LICENSE.txt
12769
0644
edit
dl
rm
linecache.py
5312
0644
edit
dl
rm
locale.py
77304
0644
edit
dl
rm
lzma.py
12983
0644
edit
dl
rm
macpath.py
5971
0644
edit
dl
rm
macurl2path.py
2732
0644
edit
dl
rm
mailbox.py
78624
0644
edit
dl
rm
mailcap.py
9067
0644
edit
dl
rm
mimetypes.py
21042
0644
edit
dl
rm
modulefinder.py
23027
0644
edit
dl
rm
netrc.py
5684
0644
edit
dl
rm
nntplib.py
43078
0644
edit
dl
rm
ntpath.py
21174
0644
edit
dl
rm
nturl2path.py
2444
0644
edit
dl
rm
numbers.py
10243
0644
edit
dl
rm
opcode.py
5822
0644
edit
dl
rm
operator.py
10863
0644
edit
dl
rm
optparse.py
60371
0644
edit
dl
rm
os.py
37526
0644
edit
dl
rm
pathlib.py
48982
0644
edit
dl
rm
pdb.py
61310
0755
edit
dl
rm
pickle.py
55691
0644
edit
dl
rm
pickletools.py
91775
0644
edit
dl
rm
pipes.py
8916
0644
edit
dl
rm
pkgutil.py
21315
0644
edit
dl
rm
platform.py
48198
0755
edit
dl
rm
plistlib.py
32787
0644
edit
dl
rm
poplib.py
14964
0644
edit
dl
rm
posixpath.py
15645
0644
edit
dl
rm
pprint.py
20860
0644
edit
dl
rm
profile.py
22019
0755
edit
dl
rm
pstats.py
26564
0644
edit
dl
rm
pty.py
4763
0644
edit
dl
rm
pyclbr.py
13558
0644
edit
dl
rm
pydoc.py
103818
0755
edit
dl
rm
py_compile.py
7181
0644
edit
dl
rm
queue.py
8780
0644
edit
dl
rm
quopri.py
7252
0755
edit
dl
rm
random.py
27442
0644
edit
dl
rm
re.py
15552
0644
edit
dl
rm
reprlib.py
5336
0644
edit
dl
rm
rlcompleter.py
7097
0644
edit
dl
rm
runpy.py
11959
0644
edit
dl
rm
sched.py
6511
0644
edit
dl
rm
secrets.py
2038
0644
edit
dl
rm
selectors.py
19438
0644
edit
dl
rm
shelve.py
8515
0644
edit
dl
rm
shlex.py
12956
0644
edit
dl
rm
shutil.py
40540
0644
edit
dl
rm
signal.py
2123
0644
edit
dl
rm
site.py
21766
0644
edit
dl
rm
sitecustomize.py
-
0
edit
dl
rm
smtpd.py
34709
0755
edit
dl
rm
smtplib.py
44208
0755
edit
dl
rm
sndhdr.py
7088
0644
edit
dl
rm
socket.py
27443
0644
edit
dl
rm
socketserver.py
27010
0644
edit
dl
rm
sre_compile.py
19338
0644
edit
dl
rm
sre_constants.py
6821
0644
edit
dl
rm
sre_parse.py
36536
0644
edit
dl
rm
ssl.py
46400
0644
edit
dl
rm
stat.py
5038
0644
edit
dl
rm
statistics.py
20673
0644
edit
dl
rm
string.py
11795
0644
edit
dl
rm
stringprep.py
12917
0644
edit
dl
rm
struct.py
257
0644
edit
dl
rm
subprocess.py
62339
0644
edit
dl
rm
sunau.py
18095
0644
edit
dl
rm
symbol.py
2109
0755
edit
dl
rm
symtable.py
7277
0644
edit
dl
rm
sysconfig.py
25057
0644
edit
dl
rm
tabnanny.py
11401
0755
edit
dl
rm
tarfile.py
94969
0755
edit
dl
rm
telnetlib.py
23136
0644
edit
dl
rm
tempfile.py
31867
0644
edit
dl
rm
textwrap.py
19558
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
49029
0644
edit
dl
rm
timeit.py
13332
0755
edit
dl
rm
token.py
3075
0644
edit
dl
rm
tokenize.py
29496
0644
edit
dl
rm
trace.py
28723
0755
edit
dl
rm
traceback.py
23458
0644
edit
dl
rm
tracemalloc.py
16658
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
turtle.py
143620
0644
edit
dl
rm
types.py
8870
0644
edit
dl
rm
typing.py
80274
0644
edit
dl
rm
uu.py
6753
0755
edit
dl
rm
uuid.py
23971
0644
edit
dl
rm
warnings.py
18488
0644
edit
dl
rm
wave.py
17709
0644
edit
dl
rm
weakref.py
20466
0644
edit
dl
rm
webbrowser.py
21757
0755
edit
dl
rm
xdrlib.py
5913
0644
edit
dl
rm
zipapp.py
7157
0644
edit
dl
rm
zipfile.py
78184
0644
edit
dl
rm
_bootlocale.py
1301
0644
edit
dl
rm
_collections_abc.py
26392
0644
edit
dl
rm
_compat_pickle.py
8749
0644
edit
dl
rm
_compression.py
5340
0644
edit
dl
rm
_dummy_thread.py
5118
0644
edit
dl
rm
_markupbase.py
14598
0644
edit
dl
rm
_osx_support.py
19119
0644
edit
dl
rm
_pydecimal.py
230228
0644
edit
dl
rm
_pyio.py
88097
0644
edit
dl
rm
_sitebuiltins.py
3115
0644
edit
dl
rm
_strptime.py
24747
0644
edit
dl
rm
_sysconfigdata_m_linux_x86_64-linux-gnu.py
22325
0644
edit
dl
rm
_threading_local.py
7214
0644
edit
dl
rm
_weakrefset.py
5705
0644
edit
dl
rm
__future__.py
4841
0644
edit
dl
rm
__phello__.foo.py
64
0644
edit
dl
rm
Edit:
/snap/core18/2999/usr/lib/python3.6/getopt.py
(7489B)
"""Parser for command line options. This module helps scripts to parse the command line arguments in sys.argv. It supports the same conventions as the Unix getopt() function (including the special meanings of arguments of the form `-' and `--'). Long options similar to those supported by GNU software may be used as well via an optional third argument. This module provides two functions and an exception: getopt() -- Parse command line options gnu_getopt() -- Like getopt(), but allow option and non-option arguments to be intermixed. GetoptError -- exception (class) raised with 'opt' attribute, which is the option involved with the exception. """ # Long option support added by Lars Wirzenius <liw@iki.fi>. # # Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions # to class-based exceptions. # # Peter Åstrand <astrand@lysator.liu.se> added gnu_getopt(). # # TODO for gnu_getopt(): # # - GNU getopt_long_only mechanism # - allow the caller to specify ordering # - RETURN_IN_ORDER option # - GNU extension with '-' as first character of option string # - optional arguments, specified by double colons # - an option string with a W followed by semicolon should # treat "-W foo" as "--foo" __all__ = ["GetoptError","error","getopt","gnu_getopt"] import os try: from gettext import gettext as _ except ImportError: # Bootstrapping Python: gettext's dependencies not built yet def _(s): return s class GetoptError(Exception): opt = '' msg = '' def __init__(self, msg, opt=''): self.msg = msg self.opt = opt Exception.__init__(self, msg, opt) def __str__(self): return self.msg error = GetoptError # backward compatibility def getopt(args, shortopts, longopts = []): """getopt(args, options[, long_options]) -> opts, args Parses command line options and parameter list. args is the argument list to be parsed, without the leading reference to the running program. Typically, this means "sys.argv[1:]". shortopts is the string of option letters that the script wants to recognize, with options that require an argument followed by a colon (i.e., the same format that Unix getopt() uses). If specified, longopts is a list of strings with the names of the long options which should be supported. The leading '--' characters should not be included in the option name. Options which require an argument should be followed by an equal sign ('='). The return value consists of two elements: the first is a list of (option, value) pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of the first argument). Each option-and-value pair returned has the option as its first element, prefixed with a hyphen (e.g., '-x'), and the option argument as its second element, or an empty string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed. """ opts = [] if type(longopts) == type(""): longopts = [longopts] else: longopts = list(longopts) while args and args[0].startswith('-') and args[0] != '-': if args[0] == '--': args = args[1:] break if args[0].startswith('--'): opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) else: opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) return opts, args def gnu_getopt(args, shortopts, longopts = []): """getopt(args, options[, long_options]) -> opts, args This function works like getopt(), except that GNU style scanning mode is used by default. This means that option and non-option arguments may be intermixed. The getopt() function stops processing options as soon as a non-option argument is encountered. If the first character of the option string is `+', or if the environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered. """ opts = [] prog_args = [] if isinstance(longopts, str): longopts = [longopts] else: longopts = list(longopts) # Allow options after non-option arguments? if shortopts.startswith('+'): shortopts = shortopts[1:] all_options_first = True elif os.environ.get("POSIXLY_CORRECT"): all_options_first = True else: all_options_first = False while args: if args[0] == '--': prog_args += args[1:] break if args[0][:2] == '--': opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) elif args[0][:1] == '-' and args[0] != '-': opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) else: if all_options_first: prog_args += args break else: prog_args.append(args[0]) args = args[1:] return opts, prog_args def do_longs(opts, opt, longopts, args): try: i = opt.index('=') except ValueError: optarg = None else: opt, optarg = opt[:i], opt[i+1:] has_arg, opt = long_has_args(opt, longopts) if has_arg: if optarg is None: if not args: raise GetoptError(_('option --%s requires argument') % opt, opt) optarg, args = args[0], args[1:] elif optarg is not None: raise GetoptError(_('option --%s must not have an argument') % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args # Return: # has_arg? # full option name def long_has_args(opt, longopts): possibilities = [o for o in longopts if o.startswith(opt)] if not possibilities: raise GetoptError(_('option --%s not recognized') % opt, opt) # Is there an exact match? if opt in possibilities: return False, opt elif opt + '=' in possibilities: return True, opt # No exact match, so better be unique. if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg raise GetoptError(_('option --%s not a unique prefix') % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match def do_shorts(opts, optstring, shortopts, args): while optstring != '': opt, optstring = optstring[0], optstring[1:] if short_has_arg(opt, shortopts): if optstring == '': if not args: raise GetoptError(_('option -%s requires argument') % opt, opt) optstring, args = args[0], args[1:] optarg, optstring = optstring, '' else: optarg = '' opts.append(('-' + opt, optarg)) return opts, args def short_has_arg(opt, shortopts): for i in range(len(shortopts)): if opt == shortopts[i] != ':': return shortopts.startswith(':', i+1) raise GetoptError(_('option -%s not recognized') % opt, opt) if __name__ == '__main__': import sys print(getopt(sys.argv[1:], "a:b", ["alpha=", "beta"]))
Save
cmd:
run