Pylint: Proper use of generated-members= setting

Created on 19 Sep 2018  路  5Comments  路  Source: PyCQA/pylint

Question

Hello, I'm using the Google Drive Python API and the following snippet generates E1101:

    # Call the Drive v3 API
    results = service.files().list(
        pageSize=10, fields="nextPageToken, files(id, name)").execute()
    items = results.get('files', [])
E1101: Instance of 'Resource' has no 'files' member (no-member)

What's the proper way to silence these E1101?
I tried this in my .pylintrc without success:

generated-members=googleapiclient\.discovery\.Resource\..*

And trying a broader match doesn't help either:

generated-members=googleapiclient.*
bug false negative

Most helpful comment

@gpakosz googleapiclient.discovery.Resource.* should have worked but I think this is currently not working correctly because there is a bug with the applied regular expressions in pylint. It currently matches either against the attribute name (so in this case files) or against the string representation of the object that gets called (and for some reason that is service.files()), but it should match against the qualified name instead.

All 5 comments

@gpakosz googleapiclient.discovery.Resource.* should have worked but I think this is currently not working correctly because there is a bug with the applied regular expressions in pylint. It currently matches either against the attribute name (so in this case files) or against the string representation of the object that gets called (and for some reason that is service.files()), but it should match against the qualified name instead.

Any news about this problem ?

I can confirm what @PCManticore mentioned, but in our case we have a Pylint configuration file used accross several projets / components and we cannot add all the generated members (the list would be huge).

Same issue. Nothing I've tried works.
generated-members=googleapiclient.discovery.Resource.* should work but it doesn't suppress any linting errors.

any updates?

@scorpp the issue is still open, but there is the PR #3634 that may solve it.

Was this page helpful?
0 / 5 - 0 ratings