Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy: Simplify HasSourceOfBase.prepare() #1948

Open
wants to merge 1 commit into
base: maintenance/gramps60
Choose a base branch
from

Conversation

stevenyoungs
Copy link
Contributor

mypy complains about the current code
gramps/gen/filters/rules/_hassourceofbase.py:69: error: Item "None" of "Source | None" has no attribute "handle" [union-attr]
so refactor and simplify to fix.

Exceptions are for exceptional behaviour. db.get_source_from_gramps_id returning None is not exceptional, so just handle it.

@stevenyoungs stevenyoungs force-pushed the hassourceofbase-prepare branch from 3741acf to 45eaae8 Compare February 9, 2025 20:23
@stevenyoungs stevenyoungs changed the base branch from master to maintenance/gramps60 February 9, 2025 20:23
It is not expcetional for db.get_source_from_gramps_id to return None so handle with a try block
@stevenyoungs stevenyoungs force-pushed the hassourceofbase-prepare branch from 45eaae8 to ae4e258 Compare February 9, 2025 20:24
@stevenyoungs stevenyoungs changed the title Simplify HasSourceOfBase.prepare() mpyp: Simplify HasSourceOfBase.prepare() Feb 9, 2025
@stevenyoungs stevenyoungs changed the title mpyp: Simplify HasSourceOfBase.prepare() mypy: Simplify HasSourceOfBase.prepare() Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants