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


Python util.is_iterable_typed函数代码示例

本文整理汇总了Python中b2.util.is_iterable_typed函数的典型用法代码示例。如果您正苦于以下问题:Python is_iterable_typed函数的具体用法?Python is_iterable_typed怎么用?Python is_iterable_typed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: convert_multiple_sources_to_consumable_types

    def convert_multiple_sources_to_consumable_types (self, project, prop_set, sources):
        """ Converts several files to consumable types.
        """
        consumed = []
        bypassed = []
        if __debug__:
            from .targets import ProjectTarget

            assert isinstance(project, ProjectTarget)
            assert isinstance(prop_set, property_set.PropertySet)
            assert is_iterable_typed(sources, virtual_target.VirtualTarget)

        assert isinstance(project, ProjectTarget)
        assert isinstance(prop_set, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)
        # We process each source one-by-one, trying to convert it to
        # a usable type.
        for s in sources:
            # TODO: need to check for failure on each source.
            (c, b) = self.convert_to_consumable_types (project, None, prop_set, [s], True)
            if not c:
                project.manager ().logger ().log (__name__, " failed to convert ", s)

            consumed.extend (c)
            bypassed.extend (b)

        return (consumed, bypassed)
开发者ID:zjutjsj1004,项目名称:third,代码行数:27,代码来源:generators.py

示例2: create

def create (raw_properties = []):
    """ Creates a new 'PropertySet' instance for the given raw properties,
        or returns an already existing one.
    """
    assert (is_iterable_typed(raw_properties, property.Property)
            or is_iterable_typed(raw_properties, basestring))
    # FIXME: propagate to callers.
    if len(raw_properties) > 0 and isinstance(raw_properties[0], property.Property):
        x = raw_properties
    else:
        x = [property.create_from_string(ps) for ps in raw_properties]

    # These two lines of code are optimized to the current state
    # of the Property class. Since this function acts as the caching
    # frontend to the PropertySet class modifying these two lines
    # could have a severe performance penalty. Be careful.
    # It would be faster to sort by p.id, but some projects may rely
    # on the fact that the properties are ordered alphabetically. So,
    # we maintain alphabetical sorting so as to maintain backward compatibility.
    x = sorted(set(x), key=lambda p: (p.feature.name, p.value, p.condition))
    key = tuple(p.id for p in x)

    if key not in __cache:
        __cache [key] = PropertySet(x)

    return __cache [key]
开发者ID:DanielaE,项目名称:boost.build,代码行数:26,代码来源:property_set.py

示例3: construct_types

def construct_types (project, name, target_types, prop_set, sources):

    if __debug__:
        from .targets import ProjectTarget
        assert isinstance(project, ProjectTarget)
        assert isinstance(name, basestring) or name is None
        assert is_iterable_typed(target_types, basestring)
        assert isinstance(prop_set, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)

    result = []
    usage_requirements = property_set.empty()

    for t in target_types:
        r = construct (project, name, t, prop_set, sources)

        if r:
            (ur, targets) = r
            usage_requirements = usage_requirements.add(ur)
            result.extend(targets)

    # TODO: have to introduce parameter controlling if
    # several types can be matched and add appropriate
    # checks

    # TODO: need to review the documentation for
    # 'construct' to see if it should return $(source) even
    # if nothing can be done with it. Currents docs seem to
    # imply that, contrary to the behaviour.
    if result:
        return (usage_requirements, result)

    else:
        return (usage_requirements, sources)
开发者ID:zjutjsj1004,项目名称:third,代码行数:34,代码来源:generators.py

示例4: refine

def refine (properties, requirements):
    """ Refines 'properties' by overriding any non-free properties
        for which a different value is specified in 'requirements'.
        Conditional requirements are just added without modification.
        Returns the resulting list of properties.
    """
    assert is_iterable_typed(properties, Property)
    assert is_iterable_typed(requirements, Property)
    # The result has no duplicates, so we store it in a set
    result = set()

    # Records all requirements.
    required = {}

    # All the elements of requirements should be present in the result
    # Record them so that we can handle 'properties'.
    for r in requirements:
        # Don't consider conditional requirements.
        if not r.condition:
            required[r.feature] = r

    for p in properties:
        # Skip conditional properties
        if p.condition:
            result.add(p)
        # No processing for free properties
        elif p.feature.free:
            result.add(p)
        else:
            if p.feature in required:
                result.add(required[p.feature])
            else:
                result.add(p)

    return sequence.unique(list(result) + requirements)
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:35,代码来源:property.py

示例5: lib

def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]):
    """The implementation of the 'lib' rule. Beyond standard syntax that rule allows
    simplified: 'lib a b c ;'."""
    assert is_iterable_typed(names, basestring)
    assert is_iterable_typed(sources, basestring)
    assert is_iterable_typed(requirements, basestring)
    assert is_iterable_typed(default_build, basestring)
    assert is_iterable_typed(usage_requirements, basestring)
    if len(names) > 1:
        if any(r.startswith("<name>") for r in requirements):
            get_manager().errors()(
                "When several names are given to the 'lib' rule\n" + "it is not allowed to specify the <name> feature."
            )

        if sources:
            get_manager().errors()(
                "When several names are given to the 'lib' rule\n" + "it is not allowed to specify sources."
            )

    project = get_manager().projects().current()
    result = []

    for name in names:
        r = requirements[:]

        # Support " lib a ; " and " lib a b c ; " syntax.
        if (
            not sources
            and not any(r.startswith("<name>") for r in requirements)
            and not any(r.startswith("<file") for r in requirements)
        ):
            r.append("<name>" + name)

        result.append(targets.create_typed_metatarget(name, "LIB", sources, r, default_build, usage_requirements))
    return result
开发者ID:boostorg,项目名称:build,代码行数:35,代码来源:builtin.py

示例6: use_project

 def use_project(self, id, where):
     # See comment in 'load' for explanation why we record the
     # parameters as opposed to loading the project now.
     assert is_iterable_typed(id, basestring)
     assert is_iterable_typed(where, basestring)
     m = self.registry.current().project_module()
     self.registry.used_projects[m].append((id[0], where[0]))
开发者ID:Cabriter,项目名称:abelkhan,代码行数:7,代码来源:project.py

示例7: inherit_generators

def inherit_generators (toolset, properties, base, generators_to_ignore = []):
    assert isinstance(toolset, basestring)
    assert is_iterable_typed(properties, basestring)
    assert isinstance(base, basestring)
    assert is_iterable_typed(generators_to_ignore, basestring)
    if not properties:
        properties = [replace_grist (toolset, '<toolset>')]

    base_generators = generators.generators_for_toolset(base)

    for g in base_generators:
        id = g.id()

        if not id in generators_to_ignore:
            # Some generator names have multiple periods in their name, so
            # $(id:B=$(toolset)) doesn't generate the right new_id name.
            # e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
            # which is not what we want. Manually parse the base and suffix
            # (if there's a better way to do this, I'd love to see it.)
            # See also register in module generators.
            (base, suffix) = split_action_id(id)

            new_id = toolset + '.' + suffix

            generators.register(g.clone(new_id, properties))
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:25,代码来源:toolset.py

示例8: constant

 def constant(self, name, value):
     """Declare and set a project global constant.
     Project global constants are normal variables but should
     not be changed. They are applied to every child Jamfile."""
     assert is_iterable_typed(name, basestring)
     assert is_iterable_typed(value, basestring)
     self.registry.current().add_constant(name[0], value)
开发者ID:Cabriter,项目名称:abelkhan,代码行数:7,代码来源:project.py

示例9: get_invocation_command

def get_invocation_command(toolset, tool, user_provided_command = [],
                           additional_paths = [], path_last = False):
    """ Same as get_invocation_command_nodefault, except that if no tool is found,
        returns either the user-provided-command, if present, or the 'tool' parameter.
    """
    assert isinstance(toolset, basestring)
    assert isinstance(tool, basestring)
    assert is_iterable_typed(user_provided_command, basestring)
    assert is_iterable_typed(additional_paths, basestring) or additional_paths is None
    assert isinstance(path_last, (int, bool))

    result = get_invocation_command_nodefault(toolset, tool,
                                              user_provided_command,
                                              additional_paths,
                                              path_last)

    if not result:
        if user_provided_command:
            result = user_provided_command[0]
        else:
            result = tool

    assert(isinstance(result, str))

    return result
开发者ID:Cabriter,项目名称:abelkhan,代码行数:25,代码来源:common.py

示例10: make_test

def make_test(target_type, sources, requirements, target_name=None):
    assert isinstance(target_type, basestring)
    assert is_iterable_typed(sources, basestring)
    assert is_iterable_typed(requirements, basestring)
    assert isinstance(target_type, basestring) or target_type is None
    if not target_name:
        target_name = stem(os.path.basename(sources[0]))

    # Having periods (".") in the target name is problematic because the typed
    # generator will strip the suffix and use the bare name for the file
    # targets. Even though the location-prefix averts problems most times it
    # does not prevent ambiguity issues when referring to the test targets. For
    # example when using the XML log output. So we rename the target to remove
    # the periods, and provide an alias for users.
    real_name = target_name.replace(".", "~")

    project = get_manager().projects().current()
    # The <location-prefix> forces the build system for generate paths in the
    # form '$build_dir/array1.test/gcc/debug'. This is necessary to allow
    # post-processing tools to work.
    t = get_manager().targets().create_typed_target(
        type.type_from_rule_name(target_type), project, real_name, sources,
        requirements + ["<location-prefix>" + real_name + ".test"], [], [])

    # The alias to the real target, per period replacement above.
    if real_name != target_name:
        get_manager().projects().project_rules().all_names_["alias"](
            target_name, [t])

    # Remember the test (for --dump-tests). A good way would be to collect all
    # given a project. This has some technical problems: e.g. we can not call
    # this dump from a Jamfile since projects referred by 'build-project' are
    # not available until the whole Jamfile has been loaded.
    __all_tests.append(t)
    return t
开发者ID:zjutjsj1004,项目名称:third,代码行数:35,代码来源:testing.py

示例11: take

def take(attributes, properties):
    """Returns a property set which include all
    properties in 'properties' that have any of 'attributes'."""
    assert is_iterable_typed(attributes, basestring)
    assert is_iterable_typed(properties, basestring)
    result = []
    for e in properties:
        if b2.util.set.intersection(attributes, feature.attributes(get_grist(e))):
            result.append(e)
    return result
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:10,代码来源:property.py

示例12: path_constant

 def path_constant(self, name, value):
     """Declare and set a project global constant, whose value is a path. The
     path is adjusted to be relative to the invocation directory. The given
     value path is taken to be either absolute, or relative to this project
     root."""
     assert is_iterable_typed(name, basestring)
     assert is_iterable_typed(value, basestring)
     if len(value) > 1:
         self.registry.manager.error()("path constant should have one element")
     self.registry.current().add_constant(name[0], value[0], path=1)
开发者ID:Cabriter,项目名称:abelkhan,代码行数:10,代码来源:project.py

示例13: capture_output_setup

def capture_output_setup(target, sources, ps):
    if __debug__:
        from ..build.property_set import PropertySet
        assert is_iterable_typed(target, basestring)
        assert is_iterable_typed(sources, basestring)
        assert isinstance(ps, PropertySet)
    run_path_setup(target[0], sources, ps)

    if ps.get('preserve-test-targets') == ['off']:
        bjam.call("set-target-variable", target, "REMOVE_TEST_TARGETS", "1")
开发者ID:zjutjsj1004,项目名称:third,代码行数:10,代码来源:testing.py

示例14: __init__

 def __init__(self, name, values, attributes):
     assert isinstance(name, basestring)
     assert is_iterable_typed(values, basestring)
     assert is_iterable_typed(attributes, basestring)
     self._name = name
     self._values = values
     self._default = None
     self._attributes = 0
     for a in attributes:
         self._attributes = self._attributes | Feature._attribute_name_to_integer[a]
     self._attributes_string_list = attributes
     self._subfeatures = []
     self._parent = None
开发者ID:Cabriter,项目名称:abelkhan,代码行数:13,代码来源:feature.py

示例15: register_type

def register_type (type, suffixes, base_type = None, os = []):
    """ Register the given type on the specified OSes, or on remaining OSes
        if os is not specified.  This rule is injected into each of the type
        modules for the sake of convenience.
    """
    assert isinstance(type, basestring)
    assert is_iterable_typed(suffixes, basestring)
    assert isinstance(base_type, basestring) or base_type is None
    assert is_iterable_typed(os, basestring)
    if registered (type):
        return

    if not os or os_name () in os:
        register (type, suffixes, base_type)
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:14,代码来源:type.py


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