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

Function _isreservedname

Lib/ntpath.py:318–331  ·  view source on GitHub ↗

Return true if the filename is reserved by the system.

(name)

Source from the content-addressed store, hash-verified

316 return any(_isreservedname(name) for name in reversed(path.split(sep)))
317
318def _isreservedname(name):
319 """Return true if the filename is reserved by the system."""
320 # Trailing dots and spaces are reserved.
321 if name[-1:] in ('.', ' '):
322 return name not in ('.', '..')
323 # Wildcards, separators, colon, and pipe (*?"<>/\:|) are reserved.
324 # ASCII control characters (0-31) are reserved.
325 # Colon is reserved for file streams (e.g. "name:stream[:type]").
326 if _reserved_chars.intersection(name):
327 return True
328 # DOS device names are reserved (e.g. "nul" or "nul .txt"). The rules
329 # are complex and vary across Windows versions. On the side of
330 # caution, return True for names that may not be reserved.
331 return name.partition('.')[0].rstrip(' ').upper() in _reserved_names
332
333
334# Expand paths beginning with '~' or '~user'.

Callers 1

isreservedFunction · 0.85

Calls 4

intersectionMethod · 0.45
upperMethod · 0.45
rstripMethod · 0.45
partitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…