text:
.modal-dialog h1,
.modal-dialog h2,
.modal-dialog h3,
.modal-dialog h4,
.modal-dialogh5,
.modal-dialog h6,
.modal-dialog p {
    color: black;
}

.toolbar-icon {
    cursor: pointer;
    font-size: large;
    padding-top: 6px;
}

.control-label-compact {
    padding: 7px 2px;
    font-size: small;
    text-align: right;
}

.tableView table {
    border-bottom: 1px solid #d5d5d5;
    border-right: 1px solid #d5d5d5;
    margin-bottom: 0;
    /*table-layout: fixed;*/
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.tableView td,
.tableView th {
    /*border-left: 1px solid #d5d5d5;*/
    /*border-top: 1px solid #d5d5d5;*/
    /*text-align: right;*/
    white-space: nowrap;
    font-weight: normal;
    font-size: 10px;
    padding: 3px 0px;
}

.tableView th {
    font-size: 10px;
    /*font-weight: normal;*/
    /*padding: 3px 9px 3px 4px;*/
}

.tableView .table {
    font-weight: normal;
    font-size: 10px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}

.tableView table th.row {
    border-top: 1px solid #d5d5d5;
    white-space: nowrap;
    text-align: center;
}
.tableView table td.data, .tableView table th.header_key {
    border-left: 1px solid #d5d5d5;
    border-top: 1px solid #d5d5d5;
    text-align: center;
    white-space: nowrap;
}

.tableView .header_key {
    font-weight: bold;
}

.tableView table th.header_empty {
    border-left: none;
    border-top: none;
    background: none;
}
.tableView table th {
    background: #f9f9f9;
    border-left: 1px solid #d5d5d5;
}
.tableView th.col {
    border-top: 1px solid #d5d5d5;
}
.tableView th.all_null{
    background:none;
    border:0;
}
.tableView th.row_null{
    border-left: 1px solid #d5d5d5;
}
.tableView th.col_null{
    border-left: 0px;
    border-top: 1px solid #d5d5d5;
}
.tableView .table_drill_cell {
    color: royalblue;
    cursor: url(../imgs/right_click.png), auto;
}
.table_drill_cell:hover {
    background-color: #999;
    color: white !important;
}
.ui-select-choices-group{
    z-index: 1000;
}

/* Style for widget type switch */
.chart-type-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-repeat: no-repeat;
    background-position: 0 0;

}
.cLine{  background-image: url(../imgs/line-active.png);  }
.cLine.disabled{background-image: url(imgs/line.png); }
/*.cBar{  background-image: url(../imgs/bar-active.png);  }*/
/*.cBar.disabled{background-image: url(../imgs/bar.png);  }*/
.cScatter{  background-image: url(../imgs/scatter-active.png);  }
.cScatter.disabled{  background-image: url(../imgs/scatter.png);  }
.cPie{  background-image: url(../imgs/pie-active.png);  }
.cPie.disabled{  background-image: url(../imgs/pie.png);  }
.cFunnel{  background-image: url(../imgs/funnel-active.png);  }
.cFunnel.disabled{  background-image: url(../imgs/funnel.png);  }

.cKpi{  background-image: url(../imgs/kpi-active.png);  }
.cKpi.disabled{  background-image: url(../imgs/kpi.png);  }
.cSankey{  background-image: url(../imgs/sankey-active.png);  }
.cSankey.disabled{  background-image: url(../imgs/sankey.png);  }
.cRadar{  background-image: url(../imgs/radar-active.png);  }
.cRadar.disabled{  background-image: url(../imgs/radar.png);  }
.cTable{  background-image: url(../imgs/table-active.png);  }
.cTable.disabled{  background-image: url(../imgs/table.png);  }
.cMap{  background-image: url(../imgs/map-active.png);  }
.cMap.disabled{  background-image: url(../imgs/map.png);  }

.chart-type a.active{
    background-color: #FFF;
    box-shadow: 0 0 0 2px rgba(81,130,227,.06),inset 0 0 0 2px rgba(81,129,228,.6);
}
.chart-type a {
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 4px 4px 0;
    cursor: pointer;
}
.chart-type a.active:hover {
    background-color: rgba(179, 180, 182, 0.64);
}
.chart-tip{
    position: absolute;
    top: 45px;
    /*left: 0;*/
    padding: 12px 16px;
    line-height: 14px;
    white-space: nowrap;
    z-index: 1001;
    display: none;

    background-color: #FFF;
    box-shadow: 0 0 6px 0 rgba(0,0,0,.1),0 10px 12px 0 rgba(170,182,206,.36);
}
.chart-tip .arrow{
    border-style: dotted dotted solid;
    border-width: 10px;
    border-color: transparent transparent rgba(226, 231, 238, 0.55);
    top: -20px;
    position: absolute;
}
.tooltip-title{
    width: 100%;
    line-height: 1.6;
    font-size: 12px;
    letter-spacing: 0;
    font-weight: 700;
}
.chart-tip span {
    display: block;
}

#preview_widget {
    text-align: center;
}
.d3-tip {
    line-height: 1;
    font-weight: normal;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 3px;
    z-index: 10000;
}

/* Creates a small triangle extender for the tooltip */
.d3-tip:after {
    box-sizing: border-box;
    display: inline;
    font-size: 10px;
    width: 100%;
    line-height: 1;
    color: rgba(0, 0, 0, 0.8);
    content: "\25BC";
    position: absolute;
    text-align: center;
}

.d3-tip.n:after {
    margin: -1px 0 0 0;
    top: 100%;
    left: 0;
}
.page {
    margin: 10px auto;
    width: 60%;
    overflow: auto;
    padding: 0 5px 5px 0;
    float: right;
}
.page>ul {
    margin: 10px auto;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: auto;
    float: right;
}
.page li {
    list-style: none;
    padding: 0;
    margin: 0;
    float: left;
    cursor: pointer;
}
a.pageLink, a.nextLink, a.previewLink {
    float: left;
    color: #666;
    font-size: 14px;
    line-height: 24px;
    font-weight: normal;
    text-align: center;
    border: 1px solid #BBB;
    width: 30px;
    margin: 0 5px 0 0;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
a.pageLink:hover, a.nextLink:hover, a.previewLink:hover {
    background-color: #585858;
    color: white !important;
}
a.current {
    background-color: #ccc;
}
a.nextLink, a.previewLink{
    width: 80px;
}
a.hide{
    display: none;
}

span.ellipse {
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-weight: bold;
    cursor: default;
    float: left;
    color: #666;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    min-width: 14px;
    padding: 0 7px;
    margin: 0 5px 0 0;
}
.optionNum {
    float: left;
    height: 26px;
    width: 200px;
    margin: 7px 20px 0 0;
}
.optionNum select {
    margin: 0 6px 0 6px;
    width: 60px;
    height: 26px;
}
.header_key {
    font-weight: bold;
}
.toolbar {
    width: 99%;
    height: 30px;
    margin: 0 0 10px 0;
    box-shadow: 1px 1px 5px #ccc;
    background-color: #F9F9F9;
}
.info {
    display: inline-block;
    float: left;
    margin: 4px 0 0 5px;
}
.exportBnt, .drillUp, .drillDown{
    margin:7px 5px 10px 5px;
    float: right;
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.drillUp{
    background: url("../imgs/drillup.png");
    background-size: cover;
}
.drillDown{
    background: url("../imgs/drilldown.svg");
    background-size: cover;
}
.exportBnt{
    background: url("../imgs/excel.svg");
    background-size: cover;
}
div.operateBox {
    position: relative;
}
div.newBoard {
    position: absolute;
    top: 20px;
    right: -160px;
    background: #fff;
    box-shadow: 1px 1px 5px #ccc;
    z-index: 100;
}
div.newBoard span {
    display: block;
    width: 160px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    font-weight: normal;
}
.hideOperate {
    display: none;
}
div.newBoard span:hover{
    font-weight: bold;
}
span.returnIcon {
    display: inline-block;
    float: right;
    cursor: pointer;
}
.layoutPanel{
    position: relative;
    /*background: url("../../imgs/layout.svg") 50% 50% no-repeat;*/
}
.drag-preview {
    border: 2px dashed grey;
    position: absolute;
    -webkit-transition: all .3s linear;
    transition: all .3s linear;
}
.chart_item {
    position: absolute;
    overflow: hidden;
    -webkit-transition: all .3s linear;
    transition: all .3s linear;
}
.chart_widget {
    width: 100%;
    height: 100%;
    margin-top: 30px;
    border: 1px solid #ccc;
    transition: all .3s linear;
    -webkit-transition: all .3s linear;
}
.chart_item:hover .menu-bar{
    display: block;
    top: 0;
    transition: all .3s linear;
    -webkit-transition: all .3s linear;
}
.box-header.toolbar {
    height: 30px;
    width: 100%;
    background: #fff;
}
.toolbar .opt {
    top: 5px;
    right: 30px;
    float: right;
    position: relative;
}

.toolbar .opt .u-icn {
    cursor: pointer;
    font-size: 16px;
    color: #999;
}
.menu-bar {
    width: 100%;
    height: 30px;
    background-color: #4c4c4c;
    position: absolute;
    top: 30px;
    left: 0;
    display: none;
    transition: all .3s linear;
    z-index: 100;
    cursor: move;
}

.u-icn, .u-icn-active {
    display: inline-block;
    font-size: 1em;
    line-height: 1;
    font-family: bigviz;
    vertical-align: middle;
}

.toolbar .line {
    /*display: inline-block;*/
    /*margin: 0 10px;*/
    /*width: 1px;*/
    /*height: 20px;*/
    /*background: #ddd;*/
    /*vertical-align: middle;*/
}

.toolbar .autoSave {
    display: inline-block;
    margin-left: 6px;
}

treecontrol {
    /* prevent user selection */
    -moz-user-select: -moz-none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;

    /* default */
    font-family: Verdana, Helvetica, Arial, sans-serif;
    font-size:13px;
    color: #555;
    text-decoration: none;
}

treecontrol ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
    overflow: hidden;
}

treecontrol li {
    position: relative;
    padding: 0 0 0 20px;
    line-height: 20px;
}

treecontrol li.tree-expanded i.tree-leaf-head, treecontrol li.tree-collapsed i.tree-leaf-head {display:none;}
treecontrol li.tree-expanded i.tree-branch-head, treecontrol li.tree-collapsed i.tree-branch-head {display:inline;}
treecontrol li.tree-leaf i.tree-branch-head {display:none;}
treecontrol li.tree-leaf i.tree-leaf-head {display:inline;}

treecontrol li i.tree-branch-head {
    cursor: pointer;
}

treecontrol li .tree-label {
    cursor: pointer;
    display: inline-block;
    width: 200px;
    height: 35px;
    z-index: 10;
    line-height: 35px;
}
treecontrol li .tree-label span{
    cursor: pointer;
    display: inline-block;
    width: 100%;
    height: 35px;
    z-index: 10;
    line-height: 35px;
}
treecontrol li .tree-unselectable {
    cursor: not-allowed;
}

treecontrol.tree-classic li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/folder.png") no-repeat;
}

treecontrol.tree-classic li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/folder-closed.png") no-repeat;
}

treecontrol.tree-classic li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    background: url("../imgs/file.png") no-repeat;
}

treecontrol.tree-classic li .tree-selected {
    font-weight: bold;
}

treecontrol.tree-classic li .tree-unselectable {
    color: #ddd;
}

treecontrol.tree-light li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-opened-2.png") no-repeat;
}

treecontrol.tree-light li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-closed-2.png") no-repeat;
}

treecontrol.tree-light li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    width: 16px; height: 16px;
    background: none no-repeat;
}

treecontrol.tree-light li .tree-selected {
    font-weight: bold;
}

treecontrol.tree-light li .tree-unselectable {
    color: #ddd;
}

treecontrol.tree-dark li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-opened-light.png") no-repeat;
}

treecontrol.tree-dark li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-closed-light.png") no-repeat;
}

treecontrol.tree-dark li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    width: 16px; height: 16px;
    background: none no-repeat;
}

treecontrol.tree-dark li .tree-selected {
    font-weight: bold;
}

treecontrol.tree-dark li .tree-unselectable {
    color: #777;
}

treecontrol.tree-dark {
    color: #ddd;
}
[treecontrol] {
    /* prevent user selection */
    -moz-user-select: -moz-none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;

    /* default */
    font-family: Verdana, Helvetica, Arial, sans-serif;
    font-size:13px;
    color: #555;
    text-decoration: none;
}

[treecontrol] ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
    overflow: hidden;
}

[treecontrol] li {
    position: relative;
    padding: 0 0 0 20px;
    line-height: 20px;
}

[treecontrol] li.tree-expanded i.tree-leaf-head, [treecontrol] li.tree-collapsed i.tree-leaf-head {display:none;}
[treecontrol] li.tree-expanded i.tree-branch-head, [treecontrol] li.tree-collapsed i.tree-branch-head {display:inline;}
[treecontrol] li.tree-leaf i.tree-branch-head {display:none;}
[treecontrol] li.tree-leaf i.tree-leaf-head {display:inline;}

[treecontrol] li i {
    cursor: pointer;
}

[treecontrol] li .tree-label {
    cursor: pointer;
    display: inline;
}

[treecontrol].tree-classic li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/folder.png") no-repeat;
}

[treecontrol].tree-classic li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/folder-closed.png") no-repeat;
}

[treecontrol].tree-classic li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    background: url("../imgs/file.png") no-repeat;
}

[treecontrol].tree-classic li .tree-selected {
    background-color: #aaddff;
    font-weight: bold;
}

[treecontrol].tree-light li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-opened-2.png") no-repeat;
}

[treecontrol].tree-light li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-closed-2.png") no-repeat;
}

[treecontrol].tree-light li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    width: 16px; height: 16px;
    background: none no-repeat;
}

[treecontrol].tree-light li .tree-selected {
    font-weight: bold;
}

[treecontrol].tree-dark li.tree-expanded i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-opened-light.png") no-repeat;
}

[treecontrol].tree-dark li.tree-collapsed i.tree-branch-head {
    padding: 1px 10px;
    background: url("../imgs/node-closed-light.png") no-repeat;
}

[treecontrol].tree-dark li.tree-leaf i.tree-leaf-head {
    padding: 1px 10px;
    width: 16px; height: 16px;
    background: none no-repeat;
}

[treecontrol].tree-dark li .tree-selected {
    font-weight: bold;
}

[treecontrol].tree-dark {
    color: #ddd;
}

.top-buffer-lg {
    margin-top: 40px;
}

.top-buffer {
    margin-top: 5px;
}
.nav-tabs-custom > .nav-tabs > li > a:hover {
    /*background: transparent;
    margin: 0;*/
    cursor: pointer;
}

.bs-example {
    margin-right: 0;
    margin-left: 0;
    background-color: #fff;
    border-color: #ddd;
    border-width: 1px;
    border-radius: 4px 4px 0 0;
    -webkit-box-shadow: none;
    box-shadow: none;
}


text:
<?php namespace Cmsable\Facades;

use Illuminate\Support\Facades\Facade;

class Pages extends Facade
{

    protected static function getFacadeAccessor(){
        return 'cmsable.pagequery-factory';
    }

}

redpajama_set_name: RedPajamaGithub


text:
The Koans walk you along the path to enlightenment in order to learn [RxJS](https://github.com/Reactive-Extensions/RxJS). The goal is to learn the RxJS library. We also teach you culture. Testing is not just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the library.

## Structure ##

The koans are broken out into areas by file, events are covered in about_events.js, time is introduced in about_time.js, etc. They are presented in order in the index.js file.

Each koan builds up your knowledge of RxJS and builds upon itself.

Some koans simply need to have the correct answer substituted for an incorrect one. Some, however, require you to supply your own answer. If you see the method __ (a double underscore) listed, it is a hint to you to supply your own code in order to make it work correctly.

## Installing Node.js ##

In order to run the koans you need Node.js installed. If you do not already have Node.js set up, please visit the [Node.js](http://nodejs.org/) site to install Node.js.

To verify your installation, in your terminal window simply type:
```bash
$ node --version
```
Any response for Node with a version number greater than 0.10.x is fine.

## Installing the RxJS Koans ##

To install the RxJS Koans, download via Git and add the depdencies via NPM:
```bash
$ git clone https://github.com/Reactive-Extensions/RxJSKoans.git
$ cd RxJSKoans
[RxJSKoans ]$ npm install
```

## The Path to Enlightenment ##

You can run the tests by calling `npm test` at your terminal window.
```bash
[RxJSKoans] $ npm test
```

## Red, Green, Refactor ##

In test-driven development (TDD) the mantra has always been red: write a failing test and run it, green: make the test pass, and refactor: look at the code and see if you can make it any better.

With the koans, you will need to run the tests and see it fail (red), make the test pass (green), then take a moment and reflect upon the test to see what it is teaching you and improve the code to better communicate its intent (refactor).

The very first time you run it you will see the following output:
```bash
  Observable Streams
    1) simple subscription

  1) Observable Streams simple subscription:
     Error: expected 42 to equal undefined
```

You have come to the first error. You then open up the `about_streams.js` file in your text editor and look at `simple subscription`:

```js
test('simple subscription', function () {
  Observable.just(42).subscribe(function (x) { equal(x, __); });
});
```

You then change `__` to `42` and run the tests again. You should now have fixed the error.

Before moving on, think about what you are learning.

In this specific case, ignore everything except the method name  and the parts inside the method. The goal is for you to see that if you pass a value to the proper assertion method method, it will either ensure it is true and continue on, or fail if in fact the statement is false.

## License ##

Copyright (c) Microsoft Open Technologies, Inc.  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.


text:
using namespace RDKit;

TEST_CASE("parsing") {
  SECTION("abbreviations") {
    auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
    CHECK(abbrevs.size() == 37);
    CHECK(abbrevs[0].label == "CO2Et");
    CHECK(abbrevs[0].displayLabel == "CO2Et");
    CHECK(abbrevs[0].displayLabelW == "EtO2C");
    CHECK(abbrevs[0].smarts == "C(=O)OCC");
    REQUIRE(abbrevs[0].mol);
    CHECK(abbrevs[0].mol->getNumAtoms() == 6);
    unsigned int nDummies = 0;
    CHECK(abbrevs[0].mol->getPropIfPresent(
        Abbreviations::common_properties::numDummies, nDummies));
    CHECK(nDummies == 1);
  }
  SECTION("linkers") {
    auto abbrevs = Abbreviations::Utils::getDefaultLinkers();
    CHECK(abbrevs.size() == 8);
    CHECK(abbrevs[0].label == "PEG6");
    CHECK(abbrevs[0].displayLabel == "PEG6");
    CHECK(abbrevs[0].displayLabelW.empty());
    CHECK(abbrevs[0].smarts == "*OCCOCCOCCOCCOCCOCC*");
    REQUIRE(abbrevs[0].mol);
    CHECK(abbrevs[0].mol->getNumAtoms() == 19);
    unsigned int nDummies = 0;
    CHECK(abbrevs[0].mol->getPropIfPresent(
        Abbreviations::common_properties::numDummies, nDummies));
    CHECK(nDummies == 1);
  }
  SECTION("bad SMILES in defintions") {
    const std::string defns = R"ABBREVS(CO2Et    C(=O)OCC
COOEt    fail
OiBu     OCC(C)C)ABBREVS";
    auto abbrevs = Abbreviations::Utils::parseAbbreviations(defns);
    REQUIRE(abbrevs.size() == 2);
    CHECK(abbrevs[0].label == "CO2Et");
    CHECK(abbrevs[1].label == "OiBu");
  }
}

TEST_CASE("findApplicableMatches") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  SECTION("basics") {
    auto m = "NCCC(F)(F)F"_smiles;
    REQUIRE(m);
    {
      double maxCoverage = 0.4;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.empty());
    }
    {
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.size() == 1);
      CHECK(matches[0].abbrev.label == "CF3");
      CHECK(matches[0].match[0].second == 2);
      CHECK(matches[0].match[1].second == 3);
    }
  }
  SECTION("multiple abbreviations") {
    {
      auto m = "FC(F)(F)CC(=O)O"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.size() == 2);
      CHECK(matches[0].abbrev.label == "CF3");
      CHECK(matches[1].abbrev.label == "CO2H");
    }
    {  // overlapping
      auto m = "FC(F)(F)C(=O)O"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.empty());
    }
    {  // overlapping
      auto m = "FC(F)(F)C(F)(F)F"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.empty());
    }
    {  // overlapping, one is too big, so there is an abbreviation for the other
      auto m = "CCC(F)(F)F"_smiles;
      REQUIRE(m);
      double maxCoverage = 0.4;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.size() == 1);
      CHECK(matches[0].abbrev.label == "Et");
      // remove the size constraint and there's no abbreviation:
      maxCoverage = 1.0;
      matches = Abbreviations::findApplicableAbbreviationMatches(*m, abbrevs,
                                                                 maxCoverage);
      CHECK(matches.empty());
    }
  }
}
TEST_CASE("findApplicableMatches linkers") {
  auto linkers = Abbreviations::Utils::getDefaultLinkers();
  SECTION("basics") {
    {
      auto m = "FCOCCOCCOCCNCCCCCCCCl"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, linkers, maxCoverage);
      CHECK(matches.size() == 2);
      CHECK(matches[0].abbrev.label == "PEG3");
      CHECK(matches[1].abbrev.label == "Hept");
    }
    {  // directly connected
      auto m = "FCOCCOCCOCCCCCCCCCCl"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, linkers, maxCoverage);
      CHECK(matches.size() == 2);
      CHECK(matches[0].abbrev.label == "PEG3");
      CHECK(matches[1].abbrev.label == "Hept");
      CHECK(matches[0].match[9].second == 10);
      CHECK(matches[1].match[0].second == 10);
    }
  }
}

TEST_CASE("applyMatches") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  SECTION("basics") {
    {
      auto m = "FC(F)(F)CC(=O)O"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.size() == 2);
      Abbreviations::applyMatches(*m, matches);
      CHECK(m->getNumAtoms() == 3);
      CHECK(MolToCXSmiles(*m) == "*C* |$CF3;;CO2H$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{1, 4, 5});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{3, 4});
    }
  }
}

TEST_CASE("applyMatches linkers") {
  auto linkers =
      Abbreviations::Utils::parseLinkers(R"ABBREV(PEG3  *OCCOCCOCC* PEG3
Pent  *CCCCC*
Cy   *C1CCC(*)CC1  Cy)ABBREV");
  SECTION("basics") {
    {
      auto m = "FCOCCOCCOCCCCCCCCl"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, linkers, maxCoverage);
      CHECK(matches.size() == 2);
      Abbreviations::applyMatches(*m, matches);
      CHECK(m->getNumAtoms() == 5);
      CHECK(MolToCXSmiles(*m) == "FC**Cl |$;;PEG3;Pent;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 11, 16});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 10, 15});
    }
    {
      auto m = "COC1CCC(C)CC1"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, linkers, maxCoverage);
      CHECK(matches.size() == 1);
      Abbreviations::applyMatches(*m, matches);
      CHECK(m->getNumAtoms() == 4);
      CHECK(MolToCXSmiles(*m) == "C*OC |$;Cy;;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 6});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 5});
    }
  }
}

TEST_CASE("condense abbreviations") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  SECTION("basics") {
    {
      auto m = "FC(F)(F)CC(=O)O"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::condenseMolAbbreviations(*m, abbrevs, maxCoverage);
      CHECK(MolToCXSmiles(*m) == "*C* |$CF3;;CO2H$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{1, 4, 5});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{3, 4});
    }
  }
}

TEST_CASE("condense abbreviations linkers") {
  auto linkers = Abbreviations::Utils::getDefaultLinkers();
  auto customLinkers =
      Abbreviations::Utils::parseLinkers(R"ABBREV(PEG3  *OCCOCCOCC* PEG3
Pent  *CCCCC*
Cy   *C1CCC(*)CC1  Cy
ala *N[C@@H](C)C(=O)* ala
arg *N[C@@H](CCCNC(N)=[NH])C(=O)* arg
asn *N[C@@H](CC(N)=O)C(=O)* asn
asp *N[C@@H](CC(O)=O)C(=O)* asp
cys *N[C@@H](CS)C(=O)* cys
gln *N[C@@H](CCC(N)=O)C(=O)* gln
glu *N[C@@H](CCC(O)=O)C(=O)* glu
gly *NCC(=O)* gly
his *N[C@@H](Cc1c[nH]cn1)C(=O)* his
ile *N[C@@H](C(C)CC)C(=O)* ile
leu *N[C@@H](CC(C)C)C(=O)* leu
lys *N[C@@H](CCCCN)C(=O)* lys
met *N[C@@H](CCSC)C(=O)* met
phe *N[C@@H](Cc1ccccc1)C(=O)* phe
pro *N1[C@@H](CCC1)C(=O)* pro
ser *N[C@@H](CO)C(=O)* ser
thr *N[C@@H](C(O)C)C(=O)* thr
trp *N[C@@H](Cc1c[nH]c2ccccc21)C(=O)* trp
tyr *N[C@@H](Cc1ccc(O)cc1)C(=O)* tyr
val *N[C@@H](C(C)C)C(=O)* val)ABBREV");
  SECTION("basics") {
    {
      auto m = "FCOCCOCCOCCCCCCCCCCl"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::condenseMolAbbreviations(*m, linkers, maxCoverage);
      CHECK(m->getNumAtoms() == 5);
      CHECK(MolToCXSmiles(*m) == "FC**Cl |$;;PEG3;Hept;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 11, 18});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 10, 17});
    }
    {
      auto m = "COC1CCC(C)CC1"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::condenseMolAbbreviations(*m, customLinkers, maxCoverage);
      CHECK(m->getNumAtoms() == 4);
      CHECK(MolToCXSmiles(*m) == "C*OC |$;Cy;;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 6});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 5});
    }
  }
  SECTION("peptides") {
    std::unique_ptr<RWMol> m(SequenceToMol("GYTKC"));
    REQUIRE(m);
    double maxCoverage = 1.0;
    Abbreviations::condenseMolAbbreviations(*m, customLinkers, maxCoverage);
    CHECK(MolToCXSmiles(*m) == "NCC(=O)****O |$;;;;tyr;thr;lys;cys;$|");
    std::vector<unsigned int> atomMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origAtomMapping,
                              atomMapping));
    CHECK(atomMapping ==
          std::vector<unsigned int>{0, 1, 2, 3, 4, 16, 23, 32, 38});
    std::vector<unsigned int> bondMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origBondMapping,
                              bondMapping));
    CHECK(bondMapping ==
          std::vector<unsigned int>{0, 1, 2, 15, 38, 37, 31, 22});
  }
}

TEST_CASE("abbreviations and linkers") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  auto linkers = Abbreviations::Utils::parseLinkers(
      R"ABBREV(Cy   *C1CCC(*)CC1  Cy)ABBREV");
  SECTION("basics") {
    {  // this isn't the order we'd normally do this in:
      auto m = "COC1CCC(C)CC1"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::condenseMolAbbreviations(*m, abbrevs, maxCoverage);
      CHECK(m->getNumAtoms() == 8);
      CHECK(MolToCXSmiles(*m) == "*C1CCC(C)CC1 |$OMe;;;;;;;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{1, 2, 3, 4, 5, 6, 7, 8});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{1, 2, 3, 4, 5, 6, 7, 8});
      Abbreviations::condenseMolAbbreviations(*m, linkers, maxCoverage);
      CHECK(m->getNumAtoms() == 3);
      CHECK(MolToCXSmiles(*m) == "**C |$OMe;Cy;$|");
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{1, 2, 6});
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{1, 5});
    }
    {  // a more sensible order
      auto m = "COC1CCC(C)CC1"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::condenseMolAbbreviations(*m, linkers, maxCoverage);
      CHECK(m->getNumAtoms() == 4);
      CHECK(MolToCXSmiles(*m) == "C*OC |$;Cy;;$|");
      std::vector<unsigned int> atomMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 6});
      std::vector<unsigned int> bondMapping;
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 5});
      Abbreviations::condenseMolAbbreviations(*m, abbrevs, maxCoverage);
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origAtomMapping, atomMapping));
      CHECK(m->getNumAtoms() == 4);
      CHECK(MolToCXSmiles(*m) == "C*OC |$;Cy;;$|");
      CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 6});
      CHECK(m->getPropIfPresent(
          Abbreviations::common_properties::origBondMapping, bondMapping));
      CHECK(bondMapping == std::vector<unsigned int>{0, 1, 5});
    }
  }
}

TEST_CASE("labelMatches") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  SECTION("basics") {
    {
      auto m = "CC(C)CC(F)(F)F"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      auto matches = Abbreviations::findApplicableAbbreviationMatches(
          *m, abbrevs, maxCoverage);
      CHECK(matches.size() == 2);
      Abbreviations::labelMatches(*m, matches);
      CHECK(m->getNumAtoms() == 8);
      const auto &sgs = getSubstanceGroups(*m);
      REQUIRE(sgs.size() == 2);
      CHECK(sgs[0].getProp<std::string>("TYPE") == "SUP");
      CHECK(sgs[0].getProp<std::string>("LABEL") == "iPr");
      CHECK(sgs[0].getBonds() == std::vector<unsigned int>({2}));
      CHECK(sgs[0].getAtoms() == std::vector<unsigned int>({1, 0, 2}));
      CHECK(sgs[0].getAttachPoints().size() == 1);
      CHECK(sgs[0].getAttachPoints()[0].aIdx == 1);
      CHECK(sgs[0].getAttachPoints()[0].lvIdx == 3);

      CHECK(sgs[1].getProp<std::string>("TYPE") == "SUP");
      CHECK(sgs[1].getProp<std::string>("LABEL") == "CF3");
      CHECK(sgs[1].getBonds() == std::vector<unsigned int>({3}));
      CHECK(sgs[1].getAtoms() == std::vector<unsigned int>({4, 5, 6, 7}));
      CHECK(sgs[1].getAttachPoints().size() == 1);
      CHECK(sgs[1].getAttachPoints()[0].aIdx == 4);
      CHECK(sgs[1].getAttachPoints()[0].lvIdx == 3);
    }
  }
}

TEST_CASE("labelMolAbbreviations") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  SECTION("basics") {
    {
      auto m = "CC(C)CC(F)(F)F"_smiles;
      REQUIRE(m);
      double maxCoverage = 1.0;
      Abbreviations::labelMolAbbreviations(*m, abbrevs, maxCoverage);
      CHECK(m->getNumAtoms() == 8);
      const auto &sgs = getSubstanceGroups(*m);
      REQUIRE(sgs.size() == 2);
      CHECK(sgs[0].getProp<std::string>("TYPE") == "SUP");
      CHECK(sgs[0].getProp<std::string>("LABEL") == "iPr");
      CHECK(sgs[0].getBonds() == std::vector<unsigned int>({2}));
      CHECK(sgs[0].getAtoms() == std::vector<unsigned int>({1, 0, 2}));
      CHECK(sgs[0].getAttachPoints().size() == 1);
      CHECK(sgs[0].getAttachPoints()[0].aIdx == 1);
      CHECK(sgs[0].getAttachPoints()[0].lvIdx == 3);

      CHECK(sgs[1].getProp<std::string>("TYPE") == "SUP");
      CHECK(sgs[1].getProp<std::string>("LABEL") == "CF3");
      CHECK(sgs[1].getBonds() == std::vector<unsigned int>({3}));
      CHECK(sgs[1].getAtoms() == std::vector<unsigned int>({4, 5, 6, 7}));
      CHECK(sgs[1].getAttachPoints().size() == 1);
      CHECK(sgs[1].getAttachPoints()[0].aIdx == 4);
      CHECK(sgs[1].getAttachPoints()[0].lvIdx == 3);
    }
  }
}

TEST_CASE("condenseAbbreviationSubstanceGroups") {
  SECTION("abbreviations") {
    auto m = R"CTAB(
  ACCLDraw09152005292D

  0  0  0     0  0            999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 10 10 2 0 0
M  V30 BEGIN ATOM
M  V30 1 C 12.8333 -9.32 0 0 CFG=3
M  V30 2 C 13.8565 -8.7293 0 0
M  V30 3 O 14.8802 -9.3201 0 0
M  V30 4 O 13.8565 -7.5471 0 0
M  V30 5 C 11.6489 -9.32 0 0
M  V30 6 C 12.241 -10.3432 0 0 CFG=3
M  V30 7 C 12.241 -11.5253 0 0 CFG=3
M  V30 8 F 12.241 -12.5874 0 0
M  V30 9 F 11.0366 -11.5253 0 0
M  V30 10 F 13.4231 -11.5253 0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 2 2 4
M  V30 2 1 2 3
M  V30 3 1 1 2
M  V30 4 1 5 6
M  V30 5 1 5 1
M  V30 6 1 1 6
M  V30 7 1 7 10
M  V30 8 1 7 9
M  V30 9 1 7 8
M  V30 10 1 6 7
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 1 ATOMS=(3 2 3 4) XBONDS=(1 3) CSTATE=(4 3 -1.02 -0.59 0) LABEL=-
M  V30 CO2H
M  V30 2 SUP 2 ATOMS=(4 7 8 9 10) XBONDS=(1 10) CSTATE=(4 10 0 1.18 0) LABEL=-
M  V30 CF3
M  V30 END SGROUP
M  V30 END CTAB
M  END)CTAB"_ctab;
    REQUIRE(m);
    CHECK(m->getNumAtoms() == 10);
    Abbreviations::condenseAbbreviationSubstanceGroups(*m);
    CHECK(m->getNumAtoms() == 5);
    std::vector<unsigned int> atomMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origAtomMapping,
                              atomMapping));
    CHECK(atomMapping == std::vector<unsigned int>{0, 1, 4, 5, 6});
    std::vector<unsigned int> bondMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origBondMapping,
                              bondMapping));
    CHECK(bondMapping == std::vector<unsigned int>{2, 3, 4, 5, 9});
    // remove the conformer before generating CXSMILES
    m->clearConformers();
    CHECK(MolToCXSmiles(*m) == "*C1CC1* |$CO2H;;;;CF3$|");
  }
  SECTION("abbreviations MRV") {
    auto m = R"CTAB(
  Mrv2014 09152006492D

  0  0  0     0  0            999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 7 7 1 0 0
M  V30 BEGIN ATOM
M  V30 1 C 5.25 -5.9858 0 0
M  V30 2 C 4.48 -7.3196 0 0
M  V30 3 C 6.02 -7.3196 0 0
M  V30 4 F 8.6873 -8.8596 0 0
M  V30 5 C 7.3537 -8.0896 0 0
M  V30 6 F 6.02 -8.8596 0 0
M  V30 7 F 7.3537 -6.5496 0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 1 1 2
M  V30 2 1 3 1
M  V30 3 1 2 3
M  V30 4 1 3 5
M  V30 5 1 4 5
M  V30 6 1 5 6
M  V30 7 1 5 7
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 0 ATOMS=(4 4 5 6 7) SAP=(3 5 3 1) XBONDS=(1 4) LABEL=CF3
M  V30 END SGROUP
M  V30 END CTAB
M  END
)CTAB"_ctab;
    REQUIRE(m);
    CHECK(m->getNumAtoms() == 7);
    Abbreviations::condenseAbbreviationSubstanceGroups(*m);
    CHECK(m->getNumAtoms() == 4);
    // remove the conformer before generating CXSMILES
    Abbreviations::condenseAbbreviationSubstanceGroups(*m);
    std::vector<unsigned int> atomMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origAtomMapping,
                              atomMapping));
    CHECK(atomMapping == std::vector<unsigned int>{0, 1, 2, 4});
    std::vector<unsigned int> bondMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origBondMapping,
                              bondMapping));
    CHECK(bondMapping == std::vector<unsigned int>{0, 1, 2, 3});
    m->clearConformers();
    CHECK(MolToCXSmiles(*m) == "*C1CC1 |$CF3;;;$|");
  }

  SECTION("linker") {
    auto m = R"CTAB(
  ACCLDraw09152006102D

  0  0  0     0  0            999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 8 7 1 0 0
M  V30 BEGIN ATOM
M  V30 1 C 7.2482 -5.1911 0 0
M  V30 2 O 5.8143 -6.2327 0 0
M  V30 3 C 6.77 -5.5382 0 0
M  V30 4 C 7.8494 -6.0186 0 0
M  V30 5 O 8.8052 -5.3241 0 0
M  V30 6 C 9.8845 -5.8046 0 0
M  V30 7 C 10.8403 -5.1101 0 0
M  V30 8 C 9.4066 -6.1518 0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 1 1 2
M  V30 2 1 2 3
M  V30 3 1 3 4
M  V30 4 1 4 5
M  V30 5 1 5 6
M  V30 6 1 6 7
M  V30 7 1 7 8
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 1 ATOMS=(6 2 3 4 5 6 7) XBONDS=(2 1 7) CSTATE=(4 1 -1.08 0.48 0) -
M  V30 CSTATE=(4 7 1.08 -0.48 0) LABEL=PEG2
M  V30 END SGROUP
M  V30 END CTAB
M  END)CTAB"_ctab;
    REQUIRE(m);
    CHECK(m->getNumAtoms() == 8);
    Abbreviations::condenseAbbreviationSubstanceGroups(*m);
    std::vector<unsigned int> atomMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origAtomMapping,
                              atomMapping));
    CHECK(atomMapping == std::vector<unsigned int>{0, 1, 7});
    std::vector<unsigned int> bondMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origBondMapping,
                              bondMapping));
    CHECK(bondMapping == std::vector<unsigned int>{0, 6});
    CHECK(m->getNumAtoms() == 3);
    // remove the conformer before generating CXSMILES
    m->clearConformers();
    CHECK(MolToCXSmiles(*m) == "C*C |$;PEG2;$|");
  }
  SECTION("linker MRV") {
    auto m = R"CTAB(
  Mrv2014 09152006522D

  0  0  0     0  0            999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 8 7 1 0 0
M  V30 BEGIN ATOM
M  V30 1 C 1.625 -8.9167 0 0
M  V30 2 O 2.9587 -8.1467 0 0
M  V30 3 C 4.2924 -8.9167 0 0
M  V30 4 C 5.626 -8.1467 0 0
M  V30 5 O 6.9597 -8.9167 0 0
M  V30 6 C 8.2934 -8.1467 0 0
M  V30 7 C 9.6271 -8.9167 0 0
M  V30 8 C 10.9608 -8.1467 0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 1 1 2
M  V30 2 1 2 3
M  V30 3 1 3 4
M  V30 4 1 4 5
M  V30 5 1 5 6
M  V30 6 1 6 7
M  V30 7 1 7 8
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 0 ATOMS=(6 2 3 4 5 6 7) SAP=(3 2 1 1) SAP=(3 7 8 2) XBONDS=(2 1 -
M  V30 7) LABEL=PEG2 ESTATE=E
M  V30 END SGROUP
M  V30 END CTAB
M  END
)CTAB"_ctab;
    REQUIRE(m);
    CHECK(m->getNumAtoms() == 8);
    Abbreviations::condenseAbbreviationSubstanceGroups(*m);
    std::vector<unsigned int> atomMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origAtomMapping,
                              atomMapping));
    CHECK(atomMapping == std::vector<unsigned int>{0, 1, 7});
    std::vector<unsigned int> bondMapping;
    CHECK(m->getPropIfPresent(Abbreviations::common_properties::origBondMapping,
                              bondMapping));
    CHECK(bondMapping == std::vector<unsigned int>{0, 6});
    CHECK(m->getNumAtoms() == 3);
    // remove the conformer before generating CXSMILES
    m->clearConformers();
    CHECK(MolToCXSmiles(*m) == "C*C |$;PEG2;$|");
  }
}

TEST_CASE("comparison") {
  auto abbrevs = Abbreviations::Utils::getDefaultAbbreviations();
  Abbreviations::AbbreviationDefinition cp = abbrevs[0];
  CHECK(cp == abbrevs[0]);
  CHECK(cp != abbrevs[1]);
  CHECK(abbrevs[1] == abbrevs[1]);
}


text:
package io.stackdocker.webpay.service;

//import com.ijpay.interceptor.WxPayApiInterceptor;
//import com.jfinal.aop.Before;
//import com.jfinal.core.Controller;
import com.jpay.weixin.api.WxPayApiConfig;
import org.springframework.stereotype.Service;

/**
 * Inspired by
 * @Email javen205@126.com
 * @author Javen
 * https://github.com/Javen205/IJPay-Demo/blob/master/src/main/java/com/ijpay/controller/weixin/WxPayApiController.java
 */
interface WeChatPayApi {
//@Before(WxPayApiInterceptor.class)
//public abstract class WxPayApiController extends Controller {
	WxPayApiConfig getApiConfig();

}


text:
using System.Web.Http;

namespace OSharp.Web.Http
{
    /// <summary>
    /// WebAPI的控制器基类
    /// </summary>
    //[CustomAuthorize]
    public abstract class BaseApiController : ApiController
    {
    }
}


text:
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';

import { HighlightJsModule } from 'ngx-highlight-js';

import { TimelineDemoRoutingModule } from './timelinedemo-routing.module';
import { TimelineDemoComponent } from './timelinedemo.component';
import { TimelineModule } from '../../../../../projects/truly-ui/src/components/timeline';
import { ShowcaseCardModule } from '../../../shared/components/showcase-card/showcase-card.module';
import { ShowcaseTablePropertiesModule } from '../../../shared/components/showcase-table-properties/showcase-table-properties.module';
import { ShowcaseTableEventsModule } from '../../../shared/components/showcase-table-events/showcase-table-events.module';
import { ShowcaseHeaderModule } from '../../../shared/components/showcase-header/showcase-header.module';

@NgModule({
  declarations: [
    TimelineDemoComponent
  ],
  imports: [
    TimelineDemoRoutingModule,
    TimelineModule,
    CommonModule,
    FormsModule,
    HighlightJsModule,
    ShowcaseCardModule,
    ShowcaseTablePropertiesModule,
    ShowcaseTableEventsModule,
    ShowcaseHeaderModule,
    ShowcaseHeaderModule
  ],
  exports: [
    TimelineDemoComponent
  ]
})
export class TimelineDemoModule {}


text:
from django.contrib.sitemaps import Sitemap
from .models import Monitoring, MonitoringInstitution

class MonitoringSitemap(Sitemap):
    def items(self):
        return Monitoring.objects.all()

    def lastmod(self, obj):
        return obj.modified

class MonitoringInstitutionSitemap(Sitemap):
    def items(self):
        return MonitoringInstitution.objects.all()


text:
import time
import logging
import mxnet as mx

class Speedometer(object):
    def __init__(self, batch_size, frequent=50):
        self.batch_size = batch_size
        self.frequent = frequent
        self.init = False
        self.tic = 0
        self.last_count = 0

    def __call__(self, param):
        """Callback to Show speed."""
        count = param.nbatch
        if self.last_count > count:
            self.init = False
        self.last_count = count

        if self.init:
            if count % self.frequent == 0:
                speed = self.frequent * self.batch_size / (time.time() - self.tic)
                if param.eval_metric is not None:
                    name, value = param.eval_metric.get()
                    s = "Epoch[%d] Batch [%d]\tSpeed: %.2f samples/sec\tTrain-" % (param.epoch, count, speed)
                    for n, v in zip(name, value):
                        s += "%s=%f,\t" % (n, v)
                    logging.info(s)
                    print s
                else:
                    logging.info("Iter[%d] Batch [%d]\tSpeed: %.2f samples/sec",
                                 param.epoch, count, speed)
                self.tic = time.time()
        else:
            self.init = True
            self.tic = time.time()

def do_checkpoint(prefix, means, stds):
    def _callback(iter_no, sym, arg, aux):
        weight = arg['fcis_bbox_weight']
        bias = arg['fcis_bbox_bias']
        repeat = bias.shape[0] / means.shape[0]

        arg['fcis_bbox_weight_test'] = weight * mx.nd.repeat(mx.nd.array(stds), repeats=repeat).reshape((bias.shape[0], 1, 1, 1))
        arg['fcis_bbox_bias_test'] = arg['fcis_bbox_bias'] * mx.nd.repeat(mx.nd.array(stds), repeats=repeat) + mx.nd.repeat(mx.nd.array(means), repeats=repeat)
        mx.model.save_checkpoint(prefix, iter_no + 1, sym, arg, aux)
        arg.pop('fcis_bbox_weight_test')
        arg.pop('fcis_bbox_bias_test')
    return _callback


text:
package org.apereo.cas.authentication.adaptive.geo;

import com.google.common.collect.Sets;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.Set;

/**
 * This is {@link GeoLocationResponse} that represents a particular geo location
 * usually calculated from an ip address.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
public class GeoLocationResponse {
    private Set<String> addresses = Sets.newConcurrentHashSet();

    /**
     * Add address.
     *
     * @param address the address
     */
    public void addAddress(final String address) {
        this.addresses.add(address);
    }

    /**
     * Format the address into a long string.
     *
     * @return the string
     */
    public String buildAddress() {
        final StringBuilder b = new StringBuilder();
        this.addresses.forEach(s -> b.append(s.concat(",")));
        return b.toString();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("addresses", this.addresses)
                .toString();
    }
}


text:
'use strict';

export default function headGenerator(baseUrl) {
  return {
    head: {
      url: baseUrl,
      method: 'head',
    },
  };
}


text:
class GoldStreamEvaluatorTest : public ::testing::Test {
 protected:
  virtual void SetUp();

  std::unique_ptr<std::istringstream> gold_iss;
  std::unique_ptr<std::istringstream> actual_iss;
};

void GoldStreamEvaluatorTest::SetUp() {
  gold_iss = std::make_unique<std::istringstream>();
  actual_iss = std::make_unique<std::istringstream>();
}

TEST_F(GoldStreamEvaluatorTest, BadGoldStream) {
  actual_iss->setstate(std::ios_base::goodbit);
  gold_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.GoldGood());
  ASSERT_TRUE(test_eval.ActualGood());
}

TEST_F(GoldStreamEvaluatorTest, BadActualStream) {
  gold_iss->setstate(std::ios_base::goodbit);
  actual_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.ActualGood());
  ASSERT_TRUE(test_eval.GoldGood());
}

TEST_F(GoldStreamEvaluatorTest, BadBothStream) {
  gold_iss->setstate(std::ios_base::badbit);
  actual_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.ActualGood());
  ASSERT_FALSE(test_eval.GoldGood());
}

TEST_F(GoldStreamEvaluatorTest, SameStream) {
  std::string input_text = "1\n2\n3\n4\n5";
  gold_iss->str(input_text);
  actual_iss->str(input_text);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_TRUE(test_eval.Compare());
}

TEST_F(GoldStreamEvaluatorTest, DiffStream) {
  std::string gold_text = "1\n2\n3\n4\n5";
  std::string actual_text = "1\n2\nX\n4\n5";
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.Compare());
}

TEST_F(GoldStreamEvaluatorTest, BadGoldStreamCompare) {
  actual_iss->setstate(std::ios_base::goodbit);
  gold_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_THROW(test_eval.Compare(), std::runtime_error);
}

TEST_F(GoldStreamEvaluatorTest, BadActualStreamCompare) {
  gold_iss->setstate(std::ios_base::goodbit);
  actual_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_THROW(test_eval.Compare(), std::runtime_error);
}

TEST_F(GoldStreamEvaluatorTest, CompareLongerGold) {
  std::string gold_text = "1\n2\n3\n4\n5";
  std::string actual_text = "1\n2\n3\n4";
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.Compare());
}

TEST_F(GoldStreamEvaluatorTest, CompareLongerActual) {
  std::string gold_text = "1\n2\n3\n4";
  std::string actual_text = "1\n2\n3\n4\n5";
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.Compare());
}

TEST_F(GoldStreamEvaluatorTest, DiffWorks) {
  std::string gold_text = "1\n2\nX\n4";
  std::string actual_text = "1\n2\n3\n4";
  std::string diff;
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);

  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  diff = test_eval.GetDiff();
  ASSERT_EQ(diff, "@@ -1,4 +1,4 @@\n 1\n 2\n-X\n+3\n 4\n");
}

TEST_F(GoldStreamEvaluatorTest, DiffWorksSame) {
  std::string gold_text = "1\n2\n3\n4";
  std::string actual_text = "1\n2\n3\n4";
  std::string diff;
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);

  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  diff = test_eval.GetDiff();
  ASSERT_EQ(diff, "");
}

TEST_F(GoldStreamEvaluatorTest, BadGoldStreamDiff) {
  actual_iss->setstate(std::ios_base::goodbit);
  gold_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_THROW(test_eval.GetDiff(), std::runtime_error);
}

TEST_F(GoldStreamEvaluatorTest, BadActualStreamDiff) {
  gold_iss->setstate(std::ios_base::goodbit);
  actual_iss->setstate(std::ios_base::badbit);
  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_THROW(test_eval.GetDiff(), std::runtime_error);
}

TEST_F(GoldStreamEvaluatorTest, RunGoldTestFail) {
  std::string gold_text = "1\n2\nX\n4";
  std::string actual_text = "1\n2\n3\n4";
  std::string diff;
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);

  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_FALSE(test_eval.RunGoldTest());
}

TEST_F(GoldStreamEvaluatorTest, RunGoldTestPass) {
  std::string gold_text = "1\n2\n3\n4";
  std::string actual_text = "1\n2\n3\n4";
  std::string diff;
  gold_iss->str(gold_text);
  actual_iss->str(actual_text);

  btest::GoldStreamEvaluator test_eval(std::move(gold_iss),
                                       std::move(actual_iss));
  ASSERT_TRUE(test_eval.RunGoldTest());
}


text:
package org.camunda.bpm.engine.test.api.mock;

import java.util.HashMap;

import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.test.mock.Mocks;
import org.camunda.bpm.engine.test.util.ProvidedProcessEngineRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNull;

/**
 * @author Tassilo Weidner
 */
public class MocksTest {
  @Rule
  public ProcessEngineRule rule = new ProvidedProcessEngineRule();

  protected RuntimeService runtimeService;
  protected TaskService taskService;

  @Before
  public void initServices() {
    runtimeService = rule.getRuntimeService();
    taskService = rule.getTaskService();
  }

  @Test
  public void testMethodsOfMocksAPI() {
    //given
    HashMap<String, Object> map = new HashMap<String, Object>();

    for (int i = 0; i < 5; i++) {
      map.put("key" + i, new Object());
    }

    //when
    for (String key : map.keySet()) {
      Mocks.register(key, map.get(key));
    }

    //then
    for (String key : map.keySet()) {
      assertEquals(map.get(key), Mocks.get(key));
    }

    assertEquals(map, Mocks.getMocks());

    Mocks.reset();

    for (String key : map.keySet()) {
      assertNull(Mocks.get(key));
    }

    assertEquals(0, Mocks.getMocks().size());
  }

  @Test
  @Deployment
  public void testMockAvailabilityInScriptTask() {
    testMockAvailability();
  }

  @Test
  @Deployment
  public void testMockAvailabilityInExpressionLanguage() {
    testMockAvailability();
  }

  //helper ////////////////////////////////////////////////////////////
  private void testMockAvailability() {
    //given
    final String testStr = "testValue";

    Mocks.register("myMock", new Object() {

      public String getTest() {
        return testStr;
      }

      public void testMethod(DelegateExecution execution, String str) {
        execution.setVariable("testVar", str);
      }

    });

    //when
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("mocksTest");
    Mocks.reset();

    //then
    assertEquals(testStr, runtimeService.getVariable(pi.getId(), "testVar"));
  }

}


text:
import base64
import datetime
import json
import logging
from urllib import urlencode
from bs4 import BeautifulSoup as BS
import urllib2
import sys
import HTMLParser
from icalendar import Calendar, Event, vDatetime

from google.appengine.api import urlfetch
from google.appengine.ext import deferred, ndb
from mcfw.cache import cached
from mcfw.rpc import returns, arguments, serialize_complex_value
from plugins.veurne_trash.models import UserLocation
from plugins.veurne_trash.plugin_consts import HTTPS_BASE_URL, ROGERTHAT_EXCEPTION_CODE_SERVICE_USER_NOT_FOUND, \
    ROGERTHAT_EXCEPTION_CODE_MESSAGE_USER_NOT_FOUNDS
from plugins.veurne_trash.plugin_utils import today
from plugins.veurne_trash.to import HouseTO, StreetTO, ActivityTO, CollectionTO
from plugins.rogerthat_api.api import system, messaging, RogerthatApiException
from plugins.rogerthat_api.to import MemberTO
from plugins.rogerthat_api.models.settings import RogerthatSettings
from framework.utils import guid, now

@returns(unicode)
@arguments(sik=unicode)
def get_api_login_token(sik):

    args = dict()
    url = "%slogin.json?%s" % (HTTPS_BASE_URL, urlencode(args))

    result = urlfetch.fetch(url=url, method=urlfetch.POST, headers=get_api_headers(sik), deadline=55)
    logging.info(result.content)

    if result.status_code != 200:
        raise Exception("Failed when loading get_api_login_token")

    json_response = json.loads(result.content)
    return unicode(json_response["loginkey"])

@returns([StreetTO])
@arguments(sik=unicode)
def get_api_streets(sik):

    args = dict()
    URL_POST = 'http://www.ivvo.be/ahah-gemeente-exposed-callback'

    sdata = {}
    sdata['field_gemeente_value'] = 'Veurne'
    sdata['field_straat_value'] = ''
    sdata['field_straatnrvan_value'] = ''
    sdata['field_straatnrtot_value'] = ''

    sdata = urlencode(sdata)

    result = urlfetch.fetch(url=URL_POST, deadline=55, payload=sdata, method=2)

    if result.status_code != 200:
        raise Exception("Failed when loading get_api_streets")

    decodedcontent = result.content.decode('unicode_escape')

    soup = BS(decodedcontent, 'html.parser')
    contents = [x.text.encode('cp1252').decode('utf8') for x in soup.find(id="field_straat_value").find_all('option')]
    contents = list(filter(None, contents))

    lijstNRS = [x for x in range(0,len(contents))]
    lijstCompleet = [{'s': straat, 'nr': nummer} for straat, nummer in zip(contents, lijstNRS)]
    logging.info(lijstCompleet)

    json_response = json.loads(json.dumps(lijstCompleet))
    return [StreetTO.fromObj(s) for s in json_response]

@returns([HouseTO])
@arguments(sik=unicode, street_number=long)
def get_api_houses(sik, street_number):
    args = dict()

    lijstNRS = [x for x in range(1,800)]
    lijstBUS = ["" for w in range(1,800)]
    lijstCompleet = [{'h': huisnr, 't': bus} for huisnr, bus in zip(lijstNRS, lijstBUS)]

    json_response = json.loads(json.dumps(lijstCompleet))

    return [HouseTO.fromObj(s) for s in json_response]

@returns([ActivityTO])
@arguments(sik=unicode)
def get_api_activities(sik):
    args = dict()

    lijstAFVAL = []
    lijstAFVAL.append([7 , 'Grofvuil op afroep'])
    lijstAFVAL.append([21 , 'Restafval'])
    lijstAFVAL.append([23 , 'Kerstbomen'])
    lijstAFVAL.append([27 , 'Papier en karton Zone 1'])
    lijstAFVAL.append([37 , 'Papier en karton Zone 2'])
    lijstAFVAL.append([47 , 'Papier en karton Zone 3'])
    lijstAFVAL.append([28 , 'PMD'])
    lijstAFVAL.append([29 , 'Snoeihout op afroep'])
    lijstAFVAL.append([30 , 'Textiel'])
    lijstAFVAL.append([31 , 'Oude metalen op afroep'])
    lijstAFVAL.append([32 , 'GFT'])
    lijstCompleet = [{'nr': nummers, 's': beschrijvingAfval} for nummers, beschrijvingAfval in lijstAFVAL]

    json_response = json.loads(json.dumps(lijstCompleet))

    return [ActivityTO.fromObj(s) for s in json_response]

@returns([CollectionTO])
@arguments(sik=unicode, street_name=unicode, house_number=long, house_bus=unicode, time_from=long)
def get_api_collections(sik, street_name, house_number, house_bus, time_from):
    args = dict()
    args["straatnaam"] = street_name
    args["huisnummer"] = house_number
    args["toevoeging"] = house_bus

    d_from = datetime.date.fromtimestamp(time_from)

    args["van"] = u"%s/%s/%s" % (d_from.day, d_from.month, d_from.year)
    args["tem"] = u"31/12/%s" % d_from.year
    BASIS_URL = 'http://www.ivvo.be/icallink/?'
    f = { 'field_gemeente_value' : 'Veurne', 'field_straat_value' : street_name.encode('utf-8'), 'field_straatnrvan_value' : house_number}

    REQ_URL = BASIS_URL + urlencode(f)

    try:
        result = urlfetch.fetch(url=REQ_URL, deadline=55)
        if result.status_code == 200:
            logging.info(result.content)
        else:
            logging.error("failed to load get_api_collections")
            raise Exception("Het laden van de afvalkalender is mislukt.")
    except urlfetch.Error:
        logging.error('Caught exception fetching url')
        raise Exception("Het laden van de afvalkalender is mislukt.")

    cal = Calendar.from_ical(result.content)
    lijst1 = []
    lijst2 = []
    for event in cal.walk('vevent'):

        date = event.get('dtstart')
        summary = event.get('summary')
        summaryID = 33
        lijst1.append(str(date.dt))
        if str(summary)=="Grofvuil op afroep": summaryID = 7
        if str(summary)=="Restafval": summaryID=21
        if str(summary)=="Kerstbomen": summaryID=23
        if str(summary)=="Papier en karton Zone 1": summaryID=27
        if str(summary)=="Papier en karton Zone 2": summaryID=37
        if str(summary)=="Papier en karton Zone 3": summaryID=47
        if str(summary)=="PMD": summaryID=28
        if str(summary)=="Snoeihout op afroep": summaryID=29
        if str(summary)=="Textiel": summaryID=33
        if str(summary)=="Oude metalen op afroep": summaryID=31
        if str(summary)=="GFT": summaryID=32
        lijst2.append(summaryID)
    lijstCompleet = [{'d': datum, 'a': afval} for datum, afval in zip(lijst1, lijst2)]

    activities = {}
    for a in get_api_activities(sik):
        activities[a.number] = a
    json_response = json.loads(json.dumps(lijstCompleet))

    collections = [CollectionTO.fromObj(s, activities[s["a"]]) for s in json_response]

    return collections

def get_streets(sik, service_identity, email, app_id, params):
    try:
        r = get_api_streets(sik)
        return {"result": json.dumps(serialize_complex_value(r, StreetTO, True)),
                "error": None}
    except:
        logging.exception(u"get_api_streets failed")
        return {"result": None,
                "error": u"get_api_streets failed"}

def get_street_numbers(sik, service_identity, email, app_id, params):
    try:
        jsondata = json.loads(params)
        r = get_api_houses(sik, long(jsondata["streetnumber"]))
        return {"result": json.dumps(serialize_complex_value(r, HouseTO, True)),
                "error": None}
    except:
        logging.exception(u"get_street_numbers failed")
        return {"result": None,
                "error": u"get_street_numbers failed"}

def set_location(sik, service_identity, email, app_id, params):
    try:
        jsondata = json.loads(params)
        street_number = long(jsondata['info']['street']['number'])
        street_name = jsondata['info']['street']['name']
        house_number = long(jsondata['info']['house']['number'])
        house_bus = jsondata['info']['house']['bus']
        collections = get_api_collections(sik, street_name, house_number, house_bus, today())

    except Exception, ex:
        return {"result": None,
                "error": ex.message}

    ul_key = UserLocation.create_key(sik, email, app_id)
    ul = ul_key.get()
    if not ul:
        ul = UserLocation(key=ul_key)
        ul.notifications = []
    ul.service_identity = service_identity
    ul.address = u"%s %s%s" % (street_name, house_number, house_bus)
    ul.street_number = street_number
    ul.house_number = house_number
    ul.house_bus = house_bus
    ul.user_data_epoch = now()
    ul.next_collection = collections[0].epoch
    ul.put()

    update_user_data(sik, service_identity, email, app_id, ul.address, ul.notifications, collections)
    return {"result": u"Location was set",
            "error": None}

def update_user_data(sik, service_identity, email, app_id, address, notifications, collections):
    deferred.defer(_update_user_data, sik, service_identity, email, app_id, address, notifications, collections, _transactional=ndb.in_transaction())

def _update_user_data(sik, service_identity, email, app_id, address, notifications, collections):
    settings = RogerthatSettings.create_key(sik).get()
    user_data = dict()
    user_data["trash"] = {}
    user_data["trash"]["address"] = address
    activities = {}
    for collection in collections:
        activities[collection.activity.number] = collection.activity

    user_data["trash"]["collections"] = serialize_complex_value(collections, CollectionTO, True)
    user_data["trash"]["notifications"] = notifications
    user_data["trash"]["notification_types"] = serialize_complex_value(sorted(activities.values(), key=lambda a: a.name), ActivityTO, True)

    try:
        system.put_user_data(settings.api_key, email, app_id, user_data, service_identity)
    except RogerthatApiException, e:
        if e.code != ROGERTHAT_EXCEPTION_CODE_SERVICE_USER_NOT_FOUND:
            raise e
        logging.debug("Ignoring _update_user_data user de-friended")

def set_notifications(sik, service_identity, email, app_id, params):
    jsondata = json.loads(params)
    ul = UserLocation.get_by_info(sik, email, app_id)
    ul.notifications = jsondata['notifications']
    ul.put()

    return {"result": u"Notifications are updated",
            "error": None}

@cached(1, lifetime=600, request=False, memcache=True)
@returns(unicode)
@arguments(sik=unicode, service_identity=unicode)
def get_branding_key(sik, service_identity):
    settings = RogerthatSettings.create_key(sik).get()
    si = system.get_identity(settings.api_key, service_identity)
    return si.description_branding

def send_collection_message(sik, service_identity, email, app_id, message):
    json_rpc_id = guid()
    deferred.defer(_send_collection_message, sik, service_identity, email, app_id, message, json_rpc_id, _transactional=ndb.in_transaction())

def _send_collection_message(sik, service_identity, email, app_id, message, json_rpc_id):
    settings = RogerthatSettings.create_key(sik).get()
    member = MemberTO()
    member.member = email
    member.app_id = app_id
    member.alert_flags = 2
    try:

        messaging.send(settings.api_key, None, message, [], 1, [member], get_branding_key(sik, service_identity), None, json_rpc_id=json_rpc_id)
    except RogerthatApiException, e:
        if e.code != ROGERTHAT_EXCEPTION_CODE_MESSAGE_USER_NOT_FOUNDS:
            raise e
        logging.debug("Ignoring _send_collection_message user de-friended")


text:
namespace infrt {

mlir::SmallVector<mlir::Value, 4> cvtValueToValueRange(
    const mlir::Value &operand);

mlir::SmallVector<mlir::Value, 4> concatTwoValueRange(
    mlir::ValueRange operand_0, mlir::ValueRange operand_1);
}  // namespace infrt


text:
#include "MovingAverageTemplate.h"
#include "DataPlausibilityTemplate.h"

class Dcf77Analyser
{
public:
	uint16_t m_snap;
	uint32_t m_lastMin;

	int16_t m_hour, m_min, m_day, m_month, m_year, m_weekday, m_currentSec;
	bool m_parity_hour;
	bool m_parity_min;
	bool m_parity_date;
	uint16_t m_cntIsr;

	Dcf77Analyser();

	bool isMinute() const;
	void minuteRead();
	void feed(uint32_t msecs, uint16_t dt);

	void elaborate();
private:
	void ResetVector();
	uint8_t bcdbitsToInt(char *data, uint8_t size) const;
	bool checkParity(char *data, uint8_t size, char par) const;
	bool m_isMinute;
	int16_t m_driftCorrectionPerMinute;
	char m_fMatrix[62];
	Average<uint16_t, 8> m_drift; // not needed if we use a realtime clock
	Average<uint16_t, 100> m_value0;
	Average<uint16_t, 100> m_value1;
};


text:
"""
This example produces networks that can remember a variable-length sequence of bits. It is
intentionally very (overly?) simplistic just to show the usage of the NEAT library. However,
if you come up with a more interesting or impressive example, please submit a pull request!

This example also demonstrates the use of a custom activation function.
"""

from __future__ import print_function

#import math
import os
import random

import neat
import visualize

# Maximum length of the test sequence.
max_inputs = 2
# Maximum number of ignored inputs
max_ignore = 2
# Number of random examples each network is tested against.
num_tests = 2 ** (max_inputs+max_ignore+1)

def test_network(net, input_sequence, num_ignore):
    # Feed input bits to the network with the record bit set enabled and play bit disabled.
    net.reset()
    for s in input_sequence:
        inputs = [s, 1.0, 0.0]
        net.activate(inputs)

    # Feed a random number of random inputs to be ignored, with both
    # record and play bits disabled.
    for _ in range(num_ignore):
        inputs = [random.choice((0.0, 1.0)), 0.0, 0.0]
        net.activate(inputs)

    # Enable the play bit and get network output.
    outputs = []
    for s in input_sequence:
        inputs = [random.choice((0.0, 1.0)), 0.0, 1.0]
        outputs.append(net.activate(inputs))

    return outputs

def eval_genome(genome, config):
    net = neat.nn.RecurrentNetwork.create(genome, config)

    error = 0.0
    for _ in range(num_tests):
        num_inputs = random.randint(1, max_inputs)
        num_ignore = random.randint(0, max_ignore)

        # Random sequence of inputs.
        seq = [random.choice((0.0, 1.0)) for _ in range(num_inputs)]

        net.reset()
        outputs = test_network(net, seq, num_ignore)

        # Enable the play bit and get network output.
        for i, o in zip(seq, outputs):
            error += (o[0] - i) ** 2

    return 1.0 - (error / (max_inputs * num_tests))

def eval_genomes(genomes, config):
    for genome_id, genome in genomes:
        genome.fitness = eval_genome(genome, config)

def run():

    # Determine path to configuration file.
    local_dir = os.path.dirname(__file__)
    config_path = os.path.join(local_dir, 'config')
    config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction,
                         neat.DefaultSpeciesSet, neat.DefaultStagnation,
                         config_path)

    pop = neat.Population(config)
    stats = neat.StatisticsReporter()
    pop.add_reporter(stats)
    pop.add_reporter(neat.StdOutReporter(True))

    pe = neat.ParallelEvaluator(4, eval_genome)
    winner = pop.run(pe.evaluate, 1000)

    # Show output of the most fit genome against a random input.
    print('\nBest genome:\n{!s}'.format(winner))
    print('\nOutput:')
    winner_net = neat.nn.RecurrentNetwork.create(winner, config)
    for n in range(num_tests):
        print('\nRun {0} output:'.format(n))

        num_inputs = random.randint(1, max_inputs)
        num_ignore = random.randint(0, max_ignore)

        seq = [random.choice((0.0, 1.0)) for _ in range(num_inputs)]
        winner_net.reset()
        outputs = test_network(winner_net, seq, num_ignore)

        correct = True
        for i, o in zip(seq, outputs):
            print("\texpected {0:1.5f} got {1:1.5f}".format(i, o[0]))
            correct = correct and round(o[0]) == i
        print("OK" if correct else "FAIL")

    node_names = {-1: 'input', -2: 'record', -3: 'play', 0: 'output'}
    visualize.draw_net(config, winner, True, node_names=node_names)
    visualize.plot_stats(stats, ylog=False, view=True)

if __name__ == '__main__':
    run()


text:
'use strict';

const utils = require('../utils/utils');
const ember = require('../utils/ember');

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

const ERROR_MESSAGE = 'Use kebab-case in route path.';

module.exports = {
  meta: {
    docs: {
      description: 'Enforces usage of kebab-case (instead of snake_case or camelCase) in route paths',
      category: 'Best Practices',
      recommended: false
    },
    fixable: null,
    ERROR_MESSAGE
  },

  create(context) {
    return {
      CallExpression(node) {
        if (!ember.isRoute(node)) {
          return;
        }

        // Retrieve the path based on the call format used:
        // 1. this.route('route-and-path');
        // 2. this.route('route', { path: 'path' });

        const hasExplicitPathOption = utils.isObjectExpression(node.arguments[1]) && hasPropertyWithKeyName(node.arguments[1], 'path');
        const pathValueNode = hasExplicitPathOption ? getPropertyByKeyName(node.arguments[1], 'path').value : node.arguments[0];
        const pathValue = pathValueNode.value;

        const urlSegments = getStaticURLSegments(pathValue);

        if (urlSegments.some(urlPart => !isKebabCase(urlPart))) {
          context.report(pathValueNode, ERROR_MESSAGE);
        }
      },
    };
  }
};

function hasPropertyWithKeyName(objectExpression, keyName) {
  return getPropertyByKeyName(objectExpression, keyName) !== undefined;
}

function getPropertyByKeyName(objectExpression, keyName) {
  return objectExpression.properties.find(property => property.key.name === keyName);
}

function getStaticURLSegments(path) {
  return path
    .split('/')
    .filter(segment => !isDynamicSegment(segment) && !isWildcardSegment(segment) && segment !== '');
}

function isDynamicSegment(segment) {
  return segment.includes(':');
}

function isWildcardSegment(segment) {
  return segment.includes('*');
}

const KEBAB_CASE_REGEXP = /^[0-9a-z-]+$/;
function isKebabCase(str) {
  return str.match(KEBAB_CASE_REGEXP);
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SaNi.Mono.Graphics.Renderables
{
    [Flags()]
    public enum GeneratorFlags : short
    {
        None                        = 0,
        VaryingSpawnLocation        = 1,
        VaryingVelocity             = 2,
        VaryingAcceleration         = 4,
        VaryingScale                = 8,
        VaryingScaleAcceleration    = 16,
        UseScaleAcceleration        = 32,
        VaryingScaleVelocity        = 64,
        UseScaleVelocity            = 128,
        VaryingAngularVelocity      = 256,
        VaryingAngularAcceleration  = 512,
        VaryingDecayTime            = 1024,
        VaryingColor                = 2048,
        VaryingAttributes           = 4096
    }
}


text:
package org.apache.camel.component.jetty;

import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * Unit test to verify that the Jetty HTTP connector is correctly disconnected on shutdown
 */
public class JettyHttpEndpointDisconnectTest extends BaseJettyTest {

    private String serverUri = "http://localhost:" + getPort() + "/myservice";

    @Test
    public void testContextShutdownRemovesHttpConnector() throws Exception {
        context.stop();
        assertEquals(0, JettyHttpComponent.CONNECTORS.size(), "Connector should have been removed");
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("jetty:" + serverUri).to("mock:result");
            }
        };
    }
}


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Tools\Abstracts;

/**
 * Description of PhoneTypes
 *
 * @author allan
 */
abstract class PhoneTypes
{

    const BASIC        = 0;
    const TELEPHONE    = 1;
    const CELLPHONE    = 2;
    const NON_REGIONAL = 3;
    const SERVICE      = 4;

}