[Bug]: Inconsistent `value` behaviour between `generate_token` and `decode_token` for `DISABLE_PAYG` and `COUNTER_SYNC`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định các điểm truy cập generate_token và decode_token trong package OpenPAYGO-python, rồi tái hiện ví dụ DISABLE_PAYG được cung cấp. So sánh cách token_type và token_value được chấp nhận và trả về, sau đó chọn contract nhất quán theo dự định từ các giải pháp được đề xuất; issue được hoàn tất khi cả hai interface xử lý các loại token này một cách nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Preflight Checklist
- I have read the Contributing Guidelines for this project, if it exists.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Expected Behavior
Token value and Token Type have a 1:1 relation for DISABLE_PAYG and COUNTER_SYNC. As a user I would expect generate_token and decode_token to have the same interface in terms of how DISABLE_PAYG and COUNTER_SYNC are specified.
Actual Behavior
In generate_token only token_type must be specified. Providing a non-None value yields:
ValueError: A value is not allowed for this token type.
In decode_token both token_type and token_value are returned.
Steps to reproduce
# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenEncoder, TokenType
encoder = OpenPAYGOTokenEncoder()
new_count, final_token = encoder.generate_token(
secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
count=4,
value=998,
token_type=TokenType.DISABLE_PAYG,
starting_code=516959010,
restricted_digit_set=False,
extended_token=False,
)
print(f"{new_count=}")
print(f"{final_token=}")
What operating system(s) are you using?
macOS
Additional Information
Suggested solutions:
Change generate_token to allow a token value that matches the provided token type. If none is given, the token value is derived from token_type. If a token type is provided that does not match the token value throw an error explaining the problem.
Alternative solution:
Change decode_token to not return token values for DISABLE_PAYG and COUNTER_SYNC
- Ngôn ngữ chính
- Python
- Star
- 15
- Fork
- 15
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của EnAccess/OpenPAYGO-python
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
EnAccess/OpenPAYGO-python#34 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
EnAccess/OpenPAYGO-python#24 ·
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
EnAccess/OpenPAYGO-python#22 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
EnAccess/OpenPAYGO-python#21 ·
-
documentation enhancement good first issue hacktoberfest help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
EnAccess/OpenPAYGO-python#15 ·
Tất cả issue của EnAccess/OpenPAYGO-python
Issue tương tự
-
correction metadata
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
acl-org/acl-anthology#10104 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug status/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
prowler-cloud/prowler#12885 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug in GaussianTailProbabilityCalibrator: running_statistics=False still uses a windowed varianceĐang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
selimfirat/pysad#107 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ci-failure high priority
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
vllm-project/vllm-omni#8194 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày