Skip to content

Commit

Permalink
fixed psf#4420
Browse files Browse the repository at this point in the history
As per your instruction .I have added space among all the 'class'.
  • Loading branch information
jyotirjoshi committed Aug 2, 2024
1 parent 4b4ae43 commit 01d39be
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/blib2to3/pytree.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def update_sibling_maps(self) -> None:
_next[id(current)] = None


class Leaf(Base):
Leaf(Base):
"""Concrete implementation for leaf nodes."""
# Default values for instance variables
Expand Down
68 changes: 68 additions & 0 deletions tests/data/cases/class_methods_new_line.py
Original file line number Diff line number Diff line change
@@ -1,97 +1,157 @@
class ClassSimplest:
pass


class ClassWithSingleField:
a = 1


class ClassWithJustTheDocstring:
"""Just a docstring."""


class ClassWithInit:
def __init__(self):
pass


class ClassWithTheDocstringAndInit:
"""Just a docstring."""
def __init__(self):
pass


class ClassWithInitAndVars:
cls_var = 100
def __init__(self):
pass


class ClassWithInitAndVarsAndDocstring:
"""Test class"""
cls_var = 100
def __init__(self):
pass


class ClassWithDecoInit:
@deco
def __init__(self):
pass


class ClassWithDecoInitAndVars:
cls_var = 100
@deco
def __init__(self):
pass


class ClassWithDecoInitAndVarsAndDocstring:
"""Test class"""
cls_var = 100
@deco
def __init__(self):
pass


class ClassSimplestWithInner:
class Inner:
pass


class ClassSimplestWithInnerWithDocstring:


class Inner:
"""Just a docstring."""
def __init__(self):
pass


class ClassWithSingleFieldWithInner:
a = 1


class Inner:
pass


class ClassWithJustTheDocstringWithInner:
"""Just a docstring."""


class Inner:
pass


class ClassWithInitWithInner:


class Inner:
pass
def __init__(self):
pass


class ClassWithInitAndVarsWithInner:
cls_var = 100


class Inner:
pass
def __init__(self):
pass


class ClassWithInitAndVarsAndDocstringWithInner:
"""Test class"""
cls_var = 100


class Inner:
pass
def __init__(self):
pass


class ClassWithDecoInitWithInner:


class Inner:
pass
@deco
def __init__(self):
pass


class ClassWithDecoInitAndVarsWithInner:
cls_var = 100


class Inner:
pass
@deco
def __init__(self):
pass


class ClassWithDecoInitAndVarsAndDocstringWithInner:
"""Test class"""
cls_var = 100


class Inner:
pass
@deco
def __init__(self):
pass


class ClassWithDecoInitAndVarsAndDocstringWithInner2:
"""Test class"""


class Inner:
pass
cls_var = 100
Expand Down Expand Up @@ -168,11 +228,15 @@ def __init__(self):


class ClassSimplestWithInner:


class Inner:
pass


class ClassSimplestWithInnerWithDocstring:


class Inner:
"""Just a docstring."""

Expand All @@ -195,6 +259,8 @@ class Inner:


class ClassWithInitWithInner:


class Inner:
pass

Expand Down Expand Up @@ -225,6 +291,8 @@ def __init__(self):


class ClassWithDecoInitWithInner:


class Inner:
pass

Expand Down
7 changes: 7 additions & 0 deletions tests/data/cases/preview_long_strings__regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def foo(self):
xxxxx_xxxxxxxxxxxx('xxx xxxxxx xxx xxxxxxxxx.xx xx xxxxxxxx. xxx xxxxxxxxxxxxx.xx xxxxxxx '
+ 'xx xxxxxx xxxxxx xxxxxx xx xxxxxxx xxx xxx ${0} xx x xxxxxxxx xxxxx'.xxxxxx(xxxxxx_xxxxxx_xxx))


class A:
class B:
def foo():
Expand All @@ -171,6 +172,7 @@ def foo():
'xxxxxxxxxx' : xxxxx_xxxxx,
}


class A:
def xxxx_xxx_xx_xxxxxxxxxx_xxxx_xxxxxxxxx(xxxx):
xxxxxxxx = [
Expand Down Expand Up @@ -245,6 +247,7 @@ def foo():
f" But not {this}."
)


class A:
class B:
def foo():
Expand Down Expand Up @@ -273,6 +276,7 @@ def foo():
xyz
)


class A:
class B:
def foo():
Expand All @@ -286,6 +290,7 @@ def foo():
"https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
% (name, module_name, get_docs_version()))


class A:
class B:
def foo():
Expand All @@ -301,6 +306,7 @@ def foo():
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)


class Step(StepBase):
def who(self):
self.cmd = 'SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name} {title}/P{passenger_association}'.format(
Expand Down Expand Up @@ -343,6 +349,7 @@ def G():
== c_float(value[0][0] / value[0][1]).value
), "%s didn't roundtrip" % tag


class xxxxxxxxxxxxxxxxxxxxx(xxxx.xxxxxxxxxxxxx):
def xxxxxxx_xxxxxx(xxxx):
assert xxxxxxx_xxxx in [
Expand Down
21 changes: 21 additions & 0 deletions tests/data/cases/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ class D:
class C:
...


class B:
this_lack_of_newline_should_be_kept: int
def b(self) -> None: ...

but_this_newline_should_also_be_kept: int


class A:
attr: int
attr2: str
Expand Down Expand Up @@ -57,6 +59,7 @@ class secret:
def who_has_to_know(self): ...
def verse(self): ...


class Conditional:
def f(self): ...
if sys.version_info >= (3, 8):
Expand All @@ -82,14 +85,18 @@ def m(self): ...
def f(): ...

class D: ...


class C: ...


class B:
this_lack_of_newline_should_be_kept: int
def b(self) -> None: ...

but_this_newline_should_also_be_kept: int


class A:
attr: int
attr2: str
Expand All @@ -104,32 +111,43 @@ def h(): ...
class E:
def f(self): ...


class F:
def f(self): ...


class G: ...


class H: ...

else:
class I: ...


class J: ...

def f(): ...


class K:
def f(self): ...

def f(): ...

class Nested:
class dirty: ...


class little: ...


class secret:
def who_has_to_know(self): ...

def verse(self): ...


class Conditional:
def f(self): ...
if sys.version_info >= (3, 8):
Expand All @@ -145,8 +163,11 @@ def j(self): ...
def k(self): ...
if sys.version_info >= (3, 8):
class A: ...


class B: ...


class C:
def l(self): ...
def m(self): ...
1 change: 1 addition & 0 deletions tests/data/cases/trailing_comma_optional_parens1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_help_text(self):
self.min_length,
) % {'min_length': self.min_length}


class A:
def b(self):
if self.connection.mysql_is_mariadb and (
Expand Down
Loading

0 comments on commit 01d39be

Please sign in to comment.