@@ -38,26 +38,19 @@ pub enum HfReader {
3838impl HfReader {
3939 /// Create a reader, automatically choosing between XET and HTTP.
4040 ///
41- /// Buckets always use XET. For other repo types, when XET is enabled
42- /// a HEAD request probes for the `X-Xet-Hash` header. Files stored on
43- /// XET are downloaded via the CAS protocol; all others fall back to HTTP GET.
41+ /// Buckets always use XET. For other repo types, a HEAD request
42+ /// probes for the `X-Xet-Hash` header. Files stored on XET are
43+ /// downloaded via the CAS protocol; all others fall back to HTTP GET.
4444 pub async fn try_new ( core : & HfCore , path : & str , range : BytesRange ) -> Result < Self > {
45- if core. xet_enabled {
46- // Buckets always use XET
47- if core. repo . repo_type == RepoType :: Bucket {
48- if let Some ( xet_file) = core. maybe_xet_file ( path) . await ? {
49- return Self :: try_new_xet ( core, & xet_file, range) . await ;
50- }
51- return Err ( Error :: new (
52- ErrorKind :: Unexpected ,
53- "bucket file is missing XET metadata" ,
54- ) ) ;
55- }
45+ if let Some ( xet_file) = core. maybe_xet_file ( path) . await ? {
46+ return Self :: try_new_xet ( core, & xet_file, range) . await ;
47+ }
5648
57- // For other repos, probe for XET
58- if let Some ( xet_file) = core. maybe_xet_file ( path) . await ? {
59- return Self :: try_new_xet ( core, & xet_file, range) . await ;
60- }
49+ if core. repo . repo_type == RepoType :: Bucket {
50+ return Err ( Error :: new (
51+ ErrorKind :: Unexpected ,
52+ "bucket file is missing XET metadata" ,
53+ ) ) ;
6154 }
6255
6356 Self :: try_new_http ( core, path, range) . await
@@ -126,7 +119,6 @@ impl oio::Read for HfReader {
126119
127120#[ cfg( test) ]
128121mod tests {
129- use super :: super :: backend:: test_utils:: mbpp_xet_operator;
130122 use super :: super :: backend:: test_utils:: { gpt2_operator, mbpp_operator} ;
131123
132124 /// Parquet magic bytes: "PAR1"
@@ -155,7 +147,7 @@ mod tests {
155147 #[ tokio:: test]
156148 #[ ignore = "requires network access" ]
157149 async fn test_read_xet_parquet ( ) {
158- let op = mbpp_xet_operator ( ) ;
150+ let op = mbpp_operator ( ) ;
159151 let data = op
160152 . read ( "full/train-00000-of-00001.parquet" )
161153 . await
@@ -169,7 +161,7 @@ mod tests {
169161 #[ tokio:: test]
170162 #[ ignore = "requires network access" ]
171163 async fn test_read_xet_range ( ) {
172- let op = mbpp_xet_operator ( ) ;
164+ let op = mbpp_operator ( ) ;
173165 let data = op
174166 . read_with ( "full/train-00000-of-00001.parquet" )
175167 . range ( 0 ..4 )
0 commit comments