8000 Added new fields to the question details object by fspv · Pull Request #10 · fspv/python-leetcode · GitHub
[go: up one dir, main page]

Skip to content

Added new fields to the question details object #10

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

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/GraphqlQuestionDetail.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**bound_topic_id** | **str** | | [optional]
**title** | **str** | | [optional]
**frequency** | **float** | | [optional]
**freq_bar** | **float** | | [optional]
**content** | **str** | | [optional]
**translated_title** | **str** | | [optional]
**translated_content** | **str** | | [optional]
Expand All @@ -16,15 +17,19 @@ Name | Type | Description | Notes
**likes** | **int** | | [optional]
**dislikes** | **int** | | [optional]
**is_liked** | **bool** | | [optional]
**is_favor** | **bool** | | [optional]
**similar_questions** | **str** | | [optional]
**contributors** | [**list[GraphqlQuestionContributor]**](GraphqlQuestionContributor.md) | | [optional]
**lang_to_valid_playground** | **str** | | [optional]
**topic_tags** | [**list[GraphqlQuestionTopicTag]**](GraphqlQuestionTopicTag.md) | | [optional]
**company_tag_stats** | **str** | | [optional]
**code_snippets** | [**list[GraphqlQuestionCodeSnippet]**](GraphqlQuestionCodeSnippet.md) | | [optional]
**stats** | **str** | | [optional]
**ac_rate** | **float** | | [optional]
**hints** | **list[str]** | | [optional]
**solution** | [**AnyOfGraphqlQuestionDetailSolution**](AnyOfGraphqlQuestionDetailSolution.md) | | [optional]
**has_solution** | **bool** | | [optional]
**has_video_solution** | **bool** | | [optional]
**status** | **str** | | [optional]
**sample_test_case** | **str** | | [optional]
**judger_available** | **bool** | | [optional]
Expand Down
132 changes: 131 additions & 1 deletion leetcode/models/graphql_question_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GraphqlQuestionDetail(object):
'bound_topic_id': 'str',
'title': 'str',
'frequency': 'float',
'freq_bar': 'float',
'content': 'str',
'translated_title': 'str',
'translated_content': 'str',
Expand All @@ -41,15 +42,19 @@ class GraphqlQuestionDetail(object):
'likes': 'int',
'dislikes': 'int',
'is_liked': 'bool',
'is_favor': 'bool',
'similar_questions': 'str',
'contributors': 'list[GraphqlQuestionContributor]',
'lang_to_valid_playground': 'str',
'topic_tags': 'list[GraphqlQuestionTopicTag]',
'company_tag_stats': 'str',
'code_snippets': 'list[GraphqlQuestionCodeSnippet]',
'stats': 'str',
'ac_rate': 'float',
'hints': 'list[str]',
'solution': 'AnyOfGraphqlQuestionDetailSolution',
'has_solution': 'bool',
'has_video_solution': 'bool',
'status': 'str',
'sample_test_case': 'str',
'judger_available': 'bool',
Expand All @@ -68,6 +73,7 @@ class GraphqlQuestionDetail(object):
'bound_topic_id': 'boundTopicId',
'title': 'title',
'frequency': 'frequency',
'freq_bar': 'freqBar',
'content': 'content',
'translated_title': 'translatedTitle',
'translated_content': 'translatedContent',
Expand All @@ -76,15 +82,19 @@ class GraphqlQuestionDetail(object):
'likes': 'likes',
'dislikes': 'dislikes',
'is_liked': 'isLiked',
'is_favor': 'isFavor',
'similar_questions': 'similarQuestions',
'contributors': 'contributors',
'lang_to_valid_playground': 'langToValidPlayground',
'topic_tags': 'topicTags',
'company_tag_stats': 'companyTagStats',
'code_snippets': 'codeSnippets',
'stats': 'stats',
'ac_rate': 'acRate',
'hints': 'hints',
'solution': 'solution',
'has_solution': 'hasSolution',
'has_video_solution': 'hasVideoSolution',
'status': 'status',
'sample_test_case': 'sampleTestCase',
'judger_available': 'judgerAvailable',
Expand All @@ -97,13 +107,14 @@ class GraphqlQuestionDetail(object):
'code_definition': 'codeDefinition'
}

def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=None, title=None, frequency=None, content=None, translated_title=None, translated_content=None, is_paid_only=None, difficulty=None, likes=None, 8000 dislikes=None, is_liked=None, similar_questions=None, contributors=None, lang_to_valid_playground=None, topic_tags=None, company_tag_stats=None, code_snippets=None, stats=None, hints=None, solution=None, status=None, sample_test_case=None, judger_available=None, judge_type=None, mysql_schemas=None, enable_run_code=None, enable_test_mode=None, env_info=None, meta_data=None, code_definition=None): # noqa: E501
def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=None, title=None, frequency=None, freq_bar=None, content=None, translated_title=None, translated_content=None, is_paid_only=None, difficulty=None, likes=None, dislikes=None, is_liked=None, is_favor=None, similar_questions=None, contributors=None, lang_to_valid_playground=None, topic_tags=None, company_tag_stats=None, code_snippets=None, stats=None, ac_rate=None, hints=None, solution=None, has_solution=None, has_video_solution=None, status=None, sample_test_case=None, judger_available=None, judge_type=None, mysql_schemas=None, enable_run_code=None, enable_test_mode=None, env_info=None, meta_data=None, code_definition=None): # noqa: E501
"""GraphqlQuestionDetail - a model defined in Swagger""" # noqa: E501
self._question_id = None
self._question_frontend_id = None
self._bound_topic_id = None
self._title = None
self._frequency = None
self._freq_bar = None
self._content = None
self._translated_title = None
self._translated_content = None
Expand All @@ -112,15 +123,19 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
self._likes = None
self._dislikes = None
self._is_liked = None
self._is_favor = None
self._similar_questions = None
self._contributors = None
self._lang_to_valid_playground = None
self._topic_tags = None
self._company_tag_stats = None
self._code_snippets = None
self._stats = None
self._ac_rate = None
self._hints = None
self._solution = None
self._has_solution = None
self._has_video_solution = None
self._status = None
self._sample_test_case = None
self._judger_available = None
Expand All @@ -142,6 +157,8 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
self.title = title
if frequency is not None:
self.frequency = frequency
if freq_bar is not None:
self.freq_bar = freq_bar
if content is not None:
self.content = content
if translated_title is not None:
Expand All @@ -158,6 +175,8 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
self.dislikes = dislikes
if is_liked is not None:
self.is_liked = is_liked
if is_favor is not None:
self.is_favor = is_favor
if similar_questions is not None:
self.similar_questions = similar_questions
if contributors is not None:
Expand All @@ -172,10 +191,16 @@ def __init__(self, question_id=None, question_frontend_id=None, bound_topic_id=N
self.code_snippets = code_snippets
if stats is not None:
self.stats = stats
if ac_rate is not None:
self.ac_rate = ac_rate
if hints is not None:
self.hints = hints
if solution is not None:
self.solution = solution
if has_solution is not None:
self.has_solution = has_solution
if has_video_solution is not None:
self.has_video_solution = has_video_solution
if status is not None:
self.status = status
if sample_test_case is not None:
Expand Down Expand Up @@ -302,6 +327,27 @@ def frequency(self, frequency):

self._frequency = frequency

@property
def freq_bar(self):
"""Gets the freq_bar of this GraphqlQuestionDetail. # noqa: E501


:return: The freq_bar of this GraphqlQuestionDetail. # noqa: E501
:rtype: float
"""
return self._freq_bar

@freq_bar.setter
def freq_bar(self, freq_bar):
"""Sets the freq_bar of this GraphqlQuestionDetail.


:param freq_bar: The freq_bar of this GraphqlQuestionDetail. # noqa: E501
:type: float
"""

self._freq_bar = freq_bar

@property
def content(self):
"""Gets the content of this GraphqlQuestionDetail. # noqa: E501
Expand Down Expand Up @@ -470,6 +516,27 @@ def is_liked(self, is_liked):

self._is_liked = is_liked

@property
def is_favor(self):
"""Gets the is_favor of this GraphqlQuestionDetail. # noqa: E501


:return: The is_favor of this GraphqlQuestionDetail. # noqa: E501
:rtype: bool
"""
return self._is_favor

@is_favor.setter
def is_favor(self, is_favor):
"""Sets the is_favor of this GraphqlQuestionDetail.


:param is_favor: The is_favor of this GraphqlQuestionDetail. # noqa: E501
:type: bool
"""

self._is_favor = is_favor

@property
def similar_questions(self):
"""Gets the similar_questions of this GraphqlQuestionDetail. # noqa: E501
Expand Down Expand Up @@ -617,6 +684,27 @@ def stats(self, stats):

self._stats = stats

@property
def ac_rate(self):
"""Gets the ac_rate of this GraphqlQuestionDetail. # noqa: E501


:return: The ac_rate of this GraphqlQuestionDetail. # noqa: E501
:rtype: float
"""
return self._ac_rate

@ac_rate.setter
def ac_rate(self, ac_rate):
"""Sets the ac_rate of this GraphqlQuestionDetail.


:param ac_rate: The ac_rate of this GraphqlQuestionDetail. # noqa: E501
:type: float
"""

self._ac_rate = ac_rate

@property
def hints(self):
"""Gets the hints of this GraphqlQuestionDetail. # noqa: E501
Expand Down Expand Up @@ -659,6 +747,48 @@ def solution(self, solution):

self._solution = solution

@property
def has_solution(self):
"""Gets the has_solution of this GraphqlQuestionDetail. # noqa: E501


:return: The has_solution of this GraphqlQuestionDetail. # noqa: E501
:rtype: bool
"""
return self._has_solution

@has_solution.setter
def has_solution(self, has_solution):
"""Sets the has_solution of this GraphqlQuestionDetail.


:param has_solution: The has_solution of this GraphqlQuestionDetail. # noqa: E501
:type: bool
"""

self._has_solution = has_solution

@property
def has_video_solution(self):
"""Gets 9E88 the has_video_solution of this GraphqlQuestionDetail. # noqa: E501


:return: The has_video_solution of this GraphqlQuestionDetail. # noqa: E501
:rtype: bool
"""
return self._has_video_solution

@has_video_solution.setter
def has_video_solution(self, has_video_solution):
"""Sets the has_video_solution of this GraphqlQuestionDetail.


:param has_video_solution: The has_video_solution of this GraphqlQuestionDetail. # noqa: E501
:type: bool
"""

self._has_video_solution = has_video_solution

@property
def status(self):
"""Gets the status of this GraphqlQuestionDetail. # noqa: E501
Expand Down
14 changes: 14 additions & 0 deletions test/test_graphql_request_get_question_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ def test_request(self) -> None:
questionFrontendId
boundTopicId
title
frequency
freqBar
content
translatedTitle
isPaidOnly
difficulty
likes
dislikes
isLiked
isFavor
similarQuestions
contributors {
username
Expand All @@ -43,13 +46,16 @@ def test_request(self) -> None:
__typename
}
stats
acRate
codeDefinition
hints
solution {
id
canSeeDetail
__typename
}
hasSolution
hasVideoSolution
status
sampleTestCase
enableRunCode
Expand Down Expand Up @@ -83,13 +89,16 @@ def test_request(self) -> None:
assert question.question_frontend_id == "1"
assert question.bound_topic_id is None
assert question.title == "Two Sum"
assert question.frequency == 0.0
assert question.freq_bar > 0
assert len(question.content) > 10
assert question.translated_title is None
assert question.is_paid_only is False
assert question.difficulty == "Easy"
assert question.likes > 0
assert question.dislikes > 0
assert question.is_liked is None
assert question.is_favor in (True, False)
assert json.loads(question.similar_questions)[0]["difficulty"] in (
"Easy",
"Medium",
Expand Down Expand Up @@ -126,6 +135,8 @@ def test_request(self) -> None:
assert int(stats["totalAcceptedRaw"]) > 0
assert int(stats["totalSubmissionRaw"]) > 0

assert question.ac_rate > 0

code_definition = json.loads(question.code_definition)[0]

assert len(code_definition["value"]) > 0
Expand All @@ -144,6 +155,9 @@ def test_request(self) -> None:
assert solution["canSeeDetail"] in (True, False)
assert int(solution["id"]) > 0

assert question.has_solution in (True, False)
assert question.has_video_solution in (True, False)

assert question.status in ("ac", "not_started", "tried")

assert len(question.sample_test_case) > 0
Expand Down
0