-
Notifications
You must be signed in to change notification settings - Fork 565
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
Logging exceptions from Literal value converters #1944
Conversation
b351404
to
0cd7713
Compare
Some options for running type checking: With docker compose:
Or:
With tox - this will run mypy and unit tests after:
With go-task in a virtual environment:
|
bd797e6
to
1397afd
Compare
@aucampia what's the policy on updating function/variable names per the "extra-tasks" job? They're pre-existing names, so I didn't see fit to update them. |
It is okay if you don't for now, flakeheaven is the best option we have for gradually getting the codebase to pass with flake8, it is not perfect though, as the baseline kind of gets confused when a file is edited, so sometimes you get errors like you saw now. I will fix them after merging, the most important thing is that we want to catch new code that causes flake8 errors. That is also why I made it report errors separately. |
win 3.10 failure is an unrelated socket error. could someone re-run? |
Will do, just waiting for others to complete. |
Kudos, SonarCloud Quality Gate passed! |
This patch setups up some flake8 ignores for names that will come up more in the future now that we have flakehell running. One case where this is relevant: - RDFLib#1944
This patch setups up some flake8 ignores for names that will come up more in the future now that we have flakehell running. One case where this is relevant: - RDFLib#1944
This is mainly to address issues experienced with flake8 in RDFLib#1944
This patch setups up some flake8 ignores for names that will come up more in the future now that we have flakehell running. One case where this is relevant: - #1944
This is mainly to address issues experienced with flake8 in #1944
48003ba
to
330e8ef
Compare
- Also, adding a function to reset bindings so tests are less order-dependent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your change looks good, I'm a bit on the fence of using logging.warning
though, it has the benefit over warnings.warn
that you can see the stack trace, but it has the downside that it is less easy for users to handle programmatically.
The rest of the change makes some much needed improvement.
On a related note, you may be interested in the recently added https://rdflib.readthedocs.io/en/latest/apidocs/rdflib.html#rdflib.term.Literal.ill_formed
Which is basically what this warning will be for:
https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal
Otherwise, the literal is ill-typed and no literal value can be associated with the literal. Such a case produces a semantic inconsistency but is not syntactically ill-formed. Implementations must accept ill-typed literals and produce RDF graphs from them. Implementations may produce warnings when encountering ill-typed literals.
@aucampia thanks. I hit this because I didn't have html5lib installed and parsing for the HTML literal failed (probably should have mentioned in the description...) Regarding warnings vs logging, main thing I wanted was a stack trace. I tend to see logs from other modules even when I don't see warnings -- not exactly conclusive, but it's pretty consistent for the applications I've worked on. |
I think this is reasonable, without a stack trace the warnings are of limited use, and while getting stack traces from |
Summary of changes
Adds logging at warning level for exceptions raised when trying to convert a Literal's lexical form into Python-value space. Also refactored to not have
convFunc
be a boolean -- I think it should resolve the type-checking issue, but I don't know how to run the type checker.Checklist
the same change.
./examples
for new features.CHANGELOG.md
).so maintainers can fix minor issues and keep your PR up to date.