commit: cfdd01b7d08d00ed1bec66e1d0f5ef976e131c28
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 19:14:56 2019 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 19:39:19 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cfdd01b7
Remove internal OrderedDict implementation
This is no longer needed becuase collections.OrderedDict is available
since Python 2.7.
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/__init__.py | 8 ++------
lib/portage/cache/mappings.py | 30 +-----------------------------
2 files changed, 3 insertions(+), 35 deletions(-)
diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index b108ca3e5..f361b9dcf 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2019 Gentoo Foundation
+# Copyright 1998-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -112,11 +112,7 @@ try:
'time',
)
- try:
- from collections import OrderedDict
- except ImportError:
- proxy.lazyimport.lazyimport(globals(),
- 'portage.cache.mappings:OrderedDict')
+ from collections import OrderedDict
import portage.const
from portage.const import VDB_PATH, PRIVATE_PATH, CACHE_PATH,
DEPCACHE_PATH, \
diff --git a/lib/portage/cache/mappings.py b/lib/portage/cache/mappings.py
index 921fdaf1b..0432fdf60 100644
--- a/lib/portage/cache/mappings.py
+++ b/lib/portage/cache/mappings.py
@@ -1,4 +1,4 @@
-# Copyright: 2005-2009 Gentoo Foundation
+# Copyright: 2005-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Author(s): Brian Harring ([email protected])
@@ -187,34 +187,6 @@ class UserDict(MutableMapping):
if sys.hexversion >= 0x3000000:
keys = __iter__
-class OrderedDict(UserDict):
-
- __slots__ = ('_order',)
-
- def __init__(self, *args, **kwargs):
- self._order = []
- UserDict.__init__(self, *args, **kwargs)
-
- def __iter__(self):
- return iter(self._order)
-
- def __setitem__(self, key, item):
- new_key = key not in self
- UserDict.__setitem__(self, key, item)
- if new_key:
- self._order.append(key)
-
- def __delitem__(self, key):
- UserDict.__delitem__(self, key)
- self._order.remove(key)
-
- def clear(self):
- UserDict.clear(self)
- del self._order[:]
-
- if sys.hexversion >= 0x3000000:
- keys = __iter__
-
class ProtectedDict(MutableMapping):
"""
given an initial dict, this wraps that dict storing changes in a
secondary dict, protecting