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
import logging | |
import sys | |
from logging.handlers import TimedRotatingFileHandler | |
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") | |
LOG_FILE = "my_app.log" | |
def get_console_handler(): | |
console_handler = logging.StreamHandler(sys.stdout) | |
console_handler.setFormatter(FORMATTER) |
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
""" | |
HackerNews module. | |
""" | |
import logging | |
import asyncio | |
from operator import itemgetter | |
import httpx |
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
# Do not use the alias `python3` | |
# For this to work properly, explicitly specify the python version as necessary on your system | |
function venv { | |
default_envdir=".venv" | |
envdir=${1:-$default_envdir} | |
if [ ! -d $envdir ]; then | |
python3.12 -m venv $envdir | |
python3.12 -m pip install ruff | |
echo -e "\x1b[38;5;2m✔ Created virtualenv $envdir\x1b[0m" |