|
6 | 6 | import struct |
7 | 7 | import subprocess |
8 | 8 | import sys |
9 | | -from collections import OrderedDict |
10 | | -from collections.abc import Callable |
11 | 9 | from functools import partial |
12 | 10 |
|
13 | 11 |
|
14 | 12 | __all__ = [ |
15 | 13 | "get_unbound_function", |
16 | 14 | "maybe_add_to_os_environ_pathlist", |
17 | | - "DefaultOrderedDict", |
18 | 15 | "subprocess_Popen", |
19 | 16 | "call_subprocess_Popen", |
20 | 17 | "output_subprocess_Popen", |
@@ -376,36 +373,3 @@ def __eq__(self, other): |
376 | 373 |
|
377 | 374 | def __hash__(self): |
378 | 375 | return hash(type(self)) |
379 | | - |
380 | | - |
381 | | -class DefaultOrderedDict(OrderedDict): |
382 | | - def __init__(self, default_factory=None, *a, **kw): |
383 | | - if default_factory is not None and not isinstance(default_factory, Callable): |
384 | | - raise TypeError("first argument must be callable") |
385 | | - OrderedDict.__init__(self, *a, **kw) |
386 | | - self.default_factory = default_factory |
387 | | - |
388 | | - def __getitem__(self, key): |
389 | | - try: |
390 | | - return OrderedDict.__getitem__(self, key) |
391 | | - except KeyError: |
392 | | - return self.__missing__(key) |
393 | | - |
394 | | - def __missing__(self, key): |
395 | | - if self.default_factory is None: |
396 | | - raise KeyError(key) |
397 | | - self[key] = value = self.default_factory() |
398 | | - return value |
399 | | - |
400 | | - def __reduce__(self): |
401 | | - if self.default_factory is None: |
402 | | - args = tuple() |
403 | | - else: |
404 | | - args = (self.default_factory,) |
405 | | - return type(self), args, None, None, iter(self.items()) |
406 | | - |
407 | | - def copy(self): |
408 | | - return self.__copy__() |
409 | | - |
410 | | - def __copy__(self): |
411 | | - return type(self)(self.default_factory, self) |
0 commit comments