MCPcopy Index your code
hub / github.com/RustPython/RustPython / repl

Function repl

Lib/ntpath.py:438–463  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

436 environ = os.environ
437
438 def repl(m):
439 lastindex = m.lastindex
440 if lastindex is None:
441 return m[0]
442 name = m[lastindex]
443 if lastindex == 1:
444 if name == percent:
445 return name
446 if not name.endswith(percent):
447 return m[0]
448 name = name[:-1]
449 else:
450 if name == dollar:
451 return name
452 if name.startswith(brace):
453 if not name.endswith(rbrace):
454 return m[0]
455 name = name[1:-1]
456
457 try:
458 if environ is None:
459 return os.fsencode(os.environ[os.fsdecode(name)])
460 else:
461 return environ[name]
462 except KeyError:
463 return m[0]
464
465 return sub(repl, path)
466

Callers

nothing calls this directly

Calls 4

fsencodeMethod · 0.80
fsdecodeMethod · 0.80
endswithMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected