Skip to content

Commit 1b952ed

Browse files
authored
docs: fix references to print_import (#17)
1 parent 28b1e9b commit 1b952ed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ If they are from different Python modules, the arguments import path will be add
9696

9797
If both files are from the same `PyImportPath`, then the import path is not added to the list of imports. In that case it is sufficient to reference the `PyIdent` by its simple name (e.g. `Timestamp`), thus only the `PyIdent.py_name` will be printed.
9898

99-
To place the import statements in the buffer of the `GeneratedFile` use `GeneratedFile.print_imports`. This will put a line `"import <path>"` for each `PyImportPath` that the generated file needs to import (e.g `"import google.protobuf.timestamp_pb2"`) in the buffer.
99+
To place the import statements in the buffer of the `GeneratedFile` use `GeneratedFile.print_import`. This will put a line `"import <path>"` for each `PyImportPath` that the generated file needs to import (e.g `"import google.protobuf.timestamp_pb2"`) in the buffer.
100100

101101
The following example shows how the `GeneratedFile.P` function behaves for different `PyImportPaths`::
102102

protogen/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def generate(gen: protogen.Plugin):
3131
)
3232
g.P("# Generated code ahead.")
3333
g.P()
34-
g.print_imports()
34+
g.print_import()
3535
g.P()
3636
for m in f.message:
3737
g.P("class ", m.py_ident, ":")
@@ -1411,7 +1411,7 @@ class GeneratedFile:
14111411
14121412
Additionally, the generated file provides mechanism for handling Python
14131413
imports. Internally it maintains a list of :class:`PyImportPath` s that are
1414-
requested to be imported. Use :meth:`print_imports` to mark the position in
1414+
requested to be imported. Use :meth:`print_import` to mark the position in
14151415
the output buffer the imports will be printed at.
14161416
14171417
To create a new instance of a generated file use
@@ -1552,7 +1552,7 @@ def print_import(self):
15521552
-------
15531553
>>> g.P("# My python file")
15541554
>>> g.P()
1555-
>>> g.print_imports()
1555+
>>> g.print_import()
15561556
>>> g.P()
15571557
>>> g.P("# more content following after the imports..")
15581558
"""

0 commit comments

Comments
 (0)