Skip to content

Commit 74bf788

Browse files
authored
Merge pull request kivy#1286 from AndreMiras/feature/tox_flake8_spacing
Fixes linter E203 E231 E261 E302 E303 E305 W291 W293 W391
2 parents 442a3a8 + b3d3d45 commit 74bf788

File tree

104 files changed

+232
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+232
-144
lines changed

pythonforandroid/bdistapk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def initialize_options(self):
3333
for (option, (source, value)) in option_dict.items():
3434
setattr(self, option, str(value))
3535

36-
3736
def finalize_options(self):
3837

3938
setup_options = self.distribution.get_option_dict('apk')
@@ -133,7 +132,7 @@ def prepare_build_dir(self):
133132
def _set_user_options():
134133
# This seems like a silly way to do things, but not sure if there's a
135134
# better way to pass arbitrary options onwards to p4a
136-
user_options = [('requirements=', None, None),]
135+
user_options = [('requirements=', None, None), ]
137136
for i, arg in enumerate(sys.argv):
138137
if arg.startswith('--'):
139138
if ('=' in arg or
@@ -144,4 +143,5 @@ def _set_user_options():
144143

145144
BdistAPK.user_options = user_options
146145

147-
_set_user_options()
146+
147+
_set_user_options()

pythonforandroid/bootstraps/empty/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def run_distribute(self):
1212
print('empty bootstrap has no distribute')
1313
exit(1)
1414

15+
1516
bootstrap = EmptyBootstrap()

pythonforandroid/bootstraps/pygame/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def run_distribute(self):
6464
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
6565

6666
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
67-
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
67+
shprint(sh.cp, join('python-install', 'include', 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
6868

6969
info('Removing some unwanted files')
7070
shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so'))
@@ -91,8 +91,8 @@ def run_distribute(self):
9191
shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
9292
shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
9393

94-
9594
self.strip_libraries(arch)
9695
super(PygameBootstrap, self).run_distribute()
9796

97+
9898
bootstrap = PygameBootstrap()

pythonforandroid/bootstraps/pygame/build/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ def make_package(args):
370370
print('Did you install ant on your system ?')
371371
sys.exit(-1)
372372

373+
373374
def parse_args(args=None):
374375
import argparse
375376

pythonforandroid/bootstraps/pygame/build/buildlib/argparse.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@
9595
import sys as _sys
9696
import textwrap as _textwrap
9797

98+
9899
def _(s):
99100
return s
100101

102+
101103
try:
102104
_set = set
103105
except NameError:
@@ -123,6 +125,7 @@ def _sorted(iterable, reverse=False):
123125
def _callable(obj):
124126
return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
125127

128+
126129
# silence Python 2.6 buggy warnings about Exception.message
127130
if _sys.version_info[:2] == (2, 6):
128131
import warnings
@@ -145,6 +148,7 @@ def _callable(obj):
145148
# Utility functions and classes
146149
# =============================
147150

151+
148152
class _AttributeHolder(object):
149153
"""Abstract base class that provides __repr__.
150154
@@ -1165,6 +1169,7 @@ def __repr__(self):
11651169
# Optional and Positional Parsing
11661170
# ===========================
11671171

1172+
11681173
class Namespace(_AttributeHolder):
11691174
"""Simple object for storing attributes.
11701175
@@ -1265,7 +1270,6 @@ def get_default(self, dest):
12651270
return action.default
12661271
return self._defaults.get(dest, None)
12671272

1268-
12691273
# =======================
12701274
# Adding argument actions
12711275
# =======================

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def make_package(args):
296296
if args.intent_filters:
297297
with open(args.intent_filters) as fd:
298298
args.intent_filters = fd.read()
299-
299+
300300
args.add_activity = args.add_activity or []
301301

302302
args.activity_launch_mode = args.activity_launch_mode or ''
@@ -355,7 +355,6 @@ def make_package(args):
355355
key=LooseVersion)
356356
build_tools_version = build_tools_versions[-1]
357357

358-
359358
render(
360359
'AndroidManifest.tmpl.xml',
361360
'src/main/AndroidManifest.xml',
@@ -371,7 +370,6 @@ def make_package(args):
371370
remove('AndroidManifest.xml')
372371
shutil.copy(join('src', 'main', 'AndroidManifest.xml'),
373372
'AndroidManifest.xml')
374-
375373

376374
render(
377375
'strings.tmpl.xml',
@@ -402,13 +400,13 @@ def make_package(args):
402400
'custom_rules.xml',
403401
args=args)
404402

405-
406403
if args.sign:
407404
render('build.properties', 'build.properties')
408405
else:
409406
if exists('build.properties'):
410407
os.remove('build.properties')
411408

409+
412410
def parse_args(args=None):
413411
global BLACKLIST_PATTERNS, WHITELIST_PATTERNS, PYTHON
414412
default_android_api = 12

pythonforandroid/bootstraps/service_only/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def run_distribute(self):
114114
site_packages_dir = join(abspath(curdir),
115115
site_packages_dir)
116116

117-
118117
self.strip_libraries(arch)
119118
self.fry_eggs(site_packages_dir)
120119
super(ServiceOnlyBootstrap, self).run_distribute()

pythonforandroid/bootstraps/service_only/build/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(
5454
join(curdir, 'templates')))
5555

56+
5657
def render(template, dest, **kwargs):
5758
'''Using jinja2, render `template` to the filename `dest`, supplying the
5859
@@ -104,6 +105,7 @@ def listfiles(d):
104105
for fn in listfiles(subdir):
105106
yield fn
106107

108+
107109
def make_python_zip():
108110
'''
109111
Search for all the python related files, and construct the pythonXX.zip
@@ -120,7 +122,6 @@ def make_python_zip():
120122
global python_files
121123
d = realpath(join('private', 'lib', 'python2.7'))
122124

123-
124125
def select(fn):
125126
if is_blacklist(fn):
126127
return False
@@ -147,6 +148,7 @@ def select(fn):
147148
zf.write(fn, afn)
148149
zf.close()
149150

151+
150152
def make_tar(tfn, source_dirs, ignore_path=[]):
151153
'''
152154
Make a zip file `fn` from the contents of source_dis.
@@ -242,7 +244,6 @@ def make_package(args):
242244
# if args.dir:
243245
# make_tar('assets/public.mp3', [args.dir], args.ignore_path)
244246

245-
246247
# # Build.
247248
# try:
248249
# for arg in args.command:
@@ -252,7 +253,6 @@ def make_package(args):
252253
# print 'Did you install ant on your system ?'
253254
# sys.exit(-1)
254255

255-
256256
# Prepare some variables for templating process
257257

258258
# default_icon = 'templates/kivy-icon.png'

pythonforandroid/bootstraps/webview/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import glob
55
import sh
66

7+
78
class WebViewBootstrap(Bootstrap):
89
name = 'webview'
910

@@ -59,7 +60,7 @@ def run_distribute(self):
5960

6061
if exists(join('libs', arch.arch, 'libpymodules.so')):
6162
shprint(sh.mv, join('libs', arch.arch, 'libpymodules.so'), 'private/')
62-
shprint(sh.cp, join('python-install', 'include' , 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
63+
shprint(sh.cp, join('python-install', 'include', 'python2.7', 'pyconfig.h'), join('private', 'include', 'python2.7/'))
6364

6465
info('Removing some unwanted files')
6566
shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so'))
@@ -110,9 +111,9 @@ def run_distribute(self):
110111
site_packages_dir = join(abspath(curdir),
111112
site_packages_dir)
112113

113-
114114
self.strip_libraries(arch)
115115
self.fry_eggs(site_packages_dir)
116116
super(WebViewBootstrap, self).run_distribute()
117117

118+
118119
bootstrap = WebViewBootstrap()

pythonforandroid/bootstraps/webview/build/build.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# pyc/py
4040
'*.pyc',
41-
# '*.py',
41+
# '*.py',
4242

4343
# temp files
4444
'~',
@@ -54,6 +54,7 @@
5454
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(
5555
join(curdir, 'templates')))
5656

57+
5758
def render(template, dest, **kwargs):
5859
'''Using jinja2, render `template` to the filename `dest`, supplying the
5960
@@ -105,6 +106,7 @@ def listfiles(d):
105106
for fn in listfiles(subdir):
106107
yield fn
107108

109+
108110
def make_python_zip():
109111
'''
110112
Search for all the python related files, and construct the pythonXX.zip
@@ -121,7 +123,6 @@ def make_python_zip():
121123
global python_files
122124
d = realpath(join('private', 'lib', 'python2.7'))
123125

124-
125126
def select(fn):
126127
if is_blacklist(fn):
127128
return False
@@ -148,6 +149,7 @@ def select(fn):
148149
zf.write(fn, afn)
149150
zf.close()
150151

152+
151153
def make_tar(tfn, source_dirs, ignore_path=[]):
152154
'''
153155
Make a zip file `fn` from the contents of source_dis.
@@ -244,7 +246,6 @@ def make_package(args):
244246
# if args.dir:
245247
# make_tar('assets/public.mp3', [args.dir], args.ignore_path)
246248

247-
248249
# # Build.
249250
# try:
250251
# for arg in args.command:
@@ -254,7 +255,6 @@ def make_package(args):
254255
# print 'Did you install ant on your system ?'
255256
# sys.exit(-1)
256257

257-
258258
# Prepare some variables for templating process
259259

260260
default_icon = 'templates/kivy-icon.png'

pythonforandroid/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Context(object):
4444

4545
recipe_build_order = None # Will hold the list of all built recipes
4646

47-
symlink_java_src = False # If True, will symlink instead of copying during build
47+
symlink_java_src = False # If True, will symlink instead of copying during build
4848

4949
java_build_tool = 'auto'
5050

pythonforandroid/distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __repr__(self):
4141
return str(self)
4242

4343
@classmethod
44-
def get_distribution(cls, ctx, name=None, recipes=[],
44+
def get_distribution(cls, ctx, name=None, recipes=[],
4545
force_build=False,
4646
extra_dist_dirs=[],
4747
require_perfect_match=False):

pythonforandroid/logger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def format(self, record):
4242
Err_Style.RESET_ALL) + record.msg
4343
return super(LevelDifferentiatingFormatter, self).format(record)
4444

45+
4546
logger = logging.getLogger('p4a')
4647
if not hasattr(logger, 'touched'): # Necessary as importlib reloads
4748
# this, which would add a second
@@ -71,6 +72,7 @@ def __getattr__(self, key):
7172
def enable(self, enable):
7273
self._enabled = enable
7374

75+
7476
Out_Style = colorama_shim(Colo_Style)
7577
Out_Fore = colorama_shim(Colo_Fore)
7678
Err_Style = colorama_shim(Colo_Style)

pythonforandroid/patching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def is_x(**kwargs):
1818
return uname()[0] == platform
1919
return is_x
2020

21+
2122
is_linux = is_platform('Linux')
2223
is_darwin = is_platform('Darwin')
2324

@@ -68,4 +69,3 @@ def is_ndk(ndk):
6869
def is_x(recipe, **kwargs):
6970
return recipe.ctx.ndk == ndk
7071
return is_x
71-

pythonforandroid/recipe.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
798798
with current_directory(self.get_build_dir(arch.arch)):
799799
hostpython = sh.Command(self.hostpython_location)
800800

801-
802801
if self.ctx.python_recipe.from_crystax:
803802
hpenv = env.copy()
804803
shprint(hostpython, 'setup.py', 'install', '-O2',
@@ -880,6 +879,7 @@ def rebuild_compiled_components(self, arch, env):
880879
shprint(hostpython, 'setup.py', self.build_cmd, '-v', _env=env,
881880
*self.setup_extra_args)
882881

882+
883883
class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
884884
""" Extensions that require the cxx-stl """
885885
call_hostpython_via_targetpython = False
@@ -902,22 +902,19 @@ def get_recipe_env(self, arch):
902902
" -lpython2.7" \
903903
" -lgnustl_shared".format(**keys)
904904

905-
906905
return env
907906

908-
def build_compiled_components(self,arch):
907+
def build_compiled_components(self, arch):
909908
super(CppCompiledComponentsPythonRecipe, self).build_compiled_components(arch)
910909

911910
# Copy libgnustl_shared.so
912911
with current_directory(self.get_build_dir(arch.arch)):
913912
sh.cp(
914-
"{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/libgnustl_shared.so".format(ctx=self.ctx,arch=arch),
913+
"{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/libgnustl_shared.so".format(ctx=self.ctx, arch=arch),
915914
self.ctx.get_libs_dir(arch.arch)
916915
)
917916

918917

919-
920-
921918
class CythonRecipe(PythonRecipe):
922919
pre_build_ext = False
923920
cythonize = True

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'on_new_intent': [],
88
'on_activity_result': [] }
99

10+
1011
class NewIntentListener(PythonJavaClass):
1112
__javainterfaces__ = [JNI_NAMESPACE + '/PythonActivity$NewIntentListener']
1213
__javacontext__ = 'app'
@@ -46,6 +47,7 @@ def bind(**kwargs):
4647
_activity.registerActivityResultListener(listener)
4748
_callbacks[event].append(listener)
4849

50+
4951
def unbind(**kwargs):
5052
for event, callback in kwargs.items():
5153
if event not in _callbacks:
@@ -58,4 +60,3 @@ def unbind(**kwargs):
5860
_activity.unregisterNewIntentListener(listener)
5961
elif event == 'on_activity_result':
6062
_activity.unregisterActivityResultListener(listener)
61-

pythonforandroid/recipes/android/src/android/billing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
===================
44
55
'''
6-

0 commit comments

Comments
 (0)