Skip to content

Commit

Permalink
Merge branch 'hotfix/0.3.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeltevanBoheemen committed Jul 27, 2022
2 parents 00e9700 + 33708ba commit 030dd7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions corpus2alpino/targets/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,25 @@ class FilesystemTarget(Target):
__current_output_path = None

def __open_file(self, document: Document, filename: str = None, suffix: str = None):
if not self.merge_files:
output_path = path.join(self.output_path,
document.collected_file.relpath,
document.collected_file.filename)
if self.merge_files:
# when merge_files = True, a file is already open
return

output_path = path.join(self.output_path,
document.collected_file.relpath,
document.collected_file.filename)

if document.subpath:
output_path = path.join(output_path, document.subpath)
if document.subpath:
output_path = path.join(output_path, document.subpath)

if filename != None:
output_path = path.join(output_path, cast(str, filename))
if suffix != None:
output_path = str(
Path(output_path).with_suffix(cast(str, suffix)))
if filename != None:
output_path = path.join(output_path, cast(str, filename))
if suffix != None:
output_path = str(
Path(output_path).with_suffix(cast(str, suffix)))

# always open a new file when splitting in separate files
self.__current_output_path = None
# always open a new file when splitting in separate files
self.__current_output_path = None

if self.__current_output_path != output_path:
if self.file: # type: ignore
Expand Down Expand Up @@ -59,6 +62,7 @@ def __init__(self, output_path: str, merge_files=False) -> None:
self.merge_files = merge_files
if self.merge_files:
# using a single file
makedirs(path.dirname(output_path), exist_ok=True)
self.file = open(output_path, 'w', encoding='utf-8')
else:
self.file = None # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = f.read()

setuptools.setup(name='corpus2alpino',
version='0.3.9',
version='0.3.10',
description='Converts FoLiA and TEI files to Alpino XML files',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 030dd7b

Please sign in to comment.