Skip to content

Commit 7163cfb

Browse files
authored
Merge pull request #16 from cesbit/dev
use is_table
2 parents 8f69c85 + 9618e62 commit 7163cfb

File tree

2 files changed

+6
-107
lines changed

2 files changed

+6
-107
lines changed

asyncsnmplib/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ async def get_next_multi(self, oids: Iterable[TOid]
9191
vbs = await self._get_next(oids)
9292
return [(oid, value) for oid, _, value in vbs if oid[:-1] in oids]
9393

94-
async def walk(self, oid: TOid) -> List[Tuple[TOid, TValue]]:
94+
async def walk(self, oid: TOid, is_table: bool,
95+
) -> List[Tuple[TOid, TValue]]:
9596
next_oid = oid
9697
prefixlen = len(oid)
9798
rows = []
@@ -103,7 +104,7 @@ async def walk(self, oid: TOid) -> List[Tuple[TOid, TValue]]:
103104
# we're done
104105
break
105106

106-
if next_oid[prefixlen + 1] == 0:
107+
if is_table or next_oid[prefixlen + 1] == 0:
107108
# this is a row we want in the result, otherwise
108109
# we are in a table
109110
if len(rows) == self.max_rows:
@@ -130,7 +131,8 @@ def close(self):
130131
class SnmpV1(Snmp):
131132
version = 0
132133

133-
async def walk(self, oid: TOid) -> List[Tuple[TOid, TValue]]:
134+
async def walk(self, oid: TOid, is_table: bool,
135+
) -> List[Tuple[TOid, TValue]]:
134136
next_oid = oid
135137
prefixlen = len(oid)
136138
rows = []
@@ -147,7 +149,7 @@ async def walk(self, oid: TOid) -> List[Tuple[TOid, TValue]]:
147149
# we're done
148150
break
149151

150-
if next_oid[prefixlen + 1] == 0:
152+
if is_table or next_oid[prefixlen + 1] == 0:
151153
# this is a row we want in the result, otherwise
152154
# we are in a table
153155
if len(rows) == self.max_rows:

asyncsnmplib/utils.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)