MCPcopy
hub / github.com/pex-tool/pex / _resolve_lock

Method _resolve_lock

pex/cli/commands/run.py:365–386  ·  view source on GitHub ↗
(
        self,
        fetcher,  # type: URLFetcher
        download_dir,  # type: str
        lock_name,  # type: str
    )

Source from the content-addressed store, hash-verified

363 url = attr.ib() # type: ArtifactURL
364
365 def _resolve_lock(
366 self,
367 fetcher, # type: URLFetcher
368 download_dir, # type: str
369 lock_name, # type: str
370 ):
371 # type: (...) -> bool
372
373 lock_url = ArtifactURL.from_url_info(
374 self.url.url_info._replace(
375 path=posixpath.join(posixpath.dirname(self.url.path), lock_name)
376 )
377 )
378 try:
379 with fetcher.get_body_stream(lock_url.download_url) as src_fp, open(
380 os.path.join(download_dir, lock_name), "wb"
381 ) as dst_fp:
382 shutil.copyfileobj(src_fp, dst_fp)
383 except (IOError, OSError):
384 return False
385 else:
386 return True
387
388 def _resolve_script(
389 self,

Callers 1

_resolve_scriptMethod · 0.95

Calls 3

get_body_streamMethod · 0.80
from_url_infoMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected