initial commit
This commit is contained in:
22
util.py
Normal file
22
util.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
|
||||
|
||||
def log(data):
|
||||
with open(curr_directory() + '/logs.log', 'a') as fl:
|
||||
fl.write(str(data) + '\n')
|
||||
|
||||
|
||||
def curr_directory():
|
||||
return os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
class Singleton(object):
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not hasattr(cls, '_instance'):
|
||||
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs)
|
||||
return cls._instance
|
||||
|
||||
@classmethod
|
||||
def get_instance(cls):
|
||||
return cls._instance
|
||||
Reference in New Issue
Block a user