Skip to content

Commit

Permalink
Extract ABC from verbatim manifest generator
Browse files Browse the repository at this point in the history
  • Loading branch information
nadove-ucsc committed Apr 11, 2024
1 parent 458a693 commit 1752b7c
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/azul/service/manifest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2012,19 +2012,7 @@ def qualify(qualifier, column_name, index=None):
bundle_tsv_writer.writerow(row)


class VerbatimManifestGenerator(FileBasedManifestGenerator):

@property
def content_type(self) -> str:
return 'application/jsonl'

@classmethod
def file_name_extension(cls) -> str:
return 'jsonl'

@classmethod
def format(cls) -> ManifestFormat:
return ManifestFormat.verbatim_jsonl
class VerbatimManifestGenerator(FileBasedManifestGenerator, metaclass=ABCMeta):

@property
def entity_type(self) -> str:
Expand Down Expand Up @@ -2105,6 +2093,21 @@ def _join_replicas(self, keys: Iterable[ReplicaKeys]) -> Iterable[Hit]:
]))
return request.scan()


class JSONLVerbatimManifestGenerator(VerbatimManifestGenerator):

@property
def content_type(self) -> str:
return 'application/jsonl'

@classmethod
def file_name_extension(cls) -> str:
return 'jsonl'

@classmethod
def format(cls) -> ManifestFormat:
return ManifestFormat.verbatim_jsonl

def create_file(self) -> tuple[str, Optional[str]]:
fd, path = mkstemp(suffix=f'.{self.file_name_extension()}')
os.close(fd)
Expand Down

0 comments on commit 1752b7c

Please sign in to comment.