diff --git a/makefile b/makefile index 55631222cbb0613e6ccd634a609b594a50ff0951..e900742bededb1651c9e64963efe6db01014903e 100644 --- a/makefile +++ b/makefile @@ -47,6 +47,7 @@ run-single: formatting: mvn fmt:format + autopep8 -ari scripting/ # Compile into a standalone jar file jar: easy-units diff --git a/scripting/bin/administration/diagnostics.py b/scripting/bin/administration/diagnostics.py index 3c1f2eed66b564fb6d73e320bd023e99f32632c6..a4df74001d79eb1d7b078de23a77a8d8f9631a0b 100755 --- a/scripting/bin/administration/diagnostics.py +++ b/scripting/bin/administration/diagnostics.py @@ -47,12 +47,15 @@ def get_option(name, default=None): return arg[index:] return default + def get_exit_code(): return int(get_option("exit", 0)) + def get_auth_token(): return get_option("auth-token") + def get_query(): return get_option("query") @@ -62,7 +65,9 @@ def get_caosdb_info(auth_token): result = dict() try: - db.configure_connection(auth_token=auth_token, password_method="auth_token") + db.configure_connection( + auth_token=auth_token, + password_method="auth_token") info = db.Info() @@ -81,17 +86,22 @@ def get_caosdb_info(auth_token): result["exception"] = str(e) return result + def test_imports(modules): result = dict() for m in modules: try: i = __import__(m) - v = i.__version__ if hasattr(i, "__version__") and i.__version__ is not None else "unknown version" + if hasattr(i, "__version__") and i.__version__ is not None: + v = i.__version__ + else: + v = "unknown version" result[m] = (True, v) except ImportError as e: result[m] = (False, str(e)) return result + def main(): try: import json diff --git a/scripting/bin/xls_from_csv.py b/scripting/bin/xls_from_csv.py index 38dfbc1c9392ce60d338b102f9b9fd05309919d3..73bb6b0ac23fc2df093bd6797e864aad1f2d5592 100755 --- a/scripting/bin/xls_from_csv.py +++ b/scripting/bin/xls_from_csv.py @@ -93,7 +93,8 @@ def _parse_arguments(): parser.add_argument('-t', '--tempdir', required=False, default=tempdir, help="Temporary dir for saving the result.") parser.add_argument('-a', '--auth-token', required=False, - help="An authentication token (not needed, only for compatibility).") + help=("An authentication token (not needed, only for " + "compatibility).")) parser.add_argument('tsv', help="The tsv file.") return parser.parse_args() @@ -104,5 +105,6 @@ def main(): filename = _write_xls(dataframe, directory=args.tempdir) print(filename) + if __name__ == "__main__": main()