summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorJarrod Millman <millman@berkeley.edu>2007-10-29 14:58:18 +0000
committerJarrod Millman <millman@berkeley.edu>2007-10-29 14:58:18 +0000
commit0b77f0e5f0e46b2ef7c570ebda046c34bbcc0f26 (patch)
treec7609a2a685fd5bff235d812b8c5705621216f4c /numpy/f2py
parentaa3c27cce3d0625f719b812c9e6b0aa73114c612 (diff)
downloadnumpy-0b77f0e5f0e46b2ef7c570ebda046c34bbcc0f26.tar.gz
ran reindent.py to clean up whitespace
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/cb_rules.py2
-rw-r--r--numpy/f2py/lib/extgen/base.py26
-rw-r--r--numpy/f2py/lib/extgen/c_support.py6
-rw-r--r--numpy/f2py/lib/extgen/py_support.py52
-rw-r--r--numpy/f2py/lib/extgen/setup_py.py8
-rw-r--r--numpy/f2py/lib/extgen/utils.py4
-rw-r--r--numpy/f2py/lib/main.py4
-rw-r--r--numpy/f2py/lib/py_wrap_type.py12
-rw-r--r--numpy/f2py/lib/tests/test_module_module.py2
9 files changed, 58 insertions, 58 deletions
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py
index 25f8290e8..77acf9aa3 100644
--- a/numpy/f2py/cb_rules.py
+++ b/numpy/f2py/cb_rules.py
@@ -293,7 +293,7 @@ cb_arg_rules=[
},
'strarglens':{isstring:',int #varname#_cb_len'}, # untested with multiple args
'strarglens_td':{isstring:',int'}, # untested with multiple args
- 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args
+ 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args
},
{ # Scalars
'decl':{l_not(isintent_c):'\t#ctype# #varname#=(*#varname#_cb_capi);'},
diff --git a/numpy/f2py/lib/extgen/base.py b/numpy/f2py/lib/extgen/base.py
index 35be0e161..0576f5844 100644
--- a/numpy/f2py/lib/extgen/base.py
+++ b/numpy/f2py/lib/extgen/base.py
@@ -65,7 +65,7 @@ class Component(object):
return l
return self._components
components = property(components)
-
+
def initialize(self, *components, **options):
"""
Set additional attributes, add components to instance, etc.
@@ -86,7 +86,7 @@ class Component(object):
def provides(self):
"""
Return a code idiom name that the current class defines.
-
+
Used in avoiding redefinitions of functions and variables.
"""
if self._provides is None:
@@ -123,7 +123,7 @@ class Component(object):
r += Component._get_class_names(b)
return r
_get_class_names = staticmethod(_get_class_names)
-
+
def add(self, component, container_label=None):
"""
Append component and its target container label to components list.
@@ -205,7 +205,7 @@ class Component(object):
return evaluated template strings.
"""
#self.finalize()
-
+
# clean up containers
self.containers = {}
for n in dir(self):
@@ -249,7 +249,7 @@ class Component(object):
container = component.get_container(k)
container.add(r, component.provides)
else:
-
+
self.warning('%s: no container label specified for component providing %r'\
% (self.__class__.__name__,component.provides))
component.parent = old_parent
@@ -284,7 +284,7 @@ class Component(object):
def get_container(self, name):
""" Return named container.
-
+
Rules for returning containers:
(1) return local container if exists
(2) return parent container if exists
@@ -295,7 +295,7 @@ class Component(object):
return self.containers[name]
except KeyError:
pass
-
+
# parent container
parent = self.parent
while parent is not None:
@@ -380,7 +380,7 @@ class Component(object):
import numpy
return numpy.__version__
numpy_version = property(numpy_version)
-
+
class Container(object):
"""
Container of a list of named strings.
@@ -401,7 +401,7 @@ class Container(object):
>>> c += c2
>>> print c
"hey, hoo, bar"
-
+
"""
__metaclass__ = ComponentMetaClass
@@ -435,7 +435,7 @@ class Container(object):
self.replace_map = replace_map
self.ignore_empty_content = ignore_empty_content
self.skip_prefix_suffix_when_single = skip_prefix_suffix_when_single
-
+
def __nonzero__(self):
return bool(self.list)
@@ -452,7 +452,7 @@ class Container(object):
for i,l in lst:
self.add(other.list[i], l)
else:
- self.add(other)
+ self.add(other)
return self
__iadd__ = __add__
@@ -532,12 +532,12 @@ class Container(object):
lst = [(i,l) for (l,i) in self.label_map.items()]
lst.sort()
for i,l in lst:
- cpy.add(mapping(other.list[i]), l)
+ cpy.add(mapping(other.list[i]), l)
return cpy
def _test():
import doctest
doctest.testmod()
-
+
if __name__ == "__main__":
_test()
diff --git a/numpy/f2py/lib/extgen/c_support.py b/numpy/f2py/lib/extgen/c_support.py
index baaca7d17..95ef1ac55 100644
--- a/numpy/f2py/lib/extgen/c_support.py
+++ b/numpy/f2py/lib/extgen/c_support.py
@@ -177,7 +177,7 @@ class CFunction(Component):
%(CDeclaration)s
%(CBody)s
}'''
-
+
container_options = dict(
CArgument = dict(separator=', ', default='void'),
CDeclaration = dict(default='<KILLLINE>', use_indent=True, ignore_empty_content=True,
@@ -215,7 +215,7 @@ class CHeader(CLine):
>>> h = CHeader('noddy.h')
>>> print h.generate()
#include "noddy.h"
-
+
"""
template = '#include "%(line)s"'
@@ -288,6 +288,6 @@ extern \"C\" {
def _test():
import doctest
doctest.testmod()
-
+
if __name__ == "__main__":
_test()
diff --git a/numpy/f2py/lib/extgen/py_support.py b/numpy/f2py/lib/extgen/py_support.py
index af1619c98..2f69853b6 100644
--- a/numpy/f2py/lib/extgen/py_support.py
+++ b/numpy/f2py/lib/extgen/py_support.py
@@ -80,7 +80,7 @@ extern \"C\" {
self.cdecl = PyCModuleCDeclaration(pyname)
self += self.cdecl
-
+
self.main = PyCModuleInitFunction(pyname)
self += self.main
map(self.add, components)
@@ -93,7 +93,7 @@ extern \"C\" {
def update_SetupPy(self, parent):
parent.setup_py += self.evaluate(' config.add_extension(%(pyname)r, sources = ["%(extmodulesrc)s"])',
extmodulesrc = self.path)
- parent.init_py += 'import %s' % (self.pyname)
+ parent.init_py += 'import %s' % (self.pyname)
def finalize(self):
if self.need_numpy_support:
@@ -113,7 +113,7 @@ if (PyErr_Occurred()) {
def build(self, build_dir=None, clean_at_exit=None):
""" build(build_dir=None, clean_at_exit=None)
-
+
A convenience function to build, import, an return
an extension module object.
"""
@@ -123,7 +123,7 @@ if (PyErr_Occurred()) {
packagename = 'extgen_' + str(hex(int(time.time()*10000000)))[2:]
build_dir = os.path.join(tempfile.gettempdir(), packagename)
clean_at_exit = True
-
+
setup = Component.SetupPy(build_dir)
setup += self
s,o = setup.execute('build_ext','--inplace')
@@ -185,7 +185,7 @@ char extgen_module_doc[] =
)
default_component_class_name = 'Line'
-
+
def initialize(self, pyname):
self.pyname = pyname
return self
@@ -225,8 +225,8 @@ class PyCModuleInitFunction(CFunction):
}
return;
}
- """
-
+ """
+
template = '''\
%(CSpecifier)s
%(CTypeSpec)s
@@ -320,7 +320,7 @@ class FunctionSignature(Component):
map(self.add, components)
return self
def update_containers(self):
- self.container_OptExtArg += self.container_OptArg + self.container_ExtArg
+ self.container_OptExtArg += self.container_OptArg + self.container_ExtArg
class PyCFunction(CFunction):
@@ -329,7 +329,7 @@ class PyCFunction(CFunction):
>>> f = PyCFunction('foo')
>>> print f.generate()
static
- char pyc_function_foo_doc[] =
+ char pyc_function_foo_doc[] =
\" foo() -> None\"
\"\\n\\n:Returns:\\n None\"
;
@@ -366,7 +366,7 @@ class PyCFunction(CFunction):
template = '''\
static
-char %(name)s_doc[] =
+char %(name)s_doc[] =
" %(FunctionSignature)s"
%(Title)s
%(Description)s
@@ -399,7 +399,7 @@ PyObject*
}'''
container_options = CFunction.container_options.copy()
-
+
container_options.update(\
TMP = dict(),
@@ -429,13 +429,13 @@ PyObject*
ReqKWList = ReqKWList.parent_container_options,
OptKWList = OptKWList.parent_container_options,
ExtKWList = ExtKWList.parent_container_options,
-
+
ReqArgFmt = ReqArgFmt.parent_container_options,
OptArgFmt = OptArgFmt.parent_container_options,
ExtArgFmt = ExtArgFmt.parent_container_options,
OptExtArgFmt = OptExtArgFmt.ExtArgFmt.parent_container_options,
RetArgFmt = ExtArgFmt.parent_container_options,
-
+
ReqArgObj = ReqArgObj.parent_container_options,
OptArgObj = OptArgObj.parent_container_options,
ExtArgObj = ExtArgObj.parent_container_options,
@@ -443,7 +443,7 @@ PyObject*
FromPyObj = CCode.parent_container_options,
PyObjFrom = CCode.parent_container_options,
-
+
CleanPyObjFrom = dict(default='<KILLLINE>', reverse=True, use_indent=True, ignore_empty_content=True),
CleanCBody = dict(default='<KILLLINE>', reverse=True, use_indent=True, ignore_empty_content=True),
CleanFromPyObj = dict(default='<KILLLINE>', reverse=True, use_indent=True, ignore_empty_content=True),
@@ -457,7 +457,7 @@ PyObject*
PyCArgument = 'TMP',
CCode = 'CBody',
)
-
+
def initialize(self, pyname, *components, **options):
self.pyname = pyname
self.title = options.pop('title', None)
@@ -483,7 +483,7 @@ PyObject*
t = ' {"%(pyname)s", (PyCFunction)%(name)s, METH_VARARGS | METH_KEYWORDS, %(name)s_doc}'
parent.cdecl.add(self.evaluate(t),'PyMethodDef')
parent.cdecl.add(self.signature,'FunctionSignature')
-
+
def update_containers(self):
self.container_OptExtArg += self.container_OptArg + self.container_ExtArg
self.container_OptExtArgFmt += self.container_OptArgFmt + self.container_ExtArgFmt
@@ -585,7 +585,7 @@ class PyCArgument(Component):
if self.output_description is None:
self.output_description = description
if options: self.warning('%s unused options: %s\n' % (self.__class__.__name__, options))
-
+
self.name = name
self.ctype = ctype = PyCTypeSpec(ctype)
self += ctype
@@ -613,8 +613,8 @@ class PyCArgument(Component):
self.retpycvar = name + '_pyc_r'
ctype.set_titles(self)
-
- map(self.add, components)
+
+ map(self.add, components)
return self
def __repr__(self):
@@ -668,7 +668,7 @@ class PyCArgument(Component):
pass
else:
raise NotImplementedError('input_intent=%r' % (self.input_intent))
-
+
if self.output_intent=='return':
parent += RetArg(self.name)
parent.signature += RetArg(self.name)
@@ -679,11 +679,11 @@ class PyCArgument(Component):
elif self.output_intent=='hide':
pass
else:
- raise NotImplementedError('output_intent=%r' % (self.output_intent))
+ raise NotImplementedError('output_intent=%r' % (self.output_intent))
class PyCReturn(PyCArgument):
- def initialize(self, name, ctype = object, *components, **options):
+ def initialize(self, name, ctype = object, *components, **options):
return PyCArgument(name, ctype, input_intent='hide', output_intent='return', *components, **options)
class PyCTypeSpec(CTypeSpec):
@@ -898,7 +898,7 @@ class PyCTypeSpec(CTypeSpec):
c_long = (None,'long', 'l', 'l', '0'),
c_unsigned_long = (None,'unsigned long', 'k', 'k', '0'),
c_long_long = (None,'PY_LONG_LONG', 'L', 'L', '0'),
- c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'),
+ c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'),
c_Py_ssize_t = (None,'Py_ssize_t', 'n', 'n', '0'),
c_char1 = (None,'char', 'c', 'c', '"\\0"'),
c_float = (None,'float', 'f', 'f', '0.0'),
@@ -911,7 +911,7 @@ class PyCTypeSpec(CTypeSpec):
def initialize(self, typeobj):
if isinstance(typeobj, self.__class__):
return typeobj
-
+
m = self.typeinfo_map
key = None
@@ -955,7 +955,7 @@ class PyCTypeSpec(CTypeSpec):
#self.add(Component.get('import_array'), 'ModuleInit')
if key.startswith('numeric_'):
raise NotImplementedError(self.__class__.__name__ + ': Numeric support')
-
+
return self
def finalize(self):
@@ -1099,6 +1099,6 @@ if (!(%(retpycvar)s==%(pycvar)s)) {
def _test():
import doctest
doctest.testmod()
-
+
if __name__ == "__main__":
_test()
diff --git a/numpy/f2py/lib/extgen/setup_py.py b/numpy/f2py/lib/extgen/setup_py.py
index 665ef5619..da1d84943 100644
--- a/numpy/f2py/lib/extgen/setup_py.py
+++ b/numpy/f2py/lib/extgen/setup_py.py
@@ -51,7 +51,7 @@ class SetupPy(Component):
>>> import SetupPy_doctest as mypackage
>>> print mypackage.foo.__doc__ #doctest: +ELLIPSIS
This module 'foo' is generated with ExtGen from NumPy version...
-
+
"""
template_setup_py_start = '''\
def configuration(parent_package='', top_path = ''):
@@ -88,7 +88,7 @@ if __name__ == "__main__":
self += init_py
self += setup_py
-
+
map(self.add, components)
return self
@@ -115,10 +115,10 @@ if __name__ == "__main__":
self.info('leaving %r directory' % (self.path))
return r
-
+
def _test():
import doctest
doctest.testmod()
-
+
if __name__ == "__main__":
_test()
diff --git a/numpy/f2py/lib/extgen/utils.py b/numpy/f2py/lib/extgen/utils.py
index b3666c8f6..aa156469f 100644
--- a/numpy/f2py/lib/extgen/utils.py
+++ b/numpy/f2py/lib/extgen/utils.py
@@ -104,7 +104,7 @@ class FileSource(Component):
Line = 'Content',
Code = 'Content',
)
-
+
def initialize(self, path, *components, **options):
self.path = path
map(self.add, components)
@@ -121,6 +121,6 @@ class FileSource(Component):
def _test():
import doctest
doctest.testmod()
-
+
if __name__ == "__main__":
_test()
diff --git a/numpy/f2py/lib/main.py b/numpy/f2py/lib/main.py
index 6c2e1415e..de34895e5 100644
--- a/numpy/f2py/lib/main.py
+++ b/numpy/f2py/lib/main.py
@@ -418,7 +418,7 @@ def build_extension(sys_argv, sources_only = False):
'--build-clib',build_dir_clib_clib,
]
temp_dirs = [build_dir_ext_temp, build_dir_clib_temp, build_dir_clib_clib]
-
+
if fc_flags:
new_sys_argv += ['config_fc'] + fc_flags
sys.argv[:] = new_sys_argv
@@ -492,7 +492,7 @@ def compile(source,
if source_ext is None:
reader = get_reader(source)
source_ext = {'free90':'.f90','fix90':'.f90','fix77':'.f','pyf':'.pyf'}[reader.mode]
-
+
if modulenames is None:
modulenames = jobname,
if os.path.isdir(tmpdir):
diff --git a/numpy/f2py/lib/py_wrap_type.py b/numpy/f2py/lib/py_wrap_type.py
index 7b90e7ed1..1c7d8f309 100644
--- a/numpy/f2py/lib/py_wrap_type.py
+++ b/numpy/f2py/lib/py_wrap_type.py
@@ -453,12 +453,12 @@ static PyTypeObject %(otype)sType = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Fortran derived type %(name)s objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
%(otype)s_methods, /* tp_methods */
0 /*%(otype)s_members*/, /* tp_members */
%(otype)s_getseters, /* tp_getset */
diff --git a/numpy/f2py/lib/tests/test_module_module.py b/numpy/f2py/lib/tests/test_module_module.py
index 0f0e88cc9..d56cb45a6 100644
--- a/numpy/f2py/lib/tests/test_module_module.py
+++ b/numpy/f2py/lib/tests/test_module_module.py
@@ -42,7 +42,7 @@ module test_module_module_ext
type(rat) a
print*,"In bar,a=",a
end subroutine bar
-end module test_module_module_ext
+end module test_module_module_ext
'''
m,m2 = compile(fortran_code, modulenames=['test_module_module_ext',