1212 BaseRemoteGroup ,
1313)
1414
15- from .catalog import Dataset , DatasetGroup , File
15+ from .catalog import CatalogDataset , DatasetGroup , CatalogFile
1616
1717
18- class CatalogFile (BaseRemoteFile ):
19- record : File = Field (exclude = True )
20- parent : Union ["CatalogDataset " , "CatalogGroup " ] = Field (exclude = True )
18+ class File (BaseRemoteFile ):
19+ record : CatalogFile = Field (exclude = True )
20+ parent : Union ["Dataset " , "Group " ] = Field (exclude = True )
2121
2222 type : str = "remote"
2323
@@ -52,9 +52,7 @@ def sha256(self) -> Optional[str]:
5252 async def _download (
5353 self , output : Path , callback : Optional [Callable [[int ], None ]] = None
5454 ) -> Path :
55- return await self .client ._download_file (
56- self , output , callback = callback
57- )
55+ return await self .client ._download_file (self , output , callback = callback )
5856
5957 async def verify (self , path : Path ) -> bool :
6058 if not self .sha256 :
@@ -71,9 +69,9 @@ def _calculate():
7169 return actual_hash == self .sha256
7270
7371
74- class CatalogGroup (BaseRemoteGroup ):
72+ class Group (BaseRemoteGroup ):
7573 record : DatasetGroup = Field (exclude = True )
76- dataset : "CatalogDataset " = Field (exclude = True )
74+ dataset : "Dataset " = Field (exclude = True )
7775
7876 @property
7977 def name (self ) -> str :
@@ -90,17 +88,15 @@ def long_name(self) -> str:
9088 @property
9189 def description (self ) -> str :
9290 return (
93- self .record .group_metadata .description
94- if self .record .group_metadata
95- else ""
91+ self .record .group_metadata .description if self .record .group_metadata else ""
9692 )
9793
98- async def files (self , ** kwargs ) -> List [CatalogFile ]:
99- return [CatalogFile (record = f , parent = self ) for f in self .record .files ]
94+ async def files (self , ** kwargs ) -> List [File ]:
95+ return [File (record = f , parent = self ) for f in self .record .files ]
10096
10197
102- class CatalogDataset (BaseRemoteDataset ):
103- record : Dataset = Field (exclude = True )
98+ class Dataset (BaseRemoteDataset ):
99+ record : CatalogDataset = Field (exclude = True )
104100 client : BaseRemoteClient = Field (exclude = True )
105101
106102 @property
@@ -123,22 +119,13 @@ def description(self) -> str:
123119 else ""
124120 )
125121
126- async def content (
127- self , ** kwargs
128- ) -> List [Union [CatalogGroup , CatalogFile ]]:
122+ async def content (self , ** kwargs ) -> List [Union [Group , File ]]:
129123 items = []
130124
131125 if self .record .groups :
132- items .extend (
133- [
134- CatalogGroup (record = g , dataset = self )
135- for g in self .record .groups
136- ]
137- )
126+ items .extend ([Group (record = g , dataset = self ) for g in self .record .groups ])
138127
139128 if self .record .files :
140- items .extend (
141- [CatalogFile (record = f , parent = self ) for f in self .record .files ]
142- )
129+ items .extend ([File (record = f , parent = self ) for f in self .record .files ])
143130
144131 return items
0 commit comments