var mongoose = require('mongoose');
var async = require('async');
var _ = require('lodash');

var Categories = function (models, event) {
    var ExpensesSchema = mongoose.Schemas.expensesCategory;

    function updateParentsCategory(req, newCategoryId, parentId, modifier, callback) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);
        var id;
        var updateCriterior;

        if (modifier === 'add') {
            updateCriterior = {$addToSet: {child: newCategoryId}};
        } else {
            updateCriterior = {$pull: {child: newCategoryId}};
        }

        ExpensesCategory.findOneAndUpdate({_id: parentId}, updateCriterior, function (err, result) {
            if (err) {
                return callback(err);
            }

            if (!result || !result.parent) {
                return callback(null);
            }

            id = result.parent;
            updateParentsCategory(req, newCategoryId, id, modifier, callback);
        });
    }

    this.get = function (req, res, next) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);

        ExpensesCategory
            .find({})
            .populate('parent', 'name')
            .sort({'nestingLevel': 1})
            .exec(function (err, result) {
                if (err) {
                    return next(err);
                }

                res.status(200).send(result);
            });
    };

    this.getAll = function (req, res, next) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);

        ExpensesCategory
            .find({})
            .populate('parent', 'name')
            .sort({'nestingLevel': 1})
            .exec(function (err, result) {
                if (err) {
                    return next(err);
                }

                res.status(200).send({data: result});
            });
    };

    this.create = function (req, res, next) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);
        var body = req.body;
        var parentId = body.parent;
        var category;

        if (!Object.keys(body).length) {
            return res.status(400).send();
        }

        body.createdBy = {
            user: req.session.uId
        };

        body.editedBy = {
            user: req.session.uId
        };

        category = new ExpensesCategory(body);

        category.save(function (err, category) {
            var newModelId;
            if (err) {
                return next(err);
            }

            newModelId = category._id;

            updateParentsCategory(req, newModelId, parentId, 'add', function () {
                if (err) {
                    return next(err);
                }

                ExpensesCategory.findById(newModelId).populate('parent', 'name').exec(function (err, result) {
                    if (err) {
                        return next(err);
                    }

                    res.status(200).send(result);
                });
            });
        });
    };

    function updateNestingLevel(req, id, nestingLevel, callback) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);

        ExpensesCategory.find({parent: id}).exec(function (err, result) {
            var n = 0;
            if (result.length !== 0) {
                result.forEach(function (item) {
                    n++;

                    ExpensesCategory.findByIdAndUpdate(item._id, {nestingLevel: nestingLevel + 1}, {new: true}, function (err, res) {
                        if (result.length === n) {
                            updateNestingLevel(req, res._id, res.nestingLevel + 1, function () {
                                if (callback) {
                                    callback();
                                }
                            });
                        } else {
                            updateNestingLevel(req, res._id, res.nestingLevel + 1);
                        }
                    });
                });
            } else {
                if (callback) {
                    callback();
                }
            }
        });
    }

    function updateFullName(id, Model, cb) {
        var fullName;
        var parrentFullName;

        Model
            .findById(id)
            .populate('parent')
            .exec(function (err, category) {

                if (!category) {
                    return cb();
                }

                parrentFullName = category && category.parent ? category.parent.fullName : null;

                if (parrentFullName) {
                    fullName = parrentFullName + ' / ' + category.name;
                } else {
                    fullName = category.name;
                }

                if (!err) {
                    Model.findByIdAndUpdate(id, {$set: {fullName: fullName}}, {new: true}, function (err, result) {
                        if (err) {
                            return cb(err);
                        }

                        async.each(category.child, function (el, callback) {
                            updateFullName(el, Model, callback);
                        }, function (err, result) {
                            if (err) {
                                return cb(err);
                            }

                            cb();
                        });
                    });
                }
            });
    }

    this.update = function (req, res, next) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);
        var data = req.body;
        var _id = req.params.id;
        var parentId;
        var newParentId = data.parent;

        delete data.createdBy;

        ExpensesCategory.findOneAndUpdate({_id: _id}, data, function (err, result) {
            if (err) {
                return next(err);
            }

            parentId = result.parent;

            if (!data.isAllUpdate) {
                ExpensesCategory.findById(_id).populate('parent', 'name').exec(function (err, result) {
                    if (err) {
                        return next(err);
                    }

                    res.status(200).send(result);
                });
                return;
            }

            async.waterfall([
                function (cb) {
                    updateParentsCategory(req, _id, parentId, 'remove', cb);
                },

                function (cb) {
                    updateParentsCategory(req, _id, newParentId, 'add', cb);
                },

                function (cb) {
                    updateFullName(_id, ExpensesCategory, cb);
                },
                function (cb) {
                    if (data.isAllUpdate) {
                        updateNestingLevel(req, _id, data.nestingLevel, cb);
                    } else {
                        cb();
                    }
                }
            ], function (err) {
                if (err) {
                    return next(err);
                }

                ExpensesCategory.findById(_id).populate('parent', 'name').exec(function (err, result) {
                    if (err) {
                        return next(err);
                    }

                    res.status(200).send(result);
                });
            });
        });

    };

    this.remove = function (req, res, next) {
        var ExpensesCategory = models.get(req.session.lastDb, 'expensesCategory', ExpensesSchema);
        var _id = req.param('id');
        var parentId;

        ExpensesCategory.findById(_id, {productsCount: 1}, function (err, result) {
            if (err) {
                return next(err);
            }

            if (!result.productsCount) {
                ExpensesCategory.findOneAndRemove({_id: _id}, function (err, result) {
                    if (err) {
                        return next(err);
                    }

                    parentId = result.parent;

                    updateParentsCategory(req, _id, parentId, 'remove', function () {
                        if (err) {
                            return next(err);
                        }

                        res.status(200).send(result);
                    });

                });
            } else {
                res.status(400).send({error: "You can't delete this Category until it has Charts of Account"});
            }
        });
    };

};

module.exports = Categories;

{'repo_name': 'EasyERP/EasyERP_open_source', 'stars': '153', 'repo_language': 'JavaScript', 'file_name': 'ListItemView.js', 'mime_type': 'text/plain', 'hash': 3777893753250585615, 'source_dataset': 'data'}


/* @flow */

const compile = require('lodash.template')
const compileOptions = {
  escape: /{{([^{][\s\S]+?[^}])}}/g,
  interpolate: /{{{([\s\S]+?)}}}/g
}

export type ParsedTemplate = {
  head: (data: any) => string;
  neck: (data: any) => string;
  tail: (data: any) => string;
};

export function parseTemplate (
  template: string,
  contentPlaceholder?: string = '<!--vue-ssr-outlet-->'
): ParsedTemplate {
  if (typeof template === 'object') {
    return template
  }

  let i = template.indexOf('</head>')
  const j = template.indexOf(contentPlaceholder)

  if (j < 0) {
    throw new Error(`Content placeholder not found in template.`)
  }

  if (i < 0) {
    i = template.indexOf('<body>')
    if (i < 0) {
      i = j
    }
  }

  return {
    head: compile(template.slice(0, i), compileOptions),
    neck: compile(template.slice(i, j), compileOptions),
    tail: compile(template.slice(j + contentPlaceholder.length), compileOptions)
  }
}

{'repo_name': 'D0g3-Lab/H1ve', 'stars': '287', 'repo_language': 'Python', 'file_name': 'b295b033364d_add_ondelete_cascade_to_foreign_keys.py', 'mime_type': 'text/x-python', 'hash': -5206391989145643970, 'source_dataset': 'data'}


/*
Dwarf Therapist
Copyright (c) 2009 Trey Stout (chmod)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#include "uniform.h"
#include "item.h"
#include "itemuniform.h"
#include "itemdefuniform.h"

Uniform::Uniform(DFInstance *df, QObject *parent)
    : QObject(parent)
    , m_df(df)
    , m_first_check(true)
{
}

Uniform::~Uniform()
{
    foreach (const QList<ItemDefUniform*> &list, m_uniform_items) {
        foreach (ItemDefUniform* def, list) {
            delete def;
        }
    }
}

void Uniform::add_uniform_item(ITEM_TYPE itype, short sub_type, short job_skill, int count){
    ItemDefUniform *uItem = new ItemDefUniform(itype,sub_type,job_skill,this);
    add_uniform_item(itype,uItem,count);
}

void Uniform::add_uniform_item(ITEM_TYPE itype, short sub_type, QList<int> job_skills, int count){
    ItemDefUniform *uItem = new ItemDefUniform(itype,sub_type,job_skills,this);
    add_uniform_item(itype,uItem,count);
}

void Uniform::add_uniform_item(VIRTADDR addr, ITEM_TYPE itype, int count){
    ItemDefUniform *uItem;
    //backpacks, quivers and flasks are assigned specific items, so pass the id number rather than an address
    if(!Item::is_supplies(itype) && !Item::is_ranged_equipment(itype)){
        uItem = new ItemDefUniform(m_df,addr,this);
    }else{
        uItem = new ItemDefUniform(itype,m_df->read_int(addr),this);
    }
    add_uniform_item(itype,uItem,count);
}

void Uniform::add_uniform_item(ITEM_TYPE itype, ItemDefUniform *uItem, int count){
    //if there's no item type, this indicates that it's a specifically chosen item, so reset the item type so we can find it later
    if(uItem->item_type() == NONE)
        uItem->item_type(itype);

    uItem->add_to_stack(count-1); //uniform item stack size start at 1

    m_uniform_items[itype].append(uItem);
    //assigning boots to a uniform only lists one item, but
    if (uItem->id() <= 0 && (itype == SHOES || itype == GLOVES))
        m_uniform_items[itype].append(new ItemDefUniform(*uItem));
    if (count > 0)
        add_equip_count(itype,count);

    uItem = 0;
}

void Uniform::add_equip_count(ITEM_TYPE itype, int count){
    int current_count = m_equip_counts.value(itype);
    if(itype == SHOES || itype == GLOVES)
        count *=2;

    m_equip_counts.insert(itype,current_count+count);

    //add group counts as well
    if(Item::is_melee_equipment(itype))
        add_equip_count(MELEE_EQUIPMENT,count);
    else if(Item::is_supplies(itype))
        add_equip_count(SUPPLIES,count);
    else if(Item::is_ranged_equipment(itype))
        add_equip_count(RANGED_EQUIPMENT,count);
}

void Uniform::clear(){
    m_equip_counts.clear();
    m_missing_items.clear();
    m_first_check = true;
}

int Uniform::get_remaining_required(ITEM_TYPE itype){
    int count = 0;
    foreach(ITEM_TYPE key, m_uniform_items.uniqueKeys()){
        QList<ItemDefUniform*> items = m_uniform_items.value(key);
        foreach(ItemDefUniform *u, items){
            if(u->get_stack_size() > 0 && (u->item_type() == itype || Item::type_in_group(itype,u->item_type())))
                count += u->get_stack_size();
        }
    }
    return count;
}

int Uniform::get_missing_equip_count(ITEM_TYPE itype){
    int count = 0;
    if(m_missing_items.count() == 0)
        return count;
    if(m_missing_counts.count() <= 0){
        load_missing_counts();
    }
    return m_missing_counts.value(itype);
}

void Uniform::load_missing_counts(){
    //ensure we have a NONE and group counts
    m_missing_counts.insert(NONE,0);
    m_missing_counts.insert(MELEE_EQUIPMENT,0);
    m_missing_counts.insert(RANGED_EQUIPMENT,0);
    m_missing_counts.insert(SUPPLIES,0);

    foreach(ITEM_TYPE itype, m_missing_items.uniqueKeys()){
        foreach(ItemDefUniform *item_miss, m_missing_items.value(itype)){
            int missing_count = m_missing_counts.value(itype,0);
            int item_qty = item_miss->get_stack_size();
            if(item_qty > 0){
                missing_count += item_qty;
                m_missing_counts[NONE] += item_qty;
                //add group counts as well
                if(Item::is_melee_equipment(itype))
                    m_missing_counts[MELEE_EQUIPMENT] += item_qty;
                else if(Item::is_supplies(itype))
                    m_missing_counts[SUPPLIES] += item_qty;
                else if(Item::is_ranged_equipment(itype))
                    m_missing_counts[RANGED_EQUIPMENT] += item_qty;
            }
            m_missing_counts.insert(itype,missing_count);
        }
    }
}

float Uniform::get_uniform_rating(ITEM_TYPE itype){
    float rating = 100;
    if(m_first_check)
        return rating;

    float required = 0;
    float missing = get_missing_equip_count(itype);

    if(itype != NONE){
        required = (float)m_equip_counts.value(itype);
    }else{
        foreach(ITEM_TYPE i,m_equip_counts.uniqueKeys()){
            if(i <= NUM_OF_ITEM_TYPES)
                required += m_equip_counts.value(i,0);
        }
    }

    if(required <= 0)
        required = 1;
    rating = (required-missing) / required * 100.0f;

    if(rating > 100)
        rating = 100.0f;

    return rating;
}

void Uniform::check_uniform(QString category_name, Item *item_inv){
    if(m_uniform_items.count() <= 0)
        return;
    //make a copy of our full uniform list to a missing list to remove items from
    if(m_first_check){
        m_missing_items = m_uniform_items;
        m_first_check = false;
    }
    ITEM_TYPE itype = item_inv->item_type();
    //no address indicates a placeholder item for uncovered/missing stuff
    if(item_inv->address() != 0 && category_name != Item::missing_group_name() && category_name != Item::uncovered_group_name()){
        //check our uniform's item list
        if(m_missing_items.value(itype).count() > 0){
            int idx = 0;
            //get the qty of this item type still required, based on the stack size
            int req_count = get_remaining_required(item_inv->item_type());
            int inv_qty = item_inv->get_stack_size();
            for(idx = m_missing_items.value(itype).count()-1; idx >= 0; idx--){
                //if the inventory quantity has been used up, or the required item count for the uniform met, quit
                if(inv_qty <= 0 || req_count <= 0)
                    break;

                ItemDefUniform *item_uni_miss = m_missing_items.value(itype).at(idx); //get a missing item of the same type
                Item *item_miss = new ItemUniform(m_df,item_uni_miss,this);

                bool match = false;

                //check for a specific item id
                if(item_miss->id() > -1){
                    if(item_miss->id() == item_inv->id()){
                        match = true;
                    }else{
                        continue;
                    }
                }else{
                    match = (item_uni_miss->indv_choice() ||
                             (
                                 (item_uni_miss->item_subtype() < 0 || item_uni_miss->item_subtype() == item_inv->item_subtype()) &&
                                 (
                                     (item_uni_miss->mat_flag() == MAT_NONE && item_miss->mat_type() < 0 && item_miss->mat_index() < 0) ||
                                     (item_miss->mat_type() < 0 && item_miss->mat_index() < 0 && item_inv->mat_flags().has_flag(item_uni_miss->mat_flag())) ||
                                      //QString::compare(item_miss->get_material_name(),item_inv->get_material_name_base(),Qt::CaseInsensitive)==0) ||
                                     ((item_miss->mat_type() >= 0 || item_miss->mat_index() >= 0) &&
                                      item_miss->mat_type() == item_inv->mat_type() && item_miss->mat_index() == item_inv->mat_index())
                                     ) &&
                                 (item_uni_miss->job_skills().count() == 0 || (item_uni_miss->job_skills().contains(item_inv->melee_skill()) || item_uni_miss->job_skills().contains(item_inv->ranged_skill())))
                                 )
                             );
                }
                delete item_miss;
                if(match){
                    QList<ItemDefUniform*> missing_items = m_missing_items.take(itype);

                    req_count -= inv_qty; //reduce the required count
                    missing_items.at(idx)->add_to_stack(-inv_qty); //reduce the uniform item's stack
                    int curr_qty = missing_items.at(idx)->get_stack_size(); //after applying the inventory quantity
                    if(curr_qty <= 0){
                        inv_qty = abs(curr_qty); //update the leftover inventory quantity
                        missing_items.removeAt(idx); //item isn't missing, remove it
                    }

                    if(missing_items.count() > 0)
                        m_missing_items.insert(itype,missing_items);
                }
            }
        }
    }
}

{'repo_name': 'Dwarf-Therapist/Dwarf-Therapist', 'stars': '260', 'repo_language': 'C++', 'file_name': 'format', 'mime_type': 'text/plain', 'hash': 3262610645104812637, 'source_dataset': 'data'}


/* iCheck plugin Square skin, green
----------------------------------- */
.icheckbox_square-green,
.iradio_square-green {
    display: inline-block;
    *display: inline;
    vertical-align: middle;
    margin: 0;
    padding: 0;
    width: 22px;
    height: 22px;
    background: url(green.png) no-repeat;
    border: none;
    cursor: pointer;
}

.icheckbox_square-green {
    background-position: 0 0;
}
    .icheckbox_square-green.hover {
        background-position: -24px 0;
    }
    .icheckbox_square-green.checked {
        background-position: -48px 0;
    }
    .icheckbox_square-green.disabled {
        background-position: -72px 0;
        cursor: default;
    }
    .icheckbox_square-green.checked.disabled {
        background-position: -96px 0;
    }

.iradio_square-green {
    background-position: -120px 0;
}
    .iradio_square-green.hover {
        background-position: -144px 0;
    }
    .iradio_square-green.checked {
        background-position: -168px 0;
    }
    .iradio_square-green.disabled {
        background-position: -192px 0;
        cursor: default;
    }
    .iradio_square-green.checked.disabled {
        background-position: -216px 0;
    }

/* Retina support */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
       only screen and (-moz-min-device-pixel-ratio: 1.5),
       only screen and (-o-min-device-pixel-ratio: 3/2),
       only screen and (min-device-pixel-ratio: 1.5) {
    .icheckbox_square-green,
    .iradio_square-green {
        background-image: url(green@2x.png);
        -webkit-background-size: 240px 24px;
        background-size: 240px 24px;
    }
}

{'repo_name': 'zhl2008/awd-platform', 'stars': '335', 'repo_language': 'Python', 'file_name': 'SUMSQ.data', 'mime_type': 'text/plain', 'hash': -6508312934482677725, 'source_dataset': 'data'}


# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 4.1.16"

gemspec path: "../"

{'repo_name': 'Semantic-Org/Semantic-UI-Rails-LESS', 'stars': '126', 'repo_language': 'JavaScript', 'file_name': 'semantic_ui.js.erb', 'mime_type': 'text/plain', 'hash': 6513027870579901880, 'source_dataset': 'data'}


/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */
#include <bluetooth/mesh/models.h>
#include "model_utils.h"
#include "mesh/mesh.h"

#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_MESH_DEBUG_MODEL)
#define LOG_MODULE_NAME bt_mesh_mod
#include "common/log.h"

/** Unknown encoded transition time value */
#define TRANSITION_TIME_UNKNOWN (0x3F)

/** Delay field step factor in milliseconds */
#define DELAY_TIME_STEP_MS (5)

#define MOD_ACKD_TIMEOUT_BASE 200
#define MOD_ACKD_TIMEOUT_PER_HOP 50

int tid_check_and_update(struct bt_mesh_tid_ctx *prev_transaction, uint8_t tid,
			 const struct bt_mesh_msg_ctx *ctx)
{
	/* This updates the timestamp in the progress: */
	int64_t uptime_delta = k_uptime_delta(&prev_transaction->timestamp);

	if (prev_transaction->src == ctx->addr &&
	    prev_transaction->dst == ctx->recv_dst &&
	    prev_transaction->tid == tid && uptime_delta < 6000) {
		return -EALREADY;
	}

	prev_transaction->src = ctx->addr;
	prev_transaction->dst = ctx->recv_dst;
	prev_transaction->tid = tid;

	return 0;
}

static const uint32_t model_transition_res[] = {
	100,
	1 * MSEC_PER_SEC,
	10 * MSEC_PER_SEC,
	60 * 10 * MSEC_PER_SEC,
};

int32_t model_transition_decode(uint8_t encoded_transition)
{
	uint8_t steps = (encoded_transition & 0x3f);
	uint8_t res = (encoded_transition >> 6);

	return (steps == TRANSITION_TIME_UNKNOWN) ?
		       SYS_FOREVER_MS :
		       (model_transition_res[res] * steps);
}

uint8_t model_transition_encode(int32_t transition_time)
{
	if (transition_time == 0) {
		return 0;
	}
	if (transition_time == SYS_FOREVER_MS) {
		return TRANSITION_TIME_UNKNOWN;
	}

	/* Even though we're only able to encode values up to 6200 ms in
	 * 100 ms step resolution, values between 6200 and 6600 ms are closer
	 * to 6200 ms than 7000 ms, which would be the nearest 1-second step
	 * representation. Similar cases exist for the other step resolutions
	 * too, so we'll use these custom limits instead of checking against
	 * the max value of each step resolution. The formula for the limit is
	 * ((0x3e * res[i]) + (((0x3e * res[i]) / res[i+1]) + 1) * res[i+1])/2.
	 */
	const int32_t limits[] = {
		6600,
		66 * MSEC_PER_SEC,
		910 * MSEC_PER_SEC,
		60 * 620 * MSEC_PER_SEC,
	};

	for (uint8_t i = 0; i < ARRAY_SIZE(model_transition_res); ++i) {
		if (transition_time > limits[i]) {
			continue;
		}

		uint8_t steps = ((transition_time + model_transition_res[i] / 2) /
			      model_transition_res[i]);
		steps = MAX(1, steps);
		steps = MIN(0x3e, steps);
		return (i << 6) | steps;
	}

	return TRANSITION_TIME_UNKNOWN;
}

uint8_t model_delay_encode(uint32_t delay)
{
	return delay / DELAY_TIME_STEP_MS;
}

int32_t model_delay_decode(uint8_t encoded_delay)
{
	return encoded_delay * 5;
}

int model_send(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
	       struct net_buf_simple *buf)
{
	if (!ctx && !mod->pub) {
		return -ENOTSUP;
	}

	if (ctx) {
		return bt_mesh_model_send(mod, ctx, buf, NULL, 0);
	}

	net_buf_simple_reset(mod->pub->msg);
	net_buf_simple_add_mem(mod->pub->msg, buf->data, buf->len);

	return bt_mesh_model_publish(mod);
}

int model_ackd_send(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
		    struct net_buf_simple *buf,
		    struct bt_mesh_model_ack_ctx *ack, uint32_t rsp_op,
		    void *user_data)
{
	if (ack &&
	    model_ack_ctx_prepare(ack, rsp_op, ctx ? ctx->addr : mod->pub->addr,
				  user_data) != 0) {
		return -EALREADY;
	}

	int retval = model_send(mod, ctx, buf);

	if (ack) {
		if (retval == 0) {
			uint8_t ttl = (ctx ? ctx->send_ttl : mod->pub->ttl);
			int32_t time = (MOD_ACKD_TIMEOUT_BASE +
				      ttl * MOD_ACKD_TIMEOUT_PER_HOP);
			return model_ack_wait(ack, time);
		}

		model_ack_clear(ack);
	}
	return retval;
}

bool bt_mesh_model_pub_is_unicast(const struct bt_mesh_model *mod)
{
	return mod->pub && BT_MESH_ADDR_IS_UNICAST(mod->pub->addr);
}

{'repo_name': 'nrfconnect/sdk-nrf', 'stars': '171', 'repo_language': 'C', 'file_name': 'reports.cmake', 'mime_type': 'text/plain', 'hash': -4565089191132104155, 'source_dataset': 'data'}


{'repo_name': 'theKashey/react-imported-component', 'stars': '453', 'repo_language': 'TypeScript', 'file_name': 'package.json', 'mime_type': 'text/plain', 'hash': -2566206154375556451, 'source_dataset': 'data'}


<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>小呆导航程序员版旧站点迁移说明 | 小呆导航</title>
    <meta name="keywords" content="小呆博客,WEBJIKE博客,小呆导航博客,程序员博客" />
    <meta name="description" content="WEBJIKE博客是小呆导航站长的个人博客，致力于为广大用户提供最前沿的前端开发技术、平面设计、作品分享、网站推荐、资源共享，开发交流等资讯。" />

<link rel="shortcut icon"  type="image/x-icon" href="/favicon.png">
<link rel="stylesheet" href="https://cdn.bootcss.com/zui/1.8.1/css/zui.min.css">
<link href="/css/style.css" rel="stylesheet">
<link href="/css/media.css" rel="stylesheet">
<link href="/css/font-awesome.min.css" rel="stylesheet">

    小呆导航

教程资源

高清图库

软件下载

个人博客

在线留言

友情链接

关于本站

<button class="bar-btn visible-xs visible-sm">

</button>
<button class="nav-btn visible-xs visible-sm">

</button>

导航目录

                前端开发

视频教程

在线学习

碎片学习

学习工具

WEB公共库

前端组织/团队

社区/论坛

前端框架 - UI

前端框架 - JS

前端插件

移动框架

预处理器

字体图标

构建工具

模块加载

包管理器

模板引擎

游戏引擎

代码高亮

代码托管

博客系统

域名/服务器

辅助工具

站长工具

图片素材

精选酷站

互联网资讯

工作/私单

应用程序

                界面设计

学习教程

灵感采集

界面交互

在线工具

icon图标

设计素材

图库素材

颜色搭配

字体字形

                影视后期

学习教程

特效动画

资讯交流

软件插件

摄影摄像

素材资源

                日常办公

热门推荐

效率资源

技能提升

在线工具

团队协作

电子邮箱

文案策划

文档模板

工作兼职

工作 / 学习 / 生活 / 网址导航

@小呆导航 V2.0

小呆导航程序员版旧站点迁移说明

                  作者：webjike
                   · 2018-05-15

                      网站公告

4月29号，小呆导航新版本上线后旧版本数据已经迁移到v1目录下面，旧站点链接包括程序员版链接已经全部替换为新版了，例如访问旧版本链接“webjike.com/web.html”会跳转到新版的小呆导航前端版。

这几天在百度站长平台查看网站数据的时候仍可以看到一些关于小呆导航程序员版的搜索词，若大家对新版网站有什么不满意的地方，欢迎在线留言向我反馈，帮助我更好地完善它。你仍然可以愉快地使用旧版本站点，不过我更建议你使用新版本的导航，因为旧版本已经不再维护，且收录的内容较少，已经不能满足使用需求了。

你可以点击网站右上角的“切回旧版”按钮访问旧版本小呆导航，或者直接访问：http://webjike.com/v1/

旧站点小呆导航程序员版对应的链接是：http://webjike.com/v1/web.html

上一篇: 前端导航5-16日更新记录

下一篇: 前端导航5-14日更新记录

热门推荐

小呆导航使用小技巧，萌新必看

阿里云虚拟主机HTTPS配置方法，带你避坑

V2EX账号被封，对自己个人行为反思

热门标签

                        开发日记

                        网站公告

                        生活琐事

                        分享

                        HTTPS

                        虚拟主机

                        建站技巧

本站内容采自互联网，如果某些内容侵犯了你的权益，请立即联系我，我将尽快删除相关内容，联系邮箱：1371096680@qq.com

Copyright © 2017-2018 小呆导航（webjike.com）All Rights Reserved

{'repo_name': 'xiaodai945/WEBJIKE', 'stars': '281', 'repo_language': 'HTML', 'file_name': '933.html', 'mime_type': 'text/html', 'hash': -4970842889602277516, 'source_dataset': 'data'}


import os from 'os';
import type { InternalApolloServerPlugin } from '../internalPlugin';
import { v4 as uuidv4 } from 'uuid';
import { printSchema, validateSchema, buildSchema } from 'graphql';
import { SchemaReporter } from './schemaReporter';
import createSHA from '../../utils/createSHA';

export interface ApolloServerPluginSchemaReportingOptions {
  /**
   * The schema reporter waits before starting reporting.
   * By default, the report waits some random amount of time between 0 and 10 seconds.
   * A longer interval leads to more staggered starts which means it is less likely
   * multiple servers will get asked to upload the same schema.
   *
   * If this server runs in lambda or in other constrained environments it would be useful
   * to decrease the schema reporting max wait time to be less than default.
   *
   * This number will be the max for the range in ms that the schema reporter will
   * wait before starting to report.
   */
  initialDelayMaxMs?: number;
  /**
   * Override the reported schema that is reported to the Apollo registry. This
   * schema does not go through any normalizations and the string is directly
   * sent to the Apollo registry. This can be useful for comments or other
   * ordering and whitespace changes that get stripped when generating a
   * `GraphQLSchema`.
   *
   * **If you pass this option to this plugin, you should explicitly configure
   * `ApolloServerPluginUsageReporting` and pass the same value to its
   * `overrideReportedSchema` option.** This ensures that the schema ID
   * associated with requests reported by the usage reporting plugin matches the
   * schema ID that this plugin reports. For example:
   *
   * ```js
   * new ApolloServer({
   *   plugins: [
   *     ApolloServerPluginSchemaReporting({overrideReportedSchema: schema}),
   *     ApolloServerPluginUsageReporting({overrideReportedSchema: schema}),
   *   ],
   * })
   * ```
   */
  overrideReportedSchema?: string;
  /**
   * The URL to use for reporting schemas. Primarily for testing and internal
   * Apollo use.
   */
  endpointUrl?: string;
}

export function ApolloServerPluginSchemaReporting(
  {
    initialDelayMaxMs,
    overrideReportedSchema,
    endpointUrl,
  }: ApolloServerPluginSchemaReportingOptions = Object.create(null),
): InternalApolloServerPlugin {
  const bootId = uuidv4();

  return {
    __internal_plugin_id__() {
      return 'SchemaReporting';
    },
    async serverWillStart({ apollo, schema, logger }) {
      const { key, graphId } = apollo;
      if (!key) {
        throw Error(
          'To use ApolloServerPluginSchemaReporting, you must provide an Apollo API ' +
            'key, via the APOLLO_KEY environment variable or via `new ApolloServer({apollo: {key})`',
        );
      }
      if (!graphId) {
        throw Error(
          "To use ApolloServerPluginSchemaReporting, you must provide your graph's ID, " +
            "either by using an API key starting with 'service:',  or by providing it explicitly via " +
            'the APOLLO_GRAPH_ID environment variable or via `new ApolloServer({apollo: {graphId}})`',
        );
      }

      // Ensure a provided override schema can be parsed and validated
      if (overrideReportedSchema) {
        try {
          const validationErrors = validateSchema(
            buildSchema(overrideReportedSchema, { noLocation: true }),
          );
          if (validationErrors.length) {
            throw new Error(
              validationErrors.map((error) => error.message).join('\n'),
            );
          }
        } catch (err) {
          throw new Error(
            'The schema provided to overrideReportedSchema failed to parse or ' +
              `validate: ${err.message}`,
          );
        }
      }

      const executableSchema = overrideReportedSchema ?? printSchema(schema);
      const executableSchemaId = computeExecutableSchemaId(executableSchema);

      if (overrideReportedSchema !== undefined) {
        logger.info(
          'Apollo schema reporting: schema to report has been overridden',
        );
      }
      if (endpointUrl !== undefined) {
        logger.info(
          `Apollo schema reporting: schema reporting URL override: ${endpointUrl}`,
        );
      }

      const serverInfo = {
        bootId,
        graphVariant: apollo.graphVariant,
        // The infra environment in which this edge server is running, e.g. localhost, Kubernetes
        // Length must be <= 256 characters.
        platform: process.env.APOLLO_SERVER_PLATFORM || 'local',
        runtimeVersion: `node ${process.version}`,
        executableSchemaId: executableSchemaId,
        // An identifier used to distinguish the version of the server code such as git or docker sha.
        // Length must be <= 256 charecters
        userVersion: process.env.APOLLO_SERVER_USER_VERSION,
        // "An identifier for the server instance. Length must be <= 256 characters.
        serverId:
          process.env.APOLLO_SERVER_ID || process.env.HOSTNAME || os.hostname(),
        libraryVersion: `apollo-server-core@${
          require('../../../package.json').version
        }`,
      };

      logger.info(
        'Apollo schema reporting starting! See your graph at ' +
          `https://studio.apollographql.com/graph/${encodeURIComponent(
            graphId,
          )}/?variant=${encodeURIComponent(
            apollo.graphVariant,
          )} with server info ${JSON.stringify(serverInfo)}`,
      );

      const schemaReporter = new SchemaReporter({
        serverInfo,
        schemaSdl: executableSchema,
        apiKey: key,
        endpointUrl,
        logger,
        // Jitter the startup between 0 and 10 seconds
        initialReportingDelayInMs: Math.floor(
          Math.random() * (initialDelayMaxMs ?? 10_000),
        ),
        fallbackReportingDelayInMs: 20_000,
      });

      schemaReporter.start();

      return {
        async serverWillStop() {
          schemaReporter.stop();
        },
      };
    },
  };
}

export function computeExecutableSchemaId(schema: string): string {
  return createSHA('sha256').update(schema).digest('hex');
}

{'repo_name': 'apollographql/apollo-server', 'stars': '9921', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 774107403561920750, 'source_dataset': 'data'}


all:
	echo >&2 "Must specify target."

package:
	python3 ./setup.py sdist bdist_wheel

local_install:
	python3 -m pip install -e .

push:
	python3 -m twine upload --repository testpypi dist/*

clean:
	rm -rf build/ dist/ *.egg-info/
	rm -f .coverage
	find . -name '*.pyc' -delete
	find . -name '__pycache__' -delete

.PHONY: all clean package local_install push clean

{'repo_name': 'facebook/ThreatExchange', 'stars': '759', 'repo_language': 'C++', 'file_name': 'threat_exchange.md', 'mime_type': 'text/plain', 'hash': 8551070788341858837, 'source_dataset': 'data'}


package com.alg.top20.trees.size;

import java.util.Random;

import com.alg.top20.trees.size.TreeNode;
import com.alg.top20.trees.size.TreeSize;

public class Driver {

	private static void add(TreeNode root, TreeNode tmp) {
		Random r = new Random(100);
		while (true) {
			if (r.nextInt(2) == 0) {
				if (root.left == null) {
					root.left = tmp;
					return;
				} else {
					root = root.left;
				}
			} else {
				if (root.right == null) {
					root.right = tmp;
					return;
				} else {
					root = root.right;
				}
			}
		}
	}

	public static void main(String[] args) {
		int size = Integer.parseInt(args[0]);

		System.out.println("Constructing binary tree");
		TreeNode root = new TreeNode(0);
		for (int i = 1; i < size; ++i) {
			TreeNode tmp = new TreeNode(i);
			add(root, tmp);
		}

		System.out.println("Completed");
		//System.out.println(treeSize1(root));
		System.out.println(TreeSize.treeSize2(root));
	}
}

{'repo_name': 'algorithmica-repository/top20', 'stars': '122', 'repo_language': 'Java', 'file_name': 'WeightedUnionCompressionSet.java', 'mime_type': 'text/plain', 'hash': -7038147683978527867, 'source_dataset': 'data'}


package ipam

import (
	"encoding/json"
	"fmt"
	"net"
	"strings"
	"sync"

	"github.com/docker/libnetwork/datastore"
	"github.com/docker/libnetwork/ipamapi"
	"github.com/docker/libnetwork/types"
)

// SubnetKey is the pointer to the configured pools in each address space
type SubnetKey struct {
	AddressSpace string
	Subnet       string
	ChildSubnet  string
}

// PoolData contains the configured pool data
type PoolData struct {
	ParentKey SubnetKey
	Pool      *net.IPNet
	Range     *AddressRange `json:",omitempty"`
	RefCount  int
}

// addrSpace contains the pool configurations for the address space
type addrSpace struct {
	subnets  map[SubnetKey]*PoolData
	dbIndex  uint64
	dbExists bool
	id       string
	scope    string
	ds       datastore.DataStore
	alloc    *Allocator
	sync.Mutex
}

// AddressRange specifies first and last ip ordinal which
// identifies a range in a pool of addresses
type AddressRange struct {
	Sub        *net.IPNet
	Start, End uint64
}

// String returns the string form of the AddressRange object
func (r *AddressRange) String() string {
	return fmt.Sprintf("Sub: %s, range [%d, %d]", r.Sub, r.Start, r.End)
}

// MarshalJSON returns the JSON encoding of the Range object
func (r *AddressRange) MarshalJSON() ([]byte, error) {
	m := map[string]interface{}{
		"Sub":   r.Sub.String(),
		"Start": r.Start,
		"End":   r.End,
	}
	return json.Marshal(m)
}

// UnmarshalJSON decodes data into the Range object
func (r *AddressRange) UnmarshalJSON(data []byte) error {
	m := map[string]interface{}{}
	err := json.Unmarshal(data, &m)
	if err != nil {
		return err
	}
	if r.Sub, err = types.ParseCIDR(m["Sub"].(string)); err != nil {
		return err
	}
	r.Start = uint64(m["Start"].(float64))
	r.End = uint64(m["End"].(float64))
	return nil
}

// String returns the string form of the SubnetKey object
func (s *SubnetKey) String() string {
	k := fmt.Sprintf("%s/%s", s.AddressSpace, s.Subnet)
	if s.ChildSubnet != "" {
		k = fmt.Sprintf("%s/%s", k, s.ChildSubnet)
	}
	return k
}

// FromString populates the SubnetKey object reading it from string
func (s *SubnetKey) FromString(str string) error {
	if str == "" || !strings.Contains(str, "/") {
		return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)
	}

	p := strings.Split(str, "/")
	if len(p) != 3 && len(p) != 5 {
		return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)
	}
	s.AddressSpace = p[0]
	s.Subnet = fmt.Sprintf("%s/%s", p[1], p[2])
	if len(p) == 5 {
		s.ChildSubnet = fmt.Sprintf("%s/%s", p[3], p[4])
	}

	return nil
}

// String returns the string form of the PoolData object
func (p *PoolData) String() string {
	return fmt.Sprintf("ParentKey: %s, Pool: %s, Range: %s, RefCount: %d",
		p.ParentKey.String(), p.Pool.String(), p.Range, p.RefCount)
}

// MarshalJSON returns the JSON encoding of the PoolData object
func (p *PoolData) MarshalJSON() ([]byte, error) {
	m := map[string]interface{}{
		"ParentKey": p.ParentKey,
		"RefCount":  p.RefCount,
	}
	if p.Pool != nil {
		m["Pool"] = p.Pool.String()
	}
	if p.Range != nil {
		m["Range"] = p.Range
	}
	return json.Marshal(m)
}

// UnmarshalJSON decodes data into the PoolData object
func (p *PoolData) UnmarshalJSON(data []byte) error {
	var (
		err error
		t   struct {
			ParentKey SubnetKey
			Pool      string
			Range     *AddressRange `json:",omitempty"`
			RefCount  int
		}
	)

	if err = json.Unmarshal(data, &t); err != nil {
		return err
	}

	p.ParentKey = t.ParentKey
	p.Range = t.Range
	p.RefCount = t.RefCount
	if t.Pool != "" {
		if p.Pool, err = types.ParseCIDR(t.Pool); err != nil {
			return err
		}
	}

	return nil
}

// MarshalJSON returns the JSON encoding of the addrSpace object
func (aSpace *addrSpace) MarshalJSON() ([]byte, error) {
	aSpace.Lock()
	defer aSpace.Unlock()

	m := map[string]interface{}{
		"Scope": string(aSpace.scope),
	}

	if aSpace.subnets != nil {
		s := map[string]*PoolData{}
		for k, v := range aSpace.subnets {
			s[k.String()] = v
		}
		m["Subnets"] = s
	}

	return json.Marshal(m)
}

// UnmarshalJSON decodes data into the addrSpace object
func (aSpace *addrSpace) UnmarshalJSON(data []byte) error {
	aSpace.Lock()
	defer aSpace.Unlock()

	m := map[string]interface{}{}
	err := json.Unmarshal(data, &m)
	if err != nil {
		return err
	}

	aSpace.scope = datastore.LocalScope
	s := m["Scope"].(string)
	if s == string(datastore.GlobalScope) {
		aSpace.scope = datastore.GlobalScope
	}

	if v, ok := m["Subnets"]; ok {
		sb, _ := json.Marshal(v)
		var s map[string]*PoolData
		err := json.Unmarshal(sb, &s)
		if err != nil {
			return err
		}
		for ks, v := range s {
			k := SubnetKey{}
			k.FromString(ks)
			aSpace.subnets[k] = v
		}
	}

	return nil
}

// CopyTo deep copies the pool data to the destination pooldata
func (p *PoolData) CopyTo(dstP *PoolData) error {
	dstP.ParentKey = p.ParentKey
	dstP.Pool = types.GetIPNetCopy(p.Pool)

	if p.Range != nil {
		dstP.Range = &AddressRange{}
		dstP.Range.Sub = types.GetIPNetCopy(p.Range.Sub)
		dstP.Range.Start = p.Range.Start
		dstP.Range.End = p.Range.End
	}

	dstP.RefCount = p.RefCount
	return nil
}

func (aSpace *addrSpace) CopyTo(o datastore.KVObject) error {
	aSpace.Lock()
	defer aSpace.Unlock()

	dstAspace := o.(*addrSpace)

	dstAspace.id = aSpace.id
	dstAspace.ds = aSpace.ds
	dstAspace.alloc = aSpace.alloc
	dstAspace.scope = aSpace.scope
	dstAspace.dbIndex = aSpace.dbIndex
	dstAspace.dbExists = aSpace.dbExists

	dstAspace.subnets = make(map[SubnetKey]*PoolData)
	for k, v := range aSpace.subnets {
		dstAspace.subnets[k] = &PoolData{}
		v.CopyTo(dstAspace.subnets[k])
	}

	return nil
}

func (aSpace *addrSpace) New() datastore.KVObject {
	aSpace.Lock()
	defer aSpace.Unlock()

	return &addrSpace{
		id:    aSpace.id,
		ds:    aSpace.ds,
		alloc: aSpace.alloc,
		scope: aSpace.scope,
	}
}

// updatePoolDBOnAdd returns a closure which will add the subnet k to the address space when executed.
func (aSpace *addrSpace) updatePoolDBOnAdd(k SubnetKey, nw *net.IPNet, ipr *AddressRange, pdf bool) (func() error, error) {
	aSpace.Lock()
	defer aSpace.Unlock()

	// Check if already allocated
	if _, ok := aSpace.subnets[k]; ok {
		if pdf {
			return nil, types.InternalMaskableErrorf("predefined pool %s is already reserved", nw)
		}
		// This means the same pool is already allocated. updatePoolDBOnAdd is called when there
		// is request for a pool/subpool. It should ensure there is no overlap with existing pools
		return nil, ipamapi.ErrPoolOverlap
	}

	// If master pool, check for overlap
	if ipr == nil {
		if aSpace.contains(k.AddressSpace, nw) {
			return nil, ipamapi.ErrPoolOverlap
		}
		// This is a new master pool, add it along with corresponding bitmask
		aSpace.subnets[k] = &PoolData{Pool: nw, RefCount: 1}
		return func() error { return aSpace.alloc.insertBitMask(k, nw) }, nil
	}

	// This is a new non-master pool (subPool)
	p := &PoolData{
		ParentKey: SubnetKey{AddressSpace: k.AddressSpace, Subnet: k.Subnet},
		Pool:      nw,
		Range:     ipr,
		RefCount:  1,
	}
	aSpace.subnets[k] = p

	// Look for parent pool
	pp, ok := aSpace.subnets[p.ParentKey]
	if ok {
		aSpace.incRefCount(pp, 1)
		return func() error { return nil }, nil
	}

	// Parent pool does not exist, add it along with corresponding bitmask
	aSpace.subnets[p.ParentKey] = &PoolData{Pool: nw, RefCount: 1}
	return func() error { return aSpace.alloc.insertBitMask(p.ParentKey, nw) }, nil
}

func (aSpace *addrSpace) updatePoolDBOnRemoval(k SubnetKey) (func() error, error) {
	aSpace.Lock()
	defer aSpace.Unlock()

	p, ok := aSpace.subnets[k]
	if !ok {
		return nil, ipamapi.ErrBadPool
	}

	aSpace.incRefCount(p, -1)

	c := p
	for ok {
		if c.RefCount == 0 {
			delete(aSpace.subnets, k)
			if c.Range == nil {
				return func() error {
					bm, err := aSpace.alloc.retrieveBitmask(k, c.Pool)
					if err != nil {
						return types.InternalErrorf("could not find bitmask in datastore for pool %s removal: %v", k.String(), err)
					}
					return bm.Destroy()
				}, nil
			}
		}
		k = c.ParentKey
		c, ok = aSpace.subnets[k]
	}

	return func() error { return nil }, nil
}

func (aSpace *addrSpace) incRefCount(p *PoolData, delta int) {
	c := p
	ok := true
	for ok {
		c.RefCount += delta
		c, ok = aSpace.subnets[c.ParentKey]
	}
}

// Checks whether the passed subnet is a superset or subset of any of the subset in this config db
func (aSpace *addrSpace) contains(space string, nw *net.IPNet) bool {
	for k, v := range aSpace.subnets {
		if space == k.AddressSpace && k.ChildSubnet == "" {
			if nw.Contains(v.Pool.IP) || v.Pool.Contains(nw.IP) {
				return true
			}
		}
	}
	return false
}

func (aSpace *addrSpace) store() datastore.DataStore {
	aSpace.Lock()
	defer aSpace.Unlock()

	return aSpace.ds
}

{'repo_name': 'balena-os/balena-engine', 'stars': '494', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': -7283680741953200707, 'source_dataset': 'data'}


<?php

namespace Illuminate\Contracts\Validation;

interface Rule
{
    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value);

    /**
     * Get the validation error message.
     *
     * @return string|array
     */
    public function message();
}

{'repo_name': 'DOUBLE-Baller/momo', 'stars': '358', 'repo_language': 'PHP', 'file_name': 'jquery.pjax.js', 'mime_type': 'text/plain', 'hash': -4361337774109532062, 'source_dataset': 'data'}


/*
 * Copyright 2013 GitHub Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.mobile.ui.search;

import static android.app.SearchManager.QUERY;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.text.TextUtils;
import android.view.View;
import android.widget.ListView;

import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import com.github.mobile.R;
import com.github.mobile.ThrowableLoader;
import com.github.mobile.core.repo.RefreshRepositoryTask;
import com.github.mobile.ui.ItemListFragment;
import com.github.mobile.ui.repo.RepositoryViewActivity;
import com.google.inject.Inject;

import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;

import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.SearchRepository;
import org.eclipse.egit.github.core.service.RepositoryService;

/**
 * Fragment to display a list of {@link SearchRepository} instances
 */
public class SearchRepositoryListFragment extends
        ItemListFragment<SearchRepository> {

    @Inject
    private RepositoryService service;

    private String query;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        setEmptyText(R.string.no_repositories);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);

        query = getStringExtra(QUERY);
    }

    @Override
    public void refresh() {
        query = getStringExtra(QUERY);

        super.refresh();
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        final SearchRepository result = (SearchRepository) l
                .getItemAtPosition(position);
        new RefreshRepositoryTask(getActivity(), result) {

            @Override
            public void execute() {
                showIndeterminate(MessageFormat.format(
                        getString(R.string.opening_repository),
                        result.generateId()));

                super.execute();
            }

            @Override
            protected void onSuccess(Repository repository) throws Exception {
                super.onSuccess(repository);

                startActivity(RepositoryViewActivity.createIntent(repository));
            }
        }.execute();
    }

    /**
     * Check if the search query is an exact repository name/owner match and
     * open the repository activity and finish the current activity when it is
     *
     * @param query
     * @return true if query opened as repository, false otherwise
     */
    private boolean openRepositoryMatch(final String query) {
        if (TextUtils.isEmpty(query))
            return false;

        RepositoryId repoId = RepositoryId.createFromId(query.trim());
        if (repoId == null)
            return false;

        Repository repo;
        try {
            repo = service.getRepository(repoId);
        } catch (IOException e) {
            return false;
        }

        startActivity(RepositoryViewActivity.createIntent(repo));
        final Activity activity = getActivity();
        if (activity != null)
            activity.finish();
        return true;
    }

    @Override
    public Loader<List<SearchRepository>> onCreateLoader(int id, Bundle args) {
        return new ThrowableLoader<List<SearchRepository>>(getActivity(), items) {

            @Override
            public List<SearchRepository> loadData() throws Exception {
                if (openRepositoryMatch(query))
                    return Collections.emptyList();
                else
                    return service.searchRepositories(query);
            }
        };
    }

    @Override
    protected int getErrorMessage(Exception exception) {
        return R.string.error_repos_load;
    }

    @Override
    protected SingleTypeAdapter<SearchRepository> createAdapter(
            List<SearchRepository> items) {
        return new SearchRepositoryListAdapter(getActivity()
                .getLayoutInflater(), items.toArray(new SearchRepository[items
                .size()]));
    }
}

{'repo_name': 'kba7/trugithub', 'stars': '2139', 'repo_language': 'JavaScript', 'file_name': 'RefUtilsTest.java', 'mime_type': 'text/x-java', 'hash': -6613462892735158790, 'source_dataset': 'data'}


<!DOCTYPE html>

        <title>Links for luigi</title>

Links for luigi

        Luigi_ext-1.0.9.tar.gz

        Luigi_ext-1.0.10.tar.gz

        Luigi_ext-1.0.18.tar.gz

        Luigi_ext-2.3.0.tar.gz

        Luigi_ext-1.0.20.tar.gz

        Luigi_ext-1.0.7.tar.gz

        Luigi_ext-1.0.23.tar.gz

        Luigi_ext-1.0.14.tar.gz

        Luigi_ext-2.1.0.tar.gz

        Luigi_ext-1.0.24.tar.gz

        Luigi_ext-1.1.2.tar.gz

        Luigi_ext-1.2.1.tar.gz

        Luigi_ext-2.1.1.tar.gz

        Luigi_ext-2.7.0b1.tar.gz

        Luigi_ext-2.3.1.tar.gz

        Luigi_ext-1.0.4.tar.gz

        Luigi_ext-1.1.1.tar.gz

        Luigi_ext-1.0.12.tar.gz

        Luigi_ext-2.4.0.tar.gz

        Luigi_ext-1.3.0.tar.gz

        Luigi_ext-2.3.3.tar.gz

        Luigi_ext-1.1.0.tar.gz

        Luigi_ext-1.0.5.tar.gz

        Luigi_ext-1.0.2.tar.gz

        Luigi_ext-2.5.0.tar.gz

        Luigi_ext-2.6.0.tar.gz

        Luigi_ext-1.0.1.tar.gz

        Luigi_ext-2.2.0.tar.gz

        Luigi_ext-1.0.9.macosx-10.7-intel.tar.gz

        Luigi_ext-1.0.22.tar.gz

        Luigi_ext-1.0.17.tar.gz

        Luigi_ext-1.0.13.tar.gz

        Luigi_ext-1.0.11.tar.gz

        Luigi_ext-1.0.16.tar.gz

        Luigi_ext-2.0.1.tar.gz

        Luigi_ext-2.3.2.tar.gz

        Luigi_ext-1.0.3.tar.gz

        Luigi_ext-1.0.6.tar.gz

        Luigi_ext-1.0.15.tar.gz

        Luigi_ext-1.0.19.tar.gz

        Luigi_ext-2.0.0.tar.gz

        Luigi_ext-1.0.tar.gz

{'repo_name': 'dependabot/dependabot-core', 'stars': '1275', 'repo_language': 'Ruby', 'file_name': 'latest_version_finder.rb', 'mime_type': 'text/x-ruby', 'hash': 1966905515168579206, 'source_dataset': 'data'}


/*
 * This file is part of ElasticFusion.
 *
 * Copyright (C) 2015 Imperial College London
 *
 * The use of the code within this file and all code within files that
 * make up the software that is ElasticFusion is permitted for
 * non-commercial purposes only.  The full terms and conditions that
 * apply to the code within this file are detailed within the LICENSE.txt
 * file and at <http://www.imperial.ac.uk/dyson-robotics-lab/downloads/elastic-fusion/elastic-fusion-license/>
 * unless explicitly stated.  By downloading this file you agree to
 * comply with these terms.
 *
 * If you wish to use any of this code for commercial purposes then
 * please email researchcontracts.engineering@imperial.ac.uk.
 *
 * Software License Agreement (BSD License)
 *
 *  Copyright (c) 2011, Willow Garage, Inc.
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer in the documentation and/or other materials provided
 *     with the distribution.
 *   * Neither the name of Willow Garage, Inc. nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY OF SUCH DAMAGE.
 *
 *  Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
 */

#include "cudafuncs.cuh"
#include "convenience.cuh"
#include "operators.cuh"

//#define MASK_ICP_RESIDUAL

#if __CUDA_ARCH__ < 300
__inline__ __device__
float __shfl_down(float val, int offset, int width = 32)
{
    static __shared__ float shared[MAX_THREADS];
    int lane = threadIdx.x % 32;
    shared[threadIdx.x] = val;
    __syncthreads();
    val = (lane + offset < width) ? shared[threadIdx.x + offset] : 0;
    __syncthreads();
    return val;
}

__inline__ __device__
int __shfl_down(int val, int offset, int width = 32)
{
    static __shared__ int shared[MAX_THREADS];
    int lane = threadIdx.x % 32;
    shared[threadIdx.x] = val;
    __syncthreads();
    val = (lane + offset < width) ? shared[threadIdx.x + offset] : 0;
    __syncthreads();
    return val;
}
#endif

#if __CUDA_ARCH__ < 350
template<typename T>
__device__ __forceinline__ T __ldg(const T* ptr)
{
    return *ptr;
}
#endif

__inline__  __device__ JtJJtrSE3 warpReduceSum(JtJJtrSE3 val)
{
    for(int offset = warpSize / 2; offset > 0; offset /= 2)
    {
        val.aa += __shfl_down(val.aa, offset);
        val.ab += __shfl_down(val.ab, offset);
        val.ac += __shfl_down(val.ac, offset);
        val.ad += __shfl_down(val.ad, offset);
        val.ae += __shfl_down(val.ae, offset);
        val.af += __shfl_down(val.af, offset);
        val.ag += __shfl_down(val.ag, offset);

        val.bb += __shfl_down(val.bb, offset);
        val.bc += __shfl_down(val.bc, offset);
        val.bd += __shfl_down(val.bd, offset);
        val.be += __shfl_down(val.be, offset);
        val.bf += __shfl_down(val.bf, offset);
        val.bg += __shfl_down(val.bg, offset);

        val.cc += __shfl_down(val.cc, offset);
        val.cd += __shfl_down(val.cd, offset);
        val.ce += __shfl_down(val.ce, offset);
        val.cf += __shfl_down(val.cf, offset);
        val.cg += __shfl_down(val.cg, offset);

        val.dd += __shfl_down(val.dd, offset);
        val.de += __shfl_down(val.de, offset);
        val.df += __shfl_down(val.df, offset);
        val.dg += __shfl_down(val.dg, offset);

        val.ee += __shfl_down(val.ee, offset);
        val.ef += __shfl_down(val.ef, offset);
        val.eg += __shfl_down(val.eg, offset);

        val.ff += __shfl_down(val.ff, offset);
        val.fg += __shfl_down(val.fg, offset);

        val.residual += __shfl_down(val.residual, offset);
        val.inliers += __shfl_down(val.inliers, offset);
    }

    return val;
}

__inline__  __device__ JtJJtrSE3 blockReduceSum(JtJJtrSE3 val)
{
    static __shared__ JtJJtrSE3 shared[32];

    int lane = threadIdx.x % warpSize;

    int wid = threadIdx.x / warpSize;

    val = warpReduceSum(val);

    //write reduced value to shared memory
    if(lane == 0)
    {
        shared[wid] = val;
    }
    __syncthreads();

    const JtJJtrSE3 zero = {0, 0, 0, 0, 0, 0, 0, 0,
                            0, 0, 0, 0, 0, 0, 0, 0,
                            0, 0, 0, 0, 0, 0, 0, 0,
                            0, 0, 0, 0, 0};

    //ensure we only grab a value from shared memory if that warp existed
    val = (threadIdx.x < blockDim.x / warpSize) ? shared[lane] : zero;

    if(wid == 0)
    {
        val = warpReduceSum(val);
    }

    return val;
}

__global__ void reduceSum(JtJJtrSE3 * in, JtJJtrSE3 * out, int N)
{
    JtJJtrSE3 sum = {0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 0, 0, 0};

    for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
    {
        sum.add(in[i]);
    }

    sum = blockReduceSum(sum);

    if(threadIdx.x == 0)
    {
        out[blockIdx.x] = sum;
    }
}

__inline__  __device__ JtJJtrSO3 warpReduceSum(JtJJtrSO3 val)
{
    for(int offset = warpSize / 2; offset > 0; offset /= 2)
    {
        val.aa += __shfl_down(val.aa, offset);
        val.ab += __shfl_down(val.ab, offset);
        val.ac += __shfl_down(val.ac, offset);
        val.ad += __shfl_down(val.ad, offset);

        val.bb += __shfl_down(val.bb, offset);
        val.bc += __shfl_down(val.bc, offset);
        val.bd += __shfl_down(val.bd, offset);

        val.cc += __shfl_down(val.cc, offset);
        val.cd += __shfl_down(val.cd, offset);

        val.residual += __shfl_down(val.residual, offset);
        val.inliers += __shfl_down(val.inliers, offset);
    }

    return val;
}

__inline__  __device__ JtJJtrSO3 blockReduceSum(JtJJtrSO3 val)
{
    static __shared__ JtJJtrSO3 shared[32];

    int lane = threadIdx.x % warpSize;

    int wid = threadIdx.x / warpSize;

    val = warpReduceSum(val);

    //write reduced value to shared memory
    if(lane == 0)
    {
        shared[wid] = val;
    }
    __syncthreads();

    const JtJJtrSO3 zero = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

    //ensure we only grab a value from shared memory if that warp existed
    val = (threadIdx.x < blockDim.x / warpSize) ? shared[lane] : zero;

    if(wid == 0)
    {
        val = warpReduceSum(val);
    }

    return val;
}

__global__ void reduceSum(JtJJtrSO3 * in, JtJJtrSO3 * out, int N)
{
    JtJJtrSO3 sum = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

    for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
    {
        sum.add(in[i]);
    }

    sum = blockReduceSum(sum);

    if(threadIdx.x == 0)
    {
        out[blockIdx.x] = sum;
    }
}

struct ICPReduction
{
    mat33 Rcurr;
    float3 tcurr;

    PtrStep<float> vmap_curr;
    PtrStep<float> nmap_curr;

    mat33 Rprev_inv;
    float3 tprev;

    CameraModel intr;

    PtrStep<float> vmap_g_prev;
    PtrStep<float> nmap_g_prev;

    float distThres;
    float angleThres;

    int cols;
    int rows;
    int N;

    JtJJtrSE3 * out;
    cudaSurfaceObject_t outErrorSurface;

    PtrStep<unsigned char> lastMask;
    PtrStep<unsigned char> nextMask;

//#ifdef MASK_ICP_RESIDUAL
    unsigned char maskID;
//#endif

    __device__ __forceinline__ bool
    search (int & x, int & y, float3& n, float3& d, float3& s) const
    {
        float3 vcurr;
        vcurr.x = vmap_curr.ptr (y       )[x];
        vcurr.y = vmap_curr.ptr (y + rows)[x];
        vcurr.z = vmap_curr.ptr (y + 2 * rows)[x];

        float3 vcurr_g = Rcurr * vcurr + tcurr;
        float3 vcurr_cp = Rprev_inv * (vcurr_g - tprev);

        int2 ukr;
        ukr.x = __float2int_rn (vcurr_cp.x * intr.fx / vcurr_cp.z + intr.cx);
        ukr.y = __float2int_rn (vcurr_cp.y * intr.fy / vcurr_cp.z + intr.cy);

        if(ukr.x < 0 || ukr.y < 0 || ukr.x >= cols || ukr.y >= rows || vcurr_cp.z < 0){
            // This magic number is picked to be small, so that during super-pixel downsampling it gets
            // either overwritten by larger values, or allows to check ICP<0 => has outlier (ICP==0.0001 => only outlier)
            // if(outErrorSurface) surf2Dwrite(0.0f, outErrorSurface, x*sizeof(float), y); //FIXME uncomment
            return false;
        }

#ifdef MASK_ICP_RESIDUAL
        //if(nextMask.ptr(ukr.y)[ukr.x] != maskID){
        if(nextMask.ptr(y)[x] != maskID){
            if(outErrorSurface) surf2Dwrite(1.0f, outErrorSurface, x*sizeof(float), y); //FIXME remove
            return false;
        } else {
            if(outErrorSurface) surf2Dwrite(0.0f, outErrorSurface, x*sizeof(float), y); //FIXME remove
        }
#endif

        float3 vprev_g;
        vprev_g.x = __ldg(&vmap_g_prev.ptr (ukr.y       )[ukr.x]);
        vprev_g.y = __ldg(&vmap_g_prev.ptr (ukr.y + rows)[ukr.x]);
        vprev_g.z = __ldg(&vmap_g_prev.ptr (ukr.y + 2 * rows)[ukr.x]);

        float3 ncurr;
        ncurr.x = nmap_curr.ptr (y)[x];
        ncurr.y = nmap_curr.ptr (y + rows)[x];
        ncurr.z = nmap_curr.ptr (y + 2 * rows)[x];

        float3 ncurr_g = Rcurr * ncurr;

        float3 nprev_g;
        nprev_g.x =  __ldg(&nmap_g_prev.ptr (ukr.y)[ukr.x]);
        nprev_g.y = __ldg(&nmap_g_prev.ptr (ukr.y + rows)[ukr.x]);
        nprev_g.z = __ldg(&nmap_g_prev.ptr (ukr.y + 2 * rows)[ukr.x]);

        float dist = norm (vprev_g - vcurr_g);
        float sine = norm (cross (ncurr_g, nprev_g));

//        if(outErrorSurface) surf2Dwrite(isfinite(dist) ? dist : 0.0f, outErrorSurface, x*sizeof(float), y); //FIXME uncomment

        n = nprev_g;
        d = vprev_g;
        s = vcurr_g;

        return (sine < angleThres && dist <= distThres && !isnan (ncurr.x) && !isnan (nprev_g.x));
    }

    __device__ __forceinline__ JtJJtrSE3
    getProducts(int & i) const
    {
        int y = i / cols;
        int x = i - (y * cols);

        float3 n_cp, d_cp, s_cp;

        bool found_coresp = search (x, y, n_cp, d_cp, s_cp);

        float row[7] = {0, 0, 0, 0, 0, 0, 0};

        if(found_coresp)
        {
            s_cp = Rprev_inv * (s_cp - tprev);
            d_cp = Rprev_inv * (d_cp - tprev);
            n_cp = Rprev_inv * (n_cp);

            *(float3*)&row[0] = n_cp;
            *(float3*)&row[3] = cross (s_cp, n_cp);
            row[6] = dot (n_cp, s_cp - d_cp);
        }

        JtJJtrSE3 values = {row[0] * row[0],
                            row[0] * row[1],
                            row[0] * row[2],
                            row[0] * row[3],
                            row[0] * row[4],
                            row[0] * row[5],
                            row[0] * row[6],

                            row[1] * row[1],
                            row[1] * row[2],
                            row[1] * row[3],
                            row[1] * row[4],
                            row[1] * row[5],
                            row[1] * row[6],

                            row[2] * row[2],
                            row[2] * row[3],
                            row[2] * row[4],
                            row[2] * row[5],
                            row[2] * row[6],

                            row[3] * row[3],
                            row[3] * row[4],
                            row[3] * row[5],
                            row[3] * row[6],

                            row[4] * row[4],
                            row[4] * row[5],
                            row[4] * row[6],

                            row[5] * row[5],
                            row[5] * row[6],

                            row[6] * row[6],
                            found_coresp};

        return values;
    }

    __device__ __forceinline__ void
    operator () () const
    {
        JtJJtrSE3 sum = {0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0};

        for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
        {
            JtJJtrSE3 val = getProducts(i);

            sum.add(val);
        }

        sum = blockReduceSum(sum);

        if(threadIdx.x == 0)
        {
            out[blockIdx.x] = sum;
        }
    }
};

__global__ void icpKernel(const ICPReduction icp)
{
    icp();
}

void icpStep(const mat33& Rcurr,
             const float3& tcurr,
             const DeviceArray2D<float>& vmap_curr,
             const DeviceArray2D<float>& nmap_curr,
             const mat33& Rprev_inv,
             const float3& tprev,
             const CameraModel& intr,
             const DeviceArray2D<float>& vmap_g_prev,
             const DeviceArray2D<float>& nmap_g_prev,
             float distThres,
             float angleThres,
             DeviceArray<JtJJtrSE3> & sum,
             DeviceArray<JtJJtrSE3> & out,
             float * matrixA_host,
             float * vectorB_host,
             float * residual_host,
             int threads,
             int blocks,
             const cudaSurfaceObject_t& icpErrorSurface,
             const DeviceArray2D<unsigned char>& nextMask,
             unsigned char maskID)
{
    int cols = vmap_curr.cols ();
    int rows = vmap_curr.rows () / 3;

    ICPReduction icp;

    icp.Rcurr = Rcurr;
    icp.tcurr = tcurr;

    icp.vmap_curr = vmap_curr;
    icp.nmap_curr = nmap_curr;

    icp.Rprev_inv = Rprev_inv;
    icp.tprev = tprev;

    icp.intr = intr;

    icp.vmap_g_prev = vmap_g_prev;
    icp.nmap_g_prev = nmap_g_prev;

    icp.distThres = distThres;
    icp.angleThres = angleThres;

    icp.cols = cols;
    icp.rows = rows;

    icp.N = cols * rows;
    icp.out = sum;
    icp.outErrorSurface = icpErrorSurface;

    icp.maskID = maskID;
    icp.nextMask = nextMask;

    icpKernel<<<blocks, threads>>>(icp);

    reduceSum<<<1, MAX_THREADS>>>(sum, out, blocks);

    cudaSafeCall(cudaGetLastError());
    cudaSafeCall(cudaDeviceSynchronize());

    float host_data[32];
    out.download((JtJJtrSE3 *)&host_data[0]);

    int shift = 0;
    for (int i = 0; i < 6; ++i)
    {
        for (int j = i; j < 7; ++j)
        {
            float value = host_data[shift++];
            if (j == 6)
                vectorB_host[i] = value;
            else
                matrixA_host[j * 6 + i] = matrixA_host[i * 6 + j] = value;
        }
    }

    residual_host[0] = host_data[27];
    residual_host[1] = host_data[28];
}

#define FLT_EPSILON ((float)1.19209290E-07F)

struct RGBReduction
{
    PtrStepSz<DataTerm> corresImg;

    float sigma;
    PtrStepSz<float3> cloud;
    float fx;
    float fy;
    PtrStepSz<short> dIdx;
    PtrStepSz<short> dIdy;
    float sobelScale;

    int cols;
    int rows;
    int N;

    JtJJtrSE3 * out;

    __device__ __forceinline__ JtJJtrSE3
    getProducts(int & i) const
    {
        const DataTerm & corresp = corresImg.data[i];

        bool found_coresp = corresp.valid;

        float row[7];

        if(found_coresp)
        {
            float w = sigma + std::abs(corresp.diff);

            w = w > FLT_EPSILON ? 1.0f / w : 1.0f;

            //Signals RGB only tracking, so we should only
            if(sigma == -1)
            {
                w = 1;
            }

            row[6] = -w * corresp.diff;

            float3 cloudPoint = {cloud.ptr(corresp.zero.y)[corresp.zero.x].x,
                                 cloud.ptr(corresp.zero.y)[corresp.zero.x].y,
                                 cloud.ptr(corresp.zero.y)[corresp.zero.x].z};

            float invz = 1.0 / cloudPoint.z;
            float dI_dx_val = w * sobelScale * dIdx.ptr(corresp.one.y)[corresp.one.x];
            float dI_dy_val = w * sobelScale * dIdy.ptr(corresp.one.y)[corresp.one.x];
            float v0 = dI_dx_val * fx * invz;
            float v1 = dI_dy_val * fy * invz;
            float v2 = -(v0 * cloudPoint.x + v1 * cloudPoint.y) * invz;

            row[0] = v0;
            row[1] = v1;
            row[2] = v2;
            row[3] = -cloudPoint.z * v1 + cloudPoint.y * v2;
            row[4] =  cloudPoint.z * v0 - cloudPoint.x * v2;
            row[5] = -cloudPoint.y * v0 + cloudPoint.x * v1;
        }
        else
        {
            row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = 0.f;
        }

        JtJJtrSE3 values = {row[0] * row[0],
                            row[0] * row[1],
                            row[0] * row[2],
                            row[0] * row[3],
                            row[0] * row[4],
                            row[0] * row[5],
                            row[0] * row[6],

                            row[1] * row[1],
                            row[1] * row[2],
                            row[1] * row[3],
                            row[1] * row[4],
                            row[1] * row[5],
                            row[1] * row[6],

                            row[2] * row[2],
                            row[2] * row[3],
                            row[2] * row[4],
                            row[2] * row[5],
                            row[2] * row[6],

                            row[3] * row[3],
                            row[3] * row[4],
                            row[3] * row[5],
                            row[3] * row[6],

                            row[4] * row[4],
                            row[4] * row[5],
                            row[4] * row[6],

                            row[5] * row[5],
                            row[5] * row[6],

                            row[6] * row[6],
                            found_coresp};

        return values;
    }

    __device__ __forceinline__ void
    operator () () const
    {
        JtJJtrSE3 sum = {0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0};

        for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
        {
            JtJJtrSE3 val = getProducts(i);

            sum.add(val);
        }

        sum = blockReduceSum(sum);

        if(threadIdx.x == 0)
        {
            out[blockIdx.x] = sum;
        }
    }
};

__global__ void rgbKernel (const RGBReduction rgb)
{
    rgb();
}

void rgbStep(const DeviceArray2D<DataTerm> & corresImg,
             const float & sigma,
             const DeviceArray2D<float3> & cloud,
             const float & fx,
             const float & fy,
             const DeviceArray2D<short> & dIdx,
             const DeviceArray2D<short> & dIdy,
             const float & sobelScale,
             DeviceArray<JtJJtrSE3> & sum,
             DeviceArray<JtJJtrSE3> & out,
             float * matrixA_host,
             float * vectorB_host,
             int threads,
             int blocks)
{
    RGBReduction rgb;

    rgb.corresImg = corresImg;
    rgb.cols = corresImg.cols();
    rgb.rows = corresImg.rows();
    rgb.sigma = sigma;
    rgb.cloud = cloud;
    rgb.fx = fx;
    rgb.fy = fy;
    rgb.dIdx = dIdx;
    rgb.dIdy = dIdy;
    rgb.sobelScale = sobelScale;
    rgb.N = rgb.cols * rgb.rows;
    rgb.out = sum;

    rgbKernel<<<blocks, threads>>>(rgb);

    reduceSum<<<1, MAX_THREADS>>>(sum, out, blocks);

    cudaSafeCall(cudaGetLastError());
    cudaSafeCall(cudaDeviceSynchronize());

    float host_data[32];
    out.download((JtJJtrSE3 *)&host_data[0]);

    int shift = 0;
    for (int i = 0; i < 6; ++i)
    {
        for (int j = i; j < 7; ++j)
        {
            float value = host_data[shift++];
            if (j == 6)
                vectorB_host[i] = value;
            else
                matrixA_host[j * 6 + i] = matrixA_host[i * 6 + j] = value;
        }
    }
}

__inline__  __device__ int2 warpReduceSum(int2 val)
{
    for(int offset = warpSize / 2; offset > 0; offset /= 2)
    {
        val.x += __shfl_down(val.x, offset);
        val.y += __shfl_down(val.y, offset);
    }

    return val;
}

__inline__  __device__ int2 blockReduceSum(int2 val)
{
    static __shared__ int2 shared[32];

    int lane = threadIdx.x % warpSize;

    int wid = threadIdx.x / warpSize;

    val = warpReduceSum(val);

    //write reduced value to shared memory
    if(lane == 0)
    {
        shared[wid] = val;
    }
    __syncthreads();

    const int2 zero = {0, 0};

    //ensure we only grab a value from shared memory if that warp existed
    val = (threadIdx.x < blockDim.x / warpSize) ? shared[lane] : zero;

    if(wid == 0)
    {
        val = warpReduceSum(val);
    }

    return val;
}

__global__ void reduceSum(int2 * in, int2 * out, int N)
{
    int2 sum = {0, 0};

    for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
    {
        sum.x += in[i].x;
        sum.y += in[i].y;
    }

    sum = blockReduceSum(sum);

    if(threadIdx.x == 0)
    {
        out[blockIdx.x] = sum;
    }
}

struct RGBResidual
{
    float minScale;

    PtrStepSz<short> dIdx;
    PtrStepSz<short> dIdy;

    PtrStepSz<float> lastDepth;
    PtrStepSz<float> nextDepth;

    PtrStepSz<unsigned char> lastImage;
    PtrStepSz<unsigned char> nextImage;

    PtrStepSz<unsigned char> lastMask;
    PtrStepSz<unsigned char> nextMask;

    mutable PtrStepSz<DataTerm> corresImg;

    float maxDepthDelta;

    float3 kt;
    mat33 krkinv;

    int cols;
    int rows;
    int N;

#ifdef MASK_RGB_RESIDUAL
    unsigned char maskID;
#endif

    int pitch;
    int imgPitch;

    int2 * out;
    cudaSurfaceObject_t outErrorSurface;

    __device__ __forceinline__ int2
    getProducts(int k) const
    {
        int i = k / cols;
        int j0 = k - (i * cols);

        int2 value = {0, 0};

        DataTerm corres;

        corres.valid = false;

        if(i >= 0 && i < rows && j0 >= 0 && j0 < cols)
        {
            if(j0 < cols - 5 && i < rows - 1)
            {
                bool valid = true;

                for(int u = max(i - 2, 0); u < min(i + 2, rows); u++)
                {
                    for(int v = max(j0 - 2, 0); v < min(j0 + 2, cols); v++)
                    {

                        valid = valid && (nextImage.ptr(u)[v] > 0)
#ifdef MASK_RGB_RESIDUAL
                                && (nextMask.ptr(u)[v] == maskID)
#endif
                                ;
                    }
                }

                if(valid)
                {
                    short * ptr_input_x = (short*) ((unsigned char*) dIdx.data + i * pitch);
                    short * ptr_input_y = (short*) ((unsigned char*) dIdy.data + i * pitch);

                    short valx = ptr_input_x[j0];
                    short valy = ptr_input_y[j0];
                    float mTwo = (valx * valx) + (valy * valy);

                    if(mTwo >= minScale)
                    {
                        int y = i;
                        int x = j0;

                        float d1 = nextDepth.ptr(y)[x];

                        if(!isnan(d1))
                        {
                            float transformed_d1 = (float)(d1 * (krkinv.data[2].x * x + krkinv.data[2].y * y + krkinv.data[2].z) + kt.z);
                            int u0 = __float2int_rn((d1 * (krkinv.data[0].x * x + krkinv.data[0].y * y + krkinv.data[0].z) + kt.x) / transformed_d1);
                            int v0 = __float2int_rn((d1 * (krkinv.data[1].x * x + krkinv.data[1].y * y + krkinv.data[1].z) + kt.y) / transformed_d1);

                            if(u0 >= 0 && v0 >= 0 && u0 < lastDepth.cols && v0 < lastDepth.rows)
                            {
                                float d0 = lastDepth.ptr(v0)[u0];

                                if(d0 > 0 && std::abs(transformed_d1 - d0) <= maxDepthDelta && lastImage.ptr(v0)[u0] != 0)
                                {
                                    corres.zero.x = u0;
                                    corres.zero.y = v0;
                                    corres.one.x = x;
                                    corres.one.y = y;
                                    corres.diff = static_cast<float>(nextImage.ptr(y)[x]) - static_cast<float>(lastImage.ptr(v0)[u0]);
                                    corres.valid = true;
                                    value.x = 1;
                                    value.y = corres.diff * corres.diff;
                                    if(outErrorSurface) surf2Dwrite(0.00001f * value.y, outErrorSurface, x*sizeof(float), y);
                                }
                            }
                        }
                    }
                }
            }
        }

        if(!corres.valid && outErrorSurface) surf2Dwrite(0.0f, outErrorSurface, j0*sizeof(float), i);
        corresImg.data[k] = corres;

        return value;
    }

    __device__ __forceinline__ void
    operator () () const
    {
        int2 sum = {0, 0};

        for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
        {
            int2 val = getProducts(i);
            sum.x += val.x;
            sum.y += val.y;
        }

        sum = blockReduceSum(sum);

        if(threadIdx.x == 0)
        {
            out[blockIdx.x] = sum;
        }
    }
};

__global__ void residualKernel (const RGBResidual rgb)
{
    rgb();
}

void computeRgbResidual(const float & minScale,
                        const DeviceArray2D<short> & dIdx,
                        const DeviceArray2D<short> & dIdy,
                        const DeviceArray2D<float> & lastDepth,
                        const DeviceArray2D<float> & nextDepth,
                        const DeviceArray2D<unsigned char> & lastImage,
                        const DeviceArray2D<unsigned char> & nextImage,
                        const DeviceArray2D<unsigned char> & lastMask,
                        const DeviceArray2D<unsigned char> & nextMask,
                        DeviceArray2D<DataTerm> & corresImg,
                        DeviceArray<int2> & sumResidual,
                        const float maxDepthDelta,
                        const float3 & kt,
                        const mat33 & krkinv,
                        int & sigmaSum,
                        int & count,
                        int threads,
                        int blocks,
                        const cudaSurfaceObject_t& rgbErrorSurface,
                        unsigned char maskID)
{
    int cols = nextImage.cols ();
    int rows = nextImage.rows ();

    RGBResidual rgb;

    rgb.minScale = minScale;

    rgb.dIdx = dIdx;
    rgb.dIdy = dIdy;

    rgb.lastDepth = lastDepth;
    rgb.nextDepth = nextDepth;

    rgb.lastImage = lastImage;
    rgb.nextImage = nextImage;

    rgb.lastMask = lastMask;
    rgb.nextMask = nextMask;

    rgb.corresImg = corresImg;

    rgb.maxDepthDelta = maxDepthDelta;

    rgb.kt = kt;
    rgb.krkinv = krkinv;

    rgb.cols = cols;
    rgb.rows = rows;
    rgb.pitch = dIdx.step();
    rgb.imgPitch = nextImage.step();

    rgb.N = cols * rows;
    rgb.out = sumResidual;
    rgb.outErrorSurface = rgbErrorSurface;

#ifdef MASK_RGB_RESIDUAL
    rgb.maskID = maskID;
#endif

    residualKernel<<<blocks, threads>>>(rgb);

    int2 out_host = {0, 0};
    int2 * out;

    cudaMalloc(&out, sizeof(int2));
    cudaMemcpy(out, &out_host, sizeof(int2), cudaMemcpyHostToDevice);

    reduceSum<<<1, MAX_THREADS>>>(sumResidual, out, blocks);

    cudaSafeCall(cudaGetLastError());
    cudaSafeCall(cudaDeviceSynchronize());

    cudaMemcpy(&out_host, out, sizeof(int2), cudaMemcpyDeviceToHost);
    cudaFree(out);

    count = out_host.x;
    sigmaSum = out_host.y;
}

struct SO3Reduction
{
    PtrStepSz<unsigned char> lastImage;
    PtrStepSz<unsigned char> nextImage;

    mat33 imageBasis;
    mat33 kinv;
    mat33 krlr;
    bool gradCheck;

    int cols;
    int rows;
    int N;

    JtJJtrSO3 * out;

    __device__ __forceinline__ float2
    getGradient(const PtrStepSz<unsigned char> img, int x, int y) const
    {
        float2 gradient;

        float actu = static_cast<float>(img.ptr(y)[x]);

        float back = static_cast<float>(img.ptr(y)[x - 1]);
        float fore = static_cast<float>(img.ptr(y)[x + 1]);
        gradient.x = ((back + actu) / 2.0f) - ((fore + actu) / 2.0f);

        back = static_cast<float>(img.ptr(y - 1)[x]);
        fore = static_cast<float>(img.ptr(y + 1)[x]);
        gradient.y = ((back + actu) / 2.0f) - ((fore + actu) / 2.0f);

        return gradient;
    }

    __device__ __forceinline__ JtJJtrSO3
    getProducts(int k) const
    {
        int y = k / cols;
        int x = k - (y * cols);

        bool found_coresp = false;

        float3 unwarpedReferencePoint = {x, y, 1.0f};

        float3 warpedReferencePoint = imageBasis * unwarpedReferencePoint;

        int2 warpedReferencePixel = {__float2int_rn(warpedReferencePoint.x / warpedReferencePoint.z),
                                     __float2int_rn(warpedReferencePoint.y / warpedReferencePoint.z)};

        if(warpedReferencePixel.x >= 1 &&
           warpedReferencePixel.x < cols - 1 &&
           warpedReferencePixel.y >= 1 &&
           warpedReferencePixel.y < rows - 1 &&
           x >= 1 &&
           x < cols - 1 &&
           y >= 1 &&
           y < rows - 1)
        {
            found_coresp = true;
        }

        float row[4];
        row[0] = row[1] = row[2] = row[3] = 0.f;

        if(found_coresp)
        {
            float2 gradNext = getGradient(nextImage, warpedReferencePixel.x, warpedReferencePixel.y);
            float2 gradLast = getGradient(lastImage, x, y);

            float gx = (gradNext.x + gradLast.x) / 2.0f;
            float gy = (gradNext.y + gradLast.y) / 2.0f;

            float3 point = kinv * unwarpedReferencePoint;

            float z2 = point.z * point.z;

            float a = krlr.data[0].x;
            float b = krlr.data[0].y;
            float c = krlr.data[0].z;

            float d = krlr.data[1].x;
            float e = krlr.data[1].y;
            float f = krlr.data[1].z;

            float g = krlr.data[2].x;
            float h = krlr.data[2].y;
            float i = krlr.data[2].z;

            //Aren't jacobians great fun
            float3 leftProduct = {((point.z * (d * gy + a * gx)) - (gy * g * y) - (gx * g * x)) / z2,
                                  ((point.z * (e * gy + b * gx)) - (gy * h * y) - (gx * h * x)) / z2,
                                  ((point.z * (f * gy + c * gx)) - (gy * i * y) - (gx * i * x)) / z2};

            float3 jacRow = cross(leftProduct, point);

            row[0] = jacRow.x;
            row[1] = jacRow.y;
            row[2] = jacRow.z;
            row[3] = -(static_cast<float>(nextImage.ptr(warpedReferencePixel.y)[warpedReferencePixel.x]) - static_cast<float>(lastImage.ptr(y)[x]));
        }

        JtJJtrSO3 values = {row[0] * row[0],
                            row[0] * row[1],
                            row[0] * row[2],
                            row[0] * row[3],

                            row[1] * row[1],
                            row[1] * row[2],
                            row[1] * row[3],

                            row[2] * row[2],
                            row[2] * row[3],

                            row[3] * row[3],
                            found_coresp};

        return values;
    }

    __device__ __forceinline__ void
    operator () () const
    {
        JtJJtrSO3 sum = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

        for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
        {
            JtJJtrSO3 val = getProducts(i);

            sum.add(val);
        }

        sum = blockReduceSum(sum);

        if(threadIdx.x == 0)
        {
            out[blockIdx.x] = sum;
        }
    }
};

__global__ void so3Kernel (const SO3Reduction so3)
{
    so3();
}

void so3Step(const DeviceArray2D<unsigned char> & lastImage,
             const DeviceArray2D<unsigned char> & nextImage,
             const mat33 & imageBasis,
             const mat33 & kinv,
             const mat33 & krlr,
             DeviceArray<JtJJtrSO3> & sum,
             DeviceArray<JtJJtrSO3> & out,
             float * matrixA_host,
             float * vectorB_host,
             float * residual_host,
             int threads,
             int blocks)
{
    int cols = nextImage.cols();
    int rows = nextImage.rows();

    SO3Reduction so3;

    so3.lastImage = lastImage;

    so3.nextImage = nextImage;

    so3.imageBasis = imageBasis;
    so3.kinv = kinv;
    so3.krlr = krlr;

    so3.cols = cols;
    so3.rows = rows;

    so3.N = cols * rows;

    so3.out = sum;

    so3Kernel<<<blocks, threads>>>(so3);

    reduceSum<<<1, MAX_THREADS>>>(sum, out, blocks);

    cudaSafeCall(cudaGetLastError());
    cudaSafeCall(cudaDeviceSynchronize());

    float host_data[11];
    out.download((JtJJtrSO3 *)&host_data[0]);

    int shift = 0;
    for (int i = 0; i < 3; ++i)
    {
        for (int j = i; j < 4; ++j)
        {
            float value = host_data[shift++];
            if (j == 3)
                vectorB_host[i] = value;
            else
                matrixA_host[j * 3 + i] = matrixA_host[i * 3 + j] = value;
        }
    }

    residual_host[0] = host_data[9];
    residual_host[1] = host_data[10];
}

{'repo_name': 'martinruenz/maskfusion', 'stars': '337', 'repo_language': 'C++', 'file_name': 'sequence_add_bbox_labels.cpp', 'mime_type': 'text/x-c++', 'hash': -7918960997283660647, 'source_dataset': 'data'}


// Copyright (C) 2012-2019 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.
//
// { dg-do run { target c++11 xfail *-*-* } }
// { dg-require-debug-mode "" }

#include <list>

void test01()
{
  std::list<int> l1;
  auto it1 = l1.begin();
  it1 = std::move(it1);
}

int main()
{
  test01();
  return 0;
}

{'repo_name': 'riscv/riscv-gcc', 'stars': '155', 'repo_language': 'C', 'file_name': 'visium-protos.h', 'mime_type': 'text/x-c', 'hash': 2141580011826470687, 'source_dataset': 'data'}


#!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

# this is a tcl version of plate vibration
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# read a vtk file
#
plate = vtk.vtkPolyDataReader()
plate.SetFileName(VTK_DATA_ROOT + "/Data/plate.vtk")
plate.SetVectorsName("mode8")

warp = vtk.vtkWarpVector()
warp.SetInputConnection(plate.GetOutputPort())
warp.SetScaleFactor(0.5)

normals = vtk.vtkPolyDataNormals()
normals.SetInputConnection(warp.GetOutputPort())

color = vtk.vtkVectorDot()
color.SetInputConnection(normals.GetOutputPort())

lut = vtk.vtkLookupTable()
lut.SetNumberOfColors(256)
lut.Build()

i = 0
while i < 128:
    lut.SetTableValue(i, (128.0 - i) / 128.0, (128.0 - i) / 128.0,
      (128.0 - i) / 128.0, 1)
    i += 1

i = 128
while i < 256:
    lut.SetTableValue(i, (i - 128.0) / 128.0, (i - 128.0) / 128.0,
      (i - 128.0) / 128.0, 1)
    i += 1

plateMapper = vtk.vtkDataSetMapper()
plateMapper.SetInputConnection(color.GetOutputPort())
plateMapper.SetLookupTable(lut)
plateMapper.SetScalarRange(-1, 1)

plateActor = vtk.vtkActor()
plateActor.SetMapper(plateMapper)

# Add the actors to the renderer, set the background and size
#
ren1.AddActor(plateActor)
ren1.SetBackground(1, 1, 1)

renWin.SetSize(250, 250)

ren1.GetActiveCamera().SetPosition(13.3991, 14.0764, 9.97787)
ren1.GetActiveCamera().SetFocalPoint(1.50437, 0.481517, 4.52992)
ren1.GetActiveCamera().SetViewAngle(30)
ren1.GetActiveCamera().SetViewUp(-0.120861, 0.458556, -0.880408)
ren1.GetActiveCamera().SetClippingRange(12.5724, 26.8374)

# render the image
#
iren.Initialize()
#iren.Start()

{'repo_name': 'Kitware/VTK', 'stars': '1386', 'repo_language': 'C++', 'file_name': 'TestSVGContextExport.cxx', 'mime_type': 'text/x-c++', 'hash': 9165811485675776395, 'source_dataset': 'data'}


fileFormatVersion: 2
guid: 8e60d31574c8c8240b17b7e0abd0ad23
ShaderImporter:
  externalObjects: {}
  defaultTextures: []
  nonModifiableTextures: []
  userData:
  assetBundleName:
  assetBundleVariant:

{'repo_name': 'SergeyMakeev/ArcadeCarPhysics', 'stars': '155', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 7271709997592359995, 'source_dataset': 'data'}


<?php

namespace Elasticsearch\Endpoints\Snapshot;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
 * Class Delete
 *
 * @category Elasticsearch
 * @package  Elasticsearch\Endpoints\Snapshot
 * @author   Zachary Tong <zach@elastic.co>
 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
 * @link     http://elastic.co
 */
class Delete extends AbstractEndpoint
{
    // A repository name
    private $repository;

    // A snapshot name
    private $snapshot;

    /**
     * @param $repository
     *
     * @return $this
     */
    public function setRepository($repository)
    {
        if (isset($repository) !== true) {
            return $this;
        }

        $this->repository = $repository;

        return $this;
    }

    /**
     * @param $snapshot
     *
     * @return $this
     */
    public function setSnapshot($snapshot)
    {
        if (isset($snapshot) !== true) {
            return $this;
        }

        $this->snapshot = $snapshot;

        return $this;
    }

    /**
     * @throws \Elasticsearch\Common\Exceptions\RuntimeException
     * @return string
     */
    public function getURI()
    {
        if (isset($this->repository) !== true) {
            throw new Exceptions\RuntimeException(
                'repository is required for Delete'
            );
        }
        if (isset($this->snapshot) !== true) {
            throw new Exceptions\RuntimeException(
                'snapshot is required for Delete'
            );
        }
        $repository = $this->repository;
        $snapshot = $this->snapshot;
        $uri   = "/_snapshot/$repository/$snapshot";

        if (isset($repository) === true && isset($snapshot) === true) {
            $uri = "/_snapshot/$repository/$snapshot";
        }

        return $uri;
    }

    /**
     * @return string[]
     */
    public function getParamWhitelist()
    {
        return array(
            'master_timeout',
        );
    }

    /**
     * @return string
     */
    public function getMethod()
    {
        return 'DELETE';
    }
}

{'repo_name': 'artefactual/atom', 'stars': '130', 'repo_language': 'PHP', 'file_name': 'messages.xml', 'mime_type': 'text/xml', 'hash': -8000286868478231296, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="NAudio" Description="This rule set contains all rules used by NAudio" ToolsVersion="10.0">
  <IncludeAll Action="Warning" />
  <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
    <Rule Id="CA2122" Action="None" />
  </Rules>
</RuleSet>

{'repo_name': 'naudio/NAudio', 'stars': '2707', 'repo_language': 'C#', 'file_name': 'MediaFoundationResampleView.xaml', 'mime_type': 'text/plain', 'hash': 1180270142939453124, 'source_dataset': 'data'}