import dataclasses
import hashlib
import inspect
import sys
from enum import Enum
from pathlib import Path, PosixPath


@dataclasses.dataclass
class ASD:
    aaa: int = 1
    bbb: int = 1
    ccc: int = 1

    @property
    def b(self):
        return self.aaa


class EE(Enum):
    asd = ASD
    x = 1


def skip1(f):
    def wrapper(self, *args, **kwargs):
        if 'cond' not in kwargs:
            return f(self, *args, **kwargs)
        if kwargs['cond']:
            del kwargs['cond']
            return f(self, *args, **kwargs)
        else:
            return self

    return wrapper


def skip(original_class):
    def f2(self, x):
        print(x)

    for name, f in inspect.getmembers(original_class, inspect.isfunction):
        print(name, f)
        setattr(original_class, name, skip1(f))
    return original_class


class Decorator(object):
    def __init__(self, arg):
        self.arg = arg

    def __call__(self, cls):
        pass
        # def wrappedClass(*args):
        #     return cls(*args)
        #
        # return type("TestClass", (cls,), dict(newMethod=self.newMethod, classattr=self.arg))

    def newMethod(self, value):
        return value * 2


@skip
class DC:
    def __init__(self):
        pass
    def f1(self, arg):
        print('f1', arg)

    def f2(self, arg):
        print('f2', arg)


if __name__ == '__main__':
    # print(sys.argv)
    # print(dir(ASD()))
    # print(ASD.__dict__)
    # print(inspect.getmembers(ASD))
    # print(inspect.getmembers(ASD))
    # for f in dataclasses.fields(ASD):
    #     print(f.name, f.type)
    # p = Path('asd')
    # pt = type(p)
    # print(pt)
    # print(pt.__name__)
    # print(type(type(p)))
    # match pt:
    #     case _x if isinstance(_x, PosixPath):
    #         print(-2)
    #     case type(__name__='PosixPath'):
    #         print(-1)
    #     case type():
    #         print(0)
    #     case Path():
    #         print(1)
    #     case PosixPath():
    #         print(3)
    #     case _:
    #         print(2)
    dc = DC()
    dc.f1(11,cond=False)
    dc.f2(22)
