[object Object]

← back to Exo

cleaner download_progress

2667c8af44c4083232905c4ab35d5a49efd306a5 · 2024-08-25 22:14:58 +0100 · Alex Cheema

Files touched

Diff

commit 2667c8af44c4083232905c4ab35d5a49efd306a5
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Sun Aug 25 22:14:58 2024 +0100

    cleaner download_progress
---
 exo/download/download_progress.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/exo/download/download_progress.py b/exo/download/download_progress.py
index b888ed0a..779e5328 100644
--- a/exo/download/download_progress.py
+++ b/exo/download/download_progress.py
@@ -23,9 +23,7 @@ class RepoFileProgressEvent:
 
   @classmethod
   def from_dict(cls, data):
-    # Convert eta from seconds back to timedelta
-    if 'eta' in data:
-      data['eta'] = timedelta(seconds=data['eta'])
+    if 'eta' in data: data['eta'] = timedelta(seconds=data['eta'])
     return cls(**data)
 
 
@@ -53,13 +51,8 @@ class RepoProgressEvent:
 
   @classmethod
   def from_dict(cls, data):
-    # Convert overall_eta from seconds back to timedelta
-    if 'overall_eta' in data:
-      data['overall_eta'] = timedelta(seconds=data['overall_eta'])
-
-    # Parse file_progress
-    if 'file_progress' in data:
-      data['file_progress'] = {k: RepoFileProgressEvent.from_dict(v) for k, v in data['file_progress'].items()}
+    if 'overall_eta' in data: data['overall_eta'] = timedelta(seconds=data['overall_eta'])
+    if 'file_progress' in data: data['file_progress'] = {k: RepoFileProgressEvent.from_dict(v) for k, v in data['file_progress'].items()}
 
     return cls(**data)
 

← f46d077b fix font dependencies for tinychat. related: #172  ·  back to Exo  ·  update mlx to 0.17.1 (not sure where 0.17.0 went on PyPi dis d917778e →