MCPcopy
hub / github.com/evilsocket/opensnitch / import_

Function import_

ui/opensnitch/proto/__init__.py:41–57  ·  view source on GitHub ↗

load the protobuffer needed based on the grpc and protobuffer version installed in the system.

()

Source from the content-addressed store, hash-verified

39old_grpc = "opensnitch.proto.pre3200.ui_pb2_grpc"
40
41def import_():
42 """load the protobuffer needed based on the grpc and protobuffer version
43 installed in the system.
44 """
45 try:
46 gui_version, grpc_version, proto_version = Versions.get()
47 proto_ver = default_pb
48 grpc_ver = default_grpc
49
50 if Version(proto_version) < Version("3.20.0"):
51 proto_ver = old_pb
52 grpc_ver = old_grpc
53
54 return importlib.import_module(proto_ver), importlib.import_module(grpc_ver)
55 except Exception as e:
56 print("error importing protobuffer: ", repr(e))
57 return importlib.import_module(default_pb, default_grpc)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected