Repository: sralloza/vcm

Issue:
download function argument should be named `killer`, not `no_killer`

Comments:

Patch:
diff --git a/README.md b/README.md
index 733f006..27ff1f0 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
 <h2 align="center">Virtual Campus Manager</h2>
 
 <p align="center">
-<a href="https://github.com/sralloza/vcm/actions"><img alt="build" src="https://github.com/sralloza/vcm/workflows/Python application/badge.svg?branch=test-coverage"></a>
-<a href="https://codecov.io/gh/sralloza/vcm/branch/test-coverage"><img alt="coverage" src="https://codecov.io/github/sralloza/vcm/coverage.svg?branch=test-coverage"></a>
+<a href="https://github.com/sralloza/vcm/actions"><img alt="build" src="https://github.com/sralloza/vcm/workflows/Python application/badge.svg"></a>
+<a href="https://codecov.io/gh/sralloza/vcm/branch/test-coverage"><img alt="coverage" src="https://codecov.io/github/sralloza/vcm/coverage.svg"></a>
 <a href="https://github.com/sralloza/vcm/blob/master/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
 </p>
 
diff --git a/vcm/core/workers.py b/vcm/core/workers.py
index d394e74..12fdfbc 100644
--- a/vcm/core/workers.py
+++ b/vcm/core/workers.py
@@ -7,6 +7,7 @@ import sys
 from threading import Event, Thread
 from threading import enumerate as enumerate_threads
 from time import time
+from typing import List
 
 from colorama import Fore
 
@@ -252,21 +253,21 @@ class Killer(Worker):
                 open_http_status_server()
 
 
-def start_workers(queue, nthreads=20, no_killer=False):
+def start_workers(queue, nthreads=20, killer=True) -> List[Worker]:
     """Starts the wokers.
 
     Args:
         queue (Queue): queue to manage the workers's tasks.
         nthreads (int): number of trheads to start.
-        no_killer (bool): if true, killer thread will not be started.
+        killer (bool): if True, killer thread will be started.
 
     Returns:
-
+        List[Worker]: list of started threads.
     """
 
     thread_list = []
 
-    if no_killer is False:
+    if killer is True:
         killer = Killer(queue)
         killer.start()
         thread_list.append(killer)
diff --git a/vcm/downloader/__init__.py b/vcm/downloader/__init__.py
index 6bd000a..22b187f 100644
--- a/vcm/downloader/__init__.py
+++ b/vcm/downloader/__init__.py
@@ -72,13 +72,13 @@ def find_subjects(queue, discover_only=False):
 
 
 @timing(name="VCM downloader")
-def download(nthreads=20, no_killer=False, status_server=True, discover_only=False):
+def download(nthreads=20, killer=True, status_server=True, discover_only=False):
     """
 
     Args:
         nthreads (int, optional): number of threads to use. Defaults to 20.
-        no_killer (bool, optional): if True, an extra thread will be launched
-            to detect key pressings, shuch as K for kill the app. Defaults to False.
+        killer (bool, optional): if True, an extra thread will be launched
+            to detect key pressings, shuch as K for kill the app. Defaults to True.
         status_server (bool, optional): if true, a http server will be opened
             in port 80 to show the status of each thread. Defaults to True.
         discover_only (bool, optional): if true, it will only discover the subjects,
@@ -87,9 +87,9 @@ def download(nthreads=20, no_killer=False, status_server=True, discover_only=Fal
 
     logger = logging.getLogger(__name__)
     logger.info(
-        "Launching notify(nthreads=%r, no_killer=%s, status_server=%s, discover_only=%s)",
+        "Launching notify(nthreads=%r, killer=%s, status_server=%s, discover_only=%s)",
         nthreads,
-        no_killer,
+        killer,
         status_server,
         discover_only,
     )
@@ -98,7 +98,7 @@ def download(nthreads=20, no_killer=False, status_server=True, discover_only=Fal
     init_colorama()
 
     queue = Queue()
-    threads = start_workers(queue, nthreads, no_killer=no_killer)
+    threads = start_workers(queue, nthreads, killer=killer)
 
     if status_server:
         runserver(queue, threads)
diff --git a/vcm/main.py b/vcm/main.py
index 0d4b710..3588562 100644
--- a/vcm/main.py
+++ b/vcm/main.py
@@ -175,7 +175,7 @@ def execute_discover(opt):  # pylint: disable=W0613
     """
 
     Printer.silence()
-    return download(nthreads=1, no_killer=True, status_server=False, discover_only=True)
+    return download(nthreads=1, killer=False, status_server=False, discover_only=True)
 
 
 def execute_download(opt):
@@ -190,7 +190,7 @@ def execute_download(opt):
 
     return download(
         nthreads=opt.nthreads,
-        no_killer=opt.no_killer,
+        killer=not opt.no_killer,
         status_server=not opt.no_status_server,
     )
 


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
index d03bd3e..e1fa18b 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -443,7 +443,7 @@ def test_execute_discover(silence_m, download_m):
 
     silence_m.assert_called_once_with()
     download_m.assert_called_once_with(
-        nthreads=1, no_killer=True, status_server=False, discover_only=True
+        nthreads=1, killer=False, status_server=False, discover_only=True
     )
 
 
@@ -466,17 +466,17 @@ class TestExecuteDownload:
         return request.param
 
     @pytest.fixture(params=[True, False])
-    def no_killer(self, request):
+    def killer(self, request):
         return request.param
 
     @pytest.fixture(params=[1, 5, 10, 15, 20])
     def nthreads(self, request):
         return request.param
 
-    def test_execute_download(self, debug, no_killer, nthreads, server):
+    def test_execute_download(self, debug, killer, nthreads, server):
         opt = Namespace(
             debug=debug,
-            no_killer=no_killer,
+            no_killer=not killer,
             nthreads=nthreads,
             no_status_server=not server,
         )
@@ -488,7 +488,7 @@ class TestExecuteDownload:
             self.ohss_m.assert_not_called()
 
         self.download_m.assert_called_once_with(
-            nthreads=nthreads, no_killer=no_killer, status_server=server
+            nthreads=nthreads, killer=killer, status_server=server
         )