Commit a8f39510 authored by Alexander Gehrke's avatar Alexander Gehrke
Browse files

Add type annotations to all generated subclasses

parent 6ce0c7ae
...@@ -5,14 +5,14 @@ import pypagexml.ds as ds ...@@ -5,14 +5,14 @@ import pypagexml.ds as ds
import pypagexml.ds.generated as dsgen import pypagexml.ds.generated as dsgen
def new_document(metadata: Optional[ds.MetadataType], page: Optional[ds.PageType]) -> ds.PcGtsTypeSub: def new_document(metadata: Optional[ds.MetadataType], page: Optional[ds.PageType] = None) -> ds.PcGtsTypeSub:
doc = ds.PcGtsTypeSub( doc = ds.PcGtsTypeSub(
metadata=metadata if metadata is not None else ds.MetadataTypeSub.default(), metadata=metadata if metadata is not None else ds.MetadataTypeSub.default(),
page=page) page=page)
return doc return doc
def new_document_from_image(path: str, metadata: Optional[ds.MetadataType]) -> ds.PcGtsTypeSub: def new_document_from_image(path: str, metadata: Optional[ds.MetadataType] = None) -> ds.PcGtsTypeSub:
im = Image.open(path) im = Image.open(path)
w = im.width w = im.width
h = im.height h = im.height
......
...@@ -740,7 +740,6 @@ CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) ...@@ -740,7 +740,6 @@ CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL)
   
# Change this to redirect the generated superclass module to use a # Change this to redirect the generated superclass module to use a
# specific subclass module. # specific subclass module.
import pypagexml.ds.subclasses
CurrentSubclassModule_ = None CurrentSubclassModule_ = None
   
   
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment