Use PEP8Bear 49/4049/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 10 Mar 2017 19:32:25 +0000 (14:32 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 10 Mar 2017 19:34:00 +0000 (14:34 -0500)
Looks like we forgot to configure the PEP8Bear. PEP8Bear also handles
space consistency so let's leave that job to PEP8Bear for Python files
instead.

Change-Id: I7f582a2202a33d7f8ea0d737befecde9f1842805
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.coafile
lftools/cli/nexus.py
lftools/cli/version.py
lftools/nexus/__init__.py
lftools/nexus/cmd.py

index 5406fa9..17c6608 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -8,15 +8,14 @@ ignore_length_regex = Signed-off-by,
 
 [Python]
 bears = BanditBear,
+    PEP8Bear,
     PyCommentedCodeBear,
     PyDocStyleBear,
     PyFlakesBear,
-    PyImportSortBear,
-    SpaceConsistencyBear
+    PyImportSortBear
 files = lftools/**/*.py
 pydocstyle_ignore = D203, D213, D301
-indent_size = 4
-use_spaces = yeah
+max_line_length = 120
 
 [Shell]
 bears = ShellCheckBear,
@@ -25,4 +24,3 @@ files = shell/*
 shell = bash
 indent_size = 4
 use_spaces = yeah
-
index 696e085..dcbfe70 100644 (file)
@@ -30,6 +30,7 @@ def reorder_staged_repos(ctx, settings):
     """
     nexuscmd.reorder_staged_repos(settings)
 
+
 nexus.add_command(reorder_staged_repos)
 
 
@@ -41,9 +42,11 @@ def create(ctx):
 
 
 @create.command()
-@click.option('-c', '--config', type=str, required=True,
+@click.option(
+    '-c', '--config', type=str, required=True,
     help='Repo config file for how to the Nexus repository should be created.')
-@click.option('-s', '--settings', type=str, required=True,
+@click.option(
+    '-s', '--settings', type=str, required=True,
     help='Config file containing administrative settings.')
 @click.pass_context
 def repo(ctx, config, settings):
index 13aeb3a..f70d372 100644 (file)
@@ -51,6 +51,7 @@ def version(ctx):
     """
     pass
 
+
 @click.command()
 @click.argument('release-tag')
 @click.pass_context
@@ -83,7 +84,8 @@ def release(ctx, release_tag):
 @click.command()
 @click.argument('release-tag')
 @click.argument('patch-dir')
-@click.option('--project', default='OpenDaylight',
+@click.option(
+    '--project', default='OpenDaylight',
     help='Project name to use when tagging. (Default: OpenDaylight)')
 @click.pass_context
 def patch(ctx, release_tag, patch_dir, project):
index 5df9c06..16519eb 100644 (file)
@@ -99,7 +99,7 @@ class Nexus:
         delete
         update
         """
-        url = '/'.join([self.baseurl,'service/local/privileges_target'])
+        url = '/'.join([self.baseurl, 'service/local/privileges_target'])
 
         privileges = {
             'data': {
index ed1f564..c92983b 100644 (file)
@@ -22,7 +22,8 @@ def reorder_staged_repos(settings_file):
     to be in the correct reverse sorted order. There is a problem with
     Nexus where it is not doing this like it should be.
     """
-    with open(settings_file, 'r') as f: settings = yaml.safe_load(f)
+    with open(settings_file, 'r') as f:
+        settings = yaml.safe_load(f)
 
     for setting in ['nexus', 'user', 'password']:
         if not setting in settings:
@@ -59,8 +60,10 @@ def create_repos(config_file, settings_file):
     :arg str settings: Settings file containing administrative credentials and
         information.
     """
-    with open(config_file, 'r') as f: config = yaml.safe_load(f)
-    with open(settings_file, 'r') as f: settings = yaml.safe_load(f)
+    with open(config_file, 'r') as f:
+        config = yaml.safe_load(f)
+    with open(settings_file, 'r') as f:
+        settings = yaml.safe_load(f)
 
     for setting in ['nexus', 'user', 'password', 'email_domain']:
         if not setting in settings:
@@ -106,16 +109,26 @@ def create_repos(config_file, settings_file):
         print('Building for %s.%s' % (base_groupId, repo))
         groupId = '%s.%s' % (base_groupId, repo)
         target = '^/%s/.*' % groupId.replace('.', '[/\.]')
+
         if 'extra_privs' in config:
             extra_privs = config['extra_privs']
         else:
             extra_privs = []
-        create_nexus_perms(repoId, [target], settings['email_domain'],
-            config['password'], extra_privs)
+
+        create_nexus_perms(
+            repoId,
+            [target],
+            settings['email_domain'],
+            config['password'],
+            extra_privs)
+
         if 'repositories' in config:
             for sub_repo in config['repositories']:
                 sub_repo_id = '%s-%s' % (repoId, sub_repo)
-                build_repo(sub_repo, sub_repo_id, config['repositories'][sub_repo],
+                build_repo(
+                    sub_repo,
+                    sub_repo_id,
+                    config['repositories'][sub_repo],
                     groupId)
 
     for repo in config['repositories']: