code
stringlengths
5
1M
repo_name
stringlengths
5
109
path
stringlengths
6
208
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
5
1M
/* * Scala (https://www.scala-lang.org) * * Copyright EPFL and Lightbend, Inc. * * Licensed under Apache License 2.0 * (http://www.apache.org/licenses/LICENSE-2.0). * * See the NOTICE file distributed with this work for * additional information regarding copyright ownership. */ package scala.collection package mutable import scala.{unchecked => uc} import scala.annotation.{implicitNotFound, tailrec, unused} import scala.annotation.unchecked.uncheckedVariance import scala.collection.generic.DefaultSerializationProxy import scala.runtime.Statics /** This class implements mutable maps using a hashtable with red-black trees in the buckets for good * worst-case performance on hash collisions. An `Ordering` is required for the element type. Equality * as determined by the `Ordering` has to be consistent with `equals` and `hashCode`. Universal equality * of numeric types is not supported (similar to `AnyRefMap`). * * @see [[https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash-tables "Scala's Collection Library overview"]] * section on `Hash Tables` for more information. * * @define Coll `mutable.CollisionProofHashMap` * @define coll mutable collision-proof hash map * @define mayNotTerminateInf * @define willNotTerminateInf */ final class CollisionProofHashMap[K, V](initialCapacity: Int, loadFactor: Double)(implicit ordering: Ordering[K]) extends AbstractMap[K, V] with MapOps[K, V, Map, CollisionProofHashMap[K, V]] //-- with StrictOptimizedIterableOps[(K, V), Iterable, CollisionProofHashMap[K, V]] with StrictOptimizedMapOps[K, V, Map, CollisionProofHashMap[K, V]] { //-- private[this] final def sortedMapFactory: SortedMapFactory[CollisionProofHashMap] = CollisionProofHashMap def this()(implicit ordering: Ordering[K]) = this(CollisionProofHashMap.defaultInitialCapacity, CollisionProofHashMap.defaultLoadFactor)(ordering) import CollisionProofHashMap.Node private[this] type RBNode = CollisionProofHashMap.RBNode[K, V] private[this] type LLNode = CollisionProofHashMap.LLNode[K, V] /** The actual hash table. */ private[this] var table: Array[Node] = new Array[Node](tableSizeFor(initialCapacity)) /** The next size value at which to resize (capacity * load factor). */ private[this] var threshold: Int = newThreshold(table.length) private[this] var contentSize = 0 override def size: Int = contentSize @`inline` private[this] final def computeHash(o: K): Int = { val h = if(o.asInstanceOf[AnyRef] eq null) 0 else o.hashCode h ^ (h >>> 16) } @`inline` private[this] final def index(hash: Int) = hash & (table.length - 1) override protected def fromSpecific(coll: IterableOnce[(K, V)] @uncheckedVariance): CollisionProofHashMap[K, V] @uncheckedVariance = CollisionProofHashMap.from(coll) override protected def newSpecificBuilder: Builder[(K, V), CollisionProofHashMap[K, V]] @uncheckedVariance = CollisionProofHashMap.newBuilder[K, V] override def empty: CollisionProofHashMap[K, V] = new CollisionProofHashMap[K, V] override def contains(key: K): Boolean = findNode(key) ne null def get(key: K): Option[V] = findNode(key) match { case null => None case nd => Some(nd match { case nd: LLNode @uc => nd.value case nd: RBNode @uc => nd.value }) } @throws[NoSuchElementException] override def apply(key: K): V = findNode(key) match { case null => default(key) case nd => nd match { case nd: LLNode @uc => nd.value case nd: RBNode @uc => nd.value } } override def getOrElse[V1 >: V](key: K, default: => V1): V1 = { val nd = findNode(key) if (nd eq null) default else nd match { case nd: LLNode @uc => nd.value case n => n.asInstanceOf[RBNode].value } } @`inline` private[this] def findNode(elem: K): Node = { val hash = computeHash(elem) table(index(hash)) match { case null => null case n: LLNode @uc => n.getNode(elem, hash) case n => n.asInstanceOf[RBNode].getNode(elem, hash) } } override def sizeHint(size: Int): Unit = { val target = tableSizeFor(((size + 1).toDouble / loadFactor).toInt) if(target > table.length) { if(size == 0) reallocTable(target) else growTable(target) } } override def update(key: K, value: V): Unit = put0(key, value, false) override def put(key: K, value: V): Option[V] = put0(key, value, true) match { case null => None case sm => sm } def addOne(elem: (K, V)): this.type = { put0(elem._1, elem._2, false); this } @`inline` private[this] def put0(key: K, value: V, getOld: Boolean): Some[V] = { if(contentSize + 1 >= threshold) growTable(table.length * 2) val hash = computeHash(key) val idx = index(hash) put0(key, value, getOld, hash, idx) } private[this] def put0(key: K, value: V, getOld: Boolean, hash: Int, idx: Int): Some[V] = { val res = table(idx) match { case n: RBNode @uc => insert(n, idx, key, hash, value) case _old => val old: LLNode = _old.asInstanceOf[LLNode] if(old eq null) { table(idx) = new LLNode(key, hash, value, null) } else { var remaining = CollisionProofHashMap.treeifyThreshold var prev: LLNode = null var n = old while((n ne null) && n.hash <= hash && remaining > 0) { if(n.hash == hash && key == n.key) { val old = n.value n.value = value return (if(getOld) Some(old) else null) } prev = n n = n.next remaining -= 1 } if(remaining == 0) { treeify(old, idx) return put0(key, value, getOld, hash, idx) } if(prev eq null) table(idx) = new LLNode(key, hash, value, old) else prev.next = new LLNode(key, hash, value, prev.next) } true } if(res) contentSize += 1 if(res) Some(null.asInstanceOf[V]) else null //TODO } private[this] def treeify(old: LLNode, idx: Int): Unit = { table(idx) = CollisionProofHashMap.leaf(old.key, old.hash, old.value, red = false, null) var n: LLNode = old.next while(n ne null) { val root = table(idx).asInstanceOf[RBNode] insertIntoExisting(root, idx, n.key, n.hash, n.value, root) n = n.next } } override def addAll(xs: IterableOnce[(K, V)]): this.type = { val k = xs.knownSize if(k > 0) sizeHint(contentSize + k) super.addAll(xs) } // returns the old value or Statics.pfMarker if not found private[this] def remove0(elem: K) : Any = { val hash = computeHash(elem) val idx = index(hash) table(idx) match { case null => Statics.pfMarker case t: RBNode @uc => val v = delete(t, idx, elem, hash) if(v.asInstanceOf[AnyRef] ne Statics.pfMarker) contentSize -= 1 v case nd: LLNode @uc if nd.hash == hash && nd.key == elem => // first element matches table(idx) = nd.next contentSize -= 1 nd.value case nd: LLNode @uc => // find an element that matches var prev = nd var next = nd.next while((next ne null) && next.hash <= hash) { if(next.hash == hash && next.key == elem) { prev.next = next.next contentSize -= 1 return next.value } prev = next next = next.next } Statics.pfMarker } } private[this] abstract class MapIterator[R] extends AbstractIterator[R] { protected[this] def extract(node: LLNode): R protected[this] def extract(node: RBNode): R private[this] var i = 0 private[this] var node: Node = null private[this] val len = table.length def hasNext: Boolean = { if(node ne null) true else { while(i < len) { val n = table(i) i += 1 n match { case null => case n: RBNode @uc => node = CollisionProofHashMap.minNodeNonNull(n) return true case n: LLNode @uc => node = n return true } } false } } def next(): R = if(!hasNext) Iterator.empty.next() else node match { case n: RBNode @uc => val r = extract(n) node = CollisionProofHashMap.successor(n ) r case n: LLNode @uc => val r = extract(n) node = n.next r } } override def keysIterator: Iterator[K] = { if (isEmpty) Iterator.empty else new MapIterator[K] { protected[this] def extract(node: LLNode) = node.key protected[this] def extract(node: RBNode) = node.key } } override def iterator: Iterator[(K, V)] = { if (isEmpty) Iterator.empty else new MapIterator[(K, V)] { protected[this] def extract(node: LLNode) = (node.key, node.value) protected[this] def extract(node: RBNode) = (node.key, node.value) } } private[this] def growTable(newlen: Int) = { var oldlen = table.length table = java.util.Arrays.copyOf(table, newlen) threshold = newThreshold(table.length) while(oldlen < newlen) { var i = 0 while (i < oldlen) { val old = table(i) if(old ne null) splitBucket(old, i, i + oldlen, oldlen) i += 1 } oldlen *= 2 } } @`inline` private[this] def reallocTable(newlen: Int) = { table = new Array(newlen) threshold = newThreshold(table.length) } @`inline` private[this] def splitBucket(tree: Node, lowBucket: Int, highBucket: Int, mask: Int): Unit = tree match { case t: LLNode @uc => splitBucket(t, lowBucket, highBucket, mask) case t: RBNode @uc => splitBucket(t, lowBucket, highBucket, mask) } private[this] def splitBucket(list: LLNode, lowBucket: Int, highBucket: Int, mask: Int): Unit = { val preLow: LLNode = new LLNode(null.asInstanceOf[K], 0, null.asInstanceOf[V], null) val preHigh: LLNode = new LLNode(null.asInstanceOf[K], 0, null.asInstanceOf[V], null) //preLow.next = null //preHigh.next = null var lastLow: LLNode = preLow var lastHigh: LLNode = preHigh var n = list while(n ne null) { val next = n.next if((n.hash & mask) == 0) { // keep low lastLow.next = n lastLow = n } else { // move to high lastHigh.next = n lastHigh = n } n = next } lastLow.next = null if(list ne preLow.next) table(lowBucket) = preLow.next if(preHigh.next ne null) { table(highBucket) = preHigh.next lastHigh.next = null } } private[this] def splitBucket(tree: RBNode, lowBucket: Int, highBucket: Int, mask: Int): Unit = { var lowCount, highCount = 0 tree.foreachNode((n: RBNode) => if((n.hash & mask) != 0) highCount += 1 else lowCount += 1) if(highCount != 0) { if(lowCount == 0) { table(lowBucket) = null table(highBucket) = tree } else { table(lowBucket) = fromNodes(new CollisionProofHashMap.RBNodesIterator(tree).filter(n => (n.hash & mask) == 0), lowCount) table(highBucket) = fromNodes(new CollisionProofHashMap.RBNodesIterator(tree).filter(n => (n.hash & mask) != 0), highCount) } } } private[this] def tableSizeFor(capacity: Int) = (Integer.highestOneBit((capacity-1).max(4))*2).min(1 << 30) private[this] def newThreshold(size: Int) = (size.toDouble * loadFactor).toInt override def clear(): Unit = { java.util.Arrays.fill(table.asInstanceOf[Array[AnyRef]], null) contentSize = 0 } override def remove(key: K): Option[V] = { val v = remove0(key) if(v.asInstanceOf[AnyRef] eq Statics.pfMarker) None else Some(v.asInstanceOf[V]) } def subtractOne(elem: K): this.type = { remove0(elem); this } override def knownSize: Int = size override def isEmpty: Boolean = size == 0 override def foreach[U](f: ((K, V)) => U): Unit = { val len = table.length var i = 0 while(i < len) { val n = table(i) if(n ne null) n match { case n: LLNode @uc => n.foreach(f) case n: RBNode @uc => n.foreach(f) } i += 1 } } override def foreachEntry[U](f: (K, V) => U): Unit = { val len = table.length var i = 0 while(i < len) { val n = table(i) if(n ne null) n match { case n: LLNode @uc => n.foreachEntry(f) case n: RBNode @uc => n.foreachEntry(f) } i += 1 } } protected[this] def writeReplace(): AnyRef = new DefaultSerializationProxy(new CollisionProofHashMap.DeserializationFactory[K, V](table.length, loadFactor, ordering), this) override protected[this] def className = "CollisionProofHashMap" override def getOrElseUpdate(key: K, defaultValue: => V): V = { val hash = computeHash(key) val idx = index(hash) table(idx) match { case null => () case n: LLNode @uc => val nd = n.getNode(key, hash) if(nd != null) return nd.value case n => val nd = n.asInstanceOf[RBNode].getNode(key, hash) if(nd != null) return nd.value } val table0 = table val default = defaultValue if(contentSize + 1 >= threshold) growTable(table.length * 2) // Avoid recomputing index if the `defaultValue()` or new element hasn't triggered a table resize. val newIdx = if (table0 eq table) idx else index(hash) put0(key, default, false, hash, newIdx) default } ///////////////////// Overrides code from SortedMapOps /** Builds a new `CollisionProofHashMap` by applying a function to all elements of this $coll. * * @param f the function to apply to each element. * @return a new $coll resulting from applying the given function * `f` to each element of this $coll and collecting the results. */ def map[K2, V2](f: ((K, V)) => (K2, V2)) (implicit @implicitNotFound(CollisionProofHashMap.ordMsg) ordering: Ordering[K2]): CollisionProofHashMap[K2, V2] = sortedMapFactory.from(new View.Map[(K, V), (K2, V2)](this, f)) /** Builds a new `CollisionProofHashMap` by applying a function to all elements of this $coll * and using the elements of the resulting collections. * * @param f the function to apply to each element. * @return a new $coll resulting from applying the given collection-valued function * `f` to each element of this $coll and concatenating the results. */ def flatMap[K2, V2](f: ((K, V)) => IterableOnce[(K2, V2)]) (implicit @implicitNotFound(CollisionProofHashMap.ordMsg) ordering: Ordering[K2]): CollisionProofHashMap[K2, V2] = sortedMapFactory.from(new View.FlatMap(this, f)) /** Builds a new sorted map by applying a partial function to all elements of this $coll * on which the function is defined. * * @param pf the partial function which filters and maps the $coll. * @return a new $coll resulting from applying the given partial function * `pf` to each element on which it is defined and collecting the results. * The order of the elements is preserved. */ def collect[K2, V2](pf: PartialFunction[(K, V), (K2, V2)]) (implicit @implicitNotFound(CollisionProofHashMap.ordMsg) ordering: Ordering[K2]): CollisionProofHashMap[K2, V2] = sortedMapFactory.from(new View.Collect(this, pf)) override def concat[V2 >: V](suffix: IterableOnce[(K, V2)]): CollisionProofHashMap[K, V2] = sortedMapFactory.from(suffix match { case it: Iterable[(K, V2)] => new View.Concat(this, it) case _ => iterator.concat(suffix.iterator) }) /** Alias for `concat` */ @`inline` override final def ++ [V2 >: V](xs: IterableOnce[(K, V2)]): CollisionProofHashMap[K, V2] = concat(xs) @deprecated("Consider requiring an immutable Map or fall back to Map.concat", "2.13.0") override def + [V1 >: V](kv: (K, V1)): CollisionProofHashMap[K, V1] = sortedMapFactory.from(new View.Appended(this, kv)) @deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0") override def + [V1 >: V](elem1: (K, V1), elem2: (K, V1), elems: (K, V1)*): CollisionProofHashMap[K, V1] = sortedMapFactory.from(new View.Concat(new View.Appended(new View.Appended(this, elem1), elem2), elems)) ///////////////////// RedBlackTree code derived from mutable.RedBlackTree: @`inline` private[this] def isRed(node: RBNode) = (node ne null) && node.red @`inline` private[this] def isBlack(node: RBNode) = (node eq null) || !node.red @unused @`inline` private[this] def compare(key: K, hash: Int, node: LLNode): Int = { val i = hash - node.hash if(i != 0) i else ordering.compare(key, node.key) } @`inline` private[this] def compare(key: K, hash: Int, node: RBNode): Int = { /*val i = hash - node.hash if(i != 0) i else*/ ordering.compare(key, node.key) } // ---- insertion ---- @tailrec private[this] final def insertIntoExisting(_root: RBNode, bucket: Int, key: K, hash: Int, value: V, x: RBNode): Boolean = { val cmp = compare(key, hash, x) if(cmp == 0) { x.value = value false } else { val next = if(cmp < 0) x.left else x.right if(next eq null) { val z = CollisionProofHashMap.leaf(key, hash, value, red = true, x) if (cmp < 0) x.left = z else x.right = z table(bucket) = fixAfterInsert(_root, z) return true } else insertIntoExisting(_root, bucket, key, hash, value, next) } } private[this] final def insert(tree: RBNode, bucket: Int, key: K, hash: Int, value: V): Boolean = { if(tree eq null) { table(bucket) = CollisionProofHashMap.leaf(key, hash, value, red = false, null) true } else insertIntoExisting(tree, bucket, key, hash, value, tree) } private[this] def fixAfterInsert(_root: RBNode, node: RBNode): RBNode = { var root = _root var z = node while (isRed(z.parent)) { if (z.parent eq z.parent.parent.left) { val y = z.parent.parent.right if (isRed(y)) { z.parent.red = false y.red = false z.parent.parent.red = true z = z.parent.parent } else { if (z eq z.parent.right) { z = z.parent root = rotateLeft(root, z) } z.parent.red = false z.parent.parent.red = true root = rotateRight(root, z.parent.parent) } } else { // symmetric cases val y = z.parent.parent.left if (isRed(y)) { z.parent.red = false y.red = false z.parent.parent.red = true z = z.parent.parent } else { if (z eq z.parent.left) { z = z.parent root = rotateRight(root, z) } z.parent.red = false z.parent.parent.red = true root = rotateLeft(root, z.parent.parent) } } } root.red = false root } // ---- deletion ---- // returns the old value or Statics.pfMarker if not found private[this] def delete(_root: RBNode, bucket: Int, key: K, hash: Int): Any = { var root = _root val z = root.getNode(key, hash: Int) if (z ne null) { val oldValue = z.value var y = z var yIsRed = y.red var x: RBNode = null var xParent: RBNode = null if (z.left eq null) { x = z.right root = transplant(root, z, z.right) xParent = z.parent } else if (z.right eq null) { x = z.left root = transplant(root, z, z.left) xParent = z.parent } else { y = CollisionProofHashMap.minNodeNonNull(z.right) yIsRed = y.red x = y.right if (y.parent eq z) xParent = y else { xParent = y.parent root = transplant(root, y, y.right) y.right = z.right y.right.parent = y } root = transplant(root, z, y) y.left = z.left y.left.parent = y y.red = z.red } if (!yIsRed) root = fixAfterDelete(root, x, xParent) if(root ne _root) table(bucket) = root oldValue } else Statics.pfMarker } private[this] def fixAfterDelete(_root: RBNode, node: RBNode, parent: RBNode): RBNode = { var root = _root var x = node var xParent = parent while ((x ne root) && isBlack(x)) { if (x eq xParent.left) { var w = xParent.right // assert(w ne null) if (w.red) { w.red = false xParent.red = true root = rotateLeft(root, xParent) w = xParent.right } if (isBlack(w.left) && isBlack(w.right)) { w.red = true x = xParent } else { if (isBlack(w.right)) { w.left.red = false w.red = true root = rotateRight(root, w) w = xParent.right } w.red = xParent.red xParent.red = false w.right.red = false root = rotateLeft(root, xParent) x = root } } else { // symmetric cases var w = xParent.left // assert(w ne null) if (w.red) { w.red = false xParent.red = true root = rotateRight(root, xParent) w = xParent.left } if (isBlack(w.right) && isBlack(w.left)) { w.red = true x = xParent } else { if (isBlack(w.left)) { w.right.red = false w.red = true root = rotateLeft(root, w) w = xParent.left } w.red = xParent.red xParent.red = false w.left.red = false root = rotateRight(root, xParent) x = root } } xParent = x.parent } if (x ne null) x.red = false root } // ---- helpers ---- @`inline` private[this] def rotateLeft(_root: RBNode, x: RBNode): RBNode = { var root = _root val y = x.right x.right = y.left val xp = x.parent if (y.left ne null) y.left.parent = x y.parent = xp if (xp eq null) root = y else if (x eq xp.left) xp.left = y else xp.right = y y.left = x x.parent = y root } @`inline` private[this] def rotateRight(_root: RBNode, x: RBNode): RBNode = { var root = _root val y = x.left x.left = y.right val xp = x.parent if (y.right ne null) y.right.parent = x y.parent = xp if (xp eq null) root = y else if (x eq xp.right) xp.right = y else xp.left = y y.right = x x.parent = y root } /** * Transplant the node `from` to the place of node `to`. This is done by setting `from` as a child of `to`'s previous * parent and setting `from`'s parent to the `to`'s previous parent. The children of `from` are left unchanged. */ private[this] def transplant(_root: RBNode, to: RBNode, from: RBNode): RBNode = { var root = _root if (to.parent eq null) root = from else if (to eq to.parent.left) to.parent.left = from else to.parent.right = from if (from ne null) from.parent = to.parent root } // building def fromNodes(xs: Iterator[Node], size: Int): RBNode = { val maxUsedDepth = 32 - Integer.numberOfLeadingZeros(size) // maximum depth of non-leaf nodes def f(level: Int, size: Int): RBNode = size match { case 0 => null case 1 => val nn = xs.next() val (key, hash, value) = nn match { case nn: LLNode @uc => (nn.key, nn.hash, nn.value) case nn: RBNode @uc => (nn.key, nn.hash, nn.value) } new RBNode(key, hash, value, level == maxUsedDepth && level != 1, null, null, null) case n => val leftSize = (size-1)/2 val left = f(level+1, leftSize) val nn = xs.next() val right = f(level+1, size-1-leftSize) val (key, hash, value) = nn match { case nn: LLNode @uc => (nn.key, nn.hash, nn.value) case nn: RBNode @uc => (nn.key, nn.hash, nn.value) } val n = new RBNode(key, hash, value, false, left, right, null) if(left ne null) left.parent = n right.parent = n n } f(1, size) } } /** * $factoryInfo * @define Coll `mutable.CollisionProofHashMap` * @define coll mutable collision-proof hash map */ @SerialVersionUID(3L) object CollisionProofHashMap extends SortedMapFactory[CollisionProofHashMap] { private[collection] final val ordMsg = "No implicit Ordering[${K2}] found to build a CollisionProofHashMap[${K2}, ${V2}]. You may want to upcast to a Map[${K}, ${V}] first by calling `unsorted`." def from[K : Ordering, V](it: scala.collection.IterableOnce[(K, V)]): CollisionProofHashMap[K, V] = { val k = it.knownSize val cap = if(k > 0) ((k + 1).toDouble / defaultLoadFactor).toInt else defaultInitialCapacity new CollisionProofHashMap[K, V](cap, defaultLoadFactor) ++= it } def empty[K : Ordering, V]: CollisionProofHashMap[K, V] = new CollisionProofHashMap[K, V] def newBuilder[K : Ordering, V]: Builder[(K, V), CollisionProofHashMap[K, V]] = newBuilder(defaultInitialCapacity, defaultLoadFactor) def newBuilder[K : Ordering, V](initialCapacity: Int, loadFactor: Double): Builder[(K, V), CollisionProofHashMap[K, V]] = new GrowableBuilder[(K, V), CollisionProofHashMap[K, V]](new CollisionProofHashMap[K, V](initialCapacity, loadFactor)) { override def sizeHint(size: Int) = elems.sizeHint(size) } /** The default load factor for the hash table */ final def defaultLoadFactor: Double = 0.75 /** The default initial capacity for the hash table */ final def defaultInitialCapacity: Int = 16 @SerialVersionUID(3L) private final class DeserializationFactory[K, V](val tableLength: Int, val loadFactor: Double, val ordering: Ordering[K]) extends Factory[(K, V), CollisionProofHashMap[K, V]] with Serializable { def fromSpecific(it: IterableOnce[(K, V)]): CollisionProofHashMap[K, V] = new CollisionProofHashMap[K, V](tableLength, loadFactor)(ordering) ++= it def newBuilder: Builder[(K, V), CollisionProofHashMap[K, V]] = CollisionProofHashMap.newBuilder(tableLength, loadFactor)(ordering) } @unused @`inline` private def compare[K, V](key: K, hash: Int, node: LLNode[K, V])(implicit ord: Ordering[K]): Int = { val i = hash - node.hash if(i != 0) i else ord.compare(key, node.key) } @`inline` private def compare[K, V](key: K, hash: Int, node: RBNode[K, V])(implicit ord: Ordering[K]): Int = { /*val i = hash - node.hash if(i != 0) i else*/ ord.compare(key, node.key) } private final val treeifyThreshold = 8 // Superclass for RBNode and LLNode to help the JIT with optimizing instance checks, but no shared common fields. // Keeping calls monomorphic where possible and dispatching manually where needed is faster. sealed abstract class Node /////////////////////////// Red-Black Tree Node final class RBNode[K, V](var key: K, var hash: Int, var value: V, var red: Boolean, var left: RBNode[K, V], var right: RBNode[K, V], var parent: RBNode[K, V]) extends Node { override def toString: String = "RBNode(" + key + ", " + hash + ", " + value + ", " + red + ", " + left + ", " + right + ")" @tailrec def getNode(k: K, h: Int)(implicit ord: Ordering[K]): RBNode[K, V] = { val cmp = compare(k, h, this) if (cmp < 0) { if(left ne null) left.getNode(k, h) else null } else if (cmp > 0) { if(right ne null) right.getNode(k, h) else null } else this } def foreach[U](f: ((K, V)) => U): Unit = { if(left ne null) left.foreach(f) f((key, value)) if(right ne null) right.foreach(f) } def foreachEntry[U](f: (K, V) => U): Unit = { if(left ne null) left.foreachEntry(f) f(key, value) if(right ne null) right.foreachEntry(f) } def foreachNode[U](f: RBNode[K, V] => U): Unit = { if(left ne null) left.foreachNode(f) f(this) if(right ne null) right.foreachNode(f) } } @`inline` private def leaf[A, B](key: A, hash: Int, value: B, red: Boolean, parent: RBNode[A, B]): RBNode[A, B] = new RBNode(key, hash, value, red, null, null, parent) @tailrec private def minNodeNonNull[A, B](node: RBNode[A, B]): RBNode[A, B] = if (node.left eq null) node else minNodeNonNull(node.left) /** * Returns the node that follows `node` in an in-order tree traversal. If `node` has the maximum key (and is, * therefore, the last node), this method returns `null`. */ private def successor[A, B](node: RBNode[A, B]): RBNode[A, B] = { if (node.right ne null) minNodeNonNull(node.right) else { var x = node var y = x.parent while ((y ne null) && (x eq y.right)) { x = y y = y.parent } y } } private final class RBNodesIterator[A, B](tree: RBNode[A, B])(implicit @unused ord: Ordering[A]) extends AbstractIterator[RBNode[A, B]] { private[this] var nextNode: RBNode[A, B] = if(tree eq null) null else minNodeNonNull(tree) def hasNext: Boolean = nextNode ne null @throws[NoSuchElementException] def next(): RBNode[A, B] = nextNode match { case null => Iterator.empty.next() case node => nextNode = successor(node) node } } /////////////////////////// Linked List Node private final class LLNode[K, V](var key: K, var hash: Int, var value: V, var next: LLNode[K, V]) extends Node { override def toString = s"LLNode($key, $value, $hash) -> $next" private[this] def eq(a: Any, b: Any): Boolean = if(a.asInstanceOf[AnyRef] eq null) b.asInstanceOf[AnyRef] eq null else a.asInstanceOf[AnyRef].equals(b) @tailrec def getNode(k: K, h: Int)(implicit ord: Ordering[K]): LLNode[K, V] = { if(h == hash && eq(k, key) /*ord.compare(k, key) == 0*/) this else if((next eq null) || (hash > h)) null else next.getNode(k, h) } @tailrec def foreach[U](f: ((K, V)) => U): Unit = { f((key, value)) if(next ne null) next.foreach(f) } @tailrec def foreachEntry[U](f: (K, V) => U): Unit = { f(key, value) if(next ne null) next.foreachEntry(f) } @tailrec def foreachNode[U](f: LLNode[K, V] => U): Unit = { f(this) if(next ne null) next.foreachNode(f) } } }
scala/scala
src/library/scala/collection/mutable/CollisionProofHashMap.scala
Scala
apache-2.0
30,458
package com.ovoenergy.comms.helpers import com.ovoenergy.comms.model.{CancellationRequested, LoggableEvent} import org.slf4j.{LoggerFactory, MDC} trait TraceTokenProvider[E] { def traceToken(e: E): String } trait EventLogger[E] { def debug(e: E, message: String): Unit def info(e: E, message: String): Unit def warn(e: E, message: String): Unit def warn(e: E, message: String, error: Throwable): Unit def error(e: E, message: String): Unit def error(e: E, message: String, error: Throwable): Unit } trait EventLoggerL1 { implicit def summonLoggerFromLoggableEvent[E <: LoggableEvent]: EventLogger[E] = { new EventLogger[E] { def loggerName: String = getClass.getSimpleName.reverse.dropWhile(_ == '$').reverse lazy val log = LoggerFactory.getLogger(loggerName) override def debug(e: E, message: String): Unit = log(e.mdcMap, () => { log.debug(message + s", event: ${e.loggableString}") }) override def info(e: E, message: String): Unit = log(e.mdcMap, () => { log.info(message + s", event: ${e.loggableString}") }) override def warn(e: E, message: String): Unit = log(e.mdcMap, () => log.warn(message)) override def warn(e: E, message: String, error: Throwable): Unit = { log(e.mdcMap, () => log.warn(message, error)) } override def error(e: E, message: String): Unit = log(e.mdcMap, () => log.error(message)) override def error(e: E, message: String, error: Throwable): Unit = { log(e.mdcMap, () => log.error(message, error)) } private def log(mdcMap: Map[String, String], loggingFunction: () => Unit) { try { mdcMap.foreach { case (k, v) => MDC.put(k, v) } loggingFunction() } finally { mdcMap.foreach { case (k, _) => MDC.remove(k) } } } } } implicit def summonLoggerFromTraceTokenProvider[E: TraceTokenProvider]: EventLogger[E] = { val tokenProvider = implicitly[TraceTokenProvider[E]] new EventLogger[E] { def loggerName: String = getClass.getSimpleName.reverse.dropWhile(_ == '$').reverse lazy val log = LoggerFactory.getLogger(loggerName) override def debug(e: E, message: String): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.debug(message)) } override def info(e: E, message: String): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.info(message)) } override def warn(e: E, message: String): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.warn(message)) } override def warn(e: E, message: String, error: Throwable): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.warn(message, error)) } override def error(e: E, message: String): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.error(message)) } override def error(e: E, message: String, error: Throwable): Unit = { log(Map("traceToken" -> tokenProvider.traceToken(e)), () => log.error(message, error)) } private def log(mdcMap: Map[String, String], loggingFunction: () => Unit) { try { mdcMap.foreach { case (k, v) => MDC.put(k, v) } loggingFunction() } finally { mdcMap.foreach { case (k, _) => MDC.remove(k) } } } } } } object EventLogger extends EventLoggerL1 { private def traceTokenExtractor[T](f: T => String) = new TraceTokenProvider[T] { override def traceToken(e: T): String = f(e) } implicit val cancellationRequested: TraceTokenProvider[CancellationRequested] = traceTokenExtractor[CancellationRequested](_.metadata.traceToken) }
ovotech/comms-kafka-serialisation
modules/helpers/src/main/scala/com/ovoenergy/comms/helpers/LoggingWithMDC.scala
Scala
mit
3,801
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kafka.api import kafka.common.{OffsetAndMetadata, OffsetMetadataAndError} import kafka.common._ import kafka.message.{ByteBufferMessageSet, Message} import kafka.common.TopicAndPartition import kafka.utils.TestUtils import TestUtils.createBroker import java.nio.ByteBuffer import org.apache.kafka.common.network.ListenerName import org.apache.kafka.common.protocol.{Errors, SecurityProtocol} import org.apache.kafka.common.utils.Time import org.junit._ import org.scalatest.junit.JUnitSuite import org.junit.Assert._ object SerializationTestUtils { private val topic1 = "test1" private val topic2 = "test2" private val partitionDataFetchResponse0 = new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("first message".getBytes))) private val partitionDataFetchResponse1 = new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("second message".getBytes))) private val partitionDataFetchResponse2 = new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("third message".getBytes))) private val partitionDataFetchResponse3 = new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("fourth message".getBytes))) private val partitionDataFetchResponseMap = Map((0, partitionDataFetchResponse0), (1, partitionDataFetchResponse1), (2, partitionDataFetchResponse2), (3, partitionDataFetchResponse3)) private val topicDataFetchResponse = { val groupedData = Array(topic1, topic2).flatMap(topic => partitionDataFetchResponseMap.map(partitionAndData => (TopicAndPartition(topic, partitionAndData._1), partitionAndData._2))) collection.immutable.Map(groupedData:_*) } private val partitionDataMessage0 = new ByteBufferMessageSet(new Message("first message".getBytes)) private val partitionDataMessage1 = new ByteBufferMessageSet(new Message("second message".getBytes)) private val partitionDataMessage2 = new ByteBufferMessageSet(new Message("third message".getBytes)) private val partitionDataMessage3 = new ByteBufferMessageSet(new Message("fourth message".getBytes)) private val partitionDataProducerRequestArray = Array(partitionDataMessage0, partitionDataMessage1, partitionDataMessage2, partitionDataMessage3) val topicDataProducerRequest = { val groupedData = Array(topic1, topic2).flatMap(topic => partitionDataProducerRequestArray.zipWithIndex.map { case(partitionDataMessage, partition) => (TopicAndPartition(topic, partition), partitionDataMessage) }) collection.mutable.Map(groupedData:_*) } private val requestInfos = collection.immutable.Map( TopicAndPartition(topic1, 0) -> PartitionFetchInfo(1000, 100), TopicAndPartition(topic1, 1) -> PartitionFetchInfo(2000, 100), TopicAndPartition(topic1, 2) -> PartitionFetchInfo(3000, 100), TopicAndPartition(topic1, 3) -> PartitionFetchInfo(4000, 100), TopicAndPartition(topic2, 0) -> PartitionFetchInfo(1000, 100), TopicAndPartition(topic2, 1) -> PartitionFetchInfo(2000, 100), TopicAndPartition(topic2, 2) -> PartitionFetchInfo(3000, 100), TopicAndPartition(topic2, 3) -> PartitionFetchInfo(4000, 100) ) private val brokers = List(createBroker(0, "localhost", 1011), createBroker(0, "localhost", 1012), createBroker(0, "localhost", 1013)) def createTestProducerRequest: ProducerRequest = { new ProducerRequest(1, "client 1", 0, 1000, topicDataProducerRequest) } def createTestProducerResponse: ProducerResponse = ProducerResponse(1, Map( TopicAndPartition(topic1, 0) -> ProducerResponseStatus(Errors.forCode(0.toShort), 10001), TopicAndPartition(topic2, 0) -> ProducerResponseStatus(Errors.forCode(0.toShort), 20001) ), ProducerRequest.CurrentVersion, 100) def createTestFetchRequest: FetchRequest = new FetchRequest(requestInfo = requestInfos.toVector) def createTestFetchResponse: FetchResponse = FetchResponse(1, topicDataFetchResponse.toVector) def createTestOffsetRequest = new OffsetRequest( collection.immutable.Map(TopicAndPartition(topic1, 1) -> PartitionOffsetRequestInfo(1000, 200)), replicaId = 0 ) def createTestOffsetResponse: OffsetResponse = { new OffsetResponse(0, collection.immutable.Map( TopicAndPartition(topic1, 1) -> PartitionOffsetsResponse(Errors.NONE, Seq(1000l, 2000l, 3000l, 4000l))) ) } def createTestOffsetCommitRequestV2: OffsetCommitRequest = { new OffsetCommitRequest( groupId = "group 1", retentionMs = Time.SYSTEM.milliseconds, requestInfo=collection.immutable.Map( TopicAndPartition(topic1, 0) -> OffsetAndMetadata(42L, "some metadata"), TopicAndPartition(topic1, 1) -> OffsetAndMetadata(100L, OffsetMetadata.NoMetadata) )) } def createTestOffsetCommitRequestV1: OffsetCommitRequest = { new OffsetCommitRequest( versionId = 1, groupId = "group 1", requestInfo = collection.immutable.Map( TopicAndPartition(topic1, 0) -> OffsetAndMetadata(42L, "some metadata", Time.SYSTEM.milliseconds), TopicAndPartition(topic1, 1) -> OffsetAndMetadata(100L, OffsetMetadata.NoMetadata, Time.SYSTEM.milliseconds) )) } def createTestOffsetCommitRequestV0: OffsetCommitRequest = { new OffsetCommitRequest( versionId = 0, groupId = "group 1", requestInfo = collection.immutable.Map( TopicAndPartition(topic1, 0) -> OffsetAndMetadata(42L, "some metadata"), TopicAndPartition(topic1, 1) -> OffsetAndMetadata(100L, OffsetMetadata.NoMetadata) )) } def createTestOffsetCommitResponse: OffsetCommitResponse = { new OffsetCommitResponse(collection.immutable.Map(TopicAndPartition(topic1, 0) -> Errors.NONE, TopicAndPartition(topic1, 1) -> Errors.NONE)) } def createTestOffsetFetchRequest: OffsetFetchRequest = { new OffsetFetchRequest("group 1", Seq( TopicAndPartition(topic1, 0), TopicAndPartition(topic1, 1) )) } def createTestOffsetFetchResponse: OffsetFetchResponse = { new OffsetFetchResponse(collection.immutable.Map( TopicAndPartition(topic1, 0) -> OffsetMetadataAndError(42L, "some metadata", Errors.NONE), TopicAndPartition(topic1, 1) -> OffsetMetadataAndError(100L, OffsetMetadata.NoMetadata, Errors.UNKNOWN_TOPIC_OR_PARTITION) ), error = Errors.NONE) } def createConsumerMetadataRequest: GroupCoordinatorRequest = GroupCoordinatorRequest("group 1", clientId = "client 1") def createConsumerMetadataResponse: GroupCoordinatorResponse = { GroupCoordinatorResponse(Some( brokers.head.getBrokerEndPoint(ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT))), Errors.NONE, 0) } } class RequestResponseSerializationTest extends JUnitSuite { private val producerRequest = SerializationTestUtils.createTestProducerRequest private val producerResponse = SerializationTestUtils.createTestProducerResponse private val fetchRequest = SerializationTestUtils.createTestFetchRequest private val offsetRequest = SerializationTestUtils.createTestOffsetRequest private val offsetResponse = SerializationTestUtils.createTestOffsetResponse private val offsetCommitRequestV0 = SerializationTestUtils.createTestOffsetCommitRequestV0 private val offsetCommitRequestV1 = SerializationTestUtils.createTestOffsetCommitRequestV1 private val offsetCommitRequestV2 = SerializationTestUtils.createTestOffsetCommitRequestV2 private val offsetCommitResponse = SerializationTestUtils.createTestOffsetCommitResponse private val offsetFetchRequest = SerializationTestUtils.createTestOffsetFetchRequest private val offsetFetchResponse = SerializationTestUtils.createTestOffsetFetchResponse private val consumerMetadataRequest = SerializationTestUtils.createConsumerMetadataRequest private val consumerMetadataResponse = SerializationTestUtils.createConsumerMetadataResponse private val consumerMetadataResponseNoCoordinator = GroupCoordinatorResponse(None, Errors.COORDINATOR_NOT_AVAILABLE, 0) @Test def testSerializationAndDeserialization() { val requestsAndResponses = collection.immutable.Seq(producerRequest, producerResponse, fetchRequest, offsetRequest, offsetResponse, offsetCommitRequestV0, offsetCommitRequestV1, offsetCommitRequestV2, offsetCommitResponse, offsetFetchRequest, offsetFetchResponse, consumerMetadataRequest, consumerMetadataResponse, consumerMetadataResponseNoCoordinator) requestsAndResponses.foreach { original => val buffer = ByteBuffer.allocate(original.sizeInBytes) original.writeTo(buffer) buffer.rewind() val deserializer = original.getClass.getDeclaredMethod("readFrom", classOf[ByteBuffer]) val deserialized = deserializer.invoke(null, buffer) assertFalse("All serialized bytes in " + original.getClass.getSimpleName + " should have been consumed", buffer.hasRemaining) assertEquals("The original and deserialized for " + original.getClass.getSimpleName + " should be the same.", original, deserialized) } } @Test def testProduceResponseVersion() { val oldClientResponse = ProducerResponse(1, Map( TopicAndPartition("t1", 0) -> ProducerResponseStatus(Errors.NONE, 10001), TopicAndPartition("t2", 0) -> ProducerResponseStatus(Errors.NONE, 20001) )) val newClientResponse = ProducerResponse(1, Map( TopicAndPartition("t1", 0) -> ProducerResponseStatus(Errors.NONE, 10001), TopicAndPartition("t2", 0) -> ProducerResponseStatus(Errors.NONE, 20001) ), 1, 100) // new response should have 4 bytes more than the old response since delayTime is an INT32 assertEquals(oldClientResponse.sizeInBytes + 4, newClientResponse.sizeInBytes) val buffer = ByteBuffer.allocate(newClientResponse.sizeInBytes) newClientResponse.writeTo(buffer) buffer.rewind() assertEquals(ProducerResponse.readFrom(buffer).throttleTime, 100) } @Test def testFetchResponseVersion() { val oldClientResponse = FetchResponse(1, Map( TopicAndPartition("t1", 0) -> new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("first message".getBytes))) ).toVector, 0) val newClientResponse = FetchResponse(1, Map( TopicAndPartition("t1", 0) -> new FetchResponsePartitionData(messages = new ByteBufferMessageSet(new Message("first message".getBytes))) ).toVector, 1, 100) // new response should have 4 bytes more than the old response since delayTime is an INT32 assertEquals(oldClientResponse.sizeInBytes + 4, newClientResponse.sizeInBytes) } }
wangcy6/storm_app
frame/kafka-0.11.0/kafka-0.11.0.1-src/core/src/test/scala/unit/kafka/api/RequestResponseSerializationTest.scala
Scala
apache-2.0
11,560
import io.gatling.recorder.GatlingRecorder import io.gatling.recorder.config.RecorderPropertiesBuilder object Recorder extends App { val props = new RecorderPropertiesBuilder props.simulationOutputFolder(IDEPathHelper.recorderOutputDirectory.toString) props.simulationPackage("de.utkast.ozark.loadtests") props.bodiesFolder(IDEPathHelper.bodiesDirectory.toString) GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile)) }
lefloh/ozark-viewengine-loadtests
test/src/test/scala/Recorder.scala
Scala
apache-2.0
457
package shared.model case class Timing(val upper:Int, val lower: Int)
rak4music/My-Musical-Flip-Card
shared/src/main/scala/shared/model/Timing.scala
Scala
apache-2.0
70
package net.usersource.twitpipe import org.scalatest.matchers.MustMatchers import org.scalatest.mock.MockitoSugar import org.scalatest.{BeforeAndAfterEach, FeatureSpec, GivenWhenThen} import org.mockito.Mockito import org.mockito.stubbing.Answer import org.mockito.invocation.InvocationOnMock import akka.actor.Actor import akka.actor.Actor._ import akka.testkit.TestKit import akka.event.EventHandler import akka.util.duration._ import java.io.BufferedReader import java.net.SocketTimeoutException import java.util.concurrent.{TimeUnit, LinkedBlockingQueue} class SampleIngestEndpointHandlingSpec extends FeatureSpec with GivenWhenThen with MustMatchers with BeforeAndAfterEach with MockitoSugar with TestKit { val eventQueue = new LinkedBlockingQueue[EventHandler.Event]() val evtHandler = actorOf(new Actor() { self.dispatcher = EventHandler.EventHandlerDispatcher protected def receive = { case genericEvent: EventHandler.Event => eventQueue.offer(genericEvent) } }) EventHandler.addListener(evtHandler) override def beforeEach() { eventQueue.clear() } feature("Creating a Sample Ingest") { scenario("Creating a connection") { given("I have a mocked Twitter endpoint") val br = mock[BufferedReader] Mockito.when(br.readLine()).thenReturn("some data").thenAnswer( new Answer[Unit] { def answer(p1: InvocationOnMock) { Thread.sleep(100); throw new SocketTimeoutException() } } ) val endpoint = mock[TwitterEndpoint] Mockito.when(endpoint.connect).thenReturn(Right(br)) when("I create a Sample connector") val connector = actorOf( new SampleIngest(endpoint, this.testActor)).start and("I send it a connect message") connector ! Connect then("It shall send me some data") expectMsgClass(5 seconds,classOf[String]) and("we close the connection") connector ! CloseConnection and("wait till actor has had a chance to process nextevent") Thread.sleep(150) Mockito.verify(br).close() } scenario("Failing to connect") { given("I have a mocked Twitter endpoint") val endpoint = mock[TwitterEndpoint] Mockito.when(endpoint.connect).thenReturn(Left(new Error("Connection Failed"))) when("I create a Sample connector") val connector = actorOf( new SampleIngest(endpoint, this.testActor)).start and("I send it a connect message") connector ! Connect then("it shall result in an error event") eventQueue.poll(1000,TimeUnit.MILLISECONDS) match { case e: EventHandler.Error => {} case a: Any => fail("Failed to get Error, got [" + a + "]") } } scenario("Connects but dies after a few messages") { given("I have a mocked Twitter endpoint which will send three messages and then die") val br = mock[BufferedReader] Mockito.when(br.readLine()). thenReturn("some data"). thenReturn("some data"). thenReturn("some data"). thenAnswer( new Answer[Unit] { def answer(p1: InvocationOnMock) { Thread.sleep(100); throw new Exception() } } ) val endpoint = mock[TwitterEndpoint] Mockito.when(endpoint.connect).thenReturn(Right(br)) when("I create a Sample connector on the endpoint") val connector = actorOf(new SampleIngest(endpoint, this.testActor)).start and("I send it a connect message") connector ! Connect then("It shall send me three messages data") expectMsgClass(5 seconds,classOf[String]) expectMsgClass(5 seconds,classOf[String]) expectMsgClass(5 seconds,classOf[String]) and("then we will also see an Info event followed by a Warning event") expectQueuedEvent[EventHandler.Info]("Failed to get Info",1000) expectQueuedEvent[EventHandler.Warning]("Failed to get Warning",1000) and("and see the underlying stream is closed") Thread.sleep(150) Mockito.verify(br).close() } } def expectQueuedEvent[T <:EventHandler.Event]( failMessage: String, millis: Long )(implicit m: Manifest[T]) = { val evt = eventQueue.poll(millis,TimeUnit.MILLISECONDS) if( evt.getClass.getName != m.toString ) fail( failMessage + "\\nExpected [" + m + "] received [" + evt.getClass.getName + "]") } }
glenford/TwitterPipeline
src/test/scala/net/usersource/twitpipe/SampleIngestEndpointHandlingSpec.scala
Scala
apache-2.0
4,326
package text.similarity /** * @author K.Sakamoto * Created on 2016/05/23 */ object DirectionTurner { def reciprocal(score: Double): Double = { if (score == 0) { 1D } else { 1 / score } } def oneMinus(score: Double): Double = { 1D - score } }
ktr-skmt/FelisCatusZero
src/main/scala/text/similarity/DirectionTurner.scala
Scala
apache-2.0
294
package org.beaucatcher.bobject import org.beaucatcher.bson._ import org.beaucatcher.mongo._ import org.beaucatcher.caseclass._ abstract class CollectionAccessWithEntityBObject[IdType]()(implicit val idEncoder: IdEncoder[IdType]) extends CollectionAccessWithOneEntityType[BObject, BObject, IdType, BValue] { override val firstCodecSet = CollectionCodecSetBObject[IdType]()(idEncoder) } object CollectionAccessWithEntityBObject { def apply[IdType: IdEncoder](name: String, migrateCallback: (CollectionAccessWithEntityBObject[IdType], Context) => Unit) = { new CollectionAccessWithEntityBObject[IdType] { override val collectionName = name override def migrate(implicit context: Context) = migrateCallback(this, context) } } } abstract class CollectionAccessWithEntityBObjectIdObjectId extends CollectionAccessWithEntityBObject[ObjectId]()(IdEncoders.objectIdIdEncoder) { } // TODO flip so that the first entity type (which is assumed if none specified) // is EntityType rather than BObject. abstract class CollectionAccessWithEntitiesBObjectOrCaseClass[EntityType <: Product, IdType]()(implicit entityManifest: Manifest[EntityType], idEncoder: IdEncoder[IdType]) extends CollectionAccessWithTwoEntityTypes[BObject, IdType, BObject, BValue, EntityType, Any] { override val firstCodecSet = CollectionCodecSetBObject[IdType]()(idEncoder) override val secondCodecSet = CollectionCodecSetCaseClass[BObject, EntityType, IdType]()(entityManifest, BObjectCodecs.bobjectQueryEncoder, BObjectCodecs.bobjectModifierEncoder, idEncoder) } abstract class CollectionAccessWithEntitiesBObjectOrCaseClassIdObjectId[EntityType <: Product]()(implicit entityManifest: Manifest[EntityType]) extends CollectionAccessWithEntitiesBObjectOrCaseClass[EntityType, ObjectId]()(entityManifest, IdEncoders.objectIdIdEncoder) { }
havocp/beaucatcher
bobject/src/main/scala/org/beaucatcher/bobject/CollectionAccess.scala
Scala
apache-2.0
1,897
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.sql.execution.command import org.apache.spark.sql.QueryTest /** * This base suite contains unified tests for the `MSCK REPAIR TABLE` command that * check V1 and V2 table catalogs. The tests that cannot run for all supported catalogs are * located in more specific test suites: * * - V2 table catalog tests: * `org.apache.spark.sql.execution.command.v2.MsckRepairTableSuite` * - V1 table catalog tests: * `org.apache.spark.sql.execution.command.v1.MsckRepairTableSuiteBase` * - V1 In-Memory catalog: * `org.apache.spark.sql.execution.command.v1.MsckRepairTableSuite` * - V1 Hive External catalog: * `org.apache.spark.sql.hive.execution.command.MsckRepairTableSuite` */ trait MsckRepairTableSuiteBase extends QueryTest with DDLCommandTestUtils { override val command = "MSCK REPAIR TABLE" }
maropu/spark
sql/core/src/test/scala/org/apache/spark/sql/execution/command/MsckRepairTableSuiteBase.scala
Scala
apache-2.0
1,665
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.table.runtime.join import org.apache.flink.api.common.state._ import org.apache.flink.api.common.typeinfo.TypeInformation import org.apache.flink.api.java.tuple.{Tuple2 => JTuple2} import org.apache.flink.configuration.Configuration import org.apache.flink.streaming.api.functions.co.CoProcessFunction import org.apache.flink.table.api.StreamQueryConfig import org.apache.flink.table.runtime.types.CRow import org.apache.flink.types.Row import org.apache.flink.util.Collector /** * Connect data for left stream and right stream. Only use for left or right join with non-equal * predicates. An MapState of type [Row, Long] is used to record how many matched rows for the * specified row. Left and right join without non-equal predicates doesn't need it because rows * from one side can always join rows from the other side as long as join keys are same. * * @param leftType the input type of left stream * @param rightType the input type of right stream * @param resultType the output type of join * @param genJoinFuncName the function code of other non-equi condition * @param genJoinFuncCode the function name of other non-equi condition * @param isLeftJoin the type of join, whether it is the type of left join * @param queryConfig the configuration for the query to generate */ class NonWindowLeftRightJoinWithNonEquiPredicates( leftType: TypeInformation[Row], rightType: TypeInformation[Row], resultType: TypeInformation[CRow], genJoinFuncName: String, genJoinFuncCode: String, isLeftJoin: Boolean, queryConfig: StreamQueryConfig) extends NonWindowOuterJoinWithNonEquiPredicates( leftType, rightType, resultType, genJoinFuncName, genJoinFuncCode, isLeftJoin, queryConfig) { override def open(parameters: Configuration): Unit = { super.open(parameters) val joinType = if (isLeftJoin) "Left" else "Right" LOG.debug(s"Instantiating NonWindow${joinType}JoinWithNonEquiPredicates.") } /** * Puts or Retract an element from the input stream into state and search the other state to * output records meet the condition. The result is NULL from the right side, if there is no * match. Records will be expired in state if state retention time has been specified. */ override def processElement( value: CRow, ctx: CoProcessFunction[CRow, CRow, CRow]#Context, out: Collector[CRow], timerState: ValueState[Long], currentSideState: MapState[Row, JTuple2[Long, Long]], otherSideState: MapState[Row, JTuple2[Long, Long]], recordFromLeft: Boolean): Unit = { val currentJoinCntState = getJoinCntState(joinCntState, recordFromLeft) val inputRow = value.row val cntAndExpiredTime = updateCurrentSide(value, ctx, timerState, currentSideState) if (!value.change && cntAndExpiredTime.f0 <= 0 && recordFromLeft == isLeftJoin) { currentJoinCntState.remove(inputRow) } cRowWrapper.reset() cRowWrapper.setCollector(out) cRowWrapper.setChange(value.change) // join other side data if (recordFromLeft == isLeftJoin) { val joinCnt = preservedJoin(inputRow, recordFromLeft, otherSideState) // init matched cnt only when row cnt is changed from 0 to 1. Each time encountered a // new record from the other side, joinCnt will also be updated. if (cntAndExpiredTime.f0 == 1 && value.change) { currentJoinCntState.put(inputRow, joinCnt) } } else { val otherSideJoinCntState = getJoinCntState(joinCntState, !recordFromLeft) retractJoinWithNonEquiPreds(value, recordFromLeft, otherSideState, otherSideJoinCntState) } } /** * Removes records which are expired from state. Register a new timer if the state still * holds records after the clean-up. Also, clear joinCnt map state when clear rowMapState. */ override def expireOutTimeRow( curTime: Long, rowMapState: MapState[Row, JTuple2[Long, Long]], timerState: ValueState[Long], isLeft: Boolean, ctx: CoProcessFunction[CRow, CRow, CRow]#OnTimerContext): Unit = { expireOutTimeRow(curTime, rowMapState, timerState, isLeft, joinCntState, ctx) } }
zhangminglei/flink
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/join/NonWindowLeftRightJoinWithNonEquiPredicates.scala
Scala
apache-2.0
5,050
package com.zinnia.ml.spark.logisticregression import org.apache.spark.mllib.classification.{LogisticRegressionWithSGD, LogisticRegressionModel} import org.apache.spark.rdd.RDD import org.jblas.DoubleMatrix import org.apache.spark.mllib.regression.LabeledPoint import java.lang.Math import org.apache.spark.mllib.optimization.L1Updater import java.util.Random import io.aos.spark.mllib.util.MLUtils /** * Created with IntelliJ IDEA. * User: Shashank L * Date: 21/1/14 * Time: 11:26 PM * To change this template use File | Settings | File Templates. */ class LogisticRegression { //function which converts the given double array into a n degree polynomial double array where n should be passed as the second parameter def polynomialFeatures(featureArray: Array[Double], degree: Int): Array[Double] = { var outputArray = Array[Double]() for (i <- 1 to degree; j <- 0 to i) { outputArray +:= scala.math.pow(featureArray(0), i - j) * scala.math.pow(featureArray(1), j) } outputArray } //function to split an RDD into 2 parts based on the percentage paramter randomly. seed is an optional parameter to achieve specific randomness def split[T: Manifest](data: RDD[T], percentage: Double, seed: Long = System.currentTimeMillis()): (RDD[T], RDD[T]) = { val randomNumberGenForPartitions = new Random(seed) val partitionRandomNumber = data.partitions.map(each => randomNumberGenForPartitions.nextLong()) val temp = data.mapPartitionsWithIndex((index, iterator) => { val randomNumberGenForRows = new Random(partitionRandomNumber(index)) val intermediate = iterator.map(each => { (each, randomNumberGenForRows.nextDouble()) }) intermediate }) (temp.filter(_._2 <= percentage).map(_._1), temp.filter(_._2 > percentage).map(_._1)) } //function to normalize the features of the labelledPoint in a RDD and return normalized RDD, features Mean and Standard deviation def normaliseFeatures(labelledRDD: RDD[LabeledPoint]): (RDD[LabeledPoint], Array[Double], Array[Double]) = { val numOfFeatures = labelledRDD.first().features.toArray.length val results = MLUtils.computeStats(labelledRDD, numOfFeatures, labelledRDD.count()) val featureMean = results._2.toArray val featureStdDev = results._3.toArray val broadcastMeanAndStdDev = labelledRDD.context.broadcast(featureMean,featureStdDev) val normalizedRDD = labelledRDD.map(point => { val normalizedFeatureArray = new Array[Double](numOfFeatures) val features = point.features for (a <- 0 to numOfFeatures - 1) { if (broadcastMeanAndStdDev.value._1(a) == 0 && broadcastMeanAndStdDev.value._2(a) == 0) { normalizedFeatureArray(a) = 0.0 } else { normalizedFeatureArray(a) = (features(a) - broadcastMeanAndStdDev.value._1(a)) / broadcastMeanAndStdDev.value._2(a) } } LabeledPoint(point.label, normalizedFeatureArray) }) (normalizedRDD, featureMean.toArray, featureStdDev.toArray) } //function runs the Logistic Regression with Stochastic Gradient Descent using options passed as parameter and returns Logistic Regression Model def runRegression(labelledRDD: RDD[LabeledPoint], numberOfIterations: Int, initialWeights: Array[Double], stepSize: Double, miniBatchFraction: Double): LogisticRegressionModel = { val regression = new LogisticRegressionWithSGD() regression.optimizer.setNumIterations(numberOfIterations).setStepSize(stepSize).setMiniBatchFraction(miniBatchFraction) val logisticRegressionModel = regression.run(labelledRDD, initialWeights) logisticRegressionModel } //function runs the Logistic Regression with Stochastic Gradient Descent with regularization using options passed as parameter and returns Logistic Regression Model def runRegularizedRegression(labelledRDD: RDD[LabeledPoint], numberOfIterations: Int, initialWeights: Array[Double], stepSize: Double, miniBatchFraction: Double, regParam: Double): LogisticRegressionModel = { val regression = new LogisticRegressionWithSGD() regression.optimizer.setNumIterations(numberOfIterations).setStepSize(stepSize).setMiniBatchFraction(miniBatchFraction).setRegParam(regParam).setUpdater(new L1Updater) val logisticRegressionModel = regression.run(labelledRDD, initialWeights) logisticRegressionModel } //function to run the Logistic Regression with Stochastic Gradient Descent for multiple RDDs taken as an input through a List of tuples and returns a map of Logistic Regression models. def runMultiClassRegression(listOfMappedRDDs: List[(Int, RDD[LabeledPoint])], numberOfIterations: Int, initialWeights: Array[Double], stepSize: Double, miniBatchFraction: Double): Map[Int, LogisticRegressionModel] = { val broadcastRegressionOptions = listOfMappedRDDs.head._2.context.broadcast(numberOfIterations,initialWeights,stepSize,miniBatchFraction) val rddOfModels = listOfMappedRDDs.map(eachRDD => { //Run the logistic regression for every RDD for every different type of label. val regression = new LogisticRegressionWithSGD() regression.optimizer.setNumIterations(broadcastRegressionOptions.value._1).setStepSize(broadcastRegressionOptions.value._3).setMiniBatchFraction(broadcastRegressionOptions.value._4) val model = regression.run(eachRDD._2, broadcastRegressionOptions.value._2) (eachRDD._1, model) }) rddOfModels.toMap } //function to compute Cost of the labelledPoints passed as a parameter using the model which is also passed as a parameter def computeCost(labelledRDD: RDD[LabeledPoint], model: LogisticRegressionModel): Double = { val broadcastModel = labelledRDD.context.broadcast(model) val labelAndPreds = labelledRDD.map { point => val model = broadcastModel.value val prediction = model.predict(point.features) (point.label, prediction) } val trainErr = labelAndPreds.filter(r => r._1 != r._2).count.toDouble / labelAndPreds.count trainErr } //function to compute Cost of the labelled Points passed as parameter using different models present in a map which is also passed as a paramter def computeCostMultiClass(modelMap: Map[Int, LogisticRegressionModel], labelledRDD: RDD[LabeledPoint]): Double = { val broadcastModelMap = labelledRDD.context.broadcast(modelMap) val labelAndPreds = labelledRDD.map(point => { def predictPoint(model: LogisticRegressionModel, testData: Array[Double]): Double = { val testDataMat = new DoubleMatrix(1, testData.length, testData: _*) val weightMatrix = new DoubleMatrix(model.weights.length, 1, model.toArray.weights: _*) val margin = testDataMat.mmul(weightMatrix).get(0) + model.intercept val value = 1.0 / (1.0 + math.exp(margin * -1)) value } var resultsMap: Map[Int, Double] = Map() val modelMap = broadcastModelMap.value for (i <- 1 to modelMap.size) { resultsMap += (i -> predictPoint(modelMap.get(i).orNull, point.features)) } (point.label, Math.round(resultsMap.maxBy(_._2)._1)) }) val trainErr = labelAndPreds.filter(r => r._1 != r._2).count.toDouble / labelAndPreds.count trainErr } //function used to predict the results based on model and input features passed as a parameter. It handles normalization of the features. def doPrediction(model: LogisticRegressionModel, features: Array[Double], featureMean: Array[Double] = null, featureStd: Array[Double] = null): Double = { if (featureMean != null && featureStd != null) { val normalizedFeatures = new Array[Double](features.length) for (a <- 0 to features.length - 1) { normalizedFeatures(a) = (features(a) - featureMean(a)) / featureStd(a) } val finalPredictedValue = model.predict(normalizedFeatures) finalPredictedValue } else { val finalPredictedValue = model.predict(features) finalPredictedValue } } //function used to predict the results based on model and input features passed as a parameter, returns the class to which the input features belong. It handles normalization of the features. def doPredictionMultiClass(modelMap: Map[Int, LogisticRegressionModel], features: Array[Double], featureMean: Array[Double] = null, featureStd: Array[Double] = null): Double = { if (featureMean != null && featureStd != null) { val normalizedFeatures = new Array[Double](features.length) for (a <- 0 to features.length - 1) { normalizedFeatures(a) = (features(a) - featureMean(a)) / featureStd(a) } var resultsMap: Map[Int, Double] = Map() for (i <- 1 to modelMap.size) { resultsMap += (i -> predictPoint(modelMap.get(i).orNull, normalizedFeatures)) } resultsMap.maxBy(_._2)._1 } else { var resultsMap: Map[Int, Double] = Map() for (i <- 1 to modelMap.size) { resultsMap += (i -> predictPoint(modelMap.get(i).orNull, features)) } resultsMap.maxBy(_._2)._1 } } //function does the prediction similar to predict method in the Logistic Regression model but does not round off the value to 1 or 0. def predictPoint(model: LogisticRegressionModel, features: Array[Double]): Double = { val testDataMat = new DoubleMatrix(1, features.length, features: _*) val weightMatrix = new DoubleMatrix(model.weights.length, 1, model.weights: _*) val margin = testDataMat.mmul(weightMatrix).get(0) + model.intercept val value = 1.0 / (1.0 + math.exp(margin * -1)) value } }
echalkpad/t4f-data
spark/mllib/src/main/tmp1/com/zinnia/ml/spark/logisticregression/LogisticRegression.scala
Scala
apache-2.0
9,547
package scala.reflect.macros package contexts trait Internals extends scala.tools.nsc.transform.TypingTransformers { self: Context => import global._ lazy val internal: ContextInternalApi = new global.SymbolTableInternal with ContextInternalApi { val enclosingOwner = callsiteTyper.context.owner class HofTransformer(hof: (Tree, TransformApi) => Tree) extends Transformer { val api = new TransformApi { def recur(tree: Tree): Tree = hof(tree, this) def default(tree: Tree): Tree = superTransform(tree) } def superTransform(tree: Tree) = super.transform(tree) override def transform(tree: Tree): Tree = hof(tree, api) } def transform(tree: Tree)(transformer: (Tree, TransformApi) => Tree): Tree = new HofTransformer(transformer).transform(tree) class HofTypingTransformer(hof: (Tree, TypingTransformApi) => Tree) extends TypingTransformer(callsiteTyper.context.unit) { self => currentOwner = callsiteTyper.context.owner curTree = EmptyTree localTyper = global.analyzer.newTyper(callsiteTyper.context.make(unit = callsiteTyper.context.unit)) val api = new TypingTransformApi { def recur(tree: Tree): Tree = hof(tree, this) def default(tree: Tree): Tree = superTransform(tree) def atOwner[T](owner: Symbol)(op: => T): T = self.atOwner(owner)(op) def atOwner[T](tree: Tree, owner: Symbol)(op: => T): T = self.atOwner(tree, owner)(op) def currentOwner: Symbol = self.currentOwner def typecheck(tree: Tree): Tree = localTyper.typed(tree) } def superTransform(tree: Tree) = super.transform(tree) override def transform(tree: Tree): Tree = hof(tree, api) } def typingTransform(tree: Tree)(transformer: (Tree, TypingTransformApi) => Tree): Tree = new HofTypingTransformer(transformer).transform(tree) def typingTransform(tree: Tree, owner: Symbol)(transformer: (Tree, TypingTransformApi) => Tree): Tree = { val trans = new HofTypingTransformer(transformer) trans.atOwner(owner)(trans.transform(tree)) } } }
felixmulder/scala
src/compiler/scala/reflect/macros/contexts/Internals.scala
Scala
bsd-3-clause
2,092
package colang.ast.parsed import colang.ast.parsed.expression.{Expression, ImplicitDereferencing, InvalidExpression, TypeReference} import colang.ast.raw import colang.ast.raw.TypeDefinition import colang.issues.{Issue, Issues, Terms} /** * Represents a type. Different type aspects are defined in separate traits to keep this file smaller. * All types are divided into reference and non-reference types: each of these categories has its own concrete * Type subclass. * @param name type name * @param scope enclosing scope * @param definition raw type definition * @param native whether type is native */ abstract class Type(val name: String, val scope: Some[Scope], val definition: Option[TypeDefinition], val native: Boolean = false) extends Symbol with Scope with ObjectMemberContainer with ConstructorContainer { val parent = scope val definitionSite = definition map { _.headSource } val description = Terms.Type // A default constructor is added for every type (it shouldn't be, need to check if the type is Plain) // TODO don't do this if the type isn't plain addConstructor(generateDefaultConstructor) // A copy constructor is added for every type. addConstructor(generateCopyConstructor) // The body of the generated default constructor is empty: field initialization will be injected into it in // InjectFieldInitialization routine just like the other constructors. private def generateDefaultConstructor: Constructor = { val localContext = LocalContext(applicableKind = Terms.Constructor, expectedReturnType = None) val body = new CodeBlock(new LocalScope(Some(this)), localContext, None) new Constructor( type_ = this, parameters = Seq.empty, body = body, definition = None, native = this.native) } private def generateCopyConstructor: Constructor = { val localContext = LocalContext(applicableKind = Terms.Constructor, expectedReturnType = None) val body = new CodeBlock(new LocalScope(Some(this)), localContext, None) val params = Seq(Variable( name = "other", scope = Some(body.innerScope), type_ = this, definition = None)) new Constructor( type_ = this, parameters = params, body = body, definition = None, native = true) } def defaultConstructor: Option[Constructor] = resolveConstructor(Seq.empty, None)._1 def copyConstructor: Constructor = resolveConstructor(Seq(this), None)._1.get /** * Returns true if a type can be implicitly converted to another type. * Note that subclasses may often override this method. This, for example, is the case with ReferenceType. * @param other target type * @return whether implicit conversion is possible */ def isImplicitlyConvertibleTo(other: Type): Boolean = this eq other /** * Returns the most specific type that both types are implicitly convertible to, or None. * @param other other type * @return optional Least Upper Bound */ def leastUpperBound(other: Type): Option[Type] = { if (this isImplicitlyConvertibleTo other) { Some(other) } else if (other isImplicitlyConvertibleTo this) { Some(this) } else None } } /** * Represents a non-reference type. */ class NonReferenceType(name: String, scope: Some[Scope], definition: Option[raw.TypeDefinition], native: Boolean = false) extends Type(name, scope, definition, native) { /** * Returns a reference type associated with this type. * @return reference type */ lazy val reference: ReferenceType = new ReferenceType(this) } /** * Represents a reference type. * Never construct those manually, use Type reference method instead. * @param referenced referenced type. */ class ReferenceType(val referenced: Type) extends Type( name = referenced.name + "&", scope = referenced.scope, definition = None, native = true) { // A default assign method is generated for every reference type. addObjectMember(defaultAssignMethod) private def defaultAssignMethod: Method = { val localContext = LocalContext(applicableKind = Terms.Method, expectedReturnType = Some(this)) val body = new CodeBlock(new LocalScope(Some(this)), localContext, None) val params = Seq(Variable( name = "other", scope = Some(body.innerScope), type_ = referenced, definition = None)) new Method( name = "assign", container = this, returnType = this, parameters = params, body = body, definition = None, native = true) } // References can be implicitly converted to their referenced types, // AND to types they can be implicitly converted to. override def isImplicitlyConvertibleTo(other: Type): Boolean = { (this eq other) || (referenced isImplicitlyConvertibleTo other) } } object Type { def resolve(rawType: raw.expression.Expression)(implicit scope: Scope): (Type, Seq[Issue]) = { val (expression, expressionIssues) = Expression.analyzeInNonLocalContext(rawType) expression match { case TypeReference(type_, _) => (type_, expressionIssues) case _ => val issue = Issues.ExpressionIsNotAType(rawType.source, expression.type_.qualifiedName) (scope.root.unknownType, expressionIssues :+ issue) } } def analyzeReference(rawType: raw.expression.TypeReferencing)(implicit scope: Scope): (Expression, Seq[Issue]) = { val (referenced, referencedIssues) = Type.resolve(rawType.referencedType) referenced match { case referenced: NonReferenceType => (TypeReference(referenced.reference, Some(rawType)), referencedIssues) case rt: ReferenceType => val issue = Issues.OverreferencedType(rawType.source, rt.qualifiedName) (InvalidExpression(), referencedIssues :+ issue) } } /** * Calculates Least Upper Bound of multiple types. See leastUpperBound instance method. * @param types types * @return Least Upper Bound */ def leastUpperBound(types: Type*): Option[Type] = { if (types.isEmpty) { None } else { (types foldLeft Some(types.head).asInstanceOf[Option[Type]]) { (lhsOption, rhs) => lhsOption match { case Some(lhs) => lhs leastUpperBound rhs case None => None } } } } /** * Coerces the expression into given types, performing type conversion if necessary. * This function should only be called when implicit conversion was checked to be possible. * @param from expression to convert * @param to target type * @return resulting expression */ def performImplicitConversion(from: Expression, to: Type): Expression = { from.type_ match { case `to` => from case rt: ReferenceType if rt.referenced == to => ImplicitDereferencing(from) case _ => throw new IllegalArgumentException("can't perform implicit conversion") } } /** * Coerces expressions to given types, performing implicit type conversions where necessary. * This function should only be called when expressions are checked to be implicitly convertible. * @param from expressions to convert * @param to target types * @return resulting expressions */ def performImplicitConversions(from: Seq[Expression], to: Seq[Type]): Seq[Expression] = { if (from.size != to.size) { throw new IllegalArgumentException("source and target lists have different length") } (from zip to) map (performImplicitConversion _).tupled } }
psenchanka/colang
src/main/scala/colang/ast/parsed/Type.scala
Scala
mit
7,792
/** * This file is part of the TA Buddy project. * Copyright (c) 2013-2014 Alexey Aksenov [email protected] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Global License version 3 * as published by the Free Software Foundation with the addition of the * following permission added to Section 15 as permitted in Section 7(a): * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED * BY Limited Liability Company «MEZHGALAKTICHESKIJ TORGOVYJ ALIANS», * Limited Liability Company «MEZHGALAKTICHESKIJ TORGOVYJ ALIANS» DISCLAIMS * THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Global License for more details. * You should have received a copy of the GNU Affero General Global License * along with this program; if not, see http://www.gnu.org/licenses or write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA, 02110-1301 USA, or download the license from the following URL: * http://www.gnu.org/licenses/agpl.html * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Global License. * * In accordance with Section 7(b) of the GNU Affero General Global License, * you must retain the producer line in every report, form or document * that is created or manipulated using TA Buddy. * * You can be released from the requirements of the license by purchasing * a commercial license. Buying such a license is mandatory as soon as you * develop commercial activities involving the TA Buddy software without * disclosing the source code of your own applications. * These activities include: offering paid services to customers, * serving files in a web or/and network application, * shipping TA Buddy with a closed source product. * * For more information, please contact Digimead Team at this * address: [email protected] */ package org.digimead.tabuddy.desktop.core.operation import java.util.concurrent.CancellationException import org.digimead.digi.lib.aop.log import org.digimead.digi.lib.api.XDependencyInjection import org.digimead.digi.lib.log.api.XLoggable import org.digimead.tabuddy.desktop.core.Report import org.digimead.tabuddy.desktop.core.api.XInfo import org.digimead.tabuddy.desktop.core.definition.Operation import org.digimead.tabuddy.desktop.core.definition.api.XOperation import org.digimead.tabuddy.desktop.core.operation.api.XOperationInfo import org.eclipse.core.runtime.{ IAdaptable, IProgressMonitor } /** 'Get information' operation. */ class OperationInfo extends XOperationInfo with XLoggable { /** * Get information. */ override def apply(): Option[Report.Info] = { log.info(s"Get information.") Report.info() } /** * Create 'Get information' operation. */ def operation() = new Implemetation().asInstanceOf[XOperation[XInfo]] /** * Checks that this class can be subclassed. * <p> * The API class is intended to be subclassed only at specific, * controlled point. This method enforces this rule * unless it is overridden. * </p><p> * <em>IMPORTANT:</em> By providing an implementation of this * method that allows a subclass of a class which does not * normally allow subclassing to be created, the implementer * agrees to be fully responsible for the fact that any such * subclass will likely fail. * </p> */ override protected def checkSubclass() {} class Implemetation() extends OperationInfo.Abstract() with XLoggable { @volatile protected var allowExecute = true override def canExecute() = allowExecute override def canRedo() = false override def canUndo() = false protected def execute(monitor: IProgressMonitor, info: IAdaptable): Operation.Result[Report.Info] = try Operation.Result.OK(OperationInfo.this()) catch { case e: CancellationException ⇒ Operation.Result.Cancel() case e: RuntimeException ⇒ Operation.Result.Error(e.getMessage(), e) } protected def redo(monitor: IProgressMonitor, info: IAdaptable): Operation.Result[Report.Info] = throw new UnsupportedOperationException protected def undo(monitor: IProgressMonitor, info: IAdaptable): Operation.Result[Report.Info] = throw new UnsupportedOperationException } } object OperationInfo { /** Stable identifier with OperationInfo DI */ lazy val operation = DI.operation.asInstanceOf[OperationInfo] /** Build a new 'Get information' operation */ @log def apply(): Option[Abstract] = Some(operation.operation().asInstanceOf[Abstract]) /** Bridge between abstract XOperation[api.Info] and concrete Operation[Report.Info] */ abstract class Abstract() extends Operation[Report.Info](s"Get information.") { this: XLoggable ⇒ } /** * Dependency injection routines. */ private object DI extends XDependencyInjection.PersistentInjectable { lazy val operation = injectOptional[XOperationInfo] getOrElse new OperationInfo } }
digimead/digi-TABuddy-desktop
part-core/src/main/scala/org/digimead/tabuddy/desktop/core/operation/OperationInfo.scala
Scala
agpl-3.0
5,334
package org.openurp.edu.eams.teach.planaudit.service.listeners import java.util.Date import org.beangle.commons.collection.Collections import org.beangle.data.model.dao.EntityDao import org.beangle.data.jpa.dao.OqlBuilder import org.beangle.commons.lang.Strings import org.openurp.edu.base.Course import org.openurp.edu.base.code.CourseType import org.openurp.edu.teach.grade.CourseGrade import org.openurp.edu.teach.lesson.CourseTake import org.openurp.edu.teach.planaudit.CourseAuditResult import org.openurp.edu.teach.planaudit.GroupAuditResult import org.openurp.edu.teach.planaudit.PlanAuditResult import org.openurp.edu.teach.planaudit.model.CourseAuditResultBean import org.openurp.edu.teach.planaudit.model.GroupAuditResultBean import org.openurp.edu.eams.teach.planaudit.service.PlanAuditContext import org.openurp.edu.eams.teach.planaudit.service.PlanAuditListener import org.openurp.edu.teach.plan.CourseGroup import org.openurp.edu.teach.plan.PlanCourse import PlanAuditCourseTakeListener._ import org.openurp.edu.teach.grade.Grade import scala.collection.mutable.Buffer object PlanAuditCourseTakeListener { private val TakeCourse2Types = "takeCourse2Types" private val Group2CoursesKey = "group2CoursesKey" } class PlanAuditCourseTakeListener extends PlanAuditListener { private var entityDao: EntityDao = _ var defaultPassed: Boolean = true def startPlanAudit(context: PlanAuditContext): Boolean = { val builder = OqlBuilder.from(classOf[CourseTake], "ct").where("ct.std=:std", context.std) builder.where("not exists(from " + classOf[CourseGrade].getName + " cg where cg.semester=ct.lesson.semester and cg.course=ct.lesson.course " + "and cg.std=ct.std and cg.status=:status)", Grade.Status.Published) builder.where("ct.lesson.semester.endOn >= :now", new Date()) builder.select("ct.lesson.course,ct.lesson.courseType") val course2Types = Collections.newMap[Course, CourseType] for (c <- entityDao.search(builder)) { course2Types.put(c.asInstanceOf[Array[Any]](0).asInstanceOf[Course], c.asInstanceOf[Array[Any]](1).asInstanceOf[CourseType]) } context.params.put(TakeCourse2Types, course2Types) context.params.put(Group2CoursesKey, Collections.newBuffer[Pair[GroupAuditResult, Course]]) true } def startGroupAudit(context: PlanAuditContext, courseGroup: CourseGroup, groupResult: GroupAuditResult): Boolean = { true } def startCourseAudit(context: PlanAuditContext, groupResult: GroupAuditResult, planCourse: PlanCourse): Boolean = { if (context.params.get(TakeCourse2Types).asInstanceOf[collection.mutable.Map[Course, CourseType]] .contains(planCourse.course)) { context.params.get(Group2CoursesKey).asInstanceOf[Buffer[Pair[GroupAuditResult, Course]]] += new Pair(groupResult, planCourse.course) } true } def endPlanAudit(context: PlanAuditContext) { val course2Types = context.params.remove(TakeCourse2Types).asInstanceOf[collection.mutable.Map[Course, CourseType]] val results = context.params.remove(Group2CoursesKey).asInstanceOf[Buffer[Pair[GroupAuditResult, Course]]] val used = Collections.newSet[GroupAuditResult] for (tuple <- results) { add2Group(tuple._2, tuple._1) course2Types.remove(tuple._2) used.add(tuple._1) } val lastTarget = getTargetGroupResult(context) for ((key, value) <- course2Types) { val g = context.coursePlan.group(value) var gr: GroupAuditResult = null if (null == g || g.planCourses.isEmpty) { gr = context.result.groupResult(value) } if (null == gr) gr = lastTarget if (null != gr) { add2Group(key, gr) used.add(gr) } } for (aur <- used) aur.checkPassed(true) } private def add2Group(course: Course, groupResult: GroupAuditResult) { var existedResult: CourseAuditResult = null for (cr <- groupResult.courseResults if cr.course == course) { existedResult = cr //break } groupResult.planResult.partial = true if (existedResult == null) { existedResult = new CourseAuditResultBean() existedResult.course = course existedResult.passed = defaultPassed groupResult.addCourseResult(existedResult) } else { if (defaultPassed) existedResult.passed = defaultPassed existedResult.groupResult.updateCourseResult(existedResult) } if (Strings.isEmpty(existedResult.remark)) { existedResult.remark = "在读" } else { existedResult.remark = (existedResult.remark + "/在读") } } private def getTargetGroupResult(context: PlanAuditContext): GroupAuditResult = { val electiveType = context.standard.convertTarCourseType if (null == electiveType) return null val result = context.result var groupResult = result.groupResult(electiveType) if (null == groupResult) { val groupRs = new GroupAuditResultBean() groupRs.courseType = electiveType groupRs.name = electiveType.name groupRs.groupNum = -1 groupResult = groupRs result.addGroupResult(groupResult) } groupResult } def setEntityDao(entityDao: EntityDao) { this.entityDao = entityDao } }
openurp/edu-eams-webapp
core/src/main/scala/org/openurp/edu/eams/teach/planaudit/service/listeners/PlanAuditCourseTakeListener.scala
Scala
gpl-3.0
5,196
package ch.epfl.yinyang import language.experimental.macros import scala.reflect.macros.blackbox.Context /** * Default implementation of virtualized Scala control structures. * * This trait is adapted from the `EmbeddedControls` trait in * Scala Virtualized. See also * [[https://raw.github.com/namin/scala/topic-virt/src/library/scala/EmbeddedControls.scala]] * * The `EmbeddedControls` trait provides method definitions where * calls to the methods are treated by the compiler in a special way. * The reason to express these calls as methods is to give embedded * DSLs a chance to provide their own definitions and thereby override * the standard interpretation of the compiler. * * Example: When faced with an `if` construct, the `@virtualized` * macro annotation will generate a method call: * `__ifThenElse(cond, thenp, elsep)` * * This method call will be bound to an implementation based on normal * rules of scoping. If it binds to the standard one in this trait, * the corresponding macro will replace it by an `If` tree node. If * not, the call will be left as it is and a staging or interpreting * DSL can take over. * * @note None of the above will happen unless you annotate your code with `@virtualize`. */ trait EmbeddedControls { import EmbeddedControls._ // NOTE: Some of the signatures below have "by-val" arguments where // one would expect "by-name" arguments. However, since these are // all macros the difference is irrelevant. Furthermore, there's // currently a bug precluding the use of "by-name" parameters in // macros (See [[https://issues.scala-lang.org/browse/SI-5778 // SI-5778]]). // Control structures def __ifThenElse[T](cond: Boolean, thenBr: T, elseBr: T): T = macro ifThenElseImpl[T] def __return(expr: Any): Nothing = macro returnImpl def __assign[T](lhs: T, rhs: T): Unit = macro assignImpl[T] def __whileDo(cond: Boolean, body: Unit): Unit = macro whileDoImpl def __doWhile(body: Unit, cond: Boolean): Unit = macro doWhileImpl def __newVar[T](init: T): T = macro newVarImpl[T] def __readVar[T](init: T): T = macro readVarImpl[T] def __lazyValDef[T](init: T): T = macro lazyValDefImpl[T] def __valDef[T](init: T): T = macro valDefImpl[T] // Infix methods for `Any` methods def infix_==(x1: Any, x2: Any): Boolean = macro any_== def infix_!=(x1: Any, x2: Any): Boolean = macro any_!= def infix_##(x: Any): Int = macro any_## def infix_equals(x1: Any, x2: Any): Boolean = macro any_equals def infix_hashCode(x: Any): Int = macro any_hashCode def infix_asInstanceOf[T](x: Any): T = macro any_asInstanceOf[T] def infix_isInstanceOf[T](x: Any): Boolean = macro any_isInstanceOf[T] def infix_toString(x: Any): String = macro any_toString def infix_getClass(x: Any): Class[_] = macro any_getClass // Infix methods for `AnyRef` methods def infix_eq(x1: AnyRef, x2: AnyRef): Boolean = macro anyRef_eq def infix_ne(x1: AnyRef, x2: AnyRef): Boolean = macro anyRef_ne def infix_notify(x: AnyRef): Unit = macro anyRef_notify def infix_notifyAll(x: AnyRef): Unit = macro anyRef_notifyAll def infix_synchronized[T](x: AnyRef, body: T): T = macro anyRef_synchronized[T] def infix_wait(x: AnyRef): Unit = macro anyRef_wait0 def infix_wait(x: AnyRef, timeout: Long): Unit = macro anyRef_wait1 def infix_wait(x: AnyRef, timeout: Long, nanos: Int): Unit = macro anyRef_wait2 def infix_clone(x: AnyRef): AnyRef = macro anyRef_clone def infix_finalize(x: AnyRef): Unit = macro anyRef_finalize } /** * EmbeddedControls companion object containing macro implementations. */ private object EmbeddedControls { // // Control structures def ifThenElseImpl[T](c: Context)( cond: c.Expr[Boolean], thenBr: c.Expr[T], elseBr: c.Expr[T]): c.Expr[T] = { import c.universe._ c.Expr(q"if ($cond) $thenBr else $elseBr") } def returnImpl(c: Context)(expr: c.Expr[Any]): c.Expr[Nothing] = { import c.universe._ c.Expr(q"return $expr") } def assignImpl[T](c: Context)( lhs: c.Expr[T], rhs: c.Expr[T]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$lhs = $rhs") } def whileDoImpl(c: Context)( cond: c.Expr[Boolean], body: c.Expr[Unit]): c.Expr[Unit] = { import c.universe._ c.Expr(q"while ($cond) $body") } def doWhileImpl(c: Context)( body: c.Expr[Unit], cond: c.Expr[Boolean]): c.Expr[Unit] = { import c.universe._ c.Expr(q"do $body while ($cond)") } def newVarImpl[T](c: Context)(init: c.Expr[T]): c.Expr[T] = init def readVarImpl[T](c: Context)(init: c.Expr[T]): c.Expr[T] = init def valDefImpl[T](c: Context)(init: c.Expr[T]): c.Expr[T] = init def lazyValDefImpl[T](c: Context)(init: c.Expr[T]): c.Expr[T] = init // // Poor man's infix methods for `Any` methods def any_==(c: Context)( x1: c.Expr[Any], x2: c.Expr[Any]): c.Expr[Boolean] = { import c.universe._ c.Expr(q"$x1.==($x2)") } def any_!=(c: Context)( x1: c.Expr[Any], x2: c.Expr[Any]): c.Expr[Boolean] = { import c.universe._ c.Expr(q"$x1.!=($x2)") } def any_##(c: Context)(x: c.Expr[Any]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x.##()") } def any_equals(c: Context)( x1: c.Expr[Any], x2: c.Expr[Any]): c.Expr[Boolean] = { import c.universe._ c.Expr(q"$x1.equals($x2)") } def any_hashCode(c: Context)(x: c.Expr[Any]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x.hashCode()") } def any_asInstanceOf[T](c: Context)(x: c.Expr[Any])( implicit tt: c.WeakTypeTag[T]): c.Expr[T] = { import c.universe._ c.Expr(q"$x.asInstanceOf[${tt.tpe}]") } def any_isInstanceOf[T](c: Context)(x: c.Expr[Any])( implicit tt: c.WeakTypeTag[T]): c.Expr[Boolean] = { import c.universe._ c.Expr[Boolean](q"$x.isInstanceOf[${tt.tpe}]") } def any_toString(c: Context)(x: c.Expr[Any]): c.Expr[String] = { import c.universe._ c.Expr(q"$x.toString()") } import scala.language.existentials def any_getClass(c: Context)(x: c.Expr[Any]): c.Expr[Class[_$1]] forSome { type _$1 } = { import c.universe._ c.Expr(q"$x.getClass()") } // // Infix methods for `AnyRef` methods def anyRef_eq(c: Context)( x1: c.Expr[AnyRef], x2: c.Expr[AnyRef]): c.Expr[Boolean] = { import c.universe._ c.Expr(q"$x1.eq($x2)") } def anyRef_ne(c: Context)( x1: c.Expr[AnyRef], x2: c.Expr[AnyRef]): c.Expr[Boolean] = { import c.universe._ c.Expr(q"$x1.ne($x2)") } def anyRef_notify(c: Context)(x: c.Expr[AnyRef]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.notify()") } def anyRef_notifyAll(c: Context)(x: c.Expr[AnyRef]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.notifyAll()") } def anyRef_synchronized[T](c: Context)( x: c.Expr[AnyRef], body: c.Expr[T]): c.Expr[T] = { import c.universe._ c.Expr(q"$x.synchronized($body)") } def anyRef_wait0(c: Context)(x: c.Expr[AnyRef]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.wait()") } def anyRef_wait1(c: Context)( x: c.Expr[AnyRef], timeout: c.Expr[Long]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.wait($timeout)") } def anyRef_wait2(c: Context)( x: c.Expr[AnyRef], timeout: c.Expr[Long], nanos: c.Expr[Int]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.wait($timeout, $nanos)") } def anyRef_clone(c: Context)(x: c.Expr[AnyRef]): c.Expr[AnyRef] = { import c.universe._ c.Expr(q"$x.clone()") } def anyRef_finalize(c: Context)(x: c.Expr[AnyRef]): c.Expr[Unit] = { import c.universe._ c.Expr(q"$x.finalize()") } }
vjovanov/scala-yinyang
components/paradise/src/EmbeddedControls.scala
Scala
bsd-3-clause
7,641
package sri.web.vdom import org.scalajs.dom import sri.core._ import sri.web.SyntheticEvent import scala.scalajs.LinkingInfo.developmentMode import scala.scalajs.js import scala.scalajs.js.Dynamic.{literal => json} import scala.scalajs.js.{`|`, undefined, UndefOr => U} trait SvgTags1 { def feTile( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, in: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) in.foreach(v => props.updateDynamic("in")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feTile",props,children :_*) else inlineReactElement("feTile",props,children :_*) } @inline def fePointLight( x: U[String | Double] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, z: U[String | Double] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) z.foreach(v => props.updateDynamic("z")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("fePointLight",props,children :_*) else inlineReactElement("fePointLight",props,children :_*) } @inline def ellipse( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, cx: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, rx: U[String | Double] = undefined, cursor: U[String] = undefined, cy: U[String | Double] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, ry: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() rx.foreach(v => props.updateDynamic("rx")(v)) onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) cy.foreach(v => props.updateDynamic("cy")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) cx.foreach(v => props.updateDynamic("cx")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) ry.foreach(v => props.updateDynamic("ry")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("ellipse",props,children :_*) else inlineReactElement("ellipse",props,children :_*) } @inline def feFuncB( amplitude: U[Double] = undefined, intercept: U[String] = undefined, tableValues: U[String] = undefined, style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, exponent: U[Double] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, offset: U[String | Double] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, `type`: U[String] = undefined, slope: U[String | Double] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) slope.foreach(v => props.updateDynamic("slope")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) intercept.foreach(v => props.updateDynamic("intercept")(v)) amplitude.foreach(v => props.updateDynamic("amplitude")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) exponent.foreach(v => props.updateDynamic("exponent")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) tableValues.foreach(v => props.updateDynamic("tableValues")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) offset.foreach(v => props.updateDynamic("offset")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) `type`.foreach(v => props.updateDynamic("type")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feFuncB",props,children :_*) else inlineReactElement("feFuncB",props,children :_*) } @inline def filter( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, filterUnits: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, primitiveUnits: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) filterUnits.foreach(v => props.updateDynamic("filterUnits")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) primitiveUnits.foreach(v => props.updateDynamic("primitiveUnits")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("filter",props,children :_*) else inlineReactElement("filter",props,children :_*) } @inline def feDistantLight( style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, elevation: U[Double] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, azimuth: U[Double] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) elevation.foreach(v => props.updateDynamic("elevation")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) azimuth.foreach(v => props.updateDynamic("azimuth")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feDistantLight",props,children :_*) else inlineReactElement("feDistantLight",props,children :_*) } @inline def mesh( style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("mesh",props,children :_*) else inlineReactElement("mesh",props,children :_*) } @inline def marker( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, refY: U[Double] = undefined, viewBox: U[String] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, refX: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, markerWidth: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, preserveAspectRatio: U[Boolean] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, markerUnits: U[String] = undefined, markerHeight: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) refX.foreach(v => props.updateDynamic("refX")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) viewBox.foreach(v => props.updateDynamic("viewBox")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) markerHeight.foreach(v => props.updateDynamic("markerHeight")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) markerUnits.foreach(v => props.updateDynamic("markerUnits")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) markerWidth.foreach(v => props.updateDynamic("markerWidth")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) preserveAspectRatio.foreach(v => props.updateDynamic("preserveAspectRatio")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) refY.foreach(v => props.updateDynamic("refY")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("marker",props,children :_*) else inlineReactElement("marker",props,children :_*) } @inline def feTurbulence( numOctaves: U[Int] = undefined, colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, seed: U[Int] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, baseFrequency: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, `type`: U[String] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, stitchTiles: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) baseFrequency.foreach(v => props.updateDynamic("baseFrequency")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) stitchTiles.foreach(v => props.updateDynamic("stitchTiles")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) numOctaves.foreach(v => props.updateDynamic("numOctaves")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) `type`.foreach(v => props.updateDynamic("type")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) seed.foreach(v => props.updateDynamic("seed")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feTurbulence",props,children :_*) else inlineReactElement("feTurbulence",props,children :_*) } @inline def textPath( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, lengthAdjust: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, startOffset: U[String] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, alignmentBaseline: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, spacing: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, textLength: U[String | Double] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) spacing.foreach(v => props.updateDynamic("spacing")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) startOffset.foreach(v => props.updateDynamic("startOffset")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) alignmentBaseline.foreach(v => props.updateDynamic("alignmentBaseline")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) textLength.foreach(v => props.updateDynamic("textLength")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) lengthAdjust.foreach(v => props.updateDynamic("lengthAdjust")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("textPath",props,children :_*) else inlineReactElement("textPath",props,children :_*) } @inline def unknown( style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("unknown",props,children :_*) else inlineReactElement("unknown",props,children :_*) } @inline def polyline( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, points: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, markerMid: U[String] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, markerStart: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, markerEnd: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) markerEnd.foreach(v => props.updateDynamic("markerEnd")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) markerMid.foreach(v => props.updateDynamic("markerMid")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) points.foreach(v => props.updateDynamic("points")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) markerStart.foreach(v => props.updateDynamic("markerStart")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("polyline",props,children :_*) else inlineReactElement("polyline",props,children :_*) } @inline def linearGradient( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, x2: U[String | Double] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, gradientTransform: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, gradientUnits: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, y1: U[String | Double] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, y2: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, x1: U[String | Double] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, spreadMethod: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) y1.foreach(v => props.updateDynamic("y1")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) gradientUnits.foreach(v => props.updateDynamic("gradientUnits")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) x2.foreach(v => props.updateDynamic("x2")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) x1.foreach(v => props.updateDynamic("x1")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) y2.foreach(v => props.updateDynamic("y2")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) spreadMethod.foreach(v => props.updateDynamic("spreadMethod")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) gradientTransform.foreach(v => props.updateDynamic("gradientTransform")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("linearGradient",props,children :_*) else inlineReactElement("linearGradient",props,children :_*) } @inline def feConvolveMatrix( colorInterpolation: U[String] = undefined, divisor: U[Double] = undefined, kernelUnitLength: U[Double] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, in: U[String] = undefined, textRendering: U[String] = undefined, kernelMatrix: U[js.Array[Double]] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, order: U[Int] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, preserveAlpha: U[Boolean] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, bias: U[Double] = undefined, fontSize: U[String | Double] = undefined, edgeMode: U[String] = undefined, strokeMiterlimit: U[String] = undefined, targetY: U[Double] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, targetX: U[Double] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) bias.foreach(v => props.updateDynamic("bias")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) divisor.foreach(v => props.updateDynamic("divisor")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) preserveAlpha.foreach(v => props.updateDynamic("preserveAlpha")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) kernelUnitLength.foreach(v => props.updateDynamic("kernelUnitLength")(v)) edgeMode.foreach(v => props.updateDynamic("edgeMode")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) in.foreach(v => props.updateDynamic("in")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) targetY.foreach(v => props.updateDynamic("targetY")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) order.foreach(v => props.updateDynamic("order")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) targetX.foreach(v => props.updateDynamic("targetX")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) kernelMatrix.foreach(v => props.updateDynamic("kernelMatrix")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feConvolveMatrix",props,children :_*) else inlineReactElement("feConvolveMatrix",props,children :_*) } @inline def hatchpath( style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("hatchpath",props,children :_*) else inlineReactElement("hatchpath",props,children :_*) } @inline def meshgradient( style: U[js.Any] = undefined, g2: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("meshgradient",props,children :_*) else inlineReactElement("meshgradient",props,children :_*) } @inline def animateTransform( floodColor: U[String] = undefined, begin: U[String] = undefined, xlinkRole: U[String] = undefined, accumulate: U[String] = undefined, keyTimes: U[String] = undefined, xlinkShow: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, fillOpacity: U[String | Double] = undefined, additive: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, calcMode: U[String] = undefined, repeatDur: U[String] = undefined, dur: U[String | Double] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, to: U[String | Double] = undefined, attributeName: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, repeatCount: U[String | Int] = undefined, xlinkHref: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, by: U[Double] = undefined, floodOpacity: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, from: U[Double] = undefined, requiredExtensions: U[String] = undefined, requiredFeatures: U[String] = undefined, end: U[Double] = undefined, values: U[String] = undefined, attributeType: U[String] = undefined, keySplines: U[String] = undefined, allowReorder: U[Boolean] = undefined, `type`: U[String] = undefined, restart: U[String] = undefined, xlinkTitle: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) from.foreach(v => props.updateDynamic("from")(v)) values.foreach(v => props.updateDynamic("values")(v)) begin.foreach(v => props.updateDynamic("begin")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) repeatCount.foreach(v => props.updateDynamic("repeatCount")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) to.foreach(v => props.updateDynamic("to")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) calcMode.foreach(v => props.updateDynamic("calcMode")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) end.foreach(v => props.updateDynamic("end")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) keySplines.foreach(v => props.updateDynamic("keySplines")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) dur.foreach(v => props.updateDynamic("dur")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) restart.foreach(v => props.updateDynamic("restart")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) by.foreach(v => props.updateDynamic("by")(v)) attributeType.foreach(v => props.updateDynamic("attributeType")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) keyTimes.foreach(v => props.updateDynamic("keyTimes")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) repeatDur.foreach(v => props.updateDynamic("repeatDur")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) additive.foreach(v => props.updateDynamic("additive")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) accumulate.foreach(v => props.updateDynamic("accumulate")(v)) className.foreach(v => props.updateDynamic("className")(v)) attributeName.foreach(v => props.updateDynamic("attributeName")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) `type`.foreach(v => props.updateDynamic("type")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("animateTransform",props,children :_*) else inlineReactElement("animateTransform",props,children :_*) } @inline def feGaussianBlur( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, in: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, stdDeviation: U[String | Double] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) stdDeviation.foreach(v => props.updateDynamic("stdDeviation")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) in.foreach(v => props.updateDynamic("in")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feGaussianBlur",props,children :_*) else inlineReactElement("feGaussianBlur",props,children :_*) } @inline def feColorMatrix( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, in: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, values: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, `type`: U[String] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) values.foreach(v => props.updateDynamic("values")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) in.foreach(v => props.updateDynamic("in")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) `type`.foreach(v => props.updateDynamic("type")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feColorMatrix",props,children :_*) else inlineReactElement("feColorMatrix",props,children :_*) } @inline def pattern( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, viewBox: U[String] = undefined, patternTransform: U[String] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, preserveAspectRatio: U[Boolean] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, patternContentUnits: U[String] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, patternUnits: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) patternContentUnits.foreach(v => props.updateDynamic("patternContentUnits")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) viewBox.foreach(v => props.updateDynamic("viewBox")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) patternTransform.foreach(v => props.updateDynamic("patternTransform")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) y.foreach(v => props.updateDynamic("y")(v)) patternUnits.foreach(v => props.updateDynamic("patternUnits")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) preserveAspectRatio.foreach(v => props.updateDynamic("preserveAspectRatio")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("pattern",props,children :_*) else inlineReactElement("pattern",props,children :_*) } @inline def path( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, pathLength: U[Double] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, markerMid: U[String] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, markerStart: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, markerEnd: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, d: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) markerEnd.foreach(v => props.updateDynamic("markerEnd")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) pathLength.foreach(v => props.updateDynamic("pathLength")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) markerMid.foreach(v => props.updateDynamic("markerMid")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) d.foreach(v => props.updateDynamic("d")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) markerStart.foreach(v => props.updateDynamic("markerStart")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("path",props,children :_*) else inlineReactElement("path",props,children :_*) } @inline def use( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("use",props,children :_*) else inlineReactElement("use",props,children :_*) } @inline def clipPath( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, clipPathUnits: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) clipPathUnits.foreach(v => props.updateDynamic("clipPathUnits")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("clipPath",props,children :_*) else inlineReactElement("clipPath",props,children :_*) } @inline def image( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, xlinkRole: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, xlinkShow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, xlinkHref: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, preserveAspectRatio: U[Boolean] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, xlinkTitle: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) preserveAspectRatio.foreach(v => props.updateDynamic("preserveAspectRatio")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("image",props) else inlineReactElement("image",props) } @inline def stop( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, offset: U[String | Double] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) offset.foreach(v => props.updateDynamic("offset")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("stop",props,children :_*) else inlineReactElement("stop",props,children :_*) } @inline def feFlood( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, x: U[String | Double] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, result: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, height: U[Double] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, baselineShift: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, width: U[Double] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) width.foreach(v => props.updateDynamic("width")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) result.foreach(v => props.updateDynamic("result")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) height.foreach(v => props.updateDynamic("height")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feFlood",props,children :_*) else inlineReactElement("feFlood",props,children :_*) } @inline def switch( colorInterpolation: U[String] = undefined, floodColor: U[String] = undefined, textRendering: U[String] = undefined, shapeRendering: U[String] = undefined, mask: U[String] = undefined, overflow: U[String] = undefined, strokeDasharray: U[String] = undefined, textAnchor: U[String] = undefined, style: U[js.Any] = undefined, strokeOpacity: U[String | Double] = undefined, textDecoration: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, stroke: U[String] = undefined, clipPath: U[String] = undefined, fillOpacity: U[String | Double] = undefined, fontSizeAdjust: U[String | Double] = undefined, clipRule: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, stopOpacity: U[String | Double] = undefined, colorInterpolationFilters: U[String] = undefined, fontStyle: U[String] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, direction: U[String] = undefined, enableBackground: U[String] = undefined, colorRendering: U[String] = undefined, g1: U[String] = undefined, cursor: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, fontFamily: U[String] = undefined, kerning: U[String] = undefined, id: U[String] = undefined, strokeDashoffset: U[String] = undefined, glyphOrientationHorizontal: U[String] = undefined, letterSpacing: U[String] = undefined, strokeLinecap: U[String] = undefined, wordSpacing: U[String | Double] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, pointerEvents: U[String] = undefined, floodOpacity: U[String | Double] = undefined, writingMode: U[String | Double] = undefined, className: U[String] = undefined, fontVariant: U[String] = undefined, requiredExtensions: U[String] = undefined, baselineShift: U[String] = undefined, requiredFeatures: U[String] = undefined, fontSize: U[String | Double] = undefined, strokeMiterlimit: U[String] = undefined, glyphOrientationVertical: U[String] = undefined, opacity: U[String] = undefined, allowReorder: U[Boolean] = undefined, clip: U[String] = undefined, fontStretch: U[String] = undefined, imageRendering: U[String] = undefined, colorProfile: U[String] = undefined, stopColor: U[String] = undefined, strokeLinejoin: U[String] = undefined, lightingColor: U[String] = undefined, transform: U[String] = undefined, fontWeight: U[String] = undefined, visibility: U[String] = undefined, unicodeBidi: U[String] = undefined, strokeWidth: U[String | Double] = undefined, dominantBaseline: U[String] = undefined, display: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) textRendering.foreach(v => props.updateDynamic("textRendering")(v)) textDecoration.foreach(v => props.updateDynamic("textDecoration")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) fontFamily.foreach(v => props.updateDynamic("fontFamily")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) opacity.foreach(v => props.updateDynamic("opacity")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) baselineShift.foreach(v => props.updateDynamic("baselineShift")(v)) overflow.foreach(v => props.updateDynamic("overflow")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) dominantBaseline.foreach(v => props.updateDynamic("dominantBaseline")(v)) colorInterpolation.foreach(v => props.updateDynamic("colorInterpolation")(v)) clip.foreach(v => props.updateDynamic("clip")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) kerning.foreach(v => props.updateDynamic("kerning")(v)) fontStretch.foreach(v => props.updateDynamic("fontStretch")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) mask.foreach(v => props.updateDynamic("mask")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) colorRendering.foreach(v => props.updateDynamic("colorRendering")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) textAnchor.foreach(v => props.updateDynamic("textAnchor")(v)) strokeDashoffset.foreach(v => props.updateDynamic("strokeDashoffset")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) fontSize.foreach(v => props.updateDynamic("fontSize")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) writingMode.foreach(v => props.updateDynamic("writingMode")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) unicodeBidi.foreach(v => props.updateDynamic("unicodeBidi")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) transform.foreach(v => props.updateDynamic("transform")(v)) enableBackground.foreach(v => props.updateDynamic("enableBackground")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) wordSpacing.foreach(v => props.updateDynamic("wordSpacing")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) fontSizeAdjust.foreach(v => props.updateDynamic("fontSizeAdjust")(v)) strokeLinecap.foreach(v => props.updateDynamic("strokeLinecap")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) lightingColor.foreach(v => props.updateDynamic("lightingColor")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) stopOpacity.foreach(v => props.updateDynamic("stopOpacity")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) imageRendering.foreach(v => props.updateDynamic("imageRendering")(v)) id.foreach(v => props.updateDynamic("id")(v)) display.foreach(v => props.updateDynamic("display")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) fontWeight.foreach(v => props.updateDynamic("fontWeight")(v)) stroke.foreach(v => props.updateDynamic("stroke")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) shapeRendering.foreach(v => props.updateDynamic("shapeRendering")(v)) stopColor.foreach(v => props.updateDynamic("stopColor")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) strokeLinejoin.foreach(v => props.updateDynamic("strokeLinejoin")(v)) visibility.foreach(v => props.updateDynamic("visibility")(v)) strokeOpacity.foreach(v => props.updateDynamic("strokeOpacity")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) fontStyle.foreach(v => props.updateDynamic("fontStyle")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) fontVariant.foreach(v => props.updateDynamic("fontVariant")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) pointerEvents.foreach(v => props.updateDynamic("pointerEvents")(v)) strokeMiterlimit.foreach(v => props.updateDynamic("strokeMiterlimit")(v)) direction.foreach(v => props.updateDynamic("direction")(v)) strokeDasharray.foreach(v => props.updateDynamic("strokeDasharray")(v)) clipRule.foreach(v => props.updateDynamic("clipRule")(v)) colorProfile.foreach(v => props.updateDynamic("colorProfile")(v)) cursor.foreach(v => props.updateDynamic("cursor")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) glyphOrientationVertical.foreach(v => props.updateDynamic("glyphOrientationVertical")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) glyphOrientationHorizontal.foreach(v => props.updateDynamic("glyphOrientationHorizontal")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) letterSpacing.foreach(v => props.updateDynamic("letterSpacing")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) colorInterpolationFilters.foreach(v => props.updateDynamic("colorInterpolationFilters")(v)) strokeWidth.foreach(v => props.updateDynamic("strokeWidth")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) clipPath.foreach(v => props.updateDynamic("clipPath")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("switch",props,children :_*) else inlineReactElement("switch",props,children :_*) } @inline def set( floodColor: U[String] = undefined, begin: U[String] = undefined, xlinkRole: U[String] = undefined, xlinkShow: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, fillOpacity: U[String | Double] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, repeatDur: U[String] = undefined, dur: U[String | Double] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, to: U[String | Double] = undefined, attributeName: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, repeatCount: U[String | Int] = undefined, xlinkHref: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, floodOpacity: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, requiredExtensions: U[String] = undefined, requiredFeatures: U[String] = undefined, end: U[Double] = undefined, attributeType: U[String] = undefined, allowReorder: U[Boolean] = undefined, restart: U[String] = undefined, xlinkTitle: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) begin.foreach(v => props.updateDynamic("begin")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) repeatCount.foreach(v => props.updateDynamic("repeatCount")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) to.foreach(v => props.updateDynamic("to")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) end.foreach(v => props.updateDynamic("end")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) dur.foreach(v => props.updateDynamic("dur")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) restart.foreach(v => props.updateDynamic("restart")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) attributeType.foreach(v => props.updateDynamic("attributeType")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) repeatDur.foreach(v => props.updateDynamic("repeatDur")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) attributeName.foreach(v => props.updateDynamic("attributeName")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("set",props,children :_*) else inlineReactElement("set",props,children :_*) } @inline def feSpotLight( x: U[String | Double] = undefined, pointsAtZ: U[Double] = undefined, style: U[js.Any] = undefined, y: U[String | Double] = undefined, g2: U[String] = undefined, specularExponent: U[Double] = undefined, limitingConeAngle: U[Double] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, pointsAtY: U[Double] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, pointsAtX: U[Double] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, className: U[String] = undefined, allowReorder: U[Boolean] = undefined, z: U[String | Double] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) pointsAtX.foreach(v => props.updateDynamic("pointsAtX")(v)) pointsAtZ.foreach(v => props.updateDynamic("pointsAtZ")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) specularExponent.foreach(v => props.updateDynamic("specularExponent")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) y.foreach(v => props.updateDynamic("y")(v)) x.foreach(v => props.updateDynamic("x")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) pointsAtY.foreach(v => props.updateDynamic("pointsAtY")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) key.foreach(v => props.updateDynamic("key")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) z.foreach(v => props.updateDynamic("z")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) limitingConeAngle.foreach(v => props.updateDynamic("limitingConeAngle")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("feSpotLight",props,children :_*) else inlineReactElement("feSpotLight",props,children :_*) } @inline def animateMotion( floodColor: U[String] = undefined, begin: U[String] = undefined, xlinkRole: U[String] = undefined, accumulate: U[String] = undefined, keyTimes: U[String] = undefined, xlinkShow: U[String] = undefined, xlinkActuate: U[String] = undefined, style: U[js.Any] = undefined, keyPoints: U[String] = undefined, externalResourcesRequired: U[Double] = undefined, g2: U[String] = undefined, fillOpacity: U[String | Double] = undefined, additive: U[String] = undefined, local: U[String] = undefined, paintOrder: U[String] = undefined, calcMode: U[String] = undefined, repeatDur: U[String] = undefined, dur: U[String | Double] = undefined, ref: U[(_ <: dom.svg.Element) => _] = undefined, g1: U[String] = undefined, xmlBase: U[String] = undefined, to: U[String | Double] = undefined, key: U[String | Int] = undefined, xmlSpace: U[String] = undefined, filter: U[String] = undefined, rotate: U[String | Double] = undefined, repeatCount: U[String | Int] = undefined, xlinkHref: U[String] = undefined, id: U[String] = undefined, xmlLang: U[String] = undefined, fill: U[String] = undefined, systemLanguage: U[Boolean] = undefined, by: U[Double] = undefined, origin: U[String] = undefined, floodOpacity: U[String | Double] = undefined, xlinkType: U[String] = undefined, className: U[String] = undefined, xlinkArcrole: U[String] = undefined, from: U[Double] = undefined, requiredExtensions: U[String] = undefined, requiredFeatures: U[String] = undefined, end: U[Double] = undefined, values: U[String] = undefined, keySplines: U[String] = undefined, allowReorder: U[Boolean] = undefined, restart: U[String] = undefined, xlinkTitle: U[String] = undefined, fillRule: U[String] = undefined, onCompositionStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onPaste: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrop: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onContextMenu: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDoubleClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragOver: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSubmit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onClick: U[(_ <: SyntheticEvent[_]) => _] = undefined, onSelect: U[(_ <: SyntheticEvent[_]) => _] = undefined, onInput: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onBlur: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragLeave: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragExit: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchMove: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCopy: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseDown: U[(_ <: SyntheticEvent[_]) => _] = undefined, onChange: U[(_ <: SyntheticEvent[_]) => _] = undefined, onWheel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationIteration: U[(_ <: SyntheticEvent[_]) => _] = undefined, onFocus: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseEnter: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchCancel: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCompositionUpdate: U[(_ <: SyntheticEvent[_]) => _] = undefined, onAnimationEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTouchStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDragStart: U[(_ <: SyntheticEvent[_]) => _] = undefined, onKeyPress: U[(_ <: SyntheticEvent[_]) => _] = undefined, onScroll: U[(_ <: SyntheticEvent[_]) => _] = undefined, onDrag: U[(_ <: SyntheticEvent[_]) => _] = undefined, onMouseUp: U[(_ <: SyntheticEvent[_]) => _] = undefined, onTransitionEnd: U[(_ <: SyntheticEvent[_]) => _] = undefined, onCut: U[(_ <: SyntheticEvent[_]) => _] = undefined, extraAttributes: U[js.Object] = undefined)(children: ReactNode*) = { val props = json() onKeyDown.foreach(v => props.updateDynamic("onKeyDown")(v)) from.foreach(v => props.updateDynamic("from")(v)) values.foreach(v => props.updateDynamic("values")(v)) begin.foreach(v => props.updateDynamic("begin")(v)) floodOpacity.foreach(v => props.updateDynamic("floodOpacity")(v)) onMouseUp.foreach(v => props.updateDynamic("onMouseUp")(v)) onTouchCancel.foreach(v => props.updateDynamic("onTouchCancel")(v)) repeatCount.foreach(v => props.updateDynamic("repeatCount")(v)) onCompositionUpdate.foreach(v => props.updateDynamic("onCompositionUpdate")(v)) onDragStart.foreach(v => props.updateDynamic("onDragStart")(v)) onInput.foreach(v => props.updateDynamic("onInput")(v)) onPaste.foreach(v => props.updateDynamic("onPaste")(v)) onBlur.foreach(v => props.updateDynamic("onBlur")(v)) xlinkRole.foreach(v => props.updateDynamic("xlinkRole")(v)) fill.foreach(v => props.updateDynamic("fill")(v)) externalResourcesRequired.foreach(v => props.updateDynamic("externalResourcesRequired")(v)) to.foreach(v => props.updateDynamic("to")(v)) onDragOver.foreach(v => props.updateDynamic("onDragOver")(v)) xlinkArcrole.foreach(v => props.updateDynamic("xlinkArcrole")(v)) xlinkTitle.foreach(v => props.updateDynamic("xlinkTitle")(v)) onDragEnd.foreach(v => props.updateDynamic("onDragEnd")(v)) onScroll.foreach(v => props.updateDynamic("onScroll")(v)) onMouseDown.foreach(v => props.updateDynamic("onMouseDown")(v)) onAnimationStart.foreach(v => props.updateDynamic("onAnimationStart")(v)) onMouseMove.foreach(v => props.updateDynamic("onMouseMove")(v)) rotate.foreach(v => props.updateDynamic("rotate")(v)) onWheel.foreach(v => props.updateDynamic("onWheel")(v)) calcMode.foreach(v => props.updateDynamic("calcMode")(v)) xmlSpace.foreach(v => props.updateDynamic("xmlSpace")(v)) xlinkShow.foreach(v => props.updateDynamic("xlinkShow")(v)) onAnimationIteration.foreach(v => props.updateDynamic("onAnimationIteration")(v)) floodColor.foreach(v => props.updateDynamic("floodColor")(v)) onTransitionEnd.foreach(v => props.updateDynamic("onTransitionEnd")(v)) end.foreach(v => props.updateDynamic("end")(v)) onAnimationEnd.foreach(v => props.updateDynamic("onAnimationEnd")(v)) systemLanguage.foreach(v => props.updateDynamic("systemLanguage")(v)) keySplines.foreach(v => props.updateDynamic("keySplines")(v)) xlinkHref.foreach(v => props.updateDynamic("xlinkHref")(v)) dur.foreach(v => props.updateDynamic("dur")(v)) xmlLang.foreach(v => props.updateDynamic("xmlLang")(v)) onDrag.foreach(v => props.updateDynamic("onDrag")(v)) keyPoints.foreach(v => props.updateDynamic("keyPoints")(v)) onSubmit.foreach(v => props.updateDynamic("onSubmit")(v)) onDragExit.foreach(v => props.updateDynamic("onDragExit")(v)) onCopy.foreach(v => props.updateDynamic("onCopy")(v)) origin.foreach(v => props.updateDynamic("origin")(v)) onDragEnter.foreach(v => props.updateDynamic("onDragEnter")(v)) onSelect.foreach(v => props.updateDynamic("onSelect")(v)) requiredFeatures.foreach(v => props.updateDynamic("requiredFeatures")(v)) restart.foreach(v => props.updateDynamic("restart")(v)) id.foreach(v => props.updateDynamic("id")(v)) onCompositionEnd.foreach(v => props.updateDynamic("onCompositionEnd")(v)) fillOpacity.foreach(v => props.updateDynamic("fillOpacity")(v)) onChange.foreach(v => props.updateDynamic("onChange")(v)) xmlBase.foreach(v => props.updateDynamic("xmlBase")(v)) requiredExtensions.foreach(v => props.updateDynamic("requiredExtensions")(v)) key.foreach(v => props.updateDynamic("key")(v)) filter.foreach(v => props.updateDynamic("filter")(v)) onClick.foreach(v => props.updateDynamic("onClick")(v)) fillRule.foreach(v => props.updateDynamic("fillRule")(v)) local.foreach(v => props.updateDynamic("local")(v)) allowReorder.foreach(v => props.updateDynamic("allowReorder")(v)) style.foreach(v => props.updateDynamic("style")(v)) onTouchMove.foreach(v => props.updateDynamic("onTouchMove")(v)) by.foreach(v => props.updateDynamic("by")(v)) onKeyUp.foreach(v => props.updateDynamic("onKeyUp")(v)) keyTimes.foreach(v => props.updateDynamic("keyTimes")(v)) onDrop.foreach(v => props.updateDynamic("onDrop")(v)) ref.foreach(v => props.updateDynamic("ref")(v)) onMouseEnter.foreach(v => props.updateDynamic("onMouseEnter")(v)) onTouchEnd.foreach(v => props.updateDynamic("onTouchEnd")(v)) onFocus.foreach(v => props.updateDynamic("onFocus")(v)) repeatDur.foreach(v => props.updateDynamic("repeatDur")(v)) onContextMenu.foreach(v => props.updateDynamic("onContextMenu")(v)) g1.foreach(v => props.updateDynamic("g1")(v)) additive.foreach(v => props.updateDynamic("additive")(v)) paintOrder.foreach(v => props.updateDynamic("paintOrder")(v)) onTouchStart.foreach(v => props.updateDynamic("onTouchStart")(v)) accumulate.foreach(v => props.updateDynamic("accumulate")(v)) className.foreach(v => props.updateDynamic("className")(v)) onKeyPress.foreach(v => props.updateDynamic("onKeyPress")(v)) g2.foreach(v => props.updateDynamic("g2")(v)) onCompositionStart.foreach(v => props.updateDynamic("onCompositionStart")(v)) onDoubleClick.foreach(v => props.updateDynamic("onDoubleClick")(v)) xlinkActuate.foreach(v => props.updateDynamic("xlinkActuate")(v)) xlinkType.foreach(v => props.updateDynamic("xlinkType")(v)) onMouseLeave.foreach(v => props.updateDynamic("onMouseLeave")(v)) onDragLeave.foreach(v => props.updateDynamic("onDragLeave")(v)) onCut.foreach(v => props.updateDynamic("onCut")(v)) if(extraAttributes.isDefined && extraAttributes != null) addJsObjects(props,extraAttributes.get) if (developmentMode) React.createElement("animateMotion",props,children :_*) else inlineReactElement("animateMotion",props,children :_*) } }
chandu0101/sri
web/src/main/scala/sri/web/vdom/SvgTags1.scala
Scala
apache-2.0
391,902
package scalax.collection.constrained package mutable import scala.collection.Set import scalax.collection.GraphPredef.{EdgeLikeIn, InnerEdgeParam, InnerNodeParam, OuterEdge, OuterNode, Param} import scalax.collection.mutable.{GraphLike => SimpleGraphLike} /* Operations for mutable constrained graphs that also return information on any constraint violation. These ops are counterparts of non-constrained mutable graph ops that do not expose constraint violations. These enhanced ops bear the same name but a postfix `?` for operator identifiers respectively `_?` for plain identifiers. $define Info returns additional information on any potential constraint violation */ trait GraphOps[ N, E[+X] <: EdgeLikeIn[X], +This[X, Y[+X] <: EdgeLikeIn[X]] <: GraphLike[X, Y, This] with Set[Param[X, Y]] with Graph[X, Y] ] { _: This[N, E] with SimpleGraphLike[N, E, This] with GraphOps[N, E, This] => /** Same as `add` but $Info. */ def add_?(node: N): Either[ConstraintViolation, Boolean] /** Same as `+=` but $Info. */ def +=?(node: N): Either[ConstraintViolation, this.type] = add_?(node) map (_ => this) /** Same as `add` but $Info. */ def add_?(edge: E[N]): Either[ConstraintViolation, Boolean] protected def +=#?(edge: E[N]): Either[ConstraintViolation, this.type] = add_?(edge) map (_ => this) /** Same as `+=` but $Info. */ def +=?(elem: Param[N, E]): Either[ConstraintViolation, this.type] = elem match { case n: OuterNode[N] => this +=? n.value case n: InnerNodeParam[N] => this +=? n.value case e: OuterEdge[N, E] => this +=#? e.edge case e: InnerEdgeParam[N, E, _, E] => this +=#? e.asEdgeTProjection[N, E].toOuter } /** Same as `++=` but $Info. */ def ++=?(elems: TraversableOnce[Param[N, E]]): Either[ConstraintViolation, this.type] /** Same as `remove` but $Info. */ def remove_?(node: N): Either[ConstraintViolation, Boolean] /** Same as `-=` but $Info. */ def -=?(node: N): Either[ConstraintViolation, this.type] = remove_?(node) map (_ => this) /** Same as `remove` but $Info. */ def remove_?(edge: E[N]): Either[ConstraintViolation, Boolean] protected def -=#?(edge: E[N]): Either[ConstraintViolation, this.type] = remove_?(edge) map (_ => this) /** Same as `-=` but $Info. */ def -=?(elem: Param[N, E]): Either[ConstraintViolation, this.type] = elem match { case n: OuterNode[N] => this -=? n.value case n: InnerNodeParam[N] => this -=? n.value case e: OuterEdge[N, E] => this -=#? e.edge case e: InnerEdgeParam[N, E, _, E] => this -=#? e.asEdgeTProjection[N, E].toOuter } /** Same as `--=` but $Info. */ def --=?(elems: TraversableOnce[Param[N, E]]): Either[ConstraintViolation, this.type] }
scala-graph/scala-graph
constrained/src/main/scala/scalax/collection/constrained/mutable/GraphOps.scala
Scala
apache-2.0
2,791
package models.daos.drivers import java.net.ConnectException import com.sendgrid.SendGrid import com.typesafe.config.ConfigFactory import play.api.Play import scala.util.{Failure, Try} import scalaj.http.Http /** * Checks if the database is connected during creation of the injector. The application will fail to start * if the configuration is wrong * * This is not in the neo4j driver since the driver needs play to run and cannot be eagerly instantiated. */ class ElasticsearchChecker() { val conf = ConfigFactory.load val elasticSearchAPIUrl = conf.getString("elasticsearch.server") val elasticSearchAPISearchEndpoint = conf.getString("elasticsearch.endpoint") val sgRecipients = conf.getString("sendgrid.recipients").split(",") Try( Http(elasticSearchAPIUrl + elasticSearchAPISearchEndpoint) .headers(("Accept", "application/json ; charset=UTF-8"), ("Content-Type", "application/json")) .asString ) match { case Failure(e)=>{ val email = new SendGrid.Email() email.setTo(sgRecipients) email.setText("Elasticsearch is not working "+e.getMessage ) email.setFrom("[email protected]") email.setSubject("Error detected on deployment environment- Elasticsearch") new SendGrid(conf.getString("sendgrid.key")).send(email) } case _ => } }
gitlinks/gitrank-web
app/models/daos/drivers/ElasticsearchChecker.scala
Scala
apache-2.0
1,328
import com.thesamet.proto.e2e.custom_types._ import com.thesamet.proto.e2e.custom_types.CustomMessage.Weather import com.thesamet.pb._ import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.must.Matchers class CustomTypesSpec extends AnyFlatSpec with Matchers { import CustomTypesSpec.Message "CustomMessage" should "serialize and parse" in { Message.getPersonId must be(PersonId("abcd")) Message.requiredPersonId must be(PersonId("required")) Message.personIds must be(Seq(PersonId("p1"), PersonId("p2"))) Message.getAge must be(Years(27)) Message.requiredAge must be(Years(25)) Message.ages must be(Seq(Years(3), Years(8), Years(35))) Message.getName must be(FullName("Foo", "Bar")) } "Custom message types" should "concatenate correctly" in { val m1 = CustomMessage( name = Some(FullName("Foo", "EMPTY")), requiredPersonId = PersonId("p1"), requiredName = FullName("first_req", "EMPTY"), age = Some(Years(4)), requiredAge = Years(1), requiredWeather = WrappedWeather(Weather.SUNNY), packedWeathers = Seq( WrappedWeather(Weather.SUNNY), WrappedWeather(Weather.RAIN) ) ) val m2 = CustomMessage( name = Some(FullName("EMPTY", "Bar")), requiredPersonId = PersonId("p2"), requiredName = FullName("EMPTY", "last_req"), age = Some(Years(5)), requiredAge = Years(2), requiredWeather = WrappedWeather(Weather.RAIN), packedWeathers = Seq( WrappedWeather(Weather.RAIN), WrappedWeather(Weather.SUNNY) ) ) val expected = CustomMessage( requiredPersonId = PersonId("p2"), requiredAge = Years(2), requiredName = FullName("first_req", "last_req"), requiredWeather = WrappedWeather(Weather.RAIN), packedWeathers = Seq( WrappedWeather(Weather.SUNNY), WrappedWeather(Weather.RAIN), WrappedWeather(Weather.RAIN), WrappedWeather(Weather.SUNNY) ) ).update( _.name := FullName("Foo", "Bar"), _.age := Years(5) ) val concat = (m1.toByteArray ++ m2.toByteArray) CustomMessage.parseFrom(concat) must be(expected) } "Extended types" should "inherit from marker type" in { val t: DomainEvent = CustomerEvent( personId = Some(PersonId("123")), optionalNumber = Some(1), repeatedNumber = Seq(2, 3, 4), requiredNumber = 5 ) t mustBe a[DomainEvent] t.personId must be(Some(PersonId("123"))) t.optionalNumber must be(Some(1)) t.repeatedNumber must be(Seq(2, 3, 4)) t.requiredNumber must be(5) } "Extended companion objects" should "inherit from marker type" in { CustomerEvent mustBe a[DomainEventCompanion] CustomerEvent.thisIs must be("The companion object") } "HasEmail" should "serialize and parse valid instances" in { val dm = HasEmail( requiredEmail = Email("foo", "bar") ) HasEmail.parseFrom(dm.toByteArray) must be(dm) } "NoBoxEmail" should "serialize and parse valid instances" in { val dm = NoBoxEmail( noBoxEmail = Email("foo", "bar") ) NoBoxEmail.parseFrom(dm.toByteArray) must be(dm) } "ContainsHasEmail" should "serialize and parse valid instances" in { val cem = ContainsHasEmail( requiredHasEmail = HasEmail(requiredEmail = Email("foo", "bar")) ) ContainsHasEmail.parseFrom(cem.toByteArray) must be(cem) } } object CustomTypesSpec { val Message = CustomMessage( personId = Some(PersonId("abcd")), requiredPersonId = PersonId("required"), personIds = Seq(PersonId("p1"), PersonId("p2")), age = Some(Years(27)), requiredAge = Years(25), ages = Seq(Years(3), Years(8), Years(35)), name = Some(FullName(firstName = "Foo", lastName = "Bar")), requiredName = FullName(firstName = "Owen", lastName = "Money"), names = Seq( FullName(firstName = "Foo", lastName = "Bar"), FullName(firstName = "V1", lastName = "Z2") ), weather = Some(WrappedWeather(Weather.RAIN)), requiredWeather = WrappedWeather(Weather.SUNNY), weathers = Seq(WrappedWeather(Weather.RAIN), WrappedWeather(Weather.SUNNY)), packedWeathers = Seq(WrappedWeather(Weather.RAIN), WrappedWeather(Weather.RAIN)) ) }
scalapb/ScalaPB
e2e/src/test/scala/CustomTypesSpec.scala
Scala
apache-2.0
4,270
package services.forms import com.google.inject.AbstractModule import com.typesafe.config.ConfigFactory import models._ import net.codingwell.scalaguice.ScalaModule import org.specs2.specification.Scope import play.api.{ Application, Configuration } import play.api.inject.guice.GuiceApplicationBuilder import _root_.services.forms.FormConfigManager import org.mockito.Mockito trait FormTestContext extends Scope { val condition1DependentField = Field( "condition1DependentField", Field.TemplateType.input, TemplateOptions("test", None, None, None, None), None, Some("model.condition1 === \\"x\\"")) val condition2DependentField = Field( "condition2DependentField", Field.TemplateType.input, TemplateOptions("test", None, None, None, None), None, Some("model.condition2 === \\"x\\"")) val requiredField1 = Field( "requiredField1", Field.TemplateType.input, TemplateOptions("test", None, None, None, None), None, None) val requiredField2 = Field( "requiredField2", Field.TemplateType.input, TemplateOptions("test", None, None, None, None), None, None) val optionalField1 = Field( "optionalField1", Field.TemplateType.input, TemplateOptions("test", None, None, None, None, optional = true), None, None) val optionalField2 = Field( "optionalField2", Field.TemplateType.input, TemplateOptions("test", None, None, None, None, optional = true), None, None) val mockFormConfigManager: FormConfigManager = Mockito.mock(classOf[FormConfigManager]) val mockFormConfig: Map[String, FormConfig] = Map("test" -> FormConfig( "test", "Test config.", VetafiInfo("test", "Test config.", required = true, externalId = "test", externalSignerId = "test"), Seq(condition1DependentField, condition2DependentField, requiredField1, requiredField2, optionalField1, optionalField2))) /** * A fake Guice module. */ class FakeModule extends AbstractModule with ScalaModule { def configure(): Unit = { bind[FormConfigManager].toInstance(mockFormConfigManager) } } lazy val application: Application = GuiceApplicationBuilder() .configure(Configuration(ConfigFactory.load("application.test.conf"))) .overrides(new FakeModule) .build() } object FormTestContext extends FormTestContext
vetafi/vetafi-web
test/services/forms/FormTestContext.scala
Scala
apache-2.0
2,359
package epic import epic.trees.Span /** * TODO * * @author dlwh **/ package object slab { // some type aliases type StringAnalysisFunction[I, O] = AnalysisFunction[String, Span, I, O] type StringSlab[+AnnotationTypes] = Slab[String, Span, AnnotationTypes] }
langkilde/epic
src/main/scala/epic/slab/package.scala
Scala
apache-2.0
270
package org.jetbrains.plugins.scala package lang package parser package parsing package statements import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes import org.jetbrains.plugins.scala.lang.parser.parsing.base.Ids import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder import org.jetbrains.plugins.scala.lang.parser.parsing.types.Type import org.jetbrains.plugins.scala.lang.parser.util.ParserUtils /** * @author Alexander Podkhalyuzin * Date: 06.02.2008 */ /* * ValDef ::= PatDef | * ids ':' Type '=' '_' */ object VarDef { def parse(builder: ScalaPsiBuilder): Boolean = { if (PatDef parse builder) { return true } // Parsing specifig wildcard definition val valDefMarker = builder.mark builder.getTokenType match { case ScalaTokenTypes.tIDENTIFIER => { Ids parse builder var hasTypeDcl = false if (ScalaTokenTypes.tCOLON.equals(builder.getTokenType)) { ParserUtils.eatElement(builder, ScalaTokenTypes.tCOLON) if (!Type.parse(builder)) { builder error "type declaration expected" } hasTypeDcl = true } else { valDefMarker.rollbackTo return false } if (!ScalaTokenTypes.tASSIGN.equals(builder.getTokenType)) { valDefMarker.rollbackTo return false } else { ParserUtils.eatElement(builder, ScalaTokenTypes.tASSIGN) builder.getTokenType match { case ScalaTokenTypes.tUNDER => builder.advanceLexer //Ate _ case _ => { valDefMarker.rollbackTo return false } } valDefMarker.drop return true } } case _ => { valDefMarker.drop return false } } } }
triggerNZ/intellij-scala
src/org/jetbrains/plugins/scala/lang/parser/parsing/statements/VarDef.scala
Scala
apache-2.0
1,859
/** * The MIT License (MIT) * Copyright (c) 2016 Microsoft Corporation * * 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 com.microsoft.azure.documentdb.spark.schema import java.util import com.microsoft.azure.documentdb.Document import org.apache.spark.rdd.RDD import org.apache.spark.sql.catalyst.analysis.TypeCoercion import org.apache.spark.sql.types._ import org.apache.spark.unsafe.types.UTF8String import scala.collection.JavaConverters._ import scala.collection.immutable /** * Knows the way to provide some Data Source schema */ trait SchemaProvider { /** * Provides the schema for current implementation of Data Source * * @return schema */ def schema(): StructType } case class DocumentDBSchema[T <: RDD[Document]]( rdd: T, samplingRatio: Double) extends SchemaProvider with Serializable { override def schema(): StructType = { val schemaData = if (samplingRatio > 0.99) rdd else rdd.sample(withReplacement = false, samplingRatio, 1) val flatMap = schemaData.flatMap { dbo => val doc: Map[String, AnyRef] = dbo.getHashMap().asScala.toMap val fields = doc.mapValues(f => convertToStruct(f)) fields } val reduced = flatMap.reduceByKey(compatibleType) val structFields = reduced.aggregate(Seq[StructField]())({ case (fields, (name, tpe)) => val newType = tpe match { case ArrayType(NullType, containsNull) => ArrayType(StringType, containsNull) case other => other } fields :+ StructField(name, newType) }, (oldFields, newFields) => oldFields ++ newFields) StructType(structFields) } private def convertToStruct(dataType: Any): DataType = dataType match { case array: util.ArrayList[_] => val arrayType: immutable.Seq[DataType] = array.asScala.toList.map(x => convertToStruct(x)).distinct ArrayType(if (arrayType.nonEmpty) arrayType.head else NullType, arrayType.contains(NullType)) case hm: util.HashMap[_, _] => val fields = hm.asInstanceOf[util.HashMap[String, AnyRef]].asScala.toMap.map { case (k, v) => StructField(k, convertToStruct(v)) }.toSeq StructType(fields) case bo: Document => val fields = bo.getHashMap().asScala.toMap.map { case (k, v) => StructField(k, convertToStruct(v)) }.toSeq StructType(fields) case elem => elemType(elem) } /** * It looks for the most compatible type between two given DataTypes. * i.e.: {{{ * val dataType1 = IntegerType * val dataType2 = DoubleType * assert(compatibleType(dataType1,dataType2)==DoubleType) * }}} * * @param t1 First DataType to compare * @param t2 Second DataType to compare * @return Compatible type for both t1 and t2 */ private def compatibleType(t1: DataType, t2: DataType): DataType = { TypeCoercion.findTightestCommonTypeOfTwo(t1, t2) match { case Some(commonType) => commonType case None => // t1 or t2 is a StructType, ArrayType, or an unexpected type. (t1, t2) match { case (other: DataType, NullType) => other case (NullType, other: DataType) => other case (StructType(fields1), StructType(fields2)) => val newFields = (fields1 ++ fields2) .groupBy(field => field.name) .map { case (name, fieldTypes) => val dataType = fieldTypes .map(field => field.dataType) .reduce(compatibleType) StructField(name, dataType, nullable = true) } StructType(newFields.toSeq.sortBy(_.name)) case (ArrayType(elementType1, containsNull1), ArrayType(elementType2, containsNull2)) => ArrayType( compatibleType(elementType1, elementType2), containsNull1 || containsNull2) case (_, _) => StringType } } } private def typeOfArray(l: Seq[Any]): ArrayType = { val containsNull = l.contains(null) val elements = l.flatMap(v => Option(v)) if (elements.isEmpty) { // If this JSON array is empty, we use NullType as a placeholder. // If this array is not empty in other JSON objects, we can resolve // the type after we have passed through all JSON objects. ArrayType(NullType, containsNull) } else { val elementType = elements .map(convertToStruct) .reduce(compatibleType) ArrayType(elementType, containsNull) } } private def elemType: PartialFunction[Any, DataType] = { case obj: Boolean => BooleanType case obj: Array[Byte] => BinaryType case obj: String => StringType case obj: UTF8String => StringType case obj: Byte => ByteType case obj: Short => ShortType case obj: Int => IntegerType case obj: Long => LongType case obj: Float => FloatType case obj: Double => DoubleType case obj: java.sql.Date => DateType case obj: java.math.BigDecimal => DecimalType.SYSTEM_DEFAULT case obj: Decimal => DecimalType.SYSTEM_DEFAULT case obj: java.sql.Timestamp => TimestampType case null => NullType case date: java.util.Date => TimestampType case _ => StringType } }
khdang/azure-documentdb-spark
src/main/scala/com/microsoft/azure/documentdb/spark/schema/DocumentDBSchema.scala
Scala
mit
6,404
package com.sksamuel.elastic4s.search.queries import com.sksamuel.elastic4s.testkit.DockerTests import org.scalatest.FlatSpec import scala.util.Try class CountTest extends FlatSpec with DockerTests { Try { client.execute { deleteIndex("london") }.await } client.execute { bulk( indexInto("london/landmarks").fields("name" -> "hampton court palace"), indexInto("london/landmarks").fields("name" -> "tower of london") ).refreshImmediately }.await "a search request of size 0" should "return total count when no query is specified" in { val resp = client.execute { search("london").size(0) }.await.result assert(2 === resp.totalHits) } it should "return the document count for the correct type" in { val resp = client.execute { search("london").size(0) }.await.result assert(2 === resp.totalHits) } it should "return the document count based on the specified query" in { val resp = client.execute { search("london").size(0).query("tower") }.await.result assert(1 === resp.totalHits) } }
Tecsisa/elastic4s
elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/queries/CountTest.scala
Scala
apache-2.0
1,100
package mvgk.moviesearch import org.openqa.selenium.firefox.FirefoxDriver /** * @author Got Hug */ case class RutrackerQuery(title: String, titleRus: Option[String], year: Int) extends MovieQuery { def doQuery(firefoxDriver: Option[FirefoxDriver] = None): MovieQueryResult = { logInfo("doQuery(): STARTED") val driver = firefoxDriver.getOrElse(new FirefoxDriver) val url = "http://rutracker.org/forum/index.php" driver.get(url) val queryString = titleRus.getOrElse(title) + " " + year driver.findElementById("search-text").sendKeys(queryString) driver.findElementByXPath("//form[@id='quick-search']/input[@type='submit']").click() val downloadsSortElement = driver.findElementByXPath("//th[@title='Торрент скачан']") downloadsSortElement.click() downloadsSortElement.click() val rootXPath = "//table[@class='forumline tablesorter']" val filmListHTML = driver.findElementByXPath(rootXPath).getAttribute("innerHTML") val link = driver.findElementByXPath( rootXPath + "/tbody/tr/td[contains(@class, 't-title')]/div/a" ).getAttribute("href") logInfo("doQuery(): ENDED") MovieQueryResult(Some(link), "md5") } }
gothug/movie-geek
src/main/scala/mvgk/moviesearch/RutrackerQuery.scala
Scala
apache-2.0
1,217
import scala.deriving._ import scala.quoted._ object Macro1 { def mirrorFields[T](t: Type[T])(using qctx: QuoteContext): List[String] = t match { case '[$field *: $fields] => field.show :: mirrorFields(fields) case '[Unit] => Nil } // Demonstrates the use of quoted pattern matching // over a refined type extracting the tuple type // for e.g., MirroredElemLabels inline def test1[T](value: =>T): List[String] = ${ test1Impl('value) } def test1Impl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[List[String]] = { import qctx.tasty._ val mirrorTpe = '[Mirror.Of[T]] Expr.summon(using mirrorTpe).get match { case '{ $m: Mirror.ProductOf[T]{ type MirroredElemLabels = $t } } => { Expr(mirrorFields(t)) } } } }
som-snytt/dotty
tests/run-macros/i8007/Macro_1.scala
Scala
apache-2.0
798
package mesosphere.marathon package api import javax.servlet.http.HttpServletRequest import javax.ws.rs._ import javax.ws.rs.core.{ Context, MediaType, Request, Response, Variant } import akka.actor.ActorSystem import ch.qos.logback.classic.{ Level, Logger, LoggerContext } import com.google.inject.Inject import com.typesafe.config.{ Config, ConfigRenderOptions } import com.typesafe.scalalogging.StrictLogging import com.wix.accord.Validator import mesosphere.marathon.metrics.Metrics import mesosphere.marathon.plugin.auth.AuthorizedResource.{ SystemConfig, SystemMetrics } import mesosphere.marathon.plugin.auth.{ Authenticator, Authorizer, UpdateResource, ViewResource } import mesosphere.marathon.raml.{ LoggerChange, Raml } import mesosphere.marathon.raml.MetricsConversion._ import org.slf4j.LoggerFactory import play.api.libs.json.Json import stream.Implicits._ import com.wix.accord.dsl._ import scala.concurrent.duration._ /** * System Resource gives access to system level functionality. * All system resources can be protected via ACLs. */ @Path("") class SystemResource @Inject() (val config: MarathonConf, cfg: Config)(implicit val authenticator: Authenticator, val authorizer: Authorizer, actorSystem: ActorSystem) extends RestResource with AuthResource with StrictLogging { private[this] val TEXT_WILDCARD_TYPE = MediaType.valueOf("text/*") /** * ping sends a pong to a client. * * ping doesn't use the `Produces` or `Consumes` tags because those do specific checking for a client * Accept header that may or may not exist. In the interest of compatibility we dynamically generate * a "pong" content object depending on the client's preferred Content-Type, or else assume `text/plain` * if the client specifies an Accept header compatible with `text/{wildcard}`. Otherwise no entity is * returned and status is set to "no content" (HTTP 204). */ @GET @Path("ping") def ping(@Context req: Request): Response = { import MediaType._ val v = Variant.mediaTypes( TEXT_PLAIN_TYPE, // first, in case client accepts */* or text/* TEXT_HTML_TYPE, APPLICATION_JSON_TYPE, TEXT_WILDCARD_TYPE ).add.build Option[Variant](req.selectVariant(v)).map(variant => variant -> variant.getMediaType).collect { case (variant, mediaType) if mediaType.isCompatible(APPLICATION_JSON_TYPE) => // return a properly formatted JSON object "\"pong\"" -> APPLICATION_JSON_TYPE case (variant, mediaType) if mediaType.isCompatible(TEXT_WILDCARD_TYPE) => // otherwise we send back plain text "pong" -> { if (mediaType.isWildcardType() || mediaType.isWildcardSubtype()) { TEXT_PLAIN_TYPE // never return a Content-Type w/ a wildcard } else { mediaType } } }.map { case (obj, mediaType) => Response.ok(obj).`type`(mediaType.toString).build }.getOrElse { Response.noContent().build } } @GET @Path("metrics") @Consumes(Array(MediaType.APPLICATION_JSON)) @Produces(Array(MarathonMediaType.PREFERRED_APPLICATION_JSON)) def metrics(@Context req: HttpServletRequest): Response = authenticated(req) { implicit identity => withAuthorization(ViewResource, SystemMetrics){ ok(jsonString(Raml.toRaml(Metrics.snapshot()))) } } @GET @Path("config") @Consumes(Array(MediaType.APPLICATION_JSON)) @Produces(Array(MarathonMediaType.PREFERRED_APPLICATION_JSON)) def config(@Context req: HttpServletRequest): Response = authenticated(req) { implicit identity => withAuthorization(ViewResource, SystemConfig) { ok(cfg.root().render(ConfigRenderOptions.defaults().setJson(true))) } } @GET @Path("logging") @Consumes(Array(MediaType.APPLICATION_JSON)) @Produces(Array(MarathonMediaType.PREFERRED_APPLICATION_JSON)) def showLoggers(@Context req: HttpServletRequest): Response = authenticated(req) { implicit identity => withAuthorization(ViewResource, SystemConfig) { LoggerFactory.getILoggerFactory match { case lc: LoggerContext => ok(lc.getLoggerList.map { logger => logger.getName -> Option(logger.getLevel).map(_.levelStr).getOrElse(logger.getEffectiveLevel.levelStr + " (inherited)") }.toMap) } } } @POST @Path("logging") @Consumes(Array(MediaType.APPLICATION_JSON)) @Produces(Array(MarathonMediaType.PREFERRED_APPLICATION_JSON)) def changeLogger(body: Array[Byte], @Context req: HttpServletRequest): Response = authenticated(req) { implicit identity => withAuthorization(UpdateResource, SystemConfig) { withValid(Json.parse(body).as[LoggerChange]) { change => LoggerFactory.getILoggerFactory.getLogger(change.logger) match { case logger: Logger => val level = Level.valueOf(change.level.value.toUpperCase) // current level can be null, which means: use the parent level // the current level should be preserved, no matter what the effective level is val currentLevel = logger.getLevel val currentEffectiveLevel = logger.getEffectiveLevel logger.info(s"Set logger ${logger.getName} to $level current: $currentEffectiveLevel") logger.setLevel(level) // if a duration is given, we schedule a timer to reset to the current level import mesosphere.marathon.core.async.ExecutionContexts.global change.durationSeconds.foreach(duration => actorSystem.scheduler.scheduleOnce(duration.seconds, new Runnable { override def run(): Unit = { logger.info(s"Duration expired. Reset Logger ${logger.getName} back to $currentEffectiveLevel") logger.setLevel(currentLevel) } })) ok(change) } } } } implicit lazy val validLoggerChange: Validator[LoggerChange] = validator[LoggerChange] { change => change.logger is notEmpty } }
janisz/marathon
src/main/scala/mesosphere/marathon/api/SystemResource.scala
Scala
apache-2.0
6,003
package metabrowse.server import io.undertow.Undertow import io.undertow.server.HttpHandler import io.undertow.server.HttpServerExchange import io.undertow.util.Headers import java.io.ByteArrayOutputStream import java.io.File import java.net.URLClassLoader import java.nio.ByteBuffer import java.nio.charset.StandardCharsets import java.nio.file.Files import java.nio.file.Path import java.util.Scanner import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference import java.util.zip.GZIPOutputStream import metabrowse.schema.SymbolIndex import metabrowse.schema.SymbolIndexes import metabrowse.schema.Workspace import metabrowse.{schema => d} import org.slf4j.Logger import org.slf4j.LoggerFactory import scala.collection.mutable.ArrayBuffer import scala.meta.inputs.Input import scala.meta.interactive.InteractiveSemanticdb import scala.meta.internal.io.FileIO import scala.meta.internal.io.InputStreamIO import scala.meta.internal.mtags.MtagsEnrichments._ import scala.meta.internal.mtags.Mtags import scala.meta.internal.mtags.OnDemandSymbolIndex import scala.meta.internal.semanticdb.TextDocuments import scala.meta.internal.semanticdb.scalac.SemanticdbOps import scala.meta.internal.{mtags => t} import scala.meta.io.AbsolutePath import scala.tools.nsc.interactive.Global import scala.util.control.NonFatal class MetabrowseServer( scalacOptions: List[String] = Nil, host: String = "localhost", port: Int = 4000, logger: Logger = LoggerFactory.getLogger("MetabrowseServer") ) { /** Starts a server that servers sources from the sourcepath. */ def start(sourcepath: Sourcepath): Unit = { replaceClasspath(sourcepath) server.start() } /** Stops the server and cleans up internal state */ def stop(): Unit = { server.stop() global.askShutdown() } /** Updates the running server to use a new sourcepath. * * Browser clients need to refresh their browser to pick up the new state. * * Beware: this method is untested! */ def replaceClasspath(sourcepath: Sourcepath): Unit = { lock.synchronized { if (state.get() != null) { global.askShutdown() } val newState = State( OnDemandSymbolIndex(), new URLClassLoader(sourcepath.sources.map(_.toUri.toURL).toArray), InteractiveSemanticdb.newCompiler( sourcepath.classpath.mkString(File.pathSeparator), scalacOptions ), sourcepath ) state.set(newState) sourcepath.sources.foreach(jar => index.addSourceJar(AbsolutePath(jar))) } } /** Returns the URL path pointing to the definition location of the given symbol */ def urlForSymbol( compiler: Global )(symbol: compiler.Symbol): Option[String] = { lazy val semanticdbOps: SemanticdbOps { val global: compiler.type } = new SemanticdbOps { val global: compiler.type = compiler } import semanticdbOps._ var compilerSymbol: compiler.Symbol = compiler.rootMirror.RootPackage symbol.ownerChain.reverse.drop(1).foreach { owner => val name = if (owner.name.isTermName || owner.hasPackageFlag) { compiler.TermName(owner.nameString) } else { compiler.TypeName(owner.nameString) } compilerSymbol = compilerSymbol.info.member(name) } val semanticdbSymbol = compilerSymbol.toSemantic for { symbolIndex <- getSymbol(semanticdbSymbol).indexes.headOption position <- symbolIndex.definition } yield { s"#${position.filename}#L${position.startLine}C${position.startCharacter}" } } // Mutable state: case class State( index: OnDemandSymbolIndex, classLoader: URLClassLoader, global: Global, sourcepath: Sourcepath ) private val state = new AtomicReference[State]() def index = state.get().index def classLoader = state.get().classLoader def global = state.get().global def sourcepath = state.get().sourcepath // Static state: private val lock = new Object() private val assets = { val in = this.getClass.getClassLoader.getResourceAsStream("metabrowse-assets.zip") val out = Files.createTempDirectory("metabrowse").resolve("assets.zip") Files.copy(in, out) FileIO.jarRootPath(AbsolutePath(out)) } private val httpHandler = new HttpHandler { override def handleRequest(exchange: HttpServerExchange): Unit = { val bytes = try { lock.synchronized { getBytes(exchange) } } catch { case NonFatal(e) => logger.error(s"unexpected error: $exchange", e) Array.emptyByteArray } val compressed = gzipDeflate(bytes) val buffer = ByteBuffer.wrap(compressed) exchange.getResponseHeaders.put( Headers.CONTENT_ENCODING, "gzip" ) exchange.getResponseHeaders.put( Headers.CONTENT_TYPE, contentType(exchange.getRequestPath) ) exchange.getResponseSender.send(buffer) } } private val server = Undertow .builder() .addHttpListener(port, host) .setHandler(httpHandler) .build() private def getBytes(exchange: HttpServerExchange): Array[Byte] = { val path = exchange.getRequestPath.stripSuffix(".gz") if (path.endsWith("index.workspace")) { getWorkspace.toByteArray } else if (path.endsWith(".symbolindexes")) { val header = exchange.getRequestHeaders.get("Metabrowse-Symbol") if (header.isEmpty) { logger.error(s"no Metabrowse-Symbol header: $exchange") Array.emptyByteArray } else { getSymbol(header.getFirst).toByteArray } } else if (path.endsWith(".semanticdb")) { getSemanticdb(path).toByteArray } else if (path.endsWith(".map")) { // Ignore requests for sourcemaps. Array.emptyByteArray } else { val actualPath = if (path == "/") "/index.html" else path val file = assets.resolve(actualPath) if (file.isFile) file.readAllBytes else { logger.warn(s"no such file: $file") Array.emptyByteArray } } } private def gzipDeflate(bytes: Array[Byte]): Array[Byte] = { if (bytes.isEmpty) bytes else { val baos = new ByteArrayOutputStream() val gos = new GZIPOutputStream(baos, bytes.length) try { gos.write(bytes) gos.finish() baos.toByteArray } finally { gos.close() } } } private def getWorkspace: Workspace = { val filenames = ArrayBuffer.newBuilder[String] for { sourcesJar <- sourcepath.sources } { FileIO.withJarFileSystem( AbsolutePath(sourcesJar), create = false, close = false ) { root => FileIO .listAllFilesRecursively(root) .filter(!_.toLanguage.isUnknownLanguage) .foreach(path => filenames += path.toNIO.toString.stripPrefix("/")) } } Workspace(filenames.result().toSeq) } private def getSemanticdb(filename: String): TextDocuments = { val path = filename .stripPrefix("/semanticdb/") .stripPrefix("/") // optional '/' .stripSuffix(".semanticdb") logger.info(path) for { in <- Option(classLoader.getResourceAsStream(path)).orElse { logger.warn(s"no source file: $path") None } text = new String(InputStreamIO.readBytes(in), StandardCharsets.UTF_8) doc <- try { val timeout = TimeUnit.SECONDS.toMillis(10) val textDocument = if (path.endsWith(".java")) { val input = Input.VirtualFile(path, text) Mtags.index(input) } else { InteractiveSemanticdb.toTextDocument( global, text, filename, timeout, List( "-P:semanticdb:synthetics:on", "-P:semanticdb:symbols:none" ) ) } Some(textDocument) } catch { case NonFatal(e) => logger.error(s"compile error: $filename", e) None } } yield TextDocuments(List(doc.withText(text))) }.getOrElse(TextDocuments()) private def getSymbol(sym: String): SymbolIndexes = { val definition = for { defn <- index .definition(t.Symbol(sym)) .orElse { logger.error(s"no definition for symbol: '$sym'") None } input = defn.path.toInput doc = Mtags.index(input) occ <- doc.occurrences .find { occ => occ.role.isDefinition && occ.range.isDefined && occ.symbol == defn.definitionSymbol.value } .orElse { logger.error(s"no definition occurrence: $defn") None } range <- occ.range.orElse { logger.error(s"no range: $occ") None } } yield { d.Position( defn.path.toString(), startLine = range.startLine, startCharacter = range.startCharacter, endLine = range.endLine, endCharacter = range.endCharacter ) } SymbolIndexes( List( SymbolIndex( symbol = sym, definition = definition ) ) ) } private def contentType(path: String): String = { if (path.endsWith(".js")) "application/javascript" else if (path.endsWith(".css")) "text/css" else if (path.endsWith(".html")) "text/html" else "" } } object MetabrowseServer { /** * Basic command-line interface to start metabrowse-server. * * Examples: {{{ * * // browse multiple artifacts with no custom compiler flags * metabrowse-server org.scalameta:scalameta_2.12:4.0.0 org.typelevel:paiges_2.12:0.2.1 * * // browse artifact with custom compiler flags * metabrowse-server -Yrangepos -Xfatal-warning -- org.scalameta:scalameta_2.12:4.0.0 * * // browse artifact with macroparadise and kind-project plugins enabled * metabrowse-server macroparadise -- org.scalameta:scalameta_2.12:4.0.0 * * }}} * * This basic interface exists primarily for local testing purposes, it's probably best * to use a proper command-line parsing library down the road, */ def main(arrayArgs: Array[String]): Unit = { val args = arrayArgs.iterator.map { case "macroparadise" => s"-Xplugin:$macroParadise" case "kind-projector" => s"-Xplugin:$kindProjector" case flag => flag }.toList val dash = args.indexOf("--") val (scalacOptions, artifacts) = { if (dash < 0) { (Nil, args) } else { (args.slice(0, dash), args.slice(dash + 1, args.length)) } } val sourcepath = Sourcepath(artifacts) val server = new MetabrowseServer(scalacOptions = scalacOptions) val in = new Scanner(System.in) server.start(sourcepath) try { println( "Listening to http://localhost:4000/ (press enter to stop server)" ) in.nextLine() } catch { case NonFatal(_) => } finally { println("Stopping server...") server.stop() } } private def macroParadise: Path = Sourcepath.coursierFetchCompilerPlugin( s"org.scalamacros:paradise_${scalaFullVersion}:2.1.0" ) private def kindProjector: Path = Sourcepath.coursierFetchCompilerPlugin( s"org.spire-math:kind-projector_${scalaBinaryVersion}:0.9.8" ) private def scalaFullVersion: String = scala.util.Properties.versionNumberString private def scalaBinaryVersion: String = scala.util.Properties.versionNumberString.split("\\\\.").take(2).mkString(".") }
scalameta/metadoc
metabrowse-server/src/main/scala/metabrowse/server/MetabrowseServer.scala
Scala
apache-2.0
11,695
/* * Copyright 2017 PayPal * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.squbs.stream import java.util.concurrent.atomic.AtomicInteger import akka.{Done, NotUsed} import akka.actor.ActorContext import akka.stream.ClosedShape import akka.stream.scaladsl.GraphDSL.Implicits._ import akka.stream.scaladsl._ import scala.concurrent.Future import scala.language.postfixOps case object NotifyWhenDone { def getInstance: NotifyWhenDone.type = this } object ThrowExceptionStream { val limit = 50000 val exceptionAt = limit * 3 / 10 val recordCount = new AtomicInteger(0) } class ThrowExceptionStream extends PerpetualStream[Future[Int]] { import ThrowExceptionStream._ def streamGraph = RunnableGraph.fromGraph(GraphDSL.createGraph(counter) { implicit builder => sink => startSource ~> injectError ~> sink ClosedShape }) val injectError = Flow[Int].map { n => if (n == exceptionAt) throw new NumberFormatException("This is a fake exception") else n } def counter = Flow[Any].map{ _ => recordCount.incrementAndGet(); 1 }.reduce{ _ + _ }.toMat(Sink.head)(Keep.right) override def receive = { case NotifyWhenDone => import context.dispatcher val target = sender() matValue foreach { v => target ! v } } private def startSource(implicit context: ActorContext): Source[Int, NotUsed] = Source(1 to limit) override def shutdown() = { println("Neo Stream Result " + recordCount.get + "\\n\\n") Future.successful(Done) } }
akara/squbs
squbs-unicomplex/src/test/scala/org/squbs/stream/ThrowExceptionStream.scala
Scala
apache-2.0
2,038
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.util import java.util.{Properties, UUID} import org.apache.spark.scheduler.cluster.ExecutorInfo import scala.collection.JavaConverters._ import scala.collection.Map import org.json4s.DefaultFormats import org.json4s.JsonDSL._ import org.json4s.JsonAST._ import org.apache.spark._ import org.apache.spark.executor._ import org.apache.spark.rdd.RDDOperationScope import org.apache.spark.scheduler._ import org.apache.spark.storage._ /** * Serializes SparkListener events to/from JSON. This protocol provides strong backwards- * and forwards-compatibility guarantees: any version of Spark should be able to read JSON output * written by any other version, including newer versions. * * 将SparkListener事件序列化到/从JSON,该协议提供强大的向后兼容性和前向兼容性保证: * 任何版本的Spark应该能够读取任何其他版本的JSON输出,包括较新版本 * * JsonProtocolSuite contains backwards-compatibility tests which check that the current version of * JsonProtocol is able to read output written by earlier versions. We do not currently have tests * for reading newer JSON output with older Spark versions. * * JsonProtocolSuite包含向后兼容性测试,检查当前版本的JsonProtocol是否能够读取较早版本的输出, * 我们目前没有使用旧的Spark版本读取较新的JSON输出的测试。 * * To ensure that we provide these guarantees, follow these rules when modifying these methods: * 为确保我们提供这些保证,修改这些方法时请遵循以下规则: * * - Never delete any JSON fields. 不要删除任何JSON字段 * - Any new JSON fields should be optional; use `Utils.jsonOption` when reading these fields * in `*FromJson` methods. * 任何新的JSON字段都应该是可选的; 在`* FromJson`方法中读取这些字段时使用`Utils.jsonOption`。 jsonInclude(Include.NON_NULL) 属性为NULL 不序列化 将该标记放在属性上,如果该属性为NULL则不参与序列化 如果放在类上边,那对这个类的全部属性起作用 Include.Include.ALWAYS 默认 Include.NON_DEFAULT 属性为默认值不序列化 Include.NON_EMPTY 属性为 空(“”) 或者为 NULL 都不序列化 Include.NON_NULL 属性为NULL 不序列化 */ private[spark] object JsonProtocol { // TODO: Remove this file and put JSON serialization into each individual class. private implicit val format = DefaultFormats /** ------------------------------------------------- * * JSON serialization methods for SparkListenerEvents | * -------------------------------------------------- */ def sparkEventToJson(event: SparkListenerEvent): JValue = { event match { case stageSubmitted: SparkListenerStageSubmitted => stageSubmittedToJson(stageSubmitted) case stageCompleted: SparkListenerStageCompleted => stageCompletedToJson(stageCompleted) case taskStart: SparkListenerTaskStart => taskStartToJson(taskStart) case taskGettingResult: SparkListenerTaskGettingResult => taskGettingResultToJson(taskGettingResult) case taskEnd: SparkListenerTaskEnd => taskEndToJson(taskEnd) case jobStart: SparkListenerJobStart => jobStartToJson(jobStart) case jobEnd: SparkListenerJobEnd => jobEndToJson(jobEnd) case environmentUpdate: SparkListenerEnvironmentUpdate => environmentUpdateToJson(environmentUpdate) case blockManagerAdded: SparkListenerBlockManagerAdded => blockManagerAddedToJson(blockManagerAdded) case blockManagerRemoved: SparkListenerBlockManagerRemoved => blockManagerRemovedToJson(blockManagerRemoved) case unpersistRDD: SparkListenerUnpersistRDD => unpersistRDDToJson(unpersistRDD) case applicationStart: SparkListenerApplicationStart => applicationStartToJson(applicationStart) case applicationEnd: SparkListenerApplicationEnd => applicationEndToJson(applicationEnd) case executorAdded: SparkListenerExecutorAdded => executorAddedToJson(executorAdded) case executorRemoved: SparkListenerExecutorRemoved => executorRemovedToJson(executorRemoved) case logStart: SparkListenerLogStart => logStartToJson(logStart) case metricsUpdate: SparkListenerExecutorMetricsUpdate => executorMetricsUpdateToJson(metricsUpdate) case blockUpdated: SparkListenerBlockUpdated => throw new MatchError(blockUpdated) // TODO(ekl) implement this } } def stageSubmittedToJson(stageSubmitted: SparkListenerStageSubmitted): JValue = { val stageInfo = stageInfoToJson(stageSubmitted.stageInfo) val properties = propertiesToJson(stageSubmitted.properties) ("Event" -> Utils.getFormattedClassName(stageSubmitted)) ~ ("Stage Info" -> stageInfo) ~ ("Properties" -> properties) } def stageCompletedToJson(stageCompleted: SparkListenerStageCompleted): JValue = { val stageInfo = stageInfoToJson(stageCompleted.stageInfo) ("Event" -> Utils.getFormattedClassName(stageCompleted)) ~ ("Stage Info" -> stageInfo) } def taskStartToJson(taskStart: SparkListenerTaskStart): JValue = { val taskInfo = taskStart.taskInfo ("Event" -> Utils.getFormattedClassName(taskStart)) ~ ("Stage ID" -> taskStart.stageId) ~ ("Stage Attempt ID" -> taskStart.stageAttemptId) ~ ("Task Info" -> taskInfoToJson(taskInfo)) } def taskGettingResultToJson(taskGettingResult: SparkListenerTaskGettingResult): JValue = { val taskInfo = taskGettingResult.taskInfo ("Event" -> Utils.getFormattedClassName(taskGettingResult)) ~ ("Task Info" -> taskInfoToJson(taskInfo)) } def taskEndToJson(taskEnd: SparkListenerTaskEnd): JValue = { val taskEndReason = taskEndReasonToJson(taskEnd.reason) val taskInfo = taskEnd.taskInfo val taskMetrics = taskEnd.taskMetrics val taskMetricsJson = if (taskMetrics != null) taskMetricsToJson(taskMetrics) else JNothing ("Event" -> Utils.getFormattedClassName(taskEnd)) ~ ("Stage ID" -> taskEnd.stageId) ~ ("Stage Attempt ID" -> taskEnd.stageAttemptId) ~ ("Task Type" -> taskEnd.taskType) ~ ("Task End Reason" -> taskEndReason) ~ ("Task Info" -> taskInfoToJson(taskInfo)) ~ ("Task Metrics" -> taskMetricsJson) } def jobStartToJson(jobStart: SparkListenerJobStart): JValue = { val properties = propertiesToJson(jobStart.properties) ("Event" -> Utils.getFormattedClassName(jobStart)) ~ ("Job ID" -> jobStart.jobId) ~ ("Submission Time" -> jobStart.time) ~ ("Stage Infos" -> jobStart.stageInfos.map(stageInfoToJson)) ~ // Added in Spark 1.2.0 ("Stage IDs" -> jobStart.stageIds) ~ ("Properties" -> properties) } def jobEndToJson(jobEnd: SparkListenerJobEnd): JValue = { val jobResult = jobResultToJson(jobEnd.jobResult) ("Event" -> Utils.getFormattedClassName(jobEnd)) ~ ("Job ID" -> jobEnd.jobId) ~ ("Completion Time" -> jobEnd.time) ~ ("Job Result" -> jobResult) } def environmentUpdateToJson(environmentUpdate: SparkListenerEnvironmentUpdate): JValue = { val environmentDetails = environmentUpdate.environmentDetails val jvmInformation = mapToJson(environmentDetails("JVM Information").toMap) val sparkProperties = mapToJson(environmentDetails("Spark Properties").toMap) val systemProperties = mapToJson(environmentDetails("System Properties").toMap) val classpathEntries = mapToJson(environmentDetails("Classpath Entries").toMap) ("Event" -> Utils.getFormattedClassName(environmentUpdate)) ~ ("JVM Information" -> jvmInformation) ~ ("Spark Properties" -> sparkProperties) ~ ("System Properties" -> systemProperties) ~ ("Classpath Entries" -> classpathEntries) } def blockManagerAddedToJson(blockManagerAdded: SparkListenerBlockManagerAdded): JValue = { val blockManagerId = blockManagerIdToJson(blockManagerAdded.blockManagerId) ("Event" -> Utils.getFormattedClassName(blockManagerAdded)) ~ ("Block Manager ID" -> blockManagerId) ~ ("Maximum Memory" -> blockManagerAdded.maxMem) ~ ("Timestamp" -> blockManagerAdded.time) } def blockManagerRemovedToJson(blockManagerRemoved: SparkListenerBlockManagerRemoved): JValue = { val blockManagerId = blockManagerIdToJson(blockManagerRemoved.blockManagerId) ("Event" -> Utils.getFormattedClassName(blockManagerRemoved)) ~ ("Block Manager ID" -> blockManagerId) ~ ("Timestamp" -> blockManagerRemoved.time) } def unpersistRDDToJson(unpersistRDD: SparkListenerUnpersistRDD): JValue = { ("Event" -> Utils.getFormattedClassName(unpersistRDD)) ~ ("RDD ID" -> unpersistRDD.rddId) } def applicationStartToJson(applicationStart: SparkListenerApplicationStart): JValue = { ("Event" -> Utils.getFormattedClassName(applicationStart)) ~ ("App Name" -> applicationStart.appName) ~ ("App ID" -> applicationStart.appId.map(JString(_)).getOrElse(JNothing)) ~ ("Timestamp" -> applicationStart.time) ~ ("User" -> applicationStart.sparkUser) ~ ("App Attempt ID" -> applicationStart.appAttemptId.map(JString(_)).getOrElse(JNothing)) ~ ("Driver Logs" -> applicationStart.driverLogs.map(mapToJson).getOrElse(JNothing)) } def applicationEndToJson(applicationEnd: SparkListenerApplicationEnd): JValue = { ("Event" -> Utils.getFormattedClassName(applicationEnd)) ~ ("Timestamp" -> applicationEnd.time) } def executorAddedToJson(executorAdded: SparkListenerExecutorAdded): JValue = { ("Event" -> Utils.getFormattedClassName(executorAdded)) ~ ("Timestamp" -> executorAdded.time) ~ ("Executor ID" -> executorAdded.executorId) ~ ("Executor Info" -> executorInfoToJson(executorAdded.executorInfo)) } def executorRemovedToJson(executorRemoved: SparkListenerExecutorRemoved): JValue = { ("Event" -> Utils.getFormattedClassName(executorRemoved)) ~ ("Timestamp" -> executorRemoved.time) ~ ("Executor ID" -> executorRemoved.executorId) ~ ("Removed Reason" -> executorRemoved.reason) } def logStartToJson(logStart: SparkListenerLogStart): JValue = { ("Event" -> Utils.getFormattedClassName(logStart)) ~ ("Spark Version" -> SPARK_VERSION) } def executorMetricsUpdateToJson(metricsUpdate: SparkListenerExecutorMetricsUpdate): JValue = { val execId = metricsUpdate.execId val taskMetrics = metricsUpdate.taskMetrics ("Event" -> Utils.getFormattedClassName(metricsUpdate)) ~ ("Executor ID" -> execId) ~ ("Metrics Updated" -> taskMetrics.map { case (taskId, stageId, stageAttemptId, metrics) => ("Task ID" -> taskId) ~ ("Stage ID" -> stageId) ~ ("Stage Attempt ID" -> stageAttemptId) ~ ("Task Metrics" -> taskMetricsToJson(metrics)) }) } /** ------------------------------------------------------------------- * * JSON serialization methods for classes SparkListenerEvents depend on | * 类SparkListenerEvents的JSON序列化方法依赖于 | * -------------------------------------------------------------------- */ def stageInfoToJson(stageInfo: StageInfo): JValue = { val rddInfo = JArray(stageInfo.rddInfos.map(rddInfoToJson).toList) val parentIds = JArray(stageInfo.parentIds.map(JInt(_)).toList) val submissionTime = stageInfo.submissionTime.map(JInt(_)).getOrElse(JNothing) val completionTime = stageInfo.completionTime.map(JInt(_)).getOrElse(JNothing) val failureReason = stageInfo.failureReason.map(JString(_)).getOrElse(JNothing) ("Stage ID" -> stageInfo.stageId) ~ ("Stage Attempt ID" -> stageInfo.attemptId) ~ ("Stage Name" -> stageInfo.name) ~ ("Number of Tasks" -> stageInfo.numTasks) ~ ("RDD Info" -> rddInfo) ~ ("Parent IDs" -> parentIds) ~ ("Details" -> stageInfo.details) ~ ("Submission Time" -> submissionTime) ~ ("Completion Time" -> completionTime) ~ ("Failure Reason" -> failureReason) ~ ("Accumulables" -> JArray( stageInfo.accumulables.values.map(accumulableInfoToJson).toList)) } def taskInfoToJson(taskInfo: TaskInfo): JValue = { ("Task ID" -> taskInfo.taskId) ~ ("Index" -> taskInfo.index) ~ ("Attempt" -> taskInfo.attemptNumber) ~ ("Launch Time" -> taskInfo.launchTime) ~ ("Executor ID" -> taskInfo.executorId) ~ ("Host" -> taskInfo.host) ~ ("Locality" -> taskInfo.taskLocality.toString) ~ ("Speculative" -> taskInfo.speculative) ~ ("Getting Result Time" -> taskInfo.gettingResultTime) ~ ("Finish Time" -> taskInfo.finishTime) ~ ("Failed" -> taskInfo.failed) ~ ("Accumulables" -> JArray(taskInfo.accumulables.map(accumulableInfoToJson).toList)) } def accumulableInfoToJson(accumulableInfo: AccumulableInfo): JValue = { ("ID" -> accumulableInfo.id) ~ ("Name" -> accumulableInfo.name) ~ ("Update" -> accumulableInfo.update.map(new JString(_)).getOrElse(JNothing)) ~ ("Value" -> accumulableInfo.value) ~ ("Internal" -> accumulableInfo.internal) } def taskMetricsToJson(taskMetrics: TaskMetrics): JValue = { val shuffleReadMetrics = taskMetrics.shuffleReadMetrics.map(shuffleReadMetricsToJson).getOrElse(JNothing) val shuffleWriteMetrics = taskMetrics.shuffleWriteMetrics.map(shuffleWriteMetricsToJson).getOrElse(JNothing) val inputMetrics = taskMetrics.inputMetrics.map(inputMetricsToJson).getOrElse(JNothing) val outputMetrics = taskMetrics.outputMetrics.map(outputMetricsToJson).getOrElse(JNothing) val updatedBlocks = taskMetrics.updatedBlocks.map { blocks => JArray(blocks.toList.map { case (id, status) => ("Block ID" -> id.toString) ~ ("Status" -> blockStatusToJson(status)) }) }.getOrElse(JNothing) ("Host Name" -> taskMetrics.hostname) ~ ("Executor Deserialize Time" -> taskMetrics.executorDeserializeTime) ~ ("Executor Run Time" -> taskMetrics.executorRunTime) ~ ("Result Size" -> taskMetrics.resultSize) ~ ("JVM GC Time" -> taskMetrics.jvmGCTime) ~ ("Result Serialization Time" -> taskMetrics.resultSerializationTime) ~ ("Memory Bytes Spilled" -> taskMetrics.memoryBytesSpilled) ~ ("Disk Bytes Spilled" -> taskMetrics.diskBytesSpilled) ~ ("Shuffle Read Metrics" -> shuffleReadMetrics) ~ ("Shuffle Write Metrics" -> shuffleWriteMetrics) ~ ("Input Metrics" -> inputMetrics) ~ ("Output Metrics" -> outputMetrics) ~ ("Updated Blocks" -> updatedBlocks) } def shuffleReadMetricsToJson(shuffleReadMetrics: ShuffleReadMetrics): JValue = { ("Remote Blocks Fetched" -> shuffleReadMetrics.remoteBlocksFetched) ~ ("Local Blocks Fetched" -> shuffleReadMetrics.localBlocksFetched) ~ ("Fetch Wait Time" -> shuffleReadMetrics.fetchWaitTime) ~ ("Remote Bytes Read" -> shuffleReadMetrics.remoteBytesRead) ~ ("Local Bytes Read" -> shuffleReadMetrics.localBytesRead) ~ ("Total Records Read" -> shuffleReadMetrics.recordsRead) } def shuffleWriteMetricsToJson(shuffleWriteMetrics: ShuffleWriteMetrics): JValue = { ("Shuffle Bytes Written" -> shuffleWriteMetrics.shuffleBytesWritten) ~ ("Shuffle Write Time" -> shuffleWriteMetrics.shuffleWriteTime) ~ ("Shuffle Records Written" -> shuffleWriteMetrics.shuffleRecordsWritten) } def inputMetricsToJson(inputMetrics: InputMetrics): JValue = { ("Data Read Method" -> inputMetrics.readMethod.toString) ~ ("Bytes Read" -> inputMetrics.bytesRead) ~ ("Records Read" -> inputMetrics.recordsRead) } def outputMetricsToJson(outputMetrics: OutputMetrics): JValue = { ("Data Write Method" -> outputMetrics.writeMethod.toString) ~ ("Bytes Written" -> outputMetrics.bytesWritten) ~ ("Records Written" -> outputMetrics.recordsWritten) } def taskEndReasonToJson(taskEndReason: TaskEndReason): JValue = { val reason = Utils.getFormattedClassName(taskEndReason) val json: JObject = taskEndReason match { case fetchFailed: FetchFailed => val blockManagerAddress = Option(fetchFailed.bmAddress). map(blockManagerIdToJson).getOrElse(JNothing) ("Block Manager Address" -> blockManagerAddress) ~ ("Shuffle ID" -> fetchFailed.shuffleId) ~ ("Map ID" -> fetchFailed.mapId) ~ ("Reduce ID" -> fetchFailed.reduceId) ~ ("Message" -> fetchFailed.message) case exceptionFailure: ExceptionFailure => val stackTrace = stackTraceToJson(exceptionFailure.stackTrace) val metrics = exceptionFailure.metrics.map(taskMetricsToJson).getOrElse(JNothing) ("Class Name" -> exceptionFailure.className) ~ ("Description" -> exceptionFailure.description) ~ ("Stack Trace" -> stackTrace) ~ ("Full Stack Trace" -> exceptionFailure.fullStackTrace) ~ ("Metrics" -> metrics) case ExecutorLostFailure(executorId) => ("Executor ID" -> executorId) case taskCommitDenied: TaskCommitDenied => ("Job ID" -> taskCommitDenied.jobID) ~ ("Partition ID" -> taskCommitDenied.partitionID) ~ ("Attempt Number" -> taskCommitDenied.attemptNumber) case _ => Utils.emptyJson } ("Reason" -> reason) ~ json } def blockManagerIdToJson(blockManagerId: BlockManagerId): JValue = { ("Executor ID" -> blockManagerId.executorId) ~ ("Host" -> blockManagerId.host) ~ ("Port" -> blockManagerId.port) } def jobResultToJson(jobResult: JobResult): JValue = { val result = Utils.getFormattedClassName(jobResult) val json = jobResult match { case JobSucceeded => Utils.emptyJson case jobFailed: JobFailed => JObject("Exception" -> exceptionToJson(jobFailed.exception)) } ("Result" -> result) ~ json } def rddInfoToJson(rddInfo: RDDInfo): JValue = { val storageLevel = storageLevelToJson(rddInfo.storageLevel) val parentIds = JArray(rddInfo.parentIds.map(JInt(_)).toList) ("RDD ID" -> rddInfo.id) ~ ("Name" -> rddInfo.name) ~ ("Scope" -> rddInfo.scope.map(_.toJson)) ~ ("Parent IDs" -> parentIds) ~ ("Storage Level" -> storageLevel) ~ ("Number of Partitions" -> rddInfo.numPartitions) ~ ("Number of Cached Partitions" -> rddInfo.numCachedPartitions) ~ ("Memory Size" -> rddInfo.memSize) ~ ("ExternalBlockStore Size" -> rddInfo.externalBlockStoreSize) ~ ("Disk Size" -> rddInfo.diskSize) } def storageLevelToJson(storageLevel: StorageLevel): JValue = { ("Use Disk" -> storageLevel.useDisk) ~ ("Use Memory" -> storageLevel.useMemory) ~ ("Use ExternalBlockStore" -> storageLevel.useOffHeap) ~ ("Deserialized" -> storageLevel.deserialized) ~ ("Replication" -> storageLevel.replication) } def blockStatusToJson(blockStatus: BlockStatus): JValue = { val storageLevel = storageLevelToJson(blockStatus.storageLevel) ("Storage Level" -> storageLevel) ~ ("Memory Size" -> blockStatus.memSize) ~ ("ExternalBlockStore Size" -> blockStatus.externalBlockStoreSize) ~ ("Disk Size" -> blockStatus.diskSize) } def executorInfoToJson(executorInfo: ExecutorInfo): JValue = { ("Host" -> executorInfo.executorHost) ~ ("Total Cores" -> executorInfo.totalCores) ~ ("Log Urls" -> mapToJson(executorInfo.logUrlMap)) } /** ------------------------------ * * Util JSON serialization methods | *Util JSON序列化方法         | * ------------------------------- */ def mapToJson(m: Map[String, String]): JValue = { val jsonFields = m.map { case (k, v) => JField(k, JString(v)) } JObject(jsonFields.toList) } def propertiesToJson(properties: Properties): JValue = { Option(properties).map { p => mapToJson(p.asScala) }.getOrElse(JNothing) } def UUIDToJson(id: UUID): JValue = { ("Least Significant Bits" -> id.getLeastSignificantBits) ~ ("Most Significant Bits" -> id.getMostSignificantBits) } def stackTraceToJson(stackTrace: Array[StackTraceElement]): JValue = { JArray(stackTrace.map { case line => ("Declaring Class" -> line.getClassName) ~ ("Method Name" -> line.getMethodName) ~ ("File Name" -> line.getFileName) ~ ("Line Number" -> line.getLineNumber) }.toList) } def exceptionToJson(exception: Exception): JValue = { ("Message" -> exception.getMessage) ~ ("Stack Trace" -> stackTraceToJson(exception.getStackTrace)) } /** --------------------------------------------------- * * JSON deserialization methods for SparkListenerEvents | * ---------------------------------------------------- */ def sparkEventFromJson(json: JValue): SparkListenerEvent = { val stageSubmitted = Utils.getFormattedClassName(SparkListenerStageSubmitted) val stageCompleted = Utils.getFormattedClassName(SparkListenerStageCompleted) val taskStart = Utils.getFormattedClassName(SparkListenerTaskStart) val taskGettingResult = Utils.getFormattedClassName(SparkListenerTaskGettingResult) val taskEnd = Utils.getFormattedClassName(SparkListenerTaskEnd) val jobStart = Utils.getFormattedClassName(SparkListenerJobStart) val jobEnd = Utils.getFormattedClassName(SparkListenerJobEnd) val environmentUpdate = Utils.getFormattedClassName(SparkListenerEnvironmentUpdate) val blockManagerAdded = Utils.getFormattedClassName(SparkListenerBlockManagerAdded) val blockManagerRemoved = Utils.getFormattedClassName(SparkListenerBlockManagerRemoved) val unpersistRDD = Utils.getFormattedClassName(SparkListenerUnpersistRDD) val applicationStart = Utils.getFormattedClassName(SparkListenerApplicationStart) val applicationEnd = Utils.getFormattedClassName(SparkListenerApplicationEnd) val executorAdded = Utils.getFormattedClassName(SparkListenerExecutorAdded) val executorRemoved = Utils.getFormattedClassName(SparkListenerExecutorRemoved) val logStart = Utils.getFormattedClassName(SparkListenerLogStart) val metricsUpdate = Utils.getFormattedClassName(SparkListenerExecutorMetricsUpdate) (json \\ "Event").extract[String] match { case `stageSubmitted` => stageSubmittedFromJson(json) case `stageCompleted` => stageCompletedFromJson(json) case `taskStart` => taskStartFromJson(json) case `taskGettingResult` => taskGettingResultFromJson(json) case `taskEnd` => taskEndFromJson(json) case `jobStart` => jobStartFromJson(json) case `jobEnd` => jobEndFromJson(json) case `environmentUpdate` => environmentUpdateFromJson(json) case `blockManagerAdded` => blockManagerAddedFromJson(json) case `blockManagerRemoved` => blockManagerRemovedFromJson(json) case `unpersistRDD` => unpersistRDDFromJson(json) case `applicationStart` => applicationStartFromJson(json) case `applicationEnd` => applicationEndFromJson(json) case `executorAdded` => executorAddedFromJson(json) case `executorRemoved` => executorRemovedFromJson(json) case `logStart` => logStartFromJson(json) case `metricsUpdate` => executorMetricsUpdateFromJson(json) } } def stageSubmittedFromJson(json: JValue): SparkListenerStageSubmitted = { val stageInfo = stageInfoFromJson(json \\ "Stage Info") val properties = propertiesFromJson(json \\ "Properties") SparkListenerStageSubmitted(stageInfo, properties) } def stageCompletedFromJson(json: JValue): SparkListenerStageCompleted = { val stageInfo = stageInfoFromJson(json \\ "Stage Info") SparkListenerStageCompleted(stageInfo) } def taskStartFromJson(json: JValue): SparkListenerTaskStart = { val stageId = (json \\ "Stage ID").extract[Int] val stageAttemptId = (json \\ "Stage Attempt ID").extractOpt[Int].getOrElse(0) val taskInfo = taskInfoFromJson(json \\ "Task Info") SparkListenerTaskStart(stageId, stageAttemptId, taskInfo) } def taskGettingResultFromJson(json: JValue): SparkListenerTaskGettingResult = { val taskInfo = taskInfoFromJson(json \\ "Task Info") SparkListenerTaskGettingResult(taskInfo) } def taskEndFromJson(json: JValue): SparkListenerTaskEnd = { val stageId = (json \\ "Stage ID").extract[Int] val stageAttemptId = (json \\ "Stage Attempt ID").extractOpt[Int].getOrElse(0) val taskType = (json \\ "Task Type").extract[String] val taskEndReason = taskEndReasonFromJson(json \\ "Task End Reason") val taskInfo = taskInfoFromJson(json \\ "Task Info") val taskMetrics = taskMetricsFromJson(json \\ "Task Metrics") SparkListenerTaskEnd(stageId, stageAttemptId, taskType, taskEndReason, taskInfo, taskMetrics) } def jobStartFromJson(json: JValue): SparkListenerJobStart = { val jobId = (json \\ "Job ID").extract[Int] val submissionTime = Utils.jsonOption(json \\ "Submission Time").map(_.extract[Long]).getOrElse(-1L) val stageIds = (json \\ "Stage IDs").extract[List[JValue]].map(_.extract[Int]) val properties = propertiesFromJson(json \\ "Properties") // The "Stage Infos" field was added in Spark 1.2.0 val stageInfos = Utils.jsonOption(json \\ "Stage Infos") .map(_.extract[Seq[JValue]].map(stageInfoFromJson)).getOrElse { stageIds.map(id => new StageInfo(id, 0, "unknown", 0, Seq.empty, Seq.empty, "unknown")) } SparkListenerJobStart(jobId, submissionTime, stageInfos, properties) } def jobEndFromJson(json: JValue): SparkListenerJobEnd = { val jobId = (json \\ "Job ID").extract[Int] val completionTime = Utils.jsonOption(json \\ "Completion Time").map(_.extract[Long]).getOrElse(-1L) val jobResult = jobResultFromJson(json \\ "Job Result") SparkListenerJobEnd(jobId, completionTime, jobResult) } def environmentUpdateFromJson(json: JValue): SparkListenerEnvironmentUpdate = { val environmentDetails = Map[String, Seq[(String, String)]]( "JVM Information" -> mapFromJson(json \\ "JVM Information").toSeq, "Spark Properties" -> mapFromJson(json \\ "Spark Properties").toSeq, "System Properties" -> mapFromJson(json \\ "System Properties").toSeq, "Classpath Entries" -> mapFromJson(json \\ "Classpath Entries").toSeq) SparkListenerEnvironmentUpdate(environmentDetails) } def blockManagerAddedFromJson(json: JValue): SparkListenerBlockManagerAdded = { val blockManagerId = blockManagerIdFromJson(json \\ "Block Manager ID") val maxMem = (json \\ "Maximum Memory").extract[Long] val time = Utils.jsonOption(json \\ "Timestamp").map(_.extract[Long]).getOrElse(-1L) SparkListenerBlockManagerAdded(time, blockManagerId, maxMem) } def blockManagerRemovedFromJson(json: JValue): SparkListenerBlockManagerRemoved = { val blockManagerId = blockManagerIdFromJson(json \\ "Block Manager ID") val time = Utils.jsonOption(json \\ "Timestamp").map(_.extract[Long]).getOrElse(-1L) SparkListenerBlockManagerRemoved(time, blockManagerId) } def unpersistRDDFromJson(json: JValue): SparkListenerUnpersistRDD = { SparkListenerUnpersistRDD((json \\ "RDD ID").extract[Int]) } def applicationStartFromJson(json: JValue): SparkListenerApplicationStart = { val appName = (json \\ "App Name").extract[String] val appId = Utils.jsonOption(json \\ "App ID").map(_.extract[String]) val time = (json \\ "Timestamp").extract[Long] val sparkUser = (json \\ "User").extract[String] val appAttemptId = Utils.jsonOption(json \\ "App Attempt ID").map(_.extract[String]) val driverLogs = Utils.jsonOption(json \\ "Driver Logs").map(mapFromJson) SparkListenerApplicationStart(appName, appId, time, sparkUser, appAttemptId, driverLogs) } def applicationEndFromJson(json: JValue): SparkListenerApplicationEnd = { SparkListenerApplicationEnd((json \\ "Timestamp").extract[Long]) } def executorAddedFromJson(json: JValue): SparkListenerExecutorAdded = { val time = (json \\ "Timestamp").extract[Long] val executorId = (json \\ "Executor ID").extract[String] val executorInfo = executorInfoFromJson(json \\ "Executor Info") SparkListenerExecutorAdded(time, executorId, executorInfo) } def executorRemovedFromJson(json: JValue): SparkListenerExecutorRemoved = { val time = (json \\ "Timestamp").extract[Long] val executorId = (json \\ "Executor ID").extract[String] val reason = (json \\ "Removed Reason").extract[String] SparkListenerExecutorRemoved(time, executorId, reason) } def logStartFromJson(json: JValue): SparkListenerLogStart = { val sparkVersion = (json \\ "Spark Version").extract[String] SparkListenerLogStart(sparkVersion) } def executorMetricsUpdateFromJson(json: JValue): SparkListenerExecutorMetricsUpdate = { val execInfo = (json \\ "Executor ID").extract[String] val taskMetrics = (json \\ "Metrics Updated").extract[List[JValue]].map { json => val taskId = (json \\ "Task ID").extract[Long] val stageId = (json \\ "Stage ID").extract[Int] val stageAttemptId = (json \\ "Stage Attempt ID").extract[Int] val metrics = taskMetricsFromJson(json \\ "Task Metrics") (taskId, stageId, stageAttemptId, metrics) } SparkListenerExecutorMetricsUpdate(execInfo, taskMetrics) } /** --------------------------------------------------------------------- * * JSON deserialization methods for classes SparkListenerEvents depend on | * ---------------------------------------------------------------------- */ def stageInfoFromJson(json: JValue): StageInfo = { val stageId = (json \\ "Stage ID").extract[Int] val attemptId = (json \\ "Stage Attempt ID").extractOpt[Int].getOrElse(0) val stageName = (json \\ "Stage Name").extract[String] val numTasks = (json \\ "Number of Tasks").extract[Int] val rddInfos = (json \\ "RDD Info").extract[List[JValue]].map(rddInfoFromJson) val parentIds = Utils.jsonOption(json \\ "Parent IDs") .map { l => l.extract[List[JValue]].map(_.extract[Int]) } .getOrElse(Seq.empty) val details = (json \\ "Details").extractOpt[String].getOrElse("") val submissionTime = Utils.jsonOption(json \\ "Submission Time").map(_.extract[Long]) val completionTime = Utils.jsonOption(json \\ "Completion Time").map(_.extract[Long]) val failureReason = Utils.jsonOption(json \\ "Failure Reason").map(_.extract[String]) val accumulatedValues = (json \\ "Accumulables").extractOpt[List[JValue]] match { case Some(values) => values.map(accumulableInfoFromJson(_)) case None => Seq[AccumulableInfo]() } val stageInfo = new StageInfo( stageId, attemptId, stageName, numTasks, rddInfos, parentIds, details) stageInfo.submissionTime = submissionTime stageInfo.completionTime = completionTime stageInfo.failureReason = failureReason for (accInfo <- accumulatedValues) { stageInfo.accumulables(accInfo.id) = accInfo } stageInfo } def taskInfoFromJson(json: JValue): TaskInfo = { val taskId = (json \\ "Task ID").extract[Long] val index = (json \\ "Index").extract[Int] val attempt = (json \\ "Attempt").extractOpt[Int].getOrElse(1) val launchTime = (json \\ "Launch Time").extract[Long] val executorId = (json \\ "Executor ID").extract[String] val host = (json \\ "Host").extract[String] val taskLocality = TaskLocality.withName((json \\ "Locality").extract[String]) val speculative = (json \\ "Speculative").extractOpt[Boolean].getOrElse(false) val gettingResultTime = (json \\ "Getting Result Time").extract[Long] val finishTime = (json \\ "Finish Time").extract[Long] val failed = (json \\ "Failed").extract[Boolean] val accumulables = (json \\ "Accumulables").extractOpt[Seq[JValue]] match { case Some(values) => values.map(accumulableInfoFromJson(_)) case None => Seq[AccumulableInfo]() } val taskInfo = new TaskInfo(taskId, index, attempt, launchTime, executorId, host, taskLocality, speculative) taskInfo.gettingResultTime = gettingResultTime taskInfo.finishTime = finishTime taskInfo.failed = failed accumulables.foreach { taskInfo.accumulables += _ } taskInfo } def accumulableInfoFromJson(json: JValue): AccumulableInfo = { val id = (json \\ "ID").extract[Long] val name = (json \\ "Name").extract[String] val update = Utils.jsonOption(json \\ "Update").map(_.extract[String]) val value = (json \\ "Value").extract[String] val internal = (json \\ "Internal").extractOpt[Boolean].getOrElse(false) AccumulableInfo(id, name, update, value, internal) } def taskMetricsFromJson(json: JValue): TaskMetrics = { if (json == JNothing) { return TaskMetrics.empty } val metrics = new TaskMetrics metrics.setHostname((json \\ "Host Name").extract[String]) metrics.setExecutorDeserializeTime((json \\ "Executor Deserialize Time").extract[Long]) metrics.setExecutorRunTime((json \\ "Executor Run Time").extract[Long]) metrics.setResultSize((json \\ "Result Size").extract[Long]) metrics.setJvmGCTime((json \\ "JVM GC Time").extract[Long]) metrics.setResultSerializationTime((json \\ "Result Serialization Time").extract[Long]) metrics.incMemoryBytesSpilled((json \\ "Memory Bytes Spilled").extract[Long]) metrics.incDiskBytesSpilled((json \\ "Disk Bytes Spilled").extract[Long]) metrics.setShuffleReadMetrics( Utils.jsonOption(json \\ "Shuffle Read Metrics").map(shuffleReadMetricsFromJson)) metrics.shuffleWriteMetrics = Utils.jsonOption(json \\ "Shuffle Write Metrics").map(shuffleWriteMetricsFromJson) metrics.setInputMetrics( Utils.jsonOption(json \\ "Input Metrics").map(inputMetricsFromJson)) metrics.outputMetrics = Utils.jsonOption(json \\ "Output Metrics").map(outputMetricsFromJson) metrics.updatedBlocks = Utils.jsonOption(json \\ "Updated Blocks").map { value => value.extract[List[JValue]].map { block => val id = BlockId((block \\ "Block ID").extract[String]) val status = blockStatusFromJson(block \\ "Status") (id, status) } } metrics } def shuffleReadMetricsFromJson(json: JValue): ShuffleReadMetrics = { val metrics = new ShuffleReadMetrics metrics.incRemoteBlocksFetched((json \\ "Remote Blocks Fetched").extract[Int]) metrics.incLocalBlocksFetched((json \\ "Local Blocks Fetched").extract[Int]) metrics.incFetchWaitTime((json \\ "Fetch Wait Time").extract[Long]) metrics.incRemoteBytesRead((json \\ "Remote Bytes Read").extract[Long]) metrics.incLocalBytesRead((json \\ "Local Bytes Read").extractOpt[Long].getOrElse(0)) metrics.incRecordsRead((json \\ "Total Records Read").extractOpt[Long].getOrElse(0)) metrics } def shuffleWriteMetricsFromJson(json: JValue): ShuffleWriteMetrics = { val metrics = new ShuffleWriteMetrics metrics.incShuffleBytesWritten((json \\ "Shuffle Bytes Written").extract[Long]) metrics.incShuffleWriteTime((json \\ "Shuffle Write Time").extract[Long]) metrics.setShuffleRecordsWritten((json \\ "Shuffle Records Written") .extractOpt[Long].getOrElse(0)) metrics } def inputMetricsFromJson(json: JValue): InputMetrics = { val metrics = new InputMetrics( DataReadMethod.withName((json \\ "Data Read Method").extract[String])) metrics.incBytesRead((json \\ "Bytes Read").extract[Long]) metrics.incRecordsRead((json \\ "Records Read").extractOpt[Long].getOrElse(0)) metrics } def outputMetricsFromJson(json: JValue): OutputMetrics = { val metrics = new OutputMetrics( DataWriteMethod.withName((json \\ "Data Write Method").extract[String])) metrics.setBytesWritten((json \\ "Bytes Written").extract[Long]) metrics.setRecordsWritten((json \\ "Records Written").extractOpt[Long].getOrElse(0)) metrics } def taskEndReasonFromJson(json: JValue): TaskEndReason = { val success = Utils.getFormattedClassName(Success) val resubmitted = Utils.getFormattedClassName(Resubmitted) val fetchFailed = Utils.getFormattedClassName(FetchFailed) val exceptionFailure = Utils.getFormattedClassName(ExceptionFailure) val taskResultLost = Utils.getFormattedClassName(TaskResultLost) val taskKilled = Utils.getFormattedClassName(TaskKilled) val taskCommitDenied = Utils.getFormattedClassName(TaskCommitDenied) val executorLostFailure = Utils.getFormattedClassName(ExecutorLostFailure) val unknownReason = Utils.getFormattedClassName(UnknownReason) (json \\ "Reason").extract[String] match { case `success` => Success case `resubmitted` => Resubmitted case `fetchFailed` => val blockManagerAddress = blockManagerIdFromJson(json \\ "Block Manager Address") val shuffleId = (json \\ "Shuffle ID").extract[Int] val mapId = (json \\ "Map ID").extract[Int] val reduceId = (json \\ "Reduce ID").extract[Int] val message = Utils.jsonOption(json \\ "Message").map(_.extract[String]) new FetchFailed(blockManagerAddress, shuffleId, mapId, reduceId, message.getOrElse("Unknown reason")) case `exceptionFailure` => val className = (json \\ "Class Name").extract[String] val description = (json \\ "Description").extract[String] val stackTrace = stackTraceFromJson(json \\ "Stack Trace") val fullStackTrace = Utils.jsonOption(json \\ "Full Stack Trace"). map(_.extract[String]).orNull val metrics = Utils.jsonOption(json \\ "Metrics").map(taskMetricsFromJson) ExceptionFailure(className, description, stackTrace, fullStackTrace, metrics, None) case `taskResultLost` => TaskResultLost case `taskKilled` => TaskKilled case `taskCommitDenied` => // Unfortunately, the `TaskCommitDenied` message was introduced in 1.3.0 but the JSON // de/serialization logic was not added until 1.5.1. To provide backward compatibility // for reading those logs, we need to provide default values for all the fields. val jobId = Utils.jsonOption(json \\ "Job ID").map(_.extract[Int]).getOrElse(-1) val partitionId = Utils.jsonOption(json \\ "Partition ID").map(_.extract[Int]).getOrElse(-1) val attemptNo = Utils.jsonOption(json \\ "Attempt Number").map(_.extract[Int]).getOrElse(-1) TaskCommitDenied(jobId, partitionId, attemptNo) case `executorLostFailure` => val executorId = Utils.jsonOption(json \\ "Executor ID").map(_.extract[String]) ExecutorLostFailure(executorId.getOrElse("Unknown")) case `unknownReason` => UnknownReason } } def blockManagerIdFromJson(json: JValue): BlockManagerId = { // On metadata fetch fail, block manager ID can be null (SPARK-4471) if (json == JNothing) { return null } val executorId = (json \\ "Executor ID").extract[String] val host = (json \\ "Host").extract[String] val port = (json \\ "Port").extract[Int] BlockManagerId(executorId, host, port) } def jobResultFromJson(json: JValue): JobResult = { val jobSucceeded = Utils.getFormattedClassName(JobSucceeded) val jobFailed = Utils.getFormattedClassName(JobFailed) (json \\ "Result").extract[String] match { case `jobSucceeded` => JobSucceeded case `jobFailed` => val exception = exceptionFromJson(json \\ "Exception") new JobFailed(exception) } } def rddInfoFromJson(json: JValue): RDDInfo = { val rddId = (json \\ "RDD ID").extract[Int] val name = (json \\ "Name").extract[String] val scope = Utils.jsonOption(json \\ "Scope") .map(_.extract[String]) .map(RDDOperationScope.fromJson) val parentIds = Utils.jsonOption(json \\ "Parent IDs") .map { l => l.extract[List[JValue]].map(_.extract[Int]) } .getOrElse(Seq.empty) val storageLevel = storageLevelFromJson(json \\ "Storage Level") val numPartitions = (json \\ "Number of Partitions").extract[Int] val numCachedPartitions = (json \\ "Number of Cached Partitions").extract[Int] val memSize = (json \\ "Memory Size").extract[Long] // fallback to tachyon for backward compatibility val externalBlockStoreSize = (json \\ "ExternalBlockStore Size").toSome .getOrElse(json \\ "Tachyon Size").extract[Long] val diskSize = (json \\ "Disk Size").extract[Long] val rddInfo = new RDDInfo(rddId, name, numPartitions, storageLevel, parentIds, scope) rddInfo.numCachedPartitions = numCachedPartitions rddInfo.memSize = memSize rddInfo.externalBlockStoreSize = externalBlockStoreSize rddInfo.diskSize = diskSize rddInfo } def storageLevelFromJson(json: JValue): StorageLevel = { val useDisk = (json \\ "Use Disk").extract[Boolean] val useMemory = (json \\ "Use Memory").extract[Boolean] // fallback to tachyon for backward compatability val useExternalBlockStore = (json \\ "Use ExternalBlockStore").toSome .getOrElse(json \\ "Use Tachyon").extract[Boolean] val deserialized = (json \\ "Deserialized").extract[Boolean] val replication = (json \\ "Replication").extract[Int] StorageLevel(useDisk, useMemory, useExternalBlockStore, deserialized, replication) } def blockStatusFromJson(json: JValue): BlockStatus = { val storageLevel = storageLevelFromJson(json \\ "Storage Level") val memorySize = (json \\ "Memory Size").extract[Long] val diskSize = (json \\ "Disk Size").extract[Long] // fallback to tachyon for backward compatability val externalBlockStoreSize = (json \\ "ExternalBlockStore Size").toSome .getOrElse(json \\ "Tachyon Size").extract[Long] BlockStatus(storageLevel, memorySize, diskSize, externalBlockStoreSize) } def executorInfoFromJson(json: JValue): ExecutorInfo = { val executorHost = (json \\ "Host").extract[String] val totalCores = (json \\ "Total Cores").extract[Int] val logUrls = mapFromJson(json \\ "Log Urls").toMap new ExecutorInfo(executorHost, totalCores, logUrls) } /** -------------------------------- * * Util JSON deserialization methods | * --------------------------------- */ def mapFromJson(json: JValue): Map[String, String] = { val jsonFields = json.asInstanceOf[JObject].obj jsonFields.map { case JField(k, JString(v)) => (k, v) }.toMap } def propertiesFromJson(json: JValue): Properties = { Utils.jsonOption(json).map { value => val properties = new Properties mapFromJson(json).foreach { case (k, v) => properties.setProperty(k, v) } properties }.getOrElse(null) } def UUIDFromJson(json: JValue): UUID = { val leastSignificantBits = (json \\ "Least Significant Bits").extract[Long] val mostSignificantBits = (json \\ "Most Significant Bits").extract[Long] new UUID(leastSignificantBits, mostSignificantBits) } def stackTraceFromJson(json: JValue): Array[StackTraceElement] = { json.extract[List[JValue]].map { line => val declaringClass = (line \\ "Declaring Class").extract[String] val methodName = (line \\ "Method Name").extract[String] val fileName = (line \\ "File Name").extract[String] val lineNumber = (line \\ "Line Number").extract[Int] new StackTraceElement(declaringClass, methodName, fileName, lineNumber) }.toArray } def exceptionFromJson(json: JValue): Exception = { val e = new Exception((json \\ "Message").extract[String]) e.setStackTrace(stackTraceFromJson(json \\ "Stack Trace")) e } }
tophua/spark1.52
core/src/main/scala/org/apache/spark/util/JsonProtocol.scala
Scala
apache-2.0
43,953
package redis.actors import akka.actor.{ActorLogging, ActorRef, Actor} import akka.io.Tcp import akka.util.{ByteStringBuilder, ByteString} import java.net.InetSocketAddress import akka.io.Tcp._ import akka.io.Tcp.Connected import akka.io.Tcp.Register import akka.io.Tcp.Connect import akka.io.Tcp.CommandFailed import akka.io.Tcp.Received abstract class RedisWorkerIO(val address: InetSocketAddress, onConnectStatus: Boolean => Unit ) extends Actor with ActorLogging { private var currAddress = address import context._ val tcp = akka.io.IO(Tcp)(context.system) // todo watch tcpWorker var tcpWorker: ActorRef = null val bufferWrite: ByteStringBuilder = new ByteStringBuilder var readyToWrite = false override def preStart() { if (tcpWorker != null) { tcpWorker ! Close } log.info(s"Connect to $currAddress") // Create a new InetSocketAddress to clear the cached IP address. currAddress = new InetSocketAddress(currAddress.getHostName, currAddress.getPort) tcp ! Connect(currAddress, options = SO.KeepAlive(on = true) :: Nil) } def reconnect() = { become(receive) preStart() } override def postStop() { log.info("RedisWorkerIO stop") } def initConnectedBuffer() { readyToWrite = true } def receive = connecting orElse writing def connecting: Receive = { case a: InetSocketAddress => onAddressChanged(a) case c: Connected => onConnected(c) case Reconnect => reconnect() case c: CommandFailed => onConnectingCommandFailed(c) case c: ConnectionClosed => onClosingConnectionClosed() // not the current opening connection } def onConnected(cmd: Connected) = { sender ! Register(self) tcpWorker = sender initConnectedBuffer() tryInitialWrite() // TODO write something in head buffer become(connected) log.info("Connected to " + cmd.remoteAddress) onConnectStatus(true) } def onConnectingCommandFailed(cmdFailed: CommandFailed) = { log.error(cmdFailed.toString) scheduleReconnect() } def connected: Receive = writing orElse reading private def reading: Receive = { case WriteAck => tryWrite() case Received(dataByteString) => { if(sender == tcpWorker) onDataReceived(dataByteString) else onDataReceivedOnClosingConnection(dataByteString) } case a: InetSocketAddress => onAddressChanged(a) case c: ConnectionClosed => { if(sender == tcpWorker) onConnectionClosed(c) else onClosingConnectionClosed() } case c: CommandFailed => onConnectedCommandFailed(c) } def onAddressChanged(addr: InetSocketAddress) { log.info(s"Address change [old=$address, new=$addr]") tcpWorker ! ConfirmedClose // close the sending direction of the connection (TCP FIN) currAddress = addr scheduleReconnect() } def onConnectionClosed(c: ConnectionClosed) = { log.warning(s"ConnectionClosed $c") scheduleReconnect() } /** O/S buffer was full * Maybe to much data in the Command ? */ def onConnectedCommandFailed(commandFailed: CommandFailed) = { log.error(commandFailed.toString) // O/S buffer was full tcpWorker ! commandFailed.cmd } def scheduleReconnect() { cleanState() log.info(s"Trying to reconnect in $reconnectDuration") this.context.system.scheduler.scheduleOnce(reconnectDuration, self, Reconnect) become(receive) } def cleanState() { onConnectStatus(false) onConnectionClosed() readyToWrite = false bufferWrite.clear() } def writing: Receive def onConnectionClosed() def onDataReceived(dataByteString: ByteString) def onDataReceivedOnClosingConnection(dataByteString: ByteString) def onClosingConnectionClosed() def onWriteSent() def restartConnection() = reconnect() def onConnectWrite(): ByteString def tryInitialWrite() { val data = onConnectWrite() if (data.nonEmpty) { writeWorker(data ++ bufferWrite.result()) bufferWrite.clear() } else { tryWrite() } } def tryWrite() { if (bufferWrite.length == 0) { readyToWrite = true } else { writeWorker(bufferWrite.result()) bufferWrite.clear() } } def write(byteString: ByteString) { if (readyToWrite) { writeWorker(byteString) } else { bufferWrite.append(byteString) } } import scala.concurrent.duration.{DurationInt, FiniteDuration} def reconnectDuration: FiniteDuration = 2 seconds private def writeWorker(byteString: ByteString) { onWriteSent() tcpWorker ! Write(byteString, WriteAck) readyToWrite = false } } object WriteAck extends Event object Reconnect
beni55/rediscala
src/main/scala/redis/actors/RedisWorkerIO.scala
Scala
apache-2.0
4,691
import org.scalatest.FunSpec import planck.{SizeMismatchException, Vecd, Matrixd} class MatrixdTests extends FunSpec { def v(e: Double*) = Vecd(e) def m(e: Vecd*) = Matrixd(e) val m1234 = m(v(1, 2), v(3, 4)) val m2468 = m(v(2, 4), v(6, 8)) val m135975 = m(v(1, 3), v(5, 9), v(7, 5)) val m126790 = m(v(1, 2, 6), v(7, 9, 0)) describe("*") { describe("matrix-matrix multiplication") { it("multiplies matrices") { assert(m1234 * m2468 == m(v(14, 20), v(30, 44))) } it("multiplies matrices of different sizes") { assert(m1234 * m135975 == m(v(10, 14), v(32, 46), v(22, 34))) assert(m135975 * m126790 == m(v(53, 51), v(52, 102))) } it("multiplies larger matrices") { val m1 = m(v(1,0,0,0), v(0,1,0,0), v(0,0,2,5), v(0,0,3,6)) val m2 = m(v(1,0,0,0), v(0,1,0,0), v(0,0,8,7), v(0,0,2,3)) val ret = m(v(1,0,0,0), v(0,1,0,0), v(0,0,37,82), v(0,0,13,28)) assert(m1 * m2 == ret) } it("multiplies matrices of size 0") { assert(m() * m() == m()) } it("throws an exception on an invalid sizes") { intercept[SizeMismatchException] { m135975 * m1234 } } } describe("matrix-vector multiplication") { it("multiplies matrices and vectors") { assert(m1234 * v(5, 3) == v(14, 22)) assert(m135975 * v(3, -1, 2) == v(12, 10)) } it("throws an exception on an invalid sizes") { intercept[SizeMismatchException] { m135975 * v(1, 2, 3, 4) } } } } describe("transform") { it("Applies a 4x4 matrix to a vector of size 3, then divides each of the " + "first 3 components by the 4th") { val transformMat = m( v( 1, 3, 5, 7), v( 9,11,13,15), v(17,19,21,23), v(25,27,29,31) ) val vec = v(3, 6, 5) val endVec = transformMat.transform(vec) assert(endVec == v( 0.6498054474708171, 0.7665369649805448, 0.8832684824902723 )) } } }
noryb009/planck
test/src/planck/MatrixdTests.scala
Scala
mit
2,060
class S { class O { def f(s: String | Null): String | Null = ??? def f(ss: Array[String] | Null): Array[String] | Null = ??? def g(s: String): String = ??? def g(ss: Array[String]): Array[String] = ??? def h(ts: String => String): String = ??? def h(ts: Array[String] => Array[String]): Array[String] = ??? def i(ts: String | Null => String | Null): String | Null = ??? def i(ts: Array[String] | Null => Array[String] | Null): Array[String] | Null = ??? } val o: O = ??? locally { def h1(hh: String => String) = ??? def h2(hh: Array[String] => Array[String]) = ??? def f1(x: String | Null): String | Null = ??? def f2(x: Array[String | Null]): Array[String | Null] = ??? h1(f1) // error h1(o.f) // error h2(f2) // error h2(o.f) // error } locally { def h1(hh: String | Null => String | Null) = ??? def h2(hh: Array[String | Null] => Array[String | Null]) = ??? def g1(x: String): String = ??? def g2(x: Array[String]): Array[String] = ??? h1(g1) // error h1(o.g) // error h2(g2) // error h2(o.g) // error } locally { def f1(x: String | Null): String | Null = ??? def f2(x: Array[String | Null]): Array[String | Null] = ??? o.h(f1) // error o.h(f2) // error } locally { def g1(x: String): String = ??? def g2(x: Array[String]): Array[String] = ??? o.i(g1) // error o.i(g2) // error } }
dotty-staging/dotty
tests/explicit-nulls/unsafe-common/unsafe-overload.scala
Scala
apache-2.0
1,452
/* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.gov.hmrc.ct.ct600.v2 import uk.gov.hmrc.ct.box._ import uk.gov.hmrc.ct.ct600.v2.retriever.ReturnStatementsBoxRetriever import uk.gov.hmrc.ct.ct600.v2.validation.RSQ7MutuallyExclusiveWithRSQ8 case class RSQ7(value: Option[Boolean]) extends CtBoxIdentifier with CtOptionalBoolean with Input with ValidatableBox[ReturnStatementsBoxRetriever] with RSQ7MutuallyExclusiveWithRSQ8 { override def validate(boxRetriever: ReturnStatementsBoxRetriever): Set[CtValidation] = { validateAsMandatory(this) ++ validateMutualExclusivity(boxRetriever) } }
hmrc/ct-calculations
src/main/scala/uk/gov/hmrc/ct/ct600/v2/RSQ7.scala
Scala
apache-2.0
1,167
package blended.updater.config import java.io.File import scala.collection.JavaConverters._ import scala.util.Success import blended.testsupport.TestFile import blended.testsupport.TestFile.{ DeletePolicy, DeleteWhenNoFailure } import blended.updater.config.util.ConfigPropertyMapConverter import blended.util.logging.Logger import com.typesafe.config.ConfigFactory import org.scalatest.{ FreeSpec, Matchers } import org.scalatest.Args import org.scalatest.Status class OverlaysTest extends FreeSpec with Matchers with TestFile { private[this] val log = Logger[OverlaysTest] override def runTest(testName: String, args: Args): Status = { log.info("START runTest " + testName) try super.runTest(testName, args) finally log.info("FINISHED runTest " + testName) } implicit val deletePolicy: DeletePolicy = DeleteWhenNoFailure "Serialization of OverlayConfig" - { "deserializes a config file" in { withTestFile( """name: overlay |version: 1 |configGenerator = [ | { | file = file1 | config = { | file1key: value | } | }, | { | file = container/file2.conf | config = { | file2key: value | } | } |]""".stripMargin ) { file => val config = ConfigFactory.parseFile(file).resolve() val read = OverlayConfigCompanion.read(config) read.isSuccess shouldEqual true read.get.name shouldEqual "overlay" read.get.version shouldEqual "1" read.get.generatedConfigs.toSet shouldEqual Set( GeneratedConfigCompanion.create( "file1", ConfigFactory.parseMap(Map("file1key" -> "value").asJava) ), GeneratedConfigCompanion.create( "container/file2.conf", ConfigFactory.parseMap(Map("file2key" -> "value").asJava) ) ) } } "serializes and desializes to the same config" in { val c = OverlayConfig( name = "overlay", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create( "file1", ConfigFactory.parseMap(Map("file1key" -> "value").asJava) ), GeneratedConfigCompanion.create( "container/file2", ConfigFactory.parseMap(Map("file2key" -> "value").asJava) ) ) ) val read = OverlayConfigCompanion.read(OverlayConfigCompanion.toConfig(c)) read.isSuccess shouldEqual true read.get.name shouldEqual "overlay" read.get.version shouldEqual "1" read.get.generatedConfigs.toSet shouldEqual Set( GeneratedConfigCompanion.create( "file1", ConfigFactory.parseMap(Map("file1key" -> "value").asJava) ), GeneratedConfigCompanion.create( "container/file2", ConfigFactory.parseMap(Map("file2key" -> "value").asJava) ) ) } } "Overlay materialized dir for " - { "an empty LocalOverlays" - { "materializes not into the same directory" in { val dir = new File(".") val oDir = LocalOverlays.materializedDir(overlays = Nil, profileDir = dir) oDir shouldBe dir } } "a non-empty LocalOverlays" - { "materializes into a sub directory" in { val dir = new File(".") val oDir = LocalOverlays.materializedDir(overlays = List(OverlayRef("o", "1")), profileDir = dir) oDir.getPath() startsWith dir.getPath() oDir.getPath().length() > dir.getPath().length() } "materializes into same sub dir even if the overlays have different order" in { val dir = new File(".") val o1Dir = LocalOverlays.materializedDir(overlays = List(OverlayRef("o", "1"), OverlayRef("p", "1")), profileDir = dir) val o2Dir = LocalOverlays.materializedDir(overlays = List(OverlayRef("p", "1"), OverlayRef("o", "1")), profileDir = dir) o1Dir shouldBe o2Dir } } } "LocalOverlays validation" - { "detects overlays with same name" in { val o1_1 = OverlayConfig("overlay1", "1") val o1_2 = OverlayConfig("overlay1", "2") val o2_1 = OverlayConfig("overlay2", "1") val overlays = LocalOverlays(overlays = Set(o1_1, o1_2, o2_1), profileDir = new File(".")) overlays.validate() shouldEqual Seq("More than one overlay with name 'overlay1' detected") } "detects overlays with conflicting propetries" in { val o1 = OverlayConfig("o1", "1", properties = Map("P1" -> "V1")) val o2 = OverlayConfig("o2", "1", properties = Map("P1" -> "V2")) val overlays = LocalOverlays(overlays = Set(o1, o2), profileDir = new File(".")) overlays.validate() shouldEqual Seq("Duplicate property definitions detected. Property: P1 Occurences: o1-1, o2-1") } "detects overlays with conflicting generators" in { val config1 = ConfigFactory.parseString("key=val1") val o1 = OverlayConfig( name = "o1", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config1) ) ) val config2 = ConfigFactory.parseString("key=val2") val o2 = OverlayConfig( name = "o2", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config2) ) ) val overlays = LocalOverlays(overlays = Set(o1, o2), profileDir = new File(".")) overlays.validate() should have size 1 overlays.validate() shouldEqual Seq("Double defined config key found: key") } } "OverlayConfig validation" - { "detects conflicting generators" in { val config1 = ConfigFactory.parseString("key=val1") val config2 = ConfigFactory.parseString("key=val2") val overlay = OverlayConfig( name = "o", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config1), GeneratedConfigCompanion.create("container/application_overlay.conf", config2) ) ) OverlayConfigCompanion.findCollisions(overlay.generatedConfigs) shouldEqual Seq("Double defined config key found: key") } } "LocalOverlays file generator" - { "generates nothing if no generators are present" in { val o1 = OverlayConfig("overlay1", "1") val o2 = OverlayConfig("overlay2", "1") withTestDir() { dir => val overlays = LocalOverlays(Set(o1, o2), dir) overlays.materialize().isSuccess shouldBe true overlays.materializedDir.listFiles() shouldBe null } } "generates one config file with merged content" in { val config1 = ConfigFactory.parseString("key1=val1") val o1 = OverlayConfig( name = "o1", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config1) ) ) val config2 = ConfigFactory.parseString("key2=val2") val o2 = OverlayConfig( name = "o2", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config2) ) ) withTestDir() { dir => val overlays = LocalOverlays(Set(o1, o2), dir) overlays.materialize().isSuccess shouldBe true val expectedEtcDir = new File(dir, "o1-1/o2-1/container") overlays.materializedDir.listFiles() shouldBe Array(expectedEtcDir) val expectedConfigFile = new File(expectedEtcDir, "application_overlay.conf") expectedEtcDir.listFiles() shouldBe Array(expectedConfigFile) ConfigFactory.parseFile(expectedConfigFile).getString("key1") shouldBe "val1" ConfigFactory.parseFile(expectedConfigFile).getString("key2") shouldBe "val2" } } "generates nothing and aborts when configs have conflicts" in { val config1 = ConfigFactory.parseString("key1=val1") val o1 = OverlayConfig( name = "o1", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config1) ) ) val config2 = ConfigFactory.parseString("key1=val2") val o2 = OverlayConfig( name = "o2", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config2) ) ) withTestDir() { dir => val overlays = LocalOverlays(Set(o1, o2), dir) overlays.materialize().isFailure shouldBe true } } "preserves property-key formatting in merged generated content" in { val config1 = ConfigFactory.parseString("props {\\n\\"a.b.c\\"=val1\\n}") val o1 = OverlayConfig( name = "o1", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config1) ) ) log.info("overlay config 1: " + o1) // FIXME: also enable this // val config2 = ConfigFactory.parseString("props {\\n\\"a.b.d\\"=val2\\n}") val config2 = ConfigFactory.parseString("props2 {\\n\\"a.b.d\\"=val2\\n}") val o2 = OverlayConfig( name = "o2", version = "1", generatedConfigs = List( GeneratedConfigCompanion.create("container/application_overlay.conf", config2) ) ) log.info("overlay config 2: " + o2) withTestDir() { dir => val overlays = LocalOverlays(Set(o1, o2), dir) val expectedEtcDir = new File(dir, "o1-1/o2-1/container") val expectedConfigFile = new File(expectedEtcDir, "application_overlay.conf") assert(overlays.materialize().map(_.toSet) === Success(Set(expectedConfigFile))) // overlays.materialize().isSuccess shouldBe true // overlays.materializedDir.listFiles() shouldBe Array(expectedEtcDir) // expectedEtcDir.listFiles() shouldBe Array(expectedConfigFile) val expectedConfig = ConfigFactory.parseFile(expectedConfigFile) log.info("expectedConfig: " + expectedConfig) val props = ConfigPropertyMapConverter.getKeyAsPropertyMap(expectedConfig, "props", None) assert(props("a.b.c") === "val1") val props2 = ConfigPropertyMapConverter.getKeyAsPropertyMap(expectedConfig, "props2", None) assert(props2("a.b.d") === "val2") // .getString("key1") shouldBe "val1" // ConfigFactory.parseFile(expectedConfigFile).getString("key2") shouldBe "val2" } } } }
lefou/blended
blended.updater.config/jvm/src/test/scala/blended/updater/config/overlayTest.scala
Scala
apache-2.0
10,734
package mesosphere.marathon package core.task.tracker.impl import akka.Done import akka.actor.{ ActorRef, Status } import akka.event.EventStream import akka.testkit.TestProbe import ch.qos.logback.classic.Level import com.google.inject.Provider import mesosphere.AkkaUnitTest import mesosphere.marathon.core.CoreGuiceModule import mesosphere.marathon.test.SettableClock import mesosphere.marathon.core.group.GroupManager import mesosphere.marathon.core.health.HealthCheckManager import mesosphere.marathon.core.instance.TestInstanceBuilder import mesosphere.marathon.core.instance.update.{ InstanceUpdateEffect, InstanceUpdateOpResolver, InstanceUpdateOperation, InstanceUpdated } import mesosphere.marathon.core.launchqueue.LaunchQueue import mesosphere.marathon.core.pod.PodDefinition import mesosphere.marathon.core.task.bus.MesosTaskStatusTestHelper import mesosphere.marathon.core.task.update.impl.steps._ import mesosphere.marathon.state.{ AppDefinition, PathId, Timestamp } import mesosphere.marathon.storage.repository.InstanceRepository import mesosphere.marathon.test.{ CaptureLogEvents, _ } import org.apache.mesos.SchedulerDriver import scala.concurrent.Future import scala.concurrent.duration._ import scala.util.{ Failure, Success, Try } class InstanceOpProcessorImplTest extends AkkaUnitTest { // ignored by the TaskOpProcessorImpl val deadline = Timestamp.zero class Fixture { lazy val config = MarathonTestHelper.defaultConfig() lazy val instanceTrackerProbe = TestProbe() lazy val opSender = TestProbe() lazy val instanceRepository = mock[InstanceRepository] lazy val stateOpResolver = mock[InstanceUpdateOpResolver] lazy val clock = new SettableClock() lazy val now = clock.now() lazy val healthCheckManager: HealthCheckManager = mock[HealthCheckManager] lazy val healthCheckManagerProvider: Provider[HealthCheckManager] = new Provider[HealthCheckManager] { override def get(): HealthCheckManager = healthCheckManager } lazy val schedulerActor: TestProbe = TestProbe() lazy val schedulerActorProvider = new Provider[ActorRef] { override def get(): ActorRef = schedulerActor.ref } lazy val groupManager: GroupManager = mock[GroupManager] lazy val groupManagerProvider: Provider[GroupManager] = new Provider[GroupManager] { override def get(): GroupManager = groupManager } lazy val launchQueue: LaunchQueue = mock[LaunchQueue] lazy val launchQueueProvider: Provider[LaunchQueue] = new Provider[LaunchQueue] { override def get(): LaunchQueue = launchQueue } lazy val schedulerDriver: SchedulerDriver = mock[SchedulerDriver] lazy val eventBus: EventStream = mock[EventStream] lazy val guiceModule = new CoreGuiceModule(system.settings.config) // Use module method to ensure that we keep the list of steps in sync with the test. lazy val statusUpdateSteps = guiceModule.taskStatusUpdateSteps( notifyHealthCheckManager, notifyRateLimiter, notifyLaunchQueue, postToEventStream, scaleApp ) // task status update steps lazy val notifyHealthCheckManager = new NotifyHealthCheckManagerStepImpl(healthCheckManagerProvider) lazy val notifyRateLimiter = new NotifyRateLimiterStepImpl(launchQueueProvider, groupManagerProvider) lazy val postToEventStream = new PostToEventStreamStepImpl(eventBus) lazy val notifyLaunchQueue = new NotifyLaunchQueueStepImpl(launchQueueProvider) lazy val scaleApp = new ScaleAppUpdateStepImpl(schedulerActorProvider) lazy val processor = new InstanceOpProcessorImpl(instanceTrackerProbe.ref, instanceRepository, stateOpResolver, config) def verifyNoMoreInteractions(): Unit = { instanceTrackerProbe.expectNoMsg(0.seconds) noMoreInteractions(instanceRepository) noMoreInteractions(stateOpResolver) } } "InstanceOpProcessorImpl" should { "process update with success" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpUpdate(MesosTaskStatusTestHelper.runningHealthy()) val mesosStatus = stateOp.mesosStatus val expectedEffect = InstanceUpdateEffect.Update(instance, Some(instance), events = Nil) val ack = InstanceTrackerActor.Ack(f.opSender.ref, expectedEffect) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.get(instance.instanceId) returns Future.successful(Some(instance)) f.instanceRepository.store(instance) returns Future.successful(Done) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, stateOp) ) And("the taskTracker replies immediately") f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) And("the processor replies with unit accordingly") result.futureValue should be(()) // first wait for the call to complete Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("it calls store") verify(f.instanceRepository).store(instance) And("no more interactions") f.verifyNoMoreInteractions() } "process update with failing taskRepository.store but successful load of existing task" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository and existing task") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpUpdate(MesosTaskStatusTestHelper.running()) val expectedEffect = InstanceUpdateEffect.Update(instance, Some(instance), events = Nil) val ack = InstanceTrackerActor.Ack(f.opSender.ref, expectedEffect) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.store(instance) returns Future.failed(new RuntimeException("fail")) f.instanceRepository.get(instance.instanceId) returns Future.successful(Some(instance)) When("the processor processes an update") var result: Try[Unit] = Failure(new RuntimeException("test executing failed")) val logs = CaptureLogEvents.forBlock { val resultF = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, stateOp) ) f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) result = Try(resultF.futureValue) // linter:ignore:VariableAssignedUnusedValue // we need to complete the future here to get all the logs } Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) Then("it calls store") verify(f.instanceRepository).store(instance) And("logs a warning after detecting the error") logs.filter(l => l.getLevel == Level.WARN && l.getMessage.contains(s"[${instance.instanceId.idString}]")) should have size 1 And("loads the task") verify(f.instanceRepository).get(instance.instanceId) And("it replies with unit immediately because the task is as expected") result should be(Success(())) And("no more interactions") f.verifyNoMoreInteractions() } "process update with failing taskRepository.store and successful load of non-existing task" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository and no task") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpUpdate(MesosTaskStatusTestHelper.running()) val expectedEffect = InstanceUpdateEffect.Update(instance, Some(instance), events = Nil) val storeException: RuntimeException = new scala.RuntimeException("fail") val ack = InstanceTrackerActor.Ack(f.opSender.ref, InstanceUpdateEffect.Failure(storeException)) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.store(instance) returns Future.failed(storeException) f.instanceRepository.get(instance.instanceId) returns Future.successful(None) When("the processor processes an update") var result: Try[Unit] = Failure(new RuntimeException("test executing failed")) val logs = CaptureLogEvents.forBlock { val resultF = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, stateOp) ) f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) result = Try(resultF.futureValue) // linter:ignore:VariableAssignedUnusedValue // we need to complete the future here to get all the logs } Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) Then("it calls store") verify(f.instanceRepository).store(instance) And("logs a warning after detecting the error") logs.filter(l => l.getLevel == Level.WARN && l.getMessage.contains(s"[${instance.instanceId.idString}]")) should have size 1 And("loads the task") verify(f.instanceRepository).get(instance.instanceId) And("it replies with unit immediately because the task is as expected") result should be(Success(())) And("no more interactions") f.verifyNoMoreInteractions() } "process update with failing taskRepository.store and load also fails" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository and existing task") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val storeFailed: RuntimeException = new scala.RuntimeException("store failed") val stateOp = builder.stateOpUpdate(MesosTaskStatusTestHelper.running()) val expectedEffect = InstanceUpdateEffect.Update(instance, Some(instance), events = Nil) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.store(instance) returns Future.failed(storeFailed) f.instanceRepository.get(instance.instanceId) returns Future.failed(new RuntimeException("task failed")) When("the processor processes an update") var result: Try[Unit] = Failure(new RuntimeException("test executing failed")) val logs = CaptureLogEvents.forBlock { result = Try(f.processor.process( // linter:ignore:VariableAssignedUnusedValue InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, stateOp) ).futureValue) // we need to complete the future here to get all the logs } Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) Then("it calls store") verify(f.instanceRepository).store(instance) And("loads the task") verify(f.instanceRepository).get(instance.instanceId) And("it replies with the original error") result.isFailure shouldBe true result.failed.get.getCause.getMessage should be(storeFailed.getMessage) And("logs a two warnings, for store and for task") logs.filter(l => l.getLevel == Level.WARN && l.getMessage.contains(s"[${instance.instanceId.idString}]")) should have size 2 And("no more interactions") f.verifyNoMoreInteractions() } "process expunge with success" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpExpunge() val expectedEffect = InstanceUpdateEffect.Expunge(instance, events = Nil) val ack = InstanceTrackerActor.Ack(f.opSender.ref, expectedEffect) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.delete(instance.instanceId) returns Future.successful(Done) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, InstanceUpdateOperation.ForceExpunge(instance.instanceId)) ) f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) Then("it replies with unit immediately") result.futureValue should be(()) Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("it calls expunge") verify(f.instanceRepository).delete(instance.instanceId) And("no more interactions") f.verifyNoMoreInteractions() } "process expunge, expunge fails but task reload confirms that task is gone" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpExpunge() val expectedEffect = InstanceUpdateEffect.Expunge(instance, events = Nil) val ack = InstanceTrackerActor.Ack(f.opSender.ref, expectedEffect) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.delete(instance.instanceId) returns Future.failed(new RuntimeException("expunge fails")) f.instanceRepository.get(instance.instanceId) returns Future.successful(None) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, InstanceUpdateOperation.ForceExpunge(instance.instanceId)) ) f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) Then("it replies with unit immediately") result.futureValue should be(()) Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("it calls expunge") verify(f.instanceRepository).delete(instance.instanceId) And("it reloads the task") verify(f.instanceRepository).get(instance.instanceId) And("the taskTracker gets the update") And("no more interactions") f.verifyNoMoreInteractions() } "process expunge, expunge fails and task reload suggests that task is still there" in { val f = new Fixture val appId = PathId("/app") Given("a taskRepository") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val expungeException: RuntimeException = new scala.RuntimeException("expunge fails") val stateOp = builder.stateOpExpunge() val resolvedEffect = InstanceUpdateEffect.Expunge(instance, events = Nil) val ack = InstanceTrackerActor.Ack(f.opSender.ref, InstanceUpdateEffect.Failure(expungeException)) f.stateOpResolver.resolve(stateOp) returns Future.successful(resolvedEffect) f.instanceRepository.delete(instance.instanceId) returns Future.failed(expungeException) f.instanceRepository.get(instance.instanceId) returns Future.successful(Some(instance)) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, f.opSender.ref, instance.instanceId, InstanceUpdateOperation.ForceExpunge(instance.instanceId)) ) f.instanceTrackerProbe.expectMsg(InstanceTrackerActor.StateChanged(ack)) f.instanceTrackerProbe.reply(()) Then("it replies with unit immediately") result.futureValue should be(()) // first we make sure that the call completes Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("it calls expunge") verify(f.instanceRepository).delete(instance.instanceId) And("it reloads the task") verify(f.instanceRepository).get(instance.instanceId) And("no more interactions") f.verifyNoMoreInteractions() } "process statusUpdate with NoChange" in { val f = new Fixture val appId = PathId("/app") Given("a statusUpdateResolver and an update") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpUpdate(MesosTaskStatusTestHelper.running()) val expectedEffect = InstanceUpdateEffect.Noop(instance.instanceId) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.get(instance.instanceId) returns Future.successful(Some(instance)) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, testActor, instance.instanceId, stateOp) ) Then("it replies with unit immediately") result.futureValue should be(()) Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("the initiator gets its ack") expectMsg(expectedEffect) And("no more interactions") f.verifyNoMoreInteractions() } "process statusUpdate with Failure" in { val f = new Fixture val appId = PathId("/app") Given("a statusUpdateResolver and an update") val builder = TestInstanceBuilder.newBuilderWithLaunchedTask(appId) val instance = builder.getInstance() val stateOp = builder.stateOpReservationTimeout() val exception = new RuntimeException("ReservationTimeout on LaunchedEphemeral is unexpected") val expectedEffect = InstanceUpdateEffect.Failure(exception) f.stateOpResolver.resolve(stateOp) returns Future.successful(expectedEffect) f.instanceRepository.get(instance.instanceId) returns Future.successful(Some(instance)) When("the processor processes an update") val result = f.processor.process( InstanceOpProcessor.Operation(deadline, testActor, instance.instanceId, stateOp) ) Then("it replies with unit immediately") result.futureValue should be(()) Then("The StateOpResolver is called") verify(f.stateOpResolver).resolve(stateOp) And("the initiator gets its ack") expectMsg(Status.Failure(exception)) And("no more interactions") f.verifyNoMoreInteractions() } "the rate limiter will inform the launch queue of apps" in { val f = new Fixture val appId = PathId("/pod") val app = AppDefinition(id = appId) val version = Timestamp.now() val builder = TestInstanceBuilder.newBuilder(appId, version, version).addTaskDropped() f.groupManager.appVersion(appId, version.toOffsetDateTime) returns Future.successful(Some(app)) f.groupManager.podVersion(appId, version.toOffsetDateTime) returns Future.successful(None) f.notifyRateLimiter.process(InstanceUpdated(builder.instance, None, Nil)).futureValue verify(f.groupManager).appVersion(appId, version.toOffsetDateTime) verify(f.groupManager).podVersion(appId, version.toOffsetDateTime) verify(f.launchQueue).addDelay(app) } "the rate limiter will inform the launch queue of pods" in { val f = new Fixture val podId = PathId("/pod") val pod = PodDefinition(id = podId) val version = Timestamp.now() val builder = TestInstanceBuilder.newBuilder(podId, version, version).addTaskDropped() f.groupManager.appVersion(podId, version.toOffsetDateTime) returns Future.successful(None) f.groupManager.podVersion(podId, version.toOffsetDateTime) returns Future.successful(Some(pod)) f.notifyRateLimiter.process(InstanceUpdated(builder.instance, None, Nil)).futureValue verify(f.groupManager).appVersion(podId, version.toOffsetDateTime) verify(f.groupManager).podVersion(podId, version.toOffsetDateTime) verify(f.launchQueue).addDelay(pod) } } }
janisz/marathon
src/test/scala/mesosphere/marathon/core/task/tracker/impl/InstanceOpProcessorImplTest.scala
Scala
apache-2.0
20,282
package cmd import org.rogach.scallop._ import recommender.DistanceMetric /** * Parse arguments (from command line) that can be later accessed as values of the Conf instance * @param arguments Command line arguments */ class Conf(arguments: Seq[String]) extends ScallopConf(arguments) { val datasetTypes = DataHolderFactoryFromConf.dataHolderFactories val algorithms = RecommenderFactoryFromConf.recommenderFactories val distanceMetrics = DistanceMetric.distanceMetrics banner( """ SparkRecommender ---------------- Recommendation system in Scala using the Apache Spark framework Example: recommender --data netflix --dir /mnt/share/netflix --method kNN -p numberOfNeighbors=5 distanceMetric=euclidean Arguments: """) version("version 0.1") //Arguments val interface = opt[String](default = Some("localhost"), descr = "Interface for setting up API") val port = opt[Int](default = Some(8080), descr = "Port of interface for setting up API") val data = opt[String](required = true, validate = { str => datasetTypes.map(_.getName).contains(str)}, descr = { "Type of dataset. Possibilities: " + datasetTypes.map(_.getName).reduce(_ + ", " + _) }) val dir = opt[String](required = true, descr = "Directory containing files of dataset") val products = opt[Int](default = Some(10), descr = "Maximal number of recommended products") val method = opt[String](required = true, validate = { str => algorithms.map(_.getName).contains(str)}, descr = { "Algorithm. Possibilities: " + algorithms.map(_.getName).reduce(_ + ", " + _) }) val parameters = props[String]('p', descr = "Parameters for algorithm") val version = opt[Boolean]("version", noshort = true, descr = "Print version") val help = opt[Boolean]("help", noshort = true, descr = "Show this message") //Description of algorithms, datasets and distance metrics private val algorithmsStr = "\\nAlgorithms:\\n" + algorithms.map(factory => factory.getName + "\\nDescription: " + factory.getDescription + "\\n---------------------------\\n").reduce(_ + _) private val datasetsStr = "\\nTypes of datasets:\\n" + datasetTypes.map(factory => factory.getName + "\\nDescription: " + factory.getDescription + "\\n---------------------------\\n").reduce(_ + _) private val distanceMetricsStr = "\\nDistance metrics:\\n" + distanceMetrics.map(factory => factory.getName + "\\nDescription: " + factory.getDescription + "\\n---------------------------\\n").reduce(_ + _) footer(algorithmsStr + datasetsStr + distanceMetricsStr) /** * Get string value of an algorithm parameter * @param key Name of the parameter * @return Value (Some(String)) or None if the parameter was not given */ def getStringParameter(key: String): Option[String] = { parameters.get(key) } /** * Get integer value of an algorithm parameter * @param key Name of the parameter * @return Value (Some(Int)) or None if the parameter was not given */ def getIntParameter(key: String): Option[Int] = { val strOpt = getStringParameter(key) strOpt match { case Some(s) => Some(s.toInt) case None => None } } /** * Get Double value of an algorithm parameter * @param key Name of the parameter * @return Value (Some(Double)) or None if the parameter was not given */ def getDoubleParameter(key: String): Option[Double] = { val strOpt = getStringParameter(key) strOpt match { case Some(s) => Some(s.toDouble) case None => None } } /** * Get a DistanceMetric from algorithm parameters * @param key Name of the parameter * @return Value (Some(DistanceMetric)) or None if the parameter was not given */ def getDistanceMetricFromConf(key: String): Option[DistanceMetric] = { val dist: Option[DistanceMetric] = parameters.get(key) match { case Some(str) => { DistanceMetric.distanceMetrics.foreach(dis => { if (dis.getName == str) return Some(dis) }) return None } case None => None } dist } }
litaoran/spray-sample
src/main/scala/cmd/Conf.scala
Scala
mit
4,054
package dhg.ccg.tag import dhg.util.CollectionUtil._ import dhg.util.FileUtil._ import dhg.util.StringUtil._ import scalaz._ import scalaz.Scalaz._ trait TagDictionary[Word, Tag] extends (Word => Set[Tag]) { def allWords: Set[Word]; def allTags: Set[Tag] def startWord: Word; def startTag: Tag; def endWord: Word; def endTag: Tag def excludedTags: Set[Tag] def apply(w: Word): Set[Tag] final def allWordsSE = allWords + (startWord, endWord) final def allTagsSE = allTags + (startTag, endTag) def reversed: Map[Tag, Set[Word]] def entries: Map[Word, Set[Tag]] def knownWordsForTag: Map[Tag, Set[Word]] def withWords(words: Set[Word]): TagDictionary[Word, Tag] def withTags(tags: Set[Tag]): TagDictionary[Word, Tag] def withExcludedTags(tags: Set[Tag]): TagDictionary[Word, Tag] } /** * ONLY INSTANTIATE THIS VIA THE COMPANION OBJECT * * A Tag Dictionary is a mapping from words to all of their potential * tags. A word not found in the dictionary (including "unknown" words) * may take any tag. * * This class guarantees that looking up the startWord or endWord will * return a set containing ony the startTag or endTag, respectively. * * The allWords property is the complete set of known words excluding * the special startWord and endWord. Likewise for allTags. For the * complete set of known words and tags including these special tags * use allWordsSE and allTagsSE. */ class SimpleTagDictionary[Word, Tag] private ( map: Map[Word, Set[Tag]], val allWords: Set[Word], val allTags: Set[Tag], val startWord: Word, val startTag: Tag, val endWord: Word, val endTag: Tag, val excludedTags: Set[Tag] = Set.empty) extends TagDictionary[Word, Tag] { def apply(w: Word): Set[Tag] = { map.get(w).map(_ -- excludedTags).filter(_.nonEmpty).getOrElse(allTags) -- excludedTags } def reversed: Map[Tag, Set[Word]] = ??? def entries: Map[Word, Set[Tag]] = map.mapVals(_ -- excludedTags).filter(_._2.nonEmpty) def knownWordsForTag: Map[Tag, Set[Word]] = allTags.mapToVal(Set.empty[Word]).toMap ++ entries.ungroup.map(_.swap).groupByKey.mapVals(_.toSet) def withWords(words: Set[Word]) = new SimpleTagDictionary(map, allWords ++ words, allTags -- excludedTags, startWord, startTag, endWord, endTag, excludedTags) def withTags(tags: Set[Tag]) = new SimpleTagDictionary(map, allWords, (allTags ++ tags) -- excludedTags, startWord, startTag, endWord, endTag, excludedTags) def withExcludedTags(tags: Set[Tag]) = new SimpleTagDictionary(map, allWords, allTags, startWord, startTag, endWord, endTag, excludedTags ++ tags) } object SimpleTagDictionary { def apply[Word, Tag]( map: Map[Word, Set[Tag]], startWord: Word, startTag: Tag, endWord: Word, endTag: Tag, additionalWords: Set[Word] = Set[Word](), additionalTags: Set[Tag] = Set[Tag](), excludedTags: Set[Tag] = Set[Tag]()) = { val allAllWords = additionalWords ++ map.keys val allAllTags = additionalTags ++ map.flatMap(_._2) -- excludedTags new SimpleTagDictionary( map.mapVals(_ -- excludedTags) ++ Map(startWord -> Set(startTag), endWord -> Set(endTag)), allAllWords - (startWord, endWord), allAllTags -- excludedTags - (startTag, endTag), startWord, startTag, endWord, endTag, excludedTags) } def empty[Word, Tag](startWord: Word, startTag: Tag, endWord: Word, endTag: Tag, excludedTags: Set[Tag] = Set[Tag]()) = { SimpleTagDictionary(Map(), startWord, startTag, endWord, endTag, excludedTags = excludedTags) } } trait TagDictionaryFactory[Word, Tag] { def apply[Word, Tag]( sentences: Vector[Vector[(Word, Tag)]], startWord: Word, startTag: Tag, endWord: Word, endTag: Tag, additionalWords: Set[Word] = Set[Word](), additionalTags: Set[Tag] = Set[Tag](), excludedTags: Set[Tag] = Set[Tag]() // ): TagDictionary[Word, Tag] } class SimpleTagDictionaryFactory[Word, Tag](tdCutoff: Option[Double] = None) extends TagDictionaryFactory[Word, Tag] { override def apply[Word, Tag]( taggedSentences: Vector[Vector[(Word, Tag)]], startWord: Word, startTag: Tag, endWord: Word, endTag: Tag, additionalWords: Set[Word], additionalTags: Set[Tag], excludedTags: Set[Tag] = Set[Tag]()) = { val tagCounts = taggedSentences.flatten.groupByKey.mapVals(_.counts.normalizeValues) val cutoff = tdCutoff.getOrElse(0.0) val pruned = tagCounts.mapVals(_.collect { case (t, p) if p >= cutoff => t }.toSet -- excludedTags).filter(_._2.nonEmpty) SimpleTagDictionary(pruned, startWord, startTag, endWord, endTag, additionalWords ++ tagCounts.keys, additionalTags -- excludedTags, excludedTags) } }
dhgarrette/2014-ccg-supertagging
src/main/scala/dhg/ccg/tag/TagDictionary.scala
Scala
apache-2.0
4,640
import exceptions._ class Account(val bank: Bank, initialBalance: Double) { class Balance(var amount: Double) {} val balance = new Balance(initialBalance) val uid = bank.generateAccountId def withdraw(amount: Double): Unit = { balance.synchronized { if (balance.amount - amount < 0) throw new NoSufficientFundsException() if (amount < 0) throw new IllegalAmountException() balance.amount -= amount } } def deposit(amount: Double): Unit = { balance.synchronized { if (amount < 0) throw new IllegalAmountException() balance.amount += amount } } def transferTo(account: Account, amount: Double) = { bank addTransactionToQueue (this, account, amount) } def getBalanceAmount: Double = balance.amount }
DagF/tdt4165_progspraak_project_h15
part2-exercise/src/main/scala/Account.scala
Scala
mit
776
package ui import com.beust.jcommander.Parameter import com.beust.jcommander.ParameterException import AST.TypeDecl import AST.GenericTypeDecl // importing names COVARIANT, CONTRAVARIANT, ... import AST.ASTNode._ object ComputeStats { def computeStats(typeDecls:Seq[TypeDecl]):LibStats = { val libstats = new LibStats val startTime = System.currentTimeMillis for { typ <- typeDecls if(typ.isClassDecl || typ.isInterfaceDecl) } { val vstats = if(typ.isClassDecl) libstats.clsStats else libstats.intStats vstats.totalUselessWildcards += typ.uselessWildCardsInSig vstats.totalWildCardActuals += typ.numWildCardActualsInSig vstats.totalOverSpecified += typ.overSpecifiedActualsInSig vstats.totalArgActuals += typ.numMethArgTypeActualsInSig vstats.totalPDecls += typ.numPDeclsInSig vstats.totalRewritablePDecls += typ.numRewritablePDeclsInSig vstats.totalRewritten += typ.numRewrittenInSig vstats.totalFlowsTo += typ.numFlowsToInSig vstats.totalRewritableFlowsTo += typ.numRewritableFlowsToInSig vstats.totalVDecls += typ.numVDeclsInSig vstats.totalRewritableVDecls += typ.numRewritableVDeclsInSig vstats.totalRewrittenVDecls += typ.numRewrittenVDeclsInSig if(!typ.isGenericType) { vstats.totalMonoTypes += 1 } else { val gtd = typ.asInstanceOf[GenericTypeDecl] var isInvariant = false var isCovariant = false var isContravariant = false var isBivariant = false var isRecVar = false val numParams = gtd.getNumTypeParameter for(index <- 0 until numParams) { val dvar = gtd getDVar index val variance = dvar.eval if(variance equals INVARIANT) { vstats.totalInVarParams += 1 isInvariant = true } else if(variance equals COVARIANT) { vstats.totalCoVarParams += 1 isCovariant = true } else if(variance equals CONTRAVARIANT) { vstats.totalContraVarParams += 1 isContravariant = true } else if(variance equals BIVARIANT) { vstats.totalBiVarParams += 1 isBivariant = true } if(dvar.isRecursivelyBounded) { isRecVar = true vstats.totalRecVarParams += 1 } } if(isInvariant) vstats.totalInVar += 1 if(isCovariant) vstats.totalCoVar += 1 if(isContravariant) vstats.totalContraVar += 1 if(isBivariant) vstats.totalBiVar += 1 if(isRecVar) vstats.totalRecVar += 1 } } val endTime = System.currentTimeMillis // # of milliseconds to analyze library libstats.runningTime = endTime - startTime libstats } /* def main(args:Array[String]):Unit = { val vf = new VarFrontend val params = new FilesParams BaseParams.processArgsAndCompile(args, vf, params, "ui.ComputeStats") val typeDecls = IterSeq getSrcTypes vf.getProgram val libstats = computeStats(typeDecls) val allstats = new AllStats(List(libstats)) print(Table1.texTable(allstats)) } */ }
jgaltidor/VarJ
src/VarJFrontend/ui/ComputeStats.scala
Scala
mit
3,012
object VersionKeys { import sbt.settingKey val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.") def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match { case snap_211 if snap_211.startsWith("2.11") && snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion case sv => sbt.CrossVersion.binaryScalaVersion(sv) } }
som-snytt/scala-xml
project/keys.scala
Scala
bsd-3-clause
456
/* * Copyright 2019 ACINQ SAS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package fr.acinq.eclair.payment.send import akka.actor.{ActorRef, FSM, Props, Status} import akka.event.Logging.MDC import fr.acinq.bitcoin.ByteVector32 import fr.acinq.bitcoin.Crypto.PublicKey import fr.acinq.eclair.channel.{HtlcOverriddenByLocalCommit, HtlcsTimedoutDownstream, HtlcsWillTimeoutUpstream} import fr.acinq.eclair.db.{OutgoingPayment, OutgoingPaymentStatus, PaymentType} import fr.acinq.eclair.payment.Bolt11Invoice.ExtraHop import fr.acinq.eclair.payment.Monitoring.{Metrics, Tags} import fr.acinq.eclair.payment.OutgoingPaymentPacket.Upstream import fr.acinq.eclair.payment.PaymentSent.PartialPayment import fr.acinq.eclair.payment._ import fr.acinq.eclair.payment.send.PaymentInitiator.SendPaymentConfig import fr.acinq.eclair.payment.send.PaymentLifecycle.SendPaymentToRoute import fr.acinq.eclair.router.Router._ import fr.acinq.eclair.wire.protocol._ import fr.acinq.eclair.{CltvExpiry, FSMDiagnosticActorLogging, Logs, MilliSatoshi, MilliSatoshiLong, NodeParams, TimestampMilli} import scodec.bits.ByteVector import java.util.UUID import java.util.concurrent.TimeUnit /** * Created by t-bast on 18/07/2019. */ /** * Sender for a multi-part payment (see https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#basic-multi-part-payments). * The payment will be split into multiple sub-payments that will be sent in parallel. */ class MultiPartPaymentLifecycle(nodeParams: NodeParams, cfg: SendPaymentConfig, router: ActorRef, paymentFactory: PaymentInitiator.PaymentFactory) extends FSMDiagnosticActorLogging[MultiPartPaymentLifecycle.State, MultiPartPaymentLifecycle.Data] { import MultiPartPaymentLifecycle._ require(cfg.id == cfg.parentId, "multi-part payment cannot have a parent payment") val id = cfg.id val paymentHash = cfg.paymentHash val start = TimestampMilli.now() private var retriedFailedChannels = false startWith(WAIT_FOR_PAYMENT_REQUEST, WaitingForRequest) when(WAIT_FOR_PAYMENT_REQUEST) { case Event(r: SendMultiPartPayment, _) => val routeParams = r.routeParams.copy(randomize = false) // we don't randomize the first attempt, regardless of configuration choices val maxFee = routeParams.getMaxFee(r.totalAmount) log.debug("sending {} with maximum fee {}", r.totalAmount, maxFee) val d = PaymentProgress(r, r.maxAttempts, Map.empty, Ignore.empty, Nil) router ! createRouteRequest(nodeParams, r.totalAmount, maxFee, routeParams, d, cfg) goto(WAIT_FOR_ROUTES) using d } when(WAIT_FOR_ROUTES) { case Event(RouteResponse(routes), d: PaymentProgress) => log.info("{} routes found (attempt={}/{})", routes.length, d.request.maxAttempts - d.remainingAttempts + 1, d.request.maxAttempts) // We may have already succeeded sending parts of the payment and only need to take care of the rest. val (toSend, maxFee) = remainingToSend(d.request, d.pending.values) if (routes.map(_.amount).sum == toSend) { val childPayments = routes.map(route => (UUID.randomUUID(), route)).toMap childPayments.foreach { case (childId, route) => spawnChildPaymentFsm(childId) ! createChildPayment(self, route, d.request) } goto(PAYMENT_IN_PROGRESS) using d.copy(remainingAttempts = (d.remainingAttempts - 1).max(0), pending = d.pending ++ childPayments) } else { // If a child payment failed while we were waiting for routes, the routes we received don't cover the whole // remaining amount. In that case we discard these routes and send a new request to the router. log.info("discarding routes, another child payment failed so we need to recompute them (amount = {}, maximum fee = {})", toSend, maxFee) val routeParams = d.request.routeParams.copy(randomize = true) // we randomize route selection when we retry router ! createRouteRequest(nodeParams, toSend, maxFee, routeParams, d, cfg) stay() } case Event(Status.Failure(t), d: PaymentProgress) => log.warning("router error: {}", t.getMessage) // If no route can be found, we will retry once with the channels that we previously ignored. // Channels are mostly ignored for temporary reasons, likely because they didn't have enough balance to forward // the payment. When we're retrying an MPP split, it may make sense to retry those ignored channels because with // a different split, they may have enough balance to forward the payment. val (toSend, maxFee) = remainingToSend(d.request, d.pending.values) if (d.ignore.channels.nonEmpty) { log.debug("retry sending {} with maximum fee {} without ignoring channels ({})", toSend, maxFee, d.ignore.channels.map(_.shortChannelId).mkString(",")) val routeParams = d.request.routeParams.copy(randomize = true) // we randomize route selection when we retry router ! createRouteRequest(nodeParams, toSend, maxFee, routeParams, d, cfg).copy(ignore = d.ignore.emptyChannels()) retriedFailedChannels = true stay() using d.copy(remainingAttempts = (d.remainingAttempts - 1).max(0), ignore = d.ignore.emptyChannels()) } else { val failure = LocalFailure(toSend, Nil, t) Metrics.PaymentError.withTag(Tags.Failure, Tags.FailureType(failure)).increment() if (cfg.storeInDb && d.pending.isEmpty && d.failures.isEmpty) { // In cases where we fail early (router error during the first attempt), the DB won't have an entry for that // payment, which may be confusing for users. val dummyPayment = OutgoingPayment(id, cfg.parentId, cfg.externalId, paymentHash, PaymentType.Standard, cfg.recipientAmount, cfg.recipientAmount, cfg.recipientNodeId, TimestampMilli.now(), cfg.invoice, OutgoingPaymentStatus.Pending) nodeParams.db.payments.addOutgoingPayment(dummyPayment) nodeParams.db.payments.updateOutgoingPayment(PaymentFailed(id, paymentHash, failure :: Nil)) } gotoAbortedOrStop(PaymentAborted(d.request, d.failures :+ failure, d.pending.keySet)) } case Event(pf: PaymentFailed, d: PaymentProgress) => if (abortPayment(pf, d)) { gotoAbortedOrStop(PaymentAborted(d.request, d.failures ++ pf.failures, d.pending.keySet - pf.id)) } else { val ignore1 = PaymentFailure.updateIgnored(pf.failures, d.ignore) val assistedRoutes1 = PaymentFailure.updateRoutingHints(pf.failures, d.request.assistedRoutes) stay() using d.copy(pending = d.pending - pf.id, ignore = ignore1, failures = d.failures ++ pf.failures, request = d.request.copy(assistedRoutes = assistedRoutes1)) } // The recipient released the preimage without receiving the full payment amount. // This is a spec violation and is too bad for them, we obtained a proof of payment without paying the full amount. case Event(ps: PaymentSent, d: PaymentProgress) => require(ps.parts.length == 1, "child payment must contain only one part") // As soon as we get the preimage we can consider that the whole payment succeeded (we have a proof of payment). gotoSucceededOrStop(PaymentSucceeded(d.request, ps.paymentPreimage, ps.parts, d.pending.keySet - ps.parts.head.id)) } when(PAYMENT_IN_PROGRESS) { case Event(pf: PaymentFailed, d: PaymentProgress) => if (abortPayment(pf, d)) { gotoAbortedOrStop(PaymentAborted(d.request, d.failures ++ pf.failures, d.pending.keySet - pf.id)) } else if (d.remainingAttempts == 0) { val failure = LocalFailure(d.request.totalAmount, Nil, PaymentError.RetryExhausted) Metrics.PaymentError.withTag(Tags.Failure, Tags.FailureType(failure)).increment() gotoAbortedOrStop(PaymentAborted(d.request, d.failures ++ pf.failures :+ failure, d.pending.keySet - pf.id)) } else { val ignore1 = PaymentFailure.updateIgnored(pf.failures, d.ignore) val assistedRoutes1 = PaymentFailure.updateRoutingHints(pf.failures, d.request.assistedRoutes) val stillPending = d.pending - pf.id val (toSend, maxFee) = remainingToSend(d.request, stillPending.values) log.debug("child payment failed, retry sending {} with maximum fee {}", toSend, maxFee) val routeParams = d.request.routeParams.copy(randomize = true) // we randomize route selection when we retry val d1 = d.copy(pending = stillPending, ignore = ignore1, failures = d.failures ++ pf.failures, request = d.request.copy(assistedRoutes = assistedRoutes1)) router ! createRouteRequest(nodeParams, toSend, maxFee, routeParams, d1, cfg) goto(WAIT_FOR_ROUTES) using d1 } case Event(ps: PaymentSent, d: PaymentProgress) => require(ps.parts.length == 1, "child payment must contain only one part") // As soon as we get the preimage we can consider that the whole payment succeeded (we have a proof of payment). Metrics.PaymentAttempt.withTag(Tags.MultiPart, value = true).record(d.request.maxAttempts - d.remainingAttempts) gotoSucceededOrStop(PaymentSucceeded(d.request, ps.paymentPreimage, ps.parts, d.pending.keySet - ps.parts.head.id)) } when(PAYMENT_ABORTED) { case Event(pf: PaymentFailed, d: PaymentAborted) => val failures = d.failures ++ pf.failures val pending = d.pending - pf.id if (pending.isEmpty) { myStop(d.request, Left(PaymentFailed(id, paymentHash, failures))) } else { stay() using d.copy(failures = failures, pending = pending) } // The recipient released the preimage without receiving the full payment amount. // This is a spec violation and is too bad for them, we obtained a proof of payment without paying the full amount. case Event(ps: PaymentSent, d: PaymentAborted) => require(ps.parts.length == 1, "child payment must contain only one part") log.warning(s"payment recipient fulfilled incomplete multi-part payment (id=${ps.parts.head.id})") gotoSucceededOrStop(PaymentSucceeded(d.request, ps.paymentPreimage, ps.parts, d.pending - ps.parts.head.id)) case Event(_: RouteResponse, _) => stay() case Event(_: Status.Failure, _) => stay() } when(PAYMENT_SUCCEEDED) { case Event(ps: PaymentSent, d: PaymentSucceeded) => require(ps.parts.length == 1, "child payment must contain only one part") val parts = d.parts ++ ps.parts val pending = d.pending - ps.parts.head.id if (pending.isEmpty) { myStop(d.request, Right(cfg.createPaymentSent(d.preimage, parts))) } else { stay() using d.copy(parts = parts, pending = pending) } // The recipient released the preimage without receiving the full payment amount. // This is a spec violation and is too bad for them, we obtained a proof of payment without paying the full amount. case Event(pf: PaymentFailed, d: PaymentSucceeded) => log.warning(s"payment succeeded but partial payment failed (id=${pf.id})") val pending = d.pending - pf.id if (pending.isEmpty) { myStop(d.request, Right(cfg.createPaymentSent(d.preimage, d.parts))) } else { stay() using d.copy(pending = pending) } case Event(_: RouteResponse, _) => stay() case Event(_: Status.Failure, _) => stay() } private def spawnChildPaymentFsm(childId: UUID): ActorRef = { val upstream = cfg.upstream match { case Upstream.Local(_) => Upstream.Local(childId) case _ => cfg.upstream } val childCfg = cfg.copy(id = childId, publishEvent = false, recordPathFindingMetrics = false, upstream = upstream) paymentFactory.spawnOutgoingPayment(context, childCfg) } private def gotoAbortedOrStop(d: PaymentAborted): State = { if (d.pending.isEmpty) { myStop(d.request, Left(PaymentFailed(id, paymentHash, d.failures))) } else goto(PAYMENT_ABORTED) using d } private def gotoSucceededOrStop(d: PaymentSucceeded): State = { d.request.replyTo ! PreimageReceived(paymentHash, d.preimage) if (d.pending.isEmpty) { myStop(d.request, Right(cfg.createPaymentSent(d.preimage, d.parts))) } else goto(PAYMENT_SUCCEEDED) using d } def myStop(request: SendMultiPartPayment, event: Either[PaymentFailed, PaymentSent]): State = { event match { case Left(paymentFailed) => log.warning("multi-part payment failed") reply(request.replyTo, paymentFailed) case Right(paymentSent) => log.info("multi-part payment succeeded") reply(request.replyTo, paymentSent) } val status = event match { case Right(_: PaymentSent) => "SUCCESS" case Left(f: PaymentFailed) => if (f.failures.exists({ case r: RemoteFailure => r.e.originNode == cfg.recipientNodeId case _ => false })) { "RECIPIENT_FAILURE" } else { "FAILURE" } } val now = TimestampMilli.now() val duration = now - start if (cfg.recordPathFindingMetrics) { val fees = event match { case Left(paymentFailed) => log.info(s"failed payment attempts details: ${PaymentFailure.jsonSummary(cfg, request.routeParams.experimentName, paymentFailed)}") request.routeParams.getMaxFee(cfg.recipientAmount) case Right(paymentSent) => val localFees = cfg.upstream match { case _: Upstream.Local => 0.msat // no local fees when we are the origin of the payment case _: Upstream.Trampoline => // in case of a relayed payment, we need to take into account the fee of the first channels paymentSent.parts.collect { // NB: the route attribute will always be defined here case p@PartialPayment(_, _, _, _, Some(route), _) => route.head.fee(p.amountWithFees) }.sum } paymentSent.feesPaid + localFees } context.system.eventStream.publish(PathFindingExperimentMetrics(cfg.recipientAmount, fees, status, duration, now, isMultiPart = true, request.routeParams.experimentName, cfg.recipientNodeId)) } Metrics.SentPaymentDuration .withTag(Tags.MultiPart, Tags.MultiPartType.Parent) .withTag(Tags.Success, value = status == "SUCCESS") .record(duration.toMillis, TimeUnit.MILLISECONDS) if (retriedFailedChannels) { Metrics.RetryFailedChannelsResult.withTag(Tags.Success, event.isRight).increment() } stop(FSM.Normal) } def reply(to: ActorRef, e: PaymentEvent): Unit = { to ! e if (cfg.publishEvent) context.system.eventStream.publish(e) } override def mdc(currentMessage: Any): MDC = { Logs.mdc( category_opt = Some(Logs.LogCategory.PAYMENT), parentPaymentId_opt = Some(cfg.parentId), paymentId_opt = Some(id), paymentHash_opt = Some(paymentHash), remoteNodeId_opt = Some(cfg.recipientNodeId)) } initialize() } object MultiPartPaymentLifecycle { def props(nodeParams: NodeParams, cfg: SendPaymentConfig, router: ActorRef, paymentFactory: PaymentInitiator.PaymentFactory) = Props(new MultiPartPaymentLifecycle(nodeParams, cfg, router, paymentFactory)) /** * Send a payment to a given node. The payment may be split into multiple child payments, for which a path-finding * algorithm will run to find suitable payment routes. * * @param paymentSecret payment secret to protect against probing (usually from a Bolt 11 invoice). * @param targetNodeId target node (may be the final recipient when using source-routing, or the first trampoline * node when using trampoline). * @param totalAmount total amount to send to the target node. * @param targetExpiry expiry at the target node (CLTV for the target node's received HTLCs). * @param maxAttempts maximum number of retries. * @param paymentMetadata payment metadata (usually from the Bolt 11 invoice). * @param assistedRoutes routing hints (usually from a Bolt 11 invoice). * @param routeParams parameters to fine-tune the routing algorithm. * @param additionalTlvs when provided, additional tlvs that will be added to the onion sent to the target node. * @param userCustomTlvs when provided, additional user-defined custom tlvs that will be added to the onion sent to the target node. */ case class SendMultiPartPayment(replyTo: ActorRef, paymentSecret: ByteVector32, targetNodeId: PublicKey, totalAmount: MilliSatoshi, targetExpiry: CltvExpiry, maxAttempts: Int, paymentMetadata: Option[ByteVector], assistedRoutes: Seq[Seq[ExtraHop]] = Nil, routeParams: RouteParams, additionalTlvs: Seq[OnionPaymentPayloadTlv] = Nil, userCustomTlvs: Seq[GenericTlv] = Nil) { require(totalAmount > 0.msat, s"total amount must be > 0") } /** * The payment FSM will wait for all child payments to settle before emitting payment events, but the preimage will be * shared as soon as it's received to unblock other actors that may need it. */ case class PreimageReceived(paymentHash: ByteVector32, paymentPreimage: ByteVector32) // @formatter:off sealed trait State case object WAIT_FOR_PAYMENT_REQUEST extends State case object WAIT_FOR_ROUTES extends State case object PAYMENT_IN_PROGRESS extends State case object PAYMENT_ABORTED extends State case object PAYMENT_SUCCEEDED extends State // @formatter:on sealed trait Data /** * During initialization, we wait for a multi-part payment request containing the total amount to send and the maximum * fee budget. */ case object WaitingForRequest extends Data /** * While the payment is in progress, we listen to child payment failures. When we receive such failures, we retry the * failed amount with different routes. * * @param request payment request containing the total amount to send. * @param remainingAttempts remaining attempts (after child payments fail). * @param pending pending child payments (payment sent, we are waiting for a fulfill or a failure). * @param ignore channels and nodes that should be ignored (previously returned a permanent error). * @param failures previous child payment failures. */ case class PaymentProgress(request: SendMultiPartPayment, remainingAttempts: Int, pending: Map[UUID, Route], ignore: Ignore, failures: Seq[PaymentFailure]) extends Data /** * When we exhaust our retry attempts without success, we abort the payment. * Once we're in that state, we wait for all the pending child payments to settle. * * @param request payment request containing the total amount to send. * @param failures child payment failures. * @param pending pending child payments (we are waiting for them to be failed downstream). */ case class PaymentAborted(request: SendMultiPartPayment, failures: Seq[PaymentFailure], pending: Set[UUID]) extends Data /** * Once we receive a first fulfill for a child payment, we can consider that the whole payment succeeded (because we * received the payment preimage that we can use as a proof of payment). * Once we're in that state, we wait for all the pending child payments to fulfill. * * @param request payment request containing the total amount to send. * @param preimage payment preimage. * @param parts fulfilled child payments. * @param pending pending child payments (we are waiting for them to be fulfilled downstream). */ case class PaymentSucceeded(request: SendMultiPartPayment, preimage: ByteVector32, parts: Seq[PartialPayment], pending: Set[UUID]) extends Data private def createRouteRequest(nodeParams: NodeParams, toSend: MilliSatoshi, maxFee: MilliSatoshi, routeParams: RouteParams, d: PaymentProgress, cfg: SendPaymentConfig): RouteRequest = RouteRequest( nodeParams.nodeId, d.request.targetNodeId, toSend, maxFee, d.request.assistedRoutes, d.ignore, routeParams, allowMultiPart = true, d.pending.values.toSeq, Some(cfg.paymentContext)) private def createChildPayment(replyTo: ActorRef, route: Route, request: SendMultiPartPayment): SendPaymentToRoute = { val finalPayload = PaymentOnion.createMultiPartPayload(route.amount, request.totalAmount, request.targetExpiry, request.paymentSecret, request.paymentMetadata, request.additionalTlvs, request.userCustomTlvs) SendPaymentToRoute(replyTo, Right(route), finalPayload) } /** When we receive an error from the final recipient or payment gets settled on chain, we should fail the whole payment, it's useless to retry. */ private def abortPayment(pf: PaymentFailed, d: PaymentProgress): Boolean = pf.failures.exists { case f: RemoteFailure => f.e.originNode == d.request.targetNodeId case LocalFailure(_, _, _: HtlcOverriddenByLocalCommit) => true case LocalFailure(_, _, _: HtlcsWillTimeoutUpstream) => true case LocalFailure(_, _, _: HtlcsTimedoutDownstream) => true case _ => false } private def remainingToSend(request: SendMultiPartPayment, pending: Iterable[Route]): (MilliSatoshi, MilliSatoshi) = { val sentAmount = pending.map(_.amount).sum val sentFees = pending.map(_.fee).sum (request.totalAmount - sentAmount, request.routeParams.copy(randomize = false).getMaxFee(request.totalAmount) - sentFees) } }
ACINQ/eclair
eclair-core/src/main/scala/fr/acinq/eclair/payment/send/MultiPartPaymentLifecycle.scala
Scala
apache-2.0
22,288
package com.aergonaut.lifeaquatic.block.storage import com.aergonaut.lifeaquatic.block.BlockBase import com.aergonaut.lifeaquatic.constants.Names class PearlBlock extends BlockBase(Names.Blocks.Storage.Pearl)
aergonaut/LifeAquatic
src/main/scala/com/aergonaut/lifeaquatic/block/storage/PearlBlock.scala
Scala
mit
211
package com.eevolution.context.dictionary.domain.api.repository import com.eevolution.context.dictionary._ /** * Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * Email: [email protected], http://www.e-evolution.com , http://github.com/EmerisScala * Created by [email protected] , www.e-evolution.com on 01/11/17. */ trait OrganizationInfoRepository [OrganizationInfo , Int] extends api.Repostory [OrganizationInfo , Int] { }
adempiere/ADReactiveSystem
dictionary-api/src/main/scala/com/eevolution/context/dictionary/domain/api/repository/OrganizationInfoRepository.scala
Scala
gpl-3.0
1,151
/* * Copyright (C) 2016 Vincibean <Andre Bessi> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.vincibean.scala.impatient.chapter6.exercise3 import java.awt.Point /** * Define an Origin object that extends java.awt.Point. Why is this not actually a * good idea? (Have a close look at the methods of the Point class.) * * Created by Vincibean on 20/01/16. */ object Origin extends Point
Vincibean/ScalaForTheImpatient-Solutions
src/main/scala/org/vincibean/scala/impatient/chapter6/exercise3/Origin.scala
Scala
gpl-3.0
1,028
package pl.edu.icm.ceon.scala_commons.math import org.apache.commons.math.distribution.TDistributionImpl import org.apache.commons.math.stat.descriptive.SummaryStatistics import Math.sqrt /** * @author Michal Oniszczuk ([email protected]) * Created: 29.08.2013 11:36 */ package object confidenceInterval { type Interval = (Double, Double) def getConfidenceInterval(stats: SummaryStatistics, confidenceLevel: Double): Interval = { val avg = stats.getMean val error = getConfidenceIntervalError(stats, confidenceLevel) (avg - error, avg + error) } def getConfidenceIntervalError(stats: SummaryStatistics, confidenceLevel: Double): Double = { val sd = stats.getStandardDeviation val n = stats.getN val alpha = 1 - confidenceLevel val tDist = new TDistributionImpl(stats.getN - 1) val qt = tDist.inverseCumulativeProbability(1 - alpha / 2) qt * sd / sqrt(n) } }
pdendek/CoAnSys
ceon-scala-commons-lite/src/main/scala/pl/edu/icm/ceon/scala_commons/math/confidenceInterval/package.scala
Scala
agpl-3.0
927
package org.nkvoll.javabin.routing.directives import spray.http.HttpHeaders.Accept import spray.http._ import spray.routing._ trait JsonDirectives extends Directives { def preferJsonResponsesForBrowsers: Directive0 = { (isBrowser & preferJsonResponses) | pass } def preferJsonResponses: Directive0 = { mapRequest { request => request.mapHeaders { headers => headers.map { case accept @ Accept(ranges) => ranges.find(_.matches(MediaTypes.`application/json`)) match { case None => accept case Some(range) => Accept(MediaTypes.`application/json`, ranges: _*) } case h => h } } } } def isBrowser: Directive0 = { optionalHeaderValueByType[HttpHeaders.`User-Agent`]() flatMap { case Some(HttpHeaders.`User-Agent`(pvs)) if pvs.exists(_.product.contains("Mozilla")) => pass case _ => reject } } }
nkvoll/javabin-rest-on-akka
src/main/scala/org/nkvoll/javabin/routing/directives/JsonDirectives.scala
Scala
mit
960
// Copyright (c) 2013-2020 Rob Norris and Contributors // This software is licensed under the MIT License (MIT). // For more information see LICENSE or https://opensource.org/licenses/MIT package doobie.postgres.syntax import cats._ import cats.syntax.all._ import doobie.implicits._ import doobie.postgres.sqlstate._ import doobie._ import doobie.util.catchsql.exceptSomeSqlState import doobie.util.query.{Query, Query0} import doobie.hi.{HPS, HRS, HC} import doobie.free.ConnectionIO class PostgresMonadErrorOps[M[_], A](ma: M[A])( implicit ev: MonadError[M, Throwable] ) { def onSuccessfulCompletion(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class00.SUCCESSFUL_COMPLETION => handler } def onWarning(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.WARNING => handler } def onDynamicResultSetsReturned(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.DYNAMIC_RESULT_SETS_RETURNED => handler } def onImplicitZeroBitPadding(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.IMPLICIT_ZERO_BIT_PADDING => handler } def onNullValueEliminatedInSetFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.NULL_VALUE_ELIMINATED_IN_SET_FUNCTION => handler } def onPrivilegeNotGranted(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.PRIVILEGE_NOT_GRANTED => handler } def onPrivilegeNotRevoked(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.PRIVILEGE_NOT_REVOKED => handler } def onStringDataRightTruncationClass01(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.STRING_DATA_RIGHT_TRUNCATION => handler } def onDeprecatedFeature(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class01.DEPRECATED_FEATURE => handler } def onNoData(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class02.NO_DATA => handler } def onNoAdditionalDynamicResultSetsReturned(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class02.NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED => handler } def onSqlStatementNotYetComplete(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class03.SQL_STATEMENT_NOT_YET_COMPLETE => handler } def onConnectionException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.CONNECTION_EXCEPTION => handler } def onConnectionDoesNotExist(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.CONNECTION_DOES_NOT_EXIST => handler } def onConnectionFailure(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.CONNECTION_FAILURE => handler } def onSqlclientUnableToEstablishSqlconnection(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION => handler } def onSqlserverRejectedEstablishmentOfSqlconnection(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION => handler } def onTransactionResolutionUnknown(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.TRANSACTION_RESOLUTION_UNKNOWN => handler } def onProtocolViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class08.PROTOCOL_VIOLATION => handler } def onTriggeredActionException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class09.TRIGGERED_ACTION_EXCEPTION => handler } def onFeatureNotSupported(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0A.FEATURE_NOT_SUPPORTED => handler } def onInvalidTransactionInitiation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0B.INVALID_TRANSACTION_INITIATION => handler } def onLocatorException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0F.LOCATOR_EXCEPTION => handler } def onInvalidLocatorSpecification(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0F.INVALID_LOCATOR_SPECIFICATION => handler } def onInvalidGrantor(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0L.INVALID_GRANTOR => handler } def onInvalidGrantOperation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0L.INVALID_GRANT_OPERATION => handler } def onInvalidRoleSpecification(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class0P.INVALID_ROLE_SPECIFICATION => handler } def onCaseNotFound(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class20.CASE_NOT_FOUND => handler } def onCardinalityViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class21.CARDINALITY_VIOLATION => handler } def onDataException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.DATA_EXCEPTION => handler } def onArraySubscriptError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.ARRAY_SUBSCRIPT_ERROR => handler } def onCharacterNotInRepertoire(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.CHARACTER_NOT_IN_REPERTOIRE => handler } def onDatetimeFieldOverflow(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.DATETIME_FIELD_OVERFLOW => handler } def onDivisionByZero(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.DIVISION_BY_ZERO => handler } def onErrorInAssignment(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.ERROR_IN_ASSIGNMENT => handler } def onEscapeCharacterConflict(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.ESCAPE_CHARACTER_CONFLICT => handler } def onIndicatorOverflow(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INDICATOR_OVERFLOW => handler } def onIntervalFieldOverflow(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INTERVAL_FIELD_OVERFLOW => handler } def onInvalidArgumentForLogarithm(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ARGUMENT_FOR_LOGARITHM => handler } def onInvalidArgumentForNtileFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ARGUMENT_FOR_NTILE_FUNCTION => handler } def onInvalidArgumentForNthValueFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION => handler } def onInvalidArgumentForPowerFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ARGUMENT_FOR_POWER_FUNCTION => handler } def onInvalidArgumentForWidthBucketFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION => handler } def onInvalidCharacterValueForCast(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_CHARACTER_VALUE_FOR_CAST => handler } def onInvalidDatetimeFormat(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_DATETIME_FORMAT => handler } def onInvalidEscapeCharacter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ESCAPE_CHARACTER => handler } def onInvalidEscapeOctet(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ESCAPE_OCTET => handler } def onInvalidEscapeSequence(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ESCAPE_SEQUENCE => handler } def onNonstandardUseOfEscapeCharacter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.NONSTANDARD_USE_OF_ESCAPE_CHARACTER => handler } def onInvalidIndicatorParameterValue(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_INDICATOR_PARAMETER_VALUE => handler } def onInvalidParameterValue(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_PARAMETER_VALUE => handler } def onInvalidRegularExpression(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_REGULAR_EXPRESSION => handler } def onInvalidRowCountInLimitClause(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ROW_COUNT_IN_LIMIT_CLAUSE => handler } def onInvalidRowCountInResultOffsetClause(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE => handler } def onInvalidTimeZoneDisplacementValue(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_TIME_ZONE_DISPLACEMENT_VALUE => handler } def onInvalidUseOfEscapeCharacter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_USE_OF_ESCAPE_CHARACTER => handler } def onMostSpecificTypeMismatch(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.MOST_SPECIFIC_TYPE_MISMATCH => handler } def onNullValueNotAllowedClass22(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.NULL_VALUE_NOT_ALLOWED => handler } def onNullValueNoIndicatorParameter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.NULL_VALUE_NO_INDICATOR_PARAMETER => handler } def onNumericValueOutOfRange(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.NUMERIC_VALUE_OUT_OF_RANGE => handler } def onStringDataLengthMismatch(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.STRING_DATA_LENGTH_MISMATCH => handler } def onStringDataRightTruncationClass22(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.STRING_DATA_RIGHT_TRUNCATION => handler } def onSubstringError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.SUBSTRING_ERROR => handler } def onTrimError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.TRIM_ERROR => handler } def onUnterminatedCString(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.UNTERMINATED_C_STRING => handler } def onZeroLengthCharacterString(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.ZERO_LENGTH_CHARACTER_STRING => handler } def onFloatingPointException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.FLOATING_POINT_EXCEPTION => handler } def onInvalidTextRepresentation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_TEXT_REPRESENTATION => handler } def onInvalidBinaryRepresentation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_BINARY_REPRESENTATION => handler } def onBadCopyFileFormat(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.BAD_COPY_FILE_FORMAT => handler } def onUntranslatableCharacter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.UNTRANSLATABLE_CHARACTER => handler } def onNotAnXmlDocument(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.NOT_AN_XML_DOCUMENT => handler } def onInvalidXmlDocument(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_XML_DOCUMENT => handler } def onInvalidXmlContent(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_XML_CONTENT => handler } def onInvalidXmlComment(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_XML_COMMENT => handler } def onInvalidXmlProcessingInstruction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class22.INVALID_XML_PROCESSING_INSTRUCTION => handler } def onIntegrityConstraintViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.INTEGRITY_CONSTRAINT_VIOLATION => handler } def onRestrictViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.RESTRICT_VIOLATION => handler } def onNotNullViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.NOT_NULL_VIOLATION => handler } def onForeignKeyViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.FOREIGN_KEY_VIOLATION => handler } def onUniqueViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.UNIQUE_VIOLATION => handler } def onCheckViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.CHECK_VIOLATION => handler } def onExclusionViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class23.EXCLUSION_VIOLATION => handler } def onInvalidCursorState(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class24.INVALID_CURSOR_STATE => handler } def onInvalidTransactionState(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.INVALID_TRANSACTION_STATE => handler } def onActiveSqlTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.ACTIVE_SQL_TRANSACTION => handler } def onBranchTransactionAlreadyActive(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.BRANCH_TRANSACTION_ALREADY_ACTIVE => handler } def onHeldCursorRequiresSameIsolationLevel(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL => handler } def onInappropriateAccessModeForBranchTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION => handler } def onInappropriateIsolationLevelForBranchTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION => handler } def onNoActiveSqlTransactionForBranchTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION => handler } def onReadOnlySqlTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.READ_ONLY_SQL_TRANSACTION => handler } def onSchemaAndDataStatementMixingNotSupported(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED => handler } def onNoActiveSqlTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.NO_ACTIVE_SQL_TRANSACTION => handler } def onInFailedSqlTransaction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class25.IN_FAILED_SQL_TRANSACTION => handler } def onInvalidSqlStatementName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class26.INVALID_SQL_STATEMENT_NAME => handler } def onTriggeredDataChangeViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class27.TRIGGERED_DATA_CHANGE_VIOLATION => handler } def onInvalidAuthorizationSpecification(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class28.INVALID_AUTHORIZATION_SPECIFICATION => handler } def onInvalidPassword(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class28.INVALID_PASSWORD => handler } def onDependentPrivilegeDescriptorsStillExist(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2B.DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST => handler } def onDependentObjectsStillExist(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2B.DEPENDENT_OBJECTS_STILL_EXIST => handler } def onInvalidTransactionTermination(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2D.INVALID_TRANSACTION_TERMINATION => handler } def onSqlRoutineException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2F.SQL_ROUTINE_EXCEPTION => handler } def onFunctionExecutedNoReturnStatement(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2F.FUNCTION_EXECUTED_NO_RETURN_STATEMENT => handler } def onModifyingSqlDataNotPermittedClass2F(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2F.MODIFYING_SQL_DATA_NOT_PERMITTED => handler } def onProhibitedSqlStatementAttemptedClass2F(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2F.PROHIBITED_SQL_STATEMENT_ATTEMPTED => handler } def onReadingSqlDataNotPermittedClass2F(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class2F.READING_SQL_DATA_NOT_PERMITTED => handler } def onInvalidCursorName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class34.INVALID_CURSOR_NAME => handler } def onExternalRoutineException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class38.EXTERNAL_ROUTINE_EXCEPTION => handler } def onContainingSqlNotPermitted(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class38.CONTAINING_SQL_NOT_PERMITTED => handler } def onModifyingSqlDataNotPermittedClass38(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class38.MODIFYING_SQL_DATA_NOT_PERMITTED => handler } def onProhibitedSqlStatementAttemptedClass38(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class38.PROHIBITED_SQL_STATEMENT_ATTEMPTED => handler } def onReadingSqlDataNotPermittedClass38(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class38.READING_SQL_DATA_NOT_PERMITTED => handler } def onExternalRoutineInvocationException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class39.EXTERNAL_ROUTINE_INVOCATION_EXCEPTION => handler } def onInvalidSqlstateReturned(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class39.INVALID_SQLSTATE_RETURNED => handler } def onNullValueNotAllowedClass39(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class39.NULL_VALUE_NOT_ALLOWED => handler } def onTriggerProtocolViolated(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class39.TRIGGER_PROTOCOL_VIOLATED => handler } def onSrfProtocolViolated(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class39.SRF_PROTOCOL_VIOLATED => handler } def onSavepointException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class3B.SAVEPOINT_EXCEPTION => handler } def onInvalidSavepointSpecification(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class3B.INVALID_SAVEPOINT_SPECIFICATION => handler } def onInvalidCatalogName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class3D.INVALID_CATALOG_NAME => handler } def onInvalidSchemaName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class3F.INVALID_SCHEMA_NAME => handler } def onTransactionRollback(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class40.TRANSACTION_ROLLBACK => handler } def onTransactionIntegrityConstraintViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class40.TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION => handler } def onSerializationFailure(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class40.SERIALIZATION_FAILURE => handler } def onStatementCompletionUnknown(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class40.STATEMENT_COMPLETION_UNKNOWN => handler } def onDeadlockDetected(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class40.DEADLOCK_DETECTED => handler } def onSyntaxErrorOrAccessRuleViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION => handler } def onSyntaxError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.SYNTAX_ERROR => handler } def onInsufficientPrivilege(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INSUFFICIENT_PRIVILEGE => handler } def onCannotCoerce(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.CANNOT_COERCE => handler } def onGroupingError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.GROUPING_ERROR => handler } def onWindowingError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.WINDOWING_ERROR => handler } def onInvalidRecursion(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_RECURSION => handler } def onInvalidForeignKey(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_FOREIGN_KEY => handler } def onInvalidName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_NAME => handler } def onNameTooLong(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.NAME_TOO_LONG => handler } def onReservedName(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.RESERVED_NAME => handler } def onDatatypeMismatch(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DATATYPE_MISMATCH => handler } def onIndeterminateDatatype(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INDETERMINATE_DATATYPE => handler } def onWrongObjectType(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.WRONG_OBJECT_TYPE => handler } def onUndefinedColumn(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.UNDEFINED_COLUMN => handler } def onUndefinedFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.UNDEFINED_FUNCTION => handler } def onUndefinedTable(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.UNDEFINED_TABLE => handler } def onUndefinedParameter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.UNDEFINED_PARAMETER => handler } def onUndefinedObject(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.UNDEFINED_OBJECT => handler } def onDuplicateColumn(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_COLUMN => handler } def onDuplicateCursor(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_CURSOR => handler } def onDuplicateDatabase(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_DATABASE => handler } def onDuplicateFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_FUNCTION => handler } def onDuplicatePreparedStatement(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_PREPARED_STATEMENT => handler } def onDuplicateSchema(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_SCHEMA => handler } def onDuplicateTable(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_TABLE => handler } def onDuplicateAlias(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_ALIAS => handler } def onDuplicateObject(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.DUPLICATE_OBJECT => handler } def onAmbiguousColumn(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.AMBIGUOUS_COLUMN => handler } def onAmbiguousFunction(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.AMBIGUOUS_FUNCTION => handler } def onAmbiguousParameter(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.AMBIGUOUS_PARAMETER => handler } def onAmbiguousAlias(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.AMBIGUOUS_ALIAS => handler } def onInvalidColumnReference(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_COLUMN_REFERENCE => handler } def onInvalidColumnDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_COLUMN_DEFINITION => handler } def onInvalidCursorDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_CURSOR_DEFINITION => handler } def onInvalidDatabaseDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_DATABASE_DEFINITION => handler } def onInvalidFunctionDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_FUNCTION_DEFINITION => handler } def onInvalidPreparedStatementDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_PREPARED_STATEMENT_DEFINITION => handler } def onInvalidSchemaDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_SCHEMA_DEFINITION => handler } def onInvalidTableDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_TABLE_DEFINITION => handler } def onInvalidObjectDefinition(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class42.INVALID_OBJECT_DEFINITION => handler } def onWithCheckOptionViolation(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class44.WITH_CHECK_OPTION_VIOLATION => handler } def onInsufficientResources(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class53.INSUFFICIENT_RESOURCES => handler } def onDiskFull(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class53.DISK_FULL => handler } def onOutOfMemory(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class53.OUT_OF_MEMORY => handler } def onTooManyConnections(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class53.TOO_MANY_CONNECTIONS => handler } def onProgramLimitExceeded(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class54.PROGRAM_LIMIT_EXCEEDED => handler } def onStatementTooComplex(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class54.STATEMENT_TOO_COMPLEX => handler } def onTooManyColumns(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class54.TOO_MANY_COLUMNS => handler } def onTooManyArguments(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class54.TOO_MANY_ARGUMENTS => handler } def onObjectNotInPrerequisiteState(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class55.OBJECT_NOT_IN_PREREQUISITE_STATE => handler } def onObjectInUse(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class55.OBJECT_IN_USE => handler } def onCantChangeRuntimeParam(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class55.CANT_CHANGE_RUNTIME_PARAM => handler } def onLockNotAvailable(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class55.LOCK_NOT_AVAILABLE => handler } def onOperatorIntervention(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.OPERATOR_INTERVENTION => handler } def onQueryCanceled(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.QUERY_CANCELED => handler } def onAdminShutdown(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.ADMIN_SHUTDOWN => handler } def onCrashShutdown(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.CRASH_SHUTDOWN => handler } def onCannotConnectNow(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.CANNOT_CONNECT_NOW => handler } def onDatabaseDropped(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class57.DATABASE_DROPPED => handler } def onIoError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class58.IO_ERROR => handler } def onUndefinedFile(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class58.UNDEFINED_FILE => handler } def onDuplicateFile(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case class58.DUPLICATE_FILE => handler } def onConfigFileError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classF0.CONFIG_FILE_ERROR => handler } def onLockFileExists(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classF0.LOCK_FILE_EXISTS => handler } def onPlpgsqlError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classP0.PLPGSQL_ERROR => handler } def onRaiseException(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classP0.RAISE_EXCEPTION => handler } def onNoDataFound(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classP0.NO_DATA_FOUND => handler } def onTooManyRows(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classP0.TOO_MANY_ROWS => handler } def onInternalError(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classXX.INTERNAL_ERROR => handler } def onDataCorrupted(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classXX.DATA_CORRUPTED => handler } def onIndexCorrupted(handler: => M[A]): M[A] = exceptSomeSqlState(ma) { case classXX.INDEX_CORRUPTED => handler } } trait ToPostgresMonadErrorOps { implicit def toPostgresMonadErrorOps[M[_], A](ma: M[A])( implicit ev: MonadError[M, Throwable] ): PostgresMonadErrorOps[M, A] = new PostgresMonadErrorOps(ma) } trait ToPostgresExplainOps { implicit def toPostgresExplainQuery0Ops(q: Query0[_]): PostgresExplainQuery0Ops = new PostgresExplainQuery0Ops(q) implicit def toPostgresExplainQueryOps[A](q: Query[A, _]): PostgresExplainQueryOps[A] = new PostgresExplainQueryOps(q) implicit def toPostgresExplainUpdate0Ops(u: Update0): PostgresExplainUpdate0Ops = new PostgresExplainUpdate0Ops(u) implicit def toPostgresExplainUpdateOps[A](u: Update[A]): PostgresExplainUpdateOps[A] = new PostgresExplainUpdateOps(u) } class PostgresExplainQuery0Ops(self: Query0[_]) { /** * Construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query (i.e., `EXPLAIN` output). The query is not actually executed. */ def explain: ConnectionIO[List[String]] = self.inspect { (sql, prepare) => HC.prepareStatement(s"EXPLAIN $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } /** * Construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query, with a comparison to the actual execution (i.e., `EXPLAIN ANALYZE` output). The * query will be executed, but no results are returned. */ def explainAnalyze: ConnectionIO[List[String]] = self.inspect { (sql, prepare) => HC.prepareStatement(s"EXPLAIN ANALYZE $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } class PostgresExplainQueryOps[A](self: Query[A, _]) { /** * Apply the argument `a` to construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query (i.e., `EXPLAIN` output). The query is not actually executed. */ def explain(a: A): ConnectionIO[List[String]] = { self.inspect(a){ (sql, prepare) => HC.prepareStatement(s"EXPLAIN $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } /** * Apply the argument `a` to construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query, with a comparison to the actual execution (i.e., `EXPLAIN ANALYZE` output). The * query will be executed, but no results are returned. */ def explainAnalyze(a: A): ConnectionIO[List[String]] = self.inspect(a) { (sql, prepare) => HC.prepareStatement(s"EXPLAIN ANALYZE $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } class PostgresExplainUpdate0Ops(self: Update0) { /** * Construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query (i.e., `EXPLAIN` output). The query is not actually executed. */ def explain: ConnectionIO[List[String]] = self.inspect { (sql, prepare) => HC.prepareStatement(s"EXPLAIN $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } /** * Construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query, with a comparison to the actual execution (i.e., `EXPLAIN ANALYZE` output). The * query will be executed, but no results are returned. */ def explainAnalyze: ConnectionIO[List[String]] = self.inspect { (sql, prepare) => HC.prepareStatement(s"EXPLAIN ANALYZE $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } class PostgresExplainUpdateOps[A](self: Update[A]) { /** * Apply the argument `a` to construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query (i.e., `EXPLAIN` output). The query is not actually executed. */ def explain(a: A): ConnectionIO[List[String]] = { self.inspect(a){ (sql, prepare) => HC.prepareStatement(s"EXPLAIN $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } /** * Apply the argument `a` to construct a program in * `[[doobie.free.connection.ConnectionIO ConnectionIO]]` which returns the server's query plan * for the query, with a comparison to the actual execution (i.e., `EXPLAIN ANALYZE` output). The * query will be executed, but no results are returned. */ def explainAnalyze(a: A): ConnectionIO[List[String]] = self.inspect(a) { (sql, prepare) => HC.prepareStatement(s"EXPLAIN ANALYZE $sql")(prepare *> HPS.executeQuery(HRS.build[List, String])) } } object monaderror extends ToPostgresMonadErrorOps
tpolecat/doobie
modules/postgres/src/main/scala/doobie/postgres/syntax/syntax.scala
Scala
mit
32,624
package org.rebeam.boxes.core import org.rebeam.boxes.core._ import scalaz._ import Scalaz._ import BoxTypes._ import scala.annotation.tailrec import scala.collection.immutable.Set import BoxDelta._ import scala.language.implicitConversions import scalaz._ import Scalaz._ object BoxScriptImports { //These methods on box only make sense when we are using a BoxScript implicit class BoxInScript[A](b: Box[A]) { def attachReaction(reaction: Reaction) = BoxDeltaF.attachReactionToBox(reaction, b) def detachReaction(reaction: Reaction) = BoxDeltaF.detachReactionFromBox(reaction, b) def applyReaction(rScript: BoxScript[A]) = for { r <- BoxScriptImports.createReaction(for { t <- rScript _ <- set(b, t) } yield ()) _ <- b.attachReaction(r) } yield r def modify(f: A => A) = BoxScriptImports.modify(b, f) final def widen[B >: A]: BoxScript[B] = b.r.map((a: A) => a: B) final def partial[B](pf: PartialFunction[A, B]): BoxScript[Option[B]] = optional(pf.lift) final def optional[B](f: A => Option[B]): BoxScript[Option[B]] = b.r.map(f) final def partialOrDefault[B](pf: PartialFunction[A, B])(d: B): BoxScript[B] = optionalOrDefault(pf.lift)(d) final def optionalOrDefault[B](f: A => Option[B])(d: B): BoxScript[B] = for { o <- b().map(f) } yield o.getOrElse(d) } implicit class BoxOptionInScript[A](b: Box[Option[A]]) { def default[B](d: A): BoxScript[A] = for { oa <- b() } yield oa.getOrElse(d) final def partialOrDefault[B](pf: PartialFunction[A, B])(d: B): BoxScript[B] = optionalOrDefault(pf.lift)(d) final def optionalOrDefault[B](f: A => Option[B])(d: B): BoxScript[B] = for { o <- b().map(_.flatMap(f)) } yield o.getOrElse(d) } //Smart constructors for BoxScript def create[T](t: T): BoxScript[Box[T]] = BoxDeltaF.create(t) def set[T](box: Box[T], t: T): BoxScript[Unit] = BoxDeltaF.set(box, t) def get[T](box: Box[T]): BoxScript[T] = BoxDeltaF.get(box) def observe(observer: Observer): BoxScript[Unit] = BoxDeltaF.observe(observer) def unobserve(observer: Observer): BoxScript[Unit] = BoxDeltaF.unobserve(observer) def createReaction(action: BoxScript[Unit]): BoxScript[Reaction] = BoxDeltaF.createReaction(action) def attachReactionToBox(r: Reaction, b: Box[_]): BoxScript[Unit] = BoxDeltaF.attachReactionToBox(r, b) def detachReactionFromBox(r: Reaction, b: Box[_]): BoxScript[Unit] = BoxDeltaF.detachReactionFromBox(r, b) val changedSources: BoxScript[Set[Box[_]]] = BoxDeltaF.changedSources def just[T](t: T): BoxScript[T] = BoxDeltaF.just(t) val nothing: BoxScript[Unit] = BoxDeltaF.nothing val revisionIndex: BoxScript[Long] = BoxDeltaF.revisionIndex def modify[T](b: BoxM[T], f: T => T) = for { o <- b.read _ <- b.write(f(o)) } yield o def modifyBox[T](b: BoxM[T], f: T => T) = modify(b, f) implicit class BoxScriptPlus[A](s: BoxScript[A]) { final def andThen[B](f: => BoxScript[B]): BoxScript[B] = s flatMap (_ => f) final def widen[B >: A]: BoxScript[B] = s.map((a: A) => a: B) final def partial[B](pf: PartialFunction[A, B]): BoxScript[Option[B]] = optional(pf.lift) final def optional[B](f: A => Option[B]): BoxScript[Option[B]] = s.map(f) final def partialOrDefault[B](pf: PartialFunction[A, B])(d: B): BoxScript[B] = optionalOrDefault(pf.lift)(d) final def optionalOrDefault[B](f: A => Option[B])(d: B): BoxScript[B] = for { o <- s.map(f) } yield o.getOrElse(d) } implicit class BoxScriptOptionPlus[A](s: BoxScript[Option[A]]) { def map2[B](f: A => B): BoxScript[Option[B]] = s.map(_.map(f)) def default[B](d: A): BoxScript[A] = for { oa <- s } yield oa.getOrElse(d) final def partialOrDefault[B](pf: PartialFunction[A, B])(d: B): BoxScript[B] = optionalOrDefault(pf.lift)(d) final def optionalOrDefault[B](f: A => Option[B])(d: B): BoxScript[B] = for { o <- s.map(_.flatMap(f)) } yield o.getOrElse(d) } //Simplest path - we have a BoxScript that finds us a BoxM[T], and we will read and write using it. def path[T](p: BoxScript[BoxM[T]]): BoxM[T] = BoxM( p.flatMap(_.read), //Get our BoxM, then use its read a => p.flatMap(_.write(a)) //Get our BoxM, then use its write ) //Accepting a box directly def pathB[T](p: BoxScript[Box[T]]): BoxM[T] = path(p.map(_.m)) //More complex - we have a BoxScript that may not always point to a BoxM[T]. To represent this we produce a BoxM[Option[T]]. //When the BoxScript points to None, we will read as None and ignore writes. //When the BoxScript points to Some, we will use it for reads and writes. def pathViaOption[T](p: BoxScript[Option[BoxM[T]]]): BoxM[Option[T]] = BoxM( for { obm <- p //Get Option[BoxM[T]] from path script ot <- obm.traverseU(_.read) //traverse uses BoxM[T] => X[T] to get us from an Option[BoxM[T]] to an X[Option[T]]. //We have read, which is BoxM[T] => BoxScript[T], so we can get from Option[BoxM[T]] to BoxScript[Option[T]] } yield ot, //And finally yield this to get a BoxScript a => a match { case None => nothing //Cannot set source BoxM to None, so do nothing case Some(a) => p.flatMap{ obm => obm match { case Some(bm) => bm.write(a) //If we currently have a BoxM to use, write to it case None => nothing //If we have no BoxM, do nothing } } } ) //Accepting a box directly def pathViaOptionB[T](p: BoxScript[Option[Box[T]]]): BoxM[Option[T]] = pathViaOption(p.map(_.map(_.m))) //Most complex case - when the script may not produce a BoxM, and that BoxM itself contains an optional type, //we follow the same approach as for pathViaOption, but we additionally flatten //the Option[Option] def pathToOption[T](p: BoxScript[Option[BoxM[Option[T]]]]): BoxM[Option[T]] = BoxM( for { obm <- p ot <- obm.traverseU(_.read).map(_.flatten) //Note we flatten the Option[Option[T]] to Option[T] } yield ot, a => p.flatMap { obm => obm match { case None => nothing case Some(bm) => bm.write(a) } } ) //Accepting a box directly def pathToOptionB[T](p: BoxScript[Option[Box[Option[T]]]]): BoxM[Option[T]] = pathToOption(p.map(_.map(_.m))) //Cache a BoxScript result in a new Box def cache[T](f: BoxScript[T]): BoxScript[Box[T]] = for { v <- f b <- create(v) r <- createReaction{ for { v <- f _ <- b() = v } yield () } _ <- b.attachReaction(r) } yield b // implicit class omapOnBoxScriptOption[A, B](s: BoxScript[Option[A]]) { // def omap(field: A => Box[B]): BoxScript[Option[Box[B]]] = s.map(_.map(field)) // } implicit def BoxToBoxR[A](box: Box[A]): BoxR[A] = box.r implicit def BoxToBoxW[A](box: Box[A]): BoxW[A] = box.w implicit def BoxToBoxM[A](box: Box[A]): BoxM[A] = box.m }
trepidacious/boxes-core
src/main/scala/org/rebeam/boxes/core/BoxScriptImports.scala
Scala
gpl-2.0
7,174
package base import org.scalatest.time.{Seconds, Span} import scala.concurrent.Future trait AsyncSpec { self: TestBaseDefinition => final def async[R](future: Future[R]): (R => Unit) => Unit = whenReady(future, timeout(Span(5, Seconds))) }
THK-ADV/lwm-reloaded
test/base/AsyncSpec.scala
Scala
mit
247
package bulu.actor.query import akka.actor.ActorLogging import akka.actor.Actor import bulu.util.HitCell import akka.actor.ActorRef import bulu.core.MeasureType import bulu.core.BitKey import bulu.util.Query import bulu.util.CacheFinished import bulu.util.QueryPartFinished import scala.collection.mutable.ArrayBuffer import bulu.util.CacheBegan import bulu.util.BaseCell import bulu.util.CachePartFinished import bulu.util.QueryReply import akka.actor.Props import akka.routing.RoundRobinRouter import bulu.util.ConfigHelper import bulu.util.CacheCell import bulu.util.CacheCellFinished import bulu.util.CacheFilterBegin class DispatchCache(cube: String, workerIndex: Int, dispatcherIndex: Int) extends Actor with ActorLogging { var aggs:(List[BitKey], Map[(String, MeasureType.MeasureType), ArrayBuffer[BigDecimal]])=null val keyList = ArrayBuffer.empty[BitKey] val valueList = scala.collection.mutable.Map.empty[(String, MeasureType.MeasureType), ArrayBuffer[BigDecimal]] def hasAgg = !keyList.isEmpty def receive: Receive = { case CacheBegan => keyList.clear valueList.clear //queryResult+=query->scala.collection.mutable.Map.empty[BitKey, Map[(String, MeasureType.MeasureType), BigDecimal]] case BaseCell(key, cell) => // log.debug("get a hit cell %s of partition (%s) of query (%s)".format(key, partition, query)) keyList += key if (valueList.isEmpty) { for ((id, value) <- cell) { val values = ArrayBuffer.empty[BigDecimal] values += value valueList += id -> values } } else { for ((id, value) <- cell) { valueList(id) += value } } //queryResult(query) += key -> aggs(key) case CacheFinished(reply) => log.info("cache is finished at cube (%s) workerIndex (%s) dispatcherIndex %s with agg (%s)". format(cube, workerIndex, dispatcherIndex, keyList.size)) aggs=(keyList.toList,valueList.toMap) reply ! CachePartFinished(cube, keyList.size, workerIndex, dispatcherIndex) case queryReply: QueryReply => log.info("began query %s at cube (%s) workerIndex (%s) dispatcherIndex %s with agg (%s)". format(queryReply.query, cube, workerIndex, dispatcherIndex, keyList.size)) if (keyList.size == 0) { queryReply.reply ! QueryPartFinished(queryReply.query, workerIndex,dispatcherIndex, Map.empty[BitKey, Map[(String, MeasureType.MeasureType), BigDecimal]]) } else { // val cacheFilter = context.actorOf( Props( new ParallelCache(cube, workerIndex, dispatcherIndex, aggs) ) ) //, name = "cellAggregator") // cacheFilter ! CacheFilterBegin( queryReply) val cellAggregator = context.actorOf(Props(new CellAggregator(queryReply.query, workerIndex, dispatcherIndex, queryReply.reply, keyList.size))) //, name = "cellAggregator") val cellFilter = context.actorOf(Props(new CellFilter(cube, cellAggregator, queryReply.cuboidMask, queryReply.filterAndMatch)). withRouter(RoundRobinRouter(nrOfInstances = 8))) //, name = "cellFilter") val fields = ConfigHelper.getMeasureFields(queryReply.query.name) for (i <- 0 until keyList.size) { val key = keyList(i) val values = for ((id, value) <- valueList if fields.contains(id._1)) yield (id, value(i)) cellFilter ! CacheCell(key, values.toMap) } } } }
hwzhao/bulu
src/main/scala/bulu/actor/query/DispatchCache.scala
Scala
apache-2.0
3,322
package scalariform.formatter import scalariform.parser._ import scalariform.formatter._ import scalariform.formatter.preferences._ // format: OFF class IndentWithTabsTest extends AbstractFormatterTest { implicit val formattingPreferences = FormattingPreferences.setPreference(IndentWithTabs, true) """class A { | |def meth() { | |println("42") // wibble |println("wobble") | |} | |}""" ==> """class A { | | def meth() { | | println("42") // wibble | println("wobble") | | } | |}""" """val n = 42 + |3""" ==> """val n = 42 + | 3""" """val xml = <foo> |bar |</foo>""" ==> """val xml = <foo> | bar |</foo>""" """foo( |alpha = "foo", |beta = "bar", |gamma = false)""" ==> """foo( | alpha = "foo", | beta = "bar", | gamma = false |)""" """foo( |"foo", |"bar", |false)""" ==> """foo( | "foo", | "bar", | false |)""" { implicit val formattingPreferences = FormattingPreferences .setPreference(IndentWithTabs, true) .setPreference(DanglingCloseParenthesis, Force) """foo( |alpha = "foo", |beta = "bar", |gamma = false)""" ==> """foo( | alpha = "foo", | beta = "bar", | gamma = false |)""" """foo( |"foo", |"bar", |false)""" ==> """foo( | "foo", | "bar", | false |)""" """foo( | "foo", | "bar", | false)""" ==> """foo( | "foo", | "bar", | false |)""" } { implicit val formattingPreferences = FormattingPreferences .setPreference(IndentWithTabs, true) .setPreference(DanglingCloseParenthesis, Preserve) """foo( |alpha = "foo", |beta = "bar", |gamma = false)""" ==> """foo( | alpha = "foo", | beta = "bar", | gamma = false)""" """foo( |"foo", |"bar", |false)""" ==> """foo( | "foo", | "bar", | false)""" """foo( | "foo", | "bar", | false)""" ==> """foo( | "foo", | "bar", | false)""" } { implicit val formattingPreferences = FormattingPreferences .setPreference(IndentWithTabs, true) .setPreference(DanglingCloseParenthesis, Prevent) """foo( |alpha = "foo", |beta = "bar", |gamma = false |)""" ==> """foo( | alpha = "foo", | beta = "bar", | gamma = false)""" """foo( |"foo", |"bar", |false |)""" ==> """foo( | "foo", | "bar", | false)""" """foo( | "foo", | "bar", | false |)""" ==> """foo( | "foo", | "bar", | false)""" } override val debug = false type Result = CompilationUnit def parse(parser: ScalaParser) = parser.compilationUnitOrScript def format(formatter: ScalaFormatter, result: Result) = formatter.format(result)(FormatterState()) }
daniel-trinh/scalariform
scalariform/src/test/scala/com/danieltrinh/scalariform/formatter/IndentWithTabsTest.scala
Scala
mit
3,038
/*********************************************************************** * Copyright (c) 2013-2017 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at * http://www.opensource.org/licenses/apache2.0.php. ***********************************************************************/ package org.locationtech.geomesa.memory.cqengine.utils import java.util.Date import java.util.regex.Pattern import com.googlecode.cqengine.attribute.Attribute import com.googlecode.cqengine.query.Query import com.googlecode.cqengine.{query => cqquery} import com.vividsolutions.jts.geom.Geometry import org.geotools.filter.LikeToRegexConverter import org.geotools.filter.visitor.AbstractFilterVisitor import org.locationtech.geomesa.filter._ import org.locationtech.geomesa.memory.cqengine.query.{GeoToolsFilterQuery, Intersects => CQIntersects} import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType} import org.opengis.filter._ import org.opengis.filter.expression.Literal import org.opengis.filter.spatial._ import org.opengis.filter.temporal._ import scala.collection.JavaConversions._ import scala.language._ class CQEngineQueryVisitor(sft: SimpleFeatureType) extends AbstractFilterVisitor { implicit val lookup: SFTAttributes = SFTAttributes(sft) /* Logical operators */ /** * And */ override def visit(filter: And, data: scala.Any): AnyRef = { val children = filter.getChildren val query = children.map { f => f.accept(this, null) match { case q: Query[SimpleFeature] => q case _ => throw new RuntimeException(s"Can't parse filter: $f.") } }.toList new cqquery.logical.And[SimpleFeature](query) } /** * Or */ override def visit(filter: Or, data: scala.Any): AnyRef = { val children = filter.getChildren val query = children.map { f => f.accept(this, null) match { case q: Query[SimpleFeature] => q case _ => throw new RuntimeException(s"Can't parse filter: $f.") } }.toList new cqquery.logical.Or[SimpleFeature](query) } /** * Not */ override def visit(filter: Not, data: scala.Any): AnyRef = { val subfilter = filter.getFilter val subquery = subfilter.accept(this, null) match { case q: Query[SimpleFeature] => q case _ => throw new RuntimeException(s"Can't parse filter: $subfilter.") } new cqquery.logical.Not[SimpleFeature](subquery) } /* Id, null, nil, exclude, include */ /** * Id */ override def visit(filter: Id, extractData: scala.AnyRef): AnyRef = { val attr = SFTAttributes.fidAttribute val values = filter.getIDs.map(_.toString) new cqquery.simple.In[SimpleFeature, String](attr, true, values) } /** * PropertyIsNil: * follows the example of IsNilImpl by using the same implementation as PropertyIsNull */ override def visit(filter: PropertyIsNil, extraData: scala.Any): AnyRef = { val name = getAttribute(filter) val attr = lookup.lookup[Any](name) new cqquery.logical.Not[SimpleFeature](new cqquery.simple.Has(attr)) } /** * PropertyIsNull */ override def visit(filter: PropertyIsNull, data: scala.Any): AnyRef = { val name = getAttribute(filter) val attr = lookup.lookup[Any](name) // TODO: could this be done better? new cqquery.logical.Not[SimpleFeature](new cqquery.simple.Has(attr)) } /** * ExcludeFilter */ override def visit(filter: ExcludeFilter, data: scala.Any): AnyRef = new cqquery.simple.None(classOf[SimpleFeature]) /** * IncludeFilter * (handled a level above if IncludeFilter is the root node) */ override def visit(filter: IncludeFilter, data: scala.Any): AnyRef = new cqquery.simple.All(classOf[SimpleFeature]) /* MultiValuedFilters */ /** * PropertyIsEqualTo */ override def visit(filter: PropertyIsEqualTo, data: scala.Any): AnyRef = { val name = getAttribute(filter) val attribute: Attribute[SimpleFeature, Any] = lookup.lookup[Any](name) val value = FilterHelper.extractAttributeBounds(filter, name, attribute.getAttributeType).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse equals values ${filterToString(filter)}") }.lower.value.get new cqquery.simple.Equal(attribute, value) } /** * PropertyIsGreaterThan */ override def visit(filter: PropertyIsGreaterThan, data: scala.Any): AnyRef = { val name = getAttribute(filter) val binding = sft.getDescriptor(name).getType.getBinding FilterHelper.extractAttributeBounds(filter, name, binding).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse greater than values ${filterToString(filter)}") }.bounds match { case (Some(lo), None) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntGTQuery(name, lo.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongGTQuery(name, lo.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatGTQuery(name, lo.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleGTQuery(name, lo.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateGTQuery(name, lo.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsGreaterThan: $c not supported") } case (None, Some(hi)) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntLTQuery(name, hi.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongLTQuery(name, hi.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatLTQuery(name, hi.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleLTQuery(name, hi.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateLTQuery(name, hi.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsGreaterThan: $c not supported") } case _ => throw new RuntimeException(s"Can't parse greater than values ${filterToString(filter)}") } } /** * PropertyIsGreaterThanOrEqualTo */ override def visit(filter: PropertyIsGreaterThanOrEqualTo, data: scala.Any): AnyRef = { val name = getAttribute(filter) val binding = sft.getDescriptor(name).getType.getBinding FilterHelper.extractAttributeBounds(filter, name, binding).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse greater than or equal to values ${filterToString(filter)}") }.bounds match { case (Some(lo), None) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntGTEQuery(name, lo.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongGTEQuery(name, lo.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatGTEQuery(name, lo.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleGTEQuery(name, lo.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateGTEQuery(name, lo.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsGreaterThanOrEqualTo: $c not supported") } case (None, Some(hi)) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntLTEQuery(name, hi.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongLTEQuery(name, hi.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatLTEQuery(name, hi.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleLTEQuery(name, hi.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateLTEQuery(name, hi.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsGreaterThanOrEqualTo: $c not supported") } case _ => throw new RuntimeException(s"Can't parse greater than or equal to values ${filterToString(filter)}") } } /** * PropertyIsLessThan */ override def visit(filter: PropertyIsLessThan, data: scala.Any): AnyRef = { val name = getAttribute(filter) val binding = sft.getDescriptor(name).getType.getBinding FilterHelper.extractAttributeBounds(filter, name, binding).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse less than values ${filterToString(filter)}") }.bounds match { case (Some(lo), None) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntGTQuery(name, lo.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongGTQuery(name, lo.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatGTQuery(name, lo.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleGTQuery(name, lo.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateGTQuery(name, lo.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsLessThan: $c not supported") } case (None, Some(hi)) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntLTQuery(name, hi.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongLTQuery(name, hi.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatLTQuery(name, hi.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleLTQuery(name, hi.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateLTQuery(name, hi.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsLessThan: $c not supported") } case _ => throw new RuntimeException(s"Can't parse less than values ${filterToString(filter)}") } } /** * PropertyIsLessThanOrEqualTo */ override def visit(filter: PropertyIsLessThanOrEqualTo, data: scala.Any): AnyRef = { val name = getAttribute(filter) val binding = sft.getDescriptor(name).getType.getBinding FilterHelper.extractAttributeBounds(filter, name, binding).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse less than or equal to values ${filterToString(filter)}") }.bounds match { case (Some(lo), None) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntGTEQuery(name, lo.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongGTEQuery(name, lo.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatGTEQuery(name, lo.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleGTEQuery(name, lo.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateGTEQuery(name, lo.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsLessThanOrEqualTo: $c not supported") } case (None, Some(hi)) => binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntLTEQuery(name, hi.asInstanceOf[java.lang.Integer]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongLTEQuery(name, hi.asInstanceOf[java.lang.Long]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatLTEQuery(name, hi.asInstanceOf[java.lang.Float]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleLTEQuery(name, hi.asInstanceOf[java.lang.Double]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateLTEQuery(name, hi.asInstanceOf[java.util.Date]) case c => throw new RuntimeException(s"PropertyIsLessThanOrEqualTo: $c not supported") } case _ => throw new RuntimeException(s"Can't parse less than or equal to values ${filterToString(filter)}") } } /** * PropertyIsNotEqualTo */ override def visit(filter: PropertyIsNotEqualTo, data: scala.Any): AnyRef = { import org.locationtech.geomesa.utils.conversions.ScalaImplicits.RichIterator val name = getAttribute(filter) val attribute: Attribute[SimpleFeature, Any] = lookup.lookup[Any](name) val value: Any = Iterator(filter.getExpression1, filter.getExpression2).collect { case lit: Literal => lit.evaluate(null, attribute.getAttributeType) }.headOption.getOrElse { throw new RuntimeException(s"Can't parse not equal to values ${filterToString(filter)}") } // TODO: could this be done better? // may not be as big an issue as PropertyIsNull, as I'm not // even sure how to build this filter in (E)CQL new cqquery.logical.Not(new cqquery.simple.Equal(attribute, value)) } /** * PropertyIsBetween * (in the OpenGIS spec, lower and upper are inclusive) */ override def visit(filter: PropertyIsBetween, data: scala.Any): AnyRef = { val name = getAttribute(filter) val binding = sft.getDescriptor(name).getType.getBinding val values = FilterHelper.extractAttributeBounds(filter, name, binding).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse less than or equal to values ${filterToString(filter)}") } val between = (values.lower.value.get, values.upper.value.get) binding match { case c if classOf[java.lang.Integer].isAssignableFrom(c) => BuildIntBetweenQuery(name, between.asInstanceOf[(java.lang.Integer, java.lang.Integer)]) case c if classOf[java.lang.Long ].isAssignableFrom(c) => BuildLongBetweenQuery(name, between.asInstanceOf[(java.lang.Long, java.lang.Long)]) case c if classOf[java.lang.Float ].isAssignableFrom(c) => BuildFloatBetweenQuery(name, between.asInstanceOf[(java.lang.Float, java.lang.Float)]) case c if classOf[java.lang.Double ].isAssignableFrom(c) => BuildDoubleBetweenQuery(name, between.asInstanceOf[(java.lang.Double, java.lang.Double)]) case c if classOf[java.util.Date ].isAssignableFrom(c) => BuildDateBetweenQuery(name, between.asInstanceOf[(java.util.Date, java.util.Date)]) case c => throw new RuntimeException(s"PropertyIsBetween: $c not supported") } } /** * PropertyIsLike */ override def visit(filter: PropertyIsLike, data: scala.Any): AnyRef = { val name = getAttribute(filter) val attr = lookup.lookup[String](name) val converter = new LikeToRegexConverter(filter) val pattern = if (filter.isMatchingCase) { Pattern.compile(converter.getPattern) } else { Pattern.compile(converter.getPattern, Pattern.CASE_INSENSITIVE) } new cqquery.simple.StringMatchesRegex[SimpleFeature, String](attr, pattern) } /* Spatial filters */ /** * BBOX */ override def visit(filter: BBOX, data: scala.Any): AnyRef = { val name = getAttribute(filter) val geom = FilterHelper.extractGeometries(filter, name).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse bbox values ${filterToString(filter)}") } val geomAttribute = lookup.lookup[Geometry](name) new CQIntersects(geomAttribute, geom) } /** * Intersects */ override def visit(filter: Intersects, data: scala.Any): AnyRef = { val name = getAttribute(filter) val geom = FilterHelper.extractGeometries(filter, name).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse intersects values ${filterToString(filter)}") } val geomAttribute = lookup.lookup[Geometry](name) new CQIntersects(geomAttribute, geom) } /** * BinarySpatialOperator: fallback non-indexable implementation of other spatial operators. * Handles: * Contains, Crosses, Disjoint, Beyond, DWithin, Equals, Overlaps, Touches, Within */ override def visit(filter: BinarySpatialOperator, data: scala.Any): AnyRef = handleGeneralCQLFilter(filter) /* Temporal filters */ /** * After: only for time attributes, and is exclusive */ override def visit(after: After, extraData: scala.Any): AnyRef = { val name = getAttribute(after) sft.getDescriptor(name).getType.getBinding match { case c if classOf[Date].isAssignableFrom(c) => val attr = lookup.lookup[Date](name) FilterHelper.extractIntervals(after, name).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse after values ${filterToString(after)}") }.bounds match { case (Some(lo), None) => new cqquery.simple.GreaterThan[SimpleFeature, Date](attr, lo.toDate, false) case (None, Some(hi)) => new cqquery.simple.LessThan[SimpleFeature, Date](attr, hi.toDate, false) } case c => throw new RuntimeException(s"After: $c not supported") } } /** * Before: only for time attributes, and is exclusive */ override def visit(before: Before, extraData: scala.Any): AnyRef = { val name = getAttribute(before) sft.getDescriptor(name).getType.getBinding match { case c if classOf[Date].isAssignableFrom(c) => val attr = lookup.lookup[Date](name) FilterHelper.extractIntervals(before, name).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse before values ${filterToString(before)}") }.bounds match { case (Some(lo), None) => new cqquery.simple.GreaterThan[SimpleFeature, Date](attr, lo.toDate, false) case (None, Some(hi)) => new cqquery.simple.LessThan[SimpleFeature, Date](attr, hi.toDate, false) } case c => throw new RuntimeException(s"Before: $c not supported") } } /** * During: only for time attributes, and is exclusive at both ends */ override def visit(during: During, extraData: scala.Any): AnyRef = { val name = getAttribute(during) sft.getDescriptor(name).getType.getBinding match { case c if classOf[Date].isAssignableFrom(c) => val attr = lookup.lookup[Date](name) val bounds = FilterHelper.extractIntervals(during, name).values.headOption.getOrElse { throw new RuntimeException(s"Can't parse during values ${filterToString(during)}") } new cqquery.simple.Between[SimpleFeature, java.util.Date](attr, bounds.lower.value.get.toDate, bounds.lower.inclusive, bounds.upper.value.get.toDate, bounds.upper.inclusive) case c => throw new RuntimeException(s"During: $c not supported") } } /** * BinaryTemporalOperator: Fallback non-indexable implementation of other temporal operators. * Handles: * AnyInteracts, Begins, BegunBy, EndedBy, Ends, Meets, * MetBy, OverlappedBy, TContains, TEquals, TOverlaps */ override def visit(filter: BinaryTemporalOperator, data: scala.Any): AnyRef = handleGeneralCQLFilter(filter) def handleGeneralCQLFilter(filter: Filter): Query[SimpleFeature] = { new GeoToolsFilterQuery(filter) } def getAttribute(filter: Filter): String = FilterHelper.propertyNames(filter, null).headOption.getOrElse { throw new RuntimeException(s"Can't parse filter ${filterToString(filter)}") } }
ronq/geomesa
geomesa-memory/geomesa-cqengine/src/main/scala/org/locationtech/geomesa/memory/cqengine/utils/CQEngineQueryVisitor.scala
Scala
apache-2.0
20,246
package sbt.extra.dsl import sbt._ import Scoped._ import Project.{richInitializeTask,richInitialize} object SimpleTasks { final def task(name: String) = new TaskId(name) final def setting(name: String) = new SettingId(name) }
etorreborre/sbt-extras
src/main/scala/SimpleDsl.scala
Scala
bsd-3-clause
233
package org.fayalite.ml.yahoo.finance import java.io.File import com.sksamuel.scrimage.Image import fa.{homeDir, readCSV} object ImgLoader { val path = new File(homeDir, "nerv") val train = new File(path, "train") val masks = readCSV(new File(path, "train_masks.csv").getCanonicalPath).tail def main(args: Array[String]) { val fMask = masks.head(2).split(" ").grouped(2).toSeq.map{ case Array(pIdx, runLen) => pIdx.toInt -> runLen.toInt }.toMap println(fMask.size, fMask.toSeq.slice(0, 20).toList) val first = new File(train, "1_1.tif") val img = Image.fromFile(first) val imgi = img.pixels.map{_.argb}.zipWithIndex println(imgi.size) } }
ryleg/fayalite
ml/src/main/scala/org/fayalite/ml/yahoo/finance/ImgLoader.scala
Scala
mit
704
/* * Copyright 2011-2017 Chris de Vreeze * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.cdevreeze.yaidom.integrationtest import java.{io => jio} import eu.cdevreeze.yaidom.core.EName import eu.cdevreeze.yaidom.parse.DocumentParserUsingStax import eu.cdevreeze.yaidom.simple.Elem import org.scalatest.funsuite.AnyFunSuite import org.xml.sax.InputSource /** * Test case that "ports" http://www.jroller.com/jurberg/entry/converting_xml_to_flat_files to Scala. * Here we do not need any dynamic language with lambdas. A static language with lambdas, such as Scala, will do just fine. * * @author Chris de Vreeze */ class XmlToFlatFileTest extends AnyFunSuite { test("testConvertXmlToFlatFile") { val docParser = DocumentParserUsingStax.newInstance() val xmlData = """<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> </book> <book id="bk103"> <author>Corets, Eva</author> <title>Maeve Ascendant</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-11-17</publish_date> </book> </catalog> """ val rootElem = docParser.parse(new InputSource(new jio.StringReader(xmlData))).documentElement val columnMapping = Vector( { (bookElem: Elem) => val id = (bookElem \\@ EName("id")).mkString.trim id.padTo(5, ' ').take(5) }, { (bookElem: Elem) => val lastName = (bookElem \\ (_.localName == "author")).map(_.text).mkString.split(',').apply(0).trim lastName.padTo(15, ' ').take(15) }, { (bookElem: Elem) => val firstName = (bookElem \\ (_.localName == "author")).map(_.text).mkString.split(',').apply(1).trim firstName.padTo(10, ' ').take(10) }) val separator = System.getProperty("line.separator") val rows = (rootElem \\ (_.localName == "book")) map { e => val columns = columnMapping map { f => f(e) } columns.mkString + separator } val expected = "bk101Gambardella Matthew " + separator + "bk102Ralls Kim " + separator + "bk103Corets Eva " + separator assertResult(expected) { rows.mkString } } }
dvreeze/yaidom
jvm/src/test/scala/eu/cdevreeze/yaidom/integrationtest/XmlToFlatFileTest.scala
Scala
apache-2.0
3,087
/* * Copyright 2001-2008 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.scalatest.tools import org.scalatest._ import org.scalatest.events._ import java.io.PrintWriter import java.text.SimpleDateFormat import java.util.Enumeration import java.util.Properties import java.net.UnknownHostException import java.net.InetAddress import scala.collection.mutable.Set import scala.collection.mutable.ListBuffer import scala.xml /** * A <code>Reporter</code> that writes test status information in XML format * using the same format as is generated by the xml formatting option of the * ant &lt;junit&gt; task. * * A separate file is written for each test suite, named TEST-[classname].xml, * to the directory specified. * * @exception IOException if unable to open the file for writing * * @author George Berger */ private[scalatest] class JUnitXmlReporter(directory: String) extends Reporter { private val events = Set.empty[Event] private val propertiesXml = genPropertiesXml // // Records events in 'events' set. Generates xml from events upon receipt // of SuiteCompleted or SuiteAborted events. // def apply(event: Event) { events += event event match { case e: SuiteCompleted => writeSuiteFile(e, e.suiteId) case e: SuiteAborted => writeSuiteFile(e, e.suiteId) case _ => } } // // Writes the xml file for a single test suite. Removes processed // events from the events Set as they are used. // private def writeSuiteFile(endEvent: Event, suiteId: String) { require(endEvent.isInstanceOf[SuiteCompleted] || endEvent.isInstanceOf[SuiteAborted]) val testsuite = getTestsuite(endEvent, suiteId) val xmlStr = xmlify(testsuite) val filespec = directory + "/TEST-" + testsuite.name + ".xml" val out = new PrintWriter(filespec, "UTF-8") out.print(xmlStr) out.close() } // // Constructs a Testsuite object corresponding to a specified // SuiteCompleted or SuiteAborted event. // // Scans events reported so far and builds the Testsuite from events // associated with the specified suite. Removes events from // the class's events Set as they are consumed. // // Only looks at events that have the same ordinal prefix as the // end event being processed (where an event's ordinal prefix is its // ordinal list with last element removed). Events with the same // prefix get processed sequentially, so filtering this way eliminates // events from any nested suites being processed concurrently // that have not yet completed when the parent's SuiteCompleted or // SuiteAborted event is processed. // private def getTestsuite(endEvent: Event, suiteId: String): Testsuite = { require(endEvent.isInstanceOf[SuiteCompleted] || endEvent.isInstanceOf[SuiteAborted]) val orderedEvents = events.toList.filter { e => e match { case e: TestStarting => e.suiteId == suiteId case e: TestSucceeded => e.suiteId == suiteId case e: TestIgnored => e.suiteId == suiteId case e: TestFailed => e.suiteId == suiteId case e: TestPending => e.suiteId == suiteId case e: TestCanceled => e.suiteId == suiteId case e: InfoProvided => e.nameInfo match { case Some(nameInfo) => nameInfo.suiteID == suiteId case None => false } case e: MarkupProvided => e.nameInfo match { case Some(nameInfo) => nameInfo.suiteID == suiteId case None => false } case e: ScopeOpened => e.nameInfo.suiteID == suiteId case e: ScopeClosed => e.nameInfo.suiteID == suiteId case e: SuiteStarting => e.suiteId == suiteId case e: SuiteAborted => e.suiteId == suiteId case e: SuiteCompleted => e.suiteId == suiteId case _ => false } }.sortWith((a, b) => a < b).toArray val (startIndex, endIndex) = locateSuite(orderedEvents, endEvent) val startEvent = orderedEvents(startIndex).asInstanceOf[SuiteStarting] events -= startEvent val name = startEvent.suiteClassName match { case Some(className) => className case None => startEvent.suiteName } val testsuite = Testsuite(name, startEvent.timeStamp) var idx = startIndex + 1 while (idx <= endIndex) { val event = orderedEvents(idx) events -= event event match { case e: TestStarting => val (testEndIndex, testcase) = processTest(orderedEvents, e, idx) testsuite.testcases += testcase if (testcase.failure != None) testsuite.failures += 1 idx = testEndIndex + 1 case e: SuiteAborted => assert(endIndex == idx) testsuite.errors += 1 testsuite.time = e.timeStamp - testsuite.timeStamp idx += 1 case e: SuiteCompleted => assert(endIndex == idx) testsuite.time = e.timeStamp - testsuite.timeStamp idx += 1 case e: TestIgnored => val testcase = Testcase(e.testName, e.suiteClassName, e.timeStamp) testcase.ignored = true testsuite.testcases += testcase idx += 1 case e: InfoProvided => idx += 1 case e: MarkupProvided => idx += 1 case e: ScopeOpened => idx += 1 case e: ScopeClosed => idx += 1 case e: TestPending => unexpected(e) case e: TestCanceled => unexpected(e) case e: RunStarting => unexpected(e) case e: RunCompleted => unexpected(e) case e: RunStopped => unexpected(e) case e: RunAborted => unexpected(e) case e: TestSucceeded => unexpected(e) case e: TestFailed => unexpected(e) case e: SuiteStarting => unexpected(e) } } testsuite } // // Finds the indexes for the SuiteStarted and SuiteCompleted or // SuiteAborted endpoints of a test suite within an ordered array of // events, given the terminating SuiteCompleted or SuiteAborted event. // // Searches sequentially through the array to find the specified // SuiteCompleted event and its preceding SuiteStarting event. // // (The orderedEvents array does not contain any SuiteStarting events // from nested suites running concurrently because of the ordinal-prefix // filtering performed in getTestsuite(). It does not contain any from // nested suites running sequentially because those get removed when they // are processed upon occurrence of their corresponding SuiteCompleted // events.) // private def locateSuite(orderedEvents: Array[Event], endEvent: Event): (Int, Int) = { require(orderedEvents.size > 0) require(endEvent.isInstanceOf[SuiteCompleted] || endEvent.isInstanceOf[SuiteAborted]) var startIndex = 0 var endIndex = 0 var idx = 0 while ((idx < orderedEvents.size) && (endIndex == 0)) { val event = orderedEvents(idx) event match { case e: SuiteStarting => startIndex = idx case e: SuiteCompleted => if (event == endEvent) { endIndex = idx assert( e.suiteName == orderedEvents(startIndex).asInstanceOf[SuiteStarting]. suiteName) } case e: SuiteAborted => if (event == endEvent) { endIndex = idx assert( e.suiteName == orderedEvents(startIndex).asInstanceOf[SuiteStarting]. suiteName) } case _ => } idx += 1 } assert(endIndex > 0) assert(orderedEvents(startIndex).isInstanceOf[SuiteStarting]) (startIndex, endIndex) } private def idxAdjustmentForRecordedEvents(recordedEvents: collection.immutable.IndexedSeq[RecordableEvent]) = recordedEvents.filter(e => e.isInstanceOf[InfoProvided] || e.isInstanceOf[MarkupProvided]).size // // Constructs a Testcase object from events in orderedEvents array. // // Accepts a TestStarting event and its index within orderedEvents. // Returns a Testcase object plus the index to its corresponding // test completion event. Removes events from class's events Set // as they are processed. // private def processTest(orderedEvents: Array[Event], startEvent: TestStarting, startIndex: Int): (Int, Testcase) = { val testcase = Testcase(startEvent.testName, startEvent.suiteClassName, startEvent.timeStamp) var endIndex = 0 var idx = startIndex + 1 while ((idx < orderedEvents.size) && (endIndex == 0)) { val event = orderedEvents(idx) events -= event event match { case e: TestSucceeded => endIndex = idx testcase.time = e.timeStamp - testcase.timeStamp idx += idxAdjustmentForRecordedEvents(e.recordedEvents) case e: TestFailed => endIndex = idx testcase.failure = Some(e) testcase.time = e.timeStamp - testcase.timeStamp idx += idxAdjustmentForRecordedEvents(e.recordedEvents) case e: TestPending => endIndex = idx testcase.pending = true idx += idxAdjustmentForRecordedEvents(e.recordedEvents) case e: TestCanceled => endIndex = idx testcase.canceled = true idx += idxAdjustmentForRecordedEvents(e.recordedEvents) case e: ScopeOpened => idx += 1 case e: ScopeClosed => idx += 1 case e: InfoProvided => idx += 1 case e: MarkupProvided => idx += 1 case e: SuiteCompleted => unexpected(e) case e: TestStarting => unexpected(e) case e: TestIgnored => unexpected(e) case e: SuiteStarting => unexpected(e) case e: RunStarting => unexpected(e) case e: RunCompleted => unexpected(e) case e: RunStopped => unexpected(e) case e: RunAborted => unexpected(e) case e: SuiteAborted => unexpected(e) } } (endIndex, testcase) } // // Creates an xml string describing a run of a test suite. // def xmlify(testsuite: Testsuite): String = { val xmlVal = <testsuite errors = { "" + testsuite.errors } failures = { "" + testsuite.failures } hostname = { "" + findHostname } name = { "" + testsuite.name } tests = { "" + testsuite.testcases.size } time = { "" + testsuite.time / 1000.0 } timestamp = { "" + formatTimeStamp(testsuite.timeStamp) }> { propertiesXml } { for (testcase <- testsuite.testcases) yield { <testcase name = { "" + testcase.name } classname = { "" + strVal(testcase.className) } time = { "" + testcase.time / 1000.0 } > { if (testcase.ignored || testcase.pending || testcase.canceled) <skipped/> else failureXml(testcase.failure) } </testcase> } } <system-out><![CDATA[]]></system-out> <system-err><![CDATA[]]></system-err> </testsuite> val prettified = (new xml.PrettyPrinter(76, 2)).format(xmlVal) // scala xml strips out the <![CDATA[]]> elements, so restore them here val withCDATA = prettified. replace("<system-out></system-out>", "<system-out><![CDATA[]]></system-out>"). replace("<system-err></system-err>", "<system-err><![CDATA[]]></system-err>") "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?>\\n" + withCDATA } // // Returns string representation of stack trace for specified Throwable, // including any nested exceptions. // def getStackTrace(throwable: Throwable): String = { "" + throwable + Array.concat(throwable.getStackTrace).mkString("\\n at ", "\\n at ", "\\n") + { if (throwable.getCause != null) { " Cause: " + getStackTrace(throwable.getCause) } else "" } } // // Generates <failure> xml for TestFailed event, if specified Option // contains one. // private def failureXml(failureOption: Option[TestFailed]): xml.NodeSeq = { failureOption match { case None => xml.NodeSeq.Empty case Some(failure) => val (throwableType, throwableText) = failure.throwable match { case None => ("", "") case Some(throwable) => val throwableType = "" + throwable.getClass val throwableText = getStackTrace(throwable) (throwableType, throwableText) } <failure message = { failure.message } type = { throwableType } > { throwableText } </failure> } } // // Returns toString value of option contents if Some, or empty string if // None. // private def strVal(option: Option[Any]): String = { option match { case Some(x) => "" + x case None => "" } } // // Determines hostname of local machine. // private def findHostname: String = { try { val localMachine = InetAddress.getLocalHost(); localMachine.getHostName } catch { case e: UnknownHostException => "unknown" } } // // Generates <properties> element of xml. // private def genPropertiesXml: xml.Elem = { val sysprops = System.getProperties <properties> { for (name <- propertyNames(sysprops)) yield <property name={ name } value = { sysprops.getProperty(name) }> </property> } </properties> } // // Returns a list of the names of properties in a Properties object. // private def propertyNames(props: Properties): List[String] = { val listBuf = new ListBuffer[String] val enumeration = props.propertyNames while (enumeration.hasMoreElements) listBuf += "" + enumeration.nextElement listBuf.toList } // // Formats timestamp into a string for display, e.g. "2009-08-31T14:59:37" // private def formatTimeStamp(timeStamp: Long): String = { val dateFmt = new SimpleDateFormat("yyyy-MM-dd") val timeFmt = new SimpleDateFormat("HH:mm:ss") dateFmt.format(timeStamp) + "T" + timeFmt.format(timeStamp) } // // Throws an exception if an unexpected Event is encountered. // def unexpected(event: Event) { throw new RuntimeException("unexpected event [" + event + "]") } // // Class to hold information about an execution of a test suite. // private case class Testsuite(name: String, timeStamp: Long) { var errors = 0 var failures = 0 var time = 0L val testcases = new ListBuffer[Testcase] } // // Class to hold information about an execution of a testcase. // private case class Testcase(name: String, className: Option[String], timeStamp: Long) { var time = 0L var pending = false var canceled = false var ignored = false var failure: Option[TestFailed] = None } }
vivosys/scalatest
src/main/scala/org/scalatest/tools/JUnitXmlReporter.scala
Scala
apache-2.0
15,917
package scife package enumeration package benchmarks import dependent._ import memoization._ import scife.{ enumeration => e } import scife.util._ import scife.util.logging._ import structures.riff._ import RiffFormat._ import org.scalatest._ import org.scalameter.api._ import scala.language.existentials class RiffImage extends StructuresBenchmark[Depend[(Int, Int, Int, Int), RiffFormat.Chunk]] { // size, dataSize, totalJiff, avRatio type Input = (Int, Int, Int, Int) type PInput = ((Int, Int), (Int, Int)) // list of extends type Output = RiffFormat.Chunk type UnsOutput = (Int, Int, Int, Int) type EnumType = Depend[Input, Output] def measureCode(tdEnum: EnumType) = { { (size: Int) => val enum = tdEnum.getEnum((size, size, (size + 1) / 2, size/2)) for (i <- 0 until enum.size) enum(i) } } def warmUp(tdEnum: EnumType, maxSize: Int) { for (size <- 1 to maxSize) { val enum = tdEnum.getEnum((size, size, (size + 1) / 2, size/2)) for (i <- 0 until enum.size) enum(i) } } def constructEnumerator(implicit ms: MemoizationScope) = { Depend.memoized( (self: Depend[Input, Output], in: Input) => { // size of the structure, payload size, #jiffed chunks, #audio chunks val (size, dataSize, jiffLoss, avChunks) = in if (size == 0 && dataSize == 0) e.Singleton(RiffFormat.Leaf): Finite[Chunk] else if (size == 1 && dataSize > 0 && avChunks <= 1 && (jiffLoss * 4) % dataSize == 0) e.Singleton( Payload(dataSize, jiffLoss * 4 / dataSize, avChunks) ): Finite[Chunk] else if (size > 1 && dataSize > 0) { val leftSizes = e.Enum(0 until size-1) val rootLeftPairs1 = e.dependent.Chain(leftSizes, Depend({ (x: Int) => Enum( math.max(0, avChunks - (size - x - 1)) to math.min(x, avChunks)) } )) val leftDataSizes = e.Enum(0 to dataSize/2) val rootLeftPairs2: Enum[(Int, Int)] = e.dependent.Chain(leftDataSizes, Depend({ (x: Int) => Enum( math.max(0, jiffLoss - (dataSize - x)) to math.min(x, jiffLoss)) } )) val rootLeftPairs = e.Product(rootLeftPairs1, rootLeftPairs2) val leftTrees: Depend[PInput, Output] = InMap(self, { (in: PInput) => val ((leftSize, leftAudio), (leftData, leftJiff)) = in (leftSize, leftData, leftJiff, leftAudio) }) val rightTrees: Depend[PInput, Output] = InMap(self, { (in: PInput) => val ((leftSize, leftAudio), (leftData, leftJiff)) = in (size - leftSize - 1, dataSize - leftData, jiffLoss - leftJiff, avChunks - leftAudio) }) val leftRightTreePairs: Depend[PInput, (Output, Output)] = Product(leftTrees, rightTrees) val allNodes = if (size < 15) memoization.Chain[PInput, (Output, Output), Output](rootLeftPairs, leftRightTreePairs, (p1: PInput, p2: (Output, Output)) => Node(dataSize, p2._1, p2._2) ) else e.dependent.Chain[PInput, (Output, Output), Output](rootLeftPairs, leftRightTreePairs, (p1: PInput, p2: (Output, Output)) => Node(dataSize, p2._1, p2._2) ) allNodes: Finite[Chunk] } else e.Empty }) } }
kaptoxic/SciFe
src/bench/test/scala/scife/enumeration/benchmarks/RiffImage.scala
Scala
gpl-2.0
3,401
import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ import org.apache.spark.SparkConf import org.apache.spark.rdd.cl._ import Array._ import scala.math._ import org.apache.spark.rdd._ import java.net._ import scala.io.Source import org.apache.spark.mllib.linalg.Vectors import org.apache.spark.mllib.linalg.DenseVector object CensusConverter { def main(args : Array[String]) { if (args.length != 2) { println("usage: CensusConverter input-dir output-dir") return; } val inputDir = args(0) val outputDir = args(1) val sc = get_spark_context("Census Converter"); val input : RDD[String] = sc.textFile(inputDir) val converted : RDD[DenseVector] = input.map(line => { val tokens : Array[String] = line.split(",") var nAttributes = tokens.length - 1 val arr : Array[Double] = new Array[Double](nAttributes) var i : Int = 0 while (i < nAttributes) { arr(i) = tokens(i + 1).toDouble i += 1 } Vectors.dense(arr).asInstanceOf[DenseVector] }) converted.saveAsObjectFile(outputDir) sc.stop } def get_spark_context(appName : String) : SparkContext = { val conf = new SparkConf() conf.setAppName(appName) val localhost = InetAddress.getLocalHost // val localIpAddress = localhost.getHostAddress conf.setMaster("spark://" + localhost.getHostName + ":7077") // 7077 is the default port return new SparkContext(conf) } }
agrippa/spark-swat
dataset-transformations/census/src/main/scala/census/CensusConverter.scala
Scala
bsd-3-clause
1,620
package pep_082 import scala.collection.mutable object wip { val filename = "src/pep_082/matrix.txt" // val input = io.Source.fromFile(filename).mkString.trim.split("\\n").map(_.split(",") map (_.toInt)) val input = """ |131 673 234 103 18 |201 96 342 965 150 |630 803 746 422 111 |537 699 497 121 956 |805 732 524 37 331 """.stripMargin.trim.split("\\n").map(_.split("\\t") map (_.toInt)) val lastRow = input.size - 1 val lastCol = input.head.size - 1 case class Position(row: Int = 0, col: Int = 0) { def isEndPosition: Boolean = isLastCol def isFirstRow: Boolean = row == 0 def isLastRow: Boolean = row == lastRow def isLastCol: Boolean = col == lastCol def moveUp: Position = Position(row - 1, col) def moveRight: Position = Position(row, col + 1) def moveDown: Position = Position(row + 1, col) } def nextCells(actualCell: Position): Seq[Position] = actualCell match { case cell if cell.isLastCol => Nil case cell if cell.isFirstRow => Seq(cell.moveDown, cell.moveRight) case cell if cell.isLastRow => Seq(cell.moveUp, cell.moveRight) case cell => Seq(cell.moveUp, cell.moveDown, cell.moveRight) } val distance = mutable.Map[Position, Int]() ++ (for {r <- 0 to lastRow} yield Position(r, 0) -> input(r)(0)) val previous = mutable.Map[Position, Position]() case class PositionsToExplore(priority: Int, position: Position) extends Ordered[PositionsToExplore] { def compare(that: PositionsToExplore) = that.priority compare this.priority } val firstColumn = for { r <- 0 to lastRow } yield PositionsToExplore(0, Position(r, 0)) val rest = for { r <- 0 to lastRow c <- 1 to lastCol } yield PositionsToExplore(Int.MaxValue, Position(r, c)) var positionsToExplore = mutable.PriorityQueue[PositionsToExplore]() ++ firstColumn ++ rest var a = positionsToExplore.length def solve(): Int = { var result: Int = Int.MaxValue while (positionsToExplore.nonEmpty) { val position = positionsToExplore.dequeue().position val neighbors = nextCells(position) neighbors.foreach { case neighbor => // val pathValue = distance.getOrElseUpdate(position, Int.MaxValue) + input(neighbor.row)(neighbor.col) val pathValue = if (distance.contains(position)) { distance.get(position).get + input(neighbor.row)(neighbor.col) } else { Int.MaxValue } val aaa = pathValue < result if (neighbor.isEndPosition && aaa) { result = pathValue } if (pathValue < distance.getOrElse(neighbor, Int.MaxValue)) { distance.update(neighbor, pathValue) previous.update(neighbor, position) // TODO PriorityQueue are O(n) for random access :-/ positionsToExplore = positionsToExplore.filterNot(_.position == neighbor) positionsToExplore.enqueue(PositionsToExplore(pathValue, neighbor)) } } } result } }
filippovitale/pe
pe-solution/src/main/scala/pep_082/wip.scala
Scala
mit
3,110
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intel.analytics.bigdl.visualization import com.intel.analytics.bigdl.optim.Trigger import com.intel.analytics.bigdl.visualization.tensorboard.{FileReader, FileWriter} import scala.collection.mutable /** * Train logger for tensorboard. * Use optimize.setTrainSummary to enable train logger. Then the log will be saved to * logDir/appName/train. * * @param logDir log dir. * @param appName application Name. */ class TrainSummary( logDir: String, appName: String) extends Summary(logDir, appName) { protected val folder = s"$logDir/$appName/train" protected override val writer = new FileWriter(folder) private val triggers: mutable.HashMap[String, Trigger] = mutable.HashMap( "Loss" -> Trigger.severalIteration(1), "Throughput" -> Trigger.severalIteration(1)) /** * Read scalar values to an array of triple by tag name. * First element of the triple is step, second is value, third is wallClockTime. * @param tag tag name. Supported tag names is "LearningRate", "Loss", "Throughput" * @return an array of triple. */ override def readScalar(tag: String): Array[(Long, Float, Double)] = { FileReader.readScalar(folder, tag) } /** * Supported tag name are LearningRate, Loss, Throughput, Parameters. * Parameters contains weight, bias, gradWeight, gradBias, and some running status(eg. * runningMean and runningVar in BatchNormalization). * * Notice: By default, we record LearningRate, Loss and Throughput each iteration, while * recording parameters is disabled. The reason is getting parameters from workers is a * heavy operation when the model is very big. * * @param tag tag name * @param trigger trigger * @return */ def setSummaryTrigger(tag: String, trigger: Trigger): this.type = { require(tag.equals("LearningRate") || tag.equals("Loss") || tag.equals("Throughput") | tag.equals("Parameters"), s"TrainSummary: only support LearningRate, Loss, Parameters and Throughput") triggers(tag) = trigger this } /** * Get a trigger by tag name. * @param tag * @return */ def getSummaryTrigger(tag: String): Option[Trigger] = { if (triggers.contains(tag)) { Some(triggers(tag)) } else { None } } private[bigdl] def getScalarTriggers(): Iterator[(String, Trigger)] = { triggers.filter(!_._1.equals("Parameters")).toIterator } } object TrainSummary{ def apply(logDir: String, appName: String): TrainSummary = { new TrainSummary(logDir, appName) } }
yiheng/BigDL
spark/dl/src/main/scala/com/intel/analytics/bigdl/visualization/TrainSummary.scala
Scala
apache-2.0
3,188
/** * Copyright 2011-2017 GatlingCorp (http://gatling.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.gatling.http.action.sync import io.gatling.commons.validation._ import io.gatling.core.action.{ Action, ExitableAction, SessionHook } import io.gatling.core.session._ import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import io.gatling.http.action.HttpActionBuilder import io.gatling.http.cache.HttpCaches import io.gatling.http.cookie.CookieJar import io.gatling.http.cookie.CookieSupport.storeCookie import io.netty.handler.codec.http.cookie.{ Cookie, DefaultCookie } import org.asynchttpclient.uri.Uri case class CookieDSL(name: Expression[String], value: Expression[String], domain: Option[Expression[String]] = None, path: Option[Expression[String]] = None, maxAge: Option[Long] = None) { def withDomain(domain: Expression[String]) = copy(domain = Some(domain)) def withPath(path: Expression[String]) = copy(path = Some(path)) def withMaxAge(maxAge: Int) = copy(maxAge = Some(maxAge)) } object AddCookieBuilder { val NoBaseUrlFailure = "Neither cookie domain nor baseURL".failure val DefaultPath = "/".expressionSuccess def apply(cookie: CookieDSL) = new AddCookieBuilder(cookie.name, cookie.value, cookie.domain, cookie.path, cookie.maxAge.getOrElse(CookieJar.UnspecifiedMaxAge)) } class AddCookieBuilder(name: Expression[String], value: Expression[String], domain: Option[Expression[String]], path: Option[Expression[String]], maxAge: Long) extends HttpActionBuilder with NameGen { import AddCookieBuilder._ private def defaultDomain(httpCaches: HttpCaches): Expression[String] = session => { httpCaches.baseUrl(session) match { case Some(baseUrl) => Uri.create(baseUrl).getHost.success case _ => NoBaseUrlFailure } } def build(ctx: ScenarioContext, next: Action): Action = { import ctx._ val httpComponents = lookUpHttpComponents(protocolComponentsRegistry) val resolvedDomain = domain.getOrElse(defaultDomain(httpComponents.httpCaches)) val resolvedPath = path.getOrElse(DefaultPath) val expression: Expression[Session] = session => for { name <- name(session) value <- value(session) domain <- resolvedDomain(session) path <- resolvedPath(session) } yield storeCookie(session, domain, path, new DefaultCookie(name, value)) new SessionHook(expression, genName("addCookie"), coreComponents.statsEngine, next) with ExitableAction } }
timve/gatling
gatling-http/src/main/scala/io/gatling/http/action/sync/AddCookieBuilder.scala
Scala
apache-2.0
3,122
// Copyright 2016 Yahoo Inc. // Licensed under the terms of the Apache 2.0 license. // Please see LICENSE file in the project root for terms. package com.yahoo.ml.caffe import org.apache.spark.SparkContext import org.apache.spark.rdd.RDD import org.apache.spark.sql.{DataFrame, SQLContext} import org.apache.spark.storage.StorageLevel /** * ImageDataFrame is a built-in data source class using Spark dataframe format. * * ImageDataFrame expects dataframe with 2 required columns (lable:String, data:byte[]), * and 5 optional columns (id: String, channels :Int, height:Int, width:Int, encoded: Boolean). * * ImageDataFrame could be configured via the following MemoryDataLayer parameter: * (1) dataframe_column_select ... a collection of dataframe SQL selection statements * (ex. "sampleId as id", "abs(height) as height") * (2) image_encoded ... indicate whether image data are encoded or not. (default: false) * (3) dataframe_format ... Dataframe Format. (default: parquet) * * @param conf CaffeSpark configuration * @param layerId the layer index in the network protocol file * @param isTrain */ class ImageDataFrame(conf: Config, layerId: Int, isTrain: Boolean) extends ImageDataSource(conf, layerId, isTrain) { /* construct a sample RDD */ def makeRDD(sc: SparkContext): RDD[(String, String, Int, Int, Int, Boolean, Array[Byte])] = { val sqlContext = new SQLContext(sc) //load DataFrame var reader = sqlContext.read if (memdatalayer_param.hasDataframeFormat()) reader = reader.format(memdatalayer_param.getDataframeFormat()) var df: DataFrame = reader.load(sourceFilePath) //select columns if specified if (memdatalayer_param.getDataframeColumnSelectCount() > 0) { val selects = memdatalayer_param.getDataframeColumnSelectList() import scala.collection.JavaConversions._ df = df.selectExpr(selects.toList:_*) } //check optional columns val column_names : Array[String] = df.columns val has_id : Boolean = column_names.contains("id") val has_channels : Boolean = column_names.contains("channels") val has_height : Boolean = column_names.contains("height") val has_width : Boolean = column_names.contains("width") val has_encoded : Boolean = column_names.contains("encoded") //mapping each row to RDD tuple df.rdd.map(row => { var id: String = if (!has_id) "" else row.getAs[String]("id") var label: String = row.getAs[String]("label") val channels : Int = if (!has_channels) 0 else row.getAs[Int]("channels") val height : Int = if (!has_height) 0 else row.getAs[Int]("height") val width : Int = if (!has_width) 0 else row.getAs[Int]("width") val encoded : Boolean = if (!has_encoded) memdatalayer_param.getImageEncoded() else row.getAs[Boolean]("encoded") val data : Array[Byte] = row.getAs[Any]("data") match { case str: String => str.getBytes case arr: Array[Byte@unchecked] => arr case _ => { log.error("Unsupport value type") null } } (id, label, channels, height, width, encoded, data) }).persist(StorageLevel.DISK_ONLY) } }
yahoo/CaffeOnSpark
caffe-grid/src/main/scala/com/yahoo/ml/caffe/ImageDataFrame.scala
Scala
apache-2.0
3,199
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package iht.views.application.exemption.partner import iht.forms.ApplicationForms._ import iht.models.application.exemptions.PartnerExemption import iht.testhelpers.CommonBuilder import iht.testhelpers.TestHelper._ import iht.views.application.{CancelComponent, ValueViewBehaviour} import iht.views.html.application.exemption.partner.partner_date_of_birth import play.api.data.Form import play.twirl.api.HtmlFormat.Appendable class PartnerDateOfBirthViewTest extends ValueViewBehaviour[PartnerExemption] { def registrationDetails = CommonBuilder.buildRegistrationDetails1 def deceasedName = registrationDetails.deceasedDetails.map(_.name).fold("")(identity) lazy val partnerDateOfBirthView: partner_date_of_birth = app.injector.instanceOf[partner_date_of_birth] override def guidance = noGuidance override def pageTitle = messagesApi("page.iht.application.exemptions.partner.dateOfBirth.question.title") override def browserTitle = messagesApi("page.iht.application.exemptions.partner.dateOfBirth.browserTitle") override def formTarget = Some(iht.controllers.application.exemptions.partner.routes.PartnerDateOfBirthController.onSubmit) override def cancelComponent = Some( CancelComponent( iht.controllers.application.exemptions.partner.routes.PartnerOverviewController.onPageLoad, messagesApi("iht.estateReport.exemptions.partner.returnToAssetsLeftToSpouse"), ExemptionsPartnerDobID ) ) override def form: Form[PartnerExemption] = spouseDateOfBirthForm override def formToView: Form[PartnerExemption] => Appendable = form => partnerDateOfBirthView(form, registrationDetails) override val value_id = "dateOfBirth-container" "Partner date of birth View" must { behave like valueView() } }
hmrc/iht-frontend
test/iht/views/application/exemption/partner/PartnerDateOfBirthViewTest.scala
Scala
apache-2.0
2,367
package com.lucidchart.relate import java.sql.{Connection, PreparedStatement, ResultSet} import scala.collection.compat._ import scala.language.higherKinds /** * CollectionsSql is a trait for collection SQL queries. * * It provides methods for parameter insertion and query execution. * {{{ * import com.lucidchart.relate._ * import com.lucidchart.relate.Query._ * * case class User(id: Long, name: String) * * SQL(""" * SELECT id, name * FROM users * WHERE id={id} * """).on { implicit query => * long("id", 1L) * }.asCollection(RowParser { row => * User(row.long("id"), row.string("name")) * }) * }}} */ trait CollectionsSql { self: Sql => /** * Execute the query and get the auto-incremented keys using a RowParser. Provided for the case * that a primary key is not an Int or BigInt * @param parser the RowParser that can parse the returned keys * @param connection the connection to use when executing the query * @return the auto-incremented keys */ def executeInsertCollection[U, T[_]](parser: SqlRow => U)(implicit factory: Factory[U, T[U]], connection: Connection): T[U] = insertionStatement.execute(_.asCollection(parser)) /** * Execute this query and get back the result as an arbitrary collection of records * @param parser the RowParser to use when parsing the result set * @param connection the connection to use when executing the query * @return the results as an arbitrary collection of records */ def asCollection[U, T[_]](parser: SqlRow => U)(implicit factory: Factory[U, T[U]], connection: Connection): T[U] = normalStatement.execute(_.asCollection(parser)) def asCollection[U: RowParser, T[_]]()(implicit factory: Factory[U, T[U]], connection: Connection): T[U] = normalStatement.execute(_.asCollection[U, T]) /** * Execute this query and get back the result as an arbitrary collection of key value pairs * @param parser the RowParser to use when parsing the result set * @param connection the connection to use when executing the query * @return the results as an arbitrary collection of key value pairs */ def asPairCollection[U, V, T[_, _]](parser: SqlRow => (U, V))(implicit factory: Factory[(U, V), T[U, V]], connection: Connection): T[U, V] = normalStatement.execute(_.asPairCollection(parser)) def asPairCollection[U, V, T[_, _]]()(implicit factory: Factory[(U, V), T[U, V]], connection: Connection, p: RowParser[(U, V)]): T[U, V] = normalStatement.execute(_.asPairCollection[U, V, T]) }
lucidsoftware/relate
relate/src/main/scala/com/lucidchart/relate/CollectionsSql.scala
Scala
apache-2.0
2,514
/* * Copyright 2012 Pellucid and Zenexity * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package datomisca import scala.annotation.implicitNotFound import java.util.{Date => JDate} /** A conversion type class for point in time values. * * A type class for converting from various point in time values. * Basis T values as `Long`, transaction entity ids as `Long`, and * transaction time stamps as `java.util.Date`. * * @tparam T * the type of the point in time. */ @implicitNotFound("Cannot use a value of type ${T} as a point in time") sealed trait AsPointT[T] { /** * Convert from a point in time. * * @param t * a point in time. * @return an upcast of the point in time. */ protected[datomisca] def conv(t: T): AnyRef } /** The instances of the [[AsPointT]] type class. */ object AsPointT { /** Basis T and transaction entity id values as `Long` are points in time. */ implicit val long = new AsPointT[Long] { override protected[datomisca] def conv(l: Long) = l: java.lang.Long } /** Transaction time stamps as `java.util.Date` are points in time. */ implicit val jDate = new AsPointT[JDate] { override protected[datomisca] def conv(date: JDate) = date } }
Enalmada/datomisca
core/src/main/scala/datomisca/AsPointT.scala
Scala
apache-2.0
1,772
/* * FILE: AggregateWithinPartitons.scala * Copyright (c) 2015 - 2019 GeoSpark Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.datasyslab.geosparkviz.sql.operator import org.apache.spark.sql.functions._ import org.apache.spark.sql.{DataFrame, Row} import org.datasyslab.geosparkviz.sql.utils.Conf import org.datasyslab.geosparkviz.utils.Pixel import scala.collection.mutable import scala.collection.mutable.ArrayBuffer object AggregateWithinPartitons { /** * Run aggregation within each partition without incurring a data shuffle. Currently support three aggregates, sum, count, avg. * If the aggregate func is count, this function doesn't require a value column. If the aggregate func is sum and avg, it will require * a value column. They are same as the regular aggregation SQL * * SELECT pixel, COUNT(*) * FROM t GROUP BY pixel * * SELECT pixel, AVG(weight) * FROM t GROUP BY pixel * * SELECT pixel, AVG(weight) * FROM t GROUP BY pixel * * @param dataFrame * @param keyCol GroupBy key * @param valueCol Aggregate value * @param aggFunc Aggregate function * @return */ def apply(dataFrame: DataFrame, keyCol:String, valueCol:String, aggFunc:String): DataFrame = { // Keep keycol, valuecol, primary partition id, secondary partition id var formattedDf:DataFrame = null // If the aggFunc is count, we don't need to make sure the valueCol exists because we just simply count the number of rows if (aggFunc.equalsIgnoreCase("count")) formattedDf = dataFrame.select(keyCol, Conf.PrimaryPID, Conf.SecondaryPID).withColumn(valueCol, lit(0.0)) else formattedDf = dataFrame.select(keyCol, Conf.PrimaryPID, Conf.SecondaryPID, valueCol) //formattedDf.show() val aggRdd = formattedDf.rdd.mapPartitions(iterator=>{ var aggregator = new mutable.HashMap[Pixel,Tuple4[Double, Double, String, String]]() while (iterator.hasNext) { val cursorRow = iterator.next() val cursorKey = cursorRow.getAs[Pixel](keyCol) val cursorValue = cursorRow.getAs[Double](valueCol) val currentAggregate = aggregator.getOrElse(cursorKey,Tuple4(0.0, 0.0, "", "")) // Update the aggregator values, partition ids are appended directly aggregator.update(cursorKey, Tuple4(currentAggregate._1+cursorValue, currentAggregate._2+1, cursorRow.getAs[String](Conf.PrimaryPID), cursorRow.getAs[String](Conf.SecondaryPID))) } var result = new ArrayBuffer[Row]() aggFunc match { case "sum" => aggregator.foreach(f=>{ result+=Row(f._1, f._2._3, f._2._4, f._2._1) }) case "count" => aggregator.foreach(f=>{ result+=Row(f._1, f._2._3, f._2._4, f._2._2) }) case "avg" => aggregator.foreach(f=>{ result+=Row(f._1, f._2._3, f._2._4, f._2._1/f._2._2) }) case _ => throw new IllegalArgumentException("[GeoSparkViz][SQL] Unsupported aggregate func type. Only sum, count, avg are supported.") } result.iterator }) formattedDf.sparkSession.createDataFrame(aggRdd, formattedDf.schema) } }
Sarwat/GeoSpark
viz/src/main/scala/org/datasyslab/geosparkviz/sql/operator/AggregateWithinPartitons.scala
Scala
mit
3,673
package moe.pizza.auth.webapp import moe.pizza.auth.config.ConfigFile.{ AuthConfig, AuthGroupConfig, ConfigFile } import moe.pizza.auth.graphdb.EveMapDb import moe.pizza.auth.interfaces.{BroadcastService, PilotGrader, UserDatabase} import moe.pizza.auth.models.Pilot import moe.pizza.auth.tasks.Update import moe.pizza.auth.webapp.Types._ import moe.pizza.auth.webapp.Utils._ import moe.pizza.crestapi.CrestApi import moe.pizza.crestapi.CrestApi.{CallbackResponse, VerifyResponse} import moe.pizza.eveapi.{EVEAPI, XMLApiResponse} import moe.pizza.eveapi.generated.eve import org.http4s.dsl._ import org.http4s.headers.Location import org.http4s.util.CaseInsensitiveString import org.http4s.{Headers, Request, Status, Uri, _} import org.joda.time.DateTime import org.mockito.Matchers._ import org.mockito.Mockito._ import org.scalatest.mock.MockitoSugar import org.scalatest.{FlatSpec, MustMatchers} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future class AutocompleteSpec extends FlatSpec with MockitoSugar with MustMatchers { "DynamicRouter's AutoCompleter" should "autocomplete groups" in { val config = mock[ConfigFile] val authconfig = mock[AuthConfig] val groupconfig = mock[AuthGroupConfig] val ud = mock[UserDatabase] val pg = mock[PilotGrader] val crest = mock[CrestApi] val db = mock[EveMapDb] when(config.auth).thenReturn(authconfig) when(authconfig.groups).thenReturn(groupconfig) when(groupconfig.closed).thenReturn(List("admin")) when(groupconfig.open).thenReturn(List("dota")) when(ud.getAllUsers()).thenReturn(Seq.empty[Pilot]) val app = new Webapp(config, pg, 9021, ud, crestapi = Some(crest), mapper = Some(db)) val res = app.dynamicWebRouter(Request(uri = Uri.uri("/ping/complete?term=dot"))) val resp = res.run resp.status must equal(Ok) val bodytxt = EntityDecoder.decodeString(resp)(Charset.`UTF-8`).run bodytxt must equal("[\"dota\"]") } "DynamicRouter's AutoCompleter" should "autocomplete corps and alliances and order by length" in { val config = mock[ConfigFile] val authconfig = mock[AuthConfig] val groupconfig = mock[AuthGroupConfig] val ud = mock[UserDatabase] val pg = mock[PilotGrader] val crest = mock[CrestApi] val db = mock[EveMapDb] when(config.auth).thenReturn(authconfig) when(authconfig.groups).thenReturn(groupconfig) val blankPilot = Pilot(null, null, null, null, null, null, null, null, null, null) when(groupconfig.closed).thenReturn(List("admin")) when(groupconfig.open).thenReturn(List("dota")) when(ud.getAllUsers()).thenReturn( Seq( blankPilot.copy(corporation = "Love Squad", alliance = "Black Legion."), blankPilot.copy(corporation = "Blackwater USA Inc.", alliance = "Pandemic Legion") )) val app = new Webapp(config, pg, 9021, ud, crestapi = Some(crest), mapper = Some(db)) val res = app.dynamicWebRouter(Request(uri = Uri.uri("/ping/complete?term=black"))) val resp = res.run resp.status must equal(Ok) val bodytxt = EntityDecoder.decodeString(resp)(Charset.`UTF-8`).run bodytxt must equal("[\"Black Legion.\",\"Blackwater USA Inc.\"]") } }
xxpizzaxx/pizza-auth-3
src/test/scala/moe/pizza/auth/webapp/AutocompleteSpec.scala
Scala
mit
3,552
package org.bitcoins.core.protocol.script import org.bitcoins.core.util.BytesUtil import org.bitcoins.crypto.{ECDigitalSignature, ECPublicKey} import org.bitcoins.testkitcore.util.TestUtil import org.bitcoins.testkitcore.util.BitcoinSUnitTest import scodec.bits.ByteVector /** Created by chris on 2/17/16. */ class ScriptSignatureFactoryTest extends BitcoinSUnitTest { "ScriptSignatureFactory" must "give the exact same result whether parsing bytes or parsing hex" in { val signatureHex = "30450221008949f0cb400094ad2b5eb399d59d01c14d73d8fe6e96df1a7150deb388ab8935022079656090d7" + "f6bac4c9a94e0aad311a4268e082a725f8aeae0573fb12ff866a5f01" val signatureBytes: ByteVector = BytesUtil.decodeHex(signatureHex) val scriptSigFromHex = ScriptSignature(signatureHex) val scriptSigFromBytes = ScriptSignature(signatureBytes) scriptSigFromHex must be(scriptSigFromBytes) } it must "build a script signature from a digital signature and a public key" in { val digitalSignatureBytes = TestUtil.p2pkhInputScriptAsm(1).bytes val digitalSignature: ECDigitalSignature = ECDigitalSignature(digitalSignatureBytes) val publicKeyBytes = TestUtil.p2pkhInputScriptAsm(3).bytes val publicKey: ECPublicKey = ECPublicKey(publicKeyBytes) val actualScriptSig: ScriptSignature = P2PKHScriptSignature(digitalSignature, publicKey) actualScriptSig.asm must be(TestUtil.p2pkhInputScriptAsm) } it must "parse a p2pk scriptSignature from a raw scriptSig" in { val rawScriptSig = TestUtil.rawP2PKScriptSig val scriptSig = ScriptSignature(rawScriptSig) val result = scriptSig match { case _: P2PKScriptSignature => true case _ => false } result must be(true) } it must "parse a p2sh scriptSignature from a raw scriptSig" in { val result = TestUtil.p2shInputScript2Of2 match { case _: P2SHScriptSignature => true case y => throw new RuntimeException("Should be p2sh input: " + y) } result must be(true) } }
bitcoin-s/bitcoin-s
core-test/src/test/scala/org/bitcoins/core/protocol/script/ScriptSignatureFactoryTest.scala
Scala
mit
2,068
/* * Copyright 2010 LinkedIn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kafka.javaapi.consumer import junit.framework.Assert._ import kafka.zk.ZooKeeperTestHarness import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig import scala.collection._ import kafka.utils.Utils import kafka.utils.{TestZKUtils, TestUtils} import org.scalatest.junit.JUnit3Suite import scala.collection.JavaConversions._ import kafka.javaapi.message.ByteBufferMessageSet import kafka.consumer.{Consumer, ConsumerConfig, KafkaMessageStream, ConsumerTimeoutException} import javax.management.NotCompliantMBeanException import org.apache.log4j.{Level, Logger} import kafka.message.{NoCompressionCodec, DefaultCompressionCodec, CompressionCodec, Message} class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHarness with ZooKeeperTestHarness { private val logger = Logger.getLogger(getClass()) val zookeeperConnect = TestZKUtils.zookeeperConnect val zkConnect = zookeeperConnect val numNodes = 2 val numParts = 2 val topic = "topic1" val configs = for(props <- TestUtils.createBrokerConfigs(numNodes)) yield new KafkaConfig(props) { override val enableZookeeper = true override val numPartitions = numParts override val zkConnect = zookeeperConnect } val group = "group1" val consumer0 = "consumer0" val consumer1 = "consumer1" val consumer2 = "consumer2" val consumer3 = "consumer3" val nMessages = 2 def testBasic() { val requestHandlerLogger = Logger.getLogger(classOf[kafka.server.KafkaRequestHandlers]) requestHandlerLogger.setLevel(Level.FATAL) var actualMessages: List[Message] = Nil // test consumer timeout logic val consumerConfig0 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer0)) { override val consumerTimeoutMs = 200 } val zkConsumerConnector0 = new ZookeeperConsumerConnector(consumerConfig0, true) val topicMessageStreams0 = zkConsumerConnector0.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) try { getMessages(nMessages*2, topicMessageStreams0) fail("should get an exception") } catch { case e: ConsumerTimeoutException => // this is ok case e => throw e } zkConsumerConnector0.shutdown // send some messages to each broker val sentMessages1 = sendMessages(nMessages, "batch1") // create a consumer val consumerConfig1 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer1)) val zkConsumerConnector1 = new ZookeeperConsumerConnector(consumerConfig1, true) val topicMessageStreams1 = zkConsumerConnector1.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) val receivedMessages1 = getMessages(nMessages*2, topicMessageStreams1) assertEquals(sentMessages1, receivedMessages1) // commit consumed offsets zkConsumerConnector1.commitOffsets // create a consumer val consumerConfig2 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer2)) val zkConsumerConnector2 = new ZookeeperConsumerConnector(consumerConfig2, true) val topicMessageStreams2 = zkConsumerConnector2.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) // send some messages to each broker val sentMessages2 = sendMessages(nMessages, "batch2") Thread.sleep(200) val receivedMessages2_1 = getMessages(nMessages, topicMessageStreams1) val receivedMessages2_2 = getMessages(nMessages, topicMessageStreams2) val receivedMessages2 = (receivedMessages2_1 ::: receivedMessages2_2).sortWith((s,t) => s.checksum < t.checksum) assertEquals(sentMessages2, receivedMessages2) // create a consumer with empty map val consumerConfig3 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer3)) val zkConsumerConnector3 = new ZookeeperConsumerConnector(consumerConfig3, true) val topicMessageStreams3 = zkConsumerConnector3.createMessageStreams(toJavaMap(new mutable.HashMap[String, Int]())) // send some messages to each broker Thread.sleep(200) val sentMessages3 = sendMessages(nMessages, "batch3") Thread.sleep(200) val receivedMessages3_1 = getMessages(nMessages, topicMessageStreams1) val receivedMessages3_2 = getMessages(nMessages, topicMessageStreams2) val receivedMessages3 = (receivedMessages3_1 ::: receivedMessages3_2).sortWith((s,t) => s.checksum < t.checksum) assertEquals(sentMessages3, receivedMessages3) zkConsumerConnector1.shutdown zkConsumerConnector2.shutdown zkConsumerConnector3.shutdown logger.info("all consumer connectors stopped") requestHandlerLogger.setLevel(Level.ERROR) } def testCompression() { val requestHandlerLogger = Logger.getLogger(classOf[kafka.server.KafkaRequestHandlers]) requestHandlerLogger.setLevel(Level.FATAL) var actualMessages: List[Message] = Nil // test consumer timeout logic val consumerConfig0 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer0)) { override val consumerTimeoutMs = 200 } val zkConsumerConnector0 = new ZookeeperConsumerConnector(consumerConfig0, true) val topicMessageStreams0 = zkConsumerConnector0.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) try { getMessages(nMessages*2, topicMessageStreams0) fail("should get an exception") } catch { case e: ConsumerTimeoutException => // this is ok case e => throw e } zkConsumerConnector0.shutdown // send some messages to each broker val sentMessages1 = sendMessages(nMessages, "batch1", DefaultCompressionCodec) // create a consumer val consumerConfig1 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer1)) val zkConsumerConnector1 = new ZookeeperConsumerConnector(consumerConfig1, true) val topicMessageStreams1 = zkConsumerConnector1.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) val receivedMessages1 = getMessages(nMessages*2, topicMessageStreams1) assertEquals(sentMessages1, receivedMessages1) // commit consumed offsets zkConsumerConnector1.commitOffsets // create a consumer val consumerConfig2 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer2)) val zkConsumerConnector2 = new ZookeeperConsumerConnector(consumerConfig2, true) val topicMessageStreams2 = zkConsumerConnector2.createMessageStreams(toJavaMap(Predef.Map(topic -> numNodes*numParts/2))) // send some messages to each broker val sentMessages2 = sendMessages(nMessages, "batch2", DefaultCompressionCodec) Thread.sleep(200) val receivedMessages2_1 = getMessages(nMessages, topicMessageStreams1) val receivedMessages2_2 = getMessages(nMessages, topicMessageStreams2) val receivedMessages2 = (receivedMessages2_1 ::: receivedMessages2_2).sortWith((s,t) => s.checksum < t.checksum) assertEquals(sentMessages2, receivedMessages2) // create a consumer with empty map val consumerConfig3 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer3)) val zkConsumerConnector3 = new ZookeeperConsumerConnector(consumerConfig3, true) val topicMessageStreams3 = zkConsumerConnector3.createMessageStreams(toJavaMap(new mutable.HashMap[String, Int]())) // send some messages to each broker Thread.sleep(200) val sentMessages3 = sendMessages(nMessages, "batch3", DefaultCompressionCodec) Thread.sleep(200) val receivedMessages3_1 = getMessages(nMessages, topicMessageStreams1) val receivedMessages3_2 = getMessages(nMessages, topicMessageStreams2) val receivedMessages3 = (receivedMessages3_1 ::: receivedMessages3_2).sortWith((s,t) => s.checksum < t.checksum) assertEquals(sentMessages3, receivedMessages3) zkConsumerConnector1.shutdown zkConsumerConnector2.shutdown zkConsumerConnector3.shutdown logger.info("all consumer connectors stopped") requestHandlerLogger.setLevel(Level.ERROR) } def testCompressionSetConsumption() { val requestHandlerLogger = Logger.getLogger(classOf[kafka.server.KafkaRequestHandlers]) requestHandlerLogger.setLevel(Level.FATAL) var actualMessages: List[Message] = Nil // shutdown one server servers.last.shutdown Thread.sleep(500) // send some messages to each broker val sentMessages = sendMessages(configs.head, 200, "batch1", DefaultCompressionCodec) // test consumer timeout logic val consumerConfig0 = new ConsumerConfig( TestUtils.createConsumerProperties(zkConnect, group, consumer0)) { override val consumerTimeoutMs = 5000 } val zkConsumerConnector0 = new ZookeeperConsumerConnector(consumerConfig0, true) val topicMessageStreams0 = zkConsumerConnector0.createMessageStreams(toJavaMap(Predef.Map(topic -> 1))) getMessages(100, topicMessageStreams0) zkConsumerConnector0.shutdown // at this point, only some part of the message set was consumed. So consumed offset should still be 0 // also fetched offset should be 0 val zkConsumerConnector1 = new ZookeeperConsumerConnector(consumerConfig0, true) val topicMessageStreams1 = zkConsumerConnector1.createMessageStreams(toJavaMap(Predef.Map(topic -> 1))) val receivedMessages = getMessages(400, topicMessageStreams1) val sortedReceivedMessages = receivedMessages.sortWith((s,t) => s.checksum < t.checksum) val sortedSentMessages = sentMessages.sortWith((s,t) => s.checksum < t.checksum) assertEquals(sortedSentMessages, sortedReceivedMessages) zkConsumerConnector1.shutdown requestHandlerLogger.setLevel(Level.ERROR) } def sendMessages(conf: KafkaConfig, messagesPerNode: Int, header: String, compressed: CompressionCodec): List[Message]= { var messages: List[Message] = Nil val producer = kafka.javaapi.Implicits.toJavaSyncProducer(TestUtils.createProducer("localhost", conf.port)) for (partition <- 0 until numParts) { val ms = 0.until(messagesPerNode).map(x => new Message((header + conf.brokerId + "-" + partition + "-" + x).getBytes)).toArray val mSet = new ByteBufferMessageSet(compressionCodec = compressed, messages = getMessageList(ms: _*)) for (message <- ms) messages ::= message producer.send(topic, partition, mSet) } producer.close() messages } def sendMessages(messagesPerNode: Int, header: String, compressed: CompressionCodec = NoCompressionCodec): List[Message]= { var messages: List[Message] = Nil for(conf <- configs) { messages ++= sendMessages(conf, messagesPerNode, header, compressed) } messages.sortWith((s,t) => s.checksum < t.checksum) } def getMessages(nMessagesPerThread: Int, jTopicMessageStreams: java.util.Map[String, java.util.List[KafkaMessageStream]]) : List[Message]= { var messages: List[Message] = Nil val topicMessageStreams = asMap(jTopicMessageStreams) for ((topic, messageStreams) <- topicMessageStreams) { for (messageStream <- messageStreams) { val iterator = messageStream.iterator for (i <- 0 until nMessagesPerThread) { assertTrue(iterator.hasNext) val message = iterator.next messages ::= message logger.debug("received message: " + Utils.toString(message.payload, "UTF-8")) } } } messages.sortWith((s,t) => s.checksum < t.checksum) } def testJMX() { val consumerConfig = new ConsumerConfig(TestUtils.createConsumerProperties(zkConnect, group, consumer0)) try { val consumer = Consumer.createJavaConsumerConnector(consumerConfig) }catch { case e: NotCompliantMBeanException => fail("Should not fail with NotCompliantMBeanException") } } private def getMessageList(messages: Message*): java.util.List[Message] = { val messageList = new java.util.ArrayList[Message]() messages.foreach(m => messageList.add(m)) messageList } private def toJavaMap(scalaMap: Map[String, Int]): java.util.Map[String, java.lang.Integer] = { val javaMap = new java.util.HashMap[String, java.lang.Integer]() scalaMap.foreach(m => javaMap.put(m._1, m._2.asInstanceOf[java.lang.Integer])) javaMap } }
tcrayford/hafka
kafka/core/src/test/scala/unit/kafka/javaapi/consumer/ZookeeperConsumerConnectorTest.scala
Scala
bsd-3-clause
12,955
package com.github.dwiechert.scala.tinyweb class TinyWeb(controllers: Map[String, Controller], filters: List[(HttpRequest) => HttpRequest]) { def handleRequest(httpRequest: HttpRequest): Option[HttpResponse] = { val composedFilter = filters.reverse.reduceLeft((composed, next) => composed.compose(next)) val filteredRequest = composedFilter(httpRequest) val controllerOption = controllers.get(filteredRequest.path) controllerOption.map(controller => controller.handleRequest(filteredRequest)) } }
DWiechert/functional-programming-patterns
src/main/scala/com/github/dwiechert/scala/tinyweb/TinyWeb.scala
Scala
apache-2.0
517
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cloudera.spark.cloud.s3.commit import com.cloudera.spark.cloud.GeneralCommitterConstants import com.cloudera.spark.cloud.s3.{S3ACommitterConstants, S3AOperations, S3ATestSetup} import com.cloudera.spark.cloud.s3.S3ACommitterConstants._ import org.apache.hadoop.fs.Path import org.apache.hadoop.fs.s3a.S3AFileSystem import org.apache.spark.sql.{Dataset, SaveMode, SparkSession} import org.apache.spark.sql.internal.SQLConf /** * Tests around the partitioned committer and its conflict resolution. */ class S3APartitionedCommitterSuite extends AbstractS3ACommitterSuite with S3ATestSetup { private var destFS: S3AFileSystem = _ private var destDir: Path = _ init() def init(): Unit = { // propagate S3 credentials if (enabled) { initFS() destFS = filesystem.asInstanceOf[S3AFileSystem] destDir = testPath(destFS, "partitioned-committer") } } private val formats = Seq( "orc", "parquet", "" ) private val modes = Seq( "append", "replace", "" ) nonEmpty(formats).foreach { format => nonEmpty(modes).foreach{ mode => ctest(s"Write $format-$mode", s"Write a partitioned dataframe in format $format with conflict mode $mode") { testOneWriteSequence( new Path(destDir, s"$format/$mode"), format, PARTITIONED, mode, mode == "append") } } } /** * Test one write sequence. * @param destDir destination * @param format output format * @param committerName committer name to use * @param confictMode how to deal with conflict * @param expectAppend should the output be expected to be appended or overwritten */ def testOneWriteSequence( destDir: Path, format: String, committerName: String, confictMode: String, expectAppend: Boolean): Unit = { val local = getLocalFS val sparkConf = newSparkConf("DataFrames", local.getUri) val committerInfo = COMMITTERS_BY_NAME(committerName) committerInfo.bind(sparkConf) logInfo(s"Using committer binding $committerInfo with conflict mode $confictMode" + s" writing $format data") hconf(sparkConf, S3ACommitterConstants.CONFLICT_MODE, confictMode) hconf(sparkConf, REJECT_FILE_OUTPUT, true) // force failfast hconf(sparkConf, GeneralCommitterConstants.FILEOUTPUTCOMMITTER_ALGORITHM_VERSION, 3) // validate the conf by asserting that the spark conf is bonded // to the partitioned committer. assert( GeneralCommitterConstants.BINDING_PARQUET_OUTPUT_COMMITTER_CLASS === sparkConf.get(SQLConf.PARQUET_OUTPUT_COMMITTER_CLASS.key), s"wrong value of ${SQLConf.PARQUET_OUTPUT_COMMITTER_CLASS}") // uncomment to fail factory operations and see where they happen // sparkConf.set(SQLConf.PARQUET_OUTPUT_COMMITTER_CLASS.key, "unknown") val dest = new Path(destDir, format) rm(destFS, dest) val spark = SparkSession .builder .config(sparkConf) .enableHiveSupport .getOrCreate() // ignore the IDE if it complains: this *is* used. import spark.implicits._ // Write the DS. Configure save mode so the committer gets // to decide how to react to invidual partitions, rather than // have the entire directory tree determine the outcome. def writeDS(sourceData: Dataset[Event]): Unit = { logDuration(s"write to $dest in format $format conflict = $confictMode") { sourceData .write .partitionBy("year", "month") .mode(SaveMode.Append) .format(format) .save(dest.toString) } } try { val sc = spark.sparkContext val conf = sc.hadoopConfiguration val numPartitions = 2 val eventData = Events.events(2017, 2017, 1, 2, 10).toDS() val origFileCount = Events.monthCount(2017, 2017, 1, 2) * numPartitions val sourceData = eventData.repartition(numPartitions).cache() sourceData.printSchema() val eventCount = sourceData.count() logInfo(s"${eventCount} elements") sourceData.show(10) val numRows = eventCount writeDS(sourceData) val operations = new S3AOperations(destFS) val stats = operations.getStorageStatistics() logDebug(s"Statistics = \\n" + stats.mkString(" ", " = ", "\\n")) operations.maybeVerifyCommitter(dest, Some(committerName), Some(committerInfo), conf, Some(origFileCount), s"$format:") // read back results and verify they match validateRowCount(spark, destFS, dest, format, numRows) // now for the real fun: write into a subdirectory alongside the others val newPartition = Events.events(2017, 2017, 10, 12, 10).toDS() val newFileCount = Events.monthCount(2017, 2017, 10, 12) writeDS(newPartition) operations.maybeVerifyCommitter(dest, Some(committerName), Some(committerInfo), conf, Some(newFileCount), s"$format:") // now list the files under the system val currentFileCount = newFileCount + origFileCount assertFileCount(currentFileCount, destFS, dest) // then write atop the existing files. // here the failure depends on what the policy was writeDS(newPartition) operations.maybeVerifyCommitter(dest, Some(committerName), Some(committerInfo), conf, Some(newFileCount), s"$format:") val finalCount = currentFileCount + (if (expectAppend) newFileCount else 0) assertFileCount(finalCount, destFS, dest) } finally { spark.close() } } }
hortonworks-spark/cloud-integration
cloud-examples/src/test/scala/com/cloudera/spark/cloud/s3/commit/S3APartitionedCommitterSuite.scala
Scala
apache-2.0
6,469
package composition.webserviceclients.vrmretentioneligibility import com.tzavellas.sse.guice.ScalaModule import composition.webserviceclients.vrmretentioneligibility.Helper.createResponse import org.mockito.Matchers.any import org.mockito.Mockito.when import org.scalatest.mock.MockitoSugar import play.api.http.Status.OK import scala.concurrent.Future import uk.gov.dvla.vehicles.presentation.common.clientsidesession.TrackingId import webserviceclients.vrmretentioneligibility.VRMRetentionEligibilityRequest import webserviceclients.vrmretentioneligibility.VRMRetentionEligibilityResponse import webserviceclients.vrmretentioneligibility.VRMRetentionEligibilityResponseDto import webserviceclients.vrmretentioneligibility.VRMRetentionEligibilityWebService final class EligibilityWebServiceCallWithCurrentAndEmptyReplacement() extends ScalaModule with MockitoSugar { val withCurrentAndEmptyReplacement: (Int, VRMRetentionEligibilityResponseDto) = { (OK, VRMRetentionEligibilityResponseDto( None, VRMRetentionEligibilityResponse( currentVRM = "stub-currentVRM", replacementVRM = None )) ) } val stub = { val webService = mock[VRMRetentionEligibilityWebService] when(webService.invoke(any[VRMRetentionEligibilityRequest], any[TrackingId])) .thenReturn(Future.successful(createResponse(withCurrentAndEmptyReplacement))) webService } def configure() = bind[VRMRetentionEligibilityWebService].toInstance(stub) }
dvla/vrm-retention-online
test/composition/webserviceclients/vrmretentioneligibility/EligibilityWebServiceCallWithCurrentAndEmptyReplacement.scala
Scala
mit
1,482
/* import io.netty.bootstrap.Bootstrap import io.netty.channel.nio.NioEventLoopGroup import io.netty.channel.socket.nio.NioDatagramChannel import io.netty.channel._ import io.netty.channel.socket.DatagramPacket import io.netty.handler.codec.MessageToMessageDecoder import java.net.InetSocketAddress import java.util.Date import org.gateway.Order val group = new NioEventLoopGroup(); try { val bootstrap = new Bootstrap bootstrap.group(group) .channel(classOf[NioDatagramChannel]) .option(ChannelOption.SO_BROADCAST, java.lang.Boolean.TRUE) .handler(new ChannelInitializer[Channel]() { override def initChannel(channel: Channel) { val pipeline: ChannelPipeline = channel.pipeline() pipeline.addLast(new LogEventDecoder()) pipeline.addLast(new LogEventHandler()) } }).localAddress(new InetSocketAddress(9090)) val channel = bootstrap.bind().syncUninterruptibly().channel() println("Server started") channel.closeFuture().await() } finally { group.shutdownGracefully().sync() println("Server stopped") } class LogEventDecoder extends MessageToMessageDecoder[DatagramPacket] { override def decode(ctx: ChannelHandlerContext, packet: DatagramPacket, out: java.util.List[Object]){ val byteBuf = packet.content() val bytes = new Array[Byte](byteBuf.readableBytes()) byteBuf.getBytes(0, bytes) val order = Order.decode(bytes) out.add((order, System.currentTimeMillis())) } override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) { cause.printStackTrace(); ctx.close(); } } class LogEventHandler extends SimpleChannelInboundHandler[(Order, Long)] { override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) { cause.printStackTrace(); ctx.close(); } override def channelRead0(ctx: ChannelHandlerContext, order: (Order, Long)) { val builder = new StringBuilder(); builder.append(" ["); builder.append(new Date(order._2)); builder.append("] ["); builder.append(order._1); builder.append("] : "); println(builder.toString()); } } */
haghard/gateway-server
perf-test/broadcast-monitor.scala
Scala
apache-2.0
2,112
package me.breidenbach.scalauth import me.breidenbach.scalauth.identifier.ScauthIdentifier /** * Date: 1/19/14 * Time: 8:29 PM * Copyright 2014 Kevin E. Breidenbach * @author Kevin E. Breidenbach */ trait UserService[T <: ScauthIdentifier] { def save(identifier: ScauthIdentifier): Either[T, Error] def find(id: Int): Option[T] def find(username: String): Option[T] def findByEmail(email: String): Option[T] } object UserService extends UserService[ScauthIdentifier] { override def save(identifier: ScauthIdentifier): Either[ScauthIdentifier, Error] = { Right(new Error()) } override def find(id: Int): Option[ScauthIdentifier] = { None } override def find(username: String): Option[ScauthIdentifier] = { None } override def findByEmail(email: String): Option[ScauthIdentifier] = { None } }
kbreidenbach/scalauth
src/main/scala/me/breidenbach/scalauth/UserService.scala
Scala
mit
843
package com.twitter.finatra.json.internal.streaming import com.twitter.finatra.conversions.bytebuffer._ import com.twitter.inject.Test import com.twitter.io.Buf class ByteBufferUtilsTest extends Test { "ByteBufferUtils.append" in { val input = Buf.ByteBuffer.Shared.extract(Buf.Utf8("1")) input.get() val byteBufferResult = ByteBufferUtils.append( input, Buf.Utf8(",2")) byteBufferResult.utf8str should equal("1,2") } }
deanh/finatra
jackson/src/test/scala/com/twitter/finatra/json/internal/streaming/ByteBufferUtilsTest.scala
Scala
apache-2.0
456
/* * Scala.js (https://www.scala-js.org/) * * Copyright EPFL. * * Licensed under Apache License 2.0 * (https://www.apache.org/licenses/LICENSE-2.0). * * See the NOTICE file distributed with this work for * additional information regarding copyright ownership. */ package org.scalajs.testsuite.javalib.io import java.io._ /** A ByteArrayOutputStream that exposes various hooks for testing purposes. */ class MockByteArrayOutputStream extends ByteArrayOutputStream { private var _flushed: Boolean = true private var _closed: Boolean = false var throwing: Boolean = false def flushed: Boolean = _flushed def closed: Boolean = _closed private def maybeThrow(): Unit = { if (throwing) throw new IOException("MockByteArrayOutputStream throws") } private def writeOp[A](op: => A): A = { maybeThrow() _flushed = false op } override def flush(): Unit = { maybeThrow() super.flush() _flushed = true } override def close(): Unit = { maybeThrow() super.close() _closed = true } override def write(c: Int): Unit = writeOp(super.write(c)) override def write(b: Array[Byte]): Unit = writeOp(super.write(b)) override def write(b: Array[Byte], off: Int, len: Int): Unit = writeOp(super.write(b, off, len)) }
scala-js/scala-js
test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/io/MockByteArrayOutputStream.scala
Scala
apache-2.0
1,303
/*********************************************************************** * Copyright (c) 2013-2019 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at * http://www.opensource.org/licenses/apache2.0.php. ***********************************************************************/ package org.locationtech.geomesa.kudu.spark import org.apache.hadoop.conf.Configuration import org.apache.hadoop.io.NullWritable import org.apache.hadoop.mapred.JobConf import org.apache.spark.SparkContext import org.apache.spark.rdd.RDD import org.geotools.data.{Query, Transaction} import org.locationtech.geomesa.index.conf.QueryHints import org.locationtech.geomesa.index.planning.QueryPlanner import org.locationtech.geomesa.kudu.data.{KuduDataStore, KuduDataStoreFactory} import org.locationtech.geomesa.spark.{DataStoreConnector, SpatialRDD, SpatialRDDProvider} import org.locationtech.geomesa.utils.geotools.FeatureUtils import org.locationtech.geomesa.utils.io.WithClose import org.opengis.feature.simple.SimpleFeature class KuduSpatialRDDProvider extends SpatialRDDProvider { override def canProcess(params: java.util.Map[String, _ <: java.io.Serializable]): Boolean = KuduDataStoreFactory.canProcess(params) override def rdd(conf: Configuration, sc: SparkContext, params: Map[String, String], query: Query): SpatialRDD = { import org.locationtech.geomesa.index.conf.QueryHints.RichHints val ds = DataStoreConnector[KuduDataStore](params) // force loose bbox to be false query.getHints.put(QueryHints.LOOSE_BBOX, false) // get the query plan to set up the iterators, ranges, etc lazy val sft = ds.getSchema(query.getTypeName) lazy val transform = { QueryPlanner.setQueryTransforms(query, sft) query.getHints.getTransformSchema } if (ds == null || sft == null) { SpatialRDD(sc.emptyRDD[SimpleFeature], transform.getOrElse(sft)) } else { val jobConf = new JobConf(conf) GeoMesaKuduInputFormat.configure(jobConf, params, query) GeoMesaKuduInputFormat.addCredentials(jobConf, ds.client) val rdd = sc.newAPIHadoopRDD(jobConf, classOf[GeoMesaKuduInputFormat], classOf[NullWritable], classOf[SimpleFeature]).map(_._2) SpatialRDD(rdd, transform.getOrElse(sft)) } } override def save(rdd: RDD[SimpleFeature], params: Map[String, String], typeName: String): Unit = { val ds = DataStoreConnector[KuduDataStore](params) require(ds.getSchema(typeName) != null, "Feature type must exist before calling save. Call `createSchema` on the DataStore first.") unsafeSave(rdd, params, typeName) } /** * Writes this RDD to a GeoMesa table. * The type must exist in the data store, and all of the features in the RDD must be of this type. * This method assumes that the schema exists. * * @param rdd rdd * @param params data store connection parameters * @param typeName feature type name */ def unsafeSave(rdd: RDD[SimpleFeature], params: Map[String, String], typeName: String): Unit = { rdd.foreachPartition { iter => val ds = DataStoreConnector[KuduDataStore](params) WithClose(ds.getFeatureWriterAppend(typeName, Transaction.AUTO_COMMIT)) { writer => iter.foreach(FeatureUtils.write(writer, _, useProvidedFid = true)) } } } }
elahrvivaz/geomesa
geomesa-kudu/geomesa-kudu-spark/src/main/scala/org/locationtech/geomesa/kudu/spark/KuduSpatialRDDProvider.scala
Scala
apache-2.0
3,496
package scalaxy.streams package test import org.junit._ import org.junit.Assert._ class TransformationClosureTest extends StreamComponentsTestBase with TransformationClosures { import global._ @Test def testNoOpTuple2 { val f = typecheck(q""" (p: (Int, Int)) => p match { case pp @ (x, y) => (x, y) } """) val SomeTransformationClosure( tc @ TransformationClosure( TupleValue( _, inputValues, Some(S("pp")), true), Nil, TupleValue( _, outputValues, None, false), closureSymbol)) = f val List( (0, ScalarValue(_, None, Some(S("x")))), (1, ScalarValue(_, None, Some(S("y"))))) = inputValues.toList assertEquals(inputValues, outputValues) val List() = tc.getPreviousReferencedPaths(Set()).toList } @Test def testTupleAliasRef { val f = typecheck(q""" (p: (Int, Int)) => p match { case pp @ (x, y) => println(pp) (x, y) } """) val SomeTransformationClosure(tc) = f val List(RootTuploidPath) = tc.getPreviousReferencedPaths(Set()).toList } @Test def testNoOpScalar { val f = typecheck(q"(x: Int) => x") val SomeTransformationClosure( tc @ TransformationClosure(inputs, statements, outputs, closureSymbol)) = f val ScalarValue(_, None, Some(S("x"))) = inputs val ScalarValue(_, None, Some(S("x"))) = outputs } @Test def testScalarToPrintln { val f = typecheck(q"(x: Int) => println(x)") val SomeTransformationClosure( tc @ TransformationClosure(inputs, statements, outputs, closureSymbol)) = f val ScalarValue(_, None, Some(S("x"))) = inputs val ScalarValue(_, Some(q"${Predef()}.println(x)"), None) = outputs } @Test def testScalarToTuple { val f = typecheck(q"(x: Int) => (1, x)") val SomeTransformationClosure( tc @ TransformationClosure(inputs, statements, outputs, closureSymbol)) = f val ScalarValue(_, None, Some(S("x"))) = inputs val TupleValue( _, values, None, false) = outputs val List( (0, ScalarValue(_, Some(Literal(Constant(1))), None)), (1, ScalarValue(_, None, Some(S("x"))))) = values.toList val List() = tc.getPreviousReferencedPaths(Set()).toList } @Test def testScalarToTuple2 { val f = typecheck(q"(x: Int) => (x, x)") val SomeTransformationClosure( tc @ TransformationClosure(inputs, statements, outputs, closureSymbol)) = f val ScalarValue(_, None, Some(S("x"))) = inputs val TupleValue( _, values, None, false) = outputs val List( (0, ScalarValue(_, None, Some(S("x")))), (1, ScalarValue(_, None, Some(S("x"))))) = values.toList val List() = tc.getPreviousReferencedPaths(Set()).toList } @Test def tupleMappedToTuple { val f = typecheck(q""" (x2: (Int, Int)) => (x2: (Int, Int) @unchecked) match { case (x1 @ ((v @ _), (i @ _))) => { val c: Int = i.+(2); scala.Tuple2.apply[(Int, Int), Int]((v, i), c) } } """) val SomeTransformationClosure(tc) = f // println(tc) } @Test def scalarMappedToTuple { val f = typecheck(q""" (array: Array[Int]) => { val length: Int = array.length.*(30); scala.Tuple2.apply[Array[Int], Int](array, length) } """) val SomeTransformationClosure(tc) = f // println(tc) } @Test def simple3Tuple { val f = typecheck(q""" ((t: ((Int, Int), Int)) => (t: ((Int, Int), Int) @unchecked) match { case (((x @ (_: Int)), (y @ (_: Int))), (i @ (_: Int))) => (x + y) % 2 == 0 }) """) val SomeTransformationClosure(tc) = f val TransformationClosure(inputs, statements, outputs, closureSymbol) = tc val IntTpe = typeOf[Int] val IntIntTpe = typeOf[(Int, Int)] val IntIntIntTpe = typeOf[((Int, Int), Int)] val TupleValue(IntIntIntTpe, inputValues, None, true) = inputs val Seq(0, 1) = inputValues.keys.toSeq.sorted val TupleValue(IntIntTpe, subInputValues, None, true) = inputValues(0) val Seq(0, 1) = subInputValues.keys.toSeq.sorted val ScalarValue(IntTpe, _, Some(S("i"))) = inputValues(1) val ScalarValue(IntTpe, _, Some(S("x"))) = subInputValues(0) val ScalarValue(IntTpe, _, Some(S("y"))) = subInputValues(1) } /** val f = toolbox.typecheck(q""" (x2: (Int, Int)) => (x2: (Int, Int) @unchecked) match { case (x1 @ ((v @ _), (i @ _))) => { val c: Int = i.+(2); scala.Tuple2.apply[(Int, Int), Int]((v, i), c) } } """) val f = toolbox.typecheck(q""" (array: Array[Int]) => { val length: Int = array.length.*(30); scala.Tuple2.apply[Array[Int], Int](array, length) } """) */ }
nativelibs4java/scalaxy-streams
src/test/scala/matchers/TransformationClosuresTest.scala
Scala
bsd-3-clause
4,923
package sbt package dependencygraph object DependencyGraphSbtCompat { object Implicits }
jrudolph/sbt-dependency-graph
src/main/scala-sbt-1.0/sbt/dependencygraph/DependencyGraphSbtCompat.scala
Scala
apache-2.0
92
package com.thetestpeople.trt.jenkins.trigger import org.junit.runner.RunWith import org.scalatest._ import org.scalatest.junit.JUnitRunner import com.thetestpeople.trt.model.QualifiedName @RunWith(classOf[JUnitRunner]) class MavenParamHelperTest extends FlatSpec with ShouldMatchers { "A single test from a single class" should "work" in { mavenTestNames(QualifiedName("testMethod", "com.example.Test")) should equal( "com.example.Test#testMethod") } "Multiple tests from a single class" should "work" in { mavenTestNames( QualifiedName("testMethod1", "com.example.Test"), QualifiedName("testMethod2", "com.example.Test")) should equal( "com.example.Test#testMethod1+testMethod2") } "Tests from multiple classes" should "work" in { mavenTestNames( QualifiedName("testMethod1", "com.example.Test1"), QualifiedName("testMethod2", "com.example.Test2")) should equal( "com.example.Test1#testMethod1,com.example.Test2#testMethod2") } private def mavenTestNames(testNames: QualifiedName*): String = MavenParamHelper.mavenTestNames(testNames.toList) }
thetestpeople/trt
test/com/thetestpeople/trt/jenkins/trigger/MavenParamHelperTest.scala
Scala
mit
1,128
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package com.jspha.maia.examples.api1 import com.jspha.maia._ import cats.Id final case class Location[F <: Dsl]( latitude: F#Atom[Double], longitude: F#Atom[Double] ) object Location { def fetchConst(latitude: Double, longitude: Double): Handler[Id, Location] = Location[form.Handler[Id]]( latitude = latitude, longitude = longitude ) val req0: Request[Location] = typelevel.NullRequest[Location] val q: QueriesAt[Location] = typelevel.GetQueriesAt[Location] def runner(req: Request[Location]): Response[Location] = typelevel.RunHandler[Id, Location](fetchConst(0, 0), req) }
MaiaOrg/scala-maia
maia/src/test/scala-2.12/com/jspha/maia/examples/api1/Location.scala
Scala
mpl-2.0
834
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.ml.regression import org.apache.spark.annotation.Experimental import org.apache.spark.ml.{PredictionModel, Predictor} import org.apache.spark.ml.param.ParamMap import org.apache.spark.ml.tree.{DecisionTreeModel, RandomForestParams, TreeEnsembleModel, TreeRegressorParams} import org.apache.spark.ml.tree.impl.RandomForest import org.apache.spark.ml.util.{Identifiable, MetadataUtils} import org.apache.spark.mllib.linalg.Vector import org.apache.spark.mllib.regression.LabeledPoint import org.apache.spark.mllib.tree.configuration.{Algo => OldAlgo} import org.apache.spark.mllib.tree.model.{RandomForestModel => OldRandomForestModel} import org.apache.spark.rdd.RDD import org.apache.spark.sql.DataFrame import org.apache.spark.sql.functions._ /** * :: Experimental :: * [[http://en.wikipedia.org/wiki/Random_forest Random Forest]] learning algorithm for regression. * It supports both continuous and categorical features. */ @Experimental final class RandomForestRegressor(override val uid: String) extends Predictor[Vector, RandomForestRegressor, RandomForestRegressionModel] with RandomForestParams with TreeRegressorParams { def this() = this(Identifiable.randomUID("rfr")) // Override parameter setters from parent trait for Java API compatibility. // Parameters from TreeRegressorParams: override def setMaxDepth(value: Int): this.type = super.setMaxDepth(value) override def setMaxBins(value: Int): this.type = super.setMaxBins(value) override def setMinInstancesPerNode(value: Int): this.type = super.setMinInstancesPerNode(value) override def setMinInfoGain(value: Double): this.type = super.setMinInfoGain(value) override def setMaxMemoryInMB(value: Int): this.type = super.setMaxMemoryInMB(value) override def setCacheNodeIds(value: Boolean): this.type = super.setCacheNodeIds(value) override def setCheckpointInterval(value: Int): this.type = super.setCheckpointInterval(value) override def setImpurity(value: String): this.type = super.setImpurity(value) // Parameters from TreeEnsembleParams: override def setSubsamplingRate(value: Double): this.type = super.setSubsamplingRate(value) override def setSeed(value: Long): this.type = super.setSeed(value) // Parameters from RandomForestParams: override def setNumTrees(value: Int): this.type = super.setNumTrees(value) override def setFeatureSubsetStrategy(value: String): this.type = super.setFeatureSubsetStrategy(value) override protected def train(dataset: DataFrame): RandomForestRegressionModel = { val categoricalFeatures: Map[Int, Int] = MetadataUtils.getCategoricalFeatures(dataset.schema($(featuresCol))) val oldDataset: RDD[LabeledPoint] = extractLabeledPoints(dataset) val strategy = super.getOldStrategy(categoricalFeatures, numClasses = 0, OldAlgo.Regression, getOldImpurity) val trees = RandomForest.run(oldDataset, strategy, getNumTrees, getFeatureSubsetStrategy, getSeed) .map(_.asInstanceOf[DecisionTreeRegressionModel]) val numFeatures = oldDataset.first().features.size new RandomForestRegressionModel(trees, numFeatures) } override def copy(extra: ParamMap): RandomForestRegressor = defaultCopy(extra) } @Experimental object RandomForestRegressor { /** Accessor for supported impurity settings: variance */ final val supportedImpurities: Array[String] = TreeRegressorParams.supportedImpurities /** Accessor for supported featureSubsetStrategy settings: auto, all, onethird, sqrt, log2 */ final val supportedFeatureSubsetStrategies: Array[String] = RandomForestParams.supportedFeatureSubsetStrategies } /** * :: Experimental :: * [[http://en.wikipedia.org/wiki/Random_forest Random Forest]] model for regression. * It supports both continuous and categorical features. * @param _trees Decision trees in the ensemble. * @param numFeatures Number of features used by this model */ @Experimental final class RandomForestRegressionModel private[ml] ( override val uid: String, private val _trees: Array[DecisionTreeRegressionModel], override val numFeatures: Int) extends PredictionModel[Vector, RandomForestRegressionModel] with TreeEnsembleModel with Serializable { require(numTrees > 0, "RandomForestRegressionModel requires at least 1 tree.") /** * Construct a random forest regression model, with all trees weighted equally. * @param trees Component trees */ private[ml] def this(trees: Array[DecisionTreeRegressionModel], numFeatures: Int) = this(Identifiable.randomUID("rfr"), trees, numFeatures) override def trees: Array[DecisionTreeModel] = _trees.asInstanceOf[Array[DecisionTreeModel]] // Note: We may add support for weights (based on tree performance) later on. private lazy val _treeWeights: Array[Double] = Array.fill[Double](numTrees)(1.0) override def treeWeights: Array[Double] = _treeWeights override protected def transformImpl(dataset: DataFrame): DataFrame = { val bcastModel = dataset.sqlContext.sparkContext.broadcast(this) val predictUDF = udf { (features: Any) => bcastModel.value.predict(features.asInstanceOf[Vector]) } dataset.withColumn($(predictionCol), predictUDF(col($(featuresCol)))) } override protected def predict(features: Vector): Double = { // TODO: When we add a generic Bagging class, handle transform there. SPARK-7128 // Predict average of tree predictions. // Ignore the weights since all are 1.0 for now. _trees.map(_.rootNode.predictImpl(features).prediction).sum / numTrees } override def copy(extra: ParamMap): RandomForestRegressionModel = { copyValues(new RandomForestRegressionModel(uid, _trees, numFeatures), extra).setParent(parent) } override def toString: String = { s"RandomForestRegressionModel (uid=$uid) with $numTrees trees" } /** * Estimate of the importance of each feature. * * This generalizes the idea of "Gini" importance to other losses, * following the explanation of Gini importance from "Random Forests" documentation * by Leo Breiman and Adele Cutler, and following the implementation from scikit-learn. * * This feature importance is calculated as follows: * - Average over trees: * - importance(feature j) = sum (over nodes which split on feature j) of the gain, * where gain is scaled by the number of instances passing through node * - Normalize importances for tree based on total number of training instances used * to build tree. * - Normalize feature importance vector to sum to 1. */ lazy val featureImportances: Vector = RandomForest.featureImportances(trees, numFeatures) /** (private[ml]) Convert to a model in the old API */ private[ml] def toOld: OldRandomForestModel = { new OldRandomForestModel(OldAlgo.Regression, _trees.map(_.toOld)) } } private[ml] object RandomForestRegressionModel { /** (private[ml]) Convert a model from the old API */ def fromOld( oldModel: OldRandomForestModel, parent: RandomForestRegressor, categoricalFeatures: Map[Int, Int], numFeatures: Int = -1): RandomForestRegressionModel = { require(oldModel.algo == OldAlgo.Regression, "Cannot convert RandomForestModel" + s" with algo=${oldModel.algo} (old API) to RandomForestRegressionModel (new API).") val newTrees = oldModel.trees.map { tree => // parent for each tree is null since there is no good way to set this. DecisionTreeRegressionModel.fromOld(tree, null, categoricalFeatures) } new RandomForestRegressionModel(parent.uid, newTrees, numFeatures) } }
pronix/spark
mllib/src/main/scala/org/apache/spark/ml/regression/RandomForestRegressor.scala
Scala
apache-2.0
8,443
package se.culvertsoft.mgen.compiler.util import scala.language.implicitConversions object SourceCodeBuffer { implicit def SourceCodeBuffer2String(s: SourceCodeBuffer) = s.toString private val cachedInstances = new ThreadLocal[SourceCodeBuffer] { override def initialValue(): SourceCodeBuffer = { new SourceCodeBuffer } } def getThreadLocal(): SourceCodeBuffer = { cachedInstances.get() } } class SourceCodeBuffer( val scopeBegin: String = " {", val scopeEnd: String = "}") { private var tabString = "\t" private val buffer = new java.lang.StringBuilder(10 * 1024) private var _tabLevel = 0 def tabLevel() = { _tabLevel } def setTabLevel(t: Int) = { _tabLevel = t } def tabs(n: Int) = { for (i <- 0 until n) buffer.append(tabString) this } def endl(): SourceCodeBuffer = { buffer.append('\n') this } def setTabString(s: String) = { tabString = s } def backingBuffer() = buffer def endl2() = { buffer.append('\n').append('\n'); this } def text(s: String) = { buffer.append(s); this } def +=(s: String): SourceCodeBuffer = { this.text(s) } def textln(s: String = "") = { buffer.append(s).append('\n'); this } def function(name: String)(params: String = "") = { buffer.append(name).append('(').append(params).append(')'); this } def paranthBegin() = { buffer.append('('); this } def paranthEnd() = { buffer.append(')'); this } def braceBegin() = { buffer.append('{'); this } def braceEnd() = { buffer.append('}'); this } def comma() = { buffer.append(','); this } def commaSpace() = { buffer.append(", "); this } def tag(inside: String) = { text(s"<$inside>"); this } def tagEnd(inside: String) = { tag("/" + inside); this } def clear() = { buffer.setLength(0); this } def char(c: Char) = { buffer.append(c); this } def size() = buffer.length() def length() = size() def removeLast(size: Int) = { buffer.setLength(buffer.length() - size); this } def apply[A](f: => A) { try { _tabLevel += 1 f } finally { _tabLevel -= 1 } } override def toString = buffer.toString }
culvertsoft/mgen
mgen-compiler/src/main/scala/se/culvertsoft/mgen/compiler/util/SourceCodeBuffer.scala
Scala
mit
2,128
package crea.nlp import scala.xml.XML import scala.xml.Elem import scala.util.Random import scalaz._ import scalaz.concurrent._ import scala.concurrent.duration._ import scalaz.stream._ import Scalaz._ import java.io.{PrintStream, OutputStream} import java.util.Date import java.text.SimpleDateFormat import epic.preprocess.MLSentenceSegmenter import org.log4s._ import twitter4j._ import Terms._ object Pubmed { private[this] implicit val scheduler = scalaz.stream.DefaultScheduler private[this] implicit val logger = org.log4s.getLogger final case class Row(pmid : String, subject : String, predicate : String, obj : String, term : String, timestamp : Long) { def toCSV : String = s""""${pmid}","${predicate}","${subject}","${obj}","${term}","${timestamp}"\\n""" def toTweet : String = s"""True or false? ${predicate}(${hashtag(subject)}, ${hashtag(obj)}) ${url} ${hashtag(term)}""" def toJSON : String = s"""{"pmid":"${pmid}","predicate":"${predicate}","subject":"${subject}","obj":"${obj}","term":"${term}","timestamp":"${timestamp}"}""" private[this] lazy val url : String = Bitly(s"http://www.ncbi.nlm.nih.gov/pubmed/${pmid}").or(Task.now("")).run private[this] def hashtag(s : String) = { val ret = s.replaceAll("\\\\W", " ") .split(" ") .map(_.capitalize) .mkString("") if(ret.matches("""^\\d+$""")) { ret } else { "#" + ret } } } private[this] val bufferSize = 128 private[this] val whitelist = List("increase", "decrease", "upregulate", "downregulate", "regulate", "encode", "decode", "secrete", "block", "activate", "inhibit", "trigger", "signal", "induce", "transmit", "cause", "treat", "prevent", "interact", "suppress", "mediate", "respond", "translate", "approve", "link", "correlate", "inject", "release", "express", "bind", "stimulate") private[this] val t = async.topic[String]() def apply(file : String) : Task[Unit] = { val fileIn = nondeterminism.njoin(maxOpen = 10, maxQueued = 4)(io.linesR(file).map(search)) val src = Web.in.merge(IRC.in).merge(fileIn) logger.debug("Begin reading relations.") src.observe(Log.info.contramap(_.toCSV)) .filter(row => whitelist.contains(row.predicate)) .observe(Twitter.out.contramap(_.toTweet)) .observe(t.publish.contramap(_.toJSON)) .map(_.toCSV) .pipe(text.utf8Encode) .to(io.fileChunkW(s"${System.currentTimeMillis}.csv", bufferSize)) .run } def in : Process[Task, String] = t.subscribe def search(term : String) : Process[Task, Row] = { ids(term) .map(id => (id, term)) .flatMap((extractArticle _).tupled) } /** * E-utilities guide: http://www.ncbi.nlm.nih.gov/books/NBK25499/ **/ def ids(term : String) : Process[Task, String] = { val datetype = "pdat" val mindate = "2000/01/01" val maxdate = "2015/01/01" val retmax = 100000 val formattedTerm = term.replaceAll(" ", "%20") val duration = 5 minutes def xml = { import sys.process._ import java.io.File import java.net.URL val url = new URL(s"""http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term="${formattedTerm}"&retmax=${retmax}&rettype=xml&datetype=${datetype}&mindate=${mindate}&maxdate=${maxdate}""") val file = new File(s"""data/${term.replace(" ", "")}.xml""") logger.debug(s"Downloading ${file.getPath}") url #> file !! logger.debug(s"Begin parsing ${file.getPath}") val ret = XML.loadFile(file) logger.debug(s"Finished parsing ${file.getPath}") ret } def seq(elem : Elem) : Seq[String] = Random.shuffle((elem \\\\ "eSearchResult" \\\\ "IdList" \\\\ "Id").map(_.text).toSeq) def task : Task[Elem] = Task(xml).timed(duration).or(reattempt).onFinish { case Some(throwable) => Task.delay(logger.error(throwable)(s"Fetching ids for ${term} failed")) case None => Task.delay(logger.debug(s"Finished downloading ids for ${term}")) } def reattempt : Task[Elem] = Task.delay { logger.warn(s"Reattempting to download article (${term}, ${id}).") task.run } Process.eval(task) .pipe(process1.lift(seq)) .observe(Log.info.contramap(x => s"Got ${x.size} article ids about '${term}'.")) .pipe(process1.unchunk) } def extractArticle(id : String, term : String) : Process[Task, Row] = { def tokens = MLSentenceSegmenter.bundled().get val duration = 2 minutes def xml = { import sys.process._ import java.io.File import java.net.URL val url = new URL(s"""http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=${id}&rettype=xml""") val file = new File(s"data/${id}.xml") logger.debug(s"Downloading ${file.getPath}") url #> file !! logger.debug(s"Begin parsing ${file.getPath}") val ret = XML.loadFile(file) logger.debug(s"Finished parsing ${file.getPath}") ret } def seq(elem : Elem) : Seq[(String, String, String, Long)] = (elem \\\\ "PubmedArticleSet" \\\\ "PubmedArticle").flatMap { article => val pmid = (article \\\\ "PMID").text val title = (article \\\\ "ArticleTitle").text val _abstractBlock = (article \\\\ "Abstract").text val timestamp : Long = Task { (article \\\\ "MedlineCitation" \\\\ "DateCreated").map { dateElem => val year = (dateElem \\\\ "Year").text val month = (dateElem \\\\ "Month").text val day = (dateElem \\\\ "Day").text val sdf = new SimpleDateFormat("dd/M/yyyy") val date = sdf.parse(s"${day}/${month}/${year}") logger.debug(s"(${term}, ${pmid}) was created on ${date.toString}") date.getTime }.max }.onFinish { case Some(throwable) => Task(logger.error(throwable)(s"Failed to extraction a date for article (${pmid}, ${term})")) case None => Task.now() }.or(Task.now(0L)).run val sentences = tokens(Option(_abstractBlock).getOrElse("")).toList sentences.map(sentence => (pmid, title, sentence, timestamp)) } def extract : ((String, String, String, Long)) => Seq[Row] = { case (pmid, title, sentence, timestamp) => logger.debug(s"Begin extracting '${sentence}'") val timeout = 3 minutes val t1 = System.currentTimeMillis val res = Task(Compile(Parse(sentence))).timed(timeout).attemptRun val t2 = System.currentTimeMillis val dt = t2 - t1 res match { case \\/-(\\/-(relations)) => relations.filter(_.args.length == 2) .map { relation => val predicate = relation.literal.id val subject = relation.args.head.id val obj = relation.args.last.id val row = Row(pmid, subject, predicate, obj, term, timestamp) logger.debug(s"Extracted(${dt}): ${row.toCSV}") row } case _ => logger.warn(s"Could not extract relations from(${dt}): ${sentence} | ${title} | ${pmid} | ${term}") Seq() } } def task : Task[Elem] = Task(xml).timed(duration).or(reattempt).onFinish { case Some(throwable) => Task.delay(logger.error(throwable)(s"Fetching article for (${term}, ${id}) failed")) case None => Task.delay(logger.debug(s"Finished downloading article for (${term}, ${id})")) } def reattempt : Task[Elem] = Task.delay { logger.warn(s"Reattempting to download article (${term}, ${id}).") task.run } Process.eval(task) .pipe(process1.lift(seq)) .pipe(process1.unchunk) .pipe(process1.lift(extract)) .pipe(process1.unchunk) } } private[this] object Bitly { def apply(link : String) : Task[String] = Task { import scala.io.Source import scala.util.parsing.json._ val result = Source.fromURL(requestURL(link)).mkString JSON.parseFull(result).map { _.asInstanceOf[Map[String,Any]]("data") .asInstanceOf[Map[String, Any]]("url") .asInstanceOf[String] }.get } private[this] def requestURL(link : String) = { s"""https://api-ssl.bitly.com/v3/shorten?login=o_1h56l570kl&apiKey=R_43026c0ecd0849c090ae4547b46ac1d7&longUrl=${link}""" } } object Log { def debug(implicit logger : org.log4s.Logger) : Sink[Task, String] = io.channel { (s : String) => Task.delay { logger.debug(s) } } def info(implicit logger : org.log4s.Logger) : Sink[Task, String] = io.channel { (s : String) => Task.delay { logger.info(s) } } def warn(implicit logger : org.log4s.Logger) : Sink[Task, String] = io.channel { (s : String) => Task.delay { logger.warn(s) } } def error(implicit logger : org.log4s.Logger) : Sink[Task, String] = io.channel { (s : String) => Task.delay { logger.error(s) } } def trace(implicit logger : org.log4s.Logger) : Sink[Task, String] = io.channel { (s : String) => Task.delay { logger.trace(s) } } } object Twitter { private[this] lazy val twitter = TwitterFactory.getSingleton private[this] implicit val logger = org.log4s.getLogger def out : Sink[Task, String] = io.channel { (s : String) => Task.delay { twitter.updateStatus(s) () }.or(Task.delay(logger.warn(s"Could not tweet: ${s}"))) } } object IRC { import org.jibble.pircbot._ private[this] implicit val scheduler = scalaz.stream.DefaultScheduler private[this] val logger = org.log4s.getLogger private[this] val t = async.topic[Pubmed.Row]() private[this] val bot = new PircBot { private[this] val name = "semanticbot" private[this] val pattern = s"""^${name}: research (.+)""".r this.setName(name) this.setVerbose(false) this.connect("irc.freenode.net") this.joinChannel("###cmc") this.joinChannel("#crea") override def onMessage(channel : String, sender : String, login : String, hostname : String, message : String) : Unit = if(message.startsWith(name)) { Task { message match { case pattern(term) => this.sendMessage(channel, s"Researching ${term}.") Pubmed.search(term).to(t.publish).run.run case _ => this.sendMessage(channel, s"${sender}: I don't understand.") } }.runAsync(_ => ()) } } def in : Process[Task, Pubmed.Row] = t.subscribe def out(channelName : String) : Sink[Task, String] = io.channel { (s : String) => Task.delay { bot.sendMessage(channelName, s) }.or(Task.delay(logger.warn(s"Could not IRC: ${s}"))) } } object Web { import org.http4s._ import org.http4s.dsl._ import org.http4s.websocket._ import org.http4s.websocket.WebsocketBits._ import org.http4s.server._ import org.http4s.server.websocket._ import org.http4s.server.jetty.JettyBuilder import org.http4s.server.blaze.{WebSocketSupport, Http1ServerStage} import org.http4s.blaze.channel.nio1.NIO1SocketServerChannelFactory import org.http4s.blaze.channel.SocketConnection import org.http4s.blaze.pipeline.LeafBuilder import java.nio.ByteBuffer import java.net.InetSocketAddress private[this] implicit val scheduler = scalaz.stream.DefaultScheduler private[this] val t = async.topic[Pubmed.Row]() private[this] val route = HttpService { case req@ GET -> Root => val src = Pubmed.in.map(s => Text(s)) val sink : Sink[Task, WebSocketFrame] = Process.constant { case Text(term, _) => Task.delay { Pubmed.search(term).to(t.publish).run.runAsync(_ => ()) } case f => Task.delay(println(s"Unknown type: $f")) } WS(src, sink) } def in = t.subscribe def start(file : String = "neuroendocrine.txt") : Unit = { Task(Pubmed(file).run).runAsync(_ => ()) def pipebuilder(conn: SocketConnection): LeafBuilder[ByteBuffer] = new Http1ServerStage(route, Some(conn)) with WebSocketSupport new NIO1SocketServerChannelFactory(pipebuilder, 12, 8*1024) .bind(new InetSocketAddress(8080)) .run() } }
markfarrell/relation-extraction
src/main/scala/crea/nlp/Pubmed.scala
Scala
lgpl-3.0
12,308
/* * Copyright 2014 Alan Rodas Bonjour * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.alanrodas.scaland import scala.util.Try package object vcs { def currentPath = properties.user.dir def userHome = properties.user.home implicit def string2repository(remote : String) : RepoUri = RepoUri(remote) implicit def string2revision(revision : String) : Revision = new Revision{def name = revision} implicit def int2revision(version : Int) : Revision = new Revision{def name = version.toString} /** * This class is intended to provide a more elegant DSL when * cloning a repository from a remote location. * * @param vcs The VCS that has created this cloner. * @param repository The remote repository to download. * @tparam R The repository type of the VCS. * @tparam C The connector type ofthe VCS. */ case class Cloner[R <: Repository[C],C <: Connector[R]] (vcs : VCS[R, C], repository : RepoUri)(implicit connector : C) { def here = at(currentPath) def atDefault : Try[R] = at(currentPath / repository.uri.filename.split("\\\\.").head) def at(localPath : String) : Try[R] = vcs.clone(repository, localPath) } /** Transforms a [[Cloner]] to a Try. */ implicit def cloner2TRepo[R <: Repository[C], C <: Connector[R]](cloner : Cloner[R, C]) : Try[R] = cloner.at(currentPath) }
alanrodas/scaland
vcs/src/main/scala/com/alanrodas/scaland/vcs/package.scala
Scala
apache-2.0
1,854
package jsmessages import javax.inject.{Inject, Singleton} import play.api.i18n.MessagesApi import scala.collection.compat._ /** * Defines various methods returning a [[JsMessages]] instance. * * Typical usage: * * {{{ * import jsmessages.JsMessagesFactory * import play.api.i18n.{I18nSupport, MessagesApi} * import play.api.mvc.{Action, Controller} * * class Application(jsMessagesFactory: JsMessagesFactory, val messagesApi: MessagesApi) extends Controller with I18nSupport { * val jsMessages = jsMessagesFactory.all * val messages = Action { implicit request => * Ok(messages(Some("window.Messages"))) * } * } * }}} * * @param messagesApi The underlying Play i18n module to retrieve messages from */ @Singleton class JsMessagesFactory @Inject() (messagesApi: MessagesApi) { /** * @return a `JsMessages` instance using all the messages of `messagesApi` */ def all: JsMessages = new JsMessages(messagesApi.messages) /** * Example: * * {{{ * val jsMessages = JsMessages.filtering(_.startsWith("error.")) * }}} * * @param filter a predicate to filter message keys * @return a `JsMessages` instance keeping only messages whose keys satisfy `filter` */ def filtering(filter: String => Boolean): JsMessages = { new JsMessages(messagesApi.messages.view.mapValues(_.view.filter { case (key, _) => filter(key) }.toMap).toMap) } /** * Example: * * {{{ * val jsMessages = JsMessages.subset( * "error.required", * "error.number" * ) * }}} * * @param keys the list of keys to keep * @return a `JsMessages` instance keeping only messages whose keys are in `keys` */ def subset(keys: String*): JsMessages = filtering(keys.contains) } trait JsMessagesFactoryComponents { def messagesApi: MessagesApi lazy val jsMessagesFactory = new JsMessagesFactory(messagesApi) }
julienrf/play-jsmessages
jsmessages/src/main/scala/jsmessages/JsMessagesFactory.scala
Scala
mit
1,915
package nl.dekkr.pagefetcher import akka.http.scaladsl.Http import akka.stream.ActorMaterializer import akka.stream.scaladsl.{Sink, Source} import com.typesafe.config.ConfigFactory import com.typesafe.scalalogging.Logger import nl.dekkr.pagefetcher.actors.{BootedCore, CoreActors} import nl.dekkr.pagefetcher.messages.RemoveOldPages import nl.dekkr.pagefetcher.model.Constants import nl.dekkr.pagefetcher.services.{BackendService, FrontendService} import org.slf4j.LoggerFactory import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future import scala.concurrent.duration._ import scala.language.postfixOps import scala.util.{Failure, Success} object Boot extends App with BootedCore with CoreActors with FrontendService with Constants { private val logger = Logger(LoggerFactory.getLogger("PageFetcher")) val config = ConfigFactory.load() implicit val backend = new BackendService()(persistence) logger.info(s"Setting up database connection...") backend.initBackEnd match { case Failure(_) => logger.error("Database connection failed, shutting down...") system.shutdown() case Success(_) => logger.info("Database ready") startApi() startHousekeeping() logger.info(s"Done booting...") } def startHousekeeping(): Unit = { logger.info(s"Scheduling housekeeping...") config.getInt(s"$CONFIG_BASE.persistence.maxStorageAge") match { case hours if hours > 0 => logger.info(s"Automatic cleanup of content older the $hours hours") system.scheduler.schedule(10 seconds, 60 minutes, persistence, RemoveOldPages(hours)) case _ => logger.info("Automatic cleanup disabled") } } def startApi(): Unit = { logger.info(s"Enabling REST interface...") implicit val materializer = ActorMaterializer() //implicit val fm = val serverSource: Source[Http.IncomingConnection, Future[Http.ServerBinding]] = Http(system).bind( interface = config.getString(s"$CONFIG_BASE.api.interface"), port = config.getInt(s"$CONFIG_BASE.api.port")) serverSource.to(Sink.foreach { connection => logger.debug("Accepted new connection from " + connection.remoteAddress) connection handleWithSyncHandler requestHandler }).run() } }
dekkr/pagefetcher
src/main/scala/nl/dekkr/pagefetcher/Boot.scala
Scala
mit
2,298
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.ml.feature import org.apache.spark.ml.linalg.{Vector, Vectors} import org.apache.spark.ml.param.ParamsSuite import org.apache.spark.ml.util.{DefaultReadWriteTest, MLTest, MLTestingUtils} import org.apache.spark.ml.util.TestingUtils._ import org.apache.spark.sql.{Dataset, Row} class VarianceThresholdSelectorSuite extends MLTest with DefaultReadWriteTest { import testImplicits._ @transient var dataset: Dataset[_] = _ override def beforeAll(): Unit = { super.beforeAll() val data = Seq( (1, Vectors.dense(Array(6.0, 7.0, 0.0, 5.0, 6.0, 0.0)), Vectors.dense(Array(6.0, 7.0, 0.0, 6.0, 0.0))), (2, Vectors.dense(Array(0.0, 9.0, 6.0, 5.0, 5.0, 9.0)), Vectors.dense(Array(0.0, 9.0, 6.0, 5.0, 9.0))), (3, Vectors.dense(Array(0.0, 9.0, 3.0, 5.0, 5.0, 5.0)), Vectors.dense(Array(0.0, 9.0, 3.0, 5.0, 5.0))), (4, Vectors.dense(Array(0.0, 9.0, 8.0, 5.0, 6.0, 4.0)), Vectors.dense(Array(0.0, 9.0, 8.0, 6.0, 4.0))), (5, Vectors.dense(Array(8.0, 9.0, 6.0, 5.0, 4.0, 4.0)), Vectors.dense(Array(8.0, 9.0, 6.0, 4.0, 4.0))), (6, Vectors.dense(Array(8.0, 9.0, 6.0, 5.0, 0.0, 0.0)), Vectors.dense(Array(8.0, 9.0, 6.0, 0.0, 0.0)))) dataset = spark.createDataFrame(data).toDF("id", "features", "expected") } test("params") { ParamsSuite.checkParams(new VarianceThresholdSelector) } test("Test VarianceThresholdSelector: varianceThreshold not set") { val selector = new VarianceThresholdSelector().setOutputCol("filtered") val model = testSelector(selector, dataset) MLTestingUtils.checkCopyAndUids(selector, model) } test("Test VarianceThresholdSelector: set varianceThreshold") { val df = spark.createDataFrame(Seq( (1, Vectors.dense(Array(6.0, 7.0, 0.0, 7.0, 6.0, 0.0)), Vectors.dense(Array(6.0, 7.0, 0.0))), (2, Vectors.dense(Array(0.0, 9.0, 6.0, 0.0, 5.0, 9.0)), Vectors.dense(Array(0.0, 0.0, 9.0))), (3, Vectors.dense(Array(0.0, 9.0, 3.0, 0.0, 5.0, 5.0)), Vectors.dense(Array(0.0, 0.0, 5.0))), (4, Vectors.dense(Array(0.0, 9.0, 8.0, 5.0, 6.0, 4.0)), Vectors.dense(Array(0.0, 5.0, 4.0))), (5, Vectors.dense(Array(8.0, 9.0, 6.0, 5.0, 4.0, 4.0)), Vectors.dense(Array(8.0, 5.0, 4.0))), (6, Vectors.dense(Array(8.0, 9.0, 6.0, 0.0, 0.0, 0.0)), Vectors.dense(Array(8.0, 0.0, 0.0))) )).toDF("id", "features", "expected") val selector = new VarianceThresholdSelector() .setVarianceThreshold(8.2) .setOutputCol("filtered") val model = testSelector(selector, df) MLTestingUtils.checkCopyAndUids(selector, model) } test("Test VarianceThresholdSelector: sparse vector") { val df = spark.createDataFrame(Seq( (1, Vectors.sparse(6, Array((0, 6.0), (1, 7.0), (3, 7.0), (4, 6.0))), Vectors.dense(Array(6.0, 0.0, 7.0, 0.0))), (2, Vectors.sparse(6, Array((1, 9.0), (2, 6.0), (4, 5.0), (5, 9.0))), Vectors.dense(Array(0.0, 6.0, 0.0, 9.0))), (3, Vectors.sparse(6, Array((1, 9.0), (2, 3.0), (4, 5.0), (5, 5.0))), Vectors.dense(Array(0.0, 3.0, 0.0, 5.0))), (4, Vectors.dense(Array(0.0, 9.0, 8.0, 5.0, 6.0, 4.0)), Vectors.dense(Array(0.0, 8.0, 5.0, 4.0))), (5, Vectors.dense(Array(8.0, 9.0, 6.0, 5.0, 4.0, 4.0)), Vectors.dense(Array(8.0, 6.0, 5.0, 4.0))), (6, Vectors.dense(Array(8.0, 9.0, 6.0, 4.0, 0.0, 0.0)), Vectors.dense(Array(8.0, 6.0, 4.0, 0.0))) )).toDF("id", "features", "expected") val selector = new VarianceThresholdSelector() .setVarianceThreshold(8.1) .setOutputCol("filtered") val model = testSelector(selector, df) MLTestingUtils.checkCopyAndUids(selector, model) } test("read/write") { def checkModelData(model: VarianceThresholdSelectorModel, model2: VarianceThresholdSelectorModel): Unit = { assert(model.selectedFeatures === model2.selectedFeatures) } val varSelector = new VarianceThresholdSelector testEstimatorAndModelReadWrite(varSelector, dataset, VarianceThresholdSelectorSuite.allParamSettings, VarianceThresholdSelectorSuite.allParamSettings, checkModelData) } private def testSelector(selector: VarianceThresholdSelector, data: Dataset[_]): VarianceThresholdSelectorModel = { val selectorModel = selector.fit(data) testTransformer[(Int, Vector, Vector)](data.toDF(), selectorModel, "filtered", "expected") { case Row(vec1: Vector, vec2: Vector) => assert(vec1 ~== vec2 absTol 1e-6) } selectorModel } } object VarianceThresholdSelectorSuite { /** * Mapping from all Params to valid settings which differ from the defaults. * This is useful for tests which need to exercise all Params, such as save/load. * This excludes input columns to simplify some tests. */ val allParamSettings: Map[String, Any] = Map( "varianceThreshold" -> 0.12, "outputCol" -> "myOutput" ) }
maropu/spark
mllib/src/test/scala/org/apache/spark/ml/feature/VarianceThresholdSelectorSuite.scala
Scala
apache-2.0
5,776
package fpinscala.gettingstarted // A comment! /* Another comment */ /** A documentation comment */ object MyModule { def abs(n: Int): Int = if (n < 0) -n else n private def formatAbs(x: Int) = { val msg = "The absolute value of %d is %d" msg.format(x, abs(x)) } def main(args: Array[String]): Unit = println(formatAbs(-42)) // A definition of factorial, using a local, tail recursive function def factorial(n: Int): Int = { @annotation.tailrec def go(n: Int, acc: Int): Int = if (n <= 0) acc else go(n-1, n*acc) go(n, 1) } // Another implementation of `factorial`, this time with a `while` loop def factorial2(n: Int): Int = { var acc = 1 var i = n while (i > 0) { acc *= i; i -= 1 } acc } // Exercise 1: Write a function to compute the nth fibonacci number def fib(n: Int): Int = ??? // This definition and `formatAbs` are very similar.. private def formatFactorial(n: Int) = { val msg = "The factorial of %d is %d." msg.format(n, factorial(n)) } // We can generalize `formatAbs` and `formatFactorial` to // accept a _function_ as a parameter def formatResult(name: String, n: Int, f: Int => Int) = { val msg = "The %s of %d is %d." msg.format(name, n, f(n)) } } object FormatAbsAndFactorial { import MyModule._ // Now we can use our general `formatResult` function // with both `abs` and `factorial` def main(args: Array[String]): Unit = { println(formatResult("absolute value", -42, abs)) println(formatResult("factorial", 7, factorial)) } } object TestFib { import MyModule._ // test implementation of `fib` def main(args: Array[String]): Unit = { println("Expected: 0, 1, 1, 2, 3, 5, 8") println("Actual: %d, %d, %d, %d, %d, %d, %d".format(fib(0), fib(1), fib(2), fib(3), fib(4), fib(5), fib(6))) } } // Functions get passed around so often in FP that it's // convenient to have syntax for constructing a function // *without* having to give it a name object AnonymousFunctions { import MyModule._ // Some examples of anonymous functions: def main(args: Array[String]): Unit = { println(formatResult("absolute value", -42, abs)) println(formatResult("factorial", 7, factorial)) println(formatResult("increment", 7, (x: Int) => x + 1)) println(formatResult("increment2", 7, (x) => x + 1)) println(formatResult("increment3", 7, x => x + 1)) println(formatResult("increment4", 7, _ + 1)) println(formatResult("increment5", 7, x => { val r = x + 1; r })) } } object MonomorphicBinarySearch { // First, a binary search implementation, specialized to `Double`, // another primitive type in Scala, representing 64-bit floating // point numbers // Ideally, we could generalize this to work for any `Array` type, // so long as we have some way of comparing elements of the `Array` def binarySearch(ds: Array[Double], key: Double): Int = { @annotation.tailrec def go(low: Int, mid: Int, high: Int): Int = { if (low > high) -mid - 1 else { val mid2 = (low + high) / 2 val d = ds(mid2) // We index into an array using the same // syntax as function application if (d == key) mid2 else if (d > key) go(low, mid2, mid2-1) else go(mid2 + 1, mid2, high) } } go(0, 0, ds.length - 1) } } object PolymorphicFunctions { // Here's a polymorphic version of `binarySearch`, parameterized on // a function for testing whether an `A` is greater than another `A`. def binarySearch[A](as: Array[A], key: A, gt: (A,A) => Boolean): Int = { @annotation.tailrec def go(low: Int, mid: Int, high: Int): Int = { if (low > high) -mid - 1 else { val mid2 = (low + high) / 2 val a = as(mid2) val greater = gt(a, key) if (!greater && !gt(key,a)) mid2 else if (greater) go(low, mid2, mid2-1) else go(mid2 + 1, mid2, high) } } go(0, 0, as.length - 1) } // Exercise 2: Implement a polymorphic function to check whether // an `Array[A]` is sorted def isSorted[A](as: Array[A], gt: (A,A) => Boolean): Boolean = as.length match { case 0 => true case 1 => true case _ => { val x = as.head val xs = as.tail gt(x, xs.head) && isSorted(xs.tail, gt) } } // Polymorphic functions are often so constrained by their type // that they only have one implementation! Here's an example: def partial1[A,B,C](a: A, f: (A,B) => C): B => C = (b: B) => f(a, b) // Exercise 3: Implement `curry`. // Note that `=>` associates to the right, so we could // write the return type as `A => B => C` def curry[A,B,C](f: (A, B) => C): A => (B => C) = (a: A) => f(a, _) // NB: The `Function2` trait has a `curried` method already // Exercise 4: Implement `uncurry` def uncurry[A,B,C](f: A => B => C): (A, B) => C = (a: A, b: B) => f(a)(b) /* NB: There is a method on the `Function` object in the standard library, `Function.uncurried` that you can use for uncurrying. Note that we can go back and forth between the two forms. We can curry and uncurry and the two forms are in some sense "the same". In FP jargon, we say that they are _isomorphic_ ("iso" = same; "morphe" = shape, form), a term we inherit from category theory. */ // Exercise 5: Implement `compose` def compose[A,B,C](f: B => C, g: A => B): A => C = (a: A) => f(g(a)) }
lzongren/fpinscala
exercises/src/main/scala/fpinscala/gettingstarted/GettingStarted.scala
Scala
mit
5,492
/* * Copyright 2007-2010 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.liftweb { package example { package snippet { import _root_.net.liftweb.http._ import S._ import js._ import JsCmds._ import JE._ import textile._ import _root_.net.liftweb.common._ import _root_.net.liftweb.util._ import Helpers._ import _root_.scala.xml._ class Json { object json extends JsonHandler { def apply(in: Any): JsCmd = SetHtml("json_result", in match { case JsonCmd("show", _, p: String, _) => Text(p) case JsonCmd("textile", _, p: String, _) => TextileParser.toHtml(p, Empty) case JsonCmd("count", _, p: String, _) => Text(p.length+" Characters") case x => <b>Problem... didn't handle JSON message {x}</b> }) } def sample(in: NodeSeq): NodeSeq = bind("json", in, "script" -> Script(json.jsCmd), AttrBindParam("onclick", Text(json.call(ElemById("json_select")~>Value, ElemById("json_question")~>Value).toJsCmd), "onclick")) } } } }
lift/lift
examples/example/src/main/scala/net/liftweb/example/snippet/Json.scala
Scala
apache-2.0
1,634
package scala.test.twitter_scrooge import scala.test.twitter_scrooge.thrift.Struct1 import scala.test.twitter_scrooge.thrift.thrift2.Struct2A import scala.test.twitter_scrooge.thrift.thrift2.Struct2B import scala.test.twitter_scrooge.thrift.thrift2.thrift3.Struct3 object JustScrooge1 { val classes = Seq(classOf[Struct1], classOf[Struct2A], classOf[Struct2B], classOf[Struct3]) def main(args: Array[String]) { print(s"classes ${classes.mkString(",")}") } }
sdtwigg/rules_scala
test/src/main/scala/scala/test/twitter_scrooge/JustScrooge1.scala
Scala
apache-2.0
470
package io.skysail.app.dbviewer.resources import io.skysail.core.app.SkysailApplication import io.skysail.core.restlet.ResourceContextId import io.skysail.core.restlet.resources._ import io.skysail.queryfilter.filter.Filter import io.skysail.queryfilter.pagination.Pagination import org.json4s.DefaultFormats import java.util.Date import io.skysail.api.doc.ApiSummary import io.skysail.api.doc.ApiDescription import io.skysail.api.doc.ApiTags import io.skysail.app.dbviewer.domain.Connection import io.skysail.app.dbviewer.repository.DbViewerRepository import io.skysail.app.dbviewer.DbViewerApplication import java.sql.ResultSet import io.skysail.app.dbviewer.domain.SchemaDetails object SchemasResource { def connectionsRepo(app: SkysailApplication) = app.getRepository[DbViewerRepository](classOf[Connection]) } class SchemasResource extends ListServerResource[List[SchemaDetails]] { //(classOf[ConnectionResource]) { setDescription("resource class responsible of handling requests to get the list of all Connections") addToContext(ResourceContextId.LINK_TITLE, "list Connections"); override def linkedResourceClasses() = List(classOf[PostConnectionResource]) @ApiSummary("returns the (potentially filtered, sorted and paginated) Schemas") def getEntity(): List[SchemaDetails] = { val connService = getSkysailApplication().asInstanceOf[DbViewerApplication].connectionService val connection = connService.getById(getAttribute("id")) val ds = connService.getDataSourceForConnection(connection.get) val dsConnection = ds.getConnection() val meta = dsConnection.getMetaData() val columnItr = resultSetItr(meta.getCatalogs)//meta.getColumns(null, null, "MyTable", null)) val t = columnItr.map(col => { // val columnType = col.getString("TYPE_NAME") // val columnName = col.getString("COLUMN_NAME") // val columnSize = col.getString("COLUMN_SIZE") SchemaDetails(Some(col.getString("TABLE_CAT"))) }).toList t } def resultSetItr(resultSet: ResultSet): Stream[ResultSet] = { new Iterator[ResultSet] { def hasNext = resultSet.next() def next() = resultSet }.toStream } }
evandor/skysail-notes
skysail.app.dbviewer/src/io/skysail/app/dbviewer/resources/schemasResources.scala
Scala
apache-2.0
2,164
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.deploy.yarn import java.util.Collections import java.util.concurrent._ import java.util.regex.Pattern import scala.collection.JavaConversions._ import scala.collection.mutable.{ArrayBuffer, HashMap, HashSet} import org.apache.hadoop.conf.Configuration import org.apache.hadoop.yarn.api.records._ import org.apache.hadoop.yarn.client.api.AMRMClient import org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest import org.apache.hadoop.yarn.util.RackResolver import org.apache.log4j.{Level, Logger} import org.apache.spark.{Logging, SecurityManager, SparkConf} import org.apache.spark.deploy.yarn.YarnSparkHadoopUtil._ import org.apache.spark.rpc.RpcEndpointRef import org.apache.spark.scheduler.cluster.CoarseGrainedClusterMessages.RemoveExecutor import org.apache.spark.util.ThreadUtils /** * YarnAllocator is charged with requesting containers from the YARN ResourceManager and deciding * what to do with containers when YARN fulfills these requests. * YarnAllocator负责从YARN ResourceManager请求容器,并决定在YARN满足这些请求时如何处理容器 * * This class makes use of YARN's AMRMClient APIs. We interact with the AMRMClient in three ways: * 该类使用YARN的AMRMClient API。 我们通过三种方式与AMRMClient进行交互: * * Making our resource needs known, which updates local bookkeeping about containers requested. * * Calling "allocate", which syncs our local container requests with the RM, and returns any * containers that YARN has granted to us. This also functions as a heartbeat. * * Processing the containers granted to us to possibly launch executors inside of them. * * The public methods of this class are thread-safe. All methods that mutate state are * synchronized. */ private[yarn] class YarnAllocator( driverUrl: String, driverRef: RpcEndpointRef, conf: Configuration, sparkConf: SparkConf, amClient: AMRMClient[ContainerRequest], appAttemptId: ApplicationAttemptId, args: ApplicationMasterArguments, securityMgr: SecurityManager) extends Logging { import YarnAllocator._ // RackResolver logs an INFO message whenever it resolves a rack, which is way too often. //RackResolver在解析机架时会记录INFO消息,这种情况太常见了 if (Logger.getLogger(classOf[RackResolver]).getLevel == null) { Logger.getLogger(classOf[RackResolver]).setLevel(Level.WARN) } // Visible for testing. //可见测试 val allocatedHostToContainersMap = new HashMap[String, collection.mutable.Set[ContainerId]] val allocatedContainerToHostMap = new HashMap[ContainerId, String] // Containers that we no longer care about. We've either already told the RM to release them or // will on the next heartbeat. Containers get removed from this map after the RM tells us they've // completed. //我们不再关心的容器。 我们已经告诉RM释放它们,或者将在下一次心跳时释放它们,RM告诉我们他们已经完成后,容器会从此地图中删除。 private val releasedContainers = Collections.newSetFromMap[ContainerId]( new ConcurrentHashMap[ContainerId, java.lang.Boolean]) @volatile private var numExecutorsRunning = 0 // Used to generate a unique ID per executor //用于为每个执行程序生成唯一ID private var executorIdCounter = 0 @volatile private var numExecutorsFailed = 0 @volatile private var targetNumExecutors = YarnSparkHadoopUtil.getInitialTargetExecutorNumber(sparkConf) // Keep track of which container is running which executor to remove the executors later // Visible for testing. //跟踪哪个容器正在运行哪个执行程序以后删除执行程序可见以进行测试 private[yarn] val executorIdToContainer = new HashMap[String, Container] private var numUnexpectedContainerRelease = 0L private val containerIdToExecutorId = new HashMap[ContainerId, String] // Executor memory in MB.执行程序内存以MB为单位 protected val executorMemory = args.executorMemory // Additional memory overhead.额外的内存开销 protected val memoryOverhead: Int = sparkConf.getInt("spark.yarn.executor.memoryOverhead", math.max((MEMORY_OVERHEAD_FACTOR * executorMemory).toInt, MEMORY_OVERHEAD_MIN)) // Number of cores per executor.每个执行程序的核心数 protected val executorCores = args.executorCores // Resource capability requested for each executors为每个执行者请求的资源能力 private[yarn] val resource = Resource.newInstance(executorMemory + memoryOverhead, executorCores) private val launcherPool = ThreadUtils.newDaemonCachedThreadPool( "ContainerLauncher", sparkConf.getInt("spark.yarn.containerLauncherMaxThreads", 25)) // For testing private val launchContainers = sparkConf.getBoolean("spark.yarn.launchContainers", true) private val labelExpression = sparkConf.getOption("spark.yarn.executor.nodeLabelExpression") // ContainerRequest constructor that can take a node label expression. We grab it through // reflection because it's only available in later versions of YARN. //ContainerRequest构造函数,可以采用节点标签表达式,我们通过反射获取它, // 因为它仅在YARN的更高版本中可用 private val nodeLabelConstructor = labelExpression.flatMap { expr => try { Some(classOf[ContainerRequest].getConstructor(classOf[Resource], classOf[Array[String]], classOf[Array[String]], classOf[Priority], classOf[Boolean], classOf[String])) } catch { case e: NoSuchMethodException => { logWarning(s"Node label expression $expr will be ignored because YARN version on" + " classpath does not support it.") None } } } // A map to store preferred hostname and possible task numbers running on it. //用于存储首选主机名和在其上运行的可能任务编号的映射 private var hostToLocalTaskCounts: Map[String, Int] = Map.empty // Number of tasks that have locality preferences in active stages //在活动阶段具有位置首选项的任务数 private var numLocalityAwareTasks: Int = 0 // A container placement strategy based on pending tasks' locality preference //基于待定任务的位置偏好的容器放置策略 private[yarn] val containerPlacementStrategy = new LocalityPreferredContainerPlacementStrategy(sparkConf, conf, resource) def getNumExecutorsRunning: Int = numExecutorsRunning def getNumExecutorsFailed: Int = numExecutorsFailed /** * Number of container requests that have not yet been fulfilled. * 尚未履行的容器请求数 */ def getNumPendingAllocate: Int = getNumPendingAtLocation(ANY_HOST) /** * Number of container requests at the given location that have not yet been fulfilled. * 在给定位置尚未完成的容器请求数 */ private def getNumPendingAtLocation(location: String): Int = amClient.getMatchingRequests(RM_REQUEST_PRIORITY, location, resource).map(_.size).sum /** * Request as many executors from the ResourceManager as needed to reach the desired total. If * the requested total is smaller than the current number of running executors, no executors will * be killed. * 根据需要从ResourceManager请求尽可能多的执行程序以达到所需的总数, * 如果请求的总数小于当前运行的执行程序数,则不会终止执行程序。 * @param requestedTotal total number of containers requested 请求的容器总数 * @param localityAwareTasks number of locality aware tasks to be used as container placement hint 要用作容器放置提示的位置感知任务的数量 * @param hostToLocalTaskCount a map of preferred hostname to possible task counts to be used as * container placement hint. * 可选任务计数的首选主机名映射,用作容器放置提示。 * @return Whether the new requested total is different than the old value. * 新请求的总数是否与旧值不同 */ def requestTotalExecutorsWithPreferredLocalities( requestedTotal: Int, localityAwareTasks: Int, hostToLocalTaskCount: Map[String, Int]): Boolean = synchronized { this.numLocalityAwareTasks = localityAwareTasks this.hostToLocalTaskCounts = hostToLocalTaskCount if (requestedTotal != targetNumExecutors) { logInfo(s"Driver requested a total number of $requestedTotal executor(s).") targetNumExecutors = requestedTotal true } else { false } } /** * Request that the ResourceManager release the container running the specified executor. * 请求ResourceManager释放运行指定执行程序的容器 */ def killExecutor(executorId: String): Unit = synchronized { if (executorIdToContainer.contains(executorId)) { val container = executorIdToContainer.remove(executorId).get containerIdToExecutorId.remove(container.getId) internalReleaseContainer(container) numExecutorsRunning -= 1 } else { logWarning(s"Attempted to kill unknown executor $executorId!") } } /** * Request resources such that, if YARN gives us all we ask for, we'll have a number of containers * equal to maxExecutors. 请求资源,如果YARN给我们所要求的全部,我们将有一些容器等于maxExecutors。 * * Deal with any containers YARN has granted to us by possibly launching executors in them. * 处理YARN通过在其中启动执行程序而授予我们的任何容器 * This must be synchronized because variables read in this method are mutated by other methods.这必须同步,因为此方法中读取的变量会被其他方法变异 */ def allocateResources(): Unit = synchronized { updateResourceRequests() val progressIndicator = 0.1f // Poll the ResourceManager. This doubles as a heartbeat if there are no pending container // requests. 轮询ResourceManager,如果没有待处理的容器请求,则会将其作为心跳加倍 val allocateResponse = amClient.allocate(progressIndicator) val allocatedContainers = allocateResponse.getAllocatedContainers() if (allocatedContainers.size > 0) { logDebug("Allocated containers: %d. Current executor count: %d. Cluster resources: %s." .format( allocatedContainers.size, numExecutorsRunning, allocateResponse.getAvailableResources)) handleAllocatedContainers(allocatedContainers) } val completedContainers = allocateResponse.getCompletedContainersStatuses() if (completedContainers.size > 0) { logDebug("Completed %d containers".format(completedContainers.size)) processCompletedContainers(completedContainers) logDebug("Finished processing %d completed containers. Current running executor count: %d." .format(completedContainers.size, numExecutorsRunning)) } } /** * Update the set of container requests that we will sync with the RM based on the number of * executors we have currently running and our target number of executors. * 根据我们当前运行的执行程序数和目标执行程序数更新我们将与RM同步的容器请求集。 * Visible for testing. */ def updateResourceRequests(): Unit = { val numPendingAllocate = getNumPendingAllocate val missing = targetNumExecutors - numPendingAllocate - numExecutorsRunning // TODO. Consider locality preferences of pending container requests. // Since the last time we made container requests, stages have completed and been submitted, // and that the localities at which we requested our pending executors // no longer apply to our current needs. We should consider to remove all outstanding // container requests and add requests anew each time to avoid this. //自上次我们提出容器请求以来,已经完成并提交了阶段,并且我们请求未决执行人的地点不再适用于我们当前的需求。 //我们应该考虑删除所有未完成的容器请求并每次重新添加请求以避免这种情况。 if (missing > 0) { logInfo(s"Will request $missing executor containers, each with ${resource.getVirtualCores} " + s"cores and ${resource.getMemory} MB memory including $memoryOverhead MB overhead") val containerLocalityPreferences = containerPlacementStrategy.localityOfRequestedContainers( missing, numLocalityAwareTasks, hostToLocalTaskCounts, allocatedHostToContainersMap) for (locality <- containerLocalityPreferences) { val request = createContainerRequest(resource, locality.nodes, locality.racks) amClient.addContainerRequest(request) val nodes = request.getNodes val hostStr = if (nodes == null || nodes.isEmpty) "Any" else nodes.last logInfo(s"Container request (host: $hostStr, capability: $resource)") } } else if (missing < 0) { val numToCancel = math.min(numPendingAllocate, -missing) logInfo(s"Canceling requests for $numToCancel executor containers") val matchingRequests = amClient.getMatchingRequests(RM_REQUEST_PRIORITY, ANY_HOST, resource) if (!matchingRequests.isEmpty) { matchingRequests.head.take(numToCancel).foreach(amClient.removeContainerRequest) } else { logWarning("Expected to find pending requests, but found none.") } } } /** * Creates a container request, handling the reflection required to use YARN features that were * added in recent versions. * 创建容器请求,处理使用最近版本中添加的YARN功能所需的反射 */ protected def createContainerRequest( resource: Resource, nodes: Array[String], racks: Array[String]): ContainerRequest = { nodeLabelConstructor.map { constructor => constructor.newInstance(resource, nodes, racks, RM_REQUEST_PRIORITY, true: java.lang.Boolean, labelExpression.orNull) }.getOrElse(new ContainerRequest(resource, nodes, racks, RM_REQUEST_PRIORITY)) } /** * Handle containers granted by the RM by launching executors on them. * 通过在RM上启动执行程序来处理由RM授予的容器 * Due to the way the YARN allocation protocol works, certain healthy race conditions can result * in YARN granting containers that we no longer need. In this case, we release them. * *由于YARN分配协议的工作方式,某些健康的竞争条件可能导致YARN授予我们不再需要的容器,在这种情况下,我们发布它们。 可见测试。 * Visible for testing. */ def handleAllocatedContainers(allocatedContainers: Seq[Container]): Unit = { val containersToUse = new ArrayBuffer[Container](allocatedContainers.size) // Match incoming requests by host 匹配主机的传入请求 val remainingAfterHostMatches = new ArrayBuffer[Container] for (allocatedContainer <- allocatedContainers) { matchContainerToRequest(allocatedContainer, allocatedContainer.getNodeId.getHost, containersToUse, remainingAfterHostMatches) } // Match remaining by rack 匹配剩余的机架 val remainingAfterRackMatches = new ArrayBuffer[Container] for (allocatedContainer <- remainingAfterHostMatches) { val rack = RackResolver.resolve(conf, allocatedContainer.getNodeId.getHost).getNetworkLocation matchContainerToRequest(allocatedContainer, rack, containersToUse, remainingAfterRackMatches) } // Assign remaining that are neither node-local nor rack-local //分配剩余的既不是节点本地也不是机架本地 val remainingAfterOffRackMatches = new ArrayBuffer[Container] for (allocatedContainer <- remainingAfterRackMatches) { matchContainerToRequest(allocatedContainer, ANY_HOST, containersToUse, remainingAfterOffRackMatches) } if (!remainingAfterOffRackMatches.isEmpty) { logDebug(s"Releasing ${remainingAfterOffRackMatches.size} unneeded containers that were " + s"allocated to us") for (container <- remainingAfterOffRackMatches) { internalReleaseContainer(container) } } runAllocatedContainers(containersToUse) logInfo("Received %d containers from YARN, launching executors on %d of them." .format(allocatedContainers.size, containersToUse.size)) } /** * Looks for requests for the given location that match the given container allocation. If it * finds one, removes the request so that it won't be submitted again. Places the container into * containersToUse or remaining. * 查找与给定容器分配匹配的给定位置的请求,如果找到一个,则删除该请求,以便不再提交, * 将容器放入容器中使用或保留。 * * @param allocatedContainer container that was given to us by YARN YARN给我们的容器 * @param location resource name, either a node, rack, or * 资源名称,节点,机架或* * @param containersToUse list of containers that will be used 将使用的容器列表 * @param remaining list of containers that will not be used 不使用的容器列表 */ private def matchContainerToRequest( allocatedContainer: Container, location: String, containersToUse: ArrayBuffer[Container], remaining: ArrayBuffer[Container]): Unit = { // SPARK-6050: certain Yarn configurations return a virtual core count that doesn't match the // request; for example, capacity scheduler + DefaultResourceCalculator. So match on requested // memory, but use the asked vcore count for matching, effectively disabling matching on vcore // count. val matchingResource = Resource.newInstance(allocatedContainer.getResource.getMemory, resource.getVirtualCores) val matchingRequests = amClient.getMatchingRequests(allocatedContainer.getPriority, location, matchingResource) // Match the allocation to a request 将分配与请求匹配 if (!matchingRequests.isEmpty) { val containerRequest = matchingRequests.get(0).iterator.next amClient.removeContainerRequest(containerRequest) containersToUse += allocatedContainer } else { remaining += allocatedContainer } } /** * Launches executors in the allocated containers. * 在已分配的容器中启动执行程序 */ private def runAllocatedContainers(containersToUse: ArrayBuffer[Container]): Unit = { for (container <- containersToUse) { numExecutorsRunning += 1 assert(numExecutorsRunning <= targetNumExecutors) val executorHostname = container.getNodeId.getHost val containerId = container.getId executorIdCounter += 1 val executorId = executorIdCounter.toString assert(container.getResource.getMemory >= resource.getMemory) logInfo("Launching container %s for on host %s".format(containerId, executorHostname)) executorIdToContainer(executorId) = container containerIdToExecutorId(container.getId) = executorId val containerSet = allocatedHostToContainersMap.getOrElseUpdate(executorHostname, new HashSet[ContainerId]) containerSet += containerId allocatedContainerToHostMap.put(containerId, executorHostname) val executorRunnable = new ExecutorRunnable( container, conf, sparkConf, driverUrl, executorId, executorHostname, executorMemory, executorCores, appAttemptId.getApplicationId.toString, securityMgr) if (launchContainers) { logInfo("Launching ExecutorRunnable. driverUrl: %s, executorHostname: %s".format( driverUrl, executorHostname)) launcherPool.execute(executorRunnable) } } } // Visible for testing. 处理已完成的容器 private[yarn] def processCompletedContainers(completedContainers: Seq[ContainerStatus]): Unit = { for (completedContainer <- completedContainers) { val containerId = completedContainer.getContainerId val alreadyReleased = releasedContainers.remove(containerId) if (!alreadyReleased) { // Decrement the number of executors running. The next iteration of // the ApplicationMaster's reporting thread will take care of allocating. //减少运行的执行程序的数量,ApplicationMaster报告线程的下一次迭代将负责分配。 numExecutorsRunning -= 1 logInfo("Completed container %s (state: %s, exit status: %s)".format( containerId, completedContainer.getState, completedContainer.getExitStatus)) // Hadoop 2.2.X added a ContainerExitStatus we should switch to use // there are some exit status' we shouldn't necessarily count against us, but for // now I think its ok as none of the containers are expected to exit if (completedContainer.getExitStatus == ContainerExitStatus.PREEMPTED) { logInfo("Container preempted: " + containerId) } else if (completedContainer.getExitStatus == -103) { // vmem limit exceeded logWarning(memLimitExceededLogMessage( completedContainer.getDiagnostics, VMEM_EXCEEDED_PATTERN)) } else if (completedContainer.getExitStatus == -104) { // pmem limit exceeded logWarning(memLimitExceededLogMessage( completedContainer.getDiagnostics, PMEM_EXCEEDED_PATTERN)) } else if (completedContainer.getExitStatus != 0) { logInfo("Container marked as failed: " + containerId + ". Exit status: " + completedContainer.getExitStatus + ". Diagnostics: " + completedContainer.getDiagnostics) numExecutorsFailed += 1 } } if (allocatedContainerToHostMap.containsKey(containerId)) { val host = allocatedContainerToHostMap.get(containerId).get val containerSet = allocatedHostToContainersMap.get(host).get containerSet.remove(containerId) if (containerSet.isEmpty) { allocatedHostToContainersMap.remove(host) } else { allocatedHostToContainersMap.update(host, containerSet) } allocatedContainerToHostMap.remove(containerId) } containerIdToExecutorId.remove(containerId).foreach { eid => executorIdToContainer.remove(eid) if (!alreadyReleased) { // The executor could have gone away (like no route to host, node failure, etc) //执行者可能已经离开(就像没有主机路由,节点故障等) // Notify backend about the failure of the executor //通知后端有关执行程序失败的信息 numUnexpectedContainerRelease += 1 driverRef.send(RemoveExecutor(eid, s"Yarn deallocated the executor $eid (container $containerId)")) } } } } private def internalReleaseContainer(container: Container): Unit = { releasedContainers.add(container.getId()) amClient.releaseAssignedContainer(container.getId()) } private[yarn] def getNumUnexpectedContainerRelease = numUnexpectedContainerRelease } private object YarnAllocator { val MEM_REGEX = "[0-9.]+ [KMG]B" val PMEM_EXCEEDED_PATTERN = Pattern.compile(s"$MEM_REGEX of $MEM_REGEX physical memory used") val VMEM_EXCEEDED_PATTERN = Pattern.compile(s"$MEM_REGEX of $MEM_REGEX virtual memory used") def memLimitExceededLogMessage(diagnostics: String, pattern: Pattern): String = { val matcher = pattern.matcher(diagnostics) val diag = if (matcher.find()) " " + matcher.group() + "." else "" ("Container killed by YARN for exceeding memory limits." + diag + " Consider boosting spark.yarn.executor.memoryOverhead.") } }
tophua/spark1.52
yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala
Scala
apache-2.0
24,526
package org.jetbrains.plugins.scala package lang.refactoring.ui import javax.swing.Icon import com.intellij.icons.AllIcons import com.intellij.psi.{PsiElement, PsiModifierList, PsiModifierListOwner} import com.intellij.refactoring.classMembers.MemberInfoModel import com.intellij.refactoring.ui.AbstractMemberSelectionTable import com.intellij.ui.RowIcon import com.intellij.util.{IconUtil, VisibilityIcons} import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunction import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScMember, ScObject} /** * Nikolay.Tropin * 8/20/13 */ abstract class ScalaMemberSelectionTableBase[M <: PsiElement, I <: ScalaMemberInfoBase[M]](memberInfos: java.util.Collection[I], memberInfoModel: MemberInfoModel[M, I], abstractColumnHeader: String) extends AbstractMemberSelectionTable[M, I](memberInfos, memberInfoModel, abstractColumnHeader) { def getAbstractColumnValue(memberInfo: I): AnyRef = { memberInfo.getMember match { case member: ScMember if member.containingClass.isInstanceOf[ScObject] => null case member: ScMember if member.hasAbstractModifier && myMemberInfoModel.isFixedAbstract(memberInfo) != null => myMemberInfoModel.isFixedAbstract(memberInfo) case _ if !myMemberInfoModel.isAbstractEnabled(memberInfo) => val res: java.lang.Boolean = myMemberInfoModel.isAbstractWhenDisabled(memberInfo) res case _ if memberInfo.isToAbstract => java.lang.Boolean.TRUE case _ => java.lang.Boolean.FALSE } } def isAbstractColumnEditable(rowIndex: Int): Boolean = { val info: I = myMemberInfos.get(rowIndex) info.getMember match { case member: ScMember if member.hasAbstractModifier && myMemberInfoModel.isFixedAbstract(info) == java.lang.Boolean.TRUE => false case _ => info.isChecked && myMemberInfoModel.isAbstractEnabled(info) } } def setVisibilityIcon(memberInfo: I, icon: RowIcon) { memberInfo.getMember match { case owner: PsiModifierListOwner => owner.getModifierList match { case mods: PsiModifierList => VisibilityIcons.setVisibilityIcon(mods, icon) case _ => icon.setIcon(IconUtil.getEmptyIcon(true), AbstractMemberSelectionTable.VISIBILITY_ICON_POSITION) } case _ => } } def getOverrideIcon(memberInfo: I): Icon = memberInfo.getMember match { case fun: ScFunction => if (java.lang.Boolean.TRUE == memberInfo.getOverrides) AllIcons.General.OverridingMethod else if (java.lang.Boolean.FALSE == memberInfo.getOverrides) AllIcons.General.ImplementingMethod else AbstractMemberSelectionTable.EMPTY_OVERRIDE_ICON case _ => AbstractMemberSelectionTable.EMPTY_OVERRIDE_ICON } }
triggerNZ/intellij-scala
src/org/jetbrains/plugins/scala/lang/refactoring/ui/ScalaMemberSelectionTableBase.scala
Scala
apache-2.0
2,799
import scala.tools.nsc.doc.base._ import scala.tools.nsc.doc.model._ import scala.tools.partest.ScaladocModelTest // scala/bug#5079 "Scaladoc can't link to an object (only a class or trait)" // scala/bug#4497 "Links in Scaladoc - Spec and implementation unsufficient" // scala/bug#4224 "Wiki-links should support method targets" // scala/bug#3695 "support non-fully-qualified type links in scaladoc comments" // scala/bug#6487 "Scaladoc can't link to inner classes" // scala/bug#6495 "Scaladoc won't pick up group name, priority and description from owner chain" // scala/bug#6501 "Scaladoc won't link to a @template type T as a template but as a member" object Test extends ScaladocModelTest { override def resourceFile = "links.scala" // no need for special settings def scaladocSettings = "" def testModel(rootPackage: Package) = { // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) import access._ // just need to check the member exists, access methods will throw an error if there's a problem val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("links") val TEST = base._object("TEST") val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember[_, _]]) val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl[_]]) assert(memberLinks == 18, s"$memberLinks == 18 (the member links in object TEST)") assert(templateLinks == 6, s"$templateLinks == 6 (the template links in object TEST)") } }
martijnhoekstra/scala
test/scaladoc/run/links.scala
Scala
apache-2.0
1,594
package pl.touk.nussknacker.engine.util.loader import pl.touk.nussknacker.engine.api.NamedServiceProvider import pl.touk.nussknacker.engine.util.multiplicity.{Empty, Many, Multiplicity, One} import java.util.ServiceLoader import scala.reflect.ClassTag object ScalaServiceLoader { import scala.collection.JavaConverters._ def load[T](classLoader: ClassLoader)(implicit classTag: ClassTag[T]): List[T] = { val claz: Class[T] = toClass(classTag) ServiceLoader .load(claz, classLoader) .asScala .toList } private def toClass[T](implicit classTag: ClassTag[T]): Class[T] = { classTag.runtimeClass.asInstanceOf[Class[T]] } def loadClass[T](classLoader: ClassLoader)(createDefault: => T)(implicit classTag: ClassTag[T]): T = chooseClass[T](createDefault, load[T](classLoader)) def chooseClass[T](createDefault: => T, loaded: List[T]): T = { Multiplicity(loaded) match { case One(only) => only case Empty() => createDefault case _ => throw new IllegalArgumentException(s"Error at loading class - default: $createDefault, loaded: $loaded") } } def loadNamed[T<:NamedServiceProvider:ClassTag](name: String, classLoader: ClassLoader = Thread.currentThread().getContextClassLoader): T = { val available = load[T](classLoader) val className = implicitly[ClassTag[T]].runtimeClass.getName Multiplicity(available.filter(_.name == name)) match { case Empty() => throw new IllegalArgumentException(s"Failed to find $className with name '$name', available names: ${available.map(_.name).distinct.mkString(", ")}") case One(instance) => instance case Many(more) => throw new IllegalArgumentException(s"More than one $className with name '$name' found: ${more.map(_.getClass).mkString(", ")}") } } }
TouK/nussknacker
utils/utils-internal/src/main/scala/pl/touk/nussknacker/engine/util/loader/ScalaServiceLoader.scala
Scala
apache-2.0
1,818
package troy.driver.query.select import shapeless._ import troy.driver.schema.column.ColumnType import troy.tast._ trait BindMarkerTypesOfWhereClause[Version, Table <: TableName[_, _], Relations <: WhereClause.Relations] { type Out <: HList } object BindMarkerTypesOfWhereClause { type Aux[V, T <: TableName[_, _], Rs <: WhereClause.Relations, O] = BindMarkerTypesOfWhereClause[V, T, Rs] { type Out = O } def apply[V, T <: TableName[_, _], Rs <: WhereClause.Relations, O](implicit w: BindMarkerTypesOfWhereClause[V, T, Rs]): Aux[V, T, Rs, w.Out] = w def instance[V, T <: TableName[_, _], Rs <: WhereClause.Relations, O <: HList]: Aux[V, T, Rs, O] = new BindMarkerTypesOfWhereClause[V, T, Rs] { override type Out = O } implicit def hNilInstance[V, T <: TableName[_, _]]: Aux[V, T, HNil, HNil] = instance[V, T, HNil, HNil] /** * For equality operators like ==, <, >, etc .. * the type of the term on the right, is the same as the left */ implicit def simpleEqualityInstance[V, T <: TableName[_, _], C <: Identifier, RT <: HList]( implicit headType: ColumnType[V, T, C], tailType: BindMarkerTypesOfWhereClause[V, T, RT] ) = instance[V, T, WhereClause.Relation.Simple[C, Operator.Equality, BindMarker.Anonymous] :: RT, headType.Out :: tailType.Out] // sealed trait Simple[columnName <: Identifier, operator <: Operator, term <: Term] extends Relation // implicit def implicitNotFoundMacro[V, K, T, C, CT]: Aux[V, K, T, C, CT] = macro implicitNotFoundMacroImpl[V, K, T, C] // // def implicitNotFoundMacroImpl[V, K, T, Rs](c: Context) = c.abort(c.enclosingPosition, s"a7a000hh") }
schemasafe/troy
troy-driver/src/main/scala/troy/driver/query/select/BindMarkerTypesOfWhereClause.scala
Scala
apache-2.0
1,635
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.sql.sources import java.io.File import com.google.common.io.Files import org.apache.hadoop.fs.Path import org.apache.parquet.hadoop.ParquetOutputFormat import org.apache.spark.sql._ import org.apache.spark.sql.catalyst.catalog.CatalogUtils import org.apache.spark.sql.execution.datasources.SQLHadoopMapReduceCommitProtocol import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.types._ class ParquetHadoopFsRelationSuite extends HadoopFsRelationTest { import testImplicits._ override val dataSourceName: String = "parquet" // Parquet does not play well with NullType. override protected def supportsDataType(dataType: DataType): Boolean = dataType match { case _: NullType => false case _: CalendarIntervalType => false case _ => true } test("save()/load() - partitioned table - simple queries - partition columns in data") { withTempDir { file => for (p1 <- 1 to 2; p2 <- Seq("foo", "bar")) { val partitionDir = new Path( CatalogUtils.URIToString(makeQualifiedPath(file.getCanonicalPath)), s"p1=$p1/p2=$p2") sparkContext .parallelize(for (i <- 1 to 3) yield (i, s"val_$i", p1)) .toDF("a", "b", "p1") .write.parquet(partitionDir.toString) } val dataSchemaWithPartition = StructType(dataSchema.fields :+ StructField("p1", IntegerType, nullable = true)) checkQueries( spark.read.format(dataSourceName) .option("dataSchema", dataSchemaWithPartition.json) .load(file.getCanonicalPath)) } } test("SPARK-7868: _temporary directories should be ignored") { withTempPath { dir => val df = Seq("a", "b", "c").zipWithIndex.toDF() df.write .format("parquet") .save(dir.getCanonicalPath) df.write .format("parquet") .save(s"${dir.getCanonicalPath}/_temporary") checkAnswer(spark.read.format("parquet").load(dir.getCanonicalPath), df.collect()) } } test("SPARK-8014: Avoid scanning output directory when SaveMode isn't SaveMode.Append") { withTempDir { dir => val path = dir.getCanonicalPath val df = Seq(1 -> "a").toDF() // Creates an arbitrary file. If this directory gets scanned, ParquetRelation2 will throw // since it's not a valid Parquet file. val emptyFile = new File(path, "empty") Files.createParentDirs(emptyFile) Files.touch(emptyFile) // This shouldn't throw anything. df.write.format("parquet").mode(SaveMode.Ignore).save(path) // This should only complain that the destination directory already exists, rather than file // "empty" is not a Parquet file. assert { intercept[AnalysisException] { df.write.format("parquet").mode(SaveMode.ErrorIfExists).save(path) }.getMessage.contains("already exists") } // This shouldn't throw anything. df.write.format("parquet").mode(SaveMode.Overwrite).save(path) checkAnswer(spark.read.format("parquet").load(path), df) } } test("SPARK-8079: Avoid NPE thrown from BaseWriterContainer.abortJob") { withTempPath { dir => intercept[AnalysisException] { // Parquet doesn't allow field names with spaces. Here we are intentionally making an // exception thrown from the `ParquetRelation2.prepareForWriteJob()` method to trigger // the bug. Please refer to spark-8079 for more details. spark.range(1, 10) .withColumnRenamed("id", "a b") .write .format("parquet") .save(dir.getCanonicalPath) } } } test("SPARK-8604: Parquet data source should write summary file while doing appending") { withSQLConf( ParquetOutputFormat.JOB_SUMMARY_LEVEL -> "ALL", SQLConf.FILE_COMMIT_PROTOCOL_CLASS.key -> classOf[SQLHadoopMapReduceCommitProtocol].getCanonicalName) { withTempPath { dir => val path = dir.getCanonicalPath val df = spark.range(0, 5).toDF() df.write.mode(SaveMode.Overwrite).parquet(path) val summaryPath = new Path(path, "_metadata") val commonSummaryPath = new Path(path, "_common_metadata") val fs = summaryPath.getFileSystem(spark.sessionState.newHadoopConf()) fs.delete(summaryPath, true) fs.delete(commonSummaryPath, true) df.write.mode(SaveMode.Append).parquet(path) checkAnswer(spark.read.parquet(path), df.union(df)) assert(fs.exists(summaryPath)) assert(fs.exists(commonSummaryPath)) } } } test("SPARK-10334 Projections and filters should be kept in physical plan") { withTempPath { dir => val path = dir.getCanonicalPath spark.range(2).select('id as 'a, 'id as 'b).write.partitionBy("b").parquet(path) val df = spark.read.parquet(path).filter('a === 0).select('b) val physicalPlan = df.queryExecution.sparkPlan assert(physicalPlan.collect { case p: execution.ProjectExec => p }.length === 1) assert(physicalPlan.collect { case p: execution.FilterExec => p }.length === 1) } } test("SPARK-11500: Not deterministic order of columns when using merging schemas.") { import testImplicits._ withSQLConf(SQLConf.PARQUET_SCHEMA_MERGING_ENABLED.key -> "true") { withTempPath { dir => val pathOne = s"${dir.getCanonicalPath}/part=1" Seq(1, 1).zipWithIndex.toDF("a", "b").write.parquet(pathOne) val pathTwo = s"${dir.getCanonicalPath}/part=2" Seq(1, 1).zipWithIndex.toDF("c", "b").write.parquet(pathTwo) val pathThree = s"${dir.getCanonicalPath}/part=3" Seq(1, 1).zipWithIndex.toDF("d", "b").write.parquet(pathThree) // The schema consists of the leading columns of the first part-file // in the lexicographic order. assert(spark.read.parquet(dir.getCanonicalPath).schema.map(_.name) === Seq("a", "b", "c", "d", "part")) } } } test(s"SPARK-13537: Fix readBytes in VectorizedPlainValuesReader") { withTempPath { file => val path = file.getCanonicalPath val schema = new StructType() .add("index", IntegerType, nullable = false) .add("col", ByteType, nullable = true) val data = Seq(Row(1, -33.toByte), Row(2, 0.toByte), Row(3, -55.toByte), Row(4, 56.toByte), Row(5, 127.toByte), Row(6, -44.toByte), Row(7, 23.toByte), Row(8, -95.toByte), Row(9, 127.toByte), Row(10, 13.toByte)) val rdd = spark.sparkContext.parallelize(data) val df = spark.createDataFrame(rdd, schema).orderBy("index").coalesce(1) df.write .mode("overwrite") .format(dataSourceName) .option("dataSchema", df.schema.json) .save(path) val loadedDF = spark .read .format(dataSourceName) .option("dataSchema", df.schema.json) .schema(df.schema) .load(path) .orderBy("index") checkAnswer(loadedDF, df) } } test("SPARK-13543: Support for specifying compression codec for Parquet via option()") { withSQLConf(SQLConf.PARQUET_COMPRESSION.key -> "UNCOMPRESSED") { withTempPath { dir => val path = s"${dir.getCanonicalPath}/table1" val df = (1 to 5).map(i => (i, (i % 2).toString)).toDF("a", "b") df.write .option("compression", "GzIP") .parquet(path) val compressedFiles = new File(path).listFiles() assert(compressedFiles.exists(_.getName.endsWith(".gz.parquet"))) val copyDf = spark .read .parquet(path) checkAnswer(df, copyDf) } } } }
lvdongr/spark
sql/hive/src/test/scala/org/apache/spark/sql/sources/ParquetHadoopFsRelationSuite.scala
Scala
apache-2.0
8,459