102
102
DUMMY_MODEL_ID ,
103
103
DUMMY_MODEL_ID_REVISION_ONE_SPECIFIC_COMMIT ,
104
104
SAMPLE_DATASET_IDENTIFIER ,
105
+ expect_deprecation ,
105
106
repo_name ,
106
107
require_git_lfs ,
107
108
rmtree_with_retry ,
@@ -1003,7 +1004,7 @@ def test_commit_copy_file(self, repo_url: RepoUrl) -> None:
1003
1004
self .assertIn ("lfs Copy (1).bin" , repo_files )
1004
1005
1005
1006
# Check same LFS file
1006
- repo_file1 , repo_file2 = self ._api .list_files_info (repo_id = repo_id , paths = ["lfs.bin" , "lfs Copy.bin" ])
1007
+ repo_file1 , repo_file2 = self ._api .get_paths_info (repo_id = repo_id , paths = ["lfs.bin" , "lfs Copy.bin" ])
1007
1008
self .assertEqual (repo_file1 .lfs ["sha256" ], repo_file2 .lfs ["sha256" ])
1008
1009
1009
1010
@use_tmp_repo ()
@@ -1161,6 +1162,7 @@ def setUpClass(cls):
1161
1162
def tearDownClass (cls ):
1162
1163
cls ._api .delete_repo (repo_id = cls .repo_id )
1163
1164
1165
+ @expect_deprecation ("list_files_info" )
1164
1166
def test_get_regular_file_info (self ):
1165
1167
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = "file.md" ))
1166
1168
self .assertEqual (len (files ), 1 )
@@ -1171,6 +1173,7 @@ def test_get_regular_file_info(self):
1171
1173
self .assertEqual (file .size , 4 )
1172
1174
self .assertEqual (file .blob_id , "6320cd248dd8aeaab759d5871f8781b5c0505172" )
1173
1175
1176
+ @expect_deprecation ("list_files_info" )
1174
1177
def test_get_lfs_file_info (self ):
1175
1178
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = "lfs.bin" ))
1176
1179
self .assertEqual (len (files ), 1 )
@@ -1188,34 +1191,41 @@ def test_get_lfs_file_info(self):
1188
1191
self .assertEqual (file .size , 4 )
1189
1192
self .assertEqual (file .blob_id , "0a828055346279420bd02a4221c177bbcdc045d8" )
1190
1193
1194
+ @expect_deprecation ("list_files_info" )
1191
1195
def test_list_files (self ):
1192
1196
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = ["file.md" , "lfs.bin" , "2/file_2.md" ]))
1193
1197
self .assertEqual (len (files ), 3 )
1194
1198
self .assertEqual ({f .path for f in files }, {"file.md" , "lfs.bin" , "2/file_2.md" })
1195
1199
1200
+ @expect_deprecation ("list_files_info" )
1196
1201
def test_list_files_and_folder (self ):
1197
1202
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = ["file.md" , "lfs.bin" , "2" ]))
1198
1203
self .assertEqual (len (files ), 3 )
1199
1204
self .assertEqual ({f .path for f in files }, {"file.md" , "lfs.bin" , "2/file_2.md" })
1200
1205
1206
+ @expect_deprecation ("list_files_info" )
1201
1207
def test_list_unknown_path_among_other (self ):
1202
1208
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = ["file.md" , "unknown" ]))
1203
1209
self .assertEqual (len (files ), 1 )
1204
1210
1211
+ @expect_deprecation ("list_files_info" )
1205
1212
def test_list_unknown_path_alone (self ):
1206
1213
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = "unknown" ))
1207
1214
self .assertEqual (len (files ), 0 )
1208
1215
1216
+ @expect_deprecation ("list_files_info" )
1209
1217
def test_list_folder_flat (self ):
1210
1218
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = ["2" ]))
1211
1219
self .assertEqual (len (files ), 1 )
1212
1220
self .assertEqual (files [0 ].path , "2/file_2.md" )
1213
1221
1222
+ @expect_deprecation ("list_files_info" )
1214
1223
def test_list_folder_recursively (self ):
1215
1224
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = ["1" ]))
1216
1225
self .assertEqual (len (files ), 2 )
1217
1226
self .assertEqual ({f .path for f in files }, {"1/2/file_1_2.md" , "1/file_1.md" })
1218
1227
1228
+ @expect_deprecation ("list_files_info" )
1219
1229
def test_list_repo_files_manually (self ):
1220
1230
files = list (self ._api .list_files_info (repo_id = self .repo_id ))
1221
1231
self .assertEqual (len (files ), 7 )
@@ -1224,22 +1234,26 @@ def test_list_repo_files_manually(self):
1224
1234
{".gitattributes" , "1/2/file_1_2.md" , "1/file_1.md" , "2/file_2.md" , "3/file_3.md" , "file.md" , "lfs.bin" },
1225
1235
)
1226
1236
1237
+ @expect_deprecation ("list_files_info" )
1227
1238
def test_list_repo_files_alias (self ):
1228
1239
self .assertEqual (
1229
- set (self ._api .list_repo_files (repo_id = self .repo_id )),
1240
+ set (f . path for f in self ._api .list_files_info (repo_id = self .repo_id )),
1230
1241
{".gitattributes" , "1/2/file_1_2.md" , "1/file_1.md" , "2/file_2.md" , "3/file_3.md" , "file.md" , "lfs.bin" },
1231
1242
)
1232
1243
1244
+ @expect_deprecation ("list_files_info" )
1233
1245
def test_list_with_root_path_is_ignored (self ):
1234
1246
# must use `paths=None`
1235
1247
files = list (self ._api .list_files_info (repo_id = self .repo_id , paths = "/" ))
1236
1248
self .assertEqual (len (files ), 0 )
1237
1249
1250
+ @expect_deprecation ("list_files_info" )
1238
1251
def test_list_with_empty_path_is_invalid (self ):
1239
1252
# must use `paths=None`
1240
1253
with self .assertRaises (BadRequestError ):
1241
1254
list (self ._api .list_files_info (repo_id = self .repo_id , paths = "" ))
1242
1255
1256
+ @expect_deprecation ("list_files_info" )
1243
1257
@with_production_testing
1244
1258
def test_list_files_with_expand (self ):
1245
1259
files = list (
@@ -1259,6 +1273,7 @@ def test_list_files_with_expand(self):
1259
1273
self .assertTrue (vae_model .security ["safe" ])
1260
1274
self .assertTrue (isinstance (vae_model .security ["av_scan" ], dict )) # all details in here
1261
1275
1276
+ @expect_deprecation ("list_files_info" )
1262
1277
@with_production_testing
1263
1278
def test_list_files_without_expand (self ):
1264
1279
files = list (
0 commit comments