Skip to content

Commit 7ccd1e2

Browse files
Update python to 3.6 for type hints
1 parent 03c4316 commit 7ccd1e2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cyaron/math.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from math import sqrt, factorial
3434
import random
3535
import itertools
36-
from typing import Union, Literal
36+
from typing import Union, Tuple, List
3737

3838
fact = (1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880)
3939

@@ -169,7 +169,7 @@ def fibonacci(n: int):
169169
return _fib(n)[0]
170170

171171

172-
def _fib(n: int) -> tuple[int, int]:
172+
def _fib(n: int) -> Tuple[int, int]:
173173
'''Returns a tuple of fibonacci (F(n), F(n+1)).'''
174174
if n == 0:
175175
return (0, 1)
@@ -275,7 +275,7 @@ def _miller_rabin_pass(a: int, s: int, f: int, n: int):
275275
return a_to_power == n - 1
276276

277277

278-
def factor(n: int) -> list[tuple[int, int]]:
278+
def factor(n: int) -> List[Tuple[int, int]]:
279279
"""
280280
Find the prime factors of a given number along with their frequencies.
281281
Args:
@@ -477,9 +477,7 @@ def miu(x: int):
477477

478478
#source:
479479
# http://interactivepython.org/runestone/static/pythonds/Recursion/pythondsConvertinganIntegertoaStringinAnyBase.html
480-
def dec2base(
481-
n: int, base: Literal[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
482-
16]) -> str:
480+
def dec2base(n: int, base: int) -> str:
483481
"""
484482
Convert a decimal number to a specified base.
485483
Args:
@@ -520,7 +518,7 @@ def n2words(num: int, join: bool = True):
520518
'Tredecillion','Quattuordecillion','Sexdecillion', \
521519
'Septendecillion','Octodecillion','Novemdecillion', \
522520
'Vigintillion']
523-
words: list[str] = []
521+
words: List[str] = []
524522
if num == 0:
525523
words.append('zero')
526524
else:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "LGPL-3.0"
77
readme = "README.md"
88

99
[tool.poetry.dependencies]
10-
python = ">=3.5"
10+
python = ">=3.6"
1111
xeger = "^0.4.0"
1212
colorful = "^0.5.6"
1313

0 commit comments

Comments
 (0)