Skip to content

Commit

Permalink
PEP8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Aug 17, 2019
1 parent 1f3eb62 commit 5c304be
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion unihan_etl/__about__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__title__ = 'unihan-etl'
__package_name__ = 'unihan_etl'
__description__ = 'Export UNIHAN to Python, Data Package, CSV, JSON and YAML'
__version__ = '0.10.1'
__version__ = '0.10.2'
__author__ = 'Tony Narlock'
__email__ = 'cihai@git-pull.com'
__github__ = 'https://github.com/cihai/unihan-etl'
Expand Down
12 changes: 6 additions & 6 deletions unihan_etl/expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def expand_kFenn(value):

def expand_kHanyuPinlu(value):
pattern = re.compile(
"""
r"""
(?P<phonetic>[a-z({}{}]+)
\((?P<frequency>[0-9]+)\)
""".format(
Expand Down Expand Up @@ -289,12 +289,12 @@ def expand_kHDZRadBreak(value):
re.X,
)

l = location_pattern.match(loc).groupdict()
lmatches = location_pattern.match(loc).groupdict()
location = {
"volume": int(l['volume']),
"page": int(l['page']),
"character": int(l['character']),
"virtual": int(l['virtual']),
"volume": int(lmatches['volume']),
"page": int(lmatches['page']),
"character": int(lmatches['character']),
"virtual": int(lmatches['virtual']),
}

pattern = re.compile(
Expand Down
10 changes: 5 additions & 5 deletions unihan_etl/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ def normalize(raw_data, fields):
"""
log.info('Collecting field data...')
items = dict()
for idx, l in enumerate(raw_data):
if not_junk(l):
l = l.strip().split('\t')
if in_fields(l[1], fields):
item = dict(zip(['ucn', 'field', 'value'], l))
for idx, line in enumerate(raw_data):
if not_junk(line):
line = line.strip().split('\t')
if in_fields(line[1], fields):
item = dict(zip(['ucn', 'field', 'value'], line))
char = ucn_to_unicode(item['ucn'])
if char not in items:
items[char] = dict().fromkeys(fields)
Expand Down
2 changes: 1 addition & 1 deletion unihan_etl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def ucnstring_to_python(ucn_string):
"""Return string with Unicode UCN (e.g. "U+4E00") to native Python Unicode
(u'\\u4e00').
"""
res = re.findall("U\+[0-9a-fA-F]*", ucn_string)
res = re.findall(r"U\+[0-9a-fA-F]*", ucn_string)
for r in res:
ucn_string = ucn_string.replace(text_type(r), text_type(ucn_to_unicode(r)))

Expand Down

0 comments on commit 5c304be

Please sign in to comment.