Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ocr4all-page-segmentation
pypagexml
Commits
a8f39510
Commit
a8f39510
authored
Jul 10, 2020
by
Alexander Gehrke
Browse files
Add type annotations to all generated subclasses
parent
6ce0c7ae
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
pypagexml/core.py
View file @
a8f39510
...
@@ -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
...
...
pypagexml/ds/generated.py
View file @
a8f39510
...
@@ -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
...
...
pypagexml/ds/subclasses.py
View file @
a8f39510
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment