From b8ae1710e82e39ff651a73f9c07fe1047a71b3f1 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Thu, 9 Apr 2020 15:07:18 +0200 Subject: [PATCH] fix rendering of tables in docstrings Signed-off-by: oleg.hoefling --- src/graphql/utilities/ast_from_value.py | 20 ++++++++++--------- src/graphql/utilities/value_from_ast.py | 20 ++++++++++--------- .../utilities/value_from_ast_untyped.py | 18 +++++++++-------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/graphql/utilities/ast_from_value.py b/src/graphql/utilities/ast_from_value.py index 53623163..c392e863 100644 --- a/src/graphql/utilities/ast_from_value.py +++ b/src/graphql/utilities/ast_from_value.py @@ -45,15 +45,17 @@ def ast_from_value(value: Any, type_: GraphQLInputType) -> Optional[ValueNode]: A GraphQL type must be provided, which will be used to interpret different Python values. - | JSON Value | GraphQL Value | - | ------------- | -------------------- | - | Object | Input Object | - | Array | List | - | Boolean | Boolean | - | String | String / Enum Value | - | Number | Int / Float | - | Mixed | Enum Value | - | null | NullValue | + ================ ======================= + JSON Value GraphQL Value + ================ ======================= + Object Input Object + Array List + Boolean Boolean + String String / Enum Value + Number Int / Float + Mixed Enum Value + null NullValue + ================ ======================= """ if is_non_null_type(type_): diff --git a/src/graphql/utilities/value_from_ast.py b/src/graphql/utilities/value_from_ast.py index 82e3f2b0..7bb08845 100644 --- a/src/graphql/utilities/value_from_ast.py +++ b/src/graphql/utilities/value_from_ast.py @@ -36,15 +36,17 @@ def value_from_ast( Returns `Undefined` when the value could not be validly coerced according to the provided type. - | GraphQL Value | JSON Value | Python Value | - | -------------------- | ------------- | ------------ | - | Input Object | Object | dict | - | List | Array | list | - | Boolean | Boolean | bool | - | String | String | str | - | Int / Float | Number | int / float | - | Enum Value | Mixed | Any | - | NullValue | null | None | + =================== ============== ================ + GraphQL Value JSON Value Python Value + =================== ============== ================ + Input Object Object dict + List Array list + Boolean Boolean bool + String String str + Int / Float Number int / float + Enum Value Mixed Any + NullValue null None + =================== ============== ================ """ if not value_node: diff --git a/src/graphql/utilities/value_from_ast_untyped.py b/src/graphql/utilities/value_from_ast_untyped.py index 0cc82015..cf245707 100644 --- a/src/graphql/utilities/value_from_ast_untyped.py +++ b/src/graphql/utilities/value_from_ast_untyped.py @@ -15,14 +15,16 @@ def value_from_ast_untyped( Unlike `value_from_ast()`, no type is provided. The resulting Python value will reflect the provided GraphQL value AST. - | GraphQL Value | JSON Value | Python Value | - | -------------------- | ---------- | ------------ | - | Input Object | Object | dict | - | List | Array | list | - | Boolean | Boolean | bool | - | String / Enum | String | str | - | Int / Float | Number | int / float | - | Null | null | None | + =================== ============== ================ + GraphQL Value JSON Value Python Value + =================== ============== ================ + Input Object Object dict + List Array list + Boolean Boolean bool + String / Enum String str + Int / Float Number int / float + Null null None + =================== ============== ================ """ func = _value_from_kind_functions.get(value_node.kind)