diff --git a/src/scribe_data/check/check_query_forms.py b/src/scribe_data/check/check_query_forms.py index b7c2766c..493d1025 100644 --- a/src/scribe_data/check/check_query_forms.py +++ b/src/scribe_data/check/check_query_forms.py @@ -493,7 +493,7 @@ def check_forms_order(query_text: str) -> bool: return select_vars == where_vars -# MARK: docstring Format +# MARK: Docstring Format def check_docstring(query_text: str) -> bool: @@ -502,16 +502,16 @@ def check_docstring(query_text: str) -> bool: Parameters ---------- - query_text : str - The SPARQL query's text to be checked. + query_text : str + The SPARQL query's text to be checked. Returns ------- - bool - True if the docstring is correctly formatted; otherwise, . + bool + True if the docstring is correctly formatted. """ # Split the text into lines. - lines = query_text.splitlines(keepends=True) + query_lines = query_text.splitlines(keepends=True) # Regex patterns for each line in the docstring and corresponding error messages. patterns = [ @@ -525,11 +525,14 @@ def check_docstring(query_text: str) -> bool: "Error in line 3:", ), ] - # Check each line against its corresponding pattern. - for i, (pattern, error_line_number) in enumerate(patterns): - if not re.match(pattern, lines[i]): - return (False, f"{error_line_number} {lines[i].strip()}") - return True + return next( + ( + (False, f"{error_line_number} {query_lines[i].strip()}") + for i, (pattern, error_line_number) in enumerate(patterns) + if not re.match(pattern, query_lines[i]) + ), + True, + ) # MARK: Main Query Forms Validation diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adjectives/query_adjectives.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adjectives/query_adjectives.sparql index 78180a97..a767fe38 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adjectives/query_adjectives.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adjectives/query_adjectives.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) adjectives (Q34698) and the given forms. +# All Hindi Hindustani (Q11051) adjectives (Q34698) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adverbs/query_adverbs.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adverbs/query_adverbs.sparql index 29ac1e09..426816ac 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adverbs/query_adverbs.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/adverbs/query_adverbs.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) adverbs (Q380057) and the given forms. +# All Hindi Hindustani (Q11051) adverbs (Q380057) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/nouns/query_nouns.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/nouns/query_nouns.sparql index 18f69dd5..5d7df096 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/nouns/query_nouns.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/nouns/query_nouns.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) nouns (Q1084) and the given forms. +# All Hindi Hindustani (Q11051) nouns (Q1084) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/postpositions/query_postpositions.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/postpositions/query_postpositions.sparql index 0b8487a2..49d923c9 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/postpositions/query_postpositions.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/postpositions/query_postpositions.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) postpositions (Q161873) and the given forms. +# All Hindi Hindustani (Q11051) postpositions (Q161873) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/prepositions/query_prepositions.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/prepositions/query_prepositions.sparql index d878d427..ec30ac29 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/prepositions/query_prepositions.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/prepositions/query_prepositions.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) prepositions (Q4833830) and the given forms. +# All Hindi Hindustani (Q11051) prepositions (Q4833830) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/proper_nouns/query_proper_nouns.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/proper_nouns/query_proper_nouns.sparql index de41f4bc..71d1fa12 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/proper_nouns/query_proper_nouns.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/proper_nouns/query_proper_nouns.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) proper nouns (Q147276) and the given forms. +# All Hindi Hindustani (Q11051) proper nouns (Q147276) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/verbs/query_verbs.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/verbs/query_verbs.sparql index ebccf730..a7be80f7 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/verbs/query_verbs.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/hindi/verbs/query_verbs.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Hindi (Q11051) verbs (Q24905) and the given forms. +# All Hindi Hindustani (Q11051) verbs (Q24905) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "hi" to remove Urdu (ur) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adjectives/query_adjectives.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adjectives/query_adjectives.sparql index 64127d28..3a81de17 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adjectives/query_adjectives.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adjectives/query_adjectives.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) adjectives (Q34698) and the given forms. +# All Urdu Hindustani (Q11051) adjectives (Q34698) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adverbs/query_adverbs.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adverbs/query_adverbs.sparql index 295b45a0..f84c585b 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adverbs/query_adverbs.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/adverbs/query_adverbs.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) adverbs (Q380057) and the given forms. +# All Urdu Hindustani (Q11051) adverbs (Q380057) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/nouns/query_nouns.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/nouns/query_nouns.sparql index 948e0957..7742886d 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/nouns/query_nouns.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/nouns/query_nouns.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) nouns (Q1084) and the given forms. +# All Urdu Hindustani (Q11051) nouns (Q1084) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/postpositions/query_postpositions.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/postpositions/query_postpositions.sparql index 915aa5ca..318f581b 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/postpositions/query_postpositions.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/postpositions/query_postpositions.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) postpositions (Q161873) and the given forms. +# All Urdu Hindustani (Q11051) postpositions (Q161873) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/prepositions/query_prepositions.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/prepositions/query_prepositions.sparql index d7c7cedc..ad85e6bd 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/prepositions/query_prepositions.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/prepositions/query_prepositions.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) prepositions (Q4833830) and the given forms. +# All Urdu Hindustani (Q11051) prepositions (Q4833830) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/proper_nouns/query_proper_nouns.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/proper_nouns/query_proper_nouns.sparql index 4626754d..7cedd182 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/proper_nouns/query_proper_nouns.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/proper_nouns/query_proper_nouns.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) proper nouns (Q147276) and the given forms. +# All Urdu Hindustani (Q11051) proper nouns (Q147276) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindi (hi) words. diff --git a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/verbs/query_verbs.sparql b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/verbs/query_verbs.sparql index cfbf0c5c..d5dc0f38 100644 --- a/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/verbs/query_verbs.sparql +++ b/src/scribe_data/wikidata/language_data_extraction/hindustani/urdu/verbs/query_verbs.sparql @@ -1,5 +1,5 @@ # tool: scribe-data -# All Urdu (Q11051) verbs (Q24905) and the given forms. +# All Urdu Hindustani (Q11051) verbs (Q24905) and the given forms. # Enter this query at https://query.wikidata.org/. # Note: We need to filter for "ur" to remove Hindustani (hi) words.