From 021c0e6d52489fca284d6357bfcd090cd715a96f Mon Sep 17 00:00:00 2001 From: Marek Havrila Date: Thu, 9 Nov 2023 13:11:59 +0100 Subject: [PATCH] Spelling and linting --- SCAutolib/__init__.py | 2 +- SCAutolib/controller.py | 2 +- SCAutolib/models/card.py | 2 +- SCAutolib/utils.py | 2 +- test/test_file.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SCAutolib/__init__.py b/SCAutolib/__init__.py index 330789d7..06bd4ed0 100644 --- a/SCAutolib/__init__.py +++ b/SCAutolib/__init__.py @@ -111,7 +111,7 @@ def run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, """ if return_code is None: return_code = [0] - if type(cmd) == str: + if isinstance(cmd, str): cmd = cmd.split(" ") logger.debug(f"run: {' '.join([str(i) for i in cmd])}") out = subprocess.run(cmd, stdout=stdout, stderr=stderr, encoding="utf-8", diff --git a/SCAutolib/controller.py b/SCAutolib/controller.py index df678e49..7ade0efa 100644 --- a/SCAutolib/controller.py +++ b/SCAutolib/controller.py @@ -133,7 +133,7 @@ def setup_system(self, install_missing: bool, gdm: bool, graphical: bool): if graphical: run(['dnf', 'groupinstall', 'Server with GUI', '-y']) - # disable subsription message + # disable subscription message run(['systemctl', '--global', 'mask', 'org.gnome.SettingsDaemon.Subscription.target']) # disable welcome message diff --git a/SCAutolib/models/card.py b/SCAutolib/models/card.py index 127c66ee..7ca2f14c 100644 --- a/SCAutolib/models/card.py +++ b/SCAutolib/models/card.py @@ -63,7 +63,7 @@ def load(json_file, **kwars): card = None if cnt["type"] == "virtual": - assert "user" in kwars.keys(),\ + assert "user" in kwars.keys(), \ "No user is provided to load the card." card = VirtualCard(user=kwars["user"], softhsm2_conf=Path(cnt["softhsm"])) diff --git a/SCAutolib/utils.py b/SCAutolib/utils.py index db47147c..11921509 100644 --- a/SCAutolib/utils.py +++ b/SCAutolib/utils.py @@ -149,7 +149,7 @@ def user_factory(username, **kwargs): user = None if user_file.exists(): result = BaseUser.load(user_file, **kwargs) - if type(result) == tuple: + if isinstance(result, tuple): user, card_file = result logger.debug(f"Loading card from {card_file}") user.card = Card.load(card_file, user=user) diff --git a/test/test_file.py b/test/test_file.py index 450b2a5d..006a0f12 100644 --- a/test/test_file.py +++ b/test/test_file.py @@ -19,7 +19,7 @@ def test_create_fail(file_test_prepare): file_test = file_test_prepare with file_test._conf_file.open('w') as config: config.write('Test config file') - with pytest.raises(FileExistsError, match=f'{file_test._conf_file } ' + with pytest.raises(FileExistsError, match=f'{file_test._conf_file} ' f'already exists'): file_test.create()