Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87395a1
commit 6eb230c
Showing
20 changed files
with
100 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
from slothql.types.fields import * | ||
from .types import * | ||
from .types.fields import Field, Integer, Float, String, Boolean, ID, JsonString, DateTime, Date, Time | ||
from .types import Object, Enum, EnumValue | ||
from .schema import Schema | ||
from .query import gql | ||
|
||
__all__ = ( | ||
# fields | ||
'Field', | ||
'Integer', 'Float', 'String', 'Boolean', 'ID', | ||
'JsonString', | ||
'DateTime', 'Date', 'Time', | ||
|
||
# types | ||
'Object', | ||
'Enum', 'EnumValue', | ||
|
||
'Schema', | ||
'gql', | ||
) | ||
|
||
try: | ||
from slothql import django | ||
__all__ += 'django', | ||
except ImportError as e: | ||
if str(e) != "No module named 'django'": | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
from .views import GraphQLView | ||
from .types import * | ||
from .types import Model | ||
|
||
__all__ = ( | ||
'GraphQLView', | ||
'Model', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,41 @@ | ||
from .model import Model | ||
from . import scalars | ||
|
||
__all__ = ( | ||
'Model', | ||
) | ||
|
||
from django.db import models | ||
|
||
import slothql | ||
|
||
from .registry import TypeRegistry | ||
|
||
TypeRegistry().register(models.AutoField, slothql.Integer()) | ||
TypeRegistry().register(models.BigAutoField, slothql.Integer()) | ||
|
||
TypeRegistry().register(models.CharField, slothql.String()) | ||
TypeRegistry().register(models.TextField, slothql.String()) | ||
TypeRegistry().register(models.EmailField, slothql.String()) | ||
|
||
TypeRegistry().register(models.IntegerField, slothql.Integer()) | ||
TypeRegistry().register(models.BigIntegerField, slothql.Integer()) | ||
TypeRegistry().register(models.PositiveIntegerField, slothql.Integer()) | ||
TypeRegistry().register(models.SmallIntegerField, slothql.Integer()) | ||
TypeRegistry().register(models.PositiveSmallIntegerField, slothql.Integer()) | ||
|
||
TypeRegistry().register(models.BooleanField, slothql.Boolean()) | ||
TypeRegistry().register(models.NullBooleanField, slothql.Boolean()) | ||
|
||
TypeRegistry().register(models.FloatField, slothql.Float()) | ||
TypeRegistry().register(models.DecimalField, slothql.Float()) | ||
|
||
TypeRegistry().register(models.DateTimeField, slothql.DateTime()) | ||
TypeRegistry().register(models.DateField, slothql.Date()) | ||
TypeRegistry().register(models.TimeField, slothql.Time()) | ||
|
||
try: | ||
from . import postgres | ||
except ImportError as e: | ||
if str(e) != "No module named 'psycopg2'": | ||
raise | ||
from django.contrib.postgres import fields | ||
|
||
TypeRegistry().register(fields.JSONField, slothql.JsonString()) | ||
except ImportError: | ||
pass |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
from .object import Object | ||
from .enum import Enum, EnumValue | ||
|
||
__all__ = ( | ||
'Object', | ||
'Enum', 'EnumValue', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import graphql | ||
from typing import Tuple, Type | ||
from typing import Type | ||
|
||
from graphql.type import GraphQLEnumValue | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
from .field import Field | ||
from .shortcuts import String, Boolean, Integer, JsonString, Float, ID, DateTime, Date, Time | ||
from .shortcuts import String, Boolean, Integer, Float, ID, JsonString, DateTime, Date, Time | ||
|
||
__all__ = ( | ||
'Field', | ||
'String', 'Boolean', 'Integer', 'Float', 'ID', 'JsonString', 'DateTime', 'Date', 'Time', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from .attr import * | ||
from .query import * | ||
from .attr import get_attr_fields, is_magic_name, get_attrs | ||
from .query import query_from_raw_json | ||
from .laziness import LazyInitMixin | ||
|
||
__all__ = ( | ||
'get_attr_fields', 'is_magic_name', 'get_attrs', | ||
'query_from_raw_json', | ||
'LazyInitMixin', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[pytest] | ||
python_files = tests.py test_*.py *_tests.py tests/*.py | ||
addopts=-p no:logging | ||
|
||
[flake8] | ||
statistics = True | ||
disable-noqa = True | ||
max-line-length = 120 | ||
max-complexity = 8 |