Skip to content

Commit 3554396

Browse files
authored
Fix extra blank lines after custom headers in multiple files (#2638)
1 parent 89f54b1 commit 3554396

14 files changed

Lines changed: 1 addition & 14 deletions

File tree

src/datamodel_code_generator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ def get_header_and_first_line(csv_file: IO[str]) -> dict[str, Any]:
779779
if header_after:
780780
content = header_before + "\n" + extracted_future + "\n\n" + header_after
781781
else:
782-
content = header_before + "\n\n\n" + extracted_future
782+
content = header_before + "\n\n" + extracted_future
783783
print(content, file=file)
784784
print(file=file)
785785
print(body_without_future.rstrip(), file=file)

tests/data/expected/main/openapi/custom_file_header.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# header ;
33
# file ;
44

5-
65
from __future__ import annotations
76

87
from typing import List, Optional

tests/data/expected/main/openapi/custom_file_header_comments_only.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Just a comment
22
# Another comment
33

4-
54
from __future__ import annotations
65

76
from typing import List, Optional

tests/data/expected/main/openapi/custom_file_header_with_docstring.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This module contains generated models.
44
"""
55

6-
76
from __future__ import annotations
87

98
from typing import List, Optional

tests/data/expected/main/openapi/modular_all_exports_children_docstring/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from ._internal import DifferentTea, Error, Id, OptionalModel, Result, Source

tests/data/expected/main/openapi/modular_all_exports_children_docstring/_internal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from typing import List, Optional

tests/data/expected/main/openapi/modular_all_exports_children_docstring/bar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from pydantic import BaseModel, Field

tests/data/expected/main/openapi/modular_all_exports_children_docstring/collections.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from enum import Enum

tests/data/expected/main/openapi/modular_all_exports_children_docstring/foo/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from .._internal import Cocoa, Tea

tests/data/expected/main/openapi/modular_all_exports_children_docstring/foo/bar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This is a multi-line docstring used for testing.
55
"""
66

7-
87
from __future__ import annotations
98

109
from typing import Any, Dict, List, Optional

0 commit comments

Comments
 (0)