From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch v1 3/4] BaseTools/Common/Misc: Cleanup the imports
Date: Thu, 24 Jan 2019 08:14:20 -0800 [thread overview]
Message-ID: <ab7814f57ceb6efb88fc3add401ef83c1d61ec05.1548270790.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1548270790.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1548270790.git.jaben.carsey@intel.com>
Refactor to 'dict' from 'IterableUserDict' which was only required for old
python interpreter.
Sort imports according to PEP8
Remove those we dont need.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Source/Python/Common/Misc.py | 34 ++++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 65ccba36b2e9..e8be8f866511 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -15,7 +15,7 @@
# Import Modules
#
from __future__ import absolute_import
-import Common.LongFilePathOs as os
+
import sys
import string
import threading
@@ -26,22 +26,22 @@ import array
import shutil
from random import sample
from struct import pack
-from UserDict import IterableUserDict
-from UserList import UserList
+import uuid
+import subprocess
+from collections import OrderedDict
+import Common.LongFilePathOs as os
from Common import EdkLogger as EdkLogger
from Common import GlobalData as GlobalData
-from .DataType import *
-from .BuildToolError import *
+from Common.DataType import *
+from Common.BuildToolError import *
from CommonDataClass.DataClass import *
-from .Parsing import GetSplitValueList
+from Common.Parsing import GetSplitValueList
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws
-import uuid
from CommonDataClass.Exceptions import BadExpression
from Common.caching import cached_property
-import subprocess
-from collections import OrderedDict
+
## Regular expression used to find out place holders in string template
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE)
@@ -831,22 +831,22 @@ class Progressor:
# accessed in the order they are added into the dict. It guarantees the order
# by making use of an internal list to keep a copy of keys.
#
-class sdict(IterableUserDict):
+class sdict(dict):
## Constructor
def __init__(self):
- IterableUserDict.__init__(self)
+ dict.__init__(self)
self._key_list = []
## [] operator
def __setitem__(self, key, value):
if key not in self._key_list:
self._key_list.append(key)
- IterableUserDict.__setitem__(self, key, value)
+ dict.__setitem__(self, key, value)
## del operator
def __delitem__(self, key):
self._key_list.remove(key)
- IterableUserDict.__delitem__(self, key)
+ dict.__delitem__(self, key)
## used in "for k in dict" loop to ensure the correct order
def __iter__(self):
@@ -869,17 +869,17 @@ class sdict(IterableUserDict):
index = self._key_list.index(key)
if order == 'BEFORE':
self._key_list.insert(index, newkey)
- IterableUserDict.__setitem__(self, newkey, newvalue)
+ dict.__setitem__(self, newkey, newvalue)
elif order == 'AFTER':
self._key_list.insert(index + 1, newkey)
- IterableUserDict.__setitem__(self, newkey, newvalue)
+ dict.__setitem__(self, newkey, newvalue)
## append support
def append(self, sdict):
for key in sdict:
if key not in self._key_list:
self._key_list.append(key)
- IterableUserDict.__setitem__(self, key, sdict[key])
+ dict.__setitem__(self, key, sdict[key])
def has_key(self, key):
return key in self._key_list
@@ -887,7 +887,7 @@ class sdict(IterableUserDict):
## Empty the dict
def clear(self):
self._key_list = []
- IterableUserDict.clear(self)
+ dict.clear(self)
## Return a copy of keys
def keys(self):
--
2.16.2.windows.1
next prev parent reply other threads:[~2019-01-24 16:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 16:14 [Patch v1 0/4] Cleanup the Common.misc file Jaben Carsey
2019-01-24 16:14 ` [Patch v1 1/4] BaseTools/Common/Misc: move private functions Jaben Carsey
2019-01-28 3:45 ` Feng, Bob C
2019-01-24 16:14 ` [Patch v1 2/4] BaseTools/Common/Misc: remove uncalled code Jaben Carsey
2019-01-28 3:45 ` Feng, Bob C
2019-01-24 16:14 ` Jaben Carsey [this message]
2019-01-28 3:45 ` [Patch v1 3/4] BaseTools/Common/Misc: Cleanup the imports Feng, Bob C
2019-01-24 16:14 ` [Patch v1 4/4] BaseTools/build/build: delete variable Jaben Carsey
2019-01-28 3:45 ` Feng, Bob C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab7814f57ceb6efb88fc3add401ef83c1d61ec05.1548270790.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox