Skip to content

Commit

Permalink
Merge pull request #38 from pfernique/master
Browse files Browse the repository at this point in the history
Improve health
  • Loading branch information
pfernique committed Aug 19, 2016
2 parents 505c315 + 2c5bc3a commit ec6638b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/py/autowig/asg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,40 +1591,40 @@ def add_directory(self, dirname):
initname = str(dirname)
if not initname.endswith(os.sep):
initname += os.sep
if not initname in self._nodes:
if initname not in self._nodes:
idparent = initname
if not idparent in self._syntax_edges:
if idparent not in self._syntax_edges:
self._syntax_edges[idparent] = []
while not dirname == os.sep:
idnode = idparent
if not idnode.endswith(os.sep):
idnode += os.sep
if not idnode in self._nodes:
if idnode not in self._nodes:
self._nodes[idnode] = dict(_proxy=DirectoryProxy)
dirname = dirname.parent
idparent = str(dirname)
if not idparent.endswith(os.sep):
idparent += os.sep
if not idparent in self._syntax_edges:
if idparent not in self._syntax_edges:
self._syntax_edges[idparent] = []
self._syntax_edges[idparent].append(idnode)
else:
break
if dirname == os.sep and not os.sep in self._nodes:
if dirname == os.sep and os.sep not in self._nodes:
self._nodes[os.sep] = dict(_proxy=DirectoryProxy)
return self[initname]

def add_file(self, filename, **kwargs):
filename = path(filename).abspath()
initname = str(filename)
proxy = kwargs.pop('proxy', FileProxy)
if not initname in self._nodes:
if initname not in self._nodes:
idnode = str(filename)
self._nodes[idnode] = dict(_proxy=proxy, **kwargs)
idparent = str(filename.parent)
if not idparent.endswith(os.sep):
idparent += os.sep
if not idparent in self._syntax_edges:
if idparent not in self._syntax_edges:
self._syntax_edges[idparent] = []
self._syntax_edges[idparent].append(idnode)
self.add_directory(idparent)
Expand Down Expand Up @@ -1729,7 +1729,7 @@ def dependencies(self, *nodes):

while len(white) > 0:
node = white.pop()
if not node._node in black:
if node._node not in black:
black.add(node._node)
parent = node.parent
if not isinstance(parent, NamespaceProxy) and visitor(parent):
Expand Down
2 changes: 1 addition & 1 deletion src/py/autowig/boost_python_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def _feedback(self, row):
if not parsed:
parsed = parse.parse(' class_{hash}.def({python}, {cpp}, {documentation});', line)
if parsed:
if not 'what' in parsed.named:
if 'what' not in parsed.named:
if parsed['cpp'].startswith('method_pointer_'):
pointer = parsed['cpp']
parsed = None
Expand Down
10 changes: 5 additions & 5 deletions src/py/autowig/libclang_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def read_enum(asg, cursor, scope):
return children
else:
spelling = 'enum ' + spelling
if not spelling in asg:
if spelling not in asg:
asg._syntax_edges[spelling] = []
asg._nodes[spelling] = dict(_proxy = EnumerationProxy,
_comment = "",
Expand Down Expand Up @@ -334,7 +334,7 @@ def read_typedef(asg, typedef, scope):
spelling = spelling + "::" + typedef.spelling
else:
spelling = spelling + typedef.spelling
if not spelling in asg:
if spelling not in asg:
try:
with warnings.catch_warnings():
warnings.simplefilter("error")
Expand Down Expand Up @@ -536,7 +536,7 @@ def read_tag(asg, cursor, scope):
spelling = 'union ' + spelling
else:
spelling = 'class ' + spelling
if not spelling in asg:
if spelling not in asg:
if cursor.kind in [CursorKind.STRUCT_DECL, CursorKind.UNION_DECL]:
asg._nodes[spelling] = dict(_proxy=ClassProxy,
_is_abstract=True,
Expand Down Expand Up @@ -614,11 +614,11 @@ def read_namespace(asg, cursor, scope):
read_access(asg, cursor.access_specifier, *children)
return children
else:
if not spelling in asg:
if spelling not in asg:
asg._nodes[spelling] = dict(_proxy=NamespaceProxy,
_is_inline=False) # TODO
asg._syntax_edges[spelling] = []
if not spelling in asg._syntax_edges[scope]:
if spelling not in asg._syntax_edges[scope]:
asg._syntax_edges[scope].append(spelling)
for child in cursor.get_children():
read_cursor(asg, child, spelling)
Expand Down
2 changes: 1 addition & 1 deletion src/py/autowig/proxy_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __setitem__(self, proxy, cls):
if issubclass(cls, self._base):
self._cache[proxy] = cls
elif isinstance(cls, basestring):
if not cls in self:
if cls not in self:
raise ValueError('\'cls\' parameter must be an existing proxy')
if proxy == cls:
raise ValueError('\'proxy\' and \'cls\' parameters cannot have the same value')
Expand Down

0 comments on commit ec6638b

Please sign in to comment.