Skip to content

Commit

Permalink
chore: Avoid unnecessary assignment before for-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 28, 2024
1 parent 4f0694d commit df0eaa8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ def do_build():
# Collect the possible extension versions to build.
extension_versions = defaultdict(list)
with open(directory / "extension_versions.csv") as f:
reader = csv.DictReader(f)
for row in reader:
for row in csv.DictReader(f):
# Ignore v1.1 and v1.1.1 versions, as these are superseded by versions using the new extension.json format.
if row["Version"] not in {"v1.1", "v1.1.1"}:
extension_versions[row["Id"]].append(row)

# Collect the extension versions to build.
extensions = []
with open(directory / "extensions.csv") as f:
reader = csv.DictReader(f)
for row in reader:
for row in csv.DictReader(f):
versions = extension_versions[row["Id"]]

# Prefer frozen versions to live versions.
Expand Down Expand Up @@ -106,8 +104,7 @@ def add(url):
download_url = f"{url}/-/archive/master/{name}-master.zip"

with open(directory / "extension_versions.csv") as f:
reader = csv.DictReader(f)
for row in reader:
for row in csv.DictReader(f):
if row["Base URL"] == base_url:
raise click.BadParameter(f'Extension version with Base URL "{base_url}" already exists.')

Expand Down Expand Up @@ -143,8 +140,7 @@ def refresh():
}

with open(directory / "extension_versions.csv") as f:
reader = csv.DictReader(f)
for row in reader:
for row in csv.DictReader(f):
version = ExtensionVersion(row)
if version.date:
tags[version.id].append(version.version)
Expand Down

0 comments on commit df0eaa8

Please sign in to comment.