Skip to content

Commit 06fd857

Browse files
committed
add flake8, mypi and fix code. Add pybind11 submodule at v2.5.0
1 parent ac4aed1 commit 06fd857

File tree

194 files changed

+31
-40934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+31
-40934
lines changed

.flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude = ./typings/**/*, ./src/lib/pybind11
4+
ignore = E203,W503

.github/workflows/build.yml

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ jobs:
2626
python -m pip install --upgrade pip
2727
python -m pip install cibuildwheel==1.3.0
2828
29+
- name: Lint source with flake8
30+
run: |
31+
pip install flake8
32+
flake8 src
33+
34+
- name: Lint source with mypy
35+
run: |
36+
pip install mypy
37+
mypy --config-file mypi.ini src
38+
2939
- name: Build source distribution with MacOS
3040
if: startsWith(matrix.os, 'mac')
3141
run: |

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
/verifier
1212
/verifier_test
1313
/build/*
14+
15+
# Tests cache
16+
.mypy_cache

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/lib/pybind11"]
2+
path = src/lib/pybind11
3+
url = https://github.com/pybind/pybind11.git

mypi.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
ignore_missing_imports = True

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def build_extensions(self):
247247
license='Apache License',
248248
python_requires='>=3.7',
249249
long_description=open('README.md').read(),
250+
long_description_content_type="text/markdown",
250251
build_requires=["pybind11"],
251252
ext_modules=ext_modules,
252253
cmdclass={'build_ext': BuildExt},

src/classgroup.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from fastvdf import verify_wesolowski
22

3+
34
class ClassGroup(tuple):
45
@classmethod
56
def identity_for_discriminant(class_, d):
@@ -71,12 +72,13 @@ def serialize(self):
7172
for x in [r[0], r[1]]])
7273

7374

74-
def deserialize_proof(proof_blob, discriminant):
75+
def deserialize_proof(proof_blob, discriminant):
7576
int_size = (discriminant.bit_length() + 16) >> 4
7677
proof_arr = [proof_blob[_:_ + 2 * int_size]
77-
for _ in range(0, len(proof_blob), 2*int_size)]
78+
for _ in range(0, len(proof_blob), 2 * int_size)]
7879
return [ClassGroup.from_bytes(blob, discriminant) for blob in proof_arr]
7980

81+
8082
def check_proof_of_time_nwesolowski(discriminant, x, proof_blob,
8183
iterations, int_size_bits, depth):
8284
"""
@@ -94,9 +96,7 @@ def check_proof_of_time_nwesolowski(discriminant, x, proof_blob,
9496
try:
9597
int_size = (int_size_bits + 16) >> 4
9698
if (
97-
len(proof_blob) !=
98-
4 * int_size +
99-
depth * (8 + 4 * int_size)
99+
len(proof_blob) != 4 * int_size + depth * (8 + 4 * int_size)
100100
):
101101
return False
102102
new_proof_blob = proof_blob[:4 * int_size]
@@ -142,9 +142,10 @@ def check_proof_of_time_nwesolowski(discriminant, x, proof_blob,
142142
str(proof[-1][1]),
143143
iterations,
144144
)
145-
except Exception as e:
145+
except Exception:
146146
return False
147147

148+
148149
"""
149150
Copyright 2018 Chia Network Inc
150151

src/lib/pybind11

Submodule pybind11 added at 3b1dbeb

src/lib/pybind11/.appveyor.yml

-70
This file was deleted.

src/lib/pybind11/.gitignore

-38
This file was deleted.

src/lib/pybind11/.gitmodules

-3
This file was deleted.

src/lib/pybind11/.readthedocs.yml

-3
This file was deleted.

0 commit comments

Comments
 (0)