[SEBA-412] Automated reformat of Python code
Passes of modernize, autopep8, black, then check with flake8
flake8 + manual fixes:
lib/xos-config
lib/xos-kafka
lib/xos-util
xos/coreapi
xos/api
xos/xos_client
Change-Id: Ib23cf84cb13beb3c6381fa0d79594dc9131dc815
diff --git a/lib/xos-util/xosutil/autodiscover_version.py b/lib/xos-util/xosutil/autodiscover_version.py
index 2e606e1..8f4ea47 100644
--- a/lib/xos-util/xosutil/autodiscover_version.py
+++ b/lib/xos-util/xosutil/autodiscover_version.py
@@ -1,4 +1,3 @@
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +23,7 @@
import inspect
import os
+
def autodiscover_version(caller_filename=None, save_to=None, max_parent_depth=None):
""" walk back along the path to the current module, searching for a VERSION file """
if not caller_filename:
@@ -42,8 +42,8 @@
return version
# limit_parent_depth can be used to limit how far back we search the tree for a VERSION file.
- if (max_parent_depth is not None):
- if (max_parent_depth <= 0):
+ if max_parent_depth is not None:
+ if max_parent_depth <= 0:
return None
max_parent_depth -= 1
@@ -51,13 +51,16 @@
if not remainder:
return None
+
def autodiscover_version_of_caller(*args, **kwargs):
frame = inspect.stack()[1]
module = inspect.getmodule(frame[0])
return autodiscover_version(module.__file__, *args, **kwargs)
+
def autodiscover_version_of_main(*args, **kwargs):
import __main__
+
if hasattr(__main__, "__file__"):
return autodiscover_version(__main__.__file__, *args, **kwargs)
else: