Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brambg committed Mar 14, 2023
1 parent 45444cd commit 19ee077
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pagexml/helper/file_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def __iter__(self):
yield file_info, file_data


def get_archiver_mode(page_archive_file: str) -> Tuple[Literal["tar", "zip", "py7zr"],
Literal["r", "r:", "r:gz", "r:bz2"]]:
def get_archiver_mode(page_archive_file: str) -> \
Tuple[Literal["tar", "zip", "py7zr"], Literal["r", "r:", "r:gz", "r:bz2"]]:
archived_fname_dir, archived_fname_file, archived_fname_ext = parse_archived_filename(page_archive_file)
if archived_fname_ext in {".tar.gz", ".tgz"}:
return "tar", "r:gz"
Expand Down
10 changes: 5 additions & 5 deletions pagexml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import xmltodict
from dateutil.parser import parse as date_parse

import pagexml.model.physical_document_model as pdm
from pagexml.helper.file_helper import read_page_archive_file
from pagexml.model.physical_document_model import Baseline, Coords, parse_derived_coords
import pagexml.model.physical_document_model as pdm


def parse_coords(coords: dict) -> Union[Coords, None]:
Expand Down Expand Up @@ -52,10 +52,10 @@ def parse_line_words(textline: dict) -> List[pdm.PageXMLWord]:
if "@conf" in word_dict["TextEquiv"]:
conf = word_dict["TextEquiv"]["@conf"]
word = pdm.PageXMLWord(text=unicode_string,
doc_id=word_dict['@id'] if '@id' in word_dict else None,
metadata=parse_custom_metadata(word_dict) if '@custom' in word_dict else None,
coords=parse_coords(word_dict["Coords"]),
conf=conf)
doc_id=word_dict['@id'] if '@id' in word_dict else None,
metadata=parse_custom_metadata(word_dict) if '@custom' in word_dict else None,
coords=parse_coords(word_dict["Coords"]),
conf=conf)
words.append(word)
except TypeError:
print('Unexpected format for Word Unicode representation:', word_dict)
Expand Down

0 comments on commit 19ee077

Please sign in to comment.