Skip to content

Commit 14433de

Browse files
committed
old revert
1 parent 17a66d1 commit 14433de

5 files changed

Lines changed: 7 additions & 35 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ Most documentation is currently written in Markdown, making it easy to add, modi
1414

1515
## Issues
1616

17-
Create new issues in the
18-
[issue tracker](https://github.com/EnAccess/OpenPAYGO-python/issues/new/choose)
17+
Issues are created [here](https://github.com/EnAccess/OpenPAYGO-python/issues/new/choose)
1918

2019
### How to Contribute to Issues
2120

openpaygo/token_decode.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ def get_activation_value_count_and_type_from_token(
134134

135135
@classmethod
136136
def _count_is_valid(cls, count, last_count, value, type, used_counts):
137-
if used_counts is None:
138-
used_counts = []
137+
139138
if value == OpenPAYGOTokenShared.COUNTER_SYNC_VALUE:
140139
if count > (last_count - cls.MAX_TOKEN_JUMP):
141140
return True
@@ -149,7 +148,7 @@ def _count_is_valid(cls, count, last_count, value, type, used_counts):
149148

150149
@classmethod
151150
def update_used_counts(cls, past_used_counts, value, new_count, type):
152-
if not past_used_counts:
151+
if not past_used_counts:
153152
return None
154153
highest_count = max(past_used_counts) if past_used_counts else 0
155154
if new_count > highest_count:

openpaygo/token_shared.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,15 @@ def generate_starting_code(cls, key):
6161

6262
@classmethod
6363
def load_secret_key_from_hex(cls, secret_key):
64-
if isinstance(secret_key, (bytes, bytearray)):
65-
secret_key_bytes = bytes(secret_key)
66-
if len(secret_key_bytes) != 16:
67-
raise ValueError(
68-
"The secret key provided is not correctly formatted, it should be "
69-
"16 "
70-
"bytes. "
71-
)
72-
return secret_key_bytes
7364

7465
try:
75-
decoded = codecs.decode(secret_key, "hex")
66+
return codecs.decode(secret_key, "hex")
7667
except Exception:
7768
raise ValueError(
7869
"The secret key provided is not correctly formatted, it should be 32 "
7970
"hexadecimal characters. "
8071
)
8172

82-
if len(decoded) != 16:
83-
raise ValueError(
84-
"The secret key provided is not correctly formatted, it should be 32 "
85-
"hexadecimal characters. "
86-
)
87-
88-
return decoded
89-
9073
@classmethod
9174
def _convert_to_29_5_bits(cls, source):
9275
mask = ((1 << (32 - 2 + 1)) - 1) << 2

test/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
To run the test, first, create and activate a virtual environment. Then install the module and run the test:
44

55
```bash
6-
cd tests
7-
python -m venv env
8-
source env/bin/activate
9-
python -m pip install -e ..
10-
python simple_scenario_test.py
11-
```
12-
13-
You can do it for full test procedure as well:
14-
15-
```bash
16-
python full_test_procedure.py
6+
uv run python test/simple_scenario_test.py
7+
uv run python test/full_test_procedure.py
178
```

test/simple_scenario_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import datetime, timedelta
22

3-
from test.simulators import DeviceSimulator, SingleDeviceServerSimulator
43
from openpaygo.token_shared import TokenType
4+
from test.simulators import DeviceSimulator, SingleDeviceServerSimulator
55

66

77
def assert_time_equals(time1, time2):

0 commit comments

Comments
 (0)