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

Method write

pex/common.py:792–812  ·  view source on GitHub ↗

Write data to ``chroot/dst`` with optional label. Has similar exceptional cases as ``Chroot.copy``

(
        self,
        data,  # type: Union[str, bytes]
        dst,  # type: str
        label=None,  # type: Optional[str]
        mode="wb",  # type: str
        executable=False,  # type: bool
        compress=True,  # type: bool
    )

Source from the content-addressed store, hash-verified

790 safe_relative_symlink(abs_src, abs_dst)
791
792 def write(
793 self,
794 data, # type: Union[str, bytes]
795 dst, # type: str
796 label=None, # type: Optional[str]
797 mode="wb", # type: str
798 executable=False, # type: bool
799 compress=True, # type: bool
800 ):
801 # type: (...) -> None
802 """Write data to ``chroot/dst`` with optional label.
803
804 Has similar exceptional cases as ``Chroot.copy``
805 """
806 dst = self._normalize(dst)
807 self._tag(dst, label, compress)
808 self._ensure_parent(dst)
809 with open(os.path.join(self.chroot, dst), mode) as wp:
810 wp.write(data)
811 if executable:
812 chmod_plus_x(wp.name)
813
814 def touch(
815 self,

Callers 15

test_chroot_zipFunction · 0.95
test_chroot_zip_symlinkFunction · 0.95
_maybe_rewrite_metadataFunction · 0.45
ensure_pagefindFunction · 0.45
filter_streamFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
validate_entry_pointFunction · 0.45
install_scriptsFunction · 0.45
recordMethod · 0.45

Calls 5

_normalizeMethod · 0.95
_tagMethod · 0.95
_ensure_parentMethod · 0.95
chmod_plus_xFunction · 0.90
joinMethod · 0.45

Tested by 15

test_chroot_zipFunction · 0.76
test_chroot_zip_symlinkFunction · 0.76
test_hashFunction · 0.36
test_directory_hasherFunction · 0.36
zip_fixtureFunction · 0.36
test_safe_open_absFunction · 0.36
test_safe_open_relativeFunction · 0.36
test_pex_from_rcFunction · 0.36
test_pexrc_precedenceFunction · 0.36