From daf7b22729fb4dd2aea03a174d78b90ed94d8aa8 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 12 Mar 2023 20:10:41 -0700 Subject: [PATCH] lint --- ngshare_exchange/course_management.py | 4 +--- ngshare_exchange/exchange.py | 4 +--- ngshare_exchange/release_assignment.py | 2 -- ngshare_exchange/tests/test_fetch_feedback.py | 4 ---- ngshare_exchange/tests/test_release_feedback.py | 1 - 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ngshare_exchange/course_management.py b/ngshare_exchange/course_management.py index 1567d9a..ca55948 100644 --- a/ngshare_exchange/course_management.py +++ b/ngshare_exchange/course_management.py @@ -7,6 +7,7 @@ import argparse from urllib.parse import quote + # https://www.geeksforgeeks.org/print-colors-python-terminal/ def prRed(skk, exit=True): print('\033[91m {}\033[00m'.format(skk)) @@ -83,7 +84,6 @@ def check_status_code(response): def check_message(response): - response = response.json() if not response['success']: prRed(response['message']) @@ -460,12 +460,10 @@ def parse_args(argv): def main(argv=None): - argv = argv or sys.argv[1:] args = parse_args(argv) args.func(args) if __name__ == '__main__': - sys.exit(main()) diff --git a/ngshare_exchange/exchange.py b/ngshare_exchange/exchange.py index 1686f01..906738e 100644 --- a/ngshare_exchange/exchange.py +++ b/ngshare_exchange/exchange.py @@ -21,7 +21,6 @@ class Exchange(ABCExchange): - username = ( os.environ['JUPYTERHUB_USER'] if 'JUPYTERHUB_USER' in os.environ @@ -38,7 +37,6 @@ class Exchange(ABCExchange): @property def ngshare_url(self): - if self._ngshare_url: return self._ngshare_url if 'PROXY_PUBLIC_SERVICE_HOST' in os.environ: @@ -190,7 +188,7 @@ def decode_dir(self, src_dir, dest_dir, ignore=None, noclobber=False): def encode_dir(self, src_dir, ignore=None): encoded_files = [] - for (subdir, dirs, files) in os.walk(src_dir): + for subdir, dirs, files in os.walk(src_dir): for file_name in files: file_path = subdir + os.sep + file_name data_bytes = open(file_path, 'rb').read() diff --git a/ngshare_exchange/release_assignment.py b/ngshare_exchange/release_assignment.py index 33a511a..5ff827c 100644 --- a/ngshare_exchange/release_assignment.py +++ b/ngshare_exchange/release_assignment.py @@ -10,7 +10,6 @@ class ExchangeReleaseAssignment(Exchange, ABCExchangeReleaseAssignment): - force = Bool( False, help='Force overwrite existing files in the exchange.' ).tag(config=True) @@ -44,7 +43,6 @@ def init_src(self): self.coursedir.assignment_id, ) if os.path.isdir(source): - # Looks like the instructor forgot to assign self.fail( 'Assignment found in "{}" but not "{}", run `nbgrader generate_assignment` first.'.format( diff --git a/ngshare_exchange/tests/test_fetch_feedback.py b/ngshare_exchange/tests/test_fetch_feedback.py index 358cde0..31e64bb 100644 --- a/ngshare_exchange/tests/test_fetch_feedback.py +++ b/ngshare_exchange/tests/test_fetch_feedback.py @@ -12,7 +12,6 @@ class TestExchangeFetchFeedback(TestExchange): - timestamp = 'some_timestamp' def _mock_bad_feedback(self): @@ -70,7 +69,6 @@ def _new_fetch_feedback( assignment_id=TestExchange.assignment_id, student_id=TestExchange.student_id, ): - retvalue = self._new_exchange_object( ExchangeFetchFeedback, course_id, assignment_id, student_id ) @@ -122,7 +120,6 @@ def test_no_course_id(self): assert issubclass(type(e), ExchangeError) def test_fetch(self): - # set chache folder submission_name = '{}+{}+{}'.format( @@ -150,7 +147,6 @@ def test_fetch(self): assert actual_file.read() == reference_file.read() def test_fetch_path_includes_course(self): - # set chache folder submission_name = '{}+{}+{}'.format( diff --git a/ngshare_exchange/tests/test_release_feedback.py b/ngshare_exchange/tests/test_release_feedback.py index 218a937..3744583 100644 --- a/ngshare_exchange/tests/test_release_feedback.py +++ b/ngshare_exchange/tests/test_release_feedback.py @@ -14,7 +14,6 @@ class TestExchangeReleaseFeedback(TestExchange): - feedback_file = '' timestamp = ''