Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_field_by_name(self, name: str) -> "GraphQLField":
"""
Returns the field corresponding to the filled in name.
:param name: name of the field with the following format "Parent.field"
:type name: str
:return: the field corresponding to the filled in name
:rtype: GraphQLField
"""
try:
parent_name, field_name = name.split(".")
except ValueError:
raise ImproperlyConfigured(
"field name must be of the format `TypeName.fieldName` got "
f"`{name}`."
)
try:
return self.type_definitions[parent_name].find_field(field_name)
except (AttributeError, KeyError):
raise UnknownSchemaFieldResolver(
f"field `{name}` was not found in GraphQL schema."
)
Resolver,
TypeResolver,
Scalar,
Subscription,
]
]
"""
if not obj:
return
SchemaRegistry._schemas.setdefault(schema_name, {}).setdefault(
where, {}
)
if obj.name in SchemaRegistry._schemas[schema_name][where]:
raise ImproperlyConfigured(
"Can't register < %s > to < %s > %s because it's already "
"registered" % (obj.name, schema_name, where)
)
SchemaRegistry._schemas[schema_name][where][obj.name] = obj
pass
class GraphQLSchemaError(TartifletteError):
pass
class GraphQLSyntaxError(TartifletteError):
pass
class NonCallable(ImproperlyConfigured):
pass
class NonCoroutine(ImproperlyConfigured):
pass
class NonAwaitableResolver(ImproperlyConfigured):
pass
class NonAsyncGeneratorSubscription(ImproperlyConfigured):
pass
class NotSubscriptionField(ImproperlyConfigured):
pass
class UnknownSchemaFieldResolver(TartifletteError):
pass
class NonCallable(ImproperlyConfigured):
pass
class NonCoroutine(ImproperlyConfigured):
pass
class NonAwaitableResolver(ImproperlyConfigured):
pass
class NonAsyncGeneratorSubscription(ImproperlyConfigured):
pass
class NotSubscriptionField(ImproperlyConfigured):
pass
class UnknownSchemaFieldResolver(TartifletteError):
pass
class UnknownDirectiveDefinition(TartifletteError):
pass
class UnknownScalarDefinition(TartifletteError):
:param sdl: SDL with complementary content from already baked modules
:param schema_name: schema name to link with
:type imported_modules: List[object]
:type sdl: str
:type schema_name: str
:return: couple list of imported modules instance/final SDL
:rtype: Tuple[List[object], str]
"""
for module in _BUILTINS_MODULES:
try:
module = import_module(module)
sdl = "{sdl}\n{msdl}".format(
sdl=sdl, msdl=await _bake_module(module, schema_name)
)
imported_modules.append(module)
except ImproperlyConfigured:
pass
return imported_modules, sdl
pass
class GraphQLSyntaxError(TartifletteError):
pass
class NonCallable(ImproperlyConfigured):
pass
class NonCoroutine(ImproperlyConfigured):
pass
class NonAwaitableResolver(ImproperlyConfigured):
pass
class NonAsyncGeneratorSubscription(ImproperlyConfigured):
pass
class NotSubscriptionField(ImproperlyConfigured):
pass
class UnknownSchemaFieldResolver(TartifletteError):
pass
class UnknownDirectiveDefinition(TartifletteError):
pass
class UnknownScalarDefinition(TartifletteError):
pass
class UnknownFieldDefinition(TartifletteError):
pass
class UnknownTypeDefinition(TartifletteError):
pass
class MissingImplementation(ImproperlyConfigured):
pass
class RedefinedImplementation(TartifletteError):
pass
class CoercionError(TartifletteError):
pass