Remove assert statements from production code
This commit is contained in:
parent
6d8cb299aa
commit
ef89b536fc
3 changed files with 7 additions and 8 deletions
|
|
@ -14,7 +14,8 @@ with open(os.path.join("webapp", "package.json"), "r", encoding="utf-8") as json
|
|||
py_ver = pyproject_data["project"]["version"]
|
||||
js_ver = webapp_data["version"]
|
||||
|
||||
assert py_ver == js_ver, (
|
||||
# Allow an assert here as this is a CI script, not production code.
|
||||
assert py_ver == js_ver, ( # noqa S101
|
||||
"The python and javascript version numbers should match.\n"
|
||||
f"Python version: {py_ver}\n"
|
||||
f"Javascript version: {js_ver}\n"
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ select = [
|
|||
"N", # PEP8 naming
|
||||
"D", # Docstring checks
|
||||
"ERA001", # Commented out code!
|
||||
"S101",# No asserts!
|
||||
"ANN",
|
||||
]
|
||||
|
||||
|
|
@ -139,14 +140,10 @@ ignore = [
|
|||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# Tests are currently not fully docstring-ed, we'll ignore this for now.
|
||||
"tests/*" = [
|
||||
"B018", # Complaining about useless attribute access in tests, but we need them to check errors are raised
|
||||
"ANN", # Tests are not typehinted for fixtures etc
|
||||
]
|
||||
"hardware-specific-tests/*" = [
|
||||
"{tests,integration-tests,hardware-specific-tests}/**" = [
|
||||
"B018", # Complaining about useless attribute access in tests, but we need them to check errors are raised
|
||||
"ANN", # Tests are not typehinted for fixtures etc
|
||||
"S101", # Allow asserts in tests
|
||||
]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ def set_static_lst(
|
|||
adaptive tweaking by the algorithm.
|
||||
"""
|
||||
for table in luminance, cr, cb:
|
||||
assert np.array(table).shape == (12, 16), "Lens shading tables must be 12x16!"
|
||||
if np.array(table).shape != (12, 16):
|
||||
raise ValueError("Lens shading tables must be 12x16!")
|
||||
alsc = Picamera2.find_tuning_algo(tuning, "rpi.alsc")
|
||||
alsc["n_iter"] = 0 # disable the adaptive part
|
||||
alsc["luminance_strength"] = 1.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue