Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/logilab/common/textutils.py

Issue 719313003: Revert "pylint: upgrade to 1.3.1" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/logilab/common/testlib.py ('k') | third_party/logilab/common/umessage.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/logilab/common/textutils.py
diff --git a/third_party/logilab/common/textutils.py b/third_party/logilab/common/textutils.py
index 9046f975b7c66c8ac3823029137b14b97c27c74b..bdeed415f0244a26552cf43d5b578c03479274ce 100644
--- a/third_party/logilab/common/textutils.py
+++ b/third_party/logilab/common/textutils.py
@@ -284,14 +284,11 @@ def text_to_dict(text):
dict of {'key': 'value'}. When the same key is encountered multiple time,
value is turned into a list containing all values.
- >>> d = text_to_dict('''multiple=1
+ >>> text_to_dict('''multiple=1
... multiple= 2
... single =3
... ''')
- >>> d['single']
- '3'
- >>> d['multiple']
- ['1', '2']
+ {'single': '3', 'multiple': ['1', '2']}
"""
res = {}
@@ -316,8 +313,6 @@ _BLANK_RE = re.compile(_BLANK_URE)
__VALUE_URE = r'-?(([0-9]+\.[0-9]*)|((0x?)?[0-9]+))'
__UNITS_URE = r'[a-zA-Z]+'
_VALUE_RE = re.compile(r'(?P<value>%s)(?P<unit>%s)?'%(__VALUE_URE, __UNITS_URE))
-_VALIDATION_RE = re.compile(r'^((%s)(%s))*(%s)?$' % (__VALUE_URE, __UNITS_URE,
- __VALUE_URE))
BYTE_UNITS = {
"b": 1,
@@ -357,12 +352,12 @@ def apply_units(string, units, inter=None, final=float, blank_reg=_BLANK_RE,
"""
if inter is None:
inter = final
- fstring = _BLANK_RE.sub('', string)
- if not (fstring and _VALIDATION_RE.match(fstring)):
- raise ValueError("Invalid unit string: %r." % string)
+ string = _BLANK_RE.sub('', string)
values = []
- for match in value_reg.finditer(fstring):
+ for match in value_reg.finditer(string):
dic = match.groupdict()
+ #import sys
+ #print >> sys.stderr, dic
lit, unit = dic["value"], dic.get("unit")
value = inter(lit)
if unit is not None:
« no previous file with comments | « third_party/logilab/common/testlib.py ('k') | third_party/logilab/common/umessage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698