How to use the pipupgrade.util.string.kebab_case function in pipupgrade

To help you get started, we’ve selected a few pipupgrade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_kebab_case():
    assert kebab_case("foo bar") == "foo-bar"
    assert kebab_case("Foo Bar") == "foo-bar"
    assert kebab_case("FOO BAR") == "foo-bar"

    assert kebab_case("_FOO_BAR_", delimiter = "_") == "foo-bar"
    assert kebab_case("foo_bar",   delimiter = "_") == "foo-bar"
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_kebab_case():
    assert kebab_case("foo bar") == "foo-bar"
    assert kebab_case("Foo Bar") == "foo-bar"
    assert kebab_case("FOO BAR") == "foo-bar"

    assert kebab_case("_FOO_BAR_", delimiter = "_") == "foo-bar"
    assert kebab_case("foo_bar",   delimiter = "_") == "foo-bar"
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_kebab_case():
    assert kebab_case("foo bar") == "foo-bar"
    assert kebab_case("Foo Bar") == "foo-bar"
    assert kebab_case("FOO BAR") == "foo-bar"

    assert kebab_case("_FOO_BAR_", delimiter = "_") == "foo-bar"
    assert kebab_case("foo_bar",   delimiter = "_") == "foo-bar"
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_kebab_case():
    assert kebab_case("foo bar") == "foo-bar"
    assert kebab_case("Foo Bar") == "foo-bar"
    assert kebab_case("FOO BAR") == "foo-bar"

    assert kebab_case("_FOO_BAR_", delimiter = "_") == "foo-bar"
    assert kebab_case("foo_bar",   delimiter = "_") == "foo-bar"
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_kebab_case():
    assert kebab_case("foo bar") == "foo-bar"
    assert kebab_case("Foo Bar") == "foo-bar"
    assert kebab_case("FOO BAR") == "foo-bar"

    assert kebab_case("_FOO_BAR_", delimiter = "_") == "foo-bar"
    assert kebab_case("foo_bar",   delimiter = "_") == "foo-bar"
github achillesrasquinha / pipupgrade / src / pipupgrade / model / package.py View on Github external
def _get_pip_info(*args, **kwargs):
	packages	= args
	pip_exec	= kwargs.get("pip_exec", None)
	
	_, out, _	= _pip.call("show", *packages, pip_exec = pip_exec,
		output = True)
	results		= [strip(o) for o in out.split("---")]
	
	info		= dict()
	
	for i, package in enumerate(packages):
		result = results[i]

		detail = dict((kebab_case(k), v) \
			for k, v in \
				iteritems(
					dict([(s + [""]) if len(s) == 1 else s \
						for s in [re.split(r":\s?", o, maxsplit = 1) \
							for o in result.split("\n")]]
					)
				)
		)

		info[package] = detail
	
	return info
github achillesrasquinha / pipupgrade / src / pipupgrade / _pip.py View on Github external
def call(*args, **kwargs):
    pip_exec  = kwargs.pop("pip_exec", None)  or _PIP_EXECUTABLE
    quiet     = kwargs.pop("quiet", None)     or False
    output    = kwargs.pop("output", None)    or False
    raise_err = kwargs.pop("raise_err", None) or True

    params    = sequencify(pip_exec) + sequencify(args)
    
    for flag, value in iteritems(kwargs):
        if value != False:
            flag  = "--%s" % kebab_case(flag, delimiter = "_")
            params.append(flag)

            if not isinstance(value, bool):
                value = value_to_envval(value)
                params.append(value)

    output = output or quiet
	
    output = popen(*params, output = output, raise_err = raise_err)
    
    return output