Skip to content

Commit

Permalink
chore: remove type hints for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlbauer committed Jan 24, 2025
1 parent e229ccd commit d4a66cb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions rocrate/model/data_entity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
from typing import Generator

# Copyright 2019-2024 The University of Manchester, UK
# Copyright 2020-2024 Vlaams Instituut voor Biotechnologie (VIB), BE
Expand Down Expand Up @@ -30,7 +29,7 @@ class DataEntity(Entity):
def write(self, base_path):
pass

def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
def stream(self, chunk_size=8192):
""" Stream the data from the source. Each chunk of the content is yielded as a tuple
containing the name of the destination file relative to the crate and the chunk of data.
The destination file name is required because a DataEntity can be a file or a
Expand Down
3 changes: 1 addition & 2 deletions rocrate/model/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import os
import warnings
from pathlib import Path
from typing import Generator
from urllib.request import urlopen

from .file_or_dir import FileOrDir
Expand Down Expand Up @@ -82,7 +81,7 @@ def write(self, base_path):
else:
self._copy_folder(base_path)

def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
def stream(self, chunk_size=8192):
if self.source is None:
return
elif is_url(str(self.source)):
Expand Down
4 changes: 2 additions & 2 deletions rocrate/model/file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python

# Copyright 2019-2024 The University of Manchester, UK
# Copyright 2020-2024 Vlaams Instituut voor Biotechnologie (VIB), BE
# Copyright 2020-2024 Barcelona Supercomputing Center (BSC), ES
Expand All @@ -21,7 +22,6 @@

from pathlib import Path
import requests
from typing import Generator

import shutil
import urllib.request
Expand Down Expand Up @@ -125,7 +125,7 @@ def _stream_from_file(self, path, chunk_size=8192):
if self.record_size:
self._jsonld['contentSize'] = str(size)

def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
def stream(self, chunk_size=8192):
if isinstance(self.source, (BytesIO, StringIO)):
yield from self._stream_from_stream(self.source)
elif is_url(str(self.source)):
Expand Down
3 changes: 1 addition & 2 deletions rocrate/model/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import json
from pathlib import Path
from typing import Generator

from .file import File
from .dataset import Dataset
Expand Down Expand Up @@ -75,7 +74,7 @@ def generate(self):
context = context[0]
return {'@context': context, '@graph': graph}

def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
def stream(self, chunk_size=8192):
content = self.generate()
yield self.id, str.encode(json.dumps(content, indent=4, sort_keys=True), encoding='utf-8')

Expand Down
3 changes: 1 addition & 2 deletions rocrate/model/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import os
from pathlib import Path
from typing import Generator

from jinja2 import Template
from .file import File
Expand Down Expand Up @@ -91,7 +90,7 @@ def is_object_list(a):
out_html = src.render(crate=self.crate, context=context_entities, data=data_entities)
return out_html

def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
def stream(self, chunk_size=8192):
if self.source:
yield from super().stream()
else:
Expand Down

0 comments on commit d4a66cb

Please sign in to comment.