Skip to content

Commit 4d4ce21

Browse files
authored
Merge pull request #677 from micw523/track-utils
Track utils with pycodestyle
2 parents 4c4b019 + 7256870 commit 4d4ce21

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

kubernetes/utils/create_from_yaml.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from os import path
15+
1616
import re
1717
import sys
18-
19-
from six import iteritems
18+
from os import path
2019

2120
import yaml
21+
from six import iteritems
2222

2323
from kubernetes import client
2424

25+
2526
def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
2627
"""
2728
Perform an action from a yaml file. Pass True for verbose to
2829
print confirmation information.
29-
3030
Input:
3131
yaml_file: string. Contains the path to yaml file.
3232
k8s_cline: an ApiClient object, initialized with the client args.
@@ -40,7 +40,7 @@ def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
4040

4141
with open(path.abspath(yaml_file)) as f:
4242
yml_object = yaml.load(f)
43-
#TODO: case of yaml file containing multiple objects
43+
# TODO: case of yaml file containing multiple objects
4444
group, _, version = yml_object["apiVersion"].partition("/")
4545
if version == "":
4646
version = group
@@ -49,7 +49,7 @@ def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
4949
# Only replace the last instance
5050
group = "".join(group.rsplit(".k8s.io", 1))
5151
fcn_to_call = "{0}{1}Api".format(group.capitalize(),
52-
version.capitalize())
52+
version.capitalize())
5353
k8s_api = getattr(client, fcn_to_call)(k8s_client)
5454
# Replace CamelCased action_type into snake_case
5555
kind = yml_object["kind"]
@@ -71,4 +71,3 @@ def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
7171
if verbose:
7272
print("{0} created. status='{1}'".format(kind, str(resp.status)))
7373
return k8s_api
74-

scripts/update-pycodestyle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ SAVEIFS=$IFS
5858
trap "IFS=$SAVEIFS" EXIT SIGINT
5959
IFS=,
6060

61-
SOURCES="${SCRIPT_ROOT}/../setup.py,${CLIENT_ROOT}/config/*.py,${CLIENT_ROOT}/watch/*.py,${SCRIPT_ROOT}/*.py,${CLIENT_ROOT}/../examples/*.py"
61+
SOURCES="${SCRIPT_ROOT}/../setup.py,${CLIENT_ROOT}/config/*.py,${CLIENT_ROOT}/watch/*.py,${CLIENT_ROOT}/utils/*.py,${SCRIPT_ROOT}/*.py,${CLIENT_ROOT}/../examples/*.py"
6262

6363
echo "--- applying autopep8"
6464
for SOURCE in $SOURCES; do

0 commit comments

Comments
 (0)