text:
<!doctype html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />

    <title>pythongis.app.tk2.texteditor(old) API documentation</title>
    <meta name="description" content="The SuperText class inherits from Tkinter's Text class and provides added
functionality to a standar..." />

  <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300' rel='stylesheet' type='text/css'>

Top

Index

Classes

        Text

__init__

after

after_cancel

after_idle

after_thread

apply_theme

bbox

bell

bind

bind_all

bind_class

bind_dnddrop

bind_draggable

bind_once

bind_rightclick

bind_until

bindtags

cget

clear_highlights

clipboard_append

clipboard_clear

clipboard_get

colormodel

columnconfigure

compare

config

configure

debug

delete

deletecommand

destroy

dlineinfo

drag_follow

drag_mark

dump

edit

edit_modified

edit_redo

edit_reset

edit_separator

edit_undo

event_add

event_delete

event_generate

event_info

focus

focus_displayof

focus_force

focus_get

focus_lastfor

focus_set

forget

get

getboolean

getvar

grab_current

grab_release

grab_set

grab_set_global

grab_status

grid

grid_bbox

grid_columnconfigure

grid_configure

grid_forget

grid_info

grid_location

grid_propagate

grid_remove

grid_rowconfigure

grid_size

grid_slaves

highlight_pattern

image_cget

image_configure

image_create

image_names

image_types

index

info

insert

jitter

keys

lift

location

lower

mainloop

mark_gravity

mark_names

mark_next

mark_previous

mark_set

mark_unset

move

move_to

nametowidget

new_thread

next_pattern

option_add

option_clear

option_get

option_readfile

pack

pack_configure

pack_forget

pack_info

pack_propagate

pack_slaves

place

place_configure

place_forget

place_info

place_slaves

prev_pattern

process_thread

propagate

quit

register

rowconfigure

scan_dragto

scan_mark

search

see

selection_clear

selection_get

selection_handle

selection_own

selection_own_get

send

setvar

size

slaves

tag_add

tag_bind

tag_cget

tag_config

tag_configure

tag_delete

tag_lower

tag_names

tag_nextrange

tag_prevrange

tag_raise

tag_ranges

tag_remove

tag_unbind

tk_bisque

tk_focusFollowsMouse

tk_focusNext

tk_focusPrev

tk_menuBar

tk_setPalette

tk_strictMotif

tk_textBackspace

tk_textIndexCloser

tk_textResetAnchor

tk_textSelectTo

tkraise

unbind

unbind_all

unbind_class

unbind_dnddrop

unbind_draggable

unbind_rightclick

update

update_idletasks

wait_variable

wait_visibility

wait_window

waitvar

window_cget

window_config

window_configure

window_create

window_names

winfo_atom

winfo_atomname

winfo_cells

winfo_children

winfo_class

winfo_colormapfull

winfo_containing

winfo_depth

winfo_exists

winfo_fpixels

winfo_geometry

winfo_height

winfo_id

winfo_interps

winfo_ismapped

winfo_manager

winfo_name

winfo_parent

winfo_pathname

winfo_pixels

winfo_pointerx

winfo_pointerxy

winfo_pointery

winfo_reqheight

winfo_reqwidth

winfo_rgb

winfo_rootx

winfo_rooty

winfo_screen

winfo_screencells

winfo_screendepth

winfo_screenheight

winfo_screenmmheight

winfo_screenmmwidth

winfo_screenvisual

winfo_screenwidth

winfo_server

winfo_toplevel

winfo_viewable

winfo_visual

winfo_visualid

winfo_visualsavailable

winfo_vrootheight

winfo_vrootwidth

winfo_vrootx

winfo_vrooty

winfo_width

winfo_x

winfo_y

xview

xview_moveto

xview_scroll

yview

yview_moveto

yview_pickplace

yview_scroll

pythongis.app.tk2.texteditor(old) module

The SuperText class inherits from Tkinter's Text class and provides added
functionality to a standard text widget:

Option to turn scrollbar on/off

Right-click pop-up menu

Two themes included (terminal and typewriter)

Compliant with Python 2.5-2.7

Author: @ifthisthenbreak
http://code.activestate.com/recipes/578897-supertext-scrollable-text-with-pop-up-menu-and-the/

Classes

class Text

Ancestors (in MRO)

Text

pythongis.app.tk2.mixins.AllMixins

pythongis.app.tk2.mixins.DnDMixin

pythongis.app.tk2.mixins.DispatchMixin

pythongis.app.tk2.mixins.AnimMixin

pythongis.app.tk2.mixins.BindMixin

__builtin__.object

Tkinter.Text

Tkinter.Widget

Tkinter.BaseWidget

Tkinter.Misc

Tkinter.Pack

Tkinter.Place

Tkinter.Grid

Tkinter.XView

Tkinter.YView

Methods

def __init__(

self, parent, scrollbar=True, **kw)

def after(

self, ms, func=None, *args)

Call function once after given time.

MS specifies the time in milliseconds. FUNC gives the
function which shall be called. Additional parameters
are given as parameters to the function call.  Return
identifier to cancel scheduling with after_cancel.

def after_cancel(

self, id)

Cancel scheduling of function identified with ID.

Identifier returned by after or after_idle must be
given as first parameter.

def after_idle(

self, func, *args)

Call FUNC once if the Tcl main loop has no event to
process.

Return an identifier to cancel the scheduling with
after_cancel.

def after_thread(

self, thread, task, args=(), kwargs={}, mslag=100, msinterval=100)

def apply_theme(

self, theme='standard')

theme=['standard', 'typewriter', 'terminal']

def bbox(

self, *args)

Return a tuple of (x,y,width,height) which gives the bounding
box of the visible part of the character at the index in ARGS.

def bell(

self, displayof=0)

Ring a display's bell.

def bind(

self, eventtype, eventfunc, add=None, bindname=None)

def bind_all(

self, sequence=None, func=None, add=None)

Bind to all widgets at an event SEQUENCE a call to function FUNC.
An additional boolean parameter ADD specifies whether FUNC will
be called additionally to the other bound function or whether
it will replace the previous function. See bind for the return value.

def bind_class(

self, className, sequence=None, func=None, add=None)

Bind to widgets with bindtag CLASSNAME at event
SEQUENCE a call of function FUNC. An additional
boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or
whether it will replace the previous function. See bind for
the return value.

def bind_dnddrop(

self, callback, dndtype, event='<Drop>', priority=50)

dndtype is either Files or Text.

def bind_draggable(

self)

def bind_once(

self, eventtype, eventfunc, add=None)

def bind_rightclick(

self, menuitems)

menuitems can be a sequence or a function for dynamic listing

def bind_until(

self, eventtype, eventfunc, add=None, bindname=None, untilevent=None, untilexpires=None)

def bindtags(

self, tagList=None)

Set or get the list of bindtags for this widget.

With no argument return the list of all bindtags associated with
this widget. With a list of strings as argument the bindtags are
set to this list. The bindtags determine in which order events are
processed (see bind).

def cget(

self, key)

Return the resource value for a KEY given as string.

def clear_highlights(

self)

def clipboard_append(

self, string, **kw)

Append STRING to the Tk clipboard.

A widget specified at the optional displayof keyword
argument specifies the target display. The clipboard
can be retrieved with selection_get.

def clipboard_clear(

self, **kw)

Clear the data in the Tk clipboard.

A widget specified for the optional displayof keyword
argument specifies the target display.

def clipboard_get(

self, **kw)

Retrieve data from the clipboard on window's display.

The window keyword defaults to the root window of the Tkinter
application.

The type keyword specifies the form in which the data is
to be returned and should be an atom name such as STRING
or FILE_NAME.  Type defaults to STRING, except on X11, where the default
is to try UTF8_STRING and fall back to STRING.

This command is equivalent to:

selection_get(CLIPBOARD)

def colormodel(

self, value=None)

Useless. Not implemented in Tk.

def columnconfigure(

self, index, cnf={}, **kw)

Configure column INDEX of a grid.

Valid resources are minsize (minimum size of the column),
weight (how much does additional space propagate to this column)
and pad (how much space to let additionally).

def compare(

self, index1, op, index2)

Return whether between index INDEX1 and index INDEX2 the
relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.

def config(

self, cnf=None, **kw)

Configure resources of a widget.

The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method keys.

def configure(

self, cnf=None, **kw)

Configure resources of a widget.

The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method keys.

def debug(

self, boolean=None)

Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN.

def delete(

self, index1, index2=None)

Delete the characters between INDEX1 and INDEX2 (not included).

def deletecommand(

self, name)

Internal function.

Delete the Tcl command provided in NAME.

def destroy(

self)

Destroy this and all descendants widgets.

def dlineinfo(

self, index)

Return tuple (x,y,width,height,baseline) giving the bounding box
and baseline position of the visible part of the line containing
the character at INDEX.

def drag_follow(

self, event)

def drag_mark(

self, event)

def dump(

self, index1, index2=None, command=None, **kw)

Return the contents of the widget between index1 and index2.

The type of contents returned in filtered based on the keyword
parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are
given and true, then the corresponding items are returned. The result
is a list of triples of the form (key, value, index). If none of the
keywords are true then 'all' is used by default.

If the 'command' argument is given, it is called once for each element
of the list of triples, with the values of each triple serving as the
arguments to the function. In this case the list is not returned.

def edit(

self, *args)

Internal method

This method controls the undo mechanism and
the modified flag. The exact behavior of the
command depends on the option argument that
follows the edit argument. The following forms
of the command are currently supported:

edit_modified, edit_redo, edit_reset, edit_separator
and edit_undo

def edit_modified(

self, arg=None)

Get or Set the modified flag

If arg is not specified, returns the modified
flag of the widget. The insert, delete, edit undo and
edit redo commands or the user can set or clear the
modified flag. If boolean is specified, sets the
modified flag of the widget to arg.

def edit_redo(

self)

Redo the last undone edit

When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false.

def edit_reset(

self)

Clears the undo and redo stacks

def edit_separator(

self)

Inserts a separator (boundary) on the undo stack.

Does nothing when the undo option is false

def edit_undo(

self)

Undoes the last edit action

If the undo option is true. An edit action is defined
as all the insert and delete commands that are recorded
on the undo stack in between two separators. Generates
an error when the undo stack is empty. Does nothing
when the undo option is false

def event_add(

self, virtual, *sequences)

Bind a virtual event VIRTUAL (of the form <<Name>>)
to an event SEQUENCE such that the virtual event is triggered
whenever SEQUENCE occurs.

def event_delete(

self, virtual, *sequences)

Unbind a virtual event VIRTUAL from SEQUENCE.

def event_generate(

self, sequence, **kw)

Generate an event SEQUENCE. Additional
keyword arguments specify parameter of the event
(e.g. x, y, rootx, rooty).

def event_info(

self, virtual=None)

Return a list of all virtual events or the information
about the SEQUENCE bound to the virtual event VIRTUAL.

def focus(

self)

Direct input focus to this widget.

If the application currently does not have the focus
this widget will get the focus if the application gets
the focus through the window manager.

def focus_displayof(

self)

Return the widget which has currently the focus on the
display where this widget is located.

Return None if the application does not have the focus.

def focus_force(

self)

Direct input focus to this widget even if the
application does not have the focus. Use with
caution!

def focus_get(

self)

Return the widget which has currently the focus in the
application.

Use focus_displayof to allow working with several
displays. Return None if application does not have
the focus.

def focus_lastfor(

self)

Return the widget which would have the focus if top level
for this widget gets the focus from the window manager.

def focus_set(

self)

Direct input focus to this widget.

If the application currently does not have the focus
this widget will get the focus if the application gets
the focus through the window manager.

def forget(

self)

Unmap this widget and do not use it for the packing order.

def get(

self, index1, index2=None)

Return the text from INDEX1 to INDEX2 (not included).

def getboolean(

self, s)

Return a boolean value for Tcl boolean values true and false given as parameter.

def getvar(

self, name='PY_VAR')

Return value of Tcl variable NAME.

def grab_current(

self)

Return widget which has currently the grab in this application
or None.

def grab_release(

self)

Release grab for this widget if currently set.

def grab_set(

self)

Set grab for this widget.

A grab directs all events to this and descendant
widgets in the application.

def grab_set_global(

self)

Set global grab for this widget.

A global grab directs all events to this and
descendant widgets on the display. Use with caution -
other applications do not get events anymore.

def grab_status(

self)

Return None, "local" or "global" if this widget has
no, a local or a global grab.

def grid(

self, cnf={}, **kw)

Position a widget in the parent widget in a grid. Use as options:
column=number - use cell identified with given column (starting with 0)
columnspan=number - this widget will span several columns
in=master - use master to contain this widget
in_=master - see 'in' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
row=number - use cell identified with given row (starting with 0)
rowspan=number - this widget will span several rows
sticky=NSEW - if cell is larger on which sides will this
              widget stick to the cell boundary

def grid_bbox(

self, column=None, row=None, col2=None, row2=None)

Return a tuple of integer coordinates for the bounding
box of this widget controlled by the geometry manager grid.

If COLUMN, ROW is given the bounding box applies from
the cell with row and column 0 to the specified
cell. If COL2 and ROW2 are given the bounding box
starts at that cell.

The returned integers specify the offset of the upper left
corner in the master widget and the width and height.

def grid_columnconfigure(

self, index, cnf={}, **kw)

Configure column INDEX of a grid.

Valid resources are minsize (minimum size of the column),
weight (how much does additional space propagate to this column)
and pad (how much space to let additionally).

def grid_configure(

self, cnf={}, **kw)

Position a widget in the parent widget in a grid. Use as options:
column=number - use cell identified with given column (starting with 0)
columnspan=number - this widget will span several columns
in=master - use master to contain this widget
in_=master - see 'in' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
row=number - use cell identified with given row (starting with 0)
rowspan=number - this widget will span several rows
sticky=NSEW - if cell is larger on which sides will this
              widget stick to the cell boundary

def grid_forget(

self)

Unmap this widget.

def grid_info(

self)

Return information about the options
for positioning this widget in a grid.

def grid_location(

self, x, y)

Return a tuple of column and row which identify the cell
at which the pixel at position X and Y inside the master
widget is located.

def grid_propagate(

self, flag=['_noarg_'])

Set or get the status for propagation of geometry information.

A boolean argument specifies whether the geometry information
of the slaves will determine the size of this widget. If no argument
is given, the current setting will be returned.

def grid_remove(

self)

Unmap this widget but remember the grid options.

def grid_rowconfigure(

self, index, cnf={}, **kw)

Configure row INDEX of a grid.

Valid resources are minsize (minimum size of the row),
weight (how much does additional space propagate to this row)
and pad (how much space to let additionally).

def grid_size(

self)

Return a tuple of the number of column and rows in the grid.

def grid_slaves(

self, row=None, column=None)

Return a list of all slaves of this widget
in its packing order.

def highlight_pattern(

self, pattern, tag, start='1.0', end='end', regexp=False, nocase=True, exact=True, **kwargs)

Apply the given tag to all text that matches the given pattern

If 'regexp' is set to True, pattern will be treated as a regular
expression.

From: http://stackoverflow.com/questions/3781670/how-to-highlight-text-in-a-tkinter-text-widget

def image_cget(

self, index, option)

Return the value of OPTION of an embedded image at INDEX.

def image_configure(

self, index, cnf=None, **kw)

Configure an embedded image at INDEX.

def image_create(

self, index, cnf={}, **kw)

Create an embedded image at INDEX.

def image_names(

self)

Return all names of embedded images in this widget.

def image_types(

self)

Return a list of all available image types (e.g. photo bitmap).

def index(

self, index)

Return the index in the form line.char for INDEX.

def info(

self)

Return information about the packing options
for this widget.

def insert(

self, index, chars, *args)

Insert CHARS before the characters at INDEX. An additional
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.

def jitter(

self, movepixels=3, frequency=0.0002, duration=0.5, pindown=True)

Jitters/shakes the widget for a certain duration.

movepixels: maximum pixels to randomly shake from base position

frequency: how much time in comma seconds in between each shake movement

duration: how long in seconds the jitter should last

pindown: whether to center the jittering around the widget's original starting point or to let it jitter freely and end up in a new location

def keys(

self)

Return a list of all resource names of this widget.

def lift(

self, aboveThis=None)

Raise this widget in the stacking order.

def location(

self, x, y)

Return a tuple of column and row which identify the cell
at which the pixel at position X and Y inside the master
widget is located.

def lower(

self, belowThis=None)

Lower this widget in the stacking order.

def mainloop(

self, n=0)

Call the mainloop of Tk.

def mark_gravity(

self, markName, direction=None)

Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
Return the current value if None is given for DIRECTION.

def mark_names(

self)

Return all mark names.

def mark_next(

self, index)

Return the name of the next mark after INDEX.

def mark_previous(

self, index)

Return the name of the previous mark before INDEX.

def mark_set(

self, markName, index)

Set mark MARKNAME before the character at INDEX.

def mark_unset(

self, *markNames)

Delete all marks in MARKNAMES.

def move(

self, xmove, ymove, **kwargs)

def move_to(

self, endx, endy, speed='not specified', accel='not specified', deaccel='not specified', effect='not specified')

Gradually moves a widget in a direct line towards endxy pixel coordinates.
None of the options besides endxy are currently working.
Note: requires that the widget uses a place manager (not pack or grid)

endxy: the end coordinate towards which to move the widget

speed: full speed pixels per ms

accel: 0 to 100 percentage speed buildup per ms

deaccel: 0 to 100 percentage speed lowering per ms

effect: some added effect to use on startup and slowdown (eg wobbly jello, shake)

def nametowidget(

self, name)

Return the Tkinter instance of a widget identified by
its Tcl name NAME.

def new_thread(

self, task, args=(), kwargs={})

def next_pattern(

self, pattern, current, regexp=False, nocase=True, exact=True, **kwargs)

def option_add(

self, pattern, value, priority=None)

Set a VALUE (second parameter) for an option
PATTERN (first parameter).

An optional third parameter gives the numeric priority
(defaults to 80).

def option_clear(

self)

Clear the option database.

It will be reloaded if option_add is called.

def option_get(

self, name, className)

Return the value for an option NAME for this widget
with CLASSNAME.

Values with higher priority override lower values.

def option_readfile(

self, fileName, priority=None)

Read file FILENAME into the option database.

An optional second parameter gives the numeric
priority.

def pack(

self, cnf={}, **kw)

Pack a widget in the parent widget. Use as options:
after=widget - pack it after you have packed widget
anchor=NSEW (or subset) - position widget according to
                          given direction
before=widget - pack it before you will pack widget
expand=bool - expand widget if parent size grows
fill=NONE or X or Y or BOTH - fill widget if widget grows
in=master - use master to contain this widget
in_=master - see 'in' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.

def pack_configure(

self, cnf={}, **kw)

Pack a widget in the parent widget. Use as options:
after=widget - pack it after you have packed widget
anchor=NSEW (or subset) - position widget according to
                          given direction
before=widget - pack it before you will pack widget
expand=bool - expand widget if parent size grows
fill=NONE or X or Y or BOTH - fill widget if widget grows
in=master - use master to contain this widget
in_=master - see 'in' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
side=TOP or BOTTOM or LEFT or RIGHT -  where to add this widget.

def pack_forget(

self)

Unmap this widget and do not use it for the packing order.

def pack_info(

self)

Return information about the packing options
for this widget.

def pack_propagate(

self, flag=['_noarg_'])

Set or get the status for propagation of geometry information.

A boolean argument specifies whether the geometry information
of the slaves will determine the size of this widget. If no argument
is given the current setting will be returned.

def pack_slaves(

self)

Return a list of all slaves of this widget
in its packing order.

def place(

self, cnf={}, **kw)

Place a widget in the parent widget. Use as options:
in=master - master relative to which the widget is placed
in_=master - see 'in' option description
x=amount - locate anchor of this widget at position x of master
y=amount - locate anchor of this widget at position y of master
relx=amount - locate anchor of this widget between 0.0 and 1.0
              relative to width of master (1.0 is right edge)
rely=amount - locate anchor of this widget between 0.0 and 1.0
              relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction
width=amount - width of this widget in pixel
height=amount - height of this widget in pixel
relwidth=amount - width of this widget between 0.0 and 1.0
                  relative to width of master (1.0 is the same width
                  as the master)
relheight=amount - height of this widget between 0.0 and 1.0
                   relative to height of master (1.0 is the same
                   height as the master)
bordermode="inside" or "outside" - whether to take border width of
                                   master widget into account

def place_configure(

self, cnf={}, **kw)

Place a widget in the parent widget. Use as options:
in=master - master relative to which the widget is placed
in_=master - see 'in' option description
x=amount - locate anchor of this widget at position x of master
y=amount - locate anchor of this widget at position y of master
relx=amount - locate anchor of this widget between 0.0 and 1.0
              relative to width of master (1.0 is right edge)
rely=amount - locate anchor of this widget between 0.0 and 1.0
              relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction
width=amount - width of this widget in pixel
height=amount - height of this widget in pixel
relwidth=amount - width of this widget between 0.0 and 1.0
                  relative to width of master (1.0 is the same width
                  as the master)
relheight=amount - height of this widget between 0.0 and 1.0
                   relative to height of master (1.0 is the same
                   height as the master)
bordermode="inside" or "outside" - whether to take border width of
                                   master widget into account

def place_forget(

self)

Unmap this widget.

def place_info(

self)

Return information about the placing options
for this widget.

def place_slaves(

self)

Return a list of all slaves of this widget
in its packing order.

def prev_pattern(

self, pattern, current, regexp=False, nocase=True, exact=True, **kwargs)

def process_thread(

self, thread, func, mslag=100, msinterval=100)

def propagate(

self, flag=['_noarg_'])

Set or get the status for propagation of geometry information.

A boolean argument specifies whether the geometry information
of the slaves will determine the size of this widget. If no argument
is given the current setting will be returned.

def quit(

self)

Quit the Tcl interpreter. All widgets will be destroyed.

def register(

self, func, subst=None, needcleanup=1)

Return a newly created Tcl function. If this
function is called, the Python function FUNC will
be executed. An optional function SUBST can
be given which will be executed before FUNC.

def rowconfigure(

self, index, cnf={}, **kw)

Configure row INDEX of a grid.

Valid resources are minsize (minimum size of the row),
weight (how much does additional space propagate to this row)
and pad (how much space to let additionally).

def scan_dragto(

self, x, y)

Adjust the view of the text to 10 times the
difference between X and Y and the coordinates given in
scan_mark.

def scan_mark(

self, x, y)

Remember the current X, Y coordinates.

def search(

self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None, elide=None)

Search PATTERN beginning from INDEX until STOPINDEX.
Return the index of the first character of a match or an
empty string.

def see(

self, index)

Scroll such that the character at INDEX is visible.

def selection_clear(

self, **kw)

Clear the current X selection.

def selection_get(

self, **kw)

Return the contents of the current X selection.

A keyword parameter selection specifies the name of
the selection and defaults to PRIMARY.  A keyword
parameter displayof specifies a widget on the display
to use. A keyword parameter type specifies the form of data to be
fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
before STRING.

def selection_handle(

self, command, **kw)

Specify a function COMMAND to call if the X
selection owned by this widget is queried by another
application.

This function must return the contents of the
selection. The function will be called with the
arguments OFFSET and LENGTH which allows the chunking
of very long selections. The following keyword
parameters can be provided:
selection - name of the selection (default PRIMARY),
type - type of the selection (e.g. STRING, FILE_NAME).

def selection_own(

self, **kw)

Become owner of X selection.

A keyword parameter selection specifies the name of
the selection (default PRIMARY).

def selection_own_get(

self, **kw)

Return owner of X selection.

The following keyword parameter can
be provided:
selection - name of the selection (default PRIMARY),
type - type of the selection (e.g. STRING, FILE_NAME).

def send(

self, interp, cmd, *args)

Send Tcl command CMD to different interpreter INTERP to be executed.

def setvar(

self, name='PY_VAR', value='1')

Set Tcl variable NAME to VALUE.

def size(

self)

Return a tuple of the number of column and rows in the grid.

def slaves(

self)

Return a list of all slaves of this widget
in its packing order.

def tag_add(

self, tagName, index1, *args)

Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
Additional pairs of indices may follow in ARGS.

def tag_bind(

self, tagName, sequence, func, add=None)

Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.

An additional boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or whether it will
replace the previous function. See bind for the return value.

def tag_cget(

self, tagName, option)

Return the value of OPTION for tag TAGNAME.

def tag_config(

self, tagName, cnf=None, **kw)

Configure a tag TAGNAME.

def tag_configure(

self, tagName, cnf=None, **kw)

Configure a tag TAGNAME.

def tag_delete(

self, *tagNames)

Delete all tags in TAGNAMES.

def tag_lower(

self, tagName, belowThis=None)

Change the priority of tag TAGNAME such that it is lower
than the priority of BELOWTHIS.

def tag_names(

self, index=None)

Return a list of all tag names.

def tag_nextrange(

self, tagName, index1, index2=None)

Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched forward from INDEX1.

def tag_prevrange(

self, tagName, index1, index2=None)

Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched backwards from INDEX1.

def tag_raise(

self, tagName, aboveThis=None)

Change the priority of tag TAGNAME such that it is higher
than the priority of ABOVETHIS.

def tag_ranges(

self, tagName)

Return a list of ranges of text which have tag TAGNAME.

def tag_remove(

self, tagName, index1, index2=None)

Remove tag TAGNAME from all characters between INDEX1 and INDEX2.

def tag_unbind(

self, tagName, sequence, funcid=None)

Unbind for all characters with TAGNAME for event SEQUENCE  the
function identified with FUNCID.

def tk_bisque(

self)

Change the color scheme to light brown as used in Tk 3.6 and before.

def tk_focusFollowsMouse(

self)

The widget under mouse will get automatically focus. Can not
be disabled easily.

def tk_focusNext(

self)

Return the next widget in the focus order which follows
widget which has currently the focus.

The focus order first goes to the next child, then to
the children of the child recursively and then to the
next sibling which is higher in the stacking order.  A
widget is omitted if it has the takefocus resource set
to 0.

def tk_focusPrev(

self)

Return previous widget in the focus order. See tk_focusNext for details.

def tk_menuBar(

self, *args)

Do not use. Needed in Tk 3.6 and earlier.

def tk_setPalette(

self, *args, **kw)

Set a new color scheme for all widget elements.

A single color as argument will cause that all colors of Tk
widget elements are derived from this.
Alternatively several keyword parameters and its associated
colors can be given. The following keywords are valid:
activeBackground, foreground, selectColor,
activeForeground, highlightBackground, selectBackground,
background, highlightColor, selectForeground,
disabledForeground, insertBackground, troughColor.

def tk_strictMotif(

self, boolean=None)

Set Tcl internal variable, whether the look and feel
should adhere to Motif.

A parameter of 1 means adhere to Motif (e.g. no color
change if mouse passes over slider).
Returns the set value.

def tk_textBackspace(

self)

def tk_textIndexCloser(

self, a, b, c)

def tk_textResetAnchor(

self, index)

def tk_textSelectTo(

self, index)

def tkraise(

self, aboveThis=None)

Raise this widget in the stacking order.

def unbind(

self, eventtype, bindid)

def unbind_all(

self, sequence)

Unbind for all widgets for event SEQUENCE all functions.

def unbind_class(

self, className, sequence)

Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE
all functions.

def unbind_dnddrop(

self)

def unbind_draggable(

self)

def unbind_rightclick(

self)

def update(

self)

Enter event loop until all pending events have been processed by Tcl.

def update_idletasks(

self)

Enter event loop until all idle callbacks have been called. This
will update the display of windows but not process events caused by
the user.

def wait_variable(

self, name='PY_VAR')

Wait until the variable is modified.

A parameter of type IntVar, StringVar, DoubleVar or
BooleanVar must be given.

def wait_visibility(

self, window=None)

Wait until the visibility of a WIDGET changes
(e.g. it appears).

If no parameter is given self is used.

def wait_window(

self, window=None)

Wait until a WIDGET is destroyed.

If no parameter is given self is used.

def waitvar(

self, name='PY_VAR')

Wait until the variable is modified.

A parameter of type IntVar, StringVar, DoubleVar or
BooleanVar must be given.

def window_cget(

self, index, option)

Return the value of OPTION of an embedded window at INDEX.

def window_config(

self, index, cnf=None, **kw)

Configure an embedded window at INDEX.

def window_configure(

self, index, cnf=None, **kw)

Configure an embedded window at INDEX.

def window_create(

self, index, cnf={}, **kw)

Create a window at INDEX.

def window_names(

self)

Return all names of embedded windows in this widget.

def winfo_atom(

self, name, displayof=0)

Return integer which represents atom NAME.

def winfo_atomname(

self, id, displayof=0)

Return name of atom with identifier ID.

def winfo_cells(

self)

Return number of cells in the colormap for this widget.

def winfo_children(

self)

Return a list of all widgets which are children of this widget.

def winfo_class(

self)

Return window class name of this widget.

def winfo_colormapfull(

self)

Return true if at the last color request the colormap was full.

def winfo_containing(

self, rootX, rootY, displayof=0)

Return the widget which is at the root coordinates ROOTX, ROOTY.

def winfo_depth(

self)

Return the number of bits per pixel.

def winfo_exists(

self)

Return true if this widget exists.

def winfo_fpixels(

self, number)

Return the number of pixels for the given distance NUMBER
(e.g. "3c") as float.

def winfo_geometry(

self)

Return geometry string for this widget in the form "widthxheight+X+Y".

def winfo_height(

self)

Return height of this widget.

def winfo_id(

self)

Return identifier ID for this widget.

def winfo_interps(

self, displayof=0)

Return the name of all Tcl interpreters for this display.

def winfo_ismapped(

self)

Return true if this widget is mapped.

def winfo_manager(

self)

Return the window manager name for this widget.

def winfo_name(

self)

Return the name of this widget.

def winfo_parent(

self)

Return the name of the parent of this widget.

def winfo_pathname(

self, id, displayof=0)

Return the pathname of the widget given by ID.

def winfo_pixels(

self, number)

Rounded integer value of winfo_fpixels.

def winfo_pointerx(

self)

Return the x coordinate of the pointer on the root window.

def winfo_pointerxy(

self)

Return a tuple of x and y coordinates of the pointer on the root window.

def winfo_pointery(

self)

Return the y coordinate of the pointer on the root window.

def winfo_reqheight(

self)

Return requested height of this widget.

def winfo_reqwidth(

self)

Return requested width of this widget.

def winfo_rgb(

self, color)

Return tuple of decimal values for red, green, blue for
COLOR in this widget.

def winfo_rootx(

self)

Return x coordinate of upper left corner of this widget on the
root window.

def winfo_rooty(

self)

Return y coordinate of upper left corner of this widget on the
root window.

def winfo_screen(

self)

Return the screen name of this widget.

def winfo_screencells(

self)

Return the number of the cells in the colormap of the screen
of this widget.

def winfo_screendepth(

self)

Return the number of bits per pixel of the root window of the
screen of this widget.

def winfo_screenheight(

self)

Return the number of pixels of the height of the screen of this widget
in pixel.

def winfo_screenmmheight(

self)

Return the number of pixels of the height of the screen of
this widget in mm.

def winfo_screenmmwidth(

self)

Return the number of pixels of the width of the screen of
this widget in mm.

def winfo_screenvisual(

self)

Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the default
colormodel of this screen.

def winfo_screenwidth(

self)

Return the number of pixels of the width of the screen of
this widget in pixel.

def winfo_server(

self)

Return information of the X-Server of the screen of this widget in
the form "XmajorRminor vendor vendorVersion".

def winfo_toplevel(

self)

Return the toplevel widget of this widget.

def winfo_viewable(

self)

Return true if the widget and all its higher ancestors are mapped.

def winfo_visual(

self)

Return one of the strings directcolor, grayscale, pseudocolor,
staticcolor, staticgray, or truecolor for the
colormodel of this widget.

def winfo_visualid(

self)

Return the X identifier for the visual for this widget.

def winfo_visualsavailable(

self, includeids=0)

Return a list of all visuals available for the screen
of this widget.

Each item in the list consists of a visual name (see winfo_visual), a
depth and if INCLUDEIDS=1 is given also the X identifier.

def winfo_vrootheight(

self)

Return the height of the virtual root window associated with this
widget in pixels. If there is no virtual root window return the
height of the screen.

def winfo_vrootwidth(

self)

Return the width of the virtual root window associated with this
widget in pixel. If there is no virtual root window return the
width of the screen.

def winfo_vrootx(

self)

Return the x offset of the virtual root relative to the root
window of the screen of this widget.

def winfo_vrooty(

self)

Return the y offset of the virtual root relative to the root
window of the screen of this widget.

def winfo_width(

self)

Return the width of this widget.

def winfo_x(

self)

Return the x coordinate of the upper left corner of this widget
in the parent.

def winfo_y(

self)

Return the y coordinate of the upper left corner of this widget
in the parent.

def xview(

self, *args)

Query and change the horizontal position of the view.

def xview_moveto(

self, fraction)

Adjusts the view in the window so that FRACTION of the
total width of the canvas is off-screen to the left.

def xview_scroll(

self, number, what)

Shift the x-view according to NUMBER which is measured in "units"
or "pages" (WHAT).

def yview(

self, *args)

Query and change the vertical position of the view.

def yview_moveto(

self, fraction)

Adjusts the view in the window so that FRACTION of the
total height of the canvas is off-screen to the top.

def yview_pickplace(

self, *what)

Obsolete function, use see.

def yview_scroll(

self, number, what)

Shift the y-view according to NUMBER which is measured in
"units" or "pages" (WHAT).

      Documentation generated by
      pdoc 0.3.2

pdoc is in the public domain with the
      UNLICENSE

Design by Kailash Nadh

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace Lodestone;

use Codeception\TestCase\Test;
use Lodestone\Exception;
use Lodestone\Exception\BadFunctionCallException;
use Lodestone\Exception\BadMethodCallException;
use Lodestone\Exception\DomainException;
use Lodestone\Exception\InvalidArgumentException;
use Lodestone\Exception\InvalidCallException;
use Lodestone\Exception\InvalidConfigException;
use Lodestone\Exception\InvalidParamException;
use Lodestone\Exception\JSONParseException;
use Lodestone\Exception\LengthException;
use Lodestone\Exception\LogicException;
use Lodestone\Exception\NotSupportedException;
use Lodestone\Exception\OutOfBoundsException;
use Lodestone\Exception\OutOfRangeException;
use Lodestone\Exception\OverflowException;
use Lodestone\Exception\RangeException;
use Lodestone\Exception\RuntimeException;
use Lodestone\Exception\UnderflowException;
use Lodestone\Exception\UnexpectedValueException;
use Lodestone\Exception\UnknownMethodException;
use Lodestone\Exception\UnknownPropertyException;

class ExceptionTest extends Test
{

    /**
     * @var \UnitTester
     */
    protected $tester;
    /**
     * @var array
     */
    protected $_arrName = [
        TestException::THROW_BAD_FUNCTION_CALL => 'Lodestone\Exception\BadFunctionCallException',
        TestException::THROW_BAD_METHOD_CALL => 'Lodestone\Exception\BadMethodCallException',
        TestException::THROW_DOMAIN => 'Lodestone\Exception\DomainException',
        TestException::THROW_INVALID_ARGUMENT => 'Lodestone\Exception\InvalidArgumentException',
        TestException::THROW_INVALID_CALL => 'Lodestone\Exception\InvalidCallException',
        TestException::THROW_INVALID_CONFIG => 'Lodestone\Exception\InvalidConfigException',
        TestException::THROW_INVALID_PARAM => 'Lodestone\Exception\InvalidParamException',
        TestException::THROW_LENGTH => 'Lodestone\Exception\LengthException',
        TestException::THROW_LOGIC => 'Lodestone\Exception\LogicException',
        TestException::THROW_NOT_SUPPORTED => 'Lodestone\Exception\NotSupportedException',
        TestException::THROW_OUT_OF_BOUNDS => 'Lodestone\Exception\OutOfBoundsException',
        TestException::THROW_OUT_OF_RANGE => 'Lodestone\Exception\OutOfRangeException',
        TestException::THROW_OVERFLOW => 'Lodestone\Exception\OverflowException',
        TestException::THROW_RANGE => 'Lodestone\Exception\RangeException',
        TestException::THROW_RUNTIME => 'Lodestone\Exception\RuntimeException',
        TestException::THROW_UNDERFLOW => 'Lodestone\Exception\UnderflowException',
        TestException::THROW_UNEXPECTED_VALUE => 'Lodestone\Exception\UnexpectedValueException',
        TestException::THROW_UNKNOWN_METHOD => 'Lodestone\Exception\UnknownMethodException',
        TestException::THROW_UNKNOWN_PROPERTY => 'Lodestone\Exception\UnknownPropertyException',
        TestException::THROW_JSON_PARSE_EXCEPTION => 'Lodestone\Exception\JSONParseException',
        TestException::THROW_ERROR_EXCEPTION => 'Lodestone\ErrorException',
        TestException::THROW_EXCEPTION => 'Lodestone\Exception',
        TestException::THROW_DEFAULT => '\Exception',
    ];

    protected function _before()
    {
    }

    protected function _after()
    {
    }

    /**
     * @expectedException \Lodestone\Exception\BadFunctionCallException
     */
    public function testThrow_例外スロー_BadFunctionCallExceptionが返る()
    {
        $o = new TestException(TestException::THROW_BAD_FUNCTION_CALL);
        unset($o);
    }

    /**
     * @expectedException \Lodestone\Exception\BadFunctionCallException
     * @expectedExceptionMessage 1 is an invalid parameter
     */
    public function testThrow_例外スロー_BadFunctionCallExceptionに渡したメッセージが返る()
    {
        $o = new TestException(TestException::THROW_BAD_FUNCTION_CALL);
        unset($o);
    }

    /**
     * @expectedException \Lodestone\Exception\BadFunctionCallException
     * @expectedExceptionMessage 1 is an invalid parameter
     * @expectedExceptionCode 1
     */
    public function testThrow_例外スロー_BadFunctionCallExceptionに設定したコードが返る()
    {
        $o = new TestException(TestException::THROW_BAD_FUNCTION_CALL);
        unset($o);
    }

    /**
     * @cover BadMethodCallException
     */
    public function testException_例外名_getNameの戻り値に設定した文字列が返る()
    {
        $e = new BadMethodCallException('BadMethodCallException');
        $this->assertEquals(
            "Bad Method Call Exception.",
            $e->getName()
        );
    }

    /**
     * getName()戻り値テスト
     */
    public function testThrow_BadFunctionCallException_getNameに設定したメッセージが返る()
    {
        try {
            $o = new TestException(TestException::THROW_BAD_FUNCTION_CALL);
        } Catch (BadFunctionCallException $e) {
            $this->assertEquals(
                "Bad Function Call Exception.",
                $e->getName()
            );
        }
        unset($o);
    }

    public function testException_lException_例外名が返る()
    {
        $e = new Exception('test');

        $this->assertEquals(
            "Exception.",
            $e->getName()
        );
    }

    public function testException_BadMethodCallException_例外名が返る()
    {
        $e = new BadMethodCallException('test');

        $this->assertEquals(
            "Bad Method Call Exception.",
            $e->getName()
        );
    }

    public function testException_DomainException_例外名が返る()
    {
        $e = new DomainException('test');

        $this->assertEquals(
            "Domain Exception.",
            $e->getName()
        );
    }

    public function testException_ArgumentException_例外名が返る()
    {
        $e = new InvalidArgumentException('test');

        $this->assertEquals(
            "Invalid Argument Exception.",
            $e->getName()
        );
    }

    public function testException_InvalidCallException_例外名が返る()
    {
        $e = new InvalidCallException('test');

        $this->assertEquals(
            "Invalid Call Exception.",
            $e->getName()
        );
    }

    public function testException_InvalidConfigException_例外名が返る()
    {
        $e = new InvalidConfigException('test');

        $this->assertEquals(
            "Invalid Config Exception.",
            $e->getName()
        );
    }

    public function testException_InvalidParamException_例外名が返る()
    {
        $e = new InvalidParamException('test');

        $this->assertEquals(
            "Invalid Param Exception.",
            $e->getName()
        );
    }

    public function testException_JSONParseException_例外名が返る()
    {
        $e = new JSONParseException('test');

        $this->assertEquals(
            "JSON Parse Exception.",
            $e->getName()
        );
    }

    public function testException_LengthException_例外名が返る()
    {
        $e = new LengthException('test');

        $this->assertEquals(
            "Length Exception.",
            $e->getName()
        );
    }

    public function testException_LogicException_例外名が返る()
    {
        $e = new LogicException('test');

        $this->assertEquals(
            "Logic Exception.",
            $e->getName()
        );
    }

    public function testException_NotSupportedException_例外名が返る()
    {
        $e = new NotSupportedException('test');

        $this->assertEquals(
            "Not Supported Exception.",
            $e->getName()
        );
    }

    public function testException_OutOfBoundsException_例外名が返る()
    {
        $e = new OutOfBoundsException('test');

        $this->assertEquals(
            "Out Of Bounds Exception.",
            $e->getName()
        );
    }

    public function testException_OutOfRangeException_例外名が返る()
    {
        $e = new OutOfRangeException('test');

        $this->assertEquals(
            "Out Of Range Exception.",
            $e->getName()
        );
    }

    public function testException_OverflowException_例外名が返る()
    {
        $e = new OverflowException('test');

        $this->assertEquals(
            "Overflow Exception.",
            $e->getName()
        );
    }

    public function testException_RangeException_例外名が返る()
    {
        $e = new RangeException('test');

        $this->assertEquals(
            "Range Exception.",
            $e->getName()
        );
    }

    public function testException_RuntimeException_例外名が返る()
    {
        $e = new RuntimeException('test');

        $this->assertEquals(
            "Runtime Exception.",
            $e->getName()
        );
    }

    public function testException_UnderflowException_例外名が返る()
    {
        $e = new UnderflowException('test');

        $this->assertEquals(
            "Underflow Exception.",
            $e->getName()
        );
    }

    public function testException_UnexpectedValueException_例外名が返る()
    {
        $e = new UnexpectedValueException('test');

        $this->assertEquals(
            "Unexpected Value Exception.",
            $e->getName()
        );
    }

    public function testException_UnknownMethodException_例外名が返る()
    {
        $e = new UnknownMethodException('test');

        $this->assertEquals(
            "Unknown Method Exception.",
            $e->getName()
        );
    }

    public function testException_UnknownPropertyException_例外名が返る()
    {
        $e = new UnknownPropertyException('test');

        $this->assertEquals(
            "Unknown Property Exception.",
            $e->getName()
        );
    }
    public function testException_ErrorException_例外名が返る()
    {
        $e = new ErrorException('test');

        $this->assertEquals(
            "Error Exception.",
            $e->getName()
        );
    }

    /**
     * まとめてテスト
     */
    public function testException_例外生成_期待通りの例外が返る()
    {
        foreach ($this->_arrName as $key => $value) {
            $this->setExpectedException(
                $value,
                "{$key} is an invalid parameter",
                $key
            );
            $o = new TestException($key);
            unset($o);
        }
    }

    /**
     * まとめてテスト
     */
    public function testException_例外生成_getName期待通りの文字列が返る()
    {
        foreach ($this->_arrName as $key => $value) {
            $o = new $value("{$key} is an invalid parameter");
            $this->assertEquals(
                "{$key} is an invalid parameter",
                $o->getMessage()
            );
        }
    }

    /**
     * まとめてテスト
     */
    public function testException_例外生成_期待通りの文字列が返る()
    {
        foreach ($this->_arrName as $key => $value) {
            $o = new $value("{$key} is an invalid parameter");
            echo $o;
            $actual = ob_get_contents();
            $this->assertEquals(
                1,
                preg_match("/{$key} is an invalid parameter/", $actual)
            );
        }
    }

    /**
     * __toString()戻り値テスト
     */
    public function testException_toString_クラスにセットしたメッセージが返る()
    {
        try {
            $o = new TestException(TestException::THROW_EXCEPTION);
        } Catch (Exception $e) {
            ob_start();
            echo $e;
            $actual = ob_get_clean();
        }
        unset($o);
        $this->assertEquals(
            1,
            preg_match('/Additional Information:/', $actual)
        );
    }
}

class TestException
{
    public $var;

    const THROW_NONE = 0;
    const THROW_BAD_FUNCTION_CALL = 1;
    const THROW_BAD_METHOD_CALL = 2;
    const THROW_DOMAIN = 3;
    const THROW_INVALID_ARGUMENT = 4;
    const THROW_INVALID_CALL = 5;
    const THROW_INVALID_CONFIG = 6;
    const THROW_INVALID_PARAM = 7;
    const THROW_LENGTH = 8;
    const THROW_LOGIC = 9;
    const THROW_NOT_SUPPORTED = 10;
    const THROW_OUT_OF_BOUNDS = 11;
    const THROW_OUT_OF_RANGE = 12;
    const THROW_OVERFLOW = 13;
    const THROW_RANGE = 14;
    const THROW_RUNTIME = 15;
    const THROW_UNDERFLOW = 16;
    const THROW_UNEXPECTED_VALUE = 17;
    const THROW_UNKNOWN_METHOD = 18;
    const THROW_UNKNOWN_PROPERTY = 19;
    const THROW_EXCEPTION = 20;
    const THROW_JSON_PARSE_EXCEPTION = 21;
    const THROW_ERROR_EXCEPTION = 21;
    const THROW_DEFAULT = 99;

    function __construct($value = self::THROW_NONE)
    {

        switch ($value) {
            case self::THROW_BAD_FUNCTION_CALL:
                throw new BadFunctionCallException('1 is an invalid parameter', ['custom'], 1);
                break;

            case self::THROW_BAD_METHOD_CALL:
                throw new DomainException('2 is an invalid parameter', ['custom'], 2);
                break;

            case self::THROW_DOMAIN:
                throw new BadMethodCallException('3 is an invalid parameter', ['custom'], 3);
                break;

            case self::THROW_INVALID_ARGUMENT:
                throw new InvalidArgumentException('4 is an invalid parameter', ['custom'], 4);
                break;

            case self::THROW_INVALID_CALL:
                throw new InvalidCallException('5 is an invalid parameter', ['custom'], 5);
                break;

            case self::THROW_INVALID_CONFIG:
                throw new InvalidConfigException('6 is an invalid parameter', ['custom'], 6);
                break;

            case self::THROW_INVALID_PARAM:
                throw new InvalidParamException('7 is an invalid parameter', ['custom'], 7);
                break;

            case self::THROW_LENGTH:
                throw new LengthException('8 is an invalid parameter', ['custom'], 8);
                break;

            case self::THROW_LOGIC:
                throw new LogicException('9 is an invalid parameter', ['custom'], 9);
                break;

            case self::THROW_NOT_SUPPORTED:
                throw new NotSupportedException('10 is an invalid parameter', ['custom'], 10);
                break;

            case self::THROW_OUT_OF_BOUNDS:
                throw new OutOfBoundsException('11 is an invalid parameter', ['custom'], 11);
                break;

            case self::THROW_OUT_OF_RANGE:
                throw new OutOfRangeException('12 is an invalid parameter', ['custom'], 12);
                break;

            case self::THROW_OVERFLOW:
                throw new OverflowException('13 is an invalid parameter', ['custom'], 13);
                break;

            case self::THROW_RANGE:
                throw new RangeException('14 is an invalid parameter', ['custom'], 14);
                break;

            case self::THROW_RUNTIME:
                throw new RuntimeException('15 is an invalid parameter', ['custom'], 15);
                break;

            case self::THROW_UNDERFLOW:
                throw new UnderflowException('16 is an invalid parameter', ['custom'], 16);
                break;

            case self::THROW_UNEXPECTED_VALUE:
                throw new UnexpectedValueException('17 is an invalid parameter', ['custom'], 17);
                break;

            case self::THROW_UNKNOWN_METHOD:
                throw new UnknownMethodException('18 is an invalid parameter', ['custom'], 18);
                break;

            case self::THROW_UNKNOWN_PROPERTY:
                throw new UnknownPropertyException('19 is an invalid parameter', ['custom'], 19);
                break;

            case self::THROW_EXCEPTION:
                throw new Exception('20 is an invalid parameter', ['custom'], 20);
                break;

            case self::THROW_JSON_PARSE_EXCEPTION:
                throw new JSONParseException('21 is an invalid parameter', ['custom'], 21);
                break;

            case self::THROW_ERROR_EXCEPTION:
                throw new ErrorException('22 is not allowed as a parameter', 22);
                break;

            case self::THROW_DEFAULT:
                throw new \Exception('99 is not allowed as a parameter', 99);
                break;

            default:
                $this->var = $value;
                break;
        }
    }
}


text:
// Copyright (c) 2011-2014, David H. Hovemeyer <david.hovemeyer@gmail.com>
// Copyright (c) 2014, Chris Ainsley <takapa@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package edu.ycp.cs.dh.acegwt.client.ace;

/**
 * A segment of a completion snippet
 */
public interface AceCompletionSnippetSegment {

    /**
     * Gets the escaped and prepared textual representation of this snippet segment (backslash and dollar are escaped in general and the dollar is used for certain special tokens)
     *
     * @param tabStopNumber the tab stop number
     * @return the prepared textual representation of this snippet segment
     */
    String getPreparedText(int tabStopNumber);
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Shape3D" inherits="Resource" version="4.0">
	<brief_description>
		Base class for all 3D shape resources.
	</brief_description>
	<description>
		Base class for all 3D shape resources. Nodes that inherit from this can be used as shapes for a [PhysicsBody3D] or [Area3D] objects.
	</description>
	<tutorials>
		<link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
	</tutorials>
	<methods>
	</methods>
	<members>
		<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
			The collision margin for the shape.
		</member>
	</members>
	<constants>
	</constants>
</class>


text:
from kervi.plugin.messaging.message_plugin import MessagePlugin
from kervi.config import Configuration
import kervi.spine as spine

class UserLogPlugin(MessagePlugin):
    def __init__(self, config, manager):
        MessagePlugin.__init__(self, "user_log", config, manager)
        #self._config = Configuration.messaging.channels.user_log
        self.spine = spine.Spine()

    @property
    def message_type(self):
        return "user_log"

    @property
    def address_based(self):
        return False

    def create_address(self, user):
        pass

    def send_message(self, addresses, subject, **kwargs):
        """"
        Adds a message to the user log.
        """
        persist = kwargs.get("persist", False)
        body = kwargs.get("body", None)
        data = kwargs.get("data", None)
        area = kwargs.get("area", None)
        source_id = kwargs.get("source_id", None)
        source_name = kwargs.get("source_name", None)
        log_type = kwargs.get("log_type", "information")
        level = kwargs.get("level", 3)
        timestamp = kwargs.get("timestamp", 0)
        self.spine.trigger_event("userLogMessage", None, {
            "source_id": source_id,
            "source_name": source_name,
            "area": area,
            "data": data,
            "level": level,
            "topic": subject,
            "body": body,
            "timestamp": timestamp,
            "type": log_type,
            "persist": persist
        })


text:
package com.ait.tooling.server.core.jmx.management;

import com.ait.tooling.server.core.logging.ICoreLoggingOperations;

public interface ICoreServerManager extends ICoreLoggingOperations
{
    public boolean isRunning();
}


text:
FOUNDATION_EXPORT CGFloat const SDUIViewControllerChannelViewHeight;
FOUNDATION_EXPORT CGFloat const SDUIViewControllerNavigationBarHeight;
FOUNDATION_EXPORT CGFloat const SDUIViewControllerTabBarHeight;

@interface SDRootViewController : UIViewController

@property (nonatomic, readonly, assign) BOOL haveSubViewsCanBehaveRefresh;

- (void)ConfigureNavigationBarButtonItems;

@end


text:
/*!
 *
 * A simple tween class using requestAnimationFrame
 *
 * @Tween
 * @author: kitajchuk
 *
 */
(function ( window, undefined ) {

"use strict";

var defaults = {
    ease: Easing.linear,
    duration: 600,
    from: 0,
    to: 0,
    delay: 0,
    update: function () {},
    complete: function () {}
};

/**
 *
 * Tween function
 * @constructor Tween
 * @requires raf
 * @requires Easing
 * @param {object} options Tween animation settings
 *

 *
duration - How long the tween will last

 *
from - Where to start the tween

 *
to - When to end the tween

 *
update - The callback on each iteration

 *
complete - The callback on end of animation

 *
ease - The easing function to use

 *
delay - How long to wait before animation

 *

 * @memberof! <global>
 *
 */
var Tween = function ( options ) {
    // Normalize options
    options = (options || {});

    // Normalize options
    for ( var i in defaults ) {
        if ( options[ i ] === undefined ) {
            options[ i ] = defaults[ i ];
        }
    }

    var tweenDiff = (options.to - options.from),
        startTime,
        rafTimer;

    function animate() {
        var animDiff = (Date.now() - startTime),
            tweenTo = (tweenDiff * options.ease( animDiff / options.duration )) + options.from;

        if ( typeof options.update === "function" ) {
            options.update( tweenTo );
        }

        if ( animDiff > options.duration ) {
            if ( typeof options.complete === "function" ) {
                options.complete( options.to );
            }

            cancelAnimationFrame( rafTimer );

            rafTimer = null;

            return false;
        }

        rafTimer = requestAnimationFrame( animate );
    }

    setTimeout(function () {
        startTime = Date.now();
        animate();

    }, options.delay );
};

// Expose
window.Tween = Tween;

})( window );
/*!
 *
 * A basic scrollto function without all the fuss
 *
 * @scroll2
 * @author: kitajchuk
 *
 */
(function ( window, undefined ) {

"use strict";

/**
 *
 * Window scroll2 function
 * @method scroll2
 * @requires Tween
 * @param {object} options Tween animation settings
 *

 *
duration - How long the tween will last

 *
complete - The callback on end of animation

 *
ease - The easing function to use

 *
x/y - The axis to tween, where its going to land

 *

 * @memberof! <global>
 *
 */
var scroll2 = function ( options ) {
    // Get current window positions
    var position = {
        x: (window.scrollX || document.documentElement.scrollLeft),
        y: (window.scrollY || document.documentElement.scrollTop)
    };

    // Normalize options
    options = (options || {});

    // Normalize easing method
    options.ease = (options.ease || Easing.swing);

    // Normalize duration
    options.duration = (options.duration || 600);

    // Normalize from
    options.from = ( options.y !== undefined ) ? position.y : position.x;

    // Normalize to
    options.to = ( options.y !== undefined ) ? options.y : options.x;

    // Apply update method
    options.update = function ( t ) {
        // Vertical scroll
        if ( options.y !== undefined ) {
            window.scrollTo( position.x, t );

        // Horizontal scroll
        } else if ( options.x !== undefined ) {
            window.scrollTo( t, position.y );
        }
    };

    return new Tween( options );
};

// Expose
window.scroll2 = scroll2;

})( window );


text:
Pattern: Assertion on the page state before taking a screenshot

Issue: -

## Description

If you take screenshots without assertions then you may get different screenshots depending on timing.

For example, if clicking a button makes some network calls and upon success, renders something, then the screenshot may sometimes have the new render and sometimes not.

This rule checks there is an assertion making sure your application state is correct before doing a screenshot. This makes sure the result of the screenshot will be consistent.

Example of **incorrect** code:

```js
cy.visit('myUrl');
cy.screenshot();
```

Example of **correct** code:

```js
cy.visit('myUrl');
cy.get('[data-test-id="my-element"]').should('be.visible');
cy.screenshot();
```


text:
extern const base::Feature kDownloadVcard;

#endif  // IOS_CHROME_BROWSER_UI_DOWNLOAD_FEATURES_H_


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>plugin_mmasgis: Class Members - Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css"/>

plugin_mmasgis

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

_

a

b

c

d

e

f

g

h

i

l

m

n

o

p

q

r

s

t

u

v

w

- n -

newButton
: mmasgis::Ui_anagrafica::Ui_MainWindowAnagrafica
, mmasgis::Ui_risultati::Ui_MainWindowResults

nextButton
: mmasgis::Ui_risultati::Ui_MainWindowResults
, mmasgis::Ui_anagrafica::Ui_MainWindowAnagrafica

nLayers
: mmasgis::copia di test::test
, mmasgis::mmasgis::mmasgis
, mmasgis::un'altra copia di test::test

nome
: mmasgis::entities::Regione
, mmasgis::entities::Comune
, mmasgis::entities::Provincia
, mmasgis::entities_sqlalchemy::Provincia
, mmasgis::sqlAlchemyQueryClass::Query

nome_comune
: mmasgis::entities_sqlalchemy::Comune

nome_provincia
: mmasgis::entities_sqlalchemy::Provincia

nome_regione
: mmasgis::entities_sqlalchemy::Regione

NomeQuery
: mmasgis::Ui_SaveQuery::Ui_SaveQueryWindow

note
: mmasgis::mysql_sqlalchemy_class::Pv

Note
: mmasgis::Ui_anagrafica_modificato::Ui_MainWindow

 All Classes Namespaces Files Functions Variables

<address class="footer">Generated on Tue Apr 17 2012 16:46:02 for plugin_mmasgis by

 1.7.3 </address>


text:
DateTimeKit is a Swift library that provides simple, easy-to-use date, time and timezone manipulation.  The ideas behind DateTimeKit are quite heavily influenced by the [JodaTime](http://www.joda.org/joda-time/) library.

DateTimeKit removes the dependence on `NSDate` and `NSCalendar` and provides a new set of objects in their place.

## Instant
An instant represents a moment on the datetime continuum. Under the covers, just like `NSDate`, it represents the number of milliseconds since the *reference date (1st Jan 2001)*.  It is totally independent of timezone.

```
let now = Instant()
println(now.description)   // 2015-03-18 05:13:43 +0000
```

## Zone
A zone is a representation of a specific timezone. It can be constructed using a timezone abbreviation, name or an absolute number of hours/minutes/seconds.

```
let sydneyZone = Zone("Australia/Sydney")!
let utcZone    = Zone.utc()
let randomZone = Zone("-12:46")!
```

## DateTime
A `DateTime` object is a combination of a specific `instant` and `zone`, and is generally what people perceive as a date and time based on their wall-clock in their specific time zone.

```
let now = Instant()

let sydneyZone = Zone("Australia/Sydney")!
let parisZone  = Zone("Europe/Paris")!

let sydneyTime = DateTime(now, sydneyZone)
println(sydneyTime)       // 2015-03-06 19:02:28.662 - Australia/Sydney (GMT+11) offset 39600 (Daylight)

let parisTime = sydneyTime.inZone(parisZone)
println(parisTime)        // 2015-03-06 09:02:28.662 - Europe/Paris (GMT+1) offset 3600
```

## Duration
A duration is a explicit length of time that can be measured in seconds (or part thereof). For example, 2 hours can be represented as 7200 seconds.

```
// current time in user's default timezone
let now = DateTime()
println(now)          // 2015-03-18 16:20:24.157 - Australia/Sydney (GMT+11) offset 39600 (Daylight)

let dt1 = now + Duration(7200)
println(dt1)          // 2015-03-18 18:20:24.157 - Australia/Sydney (GMT+11) offset 39600 (Daylight)"

let dt2 = now + 2.hours
println(dt2)          // 2015-03-18 18:20:24.157 - Australia/Sydney (GMT+11) offset 39600 (Daylight)"
```

## Period
A period is a conceptual length of time that may vary slightly depending on which date it is applied to. For example, the specific length of "2 months and 2 days" varies depending on what month it is being applied to.

```
// current time in user's default timezone
let now = DateTime()
println(now)          // 2015-03-18 16:28:07.845 - Australia/Sydney (GMT+11) offset 39600 (Daylight)

let dt1 = now + Period(0, 2, 2)
println(dt1)          // 2015-05-20 16:28:07.845 - Australia/Sydney (GMT+11) offset 39600 (Daylight)
```

## Clock
All of the above examples work just fine, but if you are creating date/time objects representing the "current" time by using the default constructors, then it gets a bit tricky to test because the system clock is obviously continually advancing.

If you need to test your temporal logic, it is often useful to be able to provide an alternate provider of the "current" time. The `Clock` protocol and its various implementations give you the flexibility to provide alternative implementations.

If you don't provide a clock to the various constructors, then the `SystemClock` implementation will be used, which always returns the current system time.

```
let clock = SystemClock()
let now = Instant(clock)     // this is equivalent to calling Instant()
```

However, sometimes you might want to be able to test code based on a specific date. A `FixedClock` always returns exactly the same instant:

```
// normal application code would be something like:
let clock = SystemClock()

// but test case code would something like:
let someInstant = ...
let someTimezone = ...
let clock = FixedClock(someInstant, someTimeZone)

// then by using dependency injection, or passing the clock around in your application code,
// you can provide sensible behaviour during normal execution and test case execution
let now = Instant(clock)
```

Using a `Clock` instance when creating your "current" date/time objects gives you much better testability.

# Installation

## Copy and Paste
The simplest, but not necessarily best, way to install DateTimeKit is perform the following steps:

* Clone or checkout the project from github into a folder somewhere
* Drag `DateTimeKit.xcodeproj` from the Finder into your project
* Add `DateTimeKit.framework` to your target's *Linked Frameworks and Libraries* (be sure to pick the correct iOS or OS X framework depending on what sort of app you are writing)
* Rebuild your project

### CocoaPods

[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

```bash
$ gem install cocoapods
```

To integrate DateTimeKit into your Xcode project using CocoaPods, specify it in your `Podfile`:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'DateTimeKit', :git => 'https://github.com/edwardaux/DateTimeKit.git'
```

Then, run the following command:

```bash
$ pod install
```

## Carthage
Still to come

# Feedback
Feel free to ask questions, raise issues or create pull requests. More than happy to receive feedback on new features or how I might have done things better.

I'm contactable via [twitter](https://twitter.com/edwardaux) or [email](mailto:craig@blackdogfoundry.com).

# Contributors

* Zacharias J. Beckman [email](mailto:zbeckman@HyraxLLC.com) [fork](https://github.com/zbeckman/DateTimeKit)

### Some other libraries:
DateTimeKit was also inspired by other works.
Some links:
* [JodaTime](http://www.joda.org/joda-time)
* [SwiftDate](https://github.com/malcommac/SwiftDate)
* [AFDateHelper](https://github.com/melvitax/AFDateHelper)
* [Timepiece](https://github.com/naoty/Timepiece)
* [MSDateFormatter](https://github.com/Namvt/MSDateFormatter)


text:
import torch
from torch import Tensor
from torch import nn
from torch import functional as F
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
from ..util import fullname, import_from_string

class Dense(nn.Module):
    """Feed-forward function with  activiation function.

    This layer takes a fixed-sized sentence embedding and passes it through a feed-forward layer. Can be used to generate deep averaging networks (DAN).

    :param in_features: Size of the input dimension
    :param out_features: Output size
    :param bias: Add a bias vector
    :param activation_function: Pytorch activation function applied on output
    :param init_weight: Initial value for the matrix of the linear layer
    :param init_bias: Initial value for the bias of the linear layer
    """
    def __init__(self, in_features: int, out_features: int, bias: bool = True, activation_function=nn.Tanh(), init_weight: Tensor = None, init_bias: Tensor = None):
        super(Dense, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.bias = bias
        self.activation_function = activation_function
        self.linear = nn.Linear(in_features, out_features, bias=bias)

        if init_weight is not None:
            self.linear.weight = nn.Parameter(init_weight)

        if init_bias is not None:
            self.linear.bias = nn.Parameter(init_bias)

    def forward(self, features: Dict[str, Tensor]):
        features.update({'sentence_embedding': self.activation_function(self.linear(features['sentence_embedding']))})
        return features

    def get_sentence_embedding_dimension(self) -> int:
        return self.out_features

    def get_config_dict(self):
        return {'in_features': self.in_features, 'out_features': self.out_features, 'bias': self.bias, 'activation_function': fullname(self.activation_function)}

    def save(self, output_path):
        with open(os.path.join(output_path, 'config.json'), 'w') as fOut:
            json.dump(self.get_config_dict(), fOut)

        torch.save(self.state_dict(), os.path.join(output_path, 'pytorch_model.bin'))

    def __repr__(self):
        return "Dense({})".format(self.get_config_dict())

    @staticmethod
    def load(input_path):
        with open(os.path.join(input_path, 'config.json')) as fIn:
            config = json.load(fIn)

        config['activation_function'] = import_from_string(config['activation_function'])()
        model = Dense(**config)
        model.load_state_dict(torch.load(os.path.join(input_path, 'pytorch_model.bin'), map_location=torch.device('cpu')))
        return model


text:
<?php

namespace Transit\Transformer\Image;

use Transit\File;
use Transit\Test\TestCase;
use \Exception;

class CropTransformerTest extends TestCase {

    /**
     * Test that cropping retains aspect ratio depending on the large side.
     */
    public function testTransform() {
        $object = new CropTransformer(array('width' => 100, 'height' => 235));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(100, $file->width());
        $this->assertEquals(235, $file->height());
    }

    /**
     * Test that an exception is thrown if no settings are defined.
     */
    public function testTransformException() {
        $object = new CropTransformer();

        try {
            $object->transform(new File($this->baseFile));
            $this->assertTrue(false);

        } catch (Exception $e) {
            $this->assertTrue(true);
        }
    }

    /**
     * Test that excluding the height will automatically generate a correct ratio.
     */
    public function testTransformHeightRatio() {
        $object = new CropTransformer(array('width' => 100));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(100, $file->width());
        $this->assertEquals(155, $file->height());

        $object = new CropTransformer(array('width' => 75, 'location' => CropTransformer::LEFT));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(75, $file->width());
        $this->assertEquals(116, $file->height());

        $object = new CropTransformer(array('width' => 137, 'location' => CropTransformer::BOTTOM));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(137, $file->width());
        $this->assertEquals(212, $file->height());
    }

    /**
     * Test that excluding the width will automatically generate a correct ratio.
     */
    public function testTransformWidthRatio() {
        $object = new CropTransformer(array('height' => 225));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(146, $file->width());
        $this->assertEquals(225, $file->height());

        $object = new CropTransformer(array('height' => 145, 'location' => CropTransformer::RIGHT));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(94, $file->width());
        $this->assertEquals(145, $file->height());

        $object = new CropTransformer(array('height' => 333, 'location' => CropTransformer::TOP));
        $file = $object->transform(new File($this->baseFile));

        $this->assertEquals(215, $file->width());
        $this->assertEquals(333, $file->height());
    }

}


text:
const arangodb = require("@arangodb");
const db = arangodb.db;
const pregel = require("@arangodb/pregel");
const examplegraphs = require("@arangodb/air/pregel-example-graphs");
const testhelpers = require("@arangodb/air/test-helpers");
const {sumAccumulator, storeAccumulator, maxAccumulator} = require("./accumulators");
const _ = require("lodash");

// ee/ce check + gm selection
const isEnterprise = require("internal").isEnterprise();
const graphModule = isEnterprise? require("@arangodb/smart-graph") : require("@arangodb/general-graph");

exports.pagerank_program = pagerank_program;
exports.pagerank = pagerank;
exports.test = test;

function pagerank_program(resultField, dampingFactor, traceVertex) {
  return {
    resultField: resultField,
    // TODO: Karpott.
    maxGSS: 1000,
    globalAccumulators: {
      delta: {
        accumulatorType: "custom",
        valueType: "any",
        customType: "maxAccumulator",
      }
    },
    vertexAccumulators: {
      rank: {
        accumulatorType: "custom",
        valueType: "any",
        customType: "storeAccumulator",
      },
      receiver: {
        accumulatorType: "custom",
        valueType: "any",
        customType: "sumAccumulator",
      }
    },
    customAccumulators: {
      sumAccumulator: sumAccumulator(),
      storeAccumulator: storeAccumulator(),
      maxAccumulator: maxAccumulator(),
    },
    phases: [
      {
        name: "main",
        initProgram: [
          "seq",
          ["accum-set!", "rank", ["/", 1, ["vertex-count"]]],
          ["accum-set!", "receiver", 0],
          ["gt?", ["this-outbound-edges-count"], 0]
        ],
        onPreStep: ["global-accum-set!", "delta", 0],
        onPostStep: ["if",
          [
            ["and",
              ["lt?", ["global-accum-ref", "delta"], 0.001],
              ["ne?", ["global-superstep"], 0]
            ],
            ["finish"]
          ]
        ],
        updateProgram: [
          "seq",
          ["let",
            [
              [
                "new-rank",
                [
                  "+",
                  ["/", ["-", 1, dampingFactor], ["vertex-count"]],
                  ["*", dampingFactor, ["accum-ref", "receiver"]],
                ]
              ]
            ],
            ["send-to-global-accum", "delta",
              ["abs", ["-",
                ["accum-ref", "rank"],
                ["var-ref", "new-rank"]
              ]]
            ],
            [
              "accum-set!",
              "rank",
              ["var-ref", "new-rank"]
            ],
          ],
          ["accum-set!", "receiver", 0],
          ["if",
            [
              ["gt?", ["this-outbound-edges-count"], 0],
              [
                "send-to-all-neighbours",
                "receiver",
                ["/", ["accum-ref", "rank"], ["this-outbound-edges-count"]],
              ]
            ]
          ],
          true,
        ],
      },
    ],
  };
}

function pagerank(graphName, resultField, dampingFactor, vertex) {
  return pregel.start(
    "ppa",
    graphName,
    pagerank_program(resultField, dampingFactor, vertex)
  );
}

function exec_test_pagerank_on_graph(graphSpec, vertex) {
  testhelpers.wait_for_pregel(
    "Air Pagerank",
    pagerank(
      graphSpec.name,
      "pageRankResult",
      0.85,
      vertex,
    ));

  testhelpers.wait_for_pregel(
    "Native Pagerank",
    pregel.start("pagerank", graphSpec.name, {
      maxGSS: 5,
      resultField: "nativeRank"
    })
  );

  // Return results which differ too much (here currently 0.05)
  return testhelpers.compare_pregel(
    db._query(`FOR d IN @@V
               FILTER ABS(d.nativeRank - d.pageRankResult.rank) >= 0.05
               RETURN {
                 name: d.name,
                 native: d.nativeRank,
                 air: d.pageRankResult.rank
               }`, {"@V": graphSpec.vname})
  );
}

function exec_test_pagerank(vertex) {
  let results = [];

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_pagerank_graph("PageRankGraph1", 1), vertex));
  try {
    graphModule._drop("PageRankGraph1", true);
  } catch (ignore) {
  }

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_pagerank_graph("PageRankGraph9", 9), vertex));
  try {
    graphModule._drop("PageRankGraph9", true);
  } catch (ignore) {
  }

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_pagerank_graph("PageRankGraph18", 18), vertex));
  try {
    graphModule._drop("PageRankGraph18", true);
  } catch (ignore) {
  }

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_wiki_vote_graph("WikiVoteGraph1", 1)));
  try {
    graphModule._drop("WikiVoteGraph1", true);
  } catch (ignore) {
  }

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_wiki_vote_graph("WikiVoteGraph9", 9)));
  try {
    graphModule._drop("WikiVoteGraph9", true);
  } catch (ignore) {
  }

  results.push(exec_test_pagerank_on_graph(examplegraphs.create_wiki_vote_graph("WikiVoteGraph18", 18)));
  try {
    graphModule._drop("WikiVoteGraph18", true);
  } catch (ignore) {
  }

  if (results.includes(false)) {
    return false;
  }
  return true;
}

function test(vertex = "") {
  return exec_test_pagerank(vertex);
}


text:
#include "../fayecpp.h"

namespace FayeCpp {

	int Advice::interval() const
	{
		return _interval;
	}

	int Advice::timeout() const
	{
		return _timeout;
	}

	Advice::ReconnectType Advice::reconnect() const
	{
		return _reconnect;
	}

	void Advice::setInterval(const int value)
	{
		_interval = value;
	}

	void Advice::setTimeout(const int value)
	{
		_timeout = value;
	}

	void Advice::setReconnect(const Advice::ReconnectType value)
	{
		_reconnect = value;
	}

	Advice & Advice::operator=(const Advice & advice)
	{
		_interval = advice._interval;
		_timeout = advice._timeout;
		_reconnect = advice._reconnect;

		return *this;
	}

	Advice::Advice() :
		_interval(-1),
		_timeout(-1),
		_reconnect(Advice::ReconnectNone)
	{

	}

	Advice::Advice(const Advice & advice) :
		_interval(advice._interval),
		_timeout(advice._timeout),
		_reconnect(advice._reconnect)
	{

	}

	Advice::~Advice()
	{

	}

}


text:
'use strict';

/**
 * @ngdoc overview
 * @name clothosApp
 * @description
 * # clothosApp
 *
 * Main module of the application.
 */
angular
  .module('clothosApp', [
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .when('/summary', {
        templateUrl: 'views/summary.html',
        controller: 'SummaryCtrl'
      })
      .when('/about', {
        templateUrl: 'views/about.html',
        controller: 'AboutCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });


text:
@*
* The Set Notes HTML form page.
*
* @see https://github.com/PlayWithMagic/PlayWithMagic.org/wiki/Set-Notes
* @see http://www.playframework.com
*@
@(page: String, isLoggedIn: Boolean, userInfo: Magician, set: models.Set, setNotesForm: Form[views.formdata.SetNotesFormData], setNotes: List[models.Note])

@import helper.form
@import views.html.bootstrap3.textInt
@import views.html.bootstrap3.hidden

@Main(page, isLoggedIn, userInfo) {

    @form(routes.Application.postSetNotes(), 'class -> "form-horizontal") {

Set Notes

          @hidden(setNotesForm("id"))
          @textInt(setNotesForm("duration"),
            label = "Preferred Duration",
            placeholder = "Minutes",
            help = "")
          @textInt(setNotesForm("cost"),
            label = "Budget",
            placeholder = "Dollars",
            help = "")

              <button id="submit" type="submit" class="btn btn-default">
                Get Notes
              </button>

              Set

              Name: @set.getName

            @set.getDescription

              Duration: @set.getDuration minutes

              Cost: $ @set.getCost

Routines

                Name

                Duration

              @for(routine <- set.getRoutines) {

                  @routine.getName

                @routine.getDuration

              }

              Notes

          @for(note <- setNotes) {

            @note.getText

          }

    }

}


text:
<?php
namespace Phpforce\SoapClient;

use Phpforce\SoapClient\Result;

/**
 * Salesforce API client interface
 *
 * @author David de Boer <david@ddeboer.nl>
 */
interface ClientInterface
{
    /**
     * Converts a Lead into an Account, Contact, or (optionally) an Opportunity
     *
     * @param array $leadConverts LeadConvert[]
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_convertlead.htm
     */
    public function convertLead(array $leadConverts);

    /**
     * Create one or more Salesforce objects
     *
     * @param array  $objects    Array of Salesforce objects
     * @param string $objectType Object type, e.g., account or contact
     *
     * @return Result\SaveResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_create.htm
     */
    public function create(array $objects, $objectType);

    /**
     * Deletes one or more records from your organization's data
     *
     * @param array $ids Salesforce object IDs
     *
     * @return Result\DeleteResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_delete.htm
     */
    public function delete(array $ids);

    /**
     * Retrieves a list of available objects for your organization's data
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describeglobal.htm
     *
     * @return Result\DescribeGlobalResult
     */
    public function describeGlobal();

    /**
     * Describes metadata (field list and object properties) for the specified object or array of objects
     *
     *
     * @param array $objectNames
     *
     * @return Result\DescribeSObjectResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describesobjects.htm
     */
    public function describeSObjects(array $objectNames);

    /**
     * Returns information about the standard and custom apps available to the
     * logged-in
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_invalidatesessions.htm
     */
    public function describeTabs();

    /**
     * Delete records from the recycle bin immediately
     *
     * @param array $ids Object ids
     */
    public function emptyRecycleBin(array $ids);

    /**
     * Retrieves the list of individual records that have been deleted within
     * the given timespan for the specified object
     *
     * @param string    $objectType Object type
     * @param \DateTime $startDate  Start date
     * @param \DateTime $endDate    End date
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm
     * @return Result\GetDeletedResult
     */
    public function getDeleted($objectType, \DateTime $startDate, \DateTime $endDate);

    /**
     * Retrieves the list of individual objects that have been updated (added or
     * changed) within the given timespan for the specified object
     *
     * @param string    $objectType Object type
     * @param \DateTime $startDate  Start date
     * @param \DateTime $endDate    End date
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getupdated.htm
     * @return Result\GetUpdatedResult
     */
    public function getUpdated($objectType, \DateTime $startDate, \DateTime $endDate);

    /**
     * Ends one or more sessions specified by a sessionId
     *
     * @param array $sessionIds Array of session ids
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_invalidatesessions.htm
     */
    public function invalidateSessions(array $sessionIds);

    /**
     * Logs in to the login server and starts a client session
     *
     * @param string $username Salesforce username
     * @param string $password Salesforce password
     * @param string $token    Salesforce security token
     *
     * @return Result\LoginResult
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_login.htm
     */
    public function login($username, $password, $token);

    /**
     * Ends the session of the logged-in user
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_logout.htm
     */
    public function logout();

    /**
     * Merge a Salesforce lead, contact or account with one or two other
     * Salesforce leads, contacts or accounts
     *
     * @param array  $mergeRequests Array of merge request objects
     * @param string $objectType    Object type, e.g., account or contact
     *
     * @return Result\MergeResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_merge.htm
     */
    public function merge(array $mergeRequests, $objectType);

    /**
     * Submits an array of approval process instances for approval, or processes
     * an array of approval process instances to be approved, rejected, or
     * removed
     *
     * @param array $processRequests
     *
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_process.htm
     */
    public function process(array $processRequests);

    /**
     * Query salesforce API and return results as record iterator
     *
     * @param string $query
     *
     * @return Result\RecordIterator
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_query.htm
     */
    public function query($query);

    /**
     * Retrieves data from specified objects, whether or not they have been
     * deleted
     *
     * @param string $query
     *
     * @return Result\QueryResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_queryall.htm
     */
    public function queryAll($query);

    /**
     * Retrieves the next batch of objects from a query
     *
     * @param string $queryLocator
     *
     * @return Result\QueryResult
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_querymore.htm
     */
    public function queryMore($queryLocator);

    /**
     * Retrieves one or more records based on the specified IDs
     *
     * @param array  $fields     Fields to retrieve on the object
     * @param array  $ids        IDs of objects to retrieve
     * @param string $objectType Object type, e.g., account or contact
     *
     * @return Result\SObject[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_retrieve.htm
     */
    public function retrieve(array $fields, array $ids, $objectType);

    /**
     * Executes a text search in your organization's data
     *
     * @param string $searchString
     *
     * @return Result\SearchResult
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_search.htm
     */
    public function search($searchString);

    /**
     * Undeletes records from the Recycle Bin
     *
     * @param array $ids
     *
     * @return Result\UndeleteResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_undelete.htm
     */
    public function undelete(array $ids);

    /**
     * Updates one or more existing records in your organization's data
     *
     * @param array  $objects    Array of objects
     * @param string $objectType Object type, e.g., account or contact
     *
     * @return Result\SaveResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_update.htm
     */
    public function update(array $objects, $objectType);

    /**
     * Creates new records and updates existing records; uses a custom field to
     * determine the presence of existing records
     *
     * @param string $externalFieldName Name of external field (must be id
     *                                  or external id)
     * @param array  $objects           Array of objects
     * @param string $objectType        Object type, e.g., account or contact
     *
     * @return Result\UpsertResult[]
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm
     */
    public function upsert($externalFieldName, array $objects, $objectType);

    /**
     * Retrieves the current system timestamp (Coordinated Universal Time (UTC)
     * time zone) from the API
     *
     * @return Result\GetServerTimestampResult
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getservertimestamp.htm
     */
    public function getServerTimestamp();

    /**
     * Get user info
     *
     * @return Result\GetUserInfoResult
     * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getuserinfo.htm
     */
    public function getUserInfo();

    /**
     * Changes a user's password to a temporary, system-generated value
     *
     * @param string $userId
     */
    public function resetPassword($userId);

    /**
     * Immediately sends an email message
     *
     * @param array $emails
     */
    public function sendEmail(array $emails);

    /**
     * Sets the specified user's password to the specified value
     *
     * @param string $userId   User id
     * @param string $password Password
     */
    public function setPassword($userId, $password);
}


text:
package com.github.liachmodded.uhcreloaded.forge.rule;

import net.minecraft.entity.ai.EntityAIAttackRanged;
import net.minecraft.entity.ai.EntityAIAttackRangedBow;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.Iterator;

/**
 * Created by liach on 4/11/2016.
 *
 * @author liach
 */
public class EasierSkeleton {

    @SubscribeEvent
    public void onSkeletonUpdate(LivingEvent.LivingUpdateEvent event) {
        if (!(event.getEntityLiving() instanceof EntitySkeleton)) {
            return;
        }
        EntitySkeleton skeleton = (EntitySkeleton) event.getEntityLiving();
        EntityAITasks tasks = skeleton.tasks;
        boolean containsOld = false;
        Iterator<EntityAITasks.EntityAITaskEntry> itr = tasks.taskEntries.iterator();
        while (itr.hasNext()) {
            EntityAITasks.EntityAITaskEntry entry = itr.next();
            if (entry.action instanceof EntityAIAttackRangedBow) {
                itr.remove();
            }
            if (entry.action instanceof EntityAIAttackRanged) {
                containsOld = true;
            }
        }
        if (!containsOld) {
            tasks.addTask(4, new EntityAIAttackRanged(skeleton, 1.0D, 20, 15.0F));
        }
    }
}


text:
"use strict";
var assert = require("power-assert");
var npmRun = require("../").npmRun;
describe("npm-run-test", function () {
    describe("npmRunAsync", function () {
        it("should run 'npm version' command", function (done) {
            return npmRun.npmRunAsync("version").then(function(data){
                done();
            }, function(error){
                done(new Error("should not call"));
            });
        });
    });
});


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="false">
        <shape android:shape="rectangle">
            <solid android:color="#2e97e8"/>
        </shape>
    </item>
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <solid android:color="#5e97ff"/>
        </shape>
    </item>
</selector>


text:
using System;

namespace Vernacular.Potato
{
    public enum MessageType
    {
        Context,
        SingularIdentifier,
        PluralIdentifier,
        SingularString,
        PluralString
    }
}