How to use the sgqlc.types.__init__.Scalar function in sgqlc

To help you get started, we’ve selected a few sgqlc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
# previous versions allowed Python name as dict keys
                    v = value[f.name]
                except KeyError:  # pragma: no cover
                    continue

            vs = f.type.__to_graphql_input__(v, indent, indent_string)
            args.append('%s: %s' % (f.graphql_name, vs))

        return '{' + ', '.join(args) + '}'


########################################################################
# Built-in types
########################################################################

class Int(Scalar):
    '''Maps GraphQL ``Int`` to Python ``int``.

    >>> Int # or repr()
    scalar Int
    >>> str(Int)
    'Int'
    >>> bytes(Int)
    b'scalar Int'

    '''
    converter = int


class Float(Scalar):
    'Maps GraphQL ``Float`` to Python ``float``.'
    converter = float
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
scalar Int
    >>> str(Int)
    'Int'
    >>> bytes(Int)
    b'scalar Int'

    '''
    converter = int


class Float(Scalar):
    'Maps GraphQL ``Float`` to Python ``float``.'
    converter = float


class String(Scalar):
    'Maps GraphQL ``String`` to Python ``str``.'
    converter = str


class Boolean(Scalar):
    'Maps GraphQL ``Boolean`` to Python ``bool``.'
    converter = bool


class ID(Scalar):
    'Maps GraphQL ``ID`` to Python ``str``.'
    converter = str


class UnknownType(Type):
    'Type found in the response that was not present in schema'
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
class Float(Scalar):
    'Maps GraphQL ``Float`` to Python ``float``.'
    converter = float


class String(Scalar):
    'Maps GraphQL ``String`` to Python ``str``.'
    converter = str


class Boolean(Scalar):
    'Maps GraphQL ``Boolean`` to Python ``bool``.'
    converter = bool


class ID(Scalar):
    'Maps GraphQL ``ID`` to Python ``str``.'
    converter = str


class UnknownType(Type):
    'Type found in the response that was not present in schema'
    __auto_register = False  # do not expose this in Schema, just subclasses


map_python_to_graphql = {
    int: Int,
    float: Float,
    str: String,
    bool: Boolean,
    id: ID,
}
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
'''
    converter = int


class Float(Scalar):
    'Maps GraphQL ``Float`` to Python ``float``.'
    converter = float


class String(Scalar):
    'Maps GraphQL ``String`` to Python ``str``.'
    converter = str


class Boolean(Scalar):
    'Maps GraphQL ``Boolean`` to Python ``bool``.'
    converter = bool


class ID(Scalar):
    'Maps GraphQL ``ID`` to Python ``str``.'
    converter = str


class UnknownType(Type):
    'Type found in the response that was not present in schema'
    __auto_register = False  # do not expose this in Schema, just subclasses


map_python_to_graphql = {
    int: Int,
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
class Int(Scalar):
    '''Maps GraphQL ``Int`` to Python ``int``.

    >>> Int # or repr()
    scalar Int
    >>> str(Int)
    'Int'
    >>> bytes(Int)
    b'scalar Int'

    '''
    converter = int


class Float(Scalar):
    'Maps GraphQL ``Float`` to Python ``float``.'
    converter = float


class String(Scalar):
    'Maps GraphQL ``String`` to Python ``str``.'
    converter = str


class Boolean(Scalar):
    'Maps GraphQL ``Boolean`` to Python ``bool``.'
    converter = bool


class ID(Scalar):
    'Maps GraphQL ``ID`` to Python ``str``.'