How to use the sgqlc.types.__init__.Arg 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
if not lst and not mapping:
            return

        if len(lst) == 1:
            if lst[0] is None:
                lst = []
            elif isinstance(lst[0], (tuple, list)):
                lst = lst[0]
            elif isinstance(lst[0], dict):
                mapping.update(lst[0])
                lst = []

        for k, v in lst:
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v

        for k, v in mapping.items():
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
:param typ: the :class:`Scalar` or :class:`Type` derived
          class. If this would cause a cross reference and the other
          type is not declared yet, then use the string name to query
          in the schema.
        :type typ: :class:`Scalar`, :class:`Type` or str

        :param graphql_name: the name to use in JSON object, usually ``aName``.
          If ``None`` or empty, will be created from python, converting
          ``a_name`` to ``aName`` using
          :func:`BaseItem._to_graphql_name()`
        :type graphql_name: str

        :param default: The default value for field. May be a value or
          :class:`Variable`.
        '''
        super(Arg, self).__init__(typ, graphql_name)
        self.default = default
        if default is not None and not isinstance(default, Variable):
            typ(default)
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
if lst[0] is None:
                lst = []
            elif isinstance(lst[0], (tuple, list)):
                lst = lst[0]
            elif isinstance(lst[0], dict):
                mapping.update(lst[0])
                lst = []

        for k, v in lst:
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v

        for k, v in mapping.items():
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v
github profusion / sgqlc / sgqlc / types / __init__.py View on Github external
super(ArgDict, self).__init__()

        if not lst and not mapping:
            return

        if len(lst) == 1:
            if lst[0] is None:
                lst = []
            elif isinstance(lst[0], (tuple, list)):
                lst = lst[0]
            elif isinstance(lst[0], dict):
                mapping.update(lst[0])
                lst = []

        for k, v in lst:
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v

        for k, v in mapping.items():
            if not isinstance(v, Arg):
                v = Arg(v)
            self[k] = v