#27182: Some import statement use backslashes instead of parentheses
-------------------------------+--------------------------------------
     Reporter:  cjerdonek      |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.10
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by cjerdonek):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> Some import statements in Django's code base use backslashes to break
> long lines instead of parentheses (at least 21 occurrences if you search
> the code base for "`import \`"). Here is one example (direct link
> [https://github.com/django/django/blob/9a2a52558e080f109a27d40a033a135c9d0e7e50/django/contrib/gis/db/backends/mysql/base.py#L1
> here]):
>
> {{{#!python
> from django.db.backends.mysql.base import \
>     DatabaseWrapper as MySQLDatabaseWrapper
> }}}
>
> These go against Django's coding style standards, which
> [https://docs.djangoproject.com/en/dev/internals/contributing/writing-
> code/coding-style/#imports say in the "Imports" section to use
> parentheses]:
>
>  Break long lines using parentheses and indent continuation lines by 4
> spaces.
>
> Django's coding style also says to follow PEP 8, which says this:
>
>  The preferred way of wrapping long lines is by using Python's implied
> line continuation inside parentheses, brackets and braces. Long lines can
> be broken over multiple lines by wrapping expressions in parentheses.
> These should be used in preference to using a backslash for line
> continuation.
>
> I believe this issue is caused by a bug in isort, since the isort section
> of Django's `setup.cfg`
> [https://github.com/django/django/blob/9a2a52558e080f109a27d40a033a135c9d0e7e50/setup.cfg#L16
> already sets] `multi_line_output=5` (which means to use parentheses). I
> tried filing an issue about this
> [https://github.com/timothycrosley/isort/issues/466 here].

New description:

 Some import statements in Django's code base use backslashes to break long
 lines instead of parentheses (at least 21 occurrences if you search the
 code base for "`import \`"). Here is one example (direct link
 
[https://github.com/django/django/blob/9a2a52558e080f109a27d40a033a135c9d0e7e50/django/contrib/gis/db/backends/mysql/base.py#L1
 here]):

 {{{#!python
 from django.db.backends.mysql.base import \
     DatabaseWrapper as MySQLDatabaseWrapper
 }}}

 These go against Django's coding style standards, which say in the
 "Imports" section
 [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /coding-style/#imports to use parentheses]:

  Break long lines using parentheses and indent continuation lines by 4
 spaces.

 Django's coding style also says to follow PEP 8, which says this:

  The preferred way of wrapping long lines is by using Python's implied
 line continuation inside parentheses, brackets and braces. Long lines can
 be broken over multiple lines by wrapping expressions in parentheses.
 These should be used in preference to using a backslash for line
 continuation.

 I believe this issue is caused by a bug in isort, since the isort section
 of Django's `setup.cfg`
 
[https://github.com/django/django/blob/9a2a52558e080f109a27d40a033a135c9d0e7e50/setup.cfg#L16
 already sets] `multi_line_output=5` (which means to use parentheses). I
 tried filing an issue about this
 [https://github.com/timothycrosley/isort/issues/466 here].

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27182#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.fe04dd022a20c7f45679d3d14255f85f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to