Skip to content

Commit 80ab7ba

Browse files
committed
Export all useful names at the top level
1 parent e41ac17 commit 80ab7ba

File tree

7 files changed

+82
-19
lines changed

7 files changed

+82
-19
lines changed

src/graphql_relay/__init__.py

+44-16
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@
99
connection_args,
1010
connection_definitions,
1111
forward_connection_args,
12+
page_info_type,
1213
Connection,
1314
ConnectionArguments,
15+
ConnectionConstructor,
1416
ConnectionCursor,
17+
ConnectionType,
1518
Edge,
19+
EdgeConstructor,
20+
EdgeType,
1621
GraphQLConnectionDefinitions,
1722
PageInfo,
23+
PageInfoConstructor,
24+
PageInfoType,
1825
)
1926

2027
# Helpers for creating connections from arrays
@@ -25,19 +32,26 @@
2532
cursor_to_offset,
2633
get_offset_with_default,
2734
offset_to_cursor,
35+
SizedSliceable,
2836
)
2937

3038
# Helper for creating mutations with client mutation IDs
31-
from .mutation.mutation import mutation_with_client_mutation_id
39+
from .mutation.mutation import (
40+
mutation_with_client_mutation_id,
41+
resolve_maybe_thunk,
42+
MutationFn,
43+
MutationFnWithoutArgs,
44+
NullResult,
45+
)
3246

3347
# Helper for creating node definitions
34-
from .node.node import node_definitions
48+
from .node.node import node_definitions, GraphQLNodeDefinitions
3549

3650
# Helper for creating plural identifying root fields
3751
from .node.plural import plural_identifying_root_field
3852

3953
# Utilities for creating global IDs in systems that don't have them
40-
from .node.node import from_global_id, global_id_field, to_global_id
54+
from .node.node import from_global_id, global_id_field, to_global_id, ResolvedGlobalId
4155

4256
# Deprecated functions from older graphql-relay-py versions
4357
# noinspection PyProtectedMember,PyUnresolvedReferences,PyDeprecation
@@ -52,30 +66,44 @@
5266
__version_info_js__ = version_info_js
5367

5468
__all__ = [
55-
"version",
56-
"version_info",
57-
"version_js",
58-
"version_info_js",
69+
"backward_connection_args",
5970
"Connection",
6071
"ConnectionArguments",
72+
"ConnectionConstructor",
6173
"ConnectionCursor",
62-
"Edge",
63-
"PageInfo",
64-
"backward_connection_args",
74+
"ConnectionType",
6575
"connection_args",
66-
"connection_definitions",
67-
"forward_connection_args",
68-
"GraphQLConnectionDefinitions",
6976
"connection_from_array",
7077
"connection_from_array_slice",
78+
"connection_definitions",
7179
"cursor_for_object_in_connection",
7280
"cursor_to_offset",
81+
"Edge",
82+
"EdgeConstructor",
83+
"EdgeType",
84+
"forward_connection_args",
85+
"from_global_id",
7386
"get_offset_with_default",
74-
"offset_to_cursor",
87+
"global_id_field",
88+
"GraphQLConnectionDefinitions",
89+
"GraphQLNodeDefinitions",
90+
"MutationFn",
91+
"MutationFnWithoutArgs",
7592
"mutation_with_client_mutation_id",
7693
"node_definitions",
94+
"NullResult",
95+
"offset_to_cursor",
96+
"PageInfo",
97+
"PageInfoConstructor",
98+
"PageInfoType",
99+
"page_info_type",
77100
"plural_identifying_root_field",
78-
"from_global_id",
79-
"global_id_field",
101+
"ResolvedGlobalId",
102+
"resolve_maybe_thunk",
103+
"SizedSliceable",
80104
"to_global_id",
105+
"version",
106+
"version_info",
107+
"version_js",
108+
"version_info_js",
81109
]

src/graphql_relay/connection/array_connection.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"cursor_to_offset",
2727
"get_offset_with_default",
2828
"offset_to_cursor",
29+
"SizedSliceable",
2930
]
3031

3132

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import warnings
22

3+
# noinspection PyDeprecation
34
from .array_connection import (
45
connection_from_array,
56
connection_from_array_slice,
67
cursor_for_object_in_connection,
78
cursor_to_offset,
89
get_offset_with_default,
910
offset_to_cursor,
11+
SizedSliceable,
1012
)
1113

14+
# Deprecated functions from older graphql-relay-py versions
15+
# noinspection PyProtectedMember,PyUnresolvedReferences,PyDeprecation
16+
from .array_connection import ( # noqa: F401
17+
connection_from_list,
18+
connection_from_list_slice,
19+
)
1220

1321
warnings.warn(
1422
"The 'arrayconnection' module is deprecated. "
@@ -17,12 +25,12 @@
1725
stacklevel=2,
1826
)
1927

20-
2128
__all__ = [
2229
"connection_from_array",
2330
"connection_from_array_slice",
2431
"cursor_for_object_in_connection",
2532
"cursor_to_offset",
2633
"get_offset_with_default",
2734
"offset_to_cursor",
35+
"SizedSliceable",
2836
]

src/graphql_relay/connection/connection.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,23 @@
4040
from typing_extensions import Protocol # type: ignore
4141

4242
__all__ = [
43-
"connection_definitions",
44-
"forward_connection_args",
4543
"backward_connection_args",
4644
"connection_args",
45+
"connection_definitions",
46+
"forward_connection_args",
47+
"page_info_type",
4748
"Connection",
4849
"ConnectionArguments",
50+
"ConnectionConstructor",
4951
"ConnectionCursor",
52+
"ConnectionType",
5053
"Edge",
54+
"EdgeConstructor",
55+
"EdgeType",
5156
"GraphQLConnectionDefinitions",
5257
"PageInfo",
58+
"PageInfoConstructor",
59+
"PageInfoType",
5360
]
5461

5562

src/graphql_relay/mutation/mutation.py

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
)
1818
from graphql.pyutils import AwaitableOrValue
1919

20+
__all__ = [
21+
"mutation_with_client_mutation_id",
22+
"resolve_maybe_thunk",
23+
"MutationFn",
24+
"MutationFnWithoutArgs",
25+
"NullResult",
26+
]
27+
2028
# Note: Contrary to the Javascript implementation of MutationFn,
2129
# the context is passed as part of the GraphQLResolveInfo and any arguments
2230
# are passed individually as keyword arguments.

src/graphql_relay/node/node.py

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
GraphQLTypeResolver,
1414
)
1515

16+
__all__ = [
17+
"from_global_id",
18+
"global_id_field",
19+
"node_definitions",
20+
"to_global_id",
21+
"GraphQLNodeDefinitions",
22+
"ResolvedGlobalId",
23+
]
24+
1625

1726
class GraphQLNodeDefinitions(NamedTuple):
1827

src/graphql_relay/node/plural.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
get_nullable_type,
1212
)
1313

14+
__all__ = ["plural_identifying_root_field"]
15+
1416

1517
def plural_identifying_root_field(
1618
arg_name: str,

0 commit comments

Comments
 (0)