mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-15 21:09:07 +00:00

Some checks are pending
CI / cargo build (release) (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks instrumented (ruff) (push) Blocked by required conditions
CI / benchmarks instrumented (ty) (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Summary -- Closes #19467 and also removes the warning about using Python 3.14 without preview enabled. I also bumped `PythonVersion::default` to 3.9 because it reaches EOL this month, but we could also defer that for now if we wanted. The first three commits are related to the `latest` bump to 3.14; the fourth commit bumps the default to 3.10. Note that this PR also bumps the default Python version for ty to 3.10 because there was a test asserting that it stays in sync with `ast::PythonVersion`. Test Plan -- Existing tests I spot-checked the ecosystem report, and I believe these are all expected. Inbits doesn't specify a target Python version, so I guess we're applying the default. UP007, UP035, and UP045 all use the new default value to emit new diagnostics.
1044 lines
21 KiB
Text
1044 lines
21 KiB
Text
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring.py
|
|
---
|
|
## Input
|
|
```python
|
|
def single_line_backslashes1():
|
|
""" content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
""" content\\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
""" content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring():
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self): """ This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated"
|
|
|
|
"""
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
' content\ '
|
|
return
|
|
```
|
|
|
|
## Outputs
|
|
### Output 1
|
|
```
|
|
indent-style = space
|
|
line-width = 88
|
|
indent-width = 4
|
|
quote-style = Double
|
|
line-ending = LineFeed
|
|
magic-trailing-comma = Respect
|
|
docstring-code = Disabled
|
|
docstring-code-line-width = "dynamic"
|
|
preview = Disabled
|
|
target_version = 3.10
|
|
source_type = Python
|
|
```
|
|
|
|
```python
|
|
def single_line_backslashes1():
|
|
"""content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
"""content\\"""
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
"""content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\"""
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring:
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self):
|
|
"""This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
"content\ "
|
|
return
|
|
```
|
|
|
|
|
|
### Output 2
|
|
```
|
|
indent-style = space
|
|
line-width = 88
|
|
indent-width = 2
|
|
quote-style = Double
|
|
line-ending = LineFeed
|
|
magic-trailing-comma = Respect
|
|
docstring-code = Disabled
|
|
docstring-code-line-width = "dynamic"
|
|
preview = Disabled
|
|
target_version = 3.10
|
|
source_type = Python
|
|
```
|
|
|
|
```python
|
|
def single_line_backslashes1():
|
|
"""content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
"""content\\"""
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
"""content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\"""
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring:
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self):
|
|
"""This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
"content\ "
|
|
return
|
|
```
|
|
|
|
|
|
### Output 3
|
|
```
|
|
indent-style = tab
|
|
line-width = 88
|
|
indent-width = 8
|
|
quote-style = Double
|
|
line-ending = LineFeed
|
|
magic-trailing-comma = Respect
|
|
docstring-code = Disabled
|
|
docstring-code-line-width = "dynamic"
|
|
preview = Disabled
|
|
target_version = 3.10
|
|
source_type = Python
|
|
```
|
|
|
|
```python
|
|
def single_line_backslashes1():
|
|
"""content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
"""content\\"""
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
"""content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\"""
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring:
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self):
|
|
"""This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
"content\ "
|
|
return
|
|
```
|
|
|
|
|
|
### Output 4
|
|
```
|
|
indent-style = tab
|
|
line-width = 88
|
|
indent-width = 4
|
|
quote-style = Double
|
|
line-ending = LineFeed
|
|
magic-trailing-comma = Respect
|
|
docstring-code = Disabled
|
|
docstring-code-line-width = "dynamic"
|
|
preview = Disabled
|
|
target_version = 3.10
|
|
source_type = Python
|
|
```
|
|
|
|
```python
|
|
def single_line_backslashes1():
|
|
"""content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
"""content\\"""
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
"""content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\"""
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring:
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self):
|
|
"""This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
"content\ "
|
|
return
|
|
```
|
|
|
|
|
|
### Output 5
|
|
```
|
|
indent-style = space
|
|
line-width = 88
|
|
indent-width = 4
|
|
quote-style = Single
|
|
line-ending = LineFeed
|
|
magic-trailing-comma = Respect
|
|
docstring-code = Disabled
|
|
docstring-code-line-width = "dynamic"
|
|
preview = Disabled
|
|
target_version = 3.10
|
|
source_type = Python
|
|
```
|
|
|
|
```python
|
|
def single_line_backslashes1():
|
|
"""content\ """
|
|
return
|
|
|
|
|
|
def single_line_backslashes2():
|
|
"""content\\"""
|
|
return
|
|
|
|
|
|
def single_line_backslashes3():
|
|
"""content\\\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes1():
|
|
"""This is a docstring with
|
|
some lines of text\ """
|
|
return
|
|
|
|
|
|
def multiline_backslashes2():
|
|
"""This is a docstring with
|
|
some lines of text\\"""
|
|
return
|
|
|
|
|
|
def multiline_backslashes3():
|
|
"""This is a docstring with
|
|
some lines of text\\\ """
|
|
return
|
|
|
|
|
|
def multiple_negatively_indented_docstring_lines():
|
|
"""a
|
|
b
|
|
c
|
|
d
|
|
e
|
|
"""
|
|
|
|
|
|
def overindentend_docstring():
|
|
"""a
|
|
over-indented
|
|
"""
|
|
|
|
|
|
def comment_before_docstring():
|
|
# don't lose this function comment ...
|
|
"""Does nothing.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this function comment
|
|
|
|
|
|
class CommentBeforeDocstring:
|
|
# don't lose this class comment ...
|
|
"""Empty class.
|
|
|
|
But it has comments
|
|
""" # ... neither lose this class comment
|
|
|
|
|
|
class IndentMeSome:
|
|
def doc_string_without_linebreak_after_colon(self):
|
|
"""This is somewhat strange
|
|
a
|
|
b
|
|
We format this a is the docstring had started properly indented on the next
|
|
line if the target indentation. This may we incorrect since source and target
|
|
indentation can be incorrect, but this is also an edge case.
|
|
"""
|
|
|
|
|
|
class IgnoreImplicitlyConcatenatedStrings:
|
|
"""""" ''
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break1():
|
|
"""
|
|
he said "the news of my death have been greatly exaggerated"
|
|
"""
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break2():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
def docstring_that_ends_with_quote_and_a_line_break3():
|
|
"""he said "the news of my death have been greatly exaggerated" """
|
|
|
|
|
|
class ByteDocstring:
|
|
b""" has leading whitespace"""
|
|
first_statement = 1
|
|
|
|
|
|
class CommentAfterDocstring1:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring2:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring3:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring4:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
class CommentAfterDocstring5:
|
|
"""Browse module classes and functions in IDLE."""
|
|
|
|
# This class is also the base class for pathbrowser.PathBrowser.
|
|
|
|
|
|
def f():
|
|
"""Browse module classes and functions in IDLE."""
|
|
# ^ Do not insert a newline above here
|
|
|
|
pass
|
|
|
|
|
|
class TabbedIndent:
|
|
def tabbed_indent(self):
|
|
"""check for correct tabbed formatting
|
|
^^^^^^^^^^
|
|
Normal indented line
|
|
- author
|
|
"""
|
|
|
|
|
|
def single_quoted():
|
|
"content\ "
|
|
return
|
|
```
|