Skip to content

Commit 07d493f

Browse files
Pre-commit auto-fix
1 parent 9835dd8 commit 07d493f

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

_validate/addonManifest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def __init__(self, input: str | TextIOBase, translatedInput: str | None = None):
9191
)
9292
self._translatedConfig = None
9393
if translatedInput is not None:
94-
self._translatedConfig = ConfigObj(translatedInput, encoding='utf-8', default_encoding='utf-8')
95-
for key in ('summary', 'description', 'changelog'):
94+
self._translatedConfig = ConfigObj(translatedInput, encoding="utf-8", default_encoding="utf-8")
95+
for key in ("summary", "description", "changelog"):
9696
val = self._translatedConfig.get(key)
9797
if val:
9898
self[key] = val

_validate/createJson.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def _createDataclassMatchingJsonSchema(
108108

109109
# Add optional fields
110110
homepage = manifest.get("url")
111-
if homepage and homepage != 'None':
111+
if homepage and homepage != "None":
112112
# The config default is None
113113
# which is parsed by configobj as a string not a NoneType
114114
addonData["homepage"] = homepage
115115
changelog = manifest.get("changelog")
116-
if changelog and changelog != 'None':
116+
if changelog and changelog != "None":
117117
# The config default is None
118118
# which is parsed by configobj as a string not a NoneType
119119
addonData["changelog"] = changelog
@@ -130,7 +130,7 @@ def _createDataclassMatchingJsonSchema(
130130
"displayName": manifest["summary"],
131131
"description": manifest["description"],
132132
"changelog": manifest["changelog"],
133-
}
133+
},
134134
)
135135
except KeyError as e:
136136
raise KeyError(f"Translation for {langCode} missing required key '{e.args[0]}'.") from e

_validate/regenerateTranslations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def regenerateJsonFile(filePath: str, errorFilePath: str | None) -> None:
2424
errorFile.write(f"Validation Errors:\n{manifest.errors}")
2525
return
2626
changelog = manifest.get("changelog")
27-
if changelog == 'None':
27+
if changelog == "None":
2828
# The config default is None
2929
# which is parsed by configobj as a string not a NoneType
3030
changelog = None
@@ -35,7 +35,7 @@ def regenerateJsonFile(filePath: str, errorFilePath: str | None) -> None:
3535
"displayName": manifest["summary"],
3636
"description": manifest["description"],
3737
"changelog": changelog,
38-
}
38+
},
3939
)
4040

4141
with open(filePath, "wt", encoding="utf-8") as f:

_validate/validate.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,18 @@ def checkDescriptionMatches(manifest: AddonManifest, submission: JsonObjT) -> Va
133133
f" Instead got: '{submission['description']}'"
134134
)
135135

136+
136137
def checkChangelogMatches(manifest: AddonManifest, submission: JsonObjT) -> ValidationErrorGenerator:
137-
""" The submission changelog must match the *.nvda-addon manifest changelog field."""
138+
"""The submission changelog must match the *.nvda-addon manifest changelog field."""
138139
changelog = manifest.get("changelog")
139-
if changelog == 'None':
140+
if changelog == "None":
140141
# The config default is None which is parsed by configobj as a string not a NoneType
141142
changelog = None
142143
if changelog != submission.get("changelog"):
143-
yield f"Submission 'changelog' must be set to '{manifest.get('changelog')}' " \
144-
f"in json file instead of {submission.get('changelog')}"
144+
yield (
145+
f"Submission 'changelog' must be set to '{manifest.get('changelog')}' "
146+
f"in json file instead of {submission.get('changelog')}"
147+
)
145148

146149

147150
def checkUrlMatchesHomepage(manifest: AddonManifest, submission: JsonObjT) -> ValidationErrorGenerator:

tests/test_validate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def test_missingHTTPsAndExt(self):
8787

8888

8989
class Validate_checkSha256(unittest.TestCase):
90-
"""Tests for the checkSha256 function
91-
"""
90+
"""Tests for the checkSha256 function"""
91+
9292
validSha = "50a8011a807665bcb8fdd177c276fef3b3f7f754796c5990ebe14e80c28b14ef"
9393

9494
def test_valid(self):
@@ -163,22 +163,22 @@ def tearDown(self):
163163

164164
def test_valid(self):
165165
errors = list(
166-
validate.checkChangelogMatches(self.manifest, self.submissionData)
166+
validate.checkChangelogMatches(self.manifest, self.submissionData),
167167
)
168168
self.assertEqual(errors, [])
169169

170170
def test_invalid(self):
171171
badChangelog = "bad changelog"
172172
self.submissionData["changelog"] = badChangelog
173173
errors = list(
174-
validate.checkChangelogMatches(self.manifest, self.submissionData)
174+
validate.checkChangelogMatches(self.manifest, self.submissionData),
175175
)
176176
self.assertEqual(
177177
errors,
178178
[
179179
f"Submission 'changelog' must be set to '{self.manifest['changelog']}' in json file."
180-
f" Instead got: '{badChangelog}'"
181-
]
180+
f" Instead got: '{badChangelog}'",
181+
],
182182
)
183183

184184

0 commit comments

Comments
 (0)