Fix pylint issue E0606: possibly-used-before-assignment
Fix: assemblers/org.osbuild.qemu:310:36: E0606: Possibly using variable 'prep_type' before assignment (possibly-used-before-assignment) inputs/org.osbuild.tree:85:15: E0606: Possibly using variable 'path' before assignment (possibly-used-before-assignment) stages/org.osbuild.sfdisk:58:36: E0606: Possibly using variable 'prep_type' before assignment (possibly-used-before-assignment) stages/org.osbuild.systemd.unit:23:16: E0606: Possibly using variable 'unit_dropins_dir' before assignment (possibly-used-before-assignment) test/mod/test_meta.py:219:29: E0606: Possibly using variable 'schema_part' before assignment (possibly-used-before-assignment) Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
7f86ccc7fc
commit
3ac6d405b5
5 changed files with 10 additions and 0 deletions
|
|
@ -305,6 +305,8 @@ class PartitionTable:
|
||||||
prep_type = "41"
|
prep_type = "41"
|
||||||
elif self.label == "gpt":
|
elif self.label == "gpt":
|
||||||
prep_type = "9E1A2D38-C612-4316-AA26-8B49521E5A8B"
|
prep_type = "9E1A2D38-C612-4316-AA26-8B49521E5A8B"
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"Unknown partition table type: {self.label}")
|
||||||
|
|
||||||
for part in self.partitions:
|
for part in self.partitions:
|
||||||
if part.type.upper() == prep_type:
|
if part.type.upper() == prep_type:
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ class TreeInput(inputs.InputService):
|
||||||
# and we have exactly one reference, i.e. a pipeline id
|
# and we have exactly one reference, i.e. a pipeline id
|
||||||
pid, _ = refs.popitem()
|
pid, _ = refs.popitem()
|
||||||
|
|
||||||
|
path = None
|
||||||
if pid:
|
if pid:
|
||||||
path = store.read_tree_at(pid, target)
|
path = store.read_tree_at(pid, target)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ class PartitionTable:
|
||||||
prep_type = "41"
|
prep_type = "41"
|
||||||
elif self.label == "gpt":
|
elif self.label == "gpt":
|
||||||
prep_type = "9E1A2D38-C612-4316-AA26-8B49521E5A8B"
|
prep_type = "9E1A2D38-C612-4316-AA26-8B49521E5A8B"
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"Unknown partition table type: {self.label}")
|
||||||
|
|
||||||
for part in self.partitions:
|
for part in self.partitions:
|
||||||
if part.type.upper() == prep_type:
|
if part.type.upper() == prep_type:
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ def main(tree, options):
|
||||||
unit_dropins_dir = f"{tree}/usr/lib/systemd/system/{unit}.d"
|
unit_dropins_dir = f"{tree}/usr/lib/systemd/system/{unit}.d"
|
||||||
elif unit_type == "global":
|
elif unit_type == "global":
|
||||||
unit_dropins_dir = f"{tree}/usr/lib/systemd/user/{unit}.d"
|
unit_dropins_dir = f"{tree}/usr/lib/systemd/user/{unit}.d"
|
||||||
|
else:
|
||||||
|
print(f"Error: Unknown unit type: {unit_type}")
|
||||||
|
return 1
|
||||||
|
|
||||||
os.makedirs(unit_dropins_dir, exist_ok=True)
|
os.makedirs(unit_dropins_dir, exist_ok=True)
|
||||||
|
|
||||||
# We trick configparser into letting us write multiple instances of the same option by writing them as keys with no
|
# We trick configparser into letting us write multiple instances of the same option by writing them as keys with no
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ def make_fake_meta_json(tmp_path, name, version, invalid=""):
|
||||||
"not": "following schema"
|
"not": "following schema"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# pylint: disable=possibly-used-before-assignment
|
||||||
meta_json_path.write_text("""
|
meta_json_path.write_text("""
|
||||||
{
|
{
|
||||||
"summary": "some json summary",
|
"summary": "some json summary",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue