Meus contatos:
Aprender Flask:
- https://github.com/realpython/discover-flask/blob/master/readme.md
- http://pythonclub.com.br/what-the-flask-pt-1-introducao-ao-desenvolvimento-web-com-python.html
Aprender Python (e não somente Python):
# reference: https://github.com/sqlalchemy/sqlalchemy/issues/5626 | |
import pytest | |
import sqlalchemy as sa | |
from sqlalchemy import orm | |
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession | |
Base = orm.declarative_base() | |
import itertools | |
def generate_chunks(data, chunk_size: int): | |
iterable = iter(data) | |
while chunk := tuple(itertools.islice(iterable, chunk_size)): | |
yield chunk | |
#!/bin/bash | |
# Config to find on heroku | |
CONFIG=$(echo $CONFIG) | |
if [ -z $CONFIG ]; then | |
echo "Syntax error! CONFIG=<config to find> $0" | |
exit 1 | |
fi |
from django.db import connection | |
# [... code of query here ...] | |
print(queryset) # querysets needs be used, because this is lazy | |
print(connection.queries) |
Meus contatos:
Aprender Flask:
Aprender Python (e não somente Python):
# Qual código é mais veloz (e furioso)? | |
# Primeiro exemplo | |
grupys_infinitos = [] | |
for edicao in range(0, 10000): | |
grupys_infinitos.append(f'Grupy-SP {edicao}') | |
print(grupys_infinitos) | |
# Segundo exemplo | |
grupys_infinitos = [f'Grupy-SP {edicao}' |
import re | |
def find_cnpj_using_in(content, company_name): | |
line = next(line for line in content.split('\n') if company_name in line) | |
line = int(line[2:16]) | |
return line | |
def find_cnpj_using_search(content, company_name): |
import json | |
import boto3 | |
# Get the service resource | |
sqs = boto3.resource( | |
'sqs', | |
aws_access_key_id='your_key', | |
aws_secret_access_key='your_access_key', | |
region_name='your_aws_region' |
import logging | |
logging.basicConfig(filename='debug.log', level=logging.DEBUG, | |
format='%(asctime)s %(levelname)s %(funcName)s => %(message)s') | |
def my_beautiful_function(): | |
logging.debug("Enter on function!") | |
print("Hello!") | |
#!/bin/bash | |
# Config to find on heroku | |
CONFIG=$(echo $CONFIG) | |
if [ -z $CONFIG ]; then | |
echo "Syntax error! CONFIG=<config to find> $0" | |
exit 1 | |
fi |