def parse_state(cmdline):
    spaces_with_no_backslashes = r'((?<!\\)\s)+'
    tokens = filter(lambda x: x != ' ', re.split(spaces_with_no_backslashes, cmdline))
    options = map(option.parse_option, (ifilter(lambda x: x.startswith('-'), tokens)))
    sources = map(source.parse_source, (ifilter(lambda x: x and not x.startswith('-'), tokens)))
    assert len(sources) > 0, 'You need to specify a source'
    assert len(sources) == 1, 'There can only be one source'
    map(option.validate_option, options)
    return State(sources[0], fn.merge(dict(options), option.default_options))
dataset/ETHPy150Open azure-satellite/pyunite/pyunite/state.py/parse_state/original