From 9f9a7ceff7f5f4eb58b19862ee771f5362681cff Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 16 Aug 2014 22:46:40 +0200 Subject: [PATCH] #ohai , pep8 --- context-managers.py | 4 +--- doctest_test.py | 2 ++ least-squares.py | 2 +- pep8.sh | 3 +++ test_swig_test.py | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) create mode 100755 pep8.sh diff --git a/context-managers.py b/context-managers.py index 93cb5eb..5b48baa 100755 --- a/context-managers.py +++ b/context-managers.py @@ -9,6 +9,7 @@ from tempfile import mkdtemp import os import shutil + @contextmanager def working_directory(path): current_dir = os.getcwd() @@ -28,8 +29,6 @@ def just_a_test(): print "finally!" - - @contextmanager def temporary_dir(*args, **kwds): name = mkdtemp(*args, **kwds) @@ -39,7 +38,6 @@ def temporary_dir(*args, **kwds): shutil.rmtree(name) - with working_directory("/tmp"), just_a_test(): # do something within data/stuff print os.getcwd() diff --git a/doctest_test.py b/doctest_test.py index 3ebea9c..e97861a 100644 --- a/doctest_test.py +++ b/doctest_test.py @@ -1,5 +1,6 @@ #!/usr/bin/python + def foo(n): """Returns n times foo, and a period. @@ -21,6 +22,7 @@ def foo(n): else: return "" + def _test(): import doctest doctest.testmod() diff --git a/least-squares.py b/least-squares.py index 9603523..4c0aa3a 100755 --- a/least-squares.py +++ b/least-squares.py @@ -9,7 +9,7 @@ b1 = Symbol('b1') b2 = Symbol('b2') # Data points -data = [(1,14), (2, 13), (3, 12), (4, 10), (5,9), (7,8), (9,5)] +data = [(1, 14), (2, 13), (3, 12), (4, 10), (5, 9), (7, 8), (9, 5)] # S is the function to minimize: # diff --git a/pep8.sh b/pep8.sh new file mode 100755 index 0000000..f0d8a16 --- /dev/null +++ b/pep8.sh @@ -0,0 +1,3 @@ +#!/bin/sh +find . -name "*.py" -not -name test_swig.py -not -name test_swig_opencv.py \ + | xargs pep8 diff --git a/test_swig_test.py b/test_swig_test.py index 0cb5409..d032dd4 100644 --- a/test_swig_test.py +++ b/test_swig_test.py @@ -2,8 +2,8 @@ from __future__ import division, print_function import test_swig # FIXME -#print(test_swig.My_variable) -#assert(test_swig.My_variable == 3.0) +# print(test_swig.My_variable) +# assert(test_swig.My_variable == 3.0) print(test_swig.fact(5)) assert(test_swig.fact(5) == 120)