feat: fix latent pylint errors in many source files #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is toward #114. We'd like to replace the many-entrypoint linting with the single-entrypoint
pre-commit
tool. When run in CI, we'll runpre-commit
against all files for convenience. So, I ran pylint against all files in DGP and found some latent issues in master. This MR addresses the issues. The issues are almost entirely documentation issues, so the bulk of this MR is docs changes.Note one quirk. According to the numpydoc style guide, we should be able to document parameters as
if
name
gets a default value such as inf(name: str = "asdf")
. However,pylint
with the numpydoc plugin does not seem to recognize thedefault: value
syntax when placed inline with the type documentation. To get around this, we use the canonicaloptional
annotation and move the default value annotation into the parameter description.Besides these docs changes, this does introduce some new code for calls to
open
. Pylint is very strict and requires we provide an encoding, so we just explicitly specify what will be used as the default in the end anyway,locale.getpreferredencoding()
. Alternatively, we could suppress this pylint warning. This is only done for text-mode (not binary-mode) files.Lastly, there were a few places where I simply couldn't intuit the types reasonably. In these cases (and in test code), I simply asked pylint to ignore missing docs.
Checks
I built the docs locally after this change. There are very many Sphinx warnings about unexpected section titles (for all sections:
Parameters
,Returns
, etc.) in documentation of callables. These issues appear to exist on master already.I reviewed the built documentation (and PDF, a la
rinoh
), and they still appear conveniently human-readable to me.This change is