Skip to content

Commit

Permalink
moved to pycodestyle, fixed some style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-wisiol committed Jan 24, 2019
1 parent 2675db5 commit 356132e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ def main():
# output the result
print('Learned a 64bit 2-xor XOR Arbiter PUF from 12000 CRPs with accuracy %f' % accuracy)


if __name__ == '__main__':
main()
8 changes: 4 additions & 4 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main(arguments):
parser.add_argument(
'-e', '--exclude_patterns', help='patterns to identify directories or files which should not be checked '
'(default are env .env)',
default=['.env', 'env'], type=str, dest='exclude_patterns', nargs='+',
default=['.env', 'env', 'venv', '.venv'], type=str, dest='exclude_patterns', nargs='+',
)
args = parser.parse_args(arguments)

Expand All @@ -43,8 +43,8 @@ def main(arguments):
# set paths which should not be checked
excludes = '--exclude={0}'.format(','.join(args.exclude_patterns))

# run pep8 check
pep8_returncode = call([executable, '-m', 'pep8', max_line_length, excludes, args.path])
# run pycodestyle check
pycodestyle_returncode = call([executable, '-m', 'pycodestyle', max_line_length, excludes, args.path])

# exclude specific directories support to check subdirectories by default
files_to_check = []
Expand All @@ -67,7 +67,7 @@ def main(arguments):
pylint_returncode = call(pylint_cmd)

returncode = 0
if pep8_returncode != 0 or pylint_returncode != 0:
if pycodestyle_returncode != 0 or pylint_returncode != 0:
returncode = 1

exit(returncode)
Expand Down
1 change: 1 addition & 0 deletions mv_num_of_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ def main(args):
experimenter = Experimenter(args.log_name, experiments)
experimenter.run()


if __name__ == '__main__':
main(argv[1:])
1 change: 1 addition & 0 deletions pypuf/property_test/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@ def example_uniqueness_statistic():
uniqueness_statistic = property_test.uniqueness_statistic(challenges, measurements=measurements)
print('The uniqueness statistic is {}.'.format(uniqueness_statistic))


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy~=1.16
pep8~=1.7
pycodestyle~=2.4
polymath==0.1.18
pylint~=2.2
pypuf-helper==0.1.5
Expand Down
1 change: 1 addition & 0 deletions sim_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@ def main(args):

log_file.close()


if __name__ == '__main__':
main(sys.argv)
1 change: 1 addition & 0 deletions stability_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def stability_figure_data(n, k, vote_count, sigma_noise_ratio, num, reps, random
stabilities = tools.approx_stabilities(instance_mv, num, reps, random)
print('{' + ','.join(map(str, stabilities)) + '}')


if __name__ == "__main__":
if len(argv) != 8:
stderr.write('Stability Calculation for MV XOR Arbiter PUF\n')
Expand Down
2 changes: 1 addition & 1 deletion test/test_experiment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This module tests the different experiment classes."""
import unittest
from numpy.testing import assert_array_equal
from test.utility import remove_test_logs, logging, get_functions_with_prefix, LOG_PATH
from numpy.testing import assert_array_equal
from pypuf.simulation.arbiter_based.ltfarray import LTFArray, NoisyLTFArray
from pypuf.experiments.experiment.logistic_regression import ExperimentLogisticRegression
from pypuf.experiments.experiment.majority_vote import ExperimentMajorityVoteFindVotes
Expand Down

0 comments on commit 356132e

Please sign in to comment.