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 uuid import UUID | |
from pydantic.class_validators import validator | |
from pydantic.main import BaseModel | |
from pydantic.types import UUID4 | |
from sqlalchemy import Column, String, Uuid | |
from sqlalchemy.orm import declarative_base | |
Base = declarative_base() |
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
### STACK CLASS | |
class Stack: | |
def __init__(self, item=None): | |
self._count = 0 | |
# TODO: de alguma forma dispensar o tipo list de _items para não precisar do append no __setitem__ | |
self._items = [item] | |
def __getitem__(self, index): | |
try: |
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
""" | |
14. mimic | |
Neste desafio você vai fazer um gerador de lero-lero. | |
É um programa que lê um arquivo, armazena a relação entre as palavras e | |
então gera um novo texto respeitando essas relações para imitar um | |
escritor de verdade. | |
Para isso você precisa: |
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 sys | |
import itertools | |
from collections import Counter | |
from operator import itemgetter | |
def file_to_string_list(filename) -> list: | |
try: | |
with open(filename, 'r') as f: |
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
# The definitive guide to setup my Python workspace | |
# Author: Henrique Bastos <[email protected]> | |
PY3=3.8.0 | |
PY2=2.7.16 | |
PY3TOOLS="youtube-dl s3cmd fabric pytest" | |
PY2TOOLS="rename mercurial" | |
VENVS=~/.ve | |
PROJS=~/workspace |
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
// load call | |
$(window).on('load', function() { | |
//active loading | |
//loadout | |
$('#preloader').fadeOut(); | |
}); |
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
@property | |
def total_hora_extra(self): | |
if self.registrohoraextra_set.filter(utilizada=False) != 0: | |
total = self.registrohoraextra_set.filter(utilizada=False).aggregate(Sum('horas'))['horas__sum'] | |
return total | |
else: | |
return 0 |