import datetime


def myFirstDecorator(fn):
    def wrapper(*args):
       start = datetime.datetime.now()
       #что-то делаем
       res = fn(*args) #вызываем функцию которую передали
       end = datetime.datetime.now()
       print(f"время выполнения функции: { end - start }")
       # что-то делаем
       return res - 1
    return wrapper


# @myFirstDecorator
# def pow_(x, y):
#     return x ** y
#
# @myFirstDecorator
# def summ(x, y):
#     return x + y


class A:
    @staticmethod
    def summ(self, x, y):
        print(self)
        self.summ(self, y, )
        return x + y

    def summ_(self, x, y):
        return x + y


# obj = A()
# print(obj.summ(obj,2,3))


# print(pow_(3,3))
# print(summ(3,4))
# fn = myFirstDecorator(pow)
# result = fn(2,2)
# print(result)


class Db:
    instance = None
    def __init__(self, age):
        self.age = age
        if Db.instance == None:
            return
        else:
            raise Exception()
    @staticmethod
    def getInstance(age):
        if Db.instance == None:
            Db.instance = Db(age)

        return Db.instance
# try:
obj = Db.getInstance(10)
obj2 = Db.getInstance(16)

# print(obj.age)
# print(obj2.age)
# except Exception as e:
# print(e)
from abc import ABC, abstractmethod

class Absclass(ABC):
    def print(self,x):
        print("Passed value: ", x)
    @abstractmethod
    def task(self):
        print("We are inside Absclass task")

    @abstractmethod
    def task_(self):
        print("We are inside Absclass task")

class test_class(Absclass):
    pass
    def task(self):
        print("We are inside test_class task")
    def task_(self):
        print("We are inside Absclass task")

test_obj = test_class()
test_obj.task()
test_obj.print("10")