Closed justin-ad closed 3 years ago
This looks correct to me. Mapping
is Python's abstract base class that all dictionary-like types belong to. See:
https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping
These abstract types are recommended for use in Python type hints. See:
https://docs.python.org/3/library/typing.html#generics
The CDK will accept any mapping type here, not just dict
, and it doesn't need to be mutable, hence Mapping
rather than MutableMapping
.
This definitely isn't a leak from TypeScript/JavaScript. (The mapping type is called Object
in those languages.)
I'll close this; feel free to re-open if you have further comments.
Your feedback helps us make the AWS CDK better for everyone. Keep it coming!
It seems that the auto translation being used to generate the documentation is littering the Python docs with JS specific type information. Please see https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_codebuild/PipelineProject.html
Why is the type for
environment_variables
specified asOption[Mapping[str, BuildEnvironmentVariable]])
? In Python, this should be(Optional[dict{str: BuildEnvironmentVariable}])
. What isMapping
? Python has no such type... this is adict
in Python.