Esempio n. 1
0
def internalizestr(string, basedirs=None, load_data=True):
        """Create an action instance based on a sequence of strings.
        This function also translates external representations of actions with
        payloads (like file and license which can use NOHASH or file paths to
        point to the payload) to an internal representation which sets the
        data field of the action returned.

        In general, each string should be in the form of "key=value". The
        exception is a payload for certain actions which should be the first
        item in the sequence.

        Raises MalformedActionError if the attribute strings are malformed.
        """

        action = fromstr(string)

        if action.name not in ("file", "license") or not load_data:
                return action, None, None

        local_path, used_basedir = set_action_data(action.hash, action,
            basedirs=basedirs)
        return action, local_path, used_basedir
Esempio n. 2
0
def internalizestr(string, basedirs=None, load_data=True):
    """Create an action instance based on a sequence of strings.
        This function also translates external representations of actions with
        payloads (like file and license which can use NOHASH or file paths to
        point to the payload) to an internal representation which sets the
        data field of the action returned.

        In general, each string should be in the form of "key=value". The
        exception is a payload for certain actions which should be the first
        item in the sequence.

        Raises MalformedActionError if the attribute strings are malformed.
        """

    action = fromstr(string)

    if action.name not in ("file", "license") or not load_data:
        return action, None, None

    local_path, used_basedir = set_action_data(action.hash,
                                               action,
                                               basedirs=basedirs)
    return action, local_path, used_basedir
Esempio n. 3
0
def attrsfromstr(string):
        """Create an attribute dict given a string w/ key=value pairs.

        Raises MalformedActionError if the attributes have syntactic problems.
        """
        return fromstr("unknown %s" % string).attrs
Esempio n. 4
0
def attrsfromstr(string):
    """Create an attribute dict given a string w/ key=value pairs.

        Raises MalformedActionError if the attributes have syntactic problems.
        """
    return fromstr("unknown {0}".format(string)).attrs