• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LudovicRousseau / pyscard / 16621389771

30 Jul 2025 11:33AM UTC coverage: 66.181% (+0.1%) from 66.048%
16621389771

push

github

LudovicRousseau
Release 2.3.0

Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>

108 of 485 branches covered (22.27%)

4452 of 6727 relevant lines covered (66.18%)

4.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/smartcard/AbstractCardRequest.py
1
"""AbstractCardRequest class.
2

3
__author__ = "https://www.gemalto.com/"
4

5
Copyright 2001-2012 gemalto
6
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
7

8
This file is part of pyscard.
9

10
pyscard is free software; you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation; either version 2.1 of the License, or
13
(at your option) any later version.
14

15
pyscard is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU Lesser General Public License for more details.
19

20
You should have received a copy of the GNU Lesser General Public License
21
along with pyscard; if not, write to the Free Software
22
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23
"""
24

25
import smartcard.System
×
26
from smartcard.CardType import AnyCardType
×
27
from smartcard.PassThruCardService import PassThruCardService
×
28

29

30
class AbstractCardRequest:
×
31
    """The base class for xxxCardRequest classes.
32

33
    A CardRequest is used for waitForCard() invocations and specifies what
34
    kind of smart card an application is waited for."""
35

36
    # pylint: disable=too-many-arguments
37
    # pylint: disable=too-many-positional-arguments
38
    def __init__(
×
39
        self,
40
        newcardonly=False,
41
        readers=None,
42
        cardType=None,
43
        cardServiceClass=None,
44
        timeout=1,
45
    ):
46
        """Construct new CardRequest.
47

48
        @param newcardonly: if True, request a new card; default is
49
                            False, i.e. accepts cards already inserted
50

51
        @param readers:     the list of readers to consider for
52
                            requesting a card; default is to consider
53
                            all readers
54

55
        @param cardType:    the L{smartcard.CardType.CardType} to wait for;
56
                            default is L{smartcard.CardType.AnyCardType},
57
                            i.e. the request will succeed with any card
58

59
        @param cardServiceClass: the specific card service class to create
60
                            and bind to the card;default is to create
61
                            and bind a L{smartcard.PassThruCardService}
62

63
        @param timeout:     the time in seconds we are ready to wait for
64
                            connecting to the requested card.  default
65
                            is to wait one second; to wait forever, set
66
                            timeout to None
67
        """
68
        self.newcardonly = newcardonly
×
69
        self.readersAsked = readers
×
70
        self.cardType = cardType
×
71
        self.cardServiceClass = cardServiceClass
×
72
        self.timeout = timeout
×
73

74
        # if no CardType requested, use AnyCardType
75
        if self.cardType is None:
×
76
            self.cardType = AnyCardType()
×
77

78
        # if no card service requested, use pass-thru card service
79
        if self.cardServiceClass is None:
×
80
            self.cardServiceClass = PassThruCardService
×
81

82
    def getReaders(self):
×
83
        """Returns the list or readers on which to wait for cards."""
84
        # if readers not given, use all readers
85
        if self.readersAsked is None:
×
86
            return smartcard.System.readers()
×
87
        return self.readersAsked
×
88

89
    def waitforcard(self):
×
90
        """Wait for card insertion and returns a card service."""
91

92
    def waitforcardevent(self):
×
93
        """Wait for card insertion or removal."""
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc