Skip to content

Commit fbe0594

Browse files
authored
Merge pull request #1 from Vibhu-Agarwal/master
Updated Python code according to PEP8
2 parents 62b3ab3 + 83e3f07 commit fbe0594

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

CppAndPython/CppAndPython.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@
77

88
e = 2.7182818284590452353602874713527
99

10+
1011
def sinh(x):
1112
return (1 - (e ** (-2 * x))) / (2 * (e ** -x))
1213

14+
1315
def cosh(x):
1416
return (1 + (e ** (-2 * x))) / (2 * (e ** -x))
1517

18+
1619
def tanh(x):
1720
tanh_x = sinh(x) / cosh(x)
1821
return tanh_x
1922

23+
2024
def test(fn, name):
25+
2126
start = perf_counter()
2227
result = fn(DATA)
2328
duration = perf_counter() - start
@@ -26,6 +31,7 @@ def test(fn, name):
2631
for d in result:
2732
assert -1 <= d <= 1, " incorrect values"
2833

34+
2935
if __name__ == "__main__":
3036
print('Running benchmarks with COUNT = {}'.format(COUNT))
3137

superfastcode/setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from distutils.core import setup, Extension, DEBUG
1+
from distutils.core import setup, Extension
22

3-
sfc_module = Extension('superfastcode', sources = ['module.cpp'])
43

5-
setup(name = 'superfastcode', version = '1.0',
6-
description = 'Python Package with superfastcode C++ extension',
7-
ext_modules = [sfc_module]
8-
)
4+
sfc_module = Extension('superfastcode', sources=['module.cpp'])
5+
6+
setup(name='superfastcode', version='1.0',
7+
description='Python Package with superfastcode C++ extension',
8+
ext_modules=[sfc_module]
9+
)

superfastcode2/setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
cpp_args = ['-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7']
77

88
sfc_module = Extension(
9-
'superfastcode2', sources = ['module.cpp'],
9+
'superfastcode2', sources=['module.cpp'],
1010
include_dirs=['pybind11/include'],
1111
language='c++',
12-
extra_compile_args = cpp_args,
12+
extra_compile_args=cpp_args,
1313
)
1414

1515
setup(
16-
name = 'superfastcode2',
17-
version = '1.0',
18-
description = 'Python package with superfastcode2 C++ extension (PyBind11)',
19-
ext_modules = [sfc_module],
20-
)
16+
name='superfastcode2',
17+
version='1.0',
18+
description='Python package with superfastcode2 C++ extension (PyBind11)',
19+
ext_modules=[sfc_module],
20+
)

0 commit comments

Comments
 (0)