MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / normcase

Function normcase

tools/python-3.11.9-amd64/Lib/ntpath.py:51–68  ·  view source on GitHub ↗

Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes.

(s)

Source from the content-addressed store, hash-verified

49 LCMAP_LOWERCASE as _LCMAP_LOWERCASE)
50
51 def normcase(s):
52 """Normalize case of pathname.
53
54 Makes all characters lowercase and all slashes into backslashes.
55 """
56 s = os.fspath(s)
57 if not s:
58 return s
59 if isinstance(s, bytes):
60 encoding = sys.getfilesystemencoding()
61 s = s.decode(encoding, 'surrogateescape').replace('/', '\\')
62 s = _LCMapStringEx(_LOCALE_NAME_INVARIANT,
63 _LCMAP_LOWERCASE, s)
64 return s.encode(encoding, 'surrogateescape')
65 else:
66 return _LCMapStringEx(_LOCALE_NAME_INVARIANT,
67 _LCMAP_LOWERCASE,
68 s.replace('/', '\\'))
69except ImportError:
70 def normcase(s):
71 """Normalize case of pathname.

Callers 3

_readlink_deepFunction · 0.70
realpathFunction · 0.70
relpathFunction · 0.70

Calls 4

replaceMethod · 0.45
decodeMethod · 0.45
encodeMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected