mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Better typing. Fixed a bug with a generator that has been renamed.
This commit is contained in:
parent
53cdd28fee
commit
9feb1aa72b
2 changed files with 4 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
pep8
|
pep8
|
||||||
coverage
|
coverage
|
||||||
coveralls
|
coveralls
|
||||||
|
mypy
|
||||||
|
|
|
@ -27,7 +27,7 @@ __license__ = "GPLv3"
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import itertools
|
import itertools
|
||||||
from typing import Iterator
|
from typing import Iterator, List, Dict
|
||||||
|
|
||||||
def identity() -> Iterator[int]:
|
def identity() -> Iterator[int]:
|
||||||
"""f(x) = x
|
"""f(x) = x
|
||||||
|
@ -68,7 +68,7 @@ def eratosthenes() -> Iterator[int]:
|
||||||
"""https://oeis.org/A000040
|
"""https://oeis.org/A000040
|
||||||
Generate the prime numbers with the sieve of Eratosthenes.
|
Generate the prime numbers with the sieve of Eratosthenes.
|
||||||
"""
|
"""
|
||||||
d = {} # type: dict[int, int]
|
d = {} # type: Dict[int, List[int]]
|
||||||
for i in itertools.count(2):
|
for i in itertools.count(2):
|
||||||
if i in d:
|
if i in d:
|
||||||
for j in d[i]:
|
for j in d[i]:
|
||||||
|
@ -92,7 +92,7 @@ def carmichael() -> Iterator[int]:
|
||||||
"""https://oeis.org/A002997
|
"""https://oeis.org/A002997
|
||||||
Composite numbers n such that a^(n-1) == 1 (mod n) for every a coprime to n.
|
Composite numbers n such that a^(n-1) == 1 (mod n) for every a coprime to n.
|
||||||
"""
|
"""
|
||||||
for m in eratosthenes_composite():
|
for m in composite():
|
||||||
for a in range(2, m):
|
for a in range(2, m):
|
||||||
if pow(a,m,m) != a:
|
if pow(a,m,m) != a:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Reference in a new issue