Python typing 模块,MutableSet() 实例源码

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

项目:py-aspio    作者:hexhex    | 项目源码 | 文件源码
def check_and_update_variable_bindings(self, bound_variables: MutableSet['Variable']) -> None:
        pass
项目:py-aspio    作者:hexhex    | 项目源码 | 文件源码
def check_and_update_variable_bindings(self, bound_variables: MutableSet['Variable']) -> None:
        pass
项目:py-aspio    作者:hexhex    | 项目源码 | 文件源码
def check_and_update_variable_bindings(self, bound_variables: MutableSet['Variable']) -> None:
        if self in bound_variables:
            raise RedefinedNameError('Variable {0!s} is defined twice'.format(self))
        bound_variables.add(self)
项目:py-aspio    作者:hexhex    | 项目源码 | 文件源码
def check_and_update_variable_bindings(self, bound_variables: MutableSet[Variable]) -> None:
        for t in self._targets:
            t.check_and_update_variable_bindings(bound_variables)
项目:py-aspio    作者:hexhex    | 项目源码 | 文件源码
def check_and_update_variable_bindings(self, bound_variables: MutableSet[Variable]) -> None:
        self._accessor.check_variable_bindings(bound_variables)
        self._target.check_and_update_variable_bindings(bound_variables)
项目:tsukkomi    作者:spoqa    | 项目源码 | 文件源码
def check_mutableset(a: typing.MutableSet[int]) -> typing.MutableSet[int]:
    return a
项目:wuye.vim    作者:zhaoyingnan911    | 项目源码 | 文件源码
def sets(p, q):
    """
    :type p: typing.AbstractSet[int]
    :type q: typing.MutableSet[float]
    """
    #? []
    p.a
    #? ["add"]
    q.a
项目:yangson    作者:CZ-NIC    | 项目源码 | 文件源码
def __init__(self):
        self.bases = set()  # type: MutableSet[QualName]
        self.derivs = set()  # type: MutableSet[QualName]
项目:yangson    作者:CZ-NIC    | 项目源码 | 文件源码
def __init__(self, main_module: YangIdentifier):
        """Initialize the class instance."""
        self.features = set()  # type: MutableSet[YangIdentifier]
        """Set of supported features."""
        self.main_module = main_module  # type: ModuleId
        """Main module of the receiver."""
        self.prefix_map = {}  # type: Dict[YangIdentifier, ModuleId]
        """Map of prefixes to module identifiers."""
        self.statement = None  # type: Statement
        """Corresponding (sub)module statements."""
        self.submodules = set()  # type: MutableSet[ModuleId]
        """Set of submodules."""
项目:yangson    作者:CZ-NIC    | 项目源码 | 文件源码
def derived_from(self, identity: QualName) -> MutableSet[QualName]:
        """Return list of identities transitively derived from `identity`."""
        try:
            res = self.identity_adjs[identity].derivs
        except KeyError:
            return set()
        for id in res.copy():
            res |= self.derived_from(id)
        return res
项目:yangson    作者:CZ-NIC    | 项目源码 | 文件源码
def derived_from_all(self, identities: List[QualName]) -> MutableSet[QualName]:
        """Return list of identities transitively derived from all `identity`."""
        if not identities:
            return set()
        res = self.derived_from(identities[0])
        for id in identities[1:]:
            res &= self.derived_from(id)
        return res
项目:data-store    作者:HumanCellAtlas    | 项目源码 | 文件源码
def get_shape_descriptor(self) -> typing.Optional[str]:
        """
        Return a string identifying the shape/structure/format of the data in this bundle
        document, so that it may be indexed appropriately.

        Currently, this returns a string identifying the metadata schema release major number.
        For example:

            v3 - Bundle contains metadata in the version 3 format
            v4 - Bundle contains metadata in the version 4 format
            ...

        This includes verification that schema major number is the same for all index metadata
        files in the bundle, consistent with the current HCA ingest service behavior. If no
        metadata version information is contained in the bundle, the empty string is returned.
        Currently this occurs in the case of the empty bundle used for deployment testing.

        If/when bundle schemas are available, this function should be updated to reflect the
        bundle schema type and major version number.

        Other projects (non-HCA) may manage their metadata schemas (if any) and schema versions.
        This should be an extension point that is customizable by other projects according to
        their metadata.
        """
        schema_version_map = defaultdict(set)  # type: typing.MutableMapping[str, typing.MutableSet[str]]
        for filename, file_content in self.files.items():
            core = file_content.get('core')
            if core is not None:
                schema_type = core['type']
                schema_version = core['schema_version']
                schema_version_major = schema_version.split(".")[0]
                schema_version_map[schema_version_major].add(schema_type)
            else:
                self.logger.info("%s", (f"File {filename} does not contain a 'core' section to identify "
                                        "the schema and schema version."))
        if schema_version_map:
            schema_versions = schema_version_map.keys()
            assert len(schema_versions) == 1, \
                "The bundle contains mixed schema major version numbers: {}".format(sorted(list(schema_versions)))
            return "v" + list(schema_versions)[0]
        else:
            return None  # No files with schema identifiers were found