#ohai , pep8
This commit is contained in:
parent
af0ca7262b
commit
9f9a7ceff7
5 changed files with 9 additions and 6 deletions
|
@ -9,6 +9,7 @@ from tempfile import mkdtemp
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def working_directory(path):
|
def working_directory(path):
|
||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
|
@ -28,8 +29,6 @@ def just_a_test():
|
||||||
print "finally!"
|
print "finally!"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def temporary_dir(*args, **kwds):
|
def temporary_dir(*args, **kwds):
|
||||||
name = mkdtemp(*args, **kwds)
|
name = mkdtemp(*args, **kwds)
|
||||||
|
@ -39,7 +38,6 @@ def temporary_dir(*args, **kwds):
|
||||||
shutil.rmtree(name)
|
shutil.rmtree(name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
with working_directory("/tmp"), just_a_test():
|
with working_directory("/tmp"), just_a_test():
|
||||||
# do something within data/stuff
|
# do something within data/stuff
|
||||||
print os.getcwd()
|
print os.getcwd()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
|
||||||
def foo(n):
|
def foo(n):
|
||||||
"""Returns n times foo, and a period.
|
"""Returns n times foo, and a period.
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ def foo(n):
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def _test():
|
def _test():
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
|
|
@ -9,7 +9,7 @@ b1 = Symbol('b1')
|
||||||
b2 = Symbol('b2')
|
b2 = Symbol('b2')
|
||||||
|
|
||||||
# Data points
|
# 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:
|
# S is the function to minimize:
|
||||||
#
|
#
|
||||||
|
|
3
pep8.sh
Executable file
3
pep8.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
find . -name "*.py" -not -name test_swig.py -not -name test_swig_opencv.py \
|
||||||
|
| xargs pep8
|
|
@ -2,8 +2,8 @@ from __future__ import division, print_function
|
||||||
import test_swig
|
import test_swig
|
||||||
|
|
||||||
# FIXME
|
# FIXME
|
||||||
#print(test_swig.My_variable)
|
# print(test_swig.My_variable)
|
||||||
#assert(test_swig.My_variable == 3.0)
|
# assert(test_swig.My_variable == 3.0)
|
||||||
|
|
||||||
print(test_swig.fact(5))
|
print(test_swig.fact(5))
|
||||||
assert(test_swig.fact(5) == 120)
|
assert(test_swig.fact(5) == 120)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue