mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-22 22:22:54 +02:00
Optional: Add auto-walrus (#158)
To learn the use of the Walrus opperator this hook integrates it in your code if it finds a reason for it. This branch is a suggestion of mine to force the use of the walrus operaor as an autofix to keep it in mind when programming. This should not increase the workload for us. It just lets us confront a new programming tool. It also isn't a rull to be follwed. Just a hook that looks at your code with an autofix.
This commit is contained in:
parent
1e2ca627ba
commit
7d6bb8b6f5
@ -87,3 +87,8 @@ repos:
|
||||
rev: 0.26.3
|
||||
hooks:
|
||||
- id: check-github-workflows
|
||||
|
||||
- repo: https://github.com/MarcoGorelli/auto-walrus
|
||||
rev: v0.2.2
|
||||
hooks:
|
||||
- id: auto-walrus
|
||||
|
@ -113,8 +113,7 @@ def get_district_court_id(name: str, city: str | None, db: Session) -> int:
|
||||
The id / privat key of a district court in the SQL-database.
|
||||
"""
|
||||
name, city = _refine_district_court_entry(name, city)
|
||||
court_id = _read_district_court_id(name, city, db)
|
||||
if court_id is not None:
|
||||
if (court_id := _read_district_court_id(name, city, db)) is not None:
|
||||
return court_id
|
||||
court = entities.DistrictCourt(name=name, city=city)
|
||||
db.add(court)
|
||||
@ -147,8 +146,7 @@ def get_person_id(
|
||||
f'At least one of the three values name: "{name}", surname: "{surname}" or date_of_birth: "{date_of_birth}" is empty.'
|
||||
)
|
||||
assert isinstance(date_of_birth, date) # noqa: S101
|
||||
person_id = _read_person_id(name, surname, date_of_birth, db)
|
||||
if person_id is not None:
|
||||
if (person_id := _read_person_id(name, surname, date_of_birth, db)) is not None:
|
||||
return person_id
|
||||
person = entities.Person(name=name, surname=surname, date_of_birth=date_of_birth)
|
||||
db.add(person)
|
||||
@ -404,6 +402,7 @@ def add_annual_financial_reports(companies: list[dict], db: Session) -> None:
|
||||
for year, report in yearly_results.items():
|
||||
if not report:
|
||||
continue
|
||||
|
||||
try:
|
||||
year_int = int(year)
|
||||
except ValueError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user