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

isort 5.0+ wants two blank lines between a from ... import within a def and a following comment line - flake8 conflict. #1293

Closed
msapiro opened this issue Jul 7, 2020 · 4 comments
Labels
bug Something isn't working repo_needed Can't currently reproduce, if reproduction steps are added we will resivit this issue.

Comments

@msapiro
Copy link

msapiro commented Jul 7, 2020

isort 5.0+ wants 2 blank lines between a from import within a def and a following comment. E.g.

    def on_email_deleted(self, email):
        from hyperkitty.tasks import rebuild_thread_cache_new_email


        # update or cleanup thread                  # noqa: E303 (isort issue)
        if self.emails.count() == 0:
            ...

is acceptable, but 0 or 1 blank lines between the from ... import and the following comment is not acceptable to isort, and more than 1 blank line is not acceptable to flake8. Thus the # noqa: to pass both.

This is not an issue if the first non-blank line following the import is not a comment. In that case, isort is happy with 0 or 1 blank lines.

timothycrosley added a commit that referenced this issue Jul 8, 2020
@timothycrosley timothycrosley added the bug Something isn't working label Jul 8, 2020
@timothycrosley
Copy link
Member

timothycrosley commented Jul 8, 2020

@msapiro I'm sorry you're encountering this issue! I would like to help resolve it as quickly as possible.
Unfortunately, so far I'm not able to reproduce the issue. See: 1685beb - which passes. It is possible that the latest point release of isort fixed it, but it's also possible that there are settings or environment issues that I'm not adequately accounting for:

Could you

  • Try isort 5.0.5 and see if it still occurs for you?
  • Provide any settings used when running isort. A quick way to get this is to paste the result of isort --show-config
  • Provide the OS isort is being ran from?

Thanks!

~Timothy

@timothycrosley timothycrosley added the repo_needed Can't currently reproduce, if reproduction steps are added we will resivit this issue. label Jul 8, 2020
@msapiro
Copy link
Author

msapiro commented Jul 8, 2020

It's still an issue with isort 5.0.5. Here's isort --version

(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ isort --version

                 _                 _
                (_) ___  ___  _ __| |_
                | |/ _/ / _ \/ '__  _/
                | |\__ \/\_\/| |  | |_
                |_|\___/\___/\_/   \_/

      isort your imports, so you don't have to.

                    VERSION 5.0.5

(lint) mark@msapiro:/var/MM/3/x/django-mailman3$

and isort --show-config

(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ isort --show-config
{
    "_known_patterns": null,
    "py_version": "py3",
    "force_to_top": [],
    "skip": [
        ".venv",
        ".mypy_cache",
        "_build",
        "build",
        ".eggs",
        "buck-out",
        ".git",
        ".nox",
        "node_modules",
        ".hg",
        "dist",
        ".pants.d",
        ".tox",
        "venv"
    ],
    "skip_glob": [],
    "line_length": 79,
    "wrap_length": 0,
    "line_ending": "",
    "sections": [
        "FUTURE",
        "STDLIB",
        "DJANGO",
        "THIRDPARTY",
        "FIRSTPARTY",
        "LOCALFOLDER"
    ],
    "no_sections": false,
    "known_future_library": [
        "__future__"
    ],
    "known_third_party": [
        "google.appengine.api"
    ],
    "known_first_party": [
        "django_mailman3"
    ],
    "known_standard_library": [
        "symbol",
        "enum",
        "imaplib",
        "array",
        "curses",
        "grp",
        "fileinput",
        "select",
        "tabnanny",
        "colorsys",
        "gc",
        "tty",
        "pdb",
        "datetime",
        "ntpath",
        "pickletools",
        "cmath",
        "symtable",
        "pydoc",
        "builtins",
        "decimal",
        "sndhdr",
        "re",
        "bisect",
        "encodings",
        "operator",
        "copyreg",
        "fpectl",
        "http",
        "turtle",
        "imghdr",
        "ipaddress",
        "winreg",
        "csv",
        "plistlib",
        "threading",
        "pprint",
        "multiprocessing",
        "gzip",
        "pwd",
        "bz2",
        "signal",
        "warnings",
        "syslog",
        "ftplib",
        "bdb",
        "hmac",
        "binascii",
        "glob",
        "ast",
        "optparse",
        "heapq",
        "shutil",
        "modulefinder",
        "secrets",
        "smtpd",
        "queue",
        "math",
        "itertools",
        "cgi",
        "aifc",
        "time",
        "reprlib",
        "xml",
        "mmap",
        "textwrap",
        "getpass",
        "dataclasses",
        "ssl",
        "quopri",
        "smtplib",
        "pathlib",
        "nntplib",
        "linecache",
        "resource",
        "xdrlib",
        "_thread",
        "html",
        "zipimport",
        "zipfile",
        "venv",
        "turtledemo",
        "nis",
        "zipapp",
        "uu",
        "crypt",
        "audioop",
        "selectors",
        "shelve",
        "asyncio",
        "wave",
        "email",
        "trace",
        "binhex",
        "weakref",
        "mailbox",
        "wsgiref",
        "sre_constants",
        "pty",
        "string",
        "argparse",
        "errno",
        "chunk",
        "abc",
        "concurrent",
        "uuid",
        "tempfile",
        "cmd",
        "logging",
        "sunau",
        "formatter",
        "msvcrt",
        "tkinter",
        "getopt",
        "pkgutil",
        "platform",
        "stringprep",
        "configparser",
        "importlib",
        "xmlrpc",
        "cProfile",
        "random",
        "inspect",
        "readline",
        "stat",
        "fractions",
        "dummy_threading",
        "mimetypes",
        "lib2to3",
        "tarfile",
        "fcntl",
        "tokenize",
        "profile",
        "gettext",
        "calendar",
        "netrc",
        "sqlite3",
        "os",
        "codeop",
        "keyword",
        "parser",
        "cgitb",
        "lzma",
        "site",
        "typing",
        "functools",
        "py_compile",
        "ensurepip",
        "ossaudiodev",
        "contextvars",
        "pickle",
        "traceback",
        "_dummy_thread",
        "distutils",
        "asyncore",
        "types",
        "io",
        "unittest",
        "runpy",
        "json",
        "statistics",
        "atexit",
        "rlcompleter",
        "winsound",
        "zlib",
        "filecmp",
        "termios",
        "struct",
        "socket",
        "sys",
        "imp",
        "telnetlib",
        "token",
        "doctest",
        "fnmatch",
        "shlex",
        "code",
        "contextlib",
        "test",
        "difflib",
        "timeit",
        "hashlib",
        "pstats",
        "pyclbr",
        "collections",
        "locale",
        "asynchat",
        "mailcap",
        "compileall",
        "sched",
        "faulthandler",
        "posix",
        "numbers",
        "webbrowser",
        "macpath",
        "posixpath",
        "pipes",
        "socketserver",
        "copy",
        "ctypes",
        "spwd",
        "marshal",
        "base64",
        "codecs",
        "poplib",
        "sysconfig",
        "tracemalloc",
        "msilib",
        "unicodedata",
        "subprocess",
        "dbm",
        "dis",
        "urllib"
    ],
    "extra_standard_library": [],
    "known_other": {
        "django": [
            "django"
        ]
    },
    "multi_line_output": "VERTICAL_GRID",
    "forced_separate": [],
    "indent": "    ",
    "comment_prefix": "  #",
    "length_sort": false,
    "length_sort_sections": [],
    "add_imports": [],
    "remove_imports": [],
    "reverse_relative": false,
    "force_single_line": false,
    "single_line_exclusions": [],
    "default_section": "THIRDPARTY",
    "import_headings": {},
    "balanced_wrapping": true,
    "use_parentheses": true,
    "order_by_type": true,
    "atomic": false,
    "lines_after_imports": 2,
    "lines_between_sections": 1,
    "lines_between_types": 0,
    "combine_as_imports": false,
    "combine_star": false,
    "keep_direct_and_as_imports": true,
    "include_trailing_comma": false,
    "from_first": false,
    "verbose": false,
    "quiet": false,
    "force_adds": false,
    "force_alphabetical_sort_within_sections": false,
    "force_alphabetical_sort": false,
    "force_grid_wrap": 0,
    "force_sort_within_sections": false,
    "lexicographical": false,
    "ignore_whitespace": false,
    "no_lines_before": [
        "LOCALFOLDER"
    ],
    "no_inline_sort": false,
    "ignore_comments": false,
    "case_sensitive": false,
    "sources": [
        {
            "py_version": "py3",
            "force_to_top": [],
            "skip": [
                ".venv",
                ".mypy_cache",
                "_build",
                "build",
                ".eggs",
                "buck-out",
                ".git",
                ".nox",
                "node_modules",
                ".hg",
                "dist",
                ".pants.d",
                ".tox",
                "venv"
            ],
            "skip_glob": [],
            "line_length": 79,
            "wrap_length": 0,
            "line_ending": "",
            "sections": [
                "FUTURE",
                "STDLIB",
                "THIRDPARTY",
                "FIRSTPARTY",
                "LOCALFOLDER"
            ],
            "no_sections": false,
            "known_future_library": [
                "__future__"
            ],
            "known_third_party": [
                "google.appengine.api"
            ],
            "known_first_party": [],
            "known_standard_library": [
                "symbol",
                "enum",
                "imaplib",
                "array",
                "curses",
                "grp",
                "fileinput",
                "select",
                "tabnanny",
                "colorsys",
                "gc",
                "tty",
                "pdb",
                "datetime",
                "ntpath",
                "pickletools",
                "cmath",
                "symtable",
                "pydoc",
                "builtins",
                "decimal",
                "sndhdr",
                "re",
                "bisect",
                "encodings",
                "operator",
                "copyreg",
                "fpectl",
                "http",
                "turtle",
                "imghdr",
                "ipaddress",
                "winreg",
                "csv",
                "plistlib",
                "threading",
                "pprint",
                "multiprocessing",
                "gzip",
                "pwd",
                "bz2",
                "signal",
                "warnings",
                "syslog",
                "ftplib",
                "bdb",
                "hmac",
                "binascii",
                "glob",
                "ast",
                "optparse",
                "heapq",
                "shutil",
                "modulefinder",
                "secrets",
                "smtpd",
                "queue",
                "math",
                "itertools",
                "cgi",
                "aifc",
                "time",
                "reprlib",
                "xml",
                "mmap",
                "textwrap",
                "getpass",
                "dataclasses",
                "ssl",
                "quopri",
                "smtplib",
                "pathlib",
                "nntplib",
                "linecache",
                "resource",
                "xdrlib",
                "_thread",
                "html",
                "zipimport",
                "zipfile",
                "venv",
                "turtledemo",
                "nis",
                "zipapp",
                "uu",
                "crypt",
                "audioop",
                "selectors",
                "shelve",
                "asyncio",
                "wave",
                "email",
                "trace",
                "binhex",
                "weakref",
                "mailbox",
                "wsgiref",
                "sre_constants",
                "pty",
                "string",
                "argparse",
                "errno",
                "chunk",
                "abc",
                "concurrent",
                "uuid",
                "tempfile",
                "cmd",
                "logging",
                "sunau",
                "formatter",
                "msvcrt",
                "tkinter",
                "getopt",
                "pkgutil",
                "platform",
                "stringprep",
                "configparser",
                "importlib",
                "xmlrpc",
                "cProfile",
                "random",
                "inspect",
                "readline",
                "stat",
                "fractions",
                "dummy_threading",
                "mimetypes",
                "lib2to3",
                "tarfile",
                "fcntl",
                "tokenize",
                "profile",
                "gettext",
                "calendar",
                "netrc",
                "sqlite3",
                "os",
                "codeop",
                "keyword",
                "parser",
                "cgitb",
                "lzma",
                "site",
                "typing",
                "functools",
                "py_compile",
                "ensurepip",
                "ossaudiodev",
                "contextvars",
                "pickle",
                "traceback",
                "_dummy_thread",
                "distutils",
                "asyncore",
                "types",
                "io",
                "unittest",
                "runpy",
                "json",
                "statistics",
                "atexit",
                "rlcompleter",
                "winsound",
                "zlib",
                "filecmp",
                "termios",
                "struct",
                "socket",
                "sys",
                "imp",
                "telnetlib",
                "token",
                "doctest",
                "fnmatch",
                "shlex",
                "code",
                "contextlib",
                "test",
                "difflib",
                "timeit",
                "hashlib",
                "pstats",
                "pyclbr",
                "collections",
                "locale",
                "asynchat",
                "mailcap",
                "compileall",
                "sched",
                "faulthandler",
                "posix",
                "numbers",
                "webbrowser",
                "macpath",
                "posixpath",
                "pipes",
                "socketserver",
                "copy",
                "ctypes",
                "spwd",
                "marshal",
                "base64",
                "codecs",
                "poplib",
                "sysconfig",
                "tracemalloc",
                "msilib",
                "unicodedata",
                "subprocess",
                "dbm",
                "dis",
                "urllib"
            ],
            "extra_standard_library": [],
            "known_other": {},
            "multi_line_output": "GRID",
            "forced_separate": [],
            "indent": "    ",
            "comment_prefix": "  #",
            "length_sort": false,
            "length_sort_sections": [],
            "add_imports": [],
            "remove_imports": [],
            "reverse_relative": false,
            "force_single_line": false,
            "single_line_exclusions": [],
            "default_section": "THIRDPARTY",
            "import_headings": {},
            "balanced_wrapping": false,
            "use_parentheses": false,
            "order_by_type": true,
            "atomic": false,
            "lines_after_imports": -1,
            "lines_between_sections": 1,
            "lines_between_types": 0,
            "combine_as_imports": false,
            "combine_star": false,
            "keep_direct_and_as_imports": true,
            "include_trailing_comma": false,
            "from_first": false,
            "verbose": false,
            "quiet": false,
            "force_adds": false,
            "force_alphabetical_sort_within_sections": false,
            "force_alphabetical_sort": false,
            "force_grid_wrap": 0,
            "force_sort_within_sections": false,
            "lexicographical": false,
            "ignore_whitespace": false,
            "no_lines_before": [],
            "no_inline_sort": false,
            "ignore_comments": false,
            "case_sensitive": false,
            "sources": [],
            "virtual_env": "",
            "conda_env": "",
            "ensure_newline_before_comments": false,
            "directory": "",
            "profile": "",
            "src_paths": [],
            "old_finders": false,
            "source": "defaults"
        },
        {
            "line_length": 79,
            "multi_line_output": "VERTICAL_GRID",
            "balanced_wrapping": true,
            "known_django": [
                "django"
            ],
            "sections": [
                "FUTURE",
                "STDLIB",
                "DJANGO",
                "THIRDPARTY",
                "FIRSTPARTY",
                "LOCALFOLDER"
            ],
            "no_lines_before": [
                "LOCALFOLDER"
            ],
            "lines_after_imports": 2,
            "use_parentheses": true,
            "default_section": "THIRDPARTY",
            "known_first_party": [
                "django_mailman3"
            ],
            "source": "/var/MM/3/x/django-mailman3/tox.ini"
        }
    ],
    "virtual_env": "",
    "conda_env": "",
    "ensure_newline_before_comments": false,
    "directory": "/var/MM/3/x/django-mailman3",
    "profile": "",
    "src_paths": [
        "/var/MM/3/x/django-mailman3",
        "/var/MM/3/x/django-mailman3/src"
    ],
    "old_finders": false
}
(lint) mark@msapiro:/var/MM/3/x/django-mailman3$

Here's the issue

(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ cat j1.py 
class Class_1():
    def function_1(self, email):
        from hyperkitty.tasks import function_2
        # with a comment
        if self.emails.count() == 0:
            function_2(email)
(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ isort --diff j1.py 
--- /var/MM/3/x/django-mailman3/j1.py:before	2020-07-08 08:36:06.558726
+++ /var/MM/3/x/django-mailman3/j1.py:after	2020-07-08 08:40:02.753785
@@ -1,6 +1,8 @@
 class Class_1():
     def function_1(self, email):
         from hyperkitty.tasks import function_2
+
+
         # with a comment
         if self.emails.count() == 0:
             function_2(email)
Fixing /var/MM/3/x/django-mailman3/j1.py
(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ 

And here, without a comment line following the import, there is no issue.

(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ cat j2.py 
class Class_1():
    def function_1(self, email):
        from hyperkitty.tasks import function_2
        if self.emails.count() == 0:
            function_2(email)
(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ isort --diff j2.py 
(lint) mark@msapiro:/var/MM/3/x/django-mailman3$ 

@pallavg
Copy link

pallavg commented Jul 8, 2020

Good afternoon. I'm also having the same issue in isort v5.0.5. In my setup.cfg, I have lines_after_imports = 2. So an example code looks like this:

# This script demonstrates how to interface with Django models without going through the web interface.
#
# --------------------------------------------- MODULE IMPORT ---------------------------------------------------------#
import logging
import os

import django

from utils import util                 # NOTE THE DOUBLE LINE


# --------------------------------------------- DEVELOPMENT CODE ------------------------------------------------------#
log = logging.getLogger(__name__)


def main():

    # Initialize Django ORM (this will also configure the logger, see tvpv_portal.settings).
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tvpv_portal.settings')
    django.setup()

    # Override the Django logger to use our own for standalone scripts.
    util.configure_logger('django_orm_demo.log')
    log.info('Init Django ORM with DJANGO_SETTINGS_MODULE=%s', os.environ.get('DJANGO_SETTINGS_MODULE'))

    # Now, we can import Django models.
    from apps.prodsetup.models import RunHistory
    from apps.traceconvert.models import TraceConvertJob                    # NOTE THE SINGLE LINE ONLY

    # From Job, get first job request (i.e., id=1).
    job = TraceConvertJob.objects.get(job_id='1')

    # Get number of entries before executing update.
    log.info('Total entries in RunHistory before update is %d', RunHistory.objects.count())

    log.info('All done')

    return 0

In the 4.X series, this code used to pass both flake8/isort checks. I explicitly wanted 2 lines after imports for global imports and only 1 line for imports within functions. Now, it fails isort as it wants to put two lines inside the function as well. I did that. So then, isort passes, but flake8 is complaining that there are too many blank lines.

isort msg:

from-type place_module for apps.traceconvert.models returned THIRDPARTY
--- /nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python/src/tvpv_portal/examples/django_orm_demo.py:before     2020-07-08 16:49:58.889673
+++ /nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python/src/tvpv_portal/examples/django_orm_demo.py:after      2020-07-08 16:50:00.952166
@@ -35,6 +35,7 @@
     from apps.prodsetup.models import RunHistory
     from apps.traceconvert.models import TraceConvertJob
 
+
     # From Job, get first job request (i.e., id=1).
     job = TraceConvertJob.objects.get(job_id='1')

My OS:

  1. SUSE Enterprise 11 (linux)
  2. Command line: isort --verbose --check-only --diff src tests setup.py
  3. setup.cfg:
[tool:isort]
# force_single_line = True
line_length = 120
lines_after_imports = 2
known_first_party = nameless
default_section = THIRDPARTY
forced_separate = test_nameless
skip = migrations

isort settings:

{
    "_known_patterns": null,
    "py_version": "py3",
    "force_to_top": [],
    "skip": [
        "migrations"
    ],
    "skip_glob": [],
    "line_length": 120,
    "wrap_length": 0,
    "line_ending": "",
    "sections": [
        "FUTURE",
        "STDLIB",
        "THIRDPARTY",
        "FIRSTPARTY",
        "LOCALFOLDER"
    ],
    "no_sections": false,
    "known_future_library": [
        "__future__"
    ],
    "known_third_party": [
        "google.appengine.api"
    ],
    "known_first_party": [
        "nameless"
    ],
    "known_standard_library": [
        "heapq",
        "curses",
        "html",
        "tkinter",
        "gzip",
        "io",
        "fpectl",
        "wave",
        "chunk",
        "gettext",
        "concurrent",
        "cmath",
        "pydoc",
        "errno",
        "shlex",
        "shelve",
        "test",
        "runpy",
        "zlib",
        "binhex",
        "hashlib",
        "logging",
        "math",
        "glob",
        "bz2",
        "fnmatch",
        "nntplib",
        "tty",
        "numbers",
        "smtpd",
        "calendar",
        "compileall",
        "asyncore",
        "codeop",
        "pathlib",
        "spwd",
        "pprint",
        "distutils",
        "multiprocessing",
        "venv",
        "formatter",
        "queue",
        "http",
        "trace",
        "filecmp",
        "bisect",
        "stringprep",
        "readline",
        "mmap",
        "_dummy_thread",
        "importlib",
        "keyword",
        "encodings",
        "shutil",
        "posix",
        "traceback",
        "webbrowser",
        "typing",
        "array",
        "random",
        "unicodedata",
        "tabnanny",
        "colorsys",
        "token",
        "ntpath",
        "unittest",
        "string",
        "tracemalloc",
        "audioop",
        "msvcrt",
        "doctest",
        "datetime",
        "csv",
        "linecache",
        "code",
        "pstats",
        "dummy_threading",
        "pickle",
        "parser",
        "tarfile",
        "imp",
        "turtle",
        "os",
        "ftplib",
        "sre_constants",
        "zipfile",
        "winreg",
        "nis",
        "pipes",
        "symbol",
        "itertools",
        "contextvars",
        "ipaddress",
        "winsound",
        "cProfile",
        "cgitb",
        "weakref",
        "sched",
        "base64",
        "grp",
        "subprocess",
        "timeit",
        "sunau",
        "email",
        "site",
        "fractions",
        "msilib",
        "json",
        "_thread",
        "binascii",
        "copy",
        "crypt",
        "mailcap",
        "codecs",
        "contextlib",
        "mailbox",
        "profile",
        "functools",
        "bdb",
        "netrc",
        "ssl",
        "sys",
        "argparse",
        "py_compile",
        "ossaudiodev",
        "marshal",
        "pty",
        "turtledemo",
        "locale",
        "optparse",
        "termios",
        "platform",
        "sndhdr",
        "resource",
        "dataclasses",
        "gc",
        "re",
        "uuid",
        "xdrlib",
        "cmd",
        "tempfile",
        "urllib",
        "getopt",
        "time",
        "posixpath",
        "abc",
        "uu",
        "enum",
        "getpass",
        "lib2to3",
        "asynchat",
        "builtins",
        "difflib",
        "imaplib",
        "warnings",
        "xml",
        "cgi",
        "pdb",
        "lzma",
        "fcntl",
        "reprlib",
        "faulthandler",
        "telnetlib",
        "mimetypes",
        "struct",
        "fileinput",
        "ctypes",
        "quopri",
        "imghdr",
        "pickletools",
        "pyclbr",
        "symtable",
        "collections",
        "select",
        "xmlrpc",
        "zipimport",
        "sysconfig",
        "socketserver",
        "tokenize",
        "dbm",
        "types",
        "aifc",
        "socket",
        "dis",
        "modulefinder",
        "configparser",
        "smtplib",
        "ensurepip",
        "selectors",
        "secrets",
        "rlcompleter",
        "threading",
        "ast",
        "macpath",
        "operator",
        "decimal",
        "zipapp",
        "stat",
        "pkgutil",
        "poplib",
        "asyncio",
        "pwd",
        "syslog",
        "hmac",
        "atexit",
        "plistlib",
        "copyreg",
        "statistics",
        "signal",
        "wsgiref",
        "inspect",
        "textwrap",
        "sqlite3"
    ],
    "extra_standard_library": [],
    "known_other": {},
    "multi_line_output": "GRID",
    "forced_separate": [
        "test_nameless"
    ],
    "indent": "    ",
    "comment_prefix": "  #",
    "length_sort": false,
    "length_sort_sections": [],
    "add_imports": [],
    "remove_imports": [],
    "reverse_relative": false,
    "force_single_line": false,
    "single_line_exclusions": [],
    "default_section": "THIRDPARTY",
    "import_headings": {},
    "balanced_wrapping": false,
    "use_parentheses": false,
    "order_by_type": true,
    "atomic": false,
    "lines_after_imports": 2,
    "lines_between_sections": 1,
    "lines_between_types": 0,
    "combine_as_imports": false,
    "combine_star": false,
    "keep_direct_and_as_imports": true,
    "include_trailing_comma": false,
    "from_first": false,
    "verbose": true,
    "quiet": false,
    "force_adds": false,
    "force_alphabetical_sort_within_sections": false,
    "force_alphabetical_sort": false,
    "force_grid_wrap": 0,
    "force_sort_within_sections": false,
    "lexicographical": false,
    "ignore_whitespace": false,
    "no_lines_before": [],
    "no_inline_sort": false,
    "ignore_comments": false,
    "case_sensitive": false,
    "sources": [
        {
            "py_version": "py3",
            "force_to_top": [],
            "skip": [
                ".mypy_cache",
                "build",
                "dist",
                ".tox",
                ".eggs",
                ".hg",
                ".git",
                ".nox",
                "_build",
                "node_modules",
                "venv",
                ".pants.d",
                "buck-out",
                ".venv"
            ],
            "skip_glob": [],
            "line_length": 79,
            "wrap_length": 0,
            "line_ending": "",
            "sections": [
                "FUTURE",
                "STDLIB",
                "THIRDPARTY",
                "FIRSTPARTY",
                "LOCALFOLDER"
            ],
            "no_sections": false,
            "known_future_library": [
                "__future__"
            ],
            "known_third_party": [
                "google.appengine.api"
            ],
            "known_first_party": [],
            "known_standard_library": [
                "heapq",
                "curses",
                "html",
                "tkinter",
                "gzip",
                "io",
                "fpectl",
                "wave",
                "chunk",
                "gettext",
                "concurrent",
                "cmath",
                "pydoc",
                "errno",
                "shlex",
                "shelve",
                "test",
                "runpy",
                "zlib",
                "binhex",
                "hashlib",
                "logging",
                "math",
                "glob",
                "bz2",
                "fnmatch",
                "nntplib",
                "tty",
                "numbers",
                "smtpd",
                "calendar",
                "compileall",
                "asyncore",
                "codeop",
                "pathlib",
                "spwd",
                "pprint",
                "distutils",
                "multiprocessing",
                "venv",
                "formatter",
                "queue",
                "http",
                "trace",
                "filecmp",
                "bisect",
                "stringprep",
                "readline",
                "mmap",
                "_dummy_thread",
                "importlib",
                "keyword",
                "encodings",
                "shutil",
                "posix",
                "traceback",
                "webbrowser",
                "typing",
                "array",
                "random",
                "unicodedata",
                "tabnanny",
                "colorsys",
                "token",
                "ntpath",
                "unittest",
                "string",
                "tracemalloc",
                "audioop",
                "msvcrt",
                "doctest",
                "datetime",
                "csv",
                "linecache",
                "code",
                "pstats",
                "dummy_threading",
                "pickle",
                "parser",
                "tarfile",
                "imp",
                "turtle",
                "os",
                "ftplib",
                "sre_constants",
                "zipfile",
                "winreg",
                "nis",
                "pipes",
                "symbol",
                "itertools",
                "contextvars",
                "ipaddress",
                "winsound",
                "cProfile",
                "cgitb",
                "weakref",
                "sched",
                "base64",
                "grp",
                "subprocess",
                "timeit",
                "sunau",
                "email",
                "site",
                "fractions",
                "msilib",
                "json",
                "_thread",
                "binascii",
                "copy",
                "crypt",
                "mailcap",
                "codecs",
                "contextlib",
                "mailbox",
                "profile",
                "functools",
                "bdb",
                "netrc",
                "ssl",
                "sys",
                "argparse",
                "py_compile",
                "ossaudiodev",
                "marshal",
                "pty",
                "turtledemo",
                "locale",
                "optparse",
                "termios",
                "platform",
                "sndhdr",
                "resource",
                "dataclasses",
                "gc",
                "re",
                "uuid",
                "xdrlib",
                "cmd",
                "tempfile",
                "urllib",
                "getopt",
                "time",
                "posixpath",
                "abc",
                "uu",
                "enum",
                "getpass",
                "lib2to3",
                "asynchat",
                "builtins",
                "difflib",
                "imaplib",
                "warnings",
                "xml",
                "cgi",
                "pdb",
                "lzma",
                "fcntl",
                "reprlib",
                "faulthandler",
                "telnetlib",
                "mimetypes",
                "struct",
                "fileinput",
                "ctypes",
                "quopri",
                "imghdr",
                "pickletools",
                "pyclbr",
                "symtable",
                "collections",
                "select",
                "xmlrpc",
                "zipimport",
                "sysconfig",
                "socketserver",
                "tokenize",
                "dbm",
                "types",
                "aifc",
                "socket",
                "dis",
                "modulefinder",
                "configparser",
                "smtplib",
                "ensurepip",
                "selectors",
                "secrets",
                "rlcompleter",
                "threading",
                "ast",
                "macpath",
                "operator",
                "decimal",
                "zipapp",
                "stat",
                "pkgutil",
                "poplib",
                "asyncio",
                "pwd",
                "syslog",
                "hmac",
                "atexit",
                "plistlib",
                "copyreg",
                "statistics",
                "signal",
                "wsgiref",
                "inspect",
                "textwrap",
                "sqlite3"
            ],
            "extra_standard_library": [],
            "known_other": {},
            "multi_line_output": "GRID",
            "forced_separate": [],
            "indent": "    ",
            "comment_prefix": "  #",
            "length_sort": false,
            "length_sort_sections": [],
            "add_imports": [],
            "remove_imports": [],
            "reverse_relative": false,
            "force_single_line": false,
            "single_line_exclusions": [],
            "default_section": "THIRDPARTY",
            "import_headings": {},
            "balanced_wrapping": false,
            "use_parentheses": false,
            "order_by_type": true,
            "atomic": false,
            "lines_after_imports": -1,
            "lines_between_sections": 1,
            "lines_between_types": 0,
            "combine_as_imports": false,
            "combine_star": false,
            "keep_direct_and_as_imports": true,
            "include_trailing_comma": false,
            "from_first": false,
            "verbose": false,
            "quiet": false,
            "force_adds": false,
            "force_alphabetical_sort_within_sections": false,
            "force_alphabetical_sort": false,
            "force_grid_wrap": 0,
            "force_sort_within_sections": false,
            "lexicographical": false,
            "ignore_whitespace": false,
            "no_lines_before": [],
            "no_inline_sort": false,
            "ignore_comments": false,
            "case_sensitive": false,
            "sources": [],
            "virtual_env": "",
            "conda_env": "",
            "ensure_newline_before_comments": false,
            "directory": "",
            "profile": "",
            "src_paths": [],
            "old_finders": false,
            "source": "defaults"
        },
        {
            "line_length": 120,
            "lines_after_imports": 2,
            "known_first_party": [
                "nameless"
            ],
            "default_section": "THIRDPARTY",
            "forced_separate": [
                "test_nameless"
            ],
            "skip": [
                "migrations"
            ],
            "source": "/nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python/setup.cfg"
        },
        {
            "verbose": true,
            "source": "runtime"
        }
    ],
    "virtual_env": "",
    "conda_env": "",
    "ensure_newline_before_comments": false,
    "directory": "/nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python",
    "profile": "",
    "src_paths": [
        "/nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python",
        "/nfs/pdx/disks/mpe_tvpv_002/pgupta6/work-repo/python/src"
    ],
    
"old_finders": false
}

@timothycrosley
Copy link
Member

Thanks for reporting and sharing your settings. They were super hepful to diagnose the issue (was able to reproduce it immediately!) This is fixed with an additional regression test added in 5.0.6.

Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working repo_needed Can't currently reproduce, if reproduction steps are added we will resivit this issue.
Projects
None yet
Development

No branches or pull requests

3 participants