mirror of
https://github.com/astral-sh/ruff.git
synced 2025-12-04 01:36:46 +00:00
Unset after_class_docstring state on every iteration (#7001)
This commit is contained in:
parent
31947af6a3
commit
eb2b226142
3 changed files with 49 additions and 1 deletions
|
|
@ -206,3 +206,19 @@ class TestTypeParams[Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
|
||||||
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Regression test for: https://github.com/astral-sh/ruff/pull/7001
|
||||||
|
class QuerySet(AltersData):
|
||||||
|
"""Represent a lazy database lookup for a set of objects."""
|
||||||
|
|
||||||
|
def as_manager(cls):
|
||||||
|
# Address the circular dependency between `Queryset` and `Manager`.
|
||||||
|
from django.db.models.manager import Manager
|
||||||
|
|
||||||
|
manager = Manager.from_queryset(cls)()
|
||||||
|
manager._built_with_as_manager = True
|
||||||
|
return manager
|
||||||
|
|
||||||
|
as_manager.queryset_only = True
|
||||||
|
as_manager = classmethod(as_manager)
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,6 @@ impl FormatRule<Suite, PyFormatContext<'_>> for FormatSuite {
|
||||||
// ...
|
// ...
|
||||||
// ```
|
// ```
|
||||||
empty_line().fmt(f)?;
|
empty_line().fmt(f)?;
|
||||||
after_class_docstring = false;
|
|
||||||
} else {
|
} else {
|
||||||
// Insert the appropriate number of empty lines based on the node level, e.g.:
|
// Insert the appropriate number of empty lines based on the node level, e.g.:
|
||||||
// * [`NodeLevel::Module`]: Up to two empty lines
|
// * [`NodeLevel::Module`]: Up to two empty lines
|
||||||
|
|
@ -320,6 +319,7 @@ impl FormatRule<Suite, PyFormatContext<'_>> for FormatSuite {
|
||||||
following.format().fmt(f)?;
|
following.format().fmt(f)?;
|
||||||
preceding = following;
|
preceding = following;
|
||||||
}
|
}
|
||||||
|
after_class_docstring = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,22 @@ class TestTypeParams[Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
|
||||||
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Regression test for: https://github.com/astral-sh/ruff/pull/7001
|
||||||
|
class QuerySet(AltersData):
|
||||||
|
"""Represent a lazy database lookup for a set of objects."""
|
||||||
|
|
||||||
|
def as_manager(cls):
|
||||||
|
# Address the circular dependency between `Queryset` and `Manager`.
|
||||||
|
from django.db.models.manager import Manager
|
||||||
|
|
||||||
|
manager = Manager.from_queryset(cls)()
|
||||||
|
manager._built_with_as_manager = True
|
||||||
|
return manager
|
||||||
|
|
||||||
|
as_manager.queryset_only = True
|
||||||
|
as_manager = classmethod(as_manager)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
|
|
@ -459,6 +475,22 @@ class TestTypeParams[
|
||||||
|
|
||||||
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
class TestTypeParams[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Regression test for: https://github.com/astral-sh/ruff/pull/7001
|
||||||
|
class QuerySet(AltersData):
|
||||||
|
"""Represent a lazy database lookup for a set of objects."""
|
||||||
|
|
||||||
|
def as_manager(cls):
|
||||||
|
# Address the circular dependency between `Queryset` and `Manager`.
|
||||||
|
from django.db.models.manager import Manager
|
||||||
|
|
||||||
|
manager = Manager.from_queryset(cls)()
|
||||||
|
manager._built_with_as_manager = True
|
||||||
|
return manager
|
||||||
|
|
||||||
|
as_manager.queryset_only = True
|
||||||
|
as_manager = classmethod(as_manager)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue