Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python | |
| """ | |
| Copyright 2017, Zixin Luo, HKUST. | |
| Commonly used functions | |
| """ | |
| from __future__ import print_function | |
| import os | |
| from datetime import datetime | |
| class ClassProperty(property): | |
| """For dynamically obtaining system time""" | |
| def __get__(self, cls, owner): | |
| return classmethod(self.fget).__get__(None, owner)() | |
| class Notify(object): | |
| """Colorful printing prefix. | |
| A quick example: | |
| print(Notify.INFO, YOUR TEXT, Notify.ENDC) | |
| """ | |
| def __init__(self): | |
| pass | |
| def HEADER(cls): | |
| return str(datetime.now()) + ": \033[95m" | |
| def INFO(cls): | |
| return str(datetime.now()) + ": \033[92mI" | |
| def OKBLUE(cls): | |
| return str(datetime.now()) + ": \033[94m" | |
| def WARNING(cls): | |
| return str(datetime.now()) + ": \033[93mW" | |
| def FAIL(cls): | |
| return str(datetime.now()) + ": \033[91mF" | |
| def BOLD(cls): | |
| return str(datetime.now()) + ": \033[1mB" | |
| def UNDERLINE(cls): | |
| return str(datetime.now()) + ": \033[4mU" | |
| ENDC = "\033[0m" | |