text:
" layer="21"/>
<wire x1="-5.4" y1="5.4" x2="3.4" y2="5.4" width="0.127" layer="21"/>
<wire x1="5.4" y1="3.4" x2="5.4" y2="-3.4" width="0.127" layer="21"/>
<wire x1="3.4" y1="-5.4" x2="-5.4" y2="-5.4" width="0.127" layer="21"/>
<wire x1="-5.4" y1="-5.4" x2="-5.4" y2="0" width="0.127" layer="21"/>
<circle x="0" y="0" radius="5.20384375" width="0.127" layer="21"/>
<wire x1="3.4" y1="5.4" x2="5.4" y2="3.4" width="0.127" layer="21"/>
<wire x1="3.4" y1="-5.4" x2="5.4" y2="-3.4" width="0.127" layer="21"/>
<smd name="P$1" x="-4.5" y="0" dx="3.6" dy="1.2" layer="1"/>
<smd name="PLUS$2" x="4.6" y="0" dx="3.6" dy="1.2" layer="1"/>
</package>
</packages>
</library>
<library name="SparkFun-LED">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find discrete LEDs for illumination or indication, but no displays.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="LED-TRICOLOR-5050-IC">
<circle x="-0.7" y="2" radius="0.2236" width="0.2032" layer="21"/>
<circle x="0" y="0" radius="2" width="0.127" layer="51"/>
<wire x1="-2.5" y1="-2.5" x2="-2.5" y2="2" width="0.127" layer="51"/>
<wire x1="-1.8" y1="2.5" x2="2.5" y2="2.5" width="0.127" layer="51"/>
<wire x1="2.5" y1="2.5" x2="2.5" y2="-2.5" width="0.127" layer="51"/>
<wire x1="2.5" y1="-2.5" x2="-2.5" y2="-2.5" width="0.127" layer="51"/>
<wire x1="-1" y1="2.5" x2="1" y2="2.5" width="0.2032" layer="21"/>
<wire x1="-1" y1="-2.5" x2="1" y2="-2.5" width="0.2032" layer="21"/>
<wire x1="-2.5" y1="0.7" x2="-2.5" y2="0.9" width="0.2032" layer="21"/>
<wire x1="-2.5" y1="-0.9" x2="-2.5" y2="-0.7" width="0.2032" layer="21"/>
<wire x1="2.5" y1="-0.9" x2="2.5" y2="-0.7" width="0.2032" layer="21"/>
<wire x1="2.5" y1="0.7" x2="2.5" y2="0.9" width="0.2032" layer="21"/>
<wire x1="-1.016" y1="-0.381" x2="-1.016" y2="0.381" width="0.2032" layer="21"/>
<wire x1="-1.016" y1="0.381" x2="-0.127" y2="0.381" width="0.2032" layer="21"/>
<wire x1="-0.127" y1="0.381" x2="-0.127" y2="-0.381" width="0.2032" layer="21"/>
<wire x1="-0.127" y1="-0.381" x2="-1.016" y2="-0.381" width="0.2032" layer="21"/>
<wire x1="0.254" y1="-0.127" x2="0.254" y2="0.127" width="0.2032" layer="21"/>
<wire x1="0.254" y1="0.127" x2="0.508" y2="0.127" width="0.2032" layer="21"/>
<wire x1="0.508" y1="0.127" x2="0.508" y2="-0.127" width="0.2032" layer="21"/>
<wire x1="0.508" y1="-0.127" x2="0.254" y2="-0.127" width="0.2032" layer="21"/>
<wire x1="-2.5" y1="2" x2="-1.8" y2="2.5" width="0.127" layer="51"/>
<rectangle x1="1.7" y1="-0.45" x2="2.7" y2="0.45" layer="51"/>
<rectangle x1="1.7" y1="1.15" x2="2.7" y2="2.05" layer="51"/>
<rectangle x1="1.7" y1="-2.05" x2="2.7" y2="-1.15" layer="51"/>
<rectangle x1="-2.7" y1="1.15" x2="-1.7" y2="2.05" layer="51" rot="R180"/>
<rectangle x1="-2.7" y1="-0.45" x2="-1.7" y2="0.45" layer="51" rot="R180"/>
<rectangle x1="-2.7" y1="-2.05" x2="-1.7" y2="-1.15" layer="51" rot="R180"/>
<smd name="1" x="-2.4" y="1.7" dx="2" dy="1.1" layer="1" roundness="100"/>
<smd name="2" x="-2.4" y="0" dx="2" dy="1.1" layer="1" roundness="100"/>
<smd name="3" x="-2.4" y="-1.7" dx="2" dy="1.1" layer="1" roundness="100"/>
<smd name="4" x="2.4" y="-1.7" dx="2" dy="1.1" layer="1" roundness="100"/>
<smd name="5" x="2.4" y="0" dx="2" dy="1.1" layer="1" roundness="100"/>
<smd name="6" x="2.4" y="1.7" dx="2" dy="1.1" layer="1" roundness="100"/>
<text x="-2.54" y="2.794" size="0.762" layer="25">>Name</text>
<text x="-2.54" y="-3.556" size="0.762" layer="27">>Value</text>
</package>
</packages>
</library>
</libraries>
<attributes>
</attributes>
<variantdefs>
</variantdefs>
<classes>
<class number="0" name="default" width="0" drill="0">
</class>
</classes>
<designrules name="LaenPCBOrder">
<description language="de">EAGLE Design Rules

Die Standard-Design-Rules sind so gewählt, dass sie für
die meisten Anwendungen passen. Sollte ihre Platine
besondere Anforderungen haben, treffen Sie die erforderlichen
Einstellungen hier und speichern die Design Rules unter
einem neuen Namen ab.</description>
<description language="en">Laen's PCB Order Design Rules

Please make sure your boards conform to these design rules.</description>
<param name="layerSetup" value="(1*16)"/>
<param name="mtCopper" value="0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm"/>
<param name="mtIsolate" value="1.5011mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm"/>
<param name="mdWireWire" value="6mil"/>
<param name="mdWirePad" value="6mil"/>
<param name="mdWireVia" value="6mil"/>
<param name="mdPadPad" value="6mil"/>
<param name="mdPadVia" value="6mil"/>
<param name="mdViaVia" value="6mil"/>
<param name="mdSmdPad" value="6mil"/>
<param name="mdSmdVia" value="6mil"/>
<param name="mdSmdSmd" value="6mil"/>
<param name="mdViaViaSameLayer" value="8mil"/>
<param name="mnLayersViaInSmd" value="2"/>
<param name="mdCopperDimension" value="15mil"/>
<param name="mdDrill" value="6mil"/>
<param name="mdSmdStop" value="0mil"/>
<param name="msWidth" value="6mil"/>
<param name="msDrill" value="13mil"/>
<param name="msMicroVia" value="13mil"/>
<param name="msBlindViaRatio" value="0.5"/>
<param name="rvPadTop" value="0.25"/>
<param name="rvPadInner" value="0.25"/>
<param name="rvPadBottom" value="0.25"/>
<param name="rvViaOuter" value="0.25"/>
<param name="rvViaInner" value="0.25"/>
<param name="rvMicroViaOuter" value="0.25"/>
<param name="rvMicroViaInner" value="0.25"/>
<param name="rlMinPadTop" value="7mil"/>
<param name="rlMaxPadTop" value="20mil"/>
<param name="rlMinPadInner" value="7mil"/>
<param name="rlMaxPadInner" value="20mil"/>
<param name="rlMinPadBottom" value="7mil"/>
<param name="rlMaxPadBottom" value="20mil"/>
<param name="rlMinViaOuter" value="7mil"/>
<param name="rlMaxViaOuter" value="20mil"/>
<param name="rlMinViaInner" value="7mil"/>
<param name="rlMaxViaInner" value="20mil"/>
<param name="rlMinMicroViaOuter" value="4mil"/>
<param name="rlMaxMicroViaOuter" value="20mil"/>
<param name="rlMinMicroViaInner" value="4mil"/>
<param name="rlMaxMicroViaInner" value="20mil"/>
<param name="psTop" value="-1"/>
<param name="psBottom" value="-1"/>
<param name="psFirst" value="-1"/>
<param name="psElongationLong" value="100"/>
<param name="psElongationOffset" value="100"/>
<param name="mvStopFrame" value="1"/>
<param name="mvCreamFrame" value="0"/>
<param name="mlMinStopFrame" value="3mil"/>
<param name="mlMaxStopFrame" value="3mil"/>
<param name="mlMinCreamFrame" value="0mil"/>
<param name="mlMaxCreamFrame" value="0mil"/>
<param name="mlViaStopLimit" value="0mil"/>
<param name="srRoundness" value="0"/>
<param name="srMinRoundness" value="0mil"/>
<param name="srMaxRoundness" value="0mil"/>
<param name="slThermalIsolate" value="10mil"/>
<param name="slThermalsForVias" value="0"/>
<param name="dpMaxLengthDifference" value="10mm"/>
<param name="dpGapFactor" value="2.5"/>
<param name="checkGrid" value="0"/>
<param name="checkAngle" value="0"/>
<param name="checkFont" value="1"/>
<param name="checkRestrict" value="1"/>
<param name="useDiameter" value="13"/>
<param name="maxErrors" value="50"/>
</designrules>
<autorouter>
<pass name="Default">
<param name="RoutingGrid" value="50mil"/>
<param name="AutoGrid" value="1"/>
<param name="Efforts" value="0"/>
<param name="TopRouterVariant" value="1"/>
<param name="tpViaShape" value="round"/>
<param name="PrefDir.1" value="a"/>
<param name="PrefDir.2" value="0"/>
<param name="PrefDir.3" value="0"/>
<param name="PrefDir.4" value="0"/>
<param name="PrefDir.5" value="0"/>
<param name="PrefDir.6" value="0"/>
<param name="PrefDir.7" value="0"/>
<param name="PrefDir.8" value="0"/>
<param name="PrefDir.9" value="0"/>
<param name="PrefDir.10" value="0"/>
<param name="PrefDir.11" value="0"/>
<param name="PrefDir.12" value="0"/>
<param name="PrefDir.13" value="0"/>
<param name="PrefDir.14" value="0"/>
<param name="PrefDir.15" value="0"/>
<param name="PrefDir.16" value="a"/>
<param name="cfVia" value="8"/>
<param name="cfNonPref" value="5"/>
<param name="cfChangeDir" value="2"/>
<param name="cfOrthStep" value="2"/>
<param name="cfDiagStep" value="3"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="1"/>
<param name="cfMalusStep" value="1"/>
<param name="cfPadImpact" value="4"/>
<param name="cfSmdImpact" value="4"/>
<param name="cfBusImpact" value="0"/>
<param name="cfHugging" value="3"/>
<param name="cfAvoid" value="4"/>
<param name="cfPolygon" value="10"/>
<param name="cfBase.1" value="0"/>
<param name="cfBase.2" value="1"/>
<param name="cfBase.3" value="1"/>
<param name="cfBase.4" value="1"/>
<param name="cfBase.5" value="1"/>
<param name="cfBase.6" value="1"/>
<param name="cfBase.7" value="1"/>
<param name="cfBase.8" value="1"/>
<param name="cfBase.9" value="1"/>
<param name="cfBase.10" value="1"/>
<param name="cfBase.11" value="1"/>
<param name="cfBase.12" value="1"/>
<param name="cfBase.13" value="1"/>
<param name="cfBase.14" value="1"/>
<param name="cfBase.15" value="1"/>
<param name="cfBase.16" value="0"/>
<param name="mnVias" value="20"/>
<param name="mnSegments" value="9999"/>
<param name="mnExtdSteps" value="9999"/>
<param name="mnRipupLevel" value="10"/>
<param name="mnRipupSteps" value="100"/>
<param name="mnRipupTotal" value="100"/>
</pass>
<pass name="Follow-me" refer="Default" active="yes">
</pass>
<pass name="Busses" refer="Default" active="yes">
<param name="cfNonPref" value="4"/>
<param name="cfBusImpact" value="4"/>
<param name="cfHugging" value="0"/>
<param name="mnVias" value="0"/>
</pass>
<pass name="Route" refer="Default" active="yes">
</pass>
<pass name="Optimize1" refer="Default" active="yes">
<param name="cfVia" value="99"/>
<param name="cfExtdStep" value="10"/>
<param name="cfHugging" value="1"/>
<param name="mnExtdSteps" value="1"/>
<param name="mnRipupLevel" value="0"/>
</pass>
<pass name="Optimize2" refer="Optimize1" active="yes">
<param name="cfNonPref" value="0"/>
<param name="cfChangeDir" value="6"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="2"/>
<param name="cfMalusStep" value="2"/>
<param name="cfPadImpact" value="2"/>
<param name="cfSmdImpact" value="2"/>
<param name="cfHugging" value="0"/>
</pass>
<pass name="Optimize3" refer="Optimize2" active="yes">
<param name="cfChangeDir" value="8"/>
<param name="cfPadImpact" value="0"/>
<param name="cfSmdImpact" value="0"/>
</pass>
<pass name="Optimize4" refer="Optimize3" active="yes">
<param name="cfChangeDir" value="25"/>
</pass>
</autorouter>
<elements>
<element name="R1" library="eagle-ltspice" package="R0603" value="" x="8.763" y="17.7165" smashed="yes">
<attribute name="SPICEMODEL" value="NONE" x="8.763" y="17.7165" size="1.778" layer="27" display="off"/>
<attribute name="SPICEPREFIX" value="R" x="8.763" y="17.7165" size="1.778" layer="27" display="off"/>
<attribute name="VALUE" x="8.128" y="15.8115" size="1.27" layer="27"/>
</element>
<element name="C1" library="eagle-ltspice" package="C0603" value="" x="13.04925" y="17.7165" smashed="yes">
<attribute name="SPICEMODEL" value="NONE" x="13.04925" y="17.7165" size="1.778" layer="27" display="off"/>
<attribute name="SPICEPREFIX" value="C" x="13.04925" y="17.7165" size="1.778" layer="27" display="off"/>
<attribute name="VALUE" x="12.41425" y="15.8115" size="1.27" layer="27"/>
</element>
<element name="S1" library="SparkFun-Electromechanical" package="TACTILE-SWITCH-1101NE" value="SWITCH-MOMENTARY-2SMD-1101NE" x="2.25425" y="10.414" smashed="yes" rot="R90">
<attribute name="PROD_ID" value="SWCH-00815" x="2.25425" y="10.414" size="1.778" layer="27" rot="R90" display="off"/>
</element>
<element name="R2" library="eagle-ltspice" package="R0402" value="" x="8.763" y="19.304" smashed="yes" rot="R180">
<attribute name="SPICEMODEL" value="NONE" x="8.763" y="19.304" size="1.778" layer="27" rot="R180" display="off"/>
<attribute name="SPICEPREFIX" value="R" x="8.763" y="19.304" size="1.778" layer="27" rot="R180" display="off"/>
<attribute name="VALUE" x="9.398" y="21.209" size="1.27" layer="27" rot="R180"/>
</element>
<element name="D2" library="SparkFun-DiscreteSemi" package="SOD-323" value="3.3V" x="4.6355" y="5.334" smashed="yes" rot="R135">
<attribute name="PROD_ID" value="DIO-11284" x="4.6355" y="5.334" size="1.778" layer="27" rot="R135" display="off"/>
</element>
<element name="D3" library="SparkFun-DiscreteSemi" package="SOD-323" value="3.3V" x="16.54175" y="4.699" smashed="yes" rot="R45">
<attribute name="PROD_ID" value="DIO-11284" x="16.54175" y="4.699" size="1.778" layer="27" rot="R45" display="off"/>
</element>
<element name="R3" library="eagle-ltspice" package="R0402" value="" x="17.49425" y="3.7465" smashed="yes" rot="R225">
<attribute name="SPICEMODEL" value="NONE" x="17.49425" y="3.7465" size="1.778" layer="27" rot="R225" display="off"/>
<attribute name="SPICEPREFIX" value="R" x="17.49425" y="3.7465" size="1.778" layer="27" rot="R225" display="off"/>
<attribute name="VALUE" x="16.596221875" y="5.54255" size="1.27" layer="27" rot="R225"/>
</element>
<element name="R4" library="eagle-ltspice" package="R0402" value="" x="13.04925" y="19.304" smashed="yes" rot="R180">
<attribute name="SPICEMODEL" value="NONE" x="13.04925" y="19.304" size="1.778" layer="27" rot="R180" display="off"/>
<attribute name="SPICEPREFIX" value="R" x="13.04925" y="19.304" size="1.778" layer="27" rot="R180" display="off"/>
<attribute name="VALUE" x="13.68425" y="21.209" size="1.27" layer="27" rot="R180"/>
</element>
<element name="R5" library="eagle-ltspice" package="R0402" value="" x="3.683" y="4.3815" smashed="yes" rot="R135">
<attribute name="SPICEMODEL" value="NONE" x="3.683" y="4.3815" size="1.778" layer="27" rot="R135" display="off"/>
<attribute name="SPICEPREFIX" value="R" x="3.683" y="4.3815" size="1.778" layer="27" rot="R135" display="off"/>
<attribute name="VALUE" x="5.47905" y="5.279525" size="1.27" layer="27" rot="R135"/>
</element>
<element name="U$1" library="mylib" package="FC0H104ZFTBR24" value="FC0H104ZFTBR24" x="10.033" y="11.3665" smashed="yes" rot="R180"/>
<element name="U2" library="SparkFun-LED" package="LED-TRICOLOR-5050-IC" value="WS2811" x="10.668" y="10.414" smashed="yes" rot="MR315">
<attribute name="PROD_ID" value="DIO-11598" x="10.668" y="10.414" size="1.778" layer="28" rot="MR315" display="off"/>
</element>
<element name="C3" library="eagle-ltspice" package="C0603" value="" x="4.318" y="17.399" smashed="yes" rot="R225">
<attribute name="SPICEMODEL" value="NONE" x="4.318" y="17.399" size="1.778" layer="27" rot="R225" display="off"/>
<attribute name="SPICEPREFIX" value="C" x="4.318" y="17.399" size="1.778" layer="27" rot="R225" display="off"/>
<attribute name="VALUE" x="3.419971875" y="19.19505" size="1.27" layer="27" rot="R225"/>
</element>
<element name="U3" library="SparkFun-DigitalIC" package="SO08-EIAJ" value="Tiny85-20-SMT" x="17.9705" y="10.7315" smashed="yes" rot="R180">
<attribute name="PROD_ID" value="IC-09092" x="17.9705" y="10.7315" size="1.778" layer="27" rot="R180" display="off"/>
</element>
<element name="JP2" library="SparkFun-Connectors" package="USB-B-MICRO-SMD_V03" value="USB_MICROB_PLUGCONN-11752" x="10.414" y="2.794" smashed="yes" rot="R90">
<attribute name="PROD_ID" value="CONN-11752" x="10.414" y="2.794" size="0.128525" layer="27" font="vector" rot="R90" display="off"/>
</element>
</elements>
<signals>
<signal name="+5V">
<contactref element="C1" pad="1"/>
<contactref element="C1" pad="1"/>
<contactref element="R2" pad="2"/>
<contactref element="R5" pad="2"/>
<contactref element="U2" pad="3"/>
<contactref element="U2" pad="5"/>
<contactref element="C3" pad="1"/>
<contactref element="C3" pad="1"/>
<contactref element="R1" pad="1"/>
<contactref element="U$1" pad="PLUS$2"/>
<contactref element="U3" pad="8"/>
<wire x1="4.919040625" y1="18.000040625" x2="7.629459375" y2="18.000040625" width="0.6096" layer="1"/>
<wire x1="7.629459375" y1="18.000040625" x2="7.913" y2="17.7165" width="0.4064" layer="1"/>
<wire x1="7.913" y1="17.7165" x2="7.913" y2="19.104" width="0.4064" layer="1"/>
<wire x1="7.913" y1="19.104" x2="8.113" y2="19.304" width="0.4064" layer="1"/>
<wire x1="7.913" y1="17.7165" x2="7.913" y2="18.454" width="0.4064" layer="1"/>
<wire x1="7.913" y1="18.454" x2="7.86765" y2="18.56105" width="0.4064" layer="1"/>
<wire x1="7.86765" y1="18.56105" x2="11.99515" y2="18.56105" width="0.254" layer="1"/>
<wire x1="11.99515" y1="18.56105" x2="12.2555" y2="18.3515" width="0.254" layer="1"/>
<wire x1="12.2555" y1="18.3515" x2="12.2555" y2="17.77275" width="0.254" layer="1"/>
<wire x1="12.2555" y1="17.77275" x2="12.19925" y2="17.7165" width="0.3048" layer="1"/>
<wire x1="7.913" y1="11.42275" x2="7.913" y2="17.7165" width="0.6096" layer="1"/>
<wire x1="7.79145" y1="7.53745" x2="8.97094375" y2="8.716940625" width="0.6096" layer="16"/>
<via x="7.79145" y="7.53745" extent="1-16" drill="0.6"/>
<wire x1="7.79145" y1="7.53745" x2="7.794625" y2="7.534275" width="0.6096" layer="16"/>
<wire x1="3.223378125" y1="4.84111875" x2="3.240009375" y2="4.85775" width="0.4064" layer="1"/>
<wire x1="3.240009375" y1="4.85775" x2="4.0005" y2="4.85775" width="0.4064" layer="1"/>
<wire x1="4.0005" y1="4.85775" x2="6.858" y2="7.51205" width="0.4064" layer="1"/>
<wire x1="6.858" y1="7.51205" x2="7.79145" y2="7.53745" width="0.4064" layer="1"/>
<wire x1="7.79145" y1="7.53745" x2="7.84225" y2="11.3665" width="0.6096" layer="1"/>
<wire x1="7.84225" y1="11.3665" x2="5.433" y2="11.3665" width="0.6096" layer="1"/>
<wire x1="7.84225" y1="11.3665" x2="7.913" y2="11.42275" width="0.6096" layer="1"/>
<wire x1="13.567140625" y1="10.908971875" x2="12.11966875" y2="9.4615" width="0.6096" layer="16"/>
<wire x1="9.7155" y1="9.4615" x2="8.97094375" y2="8.716940625" width="0.6096" layer="16"/>
<wire x1="12.11966875" y1="9.4615" x2="9.7155" y2="9.4615" width="0.6096" layer="16"/>
<wire x1="13.567140625" y1="10.908971875" x2="13.567140625" y2="10.931890625" width="0.6096" layer="16"/>
<wire x1="19.8755" y1="7.3787" x2="19.8755" y2="6.1595" width="0.4064" layer="1"/>
<wire x1="19.8755" y1="6.1595" x2="19.6088" y2="5.588" width="0.4064" layer="1"/>
<via x="19.6088" y="5.588" extent="1-16" drill="0.6"/>
<wire x1="19.6088" y1="5.588" x2="18.796" y2="5.842" width="0.4064" layer="16"/>
<wire x1="18.796" y1="5.842" x2="17.272" y2="7.874" width="0.4064" layer="16"/>
<wire x1="17.272" y1="7.874" x2="16.51" y2="7.874" width="0.4064" layer="16"/>
<wire x1="16.51" y1="7.874" x2="13.97" y2="10.414" width="0.4064" layer="16"/>
<wire x1="13.97" y1="10.414" x2="13.97" y2="10.5061125" width="0.4064" layer="16"/>
<wire x1="13.97" y1="10.5061125" x2="13.567140625" y2="10.908971875" width="0.4064" layer="16"/>
</signal>
<signal name="GND">
<contactref element="C1" pad="2"/>
<contactref element="C1" pad="2"/>
<contactref element="S1" pad="2"/>
<contactref element="D2" pad="A"/>
<contactref element="D3" pad="A"/>
<contactref element="U$1" pad="P$1"/>
<contactref element="U2" pad="6"/>
<contactref element="C3" pad="2"/>
<contactref element="C3" pad="2"/>
<contactref element="U3" pad="4"/>
<wire x1="16.1798" y1="14.5415" x2="16.0655" y2="14.1097" width="0.4064" layer="1"/>
<wire x1="3.822325" y1="6.147171875" x2="3.861171875" y2="6.147171875" width="0.4064" layer="1"/>
<wire x1="3.861171875" y1="6.147171875" x2="4.79425" y2="7.08025" width="0.4064" layer="1"/>
<wire x1="4.79425" y1="7.08025" x2="4.79425" y2="9.4615" width="0.4064" layer="1"/>
<wire x1="4.79425" y1="9.4615" x2="4.318" y2="9.93775" width="0.4064" layer="1"/>
<wire x1="4.318" y1="9.93775" x2="3.048" y2="9.93775" width="0.4064" layer="1"/>
<wire x1="3.048" y1="9.93775" x2="2.25425" y2="10.7315" width="0.4064" layer="1"/>
<wire x1="2.25425" y1="14.35775" x2="2.25425" y2="13.564" width="0.4064" layer="1"/>
<wire x1="14.533" y1="14.4865" x2="13.89925" y2="15.12025" width="0.6096" layer="1"/>
<wire x1="13.89925" y1="15.12025" x2="13.89925" y2="17.7165" width="0.6096" layer="1"/>
<wire x1="3.71695625" y1="16.79795625" x2="2.25425" y2="15.33525" width="0.6096" layer="1"/>
<wire x1="2.25425" y1="15.33525" x2="2.25425" y2="13.564" width="0.6096" layer="1"/>
<wire x1="2.25425" y1="13.564" x2="2.25425" y2="10.7315" width="0.4064" layer="1"/>
<wire x1="15.27175" y1="11.3665" x2="14.533" y2="11.3665" width="0.4064" layer="1"/>
<via x="6.604" y="8.73125" extent="1-16" drill="0.6"/>
<wire x1="14.533" y1="10.57275" x2="14.533" y2="11.3665" width="0.4064" layer="1"/>
<wire x1="4.79425" y1="9.4615" x2="4.8895" y2="8.73125" width="0.6096" layer="1"/>
<wire x1="4.8895" y1="8.73125" x2="6.604" y2="8.73125" width="0.6096" layer="1"/>
<wire x1="6.604" y1="8.73125" x2="7.7688625" y2="9.8961125" width="0.6096" layer="16"/>
<wire x1="7.7688625" y1="9.8961125" x2="7.7688625" y2="9.919025" width="0.6096" layer="16"/>
<wire x1="14.533" y1="11.3665" x2="14.37425" y2="11.20775" width="0.6096" layer="1"/>
<via x="11.303" y="10.7315" extent="1-16" drill="0.6"/>
<wire x1="7.7688625" y1="9.919025" x2="9.5338375" y2="11.684" width="0.6096" layer="16"/>
<wire x1="9.5338375" y1="11.684" x2="10.3505" y2="11.684" width="0.6096" layer="16"/>
<wire x1="10.3505" y1="11.684" x2="11.303" y2="10.7315" width="0.6096" layer="16"/>
<wire x1="11.303" y1="10.7315" x2="11.46175" y2="10.57275" width="0.6096" layer="1"/>
<wire x1="11.46175" y1="10.57275" x2="14.533" y2="10.57275" width="0.6096" layer="1"/>
<wire x1="16.1798" y1="14.5415" x2="14.533" y2="14.5415" width="0.6096" layer="1"/>
<wire x1="14.533" y1="14.5415" x2="14.533" y2="14.4865" width="0.6096" layer="1"/>
<wire x1="17.354921875" y1="5.512171875" x2="17.157328125" y2="5.512171875" width="0.4064" layer="1"/>
<wire x1="17.157328125" y1="5.512171875" x2="16.7005" y2="5.969" width="0.4064" layer="1"/>
<wire x1="16.7005" y1="5.969" x2="16.7005" y2="10.0965" width="0.254" layer="1"/>
<wire x1="16.7005" y1="10.0965" x2="16.22425" y2="10.57275" width="0.4064" layer="1"/>
<wire x1="16.22425" y1="10.57275" x2="14.533" y2="10.57275" width="0.4064" layer="1"/>
<polygon width="0.254" layer="16" isolate="0.2032" orphans="yes" rank="6">
<vertex x="20.574" y="13.97"/>
<vertex x="20.574" y="6.858" curve="-90"/>
<vertex x="14.224" y="0.508"/>
<vertex x="7.112" y="0.508" curve="-90"/>
<vertex x="0.762" y="6.858"/>
<vertex x="0.762" y="13.97" curve="-90"/>
<vertex x="7.112" y="20.32"/>
<vertex x="14.224" y="20.32" curve="-90"/>
</polygon>
<contactref element="JP2" pad="GND1"/>
<wire x1="14.533" y1="11.3665" x2="13.2715" y2="11.3665" width="0.6096" layer="1"/>
<wire x1="13.2715" y1="11.3665" x2="11.938" y2="12.7" width="0.6096" layer="1"/>
<wire x1="11.938" y1="12.7" x2="11.938" y2="13.159" width="0.6096" layer="1"/>
<wire x1="11.938" y1="13.159" x2="13.89925" y2="15.12025" width="0.6096" layer="1"/>
<wire x1="11.714" y1="5.494" x2="11.714" y2="6.828" width="0.4064" layer="1"/>
<wire x1="11.714" y1="6.828" x2="11.176" y2="7.366" width="0.4064" layer="1"/>
<wire x1="11.176" y1="7.366" x2="11.176" y2="10.6045" width="0.4064" layer="1"/>
<wire x1="11.176" y1="10.6045" x2="11.303" y2="10.7315" width="0.4064" layer="1"/>
</signal>
<signal name="N$4">
<contactref element="R4" pad="1"/>
<contactref element="U3" pad="2"/>
<wire x1="14.95425" y1="16.22425" x2="14.95425" y2="18.9865" width="0.3048" layer="1"/>
<wire x1="14.95425" y1="18.9865" x2="14.63675" y2="19.304" width="0.3048" layer="1"/>
<wire x1="14.63675" y1="19.304" x2="13.69925" y2="19.304" width="0.3048" layer="1"/>
<wire x1="18.6055" y1="14.1097" x2="18.6055" y2="15.58925" width="0.3048" layer="1"/>
<wire x1="18.6055" y1="15.58925" x2="18.44675" y2="15.748" width="0.3048" layer="1"/>
<wire x1="18.44675" y1="15.748" x2="15.4305" y2="15.748" width="0.3048" layer="1"/>
<wire x1="14.95425" y1="16.22425" x2="15.4305" y2="15.748" width="0.3048" layer="1"/>
</signal>
<signal name="N$5">
<contactref element="R2" pad="1"/>
<contactref element="U3" pad="1"/>
<wire x1="15.4305" y1="16.54175" x2="15.4305" y2="19.46275" width="0.3048" layer="1"/>
<wire x1="15.4305" y1="19.46275" x2="14.7955" y2="20.09775" width="0.3048" layer="1"/>
<wire x1="14.7955" y1="20.09775" x2="11.303" y2="20.09775" width="0.3048" layer="1"/>
<wire x1="11.303" y1="20.09775" x2="10.50925" y2="19.304" width="0.3048" layer="1"/>
<wire x1="10.50925" y1="19.304" x2="9.413" y2="19.304" width="0.3048" layer="1"/>
<wire x1="19.8755" y1="15.8115" x2="19.8755" y2="14.1097" width="0.3048" layer="1"/>
<wire x1="15.4305" y1="16.54175" x2="15.748" y2="16.22425" width="0.3048" layer="1"/>
<wire x1="15.748" y1="16.22425" x2="19.71675" y2="16.22425" width="0.3048" layer="1"/>
<wire x1="19.71675" y1="16.22425" x2="19.8755" y2="15.8115" width="0.3048" layer="1"/>
</signal>
<signal name="N$7">
<contactref element="U2" pad="2" route="any" routetag="U1.DI"/>
<contactref element="U3" pad="6"/>
<via x="13.51915" y="13.3096" extent="1-16" drill="0.6"/>
<wire x1="12.365059375" y1="12.11105625" x2="12.365059375" y2="12.206309375" width="0.4064" layer="16"/>
<wire x1="12.365059375" y1="12.206309375" x2="13.51915" y2="13.3096" width="0.4064" layer="16"/>
<wire x1="17.3355" y1="7.3787" x2="17.3355" y2="11.6205" width="0.3048" layer="1"/>
<wire x1="17.3355" y1="11.6205" x2="16.51" y2="12.446" width="0.3048" layer="1"/>
<wire x1="16.51" y1="12.446" x2="14.12875" y2="12.446" width="0.3048" layer="1"/>
<wire x1="14.12875" y1="12.446" x2="13.51915" y2="13.3096" width="0.3048" layer="1"/>
</signal>
<signal name="N$8">
<contactref element="R4" pad="2"/>
<contactref element="R5" pad="1"/>
<contactref element="D2" pad="C"/>
<wire x1="4.14261875" y1="3.921878125" x2="4.849725" y2="3.921878125" width="0.4064" layer="1"/>
<wire x1="4.849725" y1="3.921878125" x2="5.448671875" y2="4.520825" width="0.4064" layer="1"/>
<wire x1="5.448671875" y1="4.520825" x2="7.671175" y2="4.520825" width="0.4064" layer="1"/>
<wire x1="7.671175" y1="4.520825" x2="8.128" y2="4.064" width="0.4064" layer="1"/>
<wire x1="8.128" y1="4.064" x2="9.398" y2="4.064" width="0.4064" layer="1"/>
<wire x1="9.398" y1="4.064" x2="9.7155" y2="4.3815" width="0.4064" layer="1"/>
<wire x1="9.7155" y1="4.3815" x2="9.7155" y2="5.479" width="0.4064" layer="1"/>
<wire x1="10.3505" y1="14.06525" x2="13.04925" y2="16.764" width="0.4064" layer="1"/>
<wire x1="13.04925" y1="16.764" x2="13.04925" y2="19.304" width="0.254" layer="1"/>
<wire x1="13.04925" y1="19.304" x2="12.39925" y2="19.304" width="0.254" layer="1"/>
<wire x1="9.7005" y1="8.01775" x2="10.3505" y2="9.144" width="0.4064" layer="1"/>
<wire x1="10.3505" y1="9.144" x2="10.3505" y2="14.06525" width="0.4064" layer="1"/>
<contactref element="JP2" pad="D-1"/>
<wire x1="9.7005" y1="8.01775" x2="9.7005" y2="5.647303125" width="0.4064" layer="1"/>
<wire x1="9.7005" y1="5.647303125" x2="9.764" y2="5.494" width="0.4064" layer="1" curve="45"/>
<wire x1="9.7155" y1="5.479" x2="9.764" y2="5.494" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$9">
<contactref element="R3" pad="1"/>
<contactref element="U3" pad="3"/>
<wire x1="17.3355" y1="14.1097" x2="17.3355" y2="12.6365" width="0.4064" layer="1"/>
<wire x1="17.3355" y1="12.6365" x2="17.9705" y2="12.16025" width="0.4064" layer="1"/>
<wire x1="17.9705" y1="12.16025" x2="17.9705" y2="5.969" width="0.254" layer="1"/>
<wire x1="17.9705" y1="5.969" x2="18.44675" y2="5.49275" width="0.3048" layer="1"/>
<wire x1="18.44675" y1="5.49275" x2="18.44675" y2="4.699" width="0.3048" layer="1"/>
<wire x1="18.44675" y1="4.699" x2="17.95386875" y2="4.20611875" width="0.3048" layer="1"/>
</signal>
<signal name="N$1">
<contactref element="R1" pad="2"/>
<wire x1="8.92175" y1="8.66775" x2="8.92175" y2="5.62275" width="0.4064" layer="1"/>
<wire x1="8.92175" y1="8.66775" x2="9.55675" y2="9.62025" width="0.4064" layer="1"/>
<wire x1="9.55675" y1="9.62025" x2="9.55675" y2="17.66025" width="0.4064" layer="1"/>
<wire x1="9.613" y1="17.7165" x2="9.55675" y2="17.66025" width="0.4064" layer="1"/>
<contactref element="JP2" pad="VBUS1"/>
<wire x1="8.92175" y1="5.62275" x2="9.03015" y2="5.57785" width="0.4064" layer="1" curve="-44.999174"/>
<wire x1="9.03015" y1="5.57785" x2="9.114" y2="5.494" width="0.4064" layer="1"/>
</signal>
<signal name="N$3">
<contactref element="R3" pad="2"/>
<contactref element="D3" pad="C"/>
<wire x1="15.851271875" y1="3.921878125" x2="15.728575" y2="3.885825" width="0.4064" layer="1"/>
<wire x1="13.347325" y1="4.520825" x2="12.8905" y2="4.064" width="0.4064" layer="1"/>
<wire x1="12.8905" y1="4.064" x2="10.668" y2="4.064" width="0.4064" layer="1"/>
<wire x1="10.668" y1="4.064" x2="10.3505" y2="4.3815" width="0.4064" layer="1"/>
<wire x1="13.347325" y1="4.520825" x2="15.093575" y2="4.520825" width="0.4064" layer="1"/>
<wire x1="15.093575" y1="4.520825" x2="15.728575" y2="3.885825" width="0.4064" layer="1"/>
<wire x1="15.851271875" y1="3.921878125" x2="16.399628125" y2="3.921878125" width="0.4064" layer="1"/>
<wire x1="16.399628125" y1="3.921878125" x2="17.034628125" y2="3.286878125" width="0.4064" layer="1"/>
<contactref element="JP2" pad="D+1"/>
<wire x1="10.3505" y1="4.3815" x2="10.3505" y2="5.340696875" width="0.4064" layer="1"/>
<wire x1="10.3505" y1="5.340696875" x2="10.414" y2="5.494" width="0.4064" layer="1" curve="-45"/>
</signal>
<signal name="N$2">
<contactref element="U3" pad="5"/>
<contactref element="S1" pad="1"/>
<wire x1="16.49095" y1="1.4732" x2="5.2705" y2="1.524" width="0.4064" layer="1"/>
<wire x1="5.2705" y1="1.524" x2="2.0955" y2="4.699" width="0.4064" layer="1"/>
<wire x1="2.0955" y1="7.5565" x2="2.25425" y2="7.264" width="0.4064" layer="1"/>
<wire x1="2.0955" y1="4.699" x2="2.0955" y2="6.2865" width="0.4064" layer="1"/>
<wire x1="2.0955" y1="6.2865" x2="2.25425" y2="6.44525" width="0.4064" layer="1"/>
<wire x1="2.25425" y1="6.44525" x2="2.25425" y2="7.264" width="0.4064" layer="1"/>
<wire x1="15.90675" y1="7.21995" x2="15.90675" y2="5.334" width="0.3048" layer="1"/>
<wire x1="15.90675" y1="5.334" x2="17.9705" y2="3.27025" width="0.254" layer="1"/>
<wire x1="17.9705" y1="3.27025" x2="17.9197" y2="2.90195" width="0.254" layer="1"/>
<wire x1="17.9197" y1="2.90195" x2="16.49095" y2="1.4732" width="0.254" layer="1"/>
<wire x1="15.90675" y1="7.21995" x2="16.0655" y2="7.3787" width="0.3048" layer="1"/>
</signal>
</signals>
</board>
</drawing>
</eagle>


text:
import { AuthService } from './auth/auth.service';
import { Component } from '@angular/core';
import { User } from './auth/user';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
    selector: 'pm-app',
    templateUrl: 'app/app.component.html'
})

export class AppComponent {
    pageTitle: string = '';
    errorMessage: string;

    constructor(public _authService: AuthService, private _router: Router) {
        this._authService.getAuthenticatedUser(this.getAuthenticatedUserCallback.bind(this));
    };

    private getAuthenticatedUserCallback(user: User) {
        this._authService.setUser(user);
    }

    public logout() {
        this._authService.logout(this.loggedOut.bind(this));
    }

    loggedOut() {
        this._authService.setUser(undefined);
        this._router.navigate(['login']);
    }

}

repository: niekvandael/development-toolchain

license_type: permissive

repo_name: niekvandael/development-toolchain

branch_name: refs/heads/master

extension: ts


text:
using Newtonsoft.Json;
using Semver;
using Stx.BeatModsAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stx.BeatModsAPI
{
    [Serializable]
    public class InstalledMod : IMod
    {
        [JsonProperty("id")]
        public string Id { get; set; }
        [JsonProperty("name")]
        public string Name { get; set; }
        [JsonProperty("version")]
        public string Version { get; set; }
        [JsonProperty("gameVersion")]
        public string GameVersion { get; set; }
        public List<string> affectedFiles;
        public List<string> usedBy;
        public List<string> uses;
        public Mod.Download.File binaryFile;
        public bool preventRemoval = false;

        public InstalledMod()
        { }

        /*[Obsolete]
        public LocalMod(string id, string name, string version, Mod.Download.File binaryFile, bool preventRemoval = false)
        {
            Id = id;
            Name = name;
            Version = version;
            this.binaryFile = binaryFile;
            this.preventRemoval = preventRemoval;
            affectedFiles = new List<string>();
            usedBy = new List<string>();
            uses = new List<string>();
        }*/

        public InstalledMod(Mod mod, BeatSaberInstalledType type)
        {
            Id = mod.Id;
            Name = mod.Name;
            Version = mod.Version;
            GameVersion = mod.GameVersion;
            binaryFile = mod.GetPluginBinaryFile(type);
            preventRemoval = mod.required;
            affectedFiles = mod.GetBestDownloadFor(type).archiveFiles.Select((e) => e.file).ToList();
            usedBy = new List<string>();
            uses = new List<string>();
        }

        public string GetPluginBinaryFile()
        {
            if (Name.Equals(Mod.BSIPA, StringComparison.OrdinalIgnoreCase))
                return affectedFiles.FirstOrDefault((e) => e.Contains("IPA.exe"));
            else
                return affectedFiles
                    .Where((e) => e.EndsWith(".dll") || e.EndsWith(".exe"))
                    .OrderByDescending((e) => e.Contains("Plugins/"))
                    .ThenByDescending((e) => e.EndsWith(".dll"))
                    .FirstOrDefault();
        }

        public bool EqualsModIgnoreVersion(Mod mod, BeatSaberInstalledType type)
        {
            return string.Compare(mod.GetPluginBinaryFile(type).file, binaryFile.file) == 0;

            //return string.Compare(Name, mod.Name, StringComparison.OrdinalIgnoreCase) == 0;
        }

        public bool EqualsModExactVersion(Mod mod, BeatSaberInstalledType type)
        {
            return mod.GetPluginBinaryFile(type) == binaryFile;

            /*return string.Compare(Name, mod.Name, StringComparison.OrdinalIgnoreCase) == 0 &&
                string.Compare(Version, mod.Version, StringComparison.OrdinalIgnoreCase) == 0;*/
        }

        public static bool operator >(InstalledMod left, IMod right)
        {
            return SemVersion.Parse(left.Version) > right.Version;
        }

        public static bool operator <(InstalledMod left, IMod right)
        {
            return SemVersion.Parse(left.Version) < right.Version;
        }

        public static bool operator >=(InstalledMod left, IMod right)
        {
            return SemVersion.Parse(left.Version) >= right.Version;
        }

        public static bool operator <=(InstalledMod left, IMod right)
        {
            return SemVersion.Parse(left.Version) <= right.Version;
        }

        public override string ToString()
        {
            return $"{ Name }-{ Version }";
        }

    }
}

license: MIT

repository: CodeStix/Beat-Modder

repo_name: CodeStix/Beat-Modder

extension: cs


text:
RDEPENDS_${PN} = "python-shell"
RRECOMMENDS_${PN} += "zope-interfaces"

inherit distutils-base

require zope.inc

SRC_URI[md5sum] = "3c28888c51cc0a9e853c0f3032370bf9"
SRC_URI[sha256sum] = "6189999de3190e4b0d5110490567d9f7ef92379ea555f738fc741d49d0807be3"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD

extension: bb


text:
package types

import "github.com/orbs-network/orbs-spec/types/go/primitives"

type StateSdk interface {
	// read
	ReadBytesByAddress(ctx Context, address primitives.Ripmd160Sha256) ([]byte, error)
	ReadBytesByKey(ctx Context, key string) ([]byte, error)
	ReadStringByAddress(ctx Context, address primitives.Ripmd160Sha256) (string, error)
	ReadStringByKey(ctx Context, key string) (string, error)
	ReadUint64ByAddress(ctx Context, address primitives.Ripmd160Sha256) (uint64, error)
	ReadUint64ByKey(ctx Context, key string) (uint64, error)
	ReadUint32ByAddress(ctx Context, address primitives.Ripmd160Sha256) (uint32, error)
	ReadUint32ByKey(ctx Context, key string) (uint32, error)

	// write
	WriteBytesByAddress(ctx Context, address primitives.Ripmd160Sha256, value []byte) error
	WriteBytesByKey(ctx Context, key string, value []byte) error
	WriteStringByAddress(ctx Context, address primitives.Ripmd160Sha256, value string) error
	WriteStringByKey(ctx Context, key string, value string) error
	WriteUint64ByAddress(ctx Context, address primitives.Ripmd160Sha256, value uint64) error
	WriteUint64ByKey(ctx Context, key string, value uint64) error
	WriteUint32ByAddress(ctx Context, address primitives.Ripmd160Sha256, value uint32) error
	WriteUint32ByKey(ctx Context, key string, value uint32) error

	// clear
	ClearByAddress(ctx Context, address primitives.Ripmd160Sha256) error
	ClearByKey(ctx Context, key string) error
}

type ServiceSdk interface {
	CallMethod(ctx Context, serviceName string, methodName string) error // TODO: handle var args and return
}

repository: yonidavidson/orbs-network-go

repo_name: yonidavidson/orbs-network-go

gha_license_id: MIT

gha_language: Go

extension: go


text:
@proceedings{emnlp-2019-commonsense,
    title = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    editor = "Ostermann, Simon  and
      Zhang, Sheng  and
      Roth, Michael  and
      Clark, Peter",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6000",
}
@inproceedings{da-kasai-2019-cracking,
    title = "Cracking the Contextual Commonsense Code: Understanding Commonsense Reasoning Aptitude of Deep Contextual Representations",
    author = "Da, Jeff  and
      Kasai, Jungo",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6001",
    doi = "10.18653/v1/D19-6001",
    pages = "1--12",
}
@inproceedings{he-etal-2019-hybrid,
    title = "A Hybrid Neural Network Model for Commonsense Reasoning",
    author = "He, Pengcheng  and
      Liu, Xiaodong  and
      Chen, Weizhu  and
      Gao, Jianfeng",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6002",
    doi = "10.18653/v1/D19-6002",
    pages = "13--21",
}
@inproceedings{ma-etal-2019-towards,
    title = "Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering",
    author = "Ma, Kaixin  and
      Francis, Jonathan  and
      Lu, Quanyang  and
      Nyberg, Eric  and
      Oltramari, Alessandro",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6003",
    doi = "10.18653/v1/D19-6003",
    pages = "22--32",
}
@inproceedings{kavumba-etal-2019-choosing,
    title = "When Choosing Plausible Alternatives, Clever Hans can be Clever",
    author = "Kavumba, Pride  and
      Inoue, Naoya  and
      Heinzerling, Benjamin  and
      Singh, Keshav  and
      Reisert, Paul  and
      Inui, Kentaro",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6004",
    doi = "10.18653/v1/D19-6004",
    pages = "33--42",
}
@inproceedings{nakashole-2019-commonsense,
    title = "Commonsense about Human Senses: Labeled Data Collection Processes",
    author = "Nakashole, Ndapa",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6005",
    doi = "10.18653/v1/D19-6005",
    pages = "43--52",
}
@inproceedings{thiem-jansen-2019-extracting,
    title = "Extracting Common Inference Patterns from Semi-Structured Explanations",
    author = "Thiem, Sebastian  and
      Jansen, Peter",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6006",
    doi = "10.18653/v1/D19-6006",
    pages = "53--65",
}
@inproceedings{ostermann-etal-2019-commonsense,
    title = "Commonsense Inference in Natural Language Processing ({COIN}) - Shared Task Report",
    author = "Ostermann, Simon  and
      Zhang, Sheng  and
      Roth, Michael  and
      Clark, Peter",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6007",
    doi = "10.18653/v1/D19-6007",
    pages = "66--74",
}
@inproceedings{jain-singh-2019-karna,
    title = "{KARNA} at {COIN} Shared Task 1: Bidirectional Encoder Representations from Transformers with relational knowledge for machine comprehension with common sense",
    author = "Jain, Yash  and
      Singh, Chinmay",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6008",
    doi = "10.18653/v1/D19-6008",
    pages = "75--79",
}
@inproceedings{sharma-roychowdhury-2019-iit,
    title = "{IIT}-{KGP} at {COIN} 2019: Using pre-trained Language Models for modeling Machine Comprehension",
    author = "Sharma, Prakhar  and
      Roychowdhury, Sumegh",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6009",
    doi = "10.18653/v1/D19-6009",
    pages = "80--84",
}
@inproceedings{da-2019-jeff,
    title = "Jeff Da at {COIN} - Shared Task: {BIG} {MOOD}: Relating Transformers to Explicit Commonsense Knowledge",
    author = "Da, Jeff",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6010",
    doi = "10.18653/v1/D19-6010",
    pages = "85--92",
}
@inproceedings{li-etal-2019-pingan,
    title = "Pingan Smart Health and {SJTU} at {COIN} - Shared Task: utilizing Pre-trained Language Models and Common-sense Knowledge in Machine Reading Tasks",
    author = "Li, Xiepeng  and
      Zhang, Zhexi  and
      Zhu, Wei  and
      Li, Zheng  and
      Ni, Yuan  and
      Gao, Peng  and
      Yan, Junchi  and
      Xie, Guotong",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6011",
    doi = "10.18653/v1/D19-6011",
    pages = "93--98",
}
@inproceedings{liu-yu-2019-blcu,
    title = "{BLCU}-{NLP} at {COIN}-Shared Task1: Stagewise Fine-tuning {BERT} for Commonsense Inference in Everyday Narrations",
    author = "Liu, Chunhua  and
      Yu, Dong",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6012",
    doi = "10.18653/v1/D19-6012",
    pages = "99--103",
}
@inproceedings{huminski-etal-2019-commonsense,
    title = "Commonsense inference in human-robot communication",
    author = "Huminski, Aliaksandr  and
      Ng, Yan Bin  and
      Kwok, Kenneth  and
      Bond, Francis",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6013",
    doi = "10.18653/v1/D19-6013",
    pages = "104--112",
}
@inproceedings{kiyomaru-etal-2019-diversity,
    title = "Diversity-aware Event Prediction based on a Conditional Variational Autoencoder with Reconstruction",
    author = "Kiyomaru, Hirokazu  and
      Omura, Kazumasa  and
      Murawaki, Yugo  and
      Kawahara, Daisuke  and
      Kurohashi, Sadao",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6014",
    doi = "10.18653/v1/D19-6014",
    pages = "113--122",
}
@inproceedings{porada-etal-2019-gorilla,
    title = "Can a Gorilla Ride a Camel? Learning Semantic Plausibility from Text",
    author = "Porada, Ian  and
      Suleman, Kaheer  and
      Cheung, Jackie Chi Kit",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6015",
    doi = "10.18653/v1/D19-6015",
    pages = "123--129",
}
@inproceedings{goel-etal-2019-pre,
    title = "How Pre-trained Word Representations Capture Commonsense Physical Comparisons",
    author = "Goel, Pranav  and
      Feng, Shi  and
      Boyd-Graber, Jordan",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6016",
    doi = "10.18653/v1/D19-6016",
    pages = "130--135",
}

repository: emorynlp/nlprankings

repo_name: emorynlp/nlprankings

gha_license_id: NOASSERTION

gha_language: TeX

extension: bib


text:
@InProceedings{meier12,
  title = {Movement Segmentation and Recognition for Imitation Learning},
  author = {Franziska Meier and Evangelos Theodorou and Stefan Schaal},
  pages = {761--769},
  abstract = {In human movement learning, it is most common to teach constituent elements of complex movements in isolation, before chaining them into complex movements. Segmentation and recognition of observed movement could thus proceed out of this existing knowledge, which is directly compatible with movement generation. In this paper, we address exactly this scenario. We assume that a library of movement primitives has already been taught, and we wish to identify elements of the library in a complex motor act, where the individual elements have been smoothed together, and, occasionally, there might be a movement segment that is not in our library yet. We employ a flexible machine learning representation of movement primitives based on learnable nonlinear attractor system. For the purpose of movement segmentation and recognition, it is possible to reformulate this representation as a controlled linear dynamical system.  An Expectation-Maximization algorithm can be developed to estimate the open parameters of a movement primitive from the library, using as input an observed trajectory piece. If no matching primitive from the library can be found, a new primitive is created. This process allows a straightforward sequential segmentation of observed movement into known and new primitives, which are suitable for robot imitation learning. We illustrate our approach with synthetic examples and data collected from human movement.},
  pdf = {http://jmlr.org/proceedings/papers/v22/meier12/meier12.pdf},
}

repository: mreid/papersite

repo_name: mreid/papersite


text:
package buildexpression

import (
	"encoding/json"
	"errors"
	"fmt"
	"sort"
	"strings"
	"time"

	"github.com/ActiveState/cli/internal/errs"
	"github.com/ActiveState/cli/internal/locale"
	"github.com/ActiveState/cli/internal/logging"
	"github.com/ActiveState/cli/internal/multilog"
	"github.com/ActiveState/cli/internal/rtutils/ptr"
	"github.com/ActiveState/cli/internal/sliceutils"
	"github.com/ActiveState/cli/pkg/platform/api/buildplanner/model"
	"github.com/go-openapi/strfmt"
)

const (
	SolveFuncName                     = "solve"
	SolveLegacyFuncName               = "solve_legacy"
	RequirementsKey                   = "requirements"
	PlatformsKey                      = "platforms"
	AtTimeKey                         = "at_time"
	RequirementNameKey                = "name"
	RequirementNamespaceKey           = "namespace"
	RequirementVersionRequirementsKey = "version_requirements"
	RequirementVersionKey             = "version"
	RequirementComparatorKey          = "comparator"

	ctxLet         = "let"
	ctxIn          = "in"
	ctxAp          = "ap"
	ctxValue       = "value"
	ctxAssignments = "assignments"
	ctxIsAp        = "isAp"
)

var funcNodeNotFoundError = errors.New("Could not find function node")

type BuildExpression struct {
	Let         *Let
	Assignments []*Value
}

type Let struct {
	// Let statements can be nested.
	// Each let will contain its own assignments and an in statement.
	Let         *Let
	Assignments []*Var
	In          *In
}

type Var struct {
	Name  string
	Value *Value
}

type Value struct {
	Ap    *Ap
	List  *[]*Value
	Str   *string
	Null  *Null
	Float *float64

	Assignment *Var
	Object     *[]*Var
	Ident      *string
}

type Null struct {
	Null string
}

type Ap struct {
	Name      string
	Arguments []*Value
}

type In struct {
	FuncCall *Ap
	Name     *string
}

// NewBuildExpression creates a BuildExpression from a JSON byte array.
// The JSON must be a valid BuildExpression in the following format:
//
//	{
//	  "let": {
//	    "runtime": {
//	      "solve_legacy": {
//	        "at_time": "2023-04-27T17:30:05.999000Z",
//	        "build_flags": [],
//	        "camel_flags": [],
//	        "platforms": [
//	          "96b7e6f2-bebf-564c-bc1c-f04482398f38"
//	        ],
//	        "requirements": [
//	          {
//	            "name": "requests",
//	            "namespace": "language/python"
//	          },
//	          {
//	            "name": "python",
//	            "namespace": "language",
//	            "version_requirements": [
//	              {
//	                "comparator": "eq",
//	                "version": "3.10.10"
//	              }
//	            ]
//	          },
//	        ],
//	        "solver_version": null
//	      }
//	    },
//	  "in": "$runtime"
//	  }
//	}
func New(data []byte) (*BuildExpression, error) {
	rawBuildExpression := make(map[string]interface{})
	err := json.Unmarshal(data, &rawBuildExpression)
	if err != nil {
		return nil, errs.Wrap(err, "Could not unmarshal build expression")
	}

	if len(rawBuildExpression) != 1 {
		return nil, errs.New("Build expression must have exactly one key")
	}

	expr := &BuildExpression{}
	var path []string
	for key, value := range rawBuildExpression {
		switch v := value.(type) {
		case map[string]interface{}:
			// At this level the key must either be a let, an ap, or an assignment.
			if key == "let" {
				let, err := newLet(path, v)
				if err != nil {
					return nil, errs.Wrap(err, "Could not parse 'let' key")
				}

				expr.Let = let
			} else if isAp(path, v) {
				ap, err := newAp(path, v)
				if err != nil {
					return nil, errs.Wrap(err, "Could not parse '%s' key", key)
				}

				expr.Assignments = append(expr.Assignments, &Value{Ap: ap})
			} else {
				assignments, err := newAssignments(path, v)
				if err != nil {
					return nil, errs.Wrap(err, "Could not parse assignments")
				}

				expr.Assignments = append(expr.Assignments, &Value{Assignment: &Var{Name: key, Value: &Value{Object: &assignments}}})
			}
		default:
			return nil, errs.New("Build expression's value must be a map[string]interface{}")
		}
	}

	err = expr.validateRequirements()
	if err != nil {
		return nil, errs.Wrap(err, "Could not validate requirements")
	}

	return expr, nil
}

func newLet(path []string, m map[string]interface{}) (*Let, error) {
	path = append(path, ctxLet)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	inValue, ok := m["in"]
	if !ok {
		return nil, errs.New("Build expression's 'let' object has no 'in' key")
	}

	in, err := newIn(path, inValue)
	if err != nil {
		return nil, errs.Wrap(err, "Could not parse 'in' key's value: %v", inValue)
	}

	// Delete in so it doesn't get parsed as an assignment.
	delete(m, "in")

	result := &Let{In: in}
	let, ok := m["let"]
	if ok {
		letMap, ok := let.(map[string]interface{})
		if !ok {
			return nil, errs.New("'let' key's value is not a map[string]interface{}")
		}

		l, err := newLet(path, letMap)
		if err != nil {
			return nil, errs.Wrap(err, "Could not parse 'let' key")
		}
		result.Let = l

		// Delete let so it doesn't get parsed as an assignment.
		delete(m, "let")
	}

	assignments, err := newAssignments(path, m)
	if err != nil {
		return nil, errs.Wrap(err, "Could not parse assignments")
	}

	result.Assignments = assignments
	return result, nil
}

func isAp(path []string, value map[string]interface{}) bool {
	path = append(path, ctxIsAp)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	_, hasIn := value["in"]
	if hasIn && !sliceutils.Contains(path, ctxAssignments) {
		return false
	}

	return true
}

func newValue(path []string, valueInterface interface{}) (*Value, error) {
	path = append(path, ctxValue)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	value := &Value{}

	switch v := valueInterface.(type) {
	case map[string]interface{}:
		// Examine keys first to see if this is a function call.
		for key, val := range v {
			if _, ok := val.(map[string]interface{}); !ok {
				continue
			}

			// If the length of the value is greater than 1,
			// then it's not a function call. It's an object
			// and will be set as such outside the loop.
			if len(v) > 1 {
				continue
			}

			if isAp(path, val.(map[string]interface{})) {
				f, err := newAp(path, v)
				if err != nil {
					return nil, errs.Wrap(err, "Could not parse '%s' function's value: %v", key, v)
				}
				value.Ap = f
			}
		}

		if value.Ap == nil {
			// It's not a function call, but an object.
			object, err := newAssignments(path, v)
			if err != nil {
				return nil, errs.Wrap(err, "Could not parse object: %v", v)
			}
			value.Object = &object
		}

	case []interface{}:
		values := []*Value{}
		for _, item := range v {
			value, err := newValue(path, item)
			if err != nil {
				return nil, errs.Wrap(err, "Could not parse list: %v", v)
			}
			values = append(values, value)
		}
		value.List = &values

	case string:
		if sliceutils.Contains(path, ctxIn) {
			value.Ident = &v
		} else {
			value.Str = ptr.To(v)
		}

	case float64:
		value.Float = ptr.To(v)

	default:
		logging.Debug("Unknown type: %T at path %s", v, strings.Join(path, "."))
		// An empty value is interpreted as JSON null.
		value.Null = &Null{}
	}

	return value, nil
}

func newAp(path []string, m map[string]interface{}) (*Ap, error) {
	path = append(path, ctxAp)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	// m is a mapping of function name to arguments. There should only be one
	// set of arugments. Since the arguments are key-value pairs, it should be
	// a map[string]interface{}.
	if len(m) > 1 {
		return nil, errs.New("Function call has more than one argument mapping")
	}

	// Look in the given object for the function's name and argument mapping.
	var name string
	var argsInterface interface{}
	for key, value := range m {
		_, ok := value.(map[string]interface{})
		if !ok {
			return nil, errs.New("Incorrect argument format")
		}

		name = key
		argsInterface = value
	}

	args := []*Value{}

	switch v := argsInterface.(type) {
	case map[string]interface{}:
		for key, valueInterface := range v {
			value, err := newValue(path, valueInterface)
			if err != nil {
				return nil, errs.Wrap(err, "Could not parse '%s' function's argument '%s': %v", name, key, valueInterface)
			}
			args = append(args, &Value{Assignment: &Var{Name: key, Value: value}})
		}
		sort.SliceStable(args, func(i, j int) bool { return args[i].Assignment.Name < args[j].Assignment.Name })

	case []interface{}:
		for _, item := range v {
			value, err := newValue(path, item)
			if err != nil {
				return nil, errs.Wrap(err, "Could not parse '%s' function's argument list item: %v", name, item)
			}
			args = append(args, value)
		}

	default:
		return nil, errs.New("Function '%s' expected to be object or list", name)
	}

	return &Ap{Name: name, Arguments: args}, nil
}

func newAssignments(path []string, m map[string]interface{}) ([]*Var, error) {
	path = append(path, ctxAssignments)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	assignments := []*Var{}
	for key, valueInterface := range m {
		value, err := newValue(path, valueInterface)
		if err != nil {
			return nil, errs.Wrap(err, "Could not parse '%s' key's value: %v", key, valueInterface)
		}
		assignments = append(assignments, &Var{Name: key, Value: value})

	}
	sort.SliceStable(assignments, func(i, j int) bool {
		return assignments[i].Name < assignments[j].Name
	})
	return assignments, nil
}

func newIn(path []string, inValue interface{}) (*In, error) {
	path = append(path, ctxIn)
	defer func() {
		_, _, err := sliceutils.Pop(path)
		if err != nil {
			multilog.Error("Could not pop context: %v", err)
		}
	}()

	in := &In{}

	switch v := inValue.(type) {
	case map[string]interface{}:
		f, err := newAp(path, v)
		if err != nil {
			return nil, errs.Wrap(err, "'in' object is not a function call")
		}
		in.FuncCall = f

	case string:
		in.Name = ptr.To(strings.TrimPrefix(v, "$"))

	default:
		return nil, errs.New("'in' value expected to be a function call or string")
	}

	return in, nil
}

// validateRequirements ensures that the requirements in the BuildExpression contain
// both the name and namespace fields. These fileds are used for requirement operations.
func (e *BuildExpression) validateRequirements() error {
	requirements, err := e.getRequirementsNode()
	if err != nil {
		return errs.Wrap(err, "Could not get requirements node")
	}

	for _, r := range requirements {
		if r.Object == nil {
			continue
		}

		// The requirement object needs to have a name and value field.
		// The value can be a string (in the case of name or namespace)
		// or a list (in the case of version requirements).
		for _, o := range *r.Object {
			if o.Name == "" {
				return errs.New("Requirement object missing name field")
			}

			if o.Value == nil {
				return errs.New("Requirement object missing value field")
			}

			if o.Name == RequirementNameKey || o.Name == RequirementNamespaceKey {
				if o.Value.Str == nil {
					return errs.New("Requirement object value is not set to a string")
				}
			}

			if o.Name == RequirementVersionRequirementsKey {
				if o.Value.List == nil {
					return errs.New("Requirement object value is not set to a list")
				}
			}
		}
	}
	return nil
}

// Requirements returns the requirements in the BuildExpression.
// It returns an error if the requirements are not found or if they are malformed.
// It expects the JSON representation of the solve node to be formatted as follows:
//
//	{
//	  "requirements": [
//	    {
//	      "name": "requests",
//	      "namespace": "language/python"
//	    },
//	    {
//	      "name": "python",
//	      "namespace": "language",
//	      "version_requirements": [{
//	          "comparator": "eq",
//	          "version": "3.10.10"
//	      }]
//	    }
//	  ]
//	}
func (e *BuildExpression) Requirements() ([]model.Requirement, error) {
	requirementsNode, err := e.getRequirementsNode()
	if err != nil {
		return nil, errs.Wrap(err, "Could not get requirements node")
	}

	var requirements []model.Requirement
	for _, r := range requirementsNode {
		if r.Object == nil {
			continue
		}

		var req model.Requirement
		for _, o := range *r.Object {
			if o.Name == RequirementNameKey {
				req.Name = *o.Value.Str
			}

			if o.Name == RequirementNamespaceKey {
				req.Namespace = *o.Value.Str
			}

			if o.Name == RequirementVersionRequirementsKey {
				req.VersionRequirement = getVersionRequirements(o.Value.List)
			}
		}
		requirements = append(requirements, req)
	}

	return requirements, nil
}

func (e *BuildExpression) getRequirementsNode() ([]*Value, error) {
	solveAp, err := e.getSolveNode()
	if err != nil {
		return nil, errs.Wrap(err, "Could not get solve node")
	}

	var reqs []*Value
	for _, arg := range solveAp.Arguments {
		if arg.Assignment == nil {
			continue
		}

		if arg.Assignment.Name == RequirementsKey && arg.Assignment.Value != nil {
			reqs = *arg.Assignment.Value.List
		}
	}

	return reqs, nil
}

func getVersionRequirements(v *[]*Value) []model.VersionRequirement {
	var reqs []model.VersionRequirement

	if v == nil {
		return reqs
	}

	for _, r := range *v {
		if r.Object == nil {
			continue
		}

		versionReq := make(model.VersionRequirement)
		for _, o := range *r.Object {
			if o.Name == RequirementComparatorKey {
				versionReq[RequirementComparatorKey] = *o.Value.Str
			}

			if o.Name == RequirementVersionKey {
				versionReq[RequirementVersionKey] = *o.Value.Str
			}
		}
		reqs = append(reqs, versionReq)
	}
	return reqs
}

// getSolveNode returns the solve node from the build expression.
// It returns an error if the solve node is not found.
// Currently, the solve node can have the name of "solve" or "solve_legacy".
// It expects the JSON representation of the build expression to be formatted as follows:
//
//	{
//	  "let": {
//	    "runtime": {
//	      "solve": {
//	      }
//	    }
//	  }
//	}
func (e *BuildExpression) getSolveNode() (*Ap, error) {
	// First, try to find the solve node via lets.
	if e.Let != nil {
		solveAp, err := recurseLets(e.Let)
		if err != nil {
			return nil, errs.Wrap(err, "Could not recurse lets")
		}

		return solveAp, nil
	}

	// Search for solve node in the top level assignments.
	for _, a := range e.Assignments {
		if a.Assignment == nil {
			continue
		}

		if a.Assignment.Name == "" || a.Assignment.Name != "runtime" {
			continue
		}

		if a.Assignment.Value == nil {
			continue
		}

		if a.Assignment.Value.Ap == nil {
			continue
		}

		if a.Assignment.Value.Ap.Name == SolveFuncName || a.Assignment.Value.Ap.Name == SolveLegacyFuncName {
			return a.Assignment.Value.Ap, nil
		}
	}

	return nil, funcNodeNotFoundError
}

// recurseLets recursively searches for the solve node in the let statements.
// The solve node is specified by the name "runtime" and the function name "solve"
// or "solve_legacy".
func recurseLets(let *Let) (*Ap, error) {
	for _, a := range let.Assignments {
		if a.Value == nil {
			continue
		}

		if a.Value.Ap == nil {
			continue
		}

		if a.Name == "" || a.Name != "runtime" {
			continue
		}

		if a.Value.Ap.Name == SolveFuncName || a.Value.Ap.Name == SolveLegacyFuncName {
			return a.Value.Ap, nil
		}
	}

	// The highest level solve node is not found, so recurse into the next let.
	if let.Let != nil {
		return recurseLets(let.Let)
	}

	return nil, funcNodeNotFoundError
}

func (e *BuildExpression) getSolveNodeArguments() ([]*Value, error) {
	solveAp, err := e.getSolveNode()
	if err != nil {
		return nil, errs.Wrap(err, "Could not get solve node")
	}

	return solveAp.Arguments, nil
}

func (e *BuildExpression) getPlatformsNode() (*[]*Value, error) {
	solveAp, err := e.getSolveNode()
	if err != nil {
		return nil, errs.Wrap(err, "Could not get solve node")
	}

	for _, arg := range solveAp.Arguments {
		if arg.Assignment == nil {
			continue
		}

		if arg.Assignment.Name == PlatformsKey && arg.Assignment.Value != nil {
			return arg.Assignment.Value.List, nil
		}
	}

	return nil, errs.New("Could not find platforms node")
}

// Update updates the BuildExpression's requirements based on the operation and requirement.
func (e *BuildExpression) UpdateRequirement(operation model.Operation, requirement model.Requirement) error {
	var err error
	switch operation {
	case model.OperationAdded:
		err = e.addRequirement(requirement)
	case model.OperationRemoved:
		err = e.removeRequirement(requirement)
	case model.OperationUpdated:
		err = e.removeRequirement(requirement)
		if err != nil {
			break
		}
		err = e.addRequirement(requirement)
	default:
		return errs.New("Unsupported operation")
	}
	if err != nil {
		return errs.Wrap(err, "Could not update BuildExpression's requirements")
	}

	return nil
}

func (e *BuildExpression) addRequirement(requirement model.Requirement) error {
	obj := []*Var{
		{Name: RequirementNameKey, Value: &Value{Str: ptr.To(requirement.Name)}},
		{Name: RequirementNamespaceKey, Value: &Value{Str: ptr.To(requirement.Namespace)}},
	}

	if requirement.VersionRequirement != nil {
		for _, r := range requirement.VersionRequirement {
			obj = append(obj, &Var{Name: RequirementVersionRequirementsKey, Value: &Value{List: &[]*Value{
				{Object: &[]*Var{
					{Name: RequirementComparatorKey, Value: &Value{Str: ptr.To(r[RequirementComparatorKey])}},
					{Name: RequirementVersionKey, Value: &Value{Str: ptr.To(r[RequirementVersionKey])}},
				}}},
			}})
		}
	}

	requirementsNode, err := e.getRequirementsNode()
	if err != nil {
		return errs.Wrap(err, "Could not get requirements node")
	}

	requirementsNode = append(requirementsNode, &Value{Object: &obj})

	arguments, err := e.getSolveNodeArguments()
	if err != nil {
		return errs.Wrap(err, "Could not get solve node arguments")
	}

	for _, arg := range arguments {
		if arg.Assignment == nil {
			continue
		}

		if arg.Assignment.Name == RequirementsKey {
			arg.Assignment.Value.List = &requirementsNode
		}
	}

	return nil
}

func (e *BuildExpression) removeRequirement(requirement model.Requirement) error {
	requirementsNode, err := e.getRequirementsNode()
	if err != nil {
		return errs.Wrap(err, "Could not get requirements node")
	}

	var found bool
	for i, r := range requirementsNode {
		if r.Object == nil {
			continue
		}

		for _, o := range *r.Object {
			if o.Name == RequirementNameKey && *o.Value.Str == requirement.Name {
				requirementsNode = append(requirementsNode[:i], requirementsNode[i+1:]...)
				found = true
				break
			}
		}
	}

	if !found {
		return locale.NewInputError("err_remove_requirement_not_found", "Could not remove requirement '[ACTIONABLE]{{.V0}}[/RESET]', because it does not exist.", requirement.Name)
	}

	solveNode, err := e.getSolveNode()
	if err != nil {
		return errs.Wrap(err, "Could not get solve node")
	}

	for _, arg := range solveNode.Arguments {
		if arg.Assignment == nil {
			continue
		}

		if arg.Assignment.Name == RequirementsKey {
			arg.Assignment.Value.List = &requirementsNode
		}
	}

	return nil
}

func (e *BuildExpression) UpdatePlatform(operation model.Operation, platformID strfmt.UUID) error {
	var err error
	switch operation {
	case model.OperationAdded:
		err = e.addPlatform(platformID)
	case model.OperationRemoved:
		err = e.removePlatform(platformID)
	default:
		return errs.New("Unsupported operation")
	}
	if err != nil {
		return errs.Wrap(err, "Could not update BuildExpression's platform")
	}

	return nil
}

func (e *BuildExpression) addPlatform(platformID strfmt.UUID) error {
	platformsNode, err := e.getPlatformsNode()
	if err != nil {
		return errs.Wrap(err, "Could not get platforms node")
	}

	*platformsNode = append(*platformsNode, &Value{Str: ptr.To(platformID.String())})

	return nil
}

func (e *BuildExpression) removePlatform(platformID strfmt.UUID) error {
	platformsNode, err := e.getPlatformsNode()
	if err != nil {
		return errs.Wrap(err, "Could not get platforms node")
	}

	var found bool
	for i, p := range *platformsNode {
		if p.Str == nil {
			continue
		}

		if *p.Str == platformID.String() {
			*platformsNode = append((*platformsNode)[:i], (*platformsNode)[i+1:]...)
			found = true
			break
		}
	}

	if !found {
		return errs.New("Could not find platform")
	}

	return nil
}

func (e *BuildExpression) UpdateTimestamp(timestamp strfmt.DateTime) error {
	formatted, err := time.Parse(time.RFC3339, timestamp.String())
	if err != nil {
		return errs.Wrap(err, "Could not parse latest timestamp")
	}

	solveNode, err := e.getSolveNode()
	if err != nil {
		return errs.Wrap(err, "Could not get solve node")
	}

	for _, arg := range solveNode.Arguments {
		if arg.Assignment == nil {
			continue
		}

		if arg.Assignment.Name == "at_time" {
			arg.Assignment.Value.Str = ptr.To(formatted.Format(time.RFC3339))
		}
	}

	return nil
}

func (e *BuildExpression) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})

	if e.Let != nil {
		m["let"] = e.Let
	}

	for _, value := range e.Assignments {
		if value.Assignment == nil {
			continue
		}

		m[value.Assignment.Name] = value
	}

	return json.Marshal(m)
}

func (l *Let) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})

	if l.Let != nil {
		m["let"] = l.Let
	}

	for _, v := range l.Assignments {
		if v.Value == nil {
			continue
		}

		m[v.Name] = v.Value
	}

	m["in"] = l.In

	return json.Marshal(m)
}

func (a *Var) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})
	m[a.Name] = a.Value
	return json.Marshal(m)
}

func (v *Value) MarshalJSON() ([]byte, error) {
	switch {
	case v.Ap != nil:
		return json.Marshal(v.Ap)
	case v.List != nil:
		return json.Marshal(v.List)
	case v.Str != nil:
		return json.Marshal(strings.Trim(*v.Str, `"`))
	case v.Null != nil:
		return json.Marshal(nil)
	case v.Assignment != nil:
		return json.Marshal(v.Assignment)
	case v.Float != nil:
		return json.Marshal(*v.Float)
	case v.Object != nil:
		m := make(map[string]interface{})
		for _, assignment := range *v.Object {
			m[assignment.Name] = assignment.Value
		}
		return json.Marshal(m)
	case v.Ident != nil:
		return json.Marshal(v.Ident)
	}
	return json.Marshal([]*Value{})
}

func (f *Ap) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})
	args := make(map[string]interface{})
	for _, argument := range f.Arguments {
		switch {
		case argument.Assignment != nil:
			args[argument.Assignment.Name] = argument.Assignment.Value
		default:
			return nil, fmt.Errorf("Cannot marshal %v (arg %v)", f, argument)
		}
	}
	m[f.Name] = args
	return json.Marshal(m)
}

func (i *In) MarshalJSON() ([]byte, error) {
	switch {
	case i.FuncCall != nil:
		return json.Marshal(i.FuncCall)
	case i.Name != nil:
		return json.Marshal("$" + *i.Name)
	}
	return nil, fmt.Errorf("Cannot marshal %v", i)
}

repository: ActiveState/cli

repo_name: ActiveState/cli


text:
using Xunit;

namespace JsonApiDotNetCoreMongoDbTests.IntegrationTests.AtomicOperations;

[CollectionDefinition("AtomicOperationsFixture")]
public sealed class AtomicOperationsTestCollection : ICollectionFixture<AtomicOperationsFixture>
{
    // Starting MongoDB in Single Node Replica Set mode is required to enable transactions.
    // Starting in this mode requires about 10 seconds, which is normally repeated for each test class.
    // So to improve test runtime performance, we reuse a single MongoDB instance for all atomic:operations tests.
}

gha_language: C#