Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Chaco CHANGELOG
===============

Release 4.7.1
-------------

Fixes

* Fix doc build (PR#384)
* Upcast to int_ instead of int64 to avoid bincount issue (PR#383)

Release 4.7.0
-------------

Expand Down
4 changes: 2 additions & 2 deletions chaco/tools/dataprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def normal_mouse_move(self, event):
y = plot.value.get_data()[ndx]
print(self.format % (x,y))
else:
print("dataprinter: don't know how to handle plots of type", end=" ")
print(plot.__class__.__name__)
print("dataprinter: don't know how to handle plots of type {}".format(
plot.__class__.__name__))
return


Expand Down
9 changes: 4 additions & 5 deletions docs/source/sphinxext/comment_eater.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import six.moves as sm

from cStringIO import StringIO
import compiler
import inspect
import textwrap
import tokenize

from .compiler_unparse import unparse
from compiler_unparse import unparse


class Comment(object):
Expand Down Expand Up @@ -77,7 +76,7 @@ def __init__(self):
def process_file(self, file):
""" Process a file object.
"""
for token in tokenize.generate_tokens(sm.next(file)):
for token in tokenize.generate_tokens(file.next):
self.process_token(*token)
self.make_index()

Expand Down Expand Up @@ -155,7 +154,7 @@ def get_class_traits(klass):
# FIXME: gracefully handle errors here or in the caller?
source = inspect.getsource(klass)
cb = CommentBlocker()
cb.process_file(sm.StringIO(source))
cb.process_file(StringIO(source))
mod_ast = compiler.parse(source)
class_ast = mod_ast.node.nodes[0]
for node in class_ast.code.nodes:
Expand Down
7 changes: 2 additions & 5 deletions docs/source/sphinxext/compiler_unparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
"""

import sys

import six
import six.moves as sm

import cStringIO
from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add

def unparse(ast, single_line_functions=False):
s = sm.cStringIO.StringIO()
s = cStringIO.StringIO()
UnparseCompilerAst(ast, s, single_line_functions)
return s.getvalue().lstrip()

Expand Down
30 changes: 13 additions & 17 deletions docs/source/sphinxext/docscrape.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
"""Extract reference documentation from the NumPy source tree.

"""
from __future__ import print_function

import inspect
import textwrap
import re

import six
import six.moves as sm

import pydoc
from StringIO import StringIO
from warnings import warn

class Reader(object):
Expand Down Expand Up @@ -126,7 +122,7 @@ def __getitem__(self,key):
return self._parsed_data[key]

def __setitem__(self,key,val):
if key not in self._parsed_data:
if not self._parsed_data.has_key(key):
warn("Unknown section %s" % key)
else:
self._parsed_data[key] = val
Expand Down Expand Up @@ -366,7 +362,7 @@ def _str_index(self):
idx = self['index']
out = []
out += ['.. index:: %s' % idx.get('default','')]
for section, references in six.iteritems(idx):
for section, references in idx.iteritems():
if section == 'default':
continue
out += [' :%s: %s' % (section, ', '.join(references))]
Expand Down Expand Up @@ -403,13 +399,13 @@ def __init__(self, func, role='func'):
self._role = role # e.g. "func" or "meth"
try:
NumpyDocString.__init__(self,inspect.getdoc(func) or '')
except ValueError as e:
print('*'*78)
print("ERROR: '%s' while parsing `%s`" % (e, self._f))
print('*'*78)
#print("Docstring follows:")
#print(doclines)
#print('='*78)
except ValueError, e:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this line!

print '*'*78
print "ERROR: '%s' while parsing `%s`" % (e, self._f)
print '*'*78
#print "Docstring follows:"
#print doclines
#print '='*78

if not self['Signature']:
func, func_name = self.get_func()
Expand All @@ -419,7 +415,7 @@ def __init__(self, func, role='func'):
argspec = inspect.formatargspec(*argspec)
argspec = argspec.replace('*','\*')
signature = '%s%s' % (func_name, argspec)
except TypeError as e:
except TypeError, e:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't revert this line!

signature = '%s()' % func_name
self['Signature'] = signature

Expand All @@ -441,8 +437,8 @@ def __str__(self):
'meth': 'method'}

if self._role:
if self._role not in roles:
print("Warning: invalid role %s" % self._role)
if not roles.has_key(self._role):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems an unnecessary change.

print "Warning: invalid role %s" % self._role
out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''),
func_name)

Expand Down
8 changes: 2 additions & 6 deletions docs/source/sphinxext/docscrape_sphinx.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import re, textwrap

import six

from .docscrape import NumpyDocString, FunctionDoc, ClassDoc

from docscrape import NumpyDocString, FunctionDoc, ClassDoc

class SphinxDocString(NumpyDocString):
# string conversion routines
Expand Down Expand Up @@ -70,7 +66,7 @@ def _str_index(self):
return out

out += ['.. index:: %s' % idx.get('default','')]
for section, references in six.iteritems(idx):
for section, references in idx.iteritems():
if section == 'default':
continue
elif section == 'refguide':
Expand Down
20 changes: 6 additions & 14 deletions docs/source/sphinxext/numpydoc.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
from __future__ import print_function

import os, re, pydoc

import six
import six.moves as sm

from .docscrape_sphinx import SphinxDocString, SphinxClassDoc, SphinxFunctionDoc
from docscrape_sphinx import SphinxDocString, SphinxClassDoc, SphinxFunctionDoc
import inspect


def mangle_docstrings(app, what, name, obj, options, lines,
reference_offset=[0]):
if what == 'module':
Expand All @@ -33,7 +26,7 @@ def mangle_docstrings(app, what, name, obj, options, lines,
try:
references.append(int(l[len('.. ['):l.index(']')]))
except ValueError:
print("WARNING: invalid reference in %s docstring" % name)
print "WARNING: invalid reference in %s docstring" % name

# Start renaming from the biggest number, otherwise we may
# overwrite references.
Expand Down Expand Up @@ -88,7 +81,7 @@ def initialize(app):

fn = app.config.numpydoc_phantom_import_file
if (fn and os.path.isfile(fn)):
print("[numpydoc] Phantom importing modules from", fn, "...")
print "[numpydoc] Phantom importing modules from", fn, "..."
import_phantom_module(fn)

def setup(app):
Expand Down Expand Up @@ -265,7 +258,7 @@ def _import_by_name(name):
name_parts = name.split('.')
last_j = 0
modname = None
for j in reversed(sm.xrange(1, len(name_parts)+1)):
for j in reversed(range(1, len(name_parts)+1)):
last_j = j
modname = '.'.join(name_parts[:j])
try:
Expand All @@ -282,7 +275,7 @@ def _import_by_name(name):
return obj
else:
return sys.modules[modname]
except (ValueError, ImportError, AttributeError, KeyError) as e:
except (ValueError, ImportError, AttributeError, KeyError), e:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, keep the 'as'

raise ImportError(e)

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -322,7 +315,7 @@ def monkeypatch_sphinx_ext_autodoc():
if sphinx.ext.autodoc.format_signature is our_format_signature:
return

print("[numpydoc] Monkeypatching sphinx.ext.autodoc ...")
print "[numpydoc] Monkeypatching sphinx.ext.autodoc ..."
_original_format_signature = sphinx.ext.autodoc.format_signature
sphinx.ext.autodoc.format_signature = our_format_signature

Expand Down Expand Up @@ -438,7 +431,6 @@ def base_cmp(a, b):
doc = "%s%s\n\n%s" % (funcname, argspec, doc)
obj = lambda: 0
obj.__argspec_is_invalid_ = True

obj.func_name = funcname
obj.__name__ = name
obj.__doc__ = doc
Expand Down
13 changes: 5 additions & 8 deletions docs/source/sphinxext/traitsdoc.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from __future__ import print_function

import inspect
import os
import pydoc

from . import docscrape
from .docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc
from . import numpydoc
from . import comment_eater

import docscrape
from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc
import numpydoc
import comment_eater

class SphinxTraitsDoc(SphinxClassDoc):
def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc):
Expand Down Expand Up @@ -129,7 +126,7 @@ def initialize(app):

fn = app.config.numpydoc_phantom_import_file
if (fn and os.path.isfile(fn)):
print("[numpydoc] Phantom importing modules from", fn, "...")
print "[numpydoc] Phantom importing modules from", fn, "..."
numpydoc.import_phantom_module(fn)

def setup(app):
Expand Down