From 0fc0d404acd4a6080409e2796b7f6d6002039861 Mon Sep 17 00:00:00 2001 From: Neha Yadav Date: Fri, 8 Feb 2019 02:46:07 +0530 Subject: [PATCH] Update pycodestyle --- config/exec_provider.py | 7 ++++--- config/incluster_config.py | 3 ++- config/kube_config.py | 6 ++++-- hack/boilerplate/boilerplate.py | 14 +++++++++----- stream/ws_client.py | 7 ++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/config/exec_provider.py b/config/exec_provider.py index a4198353..89d81e8c 100644 --- a/config/exec_provider.py +++ b/config/exec_provider.py @@ -23,9 +23,10 @@ class ExecProvider(object): """ - Implementation of the proposal for out-of-tree client authentication providers - as described here -- - https://github.com/kubernetes/community/blob/master/contributors/design-proposals/auth/kubectl-exec-plugins.md + Implementation of the proposal for out-of-tree client + authentication providers as described here -- + https://github.com/kubernetes/community/blob/master/contributors + /design-proposals/auth/kubectl-exec-plugins.md Missing from implementation: diff --git a/config/incluster_config.py b/config/incluster_config.py index e643f0df..c9bdc907 100644 --- a/config/incluster_config.py +++ b/config/incluster_config.py @@ -87,7 +87,8 @@ def _set_config(self): def load_incluster_config(): - """Use the service account kubernetes gives to pods to connect to kubernetes + """ + Use the service account kubernetes gives to pods to connect to kubernetes cluster. It's intended for clients that expect to be running inside a pod running on kubernetes. It will raise an exception if called from a process not running in a kubernetes environment.""" diff --git a/config/kube_config.py b/config/kube_config.py index c0e0e26d..743046db 100644 --- a/config/kube_config.py +++ b/config/kube_config.py @@ -556,9 +556,11 @@ def new_client_from_config( config_file=None, context=None, persist_config=True): - """Loads configuration the same as load_kube_config but returns an ApiClient + """ + Loads configuration the same as load_kube_config but returns an ApiClient to be used with any API object. This will allow the caller to concurrently - talk with multiple clusters.""" + talk with multiple clusters. + """ client_config = type.__call__(Configuration) load_kube_config(config_file=config_file, context=context, client_configuration=client_config, diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index bdc70c31..61d4cb94 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -52,7 +52,8 @@ def get_refs(): refs = {} - for path in glob.glob(os.path.join(args.boilerplate_dir, "boilerplate.*.txt")): + for path in glob.glob(os.path.join( + args.boilerplate_dir, "boilerplate.*.txt")): extension = os.path.basename(path).split(".")[1] ref_file = open(path, 'r') @@ -105,7 +106,7 @@ def file_passes(filename, refs, regexs): filename, file=verbose_out) return False - # Replace all occurrences of the regex "2014|2015|2016|2017|2018" with "YEAR" + # Replace all occurrences of regex "2014|2015|2016|2017|2018" with "YEAR" p = regexs["date"] for i, d in enumerate(data): (data[i], found) = p.subn('YEAR', d) @@ -118,7 +119,8 @@ def file_passes(filename, refs, regexs): filename, file=verbose_out) if args.verbose: print(file=verbose_out) - for line in difflib.unified_diff(ref, data, 'reference', filename, lineterm=''): + for line in difflib.unified_diff( + ref, data, 'reference', filename, lineterm=''): print(line, file=verbose_out) print(file=verbose_out) return False @@ -171,9 +173,11 @@ def get_dates(): def get_regexs(): regexs = {} - # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing + # Search for "YEAR" which exists in the boilerplate, + # but shouldn't in the real thing regexs["year"] = re.compile('YEAR') - # get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)"; + # get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year + # as a regex like: "(2014|2015|2016|2017|2018)"; # company holder names can be anything regexs["date"] = re.compile(get_dates()) # strip #!.* from shell scripts diff --git a/stream/ws_client.py b/stream/ws_client.py index c6fea7ba..cf8a3fe9 100644 --- a/stream/ws_client.py +++ b/stream/ws_client.py @@ -53,7 +53,8 @@ def __init__(self, configuration, url, headers): header.append("authorization: %s" % headers['authorization']) if headers and 'sec-websocket-protocol' in headers: - header.append("sec-websocket-protocol: %s" % headers['sec-websocket-protocol']) + header.append("sec-websocket-protocol: %s" % + headers['sec-websocket-protocol']) else: header.append("sec-websocket-protocol: v4.channel.k8s.io") @@ -186,8 +187,8 @@ def update(self, timeout=0): data = data[1:] if data: if channel in [STDOUT_CHANNEL, STDERR_CHANNEL]: - # keeping all messages in the order they received for - # non-blocking call. + # keeping all messages in the order they received + # for non-blocking call. self._all += data if channel not in self._channels: self._channels[channel] = data