This file contains hidden or 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
| from PyQt5.QtWidgets import QProgressBar | |
| from qasync import QApplication | |
| import functools | |
| import asyncio | |
| import qasync | |
| import sys | |
| async def main(): | |
| def close_future(future, loop): | |
| loop.call_later(10, future.cancel) |
This file contains hidden or 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
| import traceback as _traceback | |
| import sys | |
| def traceback(exc: Exception = None): | |
| # Full error traceback with line numbers and previews | |
| if exc: | |
| exc_info = type(exc), exc, exc.__traceback__ | |
| else: | |
| exc_info = sys.exc_info() |
This file contains hidden or 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
| example = ["abc", "def", "ghi"] | |
| def join_words(words): | |
| return (", ".join(words[:-1]) + (" and " if len(words) > 1 else "") + words[-1]) if len(words) > 0 else "" | |
| result = join_words(example) | |
| print(result) | |
| # abc, def and ghi |
This file contains hidden or 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
| import os | |
| class Singleton: | |
| def __init__(self, app_id: str): | |
| if os.name == 'nt': | |
| # Requirement: pip install pywin32 | |
| import win32api, win32event, winerror | |
| self.mutexname = app_id | |
| self.lock = win32event.CreateMutex(None, False, self.mutexname) |
This file contains hidden or 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
| from contextlib import contextmanager | |
| import sys | |
| import re | |
| import os | |
| # Fix missing streams | |
| for stream in ("stdout", "stderr", "stdin"): | |
| if getattr(sys, stream) is None: | |
| setattr(sys, stream, open(os.devnull, "w+")) |
This file contains hidden or 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
| # Color escape code using rgb values (0-255) | |
| def rgb(r, g, b): | |
| return f'\x1b[38;2;{r};{g};{b}m' | |
| # Primer for windows' cmd to enable color escape codes | |
| import sys | |
| if sys.platform == 'win32': | |
| from ctypes import windll, c_int, byref, c_void_p | |
| ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 | |
| INVALID_HANDLE_VALUE = c_void_p(-1).value |
This file contains hidden or 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
| from collections import defaultdict | |
| import functools | |
| events_callbacks = defaultdict(list) | |
| def callback(event_id: str): | |
| def decorator_callback(func): | |
| functools.wraps(func) | |
| events_callbacks[event_id].append(func) |
This file contains hidden or 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
| π Morning 287 commits βββββββββββββββββββββ 19.7% | |
| π Daytime 386 commits βββββββββββββββββββββ 26.5% | |
| π Evening 422 commits βββββββββββββββββββββ 29.0% | |
| π Night 361 commits βββββββββββββββββββββ 24.8% |
This file contains hidden or 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
| β Total Stars 568 | |
| β Total Commits 78.2k | |
| π Total PRs 275 | |
| π© Total Issues 64 | |
| π¦ Contributed to 48 |
This file contains hidden or 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
| C +19.2k -3.8k βββββββββββββββββββββ 93.1% | |
| Python +413 -222 βββββββββββββββββββββ 3.1% | |
| TypeScript +305 -20 βββββββββββββββββββββ 1.2% | |
| Markdown +78 -21 βββββββββββββββββββββ 0.8% | |
| JavaScript +117 -18 βββββββββββββββββββββ 0.6% | |
| CSV +58 -19 βββββββββββββββββββββ 0.6% | |
| C++ +115 -47 βββββββββββββββββββββ 0.6% | |
| YAML +3 -3 βββββββββββββββββββββ 0.1% | |
| Linker Scβ¦ +7 -0 βββββββββββββββββββββ 0.0% | |
| JSON +5 -4 βββββββββββββββββββββ 0.0% |
OlderNewer