Title: Futurize to add __future__ imports breaks pylint directives · Issue #588 · PythonCharmers/python-future · GitHub
Open Graph Title: Futurize to add __future__ imports breaks pylint directives · Issue #588 · PythonCharmers/python-future
X Title: Futurize to add __future__ imports breaks pylint directives · Issue #588 · PythonCharmers/python-future
Description: When running the futurize fixer libfuturize.fixes.fix_unicode_literals_import on a file with a pylint directive, the import is added prior to the pylint directive, which causes them to be ignored. This is true of all directives that don'...
Open Graph Description: When running the futurize fixer libfuturize.fixes.fix_unicode_literals_import on a file with a pylint directive, the import is added prior to the pylint directive, which causes them to be ignored. ...
X Description: When running the futurize fixer libfuturize.fixes.fix_unicode_literals_import on a file with a pylint directive, the import is added prior to the pylint directive, which causes them to be ignored. ...
Opengraph URL: https://github.com/PythonCharmers/python-future/issues/588
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Futurize to add __future__ imports breaks pylint directives","articleBody":"When running the futurize fixer libfuturize.fixes.fix_unicode_literals_import on a file with a pylint directive, the import is added prior to the pylint directive, which causes them to be ignored. This is true of all directives that don't match the specific regexes of encoding, docstrings and shebang that the future_import method checks for. \r\n\r\nhttps://github.com/PythonCharmers/python-future/blob/4657ad23de79a541ebcc7a06f1b9ad60172ad3c4/src/libfuturize/fixer_util.py#L230\r\n\r\nBefore:\r\n```\r\n# pylint: disable=import-error,invalid-name\r\n\r\nimport path\r\nimport system\r\n```\r\n\r\nRun: `futurize --write --fix=libfuturize.fixes.fix_unicode_literals_import`\r\n\r\nAfter:\r\n```\r\nfrom __future__ import unicode_literals\r\n\r\n# pylint: disable=import-error,invalid-name\r\n\r\nimport path\r\nimport system\r\n```\r\n\r\nIf it skipped to the first non-commented, non-docstring line before inserting anything, it would fix this and any other directives that haven't been accounted for.","author":{"url":"https://github.com/amethystmarie","@type":"Person","name":"amethystmarie"},"datePublished":"2021-07-07T18:18:08Z","url":"https://github.com/PythonCharmers/python-future/issues/588"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:74581bdb-87b7-4251-724d-32eed252b0dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C0F8:1525E:4FC5C9:70285D:6B04154A |
| html-safe-nonce | 48db3c1ae26e3e968af4d84344a3a1620d6438047d0e75044622900705788955 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMEY4OjE1MjVFOjRGQzVDOTo3MDI4NUQ6NkIwNDE1NEEiLCJ2aXNpdG9yX2lkIjoiNTMzNjI3ODYyNjkwMjIxODA1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | da923ff6b75ef3c011768e8eed1694c0e369da61b3e2a09dbf8cefc9c95bfaf3 |
| hovercard-subject-tag | issue:939144755 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PythonCharmers/python-future/588/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2a758638df1073b915db2fc64ec34f3053e423eba39322914b124aa00f8b66d4/PythonCharmers/python-future/issues/588 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2a758638df1073b915db2fc64ec34f3053e423eba39322914b124aa00f8b66d4/PythonCharmers/python-future/issues/588 |
| og:image:alt | When running the futurize fixer libfuturize.fixes.fix_unicode_literals_import on a file with a pylint directive, the import is added prior to the pylint directive, which causes them to be ignored. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | amethystmarie |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/PythonCharmers/python-future git https://github.com/PythonCharmers/python-future.git |
| octolytics-dimension-user_id | 3365815 |
| octolytics-dimension-user_login | PythonCharmers |
| octolytics-dimension-repository_id | 11403699 |
| octolytics-dimension-repository_nwo | PythonCharmers/python-future |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 11403699 |
| octolytics-dimension-repository_network_root_nwo | PythonCharmers/python-future |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width