Fix PEP8: E303 too many blank lines
This commit is contained in:
@@ -333,7 +333,6 @@ def get_codemirror_value(index=0, find_prefix="$"):
|
||||
)
|
||||
|
||||
|
||||
|
||||
def attach_file(filename, sub_path):
|
||||
path = os.path.join(TEST_ROOT, sub_path, filename)
|
||||
world.browser.execute_script("$('input.file-input').css('display', 'block')")
|
||||
|
||||
@@ -161,7 +161,6 @@ class TestDownloadYoutubeSubs(ModuleStoreTestCase):
|
||||
number = '999'
|
||||
display_name = 'Test course'
|
||||
|
||||
|
||||
def clear_sub_content(self, subs_id):
|
||||
"""
|
||||
Remove, if subtitle content exists.
|
||||
@@ -490,7 +489,6 @@ class TestTranscript(unittest.TestCase):
|
||||
|
||||
""")
|
||||
|
||||
|
||||
self.sjson_transcript = textwrap.dedent("""\
|
||||
{
|
||||
"start": [
|
||||
|
||||
@@ -100,7 +100,6 @@ def _course_team_user(request, course_key, email):
|
||||
}
|
||||
return JsonResponse(msg, 400)
|
||||
|
||||
|
||||
try:
|
||||
user = User.objects.get(email=email)
|
||||
except Exception:
|
||||
|
||||
@@ -150,7 +150,6 @@ class CourseModeViewTest(ModuleStoreTestCase):
|
||||
response = self.client.get(choose_track_url)
|
||||
self.assertRedirects(response, reverse('dashboard'))
|
||||
|
||||
|
||||
# Mapping of course modes to the POST parameters sent
|
||||
# when the user chooses that mode.
|
||||
POST_PARAMS_FOR_COURSE_MODE = {
|
||||
|
||||
@@ -144,7 +144,6 @@ class DarkLangMiddlewareTests(TestCase):
|
||||
self.process_request(accept='rel-ter;q=1.0, rel;q=0.5')
|
||||
)
|
||||
|
||||
|
||||
def assertSessionLangEquals(self, value, request):
|
||||
"""
|
||||
Assert that the 'django_language' set in request.session is equal to value
|
||||
|
||||
@@ -34,7 +34,6 @@ class MakoLoader(object):
|
||||
|
||||
self.module_directory = module_directory
|
||||
|
||||
|
||||
def __call__(self, template_name, template_dirs=None):
|
||||
return self.load_template(template_name, template_dirs)
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ class TestStatus(TestCase):
|
||||
"edX/toy/2012_Fall" : "A toy story"
|
||||
}"""
|
||||
|
||||
|
||||
# json to use, expected results for course=None (e.g. homepage),
|
||||
# for toy course, for full course. Note that get_site_status_msg
|
||||
# is supposed to return global message even if course=None. The
|
||||
|
||||
@@ -18,12 +18,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('student', ['DashboardConfiguration'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'DashboardConfiguration'
|
||||
db.delete_table('student_dashboardconfiguration')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -300,7 +300,6 @@ class StubOraHandler(StubHttpRequestHandler):
|
||||
"""
|
||||
self._success_response({'problem_list': self.server.problem_list})
|
||||
|
||||
|
||||
@require_params('POST', 'grader_id', 'location', 'submission_id', 'score', 'feedback', 'submission_key')
|
||||
def _save_grade(self):
|
||||
"""
|
||||
@@ -421,7 +420,6 @@ class StubOraHandler(StubHttpRequestHandler):
|
||||
)
|
||||
self.send_response(400)
|
||||
|
||||
|
||||
def _student(self, method, key='student_id'):
|
||||
"""
|
||||
Return the `StudentState` instance for the student ID given
|
||||
|
||||
@@ -165,7 +165,6 @@ class CorrectMap(object):
|
||||
self.cmap.update(other_cmap.get_dict())
|
||||
self.set_overall_message(other_cmap.get_overall_message())
|
||||
|
||||
|
||||
def set_overall_message(self, message_str):
|
||||
""" Set a message that applies to the question as a whole,
|
||||
rather than to individual inputs. """
|
||||
|
||||
@@ -50,7 +50,6 @@ class MathRenderer(object):
|
||||
mathstr = mathstr.replace(r'\displaystyle', '')
|
||||
self.mathstr = mathstr.replace('mathjaxinline]', '%s]' % mtag)
|
||||
|
||||
|
||||
def get_html(self):
|
||||
"""
|
||||
Return the contents of this tag, rendered to html, as an etree element.
|
||||
|
||||
@@ -839,7 +839,6 @@ class MatlabInput(CodeInput):
|
||||
'No response from Xqueue within {xqueue_timeout} seconds. Aborted.'
|
||||
).format(xqueue_timeout=XQUEUE_TIMEOUT)
|
||||
|
||||
|
||||
def handle_ajax(self, dispatch, data):
|
||||
"""
|
||||
Handle AJAX calls directed to this input
|
||||
|
||||
@@ -604,7 +604,6 @@ class MatlabTest(unittest.TestCase):
|
||||
the_input = self.input_class(test_capa_system(), elt, state)
|
||||
self.assertEqual(the_input.status, 'queued')
|
||||
|
||||
|
||||
@patch('capa.inputtypes.time.time', return_value=45)
|
||||
def test_matlab_response_timeout_exceeded(self, time):
|
||||
|
||||
|
||||
@@ -606,7 +606,6 @@ class StringResponseTest(ResponseTest):
|
||||
self.assert_grade(problem, u"î", "incorrect")
|
||||
self.assert_grade(problem, u"o", "incorrect")
|
||||
|
||||
|
||||
def test_backslash_and_unicode_regexps(self):
|
||||
"""
|
||||
Test some special cases of [unicode] regexps.
|
||||
@@ -1042,8 +1041,6 @@ class CodeResponseTest(ResponseTest):
|
||||
self.assertEquals(output[answer_id]['msg'], u'Invalid grader reply. Please contact the course staff.')
|
||||
|
||||
|
||||
|
||||
|
||||
class ChoiceResponseTest(ResponseTest):
|
||||
from capa.tests.response_xml_factory import ChoiceResponseXMLFactory
|
||||
xml_factory_class = ChoiceResponseXMLFactory
|
||||
|
||||
@@ -82,7 +82,6 @@ class UtilTest(unittest.TestCase):
|
||||
result = compare_with_tolerance(infinity, infinity, '1.0', False)
|
||||
self.assertTrue(result)
|
||||
|
||||
|
||||
def test_sanitize_html(self):
|
||||
"""
|
||||
Test for html sanitization with bleach.
|
||||
|
||||
@@ -192,7 +192,6 @@ def _render_to_html(tree):
|
||||
return children.replace(' ', '')
|
||||
|
||||
|
||||
|
||||
def render_to_html(eq):
|
||||
'''
|
||||
Render a chemical equation string to html.
|
||||
@@ -231,7 +230,6 @@ def render_to_html(eq):
|
||||
# only one side
|
||||
return spanify(render_expression(left))
|
||||
|
||||
|
||||
return spanify(render_expression(left) + render_arrow(arrow) + render_expression(right))
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ class Test_Compare_Equations(unittest.TestCase):
|
||||
self.assertFalse(chemical_equations_equal('H2O( -> H2O2',
|
||||
'H2O -> H2O2'))
|
||||
|
||||
|
||||
self.assertFalse(chemical_equations_equal('H2 + O2 ==> H2O2', # strange arrow
|
||||
'2O2 + 2H2 -> 2H2O2'))
|
||||
|
||||
|
||||
@@ -257,7 +257,6 @@ class formula(object):
|
||||
|
||||
fix_pmathml(xml)
|
||||
|
||||
|
||||
def fix_hat(xml):
|
||||
"""
|
||||
hat i is turned into <mover><mi>i</mi><mo>^</mo></mover> ; mangle
|
||||
|
||||
@@ -48,7 +48,6 @@ class HeartbeatFailure(Exception):
|
||||
def __unicode__(self, *args, **kwargs):
|
||||
return self.message
|
||||
|
||||
|
||||
def __init__(self, msg, service):
|
||||
"""
|
||||
In addition to a msg, provide the name of the service.
|
||||
|
||||
@@ -752,7 +752,6 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
|
||||
log.debug("[LTI]: Incorrect action.")
|
||||
return Response(response_xml_template.format(**unsupported_values), content_type='application/xml')
|
||||
|
||||
|
||||
@classmethod
|
||||
def parse_grade_xml_body(cls, body):
|
||||
"""
|
||||
|
||||
@@ -14,7 +14,6 @@ class BlockKey(namedtuple('BlockKey', 'type id')):
|
||||
def __new__(cls, type, id):
|
||||
return super(BlockKey, cls).__new__(cls, type, id)
|
||||
|
||||
|
||||
@classmethod
|
||||
@contract(usage_key=BlockUsageLocator)
|
||||
def from_usage_key(cls, usage_key):
|
||||
|
||||
@@ -38,7 +38,6 @@ class SplitMongoKVS(InheritanceKeyValueStore):
|
||||
|
||||
self.parent = parent
|
||||
|
||||
|
||||
def get(self, key):
|
||||
# load the field, if needed
|
||||
if key.field_name not in self._fields:
|
||||
|
||||
@@ -115,7 +115,6 @@ class ModuleStoreSettingsMigration(TestCase):
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def assertStoreValuesEqual(self, store_setting1, store_setting2):
|
||||
"""
|
||||
Tests whether the fields in the given store_settings are equal.
|
||||
|
||||
@@ -188,7 +188,6 @@ def adapt_references(subtree, destination_course_key, export_fs):
|
||||
)
|
||||
|
||||
|
||||
|
||||
def _export_field_content(xblock_item, item_dir):
|
||||
"""
|
||||
Export all fields related to 'xblock_item' other than 'metadata' and 'data' to json file in provided directory
|
||||
|
||||
@@ -77,7 +77,6 @@ class RandomizeModule(RandomizeFields, XModule):
|
||||
|
||||
return [self.child_descriptor]
|
||||
|
||||
|
||||
def student_view(self, context):
|
||||
if self.child is None:
|
||||
# raise error instead? In fact, could complain on descriptor load...
|
||||
@@ -95,7 +94,6 @@ class RandomizeDescriptor(RandomizeFields, SequenceDescriptor):
|
||||
|
||||
filename_extension = "xml"
|
||||
|
||||
|
||||
def definition_to_xml(self, resource_fs):
|
||||
|
||||
xml_object = etree.Element('randomize')
|
||||
|
||||
@@ -60,7 +60,6 @@ class CustomTagDescriptor(RawDescriptor):
|
||||
template = Template(template_module_data)
|
||||
return template.render(**params)
|
||||
|
||||
|
||||
@property
|
||||
def rendered_html(self):
|
||||
return self.render_template(self.system, self.data)
|
||||
|
||||
@@ -22,7 +22,6 @@ class TestBulkAssertionTestCase(BulkAssertionTest):
|
||||
def test_passing_asserts_passthrough(self, assertion, *args):
|
||||
getattr(self, assertion)(*args)
|
||||
|
||||
|
||||
@ddt.data(
|
||||
('assertTrue', False),
|
||||
('assertFalse', True),
|
||||
|
||||
@@ -1395,7 +1395,6 @@ class CapaModuleTest(unittest.TestCase):
|
||||
Run the test for each possible rerandomize value
|
||||
"""
|
||||
|
||||
|
||||
def _reset_and_get_seed(module):
|
||||
"""
|
||||
Reset the XModule and return the module's seed
|
||||
|
||||
@@ -150,7 +150,6 @@ class ImportTestCase(BaseCourseTestCase):
|
||||
|
||||
self.assertNotEqual(descriptor1.location, descriptor2.location)
|
||||
|
||||
|
||||
def test_reimport(self):
|
||||
'''Make sure an already-exported error xml tag loads properly'''
|
||||
|
||||
|
||||
@@ -211,7 +211,6 @@ class XModuleMixin(XBlockMixin):
|
||||
def runtime(self, value):
|
||||
self._runtime = value
|
||||
|
||||
|
||||
@property
|
||||
def system(self):
|
||||
"""
|
||||
@@ -719,7 +718,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
|
||||
entry_point = "xmodule.v1"
|
||||
module_class = XModule
|
||||
|
||||
|
||||
# VS[compat]. Backwards compatibility code that can go away after
|
||||
# importing 2012 courses.
|
||||
# A set of metadata key conversions that we want to make
|
||||
@@ -835,7 +833,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
# =============================== BUILTIN METHODS ==========================
|
||||
def __eq__(self, other):
|
||||
return (self.scope_ids == other.scope_ids and
|
||||
|
||||
@@ -29,7 +29,6 @@ class AnnotatableProblemTest(UniqueCourseTest):
|
||||
USERNAME = "STAFF_TESTER"
|
||||
EMAIL = "johndoe@example.com"
|
||||
|
||||
|
||||
DATA_TEMPLATE = dedent("""\
|
||||
<annotatable>
|
||||
<instructions>Instruction text</instructions>
|
||||
|
||||
@@ -86,7 +86,6 @@ def cleanup(filepath, remove_meta):
|
||||
if attr in attrs:
|
||||
del attrs[attr]
|
||||
|
||||
|
||||
with open(filepath, "w") as f:
|
||||
f.write(etree.tostring(xml))
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ from path import path
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
|
||||
|
||||
sys.path.append('../../../../')
|
||||
|
||||
from docs.shared.conf import *
|
||||
@@ -188,7 +187,6 @@ def strip_tags(html):
|
||||
return s.get_data()
|
||||
|
||||
|
||||
|
||||
def process_docstring(app, what, name, obj, options, lines):
|
||||
"""Autodoc django models"""
|
||||
|
||||
|
||||
@@ -179,7 +179,6 @@ def strip_tags(html):
|
||||
return s.get_data()
|
||||
|
||||
|
||||
|
||||
def process_docstring(app, what, name, obj, options, lines):
|
||||
"""Autodoc django models"""
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ def add_base(paths):
|
||||
return [os.path.join(BASEDIR, x) for x in paths]
|
||||
|
||||
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
||||
@@ -21,7 +21,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.CharField')(max_length=255, null=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
# Changing field 'CourseEmail.course_id'
|
||||
db.alter_column('bulk_email_courseemail', 'course_id', self.gf('xmodule_django.models.CourseKeyField')(max_length=255))
|
||||
# Adding field 'CourseEmailTemplate.name'
|
||||
@@ -29,7 +28,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
# Changing field 'CourseAuthorization.course_id'
|
||||
db.alter_column('bulk_email_courseauthorization', 'course_id', self.gf('xmodule_django.models.CourseKeyField')(unique=True, max_length=255))
|
||||
|
||||
@@ -43,13 +41,11 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'CourseEmail.from_addr'
|
||||
db.delete_column('bulk_email_courseemail', 'from_addr')
|
||||
|
||||
|
||||
# Changing field 'CourseEmail.course_id'
|
||||
db.alter_column('bulk_email_courseemail', 'course_id', self.gf('django.db.models.fields.CharField')(max_length=255))
|
||||
# Deleting field 'CourseEmailTemplate.name'
|
||||
db.delete_column('bulk_email_courseemailtemplate', 'name')
|
||||
|
||||
|
||||
# Changing field 'CourseAuthorization.course_id'
|
||||
db.alter_column('bulk_email_courseauthorization', 'course_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True))
|
||||
|
||||
|
||||
@@ -238,7 +238,6 @@ class StorageTestBase(object):
|
||||
self.field_data_cache = FieldDataCache([self.mock_descriptor], course_id, self.user)
|
||||
self.kvs = DjangoKeyValueStore(self.field_data_cache)
|
||||
|
||||
|
||||
def test_set_and_get_existing_field(self):
|
||||
self.kvs.set(self.key_factory('existing_field'), 'test_value')
|
||||
self.assertEquals('test_value', self.kvs.get(self.key_factory('existing_field')))
|
||||
|
||||
@@ -98,7 +98,6 @@ class Command(BaseCommand):
|
||||
|
||||
name = raw_input('Full name: ')
|
||||
|
||||
|
||||
user = User(username=uname, email=email, is_active=True)
|
||||
user.set_password(password)
|
||||
try:
|
||||
|
||||
@@ -147,7 +147,6 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
|
||||
else:
|
||||
html += '<ul><li>%s</li></ul>' % escape(data)
|
||||
|
||||
|
||||
#----------------------------------------
|
||||
|
||||
html += '<hr width="100%"/>'
|
||||
|
||||
@@ -144,7 +144,6 @@ def ajax_status(request):
|
||||
if not request.user.is_authenticated():
|
||||
raise PermissionDenied
|
||||
|
||||
|
||||
qs = UserPreference.objects.filter(
|
||||
user=request.user,
|
||||
key=NOTIFICATION_PREF_KEY
|
||||
|
||||
@@ -16,12 +16,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('shoppingcart', ['Donation'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'Donation'
|
||||
db.delete_table('shoppingcart_donation')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -17,12 +17,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('shoppingcart', ['DonationConfiguration'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'DonationConfiguration'
|
||||
db.delete_table('shoppingcart_donationconfiguration')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -59,7 +59,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.CharField')(default='personal', max_length=32),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'CourseRegCodeItem'
|
||||
db.delete_table('shoppingcart_courseregcodeitem')
|
||||
@@ -88,7 +87,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'Order.order_type'
|
||||
db.delete_column('shoppingcart_order', 'order_type')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -18,7 +18,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'OrderItem.created'
|
||||
db.delete_column('shoppingcart_orderitem', 'created')
|
||||
@@ -26,7 +25,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'OrderItem.modified'
|
||||
db.delete_column('shoppingcart_orderitem', 'modified')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -263,7 +263,6 @@ class CyberSourceTests(TestCase):
|
||||
# finally, tests an accepted order
|
||||
self.assertTrue(payment_accepted(params)['accepted'])
|
||||
|
||||
|
||||
@patch('shoppingcart.processors.CyberSource.render_to_string', autospec=True)
|
||||
def test_render_purchase_form_html(self, render):
|
||||
"""
|
||||
|
||||
@@ -310,7 +310,6 @@ class PhotoVerification(StatusModel):
|
||||
|
||||
return (status, error_msg)
|
||||
|
||||
|
||||
def parsed_error_msg(self):
|
||||
"""
|
||||
Sometimes, the error message we've received needs to be parsed into
|
||||
@@ -777,7 +776,6 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
|
||||
|
||||
return header_txt + "\n\n" + body_txt
|
||||
|
||||
|
||||
def send_request(self):
|
||||
"""
|
||||
Assembles a submission to Software Secure and sends it via HTTPS.
|
||||
|
||||
@@ -9,7 +9,6 @@ import paver.easy
|
||||
from paver.easy import BuildFailure
|
||||
|
||||
|
||||
|
||||
class TestGetReportFiles(unittest.TestCase):
|
||||
"""
|
||||
Ensure only the report files we want are returned as part of run_quality.
|
||||
|
||||
@@ -95,7 +95,6 @@ class AcceptanceTestSuite(TestSuite):
|
||||
if not self.fasttest:
|
||||
self._setup_acceptance_db()
|
||||
|
||||
|
||||
def _setup_acceptance_db(self):
|
||||
"""
|
||||
TODO: Improve the following
|
||||
|
||||
Reference in New Issue
Block a user