25 Commits

Author SHA1 Message Date
Brad Warren
608d731e2b Make mypy pass on our tests (#9648)
* make mypy pass on our tests

* fix grammar
2023-03-31 09:20:44 +11:00
Brad Warren
6832521272 Make acme tests internal (#9625)
This is a first step towards implementing the plan I described at https://github.com/certbot/certbot/issues/7909#issuecomment-1448675456 which got a +1 from both Erica and Will. Similar changes for our other packages will be made in followup PRs to try and make this easier to review.

It may be helpful to look at https://github.com/certbot/certbot/pull/7600 when reviewing this PR where we did something similar in the past.

The value of `ignore-paths` in `.pylintrc` should work on Windows based on https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html#ignore-paths and the fact that on macOS/linux, changing path delimiters to `\` still causes these directories to be ignored.

I started testing this for mypy as well, but mypy doesn't current pass for us on Windows so I didn't bother and took this opportunity to remove it from the default environments in `tox.ini`. I'll update https://github.com/certbot/certbot/issues/7803 to mention that the value of `exclude` in `mypy.ini` may need to be tweaked if anyone works on that issue.

* make acme tests internal

* no mypy-win
2023-03-28 14:02:33 -07:00
Adrien Ferrand
0181a0b07f Fully type certbot apache (#9177)
* Work in progress

* Work in progress

* Work in progress

* Work in progress

* Fix issues around nullability of VirtualHost.path, may discuss that during review

* Work in progress

* Fix remaining types

* Various lint fixes

* Reconfigure tox and mypy to disallow untyped defs globally

* Cleanup compatibility tests

* Use cast for unused v2 logic

* Improve types

* Remove unused comment

* Fix coverage

* Better types

* Fix another type

* Update certbot-apache/certbot_apache/_internal/apacheparser.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot-apache/certbot_apache/_internal/assertions.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix type

* Various fixes

* Refactor imports

* Keep naming convention consistent on TypeVars

* Improve types

* Improve types

* Remove remaining Sequence[str] in the project

Co-authored-by: alexzorin <alex@zor.io>
2022-01-31 19:17:40 +11:00
Adrien Ferrand
a0f22d21ce Add type annotations to the acme project (#9036)
* Start more types

* Second run

* Work in progress

* Types in all acme module

* Various fixes

* Various fixes

* Final fixes

* Disallow untyped defs for acme project

* Fix coverage

* Remote unecessary type ignore

* Use Mapping instead of Dict as input whenever it is possible

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/client.py

Co-authored-by: alexzorin <alex@zor.io>

* Various fixes

* Fix code

* Fix code

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/challenges.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Fix deactivate_registration and simplify signature of update_registration

* Do not leak personal data during account deactivation

* Clean more Dicts

* New fix to not leak contact field in the account deactivation payload.

* Add ignore for python 3.6 type check

* Revert "Add ignore for python 3.6 type check"

This reverts commit da7338137b798e3ace34de15ed12f76ec3cf3888.

* Let's find a smarter way than "type: ignore"

* Update certbot/certbot/_internal/account.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix an annotation

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: alexzorin <alex@zor.io>
2021-10-25 09:43:21 +11:00
Brad Warren
75365f1d4e Remove python_version setting from mypy.ini (#8426)
* Remove python_version from mypy.ini.

* Fix magic_typing

* Ignore msvcrt usage.

* make mypy happier

* clean up changes

* Add type for reporter queue

* More mypy fixes

* Fix pyrfc3339 str.

* Remove unused import.

* Make certbot.util mypy work in both Pythons

* Fix typo
2020-11-05 15:28:35 -08:00
Brad Warren
fd64c8c33b Remove letshelp-certbot (#7761)
* remove references to letshelp

* remove letshelp files

* Remove line continuation

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2020-02-14 17:19:19 -08:00
Brad Warren
c9a206ca89 Get mypy passing with check_untyped_defs everywhere (#6021)
* unchecked_typed_defs everywhere

* fix mypy for lock_test

* add magic_typing

* fix mypy in letshelp

* fix validator errors in compat test

* fix mypy for test_driver.py

* fix mypy in util.py

* delint
2018-05-21 20:23:21 -07:00
Dmitry Figol
36dfd06503 Prepare certbot module for mypy check untyped defs (#6005)
* Prepare certbot module for mypy check untyped defs

* Fix #5952

* Bump mypy to version 0.600 and fix associated bugs

* Fix pylint bugs after introducing mypy

* Implement Brad's suggestions

* Reenabling pylint and adding nginx mypy back
2018-05-18 06:28:17 -07:00
Brad Warren
94bf97b812 Add remaining DNS plugins to mypy.ini and sort (#6018) 2018-05-18 12:26:10 +03:00
GmH
751f9843b4 fixed issue #5974 for certbot-dns-route53 (#5984)
* fixed issue #5974 for certbot-dns-route53

* fixed issue #5967 for certbot-dns-digitalocean

* update to use acme.magic_typing and DefaultDict class

* added no-name-in-module identifier, for issue #5974

* added unused-import identifier to disable option, for issue #5974
2018-05-15 11:22:09 -07:00
dschlessman
9bd5b3dda2 Issue 5951/check untyped defs apache (#5989)
* resolved mypy untyped defs in parser.py

* resolved mypy untyped defs in obj.py

* removed unused imports

* resolved mypy untyped defs in http_01.py

* resolved mypy untyped defs in tls_sni_01.py

* resolved mypy untyped defs in configurator.py

* address mypy too-many-arguments error in override_centos.py

* resolved mypy untyped defs in http_01_test.py

* removed unused 'conf' argument that was causing mypy method assignment error

* address mypy error where same variable reassigned to different type

* address pylint and coverage issues

* one character space change for formatting

* fix required acme version for certbot-apache
2018-05-15 10:40:32 -07:00
James Hiebert
307f45f88f Enable checking of type annotation in Nginx plugin (#5997)
* Adds type checking for certbot-nginx

* First pass at type annotation in certbot-nginx

* Ensure linting is disabled for timing imports

* Makes container types specific per PR comments

* Removes unnecessary lint option
2018-05-15 09:36:47 -07:00
Douglas Anger
907ee79715 Check_untyped_defs in mypy with clean output for certbot-dns-nsone (#5987)
* check_untyped_defs in mypy with clean output for certbot-dns-nsone

Resolves #5972
2018-05-14 13:18:49 -07:00
Brad Warren
19c6a5e6ee Merge branch 'issue_5968' into handle-mypy-ini-conflicts 2018-05-14 11:12:31 -07:00
Brad Warren
875c8d4c01 Merge branch 'feature/5971' into handle-mypy-ini-conflicts 2018-05-14 11:11:08 -07:00
Brad Warren
8d994ae30d Merge branch 'issue_5970' into handle-mypy-ini-conflicts 2018-05-14 11:10:30 -07:00
Sarah Braden
be03a976d5 fixed issue #5969 for certbot-dns-dnsmadeeasy (#5976) 2018-05-14 10:54:26 -07:00
Sarah Braden
33583792fa blank line at eof 2018-05-14 13:43:15 -04:00
Sarah Braden
430f9414a9 fix for issue #5968 for certbot-dns-dnsimple 2018-05-14 13:42:12 -04:00
Douglas Anger
5636b55507 Check_untyped_defs in mypy with clean output for certbot-dns-luadns
* check_untyped_defs in mypy with clean output for certbot-dns-luadns

Resolves #5971
2018-05-14 13:40:27 -04:00
Sarah Braden
4bd9f4dac4 fix for issue #5970 regarding certbot-dns-google 2018-05-14 13:30:38 -04:00
Douglas Anger
2d45b0b07a Check_untyped_defs in mypy with clean output for certbot_dns_rfc2136 (#5975)
* check_untyped_defs in mypy with clean output for certbot_dns_rfc2136

Resolves #5973
2018-05-14 10:26:33 -07:00
Sarah Braden
a0775f42ba fixed issue #5969 for certbot-dns-dnsmadeeasy 2018-05-14 12:34:27 -04:00
ohemorange
3eaf35f1e2 Check_untyped_defs in mypy with clean output for acme (#5874)
* check_untyped_defs in mypy with clean output for acme

* test entire acme module

* Add typing as a dependency because it's only in the stdlib for 3.5+

* Add str_utils, modified for python2.7 compatibility

* make mypy happy in acme

* typing is needed in prod

* we actually only need typing in acme so far

* add tests and more docs for str_utils

* pragma no cover

* add magic_typing

* s/from typing/from magic_typing/g

* move typing to dev_extras

* correctly set up imports

* remove str_utils

* only type: ignore for OpenSSL.SSL, not crypto

* Since we only run mypy with python3 anyway and we're fine importing it when it's not actually there, there's no actual need for typing to be present as a dependency

* comment magic_typing.py

* disable wildcard-import im magic_typing

* disable pylint errors

* add magic_typing_test

* make magic_typing tests work alongside other tests

* make sure temp_typing is set

* add typing as a dev dependency for python3.4

* run mypy with python3.4 on travis to get a little more testing with different environments

* don't stick typing into sys.modules

* reorder imports
2018-05-03 13:10:33 -07:00
ohemorange
6253acf335 Get mypy running with clean output (#5864)
Fixes #5849.

* extract mypy flags into mypy.ini file

* Get mypy running with clean output
2018-04-12 18:53:07 -07:00