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 os | |
from os import environ as env | |
from typing import get_type_hints, Union | |
from dotenv import load_dotenv | |
env = os.getenv('ENVIRONMENT') | |
dotenv_path = f'.env.{env}' if env is not None else '.env' | |
load_dotenv(dotenv_path=dotenv_path) | |
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 | |
from sqlalchemy import (Table, Column, Integer, Enum, Float, String, Date, Boolean, ForeignKey) | |
from sqlalchemy.orm import registry, relationship | |
from bot.domain import model | |
""" | |
Imperative mapping with dataclasses (models are dataclasses) | |
https://docs.sqlalchemy.org/en/14/orm/mapping_styles.html#imperative-mapping-with-dataclasses-and-attrs | |
""" |
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
core: | |
i18n: | |
language: 'es' | |
logging: | |
version: 1 | |
formatters: | |
standard: | |
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |
error: | |
format: "%(asctime)s - %(name)s - %(levelname)s <PID %(process)d:%(processName)s>\ |
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
version: "3" | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- ./wp-data:/var/lib/mysql | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: MyR00tMySQLPa$$w0rD | |
MYSQL_DATABASE: MyWordPressDatabaseName |
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
from datetime import date, datetime, timedelta | |
from dateutil.relativedelta import relativedelta | |
def build_formatted_range(interval: str, range_start: date | datetime = None, range_end: date | datetime = None, | |
period: str = None): | |
new_start = range_start | |
new_end = range_end | |
if range_end is None: |
NewerOlder