Skip to content

Commit

Permalink
[STYLES] Adds some optional Pylint checkers from the extensions module
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel FORESTIER committed Aug 28, 2021
1 parent 2165450 commit cba3188
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .pylintrc
Expand Up @@ -15,6 +15,11 @@ disable=similarities

# Additional plugins to check the code base against.
load-plugins=
pylint.extensions.check_elif,
pylint.extensions.redefined_variable_type,
pylint.extensions.overlapping_exceptions,
pylint.extensions.empty_comment,
pylint.extensions.while_used,
pylint_secure_coding_standard

[DESIGN]
Expand Down
4 changes: 2 additions & 2 deletions archey/entries/kernel.py
Expand Up @@ -4,7 +4,7 @@
import platform

from socket import timeout as SocketTimeoutError
from urllib.error import HTTPError, URLError
from urllib.error import URLError
from urllib.request import urlopen
from typing import Optional

Expand Down Expand Up @@ -50,7 +50,7 @@ def _fetch_latest_linux_release() -> Optional[str]:
kernel_releases = json.load(http_request)
except json.JSONDecodeError:
return None
except (HTTPError, URLError, SocketTimeoutError):
except (URLError, SocketTimeoutError):
return None

return kernel_releases.get('latest_stable', {}).get('version')
Expand Down
4 changes: 2 additions & 2 deletions archey/entries/wan_ip.py
Expand Up @@ -3,7 +3,7 @@
from socket import timeout as SocketTimeoutError
from subprocess import check_output, DEVNULL, TimeoutExpired, CalledProcessError
from typing import Optional
from urllib.error import HTTPError, URLError
from urllib.error import URLError
from urllib.request import urlopen

from archey.entry import Entry
Expand Down Expand Up @@ -97,7 +97,7 @@ def _run_http_request(server_url: str, timeout: float) -> Optional[str]:
try:
with urlopen(server_url, timeout=timeout) as http_request:
return http_request.read().decode().strip()
except (HTTPError, URLError, SocketTimeoutError):
except (URLError, SocketTimeoutError):
return None

def output(self, output):
Expand Down
4 changes: 3 additions & 1 deletion archey/test/entries/test_archey_model.py
Expand Up @@ -84,7 +84,9 @@ def test_fetch_virtual_env_info(self, check_output_mock, getuid_mock):
with self.subTest('Not a virtual environment (systemd).'):
check_output_mock.reset_mock()
getuid_mock.reset_mock()
check_output_mock.side_effect = CalledProcessError(1, 'systemd-detect-virt', 'none\n')
check_output_mock.side_effect = CalledProcessError( # pylint: disable=redefined-variable-type
1, 'systemd-detect-virt', 'none\n'
)

self.assertIsNone(
Model._fetch_virtual_env_info(model_mock) # pylint: disable=protected-access
Expand Down

0 comments on commit cba3188

Please sign in to comment.