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
pip install mutmut | |
mutmut run --runner 'python -m pytest -x tests/test_quiz.py' --paths-to-mutate business_logic/credit_history_quiz.py | |
mutmut results # Shows munants IDs (X here) | |
mutmut show X # Shows diff metant/original | |
mutmut apply X # Applies change from mutant to file | |
То stop certain line from mutation (Annoying on log lines) apply whitelisting comment on it: # pragma: no mutate |
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 logging | |
class InsufficientFunds(PaymentSystemError): | |
requested_amount: float = None | |
direction: FinDirection = None | |
account_balance: float = None | |
def __init__(self, *args, direction=None, requested_amount=None, account_balance=None, **kwargs): | |
self.direction = direction |
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
pg_dump -U postgres -Fc mfo > mfo.sql | |
docker cp postgres:/mfo.sql mfo.sql | |
docker cp mfo.sql postgres:/mfo.sql | |
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'mfo' AND pid <> pg_backend_pid(); | |
drop database mfo; | |
create database mfo; | |
pg_restore -U postgres -d mfo --clean --create mfo.sql |
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 asyncio | |
from aiologger import Logger | |
from loguru import logger | |
def async_logging(msg): | |
aio_logger = Logger.with_default_handlers(name='my-logger') | |
method = getattr(aio_logger, msg.record['level'].name.lower()) | |
method(f"AIO LOGGING: {msg}") |
OlderNewer