Skip to content
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

Don't report import-private-name for relative imports #7079

Merged
merged 1 commit into from Jun 28, 2022

Conversation

scop
Copy link
Contributor

@scop scop commented Jun 28, 2022

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Description

Closes #7078

@coveralls
Copy link

coveralls commented Jun 28, 2022

Pull Request Test Coverage Report for Build 2577494235

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0005%) to 95.324%

Totals Coverage Status
Change from base Build 2571502189: 0.0005%
Covered Lines: 16657
Relevant Lines: 17474

πŸ’› - Coveralls

@github-actions

This comment has been minimized.

@scop
Copy link
Contributor Author

scop commented Jun 28, 2022

Wow, ^that "Effect of this PR" report is awesome πŸ’―

@Pierre-Sassoulas
Copy link
Member

Wow, ^that "Effect of this PR" report is awesome

Yeah credit to @DanielNoord :) It's the first time someone fix SO much false positives at once too.

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Jun 28, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.4 milestone Jun 28, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change, big result, that's great πŸ‘Œ

doc/whatsnew/2/2.15/index.rst Outdated Show resolved Hide resolved
@scop scop force-pushed the fix/relative-private-imports branch from 9dec7fb to 8e94d7a Compare June 28, 2022 15:48
@scop scop force-pushed the fix/relative-private-imports branch from 8e94d7a to 144b1a5 Compare June 28, 2022 15:52
@github-actions
Copy link
Contributor

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on django:
The following messages are no longer emitted:

  1. import-private-name:
    Imported private module (_functions)
    https://github.com/django/django/blob/main/django/db/backends/sqlite3/base.py#L16
  2. import-private-name:
    Imported private object (_get_cached_resolver)
    https://github.com/django/django/blob/main/django/urls/base.py#L9
  3. import-private-name:
    Imported private object (_active)
    https://github.com/django/django/blob/main/django/contrib/admindocs/apps.py#L5
  4. import-private-name:
    Imported private object (_is_callback)
    https://github.com/django/django/blob/main/django/contrib/admindocs/views.py#L33
  5. import-private-name:
    Imported private object (_get_builtin_permissions)
    https://github.com/django/django/blob/main/django/contrib/auth/checks.py#L8
  6. import-private-name:
    Imported private object (_builtin_context_processors)
    https://github.com/django/django/blob/main/django/template/engine.py#L8

Effect on flask:
The following messages are no longer emitted:

  1. import-private-name:
    Imported private object (_app_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/__init__.py#L14
  2. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/__init__.py#L15
  3. import-private-name:
    Imported private object (_default_template_ctx_processor)
    https://github.com/pallets/flask/blob/main/src/flask/scaffold.py#L22
  4. import-private-name:
    Imported private object (_endpoint_from_view_func)
    https://github.com/pallets/flask/blob/main/src/flask/blueprints.py#L7
  5. import-private-name:
    Imported private object (_sentinel)
    https://github.com/pallets/flask/blob/main/src/flask/blueprints.py#L8
  6. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/testing.py#L13
  7. import-private-name:
    Imported private object (_split_blueprint_path)
    https://github.com/pallets/flask/blob/main/src/flask/wrappers.py#L9
  8. import-private-name:
    Imported private object (_app_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/templating.py#L8
  9. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/templating.py#L9
  10. import-private-name:
    Imported private object (_app_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/ctx.py#L9
  11. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/ctx.py#L10
  12. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/debughelpers.py#L5
  13. import-private-name:
    Imported private object (_app_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/cli.py#L1049
  14. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/helpers.py#L16
  15. import-private-name:
    Imported private object (_AppCtxGlobals)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L38
  16. import-private-name:
    Imported private object (_app_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L41
  17. import-private-name:
    Imported private object (_request_ctx_stack)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L42
  18. import-private-name:
    Imported private object (_split_blueprint_path)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L46
  19. import-private-name:
    Imported private object (_endpoint_from_view_func)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L54
  20. import-private-name:
    Imported private object (_sentinel)
    https://github.com/pallets/flask/blob/main/src/flask/app.py#L55

Effect on psycopg:
The following messages are no longer emitted:

  1. import-private-name:
    Imported private module (_tpc)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/__init__.py#L12
  2. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/__init__.py#L14
  3. import-private-name:
    Imported private module (_column)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/__init__.py#L19
  4. import-private-name:
    Imported private module (_pipeline)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/__init__.py#L21
  5. import-private-name:
    Imported private module (_queries)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/client_cursor.py#L10
  6. import-private-name:
    Imported private module (_preparing)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/client_cursor.py#L18
  7. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_transform.py#L16
  8. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_transform.py#L18
  9. import-private-name:
    Imported private module (_tz)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/conninfo.py#L14
  10. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/conninfo.py#L15
  11. import-private-name:
    Imported private module (_tpc)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection_async.py#L19
  12. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection_async.py#L22
  13. import-private-name:
    Imported private module (_pipeline)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection_async.py#L24
  14. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection_async.py#L25
  15. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/postgres.py#L7
  16. import-private-name:
    Imported private module (_adapters_map)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/postgres.py#L9
  17. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_preparing.py#L12
  18. import-private-name:
    Imported private module (_queries)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_preparing.py#L13
  19. import-private-name:
    Imported private module (_column)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L20
  20. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L21
  21. import-private-name:
    Imported private module (_queries)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L22
  22. import-private-name:
    Imported private module (_pipeline)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L23
  23. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L24
  24. import-private-name:
    Imported private module (_preparing)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor.py#L25
  25. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/errors.py#L25
  26. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_queries.py#L16
  27. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_queries.py#L17
  28. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/copy.py#L21
  29. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/copy.py#L22
  30. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/copy.py#L23
  31. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_tz.py#L12
  32. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_pipeline.py#L14
  33. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_pipeline.py#L15
  34. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_pipeline.py#L16
  35. import-private-name:
    Imported private module (_preparing)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_pipeline.py#L17
  36. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/rows.py#L13
  37. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/rows.py#L14
  38. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/sql.py#L15
  39. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/adapt.py#L12
  40. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/adapt.py#L13
  41. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/generators.py#L26
  42. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/generators.py#L27
  43. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_typeinfo.py#L16
  44. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_struct.py#L12
  45. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_adapters_map.py#L13
  46. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_adapters_map.py#L14
  47. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/_adapters_map.py#L15
  48. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/abc.py#L12
  49. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/abc.py#L13
  50. import-private-name:
    Imported private module (_tpc)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L25
  51. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L28
  52. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L30
  53. import-private-name:
    Imported private module (_cmodule)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L31
  54. import-private-name:
    Imported private module (_pipeline)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L33
  55. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L35
  56. import-private-name:
    Imported private module (_preparing)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L36
  57. import-private-name:
    Imported private module (_pipeline)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/cursor_async.py#L18
  58. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/range.py#L18
  59. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/range.py#L20
  60. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/numeric.py#L17
  61. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/numeric.py#L18
  62. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/numeric.py#L19
  63. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/numeric.py#L20
  64. import-private-name:
    Imported private module (_wrappers)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/numeric.py#L23
  65. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/hstore.py#L14
  66. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/hstore.py#L16
  67. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/shapely.py#L11
  68. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/composite.py#L17
  69. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/composite.py#L19
  70. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/composite.py#L20
  71. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/net.py#L13
  72. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/enum.py#L13
  73. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/enum.py#L14
  74. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/enum.py#L15
  75. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/array.py#L18
  76. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/array.py#L20
  77. import-private-name:
    Imported private module (_tz)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/datetime.py#L14
  78. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/datetime.py#L18
  79. import-private-name:
    Imported private module (_struct)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/multirange.py#L17
  80. import-private-name:
    Imported private module (_typeinfo)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/multirange.py#L19
  81. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/types/string.py#L14
  82. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/pq_ctypes.py#L26
  83. import-private-name:
    Imported private module (_pq_ctypes)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/pq_ctypes.py#L29
  84. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/misc.py#L10
  85. import-private-name:
    Imported private module (_encodings)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/misc.py#L11
  86. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/__init__.py#L19
  87. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/__init__.py#L20
  88. import-private-name:
    Imported private module (_enums)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/abc.py#L10
  89. import-private-name:
    Imported private module (_compat)
    https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/abc.py#L11

Effect on pytest:
The following messages are no longer emitted:

  1. import-private-name:
    Imported private module (_version)
    https://github.com/pytest-dev/pytest/blob/main/src/_pytest/__init__.py#L4
  2. import-private-name:
    Imported private module (_code)
    https://github.com/pytest-dev/pytest/blob/main/src/_pytest/mark/structures.py#L25

Effect on sentry:
The following messages are no longer emitted:

  1. import-private-name:
    Imported private object (_CaseInsensitiveSigner)
    https://github.com/getsentry/sentry/blob/master/src/sentry/utils/email/address.py#L11
  2. import-private-name:
    Imported private object (_CaseInsensitiveSigner)
    https://github.com/getsentry/sentry/blob/master/src/sentry/utils/email/__init__.py#L32

This comment was generated for commit 144b1a5

@Pierre-Sassoulas Pierre-Sassoulas merged commit c603f0e into pylint-dev:main Jun 28, 2022
@scop scop deleted the fix/relative-private-imports branch June 28, 2022 21:19
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Jun 29, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False import-private-name positive for relative imports
3 participants