-
Notifications
You must be signed in to change notification settings - Fork 16
Resolve issue with MyPy seeing files in fidesops as missing imports #719
Conversation
pattisdr
left a comment
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.
Just small questions/suggestions. I also don't think #631 should be closed, I'd still like to keep an open issue to address some of these type: ignore
src/fidesops/util/saas_util.py
Outdated
| """Get collection grouped inputs""" | ||
| collection: Collection = next( | ||
| (collect for collect in collections if collect.name == name), {} | ||
| collection = next( |
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.
Could we add a type of Optional[Collection] instead of removing altogether?
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.
Same as previous. I'll update all the same based on the answer to the first.
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.
I mean, we can compromise! I'd recommend leaving the internal type hints on files in the src/fidesops/graph/graph.py folder at least. Those files can be really tricky to trace through
| """ | ||
|
|
||
| current_request: SaaSRequest = self.get_request_by_action("read") | ||
| current_request = self.get_request_by_action("read") |
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.
Can this be optional instead of removing? current_request: Optional[SaaSRequest] = self.get_request_by_action("read")
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.
Same as previous. I'll update all the same based on the answer to the first.
| key: bytes = SecretsUtil.get_or_generate_secret( | ||
| key = SecretsUtil.get_or_generate_secret( | ||
| request_id, SecretType.key, masking_meta[SecretType.key] | ||
| ) | ||
| key_hmac: str = SecretsUtil.get_or_generate_secret( | ||
| key_hmac = SecretsUtil.get_or_generate_secret( | ||
| request_id, | ||
| SecretType.key_hmac, | ||
| masking_meta[SecretType.key_hmac], | ||
| ) | ||
|
|
||
| # The nonce is generated deterministically such that the same input val will result in same nonce | ||
| # and therefore the same masked val through the aes strategy. This is called convergent encryption, with this | ||
| # implementation loosely based on https://www.vaultproject.io/docs/secrets/transit#convergent-encryption | ||
|
|
||
| masked_values: List[str] = [] | ||
| for value in values: | ||
| nonce: bytes = self._generate_nonce( | ||
| value, key_hmac, request_id, masking_meta | ||
| ) | ||
| masked: str = encrypt(value, key, nonce) | ||
| nonce = self._generate_nonce(value, key_hmac, request_id, masking_meta) # type: ignore | ||
| masked: str = encrypt(value, key, nonce) # type: ignore |
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.
Can these removed hints just be made optional?
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.
Same as previous. I'll update all the same based on the answer to the first.
| SecretType, MaskingSecretMeta | ||
| ] = self._build_masking_secret_meta() | ||
| salt: str = SecretsUtil.get_or_generate_secret( | ||
| salt = SecretsUtil.get_or_generate_secret( |
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.
optional?
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.
Same as previous. I'll update all the same based on the answer to the first.
| key: str = SecretsUtil.get_or_generate_secret( | ||
| key = SecretsUtil.get_or_generate_secret( | ||
| request_id, SecretType.key, masking_meta[SecretType.key] | ||
| ) | ||
| salt: str = SecretsUtil.get_or_generate_secret( | ||
| salt = SecretsUtil.get_or_generate_secret( |
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.
optional?
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.
Same as previous. I'll update all the same based on the answer to the first.
|
only safe migration check tests failing which is a known error |
…719) Co-authored-by: Paul Sanders <pau@ethyca.com>
Purpose
Fix issues with MyPy.
In several cases I used
# type: ignorewhen I wasn't sure what the proper fix was. Where possible we should come back later and do a proper fix for these.Changes
__init__.pyfrom thesrcdirectory.Checklist
CHANGELOG.mdfileCHANGELOG.mdfile is being appended toUnreleasedsection in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.Run Unsafe PR Checkslabel has been applied, and checks have passed, if this PR touches any external servicesTicket
Fixes #629