Skip to content

Instantly share code, notes, and snippets.

:shipit:

Ana Paula Gomes anapaulagomes

:shipit:
Block or report user

Report or block anapaulagomes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anapaulagomes
anapaulagomes / README.md
Last active May 11, 2020
Classificação da Despesa Orçamentária por Natureza
View README.md
@anapaulagomes
anapaulagomes / override_silently.py
Created Nov 7, 2019
Find methods and classes override by Python silently
View override_silently.py
"""Find class or methods override by Python silently."""
import argparse
import os
import re
from pprint import pprint
CLASS_OR_METHOD = r'\b(class|def) (.*)\('
CLASS_OR_METHOD_PATTERN = re.compile(CLASS_OR_METHOD)
View tricks.py
# install dependencies from .cfg file (from https://stackoverflow.com/a/46573039/1344295)
python -c "import configparser; c = configparser.ConfigParser(); c.read('setup.cfg'); print(c['options']['install_requires'])" | xargs pip install
@anapaulagomes
anapaulagomes / from_mommy_to_bakery.py
Last active Oct 17, 2019
Helping people moving from model_mommy to model_bakery
View from_mommy_to_bakery.py
"""
Migrate from model_mommy to model_bakery.
``python from_mommy_to_bakery.py --dry-run``
Please check your dependency files.
"""
import argparse
import os
@anapaulagomes
anapaulagomes / from_mommy_to_bakery.py
Created Oct 11, 2019
Helping people moving from model_mommy to model_bakery
View from_mommy_to_bakery.py
"""
Migrate from model_mommy to model_bakery.
``python from_mommy_to_bakery.py --dry-run``
"""
import argparse
import os
import re
View f_strings.md
>>> f" Ana ".center(50, "o")
'oooooooooooooooooooooo Ana ooooooooooooooooooooooo'
View meetups_food_and_drinks.py
CRATE_SIZE = 24
def beer_formula(rsvps):
minimum = 1.3
maximum = 2
return int(minimum * rsvps), int(maximum * rsvps)
View README.md
@anapaulagomes
anapaulagomes / test_example.py
Created May 29, 2019
Fixture to create files using pytest tmpdir
View test_example.py
from pathlib import Path
import pytest
@pytest.fixture
def file_factory(tmpdir):
def _file_factory(path):
full_path = Path(path)
file_name = full_path.name
@anapaulagomes
anapaulagomes / order_dict.py
Created Apr 7, 2019
Order a dict by value
View order_dict.py
# stolen from https://stackoverflow.com/questions/20944483/python-3-sort-a-dict-by-its-values
[(k, d[k]) for k in sorted(d, key=d.get, reverse=True)]
You can’t perform that action at this time.