-
Notifications
You must be signed in to change notification settings - Fork 244
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
Fix some type errors #948
Fix some type errors #948
Conversation
Setting in _testing_eapis = frozenset([""]) was incorrect since that would result in |
_all_metadata_keys = set(x for x in portage.auxdbkeys) | ||
_all_metadata_keys.update(Package.metadata_keys) | ||
_all_metadata_keys = frozenset(_all_metadata_keys) | ||
_all_metadata_keys = frozenset(set(portage.auxdbkeys).union(Package.metadata_keys)) |
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.
This certainly looks nicer.
I'm a bit suspicious of this expression in the original code: x for x in portage.auxdbkeys
. If auxdbkeys is already a collection, I wonder why we piled a generator on top.
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.
It seems to come from when elements of auxdbkeys
were conditionally included, up until 1dbe0f2
--- a/lib/_emerge/Package.py
+++ b/lib/_emerge/Package.py
@@ -791,8 +791,7 @@ def with_use(self, use):
pkg = self
return pkg
-_all_metadata_keys = set(x for x in portage.auxdbkeys \
- if not x.startswith("UNUSED_"))
+_all_metadata_keys = set(x for x in portage.auxdbkeys)
_all_metadata_keys.update(Package.metadata_keys)
_all_metadata_keys = frozenset(_all_metadata_keys)
Some of the x for x
did get dropped, so it was probably oversight.
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.
Ah, that explanation makes me feel better. Thanks!
Knock out some low-hanging fruit given by running mypy --pretty --show-error-context . inside lib/ (191 total errors found). portage/package/ebuild/_config/special_env_vars.py:248: error: Incompatible types in assignment (expression has type "FrozenSet[str]", variable has type "List[str]") [assignment] environ_whitelist = frozenset(environ_whitelist) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ portage/package/ebuild/_config/special_env_vars.py:353: error: Incompatible types in assignment (expression has type "FrozenSet[str]", variable has type "List[str]") [assignment] environ_filter = frozenset(environ_filter) ^~~~~~~~~~~~~~~~~~~~~~~~~ portage/checksum.py:342: error: Incompatible types in assignment (expression has type "int", variable has type "bool") [assignment] prelink_capable = 1 ^ _emerge/Package.py: note: At top level: _emerge/Package.py:865: error: Incompatible types in assignment (expression has type "FrozenSet[str]", variable has type "Set[str]") [assignment] _all_metadata_keys = frozenset(_all_metadata_keys) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ portage/getbinpkg.py:46: error: Incompatible types in assignment (expression has type "Tuple[Type[Exception], ...]", variable has type "List[Type[Exception]]") [assignment] _all_errors = tuple(_all_errors) ^~~~~~~~~~~~~~~~~~ Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
Knock out some low-hanging fruit given by running
inside lib/ (191 total errors found).
Signed-off-by: Oskari Pirhonen xxc3ncoredxx@gmail.com