omar2535/GraphQLer

View on GitHub
graphqler/utils/singleton.py

Summary

Maintainability
A
0 mins
Test Coverage
def singleton(myClass):
    instances = {}

    def getInstance(*args, **kwargs):
        if myClass not in instances:
            instances[myClass] = myClass(*args, **kwargs)
        return instances[myClass]

    return getInstance