Skip to content

Commit 154f1e5

Browse files
committed
Fixes linter F821 (undefined name)
Fixes or ignores some undefined names. Plus deletes `get_directory()` dead code.
1 parent 546acf2 commit 154f1e5

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

pythonforandroid/logger.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import logging
32
import os
43
import re
@@ -16,7 +15,7 @@
1615
stderr = codecs.getwriter('utf8')(stderr)
1716

1817
if six.PY2:
19-
unistr = unicode
18+
unistr = unicode # noqa F821
2019
else:
2120
unistr = str
2221

pythonforandroid/recipes/android/src/android/mixer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ def __init__(self, what):
196196
self.serial = str(sound_serial)
197197
sound_serial += 1
198198

199-
if isinstance(what, file):
199+
if isinstance(what, file): # noqa F821
200200
self.file = what
201201
else:
202-
self.file = file(os.path.abspath(what), "rb")
202+
self.file = file(os.path.abspath(what), "rb") # noqa F821
203203

204204
sounds[self.serial] = self
205205

pythonforandroid/util.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515

1616
IS_PY3 = sys.version_info[0] >= 3
1717

18-
if IS_PY3:
19-
unistr = str
20-
else:
21-
unistr = unicode
22-
2318

2419
class WgetDownloader(FancyURLopener):
2520
version = ('Wget/1.17.1')
@@ -106,7 +101,7 @@ def sync(self):
106101
json.dump(self.data, fd, ensure_ascii=False)
107102
else:
108103
with io.open(self.filename, 'w', encoding='utf-8') as fd:
109-
fd.write(unicode(json.dumps(self.data, ensure_ascii=False)))
104+
fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) # noqa F821
110105

111106

112107
def which(program, path_env):
@@ -128,20 +123,3 @@ def is_exe(fpath):
128123
return exe_file
129124

130125
return None
131-
132-
133-
def get_directory(filename):
134-
'''If the filename ends with a recognised file extension, return the
135-
filename without this extension.'''
136-
if filename.endswith('.tar.gz'):
137-
return basename(filename[:-7])
138-
elif filename.endswith('.tgz'):
139-
return basename(filename[:-4])
140-
elif filename.endswith('.tar.bz2'):
141-
return basename(filename[:-8])
142-
elif filename.endswith('.tbz2'):
143-
return basename(filename[:-5])
144-
elif filename.endswith('.zip'):
145-
return basename(filename[:-4])
146-
info('Unknown file extension for {}'.format(filename))
147-
exit(1)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ ignore =
1212
E111, E114, E115, E116, E202, E121, E123, E124, E225, E126, E127, E128,
1313
E129, E201, E203, E221, E226, E231, E241, E251, E261, E265, E266, E271,
1414
E302, E303, E305, E401, E402, E501, E502, E703, E722, E741, F403,
15-
F812, F821, F841, F811, W291, W292, W293, W391, W503
15+
F812, F841, F811, W291, W292, W293, W391, W503

0 commit comments

Comments
 (0)