Skip to content

Stricter types (preparation to switch to openapi generator) #5

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 20, 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
1 change: 1 addition & 0 deletions README.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Class | Method | HTTP request | Description

## Documentation For Models

- [AnyOfGraphqlQuestionDetailSolution](docs/AnyOfGraphqlQuestionDetailSolution.md)
- [BaseSubmissionResult](docs/BaseSubmissionResult.md)
- [Difficulty](docs/Difficulty.md)
- [GraphqlData](docs/GraphqlData.md)
Expand Down
8 changes: 8 additions & 0 deletions docs/AnyOfGraphqlQuestionDetailSolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# AnyOfGraphqlQuestionDetailSolution

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

2 changes: 1 addition & 1 deletion docs/GraphqlQuestionDetail.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Name | Type | Description | Notes
**code_snippets** | [**list[GraphqlQuestionCodeSnippet]**](GraphqlQuestionCodeSnippet.md) | | [optional]
**stats** | **str** | | [optional]
**hints** | **list[str]** | | [optional]
**solution** | [**GraphqlQuestionSolution**](GraphqlQuestionSolution.md) | | [optional]
**solution** | [**AnyOfGraphqlQuestionDetailSolution**](AnyOfGraphqlQuestionDetailSolution.md) | | [optional]
**status** | **str** | | [optional]
**sample_test_case** | **str** | | [optional]
**judger_available** | **bool** | | [optional]
Expand Down
4 changes: 2 additions & 2 deletions docs/Stat.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**question_id** | **int** | |
**question__article__live** | **str** | | [optional]
**question__article__live** | **bool** | | [optional]
**question__article__slug** | **str** | | [optional]
**question__article__has_video_solution** | **str** | | [optional]
**question__article__has_video_solution** | **bool** | | [optional]
**question__title** | **str** | |
**question__title_slug** | **str** | |
**question__hide** | **bool** | |
Expand Down
1 change: 1 addition & 0 deletions leetcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from leetcode.api_client import ApiClient
from leetcode.configuration import Configuration
# import models into sdk package
from leetcode.models.any_of_graphql_question_detail_solution import AnyOfGraphqlQuestionDetailSolution
from leetcode.models.base_submission_result import BaseSubmissionResult
from leetcode.models.difficulty import Difficulty
from leetcode.models.graphql_data import GraphqlData
Expand Down
1 change: 1 addition & 0 deletions leetcode/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from __future__ import absolute_import

# import models into model package
from leetcode.models.any_of_graphql_question_detail_solution import AnyOfGraphqlQuestionDetailSolution
from leetcode.models.base_submission_result import BaseSubmissionResult
from leetcode.models.difficulty import Difficulty
from leetcode.models.graphql_data import GraphqlData
Expand Down
84 changes: 84 additions & 0 deletions leetcode/models/any_of_graphql_question_detail_solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# coding: utf-8

"""
Leetcode API

Leetcode API implementation. # noqa: E501

OpenAPI spec version: 1.0.1-1
Contact: pv.safronov@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

import pprint
import re # noqa: F401

import six

class AnyOfGraphqlQuestionDetailSolution(object):
"""NOTE: This class is auto generated by the swagger code generator program.

Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
}

attribute_map = {
}

def __init__(self): # noqa: E501
"""AnyOfGraphqlQuestionDetailSolution - a model defined in Swagger""" # noqa: E501
self.discriminator = None

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}

for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AnyOfGraphqlQuestionDetailSolution, dict):
for key, value in self.items():
result[key] = value

return result

def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())

def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()

def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AnyOfGraphqlQuestionDetailSolution):
return False

return self.__dict__ == other.__dict__

def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
6 changes: 3 additions & 3 deletions leetcode/models/graphql_question_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GraphqlQuestionDetail(object):
'code_snippets': 'list[GraphqlQuestionCodeSnippet]',
'stats': 'str',
'hints': 'list[str]',
'solution': 'GraphqlQuestionSolution',
'solution': 'AnyOfGraphqlQuestionDetailSolution',
'status': 'str',
'sample_test_case': 'str',
'judger_available': 'bool',
Expand Down Expand Up @@ -644,7 +644,7 @@ def solution(self):


:return: The solution of this GraphqlQuestionDetail. # noqa: E501
:rtype: GraphqlQuestionSolution
:rtype: AnyOfGraphqlQuestionDetailSolution
"""
return self._solution

Expand All @@ -654,7 +654,7 @@ def solution(self, solution):


:param solution: The solution of this GraphqlQuestionDetail. # noqa: E501
:type: GraphqlQuestionSolution
:type: AnyOfGraphqlQuestionDetailSolution
"""

self._solution = solution
Expand Down
12 changes: 6 additions & 6 deletions leetcode/models/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Stat(object):
"""
swagger_types = {
'question_id': 'int',
'question__article__live': 'str',
'question__article__live': 'bool',
'question__article__slug': 'str',
'question__article__has_video_solution': 'str',
'question__article__has_video_solution': 'bool',
'question__title': 'str',
'question__title_slug': 'str',
'question__hide': 'bool',
Expand Down Expand Up @@ -113,7 +113,7 @@ def question__article__live(self):


:return: The question__article__live of this Stat. # noqa: E501
:rtype: str
:rtype: bool
"""
return self._question__article__live

Expand All @@ -123,7 +123,7 @@ def question__article__live(self, question__article__live):


:param question__article__live: The question__article__live of this Stat. # noqa: E501
:type: str
:type: bool
"""

self._question__article__live = question__article__live
Expand Down Expand Up @@ -155,7 +155,7 @@ def question__article__has_video_solution(self):


:return: The question__article__has_video_solution of this Stat. # noqa: E501
:rtype: str
:rtype: bool
"""
return self._question__article__has_video_solution

Expand All @@ -165,7 +165,7 @@ def question__article__has_video_solution(self, question__article__has_video_sol


:param question__article__has_video_solution: The question__article__has_video_solution of this Stat. # noqa: E501
:type: str
:type: bool
"""

self._question__article__has_video_solution = question__article__has_video_solution
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from setuptools import find_packages, setup # noqa: H301

NAME = "python-leetcode"
VERSION = "1.0.6"
VERSION = "1.0.7"

with open("README.md") as readme:
DESCRIPTION = readme.read()
Expand Down
39 changes: 39 additions & 0 deletions test/test_any_of_graphql_question_detail_solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8

"""
Leetcode API

Leetcode API implementation. # noqa: E501

OpenAPI spec version: 1.0.1-1
Contact: pv.safronov@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import unittest

import leetcode
from leetcode.models.any_of_graphql_question_detail_solution import AnyOfGraphqlQuestionDetailSolution # noqa: E501
from leetcode.rest import ApiException


class TestAnyOfGraphqlQuestionDetailSolution(unittest.TestCase):
"""AnyOfGraphqlQuestionDetailSolution unit test stubs"""

def setUp(self):
pass

def tearDown(self):
pass

def testAnyOfGraphqlQuestionDetailSolution(self):
"""Test AnyOfGraphqlQuestionDetailSolution"""
# FIXME: construct object with mandatory attributes with example values
# model = leetcode.models.any_of_graphql_question_detail_solution.AnyOfGraphqlQuestionDetailSolution() # noqa: E501
pass


if __name__ == '__main__':
unittest.main()