@@ -107,26 +107,13 @@ impl<'a> FlatIndexClient<'a> {
107
107
}
108
108
109
109
/// Read the directories and flat remote indexes from `--find-links`.
110
- #[ allow( clippy:: result_large_err) ]
111
- pub async fn fetch (
110
+ pub async fn fetch_all (
112
111
& self ,
113
112
indexes : impl Iterator < Item = & IndexUrl > ,
114
113
) -> Result < FlatIndexEntries , FlatIndexError > {
115
114
let mut fetches = futures:: stream:: iter ( indexes)
116
115
. map ( |index| async move {
117
- let entries = match index {
118
- IndexUrl :: Path ( url) => {
119
- let path = url
120
- . to_file_path ( )
121
- . map_err ( |( ) | FlatIndexError :: NonFileUrl ( url. to_url ( ) ) ) ?;
122
- Self :: read_from_directory ( & path, index)
123
- . map_err ( |err| FlatIndexError :: FindLinksDirectory ( path. clone ( ) , err) ) ?
124
- }
125
- IndexUrl :: Pypi ( url) | IndexUrl :: Url ( url) => self
126
- . read_from_url ( url, index)
127
- . await
128
- . map_err ( |err| FlatIndexError :: FindLinksUrl ( url. to_url ( ) , err) ) ?,
129
- } ;
116
+ let entries = self . fetch_index ( index) . await ?;
130
117
if entries. is_empty ( ) {
131
118
warn ! ( "No packages found in `--find-links` entry: {}" , index) ;
132
119
} else {
@@ -151,6 +138,23 @@ impl<'a> FlatIndexClient<'a> {
151
138
Ok ( results)
152
139
}
153
140
141
+ /// Fetch a flat remote index from a `--find-links` URL.
142
+ pub async fn fetch_index ( & self , index : & IndexUrl ) -> Result < FlatIndexEntries , FlatIndexError > {
143
+ match index {
144
+ IndexUrl :: Path ( url) => {
145
+ let path = url
146
+ . to_file_path ( )
147
+ . map_err ( |( ) | FlatIndexError :: NonFileUrl ( url. to_url ( ) ) ) ?;
148
+ Self :: read_from_directory ( & path, index)
149
+ . map_err ( |err| FlatIndexError :: FindLinksDirectory ( path. clone ( ) , err) )
150
+ }
151
+ IndexUrl :: Pypi ( url) | IndexUrl :: Url ( url) => self
152
+ . read_from_url ( url, index)
153
+ . await
154
+ . map_err ( |err| FlatIndexError :: FindLinksUrl ( url. to_url ( ) , err) ) ,
155
+ }
156
+ }
157
+
154
158
/// Read a flat remote index from a `--find-links` URL.
155
159
async fn read_from_url (
156
160
& self ,
0 commit comments