Skip to content

Commit 3d9ae35

Browse files
authored
global variable naming fix code.py
adding invalid-name to each # pylint: disable=global-statement line catches it where it actually fires. All 10 global lines now have both disables.
1 parent ad19a70 commit 3d9ae35

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

PyPortal_Art_Display/code.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def get_tilt_angle():
155155
def check_tilt_skip():
156156
'''Check if display is tilted left or right long enough.
157157
Returns True if held in either zone for TILT_HOLD_TIME.'''
158-
global tilt_start # pylint: disable=global-statement
158+
global tilt_start # pylint: disable=global-statement,invalid-name
159159
if not USE_ACCEL:
160160
return False
161161
angle = get_tilt_angle()
@@ -190,7 +190,7 @@ def check_tilt_skip():
190190
def check_shake():
191191
'''Detect shake gesture from acceleration spikes.
192192
Returns True if enough spikes within time window.'''
193-
global shake_times # pylint: disable=global-statement
193+
global shake_times # pylint: disable=global-statement,invalid-name
194194
if not USE_ACCEL:
195195
return False
196196
accel_x, accel_y, accel_z = lis3dh.acceleration
@@ -494,7 +494,7 @@ def generate_chirp_wav():
494494

495495
def load_local_images():
496496
'''Scan /sd/imgs/ for BMP files.'''
497-
global local_images # pylint: disable=global-statement
497+
global local_images # pylint: disable=global-statement,invalid-name
498498
local_images = []
499499
try:
500500
for fname in os.listdir(LOCAL_IMG_PATH):
@@ -508,7 +508,7 @@ def load_local_images():
508508
def next_mode(steps=1):
509509
'''Cycle feed mode forward by steps.
510510
Skips online modes if settings are missing.'''
511-
global feed_index, current_feed # pylint: disable=global-statement
511+
global feed_index, current_feed # pylint: disable=global-statement,invalid-name
512512
feed_index = (feed_index + steps) % len(FEED_MODES)
513513
# Skip online modes if WiFi/AIO keys are missing
514514
if not online_available:
@@ -720,7 +720,7 @@ def show_online_image():
720720
'''Fetch and display an image from the API.
721721
Returns True on success, False on failure,
722722
or "mode" if screen was tapped mid-load.'''
723-
global display_file, prefetch_file # pylint: disable=global-statement
723+
global display_file, prefetch_file # pylint: disable=global-statement,invalid-name
724724
url = build_feed_url()
725725
print("Fetching:", url)
726726
status_text.text = "Fetching..."
@@ -820,7 +820,7 @@ def prefetch_online_image():
820820
Current image stays on screen during download.
821821
Returns True on success, False on failure,
822822
or "mode" if screen was tapped mid-load.'''
823-
global prefetch_ready, prefetch_title # pylint: disable=global-statement
823+
global prefetch_ready, prefetch_title # pylint: disable=global-statement,invalid-name
824824
prefetch_ready = False
825825
prefetch_title = ""
826826
status_text.text = "Prefetching..."
@@ -899,8 +899,8 @@ def display_prefetched():
899899
'''Instantly display the prefetched image.
900900
Swaps cache file roles so next prefetch writes
901901
to the file that is no longer on screen.'''
902-
global prefetch_ready # pylint: disable=global-statement
903-
global display_file, prefetch_file # pylint: disable=global-statement
902+
global prefetch_ready # pylint: disable=global-statement,invalid-name
903+
global display_file, prefetch_file # pylint: disable=global-statement,invalid-name
904904
if not prefetch_ready:
905905
return False
906906
wipe_transition(prefetch_file)
@@ -927,8 +927,8 @@ def wait_for_input(duration):
927927
Returns "skip" for D3 button, tilt, or shake.
928928
Returns "mode" for screen tap.
929929
Returns "timeout" if time expires.'''
930-
global tilt_start # pylint: disable=global-statement
931-
global shake_times # pylint: disable=global-statement
930+
global tilt_start # pylint: disable=global-statement,invalid-name
931+
global shake_times # pylint: disable=global-statement,invalid-name
932932
stamp = time.monotonic()
933933
tap_cooldown = stamp + 1.0 # ignore taps for 1s
934934
btn_was_pressed = False

0 commit comments

Comments
 (0)