A versão original(em inglês) pode ser encontrada aqui
Um guia com as "melhores das melhores práticas" (BOBP) para o desenvolvimento em Python.
A versão original(em inglês) pode ser encontrada aqui
Um guia com as "melhores das melhores práticas" (BOBP) para o desenvolvimento em Python.
Run pytest and show prints:
$ pytest -v -s
test_helloworld.py::TestHello::test_python [TestHello.setUpClass] PASSED
test_helloworld.py::TestHello::test_world PASSED
test_helloworld.py::TestHey::test_world [TestHey.setup_class] PASSED
[ColorEffects:Disabled] | |
Color=56,56,56 | |
ColorAmount=0 | |
ColorEffect=0 | |
ContrastAmount=0.65 | |
ContrastEffect=1 | |
IntensityAmount=0.1 | |
IntensityEffect=2 | |
[ColorEffects:Inactive] |
[Background] | |
Color=48,10,36 | |
MaxRandomHue=0 | |
MaxRandomSaturation=0 | |
MaxRandomValue=0 | |
[BackgroundIntense] | |
Color=89,18,67 | |
[Color0] |
#!/bin/sh | |
# recursively removes all .pyc , .pyo files and __pycache__ directories in the current | |
# directory | |
find . | \ | |
grep -E "(__pycache__|\.pyc$|\.pyo$)" | \ | |
xargs rm -rf | |
# or, for copy-pasting: |
{% if form.non_field_errors %} | |
<div class="alert alert-error"> | |
{% for error in form.non_field_errors %} | |
{{error}} | |
{% endfor %} | |
</div> | |
{% endif %} | |
<form class="form-horizontal" action="{{ form_action }}" method="post" | |
enctype="multipart/form-data" id="form-novo-movimento" name="form-novo-movimento"> |
import argparse | |
# Set up the main parser | |
parser = argparse.ArgumentParser(description='An awesome program') | |
# And the subparser | |
subparsers = parser.add_subparsers( | |
title='subcommands', | |
description='valid subcommands', | |
help='additional help') |
# mais informações sobre yield generator/coroutine | |
# http://www.dabeaz.com/generators/ | |
# motivação | |
# http://www.dabeaz.com/coroutines/Coroutines.pdf pg: 68 | |
""" | |
>>> gen = foo1(lambda : [1,2,3,6,90]) |
// using jQuery | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
var app = angular.module('app',['ngCookies', 'ui.bootstrap'], | |
// Change interpolation symbols | |
function ($interpolateProvider) { | |
$interpolateProvider.startSymbol('{$'); | |
$interpolateProvider.endSymbol('$}'); | |
}); | |
app.config(['$httpProvider', function($httpProvider) { | |
// Change content type for POST so Django gets correct request object | |
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; |