Python os.path 模块,setter() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用os.path.setter()

项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def path(self, val):
            from baiji.util.munging import _strip_initial_slashes
            self._path = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
            # For remote operations, we need a path without initial slashes
            self.remote_path = _strip_initial_slashes(self.path)
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def policy(self, val):
        if val and self.dst.is_file:
            raise ValueError("Policy only allowed when copying to s3")
        self._policy = val  # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def version_id(self, val):
        self._version_id = val  # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def preserve_acl(self, val):
        val = bool(val)
        if val and self.task != ('s3', 's3'):
            raise ValueError("Preserve ACL only allowed when copying from s3 to s3")
        self._preserve_acl = val  # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def progress(self, val):
        val = bool(val)
        self._progress = val  # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def skip(self, val):
        val = bool(val)
        self._skip_exist = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def encrypt(self, val):
        val = bool(val) and self.dst.is_s3
        self._encrypt = val  # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def validate(self, val):
        self._validate = bool(val) # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def encoding(self, val):
        if val is not None and self.dst.is_file:
            raise ValueError("Encoding can only be specified when copying to s3")
        if val is not None and self.gzip and val != 'gzip':
            raise ValueError("gzip overrides explicit encoding")
        self._encoding = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def gzip(self, val):
        val = bool(val)
        if val and self.task != ('file', 's3'):
            raise ValueError("gzip can only be specified when uploading to s3")
        if val and self.encoding is not None and self.encoding != 'gzip':
            raise ValueError("gzip overrides explicit encoding")
        self._gzip = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def content_type(self, val):
        if val is not None and self.dst.is_file:
            raise ValueError("Content Type can only be specified when copying to s3")
        self._content_type = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init
项目:baiji    作者:bodylabs    | 项目源码 | 文件源码
def metadata(self, val):
        if not (val is None or val == {}) and self.dst.is_file:
            raise ValueError("Metadata can only be specified when copying to s3")
        if val is None:
            val = {}
        self._metadata = val # we get initialized with a call to the setter in init pylint: disable=attribute-defined-outside-init