File: type_converter.py

package info (click to toggle)
python-qtpynodeeditor 0.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 604 kB
  • sloc: python: 5,038; makefile: 14; sh: 1
file content (22 lines) | stat: -rw-r--r-- 522 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
class TypeConverterId:
    def __init__(self, type_in, type_out):
        self.type_in = type_in
        self.type_out = type_out


class TypeConverter(TypeConverterId):
    def __init__(self, type_in, type_out, func):
        self.type_in = type_in
        self.type_out = type_out
        self.id = TypeConverterId(type_in, type_out)
        self.func = func

    def __call__(self, input):
        return self.func(input)


def _convert(arg):
    return arg


DefaultTypeConverter = TypeConverter(None, None, _convert)