mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
"""
|
||||
Convert International System of Units (SI) and Binary prefixes
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import Union
|
||||
|
||||
|
||||
class SI_Unit(Enum):
|
||||
@ -41,8 +42,8 @@ class Binary_Unit(Enum):
|
||||
|
||||
def convert_si_prefix(
|
||||
known_amount: float,
|
||||
known_prefix: Union[str, SI_Unit],
|
||||
unknown_prefix: Union[str, SI_Unit],
|
||||
known_prefix: str | SI_Unit,
|
||||
unknown_prefix: str | SI_Unit,
|
||||
) -> float:
|
||||
"""
|
||||
Wikipedia reference: https://en.wikipedia.org/wiki/Binary_prefix
|
||||
@ -70,8 +71,8 @@ def convert_si_prefix(
|
||||
|
||||
def convert_binary_prefix(
|
||||
known_amount: float,
|
||||
known_prefix: Union[str, Binary_Unit],
|
||||
unknown_prefix: Union[str, Binary_Unit],
|
||||
known_prefix: str | Binary_Unit,
|
||||
unknown_prefix: str | Binary_Unit,
|
||||
) -> float:
|
||||
"""
|
||||
Wikipedia reference: https://en.wikipedia.org/wiki/Metric_prefix
|
||||
|
Reference in New Issue
Block a user