diff --git a/README.md b/README.md index 14951cc..b8e0584 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ If they are from different Python modules, the arguments import path will be add 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. -To place the import statements in the buffer of the `GeneratedFile` use `GeneratedFile.print_imports`. This will put a line `"import "` for each `PyImportPath` that the generated file needs to import (e.g `"import google.protobuf.timestamp_pb2"`) in the buffer. +To place the import statements in the buffer of the `GeneratedFile` use `GeneratedFile.print_import`. This will put a line `"import "` for each `PyImportPath` that the generated file needs to import (e.g `"import google.protobuf.timestamp_pb2"`) in the buffer. The following example shows how the `GeneratedFile.P` function behaves for different `PyImportPaths`:: diff --git a/protogen/__init__.py b/protogen/__init__.py index bd253bc..a17415d 100644 --- a/protogen/__init__.py +++ b/protogen/__init__.py @@ -31,7 +31,7 @@ def generate(gen: protogen.Plugin): ) g.P("# Generated code ahead.") g.P() - g.print_imports() + g.print_import() g.P() for m in f.message: g.P("class ", m.py_ident, ":") @@ -1411,7 +1411,7 @@ class GeneratedFile: Additionally, the generated file provides mechanism for handling Python imports. Internally it maintains a list of :class:`PyImportPath` s that are - requested to be imported. Use :meth:`print_imports` to mark the position in + requested to be imported. Use :meth:`print_import` to mark the position in the output buffer the imports will be printed at. To create a new instance of a generated file use @@ -1552,7 +1552,7 @@ def print_import(self): ------- >>> g.P("# My python file") >>> g.P() - >>> g.print_imports() + >>> g.print_import() >>> g.P() >>> g.P("# more content following after the imports..") """