@@ -702,12 +702,12 @@ def interface_to_python_class(
702
702
# types via generics, each in array or object configurations.
703
703
# Typing this attribute proved very difficult. A solution
704
704
# that worked with mypy and pyright is to type "buckets"
705
- # with the array ( list) form, and create a `buckets_as_dict`
706
- # property that is typed appropriate for accessing the
707
- # buckets when in object ( dictionary) form.
705
+ # for the list form, and create a `buckets_as_dict`
706
+ # property that is typed appropriately for accessing the
707
+ # buckets in dictionary form.
708
708
# The generic type is assumed to be the first in the list,
709
- # which is a simplification that should be removed when a
710
- # more complete implementation of generic is added.
709
+ # which is a simplification that should be improved when a
710
+ # more complete implementation of generics is added.
711
711
if generics [0 ]["type" ]["name" ] == "Void" :
712
712
generic_type = "Any"
713
713
else :
@@ -733,6 +733,11 @@ def interface_to_python_class(
733
733
)
734
734
k ["buckets_as_dict" ] = generic_type
735
735
else :
736
+ if interface == "Hit" and arg ["name" ].startswith ("_" ):
737
+ # Python DSL removes the undersore prefix from all the
738
+ # properties of the hit, so we do the same
739
+ arg ["name" ] = arg ["name" ][1 :]
740
+
736
741
self .add_attribute (
737
742
k , arg , for_types_py = for_types_py , for_response = for_response
738
743
)
0 commit comments