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
test_register_deregister.rs
use mio::*; use mio::tcp::*; use bytes::SliceBuf; use super::localhost; const SERVER: Token = Token(0); const CLIENT: Token = Token(1); struct TestHandler { server: TcpListener, client: TcpStream, state: usize, } impl TestHandler { fn new(srv: TcpListener, cli: TcpStream) -> TestHandler { Tes...
(&mut self, event_loop: &mut EventLoop<TestHandler>, token: Token, _: EventSet) { debug!("handle_write; token={:?}; state={:?}", token, self.state); assert!(token == CLIENT, "unexpected token {:?}", token); assert!(self.state == 1, "unexpected state {}", self.state); self.state = 2; ...
handle_write
identifier_name
get_climate_data.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- from bs4 import BeautifulSoup from urllib2 import urlopen import csv BASE_URL = 'http://www.tutiempo.net' PAGE_1 = '/en/Climate/India/IN.html' PAGE_2 = '/en/Climate/India/IN_2.html' headings = ['Location', 'Year',...
def write_log(message): f_log = open("log.txt", 'a') f_log.write(message) f_log.close() def main(): links = get_links(BASE_URL + PAGE_1) links.extend(get_links(BASE_URL + PAGE_2)) csvfile = open('climate_data_1.csv', 'wb') csv_writer = csv.writer(csvfile) csv_writer.writerow(...
html = urlopen(url).read() soup = BeautifulSoup(html, 'lxml') location_links = soup.find('div', id='ListadosV4') locations_links = [BASE_URL + li.a['href'] for li in location_links.findAll('li')] return locations_links
identifier_body
get_climate_data.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- from bs4 import BeautifulSoup from urllib2 import urlopen import csv BASE_URL = 'http://www.tutiempo.net' PAGE_1 = '/en/Climate/India/IN.html' PAGE_2 = '/en/Climate/India/IN_2.html' headings = ['Location', 'Year',...
for month in month_list.findAll('li'): month_name = ','.join(month.findAll(text=True)) if month_name[0:10] == 'Historical': month_name = month_name.split(" ")[1] print (month_name + '\n') ...
month_list = soup.find('div','ListasLeft') if month_list is None: continue
random_line_split
get_climate_data.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- from bs4 import BeautifulSoup from urllib2 import urlopen import csv BASE_URL = 'http://www.tutiempo.net' PAGE_1 = '/en/Climate/India/IN.html' PAGE_2 = '/en/Climate/India/IN_2.html' headings = ['Location', 'Year',...
(message): f_log = open("log.txt", 'a') f_log.write(message) f_log.close() def main(): links = get_links(BASE_URL + PAGE_1) links.extend(get_links(BASE_URL + PAGE_2)) csvfile = open('climate_data_1.csv', 'wb') csv_writer = csv.writer(csvfile) csv_writer.writerow(headings) ...
write_log
identifier_name
get_climate_data.py
#--------------------------------- #Joseph Boyd - joseph.boyd@epfl.ch #--------------------------------- from bs4 import BeautifulSoup from urllib2 import urlopen import csv BASE_URL = 'http://www.tutiempo.net' PAGE_1 = '/en/Climate/India/IN.html' PAGE_2 = '/en/Climate/India/IN_2.html' headings = ['Location', 'Year',...
csv_writer.writerow(print_line) num_rows += 1 if num_rows == MAX_ROWS: csvfile.close() num_files += 1 csvfile = open('climate_data_%s.csv'%(num_files), 'wb') ...
a = ','.join(datum.findAll(text=True)) print_line.append(a.encode('utf8'))
conditional_block
IAutomationConfig.ts
// TODO:IMPLEMENT_ME - Add configuration options for you AUTs, test environments and custom behaviours export interface IAutomationConfig { externalParams?: {[name: string]: string}, passwords?: { fallbackToPreDecrypted?: boolean, decryptionKeyEnvVariable?: string }, utils?: { e...
baseURL?: string } }, logic?: { allowDefaultFieldMutator?: boolean, testCaseOrder?: { beginWithTag?: string, endWithTag?: string } } }
}, jsonPlaceholder?: {
random_line_split
setup.py
#! /usr/bin/env python3 import sys from cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need fine tuning. includefiles = ['windows/libusb-1.0.dll', ('icons/buzzer.png', 'icons/buzzer.png'), 'README.md', 'LICENSE', ...
base = None if sys.platform == "win32": base = "Win32GUI" executables = [ Executable('pyPardy.py', base=base), Executable('pyPardyEdit.py', base=base) ] setup( name='pyPardy', #long_description='', keywords='game jeopardy', version='0.2', author='Christian Wichmann', author_email='...
random_line_split
setup.py
#! /usr/bin/env python3 import sys from cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need fine tuning. includefiles = ['windows/libusb-1.0.dll', ('icons/buzzer.png', 'icons/buzzer.png'), 'README.md', 'LICENSE', ...
executables = [ Executable('pyPardy.py', base=base), Executable('pyPardyEdit.py', base=base) ] setup( name='pyPardy', #long_description='', keywords='game jeopardy', version='0.2', author='Christian Wichmann', author_email='christian@freenono.org', packages=['data', 'gui'], ur...
base = "Win32GUI"
conditional_block
polymorphism-interface.spec.ts
import {AnyT, jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../../src'; import {isEqual} from '../utils/object-compare'; describe('lazy, polymorphic interfaces', () => { interface Point { x: number; y: number; } @jsonObject class SmallNode implements Point { @jsonMe...
it('should work', () => { expect(test(false)).toBeTruthy(); }); });
{ const graph = new GraphGrid(); for (let i = 0; i < 20; i++) { let point: Point; if (i % 2 === 0) { const bigNode = new BigNode(); bigNode.inputs = [ randPortType(), randPortType(), ra...
identifier_body
polymorphism-interface.spec.ts
import {AnyT, jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../../src'; import {isEqual} from '../utils/object-compare'; describe('lazy, polymorphic interfaces', () => { interface Point { x: number; y: number; } @jsonObject class SmallNode implements Point { @jsonMe...
point.x = Math.random(); point.y = Math.random(); if (i === 0) { graph.root = point; } else { graph.points.push(point); } } const json = TypedJSON.stringify(graph, GraphGrid); const clone = TypedJSON....
{ const smallNode = new SmallNode(); smallNode.inputType = randPortType(); smallNode.outputType = randPortType(); point = smallNode; }
conditional_block
polymorphism-interface.spec.ts
import {AnyT, jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../../src'; import {isEqual} from '../utils/object-compare'; describe('lazy, polymorphic interfaces', () => { interface Point { x: number; y: number; } @jsonObject class SmallNode implements Point { @jsonMe...
() { this.inputs = []; this.outputs = []; } } @jsonObject({ knownTypes: [BigNode, SmallNode], }) class GraphGrid { @jsonArrayMember(() => AnyT) points: Array<Point>; @jsonMember root: Point; constructor() { th...
constructor
identifier_name
polymorphism-interface.spec.ts
import {AnyT, jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../../src';
describe('lazy, polymorphic interfaces', () => { interface Point { x: number; y: number; } @jsonObject class SmallNode implements Point { @jsonMember x: number; @jsonMember y: number; @jsonMember inputType: string; @jsonMember ...
import {isEqual} from '../utils/object-compare';
random_line_split
Rating.js
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license.
if(!dojo._hasResource["dojox.form.Rating"]){ dojo._hasResource["dojox.form.Rating"]=true; dojo.provide("dojox.form.Rating"); dojo.require("dijit.form._FormWidget"); dojo.declare("dojox.form.Rating",dijit.form._FormWidget,{templateString:null,numStars:3,value:0,constructor:function(_1){ dojo.mixin(this,_1); var _2="<div...
see: http://dojotoolkit.org/license for details */
random_line_split
Rating.js
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.form.Rating"]){ dojo._hasResource["dojox.form.Rating"]=true; dojo.provide("dojox.form.Rating")...
}); },onStarClick:function(_c){ var _d=+dojo.attr(_c.target,"value"); this.setAttribute("value",_d==this.value?0:_d); this._renderStars(this.value); this.onChange(this.value); },onMouseOver:function(){ },setAttribute:function(_e,_f){ this.inherited("setAttribute",arguments); if(_e=="value"){ this._renderStars(this.val...
{ dojo.removeClass(_a,"dojoxRatingStar"+(_9?"Checked":"Hover")); dojo.addClass(_a,"dojoxRatingStar"+(_9?"Hover":"Checked")); }
conditional_block
global.rs
//! The global state. use parking_lot::Mutex; use std::collections::HashSet; use std::{mem, panic}; use {rand, hazard, mpsc, debug, settings}; use garbage::Garbage; lazy_static! { /// The global state. /// /// This state is shared between all the threads. static ref STATE: State = State::new(); } ///...
{ /// The channel of messages. chan: mpsc::Receiver<Message>, /// The to-be-destroyed garbage. garbage: Vec<Garbage>, /// The current hazards. hazards: Vec<hazard::Reader>, } impl Garbo { /// Handle a given message. /// /// "Handle" in this case refers to applying the operation def...
Garbo
identifier_name
global.rs
//! The global state. use parking_lot::Mutex; use std::collections::HashSet; use std::{mem, panic}; use {rand, hazard, mpsc, debug, settings}; use garbage::Garbage; lazy_static! { /// The global state. /// /// This state is shared between all the threads. static ref STATE: State = State::new(); } ///...
#[test] fn clean_up_state() { fn dtor(x: *const u8) { unsafe { *(x as *mut u8) = 1; } } for _ in 0..1000 { let b = Box::new(0); { let s = State::new(); s.export_garbage(vec![Garbage::new(&*...
{ fn dtor(x: *const u8) { unsafe { *(x as *mut u8) = 1; } } let s = State::new(); for _ in 0..1000 { let b = Box::new(0); let h = s.create_hazard(); h.protect(&*b); s.export_garbage(vec![Garbage::new...
identifier_body
global.rs
//! The global state. use parking_lot::Mutex; use std::collections::HashSet; use std::{mem, panic}; use {rand, hazard, mpsc, debug, settings}; use garbage::Garbage; lazy_static! { /// The global state. /// /// This state is shared between all the threads. static ref STATE: State = State::new(); } ///...
/// garbage. If another thread is currently collecting garbage, `Err(())` is returned, /// otherwise it returns `Ok(())`. /// /// Garbage collection works by scanning the hazards and dropping all the garbage which is not /// currently active in the hazards. fn try_gc(&self) -> Result<(), ()> { ...
/// Try to collect the garbage. /// /// This will handle all of the messages in the channel and then attempt at collect the
random_line_split
require-dot-notation.js
/** * Requires member expressions to use dot notation when possible * * Types: `Boolean` or `Object` * * Values: * - `true` * - `"except_snake_case"` (*deprecated* use `"allExcept": ["snake_case"]`) allow quoted snake cased identifiers * - `Object`: * - `'allExcept'` array of exceptions: * - `'key...
}, getOptionName: function() { return 'requireDotNotation'; }, check: function(file, errors) { var exceptSnakeCase = this._exceptSnakeCase; var exceptKeywords = this._exceptKeywords; var dialect = file.getDialect(); file.iterateNodesByType('MemberExpression', ...
{ this._exceptSnakeCase = options.allExcept.indexOf('snake_case') > -1; this._exceptKeywords = options.allExcept.indexOf('keywords') > -1; }
conditional_block
require-dot-notation.js
/** * Requires member expressions to use dot notation when possible * * Types: `Boolean` or `Object` * * Values: * - `true` * - `"except_snake_case"` (*deprecated* use `"allExcept": ["snake_case"]`) allow quoted snake cased identifiers * - `Object`: * - `'allExcept'` array of exceptions: * - `'key...
* ##### Invalid * * ``` * var a = b['await']; // reserved word in ES6 * ``` * * #### Example for allExcept keywords with esnext * * ```js * "requireDotNotation": { "allExcept": [ "keywords" ] } * "esnext": true * ``` * * ##### Valid * * ``` * var a = b['await']; // reserved word in ES6 * ``` * * ###...
*
random_line_split
hash.rs
use std::collections::HashMap; fn
(number: &str) -> &str { match number { "798-1364" => "We're sorry, the call cannot be completed as dialed. Please hang up and try again.", "645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you today?", _ => "Hi! Who is this again...
call
identifier_name
hash.rs
use std::collections::HashMap;
"645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you today?", _ => "Hi! Who is this again?" } } fn main() { let mut contacts = HashMap::new(); contacts.insert("Daniel", "798-1364"); contacts.insert("Ashley", "645-7689"); contacts.i...
fn call(number: &str) -> &str { match number { "798-1364" => "We're sorry, the call cannot be completed as dialed. Please hang up and try again.",
random_line_split
hash.rs
use std::collections::HashMap; fn call(number: &str) -> &str { match number { "798-1364" => "We're sorry, the call cannot be completed as dialed. Please hang up and try again.", "645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you today...
{ let mut contacts = HashMap::new(); contacts.insert("Daniel", "798-1364"); contacts.insert("Ashley", "645-7689"); contacts.insert("Katie", "435-8291"); contacts.insert("Robert", "956-1745"); // 接受一个引用并返回 Option<&V> match contacts.get(&"Daniel") { Some(&number) => println!("Callin...
identifier_body
sections.rs
use super::{ConfigParseError, Error}; use std::io::Read; #[derive(Clone, Debug)] pub struct Sections { pub common_section: String, pub page_sections: Vec<String>, pub char_sections: Vec<String>, pub kerning_sections: Vec<String>, } impl Sections { pub fn new<R>(mut source: R) -> Result<Sections, E...
)))); } let mut lines = lines.skip(page_sections.len()); // Expect the "char" sections. let _ = lines.next().unwrap(); // char_count_section let char_sections = lines .clone() .take_while(|l| l.starts_with("char")) .map(|s| s.to_st...
return Err(Error::from(ConfigParseError::MissingSection(String::from( "page",
random_line_split
sections.rs
use super::{ConfigParseError, Error}; use std::io::Read; #[derive(Clone, Debug)] pub struct Sections { pub common_section: String, pub page_sections: Vec<String>, pub char_sections: Vec<String>, pub kerning_sections: Vec<String>, } impl Sections { pub fn new<R>(mut source: R) -> Result<Sections, E...
; Ok(Sections { common_section, page_sections, char_sections, kerning_sections, }) } }
{ Vec::new() }
conditional_block
sections.rs
use super::{ConfigParseError, Error}; use std::io::Read; #[derive(Clone, Debug)] pub struct
{ pub common_section: String, pub page_sections: Vec<String>, pub char_sections: Vec<String>, pub kerning_sections: Vec<String>, } impl Sections { pub fn new<R>(mut source: R) -> Result<Sections, Error> where R: Read, { // Load the entire file into a String. let mut...
Sections
identifier_name
pack.rs
// Copyright 2017 ThetaSinner // // This file is part of Osmium. // Osmium 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. // Osmi...
}
{ target.extend(rest); }
conditional_block
pack.rs
// Copyright 2017 ThetaSinner // // This file is part of Osmium. // Osmium 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. // Osmi...
if header_name == literal_without_indexing_header_name { return true; } } false } fn pack_indexed_header(index: usize, target: &mut Vec<u8>) { let encoded_index = number::encode(index as u32, 7); target.push(flags::INDEXED_HEADER_FLAG | encoded_index.prefix); if let So...
fn is_literal_without_indexing_header(header_name: &String) -> bool { for literal_without_indexing_header_name in LITERAL_WITHOUT_INDEXING.into_iter() {
random_line_split
pack.rs
// Copyright 2017 ThetaSinner // // This file is part of Osmium. // Osmium 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. // Osmi...
(field: &table::Field, use_huffman_coding: bool, target: &mut Vec<u8>) { target.push(flags::LITERAL_WITH_INDEXING_FLAG); target.extend(string::encode(String::from(field.name.clone()), use_huffman_coding)); target.extend(string::encode(String::from(field.value.clone()), use_huffman_coding)); } fn pack_lite...
pack_literal_with_indexing
identifier_name
pack.rs
// Copyright 2017 ThetaSinner // // This file is part of Osmium. // Osmium 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. // Osmi...
fn pack_literal_without_indexing(field: &table::Field, use_huffman_coding: bool, target: &mut Vec<u8>) { target.push(0u8); target.extend(string::encode(String::from(field.name.clone()), use_huffman_coding)); target.extend(string::encode(String::from(field.value.clone()), use_huffman_coding)); } fn pack_...
{ trace!("index to use {}", index); let encoded_name_index = number::encode(index as u32, 4); trace!("prefix {}", encoded_name_index.prefix); target.push((!flags::LITERAL_WITH_INDEXING_FLAG) & encoded_name_index.prefix); if let Some(rest) = encoded_name_index.rest { target.extend(rest); ...
identifier_body
in6addr.rs
// Copyright © 2015-2017 winapi-rs developers // 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. // All files in the project carrying such notice may not be copied,...
// except according to those terms. use shared::minwindef::{UCHAR, USHORT}; UNION!{union in6_addr_u { [u16; 8], Byte Byte_mut: [UCHAR; 16], Word Word_mut: [USHORT; 8], }} STRUCT!{struct in6_addr { u: in6_addr_u, }} pub type IN6_ADDR = in6_addr; pub type PIN6_ADDR = *mut IN6_ADDR; pub type LPIN6_ADDR = *...
random_line_split
0003_auto_20160525_1521.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('predict', '0002_auto_20160524_0947'),
] operations = [ migrations.RemoveField( model_name='predictdataset', name='dropbox_url', ), migrations.AlterField( model_name='predictdataset', name='file_type', field=models.CharField(max_length=25, choices=[(b'vcf', b'Varian...
random_line_split
0003_auto_20160525_1521.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class
(migrations.Migration): dependencies = [ ('predict', '0002_auto_20160524_0947'), ] operations = [ migrations.RemoveField( model_name='predictdataset', name='dropbox_url', ), migrations.AlterField( model_name='predictdataset', ...
Migration
identifier_name
0003_auto_20160525_1521.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration):
dependencies = [ ('predict', '0002_auto_20160524_0947'), ] operations = [ migrations.RemoveField( model_name='predictdataset', name='dropbox_url', ), migrations.AlterField( model_name='predictdataset', name='file_type', ...
identifier_body
dummy_plugin.py
# -*- coding: utf-8 -*- # This file is part of Knitlib. # # Knitlib 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. # # ...
self.finish() def onfinish(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onfinish")) def onconfigure(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onconfigure")) def set_port(self, *args, **kwargs): pass @staticmethod def supported_config_featur...
time.sleep(1) self.interactive_callbacks["progress"](i / float(total), i, total)
conditional_block
dummy_plugin.py
# -*- coding: utf-8 -*- # This file is part of Knitlib. # # Knitlib 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. # # ...
def onfinish(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onfinish")) def onconfigure(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onconfigure")) def set_port(self, *args, **kwargs): pass @staticmethod def supported_config_features(): return {"...
total = 5 for i in range(total): time.sleep(1) self.interactive_callbacks["progress"](i / float(total), i, total) self.finish()
random_line_split
dummy_plugin.py
# -*- coding: utf-8 -*- # This file is part of Knitlib. # # Knitlib 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. # # ...
(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onknit")) # In order to simulate blocking we make it sleep. total = 5 for i in range(total): time.sleep(1) self.interactive_callbacks["progress"](i / float(total), i, total) self.finish() def onfinish(self, e): l...
onknit
identifier_name
dummy_plugin.py
# -*- coding: utf-8 -*- # This file is part of Knitlib. # # Knitlib 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. # # ...
base_log_string = u"{} has been called on dummy knitting plugin." def onknit(self, e): logging.debug(DummyKnittingPlugin.base_log_string.format("onknit")) # In order to simulate blocking we make it sleep. total = 5 for i in range(total): time.sleep(1) self.interactive_callbacks["progr...
super(DummyKnittingPlugin, self).__init__()
identifier_body
maptools.js
/* Function * Zoom to boundbox *input: (1) Gmap object * (2) Optie1 Item with south, north, west, east and (optional) projection * optie2 GLatLngBounds or NBounds object *Dependencies: openLzyers * * */ function Ozoom(map_ ,bounds ) { if (bounds) { if (b...
/* Class * GLatLngBounds() met een andere invoer en het ondersteunen van RDS coordinaten *input: (1) map object * (2 not supported yet) pgw; a link to a pgw and image file, from where the bounds can be dtermined (north, south, west and east of input 1 are not needed in this case *Dependenc...
{ options = options || {}; var minHeight = options.minHeight || 300; var mapdiv = document.getElementById(mapName); if ((document.body.clientHeight - otherHeights) < minHeight) { var height = minHeight; } else { var height = document.body.clientHeight - otherHeights; ...
identifier_body
maptools.js
/* Function * Zoom to boundbox *input: (1) Gmap object * (2) Optie1 Item with south, north, west, east and (optional) projection * optie2 GLatLngBounds or NBounds object *Dependencies: openLzyers * * */ function Ozoom(map_ ,bounds ) { if (bounds) { if (b...
//Rijksdriehoekstelsel if (mapExtent) { var mapExtent = mapExtent.transform( new OpenLayers.Projection("EPSG:900913") , new OpenLayers.Projection("EPSG:4326") ) var extent = mapExtent.toArray(); calc_extent_south = Math.max(wgs2rds(extent[1],(extent[0]+extent[2])/...
this._east = inputs.east; this._projection = new String(inputs.projection)|| "wgs84"; if (this._projection.toLowerCase()=='rds'||this._projection == '28992'||this._projection == 28992) { // 28992
random_line_split
maptools.js
/* Function * Zoom to boundbox *input: (1) Gmap object * (2) Optie1 Item with south, north, west, east and (optional) projection * optie2 GLatLngBounds or NBounds object *Dependencies: openLzyers * * */ function
(map_ ,bounds ) { if (bounds) { if (bounds.getCenterLonLat) { //dan moet dit een openlayer.Bounds of OBounds object zijn var obounds = bounds; } else { var obounds = new OBounds(bounds); } if (obounds.validRect()) { //map_.getZoomForExtent(...
Ozoom
identifier_name
BarcodeAnswerComponent.ts
import PropTypes from "prop-types" import React from "react" const R = React.createElement export interface BarcodeAnswerComponentProps { value?: string onValueChange: any } // Functional? I haven't tried this one yet // Not tested export default class BarcodeAnswerComponent extends React.Component<BarcodeAnswer...
() { // Nothing to focus return null } handleValueChange = () => { return this.props.onValueChange(!this.props.value) } handleScanClick = () => { return this.context.scanBarcode({ success: (text: any) => { return this.props.onValueChange(text) } }) } handleClearCli...
focus
identifier_name
BarcodeAnswerComponent.ts
import PropTypes from "prop-types" import React from "react" const R = React.createElement export interface BarcodeAnswerComponentProps { value?: string onValueChange: any } // Functional? I haven't tried this one yet // Not tested export default class BarcodeAnswerComponent extends React.Component<BarcodeAnswer...
else { if (supported) { return R( "div", null, R( "button", { className: "btn btn-secondary", onClick: this.handleScanClick, type: "button" }, R("span", { className: "fas fa-qrcode" }), this.context.T("Scan") ) ...
{ return R( "div", null, R("pre", null, R("p", null, this.props.value)), R( "div", null, R( "button", { className: "btn btn-secondary", onClick: this.handleClearClick, type: "button" }, R("span", { className: "fas fa...
conditional_block
BarcodeAnswerComponent.ts
import PropTypes from "prop-types" import React from "react" const R = React.createElement
// Functional? I haven't tried this one yet // Not tested export default class BarcodeAnswerComponent extends React.Component<BarcodeAnswerComponentProps> { static contextTypes = { scanBarcode: PropTypes.func, T: PropTypes.func.isRequired // Localizer to use } focus() { // Nothing to focus retur...
export interface BarcodeAnswerComponentProps { value?: string onValueChange: any }
random_line_split
timePicker.js
/** * Modal that helps user to pick a time of the day value. */ // TODO jsdocs There are some incomplete or bad formatted comments 'use strict'; var ko = require('knockout'); var ariaHideElements = require('./utils/ariaHideElements'); var fixFocus = require('./utils/fixFocus'); var TEMPLATE = require('../../html/mod...
else { vm.selectedTime(options.selectedTime || {}); } vm.unsetLabel(options.unsetLabel || 'Remove'); vm.selectLabel(options.selectLabel || 'Select'); return new Promise(function(resolve, reject) { modal.modal('show'); // Increased accessibility: // NOTE: must be re...
{ vm.selectedTimeString(options.selectedTime); }
conditional_block
timePicker.js
/** * Modal that helps user to pick a time of the day value. */ // TODO jsdocs There are some incomplete or bad formatted comments 'use strict'; var ko = require('knockout'); var ariaHideElements = require('./utils/ariaHideElements'); var fixFocus = require('./utils/fixFocus'); var TEMPLATE = require('../../html/mod...
{ // Set-up viewmodel and binding var vm = { title: ko.observable(''), pickedHour: ko.observable(null), pickedMinute: ko.observable(null), pickedAmpm: ko.observable(null), stepInMinutes: ko.observable(5), unsetLabel: ko.observable('Remove'), selectLabel: ...
identifier_body
timePicker.js
/** * Modal that helps user to pick a time of the day value. */ // TODO jsdocs There are some incomplete or bad formatted comments 'use strict'; var ko = require('knockout'); var ariaHideElements = require('./utils/ariaHideElements'); var fixFocus = require('./utils/fixFocus'); var TEMPLATE = require('../../html/mod...
() { // Set-up viewmodel and binding var vm = { title: ko.observable(''), pickedHour: ko.observable(null), pickedMinute: ko.observable(null), pickedAmpm: ko.observable(null), stepInMinutes: ko.observable(5), unsetLabel: ko.observable('Remove'), selectLabe...
TimePickerModel
identifier_name
timePicker.js
/** * Modal that helps user to pick a time of the day value. */ // TODO jsdocs There are some incomplete or bad formatted comments 'use strict'; var ko = require('knockout'); var ariaHideElements = require('./utils/ariaHideElements'); var fixFocus = require('./utils/fixFocus'); var TEMPLATE = require('../../html/mod...
value: i, label: twoDigits(i) }); } return values; }, vm); vm.ampmValues = ko.computed(function() { var region = this.locale().region; var values = []; if (region === 'US') { values.push({ value: 0, ...
var values = []; //if (region === 'US') { for (var i = 0; i < 60; i += step) { values.push({
random_line_split
common.rs
use bindings::types::*; /* automatically generated by rust-bindgen */ pub type mraa_boolean_t = ::libc::c_uint; #[link(name = "mraa")] extern "C" {
-> mraa_boolean_t; pub fn mraa_adc_raw_bits() -> ::libc::c_uint; pub fn mraa_adc_supported_bits() -> ::libc::c_uint; pub fn mraa_set_log_level(level: ::libc::c_int) -> mraa_result_t; pub fn mraa_get_platform_name() -> *mut ::libc::c_char; pub fn mraa_set_priority(priority: ::libc::c_uint) -> ::...
pub fn mraa_init() -> mraa_result_t; pub fn mraa_deinit() -> (); pub fn mraa_pin_mode_test(pin: ::libc::c_int, mode: mraa_pinmodes_t)
random_line_split
protractor.conf.js
'use strict'; var seleniumServerJar = '/usr/local/lib/node_modules/protractor' + '/selenium/selenium-server-standalone-2.41.0.jar'; // A reference configuration file. exports.config = {
// following: // // 1. seleniumServerJar - to start Selenium Standalone locally. // 2. seleniumAddress - to connect to a Selenium server which is already // running. // 3. sauceUser/sauceKey - to use remote Selenium servers via SauceLabs. // // If the chromeOnly option is specified, no Selenium serve...
// ----- How to setup Selenium ----- // // There are three ways to specify how to use Selenium. Specify one of the
random_line_split
blog.js
const express = require('express'); const feedr = require('feedr').create(); const router = express.Router(); router.get('/', (req, res) => { feedr.readFeed('https://blog.schul-cloud.org/rss', { requestOptions: { timeout: 2000 }, }, (err, data) => { let blogFeed; try { blogFeed = data.rss.channel[0].item ...
blogFeed = []; } res.send({ blogFeed, }); }); }); module.exports = router;
return e; }); } catch (e) {
random_line_split
owner.service.ts
import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import * as _ from 'underscore'; export class Permissions { _basic : boolean; _advanced : boolean; _admin : boolean; constructor(basic : boolean, advanced : boolean, admin : boolean){ this._basic = basic; this._advanced = advance...
getPermissions(user, items, allowedRoles):any{ const self = this; return _.each(items, function(item, index){ item.permissions = self.getPermission(user, item, allowedRoles); }) } getPermission(user, item, allowedRoles : string) : Permissions { if(!user || !item || !allowedRoles) return this.allowNothin...
{}
identifier_body
owner.service.ts
import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import * as _ from 'underscore'; export class Permissions { _basic : boolean; _advanced : boolean; _admin : boolean;
(basic : boolean, advanced : boolean, admin : boolean){ this._basic = basic; this._advanced = advanced; this._admin = admin; } } @Injectable() export class OwnerService { constructor() {} getPermissions(user, items, allowedRoles):any{ const self = this; return _.each(items, function(item, index){ item...
constructor
identifier_name
owner.service.ts
import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import * as _ from 'underscore'; export class Permissions { _basic : boolean; _advanced : boolean; _admin : boolean; constructor(basic : boolean, advanced : boolean, admin : boolean){ this._basic = basic; this._advanced = advance...
else { permissions = this.allowOwner(item, user); break; } default: break; } }) return permissions; } allowNothing() : Permissions { return new Permissions(false,false,false); } allowOwner(item, user) : Permissions { if(item['creator'] == user._id) return this.allowNothing();...
{ permissions = this.allowNothing(); }
conditional_block
owner.service.ts
import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Rx'; import * as _ from 'underscore'; export class Permissions { _basic : boolean; _advanced : boolean; _admin : boolean;
constructor(basic : boolean, advanced : boolean, admin : boolean){ this._basic = basic; this._advanced = advanced; this._admin = admin; } } @Injectable() export class OwnerService { constructor() {} getPermissions(user, items, allowedRoles):any{ const self = this; return _.each(items, function(item, ind...
random_line_split
clean-repo.py
#!/usr/bin/env python # -*- coding: utf8 -*- # # Python script to compile and compare locally installed programs with files listed in the repository # If the file doesn't exist in the repository, delete it, or move it to another folder # import os import platform import re import chardet import argparse import loggin...
main()
conditional_block
clean-repo.py
#!/usr/bin/env python # -*- coding: utf8 -*- # # Python script to compile and compare locally installed programs with files listed in the repository # If the file doesn't exist in the repository, delete it, or move it to another folder # import os import platform import re import chardet import argparse import loggin...
def main(): if platform.system() == 'Linux': pass else: print('Platform is not Linux. Exiting') exit() fileList(localPath) ''' fileListRe = r'^\w*' reC = re.compile(fileListRe) ''' logging.info('End of program') if __name__ == "__main__": main()
pass
identifier_body
clean-repo.py
#!/usr/bin/env python # -*- coding: utf8 -*- # # Python script to compile and compare locally installed programs with files listed in the repository # If the file doesn't exist in the repository, delete it, or move it to another folder # import os import platform import re import chardet import argparse import loggin...
(): if platform.system() == 'Linux': pass else: print('Platform is not Linux. Exiting') exit() fileList(localPath) ''' fileListRe = r'^\w*' reC = re.compile(fileListRe) ''' logging.info('End of program') if __name__ == "__main__": main()
main
identifier_name
clean-repo.py
#!/usr/bin/env python # -*- coding: utf8 -*- # # Python script to compile and compare locally installed programs with files listed in the repository # If the file doesn't exist in the repository, delete it, or move it to another folder # import os import platform import re import chardet import argparse import loggin...
# Variables localPath = '.' def fileList(localPath): # list files todo os.chdir(localPath) listD = ['ls'] fList = Popen(listD, stdin=PIPE, stdout=PIPE, stderr=PIPE) output, err = fList.communicate() if args.verbose: logging.debug('Start listing files') if output: p...
random_line_split
map_renderer.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause File: client/state/game/map_renderer.rs Author: Jesse 'Jeaye' Wilkerson Description: A client-only state that depends on the shared game state. This st...
(&mut self) { self.prev_visible_voxel_count = self.visible_voxels.get_ref().len() as u32; let cam = gfx::Camera::get_active(); let dist = (cam.near_far.y / self.map.voxel_size) as i32; /* How far the camera can see. */ let res = self.map.resolution as f32; let pos = math::Vec3f::new(cam.position...
update_visibility
identifier_name
map_renderer.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause File: client/state/game/map_renderer.rs Author: Jesse 'Jeaye' Wilkerson Description: A client-only state that depends on the shared game state. This st...
}
{ match name { "map.wireframe" => { let res = console::Util::parse_bool(name, val); match res { Ok(val) => { self.wireframe = val; None }, Err(msg) => { Some(msg) } } } _ => Some(~"ERROR"), } }
identifier_body
map_renderer.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson
Author: Jesse 'Jeaye' Wilkerson Description: A client-only state that depends on the shared game state. This state is used only to render the voxel map. */ use std::{ vec, ptr, mem, cast, cell }; use extra; use gl2 = opengles::gl2; use gfx; use math; use obj; use obj::voxel; use log::Log; use...
See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause File: client/state/game/map_renderer.rs
random_line_split
map_renderer.rs
/* Copyright 2013 Jesse 'Jeaye' Wilkerson See licensing in LICENSE file, or at: http://www.opensource.org/licenses/BSD-3-Clause File: client/state/game/map_renderer.rs Author: Jesse 'Jeaye' Wilkerson Description: A client-only state that depends on the shared game state. This st...
} } } /* Upload the data to the inactive buffer. */ check!(gl2::bind_buffer(gl2::ARRAY_BUFFER, ibo)); unsafe { let size = visible_voxels.len() * mem::size_of::<u32>(); let mem = check!(gl2::map_buffer_range(gl2::ARRAY_BUFFER, 0, size as i64, gl2::MAP_WRI...
{ visible_voxels.push(states[index] & !voxel::Visible); }
conditional_block
foundation.core.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function
(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /*...
__webpack_require__
identifier_name
foundation.core.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ re...
if (size.length > 1 && size[1] === 'only') { if (size[0] === this._getCurrentSize()) return true; } else { return this.atLeast(size[0]); } return false; }, /** * Gets the media query of a breakpoint. * @function * @param {String} size - Name of the breakpoint to get. * @ret...
size = size.trim().split(' ');
random_line_split
foundation.core.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId)
/******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /*****...
{ /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l...
identifier_body
foundation.core.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ re...
else { //error for no class or no method throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); } } else { //error for invalid argument type throw new TypeError('We\'re s...
{ //make sure both the class and method exist if (this.length === 1) { //if there's only one, call it directly. plugClass[method].apply(plugClass, args); } else { this.each(function (i, el) { //otherwise loop through the jQuery collection a...
conditional_block
IfcBeamType.g.ts
import {BaseIfc} from "./BaseIfc" import {IfcGloballyUniqueId} from "./IfcGloballyUniqueId.g" import {IfcOwnerHistory} from "./IfcOwnerHistory.g" import {IfcLabel} from "./IfcLabel.g" import {IfcText} from "./IfcText.g" import {IfcRelAssigns} from "./IfcRelAssigns.g" import {IfcRelNests} from "./IfcRelNests.g" import {...
import {IfcRelDefinesByType} from "./IfcRelDefinesByType.g" import {IfcRepresentationMap} from "./IfcRepresentationMap.g" import {IfcRelAssignsToProduct} from "./IfcRelAssignsToProduct.g" import {IfcBeamTypeEnum} from "./IfcBeamTypeEnum.g" import {IfcBuildingElementType} from "./IfcBuildingElementType.g" /** * http:/...
import {IfcRelAssociates} from "./IfcRelAssociates.g" import {IfcIdentifier} from "./IfcIdentifier.g" import {IfcPropertySetDefinition} from "./IfcPropertySetDefinition.g"
random_line_split
IfcBeamType.g.ts
import {BaseIfc} from "./BaseIfc" import {IfcGloballyUniqueId} from "./IfcGloballyUniqueId.g" import {IfcOwnerHistory} from "./IfcOwnerHistory.g" import {IfcLabel} from "./IfcLabel.g" import {IfcText} from "./IfcText.g" import {IfcRelAssigns} from "./IfcRelAssigns.g" import {IfcRelNests} from "./IfcRelNests.g" import ...
() : string { var parameters = new Array<string>(); parameters.push(BaseIfc.toStepValue(this.GlobalId)) parameters.push(BaseIfc.toStepValue(this.OwnerHistory)) parameters.push(BaseIfc.toStepValue(this.Name)) parameters.push(BaseIfc.toStepValue(this.Description)) parameters.push(BaseIfc.toStepValue(thi...
getStepParameters
identifier_name
too-much-recursion-unwinding.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...
fn r(recursed: *mut bool) -> r { r { recursed: recursed } } fn main() { let mut recursed = false; let _r = r(&mut recursed); recurse(); }
random_line_split
too-much-recursion-unwinding.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...
() { println!("don't optimize me out"); recurse(); } struct r { recursed: *mut bool, } impl Drop for r { fn drop(&mut self) { unsafe { if !*(self.recursed) { *(self.recursed) = true; recurse(); } } } } fn r(recursed: *mut boo...
recurse
identifier_name
too-much-recursion-unwinding.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...
} } } fn r(recursed: *mut bool) -> r { r { recursed: recursed } } fn main() { let mut recursed = false; let _r = r(&mut recursed); recurse(); }
{ *(self.recursed) = true; recurse(); }
conditional_block
element.js
/** * The DOM Element unit handling * * Copyright (C) 2008-2011 Nikolay Nemshilov */ var Element = RightJS.Element = new Class(Wrapper, { /** * constructor * * NOTE: this constructor will dynamically typecast * the wrappers depending on the element tag-name * * @param String element tag n...
} }
} } else { inst._ = element;
random_line_split
element.js
/** * The DOM Element unit handling * * Copyright (C) 2008-2011 Nikolay Nemshilov */ var Element = RightJS.Element = new Class(Wrapper, { /** * constructor * * NOTE: this constructor will dynamically typecast * the wrappers depending on the element tag-name * * @param String element tag n...
else { inst._ = element; } }
{ inst._ = make_element(element, options); if (options !== undefined) { for (var key in options) { switch (key) { case 'id': inst._.id = options[key]; break; case 'html': inst._.innerHTML = options[key]; break; case 'class': inst._.className = options[key]...
conditional_block
element.js
/** * The DOM Element unit handling * * Copyright (C) 2008-2011 Nikolay Nemshilov */ var Element = RightJS.Element = new Class(Wrapper, { /** * constructor * * NOTE: this constructor will dynamically typecast * the wrappers depending on the element tag-name * * @param String element tag n...
{ if (typeof element === 'string') { inst._ = make_element(element, options); if (options !== undefined) { for (var key in options) { switch (key) { case 'id': inst._.id = options[key]; break; case 'html': inst._.innerHTML = options[key]; break; case 'cl...
identifier_body
element.js
/** * The DOM Element unit handling * * Copyright (C) 2008-2011 Nikolay Nemshilov */ var Element = RightJS.Element = new Class(Wrapper, { /** * constructor * * NOTE: this constructor will dynamically typecast * the wrappers depending on the element tag-name * * @param String element tag n...
(inst, element, options) { if (typeof element === 'string') { inst._ = make_element(element, options); if (options !== undefined) { for (var key in options) { switch (key) { case 'id': inst._.id = options[key]; break; case 'html': inst._.innerHTML = options[key]; ...
Element_initialize
identifier_name
hgk.py
# Minimal support for git commands on an hg repository # # Copyright 2005, 2006 Chris Mason <mason@suse.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''browse the repository in a graphical way The hgk extension allows bro...
def revparse(ui, repo, *revs, **opts): """parse given revisions""" def revstr(rev): if rev == 'HEAD': rev = 'tip' return revlog.hex(repo.lookup(rev)) for r in revs: revrange = r.split(':', 1) ui.write('%s\n' % revstr(revrange[0])) if len(revrange) == 2:...
def chlogwalk(): count = len(repo) i = count l = [0] * 100 chunk = 100 while True: if chunk > i: chunk = i i = 0 else: i -= chunk for x in xrange(chunk): if i + x >= count: ...
identifier_body
hgk.py
# Minimal support for git commands on an hg repository # # Copyright 2005, 2006 Chris Mason <mason@suse.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''browse the repository in a graphical way The hgk extension allows bro...
(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in xrange(len(ar)): if sha in reachable[i]: mask |= 1 << i return mask reachable = [] stop_sha1 = [] want_sha1 = [] count = 0 # figure out which commits they are ...
is_reachable
identifier_name
hgk.py
# Minimal support for git commands on an hg repository # # Copyright 2005, 2006 Chris Mason <mason@suse.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''browse the repository in a graphical way The hgk extension allows bro...
commands.help_(ui, 'cat-file') while r: if type != "commit": ui.warn(_("aborting hg cat-file only understands commits\n")) return 1 n = repo.lookup(r) catcommit(ui, repo, n, prefix) if opts['stdin']: try: (type, r) = ra...
else: if not type or not r: ui.warn(_("cat-file: type or revision not supplied\n"))
random_line_split
hgk.py
# Minimal support for git commands on an hg repository # # Copyright 2005, 2006 Chris Mason <mason@suse.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''browse the repository in a graphical way The hgk extension allows bro...
while r: if type != "commit": ui.warn(_("aborting hg cat-file only understands commits\n")) return 1 n = repo.lookup(r) catcommit(ui, repo, n, prefix) if opts['stdin']: try: (type, r) = raw_input().split(' ') except EO...
if not type or not r: ui.warn(_("cat-file: type or revision not supplied\n")) commands.help_(ui, 'cat-file')
conditional_block
linky.js
'use strict'; /** * @ngdoc filter * @name linky * @kind function * * @description * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and * plain email address links. * * Requires the {@link ngSanitize `ngSanitize`} module to be installed. * * @param {string} text In...
function addLink(url, text) { var key, linkAttributes = attributesFn(url); html.push('<a '); for (key in linkAttributes) { html.push(key + '="' + linkAttributes[key] + '" '); } if (isDefined(target) && !('target' in linkAttributes)) { html.push('target="', ...
{ if (!text) { return; } html.push(sanitizeText(text)); }
identifier_body
linky.js
'use strict'; /** * @ngdoc filter * @name linky * @kind function * * @description * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and * plain email address links. * * Requires the {@link ngSanitize `ngSanitize`} module to be installed. * * @param {string} text In...
addText(raw); return $sanitize(html.join('')); function addText(text) { if (!text) { return; } html.push(sanitizeText(text)); } function addLink(url, text) { var key, linkAttributes = attributesFn(url); html.push('<a '); for (key in linkAttributes) { ...
}
random_line_split
linky.js
'use strict'; /** * @ngdoc filter * @name linky * @kind function * * @description * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and * plain email address links. * * Requires the {@link ngSanitize `ngSanitize`} module to be installed. * * @param {string} text In...
(url, text) { var key, linkAttributes = attributesFn(url); html.push('<a '); for (key in linkAttributes) { html.push(key + '="' + linkAttributes[key] + '" '); } if (isDefined(target) && !('target' in linkAttributes)) { html.push('target="', target, ...
addLink
identifier_name
pages.py
""" Goal: Define the routes for general pages @authors: Andrei Sura <sura.andrei@gmail.com> Ruchi Vivek Desai <ruchivdesai@gmail.com> Sanath Pasumarthy <sanath@ufl.edu> @see https://flask-login.readthedocs.org/en/latest/ @see https://pythonhosted.org/Flask-Principal/ """
import base64 import datetime import uuid from flask import current_app from flask import redirect from flask import render_template from flask import request from flask import session from flask import url_for from app.models.log_entity import LogEntity from app.models.web_session_entity import WebSessionEntity from a...
import hashlib
random_line_split
pages.py
""" Goal: Define the routes for general pages @authors: Andrei Sura <sura.andrei@gmail.com> Ruchi Vivek Desai <ruchivdesai@gmail.com> Sanath Pasumarthy <sanath@ufl.edu> @see https://flask-login.readthedocs.org/en/latest/ @see https://pythonhosted.org/Flask-Principal/ """ import hashlib...
(req): """ To support login from both a url argument and from Basic Auth using the Authorization header @TODO: use for api requests? Need to add column `UserAuth.uathApiKey` """ # first, try to login using the api_key url arg api_key = req.args.get('api_key') if not api_key: ...
load_user_from_request
identifier_name
pages.py
""" Goal: Define the routes for general pages @authors: Andrei Sura <sura.andrei@gmail.com> Ruchi Vivek Desai <ruchivdesai@gmail.com> Sanath Pasumarthy <sanath@ufl.edu> @see https://flask-login.readthedocs.org/en/latest/ @see https://pythonhosted.org/Flask-Principal/ """ import hashlib...
@app.route('/loginExternalAuth', methods=['POST', 'GET']) def shibb_redirect(): """ Redirect to the local shibboleth instance where we can pass the return path. This route is reached when the user clicks the "Login" button. Note: This is equivalent to Apache's syntax: Redirect seeother /l...
""" Render the login page with username/pass @see #index() @see #render_login_shib() """ if current_user.is_authenticated(): return redirect(get_role_landing_page()) uuid = session['uuid'] form = LoginForm(request.form) if request.method == 'POST' and form.validate(): emai...
identifier_body
pages.py
""" Goal: Define the routes for general pages @authors: Andrei Sura <sura.andrei@gmail.com> Ruchi Vivek Desai <ruchivdesai@gmail.com> Sanath Pasumarthy <sanath@ufl.edu> @see https://flask-login.readthedocs.org/en/latest/ @see https://pythonhosted.org/Flask-Principal/ """ import hashlib...
if api_key: md5 = hashlib.md5() md5.update(api_key) app.logger.debug("trying api_key: {}".format(md5.digest())) user = UserEntity.query.filter_by(api_key=api_key).first() return user # finally, return None if neither of the api_keys is valid return None @app.rout...
api_key = req.headers.get('Authorization') if api_key: api_key = api_key.replace('Basic ', '', 1) try: api_key = base64.b64decode(api_key) except TypeError: pass
conditional_block
user-register.component.ts
/** * @user-register.component.ts * @description 用户注册模块入口 * @author 阿虫 * @email ar.insect@gmail.com * @date 2017-03-22 * @version v1.0 */ import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Router, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot } from '@angular/router'; ...
identifier_body
user-register.component.ts
/** * @user-register.component.ts * @description 用户注册模块入口 * @author 阿虫 * @email ar.insect@gmail.com * @date 2017-03-22 * @version v1.0 */ import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Router, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot } from '@angular/router'; ...
identifier_name
user-register.component.ts
/** * @user-register.component.ts * @description 用户注册模块入口 * @author 阿虫
* @date 2017-03-22 * @version v1.0 */ import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Router, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { User } from '../model/user-model'; // 用户模型 import...
* @email ar.insect@gmail.com
random_line_split
app.ts
/// <reference path="./typings/tsd.d.ts"/> import * as Koa from 'koa'; import * as bodyParser from 'koa-bodyparser'; import * as koaLogger from 'koa-logger'; import logger from './utils/logger';
import rank from './routes/rank'; import news from './routes/news'; import analytics from './routes/analytics'; import summarize from './routes/summarize'; import { crawlJob } from './database/crawler'; const app = new Koa(); const port = process.env.PORT || 3000; const dist = path.join(__dirname, '..', 'public'); con...
import * as serve from 'koa-static'; import * as cors from 'koa2-cors'; import * as path from 'path';
random_line_split
app.ts
/// <reference path="./typings/tsd.d.ts"/> import * as Koa from 'koa'; import * as bodyParser from 'koa-bodyparser'; import * as koaLogger from 'koa-logger'; import logger from './utils/logger'; import * as serve from 'koa-static'; import * as cors from 'koa2-cors'; import * as path from 'path'; import rank from './...
app.listen(port, () => logger.info(`Listening on PORT ${port}`));
{ crawlJob.start(); }
conditional_block
tapering_window.py
import numpy as np from scipy.special import iv def
(time,D,mywindow): """ tapering_window returns the window for tapering a WOSA segment. Inputs: - time [1-dim numpy array of floats]: times along the WOSA segment. - D [float]: Temporal length of the WOSA segment. - mywindow [int]: Choice of tapering window: -> 1: Square window -> 2: Triangular window ...
tapering_window
identifier_name
tapering_window.py
import numpy as np from scipy.special import iv def tapering_window(time,D,mywindow): """ tapering_window returns the window for tapering a WOSA segment. Inputs: - time [1-dim numpy array of floats]: times along the WOSA segment. - D [float]: Temporal length of the WOSA segment. - mywindow [int]: Choice of ...
elif mywindow==10: sig=D/6.0 tapering_window=np.exp(-(time-D/2.0)**2/2.0/sig**2) else: print "Error: The window number you entered is not valid. Check input variable 'mywindow'." return return tapering_window
alpha=2.5 tapering_window=iv(0,np.pi*alpha*np.sqrt(1.0-((time-D/2.0)/(D/2.0))**2))
conditional_block
tapering_window.py
import numpy as np from scipy.special import iv def tapering_window(time,D,mywindow): """ tapering_window returns the window for tapering a WOSA segment. Inputs: - time [1-dim numpy array of floats]: times along the WOSA segment. - D [float]: Temporal length of the WOSA segment. - mywindow [int]: Choice of ...
F. Harris. On the use of windows for harmonic analysis with the discrete fourier transform. Proceedings of the IEEE, 66(1):51-83, January 1978. WARNING: Provide the vector 'time' such that for all k=0,...,time.size-1, we have time[k]>=0 and time[k]<=D Outputs: - tapering_window [1-dim numpy array of floats - si...
-> 10: Gaussian window, with standard dev. sigma=D/6.0 The terminology and formulas come from:
random_line_split
tapering_window.py
import numpy as np from scipy.special import iv def tapering_window(time,D,mywindow):
""" tapering_window returns the window for tapering a WOSA segment. Inputs: - time [1-dim numpy array of floats]: times along the WOSA segment. - D [float]: Temporal length of the WOSA segment. - mywindow [int]: Choice of tapering window: -> 1: Square window -> 2: Triangular window -> 3: sin window ...
identifier_body
config.py
#!/usr/bin/env python ################################################## # Parallel MLMC: Config class # # # # Jun Nie # # Last modification: 19-09-2017 # ##########################################...
pass
conditional_block
config.py
#!/usr/bin/env python ################################################## # Parallel MLMC: Config class # # # # Jun Nie # # Last modification: 19-09-2017 # ##########################################...
(self, config_file): # === fvm solver parameters self.DIM = 2 self.ORDER = 1 self.case = 'vayu_burgers' # 'vayu_ls89', 'su2_ls89' self.mesh_ncoarsest = 8+1 self.mesh_nfinest = 128+1 self.mesh_filename = '/home/jun/vayu/TestMatrix/Burgers.Test/mesh/' + \ ...
__init__
identifier_name
config.py
#!/usr/bin/env python ################################################## # Parallel MLMC: Config class # # # # Jun Nie # # Last modification: 19-09-2017 # ##########################################...
self.MULTIN = 1 # number of processes for fvm solver, 1 or multiples of 2 self.MULTIM = 4 # number of samplers (processor group) self.MULTI_CORES = 0 # === update self.update(config_file) def update(self, config_file): ''' read config ...
# === parallelization parameters self.multi = 'mpi' # 'mpi' for parallel, 'single' for serial
random_line_split
config.py
#!/usr/bin/env python ################################################## # Parallel MLMC: Config class # # # # Jun Nie # # Last modification: 19-09-2017 # ##########################################...
if __name__ == '__main__': pass
""" config class wchich is used for fvm solver, mlmc & parallelization TODO: adding read config parameters from file. """ def __init__(self, config_file): # === fvm solver parameters self.DIM = 2 self.ORDER = 1 self.case = 'vayu_burgers' # 'vayu_ls89', 'su2_ls89...
identifier_body
QueuingHandler.ts
import { AbstractHandler } from './AbstractHandler'; import * as AWS from 'aws-sdk'; import { Request } from '../Request'; import { InternalServerError } from '../Errors'; import { Response } from '../Response'; import { AmazonResourceName, SQSQueueARN } from '../Utilities'; import { QueuingHandlerConfig } from '../Con...
/** * Build a message to publish to an SNS topic. The default behavior is to send stringify the event. Child class can * override this method to customize the message * @param {AmazonResourceName} arn [description] * @param {AWS.SQS.SendMessageResult} sqsData [description] * ...
{ if (this.config.notifySNSTopic) { // Build our SNS publish params. const params: AWS.SNS.PublishInput = this.buildSNSMessage( AmazonResourceName.normalize(this.config.notifySNSTopic), sqsData ); // Send the message co...
identifier_body