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
|
import six
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .options import Options
|
from .options import Options
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ class EnumTypeMeta(type):
|
||||||
options = Options(
|
options = Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
enum=None,
|
enum=None,
|
||||||
)
|
)
|
||||||
if not options.enum:
|
if not options.enum:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .abstracttype import AbstractTypeMeta
|
from .abstracttype import AbstractTypeMeta
|
||||||
from .inputfield import InputField
|
from .inputfield import InputField
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
@ -19,7 +20,7 @@ class InputObjectTypeMeta(AbstractTypeMeta):
|
||||||
options = Options(
|
options = Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
local_fields=None,
|
local_fields=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .abstracttype import AbstractTypeMeta
|
from .abstracttype import AbstractTypeMeta
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
@ -18,7 +19,7 @@ class InterfaceMeta(AbstractTypeMeta):
|
||||||
options = Options(
|
options = Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
local_fields=None,
|
local_fields=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from collections import OrderedDict
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .abstracttype import AbstractTypeMeta
|
from .abstracttype import AbstractTypeMeta
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .interface import Interface
|
from .interface import Interface
|
||||||
|
@ -22,7 +23,7 @@ class ObjectTypeMeta(AbstractTypeMeta):
|
||||||
options = _meta or Options(
|
options = _meta or Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
interfaces=(),
|
interfaces=(),
|
||||||
local_fields=OrderedDict(),
|
local_fields=OrderedDict(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||||
StringValue)
|
StringValue)
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .options import Options
|
from .options import Options
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class ScalarTypeMeta(type):
|
||||||
options = Options(
|
options = Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
)
|
)
|
||||||
|
|
||||||
return type.__new__(cls, name, bases, dict(attrs, _meta=options))
|
return type.__new__(cls, name, bases, dict(attrs, _meta=options))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
|
from ..utils.trim_docstring import trim_docstring
|
||||||
from .options import Options
|
from .options import Options
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ class UnionMeta(type):
|
||||||
options = Options(
|
options = Options(
|
||||||
attrs.pop('Meta', None),
|
attrs.pop('Meta', None),
|
||||||
name=name,
|
name=name,
|
||||||
description=attrs.get('__doc__'),
|
description=trim_docstring(attrs.get('__doc__')),
|
||||||
types=(),
|
types=(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user