Commit 6fcea273 authored by Robert Bradshaw's avatar Robert Bradshaw

remove trailing whitespace

parent 0a15980d
...@@ -613,7 +613,7 @@ def run_pipeline(source, options, full_module_name = None): ...@@ -613,7 +613,7 @@ def run_pipeline(source, options, full_module_name = None):
if os.path.exists(html_filename): if os.path.exists(html_filename):
line = codecs.open(html_filename, "r", encoding="UTF-8").readline() line = codecs.open(html_filename, "r", encoding="UTF-8").readline()
if line.startswith(u'<!-- Generated by Cython'): if line.startswith(u'<!-- Generated by Cython'):
options.annotate = True options.annotate = True
# Get pipeline # Get pipeline
if source_ext.lower() == '.py': if source_ext.lower() == '.py':
......
...@@ -73,7 +73,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -73,7 +73,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_c_code(env, options, result) self.generate_c_code(env, options, result)
self.generate_h_code(env, options, result) self.generate_h_code(env, options, result)
self.generate_api_code(env, result) self.generate_api_code(env, result)
def has_imported_c_functions(self): def has_imported_c_functions(self):
for module in self.referenced_modules: for module in self.referenced_modules:
for entry in module.cfunc_entries: for entry in module.cfunc_entries:
...@@ -166,7 +166,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -166,7 +166,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def api_name(self, env): def api_name(self, env):
return env.qualified_name.replace(".", "__") return env.qualified_name.replace(".", "__")
def generate_api_code(self, env, result): def generate_api_code(self, env, result):
def api_entries(entries, pxd=0): def api_entries(entries, pxd=0):
return [entry for entry in entries return [entry for entry in entries
...@@ -249,7 +249,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -249,7 +249,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def generate_cclass_header_code(self, type, h_code): def generate_cclass_header_code(self, type, h_code):
h_code.putln("%s %s %s;" % ( h_code.putln("%s %s %s;" % (
Naming.extern_c_macro, Naming.extern_c_macro,
PyrexTypes.public_decl("PyTypeObject", "DL_IMPORT"), PyrexTypes.public_decl("PyTypeObject", "DL_IMPORT"),
type.typeobj_cname)) type.typeobj_cname))
...@@ -1002,7 +1002,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1002,7 +1002,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
storage_class = "static " storage_class = "static "
dll_linkage = None dll_linkage = None
type = entry.type type = entry.type
if not definition and entry.defined_in_pxd: if not definition and entry.defined_in_pxd:
type = CPtrType(type) type = CPtrType(type)
header = type.declaration_code(entry.cname, header = type.declaration_code(entry.cname,
...@@ -1775,7 +1775,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1775,7 +1775,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("#endif") code.putln("#endif")
code.putln("{") code.putln("{")
tempdecl_code = code.insertion_point() tempdecl_code = code.insertion_point()
code.put_declare_refcount_context() code.put_declare_refcount_context()
code.putln("#if CYTHON_REFNANNY") code.putln("#if CYTHON_REFNANNY")
code.putln("__Pyx_RefNanny = __Pyx_RefNannyImportAPI(\"refnanny\");") code.putln("__Pyx_RefNanny = __Pyx_RefNannyImportAPI(\"refnanny\");")
......
...@@ -548,7 +548,7 @@ class CFuncDeclaratorNode(CDeclaratorNode): ...@@ -548,7 +548,7 @@ class CFuncDeclaratorNode(CDeclaratorNode):
other_type = type_node.analyse_as_type(env) other_type = type_node.analyse_as_type(env)
if other_type is None: if other_type is None:
error(type_node.pos, "Not a type") error(type_node.pos, "Not a type")
elif (type is not PyrexTypes.py_object_type elif (type is not PyrexTypes.py_object_type
and not type.same_as(other_type)): and not type.same_as(other_type)):
error(self.base.pos, "Signature does not agree with previous declaration") error(self.base.pos, "Signature does not agree with previous declaration")
error(type_node.pos, "Previous declaration here") error(type_node.pos, "Previous declaration here")
...@@ -1099,7 +1099,7 @@ class CEnumDefNode(StatNode): ...@@ -1099,7 +1099,7 @@ class CEnumDefNode(StatNode):
# api boolean # api boolean
# in_pxd boolean # in_pxd boolean
# entry Entry # entry Entry
child_attrs = ["items"] child_attrs = ["items"]
def analyse_declarations(self, env): def analyse_declarations(self, env):
...@@ -1146,7 +1146,7 @@ class CEnumDefItemNode(StatNode): ...@@ -1146,7 +1146,7 @@ class CEnumDefItemNode(StatNode):
if not self.value.type.is_int: if not self.value.type.is_int:
self.value = self.value.coerce_to(PyrexTypes.c_int_type, env) self.value = self.value.coerce_to(PyrexTypes.c_int_type, env)
self.value.analyse_const_expression(env) self.value.analyse_const_expression(env)
entry = env.declare_const(self.name, enum_entry.type, entry = env.declare_const(self.name, enum_entry.type,
self.value, self.pos, cname = self.cname, self.value, self.pos, cname = self.cname,
visibility = enum_entry.visibility, api = enum_entry.api) visibility = enum_entry.visibility, api = enum_entry.api)
enum_entry.enum_values.append(entry) enum_entry.enum_values.append(entry)
...@@ -1170,7 +1170,7 @@ class CTypeDefNode(StatNode): ...@@ -1170,7 +1170,7 @@ class CTypeDefNode(StatNode):
cname = cname, visibility = self.visibility, api = self.api) cname = cname, visibility = self.visibility, api = self.api)
if self.in_pxd and not env.in_cinclude: if self.in_pxd and not env.in_cinclude:
entry.defined_in_pxd = 1 entry.defined_in_pxd = 1
def analyse_expressions(self, env): def analyse_expressions(self, env):
pass pass
def generate_execution_code(self, code): def generate_execution_code(self, code):
...@@ -1221,7 +1221,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1221,7 +1221,7 @@ class FuncDefNode(StatNode, BlockNode):
other_type = type_node.analyse_as_type(env) other_type = type_node.analyse_as_type(env)
if other_type is None: if other_type is None:
error(type_node.pos, "Not a type") error(type_node.pos, "Not a type")
elif (type is not PyrexTypes.py_object_type elif (type is not PyrexTypes.py_object_type
and not type.same_as(other_type)): and not type.same_as(other_type)):
error(arg.base_type.pos, "Signature does not agree with previous declaration") error(arg.base_type.pos, "Signature does not agree with previous declaration")
error(type_node.pos, "Previous declaration here") error(type_node.pos, "Previous declaration here")
...@@ -1815,7 +1815,7 @@ class CFuncDefNode(FuncDefNode): ...@@ -1815,7 +1815,7 @@ class CFuncDefNode(FuncDefNode):
self.modifiers[self.modifiers.index('inline')] = 'cython_inline' self.modifiers[self.modifiers.index('inline')] = 'cython_inline'
if self.modifiers: if self.modifiers:
modifiers = "%s " % ' '.join(self.modifiers).upper() modifiers = "%s " % ' '.join(self.modifiers).upper()
header = self.return_type.declaration_code(entity, dll_linkage=dll_linkage) header = self.return_type.declaration_code(entity, dll_linkage=dll_linkage)
#print (storage_class, modifiers, header) #print (storage_class, modifiers, header)
code.putln("%s%s%s {" % (storage_class, modifiers, header)) code.putln("%s%s%s {" % (storage_class, modifiers, header))
...@@ -3446,7 +3446,7 @@ class CClassDefNode(ClassDefNode): ...@@ -3446,7 +3446,7 @@ class CClassDefNode(ClassDefNode):
visibility = self.visibility, visibility = self.visibility,
typedef_flag = self.typedef_flag, typedef_flag = self.typedef_flag,
api = self.api, api = self.api,
buffer_defaults = buffer_defaults, buffer_defaults = buffer_defaults,
shadow = self.shadow) shadow = self.shadow)
if self.shadow: if self.shadow:
home_scope.lookup(self.class_name).as_variable = self.entry home_scope.lookup(self.class_name).as_variable = self.entry
...@@ -4172,8 +4172,8 @@ class RaiseStatNode(StatNode): ...@@ -4172,8 +4172,8 @@ class RaiseStatNode(StatNode):
if self.exc_type and not self.exc_value and not self.exc_tb: if self.exc_type and not self.exc_value and not self.exc_tb:
exc = self.exc_type exc = self.exc_type
import ExprNodes import ExprNodes
if (isinstance(exc, ExprNodes.SimpleCallNode) and if (isinstance(exc, ExprNodes.SimpleCallNode) and
not (exc.args or (exc.arg_tuple is not None and not (exc.args or (exc.arg_tuple is not None and
exc.arg_tuple.args))): exc.arg_tuple.args))):
exc = exc.function # extract the exception type exc = exc.function # extract the exception type
if exc.is_name and exc.entry.is_builtin: if exc.is_name and exc.entry.is_builtin:
......
...@@ -1211,7 +1211,7 @@ if VALUE is not None: ...@@ -1211,7 +1211,7 @@ if VALUE is not None:
arg = copy.deepcopy(arg_template) arg = copy.deepcopy(arg_template)
arg.declarator.name = entry.name arg.declarator.name = entry.name
init_method.args.append(arg) init_method.args.append(arg)
# setters/getters # setters/getters
for entry, attr in zip(var_entries, attributes): for entry, attr in zip(var_entries, attributes):
# TODO: branch on visibility # TODO: branch on visibility
...@@ -1224,7 +1224,7 @@ if VALUE is not None: ...@@ -1224,7 +1224,7 @@ if VALUE is not None:
}, pos = entry.pos).stats[0] }, pos = entry.pos).stats[0]
property.name = entry.name property.name = entry.name
wrapper_class.body.stats.append(property) wrapper_class.body.stats.append(property)
wrapper_class.analyse_declarations(self.env_stack[-1]) wrapper_class.analyse_declarations(self.env_stack[-1])
return self.visit_CClassDefNode(wrapper_class) return self.visit_CClassDefNode(wrapper_class)
......
...@@ -2525,7 +2525,7 @@ def p_c_struct_or_union_definition(s, pos, ctx): ...@@ -2525,7 +2525,7 @@ def p_c_struct_or_union_definition(s, pos, ctx):
s.expect_dedent() s.expect_dedent()
else: else:
s.expect_newline("Syntax error in struct or union definition") s.expect_newline("Syntax error in struct or union definition")
return Nodes.CStructOrUnionDefNode(pos, return Nodes.CStructOrUnionDefNode(pos,
name = name, cname = cname, kind = kind, attributes = attributes, name = name, cname = cname, kind = kind, attributes = attributes,
typedef_flag = ctx.typedef_flag, visibility = ctx.visibility, typedef_flag = ctx.typedef_flag, visibility = ctx.visibility,
api = ctx.api, in_pxd = ctx.level == 'module_pxd', packed = packed) api = ctx.api, in_pxd = ctx.level == 'module_pxd', packed = packed)
...@@ -2613,7 +2613,7 @@ def p_ctypedef_statement(s, ctx): ...@@ -2613,7 +2613,7 @@ def p_ctypedef_statement(s, ctx):
s.expect_newline("Syntax error in ctypedef statement") s.expect_newline("Syntax error in ctypedef statement")
return Nodes.CTypeDefNode( return Nodes.CTypeDefNode(
pos, base_type = base_type, pos, base_type = base_type,
declarator = declarator, declarator = declarator,
visibility = visibility, api = api, visibility = visibility, api = api,
in_pxd = ctx.level == 'module_pxd') in_pxd = ctx.level == 'module_pxd')
......
This diff is collapsed.
...@@ -401,13 +401,13 @@ class Scope(object): ...@@ -401,13 +401,13 @@ class Scope(object):
except ValueError, e: except ValueError, e:
error(pos, e.args[0]) error(pos, e.args[0])
type = PyrexTypes.error_type type = PyrexTypes.error_type
entry = self.declare_type(name, type, pos, cname, entry = self.declare_type(name, type, pos, cname,
visibility = visibility, api = api) visibility = visibility, api = api)
type.qualified_name = entry.qualified_name type.qualified_name = entry.qualified_name
return entry return entry
def declare_struct_or_union(self, name, kind, scope, def declare_struct_or_union(self, name, kind, scope,
typedef_flag, pos, cname = None, typedef_flag, pos, cname = None,
visibility = 'private', api = 0, visibility = 'private', api = 0,
packed = False): packed = False):
# Add an entry for a struct or union definition. # Add an entry for a struct or union definition.
...@@ -488,7 +488,7 @@ class Scope(object): ...@@ -488,7 +488,7 @@ class Scope(object):
if entry.visibility != visibility: if entry.visibility != visibility:
error(pos, "'%s' previously declared as '%s'" % ( error(pos, "'%s' previously declared as '%s'" % (
entry.name, entry.visibility)) entry.name, entry.visibility))
def declare_enum(self, name, pos, cname, typedef_flag, def declare_enum(self, name, pos, cname, typedef_flag,
visibility = 'private', api = 0): visibility = 'private', api = 0):
if name: if name:
...@@ -504,7 +504,7 @@ class Scope(object): ...@@ -504,7 +504,7 @@ class Scope(object):
visibility = visibility, api = api) visibility = visibility, api = api)
entry.enum_values = [] entry.enum_values = []
self.sue_entries.append(entry) self.sue_entries.append(entry)
return entry return entry
def declare_var(self, name, type, pos, def declare_var(self, name, type, pos,
cname = None, visibility = 'private', api = 0, is_cdef = 0): cname = None, visibility = 'private', api = 0, is_cdef = 0):
...@@ -1059,7 +1059,7 @@ class ModuleScope(Scope): ...@@ -1059,7 +1059,7 @@ class ModuleScope(Scope):
buffer_defaults = None, shadow = 0): buffer_defaults = None, shadow = 0):
# If this is a non-extern typedef class, expose the typedef, but use # If this is a non-extern typedef class, expose the typedef, but use
# the non-typedef struct internally to avoid needing forward # the non-typedef struct internally to avoid needing forward
# declarations for anonymous structs. # declarations for anonymous structs.
if typedef_flag and visibility != 'extern': if typedef_flag and visibility != 'extern':
if not (visibility == 'public' or api): if not (visibility == 'public' or api):
warning(pos, "ctypedef only valid for 'extern' , 'public', and 'api'", 2) warning(pos, "ctypedef only valid for 'extern' , 'public', and 'api'", 2)
...@@ -1462,7 +1462,7 @@ class StructOrUnionScope(Scope): ...@@ -1462,7 +1462,7 @@ class StructOrUnionScope(Scope):
def declare_cfunction(self, name, type, pos, def declare_cfunction(self, name, type, pos,
cname = None, visibility = 'private', defining = 0, cname = None, visibility = 'private', defining = 0,
api = 0, in_pxd = 0, modifiers = ()): # currently no utility code ... api = 0, in_pxd = 0, modifiers = ()): # currently no utility code ...
return self.declare_var(name, type, pos, return self.declare_var(name, type, pos,
cname=cname, visibility=visibility) cname=cname, visibility=visibility)
class ClassScope(Scope): class ClassScope(Scope):
...@@ -1627,7 +1627,7 @@ class CClassScope(ClassScope): ...@@ -1627,7 +1627,7 @@ class CClassScope(ClassScope):
if name == "__new__": if name == "__new__":
error(pos, "__new__ method of extension type will change semantics " error(pos, "__new__ method of extension type will change semantics "
"in a future version of Pyrex and Cython. Use __cinit__ instead.") "in a future version of Pyrex and Cython. Use __cinit__ instead.")
entry = self.declare_var(name, py_object_type, pos, entry = self.declare_var(name, py_object_type, pos,
visibility='extern') visibility='extern')
special_sig = get_special_method_signature(name) special_sig = get_special_method_signature(name)
if special_sig: if special_sig:
...@@ -1753,7 +1753,7 @@ class CppClassScope(Scope): ...@@ -1753,7 +1753,7 @@ class CppClassScope(Scope):
self.inherited_var_entries = [] self.inherited_var_entries = []
def declare_var(self, name, type, pos, def declare_var(self, name, type, pos,
cname = None, visibility = 'extern', api = 0, cname = None, visibility = 'extern', api = 0,
is_cdef = 0, allow_pyobject = 0): is_cdef = 0, allow_pyobject = 0):
# Add an entry for an attribute. # Add an entry for an attribute.
if not cname: if not cname:
...@@ -1795,7 +1795,7 @@ class CppClassScope(Scope): ...@@ -1795,7 +1795,7 @@ class CppClassScope(Scope):
error(pos, "no matching function for call to %s::%s()" % error(pos, "no matching function for call to %s::%s()" %
(self.default_constructor, self.default_constructor)) (self.default_constructor, self.default_constructor))
def declare_cfunction(self, name, type, pos, cname = None, def declare_cfunction(self, name, type, pos, cname = None,
visibility = 'extern', api = 0, defining = 0, visibility = 'extern', api = 0, defining = 0,
in_pxd = 0, modifiers = (), utility_code = None): in_pxd = 0, modifiers = (), utility_code = None):
if name == self.name.split('::')[-1] and cname is None: if name == self.name.split('::')[-1] and cname is None:
...@@ -1803,7 +1803,7 @@ class CppClassScope(Scope): ...@@ -1803,7 +1803,7 @@ class CppClassScope(Scope):
name = '<init>' name = '<init>'
type.return_type = self.lookup(self.name).type type.return_type = self.lookup(self.name).type
prev_entry = self.lookup_here(name) prev_entry = self.lookup_here(name)
entry = self.declare_var(name, type, pos, entry = self.declare_var(name, type, pos,
cname=cname, visibility=visibility) cname=cname, visibility=visibility)
if prev_entry: if prev_entry:
entry.overloaded_alternatives = prev_entry.all_alternatives() entry.overloaded_alternatives = prev_entry.all_alternatives()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment