-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update get cmd for 'all' when retrieving all data-types. #541
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,15 +268,22 @@ def get_total_lexemes(language, data_type, do_print=True): | |
str | ||
A formatted string indicating the language, data type and total number of lexemes, if found. | ||
""" | ||
|
||
if language is not None and language.startswith("Q") and language[1:].isdigit(): | ||
language_qid = language | ||
if ( | ||
language is not None | ||
and (language.startswith("Q") or language.startswith("q")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this in as lower casing the language was actually breaking the ability to pass a QID as a language :) |
||
and language[1:].isdigit() | ||
): | ||
language_qid = language.capitalize() | ||
|
||
else: | ||
language_qid = get_qid_by_input(language) | ||
|
||
if data_type is not None and data_type.startswith("Q") and data_type[1:].isdigit(): | ||
data_type_qid = data_type | ||
if ( | ||
data_type is not None | ||
and (data_type.startswith("Q") or data_type.startswith("q")) | ||
and data_type[1:].isdigit() | ||
): | ||
data_type_qid = data_type.capitalize() | ||
|
||
else: | ||
data_type_qid = get_qid_by_input(data_type) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,11 +123,8 @@ def _load_json(package_path: str, file_name: str) -> Any: | |
------- | ||
A python entity representing the JSON content. | ||
""" | ||
with ( | ||
resources.files(package_path) | ||
.joinpath(file_name) | ||
.open(encoding="utf-8") as in_stream | ||
): | ||
json_file = resources.files(package_path).joinpath(file_name) | ||
with json_file.open(encoding="utf-8") as in_stream: | ||
return json.load(in_stream) | ||
|
||
|
||
|
@@ -547,6 +544,9 @@ def format_sublanguage_name(lang, language_metadata=_languages): | |
> format_sublanguage_name("english", language_metadata) | ||
'English' | ||
""" | ||
if (lang.startswith("Q") or lang.startswith("q")) and lang[1:].isdigit(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The next part of fixing passing QIDs for languages. There may need to be more fixes related to this, @axif0! Goal was getting total to work :) |
||
return lang | ||
|
||
for main_lang, lang_data in language_metadata.items(): | ||
# If it's not a sub-language, return the original name. | ||
if main_lang == lang: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user gives
-o
for overwrite enable, it still asks user input. Like this in first cmd-The second cmd is the outputted result after fixing.