From 69e0dc7d680c619e61e45452b894c5955fb31e32 Mon Sep 17 00:00:00 2001 From: Jawayria Date: Tue, 2 Feb 2021 16:57:03 +0500 Subject: [PATCH 1/2] Applied pylint-amnesty to {docs, import_shims, pavelib} --- docs/api/conf.py | 4 ++-- docs/docs_settings.py | 6 +++--- docs/guides/conf.py | 10 +++++----- .../student/management/commands/export_staff_users.py | 2 +- .../management/tests/test_export_staff_users.py | 2 +- .../student/management/commands/export_staff_users.py | 2 +- .../management/tests/test_export_staff_users.py | 2 +- import_shims/warn.py | 2 +- pavelib/__init__.py | 2 +- pavelib/assets.py | 2 +- pavelib/i18n.py | 6 +++--- pavelib/js_test.py | 2 +- pavelib/paver_tests/test_i18n.py | 2 +- pavelib/paver_tests/utils.py | 4 ++-- pavelib/prereqs.py | 4 ++-- pavelib/quality.py | 2 +- pavelib/servers.py | 2 +- pavelib/utils/process.py | 4 ++-- pavelib/utils/test/bokchoy_utils.py | 4 ++-- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/api/conf.py b/docs/api/conf.py index 7ac7e279ee..9cfb7f5126 100644 --- a/docs/api/conf.py +++ b/docs/api/conf.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # # Configuration file for the Sphinx documentation builder. # @@ -25,7 +25,7 @@ import edx_theme # -- Project information ----------------------------------------------------- project = u'Open edX REST APIs' -copyright = edx_theme.COPYRIGHT +copyright = edx_theme.COPYRIGHT # lint-amnesty, pylint: disable=redefined-builtin author = edx_theme.AUTHOR # The short X.Y version diff --git a/docs/docs_settings.py b/docs/docs_settings.py index 03992630e3..98e68dd06f 100644 --- a/docs/docs_settings.py +++ b/docs/docs_settings.py @@ -8,8 +8,8 @@ import all the Studio code. import os if os.environ['EDX_PLATFORM_SETTINGS'] == 'devstack_docker': - from lms.envs.devstack_docker import * - from cms.envs.devstack_docker import ( + from lms.envs.devstack_docker import * # lint-amnesty, pylint: disable=wildcard-import + from cms.envs.devstack_docker import ( # lint-amnesty, pylint: disable=unused-import ADVANCED_PROBLEM_TYPES, COURSE_IMPORT_EXPORT_STORAGE, LIBRARY_AUTHORING_MICROFRONTEND_URL, @@ -18,7 +18,7 @@ if os.environ['EDX_PLATFORM_SETTINGS'] == 'devstack_docker': UPDATE_SEARCH_INDEX_JOB_QUEUE, ) else: - from lms.envs.devstack import * + from lms.envs.devstack import * # lint-amnesty, pylint: disable=wildcard-import from cms.envs.devstack import ( ADVANCED_PROBLEM_TYPES, COURSE_IMPORT_EXPORT_STORAGE, diff --git a/docs/guides/conf.py b/docs/guides/conf.py index dfc8747fc6..e187b959d4 100644 --- a/docs/guides/conf.py +++ b/docs/guides/conf.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring # # Configuration file for the Sphinx documentation builder. # @@ -7,7 +7,7 @@ # http://www.sphinx-doc.org/en/master/config -import datetime +import datetime # lint-amnesty, pylint: disable=unused-import import os import sys from subprocess import check_call @@ -45,7 +45,7 @@ django.setup() # -- Project information ----------------------------------------------------- project = u'edx-platform' -copyright = edx_theme.COPYRIGHT +copyright = edx_theme.COPYRIGHT # lint-amnesty, pylint: disable=redefined-builtin author = edx_theme.AUTHOR # The short X.Y version @@ -278,7 +278,7 @@ def update_settings_module(service='lms'): os.environ['DJANGO_SETTINGS_MODULE'] = settings_module -def on_init(app): # pylint: disable=unused-argument +def on_init(app): # lint-amnesty, pylint: disable=redefined-outer-name, unused-argument """ Run sphinx-apidoc after Sphinx initialization. @@ -325,7 +325,7 @@ def on_init(app): # pylint: disable=unused-argument check_call(args) -def setup(app): +def setup(app): # lint-amnesty, pylint: disable=redefined-outer-name """Sphinx extension: run sphinx-apidoc.""" event = 'builder-inited' app.connect(event, on_init) diff --git a/import_shims/lms/student/management/commands/export_staff_users.py b/import_shims/lms/student/management/commands/export_staff_users.py index c075343e08..67e7a11532 100644 --- a/import_shims/lms/student/management/commands/export_staff_users.py +++ b/import_shims/lms/student/management/commands/export_staff_users.py @@ -5,4 +5,4 @@ from import_shims.warn import warn_deprecated_import warn_deprecated_import('student.management.commands.export_staff_users', 'common.djangoapps.student.management.commands.export_staff_users') -from common.djangoapps.student.management.commands.export_staff_users import * +from common.djangoapps.student.management.commands.export_staff_users import * # lint-amnesty, pylint: disable=import-error, no-name-in-module diff --git a/import_shims/lms/student/management/tests/test_export_staff_users.py b/import_shims/lms/student/management/tests/test_export_staff_users.py index ed38b31368..8602938c5a 100644 --- a/import_shims/lms/student/management/tests/test_export_staff_users.py +++ b/import_shims/lms/student/management/tests/test_export_staff_users.py @@ -5,4 +5,4 @@ from import_shims.warn import warn_deprecated_import warn_deprecated_import('student.management.tests.test_export_staff_users', 'common.djangoapps.student.management.tests.test_export_staff_users') -from common.djangoapps.student.management.tests.test_export_staff_users import * +from common.djangoapps.student.management.tests.test_export_staff_users import * # lint-amnesty, pylint: disable=import-error, no-name-in-module diff --git a/import_shims/studio/student/management/commands/export_staff_users.py b/import_shims/studio/student/management/commands/export_staff_users.py index c075343e08..67e7a11532 100644 --- a/import_shims/studio/student/management/commands/export_staff_users.py +++ b/import_shims/studio/student/management/commands/export_staff_users.py @@ -5,4 +5,4 @@ from import_shims.warn import warn_deprecated_import warn_deprecated_import('student.management.commands.export_staff_users', 'common.djangoapps.student.management.commands.export_staff_users') -from common.djangoapps.student.management.commands.export_staff_users import * +from common.djangoapps.student.management.commands.export_staff_users import * # lint-amnesty, pylint: disable=import-error, no-name-in-module diff --git a/import_shims/studio/student/management/tests/test_export_staff_users.py b/import_shims/studio/student/management/tests/test_export_staff_users.py index ed38b31368..8602938c5a 100644 --- a/import_shims/studio/student/management/tests/test_export_staff_users.py +++ b/import_shims/studio/student/management/tests/test_export_staff_users.py @@ -5,4 +5,4 @@ from import_shims.warn import warn_deprecated_import warn_deprecated_import('student.management.tests.test_export_staff_users', 'common.djangoapps.student.management.tests.test_export_staff_users') -from common.djangoapps.student.management.tests.test_export_staff_users import * +from common.djangoapps.student.management.tests.test_export_staff_users import * # lint-amnesty, pylint: disable=import-error, no-name-in-module diff --git a/import_shims/warn.py b/import_shims/warn.py index 598cda95a8..92a25b2a53 100644 --- a/import_shims/warn.py +++ b/import_shims/warn.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Utilities for warning about deprecated imports temporarily supported by the import_shim/ system. diff --git a/pavelib/__init__.py b/pavelib/__init__.py index da9c28a354..747031759d 100644 --- a/pavelib/__init__.py +++ b/pavelib/__init__.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured paver commands """ diff --git a/pavelib/assets.py b/pavelib/assets.py index eee3e25bb5..a26d744e9f 100644 --- a/pavelib/assets.py +++ b/pavelib/assets.py @@ -879,7 +879,7 @@ def watch_assets(options): default_wait = [str(DEFAULT_OBSERVER_TIMEOUT)] wait = float(get_parsed_option(options, 'wait', default_wait)[0]) - if not theme_dirs and themes: + if not theme_dirs and themes: # lint-amnesty, pylint: disable=no-else-raise # We can not add theme sass watchers without knowing the directory that contains the themes. raise ValueError('theme-dirs must be provided for watching theme sass.') else: diff --git a/pavelib/i18n.py b/pavelib/i18n.py index b269a9faf7..6c11ff7158 100644 --- a/pavelib/i18n.py +++ b/pavelib/i18n.py @@ -92,7 +92,7 @@ def i18n_dummy(): "pavelib.prereqs.install_prereqs", ) @timed -def i18n_compilejs(options): +def i18n_compilejs(options): # lint-amnesty, pylint: disable=unused-argument """ Generating djangojs.js files using django-statici18n """ @@ -260,7 +260,7 @@ def i18n_robot_push(): """ Extract new strings, and push to transifex """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass @task @@ -323,7 +323,7 @@ def find_release_resources(): if len(resources) == 2: return resources - if not resources: + if not resources: # lint-amnesty, pylint: disable=no-else-raise raise ValueError("You need two release-* resources defined to use this command.") else: msg = "Strange Transifex config! Found these release-* resources:\n" + "\n".join(resources) diff --git a/pavelib/js_test.py b/pavelib/js_test.py index 1a76bce298..a3f6a2383b 100644 --- a/pavelib/js_test.py +++ b/pavelib/js_test.py @@ -60,7 +60,7 @@ def test_js(options): test_suite = JsTestSuite(suite, mode=mode, with_coverage=coverage, port=port, skip_clean=skip_clean) test_suite.run() - if (suite == 'jest-snapshot') or (suite == 'all'): + if (suite == 'jest-snapshot') or (suite == 'all'): # lint-amnesty, pylint: disable=consider-using-in test_suite = JestSnapshotTestSuite('jest') test_suite.run() diff --git a/pavelib/paver_tests/test_i18n.py b/pavelib/paver_tests/test_i18n.py index d6cb38278b..a29bb3a8e7 100644 --- a/pavelib/paver_tests/test_i18n.py +++ b/pavelib/paver_tests/test_i18n.py @@ -66,7 +66,7 @@ def do_nothing(): """ Don't do anything, for replacing prerequisite tasks we want to skip. """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass class FindReleaseResourcesTest(unittest.TestCase): diff --git a/pavelib/paver_tests/utils.py b/pavelib/paver_tests/utils.py index 8f7fb69eaa..1db26cf76a 100644 --- a/pavelib/paver_tests/utils.py +++ b/pavelib/paver_tests/utils.py @@ -70,7 +70,7 @@ def fail_on_eslint(*args, **kwargs): to fail, since that is what is going to fail when we pass in a percentage ("p") requirement. """ - if "eslint" in args[0]: + if "eslint" in args[0]: # lint-amnesty, pylint: disable=no-else-raise raise BuildFailure('Subprocess return code: 1') else: if kwargs.get('capture', False): @@ -91,7 +91,7 @@ def unexpected_fail_on_npm_install(*args, **kwargs): # pylint: disable=unused-a For our tests, we need the call for diff-quality running pycodestyle reports to fail, since that is what is going to fail when we pass in a percentage ("p") requirement. """ - if ["npm", "install", "--verbose"] == args[0]: + if ["npm", "install", "--verbose"] == args[0]: # lint-amnesty, pylint: disable=no-else-raise raise BuildFailure('Subprocess return code: 50') else: return diff --git a/pavelib/prereqs.py b/pavelib/prereqs.py index 4d2e0b1903..c77ca14f24 100644 --- a/pavelib/prereqs.py +++ b/pavelib/prereqs.py @@ -10,7 +10,7 @@ import subprocess import sys from distutils import sysconfig -from paver.easy import BuildFailure, sh, task +from paver.easy import BuildFailure, sh, task # lint-amnesty, pylint: disable=unused-import from .utils.envs import Env from .utils.timer import timed @@ -340,7 +340,7 @@ def log_installed_python_prereqs(): sh("pip freeze > {}".format(Env.GEN_LOG_DIR + "/pip_freeze.log")) -def print_devstack_warning(): +def print_devstack_warning(): # lint-amnesty, pylint: disable=missing-function-docstring if Env.USING_DOCKER: # pragma: no cover print("********************************************************************************") print("* WARNING: Mac users should run this from both the lms and studio shells") diff --git a/pavelib/quality.py b/pavelib/quality.py index f5bd679c90..e5d6bc5ca6 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -786,7 +786,7 @@ def run_pii_check(options): print("-" * 45) run_output_file = str(output_file).format(env_name.lower()) sh( - "mkdir -p {} && " + "mkdir -p {} && " # lint-amnesty, pylint: disable=duplicate-string-formatting-argument "export DJANGO_SETTINGS_MODULE={}; " "code_annotations django_find_annotations " "--config_file .pii_annotations.yml --report_path {} --app_name {} " diff --git a/pavelib/servers.py b/pavelib/servers.py index cac521b72e..9bb31b4240 100644 --- a/pavelib/servers.py +++ b/pavelib/servers.py @@ -39,7 +39,7 @@ def run_server( """ if system not in ['lms', 'studio']: print("System must be either lms or studio", file=sys.stderr) - exit(1) + exit(1) # lint-amnesty, pylint: disable=consider-using-sys-exit if not settings: settings = DEFAULT_SETTINGS diff --git a/pavelib/utils/process.py b/pavelib/utils/process.py index 69d2e5e564..c775b4fa21 100644 --- a/pavelib/utils/process.py +++ b/pavelib/utils/process.py @@ -18,7 +18,7 @@ def kill_process(proc): Kill the process `proc` created with `subprocess`. """ p1_group = psutil.Process(proc.pid) - child_pids = p1_group.get_children(recursive=True) + child_pids = p1_group.get_children(recursive=True) # lint-amnesty, pylint: disable=no-member for child_pid in child_pids: os.kill(child_pid.pid, signal.SIGKILL) @@ -110,7 +110,7 @@ def run_background_process(cmd, out_log=None, err_log=None, cwd=None): killed properly. """ p1_group = psutil.Process(proc.pid) - child_pids = p1_group.get_children(recursive=True) + child_pids = p1_group.get_children(recursive=True) # lint-amnesty, pylint: disable=no-member for child_pid in child_pids: os.kill(child_pid.pid, signal.SIGINT) diff --git a/pavelib/utils/test/bokchoy_utils.py b/pavelib/utils/test/bokchoy_utils.py index 76f130c3b9..869cccbfdf 100644 --- a/pavelib/utils/test/bokchoy_utils.py +++ b/pavelib/utils/test/bokchoy_utils.py @@ -146,7 +146,7 @@ def is_mysql_running(): """ # We need to check whether or not mysql is running as a process # even if it is not daemonized. - with open(os.devnull, 'w') as os_devnull: # pylint: disable=W6005 + with open(os.devnull, 'w') as os_devnull: # lint-amnesty, pylint: disable=W6005, bad-option-value #pgrep returns the PID, which we send to /dev/null returncode = subprocess.call("pgrep mysqld", stdout=os_devnull, shell=True) return returncode == 0 @@ -212,4 +212,4 @@ def check_services(): """ Check that all required services are running """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass From d1c21db40fcdf8123401ec77d933844c033ce50f Mon Sep 17 00:00:00 2001 From: Jawayria Date: Tue, 2 Feb 2021 21:20:41 +0500 Subject: [PATCH 2/2] Resolved error --- pavelib/utils/test/bokchoy_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pavelib/utils/test/bokchoy_utils.py b/pavelib/utils/test/bokchoy_utils.py index 869cccbfdf..801fac296e 100644 --- a/pavelib/utils/test/bokchoy_utils.py +++ b/pavelib/utils/test/bokchoy_utils.py @@ -146,7 +146,7 @@ def is_mysql_running(): """ # We need to check whether or not mysql is running as a process # even if it is not daemonized. - with open(os.devnull, 'w') as os_devnull: # lint-amnesty, pylint: disable=W6005, bad-option-value + with open(os.devnull, 'w') as os_devnull: # lint-amnesty, pylint: disable=bad-option-value #pgrep returns the PID, which we send to /dev/null returncode = subprocess.call("pgrep mysqld", stdout=os_devnull, shell=True) return returncode == 0