Skip to content

Commit

Permalink
Spacing only
Browse files Browse the repository at this point in the history
  • Loading branch information
dharvey-consbio committed Nov 4, 2019
1 parent f13f80d commit aef1f20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions parserutils/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def flatten_items(items, recurse=False):

return type(items)(flattened) if isinstance(items, _flatten_types) else flattened


_flatten_types = (tuple, set)
_flattened_types = (dict,) + STRING_TYPES

Expand Down Expand Up @@ -192,6 +193,7 @@ def remove_duplicates(items, in_reverse=False, is_unhashable=False):

return unique if not in_reverse else unique[::-1] # Restore original order


_remove_dup_types = (tuple,) + STRING_TYPES
_removed_dup_types = (dict, set)

Expand Down Expand Up @@ -244,6 +246,7 @@ def reduce_value(value, default=EMPTY_STR):

return default if value is None else value


_reduce_types = (list, tuple)


Expand All @@ -264,4 +267,5 @@ def wrap_value(value, include_empty=False):

return value if include_empty else filter_empty(value, [])


_wrap_types = (dict,) + STRING_TYPES
1 change: 1 addition & 0 deletions parserutils/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def to_ascii_equivalent(text):
text = EMPTY_STR.join(_ASCII_PUNCTUATION_MAP.get(c, c) for c in text)
return EMPTY_STR.join(c for c in unicodedata.normalize('NFD', text) if unicodedata.category(c) != 'Mn')


_ASCII_PUNCTUATION_MAP = {
# Hyphens and dashes
u'\u2010': u'-', u'\u2011': u'-', u'\u2012': u'-', u'\u2013': u'-', u'\u2014': u'-', u'\u2015': u'-',
Expand Down

0 comments on commit aef1f20

Please sign in to comment.