Apply black+isort
authorfunilrys <redacted>
Wed, 31 Mar 2021 12:57:56 +0000 (14:57 +0200)
committerfunilrys <redacted>
Wed, 31 Mar 2021 12:57:56 +0000 (14:57 +0200)
testUpdateHostsFile.py
updateHostsFile.py

index 69597ee487b7bf03cb423880389d89fad3ea843b..c78bb8ada956f9b6f8b8bebdacd851d9d87c207a 100644 (file)
@@ -1646,20 +1646,30 @@ class GetFileByUrl(BaseStdout):
         self.assertEqual(expected, actual)
 
     def test_connect_unknown_domain(self):
-        test_url = "http://doesnotexist.google.com"  # leads to exception: ConnectionError
-        with mock.patch("requests.get", side_effect=requests.exceptions.ConnectionError):
+        test_url = (
+            "http://doesnotexist.google.com"  # leads to exception: ConnectionError
+        )
+        with mock.patch(
+            "requests.get", side_effect=requests.exceptions.ConnectionError
+        ):
             return_value = get_file_by_url(test_url)
         self.assertIsNone(return_value)
         printed_output = sys.stdout.getvalue()
-        self.assertEqual(printed_output, "Error retrieving data from {}\n".format(test_url))
+        self.assertEqual(
+            printed_output, "Error retrieving data from {}\n".format(test_url)
+        )
 
     def test_invalid_url(self):
         test_url = "http://fe80::5054:ff:fe5a:fc0"  # leads to exception: InvalidURL
-        with mock.patch("requests.get", side_effect=requests.exceptions.ConnectionError):
+        with mock.patch(
+            "requests.get", side_effect=requests.exceptions.ConnectionError
+        ):
             return_value = get_file_by_url(test_url)
         self.assertIsNone(return_value)
         printed_output = sys.stdout.getvalue()
-        self.assertEqual(printed_output, "Error retrieving data from {}\n".format(test_url))
+        self.assertEqual(
+            printed_output, "Error retrieving data from {}\n".format(test_url)
+        )
 
 
 class TestWriteData(Base):
index 7301f587a4d555c98e8cf7a377d0c93eac318bda..9c31d760de4b066c856eadf05ab3d56ebd056967 100644 (file)
@@ -32,8 +32,10 @@ if not PY3:
 try:
     import requests
 except ImportError:
-    raise ImportError("This project's dependencies have changed. The Requests library ("
-                      "https://requests.readthedocs.io/en/master/) is now required.")
+    raise ImportError(
+        "This project's dependencies have changed. The Requests library ("
+        "https://requests.readthedocs.io/en/master/) is now required."
+    )
 
 
 # Syntactic sugar for "sudo" command in UNIX / Linux
@@ -986,7 +988,9 @@ def normalize_rule(rule, target_ip, keep_domain_comments):
         and spacing reformatted.
     """
 
-    def normalize_response(extracted_hostname: str, extracted_suffix: Optional[str]) -> Tuple[str, str]:
+    def normalize_response(
+        extracted_hostname: str, extracted_suffix: Optional[str]
+    ) -> Tuple[str, str]:
         """
         Normalizes the responses after the provision of the extracted
         hostname and suffix - if exist.
@@ -1342,8 +1346,9 @@ def flush_dns_cache():
                 )
 
                 if os.path.isfile(service_file):
-                    if 0 != subprocess.call([systemctl, "status", service],
-                                            stdout=subprocess.DEVNULL):
+                    if 0 != subprocess.call(
+                        [systemctl, "status", service], stdout=subprocess.DEVNULL
+                    ):
                         continue
                     dns_cache_found = True
 
git clone https://git.99rst.org/PROJECT