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 X: | |
def __eq__(self, other): | |
return True | |
x = X() | |
if x == 1 and x == 2 and x == 3: | |
print('Absurdo') |
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
VARIABLE_CACHE = {} | |
def request_data(url): | |
if 'my_data' not in VARIABLE_CACHE: | |
data = request_data_from_web(url) | |
VARIABLE_CACHE['my_data'] = data | |
return data | |
else: | |
return VARIABLE_CACHE['my-data'] |
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 MyFormClass(forms.ModelForm): | |
def __init__(self, *args, **kwargs): | |
super() | |
pk = kwargs.pop("pk", None) | |
if pk: | |
self.field_with_querystring.query = Something.objects.filter(pk=pk) | |
form = MyFormClass(pk=client_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
from locust import stats, HttpLocust, TaskSet, task, events | |
from locust.runners import locust_runner | |
import sys | |
class QueryElyssonMRTaskSet(TaskSet): | |
@task(5) | |
def query_for_facebook(self): | |
url = "" | |
self.client.get(url) |
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 locust import stats, HttpLocust, TaskSet, task, events | |
from locust.runners import locust_runner | |
import sys | |
class QueryElyssonMRTaskSet(TaskSet): | |
@task(5) | |
def query_for_facebook(self): | |
url = "" | |
self.client.get(url) |
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
""" | |
Fluxo de usuário se conectando | |
1. usuário vai se conectar usando o websocket | |
1.1. quando o usuário se conectar vamos adiciona-lo a uma lista (ou dicionado) de usuários conectados | |
3. Ler os ramais registrados no redis | |
4. Responder o usuário com a lista de Ramais. | |
Novo Ramal cadastrado |
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
python teste.py | |
EXEC1=$? | |
python teste2.py | |
EXEC2=$? | |
python teste3.py | |
EXEC3=$? | |
if [ $EXEC1 -eq "1" ] || [ $EXEC2 -eq "1" ] || [ $EXEC3 -eq "1" ] | |
then | |
echo "ooohh snap :(" |
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 VendasAdmin(admin.ModelAdmin): | |
list_display = ('valor_total', 'outros', 'campos') | |
def valor_total(self, obj): | |
return '%.2f' % obj.balance |
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 asyncio | |
from datetime import datetime | |
from motor.motor_asyncio import AsyncIOMotorClient | |
from umongo import Instance, Document, fields, validate | |
db = AsyncIOMotorClient().test | |
instance = Instance(db) | |
@instance.register | |
class User(Document): |
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 alguma_coisa_do_django import models | |
TRANSACTION_KIND = ( | |
("in", "Entrada"), | |
("out", "Saida"), | |
("eaj", "Entrada de Ajuste"), | |
("saj", "Saída de Ajuste") | |
) | |
NewerOlder