id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
6,001 | leave_EnumValueDefinition | def leave_EnumValueDefinition(self, node, *args):
return node.name + wrap(' ', join(node.directives, ' ')) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 157 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,002 | leave_InputObjectTypeDefinition | def leave_InputObjectTypeDefinition(self, node, *args):
return 'input ' + node.name + wrap(' ', join(node.directives, ' ')) + ' ' + block(node.fields) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 160 | 161 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,003 | leave_TypeExtensionDefinition | def leave_TypeExtensionDefinition(self, node, *args):
return 'extend ' + node.definition | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 163 | 164 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,004 | leave_DirectiveDefinition | def leave_DirectiveDefinition(self, node, *args):
return 'directive @{}{} on {}'.format(node.name, wrap(
'(', join(node.arguments, ', '), ')'), ' | '.join(node.locations)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 166 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,005 | join | def join(maybe_list, separator=''):
if maybe_list:
return separator.join(filter(None, maybe_list))
return '' | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 171 | 174 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,006 | block | def block(_list):
'''Given a list, print each item on its own line, wrapped in an indented "{ }" block.'''
if _list:
return indent('{\n' + join(_list, '\n')) + '\n}'
return '{}' | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 177 | 181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,007 | wrap | def wrap(start, maybe_str, end=''):
if maybe_str:
return start + maybe_str + end
return '' | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 184 | 187 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,008 | indent | def indent(maybe_str):
if maybe_str:
return maybe_str.replace('\n', '\n ')
return maybe_str | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py | 190 | 193 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,009 | __init__ | def __init__(self, body, name='GraphQL'):
self.body = body
self.name = name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py | 7 | 9 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,010 | __eq__ | def __eq__(self, other):
return (
self is other or (
isinstance(other, Source) and
self.body == other.body and
self.name == other.name
)
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py | 11 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,011 | __init__ | def __init__(self, name, description=None, args=None, locations=None):
assert name, 'Directive must be named.'
assert_valid_name(name)
assert isinstance(locations, Iterable), 'Must provide locations for directive.'
self.name = name
self.description = description
self.locations = locations
if args:
assert isinstance(args, Mapping), '{} args must be a dict with argument names as keys.'.format(name)
for arg_name, _arg in args.items():
assert_valid_name(arg_name)
assert is_input_type(_arg.type), '{}({}) argument type must be Input Type but got {}.'.format(
name,
arg_name,
_arg.type)
self.args = args or OrderedDict() | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py | 52 | 69 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,012 | input_fields_to_list | def input_fields_to_list(input_fields):
fields = []
for field_name, field in input_fields.items():
fields.append(InputField(
name=field_name,
description=field.description,
type=field.type,
default_value=field.default_value))
return fields | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 17 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,013 | kind | def kind(cls, type, *_):
for klass, kind in cls._kinds:
if isinstance(type, klass):
return kind
raise Exception('Unknown kind of type: {}'.format(type)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 208 | 213 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,014 | fields | def fields(type, args, *_):
if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType)):
fields = []
include_deprecated = args.get('includeDeprecated')
for field_name, field in type.fields.items():
if field.deprecation_reason and not include_deprecated:
continue
fields.append(Field(
name=field_name,
description=field.description,
type=field.type,
args=field.args,
deprecation_reason=field.deprecation_reason
))
return fields
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 216 | 231 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,015 | interfaces | def interfaces(type, *_):
if isinstance(type, GraphQLObjectType):
return type.interfaces | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 234 | 236 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,016 | possible_types | def possible_types(type, args, context, info):
if isinstance(type, (GraphQLInterfaceType, GraphQLUnionType)):
return info.schema.get_possible_types(type) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 239 | 241 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,017 | enum_values | def enum_values(type, args, *_):
if isinstance(type, GraphQLEnumType):
values = type.values
if not args.get('includeDeprecated'):
values = [v for v in values if not v.deprecation_reason]
return values | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 244 | 250 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,018 | input_fields | def input_fields(type, *_):
if isinstance(type, GraphQLInputObjectType):
return input_fields_to_list(type.fields) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py | 253 | 255 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,019 | __init__ | def __init__(self, types):
super(GraphQLTypeMap, self).__init__()
self.update(reduce(self.reducer, types, OrderedDict()))
self._possible_type_map = defaultdict(set)
# Keep track of all implementations by interface name.
self._implementations = {}
for gql_type in self.values():
if isinstance(gql_type, GraphQLObjectType):
for interface in gql_type.interfaces:
self._implementations.setdefault(interface.name, []).append(gql_type)
# Enforce correct interface implementations.
for type in self.values():
if isinstance(type, GraphQLObjectType):
for interface in type.interfaces:
self.assert_object_implements_interface(self, type, interface) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py | 15 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,020 | get_possible_types | def get_possible_types(self, abstract_type):
if isinstance(abstract_type, GraphQLUnionType):
return abstract_type.types
assert isinstance(abstract_type, GraphQLInterfaceType)
return self._implementations.get(abstract_type.name, None) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py | 33 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,021 | is_possible_type | def is_possible_type(self, abstract_type, possible_type):
possible_types = self.get_possible_types(abstract_type)
assert isinstance(possible_types, Sequence), (
'Could not find possible implementing types for ${} in ' +
'schema. Check that schema.types is defined and is an array of' +
'all possible types in the schema.'
).format(abstract_type)
if not self._possible_type_map[abstract_type.name]:
self._possible_type_map[abstract_type.name].update([p.name for p in possible_types])
return possible_type.name in self._possible_type_map[abstract_type.name] | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py | 39 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,022 | reducer | def reducer(cls, map, type):
if not type:
return map
if isinstance(type, GraphQLList) or isinstance(type, GraphQLNonNull):
return cls.reducer(map, type.of_type)
if type.name in map:
assert map[type.name] == type, (
'Schema must contain unique named types but contains multiple types named "{}".'
).format(type.name)
return map
map[type.name] = type
reduced_map = map
if isinstance(type, (GraphQLUnionType)):
for t in type.types:
reduced_map = cls.reducer(reduced_map, t)
if isinstance(type, GraphQLObjectType):
for t in type.interfaces:
reduced_map = cls.reducer(reduced_map, t)
if isinstance(type, (GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType)):
field_map = type.fields
type_is_input = isinstance(type, GraphQLInputObjectType)
for field_name, field in field_map.items():
if type_is_input:
assert isinstance(field, GraphQLInputObjectField), (
'{}.{} must be an instance of GraphQLInputObjectField.'.format(type, field_name)
)
assert is_input_type(field.type), (
'{}.{} field type must be Input Type but got: {}.'.format(type, field_name, field.type)
)
else:
assert isinstance(field, (GraphQLField, GraphQLField)), (
'{}.{} must be an instance of GraphQLField.'.format(type, field_name)
)
assert is_output_type(field.type), (
'{}.{} field type must be Output Type but got: {}.'.format(type, field_name, field.type)
)
for arg_name, arg in field.args.items():
assert isinstance(arg, (GraphQLArgument, GraphQLArgument)), (
'{}.{}({}:) argument must be an instance of GraphQLArgument.'.format(type, field_name, arg_name)
)
assert is_input_type(arg.type), (
'{}.{}({}:) argument type must be Input Type but got: {}.'.format(type, field_name, arg_name,
arg.type)
)
reduced_map = cls.reducer(reduced_map, arg.type)
reduced_map = cls.reducer(reduced_map, getattr(field, 'type', None))
return reduced_map | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py | 53 | 109 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,023 | assert_object_implements_interface | def assert_object_implements_interface(cls, schema, object, interface):
object_field_map = object.fields
interface_field_map = interface.fields
for field_name, interface_field in interface_field_map.items():
object_field = object_field_map.get(field_name)
assert object_field, '"{}" expects field "{}" but "{}" does not provide it.'.format(
interface, field_name, object
)
assert is_type_sub_type_of(schema, object_field.type, interface_field.type), (
'{}.{} expects type "{}" but {}.{} provides type "{}".'
).format(interface, field_name, interface_field.type, object, field_name, object_field.type)
for arg_name, interface_arg in interface_field.args.items():
object_arg = object_field.args.get(arg_name)
assert object_arg, (
'{}.{} expects argument "{}" but {}.{} does not provide it.'
).format(interface, field_name, arg_name, object, field_name)
assert is_equal_type(interface_arg.type, object_arg.type), (
'{}.{}({}:) expects type "{}" but {}.{}({}:) provides type "{}".'
).format(interface, field_name, arg_name, interface_arg.type, object, field_name, arg_name, object_arg.type)
for arg_name, object_arg in object_field.args.items():
interface_arg = interface_field.args.get(arg_name)
if not interface_arg:
assert not isinstance(object_arg.type, GraphQLNonNull), (
'{}.{}({}:) is of required type '
'"{}" but is not also provided by the '
'interface {}.{}.'
).format(object, field_name, arg_name, object_arg.type, interface, field_name) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py | 112 | 145 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,024 | is_type | def is_type(type):
return isinstance(type, (
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 11 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,025 | is_input_type | def is_input_type(type):
named_type = get_named_type(type)
return isinstance(named_type, (
GraphQLScalarType,
GraphQLEnumType,
GraphQLInputObjectType,
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 24 | 30 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,026 | is_output_type | def is_output_type(type):
named_type = get_named_type(type)
return isinstance(named_type, (
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 33 | 41 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,027 | is_leaf_type | def is_leaf_type(type):
return isinstance(type, (
GraphQLScalarType,
GraphQLEnumType,
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 44 | 48 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,028 | is_composite_type | def is_composite_type(type):
named_type = get_named_type(type)
return isinstance(named_type, (
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 51 | 57 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,029 | is_abstract_type | def is_abstract_type(type):
return isinstance(type, (
GraphQLInterfaceType,
GraphQLUnionType
)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 60 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,030 | get_nullable_type | def get_nullable_type(type):
if isinstance(type, GraphQLNonNull):
return type.of_type
return type | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 67 | 70 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,031 | get_named_type | def get_named_type(type):
unmodified_type = type
while isinstance(unmodified_type, (GraphQLList, GraphQLNonNull)):
unmodified_type = unmodified_type.of_type
return unmodified_type | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 73 | 78 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,032 | __str__ | def __str__(self):
return self.name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 84 | 85 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,033 | is_same_type | def is_same_type(self, other):
return self.__class__ is other.__class__ and self.name == other.name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 87 | 88 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,034 | none_func | def none_func(x):
None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 91 | 92 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,035 | __init__ | def __init__(self, name, description=None, serialize=None, parse_value=None, parse_literal=None):
assert name, 'Type must be named.'
assert_valid_name(name)
self.name = name
self.description = description
assert callable(serialize), (
'{} must provide "serialize" function. If this custom Scalar is '
'also used as an input type, ensure "parse_value" and "parse_literal" '
'functions are also provided.'
).format(self)
if parse_value is not None or parse_literal is not None:
assert callable(parse_value) and callable(parse_literal), (
'{} must provide both "parse_value" and "parse_literal" functions.'.format(self)
)
self.serialize = serialize
self.parse_value = parse_value or none_func
self.parse_literal = parse_literal or none_func | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 114 | 133 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,036 | __str__ | def __str__(self):
return self.name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 135 | 136 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,037 | __init__ | def __init__(self, name, fields, interfaces=None, is_type_of=None, description=None):
assert name, 'Type must be named.'
assert_valid_name(name)
self.name = name
self.description = description
if is_type_of is not None:
assert callable(is_type_of), '{} must provide "is_type_of" as a function.'.format(self)
self.is_type_of = is_type_of
self._fields = fields
self._provided_interfaces = interfaces
self._interfaces = None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 165 | 177 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,038 | fields | def fields(self):
return define_field_map(self, self._fields) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 180 | 181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,039 | interfaces | def interfaces(self):
return define_interfaces(self, self._provided_interfaces) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 184 | 185 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,040 | define_field_map | def define_field_map(type, field_map):
if callable(field_map):
field_map = field_map()
assert isinstance(field_map, Mapping) and len(field_map) > 0, (
'{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
'function which returns such a mapping.'
).format(type)
for field_name, field in field_map.items():
assert_valid_name(field_name)
field_args = getattr(field, 'args', None)
if field_args:
assert isinstance(field_args, Mapping), (
'{}.{} args must be a mapping (dict / OrderedDict) with argument names as keys.'.format(type,
field_name)
)
for arg_name, arg in field_args.items():
assert_valid_name(arg_name)
return OrderedDict(field_map) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 188 | 210 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,041 | define_interfaces | def define_interfaces(type, interfaces):
if callable(interfaces):
interfaces = interfaces()
if interfaces is None:
interfaces = []
assert isinstance(interfaces, (list, tuple)), (
'{} interfaces must be a list/tuple or a function which returns a list/tuple.'.format(type)
)
for interface in interfaces:
assert isinstance(interface, GraphQLInterfaceType), (
'{} may only implement Interface types, it cannot implement: {}.'.format(type, interface)
)
if not callable(interface.resolve_type):
assert callable(type.is_type_of), (
'Interface Type {} does not provide a "resolve_type" function '
'and implementing Type {} does not provide a "is_type_of" '
'function. There is no way to resolve this implementing type '
'during execution.'
).format(interface, type)
return interfaces | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 213 | 237 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,042 | __init__ | def __init__(self, type, args=None, resolver=None, deprecation_reason=None, description=None):
self.type = type
self.args = args or OrderedDict()
self.resolver = resolver
self.deprecation_reason = deprecation_reason
self.description = description | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 243 | 248 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,043 | __eq__ | def __eq__(self, other):
return (
self is other or (
isinstance(other, GraphQLField) and
self.type == other.type and
self.args == other.args and
self.resolver == other.resolver and
self.deprecation_reason == other.deprecation_reason and
self.description == other.description
)
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 250 | 260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,044 | __hash__ | def __hash__(self):
return id(self) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 262 | 263 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,045 | __init__ | def __init__(self, type, default_value=None, description=None, out_name=None):
self.type = type
self.default_value = default_value
self.description = description
self.out_name = out_name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 269 | 273 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,046 | __eq__ | def __eq__(self, other):
return (
self is other or (
isinstance(other, GraphQLArgument) and
self.type == other.type and
self.default_value == other.default_value and
self.description == other.description and
self.out_name == other.out_name
)
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 275 | 284 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,047 | __hash__ | def __hash__(self):
return id(self) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 286 | 287 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,048 | __init__ | def __init__(self, name, fields=None, resolve_type=None, description=None):
assert name, 'Type must be named.'
assert_valid_name(name)
self.name = name
self.description = description
if resolve_type is not None:
assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
self.resolve_type = resolve_type
self._fields = fields | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 305 | 315 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,049 | fields | def fields(self):
return define_field_map(self, self._fields) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 318 | 319 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,050 | __init__ | def __init__(self, name, types=None, resolve_type=None, description=None):
assert name, 'Type must be named.'
assert_valid_name(name)
self.name = name
self.description = description
if resolve_type is not None:
assert callable(resolve_type), '{} must provide "resolve_type" as a function.'.format(self)
self.resolve_type = resolve_type
self._types = types | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 341 | 351 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,051 | types | def types(self):
return define_types(self, self._types) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 354 | 355 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,052 | define_types | def define_types(union_type, types):
if callable(types):
types = types()
assert isinstance(types, (list, tuple)) and len(
types) > 0, 'Must provide types for Union {}.'.format(union_type.name)
has_resolve_type_fn = callable(union_type.resolve_type)
for type in types:
assert isinstance(type, GraphQLObjectType), (
'{} may only contain Object types, it cannot contain: {}.'.format(union_type, type)
)
if not has_resolve_type_fn:
assert callable(type.is_type_of), (
'Union Type {} does not provide a "resolve_type" function '
'and possible Type {} does not provide a "is_type_of" '
'function. There is no way to resolve this possible type '
'during execution.'
).format(union_type, type)
return types | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 358 | 379 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,053 | __init__ | def __init__(self, name, values, description=None):
assert name, 'Type must provide name.'
assert_valid_name(name)
self.name = name
self.description = description
self.values = define_enum_values(self, values) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 402 | 408 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,054 | serialize | def serialize(self, value):
if isinstance(value, Hashable):
enum_value = self._value_lookup.get(value)
if enum_value:
return enum_value.name
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 410 | 417 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,055 | parse_value | def parse_value(self, value):
if isinstance(value, Hashable):
enum_value = self._name_lookup.get(value)
if enum_value:
return enum_value.value
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 419 | 426 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,056 | parse_literal | def parse_literal(self, value_ast):
if isinstance(value_ast, ast.EnumValue):
enum_value = self._name_lookup.get(value_ast.value)
if enum_value:
return enum_value.value | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 428 | 433 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,057 | _value_lookup | def _value_lookup(self):
return {value.value: value for value in self.values} | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 436 | 437 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,058 | _name_lookup | def _name_lookup(self):
return {value.name: value for value in self.values} | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 440 | 441 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,059 | define_enum_values | def define_enum_values(type, value_map):
assert isinstance(value_map, Mapping) and len(value_map) > 0, (
'{} values must be a mapping (dict / OrderedDict) with value names as keys.'.format(type)
)
values = []
if not isinstance(value_map, (collections.OrderedDict, OrderedDict)):
value_map = OrderedDict(sorted(list(value_map.items())))
for value_name, value in value_map.items():
assert_valid_name(value_name)
assert isinstance(value, GraphQLEnumValue), (
'{}.{} must be an instance of GraphQLEnumValue, but got: {}'.format(type, value_name, value)
)
value = copy.copy(value)
value.name = value_name
if value.value is None:
value.value = value_name
values.append(value)
return values | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 444 | 465 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,060 | __init__ | def __init__(self, value=None, deprecation_reason=None, description=None, name=None):
self.name = name
self.value = value
self.deprecation_reason = deprecation_reason
self.description = description | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 471 | 475 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,061 | __eq__ | def __eq__(self, other):
return (
self is other or (
isinstance(other, GraphQLEnumValue) and
self.name == other.name and
self.value == other.value and
self.deprecation_reason == other.deprecation_reason and
self.description == other.description
)
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 477 | 486 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,062 | __init__ | def __init__(self, name, fields, description=None):
assert name, 'Type must be named.'
self.name = name
self.description = description
self._fields = fields | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 510 | 515 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,063 | fields | def fields(self):
return self._define_field_map() | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 518 | 519 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,064 | _define_field_map | def _define_field_map(self):
fields = self._fields
if callable(fields):
fields = fields()
assert isinstance(fields, Mapping) and len(fields) > 0, (
'{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
'function which returns such a mapping.'
).format(self)
if not isinstance(fields, (collections.OrderedDict, OrderedDict)):
fields = OrderedDict(sorted(list(fields.items())))
for field_name, field in fields.items():
assert_valid_name(field_name)
return fields | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 521 | 536 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,065 | __init__ | def __init__(self, type, default_value=None, description=None, out_name=None):
self.type = type
self.default_value = default_value
self.description = description
self.out_name = out_name | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 542 | 546 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,066 | __eq__ | def __eq__(self, other):
return (
self is other or (
isinstance(other, GraphQLInputObjectField) and
self.type == other.type and
self.description == other.description and
self.out_name == other.out_name
)
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 548 | 556 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,067 | __init__ | def __init__(self, type):
assert is_type(type), 'Can only create List of a GraphQLType but got: {}.'.format(type)
self.of_type = type | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 579 | 581 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,068 | __str__ | def __str__(self):
return '[' + str(self.of_type) + ']' | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 583 | 584 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,069 | is_same_type | def is_same_type(self, other):
return isinstance(other, GraphQLList) and self.of_type.is_same_type(other.of_type) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 586 | 587 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,070 | __init__ | def __init__(self, type):
assert is_type(type) and not isinstance(type, GraphQLNonNull), (
'Can only create NonNull of a Nullable GraphQLType but got: {}.'.format(type)
)
self.of_type = type | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 609 | 613 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,071 | __str__ | def __str__(self):
return str(self.of_type) + '!' | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 615 | 616 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,072 | is_same_type | def is_same_type(self, other):
return isinstance(other, GraphQLNonNull) and self.of_type.is_same_type(other.of_type) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py | 618 | 619 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,073 | coerce_int | def coerce_int(value):
if isinstance(value, int):
num = value
else:
try:
num = int(value)
except ValueError:
num = int(float(value))
if MIN_INT <= num <= MAX_INT:
return num
raise Exception((
"Int cannot represent non 32-bit signed integer value: {}"
).format(value)) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 13 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,074 | parse_int_literal | def parse_int_literal(ast):
if isinstance(ast, IntValue):
num = int(ast.value)
if MIN_INT <= num <= MAX_INT:
return num | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 28 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,075 | coerce_float | def coerce_float(value):
if isinstance(value, float):
return value
return float(value) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 46 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,076 | parse_float_literal | def parse_float_literal(ast):
if isinstance(ast, (FloatValue, IntValue)):
return float(ast.value)
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 52 | 55 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,077 | coerce_string | def coerce_string(value):
if isinstance(value, str):
return value
if isinstance(value, bool):
return u'true' if value else u'false'
return str(value) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 68 | 75 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,078 | coerce_str | def coerce_str(value):
if isinstance(value, str):
return value
return str(value) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 78 | 82 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,079 | parse_string_literal | def parse_string_literal(ast):
if isinstance(ast, StringValue):
return ast.value
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 85 | 89 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,080 | parse_boolean_literal | def parse_boolean_literal(ast):
if isinstance(ast, BooleanValue):
return ast.value
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 102 | 105 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,081 | parse_id_literal | def parse_id_literal(ast):
if isinstance(ast, (StringValue, IntValue)):
return ast.value
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py | 116 | 119 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,082 | __init__ | def __init__(self, query, mutation=None, subscription=None, directives=None, types=None):
assert isinstance(query, GraphQLObjectType), 'Schema query must be Object Type but got: {}.'.format(query)
if mutation:
assert isinstance(mutation, GraphQLObjectType), \
'Schema mutation must be Object Type but got: {}.'.format(mutation)
if subscription:
assert isinstance(subscription, GraphQLObjectType), \
'Schema subscription must be Object Type but got: {}.'.format(subscription)
if types:
assert isinstance(types, Iterable), \
'Schema types must be iterable if provided but got: {}.'.format(types)
self._query = query
self._mutation = mutation
self._subscription = subscription
if directives is None:
directives = specified_directives
assert all(isinstance(d, GraphQLDirective) for d in directives), \
'Schema directives must be List[GraphQLDirective] if provided but got: {}.'.format(
directives
)
self._directives = directives
initial_types = [
query,
mutation,
subscription,
IntrospectionSchema
]
if types:
initial_types += types
self._type_map = GraphQLTypeMap(initial_types) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 35 | 69 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,083 | get_query_type | def get_query_type(self):
return self._query | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 71 | 72 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,084 | get_mutation_type | def get_mutation_type(self):
return self._mutation | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 74 | 75 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,085 | get_subscription_type | def get_subscription_type(self):
return self._subscription | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 77 | 78 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,086 | get_type_map | def get_type_map(self):
return self._type_map | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 80 | 81 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,087 | get_type | def get_type(self, name):
return self._type_map.get(name) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 83 | 84 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,088 | get_directives | def get_directives(self):
return self._directives | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 86 | 87 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,089 | get_directive | def get_directive(self, name):
for directive in self.get_directives():
if directive.name == name:
return directive
return None | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 89 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,090 | get_possible_types | def get_possible_types(self, abstract_type):
return self._type_map.get_possible_types(abstract_type) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 96 | 97 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,091 | is_possible_type | def is_possible_type(self, abstract_type, possible_type):
return self._type_map.is_possible_type(abstract_type, possible_type) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py | 99 | 100 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,092 | get_variable_values | def get_variable_values(schema, definition_asts, inputs):
"""Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input.
If the input cannot be parsed to match the variable definitions, a GraphQLError will be thrown."""
if inputs is None:
inputs = {}
values = {}
for def_ast in definition_asts:
var_name = def_ast.variable.name.value
value = get_variable_value(schema, def_ast, inputs.get(var_name))
values[var_name] = value
return values | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py | 15 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,093 | get_argument_values | def get_argument_values(arg_defs, arg_asts, variables=None):
"""Prepares an object map of argument values given a list of argument
definitions and list of argument AST nodes."""
if not arg_defs:
return {}
if arg_asts:
arg_ast_map = {arg.name.value: arg for arg in arg_asts}
else:
arg_ast_map = {}
result = {}
for name, arg_def in arg_defs.items():
value_ast = arg_ast_map.get(name)
if value_ast:
value_ast = value_ast.value
value = value_from_ast(
value_ast,
arg_def.type,
variables
)
if value is None:
value = arg_def.default_value
if value is not None:
# We use out_name as the output name for the
# dict if exists
result[arg_def.out_name or name] = value
return result | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py | 30 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,094 | get_variable_value | def get_variable_value(schema, definition_ast, input):
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition,
or throw an error."""
type = type_from_ast(schema, definition_ast.type)
variable = definition_ast.variable
if not type or not is_input_type(type):
raise GraphQLError(
'Variable "${}" expected value of type "{}" which cannot be used as an input type.'.format(
variable.name.value,
print_ast(definition_ast.type),
),
[definition_ast]
)
input_type = type
errors = is_valid_value(input, input_type)
if not errors:
if input is None:
default_value = definition_ast.default_value
if default_value:
return value_from_ast(default_value, input_type)
return coerce_value(input_type, input)
if input is None:
raise GraphQLError(
'Variable "${}" of required type "{}" was not provided.'.format(
variable.name.value,
print_ast(definition_ast.type)
),
[definition_ast]
)
message = (u'\n' + u'\n'.join(errors)) if errors else u''
raise GraphQLError(
'Variable "${}" got invalid value {}.{}'.format(
variable.name.value,
json.dumps(input, sort_keys=True),
message
),
[definition_ast]
) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py | 64 | 106 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,095 | coerce_value | def coerce_value(type, value):
"""Given a type and any value, return a runtime value coerced to match the type."""
if isinstance(type, GraphQLNonNull):
# Note: we're not checking that the result of coerceValue is
# non-null.
# We only call this function after calling isValidValue.
return coerce_value(type.of_type, value)
if value is None:
return None
if isinstance(type, GraphQLList):
item_type = type.of_type
if not isinstance(value, str) and isinstance(value, Iterable):
return [coerce_value(item_type, item) for item in value]
else:
return [coerce_value(item_type, value)]
if isinstance(type, GraphQLInputObjectType):
fields = type.fields
obj = {}
for field_name, field in fields.items():
field_value = coerce_value(field.type, value.get(field_name))
if field_value is None:
field_value = field.default_value
if field_value is not None:
# We use out_name as the output name for the
# dict if exists
obj[field.out_name or field_name] = field_value
return obj
assert isinstance(type, (GraphQLScalarType, GraphQLEnumType)), \
'Must be input type'
return type.parse_value(value) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py | 109 | 145 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,096 | __init__ | def __init__(self, schema, document_ast, root_value, context_value, variable_values, operation_name, executor, middleware):
"""Constructs a ExecutionContext object from the arguments passed
to execute, which we will pass throughout the other execution
methods."""
errors = []
operation = None
fragments = {}
for definition in document_ast.definitions:
if isinstance(definition, ast.OperationDefinition):
if not operation_name and operation:
raise GraphQLError('Must provide operation name if query contains multiple operations.')
if not operation_name or definition.name and definition.name.value == operation_name:
operation = definition
elif isinstance(definition, ast.FragmentDefinition):
fragments[definition.name.value] = definition
else:
raise GraphQLError(
u'GraphQL cannot execute a request containing a {}.'.format(definition.__class__.__name__),
definition
)
if not operation:
if operation_name:
raise GraphQLError(u'Unknown operation named "{}".'.format(operation_name))
else:
raise GraphQLError('Must provide an operation.')
variable_values = get_variable_values(schema, operation.variable_definitions or [], variable_values)
self.schema = schema
self.fragments = fragments
self.root_value = root_value
self.operation = operation
self.variable_values = variable_values
self.errors = errors
self.context_value = context_value
self.argument_values_cache = {}
self.executor = executor
self.middleware = middleware
self._subfields_cache = {} | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py | 24 | 68 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,097 | get_field_resolver | def get_field_resolver(self, field_resolver):
if not self.middleware:
return field_resolver
return self.middleware.get_field_resolver(field_resolver) | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py | 70 | 73 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,098 | get_argument_values | def get_argument_values(self, field_def, field_ast):
k = field_def, field_ast
result = self.argument_values_cache.get(k)
if not result:
result = self.argument_values_cache[k] = get_argument_values(field_def.args, field_ast.arguments,
self.variable_values)
return result | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py | 75 | 83 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,099 | get_sub_fields | def get_sub_fields(self, return_type, field_asts):
k = return_type, tuple(field_asts)
if k not in self._subfields_cache:
subfield_asts = DefaultOrderedDict(list)
visited_fragment_names = set()
for field_ast in field_asts:
selection_set = field_ast.selection_set
if selection_set:
subfield_asts = collect_fields(
self, return_type, selection_set,
subfield_asts, visited_fragment_names
)
self._subfields_cache[k] = subfield_asts
return self._subfields_cache[k] | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py | 85 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
6,100 | __init__ | def __init__(self, data=None, errors=None, invalid=False):
self.data = data
self.errors = errors
if invalid:
assert data is None
self.invalid = invalid | python | wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py | 108 | 115 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.