text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>SVGShape - YUI 3</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            API Docs for: 3.18.1

APIs

Classes

Modules

            <input type="search" id="api-filter" placeholder="Type to filter APIs">

Anim

App

App.Base

App.Content

App.Transitions

App.TransitionsNative

AreaSeries

AreaSplineSeries

Array

ArrayList

ArraySort

AsyncQueue

Attribute

AttributeCore

AttributeEvents

AttributeExtras

AttributeLite

AttributeObservable

AutoComplete

AutoCompleteBase

AutoCompleteFilters

AutoCompleteHighlighters

AutoCompleteList

Axis

AxisBase

BarSeries

Base

BaseCore

BaseObservable

BottomAxisLayout

Button

ButtonCore

ButtonGroup

Cache

CacheOffline

Calendar

CalendarBase

CandlestickSeries

CanvasCircle

CanvasDrawing

CanvasEllipse

CanvasGraphic

CanvasPath

CanvasPieSlice

CanvasRect

CanvasShape

CartesianChart

CartesianSeries

CategoryAxis

CategoryAxisBase

CategoryImpl

Chart

ChartBase

ChartLegend

Circle

CircleGroup

ClassNameManager

ClickableRail

Color

Color.Harmony

Color.HSL

Color.HSV

ColumnSeries

ComboSeries

ComboSplineSeries

config

Console

ContentEditable

Controller

Cookie

CurveUtil

CustomEvent

DataSchema.Array

DataSchema.Base

DataSchema.JSON

DataSchema.Text

DataSchema.XML

DataSource.Function

DataSource.Get

DataSource.IO

DataSource.Local

DataSourceArraySchema

DataSourceCache

DataSourceCacheExtension

DataSourceJSONSchema

DataSourceTextSchema

DataSourceXMLSchema

DataTable

DataTable.Base

DataTable.BodyView

DataTable.BodyView.Formatters

DataTable.Column

DataTable.ColumnWidths

DataTable.Core

DataTable.HeaderView

DataTable.Highlight

DataTable.KeyNav

DataTable.Message

DataTable.Mutable

DataTable.Paginator

DataTable.Paginator.Model

DataTable.Paginator.View

DataTable.Scrollable

DataTable.Sortable

DataTable.TableView

Date

DD.DDM

DD.Delegate

DD.Drag

DD.Drop

DD.Scroll

Dial

Do

Do.AlterArgs

Do.AlterReturn

Do.Error

Do.Halt

Do.Method

Do.Prevent

DOM

DOMEventFacade

Drawing

Easing

EditorBase

EditorSelection

Ellipse

EllipseGroup

Escape

Event

EventFacade

EventHandle

EventTarget

Features

File

FileFlash

FileHTML5

Fills

Frame

Get

Get.Transaction

GetNodeJS

Graph

Graphic

GraphicBase

Gridlines

GroupDiamond

GroupRect

Handlebars

Highlight

Histogram

HistoryBase

HistoryHash

HistoryHTML5

HorizontalLegendLayout

ImgLoadGroup

ImgLoadImgObj

InlineEditor

Intl

IO

JSON

JSONPRequest

Lang

LazyModelList

LeftAxisLayout

Lines

LineSeries

Loader

MarkerSeries

Matrix

MatrixUtil

Model

ModelList

ModelSync.Local

ModelSync.REST

Node

NodeList

Number

NumericAxis

NumericAxisBase

NumericImpl

Object

OHLCSeries

Overlay

Paginator

Paginator.Core

Paginator.Url

Panel

Parallel

Path

PieChart

PieSeries

Pjax

PjaxBase

PjaxContent

Plots

Plugin.Align

Plugin.AutoComplete

Plugin.Base

Plugin.Button

Plugin.Cache

Plugin.CalendarNavigator

Plugin.ConsoleFilters

Plugin.CreateLinkBase

Plugin.DataTableDataSource

Plugin.DDConstrained

Plugin.DDNodeScroll

Plugin.DDProxy

Plugin.DDWindowScroll

Plugin.Drag

Plugin.Drop

Plugin.EditorBidi

Plugin.EditorBR

Plugin.EditorLists

Plugin.EditorPara

Plugin.EditorParaBase

Plugin.EditorParaIE

Plugin.EditorTab

Plugin.ExecCommand

Plugin.ExecCommand.COMMANDS

Plugin.Flick

Plugin.Host

plugin.NodeFocusManager

Plugin.NodeFX

plugin.NodeMenuNav

Plugin.Pjax

Plugin.Resize

Plugin.ResizeConstrained

Plugin.ResizeProxy

Plugin.ScrollInfo

Plugin.ScrollViewList

Plugin.ScrollViewPaginator

Plugin.ScrollViewScrollbars

Plugin.Shim

Plugin.SortScroll

Plugin.Tree.Lazy

Plugin.WidgetAnim

Pollable

Promise

Promise.Resolver

QueryString

Queue

RangeSeries

Record

Recordset

RecordsetFilter

RecordsetIndexer

RecordsetSort

Rect

Renderer

Resize

RightAxisLayout

Router

ScrollView

Selector

SeriesBase

Shape

ShapeGroup

Slider

SliderBase

SliderValueRange

Sortable

SplineSeries

StackedAreaSeries

StackedAreaSplineSeries

StackedAxis

StackedAxisBase

StackedBarSeries

StackedColumnSeries

StackedComboSeries

StackedComboSplineSeries

StackedImpl

StackedLineSeries

StackedMarkerSeries

StackedSplineSeries

StackingUtil

State

StyleSheet

Subscriber

SVGCircle

SVGDrawing

SVGEllipse

SVGGraphic

SVGPath

SVGPieSlice

SVGRect

SVGShape

SWF

SWFDetect

SyntheticEvent

SyntheticEvent.Notifier

SynthRegistry

Tab

TabView

Template

Template.Micro

Test.ArrayAssert

Test.Assert

Test.AssertionError

Test.ComparisonFailure

Test.Console

Test.CoverageFormat

Test.DateAssert

Test.EventTarget

Test.Mock

Test.Mock.Value

Test.ObjectAssert

Test.Reporter

Test.Results

Test.Runner

Test.ShouldError

Test.ShouldFail

Test.TestCase

Test.TestFormat

Test.TestNode

Test.TestRunner

Test.TestSuite

Test.UnexpectedError

Test.UnexpectedValue

Test.Wait

Text.AccentFold

Text.WordBreak

TimeAxis

TimeAxisBase

TimeImpl

ToggleButton

TopAxisLayout

Transition

Tree

Tree.Labelable

Tree.Node

Tree.Node.Labelable

Tree.Node.Openable

Tree.Node.Selectable

Tree.Node.Sortable

Tree.Openable

Tree.Selectable

Tree.Sortable

UA

Uploader

Uploader.Queue

UploaderFlash

UploaderHTML5

ValueChange

VerticalLegendLayout

View

View.NodeMap

VMLCircle

VMLDrawing

VMLEllipse

VMLGraphic

VMLPath

VMLPieSlice

VMLRect

VMLShape

Widget

WidgetAutohide

WidgetButtons

WidgetChild

WidgetModality

WidgetParent

WidgetPosition

WidgetPositionAlign

WidgetPositionConstrain

WidgetStack

WidgetStdMod

XML

YQL

YQLRequest

YUI

YUI~substitute

align-plugin

anim

anim-base

anim-color

anim-curve

anim-easing

anim-node-plugin

anim-scroll

anim-shape

anim-shape-transform

anim-xy

app

app-base

app-content

app-transitions

app-transitions-native

array-extras

array-invoke

arraylist

arraylist-add

arraylist-filter

arraysort

async-queue

attribute

attribute-base

attribute-complex

attribute-core

attribute-extras

attribute-observable

autocomplete

autocomplete-base

autocomplete-filters

autocomplete-filters-accentfold

autocomplete-highlighters

autocomplete-highlighters-accentfold

autocomplete-list

autocomplete-list-keys

autocomplete-plugin

autocomplete-sources

axis

axis-base

axis-category

axis-category-base

axis-numeric

axis-numeric-base

axis-stacked

axis-stacked-base

axis-time

axis-time-base

base

base-base

base-build

base-core

base-observable

base-pluginhost

button

button-core

button-group

button-plugin

cache

cache-base

cache-offline

cache-plugin

calendar

calendar-base

calendarnavigator

charts

charts-base

charts-legend

classnamemanager

clickable-rail

collection

color

color-base

color-harmony

color-hsl

color-hsv

console

console-filters

content-editable

cookie

createlink-base

dataschema

dataschema-array

dataschema-base

dataschema-json

dataschema-text

dataschema-xml

datasource

datasource-arrayschema

datasource-cache

datasource-function

datasource-get

datasource-io

datasource-jsonschema

datasource-local

datasource-polling

datasource-textschema

datasource-xmlschema

datatable

datatable-base

datatable-body

datatable-column-widths

datatable-core

datatable-datasource

datatable-foot

datatable-formatters

datatable-head

datatable-highlight

datatable-keynav

datatable-message

datatable-mutable

datatable-paginator

datatable-scroll

datatable-sort

datatable-table

datatype

datatype-date

datatype-date-format

datatype-date-math

datatype-date-parse

datatype-number

datatype-number-format

datatype-number-parse

datatype-xml

datatype-xml-format

datatype-xml-parse

dd

dd-constrain

dd-ddm

dd-ddm-base

dd-ddm-drop

dd-delegate

dd-drag

dd-drop

dd-drop-plugin

dd-gestures

dd-plugin

dd-proxy

dd-scroll

dial

dom

dom-base

dom-screen

dom-style

dump

editor

editor-base

editor-bidi

editor-br

editor-inline

editor-lists

editor-para

editor-para-base

editor-para-ie

editor-tab

escape

event

event-base

event-contextmenu

event-custom

event-custom-base

event-custom-complex

event-delegate

event-flick

event-focus

event-gestures

event-hover

event-key

event-mouseenter

event-mousewheel

event-move

event-outside

event-resize

event-simulate

event-synthetic

event-tap

event-touch

event-valuechange

exec-command

features

file

file-flash

file-html5

frame

gesture-simulate

get

get-nodejs

graphics

graphics-group

handlebars

handlebars-base

handlebars-compiler

highlight

highlight-accentfold

highlight-base

history

history-base

history-hash

history-hash-ie

history-html5

imageloader

intl

io

io-base

io-form

io-nodejs

io-queue

io-upload-iframe

io-xdr

json

json-parse

json-stringify

jsonp

jsonp-url

lazy-model-list

loader

loader-base

loader-yui3

matrix

model

model-list

model-sync-rest

node

node-base

node-core

node-data

node-event-delegate

node-event-html5

node-event-simulate

node-flick

node-focusmanager

node-load

node-menunav

node-pluginhost

node-screen

node-scroll-info

node-style

oop

overlay

paginator

paginator-core

paginator-url

panel

parallel

pjax

pjax-base

pjax-content

pjax-plugin

plugin

pluginhost

pluginhost-base

pluginhost-config

promise

querystring

querystring-parse

querystring-parse-simple

querystring-stringify

querystring-stringify-simple

queue-promote

range-slider

recordset

recordset-base

recordset-filter

recordset-indexer

recordset-sort

resize

resize-contrain

resize-plugin

resize-proxy

rollup

router

scrollview

scrollview-base

scrollview-base-ie

scrollview-list

scrollview-paginator

scrollview-scrollbars

selection

selector-css2

selector-css3

selector-native

series-area

series-area-stacked

series-areaspline

series-areaspline-stacked

series-bar

series-bar-stacked

series-base

series-candlestick

series-cartesian

series-column

series-column-stacked

series-combo

series-combo-stacked

series-combospline

series-combospline-stacked

series-curve-util

series-fill-util

series-histogram

series-line

series-line-stacked

series-line-util

series-marker

series-marker-stacked

series-ohlc

series-pie

series-plot-util

series-range

series-spline

series-spline-stacked

series-stacked

shim-plugin

slider

slider-base

slider-value-range

sortable

sortable-scroll

stylesheet

substitute

swf

swfdetect

tabview

template

template-base

template-micro

test

test-console

text

text-accentfold

text-wordbreak

timers

transition

transition-timer

tree

tree-labelable

tree-lazy

tree-node

tree-openable

tree-selectable

tree-sortable

uploader

uploader-flash

uploader-html5

uploader-queue

view

view-node-map

widget

widget-anim

widget-autohide

widget-base

widget-base-ie

widget-buttons

widget-child

widget-htmlparser

widget-modality

widget-parent

widget-position

widget-position-align

widget-position-constrain

widget-skin

widget-stack

widget-stdmod

widget-uievents

yql

yql-jsonp

yql-nodejs

yql-winjs

yui

yui-base

yui-later

yui-log

yui-throttle

        Show:

            <input type="checkbox" id="api-show-inherited" checked>
            Inherited

            <input type="checkbox" id="api-show-protected">
            Protected

            <input type="checkbox" id="api-show-private">
            Private

            <input type="checkbox" id="api-show-deprecated">
            Deprecated

SVGShape Class

            Defined in: graphics/js/SVGShape.js:1

            Module: graphics

SVG implementation of the Shape class.
SVGShape is not intended to be used directly. Instead, use the Shape class.
If the browser has SVG capabilities, the Shape
class will point to the SVGShape class.

Index

Methods

Properties

Attributes

Item Index

Methods

                                _addTransform

                                _draw

                                _fillChangeHandler

                                _getDefaultFill

                                _getDefaultStroke

                                _parsePathData

                                _setGradientFill

                                _setGraphic

                                _strokeChangeHandler

                                _updateHandler

                                _updateTransform

                                addClass

                                compareTo

                                contains

                                createNode

                                destroy

                                destroy

                                getBounds

                                getXY

                                init

                                initializer

                                on

                                removeClass

                                rotate

                                scale

                                set

                                setXY

                                skew

                                skewX

                                skewY

                                test

                                toFront

                                toFront

                                translate

                                translateX

                                translateY

Properties

                                _transform

                                _x

                                _y

Attributes

                                data

                                fill

                                graphic

                                height

                                id

                                node

                                shapeRendering

                                stroke

                                transform

                                transformOrigin

                                visible

                                width

                                x

                                y

Methods

_addTransform

            (

                        type

                        args

)

        private

                Defined in

        graphics/js/SVGShape.js:627

Adds a transform to the shape.

Parameters:

                        type
                        String

The transform being applied.

                        args
                        Array

The arguments for the transform.

_draw

        ()

        private

                Defined in

        graphics/js/SVGShape.js:720

Draws the shape.

_fillChangeHandler

        ()

        private

                Defined in

        graphics/js/SVGShape.js:338

Adds a fill to the shape node.

_getDefaultFill

        ()

        private

                Defined in

        graphics/js/SVGShape.js:194

Value function for fill attribute

Returns:

Object

_getDefaultStroke

        ()

        private

                Defined in

        graphics/js/SVGShape.js:213

Value function for stroke attribute

Returns:

Object

_parsePathData

            (

                        val

)

        private

                Defined in

        graphics/js/SVGShape.js:817

Parses path data string and call mapped methods.

Parameters:

                        val
                        String

The path data

_setGradientFill

            (

                        type

)

        private

                Defined in

        graphics/js/SVGShape.js:376

Creates a gradient fill

Parameters:

                        type
                        String

gradient type

_setGraphic

            (

                        render

)

        private

                Defined in

        graphics/js/SVGShape.js:74

Set the Graphic instance for the shape.

Parameters:

                        render
                        Graphic | Node | HTMLElement | String

This param is used to determine the graphic instance. If it is a
Graphic instance, it will be assigned to the graphic attribute. Otherwise, a new Graphic instance will be created
and rendered into the dom element that the render represents.

_strokeChangeHandler

        ()

        private

                Defined in

        graphics/js/SVGShape.js:289

Adds a stroke to the shape node.

_updateHandler

        ()

        private

                Defined in

        graphics/js/SVGShape.js:740

Updates Shape based on attribute changes.

_updateTransform

        ()

        private

                Defined in

        graphics/js/SVGShape.js:647

Applies all transforms.

addClass

            (

                        className

)

                Defined in

        graphics/js/SVGShape.js:100

Add a class name to each node.

Parameters:

                        className
                        String

the class name to add to the node's class attribute

compareTo

            (

                        refNode

)

            Boolean

                Defined in

        graphics/js/SVGShape.js:169

Compares nodes to determine if they match.
Node instances can be compared to each other and/or HTMLElements.

Parameters:

                        refNode
                        HTMLElement | Node

The reference node to compare to the node.

Returns:

                        Boolean:

True if the nodes match, false if they do not.

contains

            (

                        needle

)

                Defined in

        graphics/js/SVGShape.js:156

Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.

Parameters:

                        needle
                        SVGShape | HTMLElement

The possible node or descendent

Returns:

Boolean Whether or not this shape is the needle or its ancestor.

createNode

        ()

        private

                Defined in

        graphics/js/SVGShape.js:230

Creates the dom node for the shape.

Returns:

HTMLElement

destroy

        ()

        protected

                Defined in

        graphics/js/SVGShape.js:878

Implementation for shape destruction

destroy

        ()

                Defined in

        graphics/js/SVGShape.js:860

Destroys the shape instance.

getBounds

        ()

                Defined in

        graphics/js/SVGShape.js:760

Returns the bounds for a shape.

Calculates the a new bounding box from the original corner coordinates (base on size and position) and the transform matrix.
The calculated bounding box is used by the graphic instance to calculate its viewBox.

Returns:

Object

getXY

        ()

                Defined in

        graphics/js/SVGShape.js:126

Gets the current position of the node in page coordinates.

Returns:

Array The XY position of the shape.

init

        ()

        protected

                Defined in

        graphics/js/SVGShape.js:39

Init method, invoked during construction.
Calls initializer method.

initializer

        ()

        private

                Defined in

        graphics/js/SVGShape.js:51

Initializes the shape

on

            (

                        type

                        callback

)

        private

                Defined in

        graphics/js/SVGShape.js:271

Overrides default on method. Checks to see if its a dom interaction event. If so,
return an event attached to the node element. If not, return the normal functionality.

Parameters:

                        type
                        String

event type

                        callback
                        Object

function

removeClass

            (

                        className

)

                Defined in

        graphics/js/SVGShape.js:112

Removes a class name from each node.

Parameters:

                        className
                        String

the class name to remove from the node's class attribute

rotate

            (

                        deg

)

                Defined in

        graphics/js/SVGShape.js:605

Rotates the shape clockwise around it transformOrigin.

Parameters:

                        deg
                        Number

The degree of the rotation.

scale

            (

                        val

)

                Defined in

        graphics/js/SVGShape.js:616

Specifies a 2d scaling operation.

Parameters:

                        val
                        Number

set

            (

                        name

                        value

)

                Defined in

        graphics/js/SVGShape.js:516

Sets the value of an attribute.

Parameters:

                        name
                        String | Object

The name of the attribute. Alternatively, an object of key value pairs can
be passed in to set multiple attributes at once.

                        value
                        Any

The value to set the attribute to. This value is ignored if an object is received as
the name param.

setXY

            (

                        Contains

)

                Defined in

        graphics/js/SVGShape.js:141

Set the position of the shape in page coordinates, regardless of how the node is positioned.

Parameters:

                        Contains
                        Array

x & y values for new position (coordinates are page-based)

skew

            (

                        x

                        y

)

                Defined in

        graphics/js/SVGShape.js:571

Skews the shape around the x-axis and y-axis.

Parameters:

                        x
                        Number

The value to skew on the x-axis.

                        y
                        Number

The value to skew on the y-axis.

skewX

            (

                        x

)

                Defined in

        graphics/js/SVGShape.js:583

Skews the shape around the x-axis.

Parameters:

                        x
                        Number

x-coordinate

skewY

            (

                        y

)

                Defined in

        graphics/js/SVGShape.js:594

Skews the shape around the y-axis.

Parameters:

                        y
                        Number

y-coordinate

test

            (

                        selector

)

                Defined in

        graphics/js/SVGShape.js:182

Test if the supplied node matches the supplied selector.

Parameters:

                        selector
                        String

The CSS selector to test against.

Returns:

Boolean Wheter or not the shape matches the selector.

toFront

        ()

                Defined in

        graphics/js/SVGShape.js:789

Places the shape above all other shapes.

toFront

        ()

                Defined in

        graphics/js/SVGShape.js:803

Places the shape underneath all other shapes.

translate

            (

                        x

                        y

)

                Defined in

        graphics/js/SVGShape.js:535

Specifies a 2d translation.

Parameters:

                        x
                        Number

The value to transate on the x-axis.

                        y
                        Number

The value to translate on the y-axis.

translateX

            (

                        x

)

                Defined in

        graphics/js/SVGShape.js:547

Translates the shape along the x-axis. When translating x and y coordinates,
use the translate method.

Parameters:

                        x
                        Number

The value to translate.

translateY

            (

                        y

)

                Defined in

        graphics/js/SVGShape.js:559

Translates the shape along the y-axis. When translating x and y coordinates,
use the translate method.

Parameters:

                        y
                        Number

The value to translate.

Properties

_transform

    String

        private

                Defined in

        graphics/js/SVGShape.js:751

Storage for the transform attribute.

_x

    Unknown

        protected

                Defined in

        graphics/js/SVGShape.js:23

Storage for x attribute.

_y

    Unknown

        protected

                Defined in

        graphics/js/SVGShape.js:31

Storage for y attribute.

Attributes

data

    String

                Defined in

        graphics/js/SVGShape.js:1258

Represents an SVG Path string. This will be parsed and added to shape's API to represent the SVG data across all
implementations. Note that when using VML or SVG implementations, part of this content will be added to the DOM using
respective VML/SVG attributes. If your content comes from an untrusted source, you will need to ensure that no
malicious code is included in that content.

fill

    Object

                Defined in

        graphics/js/SVGShape.js:1102

Contains information about the fill of the shape.

color

The color of the fill.

opacity

Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.

type

Type of fill.

solid

Solid single color fill. (default)

linear

Linear gradient fill.

radial

Radial gradient fill.

If a linear or radial is specified as the fill type. The following additional property is used:

stops

An array of objects containing the following properties:

color

The color of the stop.

opacity

Number between 0 and 1 that indicates the opacity of the stop. The default value is 1.
             Note: No effect for IE 6 - 8

offset

Number between 0 and 1 indicating where the color stop is positioned.

Linear gradients also have the following property:

rotation

Linear gradients flow left to right by default. The rotation property allows you to change the
     flow by rotation. (e.g. A rotation of 180 would make the gradient pain from right to left.)

Radial gradients have the following additional properties:

r

Radius of the gradient circle.

fx

Focal point x-coordinate of the gradient.

fy

Focal point y-coordinate of the gradient.

cx

The x-coordinate of the center of the gradient circle. Determines where the color stop begins. The default value 0.5.

Note: Currently, this property is not implemented for corresponding CanvasShape and
         VMLShape classes which are used on Android or IE 6 - 8.

cy

The y-coordinate of the center of the gradient circle. Determines where the color stop begins. The default value 0.5.

Note: Currently, this property is not implemented for corresponding CanvasShape and VMLShape
         classes which are used on Android or IE 6 - 8.

graphic

    SVGGraphic

        readonly

                Defined in

        graphics/js/SVGShape.js:1278

Reference to the parent graphic instance

height

    Number

                Defined in

        graphics/js/SVGShape.js:1038

Indicates the height of the shape

id

    String

                Defined in

        graphics/js/SVGShape.js:959

Unique id for class instance.

node

    HTMLElement

        readonly

                Defined in

        graphics/js/SVGShape.js:1242

Dom node for the shape.

shapeRendering

    String

                Defined in

        graphics/js/SVGShape.js:1067

Only implemented in SVG implementation.
Applies the SVG shape-rendering attribute to the shape.

auto

Indicates that the user agent shall make appropriate tradeoffs to balance speed,
     crisp edges and geometric precision, but with geometric precision given more importance than speed and crisp edges.

optimizeSpeed

Indicates that the user agent shall emphasize rendering speed over geometric precision and crisp edges.
     This option will sometimes cause the user agent to turn off shape anti-aliasing.

crispEdges

Indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering
     speed and geometric precision. To achieve crisp edges, the user agent might turn off anti-aliasing for all lines and curves
     or possibly just for straight lines which are close to vertical or horizontal. Also, the user agent might adjust line
     positions and line widths to align edges with device pixels.

geometricPrecision

Indicates that the user agent shall emphasize geometric precision over speed and crisp edges.

stroke

    Object

                Defined in

        graphics/js/SVGShape.js:1166

Contains information about the stroke of the shape.

color

The color of the stroke.

weight

Number that indicates the width of the stroke.

opacity

Number between 0 and 1 that indicates the opacity of the stroke. The default value is 1.

dashstyle
Indicates whether to draw a dashed stroke. When set to "none", a solid stroke is drawn. When set
     to an array, the first index indicates the length of the dash. The second index indicates the length of gap.

linecap

Specifies the linecap for the stroke. The following values can be specified:

butt (default)

Specifies a butt linecap.

square

Specifies a sqare linecap.

round

Specifies a round linecap.

linejoin

Specifies a linejoin for the stroke. The following values can be specified:

round (default)

Specifies that the linejoin will be round.

bevel

Specifies a bevel for the linejoin.

miter limit

An integer specifying the miter limit of a miter linejoin. If you want to specify a linejoin
             of miter, you simply specify the limit as opposed to having separate miter and miter limit values.

transform

    String

                Defined in

        graphics/js/SVGShape.js:913

A string containing, in order, transform operations applied to the shape instance. The transform string can contain the following values:

rotate

Rotates the shape clockwise around it transformOrigin.

translate

Specifies a 2d translation.

skew

Skews the shape around the x-axis and y-axis.

scale

Specifies a 2d scaling operation.

translateX

Translates the shape along the x-axis.

translateY

Translates the shape along the y-axis.

skewX

Skews the shape around the x-axis.

skewY

Skews the shape around the y-axis.

matrix

Specifies a 2D transformation matrix comprised of the specified six values.

Applying transforms through the transform attribute will reset the transform matrix and apply a new transform. The shape class also contains
corresponding methods for each transform that will apply the transform to the current matrix. The below code illustrates how you might use the
transform attribute to instantiate a recangle with a rotation of 45 degrees.

           var myRect = new Y.Rect({
               type:"rect",
               width: 50,
               height: 40,
               transform: "rotate(45)"
           };

The code below would apply translate and rotate to an existing shape.

   myRect.set("transform", "translate(40, 50) rotate(45)");

transformOrigin

    Array

                Defined in

        graphics/js/SVGShape.js:899

An array of x, y values which indicates the transformOrigin in which to rotate the shape. Valid values range between 0 and 1 representing a
fraction of the shape's corresponding bounding box dimension. The default value is [0.5, 0.5].

visible

    Boolean

                Defined in

        graphics/js/SVGShape.js:1048

Indicates whether the shape is visible.

width

    Number

                Defined in

        graphics/js/SVGShape.js:1028

Indicates the width of the shape

x

    Number

                Defined in

        graphics/js/SVGShape.js:982

Indicates the x position of shape.

y

    Number

                Defined in

        graphics/js/SVGShape.js:1005

Indicates the y position of shape.


text:
var Splitter = require('../utils/splitter');

module.exports = (function () {
  // Regexes used for stuff
  var widthKeywords = ['thin', 'thick', 'medium', 'inherit', 'initial'];
  var allUnits = ['px', '%', 'em', 'rem', 'in', 'cm', 'mm', 'ex', 'pt', 'pc', 'vw', 'vh', 'vmin', 'vmax'];
  var cssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + allUnits.join('|') + '|)|auto|inherit)';
  var cssFunctionNoVendorRegexStr = '[A-Z]+(\\-|[A-Z]|[0-9])+\\(([A-Z]|[0-9]|\\ |\\,|\\#|\\+|\\-|\\%|\\.|\\(|\\))*\\)';
  var cssFunctionVendorRegexStr = '\\-(\\-|[A-Z]|[0-9])+\\(([A-Z]|[0-9]|\\ |\\,|\\#|\\+|\\-|\\%|\\.|\\(|\\))*\\)';
  var cssVariableRegexStr = 'var\\(\\-\\-[^\\)]+\\)';
  var cssFunctionAnyRegexStr = '(' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')';
  var cssUnitAnyRegexStr = '(none|' + widthKeywords.join('|') + '|' + cssUnitRegexStr + '|' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')';

  var cssFunctionNoVendorRegex = new RegExp('^' + cssFunctionNoVendorRegexStr + '$', 'i');
  var cssFunctionVendorRegex = new RegExp('^' + cssFunctionVendorRegexStr + '$', 'i');
  var cssVariableRegex = new RegExp('^' + cssVariableRegexStr + '$', 'i');
  var cssFunctionAnyRegex = new RegExp('^' + cssFunctionAnyRegexStr + '$', 'i');
  var cssUnitRegex = new RegExp('^' + cssUnitRegexStr + '$', 'i');
  var cssUnitAnyRegex = new RegExp('^' + cssUnitAnyRegexStr + '$', 'i');

  var backgroundRepeatKeywords = ['repeat', 'no-repeat', 'repeat-x', 'repeat-y', 'inherit'];
  var backgroundAttachmentKeywords = ['inherit', 'scroll', 'fixed', 'local'];
  var backgroundPositionKeywords = ['center', 'top', 'bottom', 'left', 'right'];
  var backgroundSizeKeywords = ['contain', 'cover'];
  var listStyleTypeKeywords = ['armenian', 'circle', 'cjk-ideographic', 'decimal', 'decimal-leading-zero', 'disc', 'georgian', 'hebrew', 'hiragana', 'hiragana-iroha', 'inherit', 'katakana', 'katakana-iroha', 'lower-alpha', 'lower-greek', 'lower-latin', 'lower-roman', 'none', 'square', 'upper-alpha', 'upper-latin', 'upper-roman'];
  var listStylePositionKeywords = ['inside', 'outside', 'inherit'];
  var outlineStyleKeywords = ['auto', 'inherit', 'hidden', 'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];

  var compatibleCssUnitRegex;
  var compatibleCssUnitAnyRegex;

  var validator = {
    // FIXME: we need a proper OO here
    setCompatibility: function (compatibility) {
      if (compatibility.units.rem) {
        compatibleCssUnitRegex = cssUnitRegex;
        compatibleCssUnitAnyRegex = cssUnitAnyRegex;
        return;
      }

      var validUnits = allUnits.slice(0).filter(function (value) {
        return value != 'rem';
      });

      var compatibleCssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + validUnits.join('|') + ')|auto|inherit)';
      compatibleCssUnitRegex = new RegExp('^' + compatibleCssUnitRegexStr + '$', 'i');
      compatibleCssUnitAnyRegex = new RegExp('^(none|' + widthKeywords.join('|') + '|' + compatibleCssUnitRegexStr + '|' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')$', 'i');
    },

    isValidHexColor: function (s) {
      return (s.length === 4 || s.length === 7) && s[0] === '#';
    },
    isValidRgbaColor: function (s) {
      s = s.split(' ').join('');
      return s.length > 0 && s.indexOf('rgba(') === 0 && s.indexOf(')') === s.length - 1;
    },
    isValidHslaColor: function (s) {
      s = s.split(' ').join('');
      return s.length > 0 && s.indexOf('hsla(') === 0 && s.indexOf(')') === s.length - 1;
    },
    isValidNamedColor: function (s) {
      // We don't really check if it's a valid color value, but allow any letters in it
      return s !== 'auto' && (s === 'transparent' || s === 'inherit' || /^[a-zA-Z]+$/.test(s));
    },
    isValidVariable: function(s) {
      return cssVariableRegex.test(s);
    },
    isValidColor: function (s) {
      return validator.isValidNamedColor(s) || validator.isValidHexColor(s) || validator.isValidRgbaColor(s) || validator.isValidHslaColor(s) || validator.isValidVariable(s);
    },
    isValidUrl: function (s) {
      // NOTE: at this point all URLs are replaced with placeholders by clean-css, so we check for those placeholders
      return s.indexOf('__ESCAPED_URL_CLEAN_CSS') === 0;
    },
    isValidUnit: function (s) {
      return cssUnitAnyRegex.test(s);
    },
    isValidUnitWithoutFunction: function (s) {
      return cssUnitRegex.test(s);
    },
    isValidAndCompatibleUnit: function (s) {
      return compatibleCssUnitAnyRegex.test(s);
    },
    isValidAndCompatibleUnitWithoutFunction: function (s) {
      return compatibleCssUnitRegex.test(s);
    },
    isValidFunctionWithoutVendorPrefix: function (s) {
      return cssFunctionNoVendorRegex.test(s);
    },
    isValidFunctionWithVendorPrefix: function (s) {
      return cssFunctionVendorRegex.test(s);
    },
    isValidFunction: function (s) {
      return cssFunctionAnyRegex.test(s);
    },
    isValidBackgroundRepeat: function (s) {
      return backgroundRepeatKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidBackgroundAttachment: function (s) {
      return backgroundAttachmentKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidBackgroundPositionPart: function (s) {
      if (backgroundPositionKeywords.indexOf(s) >= 0)
        return true;

      return cssUnitRegex.test(s) || validator.isValidVariable(s);
    },
    isValidBackgroundPosition: function (s) {
      if (s === 'inherit')
        return true;

      var parts = s.split(' ');
      for (var i = 0, l = parts.length; i < l; i++) {
        if (parts[i] === '')
          continue;
        if (validator.isValidBackgroundPositionPart(parts[i]) || validator.isValidVariable(parts[i]))
          continue;

        return false;
      }

      return true;
    },
    isValidBackgroundSizePart: function(s) {
      return backgroundSizeKeywords.indexOf(s) >= 0 || cssUnitRegex.test(s) || validator.isValidVariable(s);
    },
    isValidBackgroundPositionAndSize: function(s) {
      if (s.indexOf('/') < 0)
        return false;

      var twoParts = new Splitter('/').split(s);
      return validator.isValidBackgroundSizePart(twoParts.pop()) && validator.isValidBackgroundPositionPart(twoParts.pop());
    },
    isValidListStyleType: function (s) {
      return listStyleTypeKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidListStylePosition: function (s) {
      return listStylePositionKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidOutlineColor: function (s) {
      return s === 'invert' || validator.isValidColor(s) || validator.isValidVendorPrefixedValue(s);
    },
    isValidOutlineStyle: function (s) {
      return outlineStyleKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidOutlineWidth: function (s) {
      return validator.isValidUnit(s) || widthKeywords.indexOf(s) >= 0 || validator.isValidVariable(s);
    },
    isValidVendorPrefixedValue: function (s) {
      return /^-([A-Za-z0-9]|-)*$/gi.test(s);
    },
    areSameFunction: function (a, b) {
      if (!validator.isValidFunction(a) || !validator.isValidFunction(b))
        return false;

      var f1name = a.substring(0, a.indexOf('('));
      var f2name = b.substring(0, b.indexOf('('));

      return f1name === f2name;
    }
  };

  return validator;
})();

redpajama_set_name: RedPajamaGithub


text:
class ContactsController < ApplicationController

  before_filter :load_contact, :except => [:new, :create, :find]

  def new
    @contact = Contact.new
    render 'edit_contact'
  end

  def create
    @contact = Contact.new(contact_params)

    new_address = parse_address
    if new_address && new_address.valid?
      assigning_new_address_object = (params[:address_specification_type] == 'existing_address')
      assign_address_to_contact(new_address, assigning_new_address_object)
      @address_list = Address.find_for_list
    end

    @saved = @contact.save
    @contact_list = Contact.find_for_list
    render 'edit_contact'
  end

  def show
    @address = @contact.address || Address.new
    is_mobile_device? ? render('show_contact') : render('edit_contact')
  end

  def update
    @contact.attributes = contact_params

    render_target = 'edit_contact'
    new_address = parse_address
    if new_address && new_address.valid? && new_address.different_from?(@contact.address)
      if changing_address_for_multiple_contacts?
        session[:changed_address] = new_address.to_json
        render_target = 'edit_contact_with_shared_address'
      else
        assigning_new_address_object = (params[:address_specification_type] == 'existing_address')
        new_address_saved = assign_address_to_contact(new_address, assigning_new_address_object)
      end
    end

    @saved = @contact.errors.blank? && @contact.save
    @address_list = Address.find_for_list if new_address_saved

    if new_address && new_address.different_from?(@contact.address)
      @address = new_address
    else
      @address = @contact.address || Address.new
    end

    render render_target
  end

  def destroy
    @old_address = Address.new
    @old_address.attributes = @contact.address.try(:attributes) || {}
    @contact.try(:destroy)
    @address_list = Address.find_for_list if @contact.address.nil?
    render 'delete_contact'
  end

  def change_address
    assigning_new_address_object = params[:submit_id] == 'no'
    changed_address_params = JSON.parse(session[:changed_address])
    changed_address = Address.find_by_id(changed_address_params['id']) || Address.new
    changed_address.attributes = changed_address_params
    new_address = assign_address_to_contact(changed_address, assigning_new_address_object)
    @contact.save

    @address = @contact.address || Address.new
    @address_list = Address.find_for_list if new_address
    render 'edit_contact'
  end

  def remove_address
    @old_address = @contact.address
    @old_address_id = @contact.remove_address
    @saved = true unless @old_address_id.nil?
    @address_list = Address.find_for_list
    render 'edit_contact'
  end

  def find
    @contact_list = Contact.where(["upper(last_name) like ?", params[:last_name].upcase << "%"]).
                            order('last_name, first_name')
    render 'find_contact'
  end

  private

  def load_contact
    @contact = Contact.find_by_id(params[:id])
  end

  def changing_address_for_multiple_contacts?
    @contact.address && @contact.address.contacts.size > 1
  end

  def assign_address_to_contact(new_address, assigning_new_address_object)
    if @contact.address.nil? || assigning_new_address_object
      @contact.assign_address(new_address)
      true
    else
      @contact.address.attributes = new_address.attributes.reject { |k,v| k == 'id' }
      false
    end
  end

  def parse_address
    if params[:address_specification_type] == 'existing_address'
      other = Contact.find_by_id(params[:other_id])
      other.address
    elsif specified_address?
      address = Address.new(address_params)
      @contact.errors.add(:base, 'Please specify a valid address') unless address.valid?
      address
    end
  end

  def specified_address?
    params[:address_specification_type] == 'specified_address' ||
            (params[:address] && params[:address][:home_phone] && !params[:address][:home_phone].blank?)
  end

  def contact_params
    params.require(:contact).permit(:prefix, :first_name, :middle_name, :last_name, :birthday, :work_phone, :cell_phone, :email, :website, :address_id)
  end

  def address_params
    params.require(:address).permit(:address1, :address2, :city, :state, :zip, :home_phone, :contact1_id, :contact2_id, :address_type_id)
  end

end


text:
require File.expand_path('../spec_helper', __FILE__)

module Danger
  describe Danger::DangerSamsao do
    describe 'with Dangerfile' do
      before do
        @dangerfile = testing_dangerfile
        @plugin = @dangerfile.samsao
        @work_in_progress = 'Do not merge, PR is a work in progess [WIP]!'

        allow(@plugin.github).to receive(:branch_for_head).and_return('something')
        allow(@plugin.github).to receive(:pr_title).and_return('Something')
      end

      describe 'warn_when_work_in_progess_pr?' do
        it 'warns when PR title contains [WIP] at the end' do
          allow(@plugin.github).to receive(:pr_title).and_return('Marker at the end [WIP]')

          @plugin.check_work_in_progess_pr

          expect(@dangerfile).to have_warning(@work_in_progress)
        end

        it 'warns when PR title contains [WIP] at the start' do
          allow(@plugin.github).to receive(:pr_title).and_return('[WIP] Marker at start')

          @plugin.check_work_in_progess_pr

          expect(@dangerfile).to have_warning(@work_in_progress)
        end

        it 'warns when PR title contains [WIP] in the middle' do
          allow(@plugin.github).to receive(:pr_title).and_return('Marker in [WIP] the middle')

          @plugin.check_work_in_progess_pr

          expect(@dangerfile).to have_warning(@work_in_progress)
        end

        it 'continues when PR title does not contain [WIP] marker' do
          allow(@plugin.github).to receive(:pr_title).and_return('A WIP PR')

          @plugin.check_work_in_progess_pr

          expect(@dangerfile).to have_no_warning
        end
      end
    end
  end
end


text:
class AddStidentIdToProject < ActiveRecord::Migration
  def change
    add_column :projects, :student_id, :integer
  end
end


text:
"""  Milletari F. et al "`V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation
<https://arxiv.org/abs/1606.04797>`_"
"""

from .encoder_decoder import EncoderDecoder
from .resnet import ResNet

class VNet(EncoderDecoder):
    """ VNet model

    **Configuration**

    inputs : dict
        dict with 'images' and 'masks' (see :meth:`~.TFModel._make_inputs`)

    body : dict
        encoder : dict
            num_stages : int
                number of downsampling blocks (default=4)

            blocks : dict
                Parameters for pre-processing blocks:

                filters : int, list of ints or list of lists of ints
                    The number of filters in the output tensor.
                    If int, same number of filters applies to all layers on all stages
                    If list of ints, specifies number of filters in each layer of different stages
                    If list of list of ints, specifies number of filters in different layers on different stages
                    If not given or None, filters parameters in encoder/blocks, decoder/blocks and decoder/upsample
                    default to values which make number of filters double
                    on each stage of encoding and halve on each stage of decoding,
                    provided that `decoder/skip` is `True`. Number of filters on the first stage of encoding will be
                    doubled number of filters in initial_block's output
                    When defining filters manually mind the filters defined in initial_block and head

            downsample : dict
                Parameters for downsampling (see :func:`~.layers.conv_block`)

        decoder : dict
            num_stages : int
                number of upsampling blocks. Defaults to the number of downsamplings.

            blocks : dict
                Parameters for post-processing blocks:

                filters : int, list of ints or list of lists of ints
                    same as encoder/blocks/filters but in reverse order

            upsample : dict
                Parameters for upsampling (see :func:`~.layers.upsample`).

    for more parameters see (see :class:`~.EncoderDecoder`)
    """
    @classmethod
    def default_config(cls):
        config = super().default_config()

        config['initial_block'] += dict(layout='cna Rcna+', kernel_size=5, filters=16)

        config['body/encoder/num_stages'] = 4
        config['body/encoder/blocks'] += dict(base=ResNet.block,
                                              layout=['cna'*2] + ['cna'*3] * 3,
                                              filters=[32, 64, 128, 256],
                                              kernel_size=5)
        config['body/encoder/downsample'] += dict(layout='cna',
                                                  filters=[32, 64, 128, 256],
                                                  kernel_size=2, strides=2)

        config['body/embedding'] = None

        config['body/decoder/upsample'] += dict(layout='tna', kernel_size=2, strides=2)
        config['body/decoder/blocks'] += dict(base=ResNet.block,
                                              layout=['cna'*3] * 3 + ['cna'*2],
                                              filters=[256, 128, 64, 32],
                                              kernel_size=5)

        config['head'] += dict(layout='Rcna+ cna', kernel_size=5, filters=[48, 32])

        config['loss'] = 'ce'
        return config


text:
package io.prediction.examples.java.recommendations.tutorial5;

import io.prediction.examples.java.recommendations.tutorial1.DataSourceParams;
import io.prediction.examples.java.recommendations.tutorial3.Evaluator;

import io.prediction.controller.java.EmptyParams;
import io.prediction.controller.java.IJavaEngineFactory;
import io.prediction.controller.java.JavaSimpleEngine;
import io.prediction.controller.java.JavaSimpleEngineBuilder;
import io.prediction.controller.java.JavaEngineParams;
import io.prediction.controller.java.JavaEngineParamsBuilder;
import io.prediction.controller.java.JavaWorkflow;
import io.prediction.controller.java.WorkflowParamsBuilder;

import java.util.HashMap;

public class Runner5 {

  public static void runEvaluation(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyMahoutRecommendationAlgo",
        new MahoutAlgoParams("LogLikelihoodSimilarity"))
      .build();

    JavaWorkflow.runEngine(
      (new EngineFactory()).apply(),
      engineParams,
      Evaluator.class,
      new EmptyParams(),
      new WorkflowParamsBuilder().batch("MyEngine").verbose(3).build()
    );
  }

  public static void main(String[] args) {
    if (args.length == 0) {
      System.out.println("Error: Please specify the file path as argument");
      System.exit(1);
    }
    runEvaluation(args[0]);
    System.exit(0); // clean shutdown is needed for spark
  }
}


text:
<?php

namespace Pterodactyl\Http\Requests\Admin\Egg;

use Pterodactyl\Http\Requests\Admin\AdminFormRequest;

class EggScriptFormRequest extends AdminFormRequest
{
    /**
     * Return the rules to be used when validating the sent data in the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'script_install' => 'sometimes|nullable|string',
            'script_is_privileged' => 'sometimes|required|boolean',
            'script_entry' => 'sometimes|required|string',
            'script_container' => 'sometimes|required|string',
            'copy_script_from' => 'sometimes|nullable|numeric',
        ];
    }
}


text:
"use strict";
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./smartTables.component'));
//# sourceMappingURL=index.js.map


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
DefaultXMLEncoder (Axis API)
</TITLE>

<META NAME="keywords" CONTENT="org.apache.axis.components.encoding.DefaultXMLEncoder class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.axis.components.encoding

Class DefaultXMLEncoder

java.lang.Object
  org.apache.axis.components.encoding.AbstractXMLEncoder
      org.apache.axis.components.encoding.UTF8Encoder
          org.apache.axis.components.encoding.DefaultXMLEncoder

All Implemented Interfaces:
XMLEncoder

public class DefaultXMLEncoder
extends org.apache.axis.components.encoding.UTF8Encoder

Field Summary

Fields inherited from class org.apache.axis.components.encoding.AbstractXMLEncoder

AMP, CR, GREATER, LESS, LF, QUOTE, TAB

Constructor Summary

DefaultXMLEncoder(java.lang.String encoding)

Method Summary

 java.lang.String
getEncoding()

          gets the encoding supported by this encoder

 void
writeEncoded(java.io.Writer writer,
             java.lang.String xmlString)

          write the encoded version of a given string

Methods inherited from class org.apache.axis.components.encoding.AbstractXMLEncoder

encode, getInitialByteArray

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DefaultXMLEncoder

public DefaultXMLEncoder(java.lang.String encoding)

Method Detail

getEncoding

public java.lang.String getEncoding()

gets the encoding supported by this encoder

Returns:
string

writeEncoded

public void writeEncoded(java.io.Writer writer,
                         java.lang.String xmlString)
                  throws java.io.IOException

write the encoded version of a given string

Parameters:
writer - writer to write this string to
xmlString - string to be encoded

Throws:

java.io.IOException

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 Apache Web Services Project. All Rights Reserved.


text:
"""Tests for the InterleaveDataset serialization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl.testing import parameterized
import numpy as np

from tensorflow.python.data.experimental.kernel_tests.serialization import dataset_serialization_test_base
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import combinations
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.ops import sparse_ops
from tensorflow.python.platform import test

class InterleaveDatasetSerializationTest(
    dataset_serialization_test_base.DatasetSerializationTestBase,
    parameterized.TestCase):

  def _build_iterator_graph(self, input_values, cycle_length, block_length,
                            num_parallel_calls):
    repeat_count = 2
    return dataset_ops.Dataset.from_tensor_slices(input_values).repeat(
        repeat_count).interleave(
            lambda x: dataset_ops.Dataset.from_tensors(x).repeat(x),
            cycle_length, block_length, num_parallel_calls)

  @combinations.generate(
      combinations.times(
          test_base.default_test_combinations(),
          combinations.combine(
              cycle_length=2,
              block_length=[1, 3],
              num_parallel_calls=[None, 1, 2])))
  def testSerializationCore(self, cycle_length, block_length,
                            num_parallel_calls):
    input_values = np.array([4, 5, 6], dtype=np.int64)
    num_outputs = np.sum(input_values) * 2
    # pylint: disable=g-long-lambda
    self.run_core_tests(
        lambda: self._build_iterator_graph(
            input_values, cycle_length, block_length, num_parallel_calls),
        num_outputs)
    # pylint: enable=g-long-lambda

  @combinations.generate(test_base.default_test_combinations())
  def testSparseCore(self):

    def _map_fn(i):
      return sparse_tensor.SparseTensorValue(
          indices=[[0, 0], [1, 1]], values=(i * [1, -1]), dense_shape=[2, 2])

    def _interleave_fn(x):
      return dataset_ops.Dataset.from_tensor_slices(
          sparse_ops.sparse_to_dense(x.indices, x.dense_shape, x.values))

    def _build_dataset():
      return dataset_ops.Dataset.range(10).map(_map_fn).interleave(
          _interleave_fn, cycle_length=1)

    self.run_core_tests(_build_dataset, 20)

if __name__ == "__main__":
  test.main()


text:
import { TestBed, waitForAsync } from "@angular/core/testing";
import { By } from "@angular/platform-browser";
import {
  MdlSimpleTooltipComponent,
  MdlTooltipComponent,
  MdlTooltipDirective,
  MdlTooltipModule,
} from "./mdl-tooltip.module";
import { Component } from "@angular/core";

@Component({
  // eslint-disable-next-line
  selector: "test-icon",
  template: "replaced by the test",
})
class MdlTestTooltipComponent {
  tooltipText = "test";
}

describe("Component: MdlTooltip", () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [MdlTooltipModule.forRoot()],
      declarations: [MdlTestTooltipComponent],
    });
  });

  it("should add the css class mdl-tooltip to the host element", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: "<mdl-tooltip>x</mdl-tooltip>",
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipEl: HTMLElement = fixture.debugElement.query(
      By.directive(MdlTooltipComponent)
    ).nativeElement;
    expect(tooltipEl.classList.contains("mdl-tooltip")).toBe(true);
  });

  it("should add the css class mdl-tooltip--large to the host element", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipEl: HTMLElement = fixture.debugElement.query(
      By.directive(MdlTooltipComponent)
    ).nativeElement;
    expect(tooltipEl.classList.contains("mdl-tooltip--large")).toBe(true);
  });

  it(
    "should add create a simpletooltipcomponent for the mdl-tooltip directive with text",
    waitForAsync(() => {
      TestBed.overrideComponent(MdlTestTooltipComponent, {
        set: {
          template: `

        `,
        },
      });
      const fixture = TestBed.createComponent(MdlTestTooltipComponent);
      fixture.detectChanges();

      // wait for async component creation
      setTimeout(() => {
        // let angular prepare the tooltip with class and text
        fixture.detectChanges();
        // check the result
        const tooltipEl: HTMLElement = fixture.debugElement.query(
          By.directive(MdlSimpleTooltipComponent)
        ).nativeElement;
        expect(tooltipEl.classList.contains("mdl-tooltip")).toBe(true);
      }, 0);
    })
  );

  it("should add the css class is-active if the mouse enters the directive element", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipTriggerElement = fixture.debugElement.query(
      By.directive(MdlTooltipDirective)
    ).nativeElement;

    const evt = document.createEvent("HTMLEvents");
    evt.initEvent("mouseenter", true, true);
    tooltipTriggerElement.dispatchEvent(evt);

    const tooltipDebugEl = fixture.debugElement.query(
      By.directive(MdlTooltipComponent)
    );
    const tooltipEl: HTMLElement = tooltipDebugEl.nativeElement;
    expect(tooltipEl.classList.contains("is-active")).toBe(true);

    expect(tooltipDebugEl.componentInstance.isActive()).toBe(true);
  });

  it("should add the css class is-active after 1 sec if the mouse enters the directive element", (cb) => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip" [delay]="1000">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipTriggerElement = fixture.debugElement.query(
      By.directive(MdlTooltipDirective)
    ).nativeElement;

    const evt = document.createEvent("HTMLEvents");
    evt.initEvent("mouseenter", true, true);
    tooltipTriggerElement.dispatchEvent(evt);

    const tooltipDebugEl = fixture.debugElement.query(
      By.directive(MdlTooltipComponent)
    );
    const tooltipEl: HTMLElement = tooltipDebugEl.nativeElement;

    expect(tooltipEl.classList.contains("is-active")).toBe(false);
    expect(tooltipDebugEl.componentInstance.isActive()).toBe(false);

    setTimeout(() => {
      expect(tooltipEl.classList.contains("is-active")).toBe(true);
      expect(tooltipDebugEl.componentInstance.isActive()).toBe(true);
      cb();
    }, 1010);
  });

  it("should cancel the delay timeout on mouseleave", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip" [delay]="1000">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipTriggerElement = fixture.debugElement.query(
      By.directive(MdlTooltipDirective)
    ).nativeElement;

    spyOn(window, "clearTimeout").and.callThrough();

    let evt = document.createEvent("HTMLEvents");
    evt.initEvent("mouseenter", true, true);
    tooltipTriggerElement.dispatchEvent(evt);

    evt = document.createEvent("HTMLEvents");
    evt.initEvent("mouseleave", true, true);
    tooltipTriggerElement.dispatchEvent(evt);

    expect(window.clearTimeout).toHaveBeenCalled();
  });

  it("should remove the css class is-active if the mouse leaves the directive element", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipTriggerElement = fixture.debugElement.query(
      By.directive(MdlTooltipDirective)
    ).nativeElement;

    const evt = document.createEvent("HTMLEvents");
    evt.initEvent("mouseleave", true, true);
    tooltipTriggerElement.dispatchEvent(evt);

    const tooltipEl: HTMLElement = fixture.debugElement.query(
      By.directive(MdlTooltipComponent)
    ).nativeElement;

    expect(tooltipEl.classList.contains("is-active")).toBe(false);
  });

  it("should add the css class mdl-tooltip--{position} if the position is set to {position}", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

          <mdl-tooltip #t="mdlTooltip">x</mdl-tooltip>
        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    ["bottom", "top", "left", "right"].forEach((position) => {
      const debugElement = fixture.debugElement.query(
        By.directive(MdlTooltipComponent)
      );

      debugElement.componentInstance.position = position;

      fixture.detectChanges();

      const tooltipEl: HTMLElement = debugElement.nativeElement;
      expect(tooltipEl.classList.contains(`mdl-tooltip--${position}`)).toBe(
        true
      );
    });
  });

  it("should change the tooltip text if the text is changed", () => {
    TestBed.overrideComponent(MdlTestTooltipComponent, {
      set: {
        template: `

        `,
      },
    });
    const fixture = TestBed.createComponent(MdlTestTooltipComponent);
    fixture.detectChanges();

    const tooltipEl: HTMLElement = fixture.debugElement.query(
      By.directive(MdlSimpleTooltipComponent)
    ).nativeElement;

    expect(tooltipEl.textContent).toBe("test");

    fixture.componentInstance.tooltipText = "chnaged";
    fixture.detectChanges();

    expect(tooltipEl.textContent).toBe("chnaged");
  });
});


text:
package iso20022

type ServiceTaxDesignation1Code string


text:
/*
 * stack.js
 *
 * an implementation of a stack datastructure
 *
 * methods:
 * - push - put an element on the top of the stack
 * - pop - remove the top element of the stack
 * - top - get a reference to the top element of the stack
 * - empty - determine if the stack is empty or not
 * - size - get the number of items on the stack
 */

/*
 * constructor
 *
 * creates an empty stack object
 */
function Stack() {
    this.size = 0;
    this.head = null;
    this.items = [];
}

/*
 * push: Object -> void
 *
 * puts the given object onto the top of the stack. This updates the size of
 * the stack, the item that head is pointing to, and the array of items.
 */
Stack.prototype.push = function(item) {
    this.size += 1;
    this.head = item;
    this.items.push(item);
};

/*
 * pop: none -> Object
 *
 * removes the top item from the stack and returns it. This ends up updating
 * the stack, the size of the stack, and what is pointed to by the head.
 */
Stack.prototype.pop = function() {
    var poppedItem = this.items.pop();
    if(poppedItem !== undefined) {
        this.size -= 1;
        this.head = this.items[this.size-1];
    }
    return poppedItem;
}

/*
 * top: none -> Object
 *
 * returns the top item on the stack, but unlike the pop function, it does
 * not modify the stack in any way.
 */
Stack.prototype.top = function() {
    return this.head;
}

/*
 * empty: none -> boolean
 *
 * if the stack is empty, then true is returned, otherwise false is
 * returned.
 */
Stack.prototype.empty = function() {
    return this.size == 0;
}


text:
import {boolean, number, object, text, withKnobs} from '@storybook/addon-knobs';

import {
  BentoAccordion,
  BentoAccordionContent,
  BentoAccordionHeader,
  BentoAccordionSection,
} from '#bento/components/bento-accordion/1.0/component';
import {BentoYoutube} from '#bento/components/bento-youtube/1.0/component';

import * as Preact from '#preact';
import {useRef, useState} from '#preact';

export default {
  title: 'YouTube',
  component: BentoYoutube,
  decorators: [withKnobs],
};

const VIDEOID = 'IAvf-rkzNck';
const LIVE_CHANNEL_ID = 'sKCkM-f2Qk4';

export const _default = () => {
  const width = number('width', 300);
  const height = number('height', 200);
  const videoid = text('videoid', VIDEOID);
  const autoplay = boolean('autoplay', false);
  const loop = boolean('loop', false);
  const params = object('params', {});
  const credentials = text('credentials', 'include');
  return (
    <BentoYoutube
      autoplay={autoplay}
      loop={loop}
      videoid={videoid}
      params={params}
      style={{width, height}}
      credentials={credentials}
    />
  );
};

/**
 * @param {*} props
 * @return {*}
 */
function WithStateTable({autoplay, credentials, loop, params, style, videoid}) {
  const ref = useRef(null);

  const [stateTable, setStateTable] = useState(null);
  const setCurrentStateTable = () => {
    setStateTable(

        {['autoplay', 'controls', 'loop', 'currentTime', 'duration'].map(
          (key) => (

              {key}
              {ref.current[key]}

          )
        )}

    );
  };

  return (
    <>
      <BentoYoutube
        ref={ref}
        autoplay={autoplay}
        loop={loop}
        videoid={videoid}
        params={params}
        style={style}
        credentials={credentials}
      />

        <button onClick={setCurrentStateTable}>🔄 current state</button>

      {stateTable}
    </>
  );
}

/**
 * @return {*}
 */
export function State() {
  const width = number('width', 300);
  const height = number('height', 200);
  const videoid = text('videoid', VIDEOID);
  const autoplay = boolean('autoplay', false);
  const loop = boolean('loop', false);
  const params = object('params', {});
  const credentials = text('credentials', 'include');
  return (
    <WithStateTable
      autoplay={autoplay}
      loop={loop}
      videoid={videoid}
      params={params}
      style={{width, height}}
      credentials={credentials}
    />
  );
}

export const liveChannelId = () => {
  const width = number('width', 300);
  const height = number('height', 200);
  const liveChannelid = text('liveChannelid', LIVE_CHANNEL_ID);
  const autoplay = boolean('autoplay', false);
  const loop = boolean('loop', false);
  const params = object('params', {});
  const credentials = text('credentials', 'include');
  return (
    <BentoYoutube
      autoplay={autoplay}
      loop={loop}
      liveChannelid={liveChannelid}
      params={params}
      style={{width, height}}
      credentials={credentials}
    />
  );
};

export const InsideAccordion = () => {
  const width = text('width', '320px');
  const height = text('height', '180px');
  const videoid = text('videoid', VIDEOID);
  const params = object('params', {});
  return (
    <BentoAccordion expandSingleSection>
      <BentoAccordionSection key={1} expanded>
        <BentoAccordionHeader>

Controls

        </BentoAccordionHeader>
        <BentoAccordionContent>
          <BentoYoutube
            loop={true}
            videoid={videoid}
            params={params}
            style={{width, height}}
          />
        </BentoAccordionContent>
      </BentoAccordionSection>
      <BentoAccordionSection key={2}>
        <BentoAccordionHeader>

Autoplay

        </BentoAccordionHeader>
        <BentoAccordionContent>
          <BentoYoutube
            autoplay={true}
            loop={true}
            videoid={videoid}
            params={params}
            style={{width, height}}
          />
        </BentoAccordionContent>
      </BentoAccordionSection>
    </BentoAccordion>
  );
};


text:
import Component from '@ember/component';
import layout from '../templates/components/mdl-card-buttons';

export default Component.extend({
  classNames: ['mdl-card__menu'],
  layout
});