Skip to content

Commit 049631d

Browse files
committed
Fix all the major linting errors
1 parent f72d5d5 commit 049631d

16 files changed

+34
-43
lines changed

apps/app_library/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import http_client
1111
import wifi
1212
import dialogs
13-
from app import *
13+
from app import App, get_local_apps, get_public_apps, get_public_app_categories, empty_local_app_cache
1414
import filesystem
1515

1616
TEMP_FILE = ".temp_download"
@@ -149,7 +149,7 @@ def store_category(category):
149149
def store_details(category, app):
150150
clear()
151151
empty_local_app_cache()
152-
with dialogs.WaitingMessage(text="Fetching app information...", title="TiLDA App Library") as message:
152+
with dialogs.WaitingMessage(text="Fetching app information...", title="TiLDA App Library"):
153153
app.fetch_api_information()
154154

155155
clear()
@@ -177,7 +177,7 @@ def remove():
177177

178178
if app:
179179
clear()
180-
with dialogs.WaitingMessage(text="Removing %s\nPlease wait..." % app, title="TiLDA App Library") as message:
180+
with dialogs.WaitingMessage(text="Removing %s\nPlease wait..." % app, title="TiLDA App Library"):
181181
for file in os.listdir(app.folder_path):
182182
os.remove(app.folder_path + "/" + file)
183183
os.remove(app.folder_path)

apps/changename/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Appname : Change name
66

77
import dialogs
8-
from database import *
8+
from database import Database
99
import buttons
1010
import ugfx
1111

apps/home/draw_name.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ugfx
2-
from database import *
3-
from filesystem import *
2+
from database import database_get
43

54
obj = []
65
sty = None

apps/home/file_loader.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
import pyb
44
import buttons
55
import dialogs
6-
from database import *
7-
from filesystem import *
8-
import uio
9-
import sys
6+
from database import database_get, database_set
7+
from filesystem import is_dir, is_file
108
import gc
11-
import onboard
12-
from app import *
9+
from app import get_local_apps, get_local_app_categories
1310

1411
ugfx.init()
1512
buttons.init()
@@ -73,8 +70,6 @@ def file_loader():
7370
components.append(author)
7471
components.append(desc)
7572

76-
app_to_load = None
77-
7873
pinned = database_get("pinned_apps", [])
7974
catergories = get_local_app_categories()
8075
c_ptr = 0

apps/home/home.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
import ugfx
1010
import pyb
11-
from database import *
12-
from filesystem import *
11+
from database import Database
12+
from filesystem import is_file
1313
import buttons
1414
import gc
1515
import apps.home.draw_name
1616
import wifi
1717
from imu import IMU
1818
import onboard
1919
import dialogs
20-
from app import *
20+
from app import get_local_apps
2121
import sys
2222
import ntp
2323

@@ -172,8 +172,6 @@ def home_main():
172172
win_wifi.show()
173173
win_clock.show()
174174

175-
min_ctr = 28
176-
177175
# Create external hooks so other apps can run code in the context of
178176
# the home screen.
179177
# To do so an app needs to have an external.py with a tick() function.

apps/home/quick_launch.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
import pyb
33
import buttons
44
import dialogs
5-
from database import *
6-
from filesystem import *
5+
from database import Database, database_get, database_set
76
import gc
8-
from app import *
7+
from app import App, empty_local_app_cache
98

109
ugfx.init()
1110
ugfx.set_default_style(dialogs.default_style_badge)
@@ -52,8 +51,6 @@ def quick_launch_screen():
5251
btn_menu = ugfx.Button(200,5,20,20,"M",parent=win_help,shape=ugfx.Button.ROUNDED)
5352
l_menu = ugfx.Label(230,5,100,20,"Menu",parent=win_help)
5453

55-
sty = dialogs.default_style_badge
56-
5754
win_header.show()
5855
win_quick.show()
5956
win_help.show()
@@ -63,8 +60,6 @@ def quick_launch_screen():
6360
last_cursor = cursor.copy()
6461
_draw_cursor(0, 0, ugfx.RED, win_quick)
6562

66-
app_to_load = "home"
67-
6863
if not database_get("quicklaunch_firstrun"):
6964
dialogs.notice("""This screen displays the most commonly used apps.
7065
Apps pinned here can also interact with the name screen.

apps/logger/external.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from filesystem import *
2-
from database import *
1+
from filesystem import is_file
2+
from database import database_get
33
import stm
44
import http_client
55
import wifi
@@ -13,7 +13,7 @@ def tick():
1313
bv = str(onboard.get_battery_voltage())
1414
uv = str(onboard.get_unreg_voltage())
1515
li = str(onboard.get_light())
16-
rssi = wifi.nic().get_rssi()
16+
wifi.nic().get_rssi()
1717

1818
aps = wifi.nic().list_aps()
1919
highest_rssi = -200
@@ -37,7 +37,7 @@ def tick():
3737
if database_get("stats_upload"):
3838
try:
3939
if wifi.nic().is_connected():
40-
with http_client.post('http://api.badge.emfcamp.org/api/barms', json=json) as resp:
40+
with http_client.post('http://api.badge.emfcamp.org/api/barms', json=json):
4141
pass
4242
except OSError as e:
4343
print("Upload failed " + str(e))

apps/logger/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
### Built-in: yes
77

88
import ugfx
9-
from filesystem import *
10-
from database import *
9+
from filesystem import is_file
10+
from database import database_get, database_set
1111
import pyb
1212
import math
1313
import buttons

examples/adc.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#This example shows how to use the ADC, and how to
22
# measure the internal reference to get a more accurate
33
# ADC reading
4+
import pyb
45

56
# set adc resolution to 12 bits
67
adca = pyb.ADCAll(12)
@@ -20,4 +21,4 @@
2021
# now calculate the USB voltage
2122
usb_voltage = usb_reading/4095*supply_voltage*2
2223

23-
print("usb_voltage: " + str(usb_voltage) + "\n")
24+
print("usb_voltage: " + str(usb_voltage) + "\n")

examples/dactest.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
dac = DAC(2)
1+
import pyb
2+
dac = pyb.DAC(2)
23

34
countdown = 10
45

@@ -7,4 +8,4 @@
78

89
pyb.delay(300)
910

10-
countdown -= 10
11+
countdown -= 10

examples/http.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import wifi
2-
from http_client import *
2+
from http_client import get
33

44
wifi.connect()
55

examples/read_light.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import pyb
12

23
#light sensor is on PA3 (note change this)
34
a = pyb.ADC('PA3')
45

56
while True:
67
print(str(a.read()))
7-
pyb.delay(1000)
8+
pyb.delay(1000)

examples/set_rtc_from_ntp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def getntptime():
1313
NTP_QUERY[0] = 0x1b
1414
addr = socket.getaddrinfo(host, 123)[0][-1]
1515
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
16-
res = s.sendto(NTP_QUERY, addr)
16+
s.sendto(NTP_QUERY, addr)
1717
msg = s.recv(48)
1818
s.close()
1919
import struct

lib/dialogs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def prompt_text(description, init_text = "", true_text="OK", false_text="Back",
114114
label.destroy()
115115
kb.destroy()
116116
edit.destroy();
117-
return default
117+
return
118118

119119
def prompt_option(options, index=0, text = "Please select one of the following:", title=None, select_text="OK", none_text=None):
120120
"""Shows a dialog prompting for one of multiple options

lib/filesystem.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
### Description: Small set of micropython specific filesystem helpers
33
### License: MIT
44

5-
import os, hashlib, binascii
5+
import os
6+
import hashlib
7+
import binascii
68

79
def get_app_foldername(path):
810
"""Gets the app name based on a path"""
@@ -39,7 +41,7 @@ def get_app_attribute(path, attribute):
3941
else:
4042
break
4143

42-
except OSError as e:
44+
except OSError:
4345
return ""
4446
return rv
4547

lib/ntp.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
### License: MIT
33

44
import database
5-
import pyb
65
import socket
76

87

@@ -17,7 +16,7 @@ def get_NTP_time():
1716
NTP_QUERY[0] = 0x1b
1817
addr = socket.getaddrinfo(NTP_HOST, NTP_PORT)[0][-1]
1918
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
20-
res = s.sendto(NTP_QUERY, addr)
19+
s.sendto(NTP_QUERY, addr)
2120

2221
# Setting timeout for receiving data. Because we're using UDP,
2322
# there's no need for a timeout on send.

0 commit comments

Comments
 (0)