mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-08 23:50:38 +03:00
Use trim_docstring to ensure description has no leading whitespace
This commit is contained in:
parent
0dc8e57c50
commit
c592e94f73
|
@ -3,6 +3,7 @@ from collections import OrderedDict
|
|||
import six
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .options import Options
|
||||
from .unmountedtype import UnmountedType
|
||||
|
||||
|
@ -23,7 +24,7 @@ class EnumTypeMeta(type):
|
|||
options = Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
enum=None,
|
||||
)
|
||||
if not options.enum:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import six
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .abstracttype import AbstractTypeMeta
|
||||
from .inputfield import InputField
|
||||
from .options import Options
|
||||
|
@ -19,7 +20,7 @@ class InputObjectTypeMeta(AbstractTypeMeta):
|
|||
options = Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
local_fields=None,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import six
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .abstracttype import AbstractTypeMeta
|
||||
from .field import Field
|
||||
from .options import Options
|
||||
|
@ -18,7 +19,7 @@ class InterfaceMeta(AbstractTypeMeta):
|
|||
options = Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
local_fields=None,
|
||||
)
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ from collections import OrderedDict
|
|||
import six
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .abstracttype import AbstractTypeMeta
|
||||
from .field import Field
|
||||
from .interface import Interface
|
||||
|
@ -22,7 +23,7 @@ class ObjectTypeMeta(AbstractTypeMeta):
|
|||
options = _meta or Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
interfaces=(),
|
||||
local_fields=OrderedDict(),
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import six
|
||||
|
||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||
StringValue)
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .options import Options
|
||||
from .unmountedtype import UnmountedType
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ScalarTypeMeta(type):
|
|||
options = Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
)
|
||||
|
||||
return type.__new__(cls, name, bases, dict(attrs, _meta=options))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import six
|
||||
|
||||
from ..utils.is_base_type import is_base_type
|
||||
from ..utils.trim_docstring import trim_docstring
|
||||
from .options import Options
|
||||
from .unmountedtype import UnmountedType
|
||||
|
||||
|
@ -16,7 +17,7 @@ class UnionMeta(type):
|
|||
options = Options(
|
||||
attrs.pop('Meta', None),
|
||||
name=name,
|
||||
description=attrs.get('__doc__'),
|
||||
description=trim_docstring(attrs.get('__doc__')),
|
||||
types=(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user