Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d4f1574

Browse files
committed
fix typos
1 parent 6e23fee commit d4f1574

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

lc.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from color import Colors
55
from config_setup import (
66
save_credentials_to_config,
7-
load_credentials_from_config, load_user_data_from_config, save_user_data_to_config,
7+
load_credentials_from_config,
8+
load_user_data_from_config,
9+
save_user_data_to_config,
810
)
911
import leetcode
1012
import leetcode.auth
@@ -165,7 +167,7 @@ def print_submission_result(submission): # used python-leetcode library
165167

166168

167169
def initialize_leetcode_api_instance(
168-
leetcode_session, leetcode_csrf_token
170+
leetcode_session, leetcode_csrf_token
169171
): # used python-leetcode library
170172
configuration = leetcode.Configuration()
171173
csrf_token = leetcode_csrf_token
@@ -199,7 +201,7 @@ def interpret_solution(title_slug, payload, api_instance):
199201

200202
# --submit
201203
def submit_solution(
202-
api_instance, title_slug, code, question_id, lang_name
204+
api_instance, title_slug, code, question_id, lang_name
203205
): # used python-leetcode library
204206
submission = leetcode.Submission(
205207
judge_type="large",
@@ -335,9 +337,9 @@ def get_question_data_by_id(api_instance, q):
335337
api_response = execute_graphql_query(api_instance, data)
336338

337339
if (
338-
api_response
339-
and "data" in api_response
340-
and "problemsetQuestionList" in api_response["data"]
340+
api_response
341+
and "data" in api_response
342+
and "problemsetQuestionList" in api_response["data"]
341343
):
342344
return api_response["data"]["problemsetQuestionList"]["questions"]
343345
return None
@@ -472,20 +474,28 @@ def display_question_detail(api_instance, title_slug):
472474
if user_lang:
473475
write_code_snippet_to_file(question_detail_data, user_lang, title_slug)
474476
else:
475-
available_languages = get_available_languages_and_code_snippets(question_detail_data)
477+
available_languages = get_available_languages_and_code_snippets(
478+
question_detail_data
479+
)
476480
if not available_languages:
477481
print("No code snippets available.")
478482
return
479483
print("Available Languages:")
480484
for index, (lang_slug, lang_name) in enumerate(available_languages, 1):
481485
print(f"{index}. {lang_slug}")
482-
lang_input = input("Enter the displayed index of the language you want to code: ").strip().lower()
486+
lang_input = (
487+
input("Enter the displayed index of the language you want to code: ")
488+
.strip()
489+
.lower()
490+
)
483491
try:
484492
lang_index = int(lang_input)
485493
if 1 <= lang_index <= len(available_languages):
486494
selected_lang = available_languages[lang_index - 1][0]
487495
print(selected_lang)
488-
write_code_snippet_to_file(question_detail_data, selected_lang, title_slug)
496+
write_code_snippet_to_file(
497+
question_detail_data, selected_lang, title_slug
498+
)
489499
else:
490500
print("Invalid index. Please enter a valid index.")
491501
except ValueError:
@@ -494,7 +504,10 @@ def display_question_detail(api_instance, title_slug):
494504

495505
def write_code_snippet_to_file(question_detail_data, lang, title_slug):
496506
code_snippets = question_detail_data.get("codeSnippets", [])
497-
code = next((snippet["code"] for snippet in code_snippets if snippet["langSlug"] == lang), None)
507+
code = next(
508+
(snippet["code"] for snippet in code_snippets if snippet["langSlug"] == lang),
509+
None,
510+
)
498511
if code:
499512
lang_extension = LANG_EXTENSIONS.get(lang)
500513
if lang_extension:
@@ -621,9 +634,7 @@ def replace_files():
621634
default="",
622635
help="Set user preferred language (e.g., python3)",
623636
)
624-
@click.option(
625-
"--lib", is_flag=True, default=False, help="Show usage information"
626-
)
637+
@click.option("--lib", is_flag=True, default=False, help="Show usage information")
627638
@click.option(
628639
"--question",
629640
"-q",

0 commit comments

Comments
 (0)