Skip to content

Commit

Permalink
Used pycodestyle instead of custom pylint check (#10292)
Browse files Browse the repository at this point in the history
* Used pycodestyle instead of custom pylint check

* Fixed lint checks
  • Loading branch information
Hudda committed Aug 16, 2020
1 parent b8734a4 commit 11b4b44
Show file tree
Hide file tree
Showing 67 changed files with 1 addition and 266 deletions.
5 changes: 0 additions & 5 deletions core/controllers/base.py
Expand Up @@ -108,31 +108,26 @@ class NotLoggedInException(Exception):

pass


class InvalidInputException(Exception):
"""Error class for invalid input on the user side (error code 400)."""

pass


class UnauthorizedUserException(Exception):
"""Error class for unauthorized access."""

pass


class PageNotFoundException(Exception):
"""Error class for a page not found error (error code 404)."""

pass


class InternalErrorException(Exception):
"""Error class for an internal server side error (error code 500)."""

pass


class TemporaryMaintenanceException(Exception):
"""Error class for when the server is currently down for temporary
maintenance (error code 503).
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/editor_test.py
Expand Up @@ -144,7 +144,6 @@ def test_new_state_template(self):
# by validating it.
exploration.states[feconf.DEFAULT_INIT_STATE_NAME].validate(None, True)


def test_that_default_exploration_cannot_be_published(self):
"""Test that publishing a default exploration raises an error
due to failing strict validation.
Expand Down Expand Up @@ -2242,7 +2241,6 @@ def setUp(self):
'is_valid': True
}


def test_resolve_issue_handler(self):
"""Test that resolving an issue deletes associated playthroughs."""
with self.login_context(self.MODERATOR_EMAIL):
Expand Down
1 change: 0 additions & 1 deletion core/controllers/learner_playlist_test.py
Expand Up @@ -157,7 +157,6 @@ def test_add_exploration_to_learner_playlist(self):
'exp_id_%s' % exp_id), {},
csrf_token=csrf_token)


# Now if we try and add an activity we should get a message saying we
# are exceeding the limit.
response = self.post_json(
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/practice_sessions_test.py
Expand Up @@ -81,15 +81,13 @@ def test_any_user_can_access_practice_sessions_page(self):
'/learn/staging/public-topic-name/practice/session?'
'selected_subtopic_ids=1,2')


def test_no_user_can_access_unpublished_topic_practice_session_page(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
self.get_html_response(
'/learn/staging/private-topic-name/practice/session?'
'selected_subtopic_ids=1,2',
expected_status_int=404)


def test_get_fails_when_new_structures_not_enabled(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
self.get_html_response(
Expand Down
1 change: 0 additions & 1 deletion core/controllers/review_tests.py
Expand Up @@ -71,7 +71,6 @@ def get(self, story_id):
for skill in skills:
skill_descriptions[skill.id] = skill.description


self.values.update({
'skill_descriptions': skill_descriptions,
'story_name': story.title
Expand Down
1 change: 0 additions & 1 deletion core/controllers/skill_mastery.py
Expand Up @@ -64,7 +64,6 @@ def get(self):
})
self.render_json(self.values)


@acl_decorators.can_access_learner_dashboard
def put(self):
"""Handles PUT requests."""
Expand Down
1 change: 0 additions & 1 deletion core/controllers/story_viewer_test.py
Expand Up @@ -298,7 +298,6 @@ def test_post_fails_when_node_does_not_exist(self):
), {}, csrf_token=csrf_token, expected_status_int=404
)


def test_post_fails_when_story_is_not_published_in_story_mode(self):
topic_services.unpublish_story(
self.TOPIC_ID, self.STORY_ID, self.admin_id)
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/subtopic_viewer_test.py
Expand Up @@ -157,7 +157,6 @@ def test_any_user_can_access_subtopic_viewer_page(self):
self.get_html_response(
'/learn/staging/%s/revision/%s' % ('name', 'sub-url-frag-one'))


def test_accessibility_of_subtopic_viewer_page_of_unpublished_topic(
self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
Expand All @@ -171,7 +170,6 @@ def test_accessibility_of_subtopic_viewer_page_of_unpublished_topic(
% ('pvttopic', 'sub-url-frag-one'))
self.logout()


def test_get_fails_when_new_structures_not_enabled(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
self.get_html_response(
Expand Down
1 change: 0 additions & 1 deletion core/controllers/suggestion_test.py
Expand Up @@ -1267,7 +1267,6 @@ def setUp(self):
self.signup(self.AUTHOR_EMAIL, 'author')
self.signup(self.REVIEWER_EMAIL, 'reviewer')


self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL)
self.TOPIC_ID = 'topic'
self.STORY_ID = 'story'
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/topic_viewer_test.py
Expand Up @@ -115,7 +115,6 @@ def test_any_user_can_access_topic_viewer_page(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
self.get_html_response('/learn/staging/%s' % 'public')


def test_accessibility_of_unpublished_topic_viewer_page(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', True):
self.get_html_response(
Expand All @@ -125,7 +124,6 @@ def test_accessibility_of_unpublished_topic_viewer_page(self):
self.get_html_response('/learn/staging/%s' % 'private')
self.logout()


def test_get_fails_when_new_structures_not_enabled(self):
with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
self.get_html_response(
Expand Down
1 change: 0 additions & 1 deletion core/domain/activity_jobs_one_off.py
Expand Up @@ -238,7 +238,6 @@ def map(commit_model):
else:
yield ('FAILURE_INCORRECT - %s' % class_name, commit_model.id)


@staticmethod
def reduce(key, values):
"""Implements the reduce function for this job."""
Expand Down
2 changes: 0 additions & 2 deletions core/domain/collection_domain_test.py
Expand Up @@ -558,7 +558,6 @@ def test_next_explorations_in_sequence(self):
collection.get_next_exploration_id_in_sequence(exploration_id),
None)


collection.add_node('exp_id_1')
collection.add_node('exp_id_2')
self.assertEqual(
Expand Down Expand Up @@ -667,7 +666,6 @@ def test_from_yaml_with_invalid_schema_version_raises_error(self):
self.COLLECTION_ID, yaml_content)



class SchemaMigrationMethodsUnitTests(test_utils.GenericTestBase):
"""Tests the presence of appropriate schema migration methods in the
Collection domain object class.
Expand Down
3 changes: 0 additions & 3 deletions core/domain/email_manager_test.py
Expand Up @@ -2975,7 +2975,6 @@ def test_send_removed_translation_reviewer_email(self):
'Best wishes,<br>'
'The Oppia Community')


with self.can_send_emails_ctx:
email_manager.send_email_to_removed_contribution_reviewer(
self.translation_reviewer_id,
Expand Down Expand Up @@ -3021,7 +3020,6 @@ def test_send_removed_voiceover_reviewer_email(self):
'Best wishes,<br>'
'The Oppia Community')


with self.can_send_emails_ctx:
email_manager.send_email_to_removed_contribution_reviewer(
self.voiceover_reviewer_id,
Expand Down Expand Up @@ -3065,7 +3063,6 @@ def test_send_removed_question_reviewer_email(self):
'Best wishes,<br>'
'The Oppia Community')


with self.can_send_emails_ctx:
email_manager.send_email_to_removed_contribution_reviewer(
self.question_reviewer_id, constants.REVIEW_CATEGORY_QUESTION,
Expand Down
4 changes: 0 additions & 4 deletions core/domain/exp_domain_test.py
Expand Up @@ -8358,7 +8358,6 @@ def test_load_from_v41_with_text_inputs_case_sensitive_equals_rule(self):
'eid', sample_yaml_content)
self.assertEqual(exploration.to_yaml(), latest_sample_yaml_content)


def test_cannot_load_from_yaml_with_no_schema_version(self):
sample_yaml_content = (
"""author_notes: ''
Expand Down Expand Up @@ -9052,7 +9051,6 @@ class HTMLMigrationUnitTests(test_utils.GenericTestBase):
title: title
""")


YAML_CONTENT_V27_WITHOUT_IMAGE_CAPTION = (
"""author_notes: ''
auto_tts_enabled: true
Expand Down Expand Up @@ -9440,7 +9438,6 @@ class HTMLMigrationUnitTests(test_utils.GenericTestBase):
""")
# pylint: enable=line-too-long, single-line-pragma


def test_load_from_v26_textangular(self):
"""Test direct loading from a v26 yaml file."""
mock_get_filename_with_dimensions_context = self.swap(
Expand All @@ -9453,7 +9450,6 @@ def test_load_from_v26_textangular(self):
self.assertEqual(
exploration.to_yaml(), self.YAML_CONTENT_V44_IMAGE_DIMENSIONS)


def test_load_from_v27_without_image_caption(self):
"""Test direct loading from a v27 yaml file."""
mock_get_filename_with_dimensions_context = self.swap(
Expand Down
3 changes: 0 additions & 3 deletions core/domain/exp_fetchers_test.py
Expand Up @@ -658,7 +658,6 @@ def test_exploration_upgrade_v34_to_latest(self):
'MatchesExactlyWith': [{'x': 'x=y', 'y': 'both'}]
})


answer_groups_2 = [{
'outcome': {
'dest': 'Introduction',
Expand Down Expand Up @@ -771,7 +770,6 @@ def test_exploration_upgrade_v34_to_latest(self):
'MatchesExactlyWith': [{'x': 'x+y'}]
})


answer_groups_3 = [{
'outcome': {
'dest': 'Introduction',
Expand Down Expand Up @@ -962,7 +960,6 @@ def test_exploration_upgrade_v34_to_latest(self):
self.save_new_exp_with_states_schema_v34(
'exp_id_4', 'owner_id', states_dict)


# Ensure the exploration was converted.
exploration = exp_fetchers.get_exploration_by_id('exp_id_4')
self.assertEqual(
Expand Down
2 changes: 0 additions & 2 deletions core/domain/exp_jobs_one_off_test.py
Expand Up @@ -957,7 +957,6 @@ def _mock_logging_function(msg, *args):
"""Mocks logging.error()."""
observed_log_messages.append(msg % args)


exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exp_services.save_new_exploration(self.albert_id, exploration)
Expand Down Expand Up @@ -2403,7 +2402,6 @@ def test_one_off_job_handles_unicode_in_latex_strings_correctly(self):
self.assertEqual(
exp_models.ExplorationMathRichTextInfoModel.get_all().count(), 1)


def test_one_off_job_fails_with_invalid_exploration(self):
"""Test the audit job fails when there is an invalid exploration."""
exploration = exp_domain.Exploration.create_default_exploration(
Expand Down
2 changes: 0 additions & 2 deletions core/domain/exp_services_test.py
Expand Up @@ -1050,7 +1050,6 @@ def test_cannot_get_multiple_explorations_by_version_with_invalid_handler(
'latest schema version.')):
exp_fetchers.get_multiple_explorations_by_version('exp_id_1', [1])


def test_save_multi_exploration_math_rich_text_info_model(self):
multiple_explorations_math_rich_text_info = []

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


def test_get_number_of_ratings(self):
self.save_new_valid_exploration(self.EXP_0_ID, self.owner_id)
exp = exp_fetchers.get_exploration_summary_by_id(self.EXP_0_ID)
Expand Down
2 changes: 0 additions & 2 deletions core/domain/expression_parser_test.py
Expand Up @@ -546,8 +546,6 @@ def test_validates_math_expression(self):
self.assertTrue(expression_parser.is_valid_expression('sqrt(-1)'))
self.assertTrue(expression_parser.is_valid_expression(
'sqrt(-abs(-1))^2/abs(5)'))


self.assertFalse(expression_parser.is_valid_expression('a+b/'))
self.assertFalse(expression_parser.is_valid_expression('|x|'))
self.assertFalse(expression_parser.is_valid_expression('||'))
Expand Down
2 changes: 0 additions & 2 deletions core/domain/feedback_services_test.py
Expand Up @@ -340,7 +340,6 @@ def test_get_thread_summaries(self):
'exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID,
self.user_id, None, None, 'not used here')


thread_ids = subscription_services.get_all_threads_subscribed_to(
self.user_id)
thread_ids.append('exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID)
Expand Down Expand Up @@ -494,7 +493,6 @@ def test_only_exploration_threads_trigger_events(self):
self.assertEqual(
event_handler_call_counter_exploration.times_called, 1)


event_handler_call_counter_non_exploration = (
test_utils.CallCounter(
event_services.FeedbackThreadCreatedEventHandler.record))
Expand Down
1 change: 0 additions & 1 deletion core/domain/fs_domain.py
Expand Up @@ -199,7 +199,6 @@ def delete(self, filepath):
except cloudstorage.NotFoundError:
raise IOError('Image does not exist: %s' % filepath)


def listdir(self, dir_name):
"""Lists all files in a directory.
Expand Down
1 change: 0 additions & 1 deletion core/domain/html_domain_test.py
Expand Up @@ -63,7 +63,6 @@ def test_validate_when_encoded_vertical_padding_string_not_string(self):
'1d245', '4d345', 0)



class LatexStringSvgImageDataTests(test_utils.GenericTestBase):

def test_create_latex_string_svg_image_dimensions(self):
Expand Down
2 changes: 0 additions & 2 deletions core/domain/html_validation_service_test.py
Expand Up @@ -1863,7 +1863,6 @@ def test_validate_svg_filenames_when_all_filenames_are_valid(self):
feconf.ENTITY_TYPE_EXPLORATION, 'exp_id1',
html_string_with_filename_having_filename), [])


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


def test_validate_svg_filenames_when_filenames_are_not_present(self):
"""Test the validate_svg_filenames_in_math_rich_text when
filenames are not present.
Expand Down
1 change: 0 additions & 1 deletion core/domain/interaction_jobs_one_off_test.py
Expand Up @@ -110,7 +110,6 @@ def test_exp_state_pairs_are_produced_only_for_desired_interactions(self):
state1 = exploration.states['State1']
state2 = exploration.states['State2']


customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSortInput</p>',
Expand Down
3 changes: 0 additions & 3 deletions core/domain/param_domain.py
Expand Up @@ -44,7 +44,6 @@ def __init__(self, obj_type):
"""
self.obj_type = obj_type


def to_dict(self):
"""Returns a dict representation of this ParamSpec.
Expand All @@ -56,7 +55,6 @@ def to_dict(self):
'obj_type': self.obj_type,
}


@classmethod
def from_dict(cls, param_spec_dict):
"""Creates a ParamSpec object from its dict representation.
Expand All @@ -72,7 +70,6 @@ def from_dict(cls, param_spec_dict):
"""
return cls(param_spec_dict['obj_type'])


def validate(self):
"""Validate the existence of the object class."""

Expand Down
1 change: 0 additions & 1 deletion core/domain/platform_parameter_domain_test.py
Expand Up @@ -265,7 +265,6 @@ def _test_flavor_relation_does_not_hold(self, version, op, flavor_b):
self._create_example_context(
app_version=version)))


def test_create_from_dict_returns_correct_instance(self):
filter_dict = {'type': 'app_version', 'conditions': [('=', '1.2.3')]}
filter_domain = (
Expand Down
1 change: 0 additions & 1 deletion core/domain/prod_validation_jobs_one_off.py
Expand Up @@ -2891,7 +2891,6 @@ def _validate_error(cls, item):
'Entity id %s: error for job is empty but '
'job status is %s' % (item.id, item.status_code))


@classmethod
def _validate_output(cls, item):
"""Validate output for entity is present only if status is
Expand Down
2 changes: 0 additions & 2 deletions core/domain/prod_validation_jobs_one_off_test.py
Expand Up @@ -8279,7 +8279,6 @@ def setUp(self):
'new_value': explorations[index * 2 + 1].id
})], 'Changes.')


self.model_instance_0 = story_models.StoryModel.get_by_id('0')
self.model_instance_1 = story_models.StoryModel.get_by_id('1')
self.model_instance_2 = story_models.StoryModel.get_by_id('2')
Expand Down Expand Up @@ -11844,7 +11843,6 @@ def setUp(self):
'skill_id': '%s' % (index * 3 + 1)
})], 'Changes.')


self.model_instance_0 = (
topic_models.SubtopicPageCommitLogEntryModel.get_by_id(
'subtopicpage-0-1-1'))
Expand Down

0 comments on commit 11b4b44

Please sign in to comment.