# Path: graphscale/check.py
# def isinst(obj: Any, ttype: Type, _msg: str=None) -> None:
# def invariant(condition: Any, msg: str) -> None:
# def failed(msg: str) -> NoReturn:
# 
# Path: graphscale/utils.py
# def is_camel_case(string: str) -> bool:
#     """Is the string potentially camel case? Only checks for capital letters currently"""
#     return bool(re.search('[A-Z]', string))
# 
# def to_snake_case(camel_case: str) -> str:
#     """Convert a camel case string to snake case. e.g. fooBar ==> foo_bar"""
#     with_underscores = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_case)
#     return re.sub('([a-z0-9])([A-Z])', r'\1_\2', with_underscores).lower()


from datetime import datetime
from enum import Enum, auto
from typing import NamedTuple, List, Any, Union
from uuid import UUID
from graphql.language.ast import (
    EnumTypeDefinition, InputObjectTypeDefinition, ListType, NamedType, NonNullType,
    ObjectTypeDefinition, IntValue, StringValue, BooleanValue, Node, TypeDefinition, Value,
    InputValueDefinition, Directive, FieldDefinition, Type
)
from graphql.language.parser import parse
from graphql.language.source import Source
from graphscale import check
from graphscale.utils import is_camel_case, to_snake_case
    values = [value_ast.name.value for value_ast in enum_type_ast.values]
    return create_enum_type_def(
        name=grapple_type_name,
        values=values,
    )


def create_grapple_input_type(input_type_ast: InputObjectTypeDefinition) -> GrappleTypeDef:
    check.isinst(input_type_ast, InputObjectTypeDefinition)
    grapple_type_name = input_type_ast.name.value
    grapple_fields = [create_grapple_input_field(field) for field in input_type_ast.fields]
    input_directive = get_directive(input_type_ast, 'pentMutationData')
    return create_input_type_def(
        name=grapple_type_name,
        fields=grapple_fields,
        is_pent_mutation_data=input_directive is not None
    )


def req_int_argument(directive_ast: Directive, name: str) -> int:
    check.isinst(directive_ast, Directive)
    for argument in directive_ast.arguments:
        if argument.name.value == name:
            check.isinst(argument.value, IntValue)
            return int(argument.value.value)

    raise Exception('argument required')


def req_string_argument(directive_ast: Directive, name: str) -> str:

# Path: graphscale/check.py
# def isinst(obj: Any, ttype: Type, _msg: str=None) -> None:
# def invariant(condition: Any, msg: str) -> None:
# def failed(msg: str) -> NoReturn:
# 
# Path: graphscale/utils.py
# def is_camel_case(string: str) -> bool:
#     """Is the string potentially camel case? Only checks for capital letters currently"""
#     return bool(re.search('[A-Z]', string))
# 
# def to_snake_case(camel_case: str) -> str:
#     """Convert a camel case string to snake case. e.g. fooBar ==> foo_bar"""
#     with_underscores = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_case)
#     return re.sub('([a-z0-9])([A-Z])', r'\1_\2', with_underscores).lower()


# Path: graphscale/grapple/parser.py
from datetime import datetime
from enum import Enum, auto
from typing import NamedTuple, List, Any, Union
from uuid import UUID
from graphql.language.ast import (
    EnumTypeDefinition, InputObjectTypeDefinition, ListType, NamedType, NonNullType,
    ObjectTypeDefinition, IntValue, StringValue, BooleanValue, Node, TypeDefinition, Value,
    InputValueDefinition, Directive, FieldDefinition, Type
)
from graphql.language.parser import parse
from graphql.language.source import Source
from graphscale import check
from graphscale.utils import is_camel_case, to_snake_case

    values = [value_ast.name.value for value_ast in enum_type_ast.values]
    return create_enum_type_def(
        name=grapple_type_name,
        values=values,
    )


def create_grapple_input_type(input_type_ast: InputObjectTypeDefinition) -> GrappleTypeDef:
    check.isinst(input_type_ast, InputObjectTypeDefinition)
    grapple_type_name = input_type_ast.name.value
    grapple_fields = [create_grapple_input_field(field) for field in input_type_ast.fields]
    input_directive = get_directive(input_type_ast, 'pentMutationData')
    return create_input_type_def(
        name=grapple_type_name,
        fields=grapple_fields,
        is_pent_mutation_data=input_directive is not None
    )


def req_int_argument(directive_ast: Directive, name: str) -> int:
    check.isinst(directive_ast, Directive)
    for argument in directive_ast.arguments:
        if argument.name.value == name:
            check.isinst(argument.value, IntValue)
            return int(argument.value.value)

    raise Exception('argument required')


def req_string_argument(directive_ast: Directive, name: str) -> str:

    check.isinst(directive_ast, Directive)