File tree 4 files changed +5
-13
lines changed
4 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -770,7 +770,7 @@ def _handle_no_cache_dir(
770
770
dest = "parallel_downloads" ,
771
771
type = "int" ,
772
772
metavar = "n" ,
773
- default = None ,
773
+ default = 1 ,
774
774
help = (
775
775
"Use upto <n> threads to download packages in parallel."
776
776
"<n> must be greater than 0"
Original file line number Diff line number Diff line change @@ -118,18 +118,14 @@ def _build_session(
118
118
ssl_context = None
119
119
else :
120
120
ssl_context = None
121
- if "parallel_downloads" in options .__dict__ :
122
- parallel_downloads = options .parallel_downloads
123
- else :
124
- parallel_downloads = None
125
121
126
122
session = PipSession (
127
123
cache = os .path .join (cache_dir , "http-v2" ) if cache_dir else None ,
128
124
retries = retries if retries is not None else options .retries ,
129
125
trusted_hosts = options .trusted_hosts ,
130
126
index_urls = self ._get_index_urls (options ),
131
127
ssl_context = ssl_context ,
132
- parallel_downloads = parallel_downloads ,
128
+ parallel_downloads = options . parallel_downloads ,
133
129
)
134
130
135
131
# Handle custom ca-bundles from the user
Original file line number Diff line number Diff line change @@ -78,9 +78,7 @@ def add_options(self) -> None:
78
78
79
79
@with_cleanup
80
80
def run (self , options : Values , args : List [str ]) -> int :
81
- if (options .parallel_downloads is not None ) and (
82
- options .parallel_downloads < 1
83
- ):
81
+ if options .parallel_downloads < 1 :
84
82
raise CommandError ("Value of '--parallel-downloads' must be greater than 0" )
85
83
86
84
options .ignore_installed = True
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ def __init__(
326
326
trusted_hosts : Sequence [str ] = (),
327
327
index_urls : Optional [List [str ]] = None ,
328
328
ssl_context : Optional ["SSLContext" ] = None ,
329
- parallel_downloads : Optional [ int ] = None ,
329
+ parallel_downloads : int = 1 ,
330
330
** kwargs : Any ,
331
331
) -> None :
332
332
"""
@@ -367,9 +367,7 @@ def __init__(
367
367
# pip._internal.network.BatchDownloader and to set pool_connection in
368
368
# the HTTPAdapter to prevent connection pool from hitting the default(10)
369
369
# limit and throwing 'Connection pool is full' warnings
370
- self .parallel_downloads = (
371
- parallel_downloads if (parallel_downloads is not None ) else 1
372
- )
370
+ self .parallel_downloads = parallel_downloads
373
371
pool_maxsize = max (self .parallel_downloads , 10 )
374
372
# Our Insecure HTTPAdapter disables HTTPS validation. It does not
375
373
# support caching so we'll use it for all http:// URLs.
You can’t perform that action at this time.
0 commit comments