mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 11:00:07 +01:00
Refactor lots of functions to use camelCase names
This commit is contained in:
10
build.py
10
build.py
@@ -863,7 +863,7 @@ def cmd_etg(options, args):
|
||||
|
||||
|
||||
def cmd_sphinx(options, args):
|
||||
from sphinxtools.postprocess import SphinxIndexes, MakeHeadings, PostProcess, GenGallery
|
||||
from sphinxtools.postprocess import sphinxIndexes, makeHeadings, postProcess, genGallery
|
||||
|
||||
cmdTimer = CommandTimer('sphinx')
|
||||
pwd = pushDir(phoenixDir())
|
||||
@@ -885,8 +885,8 @@ def cmd_sphinx(options, args):
|
||||
txt = os.path.join(sphinxDir, os.path.splitext(rstName)[0] + '.txt')
|
||||
copyIfNewer(rst, txt)
|
||||
|
||||
SphinxIndexes(sphinxDir)
|
||||
GenGallery()
|
||||
sphinxIndexes(sphinxDir)
|
||||
genGallery()
|
||||
|
||||
# Copy the hand-edited top level doc files too
|
||||
rstFiles = [os.path.join(phoenixDir(), 'TODO.rst')] + \
|
||||
@@ -895,7 +895,7 @@ def cmd_sphinx(options, args):
|
||||
txt = os.path.join(sphinxDir, os.path.splitext(os.path.basename(rst))[0] + '.txt')
|
||||
copyIfNewer(rst, txt)
|
||||
|
||||
MakeHeadings()
|
||||
makeHeadings()
|
||||
|
||||
pwd2 = pushDir(sphinxDir)
|
||||
buildDir = os.path.join(sphinxDir, 'build')
|
||||
@@ -904,7 +904,7 @@ def cmd_sphinx(options, args):
|
||||
del pwd2
|
||||
|
||||
msg('Postprocessing sphinx output...')
|
||||
PostProcess(htmlDir)
|
||||
postProcess(htmlDir)
|
||||
|
||||
|
||||
def cmd_wxlib(options, args):
|
||||
|
||||
@@ -20,7 +20,7 @@ import xml.etree.ElementTree as et
|
||||
from .tweaker_tools import FixWxPrefix, magicMethods, \
|
||||
guessTypeInt, guessTypeFloat, guessTypeStr, \
|
||||
textfile_open
|
||||
from sphinxtools.utilities import FindDescendants
|
||||
from sphinxtools.utilities import findDescendants
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# These classes simply hold various bits of information about the classes,
|
||||
@@ -662,7 +662,7 @@ class ClassDef(BaseDef):
|
||||
|
||||
fname = os.path.join(XMLSRC, refid+'.xml')
|
||||
root = et.parse(fname).getroot()
|
||||
compounds = FindDescendants(root, 'basecompoundref')
|
||||
compounds = findDescendants(root, 'basecompoundref')
|
||||
else:
|
||||
compounds = element.findall('basecompoundref')
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ from sphinxtools.inheritance import InheritanceDiagram
|
||||
|
||||
from sphinxtools import templates
|
||||
|
||||
from sphinxtools.utilities import odict
|
||||
from sphinxtools.utilities import ConvertToPython
|
||||
from sphinxtools.utilities import RemoveWxPrefix, WriteSphinxOutput
|
||||
from sphinxtools.utilities import FindControlImages, MakeSummary, PickleItem
|
||||
from sphinxtools.utilities import ChopDescription, PythonizeType, Wx2Sphinx
|
||||
from sphinxtools.utilities import PickleClassInfo, IsNumeric
|
||||
from sphinxtools.utilities import Underscore2Capitals, CountSpaces
|
||||
from sphinxtools.utilities import FormatContributedSnippets
|
||||
from sphinxtools.utilities import ODict
|
||||
from sphinxtools.utilities import convertToPython
|
||||
from sphinxtools.utilities import removeWxPrefix, writeSphinxOutput
|
||||
from sphinxtools.utilities import findControlImages, makeSummary, pickleItem
|
||||
from sphinxtools.utilities import chopDescription, pythonizeType, wx2Sphinx
|
||||
from sphinxtools.utilities import pickleClassInfo, isNumeric
|
||||
from sphinxtools.utilities import underscore2Capitals, countSpaces
|
||||
from sphinxtools.utilities import formatContributedSnippets
|
||||
from sphinxtools.utilities import PickleFile
|
||||
|
||||
from sphinxtools.constants import VERSION, REMOVED_LINKS, SECTIONS
|
||||
@@ -199,7 +199,7 @@ class Node(object):
|
||||
if xml_docs.kind != 'class':
|
||||
return ''
|
||||
|
||||
dummy, class_name = Wx2Sphinx(xml_docs.class_name)
|
||||
dummy, class_name = wx2Sphinx(xml_docs.class_name)
|
||||
return class_name
|
||||
|
||||
|
||||
@@ -283,13 +283,13 @@ class Node(object):
|
||||
if link in text.strip():
|
||||
return ''
|
||||
|
||||
text = ConvertToPython(text)
|
||||
text = convertToPython(text)
|
||||
|
||||
for child in self.children:
|
||||
text += child.Join(with_tail)
|
||||
|
||||
if with_tail and tail:
|
||||
text += ConvertToPython(tail)
|
||||
text += convertToPython(tail)
|
||||
|
||||
if text.strip() and not text.endswith('\n'):
|
||||
text += ' '
|
||||
@@ -325,7 +325,7 @@ class Root(Node):
|
||||
self.is_overload = is_overload
|
||||
self.share_docstrings = share_docstrings
|
||||
|
||||
self.sections = odict()
|
||||
self.sections = ODict()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -523,7 +523,7 @@ class ParameterList(Node):
|
||||
self.kind = kind
|
||||
|
||||
self.checked = False
|
||||
self.py_parameters = odict()
|
||||
self.py_parameters = ODict()
|
||||
|
||||
for pdef in xml_item.items:
|
||||
name = pdef.name
|
||||
@@ -582,7 +582,7 @@ class ParameterList(Node):
|
||||
return
|
||||
|
||||
name = xml_item.name or xml_item.pyName
|
||||
name = RemoveWxPrefix(name)
|
||||
name = removeWxPrefix(name)
|
||||
|
||||
parent = self.GetTopLevelParent()
|
||||
is_overload = parent.is_overload if parent else False
|
||||
@@ -646,7 +646,7 @@ class ParameterList(Node):
|
||||
|
||||
class_name = ''
|
||||
if hasattr(xml_item, 'className') and xml_item.className is not None:
|
||||
class_name = Wx2Sphinx(xml_item.className)[1] + '.'
|
||||
class_name = wx2Sphinx(xml_item.className)[1] + '.'
|
||||
|
||||
print((message % (class_name + name, arg, signature, py_parameters)))
|
||||
|
||||
@@ -654,7 +654,7 @@ class ParameterList(Node):
|
||||
## if param not in theargs:
|
||||
## class_name = ''
|
||||
## if hasattr(xml_item, 'className') and xml_item.className is not None:
|
||||
## class_name = Wx2Sphinx(xml_item.className)[1] + '.'
|
||||
## class_name = wx2Sphinx(xml_item.className)[1] + '.'
|
||||
##
|
||||
## print '\n ||| %s;%s;%s |||\n'%(class_name[0:-1], signature, param)
|
||||
## fid = open('mismatched.txt', 'a')
|
||||
@@ -734,7 +734,7 @@ class Parameter(Node):
|
||||
self.pdef = pdef
|
||||
self.name = pdef.name
|
||||
|
||||
self.type = PythonizeType(pdef.type, is_param=True)
|
||||
self.type = pythonizeType(pdef.type, is_param=True)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
@@ -902,7 +902,7 @@ class List(Node):
|
||||
|
||||
if self.element.tail:
|
||||
spacer = ('ParameterList' in self.GetHierarchy() and [' '] or [''])[0]
|
||||
text = '%s%s\n'%(spacer, ConvertToPython(self.element.tail.strip()))
|
||||
text = '%s%s\n'%(spacer, convertToPython(self.element.tail.strip()))
|
||||
docstrings += text
|
||||
|
||||
return docstrings
|
||||
@@ -1168,7 +1168,7 @@ class Image(Node):
|
||||
docstrings += '|\n\n'
|
||||
|
||||
if self.element.tail and self.element.tail.strip():
|
||||
docstrings += ConvertToPython(self.element.tail.rstrip())
|
||||
docstrings += convertToPython(self.element.tail.rstrip())
|
||||
|
||||
return docstrings
|
||||
|
||||
@@ -1297,7 +1297,7 @@ class Table(Node):
|
||||
table = '\n\n' + spacer + '.. include:: %s\n\n'%os.path.join(rst_folder, rst_file)
|
||||
|
||||
if self.element.tail and self.element.tail.strip():
|
||||
rest = ConvertToPython(self.element.tail.rstrip())
|
||||
rest = convertToPython(self.element.tail.rstrip())
|
||||
split = rest.splitlines()
|
||||
for index, r in enumerate(split):
|
||||
table += spacer + r
|
||||
@@ -1480,7 +1480,7 @@ class Snippet(Node):
|
||||
elif 'List' in hierarchy:
|
||||
spacer = ' '
|
||||
|
||||
tail = ConvertToPython(self.element.tail.lstrip())
|
||||
tail = convertToPython(self.element.tail.lstrip())
|
||||
tail = tail.replace('\n', ' ')
|
||||
docstrings += spacer + tail.replace(' ', ' ')
|
||||
|
||||
@@ -1538,7 +1538,7 @@ class XRef(Node):
|
||||
hascomma = '::' in text
|
||||
|
||||
original = text
|
||||
text = RemoveWxPrefix(text)
|
||||
text = removeWxPrefix(text)
|
||||
text = text.replace("::", ".")
|
||||
|
||||
if "(" in text:
|
||||
@@ -1547,7 +1547,7 @@ class XRef(Node):
|
||||
refid, link = list(element.items())[0]
|
||||
remainder = link.split('_')[-1]
|
||||
|
||||
space_before, space_after = CountSpaces(text)
|
||||
space_before, space_after = countSpaces(text)
|
||||
stripped = text.strip()
|
||||
|
||||
if stripped in IGNORE:
|
||||
@@ -1559,7 +1559,7 @@ class XRef(Node):
|
||||
if '_1' in link:
|
||||
ref = link.index('_1')
|
||||
|
||||
ref = Underscore2Capitals(link[6:ref])
|
||||
ref = underscore2Capitals(link[6:ref])
|
||||
text = ':ref:`%s <%s>`'%(stripped, ref)
|
||||
|
||||
elif 'funcmacro' in link or 'samples' in link or 'debugging' in text.lower() or \
|
||||
@@ -1588,7 +1588,7 @@ class XRef(Node):
|
||||
if not original.strip().startswith('wx') or ' ' in stripped:
|
||||
text = ''
|
||||
|
||||
elif not IsNumeric(text):
|
||||
elif not isNumeric(text):
|
||||
text = '``%s``'%text
|
||||
|
||||
elif 'funcmacro' in link:
|
||||
@@ -1626,9 +1626,9 @@ class XRef(Node):
|
||||
text = ':meth:`%s` '%stripped
|
||||
|
||||
else:
|
||||
text = ':ref:`%s`'%Wx2Sphinx(stripped)[1]
|
||||
text = ':ref:`%s`' % wx2Sphinx(stripped)[1]
|
||||
|
||||
return space_before + text + space_after + ConvertToPython(tail)
|
||||
return space_before + text + space_after + convertToPython(tail)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
@@ -1676,9 +1676,9 @@ class ComputerOutput(Node):
|
||||
|
||||
if text is not None:
|
||||
stripped = text.strip()
|
||||
space_before, space_after = CountSpaces(text)
|
||||
space_before, space_after = countSpaces(text)
|
||||
|
||||
text = RemoveWxPrefix(text.strip())
|
||||
text = removeWxPrefix(text.strip())
|
||||
|
||||
else:
|
||||
text = ''
|
||||
@@ -1690,9 +1690,9 @@ class ComputerOutput(Node):
|
||||
text = "``%s`` "%text
|
||||
|
||||
if self.element.tail:
|
||||
text += ConvertToPython(self.element.tail)
|
||||
text += convertToPython(self.element.tail)
|
||||
|
||||
space_before, space_after = CountSpaces(text)
|
||||
space_before, space_after = countSpaces(text)
|
||||
if space_before == '':
|
||||
space_before = ' '
|
||||
|
||||
@@ -1768,7 +1768,7 @@ class Emphasis(Node):
|
||||
tail = (tail is not None and [tail] or [''])[0]
|
||||
|
||||
if tail.strip() != ':':
|
||||
childText = childText.replace(ConvertToPython(tail), '')
|
||||
childText = childText.replace(convertToPython(tail), '')
|
||||
|
||||
fullChildText = child.Join()
|
||||
endPos = text.index(childText)
|
||||
@@ -1788,7 +1788,7 @@ class Emphasis(Node):
|
||||
text = spacing + format % text.strip()
|
||||
|
||||
if self.element.tail:
|
||||
text += ConvertToPython(self.element.tail)
|
||||
text += convertToPython(self.element.tail)
|
||||
|
||||
return text
|
||||
|
||||
@@ -1836,11 +1836,11 @@ class Title(Node):
|
||||
|
||||
if isinstance(self.parent, Section) and self.parent.section_type == 'par':
|
||||
# Sub-title in a @par doxygen tag
|
||||
text = ConvertToPython(self.element.text)
|
||||
text = convertToPython(self.element.text)
|
||||
underline = '-'
|
||||
else:
|
||||
# Normal big title
|
||||
text = '|phoenix_title| ' + ConvertToPython(self.element.text)
|
||||
text = '|phoenix_title| ' + convertToPython(self.element.text)
|
||||
underline = '='
|
||||
|
||||
lentext = len(text)
|
||||
@@ -1896,7 +1896,7 @@ class ULink(Node):
|
||||
text = '`%s <%s>`_'%(text, link)
|
||||
|
||||
if self.element.tail:
|
||||
text += ConvertToPython(self.element.tail)
|
||||
text += convertToPython(self.element.tail)
|
||||
|
||||
return text
|
||||
|
||||
@@ -1955,8 +1955,8 @@ class XMLDocString(object):
|
||||
self.kind = 'function'
|
||||
elif isinstance(xml_item, (extractors.ClassDef, extractors.PyClassDef, extractors.TypedefDef)):
|
||||
self.kind = 'class'
|
||||
self.appearance = FindControlImages(xml_item)
|
||||
self.class_name = RemoveWxPrefix(xml_item.name) or xml_item.pyName
|
||||
self.appearance = findControlImages(xml_item)
|
||||
self.class_name = removeWxPrefix(xml_item.name) or xml_item.pyName
|
||||
elif isinstance(xml_item, extractors.EnumDef):
|
||||
self.kind = 'enum'
|
||||
else:
|
||||
@@ -2054,7 +2054,7 @@ class XMLDocString(object):
|
||||
if sub_item.ignored:
|
||||
continue
|
||||
|
||||
sub_item.name = self.xml_item.pyName or RemoveWxPrefix(self.xml_item.name)
|
||||
sub_item.name = self.xml_item.pyName or removeWxPrefix(self.xml_item.name)
|
||||
docstring = XMLDocString(sub_item, is_overload=True, share_docstrings=share_docstrings)
|
||||
docstring.class_name = self.class_name
|
||||
docstring.current_module = self.current_module
|
||||
@@ -2171,7 +2171,7 @@ class XMLDocString(object):
|
||||
rest_class = Emphasis(element, parent)
|
||||
|
||||
elif tag == 'title':
|
||||
text = ConvertToPython(element.text)
|
||||
text = convertToPython(element.text)
|
||||
rest_class = Title(element, parent)
|
||||
|
||||
elif tag == 'para':
|
||||
@@ -2216,33 +2216,33 @@ class XMLDocString(object):
|
||||
|
||||
if self.kind == 'class':
|
||||
klass = self.xml_item
|
||||
name = RemoveWxPrefix(klass.name) or klass.pyName
|
||||
dummy, fullname = Wx2Sphinx(name)
|
||||
name = removeWxPrefix(klass.name) or klass.pyName
|
||||
dummy, fullname = wx2Sphinx(name)
|
||||
elif self.kind == 'method':
|
||||
method = self.xml_item
|
||||
if hasattr(method, 'isCtor') and method.isCtor:
|
||||
method_name = '__init__'
|
||||
|
||||
if hasattr(method, 'className') and method.className is not None:
|
||||
klass = RemoveWxPrefix(method.className)
|
||||
klass = removeWxPrefix(method.className)
|
||||
else:
|
||||
klass = RemoveWxPrefix(method.klass.name)
|
||||
klass = removeWxPrefix(method.klass.name)
|
||||
|
||||
method_name = '%s.%s'%(klass, method_name)
|
||||
else:
|
||||
method_name = method.name or method.pyName
|
||||
if hasattr(method, 'className') and method.className is not None:
|
||||
klass = RemoveWxPrefix(method.className)
|
||||
klass = removeWxPrefix(method.className)
|
||||
method_name = '%s.%s'%(klass, method_name)
|
||||
elif hasattr(method, 'klass'):
|
||||
klass = RemoveWxPrefix(method.klass.name)
|
||||
klass = removeWxPrefix(method.klass.name)
|
||||
method_name = '%s.%s'%(klass, method_name)
|
||||
else:
|
||||
method_name = RemoveWxPrefix(method_name)
|
||||
method_name = removeWxPrefix(method_name)
|
||||
method_name = '%s'%method_name
|
||||
klass = None
|
||||
|
||||
dummy, fullname = Wx2Sphinx(method_name)
|
||||
dummy, fullname = wx2Sphinx(method_name)
|
||||
elif self.kind == 'function':
|
||||
function = self.xml_item
|
||||
name = function.pyName or function.name
|
||||
@@ -2343,7 +2343,7 @@ class XMLDocString(object):
|
||||
# class declaration
|
||||
klass = self.xml_item
|
||||
name = self.class_name
|
||||
dummy, fullname = Wx2Sphinx(name)
|
||||
dummy, fullname = wx2Sphinx(name)
|
||||
|
||||
if '.' in fullname:
|
||||
parts = fullname.split('.')
|
||||
@@ -2358,7 +2358,7 @@ class XMLDocString(object):
|
||||
klass.nodeBases = ({name: (name, name, [])}, [name])
|
||||
|
||||
inheritance_diagram = InheritanceDiagram(klass.nodeBases)
|
||||
png, map = inheritance_diagram.MakeInheritanceDiagram()
|
||||
png, map = inheritance_diagram.makeInheritanceDiagram()
|
||||
|
||||
image_desc = templates.TEMPLATE_INHERITANCE % ('class', name, png, name, map)
|
||||
stream.write(image_desc)
|
||||
@@ -2368,7 +2368,7 @@ class XMLDocString(object):
|
||||
stream.write(appearance_desc)
|
||||
|
||||
if klass.subClasses:
|
||||
subs = [':ref:`%s`'%Wx2Sphinx(cls)[1] for cls in klass.subClasses]
|
||||
subs = [':ref:`%s`' % wx2Sphinx(cls)[1] for cls in klass.subClasses]
|
||||
subs = ', '.join(subs)
|
||||
subs_desc = templates.TEMPLATE_SUBCLASSES % subs
|
||||
stream.write(subs_desc)
|
||||
@@ -2377,15 +2377,15 @@ class XMLDocString(object):
|
||||
|
||||
if possible_py:
|
||||
possible_py.sort()
|
||||
snippets = FormatContributedSnippets(self.kind, possible_py)
|
||||
snippets = formatContributedSnippets(self.kind, possible_py)
|
||||
stream.write(snippets)
|
||||
|
||||
if klass.method_list:
|
||||
summary = MakeSummary(name, klass.method_list, templates.TEMPLATE_METHOD_SUMMARY, 'meth')
|
||||
summary = makeSummary(name, klass.method_list, templates.TEMPLATE_METHOD_SUMMARY, 'meth')
|
||||
stream.write(summary)
|
||||
|
||||
if klass.property_list:
|
||||
summary = MakeSummary(name, klass.property_list, templates.TEMPLATE_PROPERTY_SUMMARY, 'attr')
|
||||
summary = makeSummary(name, klass.property_list, templates.TEMPLATE_PROPERTY_SUMMARY, 'attr')
|
||||
stream.write(summary)
|
||||
|
||||
stream.write(templates.TEMPLATE_API)
|
||||
@@ -2395,7 +2395,7 @@ class XMLDocString(object):
|
||||
|
||||
if bases:
|
||||
stream.write('(')
|
||||
bases = [RemoveWxPrefix(b) for b in bases]
|
||||
bases = [removeWxPrefix(b) for b in bases]
|
||||
stream.write(', '.join(bases))
|
||||
stream.write(')')
|
||||
|
||||
@@ -2416,7 +2416,7 @@ class XMLDocString(object):
|
||||
found = True
|
||||
else:
|
||||
found = False
|
||||
newlines.append(ConvertToPython(line))
|
||||
newlines.append(convertToPython(line))
|
||||
|
||||
if found:
|
||||
line = line.replace('wx.EmptyString', '""')
|
||||
@@ -2430,7 +2430,7 @@ class XMLDocString(object):
|
||||
stream.write(newdocs + "\n\n")
|
||||
|
||||
if write:
|
||||
WriteSphinxOutput(stream, self.output_file)
|
||||
writeSphinxOutput(stream, self.output_file)
|
||||
else:
|
||||
return stream.getvalue()
|
||||
|
||||
@@ -2447,7 +2447,7 @@ class XMLDocString(object):
|
||||
|
||||
method = self.xml_item
|
||||
name = method.name or method.pyName
|
||||
name = RemoveWxPrefix(name)
|
||||
name = removeWxPrefix(name)
|
||||
|
||||
if method.overloads and not self.is_overload:
|
||||
if not method.isStatic:
|
||||
@@ -2482,7 +2482,7 @@ class XMLDocString(object):
|
||||
|
||||
function = self.xml_item
|
||||
name = function.name or function.pyName
|
||||
name = RemoveWxPrefix(name)
|
||||
name = removeWxPrefix(name)
|
||||
|
||||
if function.overloads and not self.is_overload:
|
||||
arguments = '(*args, **kw)'
|
||||
@@ -2558,7 +2558,7 @@ class XMLDocString(object):
|
||||
|
||||
else:
|
||||
|
||||
rtype = PythonizeType(after, is_param=False)
|
||||
rtype = pythonizeType(after, is_param=False)
|
||||
|
||||
if not rtype:
|
||||
return
|
||||
@@ -2592,7 +2592,7 @@ class XMLDocString(object):
|
||||
|
||||
method = self.xml_item
|
||||
name = method.name or method.pyName
|
||||
name = RemoveWxPrefix(name)
|
||||
name = removeWxPrefix(name)
|
||||
|
||||
if self.is_overload:
|
||||
definition = '**%s** '%name
|
||||
@@ -2620,13 +2620,13 @@ class XMLDocString(object):
|
||||
|
||||
if possible_py:
|
||||
possible_py.sort()
|
||||
snippets = FormatContributedSnippets(self.kind, possible_py)
|
||||
snippets = formatContributedSnippets(self.kind, possible_py)
|
||||
stream.write(snippets)
|
||||
|
||||
stream.write("\n\n")
|
||||
|
||||
if not self.is_overload and write:
|
||||
WriteSphinxOutput(stream, self.output_file, append=True)
|
||||
writeSphinxOutput(stream, self.output_file, append=True)
|
||||
|
||||
return stream.getvalue()
|
||||
|
||||
@@ -2672,11 +2672,11 @@ class XMLDocString(object):
|
||||
|
||||
if possible_py:
|
||||
possible_py.sort()
|
||||
snippets = FormatContributedSnippets(self.kind, possible_py)
|
||||
snippets = formatContributedSnippets(self.kind, possible_py)
|
||||
stream.write(snippets)
|
||||
|
||||
if not self.is_overload and write:
|
||||
PickleItem(stream.getvalue(), self.current_module, name, 'function')
|
||||
pickleItem(stream.getvalue(), self.current_module, name, 'function')
|
||||
|
||||
return stream.getvalue()
|
||||
|
||||
@@ -2693,7 +2693,7 @@ class XMLDocString(object):
|
||||
:rtype: `string`
|
||||
"""
|
||||
|
||||
enum_name, fullname = Wx2Sphinx(self.xml_item.name)
|
||||
enum_name, fullname = wx2Sphinx(self.xml_item.name)
|
||||
|
||||
if '@' in enum_name:
|
||||
return
|
||||
@@ -2718,7 +2718,7 @@ class XMLDocString(object):
|
||||
continue
|
||||
|
||||
docstrings = v.briefDoc
|
||||
name = ConvertToPython(RemoveWxPrefix(v.name))
|
||||
name = convertToPython(removeWxPrefix(v.name))
|
||||
stream.write('%-80s'%name)
|
||||
|
||||
if not isinstance(docstrings, string_base):
|
||||
@@ -2741,7 +2741,7 @@ class XMLDocString(object):
|
||||
# print message % duplicated
|
||||
|
||||
if count > 0 and write:
|
||||
WriteSphinxOutput(stream, self.output_file)
|
||||
writeSphinxOutput(stream, self.output_file)
|
||||
|
||||
return stream.getvalue()
|
||||
|
||||
@@ -2868,10 +2868,10 @@ class XMLDocString(object):
|
||||
docstrings = self.Indent(class_name, self.docstrings, spacer, '')
|
||||
|
||||
if self.kind == 'class':
|
||||
desc = ChopDescription(docstrings)
|
||||
desc = chopDescription(docstrings)
|
||||
self.short_description = desc
|
||||
class_name = self.class_name.lower()
|
||||
PickleItem(desc, self.current_module, self.class_name, 'class')
|
||||
pickleItem(desc, self.current_module, self.class_name, 'class')
|
||||
|
||||
if self.overloads:
|
||||
|
||||
@@ -3072,7 +3072,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
docstring.Dump()
|
||||
|
||||
PickleClassInfo(self.current_module + class_name, self.current_class, docstring.short_description)
|
||||
pickleClassInfo(self.current_module + class_name, self.current_class, docstring.short_description)
|
||||
|
||||
# these are the only kinds of items allowed to be items in a PyClass
|
||||
dispatch = [(extractors.PyFunctionDef, self.generateMethod),
|
||||
@@ -3091,7 +3091,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
def generatePyProperty(self, prop):
|
||||
|
||||
name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
name = removeWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
getter_setter = self.createPropertyLinks(name, prop)
|
||||
|
||||
stream = StringIO()
|
||||
@@ -3100,7 +3100,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
filename = self.current_module + "%s.txt"%name
|
||||
|
||||
WriteSphinxOutput(stream, filename, append=True)
|
||||
writeSphinxOutput(stream, filename, append=True)
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
@@ -3115,7 +3115,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
for item in klass.innerclasses:
|
||||
self.generateClass(item)
|
||||
|
||||
name = RemoveWxPrefix(klass.name) or klass.pyName
|
||||
name = removeWxPrefix(klass.name) or klass.pyName
|
||||
|
||||
## # Hack for App/PyApp...
|
||||
## if name == 'PyApp':
|
||||
@@ -3180,7 +3180,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
docstring.Dump()
|
||||
|
||||
PickleClassInfo(self.current_module + name, self.current_class, docstring.short_description)
|
||||
pickleClassInfo(self.current_module + name, self.current_class, docstring.short_description)
|
||||
|
||||
for item in ctors:
|
||||
if item.isCtor:
|
||||
@@ -3204,7 +3204,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
if isinstance(method, extractors.PyFunctionDef):
|
||||
self.UnIndent(method)
|
||||
|
||||
class_name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
class_name = removeWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
|
||||
# docstring
|
||||
method.name = name
|
||||
@@ -3212,7 +3212,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
docstring = XMLDocString(method)
|
||||
docstring.kind = 'method'
|
||||
|
||||
name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
name = removeWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
filename = self.current_module + "%s.txt"%class_name
|
||||
|
||||
docstring.output_file = filename
|
||||
@@ -3259,7 +3259,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
else:
|
||||
docstrings += line + '\n'
|
||||
|
||||
docstrings = ConvertToPython(docstrings)
|
||||
docstrings = convertToPython(docstrings)
|
||||
|
||||
newdocs = ''
|
||||
spacer = ' '*6
|
||||
@@ -3276,10 +3276,10 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
text = '%s %s\n%s%s\n\n'%(' .. deprecated::', VERSION, ' '*9, pm.deprecated.replace('\n', ' '))
|
||||
stream.write(text)
|
||||
|
||||
name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
name = removeWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
filename = self.current_module + "%s.txt"%name
|
||||
|
||||
WriteSphinxOutput(stream, filename, append=True)
|
||||
writeSphinxOutput(stream, filename, append=True)
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
@@ -3295,7 +3295,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
if prop.ignored:
|
||||
return
|
||||
|
||||
name = RemoveWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
name = removeWxPrefix(self.current_class.name) or self.current_class.pyName
|
||||
|
||||
getter_setter = self.createPropertyLinks(name, prop)
|
||||
|
||||
@@ -3305,7 +3305,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
filename = self.current_module + "%s.txt"%name
|
||||
|
||||
WriteSphinxOutput(stream, filename, append=True)
|
||||
writeSphinxOutput(stream, filename, append=True)
|
||||
|
||||
|
||||
def createPropertyLinks(self, name, prop):
|
||||
@@ -3343,7 +3343,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
elif guessTypeStr(globalVar):
|
||||
valTyp = '""'
|
||||
else:
|
||||
valTyp = RemoveWxPrefix(globalVar.type) + '()'
|
||||
valTyp = removeWxPrefix(globalVar.type) + '()'
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
def generateDefine(self, define):
|
||||
@@ -3357,7 +3357,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
if typedef.ignored or not typedef.docAsClass:
|
||||
return
|
||||
|
||||
name = RemoveWxPrefix(typedef.name) or typedef.pyName
|
||||
name = removeWxPrefix(typedef.name) or typedef.pyName
|
||||
typedef.module = self.current_module
|
||||
|
||||
all_classes = {}
|
||||
@@ -3388,7 +3388,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
docstring.Dump()
|
||||
|
||||
PickleClassInfo(self.current_module + name, self.current_class, docstring.short_description)
|
||||
pickleClassInfo(self.current_module + name, self.current_class, docstring.short_description)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -3414,7 +3414,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
simple_docs = ''
|
||||
|
||||
if isinstance(method, extractors.PyMethodDef):
|
||||
simple_docs = ConvertToPython(method.pyDocstring)
|
||||
simple_docs = convertToPython(method.pyDocstring)
|
||||
else:
|
||||
brief = method.briefDoc
|
||||
if not isinstance(brief, string_base):
|
||||
@@ -3423,9 +3423,9 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
docstring.current_module = self.current_module
|
||||
simple_docs = docstring.GetBrief()
|
||||
elif brief is not None:
|
||||
simple_docs = ConvertToPython(brief)
|
||||
simple_docs = convertToPython(brief)
|
||||
|
||||
simple_docs = ChopDescription(simple_docs)
|
||||
simple_docs = chopDescription(simple_docs)
|
||||
|
||||
return method_name, simple_docs
|
||||
|
||||
@@ -3459,7 +3459,7 @@ class SphinxGenerator(generators.DocsGeneratorBase):
|
||||
|
||||
else:
|
||||
|
||||
rtype = PythonizeType(after, is_param=False)
|
||||
rtype = pythonizeType(after, is_param=False)
|
||||
|
||||
if not rtype:
|
||||
return ''
|
||||
|
||||
@@ -18,7 +18,7 @@ from subprocess import Popen, PIPE
|
||||
|
||||
# Phoenix-specific imports
|
||||
|
||||
from .utilities import Wx2Sphinx, FormatExternalLink
|
||||
from .utilities import wx2Sphinx, formatExternalLink
|
||||
from .constants import INHERITANCEROOT
|
||||
|
||||
ENOENT = getattr(errno, 'ENOENT', 0)
|
||||
@@ -176,7 +176,7 @@ class InheritanceDiagram(object):
|
||||
this_node_attrs['style'] = 'bold'
|
||||
|
||||
if self.main_class is None:
|
||||
newname, fullname = Wx2Sphinx(name)
|
||||
newname, fullname = wx2Sphinx(name)
|
||||
else:
|
||||
newname = name
|
||||
|
||||
@@ -190,7 +190,7 @@ class InheritanceDiagram(object):
|
||||
if fullname in class_summary:
|
||||
this_node_attrs['URL'] = '"%s.html"'%fullname
|
||||
else:
|
||||
full_page = FormatExternalLink(fullname, inheritance=True)
|
||||
full_page = formatExternalLink(fullname, inheritance=True)
|
||||
if full_page:
|
||||
this_node_attrs['URL'] = full_page
|
||||
|
||||
@@ -205,7 +205,7 @@ class InheritanceDiagram(object):
|
||||
this_edge_attrs['color'] = 'red'
|
||||
|
||||
if self.main_class is None:
|
||||
base_name, dummy = Wx2Sphinx(base_name)
|
||||
base_name, dummy = wx2Sphinx(base_name)
|
||||
|
||||
res.append(' "%s" -> "%s" [%s];\n' %
|
||||
(base_name, newname,
|
||||
@@ -216,7 +216,7 @@ class InheritanceDiagram(object):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def MakeInheritanceDiagram(self, class_summary=None):
|
||||
def makeInheritanceDiagram(self, class_summary=None):
|
||||
"""
|
||||
Actually generates the inheritance diagram as a PNG file plus the corresponding
|
||||
MAP file for mouse navigation over the inheritance boxes.
|
||||
@@ -242,7 +242,7 @@ class InheritanceDiagram(object):
|
||||
if self.main_class is not None:
|
||||
filename = self.main_class.name
|
||||
else:
|
||||
dummy, filename = Wx2Sphinx(self.specials[0])
|
||||
dummy, filename = wx2Sphinx(self.specials[0])
|
||||
|
||||
outfn = os.path.join(static_root, filename + '_inheritance.png')
|
||||
mapfile = outfn + '.map'
|
||||
|
||||
@@ -12,8 +12,8 @@ else:
|
||||
|
||||
from inspect import getmro, getclasstree, getdoc, getcomments
|
||||
|
||||
from .utilities import MakeSummary, ChopDescription, WriteSphinxOutput, PickleFile
|
||||
from .utilities import FindControlImages, FormatExternalLink, IsPython3
|
||||
from .utilities import makeSummary, chopDescription, writeSphinxOutput, PickleFile
|
||||
from .utilities import findControlImages, formatExternalLink, isPython3
|
||||
from .constants import object_types, MODULE_TO_ICON, DOXY_2_REST, SPHINXROOT
|
||||
from . import templates
|
||||
|
||||
@@ -79,16 +79,16 @@ def generic_summary(libraryItem, stream):
|
||||
if item.is_redundant:
|
||||
continue
|
||||
|
||||
item_docs = ReplaceWxDot(item.docs)
|
||||
item_docs = KillEpydoc(item, item_docs)
|
||||
docs = ChopDescription(item_docs)
|
||||
item_docs = replaceWxDot(item.docs)
|
||||
item_docs = killEpydoc(item, item_docs)
|
||||
docs = chopDescription(item_docs)
|
||||
table.append((item.name, docs))
|
||||
|
||||
if item.kind != object_types.FUNCTION:
|
||||
toctree += ' %s\n'%item.name
|
||||
|
||||
if table:
|
||||
summary = MakeSummary(libraryItem.name, table, templ[index], refs[index], add_tilde[index])
|
||||
summary = makeSummary(libraryItem.name, table, templ[index], refs[index], add_tilde[index])
|
||||
stream.write(summary)
|
||||
|
||||
if toctree and write_toc:
|
||||
@@ -96,12 +96,12 @@ def generic_summary(libraryItem, stream):
|
||||
stream.write('\n\n')
|
||||
|
||||
|
||||
def MakeSphinxFile(name):
|
||||
def makeSphinxFile(name):
|
||||
|
||||
return os.path.join(os.getcwd(), 'docs', 'sphinx', '%s.txt'%name)
|
||||
|
||||
|
||||
def ReplaceWxDot(text):
|
||||
def replaceWxDot(text):
|
||||
|
||||
# Double ticks with 'wx.' in them
|
||||
text = re.sub(r'``wx\.(.*?)``', r'``\1`` ', text)
|
||||
@@ -167,13 +167,13 @@ def GetTopLevelParent(klass):
|
||||
return parents[-2]
|
||||
|
||||
|
||||
def FindInHierarchy(klass, newlink):
|
||||
def findInHierarchy(klass, newlink):
|
||||
|
||||
library = GetTopLevelParent(klass)
|
||||
return library.FindItem(newlink)
|
||||
|
||||
|
||||
def FindBestLink(klass, newlink):
|
||||
def findBestLink(klass, newlink):
|
||||
|
||||
parent_class = klass.parent
|
||||
|
||||
@@ -195,7 +195,7 @@ def FindBestLink(klass, newlink):
|
||||
else:
|
||||
return ':attr:`~%s`'%child.name
|
||||
|
||||
full_loop = FindInHierarchy(klass, newlink)
|
||||
full_loop = findInHierarchy(klass, newlink)
|
||||
|
||||
if full_loop:
|
||||
return full_loop
|
||||
@@ -203,7 +203,7 @@ def FindBestLink(klass, newlink):
|
||||
return ':ref:`%s`'%newlink
|
||||
|
||||
|
||||
def KillEpydoc(klass, newtext):
|
||||
def killEpydoc(klass, newtext):
|
||||
|
||||
epydocs = re.findall(EPYDOC_PATTERN, newtext)
|
||||
|
||||
@@ -256,7 +256,7 @@ def KillEpydoc(klass, newtext):
|
||||
newlink = '``%s``'%newlink
|
||||
else:
|
||||
# Try and reference it
|
||||
bestlink = FindBestLink(klass, newlink)
|
||||
bestlink = findBestLink(klass, newlink)
|
||||
if bestlink:
|
||||
newlink = bestlink
|
||||
|
||||
@@ -406,7 +406,7 @@ class Library(ParentBase):
|
||||
self.obj_type = 'Library'
|
||||
self.python_version = ''
|
||||
|
||||
self.sphinx_file = MakeSphinxFile(name)
|
||||
self.sphinx_file = makeSphinxFile(name)
|
||||
self.base_name = name
|
||||
|
||||
|
||||
@@ -489,13 +489,13 @@ class Library(ParentBase):
|
||||
header = templates.TEMPLATE_DESCRIPTION%(self.base_name, self.base_name)
|
||||
stream.write(header)
|
||||
|
||||
newtext = ReplaceWxDot(self.docs)
|
||||
newtext = KillEpydoc(self, newtext)
|
||||
newtext = replaceWxDot(self.docs)
|
||||
newtext = killEpydoc(self, newtext)
|
||||
|
||||
stream.write(newtext + '\n\n')
|
||||
|
||||
generic_summary(self, stream)
|
||||
WriteSphinxOutput(stream, self.sphinx_file)
|
||||
writeSphinxOutput(stream, self.sphinx_file)
|
||||
|
||||
|
||||
def ClassesToPickle(self, obj, class_dict):
|
||||
@@ -512,7 +512,7 @@ class Library(ParentBase):
|
||||
if child.is_redundant:
|
||||
continue
|
||||
|
||||
class_dict[child.name] = (child.method_list, child.bases, ChopDescription(child.docs))
|
||||
class_dict[child.name] = (child.method_list, child.bases, chopDescription(child.docs))
|
||||
|
||||
# recursively scan other folders, appending results
|
||||
class_dict = self.ClassesToPickle(child, class_dict)
|
||||
@@ -538,7 +538,7 @@ class Module(ParentBase):
|
||||
ParentBase.__init__(self, name, kind)
|
||||
|
||||
self.filename = ''
|
||||
self.sphinx_file = MakeSphinxFile(name)
|
||||
self.sphinx_file = makeSphinxFile(name)
|
||||
|
||||
if kind == object_types.PACKAGE:
|
||||
self.obj_type = 'Package'
|
||||
@@ -574,8 +574,8 @@ class Module(ParentBase):
|
||||
|
||||
stream.write(header)
|
||||
|
||||
newtext = ReplaceWxDot(self.docs)
|
||||
newtext = KillEpydoc(self, newtext)
|
||||
newtext = replaceWxDot(self.docs)
|
||||
newtext = killEpydoc(self, newtext)
|
||||
|
||||
stream.write(newtext + '\n\n')
|
||||
|
||||
@@ -589,7 +589,7 @@ class Module(ParentBase):
|
||||
if self.kind != object_types.PACKAGE:
|
||||
print(('%s - %s (module)'%(spacer, self.name)))
|
||||
if self.inheritance_diagram:
|
||||
png, map = self.inheritance_diagram.MakeInheritanceDiagram(class_summary)
|
||||
png, map = self.inheritance_diagram.makeInheritanceDiagram(class_summary)
|
||||
short_name = self.GetShortName()
|
||||
image_desc = templates.TEMPLATE_INHERITANCE % ('module', short_name, png, short_name, map)
|
||||
stream.write(image_desc)
|
||||
@@ -614,7 +614,7 @@ class Module(ParentBase):
|
||||
continue
|
||||
fun.Write(stream)
|
||||
|
||||
WriteSphinxOutput(stream, self.sphinx_file)
|
||||
writeSphinxOutput(stream, self.sphinx_file)
|
||||
|
||||
|
||||
def Save(self):
|
||||
@@ -691,7 +691,7 @@ class Class(ParentBase):
|
||||
|
||||
self.order = 3
|
||||
self.obj_type = 'Class'
|
||||
self.sphinx_file = MakeSphinxFile(name)
|
||||
self.sphinx_file = makeSphinxFile(name)
|
||||
|
||||
|
||||
def ToRest(self, class_summary):
|
||||
@@ -707,32 +707,32 @@ class Class(ParentBase):
|
||||
stream.write('.. currentmodule:: %s\n\n'%current_module)
|
||||
stream.write('.. highlight:: python\n\n')
|
||||
|
||||
class_docs = ReplaceWxDot(self.docs)
|
||||
class_docs = KillEpydoc(self, class_docs)
|
||||
class_docs = replaceWxDot(self.docs)
|
||||
class_docs = killEpydoc(self, class_docs)
|
||||
|
||||
header = templates.TEMPLATE_DESCRIPTION%(self.name, self.GetShortName())
|
||||
stream.write(header)
|
||||
stream.write(class_docs + '\n\n')
|
||||
|
||||
if self.inheritance_diagram:
|
||||
png, map = self.inheritance_diagram.MakeInheritanceDiagram(class_summary)
|
||||
png, map = self.inheritance_diagram.makeInheritanceDiagram(class_summary)
|
||||
short_name = self.GetShortName()
|
||||
image_desc = templates.TEMPLATE_INHERITANCE % ('class', short_name, png, short_name, map)
|
||||
stream.write(image_desc)
|
||||
|
||||
appearance = FindControlImages(self.name.lower())
|
||||
appearance = findControlImages(self.name.lower())
|
||||
if appearance:
|
||||
appearance_desc = templates.TEMPLATE_APPEARANCE % tuple(appearance)
|
||||
stream.write(appearance_desc + '\n\n')
|
||||
|
||||
if self.subClasses:
|
||||
subs = [FormatExternalLink(cls) for cls in self.subClasses]
|
||||
subs = [formatExternalLink(cls) for cls in self.subClasses]
|
||||
subs = ', '.join(subs)
|
||||
subs_desc = templates.TEMPLATE_SUBCLASSES % subs
|
||||
stream.write(subs_desc)
|
||||
|
||||
if self.superClasses:
|
||||
sups = [FormatExternalLink(cls) for cls in self.superClasses]
|
||||
sups = [formatExternalLink(cls) for cls in self.superClasses]
|
||||
sups = ', '.join(sups)
|
||||
sups_desc = templates.TEMPLATE_SUPERCLASSES % sups
|
||||
stream.write(sups_desc)
|
||||
@@ -757,7 +757,7 @@ class Class(ParentBase):
|
||||
for prop in properties:
|
||||
prop.Write(stream, short_name)
|
||||
|
||||
WriteSphinxOutput(stream, self.sphinx_file)
|
||||
writeSphinxOutput(stream, self.sphinx_file)
|
||||
self.bases = self.superClasses
|
||||
|
||||
|
||||
@@ -937,12 +937,12 @@ class Method(ChildrenBase):
|
||||
return
|
||||
|
||||
text = ''
|
||||
newdocs = ReplaceWxDot(self.docs)
|
||||
newdocs = replaceWxDot(self.docs)
|
||||
|
||||
for line in newdocs.splitlines(True):
|
||||
text += indent + line
|
||||
|
||||
text = KillEpydoc(self, text)
|
||||
text = killEpydoc(self, text)
|
||||
text += '\n\n\n'
|
||||
stream.write(text)
|
||||
|
||||
@@ -1002,7 +1002,7 @@ class Attribute(ChildrenBase):
|
||||
|
||||
def __init__(self, name, specs, value):
|
||||
|
||||
if IsPython3():
|
||||
if isPython3():
|
||||
specs = str(specs)
|
||||
else:
|
||||
specs = unicode(specs)
|
||||
|
||||
@@ -29,7 +29,7 @@ from .librarydescription import Method, Property, Attribute
|
||||
|
||||
from . import inheritance
|
||||
|
||||
from .utilities import IsPython3, PickleFile
|
||||
from .utilities import isPython3, PickleFile
|
||||
from .constants import object_types, EXCLUDED_ATTRS, MODULE_TO_ICON
|
||||
from .constants import CONSTANT_RE
|
||||
|
||||
@@ -156,7 +156,7 @@ def analyze_params(obj, signature):
|
||||
pvalue = pvalue.strip()
|
||||
if pname in pevals:
|
||||
try:
|
||||
if IsPython3():
|
||||
if isPython3():
|
||||
peval = str(pevals[pname])
|
||||
else:
|
||||
peval = unicode(pevals[pname])
|
||||
@@ -224,7 +224,7 @@ def inspect_source(method_class, obj, source):
|
||||
def is_classmethod(instancemethod):
|
||||
""" Determine if an instancemethod is a classmethod. """
|
||||
|
||||
attribute = (IsPython3() and ['__self__'] or ['im_self'] )[0]
|
||||
attribute = (isPython3() and ['__self__'] or ['im_self'])[0]
|
||||
|
||||
if hasattr(instancemethod, attribute):
|
||||
return getattr(instancemethod, attribute) is not None
|
||||
@@ -284,17 +284,17 @@ def describe_func(obj, parent_class, module_name):
|
||||
|
||||
try:
|
||||
if method in [object_types.METHOD, object_types.METHOD_DESCRIPTOR, object_types.INSTANCE_METHOD]:
|
||||
if IsPython3():
|
||||
if isPython3():
|
||||
code = obj.__func__.__code__
|
||||
else:
|
||||
code = obj.im_func.func_code
|
||||
elif method == object_types.STATIC_METHOD:
|
||||
if IsPython3():
|
||||
if isPython3():
|
||||
code = obj.__func__.__code__
|
||||
else:
|
||||
code = obj.im_func.func_code
|
||||
else:
|
||||
if IsPython3():
|
||||
if isPython3():
|
||||
obj.__code__
|
||||
else:
|
||||
code = obj.func_code
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Name: sphinxtools/postprocess.py
|
||||
# Author: Andrea Gavana
|
||||
@@ -20,7 +19,7 @@ import random
|
||||
from buildtools.config import copyIfNewer, writeIfChanged, newer, getVcsRev, textfile_open
|
||||
|
||||
from . import templates
|
||||
from .utilities import Wx2Sphinx, PickleFile
|
||||
from .utilities import wx2Sphinx, PickleFile
|
||||
from .constants import HTML_REPLACE, TODAY, SPHINXROOT, SECTIONS_EXCLUDE
|
||||
from .constants import CONSTANT_INSTANCES, WIDGETS_IMAGES_ROOT, SPHINX_IMAGES_ROOT
|
||||
from .constants import DOCSTRING_KEY
|
||||
@@ -28,7 +27,7 @@ from .constants import DOCSTRING_KEY
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
|
||||
def MakeHeadings():
|
||||
def makeHeadings():
|
||||
"""
|
||||
Generates the "headings.inc" file containing the substitution reference
|
||||
for the small icons used in the Sphinx titles, sub-titles and so on.
|
||||
@@ -60,7 +59,7 @@ def MakeHeadings():
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def SphinxIndexes(sphinxDir):
|
||||
def sphinxIndexes(sphinxDir):
|
||||
"""
|
||||
This is the main function called after the `etg` process has finished.
|
||||
|
||||
@@ -73,16 +72,16 @@ def SphinxIndexes(sphinxDir):
|
||||
|
||||
for file in pklfiles:
|
||||
if file.endswith('functions.pkl'):
|
||||
ReformatFunctions(file)
|
||||
reformatFunctions(file)
|
||||
elif 'classindex' in file:
|
||||
MakeClassIndex(sphinxDir, file)
|
||||
makeClassIndex(sphinxDir, file)
|
||||
|
||||
BuildEnumsAndMethods(sphinxDir)
|
||||
buildEnumsAndMethods(sphinxDir)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def BuildEnumsAndMethods(sphinxDir):
|
||||
def buildEnumsAndMethods(sphinxDir):
|
||||
"""
|
||||
This function does some clean-up/refactoring of the generated ReST files by:
|
||||
|
||||
@@ -140,8 +139,8 @@ def BuildEnumsAndMethods(sphinxDir):
|
||||
|
||||
text = newtext
|
||||
|
||||
text = FindInherited(input, class_summary, enum_base, text)
|
||||
text, unreferenced_classes = RemoveUnreferenced(input, class_summary, enum_base, unreferenced_classes, text)
|
||||
text = findInherited(input, class_summary, enum_base, text)
|
||||
text, unreferenced_classes = removeUnreferenced(input, class_summary, enum_base, unreferenced_classes, text)
|
||||
|
||||
text = text.replace('wx``', '``')
|
||||
text = text.replace('wx.``', '``')
|
||||
@@ -178,8 +177,8 @@ def BuildEnumsAndMethods(sphinxDir):
|
||||
# Remove lines with "Event macros" in them...
|
||||
text = text.replace('Event macros:', '')
|
||||
|
||||
text = TooltipsOnInheritance(text, class_summary)
|
||||
text = AddSpacesToLinks(text)
|
||||
text = tooltipsOnInheritance(text, class_summary)
|
||||
text = addSpacesToLinks(text)
|
||||
|
||||
if text != orig_text:
|
||||
fid = textfile_open(input, 'wt')
|
||||
@@ -218,7 +217,7 @@ def BuildEnumsAndMethods(sphinxDir):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def FindInherited(input, class_summary, enum_base, text):
|
||||
def findInherited(input, class_summary, enum_base, text):
|
||||
|
||||
# Malformed inter-links
|
||||
regex = re.findall(r'\S:meth:\S+', text)
|
||||
@@ -307,7 +306,7 @@ def FindInherited(input, class_summary, enum_base, text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def RemoveUnreferenced(input, class_summary, enum_base, unreferenced_classes, text):
|
||||
def removeUnreferenced(input, class_summary, enum_base, unreferenced_classes, text):
|
||||
|
||||
regex = re.findall(':ref:`(.*?)`', text)
|
||||
|
||||
@@ -342,7 +341,7 @@ def RemoveUnreferenced(input, class_summary, enum_base, unreferenced_classes, te
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def AddSpacesToLinks(text):
|
||||
def addSpacesToLinks(text):
|
||||
|
||||
regex = re.findall('\w:ref:`(.*?)`', text)
|
||||
|
||||
@@ -353,7 +352,7 @@ def AddSpacesToLinks(text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ReformatFunctions(file):
|
||||
def reformatFunctions(file):
|
||||
|
||||
text_file = os.path.splitext(file)[0] + '.txt'
|
||||
local_file = os.path.split(file)[1]
|
||||
@@ -407,7 +406,7 @@ def ReformatFunctions(file):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def MakeClassIndex(sphinxDir, file):
|
||||
def makeClassIndex(sphinxDir, file):
|
||||
|
||||
text_file = os.path.splitext(file)[0] + '.txt'
|
||||
local_file = os.path.split(file)[1]
|
||||
@@ -456,13 +455,13 @@ def MakeClassIndex(sphinxDir, file):
|
||||
out = classes[cls]
|
||||
if '=====' in out:
|
||||
out = ''
|
||||
text += '%-80s %s\n' % (':ref:`%s`' % Wx2Sphinx(cls)[1], out)
|
||||
text += '%-80s %s\n' % (':ref:`%s`' % wx2Sphinx(cls)[1], out)
|
||||
|
||||
text += 80*'=' + ' ' + 80*'=' + '\n\n'
|
||||
|
||||
contents = []
|
||||
for cls in names:
|
||||
contents.append(Wx2Sphinx(cls)[1])
|
||||
contents.append(wx2Sphinx(cls)[1])
|
||||
|
||||
for enum in enum_base:
|
||||
if enum.count('.') == enumDots:
|
||||
@@ -481,7 +480,7 @@ def MakeClassIndex(sphinxDir, file):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def GenGallery():
|
||||
def genGallery():
|
||||
|
||||
link = '<div class="gallery_class">'
|
||||
|
||||
@@ -545,7 +544,7 @@ def GenGallery():
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def AddPrettyTable(text):
|
||||
def addPrettyTable(text):
|
||||
""" Unused at the moment. """
|
||||
|
||||
newtext = """<br>
|
||||
@@ -566,7 +565,7 @@ def AddPrettyTable(text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ClassToFile(line):
|
||||
def classToFile(line):
|
||||
|
||||
if '–' not in line:
|
||||
return line
|
||||
@@ -592,7 +591,7 @@ def ClassToFile(line):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def AddJavaScript(text):
|
||||
def addJavaScript(text):
|
||||
|
||||
jsCode = """\
|
||||
<script>
|
||||
@@ -622,7 +621,7 @@ def AddJavaScript(text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def PostProcess(folder):
|
||||
def postProcess(folder):
|
||||
|
||||
fileNames = glob.glob(folder + "/*.html")
|
||||
|
||||
@@ -654,7 +653,7 @@ def PostProcess(folder):
|
||||
split = os.path.split(files)[1]
|
||||
|
||||
if split in ['index.html', 'main.html']:
|
||||
text = ChangeSVNRevision(text)
|
||||
text = changeSVNRevision(text)
|
||||
else:
|
||||
text = text.replace('class="headerimage"', 'class="headerimage-noshow"')
|
||||
|
||||
@@ -699,7 +698,7 @@ def PostProcess(folder):
|
||||
for old, new in list(enum_dict.items()):
|
||||
newtext = newtext.replace(old, new)
|
||||
|
||||
newtext = AddJavaScript(newtext)
|
||||
newtext = addJavaScript(newtext)
|
||||
|
||||
if orig_text != newtext:
|
||||
fid = open(files, "wt")
|
||||
@@ -709,14 +708,14 @@ def PostProcess(folder):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ChangeSVNRevision(text):
|
||||
def changeSVNRevision(text):
|
||||
REVISION = getVcsRev()
|
||||
text = text.replace('|TODAY|', TODAY)
|
||||
text = text.replace('|VCSREV|', REVISION)
|
||||
return text
|
||||
|
||||
|
||||
def TooltipsOnInheritance(text, class_summary):
|
||||
def tooltipsOnInheritance(text, class_summary):
|
||||
|
||||
graphviz = re.findall(r'<p class="graphviz">(.*?)</p>', text, re.DOTALL)
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ from .constants import DOXYROOT, SPHINXROOT, WIDGETS_IMAGES_ROOT
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
class odict(UserDict):
|
||||
|
||||
class ODict(UserDict):
|
||||
"""
|
||||
An ordered dict (odict). This is a dict which maintains an order to its items;
|
||||
the order is rather like that of a list, in that new items are, by default,
|
||||
@@ -105,7 +106,7 @@ class odict(UserDict):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def RemoveWxPrefix(name):
|
||||
def removeWxPrefix(name):
|
||||
"""
|
||||
Removes the `wx` prefix from a string.
|
||||
|
||||
@@ -129,7 +130,7 @@ def RemoveWxPrefix(name):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def IsNumeric(input_string):
|
||||
def isNumeric(input_string):
|
||||
"""
|
||||
Checks if the string `input_string` actually represents a number.
|
||||
|
||||
@@ -150,7 +151,7 @@ def IsNumeric(input_string):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def CountSpaces(text):
|
||||
def countSpaces(text):
|
||||
"""
|
||||
Counts the number of spaces before and after a string.
|
||||
|
||||
@@ -169,7 +170,7 @@ def CountSpaces(text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def Underscore2Capitals(string):
|
||||
def underscore2Capitals(string):
|
||||
"""
|
||||
Replaces the underscore letter in a string with the following letter capitalized.
|
||||
|
||||
@@ -189,7 +190,7 @@ def Underscore2Capitals(string):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ReplaceCppItems(line):
|
||||
def replaceCppItems(line):
|
||||
"""
|
||||
Replaces various C++ specific stuff with more Pythonized version of them.
|
||||
|
||||
@@ -233,7 +234,7 @@ def ReplaceCppItems(line):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def PythonizeType(ptype, is_param):
|
||||
def pythonizeType(ptype, is_param):
|
||||
"""
|
||||
Replaces various C++ specific stuff with more Pythonized version of them,
|
||||
for parameter lists and return types (i.e., the `:param:` and `:rtype:`
|
||||
@@ -251,7 +252,7 @@ def PythonizeType(ptype, is_param):
|
||||
elif 'wx.' in ptype:
|
||||
ptype = ptype[3:]
|
||||
else:
|
||||
ptype = Wx2Sphinx(ReplaceCppItems(ptype))[1]
|
||||
ptype = wx2Sphinx(replaceCppItems(ptype))[1]
|
||||
|
||||
ptype = ptype.replace('::', '.').replace('*&', '')
|
||||
ptype = ptype.replace('int const', 'int')
|
||||
@@ -263,7 +264,7 @@ def PythonizeType(ptype, is_param):
|
||||
ptype = ptype.replace(item, 'int')
|
||||
|
||||
ptype = ptype.strip()
|
||||
ptype = RemoveWxPrefix(ptype)
|
||||
ptype = removeWxPrefix(ptype)
|
||||
|
||||
if '. wx' in ptype:
|
||||
ptype = ptype.replace('. wx', '.')
|
||||
@@ -312,7 +313,7 @@ def PythonizeType(ptype, is_param):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ConvertToPython(text):
|
||||
def convertToPython(text):
|
||||
"""
|
||||
Converts the input `text` into a more ReSTified version of it.
|
||||
|
||||
@@ -344,7 +345,7 @@ def ConvertToPython(text):
|
||||
|
||||
spacer = ' '*(len(line) - len(line.lstrip()))
|
||||
|
||||
line = ReplaceCppItems(line)
|
||||
line = replaceCppItems(line)
|
||||
|
||||
for word in RE_KEEP_SPACES.split(line):
|
||||
|
||||
@@ -362,8 +363,8 @@ def ConvertToPython(text):
|
||||
continue
|
||||
|
||||
if newword not in IGNORE and not newword.startswith('wx.'):
|
||||
word = RemoveWxPrefix(word)
|
||||
newword = RemoveWxPrefix(newword)
|
||||
word = removeWxPrefix(word)
|
||||
newword = removeWxPrefix(newword)
|
||||
|
||||
if "::" in word and not word.endswith("::"):
|
||||
# Bloody SetCursorEvent...
|
||||
@@ -375,7 +376,7 @@ def ConvertToPython(text):
|
||||
|
||||
if newword.upper() == newword and newword not in PUNCTUATION and \
|
||||
newword not in IGNORE and len(newword.strip()) > 1 and \
|
||||
not IsNumeric(newword) and newword not in ['DC', 'GCDC']:
|
||||
not isNumeric(newword) and newword not in ['DC', 'GCDC']:
|
||||
|
||||
if '``' not in newword and '()' not in word and '**' not in word:
|
||||
word = word.replace(newword, "``%s``"%newword)
|
||||
@@ -396,7 +397,7 @@ def ConvertToPython(text):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def FindDescendants(element, tag, descendants=None):
|
||||
def findDescendants(element, tag, descendants=None):
|
||||
"""
|
||||
Finds and returns all descendants of a specific `xml.etree.ElementTree.Element`
|
||||
whose tag matches the input `tag`.
|
||||
@@ -420,14 +421,14 @@ def FindDescendants(element, tag, descendants=None):
|
||||
if childElement.tag == tag:
|
||||
descendants.append(childElement)
|
||||
|
||||
descendants = FindDescendants(childElement, tag, descendants)
|
||||
descendants = findDescendants(childElement, tag, descendants)
|
||||
|
||||
return descendants
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def FindControlImages(elementOrString):
|
||||
def findControlImages(elementOrString):
|
||||
"""
|
||||
Given the input `element` (an instance of `xml.etree.ElementTree.Element`
|
||||
or a plain string)
|
||||
@@ -457,15 +458,15 @@ def FindControlImages(elementOrString):
|
||||
class_name = py_class_name = elementOrString.lower()
|
||||
else:
|
||||
element = elementOrString
|
||||
class_name = RemoveWxPrefix(element.name) or element.pyName
|
||||
py_class_name = Wx2Sphinx(class_name)[1]
|
||||
class_name = removeWxPrefix(element.name) or element.pyName
|
||||
py_class_name = wx2Sphinx(class_name)[1]
|
||||
|
||||
class_name = class_name.lower()
|
||||
py_class_name = py_class_name.lower()
|
||||
|
||||
image_folder = os.path.join(DOXYROOT, 'images')
|
||||
|
||||
appearance = odict()
|
||||
appearance = ODict()
|
||||
|
||||
for sub_folder in ['wxmsw', 'wxmac', 'wxgtk']:
|
||||
|
||||
@@ -504,7 +505,7 @@ def FindControlImages(elementOrString):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def MakeSummary(class_name, item_list, template, kind, add_tilde=True):
|
||||
def makeSummary(class_name, item_list, template, kind, add_tilde=True):
|
||||
"""
|
||||
This function generates a table containing a method/property name
|
||||
and a shortened version of its docstrings.
|
||||
@@ -564,7 +565,7 @@ def MakeSummary(class_name, item_list, template, kind, add_tilde=True):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def WriteSphinxOutput(stream, filename, append=False):
|
||||
def writeSphinxOutput(stream, filename, append=False):
|
||||
"""
|
||||
Writes the text contained in the `stream` to the `filename` output file.
|
||||
|
||||
@@ -586,7 +587,7 @@ def WriteSphinxOutput(stream, filename, append=False):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def ChopDescription(text):
|
||||
def chopDescription(text):
|
||||
"""
|
||||
Given the (possibly multiline) input text, this function will get the
|
||||
first non-blank line up to the next newline character.
|
||||
@@ -641,7 +642,7 @@ class PickleFile(object):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def PickleItem(description, current_module, name, kind):
|
||||
def pickleItem(description, current_module, name, kind):
|
||||
"""
|
||||
This function pickles/unpickles a dictionary containing class names as keys
|
||||
and class brief description (chopped docstrings) as values to build the
|
||||
@@ -669,7 +670,7 @@ def PickleItem(description, current_module, name, kind):
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def PickleClassInfo(class_name, element, short_description):
|
||||
def pickleClassInfo(class_name, element, short_description):
|
||||
"""
|
||||
Saves some information about a class in a pickle-compatible file., i.e. the
|
||||
list of methods in that class and its super-classes.
|
||||
@@ -684,7 +685,7 @@ def PickleClassInfo(class_name, element, short_description):
|
||||
method_list.append(method)
|
||||
|
||||
for base in element.bases:
|
||||
bases.append(Wx2Sphinx(base)[1])
|
||||
bases.append(wx2Sphinx(base)[1])
|
||||
|
||||
pickle_file = os.path.join(SPHINXROOT, 'class_summary.lst')
|
||||
with PickleFile(pickle_file) as pf:
|
||||
@@ -698,10 +699,9 @@ def PickleClassInfo(class_name, element, short_description):
|
||||
# many items added on the fly to try and keep track of them separately. We
|
||||
# can add the module name to the saved data while in the etg/generator stage.
|
||||
|
||||
global ALL_ITEMS
|
||||
ALL_ITEMS = {}
|
||||
|
||||
def Class2Module():
|
||||
def class2Module():
|
||||
|
||||
global ALL_ITEMS
|
||||
|
||||
@@ -719,7 +719,7 @@ def Class2Module():
|
||||
|
||||
for item in module.ITEMS:
|
||||
|
||||
item = RemoveWxPrefix(item)
|
||||
item = removeWxPrefix(item)
|
||||
ALL_ITEMS[item] = current_module
|
||||
|
||||
ALL_ITEMS.update(NO_MODULE)
|
||||
@@ -727,7 +727,7 @@ def Class2Module():
|
||||
return ALL_ITEMS
|
||||
|
||||
|
||||
def Wx2Sphinx(name):
|
||||
def wx2Sphinx(name):
|
||||
"""
|
||||
Converts a wxWidgets specific string into a Phoenix-ReST-ready string.
|
||||
|
||||
@@ -738,7 +738,7 @@ def Wx2Sphinx(name):
|
||||
name = name[0:name.index('<')]
|
||||
|
||||
name = name.strip()
|
||||
newname = fullname = RemoveWxPrefix(name)
|
||||
newname = fullname = removeWxPrefix(name)
|
||||
|
||||
if '.' in newname and len(newname) > 3:
|
||||
lookup, remainder = newname.split('.')
|
||||
@@ -747,7 +747,7 @@ def Wx2Sphinx(name):
|
||||
lookup = newname
|
||||
remainder = ''
|
||||
|
||||
all_items = Class2Module()
|
||||
all_items = class2Module()
|
||||
if lookup in all_items:
|
||||
fullname = all_items[lookup] + lookup + remainder
|
||||
|
||||
@@ -772,7 +772,7 @@ RAW_2 = """
|
||||
|
||||
"""
|
||||
|
||||
def FormatContributedSnippets(kind, contrib_snippets):
|
||||
def formatContributedSnippets(kind, contrib_snippets):
|
||||
"""
|
||||
This method will include and properly ReST-ify contributed snippets
|
||||
of wxPython code (at the moment only 2 snippets are available), by
|
||||
@@ -821,7 +821,7 @@ def FormatContributedSnippets(kind, contrib_snippets):
|
||||
return text
|
||||
|
||||
|
||||
def FormatExternalLink(fullname, inheritance=False):
|
||||
def formatExternalLink(fullname, inheritance=False):
|
||||
"""
|
||||
Analyzes the input `fullname` string to check whether a class description
|
||||
is actually coming from an external documentation tool
|
||||
@@ -872,7 +872,7 @@ def FormatExternalLink(fullname, inheritance=False):
|
||||
return full_page
|
||||
|
||||
|
||||
def IsPython3():
|
||||
def isPython3():
|
||||
""" Returns ``True`` if we are using Python 3.x. """
|
||||
|
||||
return sys.version_info >= (3, )
|
||||
|
||||
Reference in New Issue
Block a user