Skip to content

Commit d4a66cb

Browse files
committed
chore: remove type hints for consistency
1 parent e229ccd commit d4a66cb

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

rocrate/model/data_entity.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
from typing import Generator
32

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

33-
def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
32+
def stream(self, chunk_size=8192):
3433
""" Stream the data from the source. Each chunk of the content is yielded as a tuple
3534
containing the name of the destination file relative to the crate and the chunk of data.
3635
The destination file name is required because a DataEntity can be a file or a

rocrate/model/dataset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import os
2525
import warnings
2626
from pathlib import Path
27-
from typing import Generator
2827
from urllib.request import urlopen
2928

3029
from .file_or_dir import FileOrDir
@@ -82,7 +81,7 @@ def write(self, base_path):
8281
else:
8382
self._copy_folder(base_path)
8483

85-
def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
84+
def stream(self, chunk_size=8192):
8685
if self.source is None:
8786
return
8887
elif is_url(str(self.source)):

rocrate/model/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
23
# Copyright 2019-2024 The University of Manchester, UK
34
# Copyright 2020-2024 Vlaams Instituut voor Biotechnologie (VIB), BE
45
# Copyright 2020-2024 Barcelona Supercomputing Center (BSC), ES
@@ -21,7 +22,6 @@
2122

2223
from pathlib import Path
2324
import requests
24-
from typing import Generator
2525

2626
import shutil
2727
import urllib.request
@@ -125,7 +125,7 @@ def _stream_from_file(self, path, chunk_size=8192):
125125
if self.record_size:
126126
self._jsonld['contentSize'] = str(size)
127127

128-
def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
128+
def stream(self, chunk_size=8192):
129129
if isinstance(self.source, (BytesIO, StringIO)):
130130
yield from self._stream_from_stream(self.source)
131131
elif is_url(str(self.source)):

rocrate/model/metadata.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import json
2424
from pathlib import Path
25-
from typing import Generator
2625

2726
from .file import File
2827
from .dataset import Dataset
@@ -75,7 +74,7 @@ def generate(self):
7574
context = context[0]
7675
return {'@context': context, '@graph': graph}
7776

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

rocrate/model/preview.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import os
2424
from pathlib import Path
25-
from typing import Generator
2625

2726
from jinja2 import Template
2827
from .file import File
@@ -91,7 +90,7 @@ def is_object_list(a):
9190
out_html = src.render(crate=self.crate, context=context_entities, data=data_entities)
9291
return out_html
9392

94-
def stream(self, chunk_size=8192) -> Generator[tuple[str, bytes], None, None]:
93+
def stream(self, chunk_size=8192):
9594
if self.source:
9695
yield from super().stream()
9796
else:

0 commit comments

Comments
 (0)