From d77af2e4175b7ecf78b44bf60de511b294ce491e Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 6 Aug 2023 08:09:02 +0200 Subject: [PATCH] Linter fixes (#2874) The errors were: ``` pythonforandroid/bootstrap.py:136:5: F811 redefinition of unused 'name' from line 73 pythonforandroid/build.py:111:5: F811 redefinition of unused 'libs_dir' from line 82 pythonforandroid/build.py:127:5: F811 redefinition of unused 'aars_dir' from line 83 pythonforandroid/graph.py:48:12: E721 do not compare types, for exact checks use `is` pythonforandroid/graph.py:163:20: E721 do not compare types, for exact checks use `is` tests/test_build.py:39:41: E231 missing whitespace after ',' tests/test_build.py:40:58: E231 missing whitespace after ',' tests/test_build.py:41:61: E231 missing whitespace after ',' tests/test_build.py:42:71: E231 missing whitespace after ',' ``` (cherry picked from commit be650bcfa82dcc7cd3007401ddf5844c9937078a) --- pythonforandroid/bootstrap.py | 1 - pythonforandroid/build.py | 9 ++++----- pythonforandroid/graph.py | 4 ++-- tests/test_build.py | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pythonforandroid/bootstrap.py b/pythonforandroid/bootstrap.py index 0a5225e526..0712f9081a 100755 --- a/pythonforandroid/bootstrap.py +++ b/pythonforandroid/bootstrap.py @@ -70,7 +70,6 @@ class Bootstrap: '''An Android project template, containing recipe stuff for compilation and templated fields for APK info. ''' - name = '' jni_subdir = '/jni' ctx = None diff --git a/pythonforandroid/build.py b/pythonforandroid/build.py index 42b6b52add..04808be902 100644 --- a/pythonforandroid/build.py +++ b/pythonforandroid/build.py @@ -77,11 +77,6 @@ class Context: # the Android project folder where everything ends up dist_dir = None - # where Android libs are cached after build - # but before being placed in dists - libs_dir = None - aars_dir = None - # Whether setup.py or similar should be used if present: use_setup_py = False @@ -109,6 +104,10 @@ def templates_dir(self): @property def libs_dir(self): + """ + where Android libs are cached after build + but before being placed in dists + """ # Was previously hardcoded as self.build_dir/libs directory = join(self.build_dir, 'libs_collections', self.bootstrap.distribution.name) diff --git a/pythonforandroid/graph.py b/pythonforandroid/graph.py index bdaca4349c..4edb8f4c90 100644 --- a/pythonforandroid/graph.py +++ b/pythonforandroid/graph.py @@ -45,7 +45,7 @@ def get_dependency_tuple_list_for_recipe(recipe, blacklist=None): """ if blacklist is None: blacklist = set() - assert type(blacklist) == set + assert type(blacklist) is set if recipe.depends is None: dependencies = [] else: @@ -160,7 +160,7 @@ def obvious_conflict_checker(ctx, name_tuples, blacklist=None): current_to_be_added = list(to_be_added) to_be_added = [] for (added_tuple, adding_recipe) in current_to_be_added: - assert type(added_tuple) == tuple + assert type(added_tuple) is tuple if len(added_tuple) > 1: # No obvious commitment in what to add, don't check it itself # but throw it into deps for later comparing against diff --git a/tests/test_build.py b/tests/test_build.py index 6d30f996e7..0210e13281 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -36,10 +36,10 @@ def test_strip_if_with_debug_symbols(self): modules = ["mymodule"] project_dir = None with mock.patch('pythonforandroid.build.info'), \ - mock.patch('sh.Command'),\ - mock.patch('pythonforandroid.build.open'),\ - mock.patch('pythonforandroid.build.shprint'),\ - mock.patch('pythonforandroid.build.current_directory'),\ + mock.patch('sh.Command'), \ + mock.patch('pythonforandroid.build.open'), \ + mock.patch('pythonforandroid.build.shprint'), \ + mock.patch('pythonforandroid.build.current_directory'), \ mock.patch('pythonforandroid.build.CythonRecipe') as m_CythonRecipe, \ mock.patch('pythonforandroid.build.project_has_setup_py') as m_project_has_setup_py, \ mock.patch('pythonforandroid.build.run_setuppy_install'):