From 9909b933a77677b37fe9657e317a88720b4a94d5 Mon Sep 17 00:00:00 2001 From: Jawayria Date: Tue, 2 Feb 2021 17:41:32 +0500 Subject: [PATCH 1/3] Applied pylint-amnesty to openedx/core/{djangolib, lib, tests, *.py --- openedx/core/apidocs.py | 2 +- openedx/core/djangolib/blockstore_cache.py | 2 +- openedx/core/djangolib/fields.py | 2 +- openedx/core/djangolib/js_utils.py | 2 +- .../djangolib/testing/tests/test_utils.py | 2 +- openedx/core/djangolib/testing/utils.py | 8 +++---- openedx/core/djangolib/tests/test_js_utils.py | 4 ++-- .../tests/test_oauth2_retirement_utils.py | 2 +- openedx/core/djangolib/translation_utils.py | 2 +- openedx/core/lib/api/authentication.py | 8 +++---- openedx/core/lib/api/fields.py | 6 ++--- openedx/core/lib/api/mixins.py | 4 ++-- openedx/core/lib/api/parsers.py | 2 +- openedx/core/lib/api/permissions.py | 2 +- openedx/core/lib/api/serializers.py | 12 +++++----- .../core/lib/api/tests/test_authentication.py | 12 +++++----- openedx/core/lib/api/tests/test_fields.py | 2 +- openedx/core/lib/api/tests/test_parsers.py | 10 ++++----- .../core/lib/api/tests/test_permissions.py | 8 +++---- openedx/core/lib/api/view_utils.py | 22 +++++++++---------- openedx/core/lib/blockstore_api/methods.py | 8 +++---- openedx/core/lib/command_utils.py | 2 +- openedx/core/lib/course_tabs.py | 2 +- openedx/core/lib/courses.py | 2 +- openedx/core/lib/derived.py | 2 +- .../core/lib/django_require/staticstorage.py | 2 +- openedx/core/lib/exceptions.py | 6 ++--- openedx/core/lib/extract_tar.py | 2 +- openedx/core/lib/gating/api.py | 4 ++-- openedx/core/lib/gating/exceptions.py | 2 +- openedx/core/lib/gating/tests/test_api.py | 2 +- openedx/core/lib/graph_traversals.py | 10 ++++----- openedx/core/lib/json_utils.py | 2 +- openedx/core/lib/license/__init__.py | 2 +- openedx/core/lib/logsettings.py | 2 +- openedx/core/lib/session_serializers.py | 2 +- openedx/core/lib/teams_config.py | 2 +- openedx/core/lib/tests/test_cache_utils.py | 18 +++++++-------- openedx/core/lib/tests/test_course_tabs.py | 4 ++-- openedx/core/lib/tests/test_derived.py | 2 +- openedx/core/lib/tests/test_edx_api_utils.py | 2 +- .../core/lib/tests/test_graph_traversals.py | 2 +- openedx/core/lib/tests/test_request_utils.py | 4 ++-- .../core/lib/tests/test_time_zone_utils.py | 2 +- .../core/lib/x_forwarded_for/middleware.py | 2 +- .../xblock_builtin/xblock_discussion/tests.py | 2 +- .../xblock_discussion/__init__.py | 2 +- openedx/core/lib/xblock_pipeline/finder.py | 8 +++---- openedx/core/lib/xblock_utils/__init__.py | 4 ++-- openedx/core/storage.py | 12 +++++----- openedx/core/tests/test_admin_view.py | 2 +- 51 files changed, 117 insertions(+), 117 deletions(-) diff --git a/openedx/core/apidocs.py b/openedx/core/apidocs.py index 3651a2162c..86a3847c95 100644 --- a/openedx/core/apidocs.py +++ b/openedx/core/apidocs.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Open API support. """ diff --git a/openedx/core/djangolib/blockstore_cache.py b/openedx/core/djangolib/blockstore_cache.py index 46c46237af..df1e3fdf32 100644 --- a/openedx/core/djangolib/blockstore_cache.py +++ b/openedx/core/djangolib/blockstore_cache.py @@ -102,7 +102,7 @@ class BundleCache(object): cache.delete(cache_key) -def _construct_versioned_cache_key(bundle_uuid, version_num, key_parts, draft_name=None): +def _construct_versioned_cache_key(bundle_uuid, version_num, key_parts, draft_name=None): # lint-amnesty, pylint: disable=missing-function-docstring cache_key = str(bundle_uuid) if draft_name: cache_key += ":" + draft_name diff --git a/openedx/core/djangolib/fields.py b/openedx/core/djangolib/fields.py index 6745925191..dc5318bb74 100644 --- a/openedx/core/djangolib/fields.py +++ b/openedx/core/djangolib/fields.py @@ -48,7 +48,7 @@ class BigAutoField(models.AutoField): elif "postgres" in conn_module: return "bigserial" else: - return super(BigAutoField, self).db_type(connection) + return super(BigAutoField, self).db_type(connection) # lint-amnesty, pylint: disable=super-with-arguments def rel_db_type(self, connection): """ diff --git a/openedx/core/djangolib/js_utils.py b/openedx/core/djangolib/js_utils.py index 66e42cb326..79b8070825 100644 --- a/openedx/core/djangolib/js_utils.py +++ b/openedx/core/djangolib/js_utils.py @@ -69,7 +69,7 @@ def dump_js_escaped_json(obj, cls=EdxJSONEncoder): (string) Escaped encoded JSON. """ - obj = list(obj) if isinstance(obj, type({}.values())) else obj + obj = list(obj) if isinstance(obj, type({}.values())) else obj # lint-amnesty, pylint: disable=isinstance-second-argument-not-valid-type json_string = json.dumps(obj, ensure_ascii=True, cls=cls) json_string = _escape_json_for_js(json_string) return json_string diff --git a/openedx/core/djangolib/testing/tests/test_utils.py b/openedx/core/djangolib/testing/tests/test_utils.py index 30b33f8f91..fd55525892 100644 --- a/openedx/core/djangolib/testing/tests/test_utils.py +++ b/openedx/core/djangolib/testing/tests/test_utils.py @@ -19,7 +19,7 @@ class TestGetMockRequest(TestCase): """ Validate the behavior of get_mock_request """ - def setUp(self): + def setUp(self): # lint-amnesty, pylint: disable=super-method-not-called self.addCleanup(set_current_request, None) def test_mock_request_is_request(self): diff --git a/openedx/core/djangolib/testing/utils.py b/openedx/core/djangolib/testing/utils.py index 031ca12ab1..72ffc0c89f 100644 --- a/openedx/core/djangolib/testing/utils.py +++ b/openedx/core/djangolib/testing/utils.py @@ -59,7 +59,7 @@ class CacheIsolationMixin(object): super(CacheIsolationMixin, cls).tearDownClass() def setUp(self): - super(CacheIsolationMixin, self).setUp() + super(CacheIsolationMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.clear_caches() self.addCleanup(self.clear_caches) @@ -165,7 +165,7 @@ class _AssertNumQueriesContext(CaptureQueriesContext): self.test_case = test_case self.num = num self.table_blacklist = table_blacklist - super(_AssertNumQueriesContext, self).__init__(connection) + super(_AssertNumQueriesContext, self).__init__(connection) # lint-amnesty, pylint: disable=super-with-arguments def __exit__(self, exc_type, exc_value, traceback): def is_unfiltered_query(query): @@ -185,7 +185,7 @@ class _AssertNumQueriesContext(CaptureQueriesContext): return False return True - super(_AssertNumQueriesContext, self).__exit__(exc_type, exc_value, traceback) + super(_AssertNumQueriesContext, self).__exit__(exc_type, exc_value, traceback) # lint-amnesty, pylint: disable=super-with-arguments if exc_type is not None: return filtered_queries = [query for query in self.captured_queries if is_unfiltered_query(query)] @@ -207,7 +207,7 @@ class FilteredQueryCountMixin(object): assertNumQueries with one that accepts a blacklist of tables to filter out of the count. """ - def assertNumQueries(self, num, func=None, table_blacklist=None, *args, **kwargs): + def assertNumQueries(self, num, func=None, table_blacklist=None, *args, **kwargs): # lint-amnesty, pylint: disable=keyword-arg-before-vararg """ Used to replace Django's assertNumQueries with the same capability, with the addition of the following argument: diff --git a/openedx/core/djangolib/tests/test_js_utils.py b/openedx/core/djangolib/tests/test_js_utils.py index f427335cab..4c74423c6a 100644 --- a/openedx/core/djangolib/tests/test_js_utils.py +++ b/openedx/core/djangolib/tests/test_js_utils.py @@ -1,4 +1,4 @@ -# pylint: disable=unicode-format-string + # lint-amnesty, pylint: disable=bad-option-value, unicode-format-string # -*- coding: utf-8 -*- """ Tests for js_utils.py @@ -32,7 +32,7 @@ class TestJSUtils(TestCase): A test encoder that is used to prove that the encoder does its job before the escaping. """ # pylint: disable=method-hidden - def default(self, noDefaultEncodingObj): + def default(self, noDefaultEncodingObj): # lint-amnesty, pylint: disable=arguments-differ return noDefaultEncodingObj.value.replace("