Skip to content

Commit a1717eb

Browse files
committed
flake8 linting
F401 - Unused imports: Removed atexit, base64, re, time, json, and pathlib.Path F403/F405 - Star imports: Replaced all from module import * with explicit imports: glrd.util: Now imports specific symbols like DEFAULTS, ERROR_CODES, etc. python_gardenlinux_lib: Now imports specific functions like parse_flavors_commit, get_s3_artifacts F841 - Unused variables: Fixed unused variables like minor, micro, e, merged_releases, formatted_change F541 - F-strings without placeholders: Converted f-strings to regular strings where no placeholders were used F811 - Redefinition: Fixed variable redefinitions F821 - Undefined names: Fixed test cases where result was being used but assigned to _ F824 - Unused global: Commented out unused global variable E303 - Extra blank lines: Fixed excessive blank lines E501 - line too long
1 parent c8519e8 commit a1717eb

File tree

9 files changed

+452
-166
lines changed

9 files changed

+452
-166
lines changed

glrd/manage.py

Lines changed: 176 additions & 81 deletions
Large diffs are not rendered by default.

glrd/query.py

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
import tabulate
1010
import yaml
1111

12-
from glrd.util import *
13-
from python_gardenlinux_lib.flavors.parse_flavors import *
14-
from python_gardenlinux_lib.s3.s3 import *
12+
from glrd.util import (
13+
DEFAULTS,
14+
ERROR_CODES,
15+
get_current_timestamp,
16+
timestamp_to_isotime,
17+
get_version,
18+
NoAliasDumper,
19+
)
1520

1621
DEFAULTS = dict(
1722
DEFAULTS,
@@ -207,7 +212,10 @@ def format_structured_output(releases, output_format):
207212
return json.dumps(data, indent=2)
208213
else: # yaml
209214
return yaml.dump(
210-
data, default_flow_style=False, sort_keys=False, Dumper=NoAliasDumper
215+
data,
216+
default_flow_style=False,
217+
sort_keys=False,
218+
Dumper=NoAliasDumper,
211219
)
212220

213221

@@ -386,7 +394,8 @@ def sort_key(r):
386394
if isinstance(major, int) and major >= 2000:
387395
return (major, minor, micro)
388396
else:
389-
# For versions < 2000.0.0 or non-integer majors (like 'next'), exclude micro from sorting
397+
# For versions < 2000.0.0 or non-integer majors (like 'next'),
398+
# exclude micro from sorting
390399
return (major, minor, 0)
391400

392401
return sorted(releases, key=sort_key)
@@ -414,7 +423,13 @@ def load_split_releases(
414423
release_type, input_type, input_url, input_file_prefix, input_format
415424
):
416425
"""Load and split releases based on type."""
417-
releases_next, releases_stable, releases_patch, releases_nightly, releases_dev = (
426+
(
427+
releases_next,
428+
releases_stable,
429+
releases_patch,
430+
releases_nightly,
431+
releases_dev,
432+
) = (
418433
[],
419434
[],
420435
[],
@@ -473,16 +488,17 @@ def load_all_releases(
473488
no_input_split=False,
474489
):
475490
"""Load releases either from a single source or split by type."""
476-
# if args.no_input_split:
477491
if no_input_split:
478-
# return load_releases(args.input, is_url=(args.input_type == 'url')).get('releases', [])
479-
return load_releases(input_source, is_url=(input_type == "url")).get(
492+
return load_releases(input_url, is_url=(input_type == "url")).get(
480493
"releases", []
481494
)
482495
else:
483-
# return load_split_releases(input)
484496
return load_split_releases(
485-
release_type, input_type, input_url, input_file_prefix, input_format
497+
release_type,
498+
input_type,
499+
input_url,
500+
input_file_prefix,
501+
input_format,
486502
)
487503

488504

@@ -524,7 +540,8 @@ def parse_arguments():
524540
parser.add_argument(
525541
"--no-input-split",
526542
action="store_true",
527-
help="Do not split Input into stable+patch and nightly. No additional input-files *-nightly and *-dev will be parsed.",
543+
help="Do not split Input into stable+patch and nightly. No additional "
544+
"input-files *-nightly and *-dev will be parsed.",
528545
)
529546

530547
parser.add_argument(
@@ -538,7 +555,8 @@ def parse_arguments():
538555
"--output-description",
539556
type=str,
540557
default=DEFAULTS["QUERY_OUTPUT_DESCRIPTION"],
541-
help="Description, added to certain outputs, e.g. mermaid (default: 'Garden Linux Releases').",
558+
help="Description, added to certain outputs, e.g. mermaid "
559+
"(default: 'Garden Linux Releases').",
542560
)
543561

544562
parser.add_argument(
@@ -559,13 +577,15 @@ def parse_arguments():
559577
"--type",
560578
type=str,
561579
default=DEFAULTS["QUERY_TYPE"],
562-
help="Filter by release types (comma-separated list, default: stable,patch). E.g., --type stable,patch,nightly,dev,next",
580+
help="Filter by release types (comma-separated list, default: "
581+
"stable,patch). E.g., --type stable,patch,nightly,dev,next",
563582
)
564583

565584
parser.add_argument(
566585
"--version",
567586
type=str,
568-
help="Filter by a specific version (major or major.minor.micro). E.g., --version 1312 or --version 1312.0 or --version 1312.0.0",
587+
help="Filter by a specific version (major or major.minor.micro). "
588+
"E.g., --version 1312 or --version 1312.0 or --version 1312.0.0",
569589
)
570590

571591
parser.add_argument(
@@ -581,7 +601,9 @@ def parse_arguments():
581601
)
582602

583603
parser.add_argument(
584-
"--no-header", action="store_true", help="Omit the header in shell output."
604+
"--no-header",
605+
action="store_true",
606+
help="Omit the header in shell output.",
585607
)
586608

587609
parser.add_argument("-V", action="version", version=f"%(prog)s {get_version()}")

glrd/schema_v1.py

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,31 @@
2121
"released": {
2222
"type": "object",
2323
"properties": {
24-
"isodate": {"type": "string", "format": "date"},
24+
"isodate": {
25+
"type": "string",
26+
"format": "date",
27+
},
2528
"timestamp": {"type": "integer"},
2629
},
2730
"required": ["isodate", "timestamp"],
2831
},
2932
"extended": {
3033
"type": "object",
3134
"properties": {
32-
"isodate": {"type": ["string"], "format": "date"},
35+
"isodate": {
36+
"type": ["string"],
37+
"format": "date",
38+
},
3339
"timestamp": {"type": ["integer"]},
3440
},
3541
},
3642
"eol": {
3743
"type": "object",
3844
"properties": {
39-
"isodate": {"type": ["string"], "format": "date"},
45+
"isodate": {
46+
"type": ["string"],
47+
"format": "date",
48+
},
4049
"timestamp": {"type": ["integer"]},
4150
},
4251
},
@@ -62,22 +71,31 @@
6271
"released": {
6372
"type": "object",
6473
"properties": {
65-
"isodate": {"type": "string", "format": "date"},
74+
"isodate": {
75+
"type": "string",
76+
"format": "date",
77+
},
6678
"timestamp": {"type": "integer"},
6779
},
6880
"required": ["isodate", "timestamp"],
6981
},
7082
"extended": {
7183
"type": "object",
7284
"properties": {
73-
"isodate": {"type": ["string"], "format": "date"},
85+
"isodate": {
86+
"type": ["string"],
87+
"format": "date",
88+
},
7489
"timestamp": {"type": ["integer"]},
7590
},
7691
},
7792
"eol": {
7893
"type": "object",
7994
"properties": {
80-
"isodate": {"type": ["string"], "format": "date"},
95+
"isodate": {
96+
"type": ["string"],
97+
"format": "date",
98+
},
8199
"timestamp": {"type": ["integer"]},
82100
},
83101
},
@@ -106,15 +124,21 @@
106124
"released": {
107125
"type": "object",
108126
"properties": {
109-
"isodate": {"type": "string", "format": "date"},
127+
"isodate": {
128+
"type": "string",
129+
"format": "date",
130+
},
110131
"timestamp": {"type": "integer"},
111132
},
112133
"required": ["isodate", "timestamp"],
113134
},
114135
"eol": {
115136
"type": "object",
116137
"properties": {
117-
"isodate": {"type": ["string"], "format": "date"},
138+
"isodate": {
139+
"type": ["string"],
140+
"format": "date",
141+
},
118142
"timestamp": {"type": ["integer"]},
119143
},
120144
},
@@ -124,8 +148,14 @@
124148
"git": {
125149
"type": "object",
126150
"properties": {
127-
"commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
128-
"commit_short": {"type": "string", "pattern": "^[0-9a-f]{7,8}$"},
151+
"commit": {
152+
"type": "string",
153+
"pattern": "^[0-9a-f]{40}$",
154+
},
155+
"commit_short": {
156+
"type": "string",
157+
"pattern": "^[0-9a-f]{7,8}$",
158+
},
129159
},
130160
"required": ["commit", "commit_short"],
131161
},
@@ -141,7 +171,14 @@
141171
"required": ["source_repo"],
142172
},
143173
},
144-
"required": ["name", "type", "version", "lifecycle", "git", "github"],
174+
"required": [
175+
"name",
176+
"type",
177+
"version",
178+
"lifecycle",
179+
"git",
180+
"github",
181+
],
145182
},
146183
"nightly": {
147184
"type": "object",
@@ -162,7 +199,10 @@
162199
"released": {
163200
"type": "object",
164201
"properties": {
165-
"isodate": {"type": "string", "format": "date"},
202+
"isodate": {
203+
"type": "string",
204+
"format": "date",
205+
},
166206
"timestamp": {"type": "integer"},
167207
},
168208
"required": ["isodate", "timestamp"],
@@ -173,8 +213,14 @@
173213
"git": {
174214
"type": "object",
175215
"properties": {
176-
"commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
177-
"commit_short": {"type": "string", "pattern": "^[0-9a-f]{7,8}$"},
216+
"commit": {
217+
"type": "string",
218+
"pattern": "^[0-9a-f]{40}$",
219+
},
220+
"commit_short": {
221+
"type": "string",
222+
"pattern": "^[0-9a-f]{7,8}$",
223+
},
178224
},
179225
"required": ["commit", "commit_short"],
180226
},
@@ -206,7 +252,10 @@
206252
"released": {
207253
"type": "object",
208254
"properties": {
209-
"isodate": {"type": "string", "format": "date"},
255+
"isodate": {
256+
"type": "string",
257+
"format": "date",
258+
},
210259
"timestamp": {"type": "integer"},
211260
},
212261
"required": ["isodate", "timestamp"],
@@ -217,8 +266,14 @@
217266
"git": {
218267
"type": "object",
219268
"properties": {
220-
"commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
221-
"commit_short": {"type": "string", "pattern": "^[0-9a-f]{7,8}$"},
269+
"commit": {
270+
"type": "string",
271+
"pattern": "^[0-9a-f]{40}$",
272+
},
273+
"commit_short": {
274+
"type": "string",
275+
"pattern": "^[0-9a-f]{7,8}$",
276+
},
222277
},
223278
"required": ["commit", "commit_short"],
224279
},

0 commit comments

Comments
 (0)