file_name large_stringlengths 4 140 | prefix large_stringlengths 0 12.1k | suffix large_stringlengths 0 12k | middle large_stringlengths 0 7.51k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
main.js | var windows = [];
/**
* Resets the windows and removes
* any interval that is running
*/
function reset() {
windows.forEach( function (w) {
w.contentWindow.close();
} );
windows.length = 0;
}
/**
* Initialise and launch the windows
* @see http://developer.chrome.com/apps/app.window.html
*/
function ... |
// @see http://developer.chrome.com/apps/app.runtime.html
chrome.app.runtime.onLaunched.addListener(launch);
| {
windows.forEach( function (w) {
w.minimize();
});
} | identifier_body |
main.js | var windows = [];
/**
* Resets the windows and removes
* any interval that is running
*/
function reset() {
windows.forEach( function (w) {
w.contentWindow.close();
} );
windows.length = 0;
}
/**
* Initialise and launch the windows
* @see http://developer.chrome.com/apps/app.window.html
*/
function ... | windows.forEach( function (w) {
w.minimize();
});
}
// @see http://developer.chrome.com/apps/app.runtime.html
chrome.app.runtime.onLaunched.addListener(launch); | */
function minimizeAll() {
| random_line_split |
main.js | var windows = [];
/**
* Resets the windows and removes
* any interval that is running
*/
function reset() {
windows.forEach( function (w) {
w.contentWindow.close();
} );
windows.length = 0;
}
/**
* Initialise and launch the windows
* @see http://developer.chrome.com/apps/app.window.html
*/
function | () {
// reset everything
reset();
// create the original window
chrome.app.window.create('original.html', {
id: "mainwin",
innerBounds: {
top: 128,
left: 128,
width: 300,
height: 300,
minHeight: 300,
maxWidth: 500,
minWidth: 300
},
... | launch | identifier_name |
remove.js | var
/**
* The CLI utility
* @private
* @type {object}
*/
cli = require('../utils/cli'),
/**
* The inquirer library
* @private
* @type {object}
*/
inquirer = require('inquirer'),
/**
* The storage interface
* @private
* @type {object}
*/
... |
/**
* An array containing inquirer questions
* @private
* @type {Array}
*/
questions = [
{
name: 'master',
type: 'password',
message: 'please enter your master password',
validate: function (input) {
var done = this.asy... | * @type {object}
*/
passwordManager = require('../password'), | random_line_split |
remove.js | var
/**
* The CLI utility
* @private
* @type {object}
*/
cli = require('../utils/cli'),
/**
* The inquirer library
* @private
* @type {object}
*/
inquirer = require('inquirer'),
/**
* The storage interface
* @private
* @type {object}
*/
... |
done(true);
})
}
},
{
name: 'item',
type: 'list',
message: 'select the password you want to remove',
choices: function () {
var done = this.async();
storage.getItem('items').t... | {
done('The master password is not correct');
} | conditional_block |
issue-1112.rs | // Copyright 2012 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-MIT or ... | <T>(x: X<T>) {
assert_eq!(x.b, 9);
assert_eq!(x.c, true);
assert_eq!(x.d, 10);
assert_eq!(x.e, 11);
assert_eq!(x.f, 12);
assert_eq!(x.g, 13);
}
| bar | identifier_name |
issue-1112.rs | // Copyright 2012 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-MIT or ... | assert_eq!(x.e, 11);
assert_eq!(x.f, 12);
assert_eq!(x.g, 13);
} |
fn bar<T>(x: X<T>) {
assert_eq!(x.b, 9);
assert_eq!(x.c, true);
assert_eq!(x.d, 10); | random_line_split |
permission.asset.filter.js | /*
Description: The class is used to filter assets based on the permissions specified in the extension json files
Filename: permission.asset.filter.js
Created Date: 7/10/2013
*/
var filterModule = function () {
var log = new Log('permission.asset.filter');
var utility = require('/modules/utility.js').rxt_... | (context) {
var data = context['data'];
var userRoles = context['roles'];
var tenantId = context['tenantId'];
var item;
var items = [];
//Go through each data item
for (var index in data) {
item = data[index];
//TODO: We are ignoring any... | execute | identifier_name |
permission.asset.filter.js | /*
Description: The class is used to filter assets based on the permissions specified in the extension json files
Filename: permission.asset.filter.js
Created Date: 7/10/2013
*/
var filterModule = function () {
var log = new Log('permission.asset.filter');
var utility = require('/modules/utility.js').rxt_... |
}
return list;
}
/*
The function is used to obtain permissible roles based on the provided state
@context: A context containing the permissions configuration block
@state: The state of the current asset
@return: An array of permissible roles
*/
function obtainPermi... | {
var providerDetails = overviewProvider.split("-AT-");
list.push(permissions[index].replace('{overview_provider}', providerDetails[0]));
} | conditional_block |
permission.asset.filter.js | /*
Description: The class is used to filter assets based on the permissions specified in the extension json files
Filename: permission.asset.filter.js
Created Date: 7/10/2013
*/
var filterModule = function () {
var log = new Log('permission.asset.filter');
var utility = require('/modules/utility.js').rxt_... | execute: execute
}
} | }
return{
isApplicable: isApplicable, | random_line_split |
permission.asset.filter.js | /*
Description: The class is used to filter assets based on the permissions specified in the extension json files
Filename: permission.asset.filter.js
Created Date: 7/10/2013
*/
var filterModule = function () {
var log = new Log('permission.asset.filter');
var utility = require('/modules/utility.js').rxt_... |
/*
The function is used to obtain permissible roles based on the provided state
@context: A context containing the permissions configuration block
@state: The state of the current asset
@return: An array of permissible roles
*/
function obtainPermissibleRoles(context, state) {
... | {
var list = [];
var overviewProvider = item.attributes.overview_provider;
for (var index in permissions) {
if(tenantId == '-1234') {
list.push(permissions[index].replace('{overview_provider}', overviewProvider));
} else {
var providerDetai... | identifier_body |
algorithms.ts | import 'rxjs/add/operator/map';
import {Injectable} from '@angular/core';
import {Http, RequestMethod} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Cube} from '../models/cube';
import 'rxjs/add/operator/mergeMap';
import {Algorithm} from '../models/analysis/algorithm';
import {Input, InputT... |
let response = res.json();
return new Algorithm().deserialize(response);
});
}
getTimeSeriesAlgorithm(): Observable<Algorithm> {
let that = this;
return this.getActualCompatibleAlgorithm('time_series');
}
getDescriptiveStatisticsAlgorithm(): Observable<Algorithm> {
retu... |
getActualCompatibleAlgorithm( algorithmName): Observable<Algorithm> {
return this.http.get(`${environment.DAMUrl}/services/meta/${algorithmName}`)
.map(res => { | random_line_split |
algorithms.ts | import 'rxjs/add/operator/map';
import {Injectable} from '@angular/core';
import {Http, RequestMethod} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Cube} from '../models/cube';
import 'rxjs/add/operator/mergeMap';
import {Algorithm} from '../models/analysis/algorithm';
import {Input, InputT... | {
private API_DAM_PATH: string = environment.DAMUrl ;
constructor(private http: Http) {
}
getActualCompatibleAlgorithms(): Observable<Algorithm[]> {
// console.log(JSON.stringify({time_series: AlgorithmsService.dummyTimeSeries().serialize(), descriptive_statistics: AlgorithmsService.dummyDescriptiveStati... | AlgorithmsService | identifier_name |
algorithms.ts | import 'rxjs/add/operator/map';
import {Injectable} from '@angular/core';
import {Http, RequestMethod} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Cube} from '../models/cube';
import 'rxjs/add/operator/mergeMap';
import {Algorithm} from '../models/analysis/algorithm';
import {Input, InputT... | }
getActualCompatibleAlgorithm( algorithmName): Observable<Algorithm> {
return this.http.get(`${environment.DAMUrl}/services/meta/${algorithmName}`)
.map(res => {
let response = res.json();
return new Algorithm().deserialize(response);
});
}
getTimeSeriesAlgorithm(): Ob... | {
// console.log(JSON.stringify({time_series: AlgorithmsService.dummyTimeSeries().serialize(), descriptive_statistics: AlgorithmsService.dummyDescriptiveStatistics().serialize(), clustering: AlgorithmsService.dummyClustering().serialize()}));
return this.http.get(`${environment.DAMUrl}/services/meta/all`)
... | identifier_body |
test.ts | /*
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* 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 ap... | }
// The compiler throws an error if the function is provided a first argument which is not array-like...
{
sparsearray2iteratorRight( 123 ); // $ExpectError
sparsearray2iteratorRight( true ); // $ExpectError
sparsearray2iteratorRight( false ); // $ExpectError
sparsearray2iteratorRight( {} ); // $ExpectError
spa... | sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10 ); // $ExpectType Iterator
sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10, {} ); // $ExpectType Iterator | random_line_split |
test.ts | /*
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* 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 ap... | ( v: number ): number {
return v * 10.0;
}
// TESTS //
// The function returns an iterator...
{
sparsearray2iteratorRight( [ 1, 2, 3, 4 ] ); // $ExpectType Iterator
sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10 ); // $ExpectType Iterator
sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10, {} ); // $ExpectTy... | times10 | identifier_name |
test.ts | /*
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* 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 ap... |
// TESTS //
// The function returns an iterator...
{
sparsearray2iteratorRight( [ 1, 2, 3, 4 ] ); // $ExpectType Iterator
sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10 ); // $ExpectType Iterator
sparsearray2iteratorRight( [ 1, 2, 3, 4 ], times10, {} ); // $ExpectType Iterator
}
// The compiler throws an er... | {
return v * 10.0;
} | identifier_body |
inherit-struct2.rs | // Copyright 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-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test struct inhe... | random_line_split | |
inherit-struct2.rs | // Copyright 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-MIT or ... | {
let s = inherit_struct_lib::S2{f1: 115, f2: 113};
assert!(s.f1 == 115);
assert!(s.f2 == 113);
assert!(inherit_struct_lib::glob_s.f1 == 32);
assert!(inherit_struct_lib::glob_s.f2 == -45);
inherit_struct_lib::test_s2(s);
} | identifier_body | |
inherit-struct2.rs | // Copyright 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-MIT or ... | () {
let s = inherit_struct_lib::S2{f1: 115, f2: 113};
assert!(s.f1 == 115);
assert!(s.f2 == 113);
assert!(inherit_struct_lib::glob_s.f1 == 32);
assert!(inherit_struct_lib::glob_s.f2 == -45);
inherit_struct_lib::test_s2(s);
}
| main | identifier_name |
server.rs | #![feature(core)]
extern crate eve;
extern crate getopts;
extern crate url;
extern crate core;
use std::thread;
use std::env;
use getopts::Options;
use std::net::SocketAddr;
use core::str::FromStr;
use eve::server;
use eve::login;
#[allow(dead_code)]
fn main() { |
// handle command line arguments
let args: Vec<String> = env::args().collect();
// define the command line arguments
let mut opts = Options::new();
opts.optopt("f", "faddress", "specify a socket address for the static file server. Defaults to 0.0.0.0:8080","SOCKET ADDRESS");
opts.optflag("h", "help", "pri... | random_line_split | |
server.rs | #![feature(core)]
extern crate eve;
extern crate getopts;
extern crate url;
extern crate core;
use std::thread;
use std::env;
use getopts::Options;
use std::net::SocketAddr;
use core::str::FromStr;
use eve::server;
use eve::login;
#[allow(dead_code)]
fn main() | }
// parse static file server address
let default_addr= SocketAddr::from_str("0.0.0.0:8080").unwrap();
let addr = match matches.opt_str("f") {
Some(ip) => {
match SocketAddr::from_str(&*ip) {
Ok(addr) => addr,
Err(_) => {
println!("WARNING: Could not parse static file ser... | {
// handle command line arguments
let args: Vec<String> = env::args().collect();
// define the command line arguments
let mut opts = Options::new();
opts.optopt("f", "faddress", "specify a socket address for the static file server. Defaults to 0.0.0.0:8080","SOCKET ADDRESS");
opts.optflag("h", "help", "p... | identifier_body |
server.rs | #![feature(core)]
extern crate eve;
extern crate getopts;
extern crate url;
extern crate core;
use std::thread;
use std::env;
use getopts::Options;
use std::net::SocketAddr;
use core::str::FromStr;
use eve::server;
use eve::login;
#[allow(dead_code)]
fn | () {
// handle command line arguments
let args: Vec<String> = env::args().collect();
// define the command line arguments
let mut opts = Options::new();
opts.optopt("f", "faddress", "specify a socket address for the static file server. Defaults to 0.0.0.0:8080","SOCKET ADDRESS");
opts.optflag("h", "help",... | main | identifier_name |
admin-polls-view.js | import Ember from 'ember';
import ResetScrollMixin from '../mixins/reset-scroll';
export default Ember.Route.extend(ResetScrollMixin, { |
model(params) {
return this.get('ajax').request('/admin/polls/' + params.pollId, {
data: {
apikey: this.get('user').getApiKey()
}
}).then((result) => {
var votes = [];
result.poll.options.forEach((option, i) => {
var count = result.poll.votes[i];
if (count === ... | ajax: Ember.inject.service(),
toast: Ember.inject.service(),
errorHandler: Ember.inject.service(),
user: Ember.inject.service(), | random_line_split |
admin-polls-view.js | import Ember from 'ember';
import ResetScrollMixin from '../mixins/reset-scroll';
export default Ember.Route.extend(ResetScrollMixin, {
ajax: Ember.inject.service(),
toast: Ember.inject.service(),
errorHandler: Ember.inject.service(),
user: Ember.inject.service(),
model(params) | votes.sort((a, b) => {
if (a.count < b.count) {
return 1;
}
else if (a.count > b.count) {
return -1;
}
return 0;
});
result.poll.votes = votes;
return {
poll: result.poll
};
}).catch((err) => {
this.get('errorH... | {
return this.get('ajax').request('/admin/polls/' + params.pollId, {
data: {
apikey: this.get('user').getApiKey()
}
}).then((result) => {
var votes = [];
result.poll.options.forEach((option, i) => {
var count = result.poll.votes[i];
if (count === undefined) {
... | identifier_body |
admin-polls-view.js | import Ember from 'ember';
import ResetScrollMixin from '../mixins/reset-scroll';
export default Ember.Route.extend(ResetScrollMixin, {
ajax: Ember.inject.service(),
toast: Ember.inject.service(),
errorHandler: Ember.inject.service(),
user: Ember.inject.service(),
| (params) {
return this.get('ajax').request('/admin/polls/' + params.pollId, {
data: {
apikey: this.get('user').getApiKey()
}
}).then((result) => {
var votes = [];
result.poll.options.forEach((option, i) => {
var count = result.poll.votes[i];
if (count === undefine... | model | identifier_name |
admin-polls-view.js | import Ember from 'ember';
import ResetScrollMixin from '../mixins/reset-scroll';
export default Ember.Route.extend(ResetScrollMixin, {
ajax: Ember.inject.service(),
toast: Ember.inject.service(),
errorHandler: Ember.inject.service(),
user: Ember.inject.service(),
model(params) {
return this.get('ajax')... |
return 0;
});
result.poll.votes = votes;
return {
poll: result.poll
};
}).catch((err) => {
this.get('errorHandler').handleError(err, 'Unable to retrieve poll.');
this.transitionTo('admin-polls');
});
}
});
| {
return -1;
} | conditional_block |
irq.rs | use ::kern::arch::port::{UnsafePort, Port};
use spin::Mutex;
/**
* ref: http://wiki.osdev.org/8259_PIC
*/
const PIC1_BASE: u16 = 0x20; /* IO base address for master PIC */
const PIC2_BASE: u16 = 0xA0; /* IO base address for slave PIC */
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
const IRQ_MASK: u... |
self.pics[1].command.write(ICW1_INIT + ICW1_ICW4);
io_wait();
self.pics[0].data.write(self.pics[0].offset);
io_wait();
self.pics[1].data.write(self.pics[1].offset);
io_wait();
// ICW3: tell Master PIC that there is a slave PIC at IRQ2
self.pics[0].data.... |
self.pics[0].command.write(ICW1_INIT + ICW1_ICW4);
io_wait(); | random_line_split |
irq.rs | use ::kern::arch::port::{UnsafePort, Port};
use spin::Mutex;
/**
* ref: http://wiki.osdev.org/8259_PIC
*/
const PIC1_BASE: u16 = 0x20; /* IO base address for master PIC */
const PIC2_BASE: u16 = 0xA0; /* IO base address for slave PIC */
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
const IRQ_MASK: u... |
self.pics[0].eoi();
}
unsafe fn setmask(&mut self, mask: u16) {
self.irqmask = mask;
self.pics[0].data.write(mask as u8);
self.pics[1].data.write((mask >> 8) as u8);
}
pub unsafe fn enable(&mut self, irq: usize) {
assert!(irq >= 0x20 && irq < 0x30);
le... | {
self.pics[1].eoi();
} | conditional_block |
irq.rs | use ::kern::arch::port::{UnsafePort, Port};
use spin::Mutex;
/**
* ref: http://wiki.osdev.org/8259_PIC
*/
const PIC1_BASE: u16 = 0x20; /* IO base address for master PIC */
const PIC2_BASE: u16 = 0xA0; /* IO base address for slave PIC */
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
const IRQ_MASK: u... |
}
/// represent two cascaded pic chips
pub struct PicChain {
pics: [Pic8259A; 2],
irqmask: u16
}
pub static PIC_CHAIN: Mutex<PicChain> = Mutex::new(unsafe {PicChain::new()});
/* reinitialize the PIC controllers, giving them specified vector offsets
rather than 8h and 70h, as configured by default */
co... | {
self.command.write(0x20);
} | identifier_body |
irq.rs | use ::kern::arch::port::{UnsafePort, Port};
use spin::Mutex;
/**
* ref: http://wiki.osdev.org/8259_PIC
*/
const PIC1_BASE: u16 = 0x20; /* IO base address for master PIC */
const PIC2_BASE: u16 = 0xA0; /* IO base address for slave PIC */
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
const IRQ_MASK: u... | {
offset: u8,
command: UnsafePort<u8>,
data: UnsafePort<u8>
}
impl Pic8259A {
pub const unsafe fn new(base: u16, offset: u8) -> Pic8259A {
Pic8259A {
offset: offset,
command: UnsafePort::new(base),
data: UnsafePort::new(base+1)
}
}
pub unsa... | Pic8259A | identifier_name |
offline.js | {
"version": 1501890517,
"fileList": [
"data.js",
"c2runtime.js",
"jquery-2.1.1.min.js",
"offlineClient.js",
"images/head-sheet0.png",
"images/body-sheet0.png",
"images/rarm-sheet0.png", | "images/brick.png",
"images/tiledbackground2.png",
"images/tiledbackground3.png",
"images/tiledbackground4.png",
"images/crate-sheet0.png",
"images/star-sheet0.png",
"images/star-sheet1.png",
"images/star-sheet2.png",
"icon-16.png",
"icon-32.png",
"icon-114.png",
"icon-128.png",
"icon-256.png"... | "images/rleg-sheet0.png",
"images/water.png",
"images/tiledbackground.png", | random_line_split |
latency.py | #!/usr/bin/env python
# this program is used to test latency
# don't test RTT bigger than 3 secs - it will break
# we make sure that nothing breaks if there is a packet missing
# this can rarely happen
import select
import socket
import time
import sys
import struct
def pong():
# easy, receive and send back
... |
return errs >= 3
if __name__ == '__main__':
if 'ping' in sys.argv:
ret = ping(sys.argv[2], int(sys.argv[3]))
elif 'pong' in sys.argv:
ret = pong()
else:
print 'ping or pong?'
ret = 1
sys.exit(ret)
| s.sendto('x', (addr, 1234)) | conditional_block |
latency.py | #!/usr/bin/env python
# this program is used to test latency
# don't test RTT bigger than 3 secs - it will break
# we make sure that nothing breaks if there is a packet missing
# this can rarely happen
import select
import socket
import time
import sys
import struct
def pong():
# easy, receive and send back
... | errs = 0
while succ != n and errs < 3: # at most 3 lost packets
time.sleep(0.02) # wait a bit
start = time.time()
s.sendto('r', (addr, 1234))
h, _, _ = select.select([s], [], [], 3) # wait 3 seconds
end = time.time()
if h == []: # lost packet
# print... | s.bind(('0.0.0.0', 1235))
succ = 0 | random_line_split |
latency.py | #!/usr/bin/env python
# this program is used to test latency
# don't test RTT bigger than 3 secs - it will break
# we make sure that nothing breaks if there is a packet missing
# this can rarely happen
import select
import socket
import time
import sys
import struct
def | ():
# easy, receive and send back
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('0.0.0.0', 1234))
while True:
c, addr = s.recvfrom(1)
s.sendto(c, (addr[0], 1235))
if c == 'x':
break
print 'Finished'
return 0
def ping(addr, n):
# send and ... | pong | identifier_name |
latency.py | #!/usr/bin/env python
# this program is used to test latency
# don't test RTT bigger than 3 secs - it will break
# we make sure that nothing breaks if there is a packet missing
# this can rarely happen
import select
import socket
import time
import sys
import struct
def pong():
# easy, receive and send back
|
def ping(addr, n):
# send and wait for it back
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('0.0.0.0', 1235))
succ = 0
errs = 0
while succ != n and errs < 3: # at most 3 lost packets
time.sleep(0.02) # wait a bit
start = time.time()
s.sendto('r', (addr,... | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('0.0.0.0', 1234))
while True:
c, addr = s.recvfrom(1)
s.sendto(c, (addr[0], 1235))
if c == 'x':
break
print 'Finished'
return 0 | identifier_body |
time-picker-translate.service.ts | import { Injectable } from '@angular/core';
import { OwlDateTimeIntl } from '@ansyn/ng-pick-datetime';
import { TranslateService } from '@ngx-translate/core';
/*
Link the translation provider of the time picker to Ansyn's translation service (and config)
*/
| @Injectable({
providedIn: 'root'
})
export class TimePickerTranslateService extends OwlDateTimeIntl {
// See https://danielykpan.github.io/date-time-picker/#locale-formats
labelsToTranslate = [
'rangeFromLabel', // From
'rangeToLabel', // To
'setBtnLabel', // Set
'cancelBtnLabel' // Cancel
];
constructor(... | random_line_split | |
time-picker-translate.service.ts | import { Injectable } from '@angular/core';
import { OwlDateTimeIntl } from '@ansyn/ng-pick-datetime';
import { TranslateService } from '@ngx-translate/core';
/*
Link the translation provider of the time picker to Ansyn's translation service (and config)
*/
@Injectable({
providedIn: 'root'
})
export class | extends OwlDateTimeIntl {
// See https://danielykpan.github.io/date-time-picker/#locale-formats
labelsToTranslate = [
'rangeFromLabel', // From
'rangeToLabel', // To
'setBtnLabel', // Set
'cancelBtnLabel' // Cancel
];
constructor(protected translate: TranslateService) {
super();
this.labelsToTranslate... | TimePickerTranslateService | identifier_name |
time-picker-translate.service.ts | import { Injectable } from '@angular/core';
import { OwlDateTimeIntl } from '@ansyn/ng-pick-datetime';
import { TranslateService } from '@ngx-translate/core';
/*
Link the translation provider of the time picker to Ansyn's translation service (and config)
*/
@Injectable({
providedIn: 'root'
})
export class TimePick... |
}
}
| {
this[label] = translation;
} | conditional_block |
time-picker-translate.service.ts | import { Injectable } from '@angular/core';
import { OwlDateTimeIntl } from '@ansyn/ng-pick-datetime';
import { TranslateService } from '@ngx-translate/core';
/*
Link the translation provider of the time picker to Ansyn's translation service (and config)
*/
@Injectable({
providedIn: 'root'
})
export class TimePick... |
searchTranlate(label: string) {
const translation = this.translate.instant(label);
if (translation !== label) {
this[label] = translation;
}
}
}
| {
super();
this.labelsToTranslate.forEach(this.searchTranlate.bind(this));
} | identifier_body |
EventManager.py | # coding=utf-8
import logging
from MissionBoard.ATBridge import ATBridge
from MissionBoard.State import Init
logger = logging.getLogger()
class EventManager(ATBridge):
"""Main Class to deal with the different loops, queue, state and bridge with the AT tiny"""
def __init__(self, loops, states):
"""Create the ma... |
def start(self):
"""fct to be overloaded
will be run when everything is ready"""
pass
def run(self):
"""run the loops, the start method and they the (endless) SPI loop"""
# start the object
self.start()
# run the loops (one per thread)
for l in self.functionalities:
l.run()
# and run the SPI... | if self.state.isOver(func):
self.nextState() | conditional_block |
EventManager.py | # coding=utf-8
import logging
from MissionBoard.ATBridge import ATBridge
from MissionBoard.State import Init
logger = logging.getLogger()
class | (ATBridge):
"""Main Class to deal with the different loops, queue, state and bridge with the AT tiny"""
def __init__(self, loops, states):
"""Create the main object"""
super(EventManager, self).__init__()
# create the different loops (on object per class given), store them as attribute
self.functionalities = ... | EventManager | identifier_name |
EventManager.py | # coding=utf-8
import logging
from MissionBoard.ATBridge import ATBridge
from MissionBoard.State import Init
logger = logging.getLogger()
class EventManager(ATBridge):
"""Main Class to deal with the different loops, queue, state and bridge with the AT tiny"""
def __init__(self, loops, states):
"""Create the ma... | @property
def stateName(self):
"""return current state name"""
return self.state.name
def nextState(self):
"""change to the next state"""
# increase the state
prevState = self.state.name
self._currentState += 1
try:
self.state = self._states[self._currentState]
self.isInitState = isinstance(sel... | random_line_split | |
EventManager.py | # coding=utf-8
import logging
from MissionBoard.ATBridge import ATBridge
from MissionBoard.State import Init
logger = logging.getLogger()
class EventManager(ATBridge):
"""Main Class to deal with the different loops, queue, state and bridge with the AT tiny"""
def __init__(self, loops, states):
"""Create the ma... |
def start(self):
"""fct to be overloaded
will be run when everything is ready"""
pass
def run(self):
"""run the loops, the start method and they the (endless) SPI loop"""
# start the object
self.start()
# run the loops (one per thread)
for l in self.functionalities:
l.run()
# and run the SPI... | """check if we need to move to another state"""
logger.debug("State=%s", self.stateName)
if self.isInitState or func.__class__ in self.state.funcNext:
# we need to check
if self.state.isOver(func):
self.nextState() | identifier_body |
ecb.py | # ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def | (infile,outfile,keyfile,mode):
key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with open(infile, 'rb') as fin:
with open(outfile, 'wb') as fout:
while True:
buf = fin.read(blocksize / 8)
... | ecb | identifier_name |
ecb.py | # ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def ecb(infile,outfile,keyfile,mode):
key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with ope... |
else:
result = present_inv(chunk, key)
for i in range(blocksize / 8):
fout.write(chr((result >> i * 8) & 0xff))
if __name__=="__main__":
parser=argparse.ArgumentParser(description='Block cipher using ECB mode.')
parser.add_argument('-i', ... | result = present(chunk, key) | conditional_block |
ecb.py | # ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def ecb(infile,outfile,keyfile,mode):
key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with ope... | break
if len(buf) != blocksize / 8:
buf += '\0' * (blocksize / 8 - len(buf))
for i in range(blocksize / 8):
chunk |= ord(buf[i]) << i * 8
if mode == 'c':
result = present(chunk, key)
... | chunk = 0x0
if buf == '': | random_line_split |
ecb.py | # ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def ecb(infile,outfile,keyfile,mode):
| fout.write(chr((result >> i * 8) & 0xff))
if __name__=="__main__":
parser=argparse.ArgumentParser(description='Block cipher using ECB mode.')
parser.add_argument('-i', dest='infile',help='input file')
parser.add_argument('-o', dest='outfile',help='output file')
parser.add_argument(... | key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with open(infile, 'rb') as fin:
with open(outfile, 'wb') as fout:
while True:
buf = fin.read(blocksize / 8)
chunk = 0x0
... | identifier_body |
table_caption.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! CSS table formatting contexts.
use app_units::Au;
use block::BlockFlow;
use context::LayoutContext;
use displ... |
fn compute_overflow(&self) -> Overflow {
self.block_flow.compute_overflow()
}
fn contains_roots_of_absolute_flow_tree(&self) -> bool {
self.block_flow.contains_roots_of_absolute_flow_tree()
}
fn is_absolute_containing_block(&self) -> bool {
self.block_flow.is_absolute_con... | {
self.block_flow.repair_style(new_style)
} | identifier_body |
table_caption.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! CSS table formatting contexts.
use app_units::Au;
use block::BlockFlow;
use context::LayoutContext;
use displ... | }
fn is_absolute_containing_block(&self) -> bool {
self.block_flow.is_absolute_containing_block()
}
fn generated_containing_block_size(&self, flow: OpaqueFlow) -> LogicalSize<Au> {
self.block_flow.generated_containing_block_size(flow)
}
fn iterate_through_fragment_border_boxes... | random_line_split | |
table_caption.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! CSS table formatting contexts.
use app_units::Au;
use block::BlockFlow;
use context::LayoutContext;
use displ... | (&self, print_tree: &mut PrintTree) {
self.block_flow.print_extra_flow_children(print_tree);
}
}
impl fmt::Debug for TableCaptionFlow {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TableCaptionFlow: {:?}", self.block_flow)
}
}
| print_extra_flow_children | identifier_name |
coherence-overlap-downstream.rs | // Copyright 2017 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-MIT or ... | { } | identifier_body | |
coherence-overlap-downstream.rs | // Copyright 2017 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-MIT or ... | () { }
| main | identifier_name |
coherence-overlap-downstream.rs | // Copyright 2017 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-MIT or ... |
pub trait Sugar {}
pub trait Fruit {}
pub trait Sweet {}
impl<T:Sugar> Sweet for T { }
impl<T:Fruit> Sweet for T { }
//~^ ERROR E0119
pub trait Foo<X> {}
pub trait Bar<X> {}
impl<X, T> Foo<X> for T where T: Bar<X> {}
impl<X> Foo<X> for i32 {}
//~^ ERROR E0119
fn main() { } | // though no impls are found. | random_line_split |
index.ts | // Copyright 2018, 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 in wr... | {
return getAPI<T>('youtube', versionOrOptions, VERSIONS, this);
} | identifier_body | |
index.ts | // Copyright 2018, 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 in wr... | <T = youtube_v3.Youtube>(
this: GoogleConfigurable, versionOrOptions: 'v3'|youtube_v3.Options) {
return getAPI<T>('youtube', versionOrOptions, VERSIONS, this);
}
| youtube | identifier_name |
index.ts | // Copyright 2018, 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.
// See... | // you may not use this file except in compliance with the License. | random_line_split |
zip.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, prefix):
|
def main(args):
zip_file = zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)
for path, archive_name in args.input_pairs:
if os.path.isdir(path):
_zip_dir(path, zip_file, archive_name)
else:
zip_file.write(path, archive_name)
zip_file.close()
if __name__ == '__main__':
parser = arg... | path = path.rstrip('/\\')
for root, dirs, files in os.walk(path):
for file in files:
zip_file.write(os.path.join(root, file), os.path.join(
root.replace(path, prefix), file)) | identifier_body |
zip.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, prefix):
path = path.rstrip('/\\')
for root, d... |
else:
zip_file.write(path, archive_name)
zip_file.close()
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='This script creates zip files.')
parser.add_argument('-o', dest='output', action='store',
help='The name of the output zip file.')
parser.add_argument('-i'... | _zip_dir(path, zip_file, archive_name) | conditional_block |
zip.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, prefix):
path = path.rstrip('/\\')
for root, d... | (args):
zip_file = zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)
for path, archive_name in args.input_pairs:
if os.path.isdir(path):
_zip_dir(path, zip_file, archive_name)
else:
zip_file.write(path, archive_name)
zip_file.close()
if __name__ == '__main__':
parser = argparse.Argum... | main | identifier_name |
zip.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, prefix):
path = path.rstrip('/\\')
for root, d... | if os.path.isdir(path):
_zip_dir(path, zip_file, archive_name)
else:
zip_file.write(path, archive_name)
zip_file.close()
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='This script creates zip files.')
parser.add_argument('-o', dest='output', action='store',
... |
def main(args):
zip_file = zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)
for path, archive_name in args.input_pairs: | random_line_split |
editing.d.ts | /*!
* devextreme-angular
* Version: 16.2.5
* Build date: Tue Feb 28 2017
*
* Copyright (c) 2012 - 2017 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://git... | extends NestedOption {
allowAdding: any;
allowDeleting: any;
allowUpdating: any;
editEnabled: any;
editMode: any;
form: any;
insertEnabled: any;
mode: any;
removeEnabled: any;
texts: any;
allowDragging: any;
allowResizing: any;
protected readonly _optionPath: string;... | DxoEditingComponent | identifier_name |
editing.d.ts | /*!
* devextreme-angular
* Version: 16.2.5
* Build date: Tue Feb 28 2017
*
* Copyright (c) 2012 - 2017 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://git... | protected readonly _optionPath: string;
constructor(parentOptionHost: NestedOptionHost, optionHost: NestedOptionHost);
}
export declare class DxoEditingModule {
} | random_line_split | |
lib.rs | // Copyright 2015 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-MIT or ... | )
}
add_builtin!(sess,
HardwiredLints,
WhileTrue,
ImproperCTypes,
BoxPointers,
UnusedAttributes,
PathStatements,
UnusedResults,
NonCamelCaseTypes,
... | {
macro_rules! add_builtin {
($sess:ident, $($name:ident),*,) => (
{$(
store.register_pass($sess, false, box builtin::$name);
)*}
)
}
macro_rules! add_builtin_with_new {
($sess:ident, $($name:ident),*,) => (
{$(
... | identifier_body |
lib.rs | // Copyright 2015 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-MIT or ... | (store: &mut lint::LintStore, sess: Option<&Session>) {
macro_rules! add_builtin {
($sess:ident, $($name:ident),*,) => (
{$(
store.register_pass($sess, false, box builtin::$name);
)*}
)
}
macro_rules! add_builtin_with_new {
($sess:iden... | register_builtins | identifier_name |
lib.rs | // Copyright 2015 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-MIT or ... |
add_builtin!(sess,
HardwiredLints,
WhileTrue,
ImproperCTypes,
BoxPointers,
UnusedAttributes,
PathStatements,
UnusedResults,
NonCamelCaseTypes,
NonSnakeCase,
... | ($sess:ident, $name:expr, $($lint:ident),*) => (
store.register_group($sess, false, $name, vec![$(LintId::of(builtin::$lint)),*]);
)
} | random_line_split |
exportneuroml.py | # A file to contain exclusively dependencies of the NeuroML package.
# See:
# https://github.com/NeuralEnsemble/libNeuroML
# http://neuroml.org
from __future__ import print_function
from collections import defaultdict
try:
from neuroml import Cell, Segment, SegmentParent, Morphology, \
NeuroMLD... | doc = NeuroMLDocument()
doc.cells.extend(cells)
doc.id = "NeuroMLDocument"
namespacedef = 'xmlns="http://www.neuroml.org/schema/neuroml2"' \
+ ' xmlns:xi="http://www.w3.org/2001/XInclude"' \
+ ' xmlns:xs="http://www.w3.org/2001/XMLSchema"' \
+ ' ... | response: somewhere to write to, like an HttpResponse
Returns nothing.
"""
| random_line_split |
exportneuroml.py | # A file to contain exclusively dependencies of the NeuroML package.
# See:
# https://github.com/NeuralEnsemble/libNeuroML
# http://neuroml.org
from __future__ import print_function
from collections import defaultdict
try:
from neuroml import Cell, Segment, SegmentParent, Morphology, \
NeuroMLD... |
# Pack the segments into a Cell
morphology = Morphology()
morphology.segments.extend(segments)
morphology.id = "Skeleton #%s" % skeleton_id
# Synapses: TODO requires input from Padraig Gleeson
cell = Cell()
cell.name = 'Cell'
cell.id = skeleton_id
cell.morphology = morphology
... | nodeID = todo.pop()
children = successors[nodeID]
if not children:
continue
p1 = asPoint(nodeID)
parent = segments[-1] if segments else None
segment_parent = SegmentParent(segments=parent.id) if parent else None
for childID in children:
p2 = asPoin... | conditional_block |
exportneuroml.py | # A file to contain exclusively dependencies of the NeuroML package.
# See:
# https://github.com/NeuralEnsemble/libNeuroML
# http://neuroml.org
from __future__ import print_function
from collections import defaultdict
try:
from neuroml import Cell, Segment, SegmentParent, Morphology, \
NeuroMLD... | # Cache of Point3DWithDiam
points = {}
def asPoint(nodeID):
""" Return the node as a Point3DWithDiam, in micrometers. """
p = points.get(nodeID)
if not p:
props = nodes[nodeID]
radius = props[2]
if radius < 0:
radius = 0.1 # FUTURE... | """ Encapsulate a single skeleton into a NeuroML Cell instance.
skeleton_id: the ID of the skeleton to which all nodes belong.
nodes: a dictionary of node ID vs tuple of node parent ID, location as a tuple of 3 floats, and radius. In nanometers.
pre: a dictionary of node ID vs list of c... | identifier_body |
exportneuroml.py | # A file to contain exclusively dependencies of the NeuroML package.
# See:
# https://github.com/NeuralEnsemble/libNeuroML
# http://neuroml.org
from __future__ import print_function
from collections import defaultdict
try:
from neuroml import Cell, Segment, SegmentParent, Morphology, \
NeuroMLD... | (cells, response):
""" Write a list of Cell instances.
cells: a list of Cell instances.
response: somewhere to write to, like an HttpResponse
Returns nothing.
"""
doc = NeuroMLDocument()
doc.cells.extend(cells)
doc.id = "NeuroMLDocument"
namespacedef = 'xmlns=... | neuroml_network | identifier_name |
ArtistConsignMeta.tsx | import * as React from "react"
import { Meta, Title } from "react-head"
import { createFragmentContainer, graphql } from "react-relay"
import { getENV } from "v2/Utils/getENV"
import { ArtistConsignMeta_artist } from "v2/__generated__/ArtistConsignMeta_artist.graphql"
import { get } from "v2/Utils/get"
interface Arti... | )
}
export const ArtistConsignMetaFragmentContainer = createFragmentContainer(
ArtistConsignMeta,
{
artist: graphql`
fragment ArtistConsignMeta_artist on Artist {
name
href
targetSupply {
microfunnel {
artworksConnection {
edges {
... | <Meta
property="og:type"
content={`${getENV("FACEBOOK_APP_NAMESPACE")}:artwork`}
/>
</> | random_line_split |
Test_CReport.py | # -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... | # Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., EML Research, gGmbH, University of Heidelberg,
# and The University of Manchester.
# All rights reserved.
# Copyright (C) 2007 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc. and EML Research, gGmbH.
# All ... | # of Manchester.
# All rights reserved.
| random_line_split |
Test_CReport.py | # -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... |
if(__name__ == '__main__'):
unittest.TextTestRunner(verbosity=2).run(suite())
| tests=[
'test_getReportDefinition'
,'test_setReportDefinition'
,'test_getTarget'
,'test_setTarget'
,'test_append'
,'test_setAppend' ... | identifier_body |
Test_CReport.py | # -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... | (self):
listOfReportDefinitions=self.datamodel.getReportDefinitionList()
reportDefinition=listOfReportDefinitions.createReportDefinition("MyReportDefinition","No Comment")
self.assert_(reportDefinition!=None)
self.report.setReportDefinition(reportDefinition)
self.assert_(self.report.getReportDefinit... | test_setReportDefinition | identifier_name |
Test_CReport.py | # -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... | unittest.TextTestRunner(verbosity=2).run(suite()) | conditional_block | |
select.template.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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | .addPropsBoundInputAttribute(consts.VALUE_ATTR)
.addOutputBinding(SELECTION_CHANGE, consts.VALUE_ATTR, consts.VALUE_ATTR)
.addChild(selectTriggerElem)
.addChild(optionElem)
.build();
const hintElem = new mat.MaterialHint('').template(mode);
return labelElem + selectElem + hintElem;
};
const b... | .addPropsBoundInputAttribute(consts.REQUIRED_ATTR, undefined, true, cd.CoerceValue.Boolean) | random_line_split |
ImageDisplay.py | ################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... |
def getregions(self):
"""Return a list of regions"""
rgnstr=self.ds9.get('regions -system fk5')
i = 0
newslits = {}
#print rgnstr
for l in rgnstr.split('\n'):
tags = ''
# work out how to use tags and just deal with "slit" tags
if... | """Delete all regions in the frame"""
cmd='regions delete all'
self.ds9.set(cmd) | identifier_body |
ImageDisplay.py | ################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... | (self):
"""Return a list of regions"""
rgnstr=self.ds9.get('regions -system fk5')
i = 0
newslits = {}
#print rgnstr
for l in rgnstr.split('\n'):
tags = ''
# work out how to use tags and just deal with "slit" tags
if l.startswith('box')... | getregions | identifier_name |
ImageDisplay.py | ################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... | cmd='regions %s -format %s' % (regfile, rformat)
self.ds9.set(cmd)
def deleteregions(self):
"""Delete all regions in the frame"""
cmd='regions delete all'
self.ds9.set(cmd)
def getregions(self):
"""Return a list of regions"""
rgnstr=self.ds9.get('regions... |
def regionfromfile(self, regfile, d=None, rformat='ds9'): | random_line_split |
ImageDisplay.py | ################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... |
def regions(self, rgnstr):
cmd = 'regions %s'
def rssregion(self, ra, dec):
"""Plot the FOV for RSS"""
# cmd='color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=0 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1\nfk5\ncircle(%s, %s, 4\')' % (ra,... | self.ds9.set('rotate to %f' % 0) | conditional_block |
StringSchema.ts | import { Type } from "./Type";
import * as _ from "lodash";
export class StringSchema extends Type{
private lengthN: number;
private minLengthN: number;
private maxLengthN: number;
private trimB: boolean;
private toUpperCaseB: boolean;
private toLowerCaseB: boolean;
private oneOfS: string[];
hasChil... |
}
oneOf(input: string[]){
this.oneOfS = input;
return this;
}
length(length: number): StringSchema { this.lengthN = length; return this }
minLength(minLength: number): StringSchema { this.minLengthN = minLength; return this }
maxLength(maxLength: number): StringSchema { this.maxLengthN = maxL... | random_line_split | |
StringSchema.ts | import { Type } from "./Type";
import * as _ from "lodash";
export class StringSchema extends Type{
private lengthN: number;
private minLengthN: number;
private maxLengthN: number;
private trimB: boolean;
private toUpperCaseB: boolean;
private toLowerCaseB: boolean;
private oneOfS: string[];
hasChil... | (trim: boolean=true): StringSchema { this.trimB = trim; return this }
}
| trim | identifier_name |
StringSchema.ts | import { Type } from "./Type";
import * as _ from "lodash";
export class StringSchema extends Type{
private lengthN: number;
private minLengthN: number;
private maxLengthN: number;
private trimB: boolean;
private toUpperCaseB: boolean;
private toLowerCaseB: boolean;
private oneOfS: string[];
hasChil... | else{
return callback({
error: "notString",
path
},null);
}
if(this.lengthN != null){
if(this.lengthN != item.length){
return callback({
error: "invalidLength",
value: item,
neededLength: this.lengthN,
path: path
},null... | {
item = data;
} | conditional_block |
StringSchema.ts | import { Type } from "./Type";
import * as _ from "lodash";
export class StringSchema extends Type{
private lengthN: number;
private minLengthN: number;
private maxLengthN: number;
private trimB: boolean;
private toUpperCaseB: boolean;
private toLowerCaseB: boolean;
private oneOfS: string[];
hasChil... |
toLowerCase(lowercase: boolean=true): StringSchema { this.toLowerCaseB = lowercase; return this }
trim(trim: boolean=true): StringSchema { this.trimB = trim; return this }
}
| { this.toUpperCaseB = uppercase; return this } | identifier_body |
meta.py | # -*- coding: utf-8 -*-
class AutocompleteMeta:
| ... autocomplete = AutocompleteMeta(
... name='silly',
... path='api/filter/silly',
... )
The model autocomplete configures the model for use:
>>> m = TestModel()
>>> m.autocomplete
<django_autocomplete.meta.AutocompleteMeta obje... | """
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of fields, if empty then all searchable fields are used
... | identifier_body |
meta.py | # -*- coding: utf-8 -*-
class AutocompleteMeta:
"""
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of... | self.__dict__[attr] = autocomplete_attrs[attr] | for attr in self.__class__.__dict__:
if attr in autocomplete_attrs: | random_line_split |
meta.py | # -*- coding: utf-8 -*-
class AutocompleteMeta:
"""
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of... | (self, autocomplete=None, **kwargs):
if autocomplete:
autocomplete_attrs = autocomplete.__dict__
else:
autocomplete_attrs = kwargs
for attr in self.__class__.__dict__:
if attr in autocomplete_attrs:
self.__dict__[attr] = autocomplete_attrs[attr... | __init__ | identifier_name |
meta.py | # -*- coding: utf-8 -*-
class AutocompleteMeta:
"""
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of... |
for attr in self.__class__.__dict__:
if attr in autocomplete_attrs:
self.__dict__[attr] = autocomplete_attrs[attr]
| autocomplete_attrs = kwargs | conditional_block |
app.py |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By:
# Maintained By:
from . import settings
# Initialize Flask app
from flask import Flask
app = Flask('ggrc', instance_relative_config=True)
app.co... | from flask.ext.jasmine import Jasmine, Asset
jasmine = Jasmine(app)
jasmine.sources(
Asset("dashboard-js"),
Asset("dashboard-js-spec-helpers"))
jasmine.specs(
Asset("dashboard-js-specs")) | conditional_block | |
app.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By:
# Maintained By:
from . import settings
# Initialize Flask app
from flask import Flask
app = Flask('ggrc', instance_relative_config=True)
app.con... |
jasmine.sources(
Asset("dashboard-js"),
Asset("dashboard-js-spec-helpers"))
jasmine.specs(
Asset("dashboard-js-specs")) | from flask.ext.jasmine import Jasmine, Asset
jasmine = Jasmine(app) | random_line_split |
__init__.py | """
# Licensed to the Apache Software Foundation (ASF) under one *
# or more contributor license agreements. See the NOTICE file * | # regarding copyright ownership. The ASF licenses this file *
# to you under the Apache License, Version 2.0 (the *
# "License"); you may not use this file except in compliance *
# with the License. You may obtain a copy of the License at *
# ... | # distributed with this work for additional information * | random_line_split |
analytics.js | // GoSquared
var GoSquared = {};
GoSquared.acct = "GSN-064561-T";
(function(w){
function gs() |
w.addEventListener ?
w.addEventListener("load", gs, false) :
w.attachEvent("onload", gs);
})(window);
// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40084408-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'... | {
w._gstc_lt = +new Date;
var d = document, g = d.createElement("script");
g.type = "text/javascript";
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
var s = d.getElementsByTagName("script")[0];
s.parentNode.insertBefore(g, s);
} | identifier_body |
analytics.js | // GoSquared
var GoSquared = {};
GoSquared.acct = "GSN-064561-T";
(function(w){
function gs(){
w._gstc_lt = +new Date; | s.parentNode.insertBefore(g, s);
}
w.addEventListener ?
w.addEventListener("load", gs, false) :
w.attachEvent("onload", gs);
})(window);
// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40084408-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElemen... | var d = document, g = d.createElement("script");
g.type = "text/javascript";
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
var s = d.getElementsByTagName("script")[0]; | random_line_split |
analytics.js | // GoSquared
var GoSquared = {};
GoSquared.acct = "GSN-064561-T";
(function(w){
function | (){
w._gstc_lt = +new Date;
var d = document, g = d.createElement("script");
g.type = "text/javascript";
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
var s = d.getElementsByTagName("script")[0];
s.parentNode.insertBefore(g, s);
}
w.addEventListener ?
w.addEventListener("load", g... | gs | identifier_name |
notify_event.py | """
sentry.rules.actions.notify_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sentry.plugins import plugins
from sentry.rules.actions.base import EventAct... | group = event.group
for plugin in self.get_plugins():
if not safe_execute(plugin.should_notify, group=group, event=event):
continue
metrics.incr('notifications.sent.{}'.format(plugin.slug))
yield self.future(plugin.rule_notify) | identifier_body | |
notify_event.py | """
sentry.rules.actions.notify_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sentry.plugins import plugins
from sentry.rules.actions.base import EventAct... | metrics.incr('notifications.sent.{}'.format(plugin.slug))
yield self.future(plugin.rule_notify) | if not safe_execute(plugin.should_notify, group=group, event=event):
continue
| random_line_split |
notify_event.py | """
sentry.rules.actions.notify_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sentry.plugins import plugins
from sentry.rules.actions.base import EventAct... | if not safe_execute(plugin.should_notify, group=group, event=event):
continue
metrics.incr('notifications.sent.{}'.format(plugin.slug))
yield self.future(plugin.rule_notify) | conditional_block | |
notify_event.py | """
sentry.rules.actions.notify_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sentry.plugins import plugins
from sentry.rules.actions.base import EventAct... | (EventAction):
label = 'Send a notification (for all enabled services)'
def get_plugins(self):
from sentry.plugins.bases.notify import NotificationPlugin
results = []
for plugin in plugins.for_project(self.project, version=1):
if not isinstance(plugin, NotificationPlugin):
... | NotifyEventAction | identifier_name |
snippet-extractor.ts | declare var require;
import {SnippetInjector} from "./snippet-injector";
var fs = require("fs");
var path = require("path");
export class SnippetExtractor extends SnippetInjector {
public targetDir: string = null;
private fileForSnippet(id: string) {
return path.join(this.targetDir, id) + ".json";
... |
return false;
}
protected addSnippet(fileExtension: string, id: string, snippet: string): void {
let snippetPath = this.fileForSnippet(id);
let snippetData = {};
if (fs.existsSync(snippetPath)) {
const contents = fs.readFileSync(snippetPath, "utf8");
sni... | {
throw new Error(`Duplicate snippet: '${id}' for type: '${fileExtension}'`);
} | conditional_block |
snippet-extractor.ts | declare var require;
import {SnippetInjector} from "./snippet-injector";
var fs = require("fs");
var path = require("path");
export class | extends SnippetInjector {
public targetDir: string = null;
private fileForSnippet(id: string) {
return path.join(this.targetDir, id) + ".json";
}
private keyForExtension(fileExtension: string): string {
return fileExtension.toLowerCase().replace(/^\./, "");
}
protected hasSni... | SnippetExtractor | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.