MCPcopy Index your code
hub / github.com/python/cpython / _platform

Function _platform

Lib/platform.py:626–641  ·  view source on GitHub ↗

Helper to format the platform string in a filename compatible format e.g. "system-version-machine".

(*args)

Source from the content-addressed store, hash-verified

624_SIMPLE_SUBSTITUTIONS = str.maketrans(r' /\:;"()', r'_-------')
625
626def _platform(*args):
627
628 """ Helper to format the platform string in a filename
629 compatible format e.g. "system-version-machine".
630 """
631 # Format the platform string
632 platform = '-'.join(x.strip() for x in filter(len, args))
633
634 # Cleanup some possible filename obstacles...
635 platform = platform.translate(_SIMPLE_SUBSTITUTIONS)
636
637 # No need to report 'unknown' information...
638 platform = platform.replace('unknown', '')
639
640 # Fold '--'s and remove trailing '-'
641 return re.sub(r'-{2,}', '-', platform).rstrip('-')
642
643def _node(default=''):
644

Callers 1

platformFunction · 0.85

Calls 7

filterFunction · 0.70
joinMethod · 0.45
stripMethod · 0.45
translateMethod · 0.45
replaceMethod · 0.45
rstripMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…