Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 0d5ab0d

Browse files
author
Juanjo Alvarez
committed
Some fixes from review
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
1 parent a3e9c85 commit 0d5ab0d

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

bblfsh/compat.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
from bblfsh.pyuast import uast, iterator as native_iterator
1818
from bblfsh.tree_order import TreeOrder
1919

20-
if "BBLFSH_COMPAT_SHUTUP" not in os.environ:
21-
print("Warning: using deprecated bblfsh v1 compatibility layer.",
22-
file=sys.stderr)
20+
print("Warning: using deprecated bblfsh v1 compatibility layer.", file=sys.stderr)
2321

2422

2523
class WrongTypeException(Exception):
@@ -109,15 +107,10 @@ def close(self) -> None:
109107

110108

111109
class CompatNodeIterator:
112-
def __init__(
113-
self,
114-
nodeit: NodeIterator,
115-
only_nodes: bool = False
116-
) -> None:
110+
def __init__(self, nodeit: NodeIterator, only_nodes: bool = False) -> None:
117111
self._nodeit = nodeit
118112
self._only_nodes = only_nodes
119113
# Used to forward calls of the old Node object
120-
# Check if this, and properties(), are needed
121114
self._last_node: Optional[Node] = None
122115

123116
def __iter__(self) -> 'CompatNodeIterator':
@@ -158,8 +151,8 @@ def properties(self) -> dict:
158151
return {}
159152

160153

161-
def iterator(n: Union[Node, CompatNodeIterator], order: TreeOrder = TreeOrder.PRE_ORDER)\
162-
-> CompatNodeIterator:
154+
def iterator(n: Union[Node, CompatNodeIterator, dict],
155+
order: TreeOrder = TreeOrder.PRE_ORDER) -> CompatNodeIterator:
163156

164157
if isinstance(n, CompatNodeIterator):
165158
return CompatNodeIterator(n._nodeit.iterate(order), only_nodes=True)

0 commit comments

Comments
 (0)