当前位置: 首页>>代码示例>>Python>>正文


Python typing.AbstractSet方法代码示例

本文整理汇总了Python中typing.AbstractSet方法的典型用法代码示例。如果您正苦于以下问题:Python typing.AbstractSet方法的具体用法?Python typing.AbstractSet怎么用?Python typing.AbstractSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在typing的用法示例。


在下文中一共展示了typing.AbstractSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def __init__(self,
                 servers: AbstractSet[Remote],
                 key_store: MasterKeyStore,
                 interval: datetime.timedelta,
                 key_type: Type[PKey]=RSAKey,
                 bits: Optional[int]=None,
                 start: bool=True) -> None:
        super().__init__()
        self.servers = servers
        self.key_store = key_store
        self.interval = interval
        self.key_type = key_type
        self.bits = bits
        self.terminated = threading.Event()
        if self.start:
            self.start() 
开发者ID:spoqa,项目名称:geofront,代码行数:18,代码来源:masterkey.py

示例2: skip_for_variants

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def skip_for_variants(meta: MetaData, variant_keys: AbstractSet[str]) -> bool:
    """Check if the recipe uses any given variant keys

    Args:
      meta: Variant MetaData object

    Returns:
      True if any variant key from variant_keys is used
    """
    # This is the same behavior as in
    # conda_build.metadata.Metadata.get_hash_contents but without leaving out
    # "build_string_excludes" (python, r_base, etc.).
    dependencies = set(meta.get_used_vars())
    trim_build_only_deps(meta, dependencies)

    return not dependencies.isdisjoint(variant_keys) 
开发者ID:bioconda,项目名称:bioconda-utils,代码行数:18,代码来源:update_pinnings.py

示例3: comment

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def comment(self, problems: Mapping[ni_abc.Status, AbstractSet[str]]) -> Optional[str]:
        """Add an appropriate comment relating to the CLA status."""
        if not problems:
            return None

        comments_url = self.request['pull_request']['comments_url']
        problem_messages: Dict[str, str] = defaultdict(str)
        for status, usernames in problems.items():
            problem_messages[status.name] = self._problem_message_template(
                status
            ).format(
                ', '.join(f"@{username}" for username in usernames)
            )

        message = NO_CLA_TEMPLATE.format_map(problem_messages)

        await self._gh.post(comments_url, data={'body': message})
        return message 
开发者ID:python,项目名称:the-knights-who-say-ni,代码行数:20,代码来源:github.py

示例4: update

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def update(self, problems: Mapping[ni_abc.Status, AbstractSet[str]]) -> None:
        if self.event == PullRequestEvent.opened:
            await self.set_label(problems)
            await self.comment(problems)
        elif self.event == PullRequestEvent.unlabeled:
            # The assumption is that a PR will almost always go from no CLA to
            # being cleared, so don't bug the user with what will probably
            # amount to a repeated message about lacking a CLA.
            await self.set_label(problems)
        elif self.event == PullRequestEvent.synchronize:
            current_label = await self.current_label()
            if not problems:
                if current_label != CLA_OK:
                    await self.remove_label()
            elif current_label != NO_CLA:
                    await self.remove_label()
                    # Since there is a chance a new person was added to a PR
                    # which caused the change in status, a comment on how to
                    # resolve the CLA issue is probably called for.
                    await self.comment(problems)
        else:  # pragma: no cover
            # Should never be reached.
            msg = 'do not know how to update a PR for {}'.format(self.event)
            raise RuntimeError(msg) 
开发者ID:python,项目名称:the-knights-who-say-ni,代码行数:26,代码来源:github.py

示例5: qubit_set

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def qubit_set(self) -> Optional[AbstractSet['cirq.Qid']]:
        """Returns a set or frozenset of qubits on the device, if possible.

        Returns:
            If the device has a finite set of qubits, then a set or frozen set
            of all qubits on the device is returned.

            If the device has no well defined finite set of qubits (e.g.
            `cirq.UnconstrainedDevice` has this property), then `None` is
            returned.
        """

        # Compatibility hack to work with devices that were written before this
        # method was defined.
        for name in ['qubits', '_qubits']:
            if hasattr(self, name):
                val = getattr(self, name)
                if callable(val):
                    val = val()
                return frozenset(val)

        # Default to the qubits being unknown.
        return None 
开发者ID:quantumlib,项目名称:Cirq,代码行数:25,代码来源:device.py

示例6: create_elevator_database

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def create_elevator_database(world_list: WorldList,
                             areas_to_not_change: AbstractSet[int],
                             ) -> Tuple[Elevator, ...]:
    """
    Creates a tuple of Elevator objects, exclude those that belongs to one of the areas provided.
    :param world_list:
    :param areas_to_not_change: Set of asset_id of Areas whose teleporters are to be ignored
    :return:
    """
    return tuple(
        Elevator(node.teleporter_instance_id,
                 world.world_asset_id,
                 area.area_asset_id,
                 node.default_connection.world_asset_id,
                 node.default_connection.area_asset_id)

        for world, area, node in world_list.all_worlds_areas_nodes
        if isinstance(node, TeleporterNode) and node.editable and area.area_asset_id not in areas_to_not_change
    ) 
开发者ID:randovania,项目名称:randovania,代码行数:21,代码来源:elevator_distributor.py

示例7: test_all

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def test_all(self):
        from typing import __all__ as a
        # Just spot-check the first and last of every category.
        self.assertIn('AbstractSet', a)
        self.assertIn('ValuesView', a)
        self.assertIn('cast', a)
        self.assertIn('overload', a)
        if hasattr(contextlib, 'AbstractContextManager'):
            self.assertIn('ContextManager', a)
        # Check that io and re are not exported.
        self.assertNotIn('io', a)
        self.assertNotIn('re', a)
        # Spot-check that stdlib modules aren't exported.
        self.assertNotIn('os', a)
        self.assertNotIn('sys', a)
        # Check that Text is defined.
        self.assertIn('Text', a)
        # Check previously missing classes.
        self.assertIn('SupportsBytes', a)
        self.assertIn('SupportsComplex', a) 
开发者ID:ShikyoKira,项目名称:Project-New-Reign---Nemesis-Main,代码行数:22,代码来源:test_typing.py

示例8: get_subset_for_channels

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def get_subset_for_channels(self, channels: AbstractSet[ChannelID]) -> 'Waveform':
        """Get a waveform that only describes the channels contained in `channels`.

        Args:
            channels: A channel set the return value should confine to.

        Raises:
            KeyError: If `channels` is not a subset of the waveform's defined channels.

        Returns:
            A waveform with waveform.defined_channels == `channels`
        """
        if not channels <= self.defined_channels:
            raise KeyError('Channels not defined on waveform: {}'.format(channels))
        if channels == self.defined_channels:
            return self
        return self.unsafe_get_subset_for_channels(channels=channels) 
开发者ID:qutech,项目名称:qupulse,代码行数:19,代码来源:waveforms.py

示例9: is_fulfilled

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def is_fulfilled(self, parameters: Mapping[str, Any], volatile: AbstractSet[str] = frozenset()) -> bool:
        """
        Args:
            parameters: These parameters are checked.
            volatile: For each of these parameters a warning is raised if they appear in a constraint

        Raises:
            :class:`qupulse.parameter_scope.ParameterNotProvidedException`: if a parameter is missing

        Warnings:
            ConstrainedParameterIsVolatileWarning: if a constrained parameter is volatile
        """
        affected_parameters = self.affected_parameters
        if not affected_parameters.issubset(parameters.keys()):
            raise ParameterNotProvidedException((affected_parameters-parameters.keys()).pop())

        for parameter in volatile & affected_parameters:
            warnings.warn(ConstrainedParameterIsVolatileWarning(parameter_name=parameter, constraint=self))

        return numpy.all(self._expression.evaluate_in_scope(parameters)) 
开发者ID:qutech,项目名称:qupulse,代码行数:22,代码来源:parameters.py

示例10: prepare_field

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def prepare_field(cls, field: ModelField) -> None:
            env_names: Union[List[str], AbstractSet[str]]
            env = field.field_info.extra.get('env')
            if env is None:
                if field.has_alias:
                    warnings.warn(
                        'aliases are no longer used by BaseSettings to define which environment variables to read. '
                        'Instead use the "env" field setting. '
                        'See https://pydantic-docs.helpmanual.io/usage/settings/#environment-variable-names',
                        FutureWarning,
                    )
                env_names = {cls.env_prefix + field.name}
            elif isinstance(env, str):
                env_names = {env}
            elif isinstance(env, (set, frozenset)):
                env_names = env
            elif sequence_like(env):
                env_names = list(env)
            else:
                raise TypeError(f'invalid field env: {env!r} ({display_as_type(env)}); should be string, list or set')

            if not cls.case_sensitive:
                env_names = env_names.__class__(n.lower() for n in env_names)
            field.field_info.extra['env_names'] = env_names 
开发者ID:samuelcolvin,项目名称:pydantic,代码行数:26,代码来源:env_settings.py

示例11: fx_bitbucket_group_slugs

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def fx_bitbucket_group_slugs(request) -> typing.AbstractSet[str]:
    try:
        slugs = request.config.getoption('--bitbucket-group-slugs')
    except ValueError:
        slugs = None
    if not slugs:
        skip('--bitbucket-group-slugs is not provided; skipped')
    return {slug.strip() for slug in slugs.split()} 
开发者ID:spoqa,项目名称:geofront,代码行数:10,代码来源:bitbucket_test.py

示例12: test_list_groups

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def test_list_groups(fx_bitbucket_identity: Identity,
                     fx_bitbucket_team_username: str,
                     fx_bitbucket_group_slugs: typing.AbstractSet[str]):
    org = BitbucketTeam('', '', fx_bitbucket_team_username)
    groups = org.list_groups(fx_bitbucket_identity)
    assert groups == fx_bitbucket_group_slugs 
开发者ID:spoqa,项目名称:geofront,代码行数:8,代码来源:bitbucket_test.py

示例13: fx_github_team_slugs

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def fx_github_team_slugs(request) -> typing.AbstractSet[str]:
    try:
        slugs = request.config.getoption('--github-team-slugs')
    except ValueError:
        slugs = None
    if not slugs:
        skip('--github-team-slugs is not provided; skipped')
    return {slug.strip() for slug in slugs.split()} 
开发者ID:spoqa,项目名称:geofront,代码行数:10,代码来源:github_test.py

示例14: test_list_groups

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def test_list_groups(fx_github_identity: Identity, fx_github_org_login: str,
                     fx_github_team_slugs: typing.AbstractSet[str]):
    org = GitHubOrganization('', '', fx_github_org_login)
    groups = org.list_groups(fx_github_identity)
    assert groups == fx_github_team_slugs 
开发者ID:spoqa,项目名称:geofront,代码行数:7,代码来源:github_test.py

示例15: list_keys

# 需要导入模块: import typing [as 别名]
# 或者: from typing import AbstractSet [as 别名]
def list_keys(self, identity: Identity) -> AbstractSet[PKey]:
        try:
            keys = self.identities[identity]
        except KeyError:
            return frozenset()
        return frozenset(keys) 
开发者ID:spoqa,项目名称:geofront,代码行数:8,代码来源:server_test.py


注:本文中的typing.AbstractSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。