eric3.Debugger.Cyclops.HTMLCyclops

Module implementing an HTML variant of Tim Peters cyclops.

Classes

CycleFinderHTML Class for finding cycles in Python data structures.
_CyclopsHTMLRepr A class to make short HTML representations of objects.

Functions

find_declarer Function to find the declarer of an attribute.
replaceLT Function to replace less than character by their HTML entity.

CycleFinderHTML

Class for finding cycles in Python data structures.

See Cyclops module description for details.

Derived from

Cyclops.CycleFinder

Methods

CycleFinderHTML Create a cycle finder with empty root set.
_add_section Method to add a section to the report.
_print_cycle Method to print a cycle.
_print_separator Method to add a separator to the report.
add_stat_line Method to add a statistics line to the report.
get_page Method to retrieve the report.
iterate_til_steady_state Method to purge dead root sets until a steady state is reached.
show_arcs compare=None -> print unique arc types in cycles.
show_chased_types Method to add a list of installed chasers to the report.
show_cycleobjs compare=typename_address_cmp -> print all objects in cycles.
show_cycles Print all cycles to stdout.
show_obj obj -> print short description of obj to sdtout.
show_sccs compare=typename_address_cmp -> print SCCs.
show_stats Print statistics for the last run of find_cycles.
stats_list Method to generate a list of statistics.

CycleFinderHTML (Constructor)

CycleFinderHTML()

Create a cycle finder with empty root set.

CycleFinderHTML._add_section

_add_section(name, text, docs = '')

Method to add a section to the report.

docs
text to be shown
name
anchor name
text
link text to be shown

CycleFinderHTML._print_cycle

_print_cycle(slice)

Method to print a cycle.

CycleFinderHTML._print_separator

_print_separator()

Method to add a separator to the report.

CycleFinderHTML.add_stat_line

add_stat_line(desc, value)

Method to add a statistics line to the report.

desc
description
value
value to be shown

CycleFinderHTML.get_page

get_page()

Method to retrieve the report.

Returns:
report as a string

CycleFinderHTML.iterate_til_steady_state

iterate_til_steady_state(show_objs = 0, summary = 1)

Method to purge dead root sets until a steady state is reached.

show_objs
flag indicating objects should be shown
summary
flag indicating a summary should be added to the report

CycleFinderHTML.show_arcs

show_arcs(compare=None)

compare=None -> print unique arc types in cycles.

See module docstring for details. Briefly, each arc in a cycle is categorized by the type of the source node, the kind of arc (how we got from the source to the destination), and the type of the destination node. Each line of output consists of those three pieces of info preceded by the count of arcs of that kind. By default, the rows are sorted first by column 2 (source node type), then by columns 3 and 4.

CycleFinderHTML.show_chased_types

show_chased_types()

Method to add a list of installed chasers to the report.

CycleFinderHTML.show_cycleobjs

show_cycleobjs(compare=Cyclops.typename_address_cmp)

compare=typename_address_cmp -> print all objects in cycles.

Prints to stdout. Each distinct object find_cycles found in a cycle is displayed. The set of objects found in cycles is first sorted by the optional "compare" function. By default, objects are sorted using their type name as the primary key and their storage address (id) as the secondary key; among objects of instance type, sorts by the instances' class names; among objects of class type, sorts by the classes' names.

CycleFinderHTML.show_cycles

show_cycles()

Print all cycles to stdout.

CycleFinderHTML.show_obj

show_obj(obj)

obj -> print short description of obj to sdtout.

This is of the form

<address> rc:<refcount> <typename>
repr: <shortrepr>

where

<address>
hex address of obj
<refcount>
If find_cycles() has been run and obj is in the root set or was found in a cycle, this is the number of references outstanding less the number held internally by CycleFinder. In most cases, this is what the true refcount would be had you not used CycleFinder at all. You can screw that up, e.g. by installing a cycle filter that holds on to references to one or more cycle elements. If find_cycles() has not been run, or has but obj wasn't found in a cycle and isn't in the root set, is "?".
<typename>
type(obj), as a string. If obj.__class__ exists, also prints the class name.
<shortrepr>
repr(obj), but using a variant of the std module repr.py that limits the number of characters displayed.

CycleFinderHTML.show_sccs

show_sccs(compare=Cyclops.typename_address_cmp)

compare=typename_address_cmp -> print SCCs.

Prints to stdout. Shows the objects in cycles partitioned into strongly connected components (that is, the largest groupings possible such that each object in an SCC is reachable from every other object in that SCC). Within each SCC, objects are sorted as for show_cycleobjs.

CycleFinderHTML.show_stats

show_stats(stats_list, name = 'Stats', title = 'Statistics')

Print statistics for the last run of find_cycles.

CycleFinderHTML.stats_list

stats_list()

Method to generate a list of statistics.

Returns:
statistics (list of description, value tuples)

Up

_CyclopsHTMLRepr

A class to make short HTML representations of objects. The std repr.repr sorts dicts by keys, but we refer to the keys via numeric subscript in cycle reports, so first a derived class that leaves dicts in raw order. Also, instances, instance methods and classes frequently appear in cycle reports, so avoid chopping their reprs at all. We're only trying to prevent massive expense for massive lists, tuples & dicts.

Derived from

_repr.Repr

Methods

_CyclopsHTMLRepr Constructor
repr_class Method overriding the base class formatter.
repr_dictionary Method overriding the base dictionary formatter.
repr_instance Method overriding the base instance formatter.

_CyclopsHTMLRepr (Constructor)

_CyclopsHTMLRepr()

Constructor

_CyclopsHTMLRepr.repr_class

repr_class(x, level)

Method overriding the base class formatter.

level
level of detail
x
class object to be shown
Returns:
string representation of the class object

_CyclopsHTMLRepr.repr_dictionary

repr_dictionary(x, level)

Method overriding the base dictionary formatter.

level
level of detail
x
dictionary to be shown
Returns:
string representation of the dictionary

_CyclopsHTMLRepr.repr_instance

repr_instance(x, level)

Method overriding the base instance formatter.

level
level of detail
x
instance object to be shown
Returns:
string representation of the instance object

Up

find_declarer

find_declarer(cls, attr, found = 0)

Function to find the declarer of an attribute.

attr
attribute to look for
cls
class to start search from
found
flag indicating if already found
Returns:
tuple of flag indicating found status and class declaring the attribute
Up

replaceLT

replaceLT(str)

Function to replace less than character by their HTML entity.

str
string to be changed
Returns:
string with lt encoded
Up