def main(debug, prefer, config_as, options, args): """ Runs pylama or pylava """ pylama, config_as = patch_pylama(prefer=prefer, config_as=config_as) try_options = suggest_paths(os.getcwd(), options or [], f"{config_as}.ini") found_options = [str(x) for x in try_options if ospath.exists(x)] options = ["-o", found_options[0]] if found_options else [] debug = True if debug: with open("/tmp/pylamashim.log", "a") as f: def _p(s): f.write(f"{s}\n") print(s) _p("---------------->>>>>") _p(" ".join(sys.argv)) _p("----------------") _p(f"try: {try_options}") _p(f"found: {found_options}") _p(f"args: {args}") _p(f"pylama: {pylama.__file__}") _p("----------------") _p(f"pylama: {' '.join(options + list(args))}") _p("<<<<<----------------") _p("") pylama.shell(args=options + list(args))
def test_shell(): from pylama.main import shell errors = shell('-o dummy dummy.py'.split(), error=False) assert errors errors = shell(['unknown.py'], error=False) assert not errors
def test_shell(): errors = shell('-o dummy dummy.py'.split(), error=False) assert errors options = parse_options() errors = check_files(['dummy.py'], options=options, error=False) assert errors errors = shell(['unknown.py'], error=False) assert not errors
def test_shell(self): from pylama.main import shell, check_files errors = shell('-o dummy dummy.py'.split(), error=False) self.assertTrue(errors) options = parse_options() errors = check_files(['dummy.py'], options=options, error=False) self.assertTrue(errors) errors = shell(['unknown.py'], error=False) self.assertFalse(errors)
def test_shell(self): from pylama.main import shell, check_files errors = shell('-o dummy dummy.py'.split(), error=False) self.assertTrue(errors) options = parse_options() errors = check_files(['dummy.py'], options=options, error=False) self.assertTrue(errors) errors = shell(['unknown.py'], error=False) self.assertTrue(errors)
def test_shell(): errors = shell('-o dummy dummy.py'.split(), error=False) assert errors errors = shell(['unknown.py'], error=False) assert not errors
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys python_path = os.environ.get('PYLAMA', '').split(os.pathsep) sys.path = [p for p in sys.path if p not in python_path] sys.path.extend(python_path) from pylama.main import shell if __name__ == '__main__': try: virtual_env = os.environ.get('VIRTUAL_ENV', '') activate_this = os.path.join(virtual_env, 'bin', 'activate_this.py') with open(activate_this) as f: from deps import six six.exec_(f.read(), dict(__file__=activate_this)) except IOError: pass sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(shell())
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys import six from pylama.main import shell if __name__ == '__main__': try: virtual_env = os.environ.get('VIRTUAL_ENV', '') activate_this = os.path.join(virtual_env, 'bin', 'activate_this.py') with open(activate_this) as f: six.exec_(f.read(), dict(__file__=activate_this)) except IOError: pass sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(shell())
"""Support the module execution.""" from pylama.main import shell if __name__ == "__main__": shell()