提交 9ac04ab4 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

More pep8/pyflakes

上级 e9e7ed0c
#!/usr/bin/env python #!/usr/bin/env python
import logging, os, sys import logging
import os
import sys
import theano import theano
from theano import config from theano import config
from theano.gof.cc import get_module_cache from theano.gof.cc import get_module_cache
...@@ -41,4 +44,3 @@ else: ...@@ -41,4 +44,3 @@ else:
print 'Type "theano-cache unlock" to unlock the cache directory' print 'Type "theano-cache unlock" to unlock the cache directory'
print 'Type "theano-cache cleanup" to delete keys in the old format' print 'Type "theano-cache cleanup" to delete keys in the old format'
sys.exit(1) sys.exit(1)
#!/usr/bin/env python #!/usr/bin/env python
__authors__ = "Olivier Delalleau, Pascal Lamblin" __authors__ = "Olivier Delalleau, Pascal Lamblin"
__contact__ = "delallea@iro" __contact__ = "delallea@iro"
""" """
This script should behave the same as the `nosetests` command. This script should behave the same as the `nosetests` command.
...@@ -68,6 +68,7 @@ def main(): ...@@ -68,6 +68,7 @@ def main():
return nose.main(addplugins=addplugins) return nose.main(addplugins=addplugins)
def help(): def help():
help_msg = """ help_msg = """
This script behaves mostly the same as the `nosetests` command. This script behaves mostly the same as the `nosetests` command.
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
# theano documentation build configuration file, created by # theano documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 7 16:34:06 2008. # sphinx-quickstart on Tue Oct 7 16:34:06 2008.
# #
# This file is execfile()d with the current directory set to its containing dir. # This file is execfile()d with the current directory set to its containing
# directory.
# #
# The contents of this file are pickled, so don't put values in the namespace # The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically). # that aren't pickleable (module imports are okay, they're removed
# automatically).
# #
# All configuration values have a default value; values that are commented out # All configuration values have a default value; values that are commented out
# serve to show the default value. # serve to show the default value.
import sys, os
# If your extensions are in another directory, add it here. If the directory # If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it # is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here. # absolute, like shown here.
...@@ -21,8 +21,8 @@ import sys, os ...@@ -21,8 +21,8 @@ import sys, os
# General configuration # General configuration
# --------------------- # ---------------------
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo'] extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo']
todo_include_todos = True todo_include_todos = True
...@@ -64,11 +64,12 @@ today_fmt = '%B %d, %Y' ...@@ -64,11 +64,12 @@ today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build. # List of documents that shouldn't be included in the build.
#unused_docs = [] #unused_docs = []
# List of directories, relative to source directories, that shouldn't be searched # List of directories, relative to source directories, that shouldn't be
# for source files. # searched for source files.
exclude_dirs = ['images', 'scripts', 'sandbox'] exclude_dirs = ['images', 'scripts', 'sandbox']
# The reST default role (used for this markup: `text`) to use for all documents. # The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None #default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text. # If true, '()' will be appended to :func: etc. cross-reference text.
...@@ -166,7 +167,8 @@ htmlhelp_basename = 'theanodoc' ...@@ -166,7 +167,8 @@ htmlhelp_basename = 'theanodoc'
latex_font_size = '11pt' latex_font_size = '11pt'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]). # (source start file, target name, title, author, document class
# [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'theano.tex', 'theano Documentation', ('index', 'theano.tex', 'theano Documentation',
'LISA lab, University of Montreal', 'manual'), 'LISA lab, University of Montreal', 'manual'),
......
...@@ -4,16 +4,14 @@ import os ...@@ -4,16 +4,14 @@ import os
import shutil import shutil
import inspect import inspect
from epydoc import docintrospecter from epydoc import docintrospecter
from epydoc.apidoc import RoutineDoc from epydoc.apidoc import RoutineDoc
def Op_to_RoutineDoc(op, routine_doc, module_name=None): def Op_to_RoutineDoc(op, routine_doc, module_name=None):
routine_doc.specialize_to(RoutineDoc) routine_doc.specialize_to(RoutineDoc)
#NB: this code is lifted from #NB: this code is lifted from epydoc/docintrospecter.py
# /u/bergstrj/pub/prefix/x86_64-unknown-linux-gnu-Fedora_release_7__Moonshine_/lib/python2.5/site-packages/epydoc
# /u/bergstrj/pub/prefix/x86_64-unknown-linux-gnu-Fedora_release_7__Moonshine_/lib/python2.5/site-packages/epydoc/docintrospecter.py
# op should be an op instance # op should be an op instance
assert hasattr(op, 'perform') assert hasattr(op, 'perform')
...@@ -32,7 +30,7 @@ def Op_to_RoutineDoc(op, routine_doc, module_name=None): ...@@ -32,7 +30,7 @@ def Op_to_RoutineDoc(op, routine_doc, module_name=None):
routine_doc.kwarg = kwarg routine_doc.kwarg = kwarg
# Set default values for positional arguments. # Set default values for positional arguments.
routine_doc.posarg_defaults = [None]*len(args) routine_doc.posarg_defaults = [None] * len(args)
# Set the routine's line number. # Set the routine's line number.
if hasattr(func, 'func_code'): if hasattr(func, 'func_code'):
...@@ -50,8 +48,8 @@ def Op_to_RoutineDoc(op, routine_doc, module_name=None): ...@@ -50,8 +48,8 @@ def Op_to_RoutineDoc(op, routine_doc, module_name=None):
return routine_doc return routine_doc
docintrospecter.register_introspecter( docintrospecter.register_introspecter(
lambda value: getattr(value, '__epydoc_asRoutine', False), lambda value: getattr(value, '__epydoc_asRoutine', False),
Op_to_RoutineDoc, Op_to_RoutineDoc,
priority=-1) priority=-1)
...@@ -63,13 +61,17 @@ if __name__ == '__main__': ...@@ -63,13 +61,17 @@ if __name__ == '__main__':
throot = "/".join(sys.path[0].split("/")[:-2]) throot = "/".join(sys.path[0].split("/")[:-2])
options = defaultdict(bool) options = defaultdict(bool)
options.update(dict([x, y or True] for x, y in getopt.getopt(sys.argv[1:], 'o:', ['epydoc', 'rst', 'help', 'nopdf'])[0])) options.update(dict([x, y or True] for x, y in
getopt.getopt(sys.argv[1:],
'o:',
['epydoc', 'rst', 'help', 'nopdf'])[0]))
if options['--help']: if options['--help']:
print 'Usage: %s [OPTIONS]' % sys.argv[0] print 'Usage: %s [OPTIONS]' % sys.argv[0]
print ' -o <dir>: output the html files in the specified dir' print ' -o <dir>: output the html files in the specified dir'
print ' --rst: only compile the doc (requires sphinx)' print ' --rst: only compile the doc (requires sphinx)'
print ' --nopdf: do not produce a PDF file from the doc, only HTML' print ' --nopdf: do not produce a PDF file from the doc, only HTML'
print ' --epydoc: only compile the api documentation (requires epydoc)' print ' --epydoc: only compile the api documentation',
print '(requires epydoc)'
print ' --help: this help' print ' --help: this help'
sys.exit(0) sys.exit(0)
...@@ -94,13 +96,14 @@ if __name__ == '__main__': ...@@ -94,13 +96,14 @@ if __name__ == '__main__':
if options['--all'] or options['--epydoc']: if options['--all'] or options['--epydoc']:
mkdir("api") mkdir("api")
from epydoc.cli import cli
sys.path[0:0] = [throot] sys.path[0:0] = [throot]
#Generate HTML doc #Generate HTML doc
## This causes problems with the subsequent generation of sphinx doc ## This causes problems with the subsequent generation of sphinx doc
#sys.argv[:] = ['', '--config', '%s/doc/api/epydoc.conf' % throot, '-o', 'api'] #from epydoc.cli import cli
#sys.argv[:] = ['', '--config', '%s/doc/api/epydoc.conf' % throot,
# '-o', 'api']
#cli() #cli()
## So we use this instead ## So we use this instead
os.system("epydoc --config %s/doc/api/epydoc.conf -o api" % throot) os.system("epydoc --config %s/doc/api/epydoc.conf -o api" % throot)
...@@ -131,6 +134,3 @@ if __name__ == '__main__': ...@@ -131,6 +134,3 @@ if __name__ == '__main__':
print 'OSError:', e print 'OSError:', e
except IOError, e: except IOError, e:
print 'IOError:', e print 'IOError:', e
...@@ -53,6 +53,7 @@ ISRELEASED = False ...@@ -53,6 +53,7 @@ ISRELEASED = False
VERSION = '%d.%d.%d%s' % (MAJOR, MINOR, MICRO, SUFFIX) VERSION = '%d.%d.%d%s' % (MAJOR, MINOR, MICRO, SUFFIX)
def git_version(): def git_version():
""" """
Return the sha1 of local git HEAD as a string. Return the sha1 of local git HEAD as a string.
...@@ -86,13 +87,15 @@ def git_version(): ...@@ -86,13 +87,15 @@ def git_version():
git_revision = "unknown-git" git_revision = "unknown-git"
return git_revision return git_revision
def write_version_py(filename=os.path.join('theano', 'generated_version.py')): def write_version_py(filename=os.path.join('theano', 'generated_version.py')):
cnt = """ cnt = """
# THIS FILE IS GENERATED FROM THEANO SETUP.PY # THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '%(version)s' short_version = '%(version)s'
version = '%(version)s' version = '%(version)s'
git_revision = '%(git_revision)s' git_revision = '%(git_revision)s'
full_version = '%(version)s.dev-%%(git_revision)s' %% {'git_revision': git_revision} full_version = '%(version)s.dev-%%(git_revision)s' %% {
'git_revision': git_revision}
release = %(isrelease)s release = %(isrelease)s
if not release: if not release:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论