-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
699 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
# Files | ||
*.pyc | ||
bootstrap.min.css | ||
*.db | ||
*.log | ||
.coverage | ||
bootstrap.min.css | ||
|
||
# Directory | ||
*.egg-info/ | ||
env | ||
env3 | ||
.idea | ||
.vscode | ||
dist | ||
.DS_Store | ||
.cache | ||
.pytest_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name = 'pygmy' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,3 @@ def unshorten(self, s): | |
for i in range(1000): | ||
sh = hd.shorten(1099) | ||
hd.decode(sh) | ||
print(time.time() - t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import logging | ||
import threading | ||
|
||
from pygmy.config import config | ||
|
||
|
||
class Logger: | ||
"""Configure singleton logger for application and return its instance.""" | ||
_lock = threading.Lock() | ||
_instance = None | ||
|
||
def __new__(cls, filename=None, level=logging.DEBUG, format=None): | ||
log_config = {'level': getattr(logging, level, logging.DEBUG)} | ||
if filename: | ||
log_config.update({'filename': filename}) | ||
if format: | ||
log_config.update({'format': format}) | ||
|
||
with cls._lock: | ||
if cls._instance is None: | ||
logging.basicConfig(**log_config) | ||
logger = logging.getLogger(__name__) | ||
cls._instance = logger | ||
cls._instance.info('Logger created for {}'.format(__name__)) | ||
cls._add_stream_handler(level, format) | ||
|
||
cls._instance.info('Logging setup done for {}'.format(__name__)) | ||
return cls._instance | ||
|
||
@classmethod | ||
def _add_stream_handler(cls, level, format): | ||
cls._instance.info('Adding stream handler to logger') | ||
handler = logging.StreamHandler() | ||
handler.setLevel(level) | ||
if format: | ||
formatter = logging.Formatter(format) | ||
handler.setFormatter(formatter) | ||
cls._instance.addHandler(handler) | ||
|
||
|
||
log = Logger(config.logging['filepath'], config.logging['level'], config.logging['format']) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.