Exemplo n.º 1
0
def reformat(**kwargs):
    """
    auto pep8 format all python file in ``source code`` and ``tests`` dir.
    """
    # repository direcotry
    repo_dir = Path(__file__).parent.absolute()

    # source code directory
    source_dir = Path(repo_dir, package.__name__)

    if source_dir.exists():
        print("Source code locate at: '%s'." % source_dir)
        print("Auto pep8 all python file ...")
        source_dir.autopep8(**kwargs)
    else:
        print("Source code directory not found!")

    # unittest code directory
    unittest_dir = Path(repo_dir, "tests")
    if unittest_dir.exists():
        print("Unittest code locate at: '%s'." % unittest_dir)
        print("Auto pep8 all python file ...")
        unittest_dir.autopep8(**kwargs)
    else:
        print("Unittest code directory not found!")

    print("Complete!")
Exemplo n.º 2
0
def fixcode(**kwargs):
    """
    auto pep8 format all python file in ``source code`` and ``tests`` dir.
    """
    # repository direcotry
    repo_dir = Path(__file__).parent.absolute()

    # source code directory
    source_dir = Path(repo_dir, package.__name__)

    if source_dir.exists():
        print("Source code locate at: '%s'." % source_dir)
        print("Auto pep8 all python file ...")
        source_dir.autopep8(**kwargs)
    else:
        print("Source code directory not found!")

    # unittest code directory
    unittest_dir = Path(repo_dir, "tests")
    if unittest_dir.exists():
        print("Unittest code locate at: '%s'." % unittest_dir)
        print("Auto pep8 all python file ...")
        unittest_dir.autopep8(**kwargs)
    else:
        print("Unittest code directory not found!")

    print("Complete!")
Exemplo n.º 3
0
def fixcode():
    # repository direcotry
    repo_dir = Path(__file__).absolute().parent.parent

    # source code directory
    source_dir = Path(repo_dir, repo_dir.basename.replace("-project", ""))
    if source_dir.exists():
        print("Source code locate at: '%s'." % source_dir)
        print("Auto pep8 all python file ...")
        source_dir.autopep8()
    else:
        print("Source code directory not found!")

    # unittest code directory
    unittest_dir = Path(repo_dir, "tests")
    if unittest_dir.exists():
        print("Unittest code locate at: '%s'." % unittest_dir)
        print("Auto pep8 all python file ...")
        unittest_dir.autopep8()
    else:
        print("Unittest code directory not found!")

    print("Complete!")
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pathlib_mate import Path

p = Path(
    Path(__file__).parent,
    "sfm",
)
p.autopep8()

p = Path(Path(__file__).parent, "tests")
p.autopep8()