|
16 | 16 |
|
17 | 17 |
|
18 | 18 | class Card(object): |
19 | | - """ High-level card manipulation API """ |
| 19 | + """High-level card manipulation API""" |
20 | 20 |
|
21 | 21 | def __init__(self, connection): |
22 | 22 | self.tp = TransmissionProtocol(connection) |
23 | 23 |
|
24 | 24 | def get_mf(self): |
25 | | - """ Get the master file (MF). """ |
| 25 | + """Get the master file (MF).""" |
26 | 26 | return self.tp.exchange(SelectCommand(file_identifier=[0x3F, 0x00])) |
27 | 27 |
|
28 | 28 | def get_pse(self): |
29 | | - """ Get the Payment System Environment (PSE) file """ |
| 29 | + """Get the Payment System Environment (PSE) file""" |
30 | 30 | return self.tp.exchange(SelectCommand("1PAY.SYS.DDF01")) |
31 | 31 |
|
32 | 32 | def list_applications(self): |
33 | | - """ List applications on the card """ |
| 33 | + """List applications on the card""" |
34 | 34 | try: |
35 | 35 | return self._list_applications_sfi() |
36 | 36 | except ErrorResponse: |
@@ -146,15 +146,15 @@ def get_application_data(self, afl): |
146 | 146 | return data |
147 | 147 |
|
148 | 148 | def verify_pin(self, pin): |
149 | | - """ Verify the PIN, raising an exception if it fails.""" |
| 149 | + """Verify the PIN, raising an exception if it fails.""" |
150 | 150 | res = self.tp.exchange(VerifyCommand(pin)) |
151 | 151 | if type(res) == WarningResponse: |
152 | 152 | raise InvalidPINException(str(res)) |
153 | 153 |
|
154 | 154 | return res |
155 | 155 |
|
156 | 156 | def generate_cap_value(self, pin, challenge=None, value=None): |
157 | | - """ Perform a transaction to generate the EMV CAP (Pinsentry) value. """ |
| 157 | + """Perform a transaction to generate the EMV CAP (Pinsentry) value.""" |
158 | 158 | apps = self.list_applications() |
159 | 159 |
|
160 | 160 | if len(apps) == 0: |
@@ -182,7 +182,9 @@ def generate_cap_value(self, pin, challenge=None, value=None): |
182 | 182 | # It appears that Belgian cards use their own silliness. |
183 | 183 | # https://github.com/zoobab/EMVCAP/blob/master/EMV-CAP#L512 |
184 | 184 | if Tag.IPB not in app_data: |
185 | | - raise EMVProtocolError("Issuer Proprietary Bitmap not found in application file") |
| 185 | + raise EMVProtocolError( |
| 186 | + "Issuer Proprietary Bitmap not found in application file" |
| 187 | + ) |
186 | 188 |
|
187 | 189 | self.verify_pin(pin) |
188 | 190 |
|
|
0 commit comments