Skip to content

Commit 11b4b44

Browse files
authored
Used pycodestyle instead of custom pylint check (oppia#10292)
* Used pycodestyle instead of custom pylint check * Fixed lint checks
1 parent b8734a4 commit 11b4b44

File tree

67 files changed

+1
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1
-266
lines changed

core/controllers/base.py

-5
Original file line numberDiff line numberDiff line change
@@ -108,31 +108,26 @@ class NotLoggedInException(Exception):
108108

109109
pass
110110

111-
112111
class InvalidInputException(Exception):
113112
"""Error class for invalid input on the user side (error code 400)."""
114113

115114
pass
116115

117-
118116
class UnauthorizedUserException(Exception):
119117
"""Error class for unauthorized access."""
120118

121119
pass
122120

123-
124121
class PageNotFoundException(Exception):
125122
"""Error class for a page not found error (error code 404)."""
126123

127124
pass
128125

129-
130126
class InternalErrorException(Exception):
131127
"""Error class for an internal server side error (error code 500)."""
132128

133129
pass
134130

135-
136131
class TemporaryMaintenanceException(Exception):
137132
"""Error class for when the server is currently down for temporary
138133
maintenance (error code 503).

core/controllers/editor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def test_new_state_template(self):
144144
# by validating it.
145145
exploration.states[feconf.DEFAULT_INIT_STATE_NAME].validate(None, True)
146146

147-
148147
def test_that_default_exploration_cannot_be_published(self):
149148
"""Test that publishing a default exploration raises an error
150149
due to failing strict validation.
@@ -2242,7 +2241,6 @@ def setUp(self):
22422241
'is_valid': True
22432242
}
22442243

2245-
22462244
def test_resolve_issue_handler(self):
22472245
"""Test that resolving an issue deletes associated playthroughs."""
22482246
with self.login_context(self.MODERATOR_EMAIL):

core/controllers/learner_playlist_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ def test_add_exploration_to_learner_playlist(self):
157157
'exp_id_%s' % exp_id), {},
158158
csrf_token=csrf_token)
159159

160-
161160
# Now if we try and add an activity we should get a message saying we
162161
# are exceeding the limit.
163162
response = self.post_json(

core/controllers/practice_sessions_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ def test_any_user_can_access_practice_sessions_page(self):
8181
'/learn/staging/public-topic-name/practice/session?'
8282
'selected_subtopic_ids=1,2')
8383

84-
8584
def test_no_user_can_access_unpublished_topic_practice_session_page(self):
8685
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
8786
self.get_html_response(
8887
'/learn/staging/private-topic-name/practice/session?'
8988
'selected_subtopic_ids=1,2',
9089
expected_status_int=404)
9190

92-
9391
def test_get_fails_when_new_structures_not_enabled(self):
9492
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
9593
self.get_html_response(

core/controllers/review_tests.py

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def get(self, story_id):
7171
for skill in skills:
7272
skill_descriptions[skill.id] = skill.description
7373

74-
7574
self.values.update({
7675
'skill_descriptions': skill_descriptions,
7776
'story_name': story.title

core/controllers/skill_mastery.py

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def get(self):
6464
})
6565
self.render_json(self.values)
6666

67-
6867
@acl_decorators.can_access_learner_dashboard
6968
def put(self):
7069
"""Handles PUT requests."""

core/controllers/story_viewer_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ def test_post_fails_when_node_does_not_exist(self):
298298
), {}, csrf_token=csrf_token, expected_status_int=404
299299
)
300300

301-
302301
def test_post_fails_when_story_is_not_published_in_story_mode(self):
303302
topic_services.unpublish_story(
304303
self.TOPIC_ID, self.STORY_ID, self.admin_id)

core/controllers/subtopic_viewer_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ def test_any_user_can_access_subtopic_viewer_page(self):
157157
self.get_html_response(
158158
'/learn/staging/%s/revision/%s' % ('name', 'sub-url-frag-one'))
159159

160-
161160
def test_accessibility_of_subtopic_viewer_page_of_unpublished_topic(
162161
self):
163162
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
@@ -171,7 +170,6 @@ def test_accessibility_of_subtopic_viewer_page_of_unpublished_topic(
171170
% ('pvttopic', 'sub-url-frag-one'))
172171
self.logout()
173172

174-
175173
def test_get_fails_when_new_structures_not_enabled(self):
176174
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
177175
self.get_html_response(

core/controllers/suggestion_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,6 @@ def setUp(self):
12671267
self.signup(self.AUTHOR_EMAIL, 'author')
12681268
self.signup(self.REVIEWER_EMAIL, 'reviewer')
12691269

1270-
12711270
self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL)
12721271
self.TOPIC_ID = 'topic'
12731272
self.STORY_ID = 'story'

core/controllers/topic_viewer_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def test_any_user_can_access_topic_viewer_page(self):
115115
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
116116
self.get_html_response('/learn/staging/%s' % 'public')
117117

118-
119118
def test_accessibility_of_unpublished_topic_viewer_page(self):
120119
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
121120
self.get_html_response(
@@ -125,7 +124,6 @@ def test_accessibility_of_unpublished_topic_viewer_page(self):
125124
self.get_html_response('/learn/staging/%s' % 'private')
126125
self.logout()
127126

128-
129127
def test_get_fails_when_new_structures_not_enabled(self):
130128
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
131129
self.get_html_response(

core/domain/activity_jobs_one_off.py

-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ def map(commit_model):
238238
else:
239239
yield ('FAILURE_INCORRECT - %s' % class_name, commit_model.id)
240240

241-
242241
@staticmethod
243242
def reduce(key, values):
244243
"""Implements the reduce function for this job."""

core/domain/collection_domain_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ def test_next_explorations_in_sequence(self):
558558
collection.get_next_exploration_id_in_sequence(exploration_id),
559559
None)
560560

561-
562561
collection.add_node('exp_id_1')
563562
collection.add_node('exp_id_2')
564563
self.assertEqual(
@@ -667,7 +666,6 @@ def test_from_yaml_with_invalid_schema_version_raises_error(self):
667666
self.COLLECTION_ID, yaml_content)
668667

669668

670-
671669
class SchemaMigrationMethodsUnitTests(test_utils.GenericTestBase):
672670
"""Tests the presence of appropriate schema migration methods in the
673671
Collection domain object class.

core/domain/email_manager_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,6 @@ def test_send_removed_translation_reviewer_email(self):
29752975
'Best wishes,<br>'
29762976
'The Oppia Community')
29772977

2978-
29792978
with self.can_send_emails_ctx:
29802979
email_manager.send_email_to_removed_contribution_reviewer(
29812980
self.translation_reviewer_id,
@@ -3021,7 +3020,6 @@ def test_send_removed_voiceover_reviewer_email(self):
30213020
'Best wishes,<br>'
30223021
'The Oppia Community')
30233022

3024-
30253023
with self.can_send_emails_ctx:
30263024
email_manager.send_email_to_removed_contribution_reviewer(
30273025
self.voiceover_reviewer_id,
@@ -3065,7 +3063,6 @@ def test_send_removed_question_reviewer_email(self):
30653063
'Best wishes,<br>'
30663064
'The Oppia Community')
30673065

3068-
30693066
with self.can_send_emails_ctx:
30703067
email_manager.send_email_to_removed_contribution_reviewer(
30713068
self.question_reviewer_id, constants.REVIEW_CATEGORY_QUESTION,

core/domain/exp_domain_test.py

-4
Original file line numberDiff line numberDiff line change
@@ -8358,7 +8358,6 @@ def test_load_from_v41_with_text_inputs_case_sensitive_equals_rule(self):
83588358
'eid', sample_yaml_content)
83598359
self.assertEqual(exploration.to_yaml(), latest_sample_yaml_content)
83608360

8361-
83628361
def test_cannot_load_from_yaml_with_no_schema_version(self):
83638362
sample_yaml_content = (
83648363
"""author_notes: ''
@@ -9052,7 +9051,6 @@ class HTMLMigrationUnitTests(test_utils.GenericTestBase):
90529051
title: title
90539052
""")
90549053

9055-
90569054
YAML_CONTENT_V27_WITHOUT_IMAGE_CAPTION = (
90579055
"""author_notes: ''
90589056
auto_tts_enabled: true
@@ -9440,7 +9438,6 @@ class HTMLMigrationUnitTests(test_utils.GenericTestBase):
94409438
""")
94419439
# pylint: enable=line-too-long, single-line-pragma
94429440

9443-
94449441
def test_load_from_v26_textangular(self):
94459442
"""Test direct loading from a v26 yaml file."""
94469443
mock_get_filename_with_dimensions_context = self.swap(
@@ -9453,7 +9450,6 @@ def test_load_from_v26_textangular(self):
94539450
self.assertEqual(
94549451
exploration.to_yaml(), self.YAML_CONTENT_V44_IMAGE_DIMENSIONS)
94559452

9456-
94579453
def test_load_from_v27_without_image_caption(self):
94589454
"""Test direct loading from a v27 yaml file."""
94599455
mock_get_filename_with_dimensions_context = self.swap(

core/domain/exp_fetchers_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,6 @@ def test_exploration_upgrade_v34_to_latest(self):
658658
'MatchesExactlyWith': [{'x': 'x=y', 'y': 'both'}]
659659
})
660660

661-
662661
answer_groups_2 = [{
663662
'outcome': {
664663
'dest': 'Introduction',
@@ -771,7 +770,6 @@ def test_exploration_upgrade_v34_to_latest(self):
771770
'MatchesExactlyWith': [{'x': 'x+y'}]
772771
})
773772

774-
775773
answer_groups_3 = [{
776774
'outcome': {
777775
'dest': 'Introduction',
@@ -962,7 +960,6 @@ def test_exploration_upgrade_v34_to_latest(self):
962960
self.save_new_exp_with_states_schema_v34(
963961
'exp_id_4', 'owner_id', states_dict)
964962

965-
966963
# Ensure the exploration was converted.
967964
exploration = exp_fetchers.get_exploration_by_id('exp_id_4')
968965
self.assertEqual(

core/domain/exp_jobs_one_off_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,6 @@ def _mock_logging_function(msg, *args):
957957
"""Mocks logging.error()."""
958958
observed_log_messages.append(msg % args)
959959

960-
961960
exploration = exp_domain.Exploration.create_default_exploration(
962961
self.VALID_EXP_ID, title='title', category='category')
963962
exp_services.save_new_exploration(self.albert_id, exploration)
@@ -2403,7 +2402,6 @@ def test_one_off_job_handles_unicode_in_latex_strings_correctly(self):
24032402
self.assertEqual(
24042403
exp_models.ExplorationMathRichTextInfoModel.get_all().count(), 1)
24052404

2406-
24072405
def test_one_off_job_fails_with_invalid_exploration(self):
24082406
"""Test the audit job fails when there is an invalid exploration."""
24092407
exploration = exp_domain.Exploration.create_default_exploration(

core/domain/exp_services_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,6 @@ def test_cannot_get_multiple_explorations_by_version_with_invalid_handler(
10501050
'latest schema version.')):
10511051
exp_fetchers.get_multiple_explorations_by_version('exp_id_1', [1])
10521052

1053-
10541053
def test_save_multi_exploration_math_rich_text_info_model(self):
10551054
multiple_explorations_math_rich_text_info = []
10561055

@@ -3668,7 +3667,6 @@ def mock_add_documents_to_index(docs, index):
36683667
self.assertEqual(actual_docs, [updated_exp_doc])
36693668
self.assertEqual(add_docs_counter.times_called, 3)
36703669

3671-
36723670
def test_get_number_of_ratings(self):
36733671
self.save_new_valid_exploration(self.EXP_0_ID, self.owner_id)
36743672
exp = exp_fetchers.get_exploration_summary_by_id(self.EXP_0_ID)

core/domain/expression_parser_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ def test_validates_math_expression(self):
546546
self.assertTrue(expression_parser.is_valid_expression('sqrt(-1)'))
547547
self.assertTrue(expression_parser.is_valid_expression(
548548
'sqrt(-abs(-1))^2/abs(5)'))
549-
550-
551549
self.assertFalse(expression_parser.is_valid_expression('a+b/'))
552550
self.assertFalse(expression_parser.is_valid_expression('|x|'))
553551
self.assertFalse(expression_parser.is_valid_expression('||'))

core/domain/feedback_services_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def test_get_thread_summaries(self):
340340
'exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID,
341341
self.user_id, None, None, 'not used here')
342342

343-
344343
thread_ids = subscription_services.get_all_threads_subscribed_to(
345344
self.user_id)
346345
thread_ids.append('exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID)
@@ -494,7 +493,6 @@ def test_only_exploration_threads_trigger_events(self):
494493
self.assertEqual(
495494
event_handler_call_counter_exploration.times_called, 1)
496495

497-
498496
event_handler_call_counter_non_exploration = (
499497
test_utils.CallCounter(
500498
event_services.FeedbackThreadCreatedEventHandler.record))

core/domain/fs_domain.py

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def delete(self, filepath):
199199
except cloudstorage.NotFoundError:
200200
raise IOError('Image does not exist: %s' % filepath)
201201

202-
203202
def listdir(self, dir_name):
204203
"""Lists all files in a directory.
205204

core/domain/html_domain_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def test_validate_when_encoded_vertical_padding_string_not_string(self):
6363
'1d245', '4d345', 0)
6464

6565

66-
6766
class LatexStringSvgImageDataTests(test_utils.GenericTestBase):
6867

6968
def test_create_latex_string_svg_image_dimensions(self):

core/domain/html_validation_service_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,6 @@ def test_validate_svg_filenames_when_all_filenames_are_valid(self):
18631863
feconf.ENTITY_TYPE_EXPLORATION, 'exp_id1',
18641864
html_string_with_filename_having_filename), [])
18651865

1866-
18671866
def test_validate_svg_filenames_when_filenames_are_invalid(self):
18681867
"""Test the validate_svg_filenames_in_math_rich_text when
18691868
filenames are present but invalid.
@@ -1896,7 +1895,6 @@ def test_validate_svg_filenames_when_filenames_are_invalid(self):
18961895
'ot;, &amp;quot;svg_filename&amp;quot;: &amp;quot;img2.'
18971896
'svg&amp;quot;}"></oppia-noninteractive-math>')])
18981897

1899-
19001898
def test_validate_svg_filenames_when_filenames_are_not_present(self):
19011899
"""Test the validate_svg_filenames_in_math_rich_text when
19021900
filenames are not present.

core/domain/interaction_jobs_one_off_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def test_exp_state_pairs_are_produced_only_for_desired_interactions(self):
110110
state1 = exploration.states['State1']
111111
state2 = exploration.states['State2']
112112

113-
114113
customization_args_dict1 = {
115114
'choices': {'value': [{
116115
'html': '<p>This is value1 for DragAndDropSortInput</p>',

core/domain/param_domain.py

-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def __init__(self, obj_type):
4444
"""
4545
self.obj_type = obj_type
4646

47-
4847
def to_dict(self):
4948
"""Returns a dict representation of this ParamSpec.
5049
@@ -56,7 +55,6 @@ def to_dict(self):
5655
'obj_type': self.obj_type,
5756
}
5857

59-
6058
@classmethod
6159
def from_dict(cls, param_spec_dict):
6260
"""Creates a ParamSpec object from its dict representation.
@@ -72,7 +70,6 @@ def from_dict(cls, param_spec_dict):
7270
"""
7371
return cls(param_spec_dict['obj_type'])
7472

75-
7673
def validate(self):
7774
"""Validate the existence of the object class."""
7875

core/domain/platform_parameter_domain_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ def _test_flavor_relation_does_not_hold(self, version, op, flavor_b):
265265
self._create_example_context(
266266
app_version=version)))
267267

268-
269268
def test_create_from_dict_returns_correct_instance(self):
270269
filter_dict = {'type': 'app_version', 'conditions': [('=', '1.2.3')]}
271270
filter_domain = (

core/domain/prod_validation_jobs_one_off.py

-1
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,6 @@ def _validate_error(cls, item):
28912891
'Entity id %s: error for job is empty but '
28922892
'job status is %s' % (item.id, item.status_code))
28932893

2894-
28952894
@classmethod
28962895
def _validate_output(cls, item):
28972896
"""Validate output for entity is present only if status is

core/domain/prod_validation_jobs_one_off_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -8279,7 +8279,6 @@ def setUp(self):
82798279
'new_value': explorations[index * 2 + 1].id
82808280
})], 'Changes.')
82818281

8282-
82838282
self.model_instance_0 = story_models.StoryModel.get_by_id('0')
82848283
self.model_instance_1 = story_models.StoryModel.get_by_id('1')
82858284
self.model_instance_2 = story_models.StoryModel.get_by_id('2')
@@ -11844,7 +11843,6 @@ def setUp(self):
1184411843
'skill_id': '%s' % (index * 3 + 1)
1184511844
})], 'Changes.')
1184611845

11847-
1184811846
self.model_instance_0 = (
1184911847
topic_models.SubtopicPageCommitLogEntryModel.get_by_id(
1185011848
'subtopicpage-0-1-1'))

0 commit comments

Comments
 (0)