Skip to content

Commit 3c356bb

Browse files
committed
chore: Ruff format
1 parent 5f614a0 commit 3c356bb

File tree

12 files changed

+19
-25
lines changed

12 files changed

+19
-25
lines changed

benchmark/benchmark_snapshot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ def call_duration(path, sdk_url, config, mmc, blur):
7878

7979
def benchmark(args, executor):
8080
image = Image.open(args.image)
81-
for resolution in [(800, 600), (1280, 720), (1920, 1080), (2560, 1440), (3840, 2160)]:
81+
for resolution in [
82+
(800, 600),
83+
(1280, 720),
84+
(1920, 1080),
85+
(2560, 1440),
86+
(3840, 2160),
87+
]:
8288
image.resize(resolution).save("/tmp/platerec-benchmark.jpg")
8389
configs = [{}] if args.blur else [{}, dict(mode="fast")]
8490

docker/platerec_installer/stream_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def camera_spec():
160160

161161

162162
def base_config(config_path: Path, config=None):
163-
164163
spec = ConfigObj()
165164
spec["timezone"] = 'string(default="UTC")'
166165
spec["version"] = "integer(default=2)"

docker/sdk_manager/PlateRec_SDK_Manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def install():
164164
for ind, choice in enumerate(hardwares):
165165
print(f"{ind + 1}) {choice}")
166166
while True:
167-
168167
choice = str(input("What is the hardware of this machine > ") or "")
169168

170169
if choice == "5":

ftp_and_sftp_processor.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
def get_files_and_dirs(
33-
func: Callable[[Any, list, list, list], None]
33+
func: Callable[[Any, list, list, list], None],
3434
) -> Callable[[Any], tuple[list, list, list]]:
3535
def wrapper(self):
3636
file_list = self.list_files()
@@ -172,7 +172,6 @@ def process_files(self, ftp_files):
172172
with tempfile.NamedTemporaryFile(
173173
suffix="_" + ftp_file, mode="rb+"
174174
) as image:
175-
176175
self.set_ftp_binary_file(ftp_file, image)
177176
api_res = recognition_api(
178177
image,
@@ -195,7 +194,6 @@ def process_files(self, ftp_files):
195194
print(json.dumps(results, indent=2))
196195

197196
def get_month_literal(self, month_number):
198-
199197
month_mapping = {
200198
"01": "jan",
201199
"02": "feb",
@@ -280,7 +278,10 @@ def is_linux_os(self, file_list):
280278
# check if OS is Linux or Windows
281279
for info in file_list:
282280
info_first_possition = info[0]
283-
return bool(info_first_possition.startswith("d") or info_first_possition.startswith("-"))
281+
return bool(
282+
info_first_possition.startswith("d")
283+
or info_first_possition.startswith("-")
284+
)
284285

285286
def set_ftp_binary_file(self, file, image):
286287
"""Retrieve a file in binary transfer mode
@@ -405,7 +406,6 @@ def set_ftp_binary_file(self, file, image):
405406
self.sftp.getfo(wd + "/" + file, image)
406407

407408
def list_files(self):
408-
409409
file_list = []
410410

411411
try:
@@ -429,7 +429,6 @@ def list_files(self):
429429

430430
@get_files_and_dirs
431431
def retrieve_files(self, file_list, dirs, nondirs):
432-
433432
for info in file_list:
434433
name = info[-1]
435434
if info[0].startswith("d"):
@@ -575,7 +574,6 @@ def default_port():
575574

576575

577576
def ftp_process(args):
578-
579577
args_dict = vars(args)
580578

581579
if args.protocol == "ftp":

parkpow/verkada-lpr-webhooks/on_premise/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def process(self):
160160

161161
class RequestHandler(BaseHTTPRequestHandler):
162162
def __init__(self, wq: WebhookQueue, *args, **kwargs):
163-
164163
self.wq = wq
165164
super().__init__(*args, **kwargs)
166165

plate_recognition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ def save_cropped(api_res, path, args):
163163
box = result["box"]
164164
cropped = image.crop((box["xmin"], box["ymin"], box["xmax"], box["ymax"]))
165165
cropped.save(
166-
dest / f'{result["plate"]}_{result["region"]["code"]}_{path.name}'
166+
dest / f"{result['plate']}_{result['region']['code']}_{path.name}"
167167
)
168168
if args.crop_vehicle and result["vehicle"]["score"]:
169169
box = result["vehicle"]["box"]
170170
cropped = image.crop((box["xmin"], box["ymin"], box["xmax"], box["ymax"]))
171171
make_model = result.get("model_make", [None])[0]
172-
filename = f'{i}_{result["vehicle"]["type"]}_{path.name}'
172+
filename = f"{i}_{result['vehicle']['type']}_{path.name}"
173173
if make_model:
174-
filename = f'{make_model["make"]}_{make_model["model"]}_' + filename
174+
filename = f"{make_model['make']}_{make_model['model']}_" + filename
175175
cropped.save(dest / filename)
176176

177177

webhooks/middleware/consumer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def handle_webhook():
6565
return jsonify({"error": "Invalid JSON format"}), 400
6666

6767
try:
68-
6968
webhook_header = {
7069
"mac_address": request.headers.get("mac-address"),
7170
"camera_name": request.headers.get("camera-name"),

webhooks/middleware/protocols/crop_plate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def crop_image(image_data, crop_box):
2323
def process_request(
2424
json_data: dict[str, Any], all_files: dict[str, bytes] | None = None
2525
) -> tuple[str, int]:
26-
2726
if not all_files:
2827
logging.error("No files uploaded.")
2928
return "No files uploaded.", 400

webhooks/middleware/protocols/strip_plate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def strip_data_in_jsonl_file(
6161

6262

6363
def convert_plate_format_to_vehicle_format(original: dict[str, Any]):
64-
6564
new_payload = {
6665
"hook": deepcopy(original["hook"]),
6766
"data": {

webhooks/middleware/protocols/zatpark.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def extract_data_plate(
3737
int | None,
3838
int | None,
3939
]:
40-
4140
data_section = json_data.get("data", {})
4241
results = data_section.get("results")
4342

@@ -99,7 +98,6 @@ def extract_data_plate(
9998
def process_request(
10099
json_data: dict[str, Any], all_files: dict[str, bytes] | None = None
101100
) -> tuple[str, int]:
102-
103101
if not all_files:
104102
logging.error(
105103
"No files dictionary provided. 'vehicle' and 'plate' image_type are required."

0 commit comments

Comments
 (0)