Skip to content

Commit

Permalink
Remove dead readergroups code
Browse files Browse the repository at this point in the history
* `DeleteSCardDefaultReaderGroupException` is unused in the codebase.
  Searching Google and GitHub further confirms it is unused.
* `initlist` can only be `None` if `.getreadergroups()` returns `None`.
  Changing the code eliminates the condition.
* Removing `if __name__ == '__main__'` eliminates junk code.

Code coverage is now 100% for the file.
  • Loading branch information
kurtmckee authored and LudovicRousseau committed Oct 2, 2024
1 parent 6400f38 commit 0c2c269
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/smartcard/reader/ReaderGroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ def __init__(self):
SmartcardException.__init__(self, 'Invalid reader group')


class DeleteSCardDefaultReaderGroupException(SmartcardException):
"""Raised when trying to delete SCard$DefaultReaders reader group."""

def __init__(self):
SmartcardException.__init__(
self, 'SCard$DefaultReaders cannot be deleted')


class innerreadergroups(ulist):
"""Smartcard readers groups private class.
Expand All @@ -51,9 +43,8 @@ class innerreadergroups(ulist):
def __init__(self, initlist=None):
"""Retrieve and store list of reader groups"""
if initlist is None:
initlist = self.getreadergroups()
if initlist is not None:
ulist.__init__(self, initlist)
initlist = self.getreadergroups() or []
ulist.__init__(self, initlist)
self.unremovablegroups = []

def __onadditem__(self, item):
Expand Down Expand Up @@ -112,7 +103,3 @@ def __init__(self, initlist=None):

def __getattr__(self, name):
return getattr(self.instance, name)


if __name__ == '__main__':
print(readergroups())

0 comments on commit 0c2c269

Please sign in to comment.