MCPcopy Create free account
hub / github.com/idank/explainshell / extract_name

Function extract_name

explainshell/manpage.py:12–27  ·  view source on GitHub ↗

>>> extract_name('ab.1.gz') 'ab' >>> extract_name('ab.1.1.gz') 'ab.1' >>> extract_name('ab.1xyz.gz') 'ab' >>> extract_name('ab.1.1xyz.gz') 'ab.1' >>> extract_name('a/b/c/ab.1.1xyz.gz') 'ab.1'

(gz_name)

Source from the content-addressed store, hash-verified

10
11
12def extract_name(gz_name):
13 """
14 >>> extract_name('ab.1.gz')
15 'ab'
16 >>> extract_name('ab.1.1.gz')
17 'ab.1'
18 >>> extract_name('ab.1xyz.gz')
19 'ab'
20 >>> extract_name('ab.1.1xyz.gz')
21 'ab.1'
22 >>> extract_name('a/b/c/ab.1.1xyz.gz')
23 'ab.1'
24 """
25 if "/" in gz_name:
26 gz_name = os.path.basename(gz_name)
27 return gz_name.rsplit(".", 2)[0]
28
29
30def _parse_synopsis(base, synopsis):

Callers 1

get_synopsis_and_aliasesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected