@@ -291,7 +291,7 @@ def _process_comment(self, line) -> None:
291
291
# These are called user comments
292
292
self .user_comments .append (line [1 :].strip ())
293
293
294
- def parse (self , fileobj : IO [AnyStr ]) -> None :
294
+ def parse (self , fileobj : IO [AnyStr ] | Iterable [ AnyStr ] ) -> None :
295
295
"""
296
296
Reads from the file-like object `fileobj` and adds any po file
297
297
units found in it to the `Catalog` supplied to the constructor.
@@ -329,15 +329,15 @@ def _invalid_pofile(self, line, lineno, msg) -> None:
329
329
330
330
331
331
def read_po (
332
- fileobj : IO [AnyStr ],
332
+ fileobj : IO [AnyStr ] | Iterable [ AnyStr ] ,
333
333
locale : str | Locale | None = None ,
334
334
domain : str | None = None ,
335
335
ignore_obsolete : bool = False ,
336
336
charset : str | None = None ,
337
337
abort_invalid : bool = False ,
338
338
) -> Catalog :
339
339
"""Read messages from a ``gettext`` PO (portable object) file from the given
340
- file-like object and return a `Catalog`.
340
+ file-like object (or an iterable of lines) and return a `Catalog`.
341
341
342
342
>>> from datetime import datetime
343
343
>>> from io import StringIO
@@ -373,7 +373,7 @@ def read_po(
373
373
.. versionadded:: 1.0
374
374
Added support for explicit charset argument.
375
375
376
- :param fileobj: the file-like object to read the PO file from
376
+ :param fileobj: the file-like object (or iterable of lines) to read the PO file from
377
377
:param locale: the locale identifier or `Locale` object, or `None`
378
378
if the catalog is not bound to a locale (which basically
379
379
means it's a template)
0 commit comments