Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
consistent use of hascolumn
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed May 26, 2019
1 parent 85022e9 commit 519468c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions awkward/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,10 @@ def _hascolumn(self, name, seen):
return False
elif isinstance(self._to, numpy.dtype):
return name in self._to.names
else:
elif isinstance(self._to, Type):
return self._to._hascolumn(name, seen)
else:
return False

def _subrepr(self, labeled, seen):
if isinstance(self._to, Type):
Expand Down Expand Up @@ -449,7 +451,13 @@ def _hascolumn(self, name, seen):
if id(self) in seen:
return False
seen.add(id(self))
return any(x._to._hascolumn(name, seen) for x in self._possibilities)
for x in self._possibilities:
if isinstance(x, numpy.dtype) and x.names is not None and name in x.names:
return True
elif isinstance(x, Type) and x._hascolumn(name, seen):
return True
else:
return False

def __len__(self):
return len(self._possibilities)
Expand Down

0 comments on commit 519468c

Please sign in to comment.