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 os | |
import shutil | |
from sphinx.builders.epub import EpubBuilder | |
# We subclass EpubBuilder and re-define build_epub to call | |
# clean_html_file_for_ibooks. This function replaces all instances of | |
# the SPAN tag to SAMP. It's uglish but it works. A better way would | |
# be to change sphinx.writers.html to emmit the SAMP tag in the first | |
# place, but it seems even more difficult to do. |
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 __future__ import division | |
import os | |
import sys | |
import codecs | |
import textwrap | |
from StringIO import StringIO | |
from docutils import nodes | |
from docutils.parsers.rst import Directive, directives | |
from sphinx.directives.code import LiteralInclude | |
from sphinx.util.nodes import set_source_info |
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 os | |
from docutils import nodes | |
from docutils.parsers.rst import directives | |
from docutils.parsers.rst.directives.images import Image | |
def find_image(path, filename): | |
fname = os.path.join(path, filename) | |
if os.path.exists(fname + '.pdf'): | |
return fname + '.pdf' |
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
# -*- coding: utf-8 -*- | |
import sys, os | |
sys.path.insert(0, os.path.abspath('extensions')) | |
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', | |
'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', | |
'epub2', 'mobi', 'autoimage', 'code_example'] |
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
\usepackage{wasysym} | |
\usepackage{moresize} | |
\usepackage{multicol} | |
\usepackage[Sonny]{fncychap} | |
\usepackage[margin=1in, paperwidth=6.69in, paperheight=9.61in]{geometry} | |
\usepackage[protrusion=true,expansion=true]{microtype} | |
\usepackage{xltxtra} | |
\setmainfont[Mapping=tex-text]{Minion Pro} | |
\setmonofont[Mapping=tex-text,Scale=0.85]{Inconsolata} | |
%\setmonofont[Mapping=tex-text,Scale=0.75]{DejaVu Sans Mono} |
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
# Makefile for Sphinx documentation | |
# | |
# You can set these variables from the command line. | |
SPHINXOPTS = | |
SPHINXBUILD = sphinx-build -E | |
PAPER = | |
BUILDDIR = build | |
LATEX-BW = $(BUILDDIR)/latex-bw |
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
[Timer] Timings: | |
[Timer] annotate --- 421.2 s | |
[Timer] rtype_lltype --- 563.8 s | |
[Timer] backendopt_lltype --- 236.9 s | |
[Timer] stackcheckinsertion_lltype --- 33.2 s | |
[Timer] database_c --- 176.4 s | |
[Timer] =========================================== | |
[Timer] Total: --- 1431.6 s | |
[translation:ERROR] Error: | |
[translation:ERROR] Traceback (most recent call last): |
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
# coding: utf-8 | |
from datetime import datetime | |
from fabric.api import env | |
class Project(dict): | |
""" | |
Describes the remote directory structure for a project. | |
""" | |
def __init__(self, rootdir, appname, package): |
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
# coding: utf-8 | |
""" | |
This is the __init__.py for an app named floppyfields. | |
It forces Django to use floppyform's form fields when working with ModelForms. | |
It's a monkeypatch (argh!), but it's isolated. | |
To enable it, put floppyfields on INSTALLED_APPS. | |
""" | |
from django.db.models import Field as ModelField | |
from floppyforms import fields |
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
# coding: utf-8 | |
def cpf_checksum(value): | |
""" | |
CPF Checksum algorithm. | |
""" | |
def dv(partial): | |
s = sum(b * int(v) for b, v in zip(range(len(partial)+1, 1, -1), partial)) | |
return s % 11 |