9898}
9999
100100
101- def _get_from_method_map (
102- method_name : str ,
103- argument_name : str ,
104- method_type_map : MethodTypeMap ,
105- ) -> FakeAnnotation | None :
106- if ALL in method_type_map :
107- operation_type_map = method_type_map [ALL ]
108- if argument_name in operation_type_map :
109- return operation_type_map [argument_name ]
110-
111- if method_name in method_type_map :
112- operation_type_map = method_type_map [method_name ]
113- if argument_name in operation_type_map :
114- return operation_type_map [argument_name ]
115-
116- return None
117-
118-
119- def _get_from_class_map (
120- class_name : str ,
121- method_name : str ,
122- argument_name : str ,
123- class_type_map : ClassTypeMap ,
124- ) -> FakeAnnotation | None :
125- if class_name in class_type_map :
126- result = _get_from_method_map (method_name , argument_name , class_type_map [class_name ])
127- if result :
128- return result
129- if ALL in class_type_map :
130- result = _get_from_method_map (method_name , argument_name , class_type_map [ALL ])
131- if result :
132- return result
133- return None
134-
135-
136101def _get_from_service_map (
137102 service_name : ServiceName ,
138103 class_name : str ,
@@ -143,12 +108,25 @@ def _get_from_service_map(
143108 if service_name not in service_type_map :
144109 return None
145110
146- return _get_from_class_map (
147- class_name ,
148- method_name ,
149- argument_name ,
150- service_type_map [ service_name ] ,
111+ checks = (
112+ ( class_name , method_name , argument_name ) ,
113+ ( class_name , ALL , argument_name ) ,
114+ ( ALL , method_name , argument_name ) ,
115+ ( ALL , ALL , argument_name ) ,
151116 )
117+ class_type_map = service_type_map [service_name ]
118+
119+ for class_name , method_name , argument_name in checks :
120+ if class_name not in class_type_map :
121+ continue
122+
123+ method_type_map = class_type_map [class_name ]
124+
125+ if method_name not in method_type_map :
126+ continue
127+
128+ operation_type_map = method_type_map [method_name ]
129+ return operation_type_map .get (argument_name )
152130
153131
154132def get_method_type_stub (
0 commit comments