diff options
author | Brad Warren <bmw@users.noreply.github.com> | 2019-11-27 22:32:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-27 22:32:00 +0300 |
commit | 84b770b56eb293aa1b026c45d2151e4420b393d9 (patch) | |
tree | 150f76204cdb715a92f3552749b5f7657a9055bb /windows-installer/construct.py | |
parent | 6c1dfe43c76f3620a3cc4ab3ec71370660fd6255 (diff) |
Defines the RenewableCert API (#7603)
This is my proposed fix for #7540. I would ideally like this to be included in our 1.0 release.
I came up with this design by adding all attributes used either in our own plugins, 3rd party plugins listed at https://certbot.eff.org/docs/using.html#third-party-plugins, or our public API code.
Despite me thinking that zope is unneeded nowadays, I initially tried to use it to define this interface since we have it and it gives us a way to define expected attributes, but it doesn't work because zope interface objects also have a method called `names` which conflict with the API.
I talked about this with Adrien out of band and did some of my own research and there are some minor benefits with this new approach of using properties:
1. It's more conventional.
2. If you also change the implementation to inherit from the class, Python will error if all properties aren't defined.
3. The PEP 526 style type annotations with mypy seem to (currently) only be used to validate code using the class, not the class implementation itself. You can add a type annotation saying the class needs to have this attribute, never define it, and mypy won't complain.
With this new approach, I had to fix `names` because pylint was complaining that the arguments differed, however, we never used the optional parameter to `names` outside of tests so I just deleted the code altogether.
* fixes #7540
* move to properties
Diffstat (limited to 'windows-installer/construct.py')
0 files changed, 0 insertions, 0 deletions