diff --git a/pythonforandroid/logger.py b/pythonforandroid/logger.py index 75fee40d1a..b05d137f57 100644 --- a/pythonforandroid/logger.py +++ b/pythonforandroid/logger.py @@ -1,4 +1,3 @@ - import logging import os import re @@ -16,7 +15,7 @@ stderr = codecs.getwriter('utf8')(stderr) if six.PY2: - unistr = unicode + unistr = unicode # noqa F821 else: unistr = str diff --git a/pythonforandroid/recipes/android/src/android/mixer.py b/pythonforandroid/recipes/android/src/android/mixer.py index 4ac224a790..3f85c6352e 100644 --- a/pythonforandroid/recipes/android/src/android/mixer.py +++ b/pythonforandroid/recipes/android/src/android/mixer.py @@ -196,10 +196,10 @@ def __init__(self, what): self.serial = str(sound_serial) sound_serial += 1 - if isinstance(what, file): + if isinstance(what, file): # noqa F821 self.file = what else: - self.file = file(os.path.abspath(what), "rb") + self.file = file(os.path.abspath(what), "rb") # noqa F821 sounds[self.serial] = self diff --git a/pythonforandroid/util.py b/pythonforandroid/util.py index cc9d94a616..75e56bde63 100644 --- a/pythonforandroid/util.py +++ b/pythonforandroid/util.py @@ -15,11 +15,6 @@ IS_PY3 = sys.version_info[0] >= 3 -if IS_PY3: - unistr = str -else: - unistr = unicode - class WgetDownloader(FancyURLopener): version = ('Wget/1.17.1') @@ -106,7 +101,7 @@ def sync(self): json.dump(self.data, fd, ensure_ascii=False) else: with io.open(self.filename, 'w', encoding='utf-8') as fd: - fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) + fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) # noqa F821 def which(program, path_env): @@ -128,20 +123,3 @@ def is_exe(fpath): return exe_file return None - - -def get_directory(filename): - '''If the filename ends with a recognised file extension, return the - filename without this extension.''' - if filename.endswith('.tar.gz'): - return basename(filename[:-7]) - elif filename.endswith('.tgz'): - return basename(filename[:-4]) - elif filename.endswith('.tar.bz2'): - return basename(filename[:-8]) - elif filename.endswith('.tbz2'): - return basename(filename[:-5]) - elif filename.endswith('.zip'): - return basename(filename[:-4]) - info('Unknown file extension for {}'.format(filename)) - exit(1) diff --git a/tox.ini b/tox.ini index 56261dcd03..ea0c63985f 100644 --- a/tox.ini +++ b/tox.ini @@ -12,4 +12,4 @@ ignore = E111, E114, E115, E116, E202, E121, E123, E124, E225, E126, E127, E128, E129, E201, E203, E221, E226, E231, E241, E251, E261, E265, E266, E271, E302, E303, E305, E401, E402, E501, E502, E703, E722, E741, F403, - F812, F821, F841, F811, W291, W292, W293, W391, W503 + F812, F841, F811, W291, W292, W293, W391, W503