Enable check_untyped_defs and make mypy hook blocking
Fix the 13 errors that surfaced under mypy --check-untyped-defs so the flag can be turned on permanently in pyproject.toml, and drop the advisory exit-0 wrapper on the mypy pre-commit hook now that the tree is clean. - _plugin_manager: rename colliding loop vars (module/name were reused with conflicting types) and guard spec/spec.loader from spec_from_file_location; call __init__ via the class in __setstate__. - __main__: pass Verbosity(options.verbose), not a bare int. - subprocess/_check: widen package to str | Mapping[str, str] to match _error_trailer's existing per-platform handling. - optimize.main: annotate the standalone PdfContext(..., None, None) that only ever reads context.options.
This commit is contained in:
@@ -774,7 +774,9 @@ def main(infile, outfile, level, jobs=1):
|
||||
)
|
||||
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
context = PdfContext(options, Path(tmpdir), infile, None, None)
|
||||
# optimize() only reads context.options on this standalone path, so
|
||||
# pdfinfo and plugin_manager are not needed.
|
||||
context = PdfContext(options, Path(tmpdir), infile, None, None) # type: ignore[arg-type]
|
||||
tmpout = Path(tmpdir) / 'out.pdf'
|
||||
optimize(
|
||||
infile,
|
||||
|
||||
Reference in New Issue
Block a user