summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 5b8aa25..d72f32b 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -387,22 +387,32 @@ class _Environ(MutableMapping):
self.data = data = {}
for key, value in environ.items():
data[keymap(key)] = str(value)
+
def __getitem__(self, key):
return self.data[self.keymap(key)]
+
def __setitem__(self, key, value):
value = str(value)
self.putenv(key, value)
self.data[self.keymap(key)] = value
+
def __delitem__(self, key):
self.unsetenv(key)
del self.data[self.keymap(key)]
+
def __iter__(self):
for key in self.data:
yield key
+
def __len__(self):
return len(self.data)
+
+ def __repr__(self):
+ return 'environ({!r})'.format(self.data)
+
def copy(self):
return dict(self)
+
def setdefault(self, key, value):
if key not in self:
self[key] = value