Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show uploader if exists #8107

Merged
merged 11 commits into from
Oct 5, 2023
24 changes: 14 additions & 10 deletions packages/syft/src/syft/service/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Asset(SyftObject):
mock_is_real: bool = False
shape: Optional[Tuple]
created_at: DateTime = DateTime.now()
uploader: Contributor
uploader: Optional[Contributor]

__repr_attrs__ = ["name", "shape"]

Expand All @@ -165,11 +165,12 @@ def _repr_html_(self) -> Any:
# relative
from ...service.action.action_object import ActionObject

uploaded_by_line = "n/a"
if len(self.contributors) > 0:
uploaded_by_line = (
f"<p><strong>Uploaded by: </strong>{self.uploader.name}</p>"
)
uploaded_by_line = (
f"<p><strong>Uploaded by: </strong>{self.uploader.name} ({self.uploader.email})</p>"
if self.uploader
else ""
)

if isinstance(self.data, ActionObject):
data_table_line = itables.to_html_datatable(
df=self.data.syft_action_data, css=itables_css
Expand Down Expand Up @@ -494,12 +495,15 @@ def _coll_repr_(self) -> Dict[str, Any]:
}

def _repr_html_(self) -> Any:
uploaded_by_line = "n/a"
if len(self.contributors) > 0:
uploaded_by_line = (
uploaded_by_line = (
(
"<p class='paragraph-sm'><strong>"
+ f"<span class='pr-8'>Uploaded by:</span></strong>{self.uploader.name}</p>"
+ f"<span class='pr-8'>Uploaded by:</span></strong>{self.uploader.name} ({self.uploader.email})</p>"
)
if self.uploader
else ""
)

return f"""
<style>
{fonts_css}
Expand Down
Loading