Skip to content

Commit

Permalink
Fix test for membership and equality
Browse files Browse the repository at this point in the history
  • Loading branch information
kruton committed Mar 2, 2016
1 parent 7be00f8 commit 0a51b26
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion android2po/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def write_file(cmd, filename, content, update=True, action=None,
finally:
f.close()

if not action is False:
if action is not False:
if old_hash is None:
action.done('created')
elif old_hash != filename.hash():
Expand Down
2 changes: 1 addition & 1 deletion android2po/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def read_xml(xml_file, language=None, warnfunc=dummy_warn):
continue

# Ignore elements we cannot or should not process
if not 'name' in tag.attrib:
if 'name' not in tag.attrib:
comment = []
continue
if tag.attrib.get('translatable') == 'false':
Expand Down
12 changes: 6 additions & 6 deletions android2po/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ def init(self):
# a placeholder would probably be to insert a unique string
# and see if it comes out at the end; or, come up with
# a proper regex to parse.
if not '%(locale)s' in layout:
if '%(locale)s' not in layout:
raise EnvironmentError('--layout lacks %(locale)s variable')
if self.config.domain and not '%(domain)s' in layout:
if self.config.domain and '%(domain)s' not in layout:
raise EnvironmentError('--layout needs %(domain)s variable, ',
'since you have set a --domain')
if multiple_pos and not '%(group)s' in layout:
if multiple_pos and '%(group)s' not in layout:
raise EnvironmentError('--layout needs %%(group)s variable, '
'since you have multiple groups: %s' % (
", ".join(self.xmlfiles)))
Expand All @@ -424,7 +424,7 @@ def init(self):
template = '%(group)s.pot'
else:
template = 'template.pot'
elif '%s' in template and not '%(group)s' in template:
elif '%s' in template and '%(group)s' not in template:
# In an earlier version the --template option only
# supported a %s placeholder for the XML kind. Make
# sure we still support this.
Expand All @@ -438,7 +438,7 @@ def init(self):
# Note that we do not validate %(domain)s here; we expressively
# allow the user to define a template without a domain.
# TODO: See the same case above when handling --layout
if multiple_pos and not '%(group)s' in template:
if multiple_pos and '%(group)s' not in template:
raise EnvironmentError('--template needs %%(group)s variable, '
'since you have multiple groups: %s' % (
", ".join(self.xmlfiles)))
Expand Down Expand Up @@ -515,7 +515,7 @@ def get_gettext_languages(self):
if not m:
continue
code = m.groupdict()['locale']
if not code in languages:
if code not in languages:
language = resolve_locale(code, self)
if language:
languages[code] = language
Expand Down
2 changes: 1 addition & 1 deletion android2po/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def format_to_re(format):
http://stackoverflow.com/questions/2654856/python-convert-format-string-to-regular-expression
"""
UNIQ = uuid.uuid1().hex
assert not UNIQ in format
assert UNIQ not in format
class MarkPlaceholders(dict):
def __getitem__(self, key):
return UNIQ+('(?P<%s>.*?)'%key)+UNIQ
Expand Down

0 comments on commit 0a51b26

Please sign in to comment.