Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/backend.py
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | def check_swhid(self, swhid): | ||||
m = re.search(r"malformed SWHID: (\w+)", str(e)) | m = re.search(r"malformed SWHID: (\w+)", str(e)) | ||||
if m: | if m: | ||||
raise ValueError(f"malformed SWHID: {m[1]}") | raise ValueError(f"malformed SWHID: {m[1]}") | ||||
m = re.search(r"Unknown SWHID: (\w+)", str(e)) | m = re.search(r"Unknown SWHID: (\w+)", str(e)) | ||||
if m: | if m: | ||||
raise NameError(f"Unknown SWHID: {m[1]}") | raise NameError(f"Unknown SWHID: {m[1]}") | ||||
raise | raise | ||||
def count(self, ttype, direction, edges_fmt, src): | def count(self, ttype, *args): | ||||
method = getattr(self.entry, "count_" + ttype) | method = getattr(self.entry, "count_" + ttype) | ||||
return method(direction, edges_fmt, src) | return method(*args) | ||||
async def traversal(self, ttype, *args): | async def traversal(self, ttype, *args): | ||||
method = getattr(self.stream_proxy, ttype) | method = getattr(self.stream_proxy, ttype) | ||||
async for line in method(*args): | async for line in method(*args): | ||||
yield line.decode().rstrip("\n") | yield line.decode().rstrip("\n") | ||||
class JavaStreamProxy: | class JavaStreamProxy: | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |