File: mountedtype.py

package info (click to toggle)
python-graphene 3.4.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,124 kB
  • sloc: python: 8,935; makefile: 212; sh: 18
file content (20 lines) | stat: -rw-r--r-- 555 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from ..utils.orderedtype import OrderedType
from .unmountedtype import UnmountedType


class MountedType(OrderedType):
    @classmethod
    def mounted(cls, unmounted):  # noqa: N802
        """
        Mount the UnmountedType instance
        """
        assert isinstance(
            unmounted, UnmountedType
        ), f"{cls.__name__} can't mount {repr(unmounted)}"

        return cls(
            unmounted.get_type(),
            *unmounted.args,
            _creation_counter=unmounted.creation_counter,
            **unmounted.kwargs,
        )