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

Function _createenviron

tools/python-3.11.9-amd64/Lib/os.py:739–766  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

737 return new
738
739def _createenviron():
740 if name == 'nt':
741 # Where Env Var Names Must Be UPPERCASE
742 def check_str(value):
743 if not isinstance(value, str):
744 raise TypeError("str expected, not %s" % type(value).__name__)
745 return value
746 encode = check_str
747 decode = str
748 def encodekey(key):
749 return encode(key).upper()
750 data = {}
751 for key, value in environ.items():
752 data[encodekey(key)] = value
753 else:
754 # Where Env Var Names Can Be Mixed Case
755 encoding = sys.getfilesystemencoding()
756 def encode(value):
757 if not isinstance(value, str):
758 raise TypeError("str expected, not %s" % type(value).__name__)
759 return value.encode(encoding, 'surrogateescape')
760 def decode(value):
761 return value.decode(encoding, 'surrogateescape')
762 encodekey = encode
763 data = environ
764 return _Environ(data,
765 encodekey, decode,
766 encode, decode)
767
768# unicode environ
769environ = _createenviron()

Callers 1

os.pyFile · 0.85

Calls 3

encodekeyFunction · 0.85
_EnvironClass · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected