file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
mut_dns_packet.rs | use buf::*;
#[derive(Debug)]
pub struct MutDnsPacket<'a> {
buf: &'a mut [u8],
pos: usize,
}
impl<'a> MutDnsPacket<'a> {
pub fn new(buf: &mut [u8]) -> MutDnsPacket {
MutDnsPacket::new_at(buf, 0)
}
pub fn new_at(buf: &mut [u8], pos: usize) -> MutDnsPacket {
debug!("New MutDn... | (&mut self) -> &mut [u8] {
self.buf
}
}
impl<'a> BufRead for MutDnsPacket<'a> {
fn buf(&self) -> &[u8] {
self.buf
}
}
impl<'a> DirectAccessBuf for MutDnsPacket<'a> {
fn pos(&self) -> usize {
self.pos
}
fn set_pos(&mut self, pos: usize) {
self.pos = pos;
}
... | buf | identifier_name |
nuevo-pedido.js | var _servicio = '../php/servicios/proc-pedidos.php';
var _idPedidoX = 0, _docGenerate = '', _serieUsar = '';
(function($){
var _cboProd = [];
var template = Handlebars.compile($("#result-template").html());
var empty = Handlebars.compile($("#empty-template").html());
$(document).ready(function(){
/* -----------... | else{
_html += '<td class="text-right" >S/. '+_fila.flt_Precio+'</td>';
}
_html += '<td class="text-right" >'+_fila.cant+'</td>';
_total = _total + parseFloat(_fila.flt_Total);
_html += '<td class="text-right" >'+_fila.flt_Total+'</td>';
_html += '<td>';
_html += '<a href="'+_fila.in... | {
_html += '<td class="text-right" >S/. '+_fila.flt_Promo+'</td>';
} | conditional_block |
nuevo-pedido.js | var _servicio = '../php/servicios/proc-pedidos.php';
var _idPedidoX = 0, _docGenerate = '', _serieUsar = '';
(function($){
var _cboProd = [];
var template = Handlebars.compile($("#result-template").html());
var empty = Handlebars.compile($("#empty-template").html());
$(document).ready(function(){
/* -----------... |
/*Solo Numeros*/
/*
onkeypress="return validar(event);"
*/
function validar(e) {
tecla = (document.all)?e.keyCode:e.which;//ascii
//alert(tecla);
switch(tecla){
case 8:
return true;
break;
case 46://punto
return true;
break;
case ... | {
if( json.data != undefined || json.data != null ){
var _fila = [], _html = '', _total = 0;
for (var i = 0; i < json.data.length; i++) {
_fila = json.data[i];
_html += '<tr id="Fila_'+_fila.int_IdDetallePedido+'" >';
_html += '<td>';
_html += '<span class="fa fa-barcode" ></span> '+_fila.prod+'... | identifier_body |
nuevo-pedido.js | var _servicio = '../php/servicios/proc-pedidos.php';
var _idPedidoX = 0, _docGenerate = '', _serieUsar = '';
(function($){
var _cboProd = [];
var template = Handlebars.compile($("#result-template").html());
var empty = Handlebars.compile($("#empty-template").html());
$(document).ready(function(){
/* -----------... | (){
$('#containerProducto').removeClass().addClass('form-group');
$('#idProd').val('0');
$('#idUM').val('0');
$('#txtPrecio').val( '0' );
$('#txtCantidad').val( '' );
$('#txtTotal').val( '0' );
//$("#txtProducto").val('');
$("#idItem").val('0');
}
function loadTablita( json ){
if( json.data != undefined || j... | resetAddItems | identifier_name |
nuevo-pedido.js | var _servicio = '../php/servicios/proc-pedidos.php';
var _idPedidoX = 0, _docGenerate = '', _serieUsar = '';
(function($){
var _cboProd = [];
var template = Handlebars.compile($("#result-template").html());
var empty = Handlebars.compile($("#empty-template").html());
$(document).ready(function(){
/* -----------... | event.preventDefault();
});
/* -------------------------------------- */
$('#btnGoFacturar').click(function(event) {
var _filtro = '';
_docGenerate = $('#Documento').val();
_serieUsar = $('#Correlativo').val();
var _idPedido = $('#idPedido').val();
_filtro = 'goBoleta';
/**/
$.post( _s... | });
/* -------------------------------------- */
$(document).delegate('.goPedido', 'click', function(event) {
var _idp = $(this).attr('href');
$('#myModal').modal('show'); | random_line_split |
user-webuploader.js | // 文件上传
jQuery(function() {
var $ = jQuery,
$list = $('#thelist'),
$btn = $('#ctlBtn'),
state = 'pending',
// 优化retina, 在retina下这个值是2
ratio = window.devicePixelRatio || 1,
// 缩略图大小
thumbnailWidth = 100 * ratio,
thumbnailHeight = 100 * ratio,
up... | conditional_block | ||
user-webuploader.js | // 文件上传
jQuery(function() {
var $ = jQuery,
$list = $('#thelist'),
$btn = $('#ctlBtn'),
state = 'pending',
// 优化retina, 在retina下这个值是2
ratio = window.devicePixelRatio || 1,
// 缩略图大小
thumbnailWidth = 100 * ratio,
thumbnailHeight = 100 * ratio, | multiple: false,
// 不压缩image
resize: false,
// swf文件路径
swf: '/webuploader/Uploader.swf',
// 文件接收服务端。
server: '/upload',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: '#picker',
// 只允许选择图片文件。
accept: ... | uploader;
uploader = WebUploader.create({
// 单文件上传 | random_line_split |
proxyLinda.py | '''
PyDALI proxyLinda module to encapsulate DALI agent communication
in the ASP solver case study
Licensed with Apache Public License
by AAAI Research Group
Department of Information Engineering and Computer Science and Mathematics
University of L'Aquila, ITALY
http://www.disim.univaq.it
'''
__autho... | tornado.platform.twisted.install()
from twisted.internet import protocol, reactor
AG_COORDINATOR = 'agCoordinator'
AG_METAPLANNER = 'agMetaPlanner'
# localmachine = socket.gethostname().lower()
localmachine = 'localhost'
sock = socket.socket()
sock.connect((localmachine, 3010))
# root = '.' + os.sep + os.... | import os
import time
import select
import tornado.platform.twisted
| random_line_split |
proxyLinda.py | '''
PyDALI proxyLinda module to encapsulate DALI agent communication
in the ASP solver case study
Licensed with Apache Public License
by AAAI Research Group
Department of Information Engineering and Computer Science and Mathematics
University of L'Aquila, ITALY
http://www.disim.univaq.it
'''
__autho... |
elif self.currentproblem == 3:
system_connection[self.identifier].sendConsoleMessage('With Blank Problem has found a solution')
message = 'new_moves_for_evaluate(%s)' % len(temporaryresult)
m = createmessage('user', AG_METAPLANNER, 'send_message... | system_connection[self.identifier].sendConsoleMessage('Weak Constraint Problem has found a solution') | conditional_block |
proxyLinda.py | '''
PyDALI proxyLinda module to encapsulate DALI agent communication
in the ASP solver case study
Licensed with Apache Public License
by AAAI Research Group
Department of Information Engineering and Computer Science and Mathematics
University of L'Aquila, ITALY
http://www.disim.univaq.it
'''
__autho... |
class PlanHandler(tornado.web.RequestHandler):
def prepare(self):
if self.request.headers["Content-Type"].startswith("application/json"):
self.json_args = json.loads(self.request.body)
else:
self.json_args = None
def post(self):
identifier = self.js... | try:
with open(os.path.join(root, 'knight' + os.sep + 'index.html')) as f:
self.write(f.read())
except IOError as e:
self.write("404: Not Found") | identifier_body |
proxyLinda.py | '''
PyDALI proxyLinda module to encapsulate DALI agent communication
in the ASP solver case study
Licensed with Apache Public License
by AAAI Research Group
Department of Information Engineering and Computer Science and Mathematics
University of L'Aquila, ITALY
http://www.disim.univaq.it
'''
__autho... | (self):
print 'new connection'
self.identifier = str(int(time.time()))
system_connection[self.identifier] = self
m = createmessage('user', AG_COORDINATOR, 'send_message', "new_connection(%s)" % self.identifier)
wrm = write_message(m)
sock.send(wrm)
self.sen... | open | identifier_name |
other_eval.py | """ Provides the evaluator backends for Numexpr and the Python interpreter """
from expression_builder import Visitor
import blaze
import math
def evaluate(expression,
chunk_size,
vm='python',
out_flavor='blaze',
user_dict={},
**kwargs):
"""
... |
class _ResultGatherer(object):
def __init__(self, vlen, maxndims, flavour):
self.vlen = vlen
self.flavour = flavour
self.maxndims = maxndims
self.accumulate = self._entry
def _entry(self, chunk_result, curr_slice):
self.scalar = False
self.dim_reduction = Fals... | return max([_ndims_var(var) for var in a_dict_of_vars.itervalues()]) | identifier_body |
other_eval.py | """ Provides the evaluator backends for Numexpr and the Python interpreter """
from expression_builder import Visitor
import blaze
import math
def evaluate(expression,
chunk_size,
vm='python',
out_flavor='blaze',
user_dict={},
**kwargs):
"""
... | (self, chunk_result, curr_slice):
self._result += chunk_result
def _blaze_append(self, chunk_result, curr_slice):
self._result.append(chunk_result)
def _np_append(self, chunk_result, slice_, curr_slice):
self._result[slice_] = chunk_result
def _array_result(self):
return s... | _reduce | identifier_name |
other_eval.py | """ Provides the evaluator backends for Numexpr and the Python interpreter """
from expression_builder import Visitor
import blaze
import math
def evaluate(expression,
chunk_size,
vm='python',
out_flavor='blaze',
user_dict={},
**kwargs):
"""
... | user_dict : dict
An user-provided dictionary where the variables in expression
can be found by name.
kwargs : list of parameters or dictionary
Any parameter supported by the carray constructor.
Returns
-------
out : Blaze object
The outcome of the expression. Yo... | The flavor for the `out` object. It can be 'Blaze' or 'numpy'. | random_line_split |
other_eval.py | """ Provides the evaluator backends for Numexpr and the Python interpreter """
from expression_builder import Visitor
import blaze
import math
def evaluate(expression,
chunk_size,
vm='python',
out_flavor='blaze',
user_dict={},
**kwargs):
"""
... |
elif vlen < 10*1000*1000:
bsize //= 2
return bsize if bsize > 0 else 1
class NumpyEvaluator(object):
name = 'python interpreter with numpy'
def __init__(self, root_node, operands=None):
assert(operands)
self.str_expr = _ExpressionBuilder().accept(root_node)
... | bsize //= 4 | conditional_block |
crc32.rs | //! Helper module to compute a CRC32 checksum
use std::io;
use std::io::prelude::*;
static CRC32_TABLE : [u32; 256] = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1... | 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2... | random_line_split | |
crc32.rs | //! Helper module to compute a CRC32 checksum
use std::io;
use std::io::prelude::*;
static CRC32_TABLE : [u32; 256] = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1... |
/// Reader that validates the CRC32 when it reaches the EOF.
pub struct Crc32Reader<R>
{
inner: R,
crc: u32,
check: u32,
}
impl<R> Crc32Reader<R>
{
/// Get a new Crc32Reader which check the inner reader against checksum.
pub fn new(inner: R, checksum: u32) -> Crc32Reader<R>
{
Crc32Rea... | {
let mut crc = !prev;
for &byte in buf.iter()
{
crc = CRC32_TABLE[((crc as u8) ^ byte) as usize] ^ (crc >> 8);
}
!crc
} | identifier_body |
crc32.rs | //! Helper module to compute a CRC32 checksum
use std::io;
use std::io::prelude::*;
static CRC32_TABLE : [u32; 256] = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1... | (prev: u32, buf: &[u8]) -> u32
{
let mut crc = !prev;
for &byte in buf.iter()
{
crc = CRC32_TABLE[((crc as u8) ^ byte) as usize] ^ (crc >> 8);
}
!crc
}
/// Reader that validates the CRC32 when it reaches the EOF.
pub struct Crc32Reader<R>
{
inner: R,
crc: u32,
check: u32,
}
i... | update | identifier_name |
crc32.rs | //! Helper module to compute a CRC32 checksum
use std::io;
use std::io::prelude::*;
static CRC32_TABLE : [u32; 256] = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1... | ,
Ok(n) => n,
Err(e) => return Err(e),
};
self.crc = update(self.crc, &buf[0..count]);
Ok(count)
}
}
#[cfg(test)]
mod test {
#[test]
fn samples() {
assert_eq!(super::update(0, b""), 0);
// test vectors from the iPXE project (input and output ... | { return Err(io::Error::new(io::ErrorKind::Other, "Invalid checksum")) } | conditional_block |
Effects.js | import { UrlUtil } from './UrlUtil'
export class Effects {
constructor () {
this.bindHighlight()
}
// if a var highlight exists in the url it will be highlighted
bindHighlight () {
// get highlight from url
const highlightId = UrlUtil.getGetValue('highlight')
// id is set
if (highlightId ... |
// when we hover over the item we stop the effect, otherwise we will mess up background hover styles
$(selector).on('mouseover', () => {
$(selector).removeClass('highlighted')
})
// highlight!
$(selector).addClass('highlighted')
setTimeout(() => {
$... | {
selector += ' td'
} | conditional_block |
Effects.js | import { UrlUtil } from './UrlUtil'
export class Effects {
constructor () {
this.bindHighlight()
}
// if a var highlight exists in the url it will be highlighted
bindHighlight () {
// get highlight from url
const highlightId = UrlUtil.getGetValue('highlight')
// id is set
if (highlightId ... | } | }, 5000)
}
}
} | random_line_split |
Effects.js | import { UrlUtil } from './UrlUtil'
export class Effects {
constructor () |
// if a var highlight exists in the url it will be highlighted
bindHighlight () {
// get highlight from url
const highlightId = UrlUtil.getGetValue('highlight')
// id is set
if (highlightId !== '') {
// init selector of the element we want to highlight
let selector = '#' + highlightId... | {
this.bindHighlight()
} | identifier_body |
Effects.js | import { UrlUtil } from './UrlUtil'
export class | {
constructor () {
this.bindHighlight()
}
// if a var highlight exists in the url it will be highlighted
bindHighlight () {
// get highlight from url
const highlightId = UrlUtil.getGetValue('highlight')
// id is set
if (highlightId !== '') {
// init selector of the element we want t... | Effects | identifier_name |
types.rs | // Copyright 2015 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initial access to the Software (the "Licences").
//
// By ... | },
/// request to retreive data with specified type and location from network
Get {
location: ::routing::authority::Authority,
data_request: ::routing::data::DataRequest,
},
// /// request to post
// Post { destination: ::routing::NameType, content: Data },
// /// Request del... | location: ::routing::authority::Authority,
content: ::routing::data::Data, | random_line_split |
types.rs | // Copyright 2015 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initial access to the Software (the "Licences").
//
// By ... |
/// Merge multiple refreshable objects into one
fn merge(from_group: ::routing::NameType, responses: Vec<Self>) -> Option<Self>;
}
| {
::routing::utils::encode(&self).unwrap_or(vec![])
} | identifier_body |
types.rs | // Copyright 2015 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initial access to the Software (the "Licences").
//
// By ... | (&self) -> Vec<u8> {
::routing::utils::encode(&self).unwrap_or(vec![])
}
/// Merge multiple refreshable objects into one
fn merge(from_group: ::routing::NameType, responses: Vec<Self>) -> Option<Self>;
}
| serialised_contents | identifier_name |
worker.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | '''
The worker thread class, which uses TaskExecutor to run tasks
read from a job queue and pushes results into a results queue
for reading later.
'''
def __init__(self, rslt_q, task_vars, host, task, play_context, loader, variable_manager, shared_loader_obj):
super(WorkerProcess, self).__... | identifier_body | |
worker.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | # put the result on the result queue
display.debug("sending task result")
self._rslt_q.put(task_result)
display.debug("done sending task result")
except AnsibleConnectionFailure:
self._host.vars = dict()
self._host.groups = []
... | random_line_split | |
worker.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | (self, rslt_q, task_vars, host, task, play_context, loader, variable_manager, shared_loader_obj):
super(WorkerProcess, self).__init__()
# takes a task queue manager as the sole param:
self._rslt_q = rslt_q
self._task_vars = task_vars
self._host = ... | __init__ | identifier_name |
worker.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
try:
# execute the task and build a TaskResult from the result
display.debug("running TaskExecutor() for %s/%s" % (self._host, self._task))
executor_result = TaskExecutor(
self._host,
self._task,
self._task_vars,
... | atfork() | conditional_block |
confirmbox.js | /**
* This file is part of "PCPIN Chat 6".
*
* "PCPIN Chat 6" is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
... | {
document.onkeyup=document.onkeyup_confirmbox;
$('confirmbox').style.display='none';
if (typeof(ok)=='boolean' && ok && confirmboxCallback!='') {
eval('try { '+confirmboxCallback+' } catch(e) {}');
}
} | identifier_body | |
confirmbox.js | /**
* This file is part of "PCPIN Chat 6".
*
* "PCPIN Chat 6" is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
... | (ok) {
document.onkeyup=document.onkeyup_confirmbox;
$('confirmbox').style.display='none';
if (typeof(ok)=='boolean' && ok && confirmboxCallback!='') {
eval('try { '+confirmboxCallback+' } catch(e) {}');
}
}
| hideConfirmBox | identifier_name |
confirmbox.js | /**
* This file is part of "PCPIN Chat 6".
*
* "PCPIN Chat 6" is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
... | /**
* Display confirm box
* @param string $text Text to display
* @param int top_offset Optional. How many pixels to add to the top position. Can be negative or positive.
* @param int left_offset Optional. How many pixels to add to the left position. Can be negative or positive.
*... | var confirmboxCallback='';
| random_line_split |
confirmbox.js | /**
* This file is part of "PCPIN Chat 6".
*
* "PCPIN Chat 6" is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
... |
}
/**
* Hide confirm box
@param boolean ok TRUE, if "OK" button was clicked
*/
function hideConfirmBox(ok) {
document.onkeyup=document.onkeyup_confirmbox;
$('confirmbox').style.display='none';
if (typeof(ok)=='boolean' && ok && confirmboxCallback!='') {
eval('try { '+confirmboxCallback+' } catch(... | {
document.onkeyup_confirmbox=document.onkeyup;
document.onkeyup=function(e) {
switch (getKC(e)) {
case 27:
hideConfirmBox(false);
break;
}
};
if (typeof(top_offset)!='number') top_offset=0;
if (typeof(left_offset)!='number') left_offset=0;
$('confirmbox_t... | conditional_block |
button.spec.js | import Vue from 'vue'
import CButton from 'components/c-button'
describe('button.vue', () => {
let el
beforeEach(() => {
el = document.createElement('div')
document.body.appendChild(el)
})
afterEach(() => {
document.body.removeChild(el)
})
it('should render correct contents', () => {
con... | it('type', () => {
const vm = new Vue({
el,
replace: false,
template: '<c-button type="submit">PLATO</c-button>',
components: {
CButton
}
})
expect(vm.$children[0].$el.type).to.equal('submit')
})
}) | expect(el0.textContent).to.equal('PLATO')
expect(el0.type).to.equal('button')
})
| random_line_split |
gridcolumn.ts |
import { Teq } from '../types/ej-types';
import { ElementIdForLog, EnableLog } from '../../../common-types';
import { ComponentActions, ComponentChecks, ComponentGrabs, ComponentLogs } from './component';
import { queryAndAction } from '../tia-extjs-query';
const compName = 'GridColumn';
/**
* gT.eC.gridcolumn.a o... | extends ComponentGrabs {
static compName = compName;
}
/**
* gT.eC.gridcolumn.l or gT.eC.gridcolumn.logs
*/
export class GridColumnLogs extends ComponentLogs {
static compName = compName;
}
export class GridColumnAPI {
static a = GridColumnActions;
static actions = GridColumnActions;
static c = GridColum... | GridColumnGrabs | identifier_name |
gridcolumn.ts | import { Teq } from '../types/ej-types';
import { ElementIdForLog, EnableLog } from '../../../common-types';
import { ComponentActions, ComponentChecks, ComponentGrabs, ComponentLogs } from './component';
import { queryAndAction } from '../tia-extjs-query';
const compName = 'GridColumn';
/**
* gT.eC.gridcolumn.a or ... | */
export class GridColumnLogs extends ComponentLogs {
static compName = compName;
}
export class GridColumnAPI {
static a = GridColumnActions;
static actions = GridColumnActions;
static c = GridColumnChecks;
static checks = GridColumnChecks;
static g = GridColumnGrabs;
static grabs = GridColumnGrabs;
... | }
/**
* gT.eC.gridcolumn.l or gT.eC.gridcolumn.logs | random_line_split |
__init__.py | from tilequeue.query.fixture import make_fixture_data_fetcher
from tilequeue.query.pool import DBConnectionPool
from tilequeue.query.postgres import make_db_data_fetcher
from tilequeue.query.rawr import make_rawr_data_fetcher
from tilequeue.query.split import make_split_data_fetcher
from tilequeue.process import Source... |
output_layer_data = make_output_calc_mapping(process_yaml_cfg)
min_zoom_layer_data = make_min_zoom_calc_mapping(process_yaml_cfg)
keys = set(output_layer_data.keys())
assert keys == set(min_zoom_layer_data.keys())
functions = {}
for key in keys:
min_zoom_fn = min_zoom_layer_data[key]
... | random_line_split | |
__init__.py | from tilequeue.query.fixture import make_fixture_data_fetcher
from tilequeue.query.pool import DBConnectionPool
from tilequeue.query.postgres import make_db_data_fetcher
from tilequeue.query.rawr import make_rawr_data_fetcher
from tilequeue.query.split import make_split_data_fetcher
from tilequeue.process import Source... |
return functions
| min_zoom_fn = min_zoom_layer_data[key]
output_fn = output_layer_data[key]
functions[key] = (min_zoom_fn, output_fn) | conditional_block |
__init__.py | from tilequeue.query.fixture import make_fixture_data_fetcher
from tilequeue.query.pool import DBConnectionPool
from tilequeue.query.postgres import make_db_data_fetcher
from tilequeue.query.rawr import make_rawr_data_fetcher
from tilequeue.query.split import make_split_data_fetcher
from tilequeue.process import Source... | (layer_data, process_yaml_cfg):
from tilequeue.query.common import LayerInfo, ShapeType
layers = {}
functions = _parse_yaml_functions(process_yaml_cfg)
for layer_datum in layer_data:
name = layer_datum['name']
min_zoom_fn, props_fn = functions[name]
shape_types = ShapeType.pars... | _make_layer_info | identifier_name |
__init__.py | from tilequeue.query.fixture import make_fixture_data_fetcher
from tilequeue.query.pool import DBConnectionPool
from tilequeue.query.postgres import make_db_data_fetcher
from tilequeue.query.rawr import make_rawr_data_fetcher
from tilequeue.query.split import make_split_data_fetcher
from tilequeue.process import Source... |
def _make_layer_info(layer_data, process_yaml_cfg):
from tilequeue.query.common import LayerInfo, ShapeType
layers = {}
functions = _parse_yaml_functions(process_yaml_cfg)
for layer_datum in layer_data:
name = layer_datum['name']
min_zoom_fn, props_fn = functions[name]
shape... | rawr_yaml = cfg.yml.get('rawr')
assert rawr_yaml is not None, 'Missing rawr configuration in yaml'
group_by_zoom = rawr_yaml.get('group-zoom')
assert group_by_zoom is not None, 'Missing group-zoom rawr config'
rawr_source_yaml = rawr_yaml.get('source')
assert rawr_source_yaml, 'Missing rawr source... | identifier_body |
07-popup.js | var modal = (<Modal type="popup" title="爱过什么女爵的滋味"> | <ModalTrigger
modal={modal}>
<Button amStyle="primary">Popup 窗口</Button>
</ModalTrigger>
);
ReactDOM.render(modalInstance, mountNode); | <p>为你封了国境<br/>为你赦了罪<br/>为你撤了历史记载<br/>为你涂了装扮<br/>为你喝了醉<br/>为你建了城池围墙<br/>一颗热的心穿着冰冷外衣<br/>一张白的脸漆上多少褪色的情节<br/>在我的空虚身体里面<br/>爱上哪个肤浅的王位<br/>在你的空虚宝座里面<br/>爱过什麽女爵的滋味<br/>为你封了国境</p><p>为你赦了罪<br/>为你撤了历史记载<br/>一颗热的心<br/>穿着冰冷外衣<br/>一张白的脸<br/>漆上多少褪色的情节<br/>在我的空虚身体里面<br/>爱上哪个肤浅的王位<br/>在你的空虚宝座里面<br/>爱过什麽女爵的滋味<br/>在我的空虚身体里面<br/>爱上哪个肤... | random_line_split |
repl.js | /*
* repl.js
* Copyright (C) 2015 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the BSD license.
*/
"use strict"; /*jshint node:true */
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var util = require('util');
var utils = require('./utils');
var completelib = ... |
function repl_defaults(options) {
options = options || {};
if (!options.input) options.input = process.stdin;
if (!options.output) options.output = process.stdout;
if (options.show_js === undefined) options.show_js = true;
if (!options.ps1) options.ps1 = '>>> ';
if (!options.ps2) options.ps2 =... | {
if (!x) return x;
if (x === '~') return homedir;
if (x.slice(0, 2) != '~/') return x;
return path.join(homedir, x.slice(2));
} | identifier_body |
repl.js | /*
* repl.js
* Copyright (C) 2015 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the BSD license.
*/
"use strict"; /*jshint node:true */
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var util = require('util');
var utils = require('./utils');
var completelib = ... |
function resetbuffer() { buffer = []; }
function completer(line) {
return find_completions(line, ctx);
}
function prompt() {
var lw = '';
if (more && buffer.length) {
var prev_line = buffer[buffer.length - 1];
if (prev_line.trimRight().substr(prev_line.... | ast.print(output);
return output.get();
}
| random_line_split |
repl.js | /*
* repl.js
* Copyright (C) 2015 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the BSD license.
*/
"use strict"; /*jshint node:true */
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var util = require('util');
var utils = require('./utils');
var completelib = ... | (line) {
buffer.push(line);
var ll = line.trimRight();
if (ll && LINE_CONTINUATION_CHARS.indexOf(ll.substr(ll.length - 1)) > -1)
return true;
var source = buffer.join('\n');
if (!source.trim()) { resetbuffer(); return false; }
var incomplete = compile_source(s... | push | identifier_name |
repl.js | /*
* repl.js
* Copyright (C) 2015 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the BSD license.
*/
"use strict"; /*jshint node:true */
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var util = require('util');
var utils = require('./utils');
var completelib = ... |
}
function runjs(js) {
var result;
if (vm.runInContext('show_js', ctx)) {
options.console.log(options.colored('---------- Compiled JavaScript ---------', 'green', true));
options.console.log(js);
options.console.log(options.colored('---------- Running JavaSc... | {
rl.prompt();
if (lw) rl.write(lw);
} | conditional_block |
app.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from ..core.app import SatchlessApp
from . import models
class ... |
def details(self, request, order_token):
order = self.get_order(request, order_token=order_token)
context = self.get_context_data(request, order=order)
format_data = {
'order_model': order._meta.model_name
}
templates = [p % format_data for p in self.order_detai... | orders = self.order_model.objects.filter(user=request.user)
context = self.get_context_data(request, orders=orders)
format_data = {
'order_model': self.order_model._meta.model_name
}
templates = [p % format_data for p in self.order_list_templates]
return TemplateRespo... | identifier_body |
app.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required | from ..core.app import SatchlessApp
from . import models
class OrderApp(SatchlessApp):
app_name = 'order'
namespace = 'order'
order_model = models.Order
order_details_templates = [
'satchless/order/view.html',
'satchless/order/%(order_model)s/view.html'
]
order_list_templates = ... | from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
| random_line_split |
app.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from ..core.app import SatchlessApp
from . import models
class ... |
else:
orders = self.order_model.objects.filter(user=None)
order = get_object_or_404(orders, token=order_token)
return order
def get_urls(self, prefix=None):
prefix = prefix or self.app_name
return patterns('',
url(r'^$', self.index, name='index'),
... | orders = self.order_model.objects.filter(user=request.user) | conditional_block |
app.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from ..core.app import SatchlessApp
from . import models
class ... | (self, request, order_token):
order = self.get_order(request, order_token=order_token)
context = self.get_context_data(request, order=order)
format_data = {
'order_model': order._meta.model_name
}
templates = [p % format_data for p in self.order_details_templates]
... | details | identifier_name |
app.js | "use strict";
| requirejs.config({
'baseUrl': 'js/lib',
'paths': {
'app': '../app',
'text': './text',
'jquery': 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min',
'jqueryui': 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min'
},
'config': {
'app/mai... | random_line_split | |
before_vm_migrate_destination.py | #!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
command = ['/bin/mkdir', '-p', dirpath]
retcod... |
def cloneDeviceNode(srcpath, devpath):
"""Clone a device node into a temporary private location."""
# we don't use os.remove/mknod/chmod/chown because we need sudo
command = ['/bin/rm', '-f', devpath]
retcode, out, err = utils.execCmd(command, sudo=True, raw=True)
if retcode != 0:
sys.st... | sys.stderr.write('directlun: error chmod %s %s, err = %s\n' % (dirpath, mode, err))
sys.exit(2) | conditional_block |
before_vm_migrate_destination.py | #!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
command = ['/bin/mkdir', '-p', dirpath]
retcod... | sys.exit(2)
mode = '755'
command = ['/bin/chmod', mode, dirpath]
if retcode != 0:
sys.stderr.write('directlun: error chmod %s %s, err = %s\n' % (dirpath, mode, err))
sys.exit(2)
def cloneDeviceNode(srcpath, devpath):
"""Clone a device node into a temporary private location."""... | random_line_split | |
before_vm_migrate_destination.py | #!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
|
def cloneDeviceNode(srcpath, devpath):
"""Clone a device node into a temporary private location."""
# we don't use os.remove/mknod/chmod/chown because we need sudo
command = ['/bin/rm', '-f', devpath]
retcode, out, err = utils.execCmd(command, sudo=True, raw=True)
if retcode != 0:
sys.st... | command = ['/bin/mkdir', '-p', dirpath]
retcode, out, err = utils.execCmd(command, sudo=True, raw=True)
if retcode != 0:
sys.stderr.write('directlun: error mkdir %s, err = %s\n' % (dirpath, err))
sys.exit(2)
mode = '755'
command = ['/bin/chmod', mode, dirpath]
if retcode != 0:
... | identifier_body |
before_vm_migrate_destination.py | #!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
command = ['/bin/mkdir', '-p', dirpath]
retcod... | (srcpath, devpath):
"""Clone a device node into a temporary private location."""
# we don't use os.remove/mknod/chmod/chown because we need sudo
command = ['/bin/rm', '-f', devpath]
retcode, out, err = utils.execCmd(command, sudo=True, raw=True)
if retcode != 0:
sys.stderr.write('directlun:... | cloneDeviceNode | identifier_name |
classConsor_1_1RadioBox.js | var classConsor_1_1RadioBox =
[
[ "RadioBox", "classConsor_1_1RadioBox_aae20cff4d62bf98f51a48d77599a3481.html#aae20cff4d62bf98f51a48d77599a3481", null ],
[ "~RadioBox", "classConsor_1_1RadioBox_a7e6c1b1b1b6474b2f9af331f135cfe7e.html#a7e6c1b1b1b6474b2f9af331f135cfe7e", null ],
[ "AddChoice", "classConsor_1_1... | ]; | [ "_FlowContainer", "classConsor_1_1RadioBox_a7461345288b9f70ef123782c95c76127.html#a7461345288b9f70ef123782c95c76127", null ],
[ "OnValueChanged", "classConsor_1_1RadioBox_a3a42be4b48f0f485c5d4a6b92d2f7e3a.html#a3a42be4b48f0f485c5d4a6b92d2f7e3a", null ] | random_line_split |
test_driverbase.py | #
# Copyright 2015 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... |
def _get_driver(self, name):
with patch(builtin_import, spec=True, new_callable=try_import):
return get_driver(name)
def test_base_not_implemented(self):
driver = VirtDeployDriverBase()
for name, method in self._get_driver_methods():
spec = inspect.getargspec(... | with patch(builtin_import, spec=True, new_callable=try_import):
return get_driver_class(name) | identifier_body |
test_driverbase.py | #
# Copyright 2015 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | return get_driver(name)
def test_base_not_implemented(self):
driver = VirtDeployDriverBase()
for name, method in self._get_driver_methods():
spec = inspect.getargspec(method)
with self.assertRaises(NotImplementedError) as cm:
getattr(driver, nam... |
def _get_driver(self, name):
with patch(builtin_import, spec=True, new_callable=try_import): | random_line_split |
test_driverbase.py | #
# Copyright 2015 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | (self):
for driver_name in get_driver_names():
driver = self._get_driver(driver_name)
self.assertTrue(isinstance(driver, VirtDeployDriverBase))
| test_get_drivers | identifier_name |
test_driverbase.py | #
# Copyright 2015 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... |
def test_drivers_interface(self):
for driver_name in get_driver_names():
driver = self._get_driver_class(driver_name)
for name, method in self._get_driver_methods():
driver_method = getattr(driver, name)
self.assertNotEqual(driver_method, method)
... | spec = inspect.getargspec(method)
with self.assertRaises(NotImplementedError) as cm:
getattr(driver, name)(*(None,) * (len(spec.args) - 1))
self.assertEqual(cm.exception.args[0], name) | conditional_block |
converter.py | """Funções de conversão usada pelo scraper do Itaú."""
import datetime
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from decimal import Decimal
def date(s):
"""Converte strings 'DD/MM' em datetime.date.
Leva em consideração ano anterior para meses maiores que o mês corren... | dt = dt.date()
return dt
def decimal(s):
"""Converte strings para Decimal('-9876.54').
>>> assert decimal('9.876,54-') == Decimal('-9876.54')
>>> assert decimal('9.876,54 D') == Decimal('-9876.54')
>>> assert decimal('9.876,54 C') == Decimal('9876.54')
>>> assert decimal('R$ 9.876,54') ==... | dt += relativedelta(years=-1)
| random_line_split |
converter.py | """Funções de conversão usada pelo scraper do Itaú."""
import datetime
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from decimal import Decimal
def date(s):
"""Converte strings 'DD/MM' em datetime.date.
Leva em consideração ano anterior para meses maiores que o mês corren... | esumo do cartão de texto para tipos Python.
Entrada: (('Item do Resumo', 'R$ -9.876,54'), ...)
Saída..: (('Item do Resumo', Decimal('-9876.54')), ...)
"""
return ((a, decimal(b)) for a, b in iterable)
| identifier_body | |
converter.py | """Funções de conversão usada pelo scraper do Itaú."""
import datetime
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from decimal import Decimal
def date(s):
"""Converte strings 'DD/MM' em datetime.date.
Leva em consideração ano anterior para meses maiores que o mês corren... | endswith(' D'):
s = '-' + s[:-2]
elif s.endswith(' C'):
s = s[:-2]
return Decimal(s)
def is_balance(s):
"""Retorna True quando s é uma entrada de saldo em vez de lançamento."""
return s in ('S A L D O',
'(-) SALDO A LIBERAR',
'SALDO FINAL DISPONIVEL',... | s[:-1]
elif s. | conditional_block |
converter.py | """Funções de conversão usada pelo scraper do Itaú."""
import datetime
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from decimal import Decimal
def date(s):
"""Converte strings 'DD/MM' em datetime.date.
Leva em consideração ano anterior para meses maiores que o mês corren... | Converte strings para Decimal('-9876.54').
>>> assert decimal('9.876,54-') == Decimal('-9876.54')
>>> assert decimal('9.876,54 D') == Decimal('-9876.54')
>>> assert decimal('9.876,54 C') == Decimal('9876.54')
>>> assert decimal('R$ 9.876,54') == Decimal('9876.54')
>>> assert decimal('R$ -9.876,54') ... | """ | identifier_name |
navigation-control.directive.ts | import { AfterContentInit, Directive, Host, Input } from '@angular/core';
import { NavigationControl } from 'mapbox-gl';
import { MapService } from '../map/map.service';
import { ControlComponent } from './control.component';
@Directive({
selector: '[mglNavigation]',
})
export class NavigationControlDirective implem... | () {
this.MapService.mapCreated$.subscribe(() => {
if (this.ControlComponent.control) {
throw new Error('Another control is already set for this control');
}
const options: { showCompass?: boolean; showZoom?: boolean } = {};
if (this.showCompass !== undefined) {
options.showC... | ngAfterContentInit | identifier_name |
navigation-control.directive.ts | import { AfterContentInit, Directive, Host, Input } from '@angular/core';
import { NavigationControl } from 'mapbox-gl';
import { MapService } from '../map/map.service';
import { ControlComponent } from './control.component';
@Directive({
selector: '[mglNavigation]',
})
export class NavigationControlDirective implem... |
if (this.showZoom !== undefined) {
options.showZoom = this.showZoom;
}
this.ControlComponent.control = new NavigationControl(options);
this.MapService.addControl(
this.ControlComponent.control,
this.ControlComponent.position
);
});
}
}
| {
options.showCompass = this.showCompass;
} | conditional_block |
navigation-control.directive.ts | import { AfterContentInit, Directive, Host, Input } from '@angular/core'; | @Directive({
selector: '[mglNavigation]',
})
export class NavigationControlDirective implements AfterContentInit {
/* Init inputs */
@Input() showCompass?: boolean;
@Input() showZoom?: boolean;
constructor(
private MapService: MapService,
@Host() private ControlComponent: ControlComponent<NavigationC... | import { NavigationControl } from 'mapbox-gl';
import { MapService } from '../map/map.service';
import { ControlComponent } from './control.component';
| random_line_split |
api.service.ts | /**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (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.
* S... | * you may not use this file except in compliance with the License. | random_line_split |
api.service.ts | /**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
}
| {
return this.http.get<Elapsed>('bench', {observe: 'response'});
} | identifier_body |
api.service.ts | /**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | (): Observable<HttpResponse<Elapsed>> {
return this.http.get<Elapsed>('normal', {observe: 'response'});
}
accessBenchEndpoint(): Observable<HttpResponse<Elapsed>> {
return this.http.get<Elapsed>('bench', {observe: 'response'});
}
}
| accessNormalEndpoint | identifier_name |
tools.component.ts | import { Component, HostListener, Input, OnInit } from '@angular/core';
import { Highlights } from '../highlights';
@Component({
selector: 'kirjs-tools',
templateUrl: './tools.component.html',
styleUrls: ['./tools.component.css']
})
export class ToolsComponent implements OnInit {
@Input() game;
@Input() high... | (a: number) {
if (a >= 48 && a <= 57) {
this.handle(this.tools[a - 49]);
}
}
handle(tool) {
const selected = tool.init(this.game, this.highlights);
if (selected) {
this.selectedTool = tool;
}
}
constructor() {
this.selectedTool = this.tools[0];
}
ngOnInit() {}
}
| shortcut | identifier_name |
tools.component.ts | import { Component, HostListener, Input, OnInit } from '@angular/core';
import { Highlights } from '../highlights';
@Component({
selector: 'kirjs-tools',
templateUrl: './tools.component.html',
styleUrls: ['./tools.component.css']
})
export class ToolsComponent implements OnInit {
@Input() game;
@Input() high... |
}
handle(tool) {
const selected = tool.init(this.game, this.highlights);
if (selected) {
this.selectedTool = tool;
}
}
constructor() {
this.selectedTool = this.tools[0];
}
ngOnInit() {}
}
| {
this.handle(this.tools[a - 49]);
} | conditional_block |
tools.component.ts | import { Component, HostListener, Input, OnInit } from '@angular/core';
import { Highlights } from '../highlights';
@Component({
selector: 'kirjs-tools',
templateUrl: './tools.component.html',
styleUrls: ['./tools.component.css']
})
export class ToolsComponent implements OnInit {
@Input() game;
@Input() high... |
}
| {} | identifier_body |
tools.component.ts | import { Component, HostListener, Input, OnInit } from '@angular/core';
import { Highlights } from '../highlights';
@Component({
selector: 'kirjs-tools',
templateUrl: './tools.component.html',
styleUrls: ['./tools.component.css']
})
export class ToolsComponent implements OnInit {
@Input() game;
@Input() high... | return this;
}
},
{
name: 'highlight2',
action: function(point, game, highlights: Highlights) {
highlights.toggle(point, 'highlight-orange');
},
init: function() {
return this;
}
},
{
name: 'clear',
action: function(point, game, hig... | },
init: function() { | random_line_split |
uds.rs | use std::io::{Read, Write};
use std::mem;
use std::net::Shutdown;
use std::os::unix::prelude::*;
use std::path::Path;
use libc;
use {io, Ready, Poll, PollOpt, Token};
use event::Evented;
use sys::unix::{cvt, Io};
use sys::unix::io::{set_nonblock, set_cloexec};
trait MyInto<T> {
fn my_into(self) -> T;
}
impl MyI... |
Some(_) => len += 1,
}
Ok((addr, len as libc::socklen_t))
}
fn sun_path_offset() -> usize {
unsafe {
// Work with an actual instance of the type since using a null pointer is UB
let addr: libc::sockaddr_un = mem::uninitialized();
let base = &addr as *const _ as usize;
... | {} | conditional_block |
uds.rs | use std::io::{Read, Write};
use std::mem;
use std::net::Shutdown;
use std::os::unix::prelude::*;
use std::path::Path;
use libc;
use {io, Ready, Poll, PollOpt, Token};
use event::Evented;
use sys::unix::{cvt, Io};
use sys::unix::io::{set_nonblock, set_cloexec};
trait MyInto<T> {
fn my_into(self) -> T;
}
impl MyI... | (&self, backlog: usize) -> io::Result<()> {
unsafe {
cvt(libc::listen(self.as_raw_fd(), backlog as i32))?;
Ok(())
}
}
pub fn accept(&self) -> io::Result<UnixSocket> {
unsafe {
let fd = cvt(libc::accept(self.as_raw_fd(),
... | listen | identifier_name |
uds.rs | use std::io::{Read, Write};
use std::mem;
use std::net::Shutdown;
use std::os::unix::prelude::*;
use std::path::Path;
use libc;
use {io, Ready, Poll, PollOpt, Token};
use event::Evented;
use sys::unix::{cvt, Io};
use sys::unix::io::{set_nonblock, set_cloexec};
trait MyInto<T> {
fn my_into(self) -> T;
}
impl MyI... | }
}
pub fn accept(&self) -> io::Result<UnixSocket> {
unsafe {
let fd = cvt(libc::accept(self.as_raw_fd(),
0 as *mut _,
0 as *mut _))?;
let fd = Io::from_raw_fd(fd);
set_cloe... | random_line_split | |
index.d.ts | import { FowerPlugin, ResponsiveBoolean } from '@fower/core'
declare const _default: () => FowerPlugin
export default _default
declare module '@fower/atomic-props' {
export interface AtomicProps {
/**
* Set line breaks to normal
*
* @example
* ```css
* {
* overflow-wrap: normal;
... | * overflow-wrap: break-word;
* }
* ```
*
* @example
* ```tsx
* <Box breakWords></Box>
* ```
*/
breakWords?: ResponsiveBoolean
/**
* set word-break to break-all
*
* ```css
* {
* word-break: break-all;
* }
* ```
* @example
... | *
* ```css
* { | random_line_split |
test_public_api.py | """Test the IPython.kernel public API
Authors
-------
* MinRK
""" | # Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
import nose.tools as nt
from IPython.testing ... | #----------------------------------------------------------------------------- | random_line_split |
test_public_api.py | """Test the IPython.kernel public API
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... |
@dec.parametric
def test_connect():
for name in connect.__all__:
yield nt.assert_true(name in dir(kernel), name)
| for name in launcher.__all__:
yield nt.assert_true(name in dir(kernel), name) | identifier_body |
test_public_api.py | """Test the IPython.kernel public API
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... |
@dec.parametric
def test_kcs():
for base in ("", "Blocking"):
KM = base + "KernelClient"
yield nt.assert_true(KM in dir(kernel), KM)
@dec.parametric
def test_launcher():
for name in launcher.__all__:
yield nt.assert_true(name in dir(kernel), name)
@dec.parametric
def test_connect():
... | KM = base + "KernelManager"
yield nt.assert_true(KM in dir(kernel), KM) | conditional_block |
test_public_api.py | """Test the IPython.kernel public API
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... | ():
for base in ("", "Multi"):
KM = base + "KernelManager"
yield nt.assert_true(KM in dir(kernel), KM)
@dec.parametric
def test_kcs():
for base in ("", "Blocking"):
KM = base + "KernelClient"
yield nt.assert_true(KM in dir(kernel), KM)
@dec.parametric
def test_launcher():
f... | test_kms | identifier_name |
settings.py | """
Django settings for apps project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
from... |
SECRET_KEY = SECRET_KEY
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = DEBUG
ALLOWED_HOSTS = [
'learningdjango.in',
'localhost',
'127.0.0.1'
]
# Application definition
INSTALLED_APPS = [
'home.apps.HomeConfig',
'polls.apps.PollsConfig',
'blog.apps.BlogConfig',
... |
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ | random_line_split |
IncrementalChecker.d.ts | import * as ts from 'typescript';
import { NormalizedMessage } from './NormalizedMessage';
import { CancellationToken } from './CancellationToken';
import * as minimatch from 'minimatch';
import { IncrementalCheckerInterface, IncrementalCheckerParams } from './IncrementalCheckerInterface';
export declare class | implements IncrementalCheckerInterface {
private linterConfigs;
private files;
private linter?;
private linterConfig?;
private linterExclusions;
protected program?: ts.Program;
protected programConfig?: ts.ParsedCommandLine;
private watcher?;
private readonly hasFixedConfig;
pri... | IncrementalChecker | identifier_name |
IncrementalChecker.d.ts | import * as ts from 'typescript';
import { NormalizedMessage } from './NormalizedMessage';
import { CancellationToken } from './CancellationToken';
import * as minimatch from 'minimatch';
import { IncrementalCheckerInterface, IncrementalCheckerParams } from './IncrementalCheckerInterface';
export declare class Incremen... | constructor({ typescript, context, programConfigFile, compilerOptions, createNormalizedMessageFromDiagnostic, linterConfigFile, linterAutoFix, createNormalizedMessageFromRuleFailure, eslinter, watchPaths, workNumber, workDivision, vue, checkSyntacticErrors, resolveModuleName, resolveTypeReferenceDirective }: Increm... | private readonly workDivision;
private readonly vue;
private readonly checkSyntacticErrors;
private readonly resolveModuleName;
private readonly resolveTypeReferenceDirective; | random_line_split |
p_2_1_2_02.rs | // P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni
// with contributions by Joey Lee and Niels Poldervaart
// Copyright 2018
//
// http://www.generative-gestaltung.... | p: &App, model: &Model, frame: Frame) {
let draw = app.draw();
let win = app.window_rect();
draw.background().color(WHITE);
let mut rng = StdRng::seed_from_u64(model.act_random_seed);
let mx = clamp(win.right() + app.mouse.x, 0.0, win.w());
let my = clamp(win.top() - app.mouse.y, 0.0, win.h()... | w(ap | identifier_name |
p_2_1_2_02.rs | // P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni
// with contributions by Joey Lee and Niels Poldervaart
// Copyright 2018
//
// http://www.generative-gestaltung.... | }
Key::Key3 => {
if model.module_alpha_background == 1.0 {
model.module_alpha_background = 0.5;
model.module_alpha_foreground = 0.5;
} else {
model.module_alpha_background = 1.0;
model.module_alpha_foreground = 1.0;
... | model.module_color_foreground = hsva(1.0, 1.0, 1.0, model.module_alpha_foreground);
}
| conditional_block |
p_2_1_2_02.rs | // P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni
// with contributions by Joey Lee and Niels Poldervaart
// Copyright 2018
//
// http://www.generative-gestaltung.... | }
Key::Key0 => {
model.module_radius_background = 15.0;
model.module_radius_foreground = 7.5;
model.module_alpha_background = 1.0;
model.module_alpha_foreground = 1.0;
model.module_color_background = hsva(0.0, 0.0, 0.0, model.module_alpha_backg... | model.module_color_foreground.alpha = model.module_alpha_foreground; | random_line_split |
p_2_1_2_02.rs | // P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni
// with contributions by Joey Lee and Niels Poldervaart
// Copyright 2018
//
// http://www.generative-gestaltung.... | n view(app: &App, model: &Model, frame: Frame) {
let draw = app.draw();
let win = app.window_rect();
draw.background().color(WHITE);
let mut rng = StdRng::seed_from_u64(model.act_random_seed);
let mx = clamp(win.right() + app.mouse.x, 0.0, win.w());
let my = clamp(win.top() - app.mouse.y, 0.0... | let _window = app
.new_window()
.size(600, 600)
.view(view)
.mouse_pressed(mouse_pressed)
.key_pressed(key_pressed)
.key_released(key_released)
.build()
.unwrap();
let module_alpha_background = 1.0;
let module_alpha_foreground = 1.0;
Model... | identifier_body |
bot.js | var config = require("./config.json");
var currentSong, newSong, currentAlbum;
const http = require("http");
const LastFmNode = require("lastfm").LastFmNode;
const Discord = require("discord.js");
const client = new Discord.Client();
var lastfm = new LastFmNode({
api_key: config.api_key
});
function stoppedPlay... | });
stoppedPlaying();
process.exit(1);
});
console.log('Bot on, hit CTRL+C to exit :)');
client.login(config.token); | depth: null | random_line_split |
bot.js | var config = require("./config.json");
var currentSong, newSong, currentAlbum;
const http = require("http");
const LastFmNode = require("lastfm").LastFmNode;
const Discord = require("discord.js");
const client = new Discord.Client();
var lastfm = new LastFmNode({
api_key: config.api_key
});
function stoppedPlay... |
var trackStream = lastfm.stream(config.username);
trackStream.on("nowPlaying", function(track) {
if(track.name && track.artist["#text"]){
//console.log(track);
if(track["@attr"]){
newSong = track.artist["#text"] + " - " + track.name;
if (newSong != currentSong) {
... | {
console.log("stopped playing.");
client.user.setGame(0);
currentAlbum = 0;
if(config.changeAvatar){
client.user.setAvatar(config.defaultAvatar);
}
} | identifier_body |
bot.js | var config = require("./config.json");
var currentSong, newSong, currentAlbum;
const http = require("http");
const LastFmNode = require("lastfm").LastFmNode;
const Discord = require("discord.js");
const client = new Discord.Client();
var lastfm = new LastFmNode({
api_key: config.api_key
});
function | (){
console.log("stopped playing.");
client.user.setGame(0);
currentAlbum = 0;
if(config.changeAvatar){
client.user.setAvatar(config.defaultAvatar);
}
}
var trackStream = lastfm.stream(config.username);
trackStream.on("nowPlaying", function(track) {
if(track.name && track.artist["#text... | stoppedPlaying | identifier_name |
bot.js | var config = require("./config.json");
var currentSong, newSong, currentAlbum;
const http = require("http");
const LastFmNode = require("lastfm").LastFmNode;
const Discord = require("discord.js");
const client = new Discord.Client();
var lastfm = new LastFmNode({
api_key: config.api_key
});
function stoppedPlay... | se{
stoppedPlaying();
}
}
});
trackStream.on("stoppedPlaying", function(track) {
stoppedPlaying();
});
trackStream.on("error", function(err) {
console.log("something went wrong: ",err);
});
client.on("ready", () => {
console.log(`Logged in as ${client.user.username}!`);
trackS... | {
newSong = track.artist["#text"] + " - " + track.name;
if (newSong != currentSong) {
if (currentAlbum != track.album["#text"]){
if(track.image[0]["#text"] && config.changeAvatar){
console.log("playing album: "+track.album["#text"]);
... | conditional_block |
app.module.ts | import { AppComponent } from './app.component';
import { AuthGuard } from './auth-guard.service';
import { AuthService } from './auth.service';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { PlanService } fro... | {}
| AppModule | identifier_name |
app.module.ts | import { AppComponent } from './app.component';
import { AuthGuard } from './auth-guard.service';
import { AuthService } from './auth.service';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { PlanService } fro... | AngularFireModule.initializeApp(firebaseConfig, firebaseAuthConfig),
BrowserModule,
FormsModule,
RouterModule,
RouterModule.forRoot(routes)
],
bootstrap: [ AppComponent ],
providers: [ AuthGuard, AuthService, PlanService ]
})
export class AppModule {} | r.push(AppComponent);
@NgModule({
declarations: r,
imports: [ | random_line_split |
convert_fasta2phylip.py | #!/usr/bin/env python3
"""Convert FASTA to PHYLIP"""
import sys
from Bio import SeqIO
print("Convert FASTA to PHYLIP")
infile = sys.argv[1]
outfile = sys.argv[2]
sequence_list = [] # To keep order of sequence
sequence_dict = {}
for record in SeqIO.parse(open(infile, "rU"), "fasta"):
tab = record.id.split(" "... | if len(sys.argv) > 3:
name_length = int(sys.argv[3])
# Write alignment in Phylip format
phyfile = open(outfile, "w")
phyfile.write(str(number_of_seq)+"\t"+str(alignment_length)+"\n")
for gene in sequence_list:
if len(gene) > name_length:
gene_name = gene[0:name_length].replace(" ", "")
if gene... | print("Warning: Hum, your alignment didn't code for nucleotides")
# Length of gene id, can be changed by passing a third argument
name_length = 50 | random_line_split |
convert_fasta2phylip.py | #!/usr/bin/env python3
"""Convert FASTA to PHYLIP"""
import sys
from Bio import SeqIO
print("Convert FASTA to PHYLIP")
infile = sys.argv[1]
outfile = sys.argv[2]
sequence_list = [] # To keep order of sequence
sequence_dict = {}
for record in SeqIO.parse(open(infile, "rU"), "fasta"):
tab = record.id.split(" "... |
# Length of gene id, can be changed by passing a third argument
name_length = 50
if len(sys.argv) > 3:
name_length = int(sys.argv[3])
# Write alignment in Phylip format
phyfile = open(outfile, "w")
phyfile.write(str(number_of_seq)+"\t"+str(alignment_length)+"\n")
for gene in sequence_list:
if len(gene) > na... | print("Warning: Hum, your alignment didn't code for nucleotides") | conditional_block |
stat.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | } | random_line_split | |
stat.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | () {
let dir = TempDir::new_in(&Path::new("."), "").unwrap();
let path = dir.path().join("file");
{
match File::create(&path) {
Err(..) => unreachable!(),
Ok(f) => {
let mut f = f;
for _ in range(0u, 1000) {
f.write([0]);
... | main | identifier_name |
stat.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | {
let dir = TempDir::new_in(&Path::new("."), "").unwrap();
let path = dir.path().join("file");
{
match File::create(&path) {
Err(..) => unreachable!(),
Ok(f) => {
let mut f = f;
for _ in range(0u, 1000) {
f.write([0]);
... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.