From 2e16e67cde056fd350ac5f6517d80c2422bc51ae Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 30 Mar 2020 23:17:31 +0200 Subject: [PATCH] Fixes linting errors in runnable.py https://travis-ci.org/github/kivy/python-for-android/jobs/668867999 ``` runnable.py:17:1: E302 expected 2 blank lines, found 1 runnable.py:33:1: W293 blank line contains whitespace runnable.py:45:1: W293 blank line contains whitespace runnable.py:46:1: W293 blank line contains whitespace runnable.py:49:1: E303 too many blank lines (4) runnable.py:53:1: W293 blank line contains whitespace runnable.py:55:1: W293 blank line contains whitespace runnable.py:56:32: E261 at least two spaces before inline comment runnable.py:56:33: E262 inline comment should start with '# ' runnable.py:57:1: W293 blank line contains whitespace runnable.py:58:45: E231 missing whitespace after ':' runnable.py:59:1: W293 blank line contains whitespace runnable.py:61:1: W293 blank line contains whitespace runnable.py:64:1: W293 blank line contains whitespace ``` --- .../recipes/android/src/android/runnable.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pythonforandroid/recipes/android/src/android/runnable.py b/pythonforandroid/recipes/android/src/android/runnable.py index 9ed419eeaf..74268c803f 100644 --- a/pythonforandroid/recipes/android/src/android/runnable.py +++ b/pythonforandroid/recipes/android/src/android/runnable.py @@ -1,7 +1,6 @@ ''' Runnable ======== - ''' from jnius import PythonJavaClass, java_method, autoclass @@ -14,6 +13,7 @@ # is limited, so by caching them we avoid running out. __functionstable__ = {} + class Runnable(PythonJavaClass): '''Wrapper around Java Runnable class. This class can be used to schedule a call of a Python function into the PythonActivity thread. @@ -30,7 +30,6 @@ def __call__(self, *args, **kwargs): self.args = args self.kwargs = kwargs Runnable.__runnables__.append(self) - _PythonActivity.mActivity.runOnUiThread(self) @java_method('()V') @@ -42,24 +41,18 @@ def run(self): traceback.print_exc() Runnable.__runnables__.remove(self) - - def run_on_ui_thread(f): '''Decorator to create automatically a :class:`Runnable` object with the function. The function will be delayed and call into the Activity thread. ''' - if f not in __functionstable__: - - rfunction = Runnable(f) #store the runnable function - - __functionstable__[f] = {"rfunction":rfunction} - + rfunction = Runnable(f) # store the runnable function + __functionstable__[f] = {"rfunction": rfunction} rfunction = __functionstable__[f]["rfunction"] - + def f2(*args, **kwargs): rfunction(*args, **kwargs) - + return f2