The use of __main__.py
to create executables
myprojectfolder/
|_ __main__.py
|_ __init__.py
Being __main__.py
:
print("Hello")
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }' | |
from .common import * # noqa | |
DEBUG = True | |
INSTALLED_APPS += ('django_extensions',) | |
# Snip all the other stuff |
from django import forms | |
from django.core.exceptions import ValidationError | |
from django.db import transaction | |
class InvalidInputsError(Exception): | |
def __init__(self, errors, non_field_errors): | |
self.errors = errors | |
self.non_field_errors = non_field_errors |
.PHONY: test install pep8 release clean | |
test: pep8 | |
py.test --cov -l --tb=short --maxfail=1 program/ | |
install: | |
python setup.py develop | |
pep8: | |
@flake8 program --ignore=F403 --exclude=junk |
The use of __main__.py
to create executables
myprojectfolder/
|_ __main__.py
|_ __init__.py
Being __main__.py
:
print("Hello")
#MongoDB - Setting up a Replica Set
cd \mongodbdir\
mkdir db1
mkdir db2
mkdir db3
###Primary mongod --dbpath ./db1 --port 30000 --replSet "demo"
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
bumpversion patch
from apps.polidata.models import Politician | |
twitter_data = { | |
"00512": "@PepeSolari", | |
"00405": "@JAIMETROBO", | |
"05851": "@AlfredoAsti", | |
"00161": "@JuanRaFerreira", | |
"05262": "@dpayss1", | |
"05137": "@juliocesilveira", | |
"00197": "@Luisaheber", |
class LoggingMixin(object): | |
def dispatch(self, request_type, request, **kwargs): | |
logger.debug( | |
'%s %s %s' % | |
(request.method, request.get_full_path(), request.raw_post_data)) | |
try: | |
response = super(LoggingMixin, self).dispatch( | |
request_type, request, **kwargs) | |
except (BadRequest, fields.ApiFieldError), e: |