File: conftest.py

package info (click to toggle)
python-apischema 0.18.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,608 kB
  • sloc: python: 15,266; sh: 7; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 588 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys

from apischema.graphql import relay
from apischema.graphql.relay import global_identification

relay.Node._node_key = classmethod(  # type: ignore
    lambda cls: f"{cls.__module__}.{cls.__name__}"
)


nodes_wrapped = relay.nodes


def nodes():
    exclude = set()
    for node_cls in global_identification._tmp_nodes:
        # The module currently imported should not have schema defined
        if hasattr(sys.modules[node_cls.__module__], "schema"):
            exclude.add(node_cls)
    return [cls for cls in nodes_wrapped() if cls not in exclude]


relay.nodes = nodes