File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import pandas as pd
1313from google .protobuf .descriptor_pb2 import DescriptorProto
1414from google .protobuf .json_format import MessageToDict
15+ from importlib import import_module
1516
1617DEFAULT_ENDPOINT = "api.streamingfast.io:443"
1718
1819
1920def retrieve_class (module_name : str , class_name : str ):
20- module = __import__ (module_name )
21+ module = import_module (module_name )
2122 return getattr (module , class_name )
2223
2324
@@ -95,8 +96,7 @@ def _class_from_module(self, module_name: str):
9596 raw_module_path : str = self .proto_file_map .get (output_type )
9697 if raw_module_path is None :
9798 return None
98- module_path : str = raw_module_path .split ("/" )[- 1 ].split (".proto" )[0 ]
99- pb2_path : str = f"{ module_path } _pb2"
99+ pb2_path : str = raw_module_path .replace ('.proto' , '_pb2' ).replace ('/' , '.' )
100100 return retrieve_class (pb2_path , output_type )
101101
102102 def _parse_from_string (self , raw : str , key : str , output_class ) -> dict :
You can’t perform that action at this time.
0 commit comments