Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bits conversion to the ByteSize class feature #8415 #8507

Merged
merged 4 commits into from Jan 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions pydantic/v1/types.py
Expand Up @@ -1082,6 +1082,19 @@ def _get_brand(card_number: str) -> PaymentCardBrand:
'tib': 2**40,
'pib': 2**50,
'eib': 2**60,
'bit': 1/8,
'kbit': 10**3/8,
'mbit': 10**6/8,
'gbit': 10**9/8,
'tbit': 10**12/8,
'pbit': 10**15/8,
'ebit': 10**18/8,
'kibit': 2**10/8,
'mibit': 2**20/8,
'gibit': 2**30/8,
'tibit': 2**40/8,
'pibit': 2**50/8,
'eibit': 2**60/8,
}
BYTE_SIZES.update({k.lower()[0]: v for k, v in BYTE_SIZES.items() if 'i' not in k})
byte_string_re = re.compile(r'^\s*(\d*\.?\d+)\s*(\w+)?', re.IGNORECASE)
Expand Down