Exemplo n.º 1
0
def copy(from_key, to_key, use_access="F"):
    """Copy one registry key to another, returning the target. If the
    target doesn't already exist it will be created.

    :param from_key: anything accepted by :func:`registry`
    :param to_key: anything accepted by :func:`registry`
    :returns: a :class:`Registry` object for `to_key`
    """
    source = registry(from_key, accept_value=False)
    target = registry(to_key, access=use_access, accept_value=False)
    if not target:
        target.create()

    for root, subkeys, subvalues in walk(source, _want_types=True):
        target_root = registry(
                target.moniker + utils.relative_to(root.moniker, source.moniker),
                access=use_access,
                accept_value=False
        )
        for k in subkeys:
            target_key = registry(
                target.moniker + utils.relative_to(k.moniker, source.moniker),
                accept_value=False,
                access=use_access
            )
            target_key.create()
        for name, value, type in subvalues:
            target_root.set_value(name, value, type)

    return target
Exemplo n.º 2
0
def copy(from_key, to_key, use_access="F"):
    """Copy one registry key to another, returning the target. If the
    target doesn't already exist it will be created.

    :param from_key: anything accepted by :func:`registry`
    :param to_key: anything accepted by :func:`registry`
    :returns: a :class:`Registry` object for `to_key`
    """
    source = registry(from_key, accept_value=False)
    target = registry(to_key, access=use_access, accept_value=False)
    if not target:
        target.create()

    for root, subkeys, subvalues in walk(source, _want_types=True):
        target_root = registry(target.moniker +
                               utils.relative_to(root.moniker, source.moniker),
                               access=use_access,
                               accept_value=False)
        for k in subkeys:
            target_key = registry(target.moniker +
                                  utils.relative_to(k.moniker, source.moniker),
                                  accept_value=False,
                                  access=use_access)
            target_key.create()
        for name, value, type in subvalues:
            target_root.set_value(name, value, type)

    return target
Exemplo n.º 3
0
def key0_subset_of_key1(key0, key1):
    s0 = set((utils.relative_to(key.moniker, key0), frozenset(values))
             for key, subkeys, values in registry.walk(key0))
    s1 = set((utils.relative_to(key.moniker, key1), frozenset(values))
             for key, subkeys, values in registry.walk(key1))
    return s0 < s1
Exemplo n.º 4
0
def keys_are_equal(key0, key1):
    return \
        list((utils.relative_to(key.moniker, key0), list(values)) for key, subkeys, values in registry.walk(key0)) == \
        list((utils.relative_to(key.moniker, key1), list(values)) for key, subkeys, values in registry.walk(key1))
Exemplo n.º 5
0
def key0_subset_of_key1(key0, key1):
    s0 = set((utils.relative_to(key.moniker, key0), frozenset(values)) for key, subkeys, values in registry.walk(key0))
    s1 = set((utils.relative_to(key.moniker, key1), frozenset(values)) for key, subkeys, values in registry.walk(key1))
    return s0 < s1
Exemplo n.º 6
0
def keys_are_equal(key0, key1):
    return \
        list((utils.relative_to(key.moniker, key0), list(values)) for key, subkeys, values in registry.walk(key0)) == \
        list((utils.relative_to(key.moniker, key1), list(values)) for key, subkeys, values in registry.walk(key1))