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 dataclasses | |
import datetime | |
from typing import Protocol | |
class InvoiceProtocol(Protocol): | |
id: int | |
paid: bool | |
late: bool | |
due_date: datetime.date |
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
# using build | |
class AsoRepository: | |
def __init__(self, mapper, model_class): | |
self.mapper = mapper | |
self.model_class = model_class | |
def get_asos_by_group_id(self, group_id): | |
qs = self._get_queryset().filter(group_brnet_id=group_id) |
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
class RuleSet: | |
def __init__(self): | |
self.dependencies = dict() | |
self.conflicts = dict() | |
def addDep(self, a, b): | |
if a not in self.dependencies: | |
self.dependencies[a] = set() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# qual a boa prática para definir um embrulhador padrão? | |
# 1. diretamente nos kwargs | |
class MyOtherEmbrulhadorClass: | |
def __init__(self, embrulhado=MyEmbrulho) | |
self.embrulhador = embrulhador() | |
# 2. Isso seria nemecessário apenas se MyEmbrulho fosse uma instância de um objeto mutável, não uma classe? | |
# Esse é um padrão muito usado no Django, talvez porque a gente cria classes que o próprio Django tem a |
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
class JSONDecoder(object): | |
"""Simple JSON <http://json.org> decoder | |
Performs the following translations in decoding by default: | |
+---------------+-------------------+ | |
| JSON | Python | | |
+===============+===================+ | |
| object | dict | | |
+---------------+-------------------+ |
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
(function(){ | |
function Ajax(){ | |
Ajax.prototype.get = function(url, dataObj){ | |
var xmlhttp = newXmlHttpRequest() | |
var urlWithParams = urlWithGETParams(url, dataObj); | |
var closure = setCallBack(xmlhttp) | |
xmlhttp.open("GET", urlWithParams, true); | |
xmlhttp.send(); | |
return closure |
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
def choices(): | |
SEMANA = gera_semanas() | |
PUBLICADO = ( | |
(True, 'Publicado'), | |
(False, 'Em Rascunho'), | |
) | |
return SEMANA, PUBLICADO | |
def gera_semanas(): |
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
Requirement already satisfied (use --upgrade to upgrade): flake8 in ./lib/python2.7/site-packages (from -r requirements_dev.txt (line 1)) | |
Requirement already satisfied (use --upgrade to upgrade): coverage in ./lib/python2.7/site-packages (from -r requirements_dev.txt (line 2)) | |
Requirement already satisfied (use --upgrade to upgrade): webtest in ./lib/python2.7/site-packages (from -r requirements_dev.txt (line 3)) | |
Requirement already satisfied (use --upgrade to upgrade): mkdocs in ./lib/python2.7/site-packages (from -r requirements_dev.txt (line 4)) | |
Requirement already satisfied (use --upgrade to upgrade): pyflakes>=0.8.1 in ./lib/python2.7/site-packages (from flake8->-r requirements_dev.txt (line 1)) | |
Requirement already satisfied (use --upgrade to upgrade): pep8>=1.5.7 in ./lib/python2.7/site-packages (from flake8->-r requirements_dev.txt (line 1)) | |
Requirement already satisfied (use --upgrade to upgrade): mccabe>=0.2.1 in ./lib/python2.7/site-packages (from flake8->-r requirements_dev.txt (line 1)) | |
Requiremen |
NewerOlder