Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(15)  |  Call(15)  |  Derive(0)  |  Import(0)
Remove any common leading whitespace from every line in `text`.

This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.

Note that tabs and spaces are both treated as whitespace, but they
are not equal: the lines "  hello" and "    hello" are
considered to have no common leading whitespace.  (This behaviour is
new in Python 2.5; older versions of this module incorrectly(more...)

        def dedent(text):
    """Remove any common leading whitespace from every line in `text`.

    This can be used to make triple-quoted strings line up with the left
    edge of the display, while still presenting them in the source code
    in indented form.

    Note that tabs and spaces are both treated as whitespace, but they
    are not equal: the lines "  hello" and "\thello" are
    considered to have no common leading whitespace.  (This behaviour is
    new in Python 2.5; older versions of this module incorrectly
    expanded tabs before searching for common leading whitespace.)
    """
    # Look for the longest leading string of spaces and tabs common to
    # all lines.
    margin = None
    text = _whitespace_only_re.sub('', text)
    indents = _leading_whitespace_re.findall(text)
    for indent in indents:
        if margin is None:
            margin = indent

        # Current line more deeply indented than previous winner:
        # no change (previous winner is still on top).
        elif indent.startswith(margin):
            pass

        # Current line consistent with and no deeper than previous winner:
        # it's the new winner.
        elif margin.startswith(indent):
            margin = indent

        # Current line and previous winner have no common whitespace:
        # there is no margin.
        else:
            margin = ""
            break

    # sanity check (testing/debugging only)
    if 0 and margin:
        for line in text.split("\n"):
            assert not line or line.startswith(margin), \
                   "line = %r, margin = %r" % (line, margin)

    if margin:
        text = re.sub(r'(?m)^' + margin, '', text)
    return text
        


src/d/e/devpi-server-1.2.2/devpi_server/gendeploy.py   devpi-server(Download)
    which you might modify and copy to your /etc/nginx/sites-enabled
    directory.
    """) % locals())
    tw.line("may quick reliable pypi installations be with you :)",
            green=True)
        you should be able to install the new crontab but please check it
        first.
    """ % (based, crontabpath))
 
 

src/p/y/pytest-xdist-1.10/testing/test_slavemanage.py   pytest-xdist(Download)
            [pytest]
            rsyncdirs=dir1/dir2
        """))
        config = testdir.parseconfig(source)
        nodemanager = NodeManager(config, ["popen//chdir=%s" % dest])
            rsyncdirs = dir1 dir5
            rsyncignore = dir1/dir2 dir5/dir6 foo*
        """))
        config = testdir.parseconfig(source)
        config.option.rsyncignore = ['bar']

src/t/o/tox-1.7.1/tox/_pytestplugin.py   tox(Download)
    def newconfig(args, source=None):
        if source is None:
            source = args
            args = []
        s = py.std.textwrap.dedent(source)
            create_files(base.ensure(key, dir=1), value)
        elif isinstance(value, str):
            s = py.std.textwrap.dedent(value)
            base.join(key).write(s)
 

src/d/e/devpi-client-1.2.2/testing/test_push.py   devpi-client(Download)
        username: test
        password: testp
    """))
    class args:
        target = "pypi:whatever"
        username: test
        password: testp
    """))
    class args:
        pypirc = str(p)

src/a/p/apipkg-1.2/test_apipkg.py   apipkg(Download)
            'os2.path': 'api2.path2',
            })
    """))
    tmpdir.join("api2.py").write(py.std.textwrap.dedent("""
        import os, sys
        from os import path
        sys.modules['api2.path2'] = path
        x = 3
    """))

src/p/y/pytest-2.5.2/testing/test_conftest.py   pytest(Download)
        def bar(foo):
            return 'bar'
    """))
    subsub = sub.mkdir("subsub")
    subsub.join("__init__.py").write("")
        def test_event_fixture(bar):
            assert bar == 'sub bar'
    """))
    result = testdir.runpytest("sub")
    result.stdout.fnmatch_lines(["*1 passed*"])

src/p/y/pytest-2.5.2/testing/test_config.py   pytest(Download)
    def test_ini_names(self, testdir, name):
        testdir.tmpdir.join(name).write(py.std.textwrap.dedent("""
            [pytest]
            minversion = 1.0
        """))
            [pytest]
            minversion = 2.0
        """))
        testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
            [pytest]
            minversion = 1.5
        """))