Skip to content

Commit 4a27017

Browse files
authored
generated file notifies users not to edit file (#161)
Signed-off-by: Aminu 'Seun Joshua <[email protected]>
1 parent efce864 commit 4a27017

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/summary.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,10 @@ impl<'a> Summary<'a> {
11631163
alias_module: Option<String>,
11641164
}
11651165

1166+
let file_header = "# This file is automatically generated by componentize-py
1167+
# It is not intended for manual editing.
1168+
";
1169+
11661170
let mut interface_imports = HashMap::<InterfaceId, Definitions>::new();
11671171
let mut interface_exports = HashMap::<InterfaceId, Definitions>::new();
11681172
let mut world_imports = Definitions::default();
@@ -1799,7 +1803,7 @@ Result = peer.types.Result
17991803

18001804
write!(
18011805
file,
1802-
"{python_imports}
1806+
"{file_header}{python_imports}
18031807
18041808
S = TypeVar('S')
18051809
@dataclass
@@ -1853,7 +1857,7 @@ Result = Union[Ok[T], Err[E]]
18531857

18541858
write!(
18551859
file,
1856-
"{docs}{python_imports}
1860+
"{file_header}{docs}{python_imports}
18571861
from ..types import Result, Ok, Err, Some
18581862
{imports}
18591863
{types}
@@ -1884,7 +1888,7 @@ from ..types import Result, Ok, Err, Some
18841888

18851889
write!(
18861890
file,
1887-
"{docs}{python_imports}
1891+
"{file_header}{docs}{python_imports}
18881892
from ..types import Result, Ok, Err, Some
18891893
{imports}
18901894
{types}
@@ -1931,7 +1935,7 @@ class {camel}(Protocol):
19311935

19321936
write!(
19331937
init,
1934-
"{python_imports}
1938+
"{file_header}{python_imports}
19351939
from ..types import Result, Ok, Err, Some
19361940
{imports}
19371941
{protocols}
@@ -1983,7 +1987,7 @@ from ..types import Result, Ok, Err, Some
19831987

19841988
write!(
19851989
file,
1986-
"{docs}{python_imports}
1990+
"{file_header}{docs}{python_imports}
19871991
from .types import Result, Ok, Err, Some
19881992
{imports}
19891993
{type_exports}

0 commit comments

Comments
 (0)