Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform boto3.ServiceRequest to look like dynamic class
`boto3.resource` creates resources dynamically via a resource factory. Unfortunately that completely breaks static analysis leading to spurious false positives since pylint cannot determine sanely that attributes exist or not. Here's an example of accessing the Topic class out of the `sns` resource. As you can see, the class is created dynamically rather than existing in the codebase itself: ``` In [2]: boto3.resource Out[2]: <function boto3.resource(*args, **kwargs)> In [3]: boto3.resource('sns') Out[3]: sns.ServiceResource() In [4]: boto3.resource('sns').Topic Out[4]: <bound method ResourceFactory._create_class_partial.<locals>.create_resource of sns.ServiceResource()> ``` This patch adds a fake `__getattr__` method to `ServiceRequest`. This will prevent `pylint` from emitting `no-member` at all for `ServiceRequest` instances, but that is a good solution for now until we can load typeshed-like annotation packages. Close pylint-dev/pylint#3134
- Loading branch information