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.controller.js
import {Task} from '../components/tasks/tasks.service.js'; export class MainController {
($interval, $log, tasksService, speechService) { 'ngInject'; const vm = this, currentTime = getPomodoroTime(); Object.assign(vm, { // timer timeLeft: formatTime(currentTime), currentTime, // tasks tasks: tasksService.getTasks(), newTask: Task(), ...
constructor
identifier_name
main.controller.js
import {Task} from '../components/tasks/tasks.service.js'; export class MainController { constructor ($interval, $log, tasksService, speechService) { 'ngInject'; const vm = this, currentTime = getPomodoroTime(); Object.assign(vm, { // timer timeLeft: formatTime(currentTime), ...
} setTime(time){ this.currentTime = time; this.timeLeft = formatTime(this.currentTime); } } function getPomodoroTime(){ return 25*60; } function getRestTime(activeTask){ if (activeTask.workedPomodoros % 4 === 0) return 20*60; return 5*60; } function formatTime(time){ const minutesLe...
setupRestTime(){ this.setTime(getRestTime(this.activeTask));
random_line_split
Overview.js
/* * catberry-homepage * * Copyright (c) 2015 Denis Rechkunov and project contributors. * * catberry-homepage's license follows: * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software wit...
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SO...
random_line_split
Overview.js
/* * catberry-homepage * * Copyright (c) 2015 Denis Rechkunov and project contributors. * * catberry-homepage's license follows: * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software wit...
Overview.prototype.filename = 'github/overview';
{ StaticStoreBase.call(this); }
identifier_body
Overview.js
/* * catberry-homepage * * Copyright (c) 2015 Denis Rechkunov and project contributors. * * catberry-homepage's license follows: * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software wit...
() { StaticStoreBase.call(this); } Overview.prototype.filename = 'github/overview';
Overview
identifier_name
bluetigers.py
# coding=utf-8 # Author: raver2046 <raver2046@gmail.com> # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 ...
from requests.utils import dict_from_cookiejar import traceback from sickbeard import logger, tvcache from sickbeard.bs4_parser import BS4Parser from sickrage.providers.torrent.TorrentProvider import TorrentProvider class BlueTigersProvider(TorrentProvider): # pylint: disable=too-many-instance-attributes def ...
# # You should have received a copy of the GNU General Public License # along with SickRage. If not, see <http://www.gnu.org/licenses/>. import re
random_line_split
bluetigers.py
# coding=utf-8 # Author: raver2046 <raver2046@gmail.com> # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 ...
items.append(item) except Exception: logger.log(u"Failed parsing provider. Traceback: %s" % traceback.format_exc(), logger.ERROR) # For each search mode sort all the items by seeders if available items.sort(key=lambda tup: t...
title = link.text download_url = self.urls['base_url'] + link['href'] download_url = download_url.replace("torrents-details", "download") # FIXME size = -1 seed...
conditional_block
bluetigers.py
# coding=utf-8 # Author: raver2046 <raver2046@gmail.com> # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 ...
self.url = self.urls['base_url'] def login(self): if any(dict_from_cookiejar(self.session.cookies).values()): return True login_params = { 'username': self.username, 'password': self.password, 'take_login': '1' } response = ...
TorrentProvider.__init__(self, "BLUETIGERS") self.username = None self.password = None self.ratio = None self.token = None self.cache = tvcache.TVCache(self, min_time=10) # Only poll BLUETIGERS every 10 minutes max self.urls = { 'base_url': 'https://www.bl...
identifier_body
bluetigers.py
# coding=utf-8 # Author: raver2046 <raver2046@gmail.com> # # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 ...
(self): return self.ratio provider = BlueTigersProvider()
seed_ratio
identifier_name
poisonpentametron.js
'use strict'; var fs = require('fs-extra') , async = require('async') , nconf = require('nconf'); var config = nconf.file('./conf/pp.' + (process.env.NODE_ENV || 'development') + '.json').load(); require('date-utils'); var pp = {}; pp.poetry = ""; pp.poetryPlain = ""; pp.rawPoetry = []; pp.cleanPoetry = []; pp.c...
}); }; function start(cb) { console.log('start'); return cb(null, config.url); } var downloadFeed = require('./download.js').downloadFeed , parseTweets = require('./parseTweets.js').parseTweets , saveFile = require('./archiveFile.js').saveFile , saveAndArchiveFile = require('./archiveFile.js').saveAndA...
{ var feed = new Date(stats.mtime) , now = new Date() , delta = feed.getMinutesBetween(now); console.log('\tisFeedFresh stats:\n\t\t%s\n\t\tnow %s\n\t\tdelta (min) %s\n\t\tthreshold (min) %s', feed, now, delta, config.maxAgeInMinutes); cb(null, delta < config.maxAg...
conditional_block
poisonpentametron.js
'use strict'; var fs = require('fs-extra') , async = require('async') , nconf = require('nconf'); var config = nconf.file('./conf/pp.' + (process.env.NODE_ENV || 'development') + '.json').load(); require('date-utils'); var pp = {}; pp.poetry = ""; pp.poetryPlain = ""; pp.rawPoetry = []; pp.cleanPoetry = []; pp.c...
(cb) { console.log('start'); return cb(null, config.url); } var downloadFeed = require('./download.js').downloadFeed , parseTweets = require('./parseTweets.js').parseTweets , saveFile = require('./archiveFile.js').saveFile , saveAndArchiveFile = require('./archiveFile.js').saveAndArchiveFile , cleanText = ...
start
identifier_name
poisonpentametron.js
'use strict'; var fs = require('fs-extra') , async = require('async') , nconf = require('nconf'); var config = nconf.file('./conf/pp.' + (process.env.NODE_ENV || 'development') + '.json').load(); require('date-utils'); var pp = {}; pp.poetry = ""; pp.poetryPlain = ""; pp.rawPoetry = []; pp.cleanPoetry = []; pp.c...
var downloadFeed = require('./download.js').downloadFeed , parseTweets = require('./parseTweets.js').parseTweets , saveFile = require('./archiveFile.js').saveFile , saveAndArchiveFile = require('./archiveFile.js').saveAndArchiveFile , cleanText = require('./sanitiseTweets.js').cleanText , createMatrix = req...
{ console.log('start'); return cb(null, config.url); }
identifier_body
poisonpentametron.js
'use strict'; var fs = require('fs-extra') , async = require('async') , nconf = require('nconf'); var config = nconf.file('./conf/pp.' + (process.env.NODE_ENV || 'development') + '.json').load(); require('date-utils'); var pp = {}; pp.poetry = ""; pp.poetryPlain = ""; pp.rawPoetry = []; pp.cleanPoetry = []; pp.c...
function finished(d, cb) { // mock cleanText console.log('finished d: %s', typeof d); cb(null); } pp.updateFeed = function(cb) { var waterfall = [start, downloadFeed, saveAndArchiveFile, parseTweets, saveAndArchiveFile, cleanText, saveAndArchiveFile, //FIXME: refactor function glue(data, cb) { ...
, cleanText = require('./sanitiseTweets.js').cleanText , createMatrix = require('./createMatrix.js').createMatrix , createPlainText = require('./createPlainText.js').createPlainText;
random_line_split
window_wall_ratio_east_SDH_by_building_age_lookup.py
# coding: utf8 # OeQ autogenerated lookup function for 'Window/Wall Ratio East in correlation to year of construction, based on the source data of the survey for the "German Building Typology developed by the "Institut für Wohnen und Umwelt", Darmstadt/Germany, 2011-2013' import math import numpy as np import oeqLooku...
1922,0, 1923,0, 1924,0, 1925,0, 1926,0, 1927,0, 1928,0, 1929,0, 1930,0, 1931,0, 1932,0, 1933,0, 1934,0, 1935,0, 1936,0, 1937,0, 1938,0, 1939,0, 1940,0, 1941,0, 1942,0, 1943,0, 1944,0, 1945,0, 1946,0, 1947,0, 1948,0, 1949,0, 1950,0, 1951,0, 1952,0, 1953,0, 1954,0, 1955,0, 1956,0, 1957,0, 1958,0.001, 1959,0.002, 1960,0.0...
1919,0, 1920,0, 1921,0,
random_line_split
window_wall_ratio_east_SDH_by_building_age_lookup.py
# coding: utf8 # OeQ autogenerated lookup function for 'Window/Wall Ratio East in correlation to year of construction, based on the source data of the survey for the "German Building Typology developed by the "Institut für Wohnen und Umwelt", Darmstadt/Germany, 2011-2013' import math import numpy as np import oeqLooku...
*xin): l_lookup = oeq.lookuptable( [ 1849,0, 1850,0, 1851,0, 1852,0, 1853,0, 1854,0, 1855,0, 1856,0, 1857,0, 1858,0, 1859,0, 1860,0, 1861,0, 1862,0, 1863,0, 1864,0, 1865,0, 1866,0, 1867,0, 1868,0, 1869,0, 1870,0, 1871,0, 1872,0, 1873,0, 1874,0, 1875,0, 1876,0, 1877,0, 1878,0, 1879,0, 1880,0, 1881,0, 1882,0, 1883,...
et(
identifier_name
window_wall_ratio_east_SDH_by_building_age_lookup.py
# coding: utf8 # OeQ autogenerated lookup function for 'Window/Wall Ratio East in correlation to year of construction, based on the source data of the survey for the "German Building Typology developed by the "Institut für Wohnen und Umwelt", Darmstadt/Germany, 2011-2013' import math import numpy as np import oeqLooku...
1867,0, 1868,0, 1869,0, 1870,0, 1871,0, 1872,0, 1873,0, 1874,0, 1875,0, 1876,0, 1877,0, 1878,0, 1879,0, 1880,0, 1881,0, 1882,0, 1883,0, 1884,0, 1885,0, 1886,0, 1887,0, 1888,0, 1889,0, 1890,0, 1891,0, 1892,0, 1893,0, 1894,0, 1895,0, 1896,0, 1897,0, 1898,0, 1899,0, 1900,0, 1901,0, 1902,0, 1903,0, 1904,0, 1905,0, 1906,0, ...
_lookup = oeq.lookuptable( [ 1849,0, 1850,0, 1851,0, 1852,0, 1853,0, 1854,0, 1855,0, 1856,0, 1857,0, 1858,0, 1859,0, 1860,0, 1861,0, 1862,0, 1863,0, 1864,0, 1865,0, 1866,0,
identifier_body
pipeline_hazard01.py
#The pipeline may not work correctly if there is both read and write access to the same memory 'xs0' from polyphony import testbench from polyphony import pipelined def pipeline_hazard01(xs0, xs1, xs2): for i in pipelined(range(len(xs0) - 1)): xs1[i] = xs0[i] xs0[i + 1] = xs2[i] @testbench def t...
test()
data0 = [1, 2, 3] data1 = [0, 0, 0] data2 = [1, 2, 1] pipeline_hazard01(data0, data1, data2) assert 1 == data0[0] assert 1 == data0[1] assert 2 == data0[2] assert 1 == data1[0] assert 1 == data1[1] assert 0 == data1[2]
identifier_body
pipeline_hazard01.py
#The pipeline may not work correctly if there is both read and write access to the same memory 'xs0' from polyphony import testbench from polyphony import pipelined def pipeline_hazard01(xs0, xs1, xs2): for i in pipelined(range(len(xs0) - 1)): xs1[i] = xs0[i] xs0[i + 1] = xs2[i]
@testbench def test(): data0 = [1, 2, 3] data1 = [0, 0, 0] data2 = [1, 2, 1] pipeline_hazard01(data0, data1, data2) assert 1 == data0[0] assert 1 == data0[1] assert 2 == data0[2] assert 1 == data1[0] assert 1 == data1[1] assert 0 == data1[2] test()
random_line_split
pipeline_hazard01.py
#The pipeline may not work correctly if there is both read and write access to the same memory 'xs0' from polyphony import testbench from polyphony import pipelined def pipeline_hazard01(xs0, xs1, xs2): for i in pipelined(range(len(xs0) - 1)):
@testbench def test(): data0 = [1, 2, 3] data1 = [0, 0, 0] data2 = [1, 2, 1] pipeline_hazard01(data0, data1, data2) assert 1 == data0[0] assert 1 == data0[1] assert 2 == data0[2] assert 1 == data1[0] assert 1 == data1[1] assert 0 == data1[2] test()
xs1[i] = xs0[i] xs0[i + 1] = xs2[i]
conditional_block
pipeline_hazard01.py
#The pipeline may not work correctly if there is both read and write access to the same memory 'xs0' from polyphony import testbench from polyphony import pipelined def
(xs0, xs1, xs2): for i in pipelined(range(len(xs0) - 1)): xs1[i] = xs0[i] xs0[i + 1] = xs2[i] @testbench def test(): data0 = [1, 2, 3] data1 = [0, 0, 0] data2 = [1, 2, 1] pipeline_hazard01(data0, data1, data2) assert 1 == data0[0] assert 1 == data0[1] assert 2 == data0[...
pipeline_hazard01
identifier_name
cstring.rs
use libc::c_char; use std::ffi::CStr; use std::str::Utf8Error; use std::ffi::CString; pub struct CStringUtils {} impl CStringUtils { pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<String>, Utf8Error> { if cstr.is_null() { return Ok(None); } unsafe { ...
} //TODO DOCUMENT WHAT THIS DOES macro_rules! check_useful_c_str { ($x:ident, $e:expr) => { let $x = match CStringUtils::c_str_to_string($x) { Ok(Some(val)) => val, _ => return VcxError::from_msg($e, "Invalid pointer has been passed").into() }; if $x.is_empty() { ...
}
random_line_split
cstring.rs
use libc::c_char; use std::ffi::CStr; use std::str::Utf8Error; use std::ffi::CString; pub struct CStringUtils {} impl CStringUtils { pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<String>, Utf8Error> { if cstr.is_null() { return Ok(None); } unsafe { ...
{ let len = v.len() as u32; (v.as_ptr() as *const u8, len) }
identifier_body
cstring.rs
use libc::c_char; use std::ffi::CStr; use std::str::Utf8Error; use std::ffi::CString; pub struct CStringUtils {} impl CStringUtils { pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<String>, Utf8Error> { if cstr.is_null() { return Ok(None); } unsafe { ...
(s: String) -> CString { CString::new(s).unwrap() } } //TODO DOCUMENT WHAT THIS DOES macro_rules! check_useful_c_str { ($x:ident, $e:expr) => { let $x = match CStringUtils::c_str_to_string($x) { Ok(Some(val)) => val, _ => return VcxError::from_msg($e, "Invalid pointer ha...
string_to_cstring
identifier_name
forward_ref.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ForwardRefFn, Inject, ReflectiveInjector, forwardRef, resolveForwardRef} from '@angular/core'; // #docregi...
(@Inject(forwardRef(() => Lock)) lock: Lock) { this.lock = lock; } } // Only at this point Lock is defined. class Lock {} var injector = ReflectiveInjector.resolveAndCreate([Door, Lock]); var door = injector.get(Door); expect(door instanceof Door).toBe(true); expect(door.lock instanceof Lock).toBe(true); // #enddocre...
constructor
identifier_name
forward_ref.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ForwardRefFn, Inject, ReflectiveInjector, forwardRef, resolveForwardRef} from '@angular/core'; // #docregi...
// #docregion forward_ref class Door { lock: Lock; constructor(@Inject(forwardRef(() => Lock)) lock: Lock) { this.lock = lock; } } // Only at this point Lock is defined. class Lock {} var injector = ReflectiveInjector.resolveAndCreate([Door, Lock]); var door = injector.get(Door); expect(door instanceof Door).toB...
// #enddocregion
random_line_split
gdpr.js
var pause = undefined; var play = undefined; var audio = undefined; var tapesound = undefined; // var staticsound = undefined; function endstatic() { document.body.style.backgroundImage = "none"; document.body.style.backgroundColor = "white"; //staticsound.pause(); } function
() { audio.play(); } function startstyle() { rude.style.display = "none"; curvebox.style.display = "none"; spun.style.display = null; cover.classList.add("wrapper"); } function startsound() { tapesound.play(); } function delayedlaw() { lawbreaker.style.display = null; } function onplay(e) { var curvebox = document.getE...
startmusic
identifier_name
gdpr.js
var pause = undefined; var play = undefined; var audio = undefined; var tapesound = undefined; // var staticsound = undefined; function endstatic() { document.body.style.backgroundImage = "none"; document.body.style.backgroundColor = "white"; //staticsound.pause(); } function startmusic() { audio.play(); } function ...
function delayedlaw() { lawbreaker.style.display = null; } function onplay(e) { var curvebox = document.getElementById("curvebox"); var rude = document.getElementById("rude"); var spun = document.getElementById("spun"); var cover = document.getElementById("cover"); var lawbreaker = document.getElementById("lawbreaker"...
{ tapesound.play(); }
identifier_body
gdpr.js
var pause = undefined; var play = undefined; var audio = undefined; var tapesound = undefined; // var staticsound = undefined; function endstatic() { document.body.style.backgroundImage = "none"; document.body.style.backgroundColor = "white"; //staticsound.pause(); } function startmusic() { audio.play(); } function ...
tapesound = document.createElement("audio"); tapesound.src = "/tapefeed.mp3"; tapesound.pause(); audio = document.createElement("audio"); audio.src = " https://oman.imjake.me/LawBreaker.mp3 "; audio.pause(); audio.addEventListener('ended',function(){ reset(); },false); }
{ var button = document.getElementById("OHGODWORK"); button.onclick = onplay; console.log("load successed");
random_line_split
connection_status.rs
use crate::{ auth::{Credentials, SASLMechanism}, Connection, ConnectionProperties, PromiseResolver, }; use parking_lot::Mutex; use std::{fmt, sync::Arc}; #[derive(Clone, Default)] pub struct ConnectionStatus(Arc<Mutex<Inner>>); impl ConnectionStatus { pub fn state(&self) -> ConnectionState { self....
[ConnectionState::Connecting, ConnectionState::Connected].contains(&self.0.lock().state) } } pub(crate) enum ConnectionStep { ProtocolHeader( PromiseResolver<Connection>, Connection, Credentials, SASLMechanism, ConnectionProperties, ), StartOk(PromiseReso...
pub(crate) fn auto_close(&self) -> bool {
random_line_split
connection_status.rs
use crate::{ auth::{Credentials, SASLMechanism}, Connection, ConnectionProperties, PromiseResolver, }; use parking_lot::Mutex; use std::{fmt, sync::Arc}; #[derive(Clone, Default)] pub struct ConnectionStatus(Arc<Mutex<Inner>>); impl ConnectionStatus { pub fn state(&self) -> ConnectionState { self....
(&self) -> bool { self.0.lock().state == ConnectionState::Error } pub(crate) fn auto_close(&self) -> bool { [ConnectionState::Connecting, ConnectionState::Connected].contains(&self.0.lock().state) } } pub(crate) enum ConnectionStep { ProtocolHeader( PromiseResolver<Connection>,...
errored
identifier_name
connection_status.rs
use crate::{ auth::{Credentials, SASLMechanism}, Connection, ConnectionProperties, PromiseResolver, }; use parking_lot::Mutex; use std::{fmt, sync::Arc}; #[derive(Clone, Default)] pub struct ConnectionStatus(Arc<Mutex<Inner>>); impl ConnectionStatus { pub fn state(&self) -> ConnectionState { self....
} struct Inner { connection_step: Option<ConnectionStep>, state: ConnectionState, vhost: String, username: String, blocked: bool, } impl Default for Inner { fn default() -> Self { Self { connection_step: None, state: ConnectionState::default(), vhos...
{ let mut debug = f.debug_struct("ConnectionStatus"); if let Some(inner) = self.0.try_lock() { debug .field("state", &inner.state) .field("vhost", &inner.vhost) .field("username", &inner.username) .field("blocked", &inner.blocke...
identifier_body
jquery.waituntilexists.js
;(function ($, window) { var intervals = {}; var removeListener = function(selector) { if (intervals[selector]) { window.clearInterval(intervals[selector]); intervals[selector] = null; } }; var found = 'waitUntilExists.found'; /** * @function * @property {object} jQuery plugin which runs handler function ...
} return $this; }; }(jQuery, window));
{ // Run the handler on all found elements and mark as found $elements.each(handler).data(found, true); if (shouldRunHandlerOnce && $this.length) { // Element was found, implying the handler already ran for all // matched elements removeListener(selector); } else if (!isChild) { // If...
conditional_block
jquery.waituntilexists.js
;(function ($, window) { var intervals = {}; var removeListener = function(selector) { if (intervals[selector]) { window.clearInterval(intervals[selector]); intervals[selector] = null; } }; var found = 'waitUntilExists.found'; /** * @function * @property {object} jQuery plugin which runs handler function ...
}(jQuery, window));
};
random_line_split
ToLong-001.js
/* ***** BEGIN LICENSE BLOCK ***** * * Copyright (C) 1998 Netscape Communications Corporation. * Copyright (C) 2010 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; ei...
() { return; } MyFunction.valueOf = new Function( "return 6060842" ); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new String() ) +''", "'LONG'"); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new Boolean() ) +''", "'LONG'"); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new Number() ) +''", "'LONG...
MyFunction
identifier_name
ToLong-001.js
/* ***** BEGIN LICENSE BLOCK ***** * * Copyright (C) 1998 Netscape Communications Corporation. * Copyright (C) 2010 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; ei...
MyFunction.valueOf = new Function( "return 6060842" ); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new String() ) +''", "'LONG'"); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new Boolean() ) +''", "'LONG'"); shouldBeWithErrorCheck( "TEST_CLASS.ambiguous( new Number() ) +''", "'LONG'"); shouldBeWi...
{ return; }
identifier_body
ToLong-001.js
/* ***** BEGIN LICENSE BLOCK ***** * * Copyright (C) 1998 Netscape Communications Corporation. * Copyright (C) 2010 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; ei...
/** * Preferred Argument Conversion. * * Passing a JavaScript boolean to a Java method should prefer to call * a Java method of the same name that expects a Java boolean. * */ var SECTION = "Preferred argument conversion: JavaScript Object to Long"; var VERSION = "1_4"; var TITLE = "LiveConnect 3.0 JavaScri...
gTestfile = 'ToLong-001.js';
random_line_split
dice.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import string import random # Simple recursive descent parser for dice rolls, e.g. '3d6+1d8+4'. # # roll := die {('+' | '-') die} ('+' | '-') modifier # di...
class Symbol(object): NUMBER = 0 D = 1 PLUS = 2 MINUS = 3 def __init__(self, type_, pos, value) def next_symbol(s): c = s.getc() while c in string.whitespace: c = s.getc() if c in string.digits: # start of a number literal = c c = s.getc() whil...
return self.pos
identifier_body
dice.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import string import random # Simple recursive descent parser for dice rolls, e.g. '3d6+1d8+4'. # # roll := die {('+' | '-') die} ('+' | '-') modifier # di...
self.pos = 0 def peek(self): return self.s[self.pos] def getc(self): c = self.peek() self.pos += 1 return c def ungetc(self): self.pos -= 1 def tell(self): return self.pos class Symbol(object): NUMBER = 0 D = 1 PLUS = 2 MINUS =...
# modifier := number class StringBuf(object): def __init__(self, s): self.s = s
random_line_split
dice.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import string import random # Simple recursive descent parser for dice rolls, e.g. '3d6+1d8+4'. # # roll := die {('+' | '-') die} ('+' | '-') modifier # di...
(object): def __init__(self, s): self.s = s self.pos = 0 def peek(self): return self.s[self.pos] def getc(self): c = self.peek() self.pos += 1 return c def ungetc(self): self.pos -= 1 def tell(self): return self.pos class Symbol(ob...
StringBuf
identifier_name
dice.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import string import random # Simple recursive descent parser for dice rolls, e.g. '3d6+1d8+4'. # # roll := die {('+' | '-') die} ('+' | '-') modifier # di...
return ()
raise ValueError('Syntax error at position ' + s.tell())
conditional_block
time.rs
assemble_lisp_time( specified_time: LispObject, phigh: *mut LispObject, plow: *mut LispObject, pusec: *mut LispObject, ppsec: *mut LispObject, ) -> c_int { let specified_time = specified_time; let mut high = LispObject::from(0); let mut low = specified_time; let mut usec = LispObjec...
check_time_validity
identifier_name
time.rs
; } if us >= 1_000_000 { lo += 1; us -= 1_000_000; } if lo >= 1 << LO_TIME_BITS { hi += 1; lo -= 1 << LO_TIME_BITS; } Self { hi, lo, us, ps } } } #[allow(clippy::suspicious_arithmetic_impl)] impl Sub for LispTime { ...
/// `UNKNOWN_MODTIME_NSECS`; in that case, the Lisp list contains a /// correspondingly negative picosecond count. #[no_mangle] pub extern "C" fn make_lisp_time(t: c_timespec) -> LispObject { make_lisp_time_1(t) } fn make_lisp_time_1(t: c_timespec) -> LispObject { let s = t.tv_sec; let ns = t.tv_nsec; ...
/// Make a Lisp list that represents the Emacs time T. T may be an /// invalid time, with a slightly negative `tv_nsec` value such as
random_line_split
time.rs
let mut us = self.us - other.us; let mut ps = self.ps - other.ps; if ps < 0 { us -= 1; ps += 1_000_000; } if us < 0 { lo -= 1; us += 1_000_000; } if hi < 0 { hi -= 1; lo += 1 << LO_TIME_BITS; ...
{ let lo_multiplier = f64::from(1 << LO_TIME_BITS); let emacs_time_min = MOST_NEGATIVE_FIXNUM as f64 * lo_multiplier; if !(emacs_time_min <= t && t < -emacs_time_min) { return false; } let small_t = t / lo_multiplier; let mut hi = small_t as EmacsInt; let t_sans_hi = t - (hi as f64)...
identifier_body
time.rs
} if us >= 1_000_000 { lo += 1; us -= 1_000_000; } if lo >= 1 << LO_TIME_BITS { hi += 1; lo -= 1 << LO_TIME_BITS; } Self { hi, lo, us, ps } } } #[allow(clippy::suspicious_arithmetic_impl)] impl Sub for LispTime { t...
if !dresult.is_null() { *dresult = t; } return 1; } else if low.is_nil() { let now = current_timespec(); if !result.is_null() { (*result).hi = hi_time(now.tv_sec); (*result).lo = lo_time(now.tv_sec); ...
{ return -1; }
conditional_block
macro_crate_test.rs
// Copyright 2013-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...
(cx: &mut ExtCtxt, sp: Span, attr: Gc<MetaItem>, it: Gc<Item>) -> Gc<Item> { box(GC) Item { attrs: it.attrs.clone(), ..(*quote_item!(cx, enum Foo { Bar, Baz }).unwrap()).clone() } } fn expand_forged_ident(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResult+'static...
expand_into_foo
identifier_name
macro_crate_test.rs
// Copyright 2013-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...
// force-host #![feature(globs, plugin_registrar, macro_rules, quote)] extern crate syntax; extern crate rustc; use syntax::ast::{TokenTree, Item, MetaItem}; use syntax::codemap::Span; use syntax::ext::base::*; use syntax::parse::token; use syntax::parse; use rustc::plugin::Registry; use std::gc::{Gc, GC}; #[macr...
random_line_split
macro_crate_test.rs
// Copyright 2013-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...
MacExpr::new(quote_expr!(cx, 1i)) } // See Issue #15750 fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult+'static> { // Parse an expression and emit it unchanged. let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), Vec::from...
{ cx.span_fatal(sp, "make_a_1 takes no arguments"); }
conditional_block
macro_crate_test.rs
// Copyright 2013-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...
// See Issue #15750 fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult+'static> { // Parse an expression and emit it unchanged. let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), Vec::from_slice(tts)); let expr = parser.pars...
{ if !tts.is_empty() { cx.span_fatal(sp, "make_a_1 takes no arguments"); } MacExpr::new(quote_expr!(cx, 1i)) }
identifier_body
array_simp_2.py
t = int(raw_input()) MOD = 10**9 + 7 def modexp(a,b): res = 1 while b: if b&1: res *= a res %= MOD a = (a*a)%MOD b /= 2 return res fn = [1 for _ in xrange(100001)] ifn = [1 for _ in xrange(100001)] for i in range(1,100000): fn[i] = fn[i-1] * i fn[i] %...
(n,k): return fn[n] * ifn[k] * ifn[n-k] for ti in range(t): n = int(raw_input()) a = map(int,raw_input().split()) ans = 0 for i in range(n): if i%2==0: ans += nCr(n-1,i)%MOD * a[i]%MOD else: ans -= nCr(n-1,i)%MOD * a[i]%MOD ans %= MOD print ans
nCr
identifier_name
array_simp_2.py
t = int(raw_input()) MOD = 10**9 + 7 def modexp(a,b): res = 1 while b: if b&1: res *= a res %= MOD a = (a*a)%MOD b /= 2 return res fn = [1 for _ in xrange(100001)] ifn = [1 for _ in xrange(100001)] for i in range(1,100000): fn[i] = fn[i-1] * i fn[i] %...
ans %= MOD print ans
ans -= nCr(n-1,i)%MOD * a[i]%MOD
conditional_block
array_simp_2.py
t = int(raw_input()) MOD = 10**9 + 7 def modexp(a,b): res = 1 while b: if b&1: res *= a res %= MOD a = (a*a)%MOD b /= 2 return res fn = [1 for _ in xrange(100001)] ifn = [1 for _ in xrange(100001)] for i in range(1,100000): fn[i] = fn[i-1] * i fn[i] %...
ans = 0 for i in range(n): if i%2==0: ans += nCr(n-1,i)%MOD * a[i]%MOD else: ans -= nCr(n-1,i)%MOD * a[i]%MOD ans %= MOD print ans
def nCr(n,k): return fn[n] * ifn[k] * ifn[n-k] for ti in range(t): n = int(raw_input()) a = map(int,raw_input().split())
random_line_split
array_simp_2.py
t = int(raw_input()) MOD = 10**9 + 7 def modexp(a,b):
fn = [1 for _ in xrange(100001)] ifn = [1 for _ in xrange(100001)] for i in range(1,100000): fn[i] = fn[i-1] * i fn[i] %= MOD ifn[i] = modexp(fn[i],MOD-2) def nCr(n,k): return fn[n] * ifn[k] * ifn[n-k] for ti in range(t): n = int(raw_input()) a = map(int,raw_input().split()) ans = 0 for...
res = 1 while b: if b&1: res *= a res %= MOD a = (a*a)%MOD b /= 2 return res
identifier_body
index.tsx
/// <reference path="../typings/index.d.ts" /> import * as injectTapEventPlugin from 'react-tap-event-plugin'; import animationFrame from './util/animationFrame'; injectTapEventPlugin(); animationFrame(); interface CustomerElement extends Element{ blur?: ()=>{} } function
(e) { if(e.target.tagName == "INPUT" || e.target.tagName == 'TEXTAREA') { return; } var activeElement = document.activeElement as CustomerElement; if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") { activeElement.blur && activeElement.blur(); } } document.ad...
blurActiveInput
identifier_name
index.tsx
/// <reference path="../typings/index.d.ts" /> import * as injectTapEventPlugin from 'react-tap-event-plugin'; import animationFrame from './util/animationFrame'; injectTapEventPlugin(); animationFrame(); interface CustomerElement extends Element{ blur?: ()=>{} } function blurActiveInput(e) { if(e.target.tagNam...
var activeElement = document.activeElement as CustomerElement; if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") { activeElement.blur && activeElement.blur(); } } document.addEventListener('touchstart', blurActiveInput, false) export {colors} from './styles/colors'; export...
{ return; }
conditional_block
index.tsx
/// <reference path="../typings/index.d.ts" /> import * as injectTapEventPlugin from 'react-tap-event-plugin'; import animationFrame from './util/animationFrame'; injectTapEventPlugin(); animationFrame(); interface CustomerElement extends Element{ blur?: ()=>{} } function blurActiveInput(e) { if(e.target.tagNam...
export {default as Toast} from './Toast'; export {default as Card} from './Card'; export {default as Switch} from './Switch'; export {default as Checkbox} from './Checkbox'; export {default as Radio} from './Radio'; export {default as RadioGroup} from './Radio/RadioGroup'; export {default as Ellipsis} from './Ellipsis'...
export {default as Badge} from './Badge';
random_line_split
index.tsx
/// <reference path="../typings/index.d.ts" /> import * as injectTapEventPlugin from 'react-tap-event-plugin'; import animationFrame from './util/animationFrame'; injectTapEventPlugin(); animationFrame(); interface CustomerElement extends Element{ blur?: ()=>{} } function blurActiveInput(e)
document.addEventListener('touchstart', blurActiveInput, false) export {colors} from './styles/colors'; export {default as Alert} from './Alert'; export {default as Button} from './Button'; export {default as Icon} from './Icon'; export {default as Line} from './Line'; export {default as Tabs} from './Tabs'; export {d...
{ if(e.target.tagName == "INPUT" || e.target.tagName == 'TEXTAREA') { return; } var activeElement = document.activeElement as CustomerElement; if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") { activeElement.blur && activeElement.blur(); } }
identifier_body
docs.js
var Document = require('pelias-model').Document; var docs = {}; docs.named = new Document('item1',1); docs.named.setName('default','poi1'); docs.unnamed = new Document('item2',2); // no name docs.unnamedWithAddress = new Document('item3',3); docs.unnamedWithAddress.setCentroid({lat:3,lon:3}); docs.unnamedWithAddress...
.setAdmin('locality','town') .setAdmin('neighborhood','hood') .setMeta('foo','bar') .setMeta('bing','bang'); docs.osmNode1 = new Document('item7',7) .setName('osmnode','node7') .setCentroid({lat:7,lon:7}); docs.osmWay1 = new Document('osmway',8) .setName('osmway','way8') .setMeta('nodes', [ { lat:...
random_line_split
CodeEditor.tsx
import * as React from 'react' import * as Codemirror from 'react-codemirror' import 'codemirror/mode/javascript/javascript' import 'codemirror/lib/codemirror.css' import 'codemirror/theme/mdn-like.css' import './CodeEditor.css'
onChange?: (...args: any[]) => any } export default class CodeEditor extends React.Component<P> { static defaultProps = { value: '', onChange: (e: any) => e, } state = { value: this.props.value, } componentWillReceiveProps(nextProps: any) { this.setState({ value: nextProps.value, ...
interface P { value?: string
random_line_split
CodeEditor.tsx
import * as React from 'react' import * as Codemirror from 'react-codemirror' import 'codemirror/mode/javascript/javascript' import 'codemirror/lib/codemirror.css' import 'codemirror/theme/mdn-like.css' import './CodeEditor.css' interface P { value?: string onChange?: (...args: any[]) => any } export default clas...
(nextProps: any) { this.setState({ value: nextProps.value, }) } updateCode = (newCode: string) => { this.props.onChange!(newCode) } render() { return ( <Codemirror value={this.state.value} onChange={this.updateCode} options={{ mode: 'javascript', ...
componentWillReceiveProps
identifier_name
CodeEditor.tsx
import * as React from 'react' import * as Codemirror from 'react-codemirror' import 'codemirror/mode/javascript/javascript' import 'codemirror/lib/codemirror.css' import 'codemirror/theme/mdn-like.css' import './CodeEditor.css' interface P { value?: string onChange?: (...args: any[]) => any } export default clas...
updateCode = (newCode: string) => { this.props.onChange!(newCode) } render() { return ( <Codemirror value={this.state.value} onChange={this.updateCode} options={{ mode: 'javascript', theme: 'mdn-like', indentUnit: 2, tabSize: 2, ...
{ this.setState({ value: nextProps.value, }) }
identifier_body
event-logging-strategy-test.ts
import Coordinator, { EventLoggingStrategy } from '../../src/index'; import { Source, Transform, TransformBuilder, buildTransform } from '@orbit/data'; import '../test-helper'; declare const RSVP: any; const { all } = RSVP; const { module, test } = QUnit; module('EventLoggingStrategy', function(hooks) { c...
// TODO: // * test `interfaces` option // * test adding sources that support different interfaces to ensure they're inspected properly });
});
random_line_split
event-logging-strategy-test.ts
import Coordinator, { EventLoggingStrategy } from '../../src/index'; import { Source, Transform, TransformBuilder, buildTransform } from '@orbit/data'; import '../test-helper'; declare const RSVP: any; const { all } = RSVP; const { module, test } = QUnit; module('EventLoggingStrategy', function(hooks) { c...
extends Source {} let s1 = new MySource({ name: 's1' }); let s2 = new MySource({ name: 's2' }); eventLoggingStrategy = new EventLoggingStrategy(); let coordinator = new Coordinator({ sources: [ s1, s2 ], strategies: [ eventLoggingStrategy ]}); assert.equal(s1.listeners('transform').length, 0); ...
MySource
identifier_name
listdir.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
}
{ println!("{}", path.display()); match fs::metadata(&path) { Ok(ref m) if m.is_dir() => Some(()), _ => None, } }
identifier_body
listdir.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
use threadpool; pub trait PathHandler<D> { fn handle_path(&self, D, PathBuf) -> Option<D>; } pub fn iterate_recursively<P: 'static + Send + Clone, W: 'static + PathHandler<P> + Send + Clone> (root: (PathBuf, P), worker: &mut W) { let threads = 10; let (push_ch, work_ch) = mpsc::sync_channel(threads); let ...
random_line_split
listdir.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
<P: 'static + Send + Clone, W: 'static + PathHandler<P> + Send + Clone> (root: (PathBuf, P), worker: &mut W) { let threads = 10; let (push_ch, work_ch) = mpsc::sync_channel(threads); let pool = threadpool::ThreadPool::new(threads); // Insert the first task into the queue: push_ch.send(Some(root)).unwrap();...
iterate_recursively
identifier_name
error_handler.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getDebugContext, getErrorLogger, getOriginalError} from './errors'; /** * Provides a hook for centralized...
} /** @internal */ _findContext(error: any): any { if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; } /** @internal */ _findOriginalError(error: Error): any { let e...
{ errorLogger(this._console, 'ERROR CONTEXT', context); }
conditional_block
error_handler.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getDebugContext, getErrorLogger, getOriginalError} from './errors'; /** * Provides a hook for centralized...
(error: any): any { if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; } /** @internal */ _findOriginalError(error: Error): any { let e = getOriginalError(error); while (...
_findContext
identifier_name
error_handler.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getDebugContext, getErrorLogger, getOriginalError} from './errors'; /** * Provides a hook for centralized...
/** @internal */ _findOriginalError(error: Error): any { let e = getOriginalError(error); while (e && getOriginalError(e)) { e = getOriginalError(e); } return e; } }
{ if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; }
identifier_body
error_handler.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {getDebugContext, getErrorLogger, getOriginalError} from './errors'; /** * Provides a hook for centralized...
* handleError(error) { * // do something with the exception * } * } * * @NgModule({ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}] * }) * class MyModule {} * ``` * * @publicApi */ export class ErrorHandler { /** * @internal */ _console: Console = console; handleErro...
* ``` * class MyErrorHandler implements ErrorHandler {
random_line_split
convert_engine.py
from __future__ import unicode_literals, with_statement import re import os import subprocess from collections import OrderedDict from django.utils.encoding import smart_str from django.core.files.temp import NamedTemporaryFile from sorl.thumbnail.base import EXTENSIONS from sorl.thumbnail.compat import b from sorl.t...
args = map(smart_str, args) p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.wait() out, err = p.communicate() if err: raise Exception(err) thumbnail.write(fp.read()) def cleanup(self, image): ...
args.append(fp.name)
random_line_split
convert_engine.py
from __future__ import unicode_literals, with_statement import re import os import subprocess from collections import OrderedDict from django.utils.encoding import smart_str from django.core.files.temp import NamedTemporaryFile from sorl.thumbnail.base import EXTENSIONS from sorl.thumbnail.compat import b from sorl.t...
suffix = '.%s' % EXTENSIONS[options['format']] with NamedTemporaryFile(suffix=suffix, mode='rb') as fp: args.append(fp.name) args = map(smart_str, args) p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.wait() out,...
args.append('-flatten')
conditional_block
convert_engine.py
from __future__ import unicode_literals, with_statement import re import os import subprocess from collections import OrderedDict from django.utils.encoding import smart_str from django.core.files.temp import NamedTemporaryFile from sorl.thumbnail.base import EXTENSIONS from sorl.thumbnail.compat import b from sorl.t...
(self, image, geometry, options): """ Pads the image """ # The order is important. The gravity option should come before extent. image['options']['background'] = options.get('padding_color') image['options']['gravity'] = 'center' image['options']['extent'] = '%sx%...
_padding
identifier_name
convert_engine.py
from __future__ import unicode_literals, with_statement import re import os import subprocess from collections import OrderedDict from django.utils.encoding import smart_str from django.core.files.temp import NamedTemporaryFile from sorl.thumbnail.base import EXTENSIONS from sorl.thumbnail.compat import b from sorl.t...
if v is not None: args.append('%s' % v) flatten = "on" if 'flatten' in options: flatten = options['flatten'] if settings.THUMBNAIL_FLATTEN and not flatten == "off": args.append('-flatten') suffix = '.%s' % EXTENSIONS[options['format'...
""" Image object is a dict with source path, options and size """ def write(self, image, options, thumbnail): """ Writes the thumbnail image """ if options['format'] == 'JPEG' and options.get( 'progressive', settings.THUMBNAIL_PROGRESSIVE): image[...
identifier_body
common-driver.js
var webdriver = require('selenium-webdriver'); var By = webdriver.By; var SauceLabs = require("saucelabs"); var fs = require("fs"); var until = webdriver.until; module.exports = { failIfTrue: function(done, failMessage) { return function(result) { if(result) done(failMessage); } }, ...
if (this.saucelabs.username != null) { var spec = jasmine.getEnv().currentSpec; this.updateJob(driver, {passed: spec.results_.totalCount == spec.results_.passedCount})() .then(driver.quit()) .then(function() { console.log("Setting test status"); }) ...
saucelabs: {}, setTestStatus: function(driver, done) { driver.controlFlow().reset(); // Discontinue any further driver actions that may have been defined.
random_line_split
common-driver.js
var webdriver = require('selenium-webdriver'); var By = webdriver.By; var SauceLabs = require("saucelabs"); var fs = require("fs"); var until = webdriver.until; module.exports = { failIfTrue: function(done, failMessage) { return function(result) { if(result) done(failMessage); } }, ...
else { driver.quit(); done(); } }, updateJob: function(driver, options) { if (this.saucelabs.username == null) { return function() {}; // No op. Assume running locally. } return function() { return new Promise(functio...
{ var spec = jasmine.getEnv().currentSpec; this.updateJob(driver, {passed: spec.results_.totalCount == spec.results_.passedCount})() .then(driver.quit()) .then(function() { console.log("Setting test status"); }) .then(done); }
conditional_block
test_calc.py
import pytest from calc import INTEGER, EOF, PLUS, Calc, CalcError def test_calc_raises_error_on_invalid_tokens(): """ Test that invalid tokens cause a ``CalcError`` and that the exception stack trace contains useful information. """ input_text = "lumberjack" # Now with 100% more Monty Python re...
(): """ Test that attempting to parse an invalid expression allows a ``CalcError`` to propagate correctly. """ input_text = "+1" calc = Calc(text=input_text) with pytest.raises(CalcError): calc.parse()
test_parse_raises_error_on_invalid_expression
identifier_name
test_calc.py
import pytest from calc import INTEGER, EOF, PLUS, Calc, CalcError def test_calc_raises_error_on_invalid_tokens(): """ Test that invalid tokens cause a ``CalcError`` and that the exception stack trace contains useful information. """ input_text = "lumberjack" # Now with 100% more Monty Python re...
input_text = "1+1" calc = Calc(text=input_text) calc.parse() assert calc.current_token.type == EOF def test_parse_raises_error_on_invalid_expression(): """ Test that attempting to parse an invalid expression allows a ``CalcError`` to propagate correctly. """ input_text = "+1" c...
random_line_split
test_calc.py
import pytest from calc import INTEGER, EOF, PLUS, Calc, CalcError def test_calc_raises_error_on_invalid_tokens(): """ Test that invalid tokens cause a ``CalcError`` and that the exception stack trace contains useful information. """ input_text = "lumberjack" # Now with 100% more Monty Python re...
def test_calc_can_consume_valid_token(): """Test that a :class:`Calc` can consume a valid :class:`Token`.""" input_text = "1+1" calc = Calc(text=input_text) # Note: Since _next_token advances position one cannot simply # >>> calc.current_token = Token(INTEGER, 1) # The _next_token method MUST...
""" Test that after consuming a solitary an INTEGER :class:`Token` a :class:`Calc` will correctly tokenize an EOF :class:`Token`. """ input_text = "1" calc = Calc(text=input_text) token = calc._next_token() assert token.type == INTEGER assert token.value == 1 assert calc._next_token(...
identifier_body
reducers011.js
/** * Copyright 2020 The Google Earth Engine Community 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...
/** * @fileoverview Earth Engine Developer's Guide examples * from 'Reducers - Image reduce' section */ // [START earthengine__reducers011__image_reduce] // Load an image and select some bands of interest. var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318') .select(['B4', 'B3', 'B2']); // Reduce...
* limitations under the License. */
random_line_split
struct-pattern-matching-with-methods.rs
// edition:2021 //check-pass #![warn(unused)] #![allow(dead_code)] #![feature(rustc_attrs)] #[derive(Debug, Clone, Copy)] enum PointType { TwoD { x: u32, y: u32 }, ThreeD{ x: u32, y: u32, z: u32 } } // Testing struct patterns struct Points { points: Vec<PointType>, } impl Points { pub fn test1(&mut ...
points.points.push(PointType::TwoD{ x:0, y:0 }); println!("{:?}", points.test1()); println!("{:?}", points.points); }
random_line_split
struct-pattern-matching-with-methods.rs
// edition:2021 //check-pass #![warn(unused)] #![allow(dead_code)] #![feature(rustc_attrs)] #[derive(Debug, Clone, Copy)] enum PointType { TwoD { x: u32, y: u32 }, ThreeD{ x: u32, y: u32, z: u32 } } // Testing struct patterns struct Points { points: Vec<PointType>, } impl Points { pub fn test1(&mut ...
() { let mut points = Points { points: Vec::<PointType>::new() }; points.points.push(PointType::ThreeD { x:0, y:0, z:0 }); points.points.push(PointType::TwoD{ x:0, y:0 }); points.points.push(PointType::ThreeD{ x:0, y:0, z:0 }); points.points.push(PointType::TwoD{ x:0, y:0 }); print...
main
identifier_name
struct-pattern-matching-with-methods.rs
// edition:2021 //check-pass #![warn(unused)] #![allow(dead_code)] #![feature(rustc_attrs)] #[derive(Debug, Clone, Copy)] enum PointType { TwoD { x: u32, y: u32 }, ThreeD{ x: u32, y: u32, z: u32 } } // Testing struct patterns struct Points { points: Vec<PointType>, } impl Points { pub fn test1(&mut ...
{ let mut points = Points { points: Vec::<PointType>::new() }; points.points.push(PointType::ThreeD { x:0, y:0, z:0 }); points.points.push(PointType::TwoD{ x:0, y:0 }); points.points.push(PointType::ThreeD{ x:0, y:0, z:0 }); points.points.push(PointType::TwoD{ x:0, y:0 }); println!...
identifier_body
function_expression-out.js
var a = function() { return 'b'; }; b = function doB(q, wer, ty) { var c = function(n) { return function() { return q + wer - ty; } } return c } this.foo = { bar: function() { var r = function() { re(); draw(); return log('foo') + 'bar'; }; }, ipsum: function(am...
// issue #143 if (!this._pollReceive) { this._pollReceive = nn.PollReceiveSocket(this.binding, function(events) { if (events) this._receive(); }.bind(this)); } // issue #283 var foo = function foo() { bar() } var foo = function() { bar() } // default params (#285) var defaultParams = function defaults...
var foo = new MyConstructor(function otherFunction() {});
random_line_split
env.rs
// Copyright 2013 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 fn max_cached_stacks() -> uint { unsafe { MAX_CACHED_STACKS } } pub fn debug_borrow() -> bool { unsafe { DEBUG_BORROW } }
{ unsafe { MIN_STACK } }
identifier_body
env.rs
// Copyright 2013 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 ...
None => () } } } pub fn min_stack() -> uint { unsafe { MIN_STACK } } pub fn max_cached_stacks() -> uint { unsafe { MAX_CACHED_STACKS } } pub fn debug_borrow() -> bool { unsafe { DEBUG_BORROW } }
random_line_split
env.rs
// Copyright 2013 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 ...
() { unsafe { match os::getenv("RUST_MIN_STACK") { Some(s) => match from_str(s) { Some(i) => MIN_STACK = i, None => () }, None => () } match os::getenv("RUST_MAX_CACHED_STACKS") { Some(max) => MAX_CACHED_STACKS =...
init
identifier_name
menu.component.ts
import * as moment from 'moment'; import { cloneDeep } from 'lodash'; import { IScope, IComponentOptions, IOnChangesObject } from 'angular'; import { RouterWrapper } from '../../../app/core'; import { IMenu, MenuService } from '../../models/menu'; import { IOrder, OrderService } from '../../models/order'; import { IL...
} // view helpers -------------------------------------------------------------- isOrdered(): boolean { return this.lineItemsAddedToOrder; } timeBeforeOrderImpossible(): string { return moment(this.menu.date).fromNow(); } isCustomLunch(): boolean { return this.customLunch; } isPredefi...
{ this.selectedLineItems = this.lLineItemService.removeItemFrom(this.selectedLineItems, item); }
conditional_block
menu.component.ts
import * as moment from 'moment'; import { cloneDeep } from 'lodash'; import { IScope, IComponentOptions, IOnChangesObject } from 'angular'; import { RouterWrapper } from '../../../app/core'; import { IMenu, MenuService } from '../../models/menu'; import { IOrder, OrderService } from '../../models/order'; import { IL...
this.triggerOrderPlaceEvent({order: this.order}); } orderAgain(): void { this.init(); this.lineItemsAddedToOrder = false; } goToBasket(): void { this.router.navigate(['/basket']); } onCustomizeLunch(): void { this.toggleCustomLunch(); } onLineItemToggled(inputItem: ILineItem, ch...
this.order = this.lOrderService.setLineItems(this.selectedLineItems, this.order); this.lineItemsAddedToOrder = true;
random_line_split
menu.component.ts
import * as moment from 'moment'; import { cloneDeep } from 'lodash'; import { IScope, IComponentOptions, IOnChangesObject } from 'angular'; import { RouterWrapper } from '../../../app/core'; import { IMenu, MenuService } from '../../models/menu'; import { IOrder, OrderService } from '../../models/order'; import { IL...
s['menu']) { // tslint:disable-line:no-string-literal this.onInputMenuChanged(this.menu); } } private init(): void { this.initOrder(); this.initSize(); this.initLunchCustomization(); } private initOrder(): void { this.order = this.lOrderService.createOrderByDate(this.menu.date); ...
if (change
identifier_name
menu.component.ts
import * as moment from 'moment'; import { cloneDeep } from 'lodash'; import { IScope, IComponentOptions, IOnChangesObject } from 'angular'; import { RouterWrapper } from '../../../app/core'; import { IMenu, MenuService } from '../../models/menu'; import { IOrder, OrderService } from '../../models/order'; import { IL...
// view helpers -------------------------------------------------------------- isOrdered(): boolean { return this.lineItemsAddedToOrder; } timeBeforeOrderImpossible(): string { return moment(this.menu.date).fromNow(); } isCustomLunch(): boolean { return this.customLunch; } isPredefinedL...
{ let item = this.lLineItemService.setSizeFor(inputItem, this.size); if (checked) { this.selectedLineItems = this.lLineItemService.addItemTo(this.selectedLineItems, item); } else { this.selectedLineItems = this.lLineItemService.removeItemFrom(this.selectedLineItems, item); } }
identifier_body
issue-49973.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 ...
{ Min = -2147483648i32, _Max = 2147483647i32, } fn main() { assert_eq!(Some(E::Min).unwrap() as i32, -2147483648i32); }
E
identifier_name
issue-49973.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!(Some(E::Min).unwrap() as i32, -2147483648i32); }
random_line_split
issue-49973.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!(Some(E::Min).unwrap() as i32, -2147483648i32); }
identifier_body
unboxed-closure-sugar-region.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 ...
fn same_type<A,B:Eq<A>>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(int,),()>, Foo(int) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. eq::<...
impl<X> Eq<X> for X { } fn eq<A,B:Eq<A>>() { }
random_line_split
unboxed-closure-sugar-region.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 ...
fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(int,),()>, Foo(int) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. eq::< Foo<'static, (int,),()>, ...
{ }
identifier_body
unboxed-closure-sugar-region.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 ...
<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(int,),()>, Foo(int) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. eq::< Foo<'static, (int,),()>, Foo(int)...
test
identifier_name
slave.js
'use strict'; // not using ES6 import/export syntax, since we need to require() in a handler // what the ES6 syntax does not permit var vm = require('vm'); var errorCatcherInPlace = false; var messageHandler = function messageHandler() { console.error('No thread logic initialized.'); // eslint-disable-line no-conso...
if (data.doRun) { // it's a good idea to wait until first thread logic run to set this up, // so initialization errors will be printed to console setupErrorCatcher(); messageHandler(data.param, messageHandlerDone, messageHandlerProgress); } }); //# sourceMappingURL=slave.js.map
{ messageHandler = runAsSandboxedModule('module.exports = ' + data.method); }
conditional_block
slave.js
'use strict'; // not using ES6 import/export syntax, since we need to require() in a handler
// what the ES6 syntax does not permit var vm = require('vm'); var errorCatcherInPlace = false; var messageHandler = function messageHandler() { console.error('No thread logic initialized.'); // eslint-disable-line no-console }; function setupErrorCatcher() { if (errorCatcherInPlace) { return; } process....
random_line_split
slave.js
'use strict'; // not using ES6 import/export syntax, since we need to require() in a handler // what the ES6 syntax does not permit var vm = require('vm'); var errorCatcherInPlace = false; var messageHandler = function messageHandler() { console.error('No thread logic initialized.'); // eslint-disable-line no-conso...
function runAsSandboxedModule(code) { var sandbox = { Buffer: Buffer, console: console, clearInterval: clearInterval, clearTimeout: clearTimeout, module: { exports: null }, require: require, setInterval: setInterval, setTimeout: setTimeout }; vm.runInNewContext(code, sandbox); ...
{ if (errorCatcherInPlace) { return; } process.on('uncaughtException', function (error) { process.send({ error: { message: error.message, stack: error.stack } }); }); errorCatcherInPlace = true; }
identifier_body
slave.js
'use strict'; // not using ES6 import/export syntax, since we need to require() in a handler // what the ES6 syntax does not permit var vm = require('vm'); var errorCatcherInPlace = false; var messageHandler = function messageHandler() { console.error('No thread logic initialized.'); // eslint-disable-line no-conso...
() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } process.send({ response: args }); } messageHandlerDone.transfer = function () { for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[...
messageHandlerDone
identifier_name