Skip to content

Instantly share code, notes, and snippets.

View shimizukawa's full-sized avatar

Takayuki SHIMIZUKAWA shimizukawa

View GitHub Profile
@shimizukawa
shimizukawa / autodoc.diff
Last active December 11, 2015 00:28
sphinx autodoc patch for descriptor-class documentation. reported behavior is here: https://gist.github.com/4503973
diff -r cfbdd84c1d6f sphinx/ext/autodoc.py
--- a/sphinx/ext/autodoc.py Thu Jan 10 21:58:18 2013 -0600
+++ b/sphinx/ext/autodoc.py Sat Jan 12 16:07:02 2013 +0900
@@ -1190,6 +1190,7 @@
def can_document_member(cls, member, membername, isattr, parent):
isdatadesc = isdescriptor(member) and not \
isinstance(member, cls.method_types) and not \
+ type(member).__name__ == "type" and not \
type(member).__name__ == "method_descriptor"
return isdatadesc or (not isinstance(parent, ModuleDocumenter)
@shimizukawa
shimizukawa / conf.py
Last active April 9, 2016 14:44
Adding custom directives and roles for Sphinx syntax it also provide index information / Sphinxの独自directive, roleを定義してアウトプットを整形したりindex化したり。
# http://sphinx-users.jp/doc11/ext/appapi.html#sphinx.application.Sphinx.add_object_type
# -- add config field --
from sphinx import addnodes
from sphinx.util.docfields import Field, GroupedField
import re
def iniref_parse_format(env, sig, signode):
@shimizukawa
shimizukawa / ubuntu
Created December 11, 2012 13:56
sphinx build (46ee365a865d) by python3.1.x
ubuntu:~/sphinx-master$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"
ubuntu:~/sphinx-master$ uname -a
Linux ubuntu 2.6.38-13-server #53-Ubuntu SMP Mon Nov 28 19:52:56 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
ubuntu:~/sphinx-master$ python3.1 -V
@shimizukawa
shimizukawa / README.rst
Created December 1, 2012 07:45
Sphinx extension "Anonimous Domain" extend objects.inv entries.

Anonymous Domain

Anonymous domain hook anonymous link target and store targets into objects.inv.

Problem

objects.inv not have anonymous link targets.

@shimizukawa
shimizukawa / ext_ctags.py
Created November 30, 2012 03:38
ctags file generator for sphinx
# -*- coding: utf-8 -*-
import os
def doctree_resolved(app, doctree, docname):
filename = os.path.join(app.confdir, app.config.ctags_filename)
# load existent ctag
ctags = load_ctag(filename)
@shimizukawa
shimizukawa / decode_inventory_of_sphinx.py
Created November 30, 2012 00:20
sphinx inventory loading
import urllib
import zlib
inv = urllib.urlopen('http://docs.python.org/2/objects.inv').read()
raw_inv = zlib.decompress('\n'.join(l for l in da.splitlines() if l and l[0]!='#'))
raw_inv.splitlines()[0]
# -> '-v std:option 1 using/cmdline.html#cmdoption$ -'
# it's a first line of raw inventory data
@shimizukawa
shimizukawa / sphinx-i18n-avoid-unusable-warnings.patch
Created November 29, 2012 13:20
sphinx i18n avoid unusable warnings patch.
diff -r 8a5db9f7719d -r 02d86c1ce059 sphinx/environment.py
--- a/sphinx/environment.py Tue Nov 27 20:07:30 2012 +0900
+++ b/sphinx/environment.py Thu Nov 29 15:46:57 2012 +0900
@@ -219,6 +219,14 @@
if not msgstr or msgstr == msg: # as-of-yet untranslated
continue
+ # Avoid "Literal block expected; none found." warnings.
+ # If msgstr ends with '::' then it cause warning message at
+ # parser.parse() processing.
@shimizukawa
shimizukawa / gist:4006583
Created November 3, 2012 08:29
Sphinx-1.3.3 install for Python-3.2 on Windows7 log
D:\>pip-3.2 freeze
distribute==0.6.30
pyreadline==1.7.dev
pywin32==216
virtualenv==1.8.2
wsgiref==0.1.2
D:\>virtualenv-3.2 py32
New python executable in py32\Scripts\python3.2.exe
Also creating executable in py32\Scripts\python.exe
@shimizukawa
shimizukawa / gist:4006542
Created November 3, 2012 08:13
Sphinx-1.3.3 install for Python-3.3 on Windows7 log
D:\>pip-3.3 freeze
distribute==0.6.30
pyreadline==2.0-dev1
virtualenv==1.8.2
D:\>virtualenv-3.3 py33
New python executable in py33\Scripts\python3.3.exe
Also creating executable in py33\Scripts\python.exe
Installing distribute.....................................................................................................................................................................................................................................................................................................................................................................................done.
Installing pip..................done.
@shimizukawa
shimizukawa / pillow-1.7.8-test-on-win32-py26.txt
Created November 1, 2012 23:04
pillow-1.7.8-test-on-win32-py26.txt
C:> c:\Python26\python.exe setup.py build_ext -i
running build_ext
--------------------------------------------------------------------
SETUP SUMMARY (Pillow 1.7.8 / PIL 1.1.7)
--------------------------------------------------------------------
version 1.7.8
platform win32 2.6.6 (r266:84297, Aug 24 2010, 18:46:32)
[MSC v.1500 32 bit (Intel)]
--------------------------------------------------------------------
--- TKINTER support available