File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
export/html/_static/controllers Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 25
25
)
26
26
from strictdoc .core .document_meta import DocumentMeta
27
27
from strictdoc .helpers .auto_described import auto_described
28
+ from strictdoc .helpers .cast import assert_cast
28
29
from strictdoc .helpers .mid import MID
29
30
30
31
@@ -217,8 +218,7 @@ def get_grammar_element_field_for(
217
218
"""
218
219
Returns the GrammarElementField for a field of a [element_type] in this document.
219
220
"""
220
- assert self .grammar is not None
221
- grammar : DocumentGrammar = self .grammar
221
+ grammar : DocumentGrammar = assert_cast (self .grammar , DocumentGrammar )
222
222
element : GrammarElement = grammar .elements_by_type [element_type ]
223
223
field : GrammarElementField = element .fields_map [field_name ]
224
224
return field
Original file line number Diff line number Diff line change 185
185
const text = this . autocompletable . innerText || "" ;
186
186
const parts = text . split ( "," ) ;
187
187
188
- // Replace the last incomplete token with the suggestion
188
+ // Replace the last incomplete token with the suggestion.
189
189
parts [ parts . length - 1 ] = " " + suggestion ;
190
190
suggestion = parts . map ( p => p . trim ( ) ) . join ( ", " )
191
191
}
Original file line number Diff line number Diff line change @@ -2793,14 +2793,14 @@ def get_autocomplete_field_results(
2793
2793
)
2794
2794
2795
2795
if field .gef_type == RequirementFieldType .MULTIPLE_CHOICE :
2796
- # MultipleChoice: Split the query into parts
2796
+ # MultipleChoice: Split the query into parts.
2797
2797
parts = q .lower ().split ("," )
2798
2798
2799
2799
# only use the last_part for lookup
2800
2800
last_part = parts [- 1 ].strip ()
2801
2801
query_words = last_part .split ()
2802
2802
2803
- # and pre -filter: don't suggest choices that were already selected / present in the query
2803
+ # Pre -filter: don't suggest choices that were already selected / present in the query.
2804
2804
already_selected = [
2805
2805
p .strip () for p in parts [:- 1 ] if p .strip ()
2806
2806
]
@@ -2810,13 +2810,13 @@ def get_autocomplete_field_results(
2810
2810
if choice .lower () not in already_selected
2811
2811
]
2812
2812
else :
2813
- # SingleChoice: use all available options
2813
+ # SingleChoice: use all available options.
2814
2814
query_words = q .lower ().split ()
2815
2815
filtered_options = all_options
2816
2816
2817
2817
resulting_values = []
2818
2818
2819
- # now filter the remainig options for those that macht all words in query_words
2819
+ # Now filter the remaining options for those that match all words in query_words.
2820
2820
for option_ in filtered_options :
2821
2821
words_ = option_ .strip ().lower ()
2822
2822
You can’t perform that action at this time.
0 commit comments