From f4a2b0c888c4414bc92fd750fe31e611b8a6e169 Mon Sep 17 00:00:00 2001
From: Timo <timotei96@gmail.com>
Date: Tue, 28 May 2019 17:11:04 +0200
Subject: [PATCH] Fixed lint errors

---
 client/views/Exam.jsx  | 26 +++++++++++++-------------
 tests/test_database.py |  6 +++---
 zesje/api/emails.py    | 40 ++++++++++++++++++++--------------------
 zesje/emails.py        |  2 +-
 4 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/client/views/Exam.jsx b/client/views/Exam.jsx
index 8c89effb..593cf78e 100644
--- a/client/views/Exam.jsx
+++ b/client/views/Exam.jsx
@@ -63,15 +63,15 @@ class Exams extends React.Component {
         previewing: false
       }
     }
-    if(prevState.problemIdToEditFeedbackOf && !prevState.editActive) {
-      if(prevState.waitForNextRender) {
+    if (prevState.problemIdToEditFeedbackOf && !prevState.editActive) {
+      if (prevState.waitForNextRender) {
         var problem = newProps.exam.problems.find(w => {
-          return w.widget.id == prevState.problemIdToEditFeedbackOf
+          return w.widget.id === prevState.problemIdToEditFeedbackOf
         })
         prevState.widgets[problem.widget.id].problem.feedback = problem.feedback
         prevState.waitForNextRender = false
-        if(!prevState.editActive) prevState.problemIdToEditFeedbackOf = null
-      } else prevState.waitForNextRender = true 
+        if (!prevState.editActive) prevState.problemIdToEditFeedbackOf = null
+      } else prevState.waitForNextRender = true
     }
     return prevState
   }
@@ -85,7 +85,7 @@ class Exams extends React.Component {
     if (prevState.selectedWidgetId !== this.state.selectedWidgetId) {
       this.saveProblemName()
       this.setState({
-        editActive:false,
+        editActive: false,
         problemIdToEditFeedbackOf: false
       })
     }
@@ -343,19 +343,19 @@ class Exams extends React.Component {
                       props.saveProblemName(e.target.value)
                     }} />
                 </div>
-                <br/>
+                <br />
                 {!this.state.editActive && <label className='label'>Feedback options</label>}
               </React.Fragment>
             )}
           </div>
         </div>
         {this.isProblemWidget(selectedWidgetId) && (this.state.editActive
-            ? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
-              goBack={this.backToFeedback} />
-            : <FeedbackPanel examID={this.props.examID} problem={props.problem}
-              editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
-              grading={false}
-        />)}
+          ? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
+            goBack={this.backToFeedback} />
+          : <FeedbackPanel examID={this.props.examID} problem={props.problem}
+            editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
+            grading={false}
+          />)}
         <div className='panel-block'>
           <button
             disabled={props.disabledDelete}
diff --git a/tests/test_database.py b/tests/test_database.py
index c7b99fc9..c890a188 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -13,11 +13,11 @@ def test_exam_generate_token_length_uppercase(duplicate_count, monkeypatch):
             self.duplicates = duplicate_count + 1
 
         def filter(self, *args):
-                return self
+            return self
 
         def first(self):
-                self.duplicates -= 1
-                return None if self.duplicates else True
+            self.duplicates -= 1
+            return None if self.duplicates else True
 
     app = Flask(__name__, static_folder=None)
     app.config.update(
diff --git a/zesje/api/emails.py b/zesje/api/emails.py
index 60039da2..408657ad 100644
--- a/zesje/api/emails.py
+++ b/zesje/api/emails.py
@@ -57,27 +57,27 @@ def render_email(exam_id, student_id, template):
 
 
 def build_email(exam_id, student_id, template, attach, from_address, copy_to=None):
-        student = Student.query.get(student_id)
-        if student is None:
-            abort(
-                404,
-                message=f"Student #{student_id} does not exist"
-            )
-        if not student.email:
-            abort(
-                409,
-                message=f'Student #{student_id} has no email address'
-            )
-
-        return emails.build(
-            student.email,
-            render_email(exam_id, student_id, template),
-            emails.build_solution_attachment(exam_id, student_id)
-            if attach
-            else None,
-            copy_to=copy_to,
-            email_from=from_address,
+    student = Student.query.get(student_id)
+    if student is None:
+        abort(
+            404,
+            message=f"Student #{student_id} does not exist"
         )
+    if not student.email:
+        abort(
+            409,
+            message=f'Student #{student_id} has no email address'
+        )
+
+    return emails.build(
+        student.email,
+        render_email(exam_id, student_id, template),
+        emails.build_solution_attachment(exam_id, student_id)
+        if attach
+        else None,
+        copy_to=copy_to,
+        email_from=from_address,
+    )
 
 
 class EmailTemplate(Resource):
diff --git a/zesje/emails.py b/zesje/emails.py
index 21295208..8e357160 100644
--- a/zesje/emails.py
+++ b/zesje/emails.py
@@ -103,7 +103,7 @@ def send(
     server_type = smtplib.SMTP_SSL if use_ssl else smtplib.SMTP
     with server_type(server, port) as s:
         if user and password:
-                s.login(user, password)
+            s.login(user, password)
         for identifier, message in messages.items():
             recipients = [
                 *message['To'].split(','),
-- 
GitLab