content
stringlengths 4
1.04M
| lang
stringclasses 358
values | score
int64 0
5
| repo_name
stringlengths 5
114
| repo_path
stringlengths 4
229
| repo_licenses
sequencelengths 1
8
|
---|---|---|---|---|---|
../../../tools/distrib/python_wrapper.sh | Shell | 1 | samotarnik/grpc | test/core/http/python_wrapper.sh | [
"Apache-2.0"
] |
module DotNotation exposing (expand, flatten, parse, serialize)
import Concourse exposing (JsonValue(..), decodeJsonValue, encodeJsonValue)
import Dict exposing (Dict)
import Json.Decode
import Json.Encode
import Parser
exposing
( (|.)
, (|=)
, DeadEnd
, Parser
, Problem(..)
, Trailing(..)
, andThen
, chompUntil
, chompWhile
, getChompedString
, getOffset
, getSource
, map
, oneOf
, problem
, sequence
, spaces
, succeed
, symbol
)
type alias DotNotation =
{ path : PathSegment
, fields : List PathSegment
, value : JsonValue
}
type alias PathSegment =
String
-- Flattening
flatten : Dict String JsonValue -> List DotNotation
flatten d =
Dict.toList d |> List.concatMap (\( path, val ) -> flattenHelper path [] val)
flattenHelper : PathSegment -> List PathSegment -> JsonValue -> List DotNotation
flattenHelper path fields value =
case value of
JsonObject kvPairs ->
kvPairs |> List.concatMap (\( k, v ) -> flattenHelper path (fields ++ [ k ]) v)
_ ->
[ { path = path, fields = fields, value = value } ]
-- Expanding
expand : List DotNotation -> Dict String JsonValue
expand =
List.foldl upsert Dict.empty
upsert : DotNotation -> Dict String JsonValue -> Dict String JsonValue
upsert { path, fields, value } =
Dict.update path
(\v ->
case v of
Just (JsonObject kvPairs) ->
case fields of
field :: rest ->
Dict.fromList kvPairs
|> upsert { path = field, fields = rest, value = value }
|> Dict.toList
|> List.sortBy Tuple.first
|> JsonObject
|> Just
[] ->
Just value
_ ->
Just <| constructValue (List.reverse fields) value
)
constructValue : List String -> JsonValue -> JsonValue
constructValue revFields value =
case revFields of
lastField :: rest ->
let
leaf =
JsonObject [ ( lastField, value ) ]
in
constructValue rest leaf
[] ->
value
-- Parsing
parse : String -> Result String DotNotation
parse =
Parser.run parser >> Result.mapError deadEndsToString
parser : Parser DotNotation
parser =
succeed DotNotation
|= pathSegment
|= oneOf
[ symbol "=" |> map (always [])
, sequence
{ start = "."
, separator = "."
, end = "="
, spaces = spaces
, item = pathSegment
, trailing = Forbidden
}
]
|= jsonValue
pathSegment : Parser PathSegment
pathSegment =
oneOf
[ quotedPathSegment
, unquotedPathSegment
]
|> andThen
(\s ->
if s == "" then
problem "Path segment must not be empty"
else
succeed s
)
quotedPathSegment : Parser PathSegment
quotedPathSegment =
getChompedString
(symbol "\""
|. chompUntil "\""
|. symbol "\""
)
|> map trimQuotes
trimQuotes : String -> String
trimQuotes =
String.slice 1 -1
unquotedPathSegment : Parser PathSegment
unquotedPathSegment =
getChompedString <|
chompWhile isValidPathSegmentChar
isValidPathSegmentChar : Char -> Bool
isValidPathSegmentChar c =
(c /= '=') && (c /= '.') && (not <| isSpace c)
isSpace : Char -> Bool
isSpace c =
(c == ' ') || (c == '\n') || (c == '\t') || (c == '\u{000D}')
jsonValue : Parser JsonValue
jsonValue =
succeed String.dropLeft
|= getOffset
|= getSource
|> andThen
(\s ->
case Json.Decode.decodeString decodeJsonValue s of
Ok v ->
succeed v
Err err ->
problem <| Json.Decode.errorToString err
)
-- Serializing
serialize : DotNotation -> ( String, String )
serialize { path, fields, value } =
let
k =
path
:: fields
|> List.map quoteIfNeeded
|> String.join "."
v =
Json.Encode.encode 0 (encodeJsonValue value)
in
( k, v )
quoteIfNeeded : String -> String
quoteIfNeeded s =
if String.all isValidPathSegmentChar s then
s
else
"\"" ++ s ++ "\""
------------------------------------------------------
-- Taken from https://github.com/elm/parser/pull/16 --
------------------------------------------------------
deadEndsToString : List DeadEnd -> String
deadEndsToString deadEnds =
String.concat (List.intersperse "; " (List.map deadEndToString deadEnds))
deadEndToString : DeadEnd -> String
deadEndToString deadend =
problemToString deadend.problem ++ " at row " ++ String.fromInt deadend.row ++ ", col " ++ String.fromInt deadend.col
problemToString : Problem -> String
problemToString p =
case p of
Expecting s ->
"expecting '" ++ s ++ "'"
ExpectingInt ->
"expecting int"
ExpectingHex ->
"expecting hex"
ExpectingOctal ->
"expecting octal"
ExpectingBinary ->
"expecting binary"
ExpectingFloat ->
"expecting float"
ExpectingNumber ->
"expecting number"
ExpectingVariable ->
"expecting variable"
ExpectingSymbol s ->
"expecting symbol '" ++ s ++ "'"
ExpectingKeyword s ->
"expecting keyword '" ++ s ++ "'"
ExpectingEnd ->
"expecting end"
UnexpectedChar ->
"unexpected char"
Problem s ->
"problem " ++ s
BadRepeat ->
"bad repeat"
| Elm | 5 | Caprowni/concourse | web/elm/src/DotNotation.elm | [
"Apache-2.0"
] |
//This file is part of "GZE - GroundZero Engine"
//The permisive licence allow to use GZE for free or commercial project (Apache License, Version 2.0).
//For conditions of distribution and use, see copyright notice in Licence.txt, this license must be included with any distribution of the code.
package {
import GZ.Base.Math.Math;
//import GZ.Base.Vec4;
<cpp_h>
#include "Lib_GZ/Base/Math/Math.h"
</cpp_h>
/**
* @author Maeiky
*/
//public vector Quaternion extends Vec4 {
public vector Quaternion {
/*
_aFaces[oGzSh->nStObjRot+_nIdx+0] = oShape->oQuaternion->nX;
_aFaces[oGzSh->nStObjRot+_nIdx+1] = oShape->oQuaternion->nY;
_aFaces[oGzSh->nStObjRot+_nIdx+2] = oShape->oQuaternion->nZ;
_aFaces[oGzSh->nStObjRot+_nIdx+3] = oShape->oQuaternion->nW;
*/
public var nX : Number;
public var nY : Number;
public var nZ : Number;
public var nW : Number;
public function Quaternion():Void {
//Vec4(0,0,0,1);
}
public function fReset():Void {
nX = 0;
nY = 0;
nZ = 0;
nW = 1;
}
public function fRoll(_nAngle : Float):Void {
var _nResW : Float = Math.fCos(0.5 * _nAngle) ;
var _nResZ : Float = Math.fSin(0.5 * _nAngle);
var _nTempX : Float = (nX * _nResW) - (nY * _nResZ);
var _nTempZ : Float = (nZ * _nResW) + (nW * _nResZ);
nY = (nY * _nResW) + (nX * _nResZ);
nW = (nW * _nResW) - (nZ * _nResZ);
nX = _nTempX;
nZ = _nTempZ;
}
public function fYaw(_nAngle : Float):Void {
var _nResW : Float = Math.fCos(0.5 * _nAngle) ;
var _nResY : Float = Math.fSin(0.5 * _nAngle);
var _nTempX : Float = (nX * _nResW) + (nZ * _nResY);
var _nTempY : Float = (nY * _nResW) + (nW * _nResY);
nZ = (nZ * _nResW) - (nX * _nResY);
nW = (nW * _nResW) - (nY * _nResY);
nX = _nTempX;
nY = _nTempY;
}
public function fPitch(_nAngle : Float):Void {
var _nResW : Float = Math.fCos(0.5 * _nAngle);
var _nResX : Float = Math.fSin(0.5 * _nAngle);
var _nTempX : Float = (nX * _nResW) + (nW * _nResX);
var _nTempY : Float = (nY * _nResW) - (nZ * _nResX);
nZ = (nZ * _nResW) + (nY * _nResX);
nW = (nW * _nResW) - (nX * _nResX);
nX = _nTempX;
nY = _nTempY;
}
public function fCombine(_oOther : Quaternion<Number> ):Void {
var _nTempX : Float = (nX * _oOther.nW) + (nW * _oOther.nX) + (nZ * _oOther.nY) - (nY * _oOther.nZ);
var _nTempY : Float = (nY * _oOther.nW) + (nW * _oOther.nY) + (nX * _oOther.nZ) - (nZ * _oOther.nX);
var _nTempZ : Float = (nZ * _oOther.nW) + (nW * _oOther.nZ) + (nY * _oOther.nX) - (nX * _oOther.nY);
nW = (nW * _oOther.nW) - (nX * _oOther.nX) - (nY * _oOther.nY) - (nZ * _oOther.nZ);
nX = _nTempX;
nY = _nTempY;
nZ = _nTempZ;
}
public function fInverse():Void {
/*
var _v180 : Quaternion<Number> = new Quaternion<Number>();
_v180.nY = 1;
*/
<cpp>
gzVecQuaternion<T> _oQuat({0,0,-1,1});
//_oQuat.fPitch(3.1416);
//_oQuat.fYaw(3.1416);
//_oQuat.fRoll(3.1416);
fCombine(_oQuat);
</cpp>
}
}
}
| Redcode | 3 | VLiance/GZE | src/Lib_GZ/Base/Quaternion.cw | [
"Apache-2.0"
] |
VITE_APP_URL=http://start.duoli.com
# 打包环境
NODE_ENV=production
| Self | 2 | imvkmark/wulicode-tools | config/.env.self | [
"MIT"
] |
--# -path=.:alltenses:prelude
resource CombinatorsBul = Combinators - [appCN, appCNc] with
(Cat = CatBul),
(Structural = StructuralBul),
(Noun = NounBul),
(Constructors = ConstructorsBul) **
{
oper
appCN : CN -> NP -> NP
= \cn,x -> mkNP the_Art (PossNP cn x) ;
appCNc : CN -> [NP] -> NP
= \cn,xs -> let np : NP = mkNP and_Conj xs
in mkNP the_Art (PossNP cn np) ;
}
| Grammatical Framework | 4 | daherb/gf-rgl | src/api/CombinatorsBul.gf | [
"BSD-3-Clause"
] |
#t {
text-name: valid;
text-face-name: 2;
}
| CartoCSS | 0 | nimix/carto | test/errorhandling/issue297.mss | [
"Apache-2.0"
] |
<?xml version="1.0" encoding="UTF-8"?>
<!-- ******************************************************************* -->
<!-- -->
<!-- Copyright IBM Corp. 2010, 2014 -->
<!-- -->
<!-- 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. -->
<!-- -->
<!-- ******************************************************************* -->
<!-- DO NOT EDIT. THIS FILE IS GENERATED. -->
<faces-config>
<faces-config-extension>
<namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri>
<default-prefix>xe</default-prefix>
<designer-extension>
<control-subpackage-name>layout</control-subpackage-name>
</designer-extension>
</faces-config-extension>
<component>
<description>%component.applicationLayout.descr%</description>
<display-name>%component.applicationLayout.name%</display-name>
<component-type>com.ibm.xsp.extlib.layout.ApplicationLayout</component-type>
<component-class>com.ibm.xsp.extlib.component.layout.UIApplicationLayout</component-class>
<property>
<description>%property.configuration.descr%</description>
<display-name>%property.configuration.name%</display-name>
<property-name>configuration</property-name>
<property-class>com.ibm.xsp.extlib.component.layout.ApplicationConfiguration</property-class>
<property-extension>
<required>true</required>
<allow-run-time-binding>false</allow-run-time-binding>
<designer-extension>
<category>basics</category>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.onItemClick.descr%</description>
<display-name>%property.onItemClick.name%</display-name>
<property-name>onItemClick</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<category>events</category>
<event>true</event>
<subcategory>container-event</subcategory>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<component-extension>
<component-family>com.ibm.xsp.extlib.layout.ApplicationLayout</component-family>
<renderer-type>com.ibm.xsp.extlib.layout.OneUIApplicationLayout</renderer-type>
<tag-name>applicationLayout</tag-name>
<designer-extension>
<in-palette>true</in-palette>
<category>Extension Library</category>
<tags>
todo
</tags>
<render-markup><?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

<xp:callback id="MastHeader" facetName="MastHeader"/>

<xp:div style="background-color:#CEE1FC; padding:5px">
<table width="98%"><tr><td>
{logo} &#160; {bannerApplicationLinks}
</td><td align="right">{bannerUtilityLinks}</td></tr></table>
<xp:table style="width: 98%; background-color:#FFFFFF">
<xp:tr>
<xp:td colspan="3" style="background-color:#4586D3">
<table width="100%"><tr><td>
<table><tr>
<td style="background-color:#4372A9;color:#FFFFFF">
{titleBarTabs}</td>
<td style="background-color:#E4E8EF">
selected</td>
</tr></table>
</td><td>
<div style="float:right;background:#FFFFFF">
<xp:callback id="SearchBar" facetName="SearchBar"/>

{searchBar}</div>
</td></tr></table>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td colspan="3" style="background-color:#E4E8EF">
<table width="100%"><tr><td><h2>{placeBarName}</h2></td>
<td> 
<div style="float:right;border:thin solid #C0C7CD">
{placeBarActions}</div></td>
</tr></table>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="width:123px" valign="top">
<xp:callback id="LeftColumn" facetName="LeftColumn"/>
</xp:td>
<xp:td valign="top">
<xp:callback id="callback1"/>
<xp:br/><xp:br/><xp:br/>
</xp:td>
<xp:td style="width:123px" valign="top">
<xp:callback id="RightColumn" facetName="RightColumn" />
</xp:td>
</xp:tr>
</xp:table>
<xp:table style="width: 98%; background-color:#FFFFFF; margin-top:5px">
<xp:tr><xp:td> {footerLinks}</xp:td></xp:tr>
</xp:table>
{legalText}
</xp:div>

<xp:callback id="MastFooter" facetName="MastFooter"/>

</xp:view>
</render-markup>
</designer-extension>
</component-extension>
</component>
<complex-type>
<description>%complex-type.com.ibm.xsp.extlib.component.layout.ApplicationConfiguration.descr%</description>
<display-name>%complex-type.com.ibm.xsp.extlib.component.layout.ApplicationConfiguration.name%</display-name>
<complex-id>com.ibm.xsp.extlib.component.layout.ApplicationConfiguration</complex-id>
<complex-class>com.ibm.xsp.extlib.component.layout.ApplicationConfiguration</complex-class>
</complex-type>
<complex-type>
<description>%complex-type.applicationConfiguration.descr%</description>
<display-name>%complex-type.applicationConfiguration.name%</display-name>
<complex-id>com.ibm.xsp.extlib.component.layout.impl.BasicApplicationConfigurationImpl</complex-id>
<complex-class>com.ibm.xsp.extlib.component.layout.impl.BasicApplicationConfigurationImpl</complex-class>
<property>
<description>%property.defaultNavigationPath.descr%</description>
<display-name>%property.defaultNavigationPath.name%</display-name>
<property-name>defaultNavigationPath</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<tags>
todo
</tags>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
/tab1/link1
/tab1/link2
/tab2/link1
/tab2/link2
</editor-parameter>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.navigationPath.descr%</description>
<display-name>%property.navigationPath.name%</display-name>
<property-name>navigationPath</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<tags>
todo
</tags>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
/tab1/link1
/tab1/link2
/tab2/link1
/tab2/link2
</editor-parameter>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.banner.descr%</description>
<display-name>%property.banner.name%</display-name>
<property-name>banner</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.mastHeader.descr%</description>
<display-name>%property.mastHeader.name%</display-name>
<property-name>mastHeader</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.mastFooter.descr%</description>
<display-name>%property.mastFooter.name%</display-name>
<property-name>mastFooter</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.productLogo.descr%</description>
<display-name>%property.productLogo.name%</display-name>
<property-name>productLogo</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.ImagePicker</editor>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.productLogoClass.descr%</description>
<display-name>%property.productLogoClass.name%</display-name>
<property-name>productLogoClass</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.StyleClassEditor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.productLogoStyle.descr%</description>
<display-name>%property.productLogoStyle.name%</display-name>
<property-name>productLogoStyle</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.StylesEditor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.productLogoAlt.descr%</description>
<display-name>%property.productLogoAlt.name%</display-name>
<property-name>productLogoAlt</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.productLogoWidth.descr%</description>
<display-name>%property.productLogoWidth.name%</display-name>
<property-name>productLogoWidth</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
50%
30px
10em
2cm
auto
inherit
</editor-parameter>
<tags>
not-image-path
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.productLogoHeight.descr%</description>
<display-name>%property.productLogoHeight.name%</display-name>
<property-name>productLogoHeight</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
50%
30px
10em
2cm
auto
inherit
</editor-parameter>
<tags>
not-image-path
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.bannerApplicationLinks.descr%</description>
<display-name>%property.bannerApplicationLinks.name%</display-name>
<property-name>bannerApplicationLinks</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addBannerApplicationLink</property-add-method>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.bannerUtilityLinks.descr%</description>
<display-name>%property.bannerUtilityLinks.name%</display-name>
<property-name>bannerUtilityLinks</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addBannerUtilityLink</property-add-method>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.titleBar.descr%</description>
<display-name>%property.titleBar.name%</display-name>
<property-name>titleBar</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.titleBarName.descr%</description>
<display-name>%property.titleBarName.name%</display-name>
<property-name>titleBarName</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.titleBarLabel.descr%</description>
<display-name>%property.titleBarLabel.name%</display-name>
<property-name>titleBarLabel</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<since>9.0.0.v00_03</since>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.titleBarTabs.descr%</description>
<display-name>%property.titleBarTabs.name%</display-name>
<property-name>titleBarTabs</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addTitleBarTab</property-add-method>
</property-extension>
</property>
<property>
<description>%property.searchBar.descr%</description>
<display-name>%property.searchBar.name%</display-name>
<property-name>searchBar</property-name>
<property-class>com.ibm.xsp.extlib.component.layout.impl.SearchBar</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
</property-extension>
</property>
<property>
<description>%property.placeBar.descr%</description>
<display-name>%property.placeBar.name%</display-name>
<property-name>placeBar</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.placeBarName.descr%</description>
<display-name>%property.placeBarName.name%</display-name>
<property-name>placeBarName</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
<designer-extension>
<tags>
localizable-text
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.placeBarLabel.descr%</description>
<display-name>%property.placeBarLabel.name%</display-name>
<property-name>placeBarLabel</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<since>9.0.0.v00_03</since>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.placeBarActions.descr%</description>
<display-name>%property.placeBarActions.name%</display-name>
<property-name>placeBarActions</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addPlaceBarAction</property-add-method>
</property-extension>
</property>
<property>
<description>%property.footer.descr%</description>
<display-name>%property.footer.name%</display-name>
<property-name>footer</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.footerLinks.descr%</description>
<display-name>%property.footerLinks.name%</display-name>
<property-name>footerLinks</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addFooterLink</property-add-method>
</property-extension>
</property>
<property>
<description>%property.legal.descr%</description>
<display-name>%property.legal.name%</display-name>
<property-name>legal</property-name>
<property-class>boolean</property-class>
<property-extension>
<default-value>true</default-value>
<designer-extension>
<tags>
runtime-default-true
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalLogo.descr%</description>
<display-name>%property.legalLogo.name%</display-name>
<property-name>legalLogo</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.ImagePicker</editor>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalLogoClass.descr%</description>
<display-name>%property.legalLogoClass.name%</display-name>
<property-name>legalLogoClass</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.StyleClassEditor</editor>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalLogoStyle.descr%</description>
<display-name>%property.legalLogoStyle.name%</display-name>
<property-name>legalLogoStyle</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.StylesEditor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalLogoAlt.descr%</description>
<display-name>%property.legalLogoAlt.name%</display-name>
<property-name>legalLogoAlt</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.legalLogoWidth.descr%</description>
<display-name>%property.legalLogoWidth.name%</display-name>
<property-name>legalLogoWidth</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
50%
30px
10em
2cm
auto
inherit
</editor-parameter>
<tags>
not-image-path
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalLogoHeight.descr%</description>
<display-name>%property.legalLogoHeight.name%</display-name>
<property-name>legalLogoHeight</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
30px
50%
10em
auto
inherit
</editor-parameter>
<tags>
todo
not-image-path
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legalText.descr%</description>
<display-name>%property.legalText.name%</display-name>
<property-name>legalText</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.leftColumnLabel.descr%</description>
<display-name>%property.leftColumnLabel.name%</display-name>
<property-name>leftColumnLabel</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<since>9.0.0.v00_03</since>
<localizable>true</localizable>
</property-extension>
</property>
<property>
<description>%property.rightColumnLabel.descr%</description>
<display-name>%property.rightColumnLabel.name%</display-name>
<property-name>rightColumnLabel</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<since>9.0.0.v00_03</since>
<localizable>true</localizable>
</property-extension>
</property>
<complex-extension>
<base-complex-id>com.ibm.xsp.extlib.component.layout.ApplicationConfiguration</base-complex-id>
<tag-name>applicationConfiguration</tag-name>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</complex-extension>
</complex-type>
<complex-type>
<description>%complex-type.appSearchBar.descr%</description>
<display-name>%complex-type.appSearchBar.name%</display-name>
<complex-id>com.ibm.xsp.extlib.component.layout.impl.SearchBar</complex-id>
<complex-class>com.ibm.xsp.extlib.component.layout.impl.SearchBar</complex-class>
<property>
<description>%property.pageName.descr%</description>
<display-name>%property.pageName.name%</display-name>
<property-name>pageName</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<required>true</required>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.PagePicker</editor>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.queryParam.descr%</description>
<display-name>%property.queryParam.name%</display-name>
<property-name>queryParam</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.inactiveText.descr%</description>
<display-name>%property.inactiveText.name%</display-name>
<property-name>inactiveText</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.options.descr%</description>
<display-name>%property.options.name%</display-name>
<property-name>options</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<allow-run-time-binding>false</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.ibm.xsp.extlib.tree.ITreeNode</property-item-class>
<property-add-method>addOption</property-add-method>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.optionsParam.descr%</description>
<display-name>%property.optionsParam.name%</display-name>
<property-name>optionsParam</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.rendered.descr%</description>
<display-name>%property.rendered.name%</display-name>
<property-name>rendered</property-name>
<property-class>boolean</property-class>
<property-extension>
<designer-extension>
<tags>
todo
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.scopeTitle.descr%</description>
<display-name>%property.scopeTitle.name%</display-name>
<property-name>scopeTitle</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
<designer-extension>
<tags>
is-accessibility-title
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.inputTitle.descr%</description>
<display-name>%property.inputTitle.name%</display-name>
<property-name>inputTitle</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
<designer-extension>
<tags>
is-accessibility-title
</tags>
</designer-extension>
</property-extension>
</property>
<property>
<description>%property.legend.descr%</description>
<display-name>%property.legend.name%</display-name>
<property-name>legend</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<localizable>true</localizable>
</property-extension>
</property>
<complex-extension>
<tag-name>appSearchBar</tag-name>
</complex-extension>
</complex-type>
</faces-config>
| XPages | 3 | jesse-gallagher/XPagesExtensionLibrary | extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-layout.xsp-config | [
"Apache-2.0"
] |
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
(*****************************************************************************)
(* The environment shared by everyone *)
(*****************************************************************************)
(* This is in fact a fake time module, we don't want to use the "real"
* unix timestamps, because we would run into atomicity problems.
* Problems like, what happens if the file was modified between the moment
* where I checked the time stamp and now etc ...
* So we maintain our own clock. It is incremented by one on every event.
*)
module Time : sig
type t
val get : unit -> t
val compare : t -> t -> int
(* The beginning of times *)
val bot : t
val to_string : t -> string
end
(* Our fancy Avl (cf monoidAvl.ml) *)
module TimeFiles : MonoidAvl.S with type elt = Time.t * string with type monoelt = Time.t
type t = {
(* The fsnotify environment, we use this for interacting with fsnotify *)
fsnotify: Fsnotify.env;
(* The set of files with their timestamp *)
mutable files: TimeFiles.t;
(* The set of new files (files created during an event) *)
mutable new_files: SSet.t;
(* The directories (and the files they contain) *)
mutable dirs: SSet.t SMap.t;
}
(*****************************************************************************)
(* Building the original environment, this call is called only once
* by the server (cf dfindServer.ml)
*)
(*****************************************************************************)
val make : string list -> t
| OCaml | 4 | esilkensen/flow | src/hack_forked/dfind/dfindEnv.mli | [
"MIT"
] |
<html>
<head>
<title> Firebase Auth + Hasura JWT example </title>
</head>
<body>
<h1> Firebase Auth + Hasura JWT example </h1>
<form id="login-form">
Email: <input id="email" type="email"/>
Password: <input id="password" type="password" />
<button type="submit">Login</button>
</form>
<button id="get-token"> Get ID token </button>
<div id="id-token"></div>
<script src="https://www.gstatic.com/firebasejs/5.5.3/firebase.js"></script>
<script src="main.js"></script>
</body>
</html>
| HTML | 3 | gh-oss-contributor/graphql-engine-1 | community/sample-apps/firebase-jwt/app/index.html | [
"Apache-2.0",
"MIT"
] |
module Issue157 where
X : Set
X = _
error : Set
error = Set
| Agda | 1 | cruhland/agda | test/interaction/Issue157.agda | [
"MIT"
] |
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="urn:test.example.org"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:test.example.org"
xmlns:ens="urn:object.test.example.org">
<types>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:object.test.example.org">
<import namespace="urn:test.example.org"/>
<complexType name="genericObject">
<sequence>
<element name="type" type="xsd:string"/>
<element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<element name="Id" type="tns:ID" nillable="true" />
<any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:test.example.org">
<import namespace="urn:object.test.example.org"/>
<simpleType name="ID">
<restriction base="xsd:string">
<length value="18"/>
<pattern value='[a-zA-Z0-9]{18}'/>
</restriction>
</simpleType>
<element name="query">
<complexType>
<sequence>
<element name="queryString" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="queryResponse">
<complexType>
<sequence>
<element name="result" type="tns:QueryResult"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="queryRequest">
<part element="tns:query" name="parameters"/>
</message>
<message name="queryResponse">
<part element="tns:queryResponse" name="parameters"/>
</message>
<portType name="Soap">
<operation name="query">
<documentation>Create a Query Cursor</documentation>
<input message="tns:queryRequest"/>
<output message="tns:queryResponse"/>
</operation>
</portType>
<binding name="SoapBinding" type="tns:Soap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="query">
<soap:operation soapAction=""/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TestService">
<port binding="tns:SoapBinding" name="Soap">
<soap:address location="https://localhost/services/Soap/u/31.0"/>
</port>
</service>
</definitions>
| XML | 4 | thiagooak/php-src | ext/soap/tests/bugs/bug73237.wsdl | [
"PHP-3.01"
] |
module opengles2_hello_triangle
import glesv2
import egl
import mnit_linux # for sdl
import x11
if "NIT_TESTING".environ == "true" then exit(0)
var window_width = 800
var window_height = 600
#
## SDL
#
var sdl_display = new SDLDisplay(window_width, window_height)
var sdl_wm_info = new SDLSystemWindowManagerInfo
var x11_window_handle = sdl_wm_info.x11_window_handle
#
## X11
#
var x_display = x_open_default_display
assert x_display != 0 else print "x11 fail"
#
## EGL
#
var egl_display = new EGLDisplay(x_display)
assert egl_display.is_valid else print "EGL display is not valid"
egl_display.initialize
print "EGL version: {egl_display.version}"
print "EGL vendor: {egl_display.vendor}"
print "EGL extensions: {egl_display.extensions.join(", ")}"
print "EGL client APIs: {egl_display.client_apis.join(", ")}"
assert egl_display.is_valid else print egl_display.error
var config_chooser = new EGLConfigChooser
#config_chooser.surface_type_egl
config_chooser.blue_size = 8
config_chooser.green_size = 8
config_chooser.red_size = 8
#config_chooser.alpha_size = 8
#config_chooser.depth_size = 8
#config_chooser.stencil_size = 8
#config_chooser.sample_buffers = 1
config_chooser.close
var configs = config_chooser.choose(egl_display)
assert configs != null else print "choosing config failed: {egl_display.error}"
assert not configs.is_empty else print "no EGL config"
print "{configs.length} EGL configs available"
for config in configs do
var attribs = config.attribs(egl_display)
print "* caveats: {attribs.caveat}"
print " conformant to: {attribs.conformant}"
print " size of RGBA: {attribs.red_size} {attribs.green_size} {attribs.blue_size} {attribs.alpha_size}"
print " buffer, depth, stencil: {attribs.buffer_size} {attribs.depth_size} {attribs.stencil_size}"
end
var config = configs.first
var format = config.attribs(egl_display).native_visual_id
# TODO android part
# Opengles1Display_midway_init(recv, format);
var surface = egl_display.create_window_surface(config, x11_window_handle, [0])
assert surface.is_ok else print egl_display.error
var context = egl_display.create_context(config)
assert context.is_ok else print egl_display.error
var make_current_res = egl_display.make_current(surface, surface, context)
assert make_current_res
var width = surface.attribs(egl_display).width
var height = surface.attribs(egl_display).height
print "Width: {width}"
print "Height: {height}"
assert egl_bind_opengl_es_api else print "eglBingAPI failed: {egl_display.error}"
#
## GLESv2
#
print "Can compile shaders? {gl_shader_compiler}"
assert_no_gl_error
assert gl_shader_compiler else print "Cannot compile shaders"
# gl program
print gl_error.to_s
var program = new GLProgram
if not program.is_ok then
print "Program is not ok: {gl_error.to_s}\nLog:"
print program.info_log
abort
end
assert_no_gl_error
# vertex shader
var vertex_shader = new GLVertexShader
assert vertex_shader.is_ok else print "Vertex shader is not ok: {gl_error}"
vertex_shader.source = """
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
} """
vertex_shader.compile
assert vertex_shader.is_compiled else print "Vertex shader compilation failed with: {vertex_shader.info_log} {program.info_log}"
assert_no_gl_error
# fragment shader
var fragment_shader = new GLFragmentShader
assert fragment_shader.is_ok else print "Fragment shader is not ok: {gl_error}"
fragment_shader.source = """
precision mediump float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
"""
fragment_shader.compile
assert fragment_shader.is_compiled else print "Fragment shader compilation failed with: {fragment_shader.info_log}"
assert_no_gl_error
program.attach_shader vertex_shader
program.attach_shader fragment_shader
program.bind_attrib_location(0, "vPosition")
program.link
assert program.is_linked else print "Linking failed: {program.info_log}"
assert_no_gl_error
# draw!
var vertices = [0.0, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, -0.5, 0.0]
var vertex_array = new VertexArray(0, 3, vertices)
vertex_array.attrib_pointer
gl_clear_color(0.5, 0.0, 0.5, 1.0)
for i in [0..10000[ do
printn "."
assert_no_gl_error
gl_viewport(0, 0, width, height)
gl_clear_color_buffer
program.use
vertex_array.enable
vertex_array.draw_arrays_triangles
egl_display.swap_buffers(surface)
end
# delete
program.delete
vertex_shader.delete
fragment_shader.delete
#
## EGL
#
# close
egl_display.make_current(new EGLSurface.none, new EGLSurface.none, new EGLContext.none)
egl_display.destroy_context(context)
egl_display.destroy_surface(surface)
#
## SDL
#
# close
sdl_display.destroy
| Nit | 3 | polyrabbit/polyglot | corpus/Nit/opengles2_hello_triangle.nit | [
"BSD-3-Clause"
] |
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 4772, 134]
NotebookOptionsPosition[ 4438, 118]
NotebookOutlinePosition[ 4797, 134]
CellTagsIndexPosition[ 4754, 131]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
RowBox[{
RowBox[{"(*", " ",
RowBox[{
"Code", " ", "to", " ", "generate", " ", "tests", " ", "for", " ", "the",
" ", "FFTW", " ", "wrapper", " ", "routines"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"SetDirectory", "[",
RowBox[{"NotebookDirectory", "[", "]"}], "]"}], ";"}]}]], "Input",
CellChangeTimes->{{3.631380318636713*^9, 3.631380353051236*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"(*", " ",
RowBox[{"Writer", " ", "function"}], " ", "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Clear", "[", "writeArr", "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"writeArr", "[",
RowBox[{"dim_", ",", " ", "fn_"}], "]"}], ":=", " ",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"a", ",", "b", ",", "fs"}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"a", " ", "=", " ",
RowBox[{"RandomReal", "[",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",", "1"}], "}"}], ",", "dim"}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"b", " ", "=", " ",
RowBox[{"Fourier", "[",
RowBox[{"a", ",",
RowBox[{"FourierParameters", "\[Rule]",
RowBox[{"{",
RowBox[{"1", ",",
RowBox[{"-", "1"}]}], "}"}]}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"fs", " ", "=", " ",
RowBox[{"OpenWrite", "[",
RowBox[{"fn", ",",
RowBox[{"BinaryFormat", "\[Rule]", "True"}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"BinaryWrite", "[",
RowBox[{"fs", ",", "dim", ",", "\"\<Integer32\>\"", ",",
RowBox[{"ByteOrdering", "\[Rule]",
RowBox[{"-", "1"}]}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"BinaryWrite", "[",
RowBox[{"fs", ",", "a", ",", " ", "\"\<Real64\>\"", ",",
RowBox[{"ByteOrdering", "\[Rule]",
RowBox[{"-", "1"}]}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"BinaryWrite", "[",
RowBox[{"fs", ",", "b", ",", " ", "\"\<Complex128\>\"", ",",
RowBox[{"ByteOrdering", "\[Rule]",
RowBox[{"-", "1"}]}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"Close", "[", "fs", "]"}], ";"}]}], "\[IndentingNewLine]",
"]"}]}], ";"}]}]}]], "Input",
CellChangeTimes->{{3.6314031420946503`*^9, 3.631403228628937*^9},
3.631403568538219*^9, {3.631403642441084*^9, 3.631403644567264*^9}, {
3.6314859331654587`*^9, 3.631486000263154*^9}, {3.631486041501898*^9,
3.6314860593443947`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"(*", " ",
RowBox[{"Do", " ", "the", " ", "1", "D", " ", "case", " ", "first"}], " ",
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"SeedRandom", "[", "1234", "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"writeArr", "[",
RowBox[{
RowBox[{"{", "100", "}"}], ",", "\"\<arr1d.dat\>\""}], "]"}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"writeArr", "[",
RowBox[{
RowBox[{"{",
RowBox[{"32", ",", "18"}], "}"}], ",", "\"\<arr2d.dat\>\""}], "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"writeArr", "[",
RowBox[{
RowBox[{"{",
RowBox[{"12", ",", "8", ",", "15"}], "}"}], ",", "\"\<arr3d.dat\>\""}],
"]"}], ";"}], "\[IndentingNewLine]"}]}]], "Input",
CellChangeTimes->{{3.63138035587591*^9, 3.631380473383889*^9}, {
3.6313805422790413`*^9, 3.631380569161026*^9}, {3.6313806075965*^9,
3.6313806864208307`*^9}, {3.631402936953382*^9, 3.631402967845344*^9},
3.6314032157246847`*^9, {3.631403283554654*^9, 3.631403340824667*^9}, {
3.631403442566831*^9, 3.631403445589222*^9}, {3.631403498667458*^9,
3.631403572569734*^9}}]
},
WindowSize->{808, 751},
WindowMargins->{{237, Automatic}, {Automatic, 46}},
FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September 9, \
2014)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 408, 10, 46, "Input"],
Cell[969, 32, 2257, 52, 199, "Input"],
Cell[3229, 86, 1205, 30, 148, "Input"]
}
]
*)
(* End of internal cache information *)
| Mathematica | 3 | jhh67/chapel | test/users/npadmana/fftw/FFTgentest.nb | [
"ECL-2.0",
"Apache-2.0"
] |
%include lhs2TeX.sty
| Literate Haskell | 0 | cruhland/agda | notes/papers/implicit/lhs2TeXpreamble.lhs | [
"MIT"
] |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <benchmark/benchmark.h>
#include <folly/dynamic.h>
#include <folly/json.h>
#include <react/renderer/components/view/ViewComponentDescriptor.h>
#include <react/renderer/core/EventDispatcher.h>
#include <react/renderer/core/RawProps.h>
#include <react/utils/ContextContainer.h>
#include <exception>
#include <string>
namespace facebook {
namespace react {
auto contextContainer = std::make_shared<ContextContainer const>();
auto eventDispatcher = std::shared_ptr<EventDispatcher>{nullptr};
auto viewComponentDescriptor = ViewComponentDescriptor{
ComponentDescriptorParameters{eventDispatcher, contextContainer}};
auto emptyPropsDynamic = folly::parseJson("{}");
auto propsString = std::string{
R"({"flex": 1, "padding": 10, "position": "absolute", "display": "none", "nativeID": "some-id", "direction": "rtl"})"};
auto propsDynamic = folly::parseJson(propsString);
auto propsStringWithSomeUnsupportedProps = std::string{
R"({"someName1": 1, "someName2": 10, "someName3": "absolute", "someName4": "none", "someName5": "some-id", "someName6": "rtl"})"};
auto unsupportedPropsDynamic =
folly::parseJson(propsStringWithSomeUnsupportedProps);
auto sourceProps = ViewProps{};
auto sharedSourceProps = ViewShadowNode::defaultSharedProps();
static void emptyPropCreation(benchmark::State &state) {
for (auto _ : state) {
ViewProps{};
}
}
BENCHMARK(emptyPropCreation);
static void propParsingEmptyRawProps(benchmark::State &state) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
for (auto _ : state) {
viewComponentDescriptor.cloneProps(
parserContext, sharedSourceProps, RawProps{emptyPropsDynamic});
}
}
BENCHMARK(propParsingEmptyRawProps);
static void propParsingRegularRawProps(benchmark::State &state) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
for (auto _ : state) {
viewComponentDescriptor.cloneProps(
parserContext, sharedSourceProps, RawProps{propsDynamic});
}
}
BENCHMARK(propParsingRegularRawProps);
static void propParsingUnsupportedRawProps(benchmark::State &state) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
for (auto _ : state) {
viewComponentDescriptor.cloneProps(
parserContext, sharedSourceProps, RawProps{unsupportedPropsDynamic});
}
}
BENCHMARK(propParsingUnsupportedRawProps);
static void propParsingRegularRawPropsWithNoSourceProps(
benchmark::State &state) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
for (auto _ : state) {
viewComponentDescriptor.cloneProps(
parserContext, nullptr, RawProps{propsDynamic});
}
}
BENCHMARK(propParsingRegularRawPropsWithNoSourceProps);
} // namespace react
} // namespace facebook
BENCHMARK_MAIN();
| C++ | 3 | shreejitverma/react-native | ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp | [
"CC-BY-4.0",
"MIT"
] |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. 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.
""" Convert BertExtAbs's checkpoints.
The script looks like it is doing something trivial but it is not. The "weights"
proposed by the authors are actually the entire model pickled. We need to load
the model within the original codebase to be able to only save its `state_dict`.
"""
import argparse
import logging
from collections import namedtuple
import torch
from model_bertabs import BertAbsSummarizer
from models.model_builder import AbsSummarizer # The authors' implementation
from transformers import BertTokenizer
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
SAMPLE_TEXT = "Hello world! cécé herlolip"
BertAbsConfig = namedtuple(
"BertAbsConfig",
[
"temp_dir",
"large",
"use_bert_emb",
"finetune_bert",
"encoder",
"share_emb",
"max_pos",
"enc_layers",
"enc_hidden_size",
"enc_heads",
"enc_ff_size",
"enc_dropout",
"dec_layers",
"dec_hidden_size",
"dec_heads",
"dec_ff_size",
"dec_dropout",
],
)
def convert_bertabs_checkpoints(path_to_checkpoints, dump_path):
"""Copy/paste and tweak the pre-trained weights provided by the creators
of BertAbs for the internal architecture.
"""
# Instantiate the authors' model with the pre-trained weights
config = BertAbsConfig(
temp_dir=".",
finetune_bert=False,
large=False,
share_emb=True,
use_bert_emb=False,
encoder="bert",
max_pos=512,
enc_layers=6,
enc_hidden_size=512,
enc_heads=8,
enc_ff_size=512,
enc_dropout=0.2,
dec_layers=6,
dec_hidden_size=768,
dec_heads=8,
dec_ff_size=2048,
dec_dropout=0.2,
)
checkpoints = torch.load(path_to_checkpoints, lambda storage, loc: storage)
original = AbsSummarizer(config, torch.device("cpu"), checkpoints)
original.eval()
new_model = BertAbsSummarizer(config, torch.device("cpu"))
new_model.eval()
# -------------------
# Convert the weights
# -------------------
logging.info("convert the model")
new_model.bert.load_state_dict(original.bert.state_dict())
new_model.decoder.load_state_dict(original.decoder.state_dict())
new_model.generator.load_state_dict(original.generator.state_dict())
# ----------------------------------
# Make sure the outpus are identical
# ----------------------------------
logging.info("Make sure that the models' outputs are identical")
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
# prepare the model inputs
encoder_input_ids = tokenizer.encode("This is sample éàalj'-.")
encoder_input_ids.extend([tokenizer.pad_token_id] * (512 - len(encoder_input_ids)))
encoder_input_ids = torch.tensor(encoder_input_ids).unsqueeze(0)
decoder_input_ids = tokenizer.encode("This is sample 3 éàalj'-.")
decoder_input_ids.extend([tokenizer.pad_token_id] * (512 - len(decoder_input_ids)))
decoder_input_ids = torch.tensor(decoder_input_ids).unsqueeze(0)
# failsafe to make sure the weights reset does not affect the
# loaded weights.
assert torch.max(torch.abs(original.generator[0].weight - new_model.generator[0].weight)) == 0
# forward pass
src = encoder_input_ids
tgt = decoder_input_ids
segs = token_type_ids = None
clss = None
mask_src = encoder_attention_mask = None
mask_tgt = decoder_attention_mask = None
mask_cls = None
# The original model does not apply the geneator layer immediatly but rather in
# the beam search (where it combines softmax + linear layer). Since we already
# apply the softmax in our generation process we only apply the linear layer here.
# We make sure that the outputs of the full stack are identical
output_original_model = original(src, tgt, segs, clss, mask_src, mask_tgt, mask_cls)[0]
output_original_generator = original.generator(output_original_model)
output_converted_model = new_model(
encoder_input_ids, decoder_input_ids, token_type_ids, encoder_attention_mask, decoder_attention_mask
)[0]
output_converted_generator = new_model.generator(output_converted_model)
maximum_absolute_difference = torch.max(torch.abs(output_converted_model - output_original_model)).item()
print("Maximum absolute difference beween weights: {:.2f}".format(maximum_absolute_difference))
maximum_absolute_difference = torch.max(torch.abs(output_converted_generator - output_original_generator)).item()
print("Maximum absolute difference beween weights: {:.2f}".format(maximum_absolute_difference))
are_identical = torch.allclose(output_converted_model, output_original_model, atol=1e-3)
if are_identical:
logging.info("all weights are equal up to 1e-3")
else:
raise ValueError("the weights are different. The new model is likely different from the original one.")
# The model has been saved with torch.save(model) and this is bound to the exact
# directory structure. We save the state_dict instead.
logging.info("saving the model's state dictionary")
torch.save(
new_model.state_dict(), "./bertabs-finetuned-cnndm-extractive-abstractive-summarization/pytorch_model.bin"
)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--bertabs_checkpoint_path",
default=None,
type=str,
required=True,
help="Path the official PyTorch dump.",
)
parser.add_argument(
"--pytorch_dump_folder_path",
default=None,
type=str,
required=True,
help="Path to the output PyTorch model.",
)
args = parser.parse_args()
convert_bertabs_checkpoints(
args.bertabs_checkpoint_path,
args.pytorch_dump_folder_path,
)
| Python | 4 | liminghao1630/transformers | examples/research_projects/bertabs/convert_bertabs_original_pytorch_checkpoint.py | [
"Apache-2.0"
] |
- content_for :foo do
| foo
- content_for :foo do
| bar
- content_for :baz do
| WON'T RENDER ME
- content_for :foo do
| baz
| Slim | 3 | osamtimizer/sinatra | sinatra-contrib/spec/content_for/multiple_blocks.slim | [
"MIT"
] |
(module
(type $0 (func (param i32 i32)))
(type $1 (func (param i32 i32 i32) (result i32)))
(import "env" "memory" (memory $2 8192))
(import "env" "emscripten_log" (func $fimport$0 (param i32 i32)))
(import "env" "emscripten_asm_const_int" (func $fimport$1 (param i32 i32 i32) (result i32)))
(table $0 159609 funcref)
(elem (i32.const 1) $fimport$0 $fimport$1)
(global $global$0 (mut i32) (i32.const 1024))
(global $global$1 i32 (i32.const 1048))
(export "__data_end" (global $global$1))
)
| WebAssembly | 2 | phated/binaryen | test/lld/em_asm_table.wat | [
"Apache-2.0"
] |
: main
trig getlinks
;
| MUF | 0 | revarbat/mufsim | tests/getlinks.muf | [
"BSD-2-Clause"
] |
[a<http://example.org/>].
[a[]].
[a()].
<http://example.org/s>a<http://example.org/Thing>.
<http://example.org/s>a[].
<http://example.org/s>a().
| Turtle | 0 | joshrose/audacity | lib-src/lv2/serd/tests/good/test-a-without-whitespace.ttl | [
"CC-BY-3.0"
] |
: main
me @ "fleegul" newpassword
me @ "password" checkpassword pop
me @ "fleegul" checkpassword pop
;
| MUF | 1 | revarbat/mufsim | tests/checkpassword.muf | [
"BSD-2-Clause"
] |
" Vim syntax file
" This file works only for Vim6.x
" Language: Tilde
" Maintainer: Tobias Rundström <[email protected]>
" URL: http://www.tildesoftware.net
" CVS: $Id: tilde.vim,v 1.1 2004/06/13 19:31:51 vimboss Exp $
if exists("b:current_syntax")
finish
endif
"tilde dosent care ...
syn case ignore
syn match tildeFunction "\~[a-z_0-9]\+"ms=s+1
syn region tildeParen start="(" end=")" contains=tildeString,tildeNumber,tildeVariable,tildeField,tildeSymtab,tildeFunction,tildeParen,tildeHexNumber,tildeOperator
syn region tildeString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ keepend
syn region tildeString contained start=+'+ skip=+\\\\\|\\"+ end=+'+ keepend
syn match tildeNumber "\d" contained
syn match tildeOperator "or\|and" contained
syn match tildeHexNumber "0x[a-z0-9]\+" contained
syn match tildeVariable "$[a-z_0-9]\+" contained
syn match tildeField "%[a-z_0-9]\+" contained
syn match tildeSymtab "@[a-z_0-9]\+" contained
syn match tildeComment "^#.*"
syn region tildeCurly start=+{+ end=+}+ contained contains=tildeLG,tildeString,tildeNumber,tildeVariable,tildeField,tildeFunction,tildeSymtab,tildeHexNumber
syn match tildeLG "=>" contained
hi def link tildeComment Comment
hi def link tildeFunction Operator
hi def link tildeOperator Operator
hi def link tildeString String
hi def link tildeNumber Number
hi def link tildeHexNumber Number
hi def link tildeVariable Identifier
hi def link tildeField Identifier
hi def link tildeSymtab Identifier
hi def link tildeError Error
let b:current_syntax = "tilde"
| VimL | 3 | uga-rosa/neovim | runtime/syntax/tilde.vim | [
"Vim"
] |
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'web_resource_error_type.dart';
/// Error returned in `WebView.onWebResourceError` when a web resource loading error has occurred.
class WebResourceError {
/// Creates a new [WebResourceError]
///
/// A user should not need to instantiate this class, but will receive one in
/// [WebResourceErrorCallback].
WebResourceError({
required this.errorCode,
required this.description,
this.domain,
this.errorType,
this.failingUrl,
}) : assert(errorCode != null),
assert(description != null);
/// Raw code of the error from the respective platform.
///
/// On Android, the error code will be a constant from a
/// [WebViewClient](https://developer.android.com/reference/android/webkit/WebViewClient#summary) and
/// will have a corresponding [errorType].
///
/// On iOS, the error code will be a constant from `NSError.code` in
/// Objective-C. See
/// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/ErrorObjectsDomains/ErrorObjectsDomains.html
/// for more information on error handling on iOS. Some possible error codes
/// can be found at https://developer.apple.com/documentation/webkit/wkerrorcode?language=objc.
final int errorCode;
/// The domain of where to find the error code.
///
/// This field is only available on iOS and represents a "domain" from where
/// the [errorCode] is from. This value is taken directly from an `NSError`
/// in Objective-C. See
/// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/ErrorObjectsDomains/ErrorObjectsDomains.html
/// for more information on error handling on iOS.
final String? domain;
/// Description of the error that can be used to communicate the problem to the user.
final String description;
/// The type this error can be categorized as.
///
/// This will never be `null` on Android, but can be `null` on iOS.
final WebResourceErrorType? errorType;
/// Gets the URL for which the resource request was made.
///
/// This value is not provided on iOS. Alternatively, you can keep track of
/// the last values provided to [WebViewPlatformController.loadUrl].
final String? failingUrl;
}
| Dart | 5 | simpleclub-extended/plugins | packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/web_resource_error.dart | [
"BSD-3-Clause"
] |
Sparsity,begin,end,freq,label smoothing,accuracy
0.5,20000,76000,2000,0,0.755599975586
0.5,20000,100000,4000,0.1,0.760320007801
0.5,20000,76000,4000,0.1,0.760580003262
0.5,20000,100000,8000,0,0.756020009518
0.5,8000,100000,4000,0.1,0.757239997387
0.5,8000,76000,4000,0.1,0.757040023804
0.5,8000,76000,4000,0,0.75396001339
0.5,20000,76000,2000,0.1,0.759119987488
0.5,40000,68000,2000,0.1,0.763140022755
0.5,8000,68000,4000,0.1,0.756060004234
0.5,40000,100000,2000,0.1,0.765299975872
0.5,20000,68000,8000,0.1,0.760659992695
0.5,8000,76000,8000,0,0.754760026932
0.5,40000,76000,8000,0,0.759660005569
0.5,20000,100000,2000,0,0.757340013981
0.5,40000,100000,8000,0,0.759379982948
0.5,40000,76000,4000,0,0.758220016956
0.5,40000,68000,4000,0,0.75992000103
0.5,20000,68000,2000,0.1,0.759000003338
0.5,8000,76000,2000,0.1,0.758000016212
0.5,40000,100000,4000,0,0.760259985924
0.5,8000,68000,4000,0,0.753459990025
0.5,8000,100000,2000,0,0.755420029163
0.5,40000,76000,2000,0,0.758639991283
0.5,20000,68000,8000,0,0.75584000349
0.5,40000,68000,2000,0,0.759739995003
0.5,20000,100000,2000,0.1,0.760100007057
0.5,20000,68000,4000,0,0.755620002747
0.5,40000,76000,2000,0.1,0.763679981232
0.5,40000,100000,8000,0.1,0.762600004673
0.5,40000,100000,4000,0.1,0.762080013752
0.5,40000,76000,4000,0.1,0.762579977512
0.5,20000,76000,8000,0.1,0.760160028934
0.5,40000,68000,8000,0.1,0.763999998569
0.5,20000,76000,4000,0,0.757359981537
0.5,8000,68000,8000,0,0.752879977226
0.5,8000,76000,8000,0.1,0.756959974766
0.5,8000,100000,8000,0.1,0.758679986
0.5,20000,100000,8000,0.1,0.759620010853
0.5,8000,68000,2000,0,0.753359973431
0.5,40000,68000,4000,0.1,0.763119995594
0.5,40000,68000,8000,0,0.759379982948
0.5,8000,68000,2000,0.1,0.755659997463
0.5,8000,76000,2000,0,0.754119992256
0.5,8000,100000,8000,0,0.758099973202
0.5,40000,100000,2000,0,0.756959974766
0.5,8000,68000,8000,0.1,0.758220016956
0.5,20000,68000,2000,0,0.754540026188
0.5,8000,100000,2000,0.1,0.759259998798
0.5,40000,76000,8000,0.1,0.762059986591
0.5,20000,76000,8000,0,0.756060004234
0.5,20000,68000,4000,0.1,0.758700013161
0.5,8000,100000,4000,0,0.75407999754
0.5,20000,100000,4000,0,0.759039998055
0.7,40000,68000,8000,0,0.755859971046
0.7,8000,68000,2000,0,0.746339976788
0.7,40000,100000,8000,0.1,0.760519981384
0.7,8000,100000,2000,0,0.749180018902
0.7,20000,76000,8000,0.1,0.755859971046
0.7,40000,100000,2000,0.1,0.757780015469
0.7,40000,76000,2000,0.1,0.760240018368
0.7,40000,76000,2000,0,0.754580020905
0.7,8000,76000,2000,0,0.746259987354
0.7,40000,100000,8000,0,0.754279971123
0.7,40000,68000,8000,0.1,0.758979976177
0.7,40000,68000,2000,0.1,0.758759975433
0.7,20000,100000,2000,0.1,0.754920005798
0.7,20000,68000,8000,0,0.751940011978
0.7,20000,100000,8000,0,0.753579974174
0.7,40000,68000,4000,0,0.75595998764
0.7,40000,100000,4000,0,0.757600009441
0.7,20000,76000,8000,0,0.754320025444
0.7,8000,100000,8000,0.1,0.754679977894
0.7,8000,68000,4000,0,0.749140024185
0.7,20000,100000,4000,0,0.755100011826
0.7,8000,76000,2000,0.1,0.749119997025
0.7,20000,68000,8000,0.1,0.753319978714
0.7,8000,76000,8000,0,0.750140011311
0.7,8000,68000,2000,0.1,0.747640013695
0.7,40000,76000,8000,0,0.757000029087
0.7,20000,68000,2000,0.1,0.753319978714
0.7,20000,100000,4000,0.1,0.756299972534
0.7,8000,76000,8000,0.1,0.750440001488
0.7,8000,68000,8000,0.1,0.749639987946
0.7,8000,68000,4000,0.1,0.748480021954
0.7,40000,76000,8000,0.1,0.759700000286
0.7,8000,100000,2000,0.1,0.753600001335
0.7,20000,68000,4000,0,0.75286000967
0.7,20000,68000,2000,0,0.751959979534
0.7,40000,76000,4000,0,0.757139980793
0.7,20000,76000,4000,0,0.752359986305
0.7,40000,76000,4000,0.1,0.759400010109
0.7,40000,100000,2000,0,0.755540013313
0.7,8000,100000,4000,0.1,0.752439975739
0.7,20000,76000,2000,0,0.751420021057
0.7,40000,100000,4000,0.1,0.763800024986
0.7,8000,100000,4000,0,0.751519978046
0.7,8000,76000,4000,0,0.747619986534
0.7,20000,100000,2000,0,0.753440022469
0.7,20000,68000,4000,0.1,0.754960000515
0.7,20000,76000,2000,0.1,0.754400014877
0.7,40000,68000,2000,0,0.755879998207
0.7,8000,68000,8000,0,0.750079989433
0.7,8000,76000,4000,0.1,0.750519990921
0.7,20000,76000,4000,0.1,0.753859996796
0.7,20000,100000,8000,0.1,0.757899999619
0.7,8000,100000,8000,0,0.75135999918
0.7,40000,68000,4000,0.1,0.759220004082
0.8,8000,100000,4000,0.1,0.748799979687
0.8,8000,100000,2000,0,0.745019972324
0.8,8000,68000,4000,0,0.740639984608
0.8,8000,100000,4000,0,0.746999979019
0.8,40000,100000,4000,0,0.749559998512
0.8,8000,100000,8000,0,0.746379971504
0.8,20000,100000,4000,0.1,0.752619981766
0.8,20000,68000,8000,0,0.749220013618
0.8,40000,68000,8000,0.1,0.753120005131
0.8,20000,76000,4000,0.1,0.750680029392
0.8,40000,100000,2000,0,0.750660002232
0.8,40000,100000,4000,0.1,0.753359973431
0.8,8000,68000,8000,0.1,0.744520008564
0.8,40000,68000,2000,0,0.751139998436
0.8,8000,100000,2000,0.1,0.747219979763
0.8,20000,76000,4000,0,0.748239994049
0.8,40000,76000,2000,0,0.753319978714
0.8,20000,68000,2000,0,0.749159991741
0.8,40000,76000,2000,0.1,0.75445997715
0.8,40000,68000,4000,0.1,0.751420021057
0.8,40000,76000,4000,0,0.751299977303
0.8,8000,76000,2000,0,0.742020010948
0.8,20000,68000,2000,0.1,0.747579991817
0.8,20000,100000,8000,0.1,0.753679990768
0.8,8000,68000,2000,0.1,0.741800010204
0.8,8000,100000,8000,0.1,0.749939978123
0.8,40000,76000,4000,0.1,0.754339993
0.8,40000,68000,8000,0,0.752900004387
0.8,8000,76000,4000,0,0.743399977684
0.8,20000,68000,4000,0.1,0.748799979687
0.8,40000,68000,2000,0.1,0.751839995384
0.8,20000,68000,8000,0.1,0.750899970531
0.8,20000,76000,2000,0.1,0.749580025673
0.8,8000,76000,8000,0,0.745079994202
0.8,20000,76000,8000,0.1,0.751060009003
0.8,8000,76000,8000,0.1,0.744840025902
0.8,20000,100000,2000,0.1,0.752420008183
0.8,40000,100000,8000,0.1,0.751600027084
0.8,8000,76000,4000,0.1,0.74430000782
0.8,8000,68000,8000,0,0.744599997997
0.8,40000,68000,4000,0,0.751760005951
0.8,20000,100000,2000,0,0.752240002155
0.8,40000,76000,8000,0.1,0.752759993076
0.8,40000,100000,8000,0,0.749719977379
0.8,8000,68000,4000,0.1,0.743319988251
0.8,8000,68000,2000,0,0.742340028286
0.8,20000,100000,4000,0,0.751900017262
0.8,20000,76000,8000,0,0.750039994717
0.8,8000,76000,2000,0.1,0.742320001125
0.8,40000,76000,8000,0,0.752260029316
0.8,20000,76000,2000,0,0.74739998579
0.8,20000,100000,8000,0,0.748939990997
0.8,20000,68000,4000,0,0.747780025005
0.8,40000,100000,2000,0.1,0.755760014057
0.9,40000,76000,2000,0,0.737420022488
0.9,20000,68000,4000,0,0.733539998531
0.9,8000,100000,8000,0,0.732020020485
0.9,8000,100000,2000,0.1,0.733500003815
0.9,8000,76000,2000,0.1,0.731859982014
0.9,20000,100000,4000,0,0.736599981785
0.9,8000,100000,4000,0,0.731559991837
0.9,20000,76000,4000,0,0.734279990196
0.9,40000,100000,2000,0,0.734759986401
0.9,8000,76000,8000,0.1,0.732800006866
0.9,20000,68000,2000,0,0.736400008202
0.9,20000,68000,2000,0.1,0.733219981194
0.9,40000,100000,8000,0,0.733340024948
0.9,40000,68000,4000,0.1,0.735140025616
0.9,20000,100000,8000,0,0.736360013485
0.9,40000,68000,4000,0,0.736299991608
0.9,20000,68000,4000,0.1,0.734979987144
0.9,20000,100000,4000,0.1,0.736660003662
0.9,8000,68000,8000,0,0.731760025024
0.9,40000,76000,8000,0.1,0.736660003662
0.9,8000,68000,2000,0.1,0.725179970264
0.9,8000,100000,2000,0,0.733659982681
0.9,20000,100000,2000,0,0.735080003738
0.9,40000,76000,4000,0.1,0.736899971962
0.9,8000,76000,4000,0.1,0.731480002403
0.9,20000,100000,8000,0.1,0.734920024872
0.9,20000,76000,8000,0.1,0.73426002264
0.9,40000,100000,2000,0.1,0.734579980373
0.9,20000,76000,2000,0,0.736180007458
0.9,8000,68000,2000,0,0.729480028152
0.9,8000,68000,4000,0.1,0.727140009403
0.9,8000,100000,8000,0.1,0.733099997044
0.9,40000,68000,8000,0,0.735339999199
0.9,20000,100000,2000,0.1,0.734719991684
0.9,8000,68000,4000,0,0.729179978371
0.9,40000,76000,4000,0,0.737460017204
0.9,40000,100000,4000,0.1,0.732940018177
0.9,20000,76000,2000,0.1,0.735660016537
0.9,20000,76000,8000,0,0.735419988632
0.9,40000,68000,2000,0,0.737259984016
0.9,40000,76000,2000,0.1,0.739099979401
0.9,8000,76000,4000,0,0.729200005531
0.9,40000,68000,2000,0.1,0.736720025539
0.9,8000,100000,4000,0.1,0.734080016613
0.9,40000,76000,8000,0,0.736720025539
0.9,8000,76000,8000,0,0.73276001215
0.9,20000,68000,8000,0.1,0.734459996223
0.9,8000,76000,2000,0,0.731419980526
0.9,8000,68000,8000,0.1,0.728120028973
0.9,40000,100000,4000,0,0.731079995632
0.9,40000,100000,8000,0.1,0.730099976063
0.95,20000,100000,4000,0,0.703519999981
0.95,20000,100000,2000,0.1,0.699100017548
0.95,40000,100000,4000,0,0.695280015469
0.95,40000,100000,8000,0.1,0.681879997253
0.95,20000,100000,8000,0.1,0.692600011826
0.95,40000,100000,2000,0.1,0.693159997463
0.95,40000,100000,2000,0,0.695720016956
0.95,8000,100000,4000,0,0.703299999237
0.95,20000,76000,8000,0.1,0.703639984131
0.95,40000,68000,2000,0.1,0.701820015907
0.95,40000,100000,8000,0,0.687439978123
0.95,8000,100000,4000,0.1,0.696940004826
0.95,40000,100000,4000,0.1,0.688799977303
0.95,8000,76000,8000,0.1,0.702400028706
0.95,40000,76000,8000,0.1,0.695819973946
0.95,20000,100000,4000,0.1,0.698939979076
0.95,20000,100000,8000,0,0.701420009136
0.95,20000,68000,2000,0.1,0.704180002213
0.95,40000,68000,4000,0.1,0.700299978256
0.95,40000,68000,2000,0,0.705919981003
0.95,20000,68000,8000,0.1,0.703100025654
0.95,8000,68000,8000,0.1,0.698339998722
0.98,40000,100000,2000,0.1,0.578999996185
| CSV | 0 | deepneuralmachine/google-research | state_of_sparsity/results/sparse_rn50/technique_comparison/rn50_magnitude_pruning.csv | [
"Apache-2.0"
] |
[{:type :mutation
:selections [{:type :field
:field-name :new_person
:args [{:arg-name :data
:arg-value {:type :object
:value [{:arg-name :last_name
:arg-value {:type :string
:value "Phelps"}}
{:arg-name :first_name
:arg-value {:type :string
:value "Fred"}}
{:arg-name :age
:arg-value {:type :integer
:value "39"}}
{:arg-name :sex
:arg-value {:type :enum
:value :male}}
{:arg-name :address
:arg-value {:type :object
:value [{:arg-name :street
:arg-value {:type :string
:value "Hamburger Lane"}}
{:arg-name :city
:arg-value {:type :string
:value "Wilsonville"}}
{:arg-name :state
:arg-value {:type :string
:value "GE"}}
{:arg-name :zip
:arg-value {:type :string
:value "87267"}}]}}
{:arg-name :notes
:arg-value {:type :array
:value [{:type :string
:value "one"}
{:type :string
:value "two"}
{:type :string
:value "three"}]}}]}}]}]}]
| edn | 3 | hagenek/lacinia | dev-resources/parser/object.edn | [
"Apache-2.0"
] |
(ns lt.util.style
"Provide style related functions.")
(defn ->px
"Appends \"px\" to `s`. If `s` is falsey then 0 is used.
Example:
```
(->px 75) ;;=> \"75px\"
(->px false) ;;=> \"0px\"
```"
[s]
(str (or s 0) "px"))
| Clojure | 4 | sam-aldis/LightTable | src/lt/util/style.cljs | [
"MIT"
] |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
"""Tests for common methods in strategy classes."""
from absl.testing import parameterized
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import distribution_strategy_context as ds_context
from tensorflow.python.distribute import multi_worker_test_base
from tensorflow.python.distribute import reduce_util
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.distribute import strategy_test_lib
from tensorflow.python.distribute import test_util
from tensorflow.python.distribute import tpu_strategy
from tensorflow.python.distribute.collective_all_reduce_strategy import CollectiveAllReduceStrategy
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import test
from tensorflow.python.util import nest
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x1_gpu,
] + strategy_combinations.all_strategies,
mode=['eager']))
class StrategyTest(test.TestCase, parameterized.TestCase):
def testCaptureReplicaId(self, strategy):
m = {}
@def_function.function
def f():
return ds_context.get_replica_context().replica_id_in_sync_group
@def_function.function
def g():
# Make g() a stateful function so it's traced twice.
if m.get('v', None) is None:
m['v'] = variables.Variable(0.)
return strategy.run(f)
g()
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_cpu_1_and_2,
strategy_combinations.multi_worker_mirrored_2x2_gpu,
strategy_combinations.tpu_strategy
],
mode=['graph', 'eager']))
class StrategyLocalResultTest(test.TestCase):
def testLocalResultForDictionary(self, distribution):
@def_function.function
def model_fn():
return {'a': constant_op.constant(1.), 'b': constant_op.constant(2.)}
with distribution.scope():
result = distribution.run(model_fn)
got = self.evaluate(distribution.experimental_local_results(result))
self.assertEqual(got, ({'a': 1., 'b': 2.}, {'a': 1., 'b': 2.}))
def testLocalResultForList(self, distribution):
@def_function.function
def model_fn():
return [constant_op.constant(1.), constant_op.constant(2.)]
with distribution.scope():
result = distribution.run(model_fn)
got = self.evaluate(distribution.experimental_local_results(result))
self.assertEqual(got, ([1., 2.], [1., 2.]))
def testLocalResultForTuple(self, distribution):
@def_function.function
def model_fn():
return (constant_op.constant(1.), constant_op.constant(2.),
constant_op.constant(3.))
with distribution.scope():
result = distribution.run(model_fn)
got = self.evaluate(distribution.experimental_local_results(result))
self.assertEqual(got, ((1., 2., 3.), (1., 2., 3.)))
def testLocalResultForNestedStruct(self, distribution):
@def_function.function
def model_fn():
return ({
'a': constant_op.constant(1.),
'b': constant_op.constant(2.)
}, {
'a': constant_op.constant(4.),
'b': constant_op.constant(6.)
})
with distribution.scope():
result = distribution.run(model_fn)
got = self.evaluate(distribution.experimental_local_results(result))
self.assertEqual(got, (({
'a': 1.,
'b': 2.
}, {
'a': 4.,
'b': 6.
}), ({
'a': 1.,
'b': 2.
}, {
'a': 4.,
'b': 6.
})))
def testLocalResultForNestedStructWithoutTensor(self, distribution):
@def_function.function
def model_fn():
return {'a': 1., 'b': 2.}
with distribution.scope():
result = distribution.run(model_fn)
v = self.evaluate(distribution.experimental_local_results(result))
self.assertIsInstance(v, tuple)
self.assertAllEqual(v, ({'a': 1., 'b': 2.}, {'a': 1., 'b': 2.}))
def testLocalResultForScalarValue(self, distribution):
@def_function.function
def model_fn():
return distribution.extended._get_local_replica_id(
ds_context.get_replica_context().replica_id_in_sync_group)
with distribution.scope():
result = distribution.run(model_fn)
v = self.evaluate(distribution.experimental_local_results(result))
self.assertIsInstance(v, tuple)
self.assertEqual(v, (0, 1))
def testLocalResultForDictionaryDifferentReplicas(self, distribution):
@def_function.function
def model_fn():
replica_id = distribution.extended._get_local_replica_id(
ds_context.get_replica_context().replica_id_in_sync_group)
return {
'a': math_ops.cast(replica_id + 1, dtype=float),
'b': math_ops.cast(replica_id + 2, dtype=float)
}
with distribution.scope():
result = distribution.run(model_fn)
got = self.evaluate(distribution.experimental_local_results(result))
self.assertAllEqual(got, ({'a': 1., 'b': 2.}, {'a': 2., 'b': 3.}))
def testLocalResultForTensor(self, distribution):
@def_function.function
def model_fn():
return constant_op.constant([2., 3.])
with distribution.scope():
result = distribution.run(model_fn)
v = self.evaluate(distribution.experimental_local_results(result))
self.assertAllEqual(v, ([2., 3.], [2., 3.]))
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x1_gpu,
] + strategy_combinations.all_strategies,
mode=['eager']))
class ReduceTest(test.TestCase, parameterized.TestCase):
def testBasic(self, strategy):
per_replica_value = strategy.experimental_distribute_values_from_function(
lambda _: array_ops.ones((), dtypes.float32))
def fn_eager():
return strategy.reduce(
reduce_util.ReduceOp.SUM, value=per_replica_value, axis=None)
fn_graph = def_function.function(fn_eager)
# Run reduce under the strategy scope to explicitly enter
# strategy default_device scope.
with strategy.scope():
self.assertEqual(fn_eager().numpy(), 1.0 * strategy.num_replicas_in_sync)
self.assertEqual(fn_graph().numpy(), 1.0 * strategy.num_replicas_in_sync)
# Run reduce without a strategy scope to implicitly enter
# strategy default_device scope.
self.assertEqual(fn_eager().numpy(), 1.0 * strategy.num_replicas_in_sync)
self.assertEqual(fn_graph().numpy(), 1.0 * strategy.num_replicas_in_sync)
def testAxis(self, strategy):
@def_function.function
def fn():
return constant_op.constant([1., 2.])
x = strategy.run(fn)
x_m = strategy.reduce(reduce_util.ReduceOp.MEAN, x, axis=0)
self.assertEqual(1.5, x_m)
x_s = strategy.reduce(reduce_util.ReduceOp.SUM, x, axis=0)
self.assertEqual(3 * strategy.num_replicas_in_sync, x_s)
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.default_strategy,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus_no_merge_call,
strategy_combinations.tpu_strategy,
strategy_combinations.tpu_strategy_packed_var,
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu_no_merge_call,
],
update_fn=['assign', 'assign_add', 'assign_sub'],
tf_function=[True, False],
mode=['eager']))
class ReplicaCtxUpdateTest(test.TestCase, parameterized.TestCase):
def testDenseUpdate(self, strategy, tf_function, update_fn):
if strategy_test_lib.is_tpu_strategy(strategy) and (not tf_function):
self.skipTest('Skip TPUStrategy + eager combination.')
with strategy.scope():
distributed_variable1 = variables.Variable(5.0)
def replica_fn():
value = array_ops.constant(2.)
python_literal = 1.
replica_context = ds_context.get_replica_context()
fn_sets = {
'assign': lambda var, value: var.assign(value),
'assign_add': lambda var, value: var.assign_add(value),
'assign_sub': lambda var, value: var.assign_sub(value),
}
replica_context._update(
distributed_variable1, fn_sets[update_fn], args=(value,))
replica_context._update(
distributed_variable1, fn_sets[update_fn], args=(python_literal,))
if tf_function:
replica_fn = def_function.function(replica_fn)
strategy.run(replica_fn)
expected_result = {'assign': 1., 'assign_add': 8., 'assign_sub': 2.}
self.assertAllEqual(
strategy.experimental_local_results(distributed_variable1),
[expected_result[update_fn]] * _get_num_replicas_per_client(strategy))
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x1_gpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu_no_merge_call,
strategy_combinations.tpu_strategy,
] + strategy_combinations.strategies_minus_tpu,
tf_function=[combinations.tf_function, combinations.no_tf_function],
mode=['eager']))
class ReplicaCtxAllReduceTest(test.TestCase, parameterized.TestCase):
def testDense(self, strategy, tf_function):
if (strategy_test_lib.is_tpu_strategy(strategy) and
tf_function is combinations.no_tf_function):
self.skipTest('Skip TPUStrategy + eager combination.')
@tf_function
def fn():
def replica_fn():
value = array_ops.identity(1.0)
reduced = strategy.extended._replica_ctx_all_reduce(
reduce_util.ReduceOp.SUM, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
self.assertEqual(got, 1.0 * strategy.num_replicas_in_sync)
def testSparse(self, strategy, tf_function):
if tf_function is combinations.no_tf_function:
self.skipTest('Skip IndexedSlices + eager combination.')
@tf_function
def fn():
def replica_fn():
value = ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
reduced = strategy.extended._replica_ctx_all_reduce(
reduce_util.ReduceOp.SUM, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
expect = ops.IndexedSlices(
values=array_ops.identity([[1.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
self.assertAllEqual(
ops.convert_to_tensor(got), ops.convert_to_tensor(expect))
def testNestedInput(self, strategy, tf_function):
if tf_function is combinations.no_tf_function:
self.skipTest('Skip IndexedSlices + eager combination.')
@tf_function
def fn():
def replica_fn():
value = (array_ops.identity(1.0),
ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1])),
array_ops.identity(2.0),
ops.IndexedSlices(
values=array_ops.identity([[2.0]]),
indices=array_ops.identity([1]),
dense_shape=array_ops.identity([5, 1])))
reduced = strategy.extended._replica_ctx_all_reduce(
reduce_util.ReduceOp.SUM, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
expect = (1.0 * strategy.num_replicas_in_sync,
ops.IndexedSlices(
values=array_ops.identity(
[[1.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1])),
2.0 * strategy.num_replicas_in_sync,
ops.IndexedSlices(
values=array_ops.identity(
[[2.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([1]),
dense_shape=array_ops.identity([5, 1])))
self.assertAllClose(
nest.map_structure(ops.convert_to_tensor, got),
nest.map_structure(ops.convert_to_tensor, expect))
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x1_gpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu,
strategy_combinations.multi_worker_mirrored_2x2_gpu_no_merge_call,
strategy_combinations.tpu_strategy,
] + strategy_combinations.strategies_minus_tpu,
tf_function=[combinations.tf_function, combinations.no_tf_function],
mode=['eager']))
class AllReduceTest(test.TestCase, parameterized.TestCase):
def testDense(self, strategy, tf_function):
if (strategy_test_lib.is_tpu_strategy(strategy) and
tf_function is combinations.no_tf_function):
self.skipTest('Skip TPUStrategy + eager combination.')
@tf_function
def fn():
def replica_fn():
value = array_ops.identity(1.0)
rep_ctx = ds_context.get_replica_context()
reduced = rep_ctx.all_reduce(reduce_util.ReduceOp.SUM, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
self.assertEqual(got, 1.0 * strategy.num_replicas_in_sync)
def testSparse(self, strategy, tf_function):
if tf_function is combinations.no_tf_function:
self.skipTest('Skip IndexedSlices + eager combination.')
@tf_function
def fn():
def replica_fn():
value = ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
rep_ctx = ds_context.get_replica_context()
reduced = rep_ctx.all_reduce(reduce_util.ReduceOp.MEAN, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
if not strategy_test_lib.is_tpu_strategy(strategy):
self.assertIsInstance(got, ops.IndexedSlices)
expect = ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
self.assertAllEqual(
ops.convert_to_tensor(got), ops.convert_to_tensor(expect))
def testSparseTuple(self, strategy, tf_function):
if tf_function is combinations.no_tf_function:
self.skipTest('Skip IndexedSlices + eager combination.')
@tf_function
def fn():
def replica_fn():
value1 = ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
value2 = ops.IndexedSlices(
values=array_ops.identity([[2.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
rep_ctx = ds_context.get_replica_context()
reduced = rep_ctx.all_reduce(reduce_util.ReduceOp.SUM, [value1, value2])
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
if not strategy_test_lib.is_tpu_strategy(strategy):
for g in got:
self.assertIsInstance(g, ops.IndexedSlices)
expect = [
ops.IndexedSlices(
values=array_ops.identity([[1.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1])),
ops.IndexedSlices(
values=array_ops.identity([[2.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1]))
]
self.assertAllEqual(
nest.map_structure(ops.convert_to_tensor, got),
nest.map_structure(ops.convert_to_tensor, expect))
def testNestedInput(self, strategy, tf_function):
if tf_function is combinations.no_tf_function:
self.skipTest('Skip IndexedSlices + eager combination.')
@tf_function
def fn():
def replica_fn():
value = (array_ops.identity(1.0),
ops.IndexedSlices(
values=array_ops.identity([[1.0]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1])),
array_ops.identity(2.0),
ops.IndexedSlices(
values=array_ops.identity([[2.0]]),
indices=array_ops.identity([1]),
dense_shape=array_ops.identity([5, 1])))
rep_ctx = ds_context.get_replica_context()
reduced = rep_ctx.all_reduce(reduce_util.ReduceOp.SUM, value)
return reduced
return strategy.experimental_local_results(strategy.run(replica_fn))
got = fn()[0]
expect = (1.0 * strategy.num_replicas_in_sync,
ops.IndexedSlices(
values=array_ops.identity(
[[1.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([0]),
dense_shape=array_ops.identity([5, 1])),
2.0 * strategy.num_replicas_in_sync,
ops.IndexedSlices(
values=array_ops.identity(
[[2.0 * strategy.num_replicas_in_sync]]),
indices=array_ops.identity([1]),
dense_shape=array_ops.identity([5, 1])))
self.assertAllClose(
nest.map_structure(ops.convert_to_tensor, got),
nest.map_structure(ops.convert_to_tensor, expect))
def _make_indexed_slices(values, indices, dense_shape):
tensor = ops.IndexedSlices(
values=constant_op.constant(values),
indices=constant_op.constant(indices),
dense_shape=constant_op.constant(dense_shape))
return tensor
def _get_num_replicas_per_client(strategy):
if isinstance(strategy, CollectiveAllReduceStrategy):
resolver = strategy.cluster_resolver
return max(nest.flatten(resolver.num_accelerators())[0], 1)
else:
return strategy.num_replicas_in_sync
@combinations.generate(
combinations.combine(
strategy=[
strategy_combinations.multi_worker_mirrored_2x1_cpu,
strategy_combinations.multi_worker_mirrored_2x1_gpu,
],
mode=['eager']))
class DistributedCollectiveAllReduceStrategyTest(
strategy_test_lib.DistributionTestBase,
parameterized.TestCase):
def testDatasetFromFunction(self, strategy):
def dataset_fn(input_context):
global_batch_size = 10
batch_size = input_context.get_per_replica_batch_size(global_batch_size)
d = dataset_ops.DatasetV2.range(100).repeat().batch(batch_size)
return d.shard(input_context.num_input_pipelines,
input_context.input_pipeline_id)
expected_sum_on_workers = {'chief': 10, 'worker': 35}
input_iterator = iter(
strategy.distribute_datasets_from_function(dataset_fn))
@def_function.function
def run(iterator):
return strategy.experimental_local_results(iterator.get_next())
result = run(input_iterator)
sum_value = math_ops.reduce_sum(result)
self.assertEqual(
sum_value.numpy(),
expected_sum_on_workers[multi_worker_test_base.get_task_type()])
def testSimpleInputFromDatasetLastPartialBatch(self, strategy):
global_batch_size = 8
dataset = dataset_ops.DatasetV2.range(14).batch(
global_batch_size, drop_remainder=False)
input_iterator = iter(strategy.experimental_distribute_dataset(dataset))
@def_function.function
def run(input_iterator):
return strategy.run(lambda x: x, args=(next(input_iterator),))
# Let the complete batch go.
run(input_iterator)
# `result` is an incomplete batch
result = run(input_iterator)
expected_data_on_workers = {'chief': [8, 9, 10], 'worker': [11, 12, 13]}
self.assertAllEqual(
expected_data_on_workers[multi_worker_test_base.get_task_type()],
result.numpy(),
)
def testSimpleInputFromFnLastPartialBatch(self, strategy):
def dataset_fn(input_context):
global_batch_size = 8
batch_size = input_context.get_per_replica_batch_size(global_batch_size)
dataset = dataset_ops.DatasetV2.range(14).batch(
batch_size, drop_remainder=False)
return dataset.shard(input_context.num_input_pipelines,
input_context.input_pipeline_id)
input_iterator = iter(
strategy.distribute_datasets_from_function(dataset_fn))
@def_function.function
def run(input_iterator):
return strategy.run(lambda x: x, args=(next(input_iterator),))
# Let the complete batch go.
run(input_iterator)
# `result` is an incomplete batch
result = run(input_iterator)
expected_data_on_worker = {'chief': [8, 9, 10, 11], 'worker': [12, 13]}
self.assertAllEqual(
expected_data_on_worker[multi_worker_test_base.get_task_type()],
result.numpy())
def testReduceHostTensor(self, strategy):
reduced = strategy.reduce(
reduce_util.ReduceOp.SUM, array_ops.identity(1.), axis=None)
self.assertEqual(reduced.numpy(), 2.)
def testReduceToHostTensor(self, strategy):
value = array_ops.identity(1.)
reduced = strategy.extended.reduce_to(reduce_util.ReduceOp.SUM, value,
value)
self.assertEqual(reduced.numpy(), 2.)
def testBatchReduceToHostTensor(self, strategy):
value = array_ops.identity(1.)
reduced = strategy.extended.batch_reduce_to(reduce_util.ReduceOp.SUM,
[(value, value),
(value, value)])
self.assertAllEqual([2., 2.], reduced)
def testReduceDeviceTensors(self, strategy):
value = strategy.run(lambda: array_ops.identity(1.))
reduced = strategy.reduce(reduce_util.ReduceOp.SUM, value, axis=None)
self.assertEqual(reduced.numpy(), 2.)
def testReduceToDeviceTensors(self, strategy):
value = strategy.run(lambda: array_ops.identity(1.))
reduced = strategy.extended.reduce_to(reduce_util.ReduceOp.SUM, value,
value)
self.assertEqual(reduced.numpy(), 2.)
def testBatchReduceToDeviceTensors(self, strategy):
value = strategy.run(lambda: array_ops.identity(1.))
reduced = strategy.extended.batch_reduce_to(reduce_util.ReduceOp.SUM,
[(value, value),
(value, value)])
self.assertAllEqual([2., 2.], reduced)
# TODO(crccw): add a test that mixes device and host tensors after multi
# worker strategy combinations can run on a fixed number of GPUs.
class StrategyClusterResolverTest(test.TestCase, parameterized.TestCase):
@combinations.generate(
combinations.combine(
strategy=[strategy_combinations.multi_worker_mirrored_2x1_cpu] +
strategy_combinations.all_strategies,
mode=['eager']))
def testClusterResolverProperty(self, strategy):
# CollectiveAllReduceStrategy and TPUStrategy must have a cluster resolver.
# `None` otherwise.
resolver = strategy.cluster_resolver
if not isinstance(strategy, CollectiveAllReduceStrategy) and not isinstance(
strategy, tpu_strategy.TPUStrategy):
self.assertIsNone(resolver)
return
with strategy.scope():
self.assertIs(strategy.cluster_resolver, resolver)
self.assertTrue(hasattr(resolver, 'cluster_spec'))
self.assertTrue(hasattr(resolver, 'master'))
self.assertTrue(hasattr(resolver, 'num_accelerators'))
self.assertTrue(hasattr(resolver, 'task_id'))
self.assertTrue(hasattr(resolver, 'task_type'))
if isinstance(strategy, CollectiveAllReduceStrategy):
self.assertEqual(resolver.task_id, 0)
self.assertAllInSet(resolver.task_type, ['chief', 'worker'])
if __name__ == '__main__':
test_util.main()
| Python | 5 | nkgwer/tensorflow | tensorflow/python/distribute/strategy_common_test.py | [
"Apache-2.0"
] |
<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require('electron')
let worker = new Worker(`../workers/worker_node.js`)
worker.onmessage = function (event) {
ipcRenderer.sendToHost(event.data)
worker.terminate()
}
</script>
</body>
</html>
| HTML | 3 | lingxiao-Zhu/electron | spec/fixtures/pages/worker.html | [
"MIT"
] |
#!/usr/bin/jconsole
require 'strings'
e =: &.>
lines =: <;._2 :. unlines
unlines =: ;@:(,&LF e) :. lines
n=: #all =: {.@> comments=: lines 0 :0
Builtin
Char
Error
K Complex
O Composition
Function application
Name
Quasiquote
Z Integer
Real
List
)
typedefs =: lines 0 :0
B uint8_t
C int8_t
E Str
O struct { U r; V f; U l; V* x; } *
F struct { U r; V f; U l; V* x; } *
N Str
Q Str
Z int64_t
R double
K struct { R a; R b; }
L struct { U r; T t; U c; U l; U o; P p; } *
)
classes =: 'const arith func comp'
(classes) =: ;: 'ECZRK ZRK BOFNQ OFL'
classes =: 'all ',classes,' nconst'
nconst =: all-.const
echo^:(0 e.~:all) 'Error: non-unique letters'
echo^:(all-.@-:&(/:~){.@>typedefs) 'Error: typedefs don''t match types'
NB. type.h
preamble =: 0 :0
// Generated; see type.ijs
#include <stdlib.h>
#include <stdint.h>
typedef intptr_t I;
typedef void* P;
typedef char* Str;
typedef uintptr_t U;
typedef U T;
typedef struct { T t; P p; } V;
#define ON_TYPES(t, f) ON_##t##_TYPES(f)
)
post =: 0 : 0
#include "mem.h"
#include "apply.h"
)
def =: '#define '
join =: 1 :'[,m,]'
typesum =: '(',')',~' + 'join/@:(,&'_t'"0)
fmt =: rplc '\n';LF;'%T';];'%t';tolower
fmte =: (&fmt)e
types =: unlines ('typedef ',2&}.,' ',{.,';'"_)e typedefs
val =: unlines comments ((def,]),' //',[)e all,e '_t'<@,"1]_12{."1":,.2^i.n
get =: unlines '#define %T(v) (*(%T*)((v).p))'fmte all,'V'
typeclasses =: unlines ((18{.def,toupper,'_t '"_),typesum@:".)e ;:classes
fs=: [: ' 'join/ ('f(',],')'"_)"0
ON =: unlines ('#define ON_',toupper,'_TYPES(f) ',fs@".)e ;:classes
'type.h' (1!:2<)~ }:unlines preamble;types;val;get;typeclasses;ON;post
exit ''
| J | 4 | mlochbaum/ILanguage | type.ijs | [
"0BSD"
] |
/*
* Copyright (c) 2018-2020, Andreas Kling <[email protected]>
* Copyright (c) 2021, Liav A. <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main(int, char**)
{
int power_state_switch_node = open("/sys/firmware/power_state", O_WRONLY);
if (power_state_switch_node < 0) {
perror("open");
return 1;
}
const char* value = "1";
if (write(power_state_switch_node, value, 1) < 0) {
perror("write");
return 1;
}
return 0;
}
| C++ | 3 | r00ster91/serenity | Userland/Utilities/reboot.cpp | [
"BSD-2-Clause"
] |
CREATE TABLE `tb_njzmhqupzv` (
`col_aiifakdklr` datetime(6) NULL,
`col_ulzkdgcmmu` time,
CONSTRAINT UNIQUE INDEX `uk_ikryxrhfhx` (`col_aiifakdklr`),
UNIQUE `uk_ckiseqvinv` (`col_aiifakdklr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `tb_nzgqzlyxvk` (
`col_quthabfydl` set('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`col_bpzwhwubra` int(118) unsigned DEFAULT '1',
`col_fpkljodgme` time NULL,
`col_zxdapdqzmv` blob,
CONSTRAINT `symb_sdbjebxsqk` UNIQUE `uk_vuzkhjajdc` (`col_bpzwhwubra`,`col_fpkljodgme`),
UNIQUE `uk_zknetkwpoq` (`col_fpkljodgme`,`col_zxdapdqzmv`(28))
) DEFAULT CHARSET=latin1;
CREATE TABLE `tb_dngwjiipsz` (
`col_thwosnwagl` enum('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
RENAME TABLE `tb_dngwjiipsz` TO `tb_hdjifcvgjr`;
RENAME TABLE `tb_hdjifcvgjr` TO `tb_nrcqacgrqr`, `tb_nzgqzlyxvk` TO `tb_pfzkhfodcd`;
RENAME TABLE `tb_pfzkhfodcd` TO `tb_rvvolpepuv`;
RENAME TABLE `tb_njzmhqupzv` TO `tb_oqkzkbtfiz`;
RENAME TABLE `tb_nrcqacgrqr` TO `tb_roetequbaj`, `tb_rvvolpepuv` TO `tb_gvxwgsxgte`;
RENAME TABLE `tb_oqkzkbtfiz` TO `tb_xsfqjfgvfq`;
RENAME TABLE `tb_xsfqjfgvfq` TO `tb_sxvwhxpswg`, `tb_roetequbaj` TO `tb_cfukmqodyg`;
RENAME TABLE `tb_sxvwhxpswg` TO `tb_cfxrlacwgr`, `tb_cfukmqodyg` TO `tb_oytmynjdbq`;
RENAME TABLE `tb_cfxrlacwgr` TO `tb_xhvastkmfw`;
RENAME TABLE `tb_xhvastkmfw` TO `tb_wtwwuhhmqp`;
CREATE TABLE `tb_njzmhqupzv` (
`col_aiifakdklr` datetime(6) NULL,
`col_ulzkdgcmmu` time,
CONSTRAINT UNIQUE INDEX `uk_ikryxrhfhx` (`col_aiifakdklr`),
UNIQUE `uk_ckiseqvinv` (`col_aiifakdklr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `tb_nzgqzlyxvk` (
`col_quthabfydl` set('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`col_bpzwhwubra` int(118) unsigned DEFAULT '1',
`col_fpkljodgme` time NULL,
`col_zxdapdqzmv` blob,
CONSTRAINT `symb_sdbjebxsqk` UNIQUE `uk_vuzkhjajdc` (`col_bpzwhwubra`,`col_fpkljodgme`),
UNIQUE `uk_zknetkwpoq` (`col_fpkljodgme`,`col_zxdapdqzmv`(28))
) DEFAULT CHARSET=latin1;
CREATE TABLE `tb_dngwjiipsz` (
`col_thwosnwagl` enum('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
RENAME TABLE `tb_dngwjiipsz` TO `tb_hdjifcvgjr`;
RENAME TABLE `tb_hdjifcvgjr` TO `tb_nrcqacgrqr`, `tb_nzgqzlyxvk` TO `tb_pfzkhfodcd`;
RENAME TABLE `tb_pfzkhfodcd` TO `tb_rvvolpepuv`;
RENAME TABLE `tb_njzmhqupzv` TO `tb_oqkzkbtfiz`;
RENAME TABLE `tb_nrcqacgrqr` TO `tb_roetequbaj`, `tb_rvvolpepuv` TO `tb_gvxwgsxgte`;
RENAME TABLE `tb_oqkzkbtfiz` TO `tb_xsfqjfgvfq`;
RENAME TABLE `tb_xsfqjfgvfq` TO `tb_sxvwhxpswg`, `tb_roetequbaj` TO `tb_cfukmqodyg`;
RENAME TABLE `tb_sxvwhxpswg` TO `tb_cfxrlacwgr`, `tb_cfukmqodyg` TO `tb_oytmynjdbq`;
RENAME TABLE `tb_cfxrlacwgr` TO `tb_xhvastkmfw`;
RENAME TABLE `tb_xhvastkmfw` TO `tb_wtwwuhhmqp`;
CREATE TABLE `tb_njzmhqupzv` (
`col_aiifakdklr` datetime(6) NULL,
`col_ulzkdgcmmu` time,
CONSTRAINT UNIQUE INDEX `uk_ikryxrhfhx` (`col_aiifakdklr`),
UNIQUE `uk_ckiseqvinv` (`col_aiifakdklr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `tb_nzgqzlyxvk` (
`col_quthabfydl` set('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`col_bpzwhwubra` int(118) unsigned DEFAULT '1',
`col_fpkljodgme` time NULL,
`col_zxdapdqzmv` blob,
CONSTRAINT `symb_sdbjebxsqk` UNIQUE `uk_vuzkhjajdc` (`col_bpzwhwubra`,`col_fpkljodgme`),
UNIQUE `uk_zknetkwpoq` (`col_fpkljodgme`,`col_zxdapdqzmv`(28))
) DEFAULT CHARSET=latin1;
CREATE TABLE `tb_dngwjiipsz` (
`col_thwosnwagl` enum('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
RENAME TABLE `tb_dngwjiipsz` TO `tb_hdjifcvgjr`;
RENAME TABLE `tb_hdjifcvgjr` TO `tb_nrcqacgrqr`, `tb_nzgqzlyxvk` TO `tb_pfzkhfodcd`;
RENAME TABLE `tb_pfzkhfodcd` TO `tb_rvvolpepuv`;
RENAME TABLE `tb_njzmhqupzv` TO `tb_oqkzkbtfiz`;
RENAME TABLE `tb_nrcqacgrqr` TO `tb_roetequbaj`, `tb_rvvolpepuv` TO `tb_gvxwgsxgte`;
RENAME TABLE `tb_oqkzkbtfiz` TO `tb_xsfqjfgvfq`;
RENAME TABLE `tb_xsfqjfgvfq` TO `tb_sxvwhxpswg`, `tb_roetequbaj` TO `tb_cfukmqodyg`;
RENAME TABLE `tb_sxvwhxpswg` TO `tb_cfxrlacwgr`, `tb_cfukmqodyg` TO `tb_oytmynjdbq`;
RENAME TABLE `tb_cfxrlacwgr` TO `tb_xhvastkmfw`;
RENAME TABLE `tb_xhvastkmfw` TO `tb_wtwwuhhmqp`;
| SQL | 1 | yuanweikang2020/canal | parse/src/test/resources/ddl/table/test_23.sql | [
"Apache-2.0"
] |
[Exposed=Window,
HTMLConstructor]
interface HTMLOptGroupElement : HTMLElement {
[CEReactions, Reflect] attribute boolean disabled;
[CEReactions, Reflect] attribute DOMString label;
};
| WebIDL | 3 | corsarstl/Learn-Vue-2 | vue-testing/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement.webidl | [
"MIT"
] |
void setup() {
size(320,240);
}
void draw() {
background(0);
flower();
}
void flower() {
fill(255,0,0);
ellipse(100,100,20,20);
}
| Processing | 4 | aerinkayne/website | Tutorials/Processing/unsorted/functions-objects/functions/functions.pde | [
"MIT"
] |
module Todo.Task exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode
import String
-- MODEL
type alias Model =
{ description : String
, completed : Bool
, edits : Maybe String
, id : Int
}
init : String -> Int -> Model
init desc id =
{ description = desc
, completed = False
, edits = Nothing
, id = id
}
-- UPDATE
type Msg
= Focus String
| Edit String
| Cancel
| Commit
| Completed Bool
| Delete
update : Msg -> Model -> Maybe Model
update msg model =
case msg of
Focus elementId ->
Just { model | edits = Just model.description }
Edit description ->
Just { model | edits = Just description }
Cancel ->
Just { model | edits = Nothing }
Commit ->
case model.edits of
Nothing ->
Just model
Just rawDescription ->
let
description =
String.trim rawDescription
in
if String.isEmpty description then
Nothing
else
Just
{ model
| edits = Nothing
, description = description
}
Completed bool ->
Just { model | completed = bool }
Delete ->
Nothing
-- VIEW
view : Model -> Html Msg
view model =
let
className =
(if model.completed then
"completed "
else
""
)
++ case model.edits of
Just _ ->
"editing"
Nothing ->
""
description =
Maybe.withDefault model.description model.edits
elementId =
"todo-" ++ toString model.id
in
li
[ class className ]
[ div
[ class "view" ]
[ input
[ class "toggle"
, type' "checkbox"
, checked model.completed
, onClick (Completed (not model.completed))
]
[]
, label
[ onDoubleClick (Focus elementId) ]
[ text description ]
, button
[ class "destroy"
, onClick Delete
]
[]
]
, input
[ class "edit"
, value description
, name "title"
, id (elementId)
, onInput Edit
, onBlur Commit
, onFinish Commit Cancel
]
[]
]
onFinish : msg -> msg -> Attribute msg
onFinish enterMessage escapeMessage =
let
select key =
case key of
13 ->
enterMessage
_ ->
-- Not a 'finish' key, such as ENTER or ESCAPE
escapeMessage
in
on "keydown" (Json.Decode.map select keyCode)
| Elm | 5 | elenaparaschiv/todomvc | examples/elm/Todo/Task.elm | [
"MIT"
] |
require 'template'
require 'axle/opal_lib/data_source'
require 'digest-rails/opal_lib/core_pane_controller'
require 'digest-rails/opal_lib/digest_section_controller'
require 'digest-rails/opal_lib/multi_digest_controller'
require 'digest-rails/opal_lib/column_text'
require 'digest-rails/opal_lib/column_select'
require 'digest-rails/opal_lib/column_direct_attr'
require 'digest-rails/opal_lib/column_indirect_attr'
require 'digest-rails/opal_lib/base_pane_controller'
class BasePaneletController < BasePaneController
attr_accessor :CC
def initialize(c)
@CC = c[:client_context]
CC[:template] = Template['digest-rails/views/panelets_body']
end
def configure(c)
CC[:render_target] = RenderTarget.new( ".#{c[:short]}" )
CC[:data_source] = DataSource.new(c[:model])
end
def config_data_source_select
CC[:data_source].configure do |config|
config.add_column(
ColumnSelect.new.init(
header: 'Select',
prompt: '->',
click_proc: Proc.new do |row,row_content|
puts row
puts row_content[:data][1]
Dialog.set_content( row_content[:rendering] ).open
end
)
)
end
end
end | Opal | 4 | bcavileer/digest-rails | app/assets/javascripts/digest-rails/opal_lib/hold/base_panelet_controller.js.opal | [
"MIT"
] |
namespace DebugStub
include Test.xs
.v = 4 | XS | 0 | xccoreco/XSharp | playground/IncludeTest.xs | [
"BSD-3-Clause"
] |
package
{
// some utilities to encapsulate using the relative read/write of the
// corrupt vector.<uint> as an absolute read/write of the whole address
// space.
public class Memory
{
public var vector:Vector.<uint>;
public var vector_base:uint;
public var vector_size:uint;
private static function negative(i:uint):uint {
return (~i) + 1;
}
public function Memory(v:Vector.<uint>, b:uint, s:uint) {
vector = v;
vector_base = b;
vector_size = s;
}
public function Cleanup():void {
// restore the correct size to our vector so that flash doesn't
// inadvertently trample on lots of memory.
vector[negative(2)] = vector_size;
}
public function read_dword(address:uint):uint {
var offset:uint = 0;
if (address & 0x3 != 0) {
// NB: we could read 2 dwords here, and produce the correct
// dword, but that could lead to oob reads if we're close to
// a page boundary. take the path of least danger, and throw
// for debugging.
throw 'read_dword called with misaligned address'
}
if (address < vector_base) {
offset = negative((vector_base - address) >> 2);
}
else {
offset = address - vector_base >> 2;
}
try {
return vector[offset];
} catch (e:Error) {
// we can't read at offset 0xffffffff, sometimes we will want
// to, but that is just life.
}
return 0;
}
public function read_byte(address:uint):uint {
var dword_address:uint = address & 0xfffffffc;
var dword:uint = read_dword(dword_address);
while (address & 0x3) {
dword = dword >> 8;
address -= 1;
}
return (dword & 0xff);
}
public function read_string(address:uint):String {
var string:String = '';
var dword:uint = 0;
while (address & 0x3) {
var char:uint = read_byte(address);
if (char == 0) {
return string;
}
string += String.fromCharCode(char);
address += 1;
}
while (true) {
dword = read_dword(address);
if ((dword & 0xff) != 0) {
string += String.fromCharCode(dword & 0xff);
dword = dword >> 8;
}
else {
return string;
}
if ((dword & 0xff) != 0) {
string += String.fromCharCode(dword & 0xff);
dword = dword >> 8;
}
else {
return string;
}
if ((dword & 0xff) != 0) {
string += String.fromCharCode(dword & 0xff);
dword = dword >> 8;
}
else {
return string;
}
if ((dword & 0xff) != 0) {
string += String.fromCharCode(dword & 0xff);
}
else {
return string;
}
address += 4;
}
return string;
}
public function write_dword(address:uint, value:uint):void {
var offset:uint = 0;
if (address & 0x3 != 0) {
// NB: we could read 2 dwords here, and write 2 dwords, and
// produce the correct dword, but that could lead to oob reads
// and writes if we're close to a page boundary. take the path
// of least danger, and throw for debugging.
throw 'write_dword called with misaligned address'
}
if (address < vector_base) {
offset = negative((vector_base - address) >> 2);
}
else {
offset = (address - vector_base) >> 2;
}
vector[offset] = value;
}
}
} | ActionScript | 4 | OsmanDere/metasploit-framework | external/source/exploits/CVE-2015-0318/Memory.as | [
"BSD-2-Clause",
"BSD-3-Clause"
] |
--TEST--
Uninitialized PDO objects
--EXTENSIONS--
pdo
--FILE--
<?php
class MyPDO extends PDO {
public function __construct() {}
}
class MyPDOStatement extends PDOStatement {
public function __construct() {}
}
$pdo = new MyPDO;
try {
$pdo->query("foo");
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$stmt = new MyPDOStatement;
try {
$stmt->fetch();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$stmt = new MyPDOStatement;
try {
foreach ($stmt as $row) {}
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
PDO object is not initialized, constructor was not called
PDO object is uninitialized
PDO object is uninitialized
| PHP | 2 | NathanFreeman/php-src | ext/pdo/tests/pdo_uninitialized.phpt | [
"PHP-3.01"
] |
\data\
ngram 1=100
ngram 2=246
ngram 3=282
\1-grams:
-99 <s> -0.0544355
-1.80964 car -0.00984062
-2.61019 one -0.00984062
-1.73999 the -0.0517839
-1.92717 know -0.0273663
-1.85371 they -0.0606816
-1.88802 like -0.0273663
-1.88391 of -0.0345176
-1.94793 lot -0.0273663
-1.85772 in -0.0345176
-1.87965 really -0.00984064
-1.94211 just -0.00984062
-1.22836 </s>
-2.05438 parking -0.0686959
-1.97919 out -0.00984062
-1.97919 for -0.0686959
-1.94211 we -0.00984062
-1.94211 it's -0.0409123
-2.09474 had -0.00984062
-2.18926 to -0.0409811
-2.14275 not -0.00984062
-2.14275 our -0.0929816
-2.09474 what -0.00984062
-0.566575 <unk> -0.0724442
-2.14146 oh -0.0409811
-2.08783 i'd -0.0517839
-2.08783 smashing -0.0517839
-2.09474 too -0.00984062
-2.09474 um -0.00984062
-2.08783 so -0.0993089
-2.36738 all -0.00984062
-2.30164 over -0.0743795
-2.30164 around -0.00984062
-2.36738 cheaper -0.00984062
-1.32963 a -0.0631897
-2.36738 security -0.00984062
-2.30164 people -0.00984062
-2.36738 daylight -0.00984062
-2.32788 [laughter] -0.0607737
-2.30164 broad -0.0743795
-2.36738 bought -0.00984062
-2.29058 uh-huh -0.0743795
-2.30164 cars -0.00984062
-2.30164 into -0.00984062
-2.30164 right -0.0743795
-1.44678 and -0.0303061
-2.36738 there -0.00984062
-2.30164 me -0.00984062
-2.30164 ride -0.00984062
-2.30164 see -0.00984062
-2.36738 were -0.0607737
-2.30164 my -0.00984062
-2.30164 didn't -0.00984062
-2.30164 comfortable -0.00984062
-2.30164 as -0.00984062
-2.36738 windows -0.00984062
-1.50956 you -0.0646521
-2.30164 many -0.00984062
-2.61019 breaking -0.00984062
-2.61019 office -0.00984062
-2.61019 league -0.00984062
-2.61019 looks -0.00984062
-2.58796 yes -0.00984062
-2.61019 with -0.00984062
-2.61019 except -0.00984062
-2.61019 rash -0.00984062
-2.61019 window -0.00984062
-1.65196 have -0.0250986
-2.61019 going -0.00984062
-2.61019 pretty -0.00984062
-2.61019 real -0.00984062
-2.61019 paying -0.00984062
-2.61019 sitting -0.00984062
-2.61019 break -0.00984062
-2.61019 probably -0.00984062
-2.61019 bit -0.00984062
-2.61019 Maxima -0.00984062
-2.61019 always -0.00984062
-1.63641 it -0.0370039
-2.61019 stuff -0.00984062
-2.61019 heavy -0.00984062
-2.61019 because -0.00984062
-2.61019 house -0.00984062
-2.61019 i'll -0.00984062
-2.61019 yeah -0.00984062
-2.61019 up -0.00984062
-2.61019 lot's -0.00984062
-2.61019 looking -0.00984062
-2.61019 new -0.00984062
-1.6869 i -0.0273228
-2.58796 sixty -0.00984062
-2.61019 seventy -0.00984062
-2.61019 on -0.00984062
-2.61019 anything -0.00984062
-2.61019 could -0.00984062
-2.61019 i'm -0.00984062
-2.61019 makes -0.00984062
-2.61019 or -0.00984062
-2.61019 can't -0.00984062
-2.61019 nerve -0.00984062
\2-grams:
-1.87045 <s> they -0.0615336
-1.89418 <s> really -0.0615336
-1.43144 <s> oh -0.112377
-2.07952 <s> i'd -0.0615336
-2.07952 <s> smashing -0.0615336
-2.07952 <s> so -0.0615336
-1.70144 <s> [laughter] -0.14022
-2.24883 <s> uh-huh -0.0615336
-1.20624 <s> and -0.0615336
-1.54653 <s> you -0.0615336
-2.46872 <s> yes -0.0615336
-1.31156 <s> i -0.0615336
-2.46872 <s> sixty -0.0615336
-1.8267 car just -0.0615336
-0.570344 car <unk> -0.0615336
-1.93107 car so -0.0615336
-2.06474 car around -0.0615336
-1.41253 car and -0.0615336
-2.06474 car as -0.0615336
-1.51727 one i'd -0.0615336
-1.93684 the parking -0.0615336
-0.532749 the <unk> -0.0615336
-1.24967 the windows -0.0615336
-2.22827 the window -0.0615336
-1.80891 know it's -0.0615336
-1.09564 know and -0.0615336
-2.14857 know break -0.0615336
-1.57697 know it -0.0615336
-1.84113 they we -0.0615336
-1.17592 they were -0.14022
-1.08438 they have -0.0615336
-1.27782 like to -0.14022
-1.9084 like what -0.0615336
-1.312 like a -0.0615336
-1.57697 like it -0.0615336
-1.7259 of car -0.0615336
-0.503737 of <unk> -0.0615336
-2.04133 of my -0.0615336
-2.17089 of nerve -0.0615336
-1.2296 lot of -0.0615336
-1.2197 lot </s>
-1.41611 lot and -0.0615336
-1.47052 lot you -0.0615336
-1.67187 in the -0.0615336
-1.15733 in our -0.14022
-0.593395 in <unk> -0.0615336
-2.04133 in broad -0.0615336
-1.20576 really </s>
-1.90866 really what -0.0615336
-1.58057 really have -0.0615336
-2.16244 really heavy -0.0615336
-2.16244 really yeah -0.0615336
-1.71745 just in -0.0615336
-1.73286 just really -0.0615336
-1.28933 just a -0.0615336
-1.97955 just broad -0.0615336
-0.824432 parking lot -0.0615336
-2.08609 parking lot's -0.0615336
-1.63096 out the -0.0615336
-1.73583 out of -0.0615336
-0.567339 out <unk> -0.0615336
-1.97955 out my -0.0615336
-1.24744 for </s>
-0.744343 for a -0.112377
-1.71461 we they -0.0615336
-1.87092 we had -0.0615336
-0.567339 we <unk> -0.0615336
-1.56244 we have -0.0615336
-1.79589 it's it's -0.0615336
-1.06929 it's not -0.0615336
-1.3169 it's a -0.0615336
-1.7296 had we -0.0615336
-1.86041 had to -0.0615336
-1.27382 had a -0.0615336
-0.593031 to <unk> -0.0615336
-0.991693 to have -0.0615336
-1.59761 not the -0.0615336
-1.18541 not </s>
-2.00583 not real -0.0615336
-0.699288 our parking -0.112377
-0.564355 what <unk> -0.0615336
-1.90836 what people -0.0615336
-1.42355 what you -0.0615336
-1.86363 <unk> car -0.0615336
-1.79667 <unk> the -0.0615336
-1.72226 <unk> like -0.0615336
-1.93455 <unk> of -0.0615336
-1.70449 <unk> in -0.0615336
-1.14371 <unk> </s>
-1.77258 <unk> for -0.14022
-0.549194 <unk> <unk> -0.0615336
-2.31918 <unk> over -0.0615336
-2.31918 <unk> around -0.0615336
-1.15049 <unk> a -0.0615336
-1.93423 <unk> security -0.0615336
-2.31918 <unk> right -0.0615336
-1.51113 <unk> and -0.0615336
-1.46618 <unk> you -0.0615336
-2.57737 <unk> except -0.0615336
-2.57737 <unk> bit -0.0615336
-2.57737 <unk> stuff -0.0615336
-2.57737 <unk> i'll -0.0615336
-1.74536 <unk> i -0.0615336
-2.57737 <unk> makes -0.0615336
-2.57737 <unk> or -0.0615336
-1.02846 oh really -0.0615336
-1.88418 oh uh-huh -0.0615336
-0.933968 i'd like -0.14022
-2.01566 i'd probably -0.0615336
-1.62672 smashing the -0.0615336
-0.901575 smashing it -0.0615336
-1.81451 too um -0.0615336
-1.90836 too didn't -0.0615336
-1.90836 too many -0.0615336
-1.18541 um </s>
-1.27382 um a -0.0615336
-1.55955 um i -0.0615336
-0.376504 so <unk> -0.0615336
-1.71983 all had -0.0615336
-1.48163 all have -0.0615336
-0.793126 over there -0.0615336
-1.53773 around the -0.0615336
-1.71697 around smashing -0.0615336
-1.57912 cheaper car -0.0615336
-1.79363 cheaper ride -0.0615336
-1.35401 a car -0.0615336
-1.54313 a lot -0.14022
-0.532736 a <unk> -0.0990973
-2.08116 a um -0.0615336
-1.64596 a cheaper -0.0615336
-1.37863 a a -0.0615336
-2.24711 a comfortable -0.0615336
-2.46023 a rash -0.0615336
-2.46023 a house -0.0615336
-2.46023 a new -0.0615336
-1.61799 security really -0.0615336
-1.86644 security because -0.0615336
-1.6503 people just -0.0615336
-1.86644 people sitting -0.0615336
-1.16124 daylight </s>
-0.558448 daylight <unk> -0.0615336
-0.739987 [laughter] </s>
-0.793126 broad daylight -0.0615336
-1.86644 bought one -0.0615336
-1.24438 bought a -0.0615336
-0.683598 uh-huh </s>
-1.6503 cars just -0.0615336
-1.71697 cars i'd -0.0615336
-1.79363 into cars -0.0615336
-1.4713 into it -0.0615336
-0.779261 right out -0.0615336
-1.40566 and they -0.0615336
-1.9023 and it's -0.0615336
-2.06649 and our -0.0615336
-0.593688 and <unk> -0.0615336
-2.02848 and um -0.0615336
-2.18552 and people -0.0615336
-1.51263 and you -0.0615336
-1.3208 and it -0.14022
-1.67686 and i -0.0615336
-2.3814 and i'm -0.0615336
-1.71983 there too -0.0615336
-1.38255 there you -0.0615336
-1.71983 me too -0.0615336
-1.71697 me so -0.0615336
-1.16124 ride </s>
-1.33586 ride and -0.0615336
-1.86644 see paying -0.0615336
-1.86644 see anything -0.0615336
-0.435991 were <unk> -0.0615336
-1.86644 my office -0.0615336
-1.86644 my league -0.0615336
-1.79363 didn't see -0.0615336
-1.38255 didn't you -0.0615336
-1.79363 comfortable ride -0.0615336
-1.4713 comfortable it -0.0615336
-0.558448 as <unk> -0.0615336
-1.38255 as you -0.0615336
-0.558448 windows <unk> -0.0615336
-1.33586 windows and -0.0615336
-0.966317 you know -0.0990973
-1.94769 you for -0.0615336
-2.0377 you what -0.0615336
-1.45372 you all -0.0615336
-1.66869 you have -0.0615336
-2.36104 you could -0.0615336
-1.79363 many cars -0.0615336
-1.79363 many many -0.0615336
-1.56407 breaking into -0.0615336
-1.6055 office looks -0.0615336
-1.09589 league </s>
-1.56407 looks right -0.0615336
-1.09589 yes </s>
-0.541195 with <unk> -0.0615336
-1.474 except it's -0.0615336
-1.45376 rash of -0.0615336
-1.09589 window </s>
-1.23218 have </s>
-1.86695 have we -0.0615336
-1.98342 have had -0.0615336
-0.586949 have <unk> -0.0615336
-1.98342 have too -0.0615336
-2.12418 have over -0.0615336
-1.07813 have a -0.0615336
-1.6055 going on -0.0615336
-0.541195 pretty <unk> -0.0615336
-1.56407 real comfortable -0.0615336
-1.56407 paying as -0.0615336
-1.6055 sitting up -0.0615336
-1.56407 break into -0.0615336
-0.541195 probably <unk> -0.0615336
-1.48599 bit out -0.0615336
-1.09589 Maxima </s>
-1.6055 always looking -0.0615336
-1.87244 it we -0.0615336
-0.500045 it <unk> -0.112377
-1.98199 it smashing -0.0615336
-1.44676 it and -0.0615336
-2.28611 it with -0.0615336
-2.28611 it pretty -0.0615336
-1.474 stuff just -0.0615336
-1.44406 heavy in -0.0615336
-1.44254 because they -0.0615336
-1.48599 house for -0.0615336
-0.541195 i'll <unk> -0.0615336
-1.56407 yeah me -0.0615336
-1.44406 up in -0.0615336
-1.53104 lot's not -0.0615336
-1.48599 looking out -0.0615336
-1.6055 new Maxima -0.0615336
-1.8445 i know -0.0615336
-1.81381 i like -0.0615336
-1.30979 i bought -0.0615336
-2.10297 i didn't -0.0615336
-1.64761 i i -0.0615336
-2.25927 i can't -0.0615336
-1.6055 sixty seventy -0.0615336
-0.541195 seventy <unk> -0.0615336
-1.24148 on and -0.0615336
-1.6055 anything going -0.0615336
-0.541195 could <unk> -0.0615336
-1.6055 i'm always -0.0615336
-1.56407 makes me -0.0615336
-1.6055 or breaking -0.0615336
-1.56407 can't see -0.0615336
-1.27864 nerve you -0.0615336
\3-grams:
-0.691287 <s> they have
-0.730148 <s> really </s>
-0.591322 <s> oh really
-1.26668 <s> oh uh-huh
-0.632369 <s> i'd like
-0.618033 <s> smashing it
-0.303793 <s> so <unk>
-0.389665 <s> [laughter] </s>
-0.50593 <s> uh-huh </s>
-1.10713 <s> and they
-1.28263 <s> and um
-1.30367 <s> and people
-0.646094 <s> you know
-0.695292 <s> yes </s>
-1.24833 <s> i know
-1.24139 <s> i like
-1.19673 <s> i i
-0.813516 <s> sixty seventy
-0.752797 car just a
-0.791089 car <unk> you
-0.303793 car so <unk>
-0.803359 car around the
-0.760524 car and it
-0.774498 car as you
-0.852391 one i'd probably
-0.581477 the parking lot
-1.10827 the <unk> car
-0.507082 the <unk> <unk>
-0.514355 the windows <unk>
-0.97427 the windows and
-0.695292 the window </s>
-0.835669 know it's it's
-0.999318 know and they
-1.13371 know and our
-0.807468 know break into
-0.787463 know it and
-0.43517 they we <unk>
-0.266592 they were <unk>
-1.10878 they have we
-1.12453 they have had
-0.456259 like to have
-0.782953 like what you
-0.773657 like a a
-0.864556 like it pretty
-0.437091 of car <unk>
-0.891462 of <unk> </s>
-1.15357 of <unk> over
-0.841907 of my league
-0.750076 of nerve you
-0.470886 lot of <unk>
-1.14322 lot of nerve
-0.822835 lot and i
-0.646094 lot you know
-0.742445 in the windows
-0.37609 in our parking
-0.423467 in <unk> <unk>
-0.565666 in broad daylight
-0.433257 really what <unk>
-0.689082 really have a
-0.786949 really heavy in
-0.807468 really yeah me
-0.715524 just in our
-0.809936 just really have
-0.412703 just a <unk>
-0.565666 just broad daylight
-1.01607 parking lot </s>
-1.11166 parking lot and
-1.13425 parking lot you
-0.802283 parking lot's not
-0.862527 out the window
-0.853879 out of my
-0.835743 out <unk> the
-0.841907 out my office
-0.661302 for a car
-0.567927 for a <unk>
-0.691287 we they have
-0.828911 we had we
-0.865605 we <unk> right
-0.447621 we have <unk>
-0.759591 it's it's a
-1.05564 it's not the
-1.12716 it's not real
-0.818963 it's a cheaper
-0.82725 had we they
-0.451441 had to <unk>
-0.804219 had a lot
-0.847087 to <unk> security
-1.12453 to have too
-0.858385 to have a
-0.412711 not the <unk>
-0.807468 not real comfortable
-0.523434 our parking lot
-1.29785 our parking lot's
-0.847109 what <unk> of
-0.819521 what people just
-0.788779 what you all
-0.846862 <unk> car so
-0.847271 <unk> the parking
-1.11481 <unk> like what
-0.965107 <unk> like a
-0.828505 <unk> of car
-0.541514 <unk> in <unk>
-1.13109 <unk> in broad
-0.391069 <unk> for a
-1.45193 <unk> <unk> like
-1.44357 <unk> <unk> in
-1.09038 <unk> <unk> </s>
-1.47465 <unk> <unk> for
-1.09558 <unk> <unk> a
-1.34081 <unk> <unk> and
-1.6743 <unk> <unk> makes
-0.565666 <unk> over there
-0.827515 <unk> around smashing
-1.47339 <unk> a um
-1.33693 <unk> a cheaper
-1.50398 <unk> a comfortable
-1.53122 <unk> a rash
-1.53122 <unk> a house
-1.06063 <unk> security really
-1.1087 <unk> security because
-0.558483 <unk> right out
-0.760524 <unk> and it
-1.13071 <unk> you what
-1.0723 <unk> you have
-0.792513 <unk> except it's
-0.794655 <unk> bit out
-0.792513 <unk> stuff just
-0.418253 <unk> i'll <unk>
-0.757869 <unk> i bought
-0.807468 <unk> makes me
-0.813516 <unk> or breaking
-1.11484 oh really what
-1.14252 oh really yeah
-0.50593 oh uh-huh </s>
-0.502901 i'd like to
-0.418253 i'd probably <unk>
-0.742445 smashing the windows
-1.12436 smashing it smashing
-1.15154 smashing it with
-0.806777 too um i
-0.774498 too didn't you
-0.835454 too many many
-0.412703 um a <unk>
-0.757869 um i bought
-1.21834 so <unk> like
-1.2245 so <unk> i
-1.33412 so <unk> or
-0.748833 all had a
-0.858152 all have over
-1.08304 over there too
-0.991309 over there you
-0.412711 around the <unk>
-0.816428 around smashing the
-0.780742 cheaper car and
-0.764076 cheaper ride and
-1.24435 a car just
-1.28809 a car around
-1.28809 a car as
-0.496745 a lot of
-0.709656 a <unk> </s>
-0.588749 a <unk> <unk>
-1.45429 a <unk> bit
-0.748833 a um a
-1.05096 a cheaper car
-1.09685 a cheaper ride
-0.869299 a a new
-0.835454 a comfortable ride
-0.788785 a rash of
-0.794655 a house for
-0.813516 a new Maxima
-0.859878 security really heavy
-0.786658 security because they
-0.829265 people just really
-0.813516 people sitting up
-0.87159 daylight <unk> i'll
-0.899887 broad daylight </s>
-0.514355 broad daylight <unk>
-0.80002 bought one i'd
-0.768232 bought a car
-0.850153 cars just broad
-0.632369 cars i'd like
-0.819521 into cars just
-0.842396 into it we
-0.52131 right out <unk>
-1.12407 right out my
-1.10477 and they we
-0.906804 and they were
-0.68593 and it's not
-0.514906 and our parking
-0.87159 and <unk> stuff
-0.724141 and um </s>
-0.841907 and people sitting
-0.788779 and you all
-0.296813 and it <unk>
-0.857131 and i didn't
-0.813516 and i'm always
-0.845198 there too didn't
-0.646094 there you know
-0.845198 me too many
-0.303793 me so <unk>
-0.84474 ride and it's
-0.807468 see paying as
-0.813516 see anything going
-1.07992 were <unk> in
-1.15357 were <unk> around
-0.813516 my office looks
-0.695292 my league </s>
-0.841907 didn't see anything
-0.848028 didn't you for
-0.716747 comfortable ride </s>
-0.390907 comfortable it <unk>
-0.833398 as <unk> for
-0.866825 as you could
-0.847087 windows <unk> security
-0.451853 windows and <unk>
-1.34308 you know it's
-0.695013 you know and
-1.41251 you know break
-0.539906 you for a
-0.845198 you what people
-1.08304 you all had
-1.02372 you all have
-0.737654 you have </s>
-0.418253 you could <unk>
-0.827515 many cars i'd
-0.835454 many many cars
-0.792024 breaking into it
-0.807468 office looks right
-0.558483 looks right out
-0.423467 with <unk> <unk>
-0.68593 except it's not
-0.393396 rash of <unk>
-0.842273 have we had
-0.84141 have had to
-0.713367 have <unk> a
-0.837407 have too um
-0.565666 have over there
-1.04142 have a lot
-0.494066 have a <unk>
-0.740218 going on and
-0.87159 pretty <unk> except
-0.792024 real comfortable it
-0.429457 paying as <unk>
-0.786949 sitting up in
-0.835454 break into cars
-0.423467 probably <unk> <unk>
-0.829586 bit out of
-0.794655 always looking out
-0.807219 it we have
-0.581663 it <unk> <unk>
-0.622427 it <unk> a
-0.618033 it smashing it
-0.799246 it and you
-0.418253 it with <unk>
-0.418253 it pretty <unk>
-0.827569 stuff just in
-0.715524 heavy in our
-0.721272 because they were
-0.74184 house for </s>
-0.791089 i'll <unk> you
-0.827834 yeah me too
-0.822227 up in the
-0.724141 lot's not </s>
-0.816995 looking out the
-0.695292 new Maxima </s>
-0.809404 i know it
-0.809404 i like it
-1.1087 i bought one
-0.937441 i bought a
-0.835454 i didn't see
-0.863647 i i can't
-0.807468 i can't see
-0.418253 sixty seventy <unk>
-0.423467 seventy <unk> <unk>
-0.867379 on and i'm
-0.813516 anything going on
-0.713367 could <unk> a
-0.813516 i'm always looking
-0.827515 makes me so
-0.807468 or breaking into
-0.841907 can't see paying
-0.646094 nerve you know
\end\
| DNS Zone | 3 | shuipi100/kaldi | src/rnnlm/test/0.1k_3gram_unpruned.arpa | [
"Apache-2.0"
] |
abc_problem :-
maplist(abc_problem, ['', 'A', bark, bOOk, treAT, 'COmmon', sQuaD, 'CONFUSE']).
abc_problem(Word) :-
L = [[b,o],[x,k],[d,q],[c,p],[n,a],[g,t],[r,e],[t,g],[q,d],[f,s],
[j,w],[h,u],[v,i],[a,n],[o,b],[e,r],[f,s],[l,y],[p,c],[z,m]],
( abc_problem(L, Word)
-> format('~w OK~n', [Word])
; format('~w KO~n', [Word])).
abc_problem(L, Word) :-
atom_chars(Word, C_Words),
maplist(downcase_atom, C_Words, D_Words),
can_makeword(L, D_Words).
can_makeword(_L, []).
can_makeword(L, [H | T]) :-
( select([H, _], L, L1); select([_, H], L, L1)),
can_makeword(L1, T).
| Prolog | 4 | jjallaire/skylighting | skylighting-core/test/cases/abc.prolog | [
"BSD-3-Clause",
"MIT"
] |
#N canvas 847 270 519 316 12;
#X msg 101 186 2;
#X obj 78 227 print~;
#X msg 78 151 bang;
#X obj 41 122 phasor~ 1000;
#X text 118 152 bang prints one vector;
#X text 136 185 print two or more successive vectors, f 19;
#X obj 35 14 print~;
#X text 88 14 - print out raw values of a signal;
#X text 271 269 Updated for Pd version 0.33;
#X text 22 46 The print~ object takes a signal input and prints one
or more vectors out when you send it a bang or a number. By default
a vector is 64 samples., f 49;
#X text 53 269 see also:;
#X obj 135 270 print;
#X msg 330 154 \; pd dsp \$1;
#X obj 330 130 tgl 17 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X text 349 128 DSP on/off;
#X connect 0 0 1 0;
#X connect 2 0 1 0;
#X connect 3 0 1 0;
#X connect 13 0 12 0;
| Pure Data | 4 | myQwil/pure-data | doc/5.reference/print~-help.pd | [
"TCL"
] |
;--------------------------------
; CairoShell_64.nsi
!define ARCBITS 64
!define ARCNAME "x64"
!include "CairoShell.nsi"
| NSIS | 1 | anderlli0053/cairoshell | Installer/CairoShell_64.nsi | [
"Apache-2.0"
] |
{% include configuration.vars.templates.breadcrumb|default('@SyliusAdmin/ProductVariant/Index/_breadcrumb.html.twig') %}
| Twig | 1 | titomtd/Sylius | src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Index/ProductHeader/_breadcrumb.html.twig | [
"MIT"
] |
struct HelloWorld extends array
private static method onInit takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 0, "Hello World")
endmethod
endstruct
| Jasmin | 3 | Gabrielarodrigues10/ga | v/VJass.j | [
"MIT"
] |
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M15.54 10.5c.1.29.38.5.71.5.41 0 .75-.34.75-.75V10c0-.55-.45-1-1-1h-3c-.55 0-1 .45-1 1v1.5c0 .55.45 1 1 1h2.5v1h-2.04c-.1-.29-.38-.5-.71-.5-.41 0-.75.34-.75.75V14c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-1.5c0-.55-.45-1-1-1h-2.5v-1h2.04zm-8.04 3H9V9.75c0-.41.34-.75.75-.75s.75.34.75.75v3.75c0 .83-.67 1.5-1.5 1.5H7.5c-.83 0-1.5-.67-1.5-1.5v-.25c0-.41.34-.75.75-.75s.75.34.75.75v.25z"
}), 'JavascriptRounded'); | JavaScript | 2 | dany-freeman/material-ui | packages/mui-icons-material/lib/esm/JavascriptRounded.js | [
"MIT"
] |
<div>Sometimes Evernote
wraps lines inside blocks</div>
<div>Sometimes it doesn't wrap them</div>
<pre>But
careful
with
pre tags</pre> | HTML | 2 | asahiocean/joplin | packages/app-cli/tests/enex_to_md/multiline_inner_text.html | [
"MIT"
] |
package test;
import java.util.List;
import java.util.Collection;
public interface InheritReadOnlinessSubclass {
public interface Super {
Collection<String> foo();
void dummy(); // to avoid loading as SAM interface
}
public interface Sub extends Super {
List<String> foo();
}
}
| Java | 4 | qussarah/declare | compiler/testData/loadJava/compiledJava/kotlinSignature/propagation/return/InheritReadOnlinessSubclass.java | [
"Apache-2.0"
] |
module promise_demo
import gololang.concurrent.async.Promise
function main = |args| {
let divide42 = { # my promise
let promise = Promise()
let randomNumber = java.util.Random():nextInt(5)
if randomNumber > 0 {
let result = 42.0 / randomNumber
# resolve
promise: set([randomNumber, result])
} else {
# reject
promise: fail(java.lang.Exception("Divided by 0!"))
}
promise: future()
: onSet(|values| { #then
println("😊 👍 42/" + values: get(0) + "=" + values: get(1))
})
: onFail(|err| { #catch
println("😡 👎 ouch!: " + err: getMessage())
})
}
10: times(-> divide42())
} | Golo | 5 | ajnavarro/language-dataset | data/github.com/TypeUnsafe/golo-tour/00d980cef4912dd8f97cc72153e6c9ab0234b8fd/07-golo.06.RivieraJUG/04-golo-s-touch/sandbox/06-b-promises.golo | [
"MIT"
] |
grammar t053heteroTP;
options {
language=JavaScript;
output=AST;
tokenVocab=t053heteroT;
}
tokens { ROOT; }
@header {
function VX(ttype, tree) {
VX.superclass.constructor.apply(this, arguments);
};
org.antlr.lang.extend(VX, org.antlr.runtime.tree.CommonTree, {
toString: function() {
return VX.superclass.toString.call(this) + "<V>";
}
});
}
a : ID<V> ';'<V>;
| G-code | 3 | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | java/java2py/antlr-3.1.3/runtime/JavaScript/tests/functional/t053heteroTP.g | [
"Apache-2.0"
] |
require '../assertions'
require '../parserAssertions'
terms = require '../../lib/parser/codeGenerator'.codeGenerator ()
_ = require 'underscore'
require 'chai'.should()
describe 'operator expression'
variable (name) = terms.complexExpression [[terms.variable [name]]]
it 'parses operators, using precedence table'
(expression "a @and b") shouldContainFields (
terms.operator (
'&&'
[
terms.variable ['a']
terms.variable ['b']
]
)
)
compilationMap = {}
(name) compilesTo (jsOpName) =
compilationMap.(name) = jsOpName
compiledNameFor (name) =
if (Object.hasOwnProperty.call (compilationMap, name))
compilationMap.(name)
else
name
'@and' compilesTo '&&'
'@or' compilesTo '||'
'==' compilesTo '==='
'!=' compilesTo '!=='
'@not' compilesTo '!'
'^^' compilesTo '^'
'::' compilesTo 'instanceof'
(higher) isHigherInPrecedenceThan (lower) =
it "parses #(higher) as higher precedence than #(lower)"
(expression "a #(higher) b #(lower) c") shouldContainFields (
terms.operator (
compiledNameFor (lower)
[
terms.operator (
compiledNameFor (higher)
[
terms.variable ['a']
terms.variable ['b']
]
)
terms.variable ['c']
]
)
)
it "parses #(lower) as lower precedence than #(higher)"
(expression "a #(lower) b #(higher) c") shouldContainFields (
terms.operator (
compiledNameFor (lower)
[
terms.variable ['a']
terms.operator (
compiledNameFor (higher)
[
terms.variable ['b']
terms.variable ['c']
]
)
]
)
)
describe 'custom operators'
it 'throws when a custom operator is used before other operators'
operator = terms.operatorExpression (variable 'a')
operator.addOperator '@custom' expression (variable 'b')
operator.addOperator '@and' expression (variable 'c')
@{operator.expression ()}.should.throw '@custom cannot be used with other operators'
it 'throws when a custom operator is used after other operators'
operator = terms.operatorExpression (variable 'a')
operator.addOperator '@and' expression (variable 'b')
operator.addOperator '@custom' expression (variable 'c')
@{operator.expression ()}.should.throw '@custom cannot be used with other operators'
it "parses two custom unary operators, outer to inner"
(expression "@outer @inner a") shouldContainFields (
terms.functionCall (
terms.variable ['outer']
[
terms.functionCall (
terms.variable ['inner']
[
terms.variable ['a']
]
)
]
)
)
it "parses @custom binary operator as function call"
(expression "a @custom b") shouldContainFields (
terms.functionCall (terms.variable ['custom'], [terms.variable ['a'], terms.variable ['b']])
)
it "parses @你好 binary operator as function call"
(expression "a @你好 b") shouldContainFields (
terms.functionCall (terms.variable ['你好'], [terms.variable ['a'], terms.variable ['b']])
)
it "parses @custom unary operator as function call"
(expression "@custom a") shouldContainFields (
terms.functionCall (terms.variable ['custom'], [terms.variable ['a']])
)
it "parses @你好 unary operator as function call"
(expression "@你好 a") shouldContainFields (
terms.functionCall (terms.variable ['你好'], [terms.variable ['a']])
)
it "parses camel case custom operators"
(expression "@customOp a") shouldContainFields (
terms.functionCall (terms.variable ['customOp'], [terms.variable ['a']])
)
operatorsInOrderOfPrecedence = [
['/', '*', '%']
['-', '+']
['<<', '>>', '>>>']
['>', '>=', '<', '<=']
['==', '!=']
'&'
'^^'
'|'
'::'
['&&', '@and']
['||', '@or']
['<-']
]
theLeftOperator (left) hasHigherPrecedenceThanTheRightOperator (right) =
(expression "a #(left) b #(right) c") shouldContainFields (
terms.operator (
compiledNameFor (right)
[
terms.operator (
compiledNameFor (left)
[
terms.variable ['a']
terms.variable ['b']
]
)
terms.variable ['c']
]
)
)
(operators) areTheSamePrecedenceAndAreLeftAssociative =
_.reduce (operators) @(left, right)
it "parses #(left) with the same precedence as #(right) and both are left associative"
theLeftOperator (left) hasHigherPrecedenceThanTheRightOperator (right)
theLeftOperator (right) hasHigherPrecedenceThanTheRightOperator (left)
right
_.reduce (operatorsInOrderOfPrecedence) @(higher, lower)
if (higher :: Array)
(higher) areTheSamePrecedenceAndAreLeftAssociative
if (lower :: Array)
(higher.0) isHigherInPrecedenceThan (lower.0)
else
(higher.0) isHigherInPrecedenceThan (lower)
else
if (lower :: Array)
(higher) isHigherInPrecedenceThan (lower.0)
else
(higher) isHigherInPrecedenceThan (lower)
lower
itParsesUnaryOperator (op) =
it "should parse unary #(op)"
(expression "#(op) a") shouldContainFields {
operator = compiledNameFor (op)
operatorArguments = [
{variable ['a'], isVariable}
]
}
unaryOperators = [
'!'
'@not'
'~'
'+'
'-'
]
for each @(op) in (unaryOperators)
itParsesUnaryOperator (op)
| PogoScript | 4 | featurist/pogoscript | test/parser/operatorParserSpec.pogo | [
"BSD-2-Clause"
] |
\require "b@~>0.3.0" | LilyPond | 0 | HolgerPeters/lyp | spec/package_setups/simple_with_nested_packages/[email protected]/package.ly | [
"MIT"
] |
* XLSX
[[https://travis-ci.org/tealeg/xlsx][https://img.shields.io/travis/tealeg/xlsx/master.svg?style=flat-square]]
[[https://codecov.io/gh/tealeg/xlsx][https://codecov.io/gh/tealeg/xlsx/branch/master/graph/badge.svg]]
[[https://godoc.org/github.com/tealeg/xlsx][https://godoc.org/github.com/tealeg/xlsx?status.svg]]
[[https://github.com/tealeg/xlsx#license][https://img.shields.io/badge/license-bsd-orange.svg]]
** Introduction
xlsx is a library to simplify reading and writing the XML format used
by recent version of Microsoft Excel in Go programs.
The support for writing XLSX files is currently extremely minimal. It
will expand slowly, but in the meantime patches are welcome!
** Full API docs
The full API docs can be viewed using go's built in documentation
tool, or online at [[http://godoc.org/github.com/tealeg/xlsx][godoc.org]].
** Basic Usage
*** Reading XLSX files
Here is a minimal example usage that will dump all cell data in a
given XLSX file. A more complete example of this kind of
functionality is contained in [[https://github.com/tealeg/xlsx2csv][the XLSX2CSV program]]:
#+BEGIN_SRC go
package main
import (
"fmt"
"github.com/tealeg/xlsx"
)
func main() {
excelFileName := "/home/tealeg/foo.xlsx"
xlFile, err := xlsx.OpenFile(excelFileName)
if err != nil {
...
}
for _, sheet := range xlFile.Sheets {
for _, row := range sheet.Rows {
for _, cell := range row.Cells {
text := cell.String()
fmt.Printf("%s\n", text)
}
}
}
}
#+END_SRC
Some additional information is available from the cell (for example,
style information). For more details see the godoc output for this
package.
*** Writing XLSX files
The following constitutes the bare minimum required to write an XLSX document.
#+BEGIN_SRC go
package main
import (
"fmt"
"github.com/tealeg/xlsx"
)
func main() {
var file *xlsx.File
var sheet *xlsx.Sheet
var row *xlsx.Row
var cell *xlsx.Cell
var err error
file = xlsx.NewFile()
sheet, err = file.AddSheet("Sheet1")
if err != nil {
fmt.Printf(err.Error())
}
row = sheet.AddRow()
cell = row.AddCell()
cell.Value = "I am a cell!"
err = file.Save("MyXLSXFile.xlsx")
if err != nil {
fmt.Printf(err.Error())
}
}
#+END_SRC
** Contributing
We're extremely happy to review pull requests. Please be patient, maintaining XLSX doesn't pay anyone's salary (to my knowledge).
If you'd like to propose a change please ensure the following:
- All existing tests are passing.
- There are tests in the test suite that cover the changes you're making.
- You have added documentation strings (in English) to (at least) the public functions you've added or modified.
- Your use of, or creation of, XML is compliant with [[http://www.ecma-international.org/publications/standards/Ecma-376.htm][part 1 of the 4th edition of the ECMA-376 Standard for Office Open XML]].
Eat a peach - Geoff
| Org | 4 | btkinghome/Spear-of-Adun | vendor/github.com/tealeg/xlsx/README.org | [
"MIT"
] |
.style {
grid-template-columns: repeat(4, [col-start);
}
| CSS | 0 | mengxy/swc | crates/swc_css_parser/tests/errors/rome/invalid/grid/repeat/unclosed-lint-name/input.css | [
"Apache-2.0"
] |
<button id="hide" (click)="hide()">Hide</button>
<button id="show-10-rows-5-cols" (click)="showTenRowsFiveCols()">Show 10 Rows 5 Cols</button>
<button id="show-100-rows-5-cols" (click)="showOneHundredRowsFiveCols()">Show 100 Rows 5 Cols</button>
<button id="show-1000-rows-5-cols" (click)="showOneThousandRowsFiveCols()">Show 1000 Rows 5 Cols</button>
<button id="show-10-rows-10-cols" (click)="showTenRowsTenCols()">Show 10 Rows 10 Cols</button>
<button id="show-10-rows-20-cols" (click)="showTenRowsTwentyCols()">Show 10 Rows 20 Cols</button>
<basic-table [rows]="tenRows" [cols]="fiveCols" *ngIf="isTenRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneHundredRows" [cols]="fiveCols" *ngIf="isOneHundredRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneThousandRows" [cols]="fiveCols" *ngIf="isOneThousandRowsFiveColsVisible"></basic-table>
<basic-table [rows]="tenRows" [cols]="tenCols" *ngIf="isTenRowsTenColsVisible"></basic-table>
<basic-table [rows]="tenRows" [cols]="twentyCols" *ngIf="isTenRowsTwentyColsVisible"></basic-table>
| HTML | 3 | tungyingwaltz/components | test/benchmarks/mdc/table/app.module.html | [
"MIT"
] |
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* 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.
*****************************************************************************/
#include "modules/canbus/vehicle/transit/protocol/llc_auxiliaryfeedback_120.h"
#include "gtest/gtest.h"
#include "modules/canbus/proto/transit.pb.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace transit {
using ::apollo::drivers::canbus::Byte;
class llc_auxiliaryfeedback_120Test : public ::testing ::Test {
public:
virtual void SetUp() {}
protected:
Llcauxiliaryfeedback120 Llcauxiliary_feedback120_;
};
TEST_F(llc_auxiliaryfeedback_120Test, General) {
const uint8_t kData[4] = {0xFB, 0xFF, 0xFF, 0xFF};
int32_t length = 1;
int32_t turnsignal_len = 2;
EXPECT_FALSE(Llcauxiliary_feedback120_.llc_fbk_inverter(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch8(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch7(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch6(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch5(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch4(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch3(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch2(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_pdu_ch1(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_hazardlights(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_ledgreenon(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_horn(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_buzzeron(kData, length));
EXPECT_EQ(Llcauxiliary_feedback120_.llc_fbk_turnsignal(kData, turnsignal_len),
3);
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_lowbeam(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_highbeam(kData, length));
EXPECT_TRUE(Llcauxiliary_feedback120_.llc_fbk_ledredon(kData, length));
EXPECT_TRUE(
Llcauxiliary_feedback120_.llc_fbk_autonomybuttonpressed(kData, length));
}
} // namespace transit
} // namespace canbus
} // namespace apollo
| C++ | 4 | seeclong/apollo | modules/canbus/vehicle/transit/protocol/llc_auxiliaryfeedback_120_test.cc | [
"Apache-2.0"
] |
# Edge project file (edit at your own risk)
# Copyright (c) 2004-2017 Elements Interactive B.V.
# -----------------------------------------
# General project properties
projectname = "view3d"
caption = "View 3D"
target type = "bin"
appuid = "0x10205d9f"
version = "1.00.0"
capabilities = "None"
selplatform = "Series 60 (1st edition),Series 80 (1st edition),Series 80 (2nd edition),Series 90 (Nokia 7710)"
noresemu = "1"
# Project source, header and resource tree
sourcefile = "..\code\view3d.cpp"
headerfile = "..\code\main.h"
resourcepath = "Icons"
resourcefile = "..\res\icons\ico48_64.bmp"
resourcefile = "..\res\icons\ico48.bmp"
resourcefile = "..\res\icons\ico32.bmp"
resourcefile = "..\res\icons\ico24.bmp"
resourcefile = "..\res\icons\ico20.bmp"
resourcefile = "..\res\icons\ico16.bmp"
endpath = 1
resourcepath = "Install"
resourcefile = "..\res\edgelogo.3ds"
resourcefile = "..\res\texture.png"
resourcefile = "..\..\..\..\rasteroid3.1\bin\series60\armi\urel\libGLES_CM_NoE.dll"
resourcefile = "..\..\..\..\rasteroid3.1\bin\series60\armi\urel\libEGL.dll"
endpath = 0
# Project environment
incpath = "."
incpath = "..\..\..\..\rasteroid3.1\include"
pluginlib = "opengl\pluginrasteroid.lib"
dynamiclib = "..\..\..\..\rasteroid3.1\lib\series60\armi\urel\libEGL.lib"
dynamiclib = "..\..\..\..\rasteroid3.1\lib\series60\armi\urel\libGLES_CM_NoE.lib"
macrodef = "EGL_RASTEROID"
| Ecere Projects | 2 | elementsinteractive/edgelib | samples/View3D/workspace_eide_opengl/view3d_symbian_pre9.epj | [
"BSD-3-Clause"
] |
[
"ionAccessibilityOutline",
"ionAccessibilitySharp",
"ionAccessibility",
"ionAddCircleOutline",
"ionAddCircleSharp",
"ionAddCircle",
"ionAddOutline",
"ionAddSharp",
"ionAdd",
"ionAirplaneOutline",
"ionAirplaneSharp",
"ionAirplane",
"ionAlarmOutline",
"ionAlarmSharp",
"ionAlarm",
"ionAlbumsOutline",
"ionAlbumsSharp",
"ionAlbums",
"ionAlertCircleOutline",
"ionAlertCircleSharp",
"ionAlertCircle",
"ionAlertOutline",
"ionAlertSharp",
"ionAlert",
"ionAmericanFootballOutline",
"ionAmericanFootballSharp",
"ionAmericanFootball",
"ionAnalyticsOutline",
"ionAnalyticsSharp",
"ionAnalytics",
"ionApertureOutline",
"ionApertureSharp",
"ionAperture",
"ionAppsOutline",
"ionAppsSharp",
"ionApps",
"ionArchiveOutline",
"ionArchiveSharp",
"ionArchive",
"ionArrowBackCircleOutline",
"ionArrowBackCircleSharp",
"ionArrowBackCircle",
"ionArrowBackOutline",
"ionArrowBackSharp",
"ionArrowBack",
"ionArrowDownCircleOutline",
"ionArrowDownCircleSharp",
"ionArrowDownCircle",
"ionArrowDownOutline",
"ionArrowDownSharp",
"ionArrowDown",
"ionArrowForwardCircleOutline",
"ionArrowForwardCircleSharp",
"ionArrowForwardCircle",
"ionArrowForwardOutline",
"ionArrowForwardSharp",
"ionArrowForward",
"ionArrowRedoCircleOutline",
"ionArrowRedoCircleSharp",
"ionArrowRedoCircle",
"ionArrowRedoOutline",
"ionArrowRedoSharp",
"ionArrowRedo",
"ionArrowUndoCircleOutline",
"ionArrowUndoCircleSharp",
"ionArrowUndoCircle",
"ionArrowUndoOutline",
"ionArrowUndoSharp",
"ionArrowUndo",
"ionArrowUpCircleOutline",
"ionArrowUpCircleSharp",
"ionArrowUpCircle",
"ionArrowUpOutline",
"ionArrowUpSharp",
"ionArrowUp",
"ionAtCircleOutline",
"ionAtCircleSharp",
"ionAtCircle",
"ionAtOutline",
"ionAtSharp",
"ionAt",
"ionAttachOutline",
"ionAttachSharp",
"ionAttach",
"ionBackspaceOutline",
"ionBackspaceSharp",
"ionBackspace",
"ionBagAddOutline",
"ionBagAddSharp",
"ionBagAdd",
"ionBagCheckOutline",
"ionBagCheckSharp",
"ionBagCheck",
"ionBagHandleOutline",
"ionBagHandleSharp",
"ionBagHandle",
"ionBagOutline",
"ionBagRemoveOutline",
"ionBagRemoveSharp",
"ionBagRemove",
"ionBagSharp",
"ionBag",
"ionBalloonOutline",
"ionBalloonSharp",
"ionBalloon",
"ionBanOutline",
"ionBanSharp",
"ionBan",
"ionBandageOutline",
"ionBandageSharp",
"ionBandage",
"ionBarChartOutline",
"ionBarChartSharp",
"ionBarChart",
"ionBarbellOutline",
"ionBarbellSharp",
"ionBarbell",
"ionBarcodeOutline",
"ionBarcodeSharp",
"ionBarcode",
"ionBaseballOutline",
"ionBaseballSharp",
"ionBaseball",
"ionBasketOutline",
"ionBasketSharp",
"ionBasket",
"ionBasketballOutline",
"ionBasketballSharp",
"ionBasketball",
"ionBatteryChargingOutline",
"ionBatteryChargingSharp",
"ionBatteryCharging",
"ionBatteryDeadOutline",
"ionBatteryDeadSharp",
"ionBatteryDead",
"ionBatteryFullOutline",
"ionBatteryFullSharp",
"ionBatteryFull",
"ionBatteryHalfOutline",
"ionBatteryHalfSharp",
"ionBatteryHalf",
"ionBeakerOutline",
"ionBeakerSharp",
"ionBeaker",
"ionBedOutline",
"ionBedSharp",
"ionBed",
"ionBeerOutline",
"ionBeerSharp",
"ionBeer",
"ionBicycleOutline",
"ionBicycleSharp",
"ionBicycle",
"ionBluetoothOutline",
"ionBluetoothSharp",
"ionBluetooth",
"ionBoatOutline",
"ionBoatSharp",
"ionBoat",
"ionBodyOutline",
"ionBodySharp",
"ionBody",
"ionBonfireOutline",
"ionBonfireSharp",
"ionBonfire",
"ionBookOutline",
"ionBookSharp",
"ionBook",
"ionBookmarkOutline",
"ionBookmarkSharp",
"ionBookmark",
"ionBookmarksOutline",
"ionBookmarksSharp",
"ionBookmarks",
"ionBowlingBallOutline",
"ionBowlingBallSharp",
"ionBowlingBall",
"ionBriefcaseOutline",
"ionBriefcaseSharp",
"ionBriefcase",
"ionBrowsersOutline",
"ionBrowsersSharp",
"ionBrowsers",
"ionBrushOutline",
"ionBrushSharp",
"ionBrush",
"ionBugOutline",
"ionBugSharp",
"ionBug",
"ionBuildOutline",
"ionBuildSharp",
"ionBuild",
"ionBulbOutline",
"ionBulbSharp",
"ionBulb",
"ionBusOutline",
"ionBusSharp",
"ionBus",
"ionBusinessOutline",
"ionBusinessSharp",
"ionBusiness",
"ionCafeOutline",
"ionCafeSharp",
"ionCafe",
"ionCalculatorOutline",
"ionCalculatorSharp",
"ionCalculator",
"ionCalendarClearOutline",
"ionCalendarClearSharp",
"ionCalendarClear",
"ionCalendarNumberOutline",
"ionCalendarNumberSharp",
"ionCalendarNumber",
"ionCalendarOutline",
"ionCalendarSharp",
"ionCalendar",
"ionCallOutline",
"ionCallSharp",
"ionCall",
"ionCameraOutline",
"ionCameraReverseOutline",
"ionCameraReverseSharp",
"ionCameraReverse",
"ionCameraSharp",
"ionCamera",
"ionCarOutline",
"ionCarSharp",
"ionCarSportOutline",
"ionCarSportSharp",
"ionCarSport",
"ionCar",
"ionCardOutline",
"ionCardSharp",
"ionCard",
"ionCaretBackCircleOutline",
"ionCaretBackCircleSharp",
"ionCaretBackCircle",
"ionCaretBackOutline",
"ionCaretBackSharp",
"ionCaretBack",
"ionCaretDownCircleOutline",
"ionCaretDownCircleSharp",
"ionCaretDownCircle",
"ionCaretDownOutline",
"ionCaretDownSharp",
"ionCaretDown",
"ionCaretForwardCircleOutline",
"ionCaretForwardCircleSharp",
"ionCaretForwardCircle",
"ionCaretForwardOutline",
"ionCaretForwardSharp",
"ionCaretForward",
"ionCaretUpCircleOutline",
"ionCaretUpCircleSharp",
"ionCaretUpCircle",
"ionCaretUpOutline",
"ionCaretUpSharp",
"ionCaretUp",
"ionCartOutline",
"ionCartSharp",
"ionCart",
"ionCashOutline",
"ionCashSharp",
"ionCash",
"ionCellularOutline",
"ionCellularSharp",
"ionCellular",
"ionChatboxEllipsesOutline",
"ionChatboxEllipsesSharp",
"ionChatboxEllipses",
"ionChatboxOutline",
"ionChatboxSharp",
"ionChatbox",
"ionChatbubbleEllipsesOutline",
"ionChatbubbleEllipsesSharp",
"ionChatbubbleEllipses",
"ionChatbubbleOutline",
"ionChatbubbleSharp",
"ionChatbubble",
"ionChatbubblesOutline",
"ionChatbubblesSharp",
"ionChatbubbles",
"ionCheckboxOutline",
"ionCheckboxSharp",
"ionCheckbox",
"ionCheckmarkCircleOutline",
"ionCheckmarkCircleSharp",
"ionCheckmarkCircle",
"ionCheckmarkDoneCircleOutline",
"ionCheckmarkDoneCircleSharp",
"ionCheckmarkDoneCircle",
"ionCheckmarkDoneOutline",
"ionCheckmarkDoneSharp",
"ionCheckmarkDone",
"ionCheckmarkOutline",
"ionCheckmarkSharp",
"ionCheckmark",
"ionChevronBackCircleOutline",
"ionChevronBackCircleSharp",
"ionChevronBackCircle",
"ionChevronBackOutline",
"ionChevronBackSharp",
"ionChevronBack",
"ionChevronDownCircleOutline",
"ionChevronDownCircleSharp",
"ionChevronDownCircle",
"ionChevronDownOutline",
"ionChevronDownSharp",
"ionChevronDown",
"ionChevronForwardCircleOutline",
"ionChevronForwardCircleSharp",
"ionChevronForwardCircle",
"ionChevronForwardOutline",
"ionChevronForwardSharp",
"ionChevronForward",
"ionChevronUpCircleOutline",
"ionChevronUpCircleSharp",
"ionChevronUpCircle",
"ionChevronUpOutline",
"ionChevronUpSharp",
"ionChevronUp",
"ionClipboardOutline",
"ionClipboardSharp",
"ionClipboard",
"ionCloseCircleOutline",
"ionCloseCircleSharp",
"ionCloseCircle",
"ionCloseOutline",
"ionCloseSharp",
"ionClose",
"ionCloudCircleOutline",
"ionCloudCircleSharp",
"ionCloudCircle",
"ionCloudDoneOutline",
"ionCloudDoneSharp",
"ionCloudDone",
"ionCloudDownloadOutline",
"ionCloudDownloadSharp",
"ionCloudDownload",
"ionCloudOfflineOutline",
"ionCloudOfflineSharp",
"ionCloudOffline",
"ionCloudOutline",
"ionCloudSharp",
"ionCloudUploadOutline",
"ionCloudUploadSharp",
"ionCloudUpload",
"ionCloud",
"ionCloudyNightOutline",
"ionCloudyNightSharp",
"ionCloudyNight",
"ionCloudyOutline",
"ionCloudySharp",
"ionCloudy",
"ionCodeDownloadOutline",
"ionCodeDownloadSharp",
"ionCodeDownload",
"ionCodeOutline",
"ionCodeSharp",
"ionCodeSlashOutline",
"ionCodeSlashSharp",
"ionCodeSlash",
"ionCodeWorkingOutline",
"ionCodeWorkingSharp",
"ionCodeWorking",
"ionCode",
"ionCogOutline",
"ionCogSharp",
"ionCog",
"ionColorFillOutline",
"ionColorFillSharp",
"ionColorFill",
"ionColorFilterOutline",
"ionColorFilterSharp",
"ionColorFilter",
"ionColorPaletteOutline",
"ionColorPaletteSharp",
"ionColorPalette",
"ionColorWandOutline",
"ionColorWandSharp",
"ionColorWand",
"ionCompassOutline",
"ionCompassSharp",
"ionCompass",
"ionConstructOutline",
"ionConstructSharp",
"ionConstruct",
"ionContractOutline",
"ionContractSharp",
"ionContract",
"ionContrastOutline",
"ionContrastSharp",
"ionContrast",
"ionCopyOutline",
"ionCopySharp",
"ionCopy",
"ionCreateOutline",
"ionCreateSharp",
"ionCreate",
"ionCropOutline",
"ionCropSharp",
"ionCrop",
"ionCubeOutline",
"ionCubeSharp",
"ionCube",
"ionCutOutline",
"ionCutSharp",
"ionCut",
"ionDesktopOutline",
"ionDesktopSharp",
"ionDesktop",
"ionDiamondOutline",
"ionDiamondSharp",
"ionDiamond",
"ionDiceOutline",
"ionDiceSharp",
"ionDice",
"ionDiscOutline",
"ionDiscSharp",
"ionDisc",
"ionDocumentAttachOutline",
"ionDocumentAttachSharp",
"ionDocumentAttach",
"ionDocumentLockOutline",
"ionDocumentLockSharp",
"ionDocumentLock",
"ionDocumentOutline",
"ionDocumentSharp",
"ionDocumentTextOutline",
"ionDocumentTextSharp",
"ionDocumentText",
"ionDocument",
"ionDocumentsOutline",
"ionDocumentsSharp",
"ionDocuments",
"ionDownloadOutline",
"ionDownloadSharp",
"ionDownload",
"ionDuplicateOutline",
"ionDuplicateSharp",
"ionDuplicate",
"ionEarOutline",
"ionEarSharp",
"ionEar",
"ionEarthOutline",
"ionEarthSharp",
"ionEarth",
"ionEaselOutline",
"ionEaselSharp",
"ionEasel",
"ionEggOutline",
"ionEggSharp",
"ionEgg",
"ionEllipseOutline",
"ionEllipseSharp",
"ionEllipse",
"ionEllipsisHorizontalCircleOutline",
"ionEllipsisHorizontalCircleSharp",
"ionEllipsisHorizontalCircle",
"ionEllipsisHorizontalOutline",
"ionEllipsisHorizontalSharp",
"ionEllipsisHorizontal",
"ionEllipsisVerticalCircleOutline",
"ionEllipsisVerticalCircleSharp",
"ionEllipsisVerticalCircle",
"ionEllipsisVerticalOutline",
"ionEllipsisVerticalSharp",
"ionEllipsisVertical",
"ionEnterOutline",
"ionEnterSharp",
"ionEnter",
"ionExitOutline",
"ionExitSharp",
"ionExit",
"ionExpandOutline",
"ionExpandSharp",
"ionExpand",
"ionExtensionPuzzleOutline",
"ionExtensionPuzzleSharp",
"ionExtensionPuzzle",
"ionEyeOffOutline",
"ionEyeOffSharp",
"ionEyeOff",
"ionEyeOutline",
"ionEyeSharp",
"ionEye",
"ionEyedropOutline",
"ionEyedropSharp",
"ionEyedrop",
"ionFastFoodOutline",
"ionFastFoodSharp",
"ionFastFood",
"ionFemaleOutline",
"ionFemaleSharp",
"ionFemale",
"ionFileTrayFullOutline",
"ionFileTrayFullSharp",
"ionFileTrayFull",
"ionFileTrayOutline",
"ionFileTraySharp",
"ionFileTrayStackedOutline",
"ionFileTrayStackedSharp",
"ionFileTrayStacked",
"ionFileTray",
"ionFilmOutline",
"ionFilmSharp",
"ionFilm",
"ionFilterCircleOutline",
"ionFilterCircleSharp",
"ionFilterCircle",
"ionFilterOutline",
"ionFilterSharp",
"ionFilter",
"ionFingerPrintOutline",
"ionFingerPrintSharp",
"ionFingerPrint",
"ionFishOutline",
"ionFishSharp",
"ionFish",
"ionFitnessOutline",
"ionFitnessSharp",
"ionFitness",
"ionFlagOutline",
"ionFlagSharp",
"ionFlag",
"ionFlameOutline",
"ionFlameSharp",
"ionFlame",
"ionFlashOffOutline",
"ionFlashOffSharp",
"ionFlashOff",
"ionFlashOutline",
"ionFlashSharp",
"ionFlash",
"ionFlashlightOutline",
"ionFlashlightSharp",
"ionFlashlight",
"ionFlaskOutline",
"ionFlaskSharp",
"ionFlask",
"ionFlowerOutline",
"ionFlowerSharp",
"ionFlower",
"ionFolderOpenOutline",
"ionFolderOpenSharp",
"ionFolderOpen",
"ionFolderOutline",
"ionFolderSharp",
"ionFolder",
"ionFootballOutline",
"ionFootballSharp",
"ionFootball",
"ionFootstepsOutline",
"ionFootstepsSharp",
"ionFootsteps",
"ionFunnelOutline",
"ionFunnelSharp",
"ionFunnel",
"ionGameControllerOutline",
"ionGameControllerSharp",
"ionGameController",
"ionGiftOutline",
"ionGiftSharp",
"ionGift",
"ionGitBranchOutline",
"ionGitBranchSharp",
"ionGitBranch",
"ionGitCommitOutline",
"ionGitCommitSharp",
"ionGitCommit",
"ionGitCompareOutline",
"ionGitCompareSharp",
"ionGitCompare",
"ionGitMergeOutline",
"ionGitMergeSharp",
"ionGitMerge",
"ionGitNetworkOutline",
"ionGitNetworkSharp",
"ionGitNetwork",
"ionGitPullRequestOutline",
"ionGitPullRequestSharp",
"ionGitPullRequest",
"ionGlassesOutline",
"ionGlassesSharp",
"ionGlasses",
"ionGlobeOutline",
"ionGlobeSharp",
"ionGlobe",
"ionGolfOutline",
"ionGolfSharp",
"ionGolf",
"ionGridOutline",
"ionGridSharp",
"ionGrid",
"ionHammerOutline",
"ionHammerSharp",
"ionHammer",
"ionHandLeftOutline",
"ionHandLeftSharp",
"ionHandLeft",
"ionHandRightOutline",
"ionHandRightSharp",
"ionHandRight",
"ionHappyOutline",
"ionHappySharp",
"ionHappy",
"ionHardwareChipOutline",
"ionHardwareChipSharp",
"ionHardwareChip",
"ionHeadsetOutline",
"ionHeadsetSharp",
"ionHeadset",
"ionHeartCircleOutline",
"ionHeartCircleSharp",
"ionHeartCircle",
"ionHeartDislikeCircleOutline",
"ionHeartDislikeCircleSharp",
"ionHeartDislikeCircle",
"ionHeartDislikeOutline",
"ionHeartDislikeSharp",
"ionHeartDislike",
"ionHeartHalfOutline",
"ionHeartHalfSharp",
"ionHeartHalf",
"ionHeartOutline",
"ionHeartSharp",
"ionHeart",
"ionHelpBuoyOutline",
"ionHelpBuoySharp",
"ionHelpBuoy",
"ionHelpCircleOutline",
"ionHelpCircleSharp",
"ionHelpCircle",
"ionHelpOutline",
"ionHelpSharp",
"ionHelp",
"ionHomeOutline",
"ionHomeSharp",
"ionHome",
"ionHourglassOutline",
"ionHourglassSharp",
"ionHourglass",
"ionIceCreamOutline",
"ionIceCreamSharp",
"ionIceCream",
"ionIdCardOutline",
"ionIdCardSharp",
"ionIdCard",
"ionImageOutline",
"ionImageSharp",
"ionImage",
"ionImagesOutline",
"ionImagesSharp",
"ionImages",
"ionInfiniteOutline",
"ionInfiniteSharp",
"ionInfinite",
"ionInformationCircleOutline",
"ionInformationCircleSharp",
"ionInformationCircle",
"ionInformationOutline",
"ionInformationSharp",
"ionInformation",
"ionInvertModeOutline",
"ionInvertModeSharp",
"ionInvertMode",
"ionJournalOutline",
"ionJournalSharp",
"ionJournal",
"ionKeyOutline",
"ionKeySharp",
"ionKey",
"ionKeypadOutline",
"ionKeypadSharp",
"ionKeypad",
"ionLanguageOutline",
"ionLanguageSharp",
"ionLanguage",
"ionLaptopOutline",
"ionLaptopSharp",
"ionLaptop",
"ionLayersOutline",
"ionLayersSharp",
"ionLayers",
"ionLeafOutline",
"ionLeafSharp",
"ionLeaf",
"ionLibraryOutline",
"ionLibrarySharp",
"ionLibrary",
"ionLinkOutline",
"ionLinkSharp",
"ionLink",
"ionListCircleOutline",
"ionListCircleSharp",
"ionListCircle",
"ionListOutline",
"ionListSharp",
"ionList",
"ionLocateOutline",
"ionLocateSharp",
"ionLocate",
"ionLocationOutline",
"ionLocationSharp",
"ionLocation",
"ionLockClosedOutline",
"ionLockClosedSharp",
"ionLockClosed",
"ionLockOpenOutline",
"ionLockOpenSharp",
"ionLockOpen",
"ionLogInOutline",
"ionLogInSharp",
"ionLogIn",
"ionLogOutOutline",
"ionLogOutSharp",
"ionLogOut",
"ionLogoAlipay",
"ionLogoAmazon",
"ionLogoAmplify",
"ionLogoAndroid",
"ionLogoAngular",
"ionLogoAppleAppstore",
"ionLogoAppleAr",
"ionLogoApple",
"ionLogoBehance",
"ionLogoBitbucket",
"ionLogoBitcoin",
"ionLogoBuffer",
"ionLogoCapacitor",
"ionLogoChrome",
"ionLogoClosedCaptioning",
"ionLogoCodepen",
"ionLogoCss3",
"ionLogoDesignernews",
"ionLogoDeviantart",
"ionLogoDiscord",
"ionLogoDocker",
"ionLogoDribbble",
"ionLogoDropbox",
"ionLogoEdge",
"ionLogoElectron",
"ionLogoEuro",
"ionLogoFacebook",
"ionLogoFigma",
"ionLogoFirebase",
"ionLogoFirefox",
"ionLogoFlickr",
"ionLogoFoursquare",
"ionLogoGithub",
"ionLogoGitlab",
"ionLogoGooglePlaystore",
"ionLogoGoogle",
"ionLogoHackernews",
"ionLogoHtml5",
"ionLogoInstagram",
"ionLogoIonic",
"ionLogoIonitron",
"ionLogoJavascript",
"ionLogoLaravel",
"ionLogoLinkedin",
"ionLogoMarkdown",
"ionLogoMastodon",
"ionLogoMedium",
"ionLogoMicrosoft",
"ionLogoNoSmoking",
"ionLogoNodejs",
"ionLogoNpm",
"ionLogoOctocat",
"ionLogoPaypal",
"ionLogoPinterest",
"ionLogoPlaystation",
"ionLogoPwa",
"ionLogoPython",
"ionLogoReact",
"ionLogoReddit",
"ionLogoRss",
"ionLogoSass",
"ionLogoSkype",
"ionLogoSlack",
"ionLogoSnapchat",
"ionLogoSoundcloud",
"ionLogoStackoverflow",
"ionLogoSteam",
"ionLogoStencil",
"ionLogoTableau",
"ionLogoTiktok",
"ionLogoTumblr",
"ionLogoTux",
"ionLogoTwitch",
"ionLogoTwitter",
"ionLogoUsd",
"ionLogoVenmo",
"ionLogoVercel",
"ionLogoVimeo",
"ionLogoVk",
"ionLogoVue",
"ionLogoWebComponent",
"ionLogoWechat",
"ionLogoWhatsapp",
"ionLogoWindows",
"ionLogoWordpress",
"ionLogoXbox",
"ionLogoXing",
"ionLogoYahoo",
"ionLogoYen",
"ionLogoYoutube",
"ionMagnetOutline",
"ionMagnetSharp",
"ionMagnet",
"ionMailOpenOutline",
"ionMailOpenSharp",
"ionMailOpen",
"ionMailOutline",
"ionMailSharp",
"ionMailUnreadOutline",
"ionMailUnreadSharp",
"ionMailUnread",
"ionMail",
"ionMaleFemaleOutline",
"ionMaleFemaleSharp",
"ionMaleFemale",
"ionMaleOutline",
"ionMaleSharp",
"ionMale",
"ionManOutline",
"ionManSharp",
"ionMan",
"ionMapOutline",
"ionMapSharp",
"ionMap",
"ionMedalOutline",
"ionMedalSharp",
"ionMedal",
"ionMedicalOutline",
"ionMedicalSharp",
"ionMedical",
"ionMedkitOutline",
"ionMedkitSharp",
"ionMedkit",
"ionMegaphoneOutline",
"ionMegaphoneSharp",
"ionMegaphone",
"ionMenuOutline",
"ionMenuSharp",
"ionMenu",
"ionMicCircleOutline",
"ionMicCircleSharp",
"ionMicCircle",
"ionMicOffCircleOutline",
"ionMicOffCircleSharp",
"ionMicOffCircle",
"ionMicOffOutline",
"ionMicOffSharp",
"ionMicOff",
"ionMicOutline",
"ionMicSharp",
"ionMic",
"ionMoonOutline",
"ionMoonSharp",
"ionMoon",
"ionMoveOutline",
"ionMoveSharp",
"ionMove",
"ionMusicalNoteOutline",
"ionMusicalNoteSharp",
"ionMusicalNote",
"ionMusicalNotesOutline",
"ionMusicalNotesSharp",
"ionMusicalNotes",
"ionNavigateCircleOutline",
"ionNavigateCircleSharp",
"ionNavigateCircle",
"ionNavigateOutline",
"ionNavigateSharp",
"ionNavigate",
"ionNewspaperOutline",
"ionNewspaperSharp",
"ionNewspaper",
"ionNotificationsCircleOutline",
"ionNotificationsCircleSharp",
"ionNotificationsCircle",
"ionNotificationsOffCircleOutline",
"ionNotificationsOffCircleSharp",
"ionNotificationsOffCircle",
"ionNotificationsOffOutline",
"ionNotificationsOffSharp",
"ionNotificationsOff",
"ionNotificationsOutline",
"ionNotificationsSharp",
"ionNotifications",
"ionNuclearOutline",
"ionNuclearSharp",
"ionNuclear",
"ionNutritionOutline",
"ionNutritionSharp",
"ionNutrition",
"ionOpenOutline",
"ionOpenSharp",
"ionOpen",
"ionOptionsOutline",
"ionOptionsSharp",
"ionOptions",
"ionPaperPlaneOutline",
"ionPaperPlaneSharp",
"ionPaperPlane",
"ionPartlySunnyOutline",
"ionPartlySunnySharp",
"ionPartlySunny",
"ionPauseCircleOutline",
"ionPauseCircleSharp",
"ionPauseCircle",
"ionPauseOutline",
"ionPauseSharp",
"ionPause",
"ionPawOutline",
"ionPawSharp",
"ionPaw",
"ionPencilOutline",
"ionPencilSharp",
"ionPencil",
"ionPeopleCircleOutline",
"ionPeopleCircleSharp",
"ionPeopleCircle",
"ionPeopleOutline",
"ionPeopleSharp",
"ionPeople",
"ionPersonAddOutline",
"ionPersonAddSharp",
"ionPersonAdd",
"ionPersonCircleOutline",
"ionPersonCircleSharp",
"ionPersonCircle",
"ionPersonOutline",
"ionPersonRemoveOutline",
"ionPersonRemoveSharp",
"ionPersonRemove",
"ionPersonSharp",
"ionPerson",
"ionPhoneLandscapeOutline",
"ionPhoneLandscapeSharp",
"ionPhoneLandscape",
"ionPhonePortraitOutline",
"ionPhonePortraitSharp",
"ionPhonePortrait",
"ionPieChartOutline",
"ionPieChartSharp",
"ionPieChart",
"ionPinOutline",
"ionPinSharp",
"ionPin",
"ionPintOutline",
"ionPintSharp",
"ionPint",
"ionPizzaOutline",
"ionPizzaSharp",
"ionPizza",
"ionPlanetOutline",
"ionPlanetSharp",
"ionPlanet",
"ionPlayBackCircleOutline",
"ionPlayBackCircleSharp",
"ionPlayBackCircle",
"ionPlayBackOutline",
"ionPlayBackSharp",
"ionPlayBack",
"ionPlayCircleOutline",
"ionPlayCircleSharp",
"ionPlayCircle",
"ionPlayForwardCircleOutline",
"ionPlayForwardCircleSharp",
"ionPlayForwardCircle",
"ionPlayForwardOutline",
"ionPlayForwardSharp",
"ionPlayForward",
"ionPlayOutline",
"ionPlaySharp",
"ionPlaySkipBackCircleOutline",
"ionPlaySkipBackCircleSharp",
"ionPlaySkipBackCircle",
"ionPlaySkipBackOutline",
"ionPlaySkipBackSharp",
"ionPlaySkipBack",
"ionPlaySkipForwardCircleOutline",
"ionPlaySkipForwardCircleSharp",
"ionPlaySkipForwardCircle",
"ionPlaySkipForwardOutline",
"ionPlaySkipForwardSharp",
"ionPlaySkipForward",
"ionPlay",
"ionPodiumOutline",
"ionPodiumSharp",
"ionPodium",
"ionPowerOutline",
"ionPowerSharp",
"ionPower",
"ionPricetagOutline",
"ionPricetagSharp",
"ionPricetag",
"ionPricetagsOutline",
"ionPricetagsSharp",
"ionPricetags",
"ionPrintOutline",
"ionPrintSharp",
"ionPrint",
"ionPrismOutline",
"ionPrismSharp",
"ionPrism",
"ionPulseOutline",
"ionPulseSharp",
"ionPulse",
"ionPushOutline",
"ionPushSharp",
"ionPush",
"ionQrCodeOutline",
"ionQrCodeSharp",
"ionQrCode",
"ionRadioButtonOffOutline",
"ionRadioButtonOffSharp",
"ionRadioButtonOff",
"ionRadioButtonOnOutline",
"ionRadioButtonOnSharp",
"ionRadioButtonOn",
"ionRadioOutline",
"ionRadioSharp",
"ionRadio",
"ionRainyOutline",
"ionRainySharp",
"ionRainy",
"ionReaderOutline",
"ionReaderSharp",
"ionReader",
"ionReceiptOutline",
"ionReceiptSharp",
"ionReceipt",
"ionRecordingOutline",
"ionRecordingSharp",
"ionRecording",
"ionRefreshCircleOutline",
"ionRefreshCircleSharp",
"ionRefreshCircle",
"ionRefreshOutline",
"ionRefreshSharp",
"ionRefresh",
"ionReloadCircleOutline",
"ionReloadCircleSharp",
"ionReloadCircle",
"ionReloadOutline",
"ionReloadSharp",
"ionReload",
"ionRemoveCircleOutline",
"ionRemoveCircleSharp",
"ionRemoveCircle",
"ionRemoveOutline",
"ionRemoveSharp",
"ionRemove",
"ionReorderFourOutline",
"ionReorderFourSharp",
"ionReorderFour",
"ionReorderThreeOutline",
"ionReorderThreeSharp",
"ionReorderThree",
"ionReorderTwoOutline",
"ionReorderTwoSharp",
"ionReorderTwo",
"ionRepeatOutline",
"ionRepeatSharp",
"ionRepeat",
"ionResizeOutline",
"ionResizeSharp",
"ionResize",
"ionRestaurantOutline",
"ionRestaurantSharp",
"ionRestaurant",
"ionReturnDownBackOutline",
"ionReturnDownBackSharp",
"ionReturnDownBack",
"ionReturnDownForwardOutline",
"ionReturnDownForwardSharp",
"ionReturnDownForward",
"ionReturnUpBackOutline",
"ionReturnUpBackSharp",
"ionReturnUpBack",
"ionReturnUpForwardOutline",
"ionReturnUpForwardSharp",
"ionReturnUpForward",
"ionRibbonOutline",
"ionRibbonSharp",
"ionRibbon",
"ionRocketOutline",
"ionRocketSharp",
"ionRocket",
"ionRoseOutline",
"ionRoseSharp",
"ionRose",
"ionSadOutline",
"ionSadSharp",
"ionSad",
"ionSaveOutline",
"ionSaveSharp",
"ionSave",
"ionScaleOutline",
"ionScaleSharp",
"ionScale",
"ionScanCircleOutline",
"ionScanCircleSharp",
"ionScanCircle",
"ionScanOutline",
"ionScanSharp",
"ionScan",
"ionSchoolOutline",
"ionSchoolSharp",
"ionSchool",
"ionSearchCircleOutline",
"ionSearchCircleSharp",
"ionSearchCircle",
"ionSearchOutline",
"ionSearchSharp",
"ionSearch",
"ionSendOutline",
"ionSendSharp",
"ionSend",
"ionServerOutline",
"ionServerSharp",
"ionServer",
"ionSettingsOutline",
"ionSettingsSharp",
"ionSettings",
"ionShapesOutline",
"ionShapesSharp",
"ionShapes",
"ionShareOutline",
"ionShareSharp",
"ionShareSocialOutline",
"ionShareSocialSharp",
"ionShareSocial",
"ionShare",
"ionShieldCheckmarkOutline",
"ionShieldCheckmarkSharp",
"ionShieldCheckmark",
"ionShieldHalfOutline",
"ionShieldHalfSharp",
"ionShieldHalf",
"ionShieldOutline",
"ionShieldSharp",
"ionShield",
"ionShirtOutline",
"ionShirtSharp",
"ionShirt",
"ionShuffleOutline",
"ionShuffleSharp",
"ionShuffle",
"ionSkullOutline",
"ionSkullSharp",
"ionSkull",
"ionSnowOutline",
"ionSnowSharp",
"ionSnow",
"ionSparklesOutline",
"ionSparklesSharp",
"ionSparkles",
"ionSpeedometerOutline",
"ionSpeedometerSharp",
"ionSpeedometer",
"ionSquareOutline",
"ionSquareSharp",
"ionSquare",
"ionStarHalfOutline",
"ionStarHalfSharp",
"ionStarHalf",
"ionStarOutline",
"ionStarSharp",
"ionStar",
"ionStatsChartOutline",
"ionStatsChartSharp",
"ionStatsChart",
"ionStopCircleOutline",
"ionStopCircleSharp",
"ionStopCircle",
"ionStopOutline",
"ionStopSharp",
"ionStop",
"ionStopwatchOutline",
"ionStopwatchSharp",
"ionStopwatch",
"ionStorefrontOutline",
"ionStorefrontSharp",
"ionStorefront",
"ionSubwayOutline",
"ionSubwaySharp",
"ionSubway",
"ionSunnyOutline",
"ionSunnySharp",
"ionSunny",
"ionSwapHorizontalOutline",
"ionSwapHorizontalSharp",
"ionSwapHorizontal",
"ionSwapVerticalOutline",
"ionSwapVerticalSharp",
"ionSwapVertical",
"ionSyncCircleOutline",
"ionSyncCircleSharp",
"ionSyncCircle",
"ionSyncOutline",
"ionSyncSharp",
"ionSync",
"ionTabletLandscapeOutline",
"ionTabletLandscapeSharp",
"ionTabletLandscape",
"ionTabletPortraitOutline",
"ionTabletPortraitSharp",
"ionTabletPortrait",
"ionTelescopeOutline",
"ionTelescopeSharp",
"ionTelescope",
"ionTennisballOutline",
"ionTennisballSharp",
"ionTennisball",
"ionTerminalOutline",
"ionTerminalSharp",
"ionTerminal",
"ionTextOutline",
"ionTextSharp",
"ionText",
"ionThermometerOutline",
"ionThermometerSharp",
"ionThermometer",
"ionThumbsDownOutline",
"ionThumbsDownSharp",
"ionThumbsDown",
"ionThumbsUpOutline",
"ionThumbsUpSharp",
"ionThumbsUp",
"ionThunderstormOutline",
"ionThunderstormSharp",
"ionThunderstorm",
"ionTicketOutline",
"ionTicketSharp",
"ionTicket",
"ionTimeOutline",
"ionTimeSharp",
"ionTime",
"ionTimerOutline",
"ionTimerSharp",
"ionTimer",
"ionTodayOutline",
"ionTodaySharp",
"ionToday",
"ionToggleOutline",
"ionToggleSharp",
"ionToggle",
"ionTrailSignOutline",
"ionTrailSignSharp",
"ionTrailSign",
"ionTrainOutline",
"ionTrainSharp",
"ionTrain",
"ionTransgenderOutline",
"ionTransgenderSharp",
"ionTransgender",
"ionTrashBinOutline",
"ionTrashBinSharp",
"ionTrashBin",
"ionTrashOutline",
"ionTrashSharp",
"ionTrash",
"ionTrendingDownOutline",
"ionTrendingDownSharp",
"ionTrendingDown",
"ionTrendingUpOutline",
"ionTrendingUpSharp",
"ionTrendingUp",
"ionTriangleOutline",
"ionTriangleSharp",
"ionTriangle",
"ionTrophyOutline",
"ionTrophySharp",
"ionTrophy",
"ionTvOutline",
"ionTvSharp",
"ionTv",
"ionUmbrellaOutline",
"ionUmbrellaSharp",
"ionUmbrella",
"ionUnlinkOutline",
"ionUnlinkSharp",
"ionUnlink",
"ionVideocamOffOutline",
"ionVideocamOffSharp",
"ionVideocamOff",
"ionVideocamOutline",
"ionVideocamSharp",
"ionVideocam",
"ionVolumeHighOutline",
"ionVolumeHighSharp",
"ionVolumeHigh",
"ionVolumeLowOutline",
"ionVolumeLowSharp",
"ionVolumeLow",
"ionVolumeMediumOutline",
"ionVolumeMediumSharp",
"ionVolumeMedium",
"ionVolumeMuteOutline",
"ionVolumeMuteSharp",
"ionVolumeMute",
"ionVolumeOffOutline",
"ionVolumeOffSharp",
"ionVolumeOff",
"ionWalkOutline",
"ionWalkSharp",
"ionWalk",
"ionWalletOutline",
"ionWalletSharp",
"ionWallet",
"ionWarningOutline",
"ionWarningSharp",
"ionWarning",
"ionWatchOutline",
"ionWatchSharp",
"ionWatch",
"ionWaterOutline",
"ionWaterSharp",
"ionWater",
"ionWifiOutline",
"ionWifiSharp",
"ionWifi",
"ionWineOutline",
"ionWineSharp",
"ionWine",
"ionWomanOutline",
"ionWomanSharp",
"ionWoman"
] | JSON | 2 | eddelplus/quasar | extras/ionicons-v6/icons.json | [
"MIT"
] |
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- userdpiapi.hpp
Abstract:
- This module is used for abstracting calls to ntdll DLL APIs to break DDK dependencies.
Author(s):
- Michael Niksa (MiNiksa) July-2016
--*/
#pragma once
#include "conddkrefs.h"
// From winternl.h
typedef enum _PROCESSINFOCLASS
{
ProcessBasicInformation = 0,
ProcessDebugPort = 7,
ProcessWow64Information = 26,
ProcessImageFileName = 27,
ProcessBreakOnTermination = 29
} PROCESSINFOCLASS;
typedef struct _PROCESS_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PVOID PebBaseAddress;
ULONG_PTR AffinityMask;
LONG BasePriority;
ULONG_PTR UniqueProcessId;
ULONG_PTR InheritedFromUniqueProcessId;
} PROCESS_BASIC_INFORMATION;
typedef PROCESS_BASIC_INFORMATION* PPROCESS_BASIC_INFORMATION;
// end From winternl.h
class NtPrivApi sealed
{
public:
[[nodiscard]] static NTSTATUS s_GetProcessParentId(_Inout_ PULONG ProcessId);
~NtPrivApi();
private:
[[nodiscard]] static NTSTATUS s_NtOpenProcess(_Out_ PHANDLE ProcessHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ PCLIENT_ID ClientId);
[[nodiscard]] static NTSTATUS s_NtQueryInformationProcess(_In_ HANDLE ProcessHandle,
_In_ PROCESSINFOCLASS ProcessInformationClass,
_Out_ PVOID ProcessInformation,
_In_ ULONG ProcessInformationLength,
_Out_opt_ PULONG ReturnLength);
[[nodiscard]] static NTSTATUS s_NtClose(_In_ HANDLE Handle);
static NtPrivApi& _Instance();
HMODULE _hNtDll;
NtPrivApi();
};
| C++ | 4 | rasc0l/terminal | src/host/ntprivapi.hpp | [
"MIT"
] |
#tag Class
Protected Class AVCaptureInputPort
Inherits NSObject
#tag Method, Flags = &h21
Private Shared Function ClassRef() As Ptr
static ref as ptr = NSClassFromString("AVCaptureInputPort")
return ref
End Function
#tag EndMethod
#tag Method, Flags = &h1000
Sub Constructor()
// Calling the overridden superclass constructor.
// Note that this may need modifications if there are multiple constructor choices.
// Possible constructor calls:
// Constructor() -- From NSObject
// Constructor(ref as ptr) -- From NSObject
Super.Constructor( Initialize(Allocate(ClassRef)) )
needsExtraRelease = True
End Sub
#tag EndMethod
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function enabled_ lib AVFoundationLib selector "isEnabled" (obj_id as ptr) as Boolean
Return enabled_(self)
End Get
#tag EndGetter
#tag Setter
Set
declare sub enabled_ lib AVFoundationLib selector "setEnabled:" (obj_id as ptr, enabled as Boolean)
enabled_(self, value)
End Set
#tag EndSetter
enabled As Boolean
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function input_ lib AVFoundationLib selector "input" (obj_id as ptr) as ptr
Return new AVCaptureInput(input_(self))
End Get
#tag EndGetter
input As AVCaptureInput
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function mediaType_ lib AVFoundationLib selector "mediaType" (obj_id as ptr) as CFStringRef
Return mediaType_(self)
End Get
#tag EndGetter
mediaType As Text
#tag EndComputedProperty
#tag ViewBehavior
#tag ViewProperty
Name="enabled"
Visible=false
Group="Behavior"
InitialValue=""
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="mediaType"
Visible=false
Group="Behavior"
InitialValue=""
Type="Text"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 4 | kingj5/iOSKit | Modules/AVFoundation/AVCaptureInputPort.xojo_code | [
"MIT"
] |
# Makefile for core library for VMS
# contributed by Jouk Jansen [email protected]
# Last revision : 3 October 2007
.first
define gl [---.include.gl]
define math [-.math]
define vbo [-.vbo]
define tnl [-.tnl]
define shader [-.shader]
define swrast [-.swrast]
define swrast_setup [-.swrast_setup]
define main [-.main]
define glapi [-.glapi]
.include [---]mms-config.
##### MACROS #####
VPATH = RCS
INCDIR = [---.include],[-.main],[-.glapi],[-.shader],[-.shader.slang]
LIBDIR = [---.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
SOURCES =vbo_context.c,vbo_exec.c,vbo_exec_api.c,vbo_exec_array.c,\
vbo_exec_draw.c,vbo_exec_eval.c,vbo_rebase.c,vbo_save.c,\
vbo_save_api.c,vbo_save_draw.c,vbo_save_loopback.c,\
vbo_split.c,vbo_split_copy.c,vbo_split_inplace.c
OBJECTS =vbo_context.obj,vbo_exec.obj,vbo_exec_api.obj,vbo_exec_array.obj,\
vbo_exec_draw.obj,vbo_exec_eval.obj,vbo_rebase.obj,vbo_save.obj,\
vbo_save_api.obj,vbo_save_draw.obj,vbo_save_loopback.obj,\
vbo_split.obj,vbo_split_copy.obj,vbo_split_inplace.obj
##### RULES #####
VERSION=Mesa V3.4
##### TARGETS #####
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS)
@ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
clean :
purge
delete *.obj;*
vbo_context.obj : vbo_context.c
vbo_exec.obj : vbo_exec.c
vbo_exec_api.obj : vbo_exec_api.c
vbo_exec_array.obj : vbo_exec_array.c
vbo_exec_draw.obj : vbo_exec_draw.c
vbo_exec_eval.obj : vbo_exec_eval.c
vbo_rebase.obj : vbo_rebase.c
vbo_save.obj : vbo_save.c
vbo_save_api.obj : vbo_save_api.c
vbo_save_draw.obj : vbo_save_draw.c
vbo_save_loopback.obj : vbo_save_loopback.c
vbo_split.obj : vbo_split.c
vbo_split_copy.obj : vbo_split_copy.c
vbo_split_inplace.obj : vbo_split_inplace.c
| Module Management System | 3 | manggoguy/parsec-modified | pkgs/libs/mesa/src/src/mesa/vbo/descrip.mms | [
"BSD-3-Clause"
] |
{% skip_file if flag?(:without_playground) %}
require "./playground/*"
| Crystal | 1 | jessedoyle/crystal | src/compiler/crystal/tools/playground.cr | [
"Apache-2.0"
] |
= Documentation for JSON Feature
The json feature adds support for JSON API access for all other
features that ship with Rodauth.
When this feature is used, all other features become accessible via a
JSON API. The JSON API uses the POST method for all requests, using
the same parameter names as the features uses. JSON API requests to
Rodauth endpoints that use a method other than POST will result in a
405 Method Not Allowed response.
Responses are returned as JSON hashes. In case of an error, the +error+
entry is set to an error message, and the <tt>field-error</tt> entry is set to
an array containing the field name and the error message for that field.
Successful requests by default store a +success+ entry with a success
message, though that can be disabled.
The session state is managed in the rack session, so make sure that
CSRF protection is enabled. This will be the case when passing the
<tt>json: true</tt> option when loading the rodauth plugin. If you
want to only handle JSON requests, set <tt>only_json? true</tt> in
your rodauth configuration.
If you want token-based authentication sent via the Authorization
header, consider using the jwt feature.
== Auth Value Methods
json_accept_regexp :: The regexp to use to check the Accept header for JSON if +json_check_accept?+ is true.
json_check_accept? :: Whether to check the Accept header to see if the client supports JSON responses, true by default.
json_non_post_error_message :: The error message to use when a JSON non-POST request is sent.
json_not_accepted_error_message :: The error message to display if +json_check_accept?+ is true and the Accept header is present but does not match +json_request_content_type_regexp+.
json_request_content_type_regexp :: The regexp to use to recognize a request as a json request.
json_response_content_type :: The content type to set for json responses, <tt>application/json</tt> by default.
json_response_custom_error_status? :: Whether to use custom error statuses, instead of always using +json_response_error_status+, true by default, can be set to false for backwards compatibility with Rodauth 1.
json_response_error_key :: The JSON result key containing an error message, +error+ by default.
json_response_error_status :: The HTTP status code to use for JSON error responses if not using custom error statuses, 400 by default.
json_response_field_error_key :: The JSON result key containing an field error message, <tt>field-error</tt> by default.
json_response_success_key :: The JSON result key containing a success message for successful request, if set. +success+ by default.
non_json_request_error_message :: The error message to use when a non-JSON request is sent and +only_json?+ is set.
only_json? :: Whether to have Rodauth only allow JSON requests. True by default if <tt>json: :only</tt> option was given when loading the plugin. If set, rodauth endpoints will issue an error for non-JSON requests.
use_json? :: Whether to return a JSON response. By default, a JSON response is returned if +only_json?+ is true, or if the request uses a json content type.
== Auth Methods
json_request? :: Whether the current request is a JSON request, looks at the Content-Type request header by default.
json_response_body(hash) :: The body to use for JSON response. By default just converts hash to JSON. Can be used to reformat JSON output in arbitrary ways.
| RDoc | 4 | dmitryzuev/rodauth | doc/json.rdoc | [
"MIT"
] |
#include "devicedefines.h"
#include "../core/customdefines.h"
/* This file includes an example integration of lib_array_mic into USB Audio */
#include <platform.h>
#include <xs1.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <xclib.h>
#include <stdint.h>
#include "mic_array.h"
#define MAX_DECIMATION_FACTOR 12
// Defines for mic_array_decimator_conf_common_t
#define DC_OFFSET_REMOVAL 1
#define INDEX_BIT_REVERSAL 0
#define WINDOWING_FUNCTION 0
#define MIC_GAIN_COMPENSATION 0
#define FIR_GAIN_COMPENSATION 0
/* Hardware resources */
in port p_pdm_clk = PORT_PDM_CLK;
in port p_mclk = PORT_PDM_MCLK;
clock pdmclk = on tile[PDM_TILE]: XS1_CLKBLK_3;
/* Wordclock */
in port p_wclk_mclk = PORT_WCLK_MCLK;
in port p_wclk_out = PORT_WCLK_OUT;
in port p_clk_src_sel = PORT_CLK_SRC_SEL;
clock clk_audio_wclk = on tile[PDM_TILE]: XS1_CLKBLK_4;
// Mic input ports
in buffered port:32 p_pdm_mics_0_to_7 = PORT_PDM_DATA_0_to_7;
in buffered port:32 p_pdm_mics_8_to_15 = PORT_PDM_DATA_8_to_15;
/* User hooks */
unsafe void user_pdm_process(mic_array_frame_time_domain * unsafe audio, int output[]);
// data mics 1-8
int data_0[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
int data_1[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
//data mics 9-16
int data_2[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
int data_3[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
mic_array_frame_time_domain mic_audio[NUM_PDM_MICS/4];
void generate_wordclock(){
unsigned int src_sel;
p_clk_src_sel :> src_sel;
//When board uses its internal clock, the Wordclock is derived from that
if(src_sel){
/*For whatever reason (did not find any documentation of this)
* the division factor is off by 1 bit. Dividing by 12.288MHz by 256
* results in the factor 128
*/
configure_clock_src_divide(clk_audio_wclk, p_wclk_mclk, 128);
configure_port_clock_output(p_wclk_out, clk_audio_wclk);
start_clock(clk_audio_wclk);
}
else {
stop_clock(clk_audio_wclk);
}
}
void pdm_process(streaming chanend c_ds_output[NUM_PDM_MICS/4], chanend c_audio)
{
unsigned buffer = 1; // Buffer index
int output[NUM_PDM_MICS];
while(1)
{
unsigned samplerate;
c_audio :> samplerate;
unsigned decimationfactor = 96000/samplerate;
unsafe
{
// FIR coefficients for different sample rates
const int * unsafe fir_coefs[7] = {0, g_third_stage_div_2_fir, g_third_stage_div_4_fir, g_third_stage_div_6_fir,
g_third_stage_div_8_fir, 0, g_third_stage_div_12_fir};
// General config for the decimator
mic_array_decimator_conf_common_t dcc = {MIC_ARRAY_MAX_FRAME_SIZE_LOG2, DC_OFFSET_REMOVAL, INDEX_BIT_REVERSAL,
WINDOWING_FUNCTION, decimationfactor, fir_coefs[decimationfactor/2],
MIC_GAIN_COMPENSATION, FIR_GAIN_COMPENSATION,
DECIMATOR_NO_FRAME_OVERLAP, NUM_PDM_MICS/4};
// Decimator specific config
mic_array_decimator_config_t dc[NUM_PDM_MICS/4] = {{&dcc, data_0, {0, 0, 0, 0}, 4},
{&dcc, data_1, {0, 0, 0, 0}, 4},
{&dcc, data_2, {0, 0, 0, 0}, 4},
{&dcc, data_3, {0, 0, 0, 0}, 4}};
mic_array_decimator_configure(c_ds_output, NUM_PDM_MICS/4, dc);
mic_array_init_time_domain_frame(c_ds_output, NUM_PDM_MICS/4, buffer, mic_audio, dc);
while(1)
{
mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, NUM_PDM_MICS/4,
buffer, mic_audio, dc);
unsafe
{
int req;
user_pdm_process(current, output);
c_audio :> req;
if(req)
{
for(int i = 0; i < NUM_PDM_MICS; i++)
{
//TODO: Multiply by -1 to compensate for false differential signaling
c_audio <: output[i];
}
}
else
{
break;
}
}
}
}
}
}
#if MAX_FREQ > 48000
#error MAX_FREQ > 48000 NOT CURRENTLY SUPPORTED
#endif
void pcm_pdm_mic(chanend c_pcm_out)
{
streaming chan c_pdm_mic_0_to_3, c_pdm_mic_4_to_7, c_pdm_mic_8_to_11, c_pdm_mic_12_to_15;
streaming chan c_ds_output[NUM_PDM_MICS/4];
/* Note, this divide should be based on master clock freq */
configure_clock_src_divide(pdmclk, p_mclk, 2);
configure_port_clock_output(p_pdm_clk, pdmclk);
//Mics 1 to 8
configure_in_port(p_pdm_mics_0_to_7, pdmclk);
//Mics 9 to 16
configure_in_port(p_pdm_mics_8_to_15, pdmclk);
start_clock(pdmclk);
par
{
// Mics 1 to 8
mic_array_pdm_rx(p_pdm_mics_0_to_7, c_pdm_mic_0_to_3, c_pdm_mic_4_to_7);
mic_array_decimate_to_pcm_4ch(c_pdm_mic_0_to_3, c_ds_output[0], MIC_ARRAY_NO_INTERNAL_CHANS);
mic_array_decimate_to_pcm_4ch(c_pdm_mic_4_to_7, c_ds_output[1], MIC_ARRAY_NO_INTERNAL_CHANS);
// Mics 9 to 16
mic_array_pdm_rx(p_pdm_mics_8_to_15, c_pdm_mic_8_to_11, c_pdm_mic_12_to_15);
mic_array_decimate_to_pcm_4ch(c_pdm_mic_8_to_11, c_ds_output[2], MIC_ARRAY_NO_INTERNAL_CHANS);
mic_array_decimate_to_pcm_4ch(c_pdm_mic_12_to_15, c_ds_output[3], MIC_ARRAY_NO_INTERNAL_CHANS);
// Process decimated data
pdm_process(c_ds_output, c_pcm_out);
}
}
| XC | 5 | simongapp/xmos_usb_mems_interface | 01Firmware/PDM_USB/PDM_USB/src/pdm_mics/pcm_pdm_mic.xc | [
"Unlicense"
] |
.button-ok {
foo: 1;
}
.button-cancel {
foo: 1;
}
.button-custom {
foo: 1;
}
.grand .parent > .grand .parent {
foo: 1;
}
.grand .parent + .grand .parent {
foo: 1;
}
.grand .parent .grand .parent {
foo: 1;
}
.grand .parent.grand .parent {
foo: 1;
}
.grand .parent,
.grand .parentish {
foo: 1;
}
| CSS | 0 | FlyAboveGrass/wepy | packages/compiler-stylus/test/fixtures/css/selector.css | [
"BSD-3-Clause"
] |
#!/bin/bash
# The script runs the smoke test against every supported builder configuration.
#
# It's a part of the test process.
dir="$(pwd)/examples"
ok_message="\n\033[0;32m✓ OK!\033[0m\n"
error_message="\n\033[0;31m✗ Something went wrong!\033[0m\n"
cd "$dir" || exit 1
for example in `ls`
do
printf "\n\033[0;32mTesting $example...\033[0m\n\n"
cd "$example" || exit 1
yarn
yarn build
yarn test || (printf "$error_message" && exit 1) || exit 1
cd - || exit 1
printf "$ok_message"
done
| Shell | 4 | taco-tues-on-a-fri/date-fns | scripts/test/smoke.sh | [
"MIT"
] |
(*
Module: Sep
Generic separators to build lenses
Author: Raphael Pinson <[email protected]>
About: License
This file is licensed under the LGPL v2+, like the rest of Augeas.
*)
module Sep =
(* Variable: colon *)
let colon = Util.del_str ":"
(* Variable: semicolon *)
let semicolon = Util.del_str ";"
(* Variable: comma *)
let comma = Util.del_str ","
(* Variable: equal *)
let equal = Util.del_str "="
(* Variable: space_equal *)
let space_equal = Util.delim "="
(* Variable: space
Deletes a <Rx.space> and default to a single space *)
let space = del Rx.space " "
(* Variable: tab
Deletes a <Rx.space> and default to a tab *)
let tab = del Rx.space "\t"
(* Variable: opt_space
Deletes a <Rx.opt_space> and default to an empty string *)
let opt_space = del Rx.opt_space ""
(* Variable: opt_tab
Deletes a <Rx.opt_space> and default to a tab *)
let opt_tab = del Rx.opt_space "\t"
(* Variable: cl_or_space
Deletes a <Rx.cl_or_space> and default to a single space *)
let cl_or_space = del Rx.cl_or_space " "
(* Variable: cl_or_opt_space
Deletes a <Rx.cl_or_opt_space> and default to a single space *)
let cl_or_opt_space = del Rx.cl_or_opt_space " "
(* Variable: lbracket *)
let lbracket = Util.del_str "("
(* Variable: rbracket *)
let rbracket = Util.del_str ")"
| Augeas | 4 | zwass/launcher | pkg/augeas/assets/lenses/sep.aug | [
"MIT"
] |
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/
// Distributed under the MIT License.
//==============================================================================================================================
//
// Configuration:
// FILAMENT_SPLIT_EASU:
// if defined, only do the fast path (early exit) code, and write 1.0 to the
// depth buffer for the slow path
//
// FILAMENT_FSR_DERINGING:
// if defined, performs deringing code
//
#define rcp(x) (1.0/(x))
#define rsqrt inversesqrt
AF3 FsrEasuSampleF(highp AF2 p);
void FsrEasuTapF2(
inout AF2 aCR,inout AF2 aCG,inout AF2 aCB,
inout AF2 aW,
AF2 offX,AF2 offY,
AF2 dir,
AF2 len,
AF1 lob,
AF1 clp,
AF2 cR,AF2 cG,AF2 cB) {
AF2 vX,vY;
vX=offX* dir.xx +offY*dir.yy;
vY=offX*(-dir.yy)+offY*dir.xx;
vX*=len.x;vY*=len.y;
AF2 d2=vX*vX+vY*vY;
d2=min(d2,AF2_(clp));
AF2 wB=AF2_(2.0/5.0)*d2+AF2_(-1.0);
AF2 wA=AF2_(lob)*d2+AF2_(-1.0);
wB*=wB;
wA*=wA;
wB=AF2_(25.0/16.0)*wB+AF2_(-(25.0/16.0-1.0));
AF2 w=wB*wA;
aCR+=cR*w;aCG+=cG*w;aCB+=cB*w;aW+=w;
}
void FsrEasuL(
out AF3 pix,
highp AF2 ip,
highp AF4 con0,
highp AF4 con1,
highp AF4 con2,
highp AF4 con3){
//------------------------------------------------------------------------------------------------------------------------------
// Direction is the '+' diff.
// A
// B C D
// E
highp AF2 pp=(ip)*(con0.xy)+(con0.zw);
highp AF2 tc=(pp+AF2_(0.5))*con1.xy;
AF3 sA=FsrEasuSampleF(tc-AF2(0, con1.y));
AF3 sB=FsrEasuSampleF(tc-AF2(con1.x, 0));
AF3 sC=FsrEasuSampleF(tc);
AF3 sD=FsrEasuSampleF(tc+AF2(con1.x, 0));
AF3 sE=FsrEasuSampleF(tc+AF2(0, con1.y));
AF1 lA=sA.r*0.5+sA.g;
AF1 lB=sB.r*0.5+sB.g;
AF1 lC=sC.r*0.5+sC.g;
AF1 lD=sD.r*0.5+sD.g;
AF1 lE=sE.r*0.5+sE.g;
// Then takes magnitude from abs average of both sides of 'C'.
// Length converts gradient reversal to 0, smoothly to non-reversal at 1, shaped, then adding horz and vert terms.
AF1 dc=lD-lC;
AF1 cb=lC-lB;
AF1 lenX=max(abs(dc),abs(cb));
lenX=ARcpF1(lenX);
AF1 dirX=lD-lB;
lenX=ASatF1(abs(dirX)*lenX);
lenX*=lenX;
// Repeat for the y axis.
AF1 ec=lE-lC;
AF1 ca=lC-lA;
AF1 lenY=max(abs(ec),abs(ca));
lenY=ARcpF1(lenY);
AF1 dirY=lE-lA;
lenY=ASatF1(abs(dirY)*lenY);
AF1 len = lenY * lenY + lenX;
AF2 dir = AF2(dirX, dirY);
//------------------------------------------------------------------------------------------------------------------------------
AF2 dir2=dir*dir;
AF1 dirR=dir2.x+dir2.y;
if (dirR<AF1_(1.0/64.0)) {
pix = sC;
#ifdef FILAMENT_SPLIT_EASU
gl_FragDepth = 0.0;
#endif
return;
}
#ifdef FILAMENT_SPLIT_EASU
gl_FragDepth = 1.0;
#else
dirR=rsqrt(dirR);
dir*=AF2_(dirR);
len=len*AF1_(0.5);
len*=len;
AF1 stretch=(dir.x*dir.x+dir.y*dir.y)*rcp(max(abs(dir.x),abs(dir.y)));
AF2 len2=AF2(AF1_(1.0)+(stretch-AF1_(1.0))*len,AF1_(1.0)+AF1_(-0.5)*len);
AF1 lob=AF1_(0.5)+AF1_((1.0/4.0-0.04)-0.5)*len;
AF1 clp=rcp(lob);
//------------------------------------------------------------------------------------------------------------------------------
highp AF2 fp=floor(pp);
pp-=fp;
AF2 ppp=AF2(pp);
highp AF2 p0=fp*(con1.xy)+(con1.zw);
highp AF2 p1=p0+(con2.xy);
highp AF2 p2=p0+(con2.zw);
highp AF2 p3=p0+(con3.xy);
p0.y-=con1.w; p3.y+=con1.w;
AF4 fgcbR=FsrEasuRF(p0);
AF4 fgcbG=FsrEasuGF(p0);
AF4 fgcbB=FsrEasuBF(p0);
AF4 ijfeR=FsrEasuRF(p1);
AF4 ijfeG=FsrEasuGF(p1);
AF4 ijfeB=FsrEasuBF(p1);
AF4 klhgR=FsrEasuRF(p2);
AF4 klhgG=FsrEasuGF(p2);
AF4 klhgB=FsrEasuBF(p2);
AF4 nokjR=FsrEasuRF(p3);
AF4 nokjG=FsrEasuGF(p3);
AF4 nokjB=FsrEasuBF(p3);
//------------------------------------------------------------------------------------------------------------------------------
// This part is different for FP16, working pairs of taps at a time.
#ifdef FILAMENT_FSR_DERINGING
AF3 min4=min(AMin3F3(AF3(ijfeR.z,ijfeG.z,ijfeB.z),AF3(klhgR.w,klhgG.w,klhgB.w),AF3(ijfeR.y,ijfeG.y,ijfeB.y)),
AF3(klhgR.x,klhgG.x,klhgB.x));
AF3 max4=max(AMax3F3(AF3(ijfeR.z,ijfeG.z,ijfeB.z),AF3(klhgR.w,klhgG.w,klhgB.w),AF3(ijfeR.y,ijfeG.y,ijfeB.y)),
AF3(klhgR.x,klhgG.x,klhgB.x));
#endif
AF2 pR=AF2_(0.0);
AF2 pG=AF2_(0.0);
AF2 pB=AF2_(0.0);
AF2 pW=AF2_(0.0);
FsrEasuTapF2(pR,pG,pB,pW,AF2( 1.0, 0.0)-ppp.xx,AF2(-1.0,-1.0)-ppp.yy,dir,len2,lob,clp,fgcbR.zw,fgcbG.zw,fgcbB.zw);
FsrEasuTapF2(pR,pG,pB,pW,AF2(-1.0, 0.0)-ppp.xx,AF2( 1.0, 1.0)-ppp.yy,dir,len2,lob,clp,ijfeR.xy,ijfeG.xy,ijfeB.xy);
FsrEasuTapF2(pR,pG,pB,pW,AF2( 0.0,-1.0)-ppp.xx,AF2( 0.0, 0.0)-ppp.yy,dir,len2,lob,clp,ijfeR.zw,ijfeG.zw,ijfeB.zw);
FsrEasuTapF2(pR,pG,pB,pW,AF2( 1.0, 2.0)-ppp.xx,AF2( 1.0, 1.0)-ppp.yy,dir,len2,lob,clp,klhgR.xy,klhgG.xy,klhgB.xy);
FsrEasuTapF2(pR,pG,pB,pW,AF2( 2.0, 1.0)-ppp.xx,AF2( 0.0, 0.0)-ppp.yy,dir,len2,lob,clp,klhgR.zw,klhgG.zw,klhgB.zw);
FsrEasuTapF2(pR,pG,pB,pW,AF2( 0.0, 1.0)-ppp.xx,AF2( 2.0, 2.0)-ppp.yy,dir,len2,lob,clp,nokjR.xy,nokjG.xy,nokjB.xy);
AF3 aC=AF3(pR.x+pR.y,pG.x+pG.y,pB.x+pB.y);
AF1 aW=pW.x+pW.y;
//------------------------------------------------------------------------------------------------------------------------------
#ifdef FILAMENT_FSR_DERINGING
pix=min(max4,max(min4,aC*AF3_(ARcpF1(aW))));
#else
pix=aC*AF3_(ARcpF1(aW));
#endif
#endif // FILAMENT_SPLIT_EASU
}
| F# | 5 | N500/filament | filament/src/materials/fsr/ffx_fsr1_mobile.fs | [
"Apache-2.0"
] |
(
SynthDef(\plaits,
{|bus, freq = 220, dur=1, pan=0, harm=0.5, timbre=0.5, morph=0.5, engine=7, atk=0.2, sus=0.3, mul=1.0|
var env = EnvGen.ar(Env.linen(atk, 1-atk-sus, sus, 1, -3), timeScale:dur, doneAction:0);
var sound = MiPlaits.ar(pitch: freq.cpsmidi, engine: engine, harm: harm, timbre: timbre, morph: morph, mul: mul, trigger: 1, lpg_colour: 0.1);
ReplaceOut.ar(bus, Pan2.ar(sound[0], pan, env));
}).add;
SynthDef.new(\globalReverb, {
|bus, drywet = 0.000001, damp = 0.000001|
var sound = In.ar(bus, 2);
var verb = MiVerb.ar(sound, drywet: drywet, damp: damp);
ReplaceOut.ar(bus, verb);
}).add;
/*
SynthDef.new(\lpf, {
|bus, cutoff=0.5, res=0.5, drive=0.3|
var osc;
osc = In.ar(bus, 2);
osc = MiRipples.ar(osc, cutoff, res, drive);
ReplaceOut.ar(bus, osc);
}).add;
SynthDef.new(\globalChorus, {
|bus, bright=0.0, pos=0.0|
var sound = In.ar(bus, 2);
var chorus = MiRings.ar(in: sound, bright: bright, pos: pos, damp: 0.1, poly: 1, model: 1, easteregg: 1);
ReplaceOut.ar(bus, chorus);
}).add;
*/
) | SuperCollider | 4 | pjagielski/punkt | src/main/resources/punkt-misynths.scd | [
"Apache-2.0"
] |
// use noise() to build surface, use move() for movement
// set perspective
rotate 270, 0,1,0
move -20,1,0
//move map(TIME%1000, 0,1000, 0,5),0,0
DECAY: 0.05
move 0,wave(200)*2,wave(50)*10
particle 1
stroke 1
// whole set of x*y block is a single particle
for x: -5 to 5 step 2
for y: -5 to 5 step 2
push
// now its: forth, top, left
z_pos: map(noise(x,y), 0,1, -5,5)
x_pos: map(noise(x*2,y*2), 0,1, -5,5)
y_pos: map(noise(x*4,y*4), 0,1, -5,5)
move x_pos,z_pos,y_pos
box wave(100) * map(noise(x,y), 0,1, 0.5,1)
pop
end
end
end
| Cycript | 4 | marcinbiegun/creativecoding-sketches | Cyril/data/code_experiments/7.cy | [
"MIT"
] |
input Params {
app_id: ID!
key_hash: String!
}
| GraphQL | 3 | fuelingtheweb/prettier | tests/graphql_object_type_def/input.graphql | [
"MIT"
] |
var exec = require("child_process").exec;
var COMMAND = "{{escapeBackslashes command}}{{#if task}} {{escapeBackslashes task}}{{/if}}{{#if args}} {{{escapeBackslashes args}}}{{/if}}";
var MSG_CHECKING = "\n\x1B[1;33m \\_°< \x1B[0m\x1B[1m I'm checking your code, please wait...\x1B[0m";
var MSG_OK = "\r\x1B[1;32m \\_^> \x1B[0m\x1B[1m Everything is ok, good job! \x1B[0m\n";
var MSG_ERROR = "\x1B[1;31m \\_×< \x1B[0m\x1B[1m Oops, there is something wrong!\n";
process.stdout.write(MSG_CHECKING);
exec(COMMAND, {
cwd: "{{escapeBackslashes gruntfileDirectory}}"
}, function (err, stdout, stderr) {
var exitCode = 0;
if (err) {
process.stdout.write("\r \r");
console.log(stdout);
console.log(MSG_ERROR);
exitCode = -1;
} else {
console.log(MSG_OK);
}
{{#unless preventExit}}
process.exit(exitCode);
{{/unless}}
});
| Harbour | 3 | Rincelent/PhotonUI | test/githook-template.js.hb | [
"BSD-3-Clause"
] |
/*
* TODO(antoyo): support #[inline] attributes.
* TODO(antoyo): support LTO.
*
* TODO(antoyo): remove the patches.
*/
#![feature(rustc_private, decl_macro, associated_type_bounds, never_type, trusted_len)]
#![allow(broken_intra_doc_links)]
#![recursion_limit="256"]
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
extern crate rustc_ast;
extern crate rustc_codegen_ssa;
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_metadata;
extern crate rustc_middle;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_symbol_mangling;
extern crate rustc_target;
// This prevents duplicating functions and statics that are already part of the host rustc process.
#[allow(unused_extern_crates)]
extern crate rustc_driver;
mod abi;
mod allocator;
mod archive;
mod asm;
mod back;
mod base;
mod builder;
mod callee;
mod common;
mod consts;
mod context;
mod coverageinfo;
mod debuginfo;
mod declare;
mod intrinsic;
mod mono_item;
mod type_;
mod type_of;
use std::any::Any;
use std::sync::Arc;
use gccjit::{Context, OptimizationLevel};
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
use rustc_codegen_ssa::base::codegen_crate;
use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, ModuleConfig, TargetMachineFactoryFn};
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
use rustc_codegen_ssa::target_features::supported_target_features;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{ErrorReported, Handler};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{Lto, OptLevel, OutputFilenames};
use rustc_session::Session;
use rustc_span::Symbol;
use rustc_span::fatal_error::FatalError;
pub struct PrintOnPanic<F: Fn() -> String>(pub F);
impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
fn drop(&mut self) {
if ::std::thread::panicking() {
println!("{}", (self.0)());
}
}
}
#[derive(Clone)]
pub struct GccCodegenBackend;
impl CodegenBackend for GccCodegenBackend {
fn init(&self, sess: &Session) {
if sess.lto() != Lto::No {
sess.warn("LTO is not supported. You may get a linker error.");
}
}
fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>, metadata: EncodedMetadata, need_metadata_module: bool) -> Box<dyn Any> {
let target_cpu = target_cpu(tcx.sess);
let res = codegen_crate(self.clone(), tcx, target_cpu.to_string(), metadata, need_metadata_module);
rustc_symbol_mangling::test::report_symbol_names(tcx);
Box::new(res)
}
fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
let (codegen_results, work_products) = ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
.join(sess);
Ok((codegen_results, work_products))
}
fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) -> Result<(), ErrorReported> {
use rustc_codegen_ssa::back::link::link_binary;
link_binary::<crate::archive::ArArchiveBuilder<'_>>(
sess,
&codegen_results,
outputs,
)
}
fn target_features(&self, sess: &Session) -> Vec<Symbol> {
target_features(sess)
}
}
impl ExtraBackendMethods for GccCodegenBackend {
fn new_metadata<'tcx>(&self, _tcx: TyCtxt<'tcx>, _mod_name: &str) -> Self::Module {
GccContext {
context: Context::default(),
}
}
fn codegen_allocator<'tcx>(&self, tcx: TyCtxt<'tcx>, mods: &mut Self::Module, module_name: &str, kind: AllocatorKind, has_alloc_error_handler: bool) {
unsafe { allocator::codegen(tcx, mods, module_name, kind, has_alloc_error_handler) }
}
fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (ModuleCodegen<Self::Module>, u64) {
base::compile_codegen_unit(tcx, cgu_name)
}
fn target_machine_factory(&self, _sess: &Session, _opt_level: OptLevel) -> TargetMachineFactoryFn<Self> {
// TODO(antoyo): set opt level.
Arc::new(|_| {
Ok(())
})
}
fn target_cpu<'b>(&self, _sess: &'b Session) -> &'b str {
unimplemented!();
}
fn tune_cpu<'b>(&self, _sess: &'b Session) -> Option<&'b str> {
None
// TODO(antoyo)
}
}
pub struct ModuleBuffer;
impl ModuleBufferMethods for ModuleBuffer {
fn data(&self) -> &[u8] {
unimplemented!();
}
}
pub struct ThinBuffer;
impl ThinBufferMethods for ThinBuffer {
fn data(&self) -> &[u8] {
unimplemented!();
}
}
pub struct GccContext {
context: Context<'static>,
}
unsafe impl Send for GccContext {}
// FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "-Zno-parallel-llvm". Try to disable it here.
unsafe impl Sync for GccContext {}
impl WriteBackendMethods for GccCodegenBackend {
type Module = GccContext;
type TargetMachine = ();
type ModuleBuffer = ModuleBuffer;
type Context = ();
type ThinData = ();
type ThinBuffer = ThinBuffer;
fn run_fat_lto(_cgcx: &CodegenContext<Self>, mut modules: Vec<FatLTOInput<Self>>, _cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>) -> Result<LtoModuleCodegen<Self>, FatalError> {
// TODO(antoyo): implement LTO by sending -flto to libgccjit and adding the appropriate gcc linker plugins.
// NOTE: implemented elsewhere.
// TODO: what is implemented elsewhere ^ ?
let module =
match modules.remove(0) {
FatLTOInput::InMemory(module) => module,
FatLTOInput::Serialized { .. } => {
unimplemented!();
}
};
Ok(LtoModuleCodegen::Fat { module: Some(module), _serialized_bitcode: vec![] })
}
fn run_thin_lto(_cgcx: &CodegenContext<Self>, _modules: Vec<(String, Self::ThinBuffer)>, _cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError> {
unimplemented!();
}
fn print_pass_timings(&self) {
unimplemented!();
}
unsafe fn optimize(_cgcx: &CodegenContext<Self>, _diag_handler: &Handler, module: &ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<(), FatalError> {
module.module_llvm.context.set_optimization_level(to_gcc_opt_level(config.opt_level));
Ok(())
}
unsafe fn optimize_thin(_cgcx: &CodegenContext<Self>, _thin: &mut ThinModule<Self>) -> Result<ModuleCodegen<Self::Module>, FatalError> {
unimplemented!();
}
unsafe fn codegen(cgcx: &CodegenContext<Self>, diag_handler: &Handler, module: ModuleCodegen<Self::Module>, config: &ModuleConfig) -> Result<CompiledModule, FatalError> {
back::write::codegen(cgcx, diag_handler, module, config)
}
fn prepare_thin(_module: ModuleCodegen<Self::Module>) -> (String, Self::ThinBuffer) {
unimplemented!();
}
fn serialize_module(_module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer) {
unimplemented!();
}
fn run_lto_pass_manager(_cgcx: &CodegenContext<Self>, _module: &ModuleCodegen<Self::Module>, _config: &ModuleConfig, _thin: bool) -> Result<(), FatalError> {
// TODO(antoyo)
Ok(())
}
fn run_link(cgcx: &CodegenContext<Self>, diag_handler: &Handler, modules: Vec<ModuleCodegen<Self::Module>>) -> Result<ModuleCodegen<Self::Module>, FatalError> {
back::write::link(cgcx, diag_handler, modules)
}
}
/// This is the entrypoint for a hot plugged rustc_codegen_gccjit
#[no_mangle]
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
Box::new(GccCodegenBackend)
}
fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
match optlevel {
None => OptimizationLevel::None,
Some(level) => {
match level {
OptLevel::No => OptimizationLevel::None,
OptLevel::Less => OptimizationLevel::Limited,
OptLevel::Default => OptimizationLevel::Standard,
OptLevel::Aggressive => OptimizationLevel::Aggressive,
OptLevel::Size | OptLevel::SizeMin => OptimizationLevel::Limited,
}
},
}
}
fn handle_native(name: &str) -> &str {
if name != "native" {
return name;
}
unimplemented!();
}
pub fn target_cpu(sess: &Session) -> &str {
let name = sess.opts.cg.target_cpu.as_ref().unwrap_or(&sess.target.cpu);
handle_native(name)
}
pub fn target_features(sess: &Session) -> Vec<Symbol> {
supported_target_features(sess)
.iter()
.filter_map(
|&(feature, gate)| {
if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None }
},
)
.filter(|_feature| {
// TODO(antoyo): implement a way to get enabled feature in libgccjit.
false
})
.map(|feature| Symbol::intern(feature))
.collect()
}
| Rust | 4 | rizalgowandy/rust | compiler/rustc_codegen_gcc/src/lib.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
import React from 'react';
import { Trans, useTranslation } from 'react-i18next';
import emmaImg from '../../../assets/images/landing/Emma.png';
import sarahImg from '../../../assets/images/landing/Sarah.png';
import shawnImg from '../../../assets/images/landing/Shawn.png';
import { ImageLoader } from '../../helpers';
const Testimonials = (): JSX.Element => {
const { t } = useTranslation();
return (
<div className='testimonials'>
<h1 className='big-heading text-center'>
{t('landing.testimonials.heading')}
</h1>
<div className='testimonials-row' data-test-label='testimonial-cards'>
<div className='testimonial-card'>
<div className='testimonial-card-header'>
<ImageLoader
alt='Shawn Wang'
className='testimonial-image'
src={shawnImg}
/>
</div>
<div className='testimonials-footer'>
<div className='testimonial-meta'>
<p>
{' '}
<Trans>landing.testimonials.shawn.location</Trans>
</p>
<p>
<Trans>landing.testimonials.shawn.occupation</Trans>
</p>
</div>
<div className='testimony'>
<p>
<Trans>landing.testimonials.shawn.testimony</Trans>
</p>
</div>
</div>
</div>
<div className='testimonial-card'>
<div className='testimonial-card-header'>
<ImageLoader
alt='Sarah Chima'
className='testimonial-image'
src={sarahImg}
/>
</div>
<div className='testimonials-footer'>
<div className='testimonial-meta'>
<p>
{' '}
<Trans>landing.testimonials.sarah.location</Trans>
</p>
<p>
<Trans>landing.testimonials.sarah.occupation</Trans>
</p>
</div>
<div className='testimony'>
<p>
<Trans>landing.testimonials.sarah.testimony</Trans>
</p>
</div>
</div>
</div>
<div className='testimonial-card'>
<div className='testimonial-card-header'>
<ImageLoader
alt='Emma Bostian'
className='testimonial-image'
src={emmaImg}
/>
</div>
<div className='testimonials-footer'>
<div className='testimonial-meta'>
<p>
{' '}
<Trans>landing.testimonials.emma.location</Trans>
</p>
<p>
<Trans>landing.testimonials.emma.occupation</Trans>
</p>
</div>
<div className='testimony'>
<p>
<Trans>landing.testimonials.emma.testimony</Trans>
</p>
</div>
</div>
</div>
</div>
</div>
);
};
Testimonials.displayName = 'Testimonals';
export default Testimonials;
| TypeScript | 3 | fcastillo-serempre/freeCodeCamp | client/src/components/landing/components/testimonials.tsx | [
"BSD-3-Clause"
] |
(defmodule unit-mkr-tests
(behaviour ltest-unit)
(export all)
(import
(from mkr
(call/fresh 1)
(conj 2)
(disj 2)
(= 2))
(from ltest
(check-failed-assert 2)
(check-wrong-assert-exception 2))))
(include-lib "ltest/include/ltest-macros.lfe")
(include-lib "mkr/include/mkr-bool.lfe")
(define (empty-state) (: mkr-user empty-state)) ;; DRY
(deftest call/fresh-simple-goal
(is-equal '((((#(0) . 5)). 1))
(funcall (call/fresh (lambda(q) (= q 5)))
(empty-state))))
(deftest call/fresh-complex-goal
(flet ((a-and-b ()
(conj (call/fresh (lambda(a) (= a 7)))
(call/fresh (lambda(b) (disj (= b 5)
(= b 6)))))))
(is-equal '((((#(1) . 5) (#(0) . 7)) . 2)
(((#(1) . 6) (#(0) . 7)) . 2))
(funcall (a-and-b) (empty-state)))))
(deftest conj-fails-unless-all-goals-succeed
(is-equal '()
(funcall (call/fresh
(lambda(q) (conj (= 2 q) (= 1 q))))
(empty-state))))
(deftest conj-succeeds-if-all-goals-succeed
(is-equal '((((#(0) . 1)). 1))
(funcall (call/fresh
(lambda(q) (conj (= 1 q) (= 1 q))))
(empty-state))))
(deftest disj-fails-if-all-goals-fail
(is-equal '()
(funcall (call/fresh
(lambda(q) (disj (= 1 2) (= 'a 'b))))
(empty-state))))
(deftest disj-succeeds-if-any-goals-succeed
(is-equal '( (() . 1)
(((#(0) . a)). 1)
)
(funcall (call/fresh
(lambda(q) (disj (= 1 1) (= 'a q))))
(empty-state))))
(deftest andd-returns-last-non-falsey-value
(is-equal 'a (andd 'true 'b 'a)))
(deftest andd-treats-the-empty-list-as-TRUE
(is-equal 'c (andd '() 'b 'c)))
(deftest orr-returns-first-non-false-value
(is-equal '() (orr 'false 'false '() '() 'a 'b)))
(deftest orr-returns-false-on-all-falsey-values
(is-equal 'false (orr 'false)))
| LFE | 4 | pzel/mkr | test/unit-mkr-tests.lfe | [
"MIT"
] |
Import trans.system
Function MonkeyType$( ty$ )
#rem
typedef unsigned long GLenum;
typedef boolean GLboolean;
typedef unsigned long GLbitfield;
typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */
typedef short GLshort;
typedef long GLint;
typedef long GLsizei;
typedef long long GLintptr;
typedef long long GLsizeiptr;
typedef unsigned byte GLubyte; /* 'unsigned byte' should be an unsigned 8 bit type. */
typedef unsigned short GLushort;
typedef unsigned long GLuint;
typedef float GLfloat;
typedef float GLclampf;
#end
Select ty
Case "void"
Return ":void"
Case "GLenum","GLbitfield",
"GLbyte","GLshort","GLint","GLsizei",
"GLintptr","GLsizeiptr",
"GLubyte","GLushort","GLuint"
Return ""
Case "GLboolean"
Return "?"
Case "DOMString"
Return "$"
Case "GLfloat","GLclampf"
Return "#"
Case "int[]","long[]"
Return "[]"
Case "float[]"
Return "#[]"
Default
Return ":"+ty
End
End
Function Main()
ChangeDir "../../"
Local src:=LoadString( "webgl.txt" )
src=src.Replace( "[ ]","[]" )
Local lines:=src.Split( "~n" )
Local protos:=New StringStack
Local pline$
protos.Push ""
For Local line:=EachIn lines
line=line.Trim()
If Not line Continue
If line.EndsWith( "," )
pline+=line
Continue
Endif
line=pline+line
pline=""
If line.StartsWith( "/*" )
protos.Push "~t'"+line
Continue
Endif
If line.StartsWith( "const GLenum " )
'eg: const GLenum DEPTH_BUFFER_BIT = 0x00000100;
Local i=line.Find( "=" )
If i=-1 Error "ERR"
line=line[13..i].Trim()
Local proto:="~tField "+line
If line.EndsWith( "_" ) proto+="=~q"+line[..-1]+"~q"
protos.Push proto
Continue
Endif
Local i=line.Find( " " )
If i<>-1
Local ty:=line[..i]
line=line[i+1..].Trim()
i=line.Find( "(" )
If i=-1 Error "ERR:"+line
Local id:=line[..i]
line=line[i+1..].Trim()
i=line.Find( ")" )
If i=-1 Error "ERR"
line=line[..i].Trim()
Local argp$,err
If line.Length
Local args:=line.Split( "," )
For Local arg:=Eachin args
arg=arg.Trim()
Local i=arg.Find( " " )
If i=-1 i=0
Local ty:=arg[..i]
Local id:=arg[i+1..]
If argp argp+=","
argp+=id+MonkeyType( ty )
Next
Endif
Local proto$="~tMethod "+id+MonkeyType(ty)+"("+argp+")"
If err proto="'"+proto
protos.Push proto
Continue
Endif
protos.Push "'~t"+line
Next
protos.Push ""
Local wgl$=LoadString( "webgl.monkey" )
Local i=wgl.Find( "'*****[WebGLRenderingContext]*****" )
If i=-1 Error "ERR"
i=wgl.Find( "~n",i )
If i=-1 Error "ERR"
wgl=wgl[..i]+protos.Join( "~n" )+"End~n"
SaveString wgl,"webgl.monkey"
End
| Monkey | 4 | blitz-research/monkey | modules/dom/mkwebgl.monkey | [
"Zlib"
] |
syntax = "proto3";
package tensorflow;
message ProfilerServiceMonitorResult {
// Represents the different types of responses from the profiling service.
enum ResponseType {
// No result is returned from the profiling service.
EMPTY_RESULT = 0;
// Only device utilization is available.
UTIL_ONLY = 1;
// Both device utilization and device idle time are available.
UTIL_IDLE = 2;
// Device utilization, device idle time, step time, and infeed percentage
// are all available.
UTIL_IDLE_STEP = 3;
}
// Type of profiling responses.
ResponseType response_type = 1;
// Percentage of time when device is idle.
double device_idle_time_percent = 2;
// TPU matrix unit utilization percentage.
double matrix_unit_utilization_percent = 3;
// Average step time in millisecond.
double step_time_ms_avg = 4;
// Minimum step time in millisecond.
double step_time_ms_min = 5;
// Maximum step time in millisecond.
double step_time_ms_max = 6;
// Average infeed percentage.
double infeed_percent_avg = 7;
// Minimum infeed percentage.
double infeed_percent_min = 8;
// Maximum infeed percentage.
double infeed_percent_max = 9;
// next-field: 10
}
| Protocol Buffer | 4 | yage99/tensorflow | tensorflow/core/profiler/profiler_service_monitor_result.proto | [
"Apache-2.0"
] |
#tag Class
Class NSPoint
#tag Method, Flags = &h0
Sub Constructor()
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Constructor(x as Double, y as Double)
self.x = x
self.y = y
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Operator_Convert(other as NSPoint32)
self.Constructor(other.x,other.y)
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Operator_Convert(other as NSPoint64)
self.Constructor(other.x,other.y)
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Function Value32() As NSPoint32
dim result as NSPoint32
result.x = self.x
result.y = self.y
Return result
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function Value64() As NSPoint64
dim result as NSPoint64
result.x = self.x
result.y = self.y
Return result
End Function
#tag EndMethod
#tag Property, Flags = &h0
x As Double
#tag EndProperty
#tag Property, Flags = &h0
y As Double
#tag EndProperty
#tag ViewBehavior
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="x"
Visible=false
Group="Behavior"
InitialValue=""
Type="Double"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="y"
Visible=false
Group="Behavior"
InitialValue=""
Type="Double"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 3 | jkleroy/Xojo-iOS-HTML2PDF | Extras/iOSKit/Foundation/NSPoint.xojo_code | [
"Unlicense"
] |
The [[http://www.globalreporting.org/Home|Global Reporting Initiative (GRI)]] is a widely used sustainability reporting framework which sets out the principles and indicators that organizations can use to measure and report their economic, environmental, and social performance. AMEE provides an excellent level of support for GRI compliance.
Emissions related reporting requirements are documented in the [[http://www.globalreporting.org/NR/rdonlyres/D2BC0DF8-FF2C-4BAB-B2B4-27DA868C2A5F/2800/smallG3_IP_EN_ENG_andcov.pdf|'Environment']] category of the Indicator Protocols Set. GRI recommends that reporters use the methodologies of the [[http://www.ghgprotocol.org/|Greenhouse Gas Protocol (GHGP)]] and/or the [[http://www.ipcc-nggip.iges.or.jp/public/2006gl/index.html|Intergovernmental Panel on Climate Change (IPCC)]] to calculate greenhouse gas emissions. AMEE supports the IPCC-NGGIP and the GHGP recommended datasets (which, in many cases, ultimately derives from the IPCC), with new data being added on a continual basis.
To discover data and calculation methodologies which can provide support for the GRI see the following pages:
* [[IPCC|IPCC-NGGIP]]
* [[Greenhouse_Gas_Protocol|Greenhouse Gas protocol]]
| Creole | 0 | OpenAMEE/datasets | documentation/Global_Reporting_Initiative/documentation.creole | [
"MIT"
] |
describe("Numeric limits should be defined",||
shortMin := SHRT_MIN
shortMax := SHRT_MAX
unsignedShortMax := USHRT_MAX
intMin := INT_MIN
intMax := INT_MAX
unsignedIntMax := UINT_MAX
longMin := LONG_MIN
longMax := LONG_MAX
unsignedLongMax := ULONG_MAX
longLongMin := LLONG_MIN
longLongMax := LLONG_MAX
unsignedLongLongMax := ULLONG_MAX
floatMin := FLT_MIN
floatMax := FLT_MAX
doubleMin := DBL_MIN
doubleMax := DBL_MAX
longDoubleMin := LDBL_MIN
longDoubleMax := LDBL_MAX
infinity := INFINITY
notANumber := NAN
)
| ooc | 3 | shamanas/rock | test/sdk/lang/limits.ooc | [
"MIT"
] |
; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s
define i128 @shl(i128 %r, i128 %s) nounwind readnone {
; CHECK-LABEL: shl:
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
; CHECK: lsr [[LO_FOR_HI_NORMAL:x[0-9]+]], x0, [[REV_SHIFT]]
; CHECK: cmp x2, #0
; CHECK: csel [[LO_FOR_HI:x[0-9]+]], xzr, [[LO_FOR_HI_NORMAL]], eq
; CHECK: lsl [[HI_FOR_HI:x[0-9]+]], x1, x2
; CHECK: orr [[HI_NORMAL:x[0-9]+]], [[LO_FOR_HI]], [[HI_FOR_HI]]
; CHECK: lsl [[HI_BIG_SHIFT:x[0-9]+]], x0, x2
; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
; CHECK: cmp [[EXTRA_SHIFT]], #0
; CHECK: csel x1, [[HI_BIG_SHIFT]], [[HI_NORMAL]], ge
; CHECK: csel x0, xzr, [[HI_BIG_SHIFT]], ge
; CHECK: ret
%shl = shl i128 %r, %s
ret i128 %shl
}
define i128 @ashr(i128 %r, i128 %s) nounwind readnone {
; CHECK-LABEL: ashr:
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
; CHECK: cmp x2, #0
; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
; CHECK: asr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
; CHECK: cmp [[EXTRA_SHIFT]], #0
; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
; CHECK: asr [[BIGSHIFT_HI:x[0-9]+]], x1, #63
; CHECK: csel x1, [[BIGSHIFT_HI]], [[LO_BIG_SHIFT]], ge
; CHECK: ret
%shr = ashr i128 %r, %s
ret i128 %shr
}
define i128 @lshr(i128 %r, i128 %s) nounwind readnone {
; CHECK-LABEL: lshr:
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
; CHECK: cmp x2, #0
; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
; CHECK: lsr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
; CHECK: cmp [[EXTRA_SHIFT]], #0
; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
; CHECK: csel x1, xzr, [[LO_BIG_SHIFT]], ge
; CHECK: ret
%shr = lshr i128 %r, %s
ret i128 %shr
}
| LLVM | 4 | medismailben/llvm-project | llvm/test/CodeGen/AArch64/arm64-long-shift.ll | [
"Apache-2.0"
] |
using Uno;
using Uno.Compiler;
using Uno.Collections;
using Uno.UX;
namespace Fuse
{
public abstract class AppBase : Uno.Application
{
[UXPrimary]
/** The @Node.Children of the virtual root @Node of the @App.
Note that the virtual root node might be different from the @RootViewport depending
on platform. */
public abstract IList<Node> Children
{
get;
}
[UXContent]
/** The @Node.Resources of the virtual root node of the @App.
Note that the virtual root node might be different from the @RootViewport depending
on platform */
public IList<Resource> Resources { get { return new List<Resource>(); } }
}
[IgnoreMainClass]
public abstract class App : AppBase
{
public override IList<Node> Children { get { return new List<Node>(); } }
public static new App Current
{
get { return Uno.Application.Current as App; }
}
protected virtual void OnDraw() {}
protected virtual void OnUpdate() {}
}
}
| Uno | 5 | mortend/fuse-studio | Source/CodeCompletion/Outracks.CodeCompletion.UXNinja.TestsCommon/TestData/App.uno | [
"MIT"
] |
--TEST--
Bug #79242 (COM error constants don't match com_exception codes)
--EXTENSIONS--
com_dotnet
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
?>
--FILE--
<?php
var_dump(
DISP_E_DIVBYZERO,
DISP_E_OVERFLOW,
DISP_E_BADINDEX,
MK_E_UNAVAILABLE
);
?>
--EXPECT--
int(-2147352558)
int(-2147352566)
int(-2147352565)
int(-2147221021)
| PHP | 4 | NathanFreeman/php-src | ext/com_dotnet/tests/bug79242.phpt | [
"PHP-3.01"
] |
grammar Grammar;
main : ;
| ANTLR | 0 | jcs-PR/omnisharp-roslyn | test-assets/test-projects/AntlrGeneratedFiles/Grammar.g4 | [
"MIT"
] |
%{
#include <stdio.h>
Expression* lastExp = 0;
#define YYERROR_VERBOSE 1
/* dump Expression stack during parsing? */
#define DEBUG_EXP 0
int yylex();
char *yytext;
void yyerror(const char *e) {
//if(DEBUG_EXP) fprintf(stderr, "%s at token \"%s\"\n", e, yytext);
if(DEBUG_EXP) fprintf(stderr, "%s\n", e);
errMsg = e;
// be extra paranoid about deletion
if(lastExp && dynamic_cast<Expression*>(lastExp))
delete lastExp;
lastExp = 0;
}
%}
%union {
int val;
char *equate;
CARTDEBUG_INT_METHOD cartMethod;
CPUDEBUG_INT_METHOD cpuMethod;
TIADEBUG_INT_METHOD tiaMethod;
Expression *exp;
char *function;
}
/* Terminals */
%token <val> NUMBER
%token <val> ERR
%token <equate> EQUATE
%token <cartMethod> CART_METHOD
%token <cpuMethod> CPU_METHOD
%token <tiaMethod> TIA_METHOD
%token <function> FUNCTION
/* Non-terminals */
%type <exp> expression
/* Operator associativity and precedence */
%left '-' '+'
%left '*' '/' '%'
%left LOG_OR
%left LOG_AND
%left LOG_NOT
%left '|' '^'
%left '&'
%left SHR SHL
%nonassoc '<' '>' GTE LTE NE EQ
%nonassoc DEREF
%nonassoc UMINUS
%nonassoc '['
%%
statement: expression { if(DEBUG_EXP) fprintf(stderr, "\ndone\n"); result.exp = $1; }
;
expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$ = new PlusExpression($1, $3); lastExp = $$; }
| expression '-' expression { if(DEBUG_EXP) fprintf(stderr, " -"); $$ = new MinusExpression($1, $3); lastExp = $$; }
| expression '*' expression { if(DEBUG_EXP) fprintf(stderr, " *"); $$ = new MultExpression($1, $3); lastExp = $$; }
| expression '/' expression { if(DEBUG_EXP) fprintf(stderr, " /"); $$ = new DivExpression($1, $3); lastExp = $$; }
| expression '%' expression { if(DEBUG_EXP) fprintf(stderr, " %%"); $$ = new ModExpression($1, $3); lastExp = $$; }
| expression '&' expression { if(DEBUG_EXP) fprintf(stderr, " &"); $$ = new BinAndExpression($1, $3); lastExp = $$; }
| expression '|' expression { if(DEBUG_EXP) fprintf(stderr, " |"); $$ = new BinOrExpression($1, $3); lastExp = $$; }
| expression '^' expression { if(DEBUG_EXP) fprintf(stderr, " ^"); $$ = new BinXorExpression($1, $3); lastExp = $$; }
| expression '<' expression { if(DEBUG_EXP) fprintf(stderr, " <"); $$ = new LessExpression($1, $3); lastExp = $$; }
| expression '>' expression { if(DEBUG_EXP) fprintf(stderr, " >"); $$ = new GreaterExpression($1, $3); lastExp = $$; }
| expression GTE expression { if(DEBUG_EXP) fprintf(stderr, " >="); $$ = new GreaterEqualsExpression($1, $3); lastExp = $$; }
| expression LTE expression { if(DEBUG_EXP) fprintf(stderr, " <="); $$ = new LessEqualsExpression($1, $3); lastExp = $$; }
| expression NE expression { if(DEBUG_EXP) fprintf(stderr, " !="); $$ = new NotEqualsExpression($1, $3); lastExp = $$; }
| expression EQ expression { if(DEBUG_EXP) fprintf(stderr, " =="); $$ = new EqualsExpression($1, $3); lastExp = $$; }
| expression SHR expression { if(DEBUG_EXP) fprintf(stderr, " >>"); $$ = new ShiftRightExpression($1, $3); lastExp = $$; }
| expression SHL expression { if(DEBUG_EXP) fprintf(stderr, " <<"); $$ = new ShiftLeftExpression($1, $3); lastExp = $$; }
| expression LOG_OR expression { if(DEBUG_EXP) fprintf(stderr, " ||"); $$ = new LogOrExpression($1, $3); lastExp = $$; }
| expression LOG_AND expression { if(DEBUG_EXP) fprintf(stderr, " &&"); $$ = new LogAndExpression($1, $3); lastExp = $$; }
| '-' expression %prec UMINUS { if(DEBUG_EXP) fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); lastExp = $$; }
| '~' expression %prec UMINUS { if(DEBUG_EXP) fprintf(stderr, " ~"); $$ = new BinNotExpression($2); lastExp = $$; }
| '!' expression %prec UMINUS { if(DEBUG_EXP) fprintf(stderr, " !"); $$ = new LogNotExpression($2); lastExp = $$; }
| '*' expression %prec DEREF { if(DEBUG_EXP) fprintf(stderr, " U*"); $$ = new ByteDerefExpression($2); lastExp = $$; }
| '@' expression %prec DEREF { if(DEBUG_EXP) fprintf(stderr, " U@"); $$ = new WordDerefExpression($2); lastExp = $$; }
| '<' expression { if(DEBUG_EXP) fprintf(stderr, " U<"); $$ = new LoByteExpression($2); lastExp = $$; }
| '>' expression { if(DEBUG_EXP) fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; }
| '(' expression ')' { if(DEBUG_EXP) fprintf(stderr, " ()"); $$ = $2; lastExp = $$; }
| expression '[' expression ']' { if(DEBUG_EXP) fprintf(stderr, " []"); $$ = new ByteDerefOffsetExpression($1, $3); lastExp = $$; }
| NUMBER { if(DEBUG_EXP) fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); lastExp = $$; }
| EQUATE { if(DEBUG_EXP) fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; }
| CPU_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; }
| CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; }
| TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; }
| FUNCTION { if(DEBUG_EXP) fprintf(stderr, " (function)"); $$ = new FunctionExpression($1); lastExp = $$; }
| ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; }
;
%%
| Yacc | 3 | MatPoliquin/retro | retro/cores/atari2600/stella/src/yacc/stella.y | [
"MIT-0",
"MIT"
] |
data testing;
begin=0;
end=10;
msg="This is row %x of %y";
do i = begin to end by 1;
drop msg begin end i;
recnum=i;
label=tranwrd(tranwrd(msg,"%x",i),"%y",end);
output;
end;
run;
libname out '/home/tika/testing/sas';
libname outxpt XPORT '/home/tika/testing/sas/testing.xpt';
libname outv6 v6 '/home/tika/testing/sas';
libname outxml xmlv2 '/home/tika/testing/sas';
data out.testing;
set testing;
run;
data outv6.testv6;
set testing;
run;
data outxml.testxml;
set testing;
run;
proc copy in=out out=outxpt;
select testing;
run;
proc print data=testing;
run;
| SAS | 3 | dedabob/tika | tika-parsers/src/test/resources/test-documents/testSAS.sas | [
"Apache-2.0"
] |
#include <ATen/ATen.h>
#include <ATen/AccumulateType.h>
#include <ATen/native/Resize.h>
#include <c10/cuda/CUDAStream.h>
#include <c10/cuda/CUDAException.h>
namespace at {
namespace native {
namespace {
constexpr int MULTIMARGIN_THREADS = 128;
template <int P, typename scalar_t>
__global__ void MultiMarginLoss_forward_kernel(
scalar_t *output, scalar_t *input, int64_t *target, scalar_t *weights,
int nframe, int dim, bool sizeAverage, scalar_t margin) {
using acc_t = at::acc_type<scalar_t, true>;
__shared__ acc_t buffer[MULTIMARGIN_THREADS];
int k = blockIdx.x;
scalar_t *input_k = input + k*dim;
scalar_t *output_k = output + k;
int target_k = static_cast<int>(target[k]);
scalar_t input_target_k = input_k[target_k];
int i_start = threadIdx.x;
int i_end = dim;
int i_step = blockDim.x;
buffer[threadIdx.x] = 0;
for (int i = i_start; i < i_end; i += i_step) {
scalar_t z = margin - input_target_k + input_k[i];
if (i == target_k) {
continue;
}
if (z > 0) {
scalar_t h = (P==1) ? z : z*z;
if (weights) {
h *= weights[target_k];
}
buffer[threadIdx.x] += h;
}
}
__syncthreads();
// reduce
if (threadIdx.x == 0) {
acc_t sum = 0;
for (int i=0; i < blockDim.x; i++)
sum += buffer[i];
const int denom = sizeAverage ? nframe * dim : dim;
*output_k = static_cast<scalar_t>(sum / denom);
}
}
template <int P, typename scalar_t>
__global__ void MultiMarginLoss_backward_kernel(
scalar_t *gradInput, scalar_t *gradOutput, scalar_t *input, int64_t *target,
scalar_t *weights, int nframe, int dim, bool sizeAverage, scalar_t margin,
bool reduce) {
using acc_t = at::acc_type<scalar_t, true>;
__shared__ acc_t buffer[MULTIMARGIN_THREADS];
int k = blockIdx.x;
scalar_t *input_k = input + k*dim;
scalar_t *gradInput_k = gradInput + k*dim;
int target_k = static_cast<int>(target[k]);
scalar_t input_target_k = input_k[target_k];
scalar_t *gradOutput_k = gradOutput;
if (!reduce) {
gradOutput_k += k;
}
const int denom = sizeAverage && reduce ? nframe * dim : dim;
const acc_t g = acc_t(1) / static_cast<acc_t>(denom);
int i_start = threadIdx.x;
int i_end = dim;
int i_step = blockDim.x;
buffer[threadIdx.x] = 0;
for (int i=i_start; i<i_end; i+=i_step) {
scalar_t z = margin - input_target_k + input_k[i];
if (i == target_k) {
continue;
}
if (z > 0) {
acc_t h = (P == 1) ? g : 2*g*z;
if (weights) {
h *= weights[target_k];
}
buffer[threadIdx.x] -= static_cast<scalar_t>(h);
gradInput_k[i] = static_cast<scalar_t>(h);
} else {
gradInput_k[i] = static_cast<scalar_t>(0);
}
}
__syncthreads();
// reduce
if (threadIdx.x == 0) {
acc_t gradInput_target_k = 0;
for (int i=0; i<blockDim.x; i++) {
gradInput_target_k += buffer[i];
}
gradInput_k[target_k] = static_cast<scalar_t>(gradInput_target_k);
}
for (int i=i_start; i<i_end; i+= i_step) {
gradInput_k[i] *= * gradOutput_k;
}
}
void multi_margin_loss_shape_check(
const Tensor &input, const Tensor &target) {
auto in_sizes = input.sizes();
auto dims = in_sizes.size();
TORCH_CHECK(
(dims == 2 && in_sizes[1] != 0) || (dims == 1 && in_sizes[0] != 0) || dims == 0,
"Expected non-empty vector or matrix with optional 0-dim batch size, but got: ",
in_sizes);
int64_t nframe = dims <= 1 ? 1 : in_sizes[0];
TORCH_CHECK(
target.dim() <= 1 && target.numel() == nframe,
"inconsistent target size, expected ", nframe, " but got ",
target.sizes());
}
} // namespace (anonymous)
Tensor& multi_margin_loss_cuda_out(
const Tensor &input_, const Tensor &target_, const Scalar &p_, const Scalar &margin_,
const c10::optional<Tensor> &weights_, int64_t reduction, Tensor& out_) {
auto p = p_.toLong();
TORCH_CHECK(p == 1 || p == 2, "multi_margin_loss: Invalid p, expected 1 or 2 but got ", p);
multi_margin_loss_shape_check(input_, target_);
if (reduction == at::Reduction::None) {
resize_output(out_, target_.sizes());
} else if (input_.dim() == 2) {
resize_output(out_, {input_.sizes()[0]});
} else {
resize_output(out_, {});
}
if (input_.numel() == 0) {
return out_;
}
auto input = input_.contiguous();
auto target = target_.contiguous();
Tensor weights;
if (weights_ && weights_->defined()) {
weights = weights_->contiguous();
}
auto out = (out_.is_contiguous() ? out_ :
at::empty(out_.sizes(), input.options()));
const auto stream = c10::cuda::getCurrentCUDAStream();
AT_DISPATCH_FLOATING_TYPES_AND2(kHalf, kBFloat16, input.scalar_type(), "multi_margin_loss_cuda", [&] {
const scalar_t margin = margin_.to<scalar_t>();
if (input.dim() <= 1) {
int nframe = 1;
TORCH_CHECK(target.dim() <= 1 && target.numel() == nframe, "inconsistent target size");
dim3 blocks(1);
dim3 threads(MULTIMARGIN_THREADS);
if (p == 1) {
MultiMarginLoss_forward_kernel<1> <<<blocks, threads, 0, stream>>>(
out.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
1,
input.dim() < 1 ? input.numel() : input.sizes()[0],
reduction == at::Reduction::Mean,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else if (p == 2) {
MultiMarginLoss_forward_kernel<2> <<<blocks, threads, 0, stream>>>(
out.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
1,
input.dim() < 1 ? input.numel() : input.sizes()[0],
reduction == at::Reduction::Mean,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
} else {
auto in_sizes = input.sizes();
TORCH_INTERNAL_ASSERT(in_sizes.size() == 2);
int nframe = in_sizes[0];
// allow zero-dim target for 2D input.
TORCH_CHECK(in_sizes[1] != 0 && target.dim() <= 1 && target.numel() == nframe,
"inconsistent target size");
dim3 blocks(nframe);
dim3 threads(MULTIMARGIN_THREADS);
if (reduction == at::Reduction::None) {
if (p == 1) {
MultiMarginLoss_forward_kernel<1> <<<blocks, threads, 0, stream>>>(
out.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
false,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else if (p == 2) {
MultiMarginLoss_forward_kernel<2> <<<blocks, threads, 0, stream>>>(
out.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
false,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
} else {
auto tmp_output = at::empty({nframe}, input.options());
if (p == 1) {
MultiMarginLoss_forward_kernel<1> <<<blocks, threads, 0, stream>>>(
tmp_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
reduction == Reduction::Mean,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else if (p == 2) {
MultiMarginLoss_forward_kernel<2> <<<blocks, threads, 0, stream>>>(
tmp_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
reduction == Reduction::Mean,
margin);
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
at::sum_out(out, tmp_output, /*dims=*/IntArrayRef{});
}
}
});
if (!out.is_alias_of(out_)) {
out_.copy_(out);
}
return out_;
}
Tensor multi_margin_loss_cuda(
const Tensor &input, const Tensor &target, const Scalar &p, const Scalar &margin,
const c10::optional<Tensor> &weights, int64_t reduction) {
auto out = at::empty({}, input.options());
multi_margin_loss_cuda_out(input, target, p, margin, weights, reduction, out);
return out;
}
Tensor& multi_margin_loss_cuda_backward_out(
const Tensor &grad_output_,const Tensor &input_, const Tensor &target_,
const Scalar &p_, const Scalar &margin_, const c10::optional<Tensor> &weights_,
int64_t reduction, Tensor &grad_input_) {
auto p = p_.toLong();
TORCH_CHECK(p == 1 || p == 2,
"multi_margin_loss_backward: Invalid p, expected 1 or 2 but got ", p);
multi_margin_loss_shape_check(input_, target_);
resize_output(grad_input_, input_.sizes());
if (input_.numel() == 0) {
return grad_input_;
}
auto input = input_.contiguous();
auto grad_input = (grad_input_.is_contiguous() ? grad_input_ :
at::empty(grad_input_.sizes(), input.options()));
auto grad_output = grad_output_.contiguous();
auto target = target_.contiguous();
Tensor weights;
if (weights_ && weights_->defined()) {
weights = weights_->contiguous();
}
const auto stream = c10::cuda::getCurrentCUDAStream();
AT_DISPATCH_FLOATING_TYPES_AND2(kHalf, kBFloat16, input.scalar_type(),
"multi_margin_loss_backward_cuda", [&] {
const scalar_t margin = margin_.to<scalar_t>();
if (input.dim() <= 1) {
dim3 blocks(1);
dim3 threads(MULTIMARGIN_THREADS);
if (p == 1) {
MultiMarginLoss_backward_kernel<1> <<<blocks, threads, 0, stream>>>(
grad_input.data_ptr<scalar_t>(),
grad_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
1,
input.dim() == 0 ? 1 : input.sizes()[0],
reduction == at::Reduction::Mean,
margin,
reduction != at::Reduction::None);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else if (p == 2) {
MultiMarginLoss_backward_kernel<2> <<<blocks, threads, 0, stream>>>(
grad_input.data_ptr<scalar_t>(),
grad_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
1,
input.dim() == 0 ? 1 : input.sizes()[0],
reduction == at::Reduction::Mean,
margin,
reduction != at::Reduction::None);
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
} else {
auto in_sizes = input.sizes();
TORCH_INTERNAL_ASSERT(in_sizes.size() == 2);
int nframe = in_sizes[0];
TORCH_CHECK((in_sizes[1] != 0) && (target.dim() <= 1) && (target.numel() == nframe),
"inconsistent target size");
dim3 blocks(in_sizes[0]);
dim3 threads(MULTIMARGIN_THREADS);
if (p == 1) {
MultiMarginLoss_backward_kernel<1> <<<blocks, threads, 0, stream>>>(
grad_input.data_ptr<scalar_t>(),
grad_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
reduction == at::Reduction::Mean,
margin,
reduction != at::Reduction::None);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else if (p == 2) {
MultiMarginLoss_backward_kernel<2> <<<blocks, threads, 0, stream>>>(
grad_input.data_ptr<scalar_t>(),
grad_output.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
target.data_ptr<int64_t>(),
weights.defined() ? weights.data_ptr<scalar_t>() : nullptr,
nframe, in_sizes[1],
reduction == at::Reduction::Mean,
margin,
reduction != at::Reduction::None);
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
}
});
if (!grad_input.is_alias_of(grad_input_)) {
grad_input_.copy_(grad_input);
}
return grad_input_;
}
Tensor multi_margin_loss_cuda_backward(
const Tensor &grad_output, const Tensor &input, const Tensor &target,
const Scalar &p, const Scalar &margin, const c10::optional<Tensor> &weights,
int64_t reduction) {
auto grad_input = at::empty({}, input.options());
multi_margin_loss_cuda_backward_out(
grad_output, input, target, p, margin, weights, reduction, grad_input);
return grad_input;
}
}} // namespace at::native
| Cuda | 5 | Hacky-DH/pytorch | aten/src/ATen/native/cuda/MultiMarginLoss.cu | [
"Intel"
] |
<!-- #docregion binding -->
<p>Emoji from FlowerService: {{flower.emoji}}</p>
<p>Emoji from AnimalService: {{animal.emoji}}</p>
<!-- #enddocregion binding -->
| HTML | 3 | coreyscherbing/angular | aio/content/examples/providers-viewproviders/src/app/inspector/inspector.component.html | [
"MIT"
] |
#pragma TextEncoding="UTF-8"
#pragma rtGlobals=1
#pragma ModuleName = SIDAMFourierSym
#include "SIDAM_Display"
#include "SIDAM_PeakPos"
#include "SIDAM_Utilities_Bias"
#include "SIDAM_Utilities_Control"
#include "SIDAM_Utilities_Help"
#include "SIDAM_Utilities_Image"
#include "SIDAM_Utilities_Panel"
#include "SIDAM_Utilities_WaveDf"
#ifndef SIDAMshowProc
#pragma hide = 1
#endif
//@
// Symmetrize Fourier transform based on symmetry.
//
// ## Parameters
// w : wave
// The input wave, 2D or 3D.
// q1w : wave
// The first peak, {qx, qy, a}.
// The (qx, qy) is the peak position in pixel.
// The a is the "ideal" real-space length corresponding to the peak.
// q2w : wave
// The second peak, specified in the same manner as the `q1w`.
// sym : int {1 -- 5}
// The symmetry.
// 1. 2mm
// 2. 3
// 3. 3m
// 4. 4
// 5. 4mm
// shear : int {0 or 1}, default 0
// The shear direction.
// * 0: x
// * 1: y
// endeffect : int {0 -- 3}, default 2
// How to handle the ends of the wave.
// * 0: Bounce. Uses `w[i]` in place of the missing `w[-i]` and `w[n-i]` in place of the missing `w[n+i]`.
// * 1: Wrap. Uses `w[n-i]` in place of the missing `w[-i]` and vice-versa.
// * 2: Zero (default). Uses 0 for any missing value.
// * 3: Repeat. Uses `w[0]` in place of the missing `w[-i]` and `w[n]` in place of the missing `w[n+i]`.
//
// ## Returns
// wave
// Symmetrized wave.
//@
Function/WAVE SIDAMFourierSym(Wave w, Wave q1w, Wave q2w, int sym,
[int shear, int endeffect])
STRUCT paramStruct s
Wave/Z s.w = w
Wave/Z s.q1w = q1w
Wave/Z s.q2w = q2w
s.sym = sym
s.shear = ParamIsDefault(shear) ? 0 : shear
s.endeffect = ParamIsDefault(endeffect) ? 2 : endeffect
if (validate(s))
print s.errMsg
return $""
endif
return symmetrize(w, q1w, q2w, sym, s.shear, s.endeffect)
End
Static Function validate(STRUCT paramStruct &s)
s.errMsg = PRESTR_CAUTION + "SIDAMFourierSym gave error: "
int flag = SIDAMValidateWaveforFFT(s.w)
if (flag)
s.errMsg += SIDAMValidateWaveforFFTMsg(flag)
return 0
endif
if (!WaveExists(s.q1w) || !WaveExists(s.q2w))
s.errMsg += "wave not found."
return 1
endif
if (s.sym < 1 || s.sym > 5)
s.errMsg += "the parameter of symmetry must be from 1 to 5."
return 1
endif
s.shear = s.shear ? 1 : 0
s.endeffect = limit(s.endeffect, 0, 3)
End
Static Structure paramStruct
String errMsg
Wave w
Wave q1w
Wave q2w
uchar sym
uchar shear
uchar endeffect
EndStructure
Static Function/S echoStr(Wave w, Wave q1w, Wave q2w, int sym,
int shear, int endeffect, String result)
String paramStr = GetWavesDataFolder(w,2)
paramStr += "," + SelectString(WaveType(q1w,2)==2, \
GetWavesDataFolder(q1w,2), SIDAMWaveToString(q1w, noquote=1))
paramStr += "," + SelectString(WaveType(q2w,2)==2, \
GetWavesDataFolder(q2w,2), SIDAMWaveToString(q2w, noquote=1))
paramStr += "," + num2str(sym)
paramStr += SelectString(shear, "", ",shear=1")
paramStr += SelectString(endeffect==2, ",endeffect="+num2str(endeffect), "")
Sprintf paramStr, "Duplicate/O SIDAMFourierSym(%s), %s%s"\
, paramStr, GetWavesDataFolder(w,1), PossiblyQuoteName(result)
return paramStr
End
// Wave q1w, q2w {qx, qy, a}
// int sym 1: 2mm, 2: 3, 3: 3m, 4: 4, 5: 4mm
// int shear 0: x, 1: y
// int endeffect 0: bounce, 1: wrap, 2: zero
Static Function/WAVE symmetrize(Wave w, Wave q1w, Wave q2w, int sym,
int shear, int endeffect)
Variable nx = DimSize(w,0), ny = DimSize(w,1), nz = DimSize(w,2)
Variable ox = DimOffset(w,0), oy = DimOffset(w,1)
Variable dx = DimDelta(w,0), dy = DimDelta(w,1)
Variable q1x = ox + dx * q1w[0], q1y = oy + dy *q1w[1]
Variable q2x = ox + dx * q2w[0], q2y = oy + dy *q2w[1]
// transformation matrix
Wave mw = calcMatrix(w, q1w, q2w, sym, shear)
Variable m1 = mw[0], m2 = mw[1], m3 = mw[2]
// Change the wave scaling for expansion in the x and y directions
Duplicate/FREE w tw
SetScale/P x -dx*(nx/2-1)*m1, dx*m1, "", tw
SetScale/P y -dy*ny/2*m3, dy*m3, "", tw
// Extended wave
Wave ew = SIDAMEndEffect(tw, endeffect)
// Shear correction
Make/N=(nx,ny,nz)/FREE w0
CopyScales tw, w0
Variable m = shear ? m2/m1 : m2/m3
if (shear)
MultiThread w0 = sym_interpolation(ew, x, -m*x+y, r)
else
MultiThread w0 = sym_interpolation(ew, x-m*y, y, r)
endif
// Extended wave after the shear correction
Wave ew0 = SIDAMEndEffect(w0, endeffect)
if (endeffect == 2)
Make/N=(nx*3, ny*3, nz)/FREE enw0
CopyScales ew0, enw0
MultiThread enw0[nx,2*nx-1][ny,2*ny-1][] = 1 // center-middle
endif
// Make rotated waves
switch (sym)
case 2: // 3
case 3: // 3m
Wave w1 = sym_rotation(ew0, pi/3)
Wave w2 = sym_rotation(ew0, pi/3*2)
if (endeffect == 2)
Wave nw1 = sym_rotation(enw0, pi/3)
Wave nw2 = sym_rotation(enw0, pi/3*2)
endif
break
case 4: // 4
case 5: // 4mm
Wave w1 = sym_rotation(ew0, pi/2)
if (endeffect == 2)
Wave nw1 = sym_rotation(enw0, pi/2)
endif
break
endswitch
// Make mirrored waves
if (sym == 1 || sym == 3 || sym ==5)
Variable theta = shear ? atan((m2*q1x+m3*q1y)/(m1*q1x)) : atan((m3*q1y)/(m1*q1x+m2*q1y))
switch (sym)
case 1: // 2mm
Wave w1 = sym_mirror(ew0, 2*theta)
if (endeffect == 2)
Wave nw1 = sym_mirror(enw0, 2*theta)
endif
break
case 3: // 3m
Wave w3 = sym_mirror(ew0, 2*theta)
Wave w4 = sym_mirror(ew0, 2*(theta-pi/3))
Wave w5 = sym_mirror(ew0, 2*(theta-pi/3*2))
if (endeffect == 2)
Wave nw3 = sym_mirror(enw0, 2*theta)
Wave nw4 = sym_mirror(enw0, 2*(theta-pi/3))
Wave nw5 = sym_mirror(enw0, 2*(theta-pi/3*2))
endif
break
case 5: // 4mm
Wave w2 = sym_mirror(ew0, 2*theta)
Wave w3 = sym_mirror(ew0, 2*(theta-pi/4))
if (endeffect == 2)
Wave nw2 = sym_mirror(enw0, 2*theta)
Wave nw3 = sym_mirror(enw0, 2*(theta-pi/4))
endif
break
endswitch
endif
// symmetrize
switch (sym)
case 1: // 2mm
if (endeffect == 2)
FastOP w0 = w0 + w1
FastOP nw1 = 1 + nw1
FastOP w0 = w0 / nw1
else
FastOP w0 = 0.5*w0 + 0.5*w1
endif
break
case 2: // 3
if (endeffect == 2)
FastOP w0 = w0 + w1 + w2
FastOP nw1 = 1 + nw1 + nw2
FastOP w0 = w0 / nw1
else
FastOP w0 = (1/3)*w0 + (1/3)*w1 + (1/3)*w2
endif
break
case 3: // 3m
FastOP w0 = w0 + w1 + w2
FastOP w0 = w0 + w3 + w4
if (endeffect == 2)
FastOP w0 = w0 + w5
FastOP nw1 = 1 + nw1 + nw2
FastOP nw1 = nw1 + nw3 + nw4
FastOP nw1 = nw1 + nw5
FastOP w0 = w0 / nw1
else
FastOP w0 = (1/6)*w0 + (1/6)*w5
endif
break
case 4: // 4
if (endeffect == 2)
FastOP w0 = w0 + w1
FastOP nw1 = 1 + nw1
FastOP w0 = w0 / nw1
else
FastOP w0 = 0.5*w0 + 0.5*w1
endif
break
case 5: // 4mm
FastOP w0 = w0 + w1 + w2
if (endeffect == 2)
FastOP w0 = w0 + w3
FastOP nw1 = 1 + nw1 + nw2
FastOP nw1 = nw1 + nw3
FastOP w0 = w0 / nw1
else
FastOP w0 = 0.25*w0 + 0.25*w3
endif
break
endswitch
String noteStr
Sprintf noteStr, "%s;m1:%.4f;m2:%.4e;m3:%.4f;q1w:%s;q2w:%s;sym:%d;shear:%d;endeffect:%d;", note(w), m1, m2, m3, SIDAMWaveToString(q1w,noquote=1), SIDAMWaveToString(q2w,noquote=1),sym,shear,endeffect
Note w0, noteStr
SIDAMCopyBias(w, w0)
return w0
End
Static Function/WAVE calcMatrix(w, q1w, q2w, sym, shear)
Wave w, q1w, q2w
Variable sym, shear
Variable q1x = DimOffset(w,0) + DimDelta(w,0) * q1w[0], q1y = DimOffset(w,1) + DimDelta(w,1) *q1w[1]
Variable q2x = DimOffset(w,0) + DimDelta(w,0) * q2w[0], q2y = DimOffset(w,1) + DimDelta(w,1) *q2w[1]
Variable lx = q1w[2]^-2, ly = q2w[2]^-2, lz = 1 / (q1w[2] * q2w[2])
switch (sym)
case 1: // 2mm
lz *= cos(pi/2)
break
case 2: // 3
case 3: // 3mm
lz *= q1x*q2x + q1y*q2y > 0 ? cos(pi/3) : cos(2*pi/3)
break
case 4: // 4
case 5: // 4mm
lz *= cos(pi/2)
break
endswitch
Variable N = (q1x*q2y - q1y*q2x)^2
Variable A = (q2y^2*lx + q1y^2*ly - 2*q1y*q2y*lz ) / N
Variable B = -(q2x*q2y*lx + q1x*q1y*ly - (q1x*q2y+q1y*q2x)*lz) / N
Variable C = (q2x^2*lx + q1x^2*ly - 2*q1x*q2x*lz) / N
Make/D/N=3/FREE resw
resw[0] = shear ? sqrt(A-B^2/C) : sqrt(A)
resw[1] = shear ? B/sqrt(C) : B/sqrt(A)
resw[2] = shear ? sqrt(C) : sqrt(C-B^2/A)
return resw
End
ThreadSafe Static Function/WAVE sym_rotation(Wave ew, Variable theta)
Wave resw = sym_reduce(ew)
Variable vc = cos(theta), vs = sin(theta)
MultiThread resw = sym_interpolation(ew, x*vc-y*vs, x*vs+y*vc, r)
return resw
End
ThreadSafe Static Function/WAVE sym_mirror(Wave ew, Variable theta)
Wave resw = sym_reduce(ew)
Variable vc = cos(theta), vs = sin(theta)
MultiThread resw = sym_interpolation(ew, x*vc+y*vs, x*vs-y*vc, r)
return resw
End
// Input an extended wave and return an empty wave size of
// which is the same as the original before extension
ThreadSafe Static Function/WAVE sym_reduce(Wave ew)
Make/N=(DimSize(ew,0)/3, DimSize(ew,1)/3, DimSize(ew,2))/FREE redw
SetScale/P x DimOffset(ew,0)+DimDelta(ew,0)*DimSize(ew,0)/3, DimDelta(ew,0),"", redw
SetScale/P y DimOffset(ew,1)+DimDelta(ew,1)*DimSize(ew,1)/3, DimDelta(ew,1),"", redw
SetScale/P z DimOffset(ew,2), DimDelta(ew,2),"", redw
return redw
End
ThreadSafe Static Function sym_interpolation(Wave w, Variable kx,
Variable ky, Variable rr)
Variable ox = DimOffset(w,0), oy = DimOffset(w,1)
Variable dx = DimDelta(w,0), dy = DimDelta(w,1)
Variable p0 = floor((kx-ox)/dx), p1 = ceil((kx-ox)/dx)
Variable q0 = floor((ky-oy)/dy), q1 = ceil((ky-oy)/dy)
Variable x0 = ox + dx*p0, x1 = ox + dx*p1
Variable y0 = oy + dy*q0, y1 = oy + dy*q1
Variable xx = (x0 == x1) ? 0 : (x1-kx)/(x1-x0)
Variable yy = (y0 == y1) ? 0 : (y1-ky)/(y1-y0)
Variable c00 = xx * yy
Variable c01 = xx * (1 - yy)
Variable c10 = (1 - xx) * yy
Variable c11 = (1 - xx) * (1 - yy)
return w[p0][q0][rr]*c00+w[p0][q1][rr]*c01+w[p1][q0][rr]*c10+w[p1][q1][rr]*c11
End
//==============================================================================
Static Function menuDo()
pnl(SIDAMImageWaveRef(WinName(0,1)),WinName(0,1))
End
Static Function marqueeDo()
GetLastUserMenuInfo
String menuItem = S_value
Variable vec = str2num(menuItem[strlen(menuItem)-1])
// Get the peak position
String grfName = WinName(0,1)
Wave iw = SIDAMImageWaveRef(grfName)
Wave posw = SIDAMPeakPos(iw, 1) // asymmetric Lorentz2D
// Pass the position to the panel
Variable cp = (posw[2]-DimOffset(iw,0))/DimDelta(iw,0)
Variable cq = (posw[3]-DimOffset(iw,1))/DimDelta(iw,1)
String pnlName = GetUserData(grfName, "", KEY)
pnlPutNumbers(pnlName, vec, {cp,cq})
End
Static Function/S marqueeMenu()
String grfName = WinName(0,1,1)
if (!strlen(grfName))
return ""
endif
String pnlName = GetUserData(grfName, "", KEY)
if (!strlen(pnlName))
return ""
else
return "Get peak location for vector 1;Get peak location for vector 2"
endif
End
//==============================================================================
Static StrConstant SUFFIX = "_sym"
Static StrConstant KEY = "SIDAMFourierSymPnl"
Static Function pnl(Wave w, String grfName)
String pnlName = SIdAMNewPanel("Symmetrize FFT ("+NameOfWave(w)+")", 355, 250)
SetWindow $pnlName hook(self)=SIDAMFourierSym#pnlHook
SetWindow $pnlName userData(src)=GetWavesDataFolder(w,2)
Variable nx = DimSize(w,0), ny = DimSize(w,1)
SetVariable outputV title="output name", pos={8,9}, size={341,16}, bodyWidth=274, win=$pnlName
SetVariable outputV value= _STR:NameOfWave(w)+SUFFIX, proc=SIDAMFourierSym#pnlSetVar, win=$pnlName
PopupMenu symP title="symmetry", pos={21,39}, size={143,20}, bodyWidth=90, win=$pnlName
PopupMenu symP mode=1, value= "2mm;3;3m;4;4mm", proc=SIDAMFourierSym#pnlPopup, win=$pnlName
PopupMenu shearP title="shear", pos={196,39}, size={101,20}, bodyWidth=70, mode=1, value="x;y", win=$pnlName
PopupMenu endeffectP title="end effects", pos={13,70}, size={151,20}, bodyWidth=90, win=$pnlName
PopupMenu endeffectP mode=3, value= "bounce;wrap;zero;repeat", proc=SIDAMFourierSym#pnlPopup, win=$pnlName
GroupBox v1G title="vector 1", pos={6,102}, size={169,103}, win=$pnlName
SetVariable p1V title="p", pos={17,124}, value=_STR:num2str(nx/2-1), win=$pnlName
SetVariable q1V title="q", pos={17,150}, value= _STR:num2str(ny/2), win=$pnlName
SetVariable a1V title="a", pos={17,176}, value= _STR:"0", win=$pnlName
GroupBox v2G title="vector 2", pos={180,102}, size={169,103}, win=$pnlName
SetVariable p2V title="p", pos={191,124}, value= _STR:num2str(nx/2-1), win=$pnlName
SetVariable q2V title="q", pos={191,150}, value= _STR:num2str(ny/2), win=$pnlName
SetVariable a2V title="a", pos={191,176}, value= _STR:"0", win=$pnlName
Button doB title="Do It", pos={5,219}, size={60,20}, proc=SIDAMFourierSym#pnlButton, win=$pnlName
CheckBox displayC title="display", pos={75,222}, size={54,14}, value=1, win=$pnlName
PopupMenu toP title="To", pos={140,219}, size={50,20}, bodyWidth=50, win=$pnlName
PopupMenu toP value="Cmd Line;Clip", mode=0, proc=SIDAMFourierSym#pnlPopup, win=$pnlName
Button helpB title="Help", pos={220,219}, size={60,20}, proc=SIDAMFourierSym#pnlButton, win=$pnlName
Button cancelB title="Cancel", pos={290,219}, size={60,20}, proc=SIDAMFourierSym#pnlButton, win=$pnlName
String ctrlList = "p1V;q1V;a1V;p2V;q2V;a2V;"
ModifyControlList ctrlList size={150,16}, bodyWidth=140, proc=SIDAMFourierSym#pnlSetVar, win=$pnlName
ModifyControlList ctrlList valueColor=(SIDAM_CLR_EVAL_R,SIDAM_CLR_EVAL_G,SIDAM_CLR_EVAL_B), win=$pnlName
ModifyControlList ctrlList fColor=(SIDAM_CLR_EVAL_R,SIDAM_CLR_EVAL_G,SIDAM_CLR_EVAL_B), win=$pnlName
ModifyControlList ControlNameList(pnlName,";","*") focusRing=0, win=$pnlName
AutoPositionWindow/E/M=0/R=$grfName $pnlName
SetWindow $pnlName userData(parent)=grfName
SetWindow $grfName hook($KEY)=SIDAMFourierSym#pnlHookParent, userData($KEY)=pnlName
End
Static Function pnlHook(STRUCT WMWinHookStruct &s)
switch (s.eventCode)
case 2: // kill
SetWindow $GetUserData(s.winName,"","parent") hook($KEY)=$"", userData($KEY)=""
break
case 5: // mouseup
if (strlen(GetUserData(s.winName,"","parent")))
Variable v1Gsel = isGBClicked(s,"v1G")
Variable v2Gsel = isGBClicked(s,"v2G")
GroupBox v1G fstyle=v1Gsel, userData(selected)=num2str(v1Gsel), win=$s.winName
GroupBox v2G fstyle=v2Gsel, userData(selected)=num2str(v2Gsel), win=$s.winName
SetVariable p1V fstyle=v1Gsel, win=$s.winName
SetVariable q1V fstyle=v1Gsel, win=$s.winName
SetVariable p2V fstyle=v2Gsel, win=$s.winName
SetVariable q2V fstyle=v2Gsel, win=$s.winName
endif
break
case 11: // keyboard
if (s.keycode == 27) // esc
SetWindow $GetUserData(s.winName,"","parent") hook($KEY)=$"", userData($KEY)=""
KillWindow $s.winName
endif
break
endswitch
return 0
End
// A groupbox is clicked or not
Static Function isGBClicked(STRUCT WMWinHookStruct &s, String grpName)
ControlInfo/W=$s.winName $grpName
return (V_left < s.mouseLoc.h && s.mouseLoc.h < V_left + V_width && \
V_top < s.mouseLoc.v && s.mouseLoc.v < V_top + V_height)
End
Static Function pnlHookParent(STRUCT WMWinHookStruct &s)
switch (s.eventCode)
case 2: // killed
SetWindow $GetUserData(s.winName, "", KEY) userData(parent)=""
break
case 3: // mousedown
// Record the eventMod used at the event of mouseup
SetWindow $s.winName userData(eventMod)=num2istr(s.eventMod)
break
case 5: // mouseup
// The eventMode recorded at the event of mousedown
Variable eventMod = str2num(GetUserData(s.winName,"","eventMod"))
// If the click is left click, put the numbers to the item
// selected in the panel. This must be left click otherwise
// the marquee menu does not work well.
if (!(eventMod & 16))
String pnlName = GetUserData(s.winName, "", KEY)
STRUCT SIDAMMousePos ms
SIDAMGetMousePos(ms, s.winName, s.mouseLoc, grid=1)
if (str2num(GetUserData(pnlName,"v1G","selected")))
pnlPutNumbers(pnlName, 1, {ms.p,ms.q})
elseif (str2num(GetUserData(pnlName,"v2G","selected")))
pnlPutNumbers(pnlName, 2, {ms.p,ms.q})
endif
endif
// Delete the recorded eventMod
SetWindow $s.winName userData(eventMod)=""
break
endswitch
return 0
End
//-------------------------------------------------------------
// Controls
//-------------------------------------------------------------
// Setvariable
Static Function pnlSetVar(STRUCT WMSetVariableAction &s)
// Handle either mouse up, enter key, or end edit
if (s.eventCode != 1 && s.eventCode != 2 && s.eventCode != 8)
return 1
endif
Wave w = $GetUserData(s.win, "", "src")
strswitch (s.ctrlName)
case "outputV":
SIDAMValidateSetVariableString(s.win,s.ctrlName,0)
break
case "p1V":
case "q1V":
case "p2V":
case "q2V":
case "a1V":
case "a2V":
SIDAMValidateSetVariableString(s.win,s.ctrlName,1)
if (stringmatch(s.ctrlName, "a1V"))
ControlInfo/W=$s.win symP
if (V_Value != 1) // not 2mm
SetVariable a2V value=_STR:s.sval, win=$s.win
endif
endif
break
endswitch
String ctrlList = "outputV;p1V;q1V;p2V;q2V;a1V;a2V"
Variable i, disable = 0
for (i = 0; i < ItemsInList(ctrlList); i += 1)
if (strlen(GetUserData(s.win, StringFromList(i,ctrlList), "check")))
disable = 2
break
endif
endfor
PopupMenu toP disable=disable, win=$s.win
Button doB disable=disable, win=$s.win
End
// popup
Static Function pnlPopup(STRUCT WMPopupAction &s)
if (s.eventCode != 2)
return 1
endif
strswitch (s.ctrlName)
case "symP":
if (s.popNum == 1)
SetVariable a2V disable=0, win=$s.win
else
ControlInfo/W=$s.win a1V
SetVariable a2V value=_STR:S_Value, disable=2, win=$s.win
endif
break
case "toP":
Wave w = $GetUserData(s.win,"","src")
Wave cvw = SIDAMGetCtrlValues(s.win, "symP;shearP;endeffectP")
ControlInfo/W=$s.win outputV
String paramStr = echoStr(w,\
SIDAMGetCtrlTexts(s.win, "p1V;q1V;a1V"), \
SIDAMGetCtrlTexts(s.win, "p2V;q2V;a2V"), \
cvw[0], cvw[1]-1, cvw[2]-1, S_value)
SIDAMPopupTo(s, paramStr)
break
endswitch
End
// Button
Static Function pnlButton(STRUCT WMButtonAction &s)
if (s.eventCode != 2)
return 0
endif
strswitch (s.ctrlName)
case "doB":
Wave w = $GetUserData(s.win,"","src")
Wave cvw = SIDAMGetCtrlValues(s.win, "symP;shearP;endeffectP;displayC")
Wave q1w = SIDAMGetCtrlValues(s.win, "p1V;q1V;a1V")
Wave q2w = SIDAMGetCtrlValues(s.win, "p2V;q2V;a2V")
Wave/T q1tw = SIDAMGetCtrlTexts(s.win, "p1V;q1V;a1V")
Wave/T q2tw = SIDAMGetCtrlTexts(s.win, "p2V;q2V;a2V")
ControlInfo/W=$s.win outputV ; String result = S_Value
KillWindow $s.win
printf "%s%s\r", PRESTR_CMD, echoStr(w, q1tw, q2tw, \
cvw[0], cvw[1]-1, cvw[2]-1, result)
DFREF dfr = GetWavesDataFolderDFR(w)
Duplicate/O SIDAMFourierSym(w, q1w, q2w, cvw[0], shear=cvw[1]-1, \
endeffect=cvw[2]-1) dfr:$result/WAVE=resw
if (cvw[3])
SIDAMDisplay(resw, history=1)
endif
break
case "cancelB":
KillWindow $s.win
break
case "helpB":
SIDAMOpenHelpNote("symmetrization",s.win,"Fourier Symmetrization")
break
endswitch
End
Static Function pnlPutNumbers(String pnlName, int num, Wave nw)
switch (num)
case 1:
SetVariable p1V value=_STR:num2str(nw[0]), fstyle=0, win=$pnlName
SetVariable q1V value=_STR:num2str(nw[1]), fstyle=0, win=$pnlName
GroupBox v1G fstyle=0, userData(selected)="0", win=$pnlName
break
case 2:
SetVariable p2V value=_STR:num2str(nw[0]), fstyle=0, win=$pnlName
SetVariable q2V value=_STR:num2str(nw[1]), fstyle=0, win=$pnlName
GroupBox v2G fstyle=0, userData(selected)="0", win=$pnlName
break
endswitch
End
| IGOR Pro | 5 | yuksk/SIDAM | src/SIDAM/func/SIDAM_Fourier_Symmetrization.ipf | [
"MIT"
] |
fn test() {
let mut v: isize;
v = v + 1; //~ ERROR use of possibly-uninitialized variable: `v`
v.clone();
}
fn main() {
}
| Rust | 2 | Eric-Arellano/rust | src/test/ui/borrowck/borrowck-init-plus-equal.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/nw/src/api/object_manager_factory.h"
#include "content/nw/src/api/object_manager.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
namespace nw {
// static
ObjectManager* ObjectManagerFactory::GetForBrowserContext(
content::BrowserContext* context) {
return static_cast<ObjectManager*>(
GetInstance()->GetServiceForBrowserContext(context, true));
}
// static
ObjectManagerFactory* ObjectManagerFactory::GetInstance() {
return base::Singleton<ObjectManagerFactory>::get();
}
// static
KeyedService* ObjectManagerFactory::BuildServiceInstanceForTesting(
content::BrowserContext* context) {
return GetInstance()->BuildServiceInstanceFor(context);
}
ObjectManagerFactory::ObjectManagerFactory()
: BrowserContextKeyedServiceFactory(
"ObjectManager",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
}
ObjectManagerFactory::~ObjectManagerFactory() {}
KeyedService* ObjectManagerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new ObjectManager(context);
}
content::BrowserContext* ObjectManagerFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext(context);
}
bool ObjectManagerFactory::ServiceIsCreatedWithBrowserContext() const {
return true;
}
bool ObjectManagerFactory::ServiceIsNULLWhileTesting() const {
return true;
}
} // namespace nw
| C++ | 4 | namaljayathunga/nw.js | src/api/object_manager_factory.cc | [
"MIT"
] |
[{:type :query
:selections [{:type :field
:field-name :introspect
:args [{:arg-name :types
:arg-value {:type :array
:value [{:type :enum
:value :query}
{:type :enum
:value :mutation}
{:type :enum
:value :subscription}
{:type :enum
:value :other}]}}]}]}]
| edn | 4 | hagenek/lacinia | dev-resources/parser/enum-reserved.edn | [
"Apache-2.0"
] |
[Desktop Entry]
Name=PyInstaller Appimage Test
GenericName=PyInstaller Appimage Test
Comment=Simple AppImage test for code frozen with PyInstaller.
Exec=false
Icon=apptest
Type=Application
StartupNotify=false
Terminal=false
Categories=Office;
| desktop | 2 | hawkhai/pyinstaller | tests/functional/data/appimage/org.pyinstaller.appimage.test.desktop | [
"Apache-2.0"
] |
"""Describe logbook events."""
from homeassistant.components.logbook.const import (
LOGBOOK_ENTRY_ENTITY_ID,
LOGBOOK_ENTRY_MESSAGE,
LOGBOOK_ENTRY_NAME,
)
from homeassistant.core import callback
from .const import DOMAIN, EVENT_ALEXA_SMART_HOME
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def async_describe_logbook_event(event):
"""Describe a logbook event."""
data = event.data
if entity_id := data["request"].get("entity_id"):
state = hass.states.get(entity_id)
name = state.name if state else entity_id
message = f"sent command {data['request']['namespace']}/{data['request']['name']} for {name}"
else:
message = (
f"sent command {data['request']['namespace']}/{data['request']['name']}"
)
return {
LOGBOOK_ENTRY_NAME: "Amazon Alexa",
LOGBOOK_ENTRY_MESSAGE: message,
LOGBOOK_ENTRY_ENTITY_ID: entity_id,
}
async_describe_event(DOMAIN, EVENT_ALEXA_SMART_HOME, async_describe_logbook_event)
| Python | 4 | liangleslie/core | homeassistant/components/alexa/logbook.py | [
"Apache-2.0"
] |
Prefix(:=<http://example.org/>)
Ontology(:MainOntology
Import( <http://localhost:10000/child1.owl> )
Import( <http://localhost:10000/child2.owl> )
Declaration(Class(:main))
)
| Web Ontology Language | 3 | jmcmurry/SciGraph | SciGraph-core/src/test/resources/ontologies/import/main.owl | [
"Apache-2.0"
] |
## Licensed to Cloudera, Inc. under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. Cloudera, Inc. 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.
<%!
import sys
from desktop.views import commonheader, commonfooter
if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import ugettext as _
%>
<%namespace name="actionbar" file="actionbar.mako" />
<%namespace name="layout" file="about_layout.mako" />
%if not is_embeddable:
${ commonheader(_('Threads'), "about", user, request) | n,unicode }
%endif
<script type="text/javascript">
(function () {
var ThreadsViewModel = function () {
var self = this;
self.threads = ko.observable();
self.fetchThreads = function () {
window.simpleGet('/desktop/debug/threads', {}, {
successCallback: self.threads
});
};
};
$(document).ready(function () {
var viewModel = new ThreadsViewModel();
ko.applyBindings(viewModel, $('#threadsComponents')[0]);
});
})();
</script>
${layout.menubar(section='threads')}
<div id="threadsComponents" class="container-fluid">
<div class="card card-small" style="padding-top: 10px">
<pre data-bind="text: $root.threads"></pre>
</div>
</div>
%if not is_embeddable:
${ commonfooter(request, messages) | n,unicode }
%endif
| Mako | 4 | yetsun/hue | desktop/core/src/desktop/templates/threads.mako | [
"Apache-2.0"
] |
# Check the multiple slot add and remove commands
source "../tests/includes/init-tests.tcl"
proc cluster_allocate_with_continuous_slots_local {n} {
R 0 cluster ADDSLOTSRANGE 0 3276
R 1 cluster ADDSLOTSRANGE 3277 6552
R 2 cluster ADDSLOTSRANGE 6553 9828
R 3 cluster ADDSLOTSRANGE 9829 13104
R 4 cluster ADDSLOTSRANGE 13105 16383
}
proc cluster_create_with_continuous_slots_local {masters slaves} {
cluster_allocate_with_continuous_slots_local $masters
if {$slaves} {
cluster_allocate_slaves $masters $slaves
}
assert_cluster_state ok
}
test "Create a 5 nodes cluster" {
cluster_create_with_continuous_slots_local 5 5
}
test "Cluster should start ok" {
assert_cluster_state ok
}
set master1 [Rn 0]
set master2 [Rn 1]
set master3 [Rn 2]
set master4 [Rn 3]
set master5 [Rn 4]
test "Continuous slots distribution" {
assert_match "* 0-3276*" [$master1 CLUSTER NODES]
assert_match "* 3277-6552*" [$master2 CLUSTER NODES]
assert_match "* 6553-9828*" [$master3 CLUSTER NODES]
assert_match "* 9829-13104*" [$master4 CLUSTER NODES]
assert_match "* 13105-16383*" [$master5 CLUSTER NODES]
assert_match "*0 3276*" [$master1 CLUSTER SLOTS]
assert_match "*3277 6552*" [$master2 CLUSTER SLOTS]
assert_match "*6553 9828*" [$master3 CLUSTER SLOTS]
assert_match "*9829 13104*" [$master4 CLUSTER SLOTS]
assert_match "*13105 16383*" [$master5 CLUSTER SLOTS]
$master1 CLUSTER DELSLOTSRANGE 3001 3050
assert_match "* 0-3000 3051-3276*" [$master1 CLUSTER NODES]
assert_match "*0 3000*3051 3276*" [$master1 CLUSTER SLOTS]
$master2 CLUSTER DELSLOTSRANGE 5001 5500
assert_match "* 3277-5000 5501-6552*" [$master2 CLUSTER NODES]
assert_match "*3277 5000*5501 6552*" [$master2 CLUSTER SLOTS]
$master3 CLUSTER DELSLOTSRANGE 7001 7100 8001 8500
assert_match "* 6553-7000 7101-8000 8501-9828*" [$master3 CLUSTER NODES]
assert_match "*6553 7000*7101 8000*8501 9828*" [$master3 CLUSTER SLOTS]
$master4 CLUSTER DELSLOTSRANGE 11001 12000 12101 12200
assert_match "* 9829-11000 12001-12100 12201-13104*" [$master4 CLUSTER NODES]
assert_match "*9829 11000*12001 12100*12201 13104*" [$master4 CLUSTER SLOTS]
$master5 CLUSTER DELSLOTSRANGE 13501 14000 15001 16000
assert_match "* 13105-13500 14001-15000 16001-16383*" [$master5 CLUSTER NODES]
assert_match "*13105 13500*14001 15000*16001 16383*" [$master5 CLUSTER SLOTS]
}
test "ADDSLOTSRANGE command with several boundary conditions test suite" {
# Add multiple slots with incorrect argument number
assert_error "ERR wrong number of arguments for 'cluster|addslotsrange' command" {R 0 cluster ADDSLOTSRANGE 3001 3020 3030}
# Add multiple slots with invalid input slot
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTSRANGE 3001 3020 3030 aaa}
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTSRANGE 3001 3020 3030 70000}
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTSRANGE 3001 3020 -1000 3030}
# Add multiple slots when start slot number is greater than the end slot
assert_error "ERR start slot number 3030 is greater than end slot number 3025" {R 0 cluster ADDSLOTSRANGE 3001 3020 3030 3025}
# Add multiple slots with busy slot
assert_error "ERR Slot 3200 is already busy" {R 0 cluster ADDSLOTSRANGE 3001 3020 3200 3250}
# Add multiple slots with assigned multiple times
assert_error "ERR Slot 3001 specified multiple times" {R 0 cluster ADDSLOTSRANGE 3001 3020 3001 3020}
}
test "DELSLOTSRANGE command with several boundary conditions test suite" {
# Delete multiple slots with incorrect argument number
assert_error "ERR wrong number of arguments for 'cluster|delslotsrange' command" {R 0 cluster DELSLOTSRANGE 1000 2000 2100}
assert_match "* 0-3000 3051-3276*" [$master1 CLUSTER NODES]
assert_match "*0 3000*3051 3276*" [$master1 CLUSTER SLOTS]
# Delete multiple slots with invalid input slot
assert_error "ERR Invalid or out of range slot" {R 0 cluster DELSLOTSRANGE 1000 2000 2100 aaa}
assert_error "ERR Invalid or out of range slot" {R 0 cluster DELSLOTSRANGE 1000 2000 2100 70000}
assert_error "ERR Invalid or out of range slot" {R 0 cluster DELSLOTSRANGE 1000 2000 -2100 2200}
assert_match "* 0-3000 3051-3276*" [$master1 CLUSTER NODES]
assert_match "*0 3000*3051 3276*" [$master1 CLUSTER SLOTS]
# Delete multiple slots when start slot number is greater than the end slot
assert_error "ERR start slot number 5800 is greater than end slot number 5750" {R 1 cluster DELSLOTSRANGE 5600 5700 5800 5750}
assert_match "* 3277-5000 5501-6552*" [$master2 CLUSTER NODES]
assert_match "*3277 5000*5501 6552*" [$master2 CLUSTER SLOTS]
# Delete multiple slots with already unassigned
assert_error "ERR Slot 7001 is already unassigned" {R 2 cluster DELSLOTSRANGE 7001 7100 9000 9200}
assert_match "* 6553-7000 7101-8000 8501-9828*" [$master3 CLUSTER NODES]
assert_match "*6553 7000*7101 8000*8501 9828*" [$master3 CLUSTER SLOTS]
# Delete multiple slots with assigned multiple times
assert_error "ERR Slot 12500 specified multiple times" {R 3 cluster DELSLOTSRANGE 12500 12600 12500 12600}
assert_match "* 9829-11000 12001-12100 12201-13104*" [$master4 CLUSTER NODES]
assert_match "*9829 11000*12001 12100*12201 13104*" [$master4 CLUSTER SLOTS]
}
| Tcl | 5 | dawnwalk/redis | tests/cluster/tests/23-multiple-slot-operations.tcl | [
"BSD-3-Clause"
] |
"""Tests for the mobile_app HTTP API."""
from binascii import unhexlify
from http import HTTPStatus
import json
from unittest.mock import patch
import pytest
from homeassistant.components.mobile_app.const import CONF_SECRET, DOMAIN
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.setup import async_setup_component
from .const import REGISTER, REGISTER_CLEARTEXT, RENDER_TEMPLATE
from tests.common import mock_coro
async def test_registration(hass, hass_client, hass_admin_user):
"""Test that registrations happen."""
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
api_client = await hass_client()
with patch(
"homeassistant.components.person.async_add_user_device_tracker",
spec=True,
return_value=mock_coro(),
) as add_user_dev_track:
resp = await api_client.post(
"/api/mobile_app/registrations", json=REGISTER_CLEARTEXT
)
assert len(add_user_dev_track.mock_calls) == 1
assert add_user_dev_track.mock_calls[0][1][1] == hass_admin_user.id
assert add_user_dev_track.mock_calls[0][1][2] == "device_tracker.test_1"
assert resp.status == HTTPStatus.CREATED
register_json = await resp.json()
assert CONF_WEBHOOK_ID in register_json
assert CONF_SECRET in register_json
entries = hass.config_entries.async_entries(DOMAIN)
assert entries[0].unique_id == "io.homeassistant.mobile_app_test-mock-device-id"
assert entries[0].data["device_id"] == REGISTER_CLEARTEXT["device_id"]
assert entries[0].data["app_data"] == REGISTER_CLEARTEXT["app_data"]
assert entries[0].data["app_id"] == REGISTER_CLEARTEXT["app_id"]
assert entries[0].data["app_name"] == REGISTER_CLEARTEXT["app_name"]
assert entries[0].data["app_version"] == REGISTER_CLEARTEXT["app_version"]
assert entries[0].data["device_name"] == REGISTER_CLEARTEXT["device_name"]
assert entries[0].data["manufacturer"] == REGISTER_CLEARTEXT["manufacturer"]
assert entries[0].data["model"] == REGISTER_CLEARTEXT["model"]
assert entries[0].data["os_name"] == REGISTER_CLEARTEXT["os_name"]
assert entries[0].data["os_version"] == REGISTER_CLEARTEXT["os_version"]
assert (
entries[0].data["supports_encryption"]
== REGISTER_CLEARTEXT["supports_encryption"]
)
async def test_registration_encryption(hass, hass_client):
"""Test that registrations happen."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
return
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
api_client = await hass_client()
resp = await api_client.post("/api/mobile_app/registrations", json=REGISTER)
assert resp.status == HTTPStatus.CREATED
register_json = await resp.json()
key = unhexlify(register_json[CONF_SECRET])
payload = json.dumps(RENDER_TEMPLATE["data"]).encode("utf-8")
data = SecretBox(key).encrypt(payload, encoder=Base64Encoder).decode("utf-8")
container = {"type": "render_template", "encrypted": True, "encrypted_data": data}
resp = await api_client.post(
f"/api/webhook/{register_json[CONF_WEBHOOK_ID]}", json=container
)
assert resp.status == HTTPStatus.OK
webhook_json = await resp.json()
assert "encrypted_data" in webhook_json
decrypted_data = SecretBox(key).decrypt(
webhook_json["encrypted_data"], encoder=Base64Encoder
)
decrypted_data = decrypted_data.decode("utf-8")
assert json.loads(decrypted_data) == {"one": "Hello world"}
async def test_registration_encryption_legacy(hass, hass_client):
"""Test that registrations happen."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
return
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
api_client = await hass_client()
resp = await api_client.post("/api/mobile_app/registrations", json=REGISTER)
assert resp.status == HTTPStatus.CREATED
register_json = await resp.json()
keylen = SecretBox.KEY_SIZE
key = register_json[CONF_SECRET].encode("utf-8")
key = key[:keylen]
key = key.ljust(keylen, b"\0")
payload = json.dumps(RENDER_TEMPLATE["data"]).encode("utf-8")
data = SecretBox(key).encrypt(payload, encoder=Base64Encoder).decode("utf-8")
container = {"type": "render_template", "encrypted": True, "encrypted_data": data}
resp = await api_client.post(
f"/api/webhook/{register_json[CONF_WEBHOOK_ID]}", json=container
)
assert resp.status == HTTPStatus.OK
webhook_json = await resp.json()
assert "encrypted_data" in webhook_json
decrypted_data = SecretBox(key).decrypt(
webhook_json["encrypted_data"], encoder=Base64Encoder
)
decrypted_data = decrypted_data.decode("utf-8")
assert json.loads(decrypted_data) == {"one": "Hello world"}
| Python | 5 | MrDelik/core | tests/components/mobile_app/test_http_api.py | [
"Apache-2.0"
] |
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* 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.
*****************************************************************************/
#include "modules/canbus/vehicle/%(car_type_lower)s/%(car_type_lower)s_message_manager.h"
%(control_header_list)s
%(report_header_list)s
namespace apollo {
namespace canbus {
namespace %(car_type_lower)s {
%(car_type_cap)sMessageManager::%(car_type_cap)sMessageManager() {
// Control Messages
%(control_add_list)s
// Report Messages
%(report_add_list)s
}
%(car_type_cap)sMessageManager::~%(car_type_cap)sMessageManager() {}
} // namespace %(car_type_lower)s
} // namespace canbus
} // namespace apollo
| Smarty | 4 | seeclong/apollo | modules/tools/gen_vehicle_protocol/template/message_manager.cc.tpl | [
"Apache-2.0"
] |
_ = require 'underscore'
fs = require 'fs'
path = require 'path'
{NylasAPIHelpers,
Thread,
DatabaseWriter,
Actions,
Message,
Thread} = require 'nylas-exports'
DeltaProcessor = require('../../src/services/delta-processor').default
fixturesPath = path.resolve(__dirname, '..', 'fixtures')
describe "DeltaProcessor", ->
describe "handleDeltas", ->
beforeEach ->
@sampleDeltas = JSON.parse(fs.readFileSync("#{fixturesPath}/sample-deltas.json"))
@sampleClustered = JSON.parse(fs.readFileSync("#{fixturesPath}/sample-deltas-clustered.json"))
it "should immediately fire the received raw deltas event", ->
spyOn(Actions, 'longPollReceivedRawDeltas')
spyOn(DeltaProcessor, '_clusterDeltas').andReturn({create: {}, modify: {}, destroy: []})
waitsForPromise ->
DeltaProcessor.process(@sampleDeltas, {source: 'n1Cloud'})
runs ->
expect(Actions.longPollReceivedRawDeltas).toHaveBeenCalled()
xit "should call helper methods for all creates first, then modifications, then destroys", ->
spyOn(Actions, 'longPollProcessedDeltas')
handleDeltaDeletionPromises = []
resolveDeltaDeletionPromises = ->
fn() for fn in handleDeltaDeletionPromises
handleDeltaDeletionPromises = []
spyOn(DeltaProcessor, '_handleDestroyDelta').andCallFake ->
new Promise (resolve, reject) ->
handleDeltaDeletionPromises.push(resolve)
handleModelResponsePromises = []
resolveModelResponsePromises = ->
fn() for fn in handleModelResponsePromises
handleModelResponsePromises = []
spyOn(NylasAPIHelpers, 'handleModelResponse').andCallFake ->
new Promise (resolve, reject) ->
handleModelResponsePromises.push(resolve)
spyOn(DeltaProcessor, '_clusterDeltas').andReturn(JSON.parse(JSON.stringify(@sampleClustered)))
DeltaProcessor.process(@sampleDeltas)
createTypes = Object.keys(@sampleClustered['create'])
expect(NylasAPIHelpers.handleModelResponse.calls.length).toEqual(createTypes.length)
expect(NylasAPIHelpers.handleModelResponse.calls[0].args[0]).toEqual(_.values(@sampleClustered['create'][createTypes[0]]))
expect(DeltaProcessor._handleDestroyDelta.calls.length).toEqual(0)
NylasAPIHelpers.handleModelResponse.reset()
resolveModelResponsePromises()
advanceClock()
modifyTypes = Object.keys(@sampleClustered['modify'])
expect(NylasAPIHelpers.handleModelResponse.calls.length).toEqual(modifyTypes.length)
expect(NylasAPIHelpers.handleModelResponse.calls[0].args[0]).toEqual(_.values(@sampleClustered['modify'][modifyTypes[0]]))
expect(DeltaProcessor._handleDestroyDelta.calls.length).toEqual(0)
NylasAPIHelpers.handleModelResponse.reset()
resolveModelResponsePromises()
advanceClock()
destroyCount = @sampleClustered['destroy'].length
expect(DeltaProcessor._handleDestroyDelta.calls.length).toEqual(destroyCount)
expect(DeltaProcessor._handleDestroyDelta.calls[0].args[0]).toEqual(@sampleClustered['destroy'][0])
expect(Actions.longPollProcessedDeltas).not.toHaveBeenCalled()
resolveDeltaDeletionPromises()
advanceClock()
expect(Actions.longPollProcessedDeltas).toHaveBeenCalled()
describe "clusterDeltas", ->
beforeEach ->
@sampleDeltas = JSON.parse(fs.readFileSync("#{fixturesPath}/sample-deltas.json"))
@expectedClustered = JSON.parse(fs.readFileSync("#{fixturesPath}/sample-deltas-clustered.json"))
it "should collect create/modify events into a hash by model type", ->
{create, modify} = DeltaProcessor._clusterDeltas(@sampleDeltas)
expect(create).toEqual(@expectedClustered.create)
expect(modify).toEqual(@expectedClustered.modify)
it "should collect destroys into an array", ->
{destroy} = DeltaProcessor._clusterDeltas(@sampleDeltas)
expect(destroy).toEqual(@expectedClustered.destroy)
describe "handleDeltaDeletion", ->
beforeEach ->
@thread = new Thread(id: 'idhere')
@delta =
"cursor": "bb95ddzqtr2gpmvgrng73t6ih",
"object": "thread",
"event": "delete",
"objectId": @thread.id,
"timestamp": "2015-08-26T17:36:45.297Z"
spyOn(DatabaseWriter.prototype, 'unpersistModel')
it "should resolve if the object cannot be found", ->
spyOn(DatabaseWriter.prototype, 'find').andCallFake (klass, id) =>
return Promise.resolve(null)
waitsForPromise =>
DeltaProcessor._handleDestroyDelta(@delta)
runs =>
expect(DatabaseWriter.prototype.find).toHaveBeenCalledWith(Thread, 'idhere')
expect(DatabaseWriter.prototype.unpersistModel).not.toHaveBeenCalled()
it "should call unpersistModel if the object exists", ->
spyOn(DatabaseWriter.prototype, 'find').andCallFake (klass, id) =>
return Promise.resolve(@thread)
waitsForPromise =>
DeltaProcessor._handleDestroyDelta(@delta)
runs =>
expect(DatabaseWriter.prototype.find).toHaveBeenCalledWith(Thread, 'idhere')
expect(DatabaseWriter.prototype.unpersistModel).toHaveBeenCalledWith(@thread)
describe "handleModelResponse", ->
# SEE spec/nylas-api-spec.coffee
describe "receives metadata deltas", ->
beforeEach ->
@stubDB = {}
spyOn(DatabaseWriter.prototype, 'find').andCallFake (klass, id) =>
return @stubDB[id]
spyOn(DatabaseWriter.prototype, 'findAll').andCallFake (klass, where) =>
ids = where.id
models = []
ids.forEach (id) =>
model = @stubDB[id]
if model
models.push(model)
return models
spyOn(DatabaseWriter.prototype, 'persistModels').andCallFake (models) =>
models.forEach (model) =>
@stubDB[model.id] = model
return Promise.resolve()
@messageMetadataDelta =
id: 519,
event: "create",
object: "metadata",
objectId: 8876,
changedFields: ["version", "object"],
attributes:
id: 8876,
value: {link_clicks: 1},
object: "metadata",
version: 2,
plugin_id: "link-tracking",
object_id: '2887',
object_type: "message",
account_id: 2
@threadMetadataDelta =
id: 392,
event: "create",
object: "metadata",
objectId: 3845,
changedFields: ["version", "object"],
attributes:
id: 3845,
value: {shouldNotify: true},
object: "metadata",
version: 2,
plugin_id: "send-reminders",
object_id: 't:3984',
object_type: "thread"
account_id: 2,
it "saves metadata to existing Messages", ->
message = new Message({serverId: @messageMetadataDelta.attributes.object_id})
@stubDB[message.id] = message
waitsForPromise =>
DeltaProcessor.process([@messageMetadataDelta])
runs ->
message = @stubDB[message.id] # refresh reference
expect(message.pluginMetadata.length).toEqual(1)
expect(message.metadataForPluginId('link-tracking')).toEqual({link_clicks: 1})
it "saves metadata to existing Threads", ->
thread = new Thread({serverId: @threadMetadataDelta.attributes.object_id})
@stubDB[thread.id] = thread
waitsForPromise =>
DeltaProcessor.process([@threadMetadataDelta])
runs ->
thread = @stubDB[thread.id] # refresh reference
expect(thread.pluginMetadata.length).toEqual(1)
expect(thread.metadataForPluginId('send-reminders')).toEqual({shouldNotify: true})
it "knows how to reconcile different thread ids", ->
thread = new Thread({serverId: 't:1948'})
@stubDB[thread.id] = thread
message = new Message({
serverId: @threadMetadataDelta.attributes.object_id.substring(2),
threadId: thread.id
})
@stubDB[message.id] = message
waitsForPromise =>
DeltaProcessor.process([@threadMetadataDelta])
runs ->
thread = @stubDB[thread.id] # refresh reference
expect(thread.pluginMetadata.length).toEqual(1)
expect(thread.metadataForPluginId('send-reminders')).toEqual({shouldNotify: true})
it "creates ghost Messages if necessary", ->
waitsForPromise =>
DeltaProcessor.process([@messageMetadataDelta])
runs ->
message = @stubDB[@messageMetadataDelta.attributes.object_id]
expect(message).toBeDefined()
expect(message.pluginMetadata.length).toEqual(1)
expect(message.metadataForPluginId('link-tracking')).toEqual({link_clicks: 1})
it "creates ghost Threads if necessary", ->
waitsForPromise =>
DeltaProcessor.process([@threadMetadataDelta])
runs ->
thread = @stubDB[@threadMetadataDelta.attributes.object_id]
expect(thread.pluginMetadata.length).toEqual(1)
expect(thread.metadataForPluginId('send-reminders')).toEqual({shouldNotify: true})
| CoffeeScript | 4 | cnheider/nylas-mail | packages/client-app/spec/services/delta-processor-spec.coffee | [
"MIT"
] |
------------------------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
-- --
-- This library 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 2 of the License, or (at --
-- your option) any later version. --
-- --
-- This library 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 library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
------------------------------------------------------------------------------
-- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
with Ada.Streams;
with Interfaces;
package ZLib is
ZLib_Error : exception;
Status_Error : exception;
type Compression_Level is new Integer range -1 .. 9;
type Flush_Mode is private;
type Compression_Method is private;
type Window_Bits_Type is new Integer range 8 .. 15;
type Memory_Level_Type is new Integer range 1 .. 9;
type Unsigned_32 is new Interfaces.Unsigned_32;
type Strategy_Type is private;
type Header_Type is (None, Auto, Default, GZip);
-- Header type usage have a some limitation for inflate.
-- See comment for Inflate_Init.
subtype Count is Ada.Streams.Stream_Element_Count;
Default_Memory_Level : constant Memory_Level_Type := 8;
Default_Window_Bits : constant Window_Bits_Type := 15;
----------------------------------
-- Compression method constants --
----------------------------------
Deflated : constant Compression_Method;
-- Only one method allowed in this ZLib version
---------------------------------
-- Compression level constants --
---------------------------------
No_Compression : constant Compression_Level := 0;
Best_Speed : constant Compression_Level := 1;
Best_Compression : constant Compression_Level := 9;
Default_Compression : constant Compression_Level := -1;
--------------------------
-- Flush mode constants --
--------------------------
No_Flush : constant Flush_Mode;
-- Regular way for compression, no flush
Partial_Flush : constant Flush_Mode;
-- Will be removed, use Z_SYNC_FLUSH instead
Sync_Flush : constant Flush_Mode;
-- All pending output is flushed to the output buffer and the output
-- is aligned on a byte boundary, so that the decompressor can get all
-- input data available so far. (In particular avail_in is zero after the
-- call if enough output space has been provided before the call.)
-- Flushing may degrade compression for some compression algorithms and so
-- it should be used only when necessary.
Block_Flush : constant Flush_Mode;
-- Z_BLOCK requests that inflate() stop
-- if and when it get to the next deflate block boundary. When decoding the
-- zlib or gzip format, this will cause inflate() to return immediately
-- after the header and before the first block. When doing a raw inflate,
-- inflate() will go ahead and process the first block, and will return
-- when it gets to the end of that block, or when it runs out of data.
Full_Flush : constant Flush_Mode;
-- All output is flushed as with SYNC_FLUSH, and the compression state
-- is reset so that decompression can restart from this point if previous
-- compressed data has been damaged or if random access is desired. Using
-- Full_Flush too often can seriously degrade the compression.
Finish : constant Flush_Mode;
-- Just for tell the compressor that input data is complete.
------------------------------------
-- Compression strategy constants --
------------------------------------
-- RLE stategy could be used only in version 1.2.0 and later.
Filtered : constant Strategy_Type;
Huffman_Only : constant Strategy_Type;
RLE : constant Strategy_Type;
Default_Strategy : constant Strategy_Type;
Default_Buffer_Size : constant := 4096;
type Filter_Type is tagged limited private;
-- The filter is for compression and for decompression.
-- The usage of the type is depend of its initialization.
function Version return String;
pragma Inline (Version);
-- Return string representation of the ZLib version.
procedure Deflate_Init
(Filter : in out Filter_Type;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Method : in Compression_Method := Deflated;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Memory_Level : in Memory_Level_Type := Default_Memory_Level;
Header : in Header_Type := Default);
-- Compressor initialization.
-- When Header parameter is Auto or Default, then default zlib header
-- would be provided for compressed data.
-- When Header is GZip, then gzip header would be set instead of
-- default header.
-- When Header is None, no header would be set for compressed data.
procedure Inflate_Init
(Filter : in out Filter_Type;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Header : in Header_Type := Default);
-- Decompressor initialization.
-- Default header type mean that ZLib default header is expecting in the
-- input compressed stream.
-- Header type None mean that no header is expecting in the input stream.
-- GZip header type mean that GZip header is expecting in the
-- input compressed stream.
-- Auto header type mean that header type (GZip or Native) would be
-- detected automatically in the input stream.
-- Note that header types parameter values None, GZip and Auto are
-- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
-- Deflate_Init is supporting all header types.
function Is_Open (Filter : in Filter_Type) return Boolean;
pragma Inline (Is_Open);
-- Is the filter opened for compression or decompression.
procedure Close
(Filter : in out Filter_Type;
Ignore_Error : in Boolean := False);
-- Closing the compression or decompressor.
-- If stream is closing before the complete and Ignore_Error is False,
-- The exception would be raised.
generic
with procedure Data_In
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
with procedure Data_Out
(Item : in Ada.Streams.Stream_Element_Array);
procedure Generic_Translate
(Filter : in out Filter_Type;
In_Buffer_Size : in Integer := Default_Buffer_Size;
Out_Buffer_Size : in Integer := Default_Buffer_Size);
-- Compress/decompress data fetch from Data_In routine and pass the result
-- to the Data_Out routine. User should provide Data_In and Data_Out
-- for compression/decompression data flow.
-- Compression or decompression depend on Filter initialization.
function Total_In (Filter : in Filter_Type) return Count;
pragma Inline (Total_In);
-- Returns total number of input bytes read so far
function Total_Out (Filter : in Filter_Type) return Count;
pragma Inline (Total_Out);
-- Returns total number of bytes output so far
function CRC32
(CRC : in Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array)
return Unsigned_32;
pragma Inline (CRC32);
-- Compute CRC32, it could be necessary for make gzip format
procedure CRC32
(CRC : in out Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array);
pragma Inline (CRC32);
-- Compute CRC32, it could be necessary for make gzip format
-------------------------------------------------
-- Below is more complex low level routines. --
-------------------------------------------------
procedure Translate
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
-- Compress/decompress the In_Data buffer and place the result into
-- Out_Data. In_Last is the index of last element from In_Data accepted by
-- the Filter. Out_Last is the last element of the received data from
-- Filter. To tell the filter that incoming data are complete put the
-- Flush parameter to Finish.
function Stream_End (Filter : in Filter_Type) return Boolean;
pragma Inline (Stream_End);
-- Return the true when the stream is complete.
procedure Flush
(Filter : in out Filter_Type;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
pragma Inline (Flush);
-- Flushing the data from the compressor.
generic
with procedure Write
(Item : in Ada.Streams.Stream_Element_Array);
-- User should provide this routine for accept
-- compressed/decompressed data.
Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
-- Buffer size for Write user routine.
procedure Write
(Filter : in out Filter_Type;
Item : in Ada.Streams.Stream_Element_Array;
Flush : in Flush_Mode := No_Flush);
-- Compress/Decompress data from Item to the generic parameter procedure
-- Write. Output buffer size could be set in Buffer_Size generic parameter.
generic
with procedure Read
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- User should provide data for compression/decompression
-- thru this routine.
Buffer : in out Ada.Streams.Stream_Element_Array;
-- Buffer for keep remaining data from the previous
-- back read.
Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
-- Rest_First have to be initialized to Buffer'Last + 1
-- Rest_Last have to be initialized to Buffer'Last
-- before usage.
Allow_Read_Some : in Boolean := False;
-- Is it allowed to return Last < Item'Last before end of data.
procedure Read
(Filter : in out Filter_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode := No_Flush);
-- Compress/Decompress data from generic parameter procedure Read to the
-- Item. User should provide Buffer and initialized Rest_First, Rest_Last
-- indicators. If Allow_Read_Some is True, Read routines could return
-- Last < Item'Last only at end of stream.
private
use Ada.Streams;
pragma Assert (Ada.Streams.Stream_Element'Size = 8);
pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
type Flush_Mode is new Integer range 0 .. 5;
type Compression_Method is new Integer range 8 .. 8;
type Strategy_Type is new Integer range 0 .. 3;
No_Flush : constant Flush_Mode := 0;
Partial_Flush : constant Flush_Mode := 1;
Sync_Flush : constant Flush_Mode := 2;
Full_Flush : constant Flush_Mode := 3;
Finish : constant Flush_Mode := 4;
Block_Flush : constant Flush_Mode := 5;
Filtered : constant Strategy_Type := 1;
Huffman_Only : constant Strategy_Type := 2;
RLE : constant Strategy_Type := 3;
Default_Strategy : constant Strategy_Type := 0;
Deflated : constant Compression_Method := 8;
type Z_Stream;
type Z_Stream_Access is access all Z_Stream;
type Filter_Type is tagged limited record
Strm : Z_Stream_Access;
Compression : Boolean;
Stream_End : Boolean;
Header : Header_Type;
CRC : Unsigned_32;
Offset : Stream_Element_Offset;
-- Offset for gzip header/footer output.
end record;
end ZLib;
| Ada | 5 | bitcrystal/temp | src/minizip/contrib/ada/zlib.ads | [
"MIT"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.