ZTWHHH commited on
Commit
faa06d6
·
verified ·
1 Parent(s): 436e968

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/__init__.cpython-310.pyc +0 -0
  2. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/base.cpython-310.pyc +0 -0
  3. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/format_error.cpython-310.pyc +0 -0
  4. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/located_error.cpython-310.pyc +0 -0
  5. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/syntax_error.cpython-310.pyc +0 -0
  6. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
  7. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py +11 -0
  8. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py +29 -0
  9. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py +36 -0
  10. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
  11. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/__init__.cpython-310.pyc +0 -0
  12. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/definition.cpython-310.pyc +0 -0
  13. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/schema.cpython-310.pyc +0 -0
  14. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/typemap.cpython-310.pyc +0 -0
  15. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
  16. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
  17. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
  18. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
  19. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
  20. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/__init__.cpython-310.pyc +0 -0
  21. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/arguments_of_correct_type.cpython-310.pyc +0 -0
  22. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/base.cpython-310.pyc +0 -0
  23. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/default_values_of_correct_type.cpython-310.pyc +0 -0
  24. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_directives.cpython-310.pyc +0 -0
  25. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_fragment_names.cpython-310.pyc +0 -0
  26. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_type_names.cpython-310.pyc +0 -0
  27. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/lone_anonymous_operation.cpython-310.pyc +0 -0
  28. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_fragment_cycles.cpython-310.pyc +0 -0
  29. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_fragments.cpython-310.pyc +0 -0
  30. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_variables.cpython-310.pyc +0 -0
  31. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/overlapping_fields_can_be_merged.cpython-310.pyc +0 -0
  32. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/scalar_leafs.cpython-310.pyc +0 -0
  33. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_argument_names.cpython-310.pyc +0 -0
  34. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_fragment_names.cpython-310.pyc +0 -0
  35. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_input_field_names.cpython-310.pyc +0 -0
  36. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_variable_names.cpython-310.pyc +0 -0
  37. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/variables_are_input_types.cpython-310.pyc +0 -0
  38. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py +24 -0
  39. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py +8 -0
  40. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py +44 -0
  41. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py +97 -0
  42. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py +19 -0
  43. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py +43 -0
  44. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py +59 -0
  45. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py +38 -0
  46. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py +37 -0
  47. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py +46 -0
  48. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py +32 -0
  49. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py +28 -0
  50. parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py +31 -0
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (430 Bytes). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/base.cpython-310.pyc ADDED
Binary file (1.9 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/format_error.cpython-310.pyc ADDED
Binary file (575 Bytes). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/located_error.cpython-310.pyc ADDED
Binary file (946 Bytes). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/syntax_error.cpython-310.pyc ADDED
Binary file (1.31 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ..language.location import get_location
2
+
3
+
4
+ class GraphQLError(Exception):
5
+ __slots__ = 'message', 'nodes', 'stack', 'original_error', '_source', '_positions'
6
+
7
+ def __init__(self, message, nodes=None, stack=None, source=None, positions=None):
8
+ super(GraphQLError, self).__init__(message)
9
+ self.message = message
10
+ self.nodes = nodes
11
+ self.stack = stack
12
+ self._source = source
13
+ self._positions = positions
14
+
15
+ @property
16
+ def source(self):
17
+ if self._source:
18
+ return self._source
19
+ if self.nodes:
20
+ node = self.nodes[0]
21
+ return node and node.loc and node.loc.source
22
+
23
+ @property
24
+ def positions(self):
25
+ if self._positions:
26
+ return self._positions
27
+ if self.nodes is not None:
28
+ node_positions = [node.loc and node.loc.start for node in self.nodes]
29
+ if any(node_positions):
30
+ return node_positions
31
+
32
+ def reraise(self):
33
+ if self.stack:
34
+ raise self.with_traceback(self.stack)
35
+ else:
36
+ raise self
37
+
38
+ @property
39
+ def locations(self):
40
+ source = self.source
41
+ if self.positions and source:
42
+ return [get_location(source, pos) for pos in self.positions]
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def format_error(error):
2
+ formatted_error = {
3
+ 'message': error.message,
4
+ }
5
+ if error.locations is not None:
6
+ formatted_error['locations'] = [
7
+ {'line': loc.line, 'column': loc.column}
8
+ for loc in error.locations
9
+ ]
10
+
11
+ return formatted_error
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ from .base import GraphQLError
4
+
5
+ __all__ = ['GraphQLLocatedError']
6
+
7
+
8
+ class GraphQLLocatedError(GraphQLError):
9
+
10
+ def __init__(self, nodes, original_error=None):
11
+ if original_error:
12
+ try:
13
+ message = str(original_error)
14
+ except UnicodeEncodeError:
15
+ message = original_error.message.encode('utf-8')
16
+ else:
17
+ message = 'An unknown error occurred.'
18
+
19
+ if hasattr(original_error, 'stack'):
20
+ stack = original_error.stack
21
+ else:
22
+ stack = sys.exc_info()[2]
23
+
24
+ super(GraphQLLocatedError, self).__init__(
25
+ message=message,
26
+ nodes=nodes,
27
+ stack=stack
28
+ )
29
+ self.original_error = original_error
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ..language.location import get_location
2
+ from .base import GraphQLError
3
+
4
+ __all__ = ['GraphQLSyntaxError']
5
+
6
+
7
+ class GraphQLSyntaxError(GraphQLError):
8
+
9
+ def __init__(self, source, position, description):
10
+ location = get_location(source, position)
11
+ super(GraphQLSyntaxError, self).__init__(
12
+ message=u'Syntax Error {} ({}:{}) {}\n\n{}'.format(
13
+ source.name,
14
+ location.line,
15
+ location.column,
16
+ description,
17
+ highlight_source_at_location(source, location),
18
+ ),
19
+ source=source,
20
+ positions=[position],
21
+ )
22
+
23
+
24
+ def highlight_source_at_location(source, location):
25
+ line = location.line
26
+ lines = source.body.splitlines()
27
+ pad_len = len(str(line + 1))
28
+ result = u''
29
+ format = (u'{:>' + str(pad_len) + '}: {}\n').format
30
+ if line >= 2:
31
+ result += format(line - 1, lines[line - 2])
32
+ result += format(line, lines[line - 1])
33
+ result += ' ' * (1 + pad_len + location.column) + '^\n'
34
+ if line < len(lines):
35
+ result += format(line + 1, lines[line])
36
+ return result
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # flake8: noqa
2
+ from .definition import ( # no import order
3
+ GraphQLScalarType,
4
+ GraphQLObjectType,
5
+ GraphQLField,
6
+ GraphQLArgument,
7
+ GraphQLInterfaceType,
8
+ GraphQLUnionType,
9
+ GraphQLEnumType,
10
+ GraphQLEnumValue,
11
+ GraphQLInputObjectType,
12
+ GraphQLInputObjectField,
13
+ GraphQLList,
14
+ GraphQLNonNull,
15
+ get_named_type,
16
+ is_abstract_type,
17
+ is_composite_type,
18
+ is_input_type,
19
+ is_leaf_type,
20
+ is_type,
21
+ get_nullable_type,
22
+ is_output_type
23
+ )
24
+ from .directives import (
25
+ # "Enum" of Directive locations
26
+ DirectiveLocation,
27
+
28
+ # Directive definition
29
+ GraphQLDirective,
30
+
31
+ # Built-in directives defined by the Spec
32
+ specified_directives,
33
+ GraphQLSkipDirective,
34
+ GraphQLIncludeDirective,
35
+ GraphQLDeprecatedDirective,
36
+
37
+ # Constant Deprecation Reason
38
+ DEFAULT_DEPRECATION_REASON,
39
+ )
40
+ from .scalars import ( # no import order
41
+ GraphQLInt,
42
+ GraphQLFloat,
43
+ GraphQLString,
44
+ GraphQLBoolean,
45
+ GraphQLID,
46
+ )
47
+ from .schema import GraphQLSchema
48
+
49
+ from .introspection import (
50
+ # "Enum" of Type Kinds
51
+ TypeKind,
52
+
53
+ # GraphQL Types for introspection.
54
+ __Schema,
55
+ __Directive,
56
+ __DirectiveLocation,
57
+ __Type,
58
+ __Field,
59
+ __InputValue,
60
+ __EnumValue,
61
+ __TypeKind,
62
+
63
+ # Meta-field definitions.
64
+ SchemaMetaFieldDef,
65
+ TypeMetaFieldDef,
66
+ TypeNameMetaFieldDef
67
+ )
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (1.48 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/definition.cpython-310.pyc ADDED
Binary file (18.6 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/schema.cpython-310.pyc ADDED
Binary file (4.02 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/typemap.cpython-310.pyc ADDED
Binary file (4.67 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Mapping, Hashable
2
+ import collections
3
+ import copy
4
+
5
+ from ..language import ast
6
+ from ..pyutils.cached_property import cached_property
7
+ from ..pyutils.ordereddict import OrderedDict
8
+ from ..utils.assert_valid_name import assert_valid_name
9
+
10
+
11
+ def is_type(type):
12
+ return isinstance(type, (
13
+ GraphQLScalarType,
14
+ GraphQLObjectType,
15
+ GraphQLInterfaceType,
16
+ GraphQLUnionType,
17
+ GraphQLEnumType,
18
+ GraphQLInputObjectType,
19
+ GraphQLList,
20
+ GraphQLNonNull
21
+ ))
22
+
23
+
24
+ def is_input_type(type):
25
+ named_type = get_named_type(type)
26
+ return isinstance(named_type, (
27
+ GraphQLScalarType,
28
+ GraphQLEnumType,
29
+ GraphQLInputObjectType,
30
+ ))
31
+
32
+
33
+ def is_output_type(type):
34
+ named_type = get_named_type(type)
35
+ return isinstance(named_type, (
36
+ GraphQLScalarType,
37
+ GraphQLObjectType,
38
+ GraphQLInterfaceType,
39
+ GraphQLUnionType,
40
+ GraphQLEnumType
41
+ ))
42
+
43
+
44
+ def is_leaf_type(type):
45
+ return isinstance(type, (
46
+ GraphQLScalarType,
47
+ GraphQLEnumType,
48
+ ))
49
+
50
+
51
+ def is_composite_type(type):
52
+ named_type = get_named_type(type)
53
+ return isinstance(named_type, (
54
+ GraphQLObjectType,
55
+ GraphQLInterfaceType,
56
+ GraphQLUnionType,
57
+ ))
58
+
59
+
60
+ def is_abstract_type(type):
61
+ return isinstance(type, (
62
+ GraphQLInterfaceType,
63
+ GraphQLUnionType
64
+ ))
65
+
66
+
67
+ def get_nullable_type(type):
68
+ if isinstance(type, GraphQLNonNull):
69
+ return type.of_type
70
+ return type
71
+
72
+
73
+ def get_named_type(type):
74
+ unmodified_type = type
75
+ while isinstance(unmodified_type, (GraphQLList, GraphQLNonNull)):
76
+ unmodified_type = unmodified_type.of_type
77
+
78
+ return unmodified_type
79
+
80
+
81
+ class GraphQLType(object):
82
+ __slots__ = 'name',
83
+
84
+ def __str__(self):
85
+ return self.name
86
+
87
+ def is_same_type(self, other):
88
+ return self.__class__ is other.__class__ and self.name == other.name
89
+
90
+
91
+ def none_func(x):
92
+ None
93
+
94
+
95
+ class GraphQLScalarType(GraphQLType):
96
+ """Scalar Type Definition
97
+
98
+ The leaf values of any request and input values to arguments are
99
+ Scalars (or Enums) and are defined with a name and a series of coercion
100
+ functions used to ensure validity.
101
+
102
+ Example:
103
+
104
+ def coerce_odd(value):
105
+ if value % 2 == 1:
106
+ return value
107
+ return None
108
+
109
+ OddType = GraphQLScalarType(name='Odd', serialize=coerce_odd)
110
+ """
111
+
112
+ __slots__ = 'name', 'description', 'serialize', 'parse_value', 'parse_literal'
113
+
114
+ def __init__(self, name, description=None, serialize=None, parse_value=None, parse_literal=None):
115
+ assert name, 'Type must be named.'
116
+ assert_valid_name(name)
117
+ self.name = name
118
+ self.description = description
119
+
120
+ assert callable(serialize), (
121
+ '{} must provide "serialize" function. If this custom Scalar is '
122
+ 'also used as an input type, ensure "parse_value" and "parse_literal" '
123
+ 'functions are also provided.'
124
+ ).format(self)
125
+
126
+ if parse_value is not None or parse_literal is not None:
127
+ assert callable(parse_value) and callable(parse_literal), (
128
+ '{} must provide both "parse_value" and "parse_literal" functions.'.format(self)
129
+ )
130
+
131
+ self.serialize = serialize
132
+ self.parse_value = parse_value or none_func
133
+ self.parse_literal = parse_literal or none_func
134
+
135
+ def __str__(self):
136
+ return self.name
137
+
138
+
139
+ class GraphQLObjectType(GraphQLType):
140
+ """Object Type Definition
141
+
142
+ Almost all of the GraphQL types you define will be object types.
143
+ Object types have a name, but most importantly describe their fields.
144
+
145
+ Example:
146
+
147
+ AddressType = GraphQLObjectType('Address', {
148
+ 'street': GraphQLField(GraphQLString),
149
+ 'number': GraphQLField(GraphQLInt),
150
+ 'formatted': GraphQLField(GraphQLString,
151
+ resolver=lambda obj, args, context, info: obj.number + ' ' + obj.street),
152
+ })
153
+
154
+ When two types need to refer to each other, or a type needs to refer to
155
+ itself in a field, you can use a static method to supply the fields
156
+ lazily.
157
+
158
+ Example:
159
+
160
+ PersonType = GraphQLObjectType('Person', lambda: {
161
+ 'name': GraphQLField(GraphQLString),
162
+ 'bestFriend': GraphQLField(PersonType)
163
+ })
164
+ """
165
+ def __init__(self, name, fields, interfaces=None, is_type_of=None, description=None):
166
+ assert name, 'Type must be named.'
167
+ assert_valid_name(name)
168
+ self.name = name
169
+ self.description = description
170
+
171
+ if is_type_of is not None:
172
+ assert callable(is_type_of), '{} must provide "is_type_of" as a function.'.format(self)
173
+
174
+ self.is_type_of = is_type_of
175
+ self._fields = fields
176
+ self._provided_interfaces = interfaces
177
+ self._interfaces = None
178
+
179
+ @cached_property
180
+ def fields(self):
181
+ return define_field_map(self, self._fields)
182
+
183
+ @cached_property
184
+ def interfaces(self):
185
+ return define_interfaces(self, self._provided_interfaces)
186
+
187
+
188
+ def define_field_map(type, field_map):
189
+ if callable(field_map):
190
+ field_map = field_map()
191
+
192
+ assert isinstance(field_map, Mapping) and len(field_map) > 0, (
193
+ '{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
194
+ 'function which returns such a mapping.'
195
+ ).format(type)
196
+
197
+ for field_name, field in field_map.items():
198
+ assert_valid_name(field_name)
199
+ field_args = getattr(field, 'args', None)
200
+
201
+ if field_args:
202
+ assert isinstance(field_args, Mapping), (
203
+ '{}.{} args must be a mapping (dict / OrderedDict) with argument names as keys.'.format(type,
204
+ field_name)
205
+ )
206
+
207
+ for arg_name, arg in field_args.items():
208
+ assert_valid_name(arg_name)
209
+
210
+ return OrderedDict(field_map)
211
+
212
+
213
+ def define_interfaces(type, interfaces):
214
+ if callable(interfaces):
215
+ interfaces = interfaces()
216
+
217
+ if interfaces is None:
218
+ interfaces = []
219
+
220
+ assert isinstance(interfaces, (list, tuple)), (
221
+ '{} interfaces must be a list/tuple or a function which returns a list/tuple.'.format(type)
222
+ )
223
+
224
+ for interface in interfaces:
225
+ assert isinstance(interface, GraphQLInterfaceType), (
226
+ '{} may only implement Interface types, it cannot implement: {}.'.format(type, interface)
227
+ )
228
+
229
+ if not callable(interface.resolve_type):
230
+ assert callable(type.is_type_of), (
231
+ 'Interface Type {} does not provide a "resolve_type" function '
232
+ 'and implementing Type {} does not provide a "is_type_of" '
233
+ 'function. There is no way to resolve this implementing type '
234
+ 'during execution.'
235
+ ).format(interface, type)
236
+
237
+ return interfaces
238
+
239
+
240
+ class GraphQLField(object):
241
+ __slots__ = 'type', 'args', 'resolver', 'deprecation_reason', 'description'
242
+
243
+ def __init__(self, type, args=None, resolver=None, deprecation_reason=None, description=None):
244
+ self.type = type
245
+ self.args = args or OrderedDict()
246
+ self.resolver = resolver
247
+ self.deprecation_reason = deprecation_reason
248
+ self.description = description
249
+
250
+ def __eq__(self, other):
251
+ return (
252
+ self is other or (
253
+ isinstance(other, GraphQLField) and
254
+ self.type == other.type and
255
+ self.args == other.args and
256
+ self.resolver == other.resolver and
257
+ self.deprecation_reason == other.deprecation_reason and
258
+ self.description == other.description
259
+ )
260
+ )
261
+
262
+ def __hash__(self):
263
+ return id(self)
264
+
265
+
266
+ class GraphQLArgument(object):
267
+ __slots__ = 'type', 'default_value', 'description', 'out_name'
268
+
269
+ def __init__(self, type, default_value=None, description=None, out_name=None):
270
+ self.type = type
271
+ self.default_value = default_value
272
+ self.description = description
273
+ self.out_name = out_name
274
+
275
+ def __eq__(self, other):
276
+ return (
277
+ self is other or (
278
+ isinstance(other, GraphQLArgument) and
279
+ self.type == other.type and
280
+ self.default_value == other.default_value and
281
+ self.description == other.description and
282
+ self.out_name == other.out_name
283
+ )
284
+ )
285
+
286
+ def __hash__(self):
287
+ return id(self)
288
+
289
+
290
+ class GraphQLInterfaceType(GraphQLType):
291
+ """Interface Type Definition
292
+
293
+ When a field can return one of a heterogeneous set of types, a Interface type is used to describe what types are possible,
294
+ what fields are in common across all types, as well as a function to determine which type is actually used when the field is resolved.
295
+
296
+ Example:
297
+
298
+ EntityType = GraphQLInterfaceType(
299
+ name='Entity',
300
+ fields={
301
+ 'name': GraphQLField(GraphQLString),
302
+ })
303
+ """
304
+
305
+ def __init__(self, name, fields=None, resolve_type=None, description=None):
306
+ assert name, 'Type must be named.'
307
+ assert_valid_name(name)
308
+ self.name = name
309
+ self.description = description
310
+
311
+ if resolve_type is not None:
312
+ assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
313
+
314
+ self.resolve_type = resolve_type
315
+ self._fields = fields
316
+
317
+ @cached_property
318
+ def fields(self):
319
+ return define_field_map(self, self._fields)
320
+
321
+
322
+ class GraphQLUnionType(GraphQLType):
323
+ """Union Type Definition
324
+
325
+ When a field can return one of a heterogeneous set of types, a Union type is used to describe what types are possible
326
+ as well as providing a function to determine which type is actually used when the field is resolved.
327
+
328
+ Example:
329
+
330
+ class PetType(GraphQLUnionType):
331
+ name = 'Pet'
332
+ types = [DogType, CatType]
333
+
334
+ def resolve_type(self, value):
335
+ if isinstance(value, Dog):
336
+ return DogType()
337
+ if isinstance(value, Cat):
338
+ return CatType()
339
+ """
340
+
341
+ def __init__(self, name, types=None, resolve_type=None, description=None):
342
+ assert name, 'Type must be named.'
343
+ assert_valid_name(name)
344
+ self.name = name
345
+ self.description = description
346
+
347
+ if resolve_type is not None:
348
+ assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
349
+
350
+ self.resolve_type = resolve_type
351
+ self._types = types
352
+
353
+ @cached_property
354
+ def types(self):
355
+ return define_types(self, self._types)
356
+
357
+
358
+ def define_types(union_type, types):
359
+ if callable(types):
360
+ types = types()
361
+
362
+ assert isinstance(types, (list, tuple)) and len(
363
+ types) > 0, 'Must provide types for Union {}.'.format(union_type.name)
364
+ has_resolve_type_fn = callable(union_type.resolve_type)
365
+
366
+ for type in types:
367
+ assert isinstance(type, GraphQLObjectType), (
368
+ '{} may only contain Object types, it cannot contain: {}.'.format(union_type, type)
369
+ )
370
+
371
+ if not has_resolve_type_fn:
372
+ assert callable(type.is_type_of), (
373
+ 'Union Type {} does not provide a "resolve_type" function '
374
+ 'and possible Type {} does not provide a "is_type_of" '
375
+ 'function. There is no way to resolve this possible type '
376
+ 'during execution.'
377
+ ).format(union_type, type)
378
+
379
+ return types
380
+
381
+
382
+ class GraphQLEnumType(GraphQLType):
383
+ """Enum Type Definition
384
+
385
+ Some leaf values of requests and input values are Enums. GraphQL serializes Enum values as strings,
386
+ however internally Enums can be represented by any kind of type, often integers.
387
+
388
+ Example:
389
+
390
+ RGBType = GraphQLEnumType(
391
+ name='RGB',
392
+ values=OrderedDict([
393
+ ('RED', GraphQLEnumValue(0)),
394
+ ('GREEN', GraphQLEnumValue(1)),
395
+ ('BLUE', GraphQLEnumValue(2))
396
+ ])
397
+ )
398
+
399
+ Note: If a value is not provided in a definition, the name of the enum value will be used as it's internal value.
400
+ """
401
+
402
+ def __init__(self, name, values, description=None):
403
+ assert name, 'Type must provide name.'
404
+ assert_valid_name(name)
405
+ self.name = name
406
+ self.description = description
407
+
408
+ self.values = define_enum_values(self, values)
409
+
410
+ def serialize(self, value):
411
+ if isinstance(value, Hashable):
412
+ enum_value = self._value_lookup.get(value)
413
+
414
+ if enum_value:
415
+ return enum_value.name
416
+
417
+ return None
418
+
419
+ def parse_value(self, value):
420
+ if isinstance(value, Hashable):
421
+ enum_value = self._name_lookup.get(value)
422
+
423
+ if enum_value:
424
+ return enum_value.value
425
+
426
+ return None
427
+
428
+ def parse_literal(self, value_ast):
429
+ if isinstance(value_ast, ast.EnumValue):
430
+ enum_value = self._name_lookup.get(value_ast.value)
431
+
432
+ if enum_value:
433
+ return enum_value.value
434
+
435
+ @cached_property
436
+ def _value_lookup(self):
437
+ return {value.value: value for value in self.values}
438
+
439
+ @cached_property
440
+ def _name_lookup(self):
441
+ return {value.name: value for value in self.values}
442
+
443
+
444
+ def define_enum_values(type, value_map):
445
+ assert isinstance(value_map, Mapping) and len(value_map) > 0, (
446
+ '{} values must be a mapping (dict / OrderedDict) with value names as keys.'.format(type)
447
+ )
448
+
449
+ values = []
450
+ if not isinstance(value_map, (collections.OrderedDict, OrderedDict)):
451
+ value_map = OrderedDict(sorted(list(value_map.items())))
452
+
453
+ for value_name, value in value_map.items():
454
+ assert_valid_name(value_name)
455
+ assert isinstance(value, GraphQLEnumValue), (
456
+ '{}.{} must be an instance of GraphQLEnumValue, but got: {}'.format(type, value_name, value)
457
+ )
458
+ value = copy.copy(value)
459
+ value.name = value_name
460
+ if value.value is None:
461
+ value.value = value_name
462
+
463
+ values.append(value)
464
+
465
+ return values
466
+
467
+
468
+ class GraphQLEnumValue(object):
469
+ __slots__ = 'name', 'value', 'deprecation_reason', 'description'
470
+
471
+ def __init__(self, value=None, deprecation_reason=None, description=None, name=None):
472
+ self.name = name
473
+ self.value = value
474
+ self.deprecation_reason = deprecation_reason
475
+ self.description = description
476
+
477
+ def __eq__(self, other):
478
+ return (
479
+ self is other or (
480
+ isinstance(other, GraphQLEnumValue) and
481
+ self.name == other.name and
482
+ self.value == other.value and
483
+ self.deprecation_reason == other.deprecation_reason and
484
+ self.description == other.description
485
+ )
486
+ )
487
+
488
+
489
+ class GraphQLInputObjectType(GraphQLType):
490
+ """Input Object Type Definition
491
+
492
+ An input object defines a structured collection of fields which may be
493
+ supplied to a field argument.
494
+
495
+ Using `NonNull` will ensure that a value must be provided by the query
496
+
497
+ Example:
498
+
499
+ NonNullFloat = GraphQLNonNull(GraphQLFloat())
500
+
501
+ class GeoPoint(GraphQLInputObjectType):
502
+ name = 'GeoPoint'
503
+ fields = {
504
+ 'lat': GraphQLInputObjectField(NonNullFloat),
505
+ 'lon': GraphQLInputObjectField(NonNullFloat),
506
+ 'alt': GraphQLInputObjectField(GraphQLFloat(),
507
+ default_value=0)
508
+ }
509
+ """
510
+ def __init__(self, name, fields, description=None):
511
+ assert name, 'Type must be named.'
512
+ self.name = name
513
+ self.description = description
514
+
515
+ self._fields = fields
516
+
517
+ @cached_property
518
+ def fields(self):
519
+ return self._define_field_map()
520
+
521
+ def _define_field_map(self):
522
+ fields = self._fields
523
+ if callable(fields):
524
+ fields = fields()
525
+
526
+ assert isinstance(fields, Mapping) and len(fields) > 0, (
527
+ '{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
528
+ 'function which returns such a mapping.'
529
+ ).format(self)
530
+ if not isinstance(fields, (collections.OrderedDict, OrderedDict)):
531
+ fields = OrderedDict(sorted(list(fields.items())))
532
+
533
+ for field_name, field in fields.items():
534
+ assert_valid_name(field_name)
535
+
536
+ return fields
537
+
538
+
539
+ class GraphQLInputObjectField(object):
540
+ __slots__ = 'type', 'default_value', 'description', 'out_name'
541
+
542
+ def __init__(self, type, default_value=None, description=None, out_name=None):
543
+ self.type = type
544
+ self.default_value = default_value
545
+ self.description = description
546
+ self.out_name = out_name
547
+
548
+ def __eq__(self, other):
549
+ return (
550
+ self is other or (
551
+ isinstance(other, GraphQLInputObjectField) and
552
+ self.type == other.type and
553
+ self.description == other.description and
554
+ self.out_name == other.out_name
555
+ )
556
+ )
557
+
558
+
559
+ class GraphQLList(GraphQLType):
560
+ """List Modifier
561
+
562
+ A list is a kind of type marker, a wrapping type which points to another
563
+ type. Lists are often created within the context of defining the fields
564
+ of an object type.
565
+
566
+ Example:
567
+
568
+ class PersonType(GraphQLObjectType):
569
+ name = 'Person'
570
+
571
+ def get_fields(self):
572
+ return {
573
+ 'parents': GraphQLField(GraphQLList(PersonType())),
574
+ 'children': GraphQLField(GraphQLList(PersonType())),
575
+ }
576
+ """
577
+ __slots__ = 'of_type',
578
+
579
+ def __init__(self, type):
580
+ assert is_type(type), 'Can only create List of a GraphQLType but got: {}.'.format(type)
581
+ self.of_type = type
582
+
583
+ def __str__(self):
584
+ return '[' + str(self.of_type) + ']'
585
+
586
+ def is_same_type(self, other):
587
+ return isinstance(other, GraphQLList) and self.of_type.is_same_type(other.of_type)
588
+
589
+
590
+ class GraphQLNonNull(GraphQLType):
591
+ """Non-Null Modifier
592
+
593
+ A non-null is a kind of type marker, a wrapping type which points to another type. Non-null types enforce that their values are never null
594
+ and can ensure an error is raised if this ever occurs during a request. It is useful for fields which you can make a strong guarantee on
595
+ non-nullability, for example usually the id field of a database row will never be null.
596
+
597
+ Example:
598
+
599
+ class RowType(GraphQLObjectType):
600
+ name = 'Row'
601
+ fields = {
602
+ 'id': GraphQLField(type=GraphQLNonNull(GraphQLString()))
603
+ }
604
+
605
+ Note: the enforcement of non-nullability occurs within the executor.
606
+ """
607
+ __slots__ = 'of_type',
608
+
609
+ def __init__(self, type):
610
+ assert is_type(type) and not isinstance(type, GraphQLNonNull), (
611
+ 'Can only create NonNull of a Nullable GraphQLType but got: {}.'.format(type)
612
+ )
613
+ self.of_type = type
614
+
615
+ def __str__(self):
616
+ return str(self.of_type) + '!'
617
+
618
+ def is_same_type(self, other):
619
+ return isinstance(other, GraphQLNonNull) and self.of_type.is_same_type(other.of_type)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections import OrderedDict, namedtuple
2
+
3
+ from ..language.printer import print_ast
4
+ from ..utils.ast_from_value import ast_from_value
5
+ from .definition import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
6
+ GraphQLField, GraphQLInputObjectType,
7
+ GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
8
+ GraphQLObjectType, GraphQLScalarType,
9
+ GraphQLUnionType)
10
+ from .directives import DirectiveLocation
11
+ from .scalars import GraphQLBoolean, GraphQLString
12
+
13
+ InputField = namedtuple('InputField', ['name', 'description', 'type', 'default_value'])
14
+ Field = namedtuple('Field', ['name', 'type', 'description', 'args', 'deprecation_reason'])
15
+
16
+
17
+ def input_fields_to_list(input_fields):
18
+ fields = []
19
+ for field_name, field in input_fields.items():
20
+ fields.append(InputField(
21
+ name=field_name,
22
+ description=field.description,
23
+ type=field.type,
24
+ default_value=field.default_value))
25
+ return fields
26
+
27
+
28
+ __Schema = GraphQLObjectType(
29
+ '__Schema',
30
+ description='A GraphQL Schema defines the capabilities of a GraphQL server. It '
31
+ 'exposes all available types and directives on the server, as well as '
32
+ 'the entry points for query, mutation and subscription operations.',
33
+ fields=lambda: OrderedDict([
34
+ ('types', GraphQLField(
35
+ description='A list of all types supported by this server.',
36
+ type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__Type))),
37
+ resolver=lambda schema, *_: schema.get_type_map().values(),
38
+ )),
39
+ ('queryType', GraphQLField(
40
+ description='The type that query operations will be rooted at.',
41
+ type=GraphQLNonNull(__Type),
42
+ resolver=lambda schema, *_: schema.get_query_type(),
43
+ )),
44
+ ('mutationType', GraphQLField(
45
+ description='If this server supports mutation, the type that '
46
+ 'mutation operations will be rooted at.',
47
+ type=__Type,
48
+ resolver=lambda schema, *_: schema.get_mutation_type(),
49
+ )),
50
+ ('subscriptionType', GraphQLField(
51
+ description='If this server support subscription, the type '
52
+ 'that subscription operations will be rooted at.',
53
+ type=__Type,
54
+ resolver=lambda schema, *_: schema.get_subscription_type(),
55
+ )),
56
+ ('directives', GraphQLField(
57
+ description='A list of all directives supported by this server.',
58
+ type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__Directive))),
59
+ resolver=lambda schema, *_: schema.get_directives(),
60
+ )),
61
+ ]))
62
+
63
+ _on_operation_locations = set(DirectiveLocation.OPERATION_LOCATIONS)
64
+ _on_fragment_locations = set(DirectiveLocation.FRAGMENT_LOCATIONS)
65
+ _on_field_locations = set(DirectiveLocation.FIELD_LOCATIONS)
66
+
67
+ __Directive = GraphQLObjectType(
68
+ '__Directive',
69
+ description='A Directive provides a way to describe alternate runtime execution and '
70
+ 'type validation behavior in a GraphQL document.'
71
+ '\n\nIn some cases, you need to provide options to alter GraphQL\'s '
72
+ 'execution behavior in ways field arguments will not suffice, such as '
73
+ 'conditionally including or skipping a field. Directives provide this by '
74
+ 'describing additional information to the executor.',
75
+ fields=lambda: OrderedDict([
76
+ ('name', GraphQLField(GraphQLNonNull(GraphQLString))),
77
+ ('description', GraphQLField(GraphQLString)),
78
+ ('locations', GraphQLField(
79
+ type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__DirectiveLocation))),
80
+ )),
81
+ ('args', GraphQLField(
82
+ type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
83
+ resolver=lambda directive, *args: input_fields_to_list(directive.args),
84
+ )),
85
+ ('onOperation', GraphQLField(
86
+ type=GraphQLNonNull(GraphQLBoolean),
87
+ deprecation_reason='Use `locations`.',
88
+ resolver=lambda directive, *args: set(directive.locations) & _on_operation_locations,
89
+ )),
90
+ ('onFragment', GraphQLField(
91
+ type=GraphQLNonNull(GraphQLBoolean),
92
+ deprecation_reason='Use `locations`.',
93
+ resolver=lambda directive, *args: set(directive.locations) & _on_fragment_locations,
94
+ )),
95
+ ('onField', GraphQLField(
96
+ type=GraphQLNonNull(GraphQLBoolean),
97
+ deprecation_reason='Use `locations`.',
98
+ resolver=lambda directive, *args: set(directive.locations) & _on_field_locations,
99
+ ))
100
+ ]))
101
+
102
+ __DirectiveLocation = GraphQLEnumType(
103
+ '__DirectiveLocation',
104
+ description=(
105
+ 'A Directive can be adjacent to many parts of the GraphQL language, a ' +
106
+ '__DirectiveLocation describes one such possible adjacencies.'
107
+ ),
108
+ values=OrderedDict([
109
+ ('QUERY', GraphQLEnumValue(
110
+ DirectiveLocation.QUERY,
111
+ description='Location adjacent to a query operation.'
112
+ )),
113
+ ('MUTATION', GraphQLEnumValue(
114
+ DirectiveLocation.MUTATION,
115
+ description='Location adjacent to a mutation operation.'
116
+ )),
117
+ ('SUBSCRIPTION', GraphQLEnumValue(
118
+ DirectiveLocation.SUBSCRIPTION,
119
+ description='Location adjacent to a subscription operation.'
120
+ )),
121
+ ('FIELD', GraphQLEnumValue(
122
+ DirectiveLocation.FIELD,
123
+ description='Location adjacent to a field.'
124
+ )),
125
+ ('FRAGMENT_DEFINITION', GraphQLEnumValue(
126
+ DirectiveLocation.FRAGMENT_DEFINITION,
127
+ description='Location adjacent to a fragment definition.'
128
+ )),
129
+ ('FRAGMENT_SPREAD', GraphQLEnumValue(
130
+ DirectiveLocation.FRAGMENT_SPREAD,
131
+ description='Location adjacent to a fragment spread.'
132
+ )),
133
+ ('INLINE_FRAGMENT', GraphQLEnumValue(
134
+ DirectiveLocation.INLINE_FRAGMENT,
135
+ description='Location adjacent to an inline fragment.'
136
+ )),
137
+ ('SCHEMA', GraphQLEnumValue(
138
+ DirectiveLocation.SCHEMA,
139
+ description='Location adjacent to a schema definition.'
140
+ )),
141
+ ('SCALAR', GraphQLEnumValue(
142
+ DirectiveLocation.SCALAR,
143
+ description='Location adjacent to a scalar definition.'
144
+ )),
145
+ ('OBJECT', GraphQLEnumValue(
146
+ DirectiveLocation.OBJECT,
147
+ description='Location adjacent to an object definition.'
148
+ )),
149
+ ('FIELD_DEFINITION', GraphQLEnumValue(
150
+ DirectiveLocation.FIELD_DEFINITION,
151
+ description='Location adjacent to a field definition.'
152
+ )),
153
+ ('ARGUMENT_DEFINITION', GraphQLEnumValue(
154
+ DirectiveLocation.ARGUMENT_DEFINITION,
155
+ description='Location adjacent to an argument definition.'
156
+ )),
157
+ ('INTERFACE', GraphQLEnumValue(
158
+ DirectiveLocation.INTERFACE,
159
+ description='Location adjacent to an interface definition.'
160
+ )),
161
+ ('UNION', GraphQLEnumValue(
162
+ DirectiveLocation.UNION,
163
+ description='Location adjacent to a union definition.'
164
+ )),
165
+ ('ENUM', GraphQLEnumValue(
166
+ DirectiveLocation.ENUM,
167
+ description='Location adjacent to an enum definition.'
168
+ )),
169
+ ('ENUM_VALUE', GraphQLEnumValue(
170
+ DirectiveLocation.ENUM_VALUE,
171
+ description='Location adjacent to an enum value definition.'
172
+ )),
173
+ ('INPUT_OBJECT', GraphQLEnumValue(
174
+ DirectiveLocation.INPUT_OBJECT,
175
+ description='Location adjacent to an input object definition.'
176
+ )),
177
+ ('INPUT_FIELD_DEFINITION', GraphQLEnumValue(
178
+ DirectiveLocation.INPUT_FIELD_DEFINITION,
179
+ description='Location adjacent to an input object field definition.'
180
+ )),
181
+ ]))
182
+
183
+
184
+ class TypeKind(object):
185
+ SCALAR = 'SCALAR'
186
+ OBJECT = 'OBJECT'
187
+ INTERFACE = 'INTERFACE'
188
+ UNION = 'UNION'
189
+ ENUM = 'ENUM'
190
+ INPUT_OBJECT = 'INPUT_OBJECT'
191
+ LIST = 'LIST'
192
+ NON_NULL = 'NON_NULL'
193
+
194
+
195
+ class TypeFieldResolvers(object):
196
+ _kinds = (
197
+ (GraphQLScalarType, TypeKind.SCALAR),
198
+ (GraphQLObjectType, TypeKind.OBJECT),
199
+ (GraphQLInterfaceType, TypeKind.INTERFACE),
200
+ (GraphQLUnionType, TypeKind.UNION),
201
+ (GraphQLEnumType, TypeKind.ENUM),
202
+ (GraphQLInputObjectType, TypeKind.INPUT_OBJECT),
203
+ (GraphQLList, TypeKind.LIST),
204
+ (GraphQLNonNull, TypeKind.NON_NULL),
205
+ )
206
+
207
+ @classmethod
208
+ def kind(cls, type, *_):
209
+ for klass, kind in cls._kinds:
210
+ if isinstance(type, klass):
211
+ return kind
212
+
213
+ raise Exception('Unknown kind of type: {}'.format(type))
214
+
215
+ @staticmethod
216
+ def fields(type, args, *_):
217
+ if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType)):
218
+ fields = []
219
+ include_deprecated = args.get('includeDeprecated')
220
+ for field_name, field in type.fields.items():
221
+ if field.deprecation_reason and not include_deprecated:
222
+ continue
223
+ fields.append(Field(
224
+ name=field_name,
225
+ description=field.description,
226
+ type=field.type,
227
+ args=field.args,
228
+ deprecation_reason=field.deprecation_reason
229
+ ))
230
+ return fields
231
+ return None
232
+
233
+ @staticmethod
234
+ def interfaces(type, *_):
235
+ if isinstance(type, GraphQLObjectType):
236
+ return type.interfaces
237
+
238
+ @staticmethod
239
+ def possible_types(type, args, context, info):
240
+ if isinstance(type, (GraphQLInterfaceType, GraphQLUnionType)):
241
+ return info.schema.get_possible_types(type)
242
+
243
+ @staticmethod
244
+ def enum_values(type, args, *_):
245
+ if isinstance(type, GraphQLEnumType):
246
+ values = type.values
247
+ if not args.get('includeDeprecated'):
248
+ values = [v for v in values if not v.deprecation_reason]
249
+
250
+ return values
251
+
252
+ @staticmethod
253
+ def input_fields(type, *_):
254
+ if isinstance(type, GraphQLInputObjectType):
255
+ return input_fields_to_list(type.fields)
256
+
257
+
258
+ __Type = GraphQLObjectType(
259
+ '__Type',
260
+ description='The fundamental unit of any GraphQL Schema is the type. There are '
261
+ 'many kinds of types in GraphQL as represented by the `__TypeKind` enum.'
262
+ '\n\nDepending on the kind of a type, certain fields describe '
263
+ 'information about that type. Scalar types provide no information '
264
+ 'beyond a name and description, while Enum types provide their values. '
265
+ 'Object and Interface types provide the fields they describe. Abstract '
266
+ 'types, Union and Interface, provide the Object types possible '
267
+ 'at runtime. List and NonNull types compose other types.',
268
+ fields=lambda: OrderedDict([
269
+ ('kind', GraphQLField(
270
+ type=GraphQLNonNull(__TypeKind),
271
+ resolver=TypeFieldResolvers.kind
272
+ )),
273
+ ('name', GraphQLField(GraphQLString)),
274
+ ('description', GraphQLField(GraphQLString)),
275
+ ('fields', GraphQLField(
276
+ type=GraphQLList(GraphQLNonNull(__Field)),
277
+ args={
278
+ 'includeDeprecated': GraphQLArgument(
279
+ GraphQLBoolean,
280
+ default_value=False
281
+ )
282
+ },
283
+ resolver=TypeFieldResolvers.fields
284
+ )),
285
+ ('interfaces', GraphQLField(
286
+ type=GraphQLList(GraphQLNonNull(__Type)),
287
+ resolver=TypeFieldResolvers.interfaces
288
+ )),
289
+ ('possibleTypes', GraphQLField(
290
+ type=GraphQLList(GraphQLNonNull(__Type)),
291
+ resolver=TypeFieldResolvers.possible_types
292
+ )),
293
+ ('enumValues', GraphQLField(
294
+ type=GraphQLList(GraphQLNonNull(__EnumValue)),
295
+ args={
296
+ 'includeDeprecated': GraphQLArgument(
297
+ GraphQLBoolean,
298
+ default_value=False
299
+ )
300
+ },
301
+ resolver=TypeFieldResolvers.enum_values
302
+ )),
303
+ ('inputFields', GraphQLField(
304
+ type=GraphQLList(GraphQLNonNull(__InputValue)),
305
+ resolver=TypeFieldResolvers.input_fields
306
+ )),
307
+ ('ofType', GraphQLField(
308
+ type=__Type,
309
+ resolver=lambda type, *_: getattr(type, 'of_type', None)
310
+ )),
311
+ ]))
312
+
313
+ __Field = GraphQLObjectType(
314
+ '__Field',
315
+ description='Object and Interface types are described by a list of Fields, each of '
316
+ 'which has a name, potentially a list of arguments, and a return type.',
317
+ fields=lambda: OrderedDict([
318
+ ('name', GraphQLField(GraphQLNonNull(GraphQLString))),
319
+ ('description', GraphQLField(GraphQLString)),
320
+ ('args', GraphQLField(
321
+ type=GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
322
+ resolver=lambda field, *_: input_fields_to_list(field.args)
323
+ )),
324
+ ('type', GraphQLField(GraphQLNonNull(__Type))),
325
+ ('isDeprecated', GraphQLField(
326
+ type=GraphQLNonNull(GraphQLBoolean),
327
+ resolver=lambda field, *_: bool(field.deprecation_reason)
328
+ )),
329
+ ('deprecationReason', GraphQLField(
330
+ type=GraphQLString,
331
+ resolver=lambda field, *_: field.deprecation_reason
332
+ ))
333
+ ])
334
+ )
335
+
336
+ __InputValue = GraphQLObjectType(
337
+ '__InputValue',
338
+ description='Arguments provided to Fields or Directives and the input fields of an '
339
+ 'InputObject are represented as Input Values which describe their type '
340
+ 'and optionally a default value.',
341
+ fields=lambda: OrderedDict([
342
+ ('name', GraphQLField(GraphQLNonNull(GraphQLString))),
343
+ ('description', GraphQLField(GraphQLString)),
344
+ ('type', GraphQLField(GraphQLNonNull(__Type))),
345
+ ('defaultValue', GraphQLField(
346
+ type=GraphQLString,
347
+ resolver=lambda input_val, *_:
348
+ None if input_val.default_value is None
349
+ else print_ast(ast_from_value(input_val.default_value, input_val))
350
+ ))
351
+ ]))
352
+
353
+ __EnumValue = GraphQLObjectType(
354
+ '__EnumValue',
355
+ description='One possible value for a given Enum. Enum values are unique values, not '
356
+ 'a placeholder for a string or numeric value. However an Enum value is '
357
+ 'returned in a JSON response as a string.',
358
+ fields=lambda: OrderedDict([
359
+ ('name', GraphQLField(GraphQLNonNull(GraphQLString))),
360
+ ('description', GraphQLField(GraphQLString)),
361
+ ('isDeprecated', GraphQLField(
362
+ type=GraphQLNonNull(GraphQLBoolean),
363
+ resolver=lambda field, *_: bool(field.deprecation_reason)
364
+ )),
365
+ ('deprecationReason', GraphQLField(
366
+ type=GraphQLString,
367
+ resolver=lambda enum_value, *_: enum_value.deprecation_reason,
368
+ ))
369
+ ]))
370
+
371
+ __TypeKind = GraphQLEnumType(
372
+ '__TypeKind',
373
+ description='An enum describing what kind of type a given `__Type` is',
374
+ values=OrderedDict([
375
+ ('SCALAR', GraphQLEnumValue(
376
+ TypeKind.SCALAR,
377
+ description='Indicates this type is a scalar.'
378
+ )),
379
+ ('OBJECT', GraphQLEnumValue(
380
+ TypeKind.OBJECT,
381
+ description='Indicates this type is an object. '
382
+ '`fields` and `interfaces` are valid fields.'
383
+ )),
384
+ ('INTERFACE', GraphQLEnumValue(
385
+ TypeKind.INTERFACE,
386
+ description='Indicates this type is an interface. '
387
+ '`fields` and `possibleTypes` are valid fields.'
388
+ )),
389
+ ('UNION', GraphQLEnumValue(
390
+ TypeKind.UNION,
391
+ description='Indicates this type is a union. '
392
+ '`possibleTypes` is a valid field.'
393
+ )),
394
+ ('ENUM', GraphQLEnumValue(
395
+ TypeKind.ENUM,
396
+ description='Indicates this type is an enum. '
397
+ '`enumValues` is a valid field.'
398
+ )),
399
+ ('INPUT_OBJECT', GraphQLEnumValue(
400
+ TypeKind.INPUT_OBJECT,
401
+ description='Indicates this type is an input object. '
402
+ '`inputFields` is a valid field.'
403
+ )),
404
+ ('LIST', GraphQLEnumValue(
405
+ TypeKind.LIST,
406
+ description='Indicates this type is a list. '
407
+ '`ofType` is a valid field.'
408
+ )),
409
+ ('NON_NULL', GraphQLEnumValue(
410
+ TypeKind.NON_NULL,
411
+ description='Indicates this type is a non-null. '
412
+ '`ofType` is a valid field.'
413
+ )),
414
+ ]))
415
+
416
+ IntrospectionSchema = __Schema
417
+
418
+ SchemaMetaFieldDef = GraphQLField(
419
+ # name='__schema',
420
+ type=GraphQLNonNull(__Schema),
421
+ description='Access the current type schema of this server.',
422
+ resolver=lambda source, args, context, info: info.schema,
423
+ args={}
424
+ )
425
+
426
+ TypeMetaFieldDef = GraphQLField(
427
+ type=__Type,
428
+ # name='__type',
429
+ description='Request the type information of a single type.',
430
+ args={'name': GraphQLArgument(GraphQLNonNull(GraphQLString))},
431
+ resolver=lambda source, args, context, info: info.schema.get_type(args['name'])
432
+ )
433
+
434
+ TypeNameMetaFieldDef = GraphQLField(
435
+ type=GraphQLNonNull(GraphQLString),
436
+ # name='__typename',
437
+ description='The name of the current Object type at runtime.',
438
+ resolver=lambda source, args, context, info: info.parent_type.name,
439
+ args={}
440
+ )
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ..language.ast import BooleanValue, FloatValue, IntValue, StringValue
2
+ from .definition import GraphQLScalarType
3
+
4
+ # As per the GraphQL Spec, Integers are only treated as valid when a valid
5
+ # 32-bit signed integer, providing the broadest support across platforms.
6
+ #
7
+ # n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
8
+ # they are internally represented as IEEE 754 doubles.
9
+ MAX_INT = 2147483647
10
+ MIN_INT = -2147483648
11
+
12
+
13
+ def coerce_int(value):
14
+ if isinstance(value, int):
15
+ num = value
16
+ else:
17
+ try:
18
+ num = int(value)
19
+ except ValueError:
20
+ num = int(float(value))
21
+ if MIN_INT <= num <= MAX_INT:
22
+ return num
23
+ raise Exception((
24
+ "Int cannot represent non 32-bit signed integer value: {}"
25
+ ).format(value))
26
+
27
+
28
+ def parse_int_literal(ast):
29
+ if isinstance(ast, IntValue):
30
+ num = int(ast.value)
31
+ if MIN_INT <= num <= MAX_INT:
32
+ return num
33
+
34
+
35
+ GraphQLInt = GraphQLScalarType(
36
+ name='Int',
37
+ description='The `Int` scalar type represents non-fractional signed whole numeric '
38
+ 'values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since '
39
+ 'represented in JSON as double-precision floating point numbers specified'
40
+ 'by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
41
+ serialize=coerce_int,
42
+ parse_value=coerce_int,
43
+ parse_literal=parse_int_literal)
44
+
45
+
46
+ def coerce_float(value):
47
+ if isinstance(value, float):
48
+ return value
49
+ return float(value)
50
+
51
+
52
+ def parse_float_literal(ast):
53
+ if isinstance(ast, (FloatValue, IntValue)):
54
+ return float(ast.value)
55
+ return None
56
+
57
+
58
+ GraphQLFloat = GraphQLScalarType(
59
+ name='Float',
60
+ description='The `Float` scalar type represents signed double-precision fractional '
61
+ 'values as specified by '
62
+ '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ',
63
+ serialize=coerce_float,
64
+ parse_value=coerce_float,
65
+ parse_literal=parse_float_literal)
66
+
67
+
68
+ def coerce_string(value):
69
+ if isinstance(value, str):
70
+ return value
71
+
72
+ if isinstance(value, bool):
73
+ return u'true' if value else u'false'
74
+
75
+ return str(value)
76
+
77
+
78
+ def coerce_str(value):
79
+ if isinstance(value, str):
80
+ return value
81
+
82
+ return str(value)
83
+
84
+
85
+ def parse_string_literal(ast):
86
+ if isinstance(ast, StringValue):
87
+ return ast.value
88
+
89
+ return None
90
+
91
+
92
+ GraphQLString = GraphQLScalarType(
93
+ name='String',
94
+ description='The `String` scalar type represents textual data, represented as UTF-8 '
95
+ 'character sequences. The String type is most often used by GraphQL to '
96
+ 'represent free-form human-readable text.',
97
+ serialize=coerce_string,
98
+ parse_value=coerce_string,
99
+ parse_literal=parse_string_literal)
100
+
101
+
102
+ def parse_boolean_literal(ast):
103
+ if isinstance(ast, BooleanValue):
104
+ return ast.value
105
+ return None
106
+
107
+
108
+ GraphQLBoolean = GraphQLScalarType(
109
+ name='Boolean',
110
+ description='The `Boolean` scalar type represents `true` or `false`.',
111
+ serialize=bool,
112
+ parse_value=bool,
113
+ parse_literal=parse_boolean_literal)
114
+
115
+
116
+ def parse_id_literal(ast):
117
+ if isinstance(ast, (StringValue, IntValue)):
118
+ return ast.value
119
+ return None
120
+
121
+
122
+ GraphQLID = GraphQLScalarType(
123
+ name='ID',
124
+ description='The `ID` scalar type represents a unique identifier, often used to '
125
+ 'refetch an object or as key for a cache. The ID type appears in a JSON '
126
+ 'response as a String; however, it is not intended to be human-readable. '
127
+ 'When expected as an input type, any string (such as `"4"`) or integer '
128
+ '(such as `4`) input value will be accepted as an ID.',
129
+ serialize=coerce_str,
130
+ parse_value=coerce_str,
131
+ parse_literal=parse_id_literal)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Iterable
2
+
3
+ from .definition import GraphQLObjectType
4
+ from .directives import GraphQLDirective, specified_directives
5
+ from .introspection import IntrospectionSchema
6
+ from .typemap import GraphQLTypeMap
7
+
8
+
9
+ class GraphQLSchema(object):
10
+ """Schema Definition
11
+
12
+ A Schema is created by supplying the root types of each type of operation, query and mutation (optional).
13
+ A schema definition is then supplied to the validator and executor.
14
+
15
+ Example:
16
+
17
+ MyAppSchema = GraphQLSchema(
18
+ query=MyAppQueryRootType,
19
+ mutation=MyAppMutationRootType,
20
+ )
21
+
22
+ Note: If an array of `directives` are provided to GraphQLSchema, that will be
23
+ the exact list of directives represented and allowed. If `directives` is not
24
+ provided then a default set of the specified directives (e.g. @include and
25
+ @skip) will be used. If you wish to provide *additional* directives to these
26
+ specified directives, you must explicitly declare them. Example:
27
+
28
+ MyAppSchema = GraphQLSchema(
29
+ ...
30
+ directives=specified_directives.extend([MyCustomerDirective]),
31
+ )
32
+ """
33
+ __slots__ = '_query', '_mutation', '_subscription', '_type_map', '_directives', '_implementations', '_possible_type_map'
34
+
35
+ def __init__(self, query, mutation=None, subscription=None, directives=None, types=None):
36
+ assert isinstance(query, GraphQLObjectType), 'Schema query must be Object Type but got: {}.'.format(query)
37
+ if mutation:
38
+ assert isinstance(mutation, GraphQLObjectType), \
39
+ 'Schema mutation must be Object Type but got: {}.'.format(mutation)
40
+
41
+ if subscription:
42
+ assert isinstance(subscription, GraphQLObjectType), \
43
+ 'Schema subscription must be Object Type but got: {}.'.format(subscription)
44
+
45
+ if types:
46
+ assert isinstance(types, Iterable), \
47
+ 'Schema types must be iterable if provided but got: {}.'.format(types)
48
+
49
+ self._query = query
50
+ self._mutation = mutation
51
+ self._subscription = subscription
52
+ if directives is None:
53
+ directives = specified_directives
54
+
55
+ assert all(isinstance(d, GraphQLDirective) for d in directives), \
56
+ 'Schema directives must be List[GraphQLDirective] if provided but got: {}.'.format(
57
+ directives
58
+ )
59
+ self._directives = directives
60
+
61
+ initial_types = [
62
+ query,
63
+ mutation,
64
+ subscription,
65
+ IntrospectionSchema
66
+ ]
67
+ if types:
68
+ initial_types += types
69
+ self._type_map = GraphQLTypeMap(initial_types)
70
+
71
+ def get_query_type(self):
72
+ return self._query
73
+
74
+ def get_mutation_type(self):
75
+ return self._mutation
76
+
77
+ def get_subscription_type(self):
78
+ return self._subscription
79
+
80
+ def get_type_map(self):
81
+ return self._type_map
82
+
83
+ def get_type(self, name):
84
+ return self._type_map.get(name)
85
+
86
+ def get_directives(self):
87
+ return self._directives
88
+
89
+ def get_directive(self, name):
90
+ for directive in self.get_directives():
91
+ if directive.name == name:
92
+ return directive
93
+
94
+ return None
95
+
96
+ def get_possible_types(self, abstract_type):
97
+ return self._type_map.get_possible_types(abstract_type)
98
+
99
+ def is_possible_type(self, abstract_type, possible_type):
100
+ return self._type_map.is_possible_type(abstract_type, possible_type)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections import OrderedDict, defaultdict
2
+ from collections.abc import Sequence
3
+ from functools import reduce
4
+
5
+ from ..utils.type_comparators import is_equal_type, is_type_sub_type_of
6
+ from .definition import (GraphQLArgument, GraphQLField,
7
+ GraphQLInputObjectField, GraphQLInputObjectType,
8
+ GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
9
+ GraphQLObjectType, GraphQLUnionType, is_input_type,
10
+ is_output_type)
11
+
12
+
13
+ class GraphQLTypeMap(OrderedDict):
14
+
15
+ def __init__(self, types):
16
+ super(GraphQLTypeMap, self).__init__()
17
+ self.update(reduce(self.reducer, types, OrderedDict()))
18
+ self._possible_type_map = defaultdict(set)
19
+
20
+ # Keep track of all implementations by interface name.
21
+ self._implementations = {}
22
+ for gql_type in self.values():
23
+ if isinstance(gql_type, GraphQLObjectType):
24
+ for interface in gql_type.interfaces:
25
+ self._implementations.setdefault(interface.name, []).append(gql_type)
26
+
27
+ # Enforce correct interface implementations.
28
+ for type in self.values():
29
+ if isinstance(type, GraphQLObjectType):
30
+ for interface in type.interfaces:
31
+ self.assert_object_implements_interface(self, type, interface)
32
+
33
+ def get_possible_types(self, abstract_type):
34
+ if isinstance(abstract_type, GraphQLUnionType):
35
+ return abstract_type.types
36
+ assert isinstance(abstract_type, GraphQLInterfaceType)
37
+ return self._implementations.get(abstract_type.name, None)
38
+
39
+ def is_possible_type(self, abstract_type, possible_type):
40
+ possible_types = self.get_possible_types(abstract_type)
41
+ assert isinstance(possible_types, Sequence), (
42
+ 'Could not find possible implementing types for ${} in ' +
43
+ 'schema. Check that schema.types is defined and is an array of' +
44
+ 'all possible types in the schema.'
45
+ ).format(abstract_type)
46
+
47
+ if not self._possible_type_map[abstract_type.name]:
48
+ self._possible_type_map[abstract_type.name].update([p.name for p in possible_types])
49
+
50
+ return possible_type.name in self._possible_type_map[abstract_type.name]
51
+
52
+ @classmethod
53
+ def reducer(cls, map, type):
54
+ if not type:
55
+ return map
56
+
57
+ if isinstance(type, GraphQLList) or isinstance(type, GraphQLNonNull):
58
+ return cls.reducer(map, type.of_type)
59
+
60
+ if type.name in map:
61
+ assert map[type.name] == type, (
62
+ 'Schema must contain unique named types but contains multiple types named "{}".'
63
+ ).format(type.name)
64
+
65
+ return map
66
+
67
+ map[type.name] = type
68
+
69
+ reduced_map = map
70
+
71
+ if isinstance(type, (GraphQLUnionType)):
72
+ for t in type.types:
73
+ reduced_map = cls.reducer(reduced_map, t)
74
+
75
+ if isinstance(type, GraphQLObjectType):
76
+ for t in type.interfaces:
77
+ reduced_map = cls.reducer(reduced_map, t)
78
+
79
+ if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType)):
80
+ field_map = type.fields
81
+ type_is_input = isinstance(type, GraphQLInputObjectType)
82
+ for field_name, field in field_map.items():
83
+ if type_is_input:
84
+ assert isinstance(field, GraphQLInputObjectField), (
85
+ '{}.{} must be an instance of GraphQLInputObjectField.'.format(type, field_name)
86
+ )
87
+ assert is_input_type(field.type), (
88
+ '{}.{} field type must be Input Type but got: {}.'.format(type, field_name, field.type)
89
+ )
90
+ else:
91
+ assert isinstance(field, (GraphQLField, GraphQLField)), (
92
+ '{}.{} must be an instance of GraphQLField.'.format(type, field_name)
93
+ )
94
+ assert is_output_type(field.type), (
95
+ '{}.{} field type must be Output Type but got: {}.'.format(type, field_name, field.type)
96
+ )
97
+ for arg_name, arg in field.args.items():
98
+ assert isinstance(arg, (GraphQLArgument, GraphQLArgument)), (
99
+ '{}.{}({}:) argument must be an instance of GraphQLArgument.'.format(type, field_name, arg_name)
100
+ )
101
+ assert is_input_type(arg.type), (
102
+ '{}.{}({}:) argument type must be Input Type but got: {}.'.format(type, field_name, arg_name,
103
+ arg.type)
104
+ )
105
+ reduced_map = cls.reducer(reduced_map, arg.type)
106
+
107
+ reduced_map = cls.reducer(reduced_map, getattr(field, 'type', None))
108
+
109
+ return reduced_map
110
+
111
+ @classmethod
112
+ def assert_object_implements_interface(cls, schema, object, interface):
113
+ object_field_map = object.fields
114
+ interface_field_map = interface.fields
115
+
116
+ for field_name, interface_field in interface_field_map.items():
117
+ object_field = object_field_map.get(field_name)
118
+
119
+ assert object_field, '"{}" expects field "{}" but "{}" does not provide it.'.format(
120
+ interface, field_name, object
121
+ )
122
+
123
+ assert is_type_sub_type_of(schema, object_field.type, interface_field.type), (
124
+ '{}.{} expects type "{}" but {}.{} provides type "{}".'
125
+ ).format(interface, field_name, interface_field.type, object, field_name, object_field.type)
126
+
127
+ for arg_name, interface_arg in interface_field.args.items():
128
+ object_arg = object_field.args.get(arg_name)
129
+
130
+ assert object_arg, (
131
+ '{}.{} expects argument "{}" but {}.{} does not provide it.'
132
+ ).format(interface, field_name, arg_name, object, field_name)
133
+
134
+ assert is_equal_type(interface_arg.type, object_arg.type), (
135
+ '{}.{}({}:) expects type "{}" but {}.{}({}:) provides type "{}".'
136
+ ).format(interface, field_name, arg_name, interface_arg.type, object, field_name, arg_name, object_arg.type)
137
+
138
+ for arg_name, object_arg in object_field.args.items():
139
+ interface_arg = interface_field.args.get(arg_name)
140
+ if not interface_arg:
141
+ assert not isinstance(object_arg.type, GraphQLNonNull), (
142
+ '{}.{}({}:) is of required type '
143
+ '"{}" but is not also provided by the '
144
+ 'interface {}.{}.'
145
+ ).format(object, field_name, arg_name, object_arg.type, interface, field_name)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (2.1 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/arguments_of_correct_type.cpython-310.pyc ADDED
Binary file (1.29 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/base.cpython-310.pyc ADDED
Binary file (584 Bytes). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/default_values_of_correct_type.cpython-310.pyc ADDED
Binary file (2.24 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_directives.cpython-310.pyc ADDED
Binary file (2.94 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_fragment_names.cpython-310.pyc ADDED
Binary file (1.04 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_type_names.cpython-310.pyc ADDED
Binary file (1.86 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/lone_anonymous_operation.cpython-310.pyc ADDED
Binary file (1.76 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_fragment_cycles.cpython-310.pyc ADDED
Binary file (2.36 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_fragments.cpython-310.pyc ADDED
Binary file (1.89 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_variables.cpython-310.pyc ADDED
Binary file (1.94 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/overlapping_fields_can_be_merged.cpython-310.pyc ADDED
Binary file (9.9 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/scalar_leafs.cpython-310.pyc ADDED
Binary file (1.43 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_argument_names.cpython-310.pyc ADDED
Binary file (1.59 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_fragment_names.cpython-310.pyc ADDED
Binary file (1.53 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_input_field_names.cpython-310.pyc ADDED
Binary file (1.74 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_variable_names.cpython-310.pyc ADDED
Binary file (1.54 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/variables_are_input_types.cpython-310.pyc ADDED
Binary file (1.32 kB). View file
 
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from ...language.printer import print_ast
3
+ from ...utils.is_valid_literal_value import is_valid_literal_value
4
+ from .base import ValidationRule
5
+
6
+
7
+ class ArgumentsOfCorrectType(ValidationRule):
8
+
9
+ def enter_Argument(self, node, key, parent, path, ancestors):
10
+ arg_def = self.context.get_argument()
11
+ if arg_def:
12
+ errors = is_valid_literal_value(arg_def.type, node.value)
13
+ if errors:
14
+ self.context.report_error(GraphQLError(
15
+ self.bad_value_message(node.name.value, arg_def.type,
16
+ print_ast(node.value), errors),
17
+ [node.value]
18
+ ))
19
+ return False
20
+
21
+ @staticmethod
22
+ def bad_value_message(arg_name, type, value, verbose_errors):
23
+ message = (u'\n' + u'\n'.join(verbose_errors)) if verbose_errors else ''
24
+ return 'Argument "{}" has invalid value {}.{}'.format(arg_name, value, message)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from ...language.visitor import Visitor
2
+
3
+
4
+ class ValidationRule(Visitor):
5
+ __slots__ = 'context',
6
+
7
+ def __init__(self, context):
8
+ self.context = context
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from ...language.printer import print_ast
3
+ from ...type.definition import GraphQLNonNull
4
+ from ...utils.is_valid_literal_value import is_valid_literal_value
5
+ from .base import ValidationRule
6
+
7
+
8
+ class DefaultValuesOfCorrectType(ValidationRule):
9
+
10
+ def enter_VariableDefinition(self, node, key, parent, path, ancestors):
11
+ name = node.variable.name.value
12
+ default_value = node.default_value
13
+ type = self.context.get_input_type()
14
+
15
+ if isinstance(type, GraphQLNonNull) and default_value:
16
+ self.context.report_error(GraphQLError(
17
+ self.default_for_non_null_arg_message(name, type, type.of_type),
18
+ [default_value]
19
+ ))
20
+
21
+ if type and default_value:
22
+ errors = is_valid_literal_value(type, default_value)
23
+ if errors:
24
+ self.context.report_error(GraphQLError(
25
+ self.bad_value_for_default_arg_message(name, type, print_ast(default_value), errors),
26
+ [default_value]
27
+ ))
28
+ return False
29
+
30
+ def enter_SelectionSet(self, node, key, parent, path, ancestors):
31
+ return False
32
+
33
+ def enter_FragmentDefinition(self, node, key, parent, path, ancestors):
34
+ return False
35
+
36
+ @staticmethod
37
+ def default_for_non_null_arg_message(var_name, type, guess_type):
38
+ return u'Variable "${}" of type "{}" is required and will not use the default value. ' \
39
+ u'Perhaps you meant to use type "{}".'.format(var_name, type, guess_type)
40
+
41
+ @staticmethod
42
+ def bad_value_for_default_arg_message(var_name, type, value, verbose_errors):
43
+ message = (u'\n' + u'\n'.join(verbose_errors)) if verbose_errors else u''
44
+ return u'Variable "${}" of type "{}" has invalid default value: {}.{}'.format(var_name, type, value, message)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from ...language import ast
3
+ from ...type.directives import DirectiveLocation
4
+ from .base import ValidationRule
5
+
6
+
7
+ class KnownDirectives(ValidationRule):
8
+
9
+ def enter_Directive(self, node, key, parent, path, ancestors):
10
+ directive_def = next((
11
+ definition for definition in self.context.get_schema().get_directives()
12
+ if definition.name == node.name.value
13
+ ), None)
14
+
15
+ if not directive_def:
16
+ return self.context.report_error(GraphQLError(
17
+ self.unknown_directive_message(node.name.value),
18
+ [node]
19
+ ))
20
+
21
+ candidate_location = get_directive_location_for_ast_path(ancestors)
22
+ if not candidate_location:
23
+ self.context.report_error(GraphQLError(
24
+ self.misplaced_directive_message(node.name.value, node.type),
25
+ [node]
26
+ ))
27
+ elif candidate_location not in directive_def.locations:
28
+ self.context.report_error(GraphQLError(
29
+ self.misplaced_directive_message(node.name.value, candidate_location),
30
+ [node]
31
+ ))
32
+
33
+ @staticmethod
34
+ def unknown_directive_message(directive_name):
35
+ return 'Unknown directive "{}".'.format(directive_name)
36
+
37
+ @staticmethod
38
+ def misplaced_directive_message(directive_name, location):
39
+ return 'Directive "{}" may not be used on "{}".'.format(directive_name, location)
40
+
41
+
42
+ _operation_definition_map = {
43
+ 'query': DirectiveLocation.QUERY,
44
+ 'mutation': DirectiveLocation.MUTATION,
45
+ 'subscription': DirectiveLocation.SUBSCRIPTION,
46
+ }
47
+
48
+
49
+ def get_directive_location_for_ast_path(ancestors):
50
+ applied_to = ancestors[-1]
51
+ if isinstance(applied_to, ast.OperationDefinition):
52
+ return _operation_definition_map.get(applied_to.operation)
53
+
54
+ elif isinstance(applied_to, ast.Field):
55
+ return DirectiveLocation.FIELD
56
+
57
+ elif isinstance(applied_to, ast.FragmentSpread):
58
+ return DirectiveLocation.FRAGMENT_SPREAD
59
+
60
+ elif isinstance(applied_to, ast.InlineFragment):
61
+ return DirectiveLocation.INLINE_FRAGMENT
62
+
63
+ elif isinstance(applied_to, ast.FragmentDefinition):
64
+ return DirectiveLocation.FRAGMENT_DEFINITION
65
+
66
+ elif isinstance(applied_to, ast.SchemaDefinition):
67
+ return DirectiveLocation.SCHEMA
68
+
69
+ elif isinstance(applied_to, ast.ScalarTypeDefinition):
70
+ return DirectiveLocation.SCALAR
71
+
72
+ elif isinstance(applied_to, ast.ObjectTypeDefinition):
73
+ return DirectiveLocation.OBJECT
74
+
75
+ elif isinstance(applied_to, ast.FieldDefinition):
76
+ return DirectiveLocation.FIELD_DEFINITION
77
+
78
+ elif isinstance(applied_to, ast.InterfaceTypeDefinition):
79
+ return DirectiveLocation.INTERFACE
80
+
81
+ elif isinstance(applied_to, ast.UnionTypeDefinition):
82
+ return DirectiveLocation.UNION
83
+
84
+ elif isinstance(applied_to, ast.EnumTypeDefinition):
85
+ return DirectiveLocation.ENUM
86
+
87
+ elif isinstance(applied_to, ast.EnumValueDefinition):
88
+ return DirectiveLocation.ENUM_VALUE
89
+
90
+ elif isinstance(applied_to, ast.InputObjectTypeDefinition):
91
+ return DirectiveLocation.INPUT_OBJECT
92
+
93
+ elif isinstance(applied_to, ast.InputValueDefinition):
94
+ parent_node = ancestors[-3]
95
+ return (DirectiveLocation.INPUT_FIELD_DEFINITION
96
+ if isinstance(parent_node, ast.InputObjectTypeDefinition)
97
+ else DirectiveLocation.ARGUMENT_DEFINITION)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class KnownFragmentNames(ValidationRule):
6
+
7
+ def enter_FragmentSpread(self, node, key, parent, path, ancestors):
8
+ fragment_name = node.name.value
9
+ fragment = self.context.get_fragment(fragment_name)
10
+
11
+ if not fragment:
12
+ self.context.report_error(GraphQLError(
13
+ self.unknown_fragment_message(fragment_name),
14
+ [node.name]
15
+ ))
16
+
17
+ @staticmethod
18
+ def unknown_fragment_message(fragment_name):
19
+ return 'Unknown fragment "{}".'.format(fragment_name)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from ...utils.quoted_or_list import quoted_or_list
3
+ from ...utils.suggestion_list import suggestion_list
4
+ from .base import ValidationRule
5
+
6
+
7
+ def _unknown_type_message(type, suggested_types):
8
+ message = 'Unknown type "{}".'.format(type)
9
+ if suggested_types:
10
+ message += ' Perhaps you meant {}?'.format(quoted_or_list(suggested_types))
11
+
12
+ return message
13
+
14
+
15
+ class KnownTypeNames(ValidationRule):
16
+
17
+ def enter_ObjectTypeDefinition(self, node, *args):
18
+ return False
19
+
20
+ def enter_InterfaceTypeDefinition(self, node, *args):
21
+ return False
22
+
23
+ def enter_UnionTypeDefinition(self, node, *args):
24
+ return False
25
+
26
+ def enter_InputObjectTypeDefinition(self, node, *args):
27
+ return False
28
+
29
+ def enter_NamedType(self, node, *args):
30
+ schema = self.context.get_schema()
31
+ type_name = node.name.value
32
+ type = schema.get_type(type_name)
33
+
34
+ if not type:
35
+ self.context.report_error(
36
+ GraphQLError(
37
+ _unknown_type_message(
38
+ type_name,
39
+ suggestion_list(type_name, list(schema.get_type_map().keys()))
40
+ ),
41
+ [node]
42
+ )
43
+ )
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class NoFragmentCycles(ValidationRule):
6
+ __slots__ = 'errors', 'visited_frags', 'spread_path', 'spread_path_index_by_name'
7
+
8
+ def __init__(self, context):
9
+ super(NoFragmentCycles, self).__init__(context)
10
+ self.errors = []
11
+ self.visited_frags = set()
12
+ self.spread_path = []
13
+ self.spread_path_index_by_name = {}
14
+
15
+ def enter_OperationDefinition(self, node, key, parent, path, ancestors):
16
+ return False
17
+
18
+ def enter_FragmentDefinition(self, node, key, parent, path, ancestors):
19
+ if node.name.value not in self.visited_frags:
20
+ self.detect_cycle_recursive(node)
21
+ return False
22
+
23
+ def detect_cycle_recursive(self, fragment):
24
+ fragment_name = fragment.name.value
25
+ self.visited_frags.add(fragment_name)
26
+
27
+ spread_nodes = self.context.get_fragment_spreads(fragment.selection_set)
28
+ if not spread_nodes:
29
+ return
30
+
31
+ self.spread_path_index_by_name[fragment_name] = len(self.spread_path)
32
+
33
+ for spread_node in spread_nodes:
34
+ spread_name = spread_node.name.value
35
+ cycle_index = self.spread_path_index_by_name.get(spread_name)
36
+
37
+ if cycle_index is None:
38
+ self.spread_path.append(spread_node)
39
+ if spread_name not in self.visited_frags:
40
+ spread_fragment = self.context.get_fragment(spread_name)
41
+ if spread_fragment:
42
+ self.detect_cycle_recursive(spread_fragment)
43
+ self.spread_path.pop()
44
+ else:
45
+ cycle_path = self.spread_path[cycle_index:]
46
+ self.context.report_error(GraphQLError(
47
+ self.cycle_error_message(
48
+ spread_name,
49
+ [s.name.value for s in cycle_path]
50
+ ),
51
+ cycle_path + [spread_node]
52
+ ))
53
+
54
+ self.spread_path_index_by_name[fragment_name] = None
55
+
56
+ @staticmethod
57
+ def cycle_error_message(fragment_name, spread_names):
58
+ via = ' via {}'.format(', '.join(spread_names)) if spread_names else ''
59
+ return 'Cannot spread fragment "{}" within itself{}.'.format(fragment_name, via)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class NoUnusedFragments(ValidationRule):
6
+ __slots__ = 'fragment_definitions', 'operation_definitions', 'fragment_adjacencies', 'spread_names'
7
+
8
+ def __init__(self, context):
9
+ super(NoUnusedFragments, self).__init__(context)
10
+ self.operation_definitions = []
11
+ self.fragment_definitions = []
12
+
13
+ def enter_OperationDefinition(self, node, key, parent, path, ancestors):
14
+ self.operation_definitions.append(node)
15
+ return False
16
+
17
+ def enter_FragmentDefinition(self, node, key, parent, path, ancestors):
18
+ self.fragment_definitions.append(node)
19
+ return False
20
+
21
+ def leave_Document(self, node, key, parent, path, ancestors):
22
+ fragment_names_used = set()
23
+
24
+ for operation in self.operation_definitions:
25
+ fragments = self.context.get_recursively_referenced_fragments(operation)
26
+ for fragment in fragments:
27
+ fragment_names_used.add(fragment.name.value)
28
+
29
+ for fragment_definition in self.fragment_definitions:
30
+ if fragment_definition.name.value not in fragment_names_used:
31
+ self.context.report_error(GraphQLError(
32
+ self.unused_fragment_message(fragment_definition.name.value),
33
+ [fragment_definition]
34
+ ))
35
+
36
+ @staticmethod
37
+ def unused_fragment_message(fragment_name):
38
+ return 'Fragment "{}" is never used.'.format(fragment_name)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class NoUnusedVariables(ValidationRule):
6
+ __slots__ = 'variable_definitions'
7
+
8
+ def __init__(self, context):
9
+ self.variable_definitions = []
10
+ super(NoUnusedVariables, self).__init__(context)
11
+
12
+ def enter_OperationDefinition(self, node, key, parent, path, ancestors):
13
+ self.variable_definitions = []
14
+
15
+ def leave_OperationDefinition(self, operation, key, parent, path, ancestors):
16
+ variable_name_used = set()
17
+ usages = self.context.get_recursive_variable_usages(operation)
18
+ op_name = operation.name and operation.name.value or None
19
+
20
+ for variable_usage in usages:
21
+ variable_name_used.add(variable_usage.node.name.value)
22
+
23
+ for variable_definition in self.variable_definitions:
24
+ if variable_definition.variable.name.value not in variable_name_used:
25
+ self.context.report_error(GraphQLError(
26
+ self.unused_variable_message(variable_definition.variable.name.value, op_name),
27
+ [variable_definition]
28
+ ))
29
+
30
+ def enter_VariableDefinition(self, node, key, parent, path, ancestors):
31
+ self.variable_definitions.append(node)
32
+
33
+ @staticmethod
34
+ def unused_variable_message(variable_name, op_name):
35
+ if op_name:
36
+ return 'Variable "${}" is never used in operation "{}".'.format(variable_name, op_name)
37
+ return 'Variable "${}" is never used.'.format(variable_name)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from ...type.definition import GraphQLNonNull
3
+ from .base import ValidationRule
4
+
5
+
6
+ class ProvidedNonNullArguments(ValidationRule):
7
+
8
+ def leave_Field(self, node, key, parent, path, ancestors):
9
+ field_def = self.context.get_field_def()
10
+ if not field_def:
11
+ return False
12
+
13
+ arg_asts = node.arguments or []
14
+ arg_ast_map = {arg.name.value: arg for arg in arg_asts}
15
+
16
+ for arg_name, arg_def in field_def.args.items():
17
+ arg_ast = arg_ast_map.get(arg_name, None)
18
+ if not arg_ast and isinstance(arg_def.type, GraphQLNonNull):
19
+ self.context.report_error(GraphQLError(
20
+ self.missing_field_arg_message(node.name.value, arg_name, arg_def.type),
21
+ [node]
22
+ ))
23
+
24
+ def leave_Directive(self, node, key, parent, path, ancestors):
25
+ directive_def = self.context.get_directive()
26
+ if not directive_def:
27
+ return False
28
+
29
+ arg_asts = node.arguments or []
30
+ arg_ast_map = {arg.name.value: arg for arg in arg_asts}
31
+
32
+ for arg_name, arg_def in directive_def.args.items():
33
+ arg_ast = arg_ast_map.get(arg_name, None)
34
+ if not arg_ast and isinstance(arg_def.type, GraphQLNonNull):
35
+ self.context.report_error(GraphQLError(
36
+ self.missing_directive_arg_message(node.name.value, arg_name, arg_def.type),
37
+ [node]
38
+ ))
39
+
40
+ @staticmethod
41
+ def missing_field_arg_message(name, arg_name, type):
42
+ return 'Field "{}" argument "{}" of type "{}" is required but not provided.'.format(name, arg_name, type)
43
+
44
+ @staticmethod
45
+ def missing_directive_arg_message(name, arg_name, type):
46
+ return 'Directive "{}" argument "{}" of type "{}" is required but not provided.'.format(name, arg_name, type)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class UniqueArgumentNames(ValidationRule):
6
+ __slots__ = 'known_arg_names',
7
+
8
+ def __init__(self, context):
9
+ super(UniqueArgumentNames, self).__init__(context)
10
+ self.known_arg_names = {}
11
+
12
+ def enter_Field(self, node, key, parent, path, ancestors):
13
+ self.known_arg_names = {}
14
+
15
+ def enter_Directive(self, node, key, parent, path, ancestors):
16
+ self.known_arg_names = {}
17
+
18
+ def enter_Argument(self, node, key, parent, path, ancestors):
19
+ arg_name = node.name.value
20
+
21
+ if arg_name in self.known_arg_names:
22
+ self.context.report_error(GraphQLError(
23
+ self.duplicate_arg_message(arg_name),
24
+ [self.known_arg_names[arg_name], node.name]
25
+ ))
26
+ else:
27
+ self.known_arg_names[arg_name] = node.name
28
+ return False
29
+
30
+ @staticmethod
31
+ def duplicate_arg_message(field):
32
+ return 'There can only be one argument named "{}".'.format(field)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class UniqueFragmentNames(ValidationRule):
6
+ __slots__ = 'known_fragment_names',
7
+
8
+ def __init__(self, context):
9
+ super(UniqueFragmentNames, self).__init__(context)
10
+ self.known_fragment_names = {}
11
+
12
+ def enter_OperationDefinition(self, node, key, parent, path, ancestors):
13
+ return False
14
+
15
+ def enter_FragmentDefinition(self, node, key, parent, path, ancestors):
16
+ fragment_name = node.name.value
17
+ if fragment_name in self.known_fragment_names:
18
+ self.context.report_error(GraphQLError(
19
+ self.duplicate_fragment_name_message(fragment_name),
20
+ [self.known_fragment_names[fragment_name], node.name]
21
+ ))
22
+ else:
23
+ self.known_fragment_names[fragment_name] = node.name
24
+ return False
25
+
26
+ @staticmethod
27
+ def duplicate_fragment_name_message(field):
28
+ return 'There can only be one fragment named "{}".'.format(field)
parrot/lib/python3.10/site-packages/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...error import GraphQLError
2
+ from .base import ValidationRule
3
+
4
+
5
+ class UniqueOperationNames(ValidationRule):
6
+ __slots__ = 'known_operation_names',
7
+
8
+ def __init__(self, context):
9
+ super(UniqueOperationNames, self).__init__(context)
10
+ self.known_operation_names = {}
11
+
12
+ def enter_OperationDefinition(self, node, key, parent, path, ancestors):
13
+ operation_name = node.name
14
+ if not operation_name:
15
+ return
16
+
17
+ if operation_name.value in self.known_operation_names:
18
+ self.context.report_error(GraphQLError(
19
+ self.duplicate_operation_name_message(operation_name.value),
20
+ [self.known_operation_names[operation_name.value], operation_name]
21
+ ))
22
+ else:
23
+ self.known_operation_names[operation_name.value] = operation_name
24
+ return False
25
+
26
+ def enter_FragmentDefinition(self, node, key, parent, path, ancestors):
27
+ return False
28
+
29
+ @staticmethod
30
+ def duplicate_operation_name_message(operation_name):
31
+ return 'There can only be one operation named "{}".'.format(operation_name)