remove aniso8601, mock, iso8601 (#1548)

* remove aniso8601

* remove mock, iso8601

---------

Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
This commit is contained in:
Dulmandakh 2024-06-13 22:35:00 +08:00 committed by GitHub
parent 614449e651
commit 17d09c8ded
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 8 deletions

View File

@ -1,2 +1,2 @@
[settings] [settings]
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pyutils,setuptools,snapshottest,sphinx_graphene_theme known_third_party = graphql,graphql_relay,promise,pytest,pyutils,setuptools,snapshottest,sphinx_graphene_theme

View File

@ -2,7 +2,6 @@ from __future__ import absolute_import
import datetime import datetime
from aniso8601 import parse_date, parse_datetime, parse_time
from graphql.error import GraphQLError from graphql.error import GraphQLError
from graphql.language import StringValueNode, print_ast from graphql.language import StringValueNode, print_ast
@ -39,7 +38,7 @@ class Date(Scalar):
if not isinstance(value, str): if not isinstance(value, str):
raise GraphQLError(f"Date cannot represent non-string value: {repr(value)}") raise GraphQLError(f"Date cannot represent non-string value: {repr(value)}")
try: try:
return parse_date(value) return datetime.date.fromisoformat(value)
except ValueError: except ValueError:
raise GraphQLError(f"Date cannot represent value: {repr(value)}") raise GraphQLError(f"Date cannot represent value: {repr(value)}")
@ -74,7 +73,7 @@ class DateTime(Scalar):
f"DateTime cannot represent non-string value: {repr(value)}" f"DateTime cannot represent non-string value: {repr(value)}"
) )
try: try:
return parse_datetime(value) return datetime.datetime.fromisoformat(value)
except ValueError: except ValueError:
raise GraphQLError(f"DateTime cannot represent value: {repr(value)}") raise GraphQLError(f"DateTime cannot represent value: {repr(value)}")
@ -107,6 +106,6 @@ class Time(Scalar):
if not isinstance(value, str): if not isinstance(value, str):
raise GraphQLError(f"Time cannot represent non-string value: {repr(value)}") raise GraphQLError(f"Time cannot represent non-string value: {repr(value)}")
try: try:
return parse_time(value) return datetime.time.fromisoformat(value)
except ValueError: except ValueError:
raise GraphQLError(f"Time cannot represent value: {repr(value)}") raise GraphQLError(f"Time cannot represent value: {repr(value)}")

View File

@ -52,8 +52,6 @@ tests_require = [
"pytest-asyncio>=0.16,<2", "pytest-asyncio>=0.16,<2",
"snapshottest>=0.6,<1", "snapshottest>=0.6,<1",
"coveralls>=3.3,<4", "coveralls>=3.3,<4",
"mock>=4,<5",
"iso8601>=1,<2",
] ]
dev_requires = ["black==22.3.0", "flake8>=4,<5"] + tests_require dev_requires = ["black==22.3.0", "flake8>=4,<5"] + tests_require
@ -84,7 +82,6 @@ setup(
install_requires=[ install_requires=[
"graphql-core>=3.1,<3.3", "graphql-core>=3.1,<3.3",
"graphql-relay>=3.1,<3.3", "graphql-relay>=3.1,<3.3",
"aniso8601>=8,<10",
], ],
tests_require=tests_require, tests_require=tests_require,
extras_require={"test": tests_require, "dev": dev_requires}, extras_require={"test": tests_require, "dev": dev_requires},