Skip to content

Commit e0844af

Browse files
committed
Linter fixes E111, E116, E122, E202, E225, E241...
- E111 indentation is not a multiple of four - E116 unexpected indentation (comment) - E122 continuation line missing indentation or outdented - E202 whitespace before '}' - E225 missing whitespace around operator - E241 multiple spaces after ',' - E265 block comment should start with '# ' - E266 too many leading '#' for block comment - E401 multiple imports on one line - E741 ambiguous variable name - E502 the backslash is redundant between brackets - F403 unable to detect undefined names - F811 redefinition of unused name - W292 no newline at end of file
1 parent ce56784 commit e0844af

File tree

15 files changed

+42
-40
lines changed

15 files changed

+42
-40
lines changed

pythonforandroid/archs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_env(self, with_flags_in_cc=True):
3636
env['CFLAGS'] = ' '.join([
3737
'-DANDROID', '-mandroid', '-fomit-frame-pointer'
3838
' -D__ANDROID_API__={}'.format(self.ctx._android_api),
39-
])
39+
])
4040
env['LDFLAGS'] = ' '
4141

4242
sysroot = join(self.ctx._ndk_dir, 'sysroot')

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def make_package(args):
378378
url_scheme=url_scheme,
379379
private_version=str(time.time()))
380380

381-
## gradle build templates
381+
# gradle build templates
382382
render(
383383
'build.tmpl.gradle',
384384
'build.gradle',
@@ -388,7 +388,7 @@ def make_package(args):
388388
android_api=android_api,
389389
build_tools_version=build_tools_version)
390390

391-
## ant build templates
391+
# ant build templates
392392
render(
393393
'build.tmpl.xml',
394394
'build.xml',
@@ -418,10 +418,10 @@ def parse_args(args=None):
418418
tools directory of the Android SDK.
419419
''')
420420

421+
# `required=True` for launcher, crashes in make_package
422+
# if not mentioned (and the check is there anyway)
421423
ap.add_argument('--private', dest='private',
422424
help='the dir of user files')
423-
# , required=True) for launcher, crashes in make_package
424-
# if not mentioned (and the check is there anyway)
425425
ap.add_argument('--package', dest='package',
426426
help=('The name of the java package the project will be'
427427
' packaged under.'),
@@ -486,8 +486,8 @@ def parse_args(args=None):
486486
ap.add_argument('--depend', dest='depends', action='append',
487487
help=('Add a external dependency '
488488
'(eg: com.android.support:appcompat-v7:19.0.1)'))
489-
## The --sdk option has been removed, it is ignored in favour of
490-
## --android-api handled by toolchain.py
489+
# The --sdk option has been removed, it is ignored in favour of
490+
# --android-api handled by toolchain.py
491491
ap.add_argument('--sdk', dest='sdk_version', default=-1,
492492
type=int, help=('Deprecated argument, does nothing'))
493493
ap.add_argument('--minsdk', dest='min_sdk_version',

pythonforandroid/graph.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from copy import deepcopy
32
from itertools import product
43
from sys import exit

pythonforandroid/recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ def clean_build(self, arch=None):
548548
if exists(base_dir):
549549
dirs.append(base_dir)
550550
if not dirs:
551-
warning(('Attempted to clean build for {} but found no existing '
552-
'build dirs').format(self.name))
551+
warning(('Attempted to clean build for {} but found no existing '
552+
'build dirs').format(self.name))
553553

554554
for directory in dirs:
555555
if exists(directory):

pythonforandroid/recipes/android/src/android/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
'''
66

77
# legacy import
8-
from android._android import * # noqa: F401
8+
from android._android import * # noqa: F401, F403

pythonforandroid/recipes/android/src/android/activity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
_callbacks = {
77
'on_new_intent': [],
8-
'on_activity_result': [] }
8+
'on_activity_result': [],
9+
}
910

1011

1112
class NewIntentListener(PythonJavaClass):

pythonforandroid/recipes/flask/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44

55
class FlaskRecipe(PythonRecipe):
6-
version = '0.10.1' # The webserver of 'master' seems to fail
7-
# after a little while on Android, so use
8-
# 0.10.1 at least for now
6+
# The webserver of 'master' seems to fail
7+
# after a little while on Android, so use
8+
# 0.10.1 at least for now
9+
version = '0.10.1'
910
url = 'https://github.com/pallets/flask/archive/{version}.zip'
1011

1112
depends = [('python2', 'python3crystax'), 'setuptools', 'genericndkbuild']

pythonforandroid/recipes/libffi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def build_arch(self, arch):
4040
'--host=' + arch.toolchain_prefix,
4141
'--prefix=' + self.ctx.get_python_install_dir(),
4242
'--enable-shared', _env=env)
43-
#'--with-sysroot={}'.format(self.ctx.ndk_platform),
44-
#'--target={}'.format(arch.toolchain_prefix),
43+
# '--with-sysroot={}'.format(self.ctx.ndk_platform),
44+
# '--target={}'.format(arch.toolchain_prefix),
4545

4646
# ndk 15 introduces unified headers required --sysroot and
4747
# -isysroot for libraries and headers. libtool's head explodes

pythonforandroid/recipes/libgeos/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class LibgeosRecipe(Recipe):
88
version = '3.5'
9-
#url = 'http://download.osgeo.org/geos/geos-{version}.tar.bz2'
9+
# url = 'http://download.osgeo.org/geos/geos-{version}.tar.bz2'
1010
url = 'https://github.com/libgeos/libgeos/archive/svn-{version}.zip'
1111
depends = ['python2']
1212

@@ -23,7 +23,7 @@ def build_arch(self, arch):
2323
bash = sh.Command('bash')
2424
print("If this fails make sure you have autoconf and libtool installed")
2525
shprint(bash, 'autogen.sh') # Requires autoconf and libtool
26-
shprint(bash, 'configure', '--host=arm-linux-androideabi', '--enable-shared', '--prefix={}'.format(dst_dir), _env=env)
26+
shprint(bash, 'configure', '--host=arm-linux-androideabi', '--enable-shared', '--prefix={}'.format(dst_dir), _env=env)
2727
shprint(sh.make, '-j', str(cpu_count()), _env=env)
2828
shprint(sh.make, 'install', _env=env)
2929
shutil.copyfile('{}/lib/libgeos_c.so'.format(dst_dir), join(self.ctx.get_libs_dir(arch.arch), 'libgeos_c.so'))

pythonforandroid/recipes/opencv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class OpenCVRecipe(NDKRecipe):
1212
version = '2.4.10.1'
1313
url = 'https://github.com/Itseez/opencv/archive/{version}.zip'
14-
#md5sum = '2ddfa98e867e6611254040df841186dc'
14+
# md5sum = '2ddfa98e867e6611254040df841186dc'
1515
depends = ['numpy']
1616
patches = ['patches/p4a_build-2.4.10.1.patch']
1717
generated_libraries = ['cv2.so']

pythonforandroid/recipes/python2/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,23 @@ def do_python_build(self, arch):
8787
# TODO need to add a should_build that checks if optional
8888
# dependencies have changed (possibly in a generic way)
8989
if 'openssl' in self.ctx.recipe_build_order:
90-
r = Recipe.get_recipe('openssl', self.ctx)
91-
openssl_build_dir = r.get_build_dir(arch.arch)
90+
recipe = Recipe.get_recipe('openssl', self.ctx)
91+
openssl_build_dir = recipe.get_build_dir(arch.arch)
9292
setuplocal = join('Modules', 'Setup.local')
9393
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup.local-ssl'), setuplocal)
9494
shprint(sh.sed, '-i.backup', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), setuplocal)
95-
env['OPENSSL_VERSION'] = r.version
95+
env['OPENSSL_VERSION'] = recipe.version
9696

9797
if 'sqlite3' in self.ctx.recipe_build_order:
9898
# Include sqlite3 in python2 build
99-
r = Recipe.get_recipe('sqlite3', self.ctx)
100-
i = ' -I' + r.get_build_dir(arch.arch)
101-
l = ' -L' + r.get_lib_dir(arch) + ' -lsqlite3'
99+
recipe = Recipe.get_recipe('sqlite3', self.ctx)
100+
include = ' -I' + recipe.get_build_dir(arch.arch)
101+
lib = ' -L' + recipe.get_lib_dir(arch) + ' -lsqlite3'
102102
# Insert or append to env
103-
f = 'CPPFLAGS'
104-
env[f] = env[f] + i if f in env else i
105-
f = 'LDFLAGS'
106-
env[f] = env[f] + l if f in env else l
103+
flag = 'CPPFLAGS'
104+
env[flag] = env[flag] + include if flag in env else include
105+
flag = 'LDFLAGS'
106+
env[flag] = env[flag] + lib if flag in env else lib
107107

108108
# NDK has langinfo.h but doesn't define nl_langinfo()
109109
env['ac_cv_header_langinfo_h'] = 'no'

pythonforandroid/recipes/reportlab/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import os, sh
1+
import os
2+
import sh
23
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
34
from pythonforandroid.util import (current_directory, ensure_dir)
45
from pythonforandroid.logger import (info, shprint)

pythonforandroid/recipes/vlc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def build_arch(self, arch):
6565
info("compiling vlc from sources")
6666
debug("environment: {}".format(env))
6767
if not isfile(join('bin', 'VLC-debug.apk')):
68-
shprint(sh.Command('./compile.sh'), _env=env,
69-
_tail=50, _critical=True)
68+
shprint(sh.Command('./compile.sh'), _env=env,
69+
_tail=50, _critical=True)
7070
shprint(sh.Command('./compile-libvlc.sh'), _env=env,
7171
_tail=50, _critical=True)
7272
shprint(sh.cp, '-a', aar, self.ctx.aars_dir)

pythonforandroid/toolchain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def add_parser(subparsers, *args, **kwargs):
398398
action='store_true',
399399
help='If passed, do not delete existing dists')
400400

401-
parser_clean_download_cache= add_parser(
401+
parser_clean_download_cache = add_parser(
402402
subparsers,
403403
'clean_download_cache', aliases=['clean-download-cache'],
404404
help='Delete cached downloads for requirement builds',
@@ -584,8 +584,8 @@ def recipes(self, args):
584584
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
585585
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
586586
'{version:<8}{Style.RESET_ALL}'.format(
587-
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
588-
version=version))
587+
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
588+
version=version))
589589
print(' {Fore.GREEN}depends: {recipe.depends}'
590590
'{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
591591
if recipe.conflicts:

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ commands = flake8 pythonforandroid/ tests/
1515

1616
[flake8]
1717
ignore =
18-
E111, E116, E202, E121, E123, E124, E225, E126,
19-
E226, E241, E265, E266,
20-
E401, E402, E501, E502, E722, E741, F403,
21-
F812, F841, F811, W292, W503
18+
E123, E124, E126,
19+
E226,
20+
E402, E501, E722,
21+
F812, F841, W503

0 commit comments

Comments
 (0)