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
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place,...
random_line_split
manager.rs
use super::*; use crate::app::{ddns, settings, user, vfs}; #[derive(Clone)] pub struct Manager { settings_manager: settings::Manager, user_manager: user::Manager, vfs_manager: vfs::Manager, ddns_manager: ddns::Manager, } impl Manager { pub fn new( settings_manager: settings::Manager, user_manager: user::Mana...
pub fn apply(&self, config: &Config) -> Result<(), Error> { if let Some(new_settings) = &config.settings { self.settings_manager .amend(new_settings) .map_err(|_| Error::Unspecified)?; } if let Some(mount_dirs) = &config.mount_dirs { self.vfs_manager .set_mount_dirs(&mount_dirs) .map_err...
{ Self { settings_manager, user_manager, vfs_manager, ddns_manager, } }
identifier_body
manager.rs
use super::*; use crate::app::{ddns, settings, user, vfs}; #[derive(Clone)] pub struct Manager { settings_manager: settings::Manager, user_manager: user::Manager, vfs_manager: vfs::Manager, ddns_manager: ddns::Manager, } impl Manager { pub fn new( settings_manager: settings::Manager, user_manager: user::Mana...
for old_user in old_users .iter() .filter(|old_user| !users.iter().any(|u| u.name == old_user.name)) { self.user_manager .delete(&old_user.name) .map_err(|_| Error::Unspecified)?; } // Insert new users for new_user in users .iter() .filter(|u| !old_users.iter().any(|old_use...
// Delete users that are not in new list
random_line_split
manager.rs
use super::*; use crate::app::{ddns, settings, user, vfs}; #[derive(Clone)] pub struct
{ settings_manager: settings::Manager, user_manager: user::Manager, vfs_manager: vfs::Manager, ddns_manager: ddns::Manager, } impl Manager { pub fn new( settings_manager: settings::Manager, user_manager: user::Manager, vfs_manager: vfs::Manager, ddns_manager: ddns::Manager, ) -> Self { Self { setti...
Manager
identifier_name
manager.rs
use super::*; use crate::app::{ddns, settings, user, vfs}; #[derive(Clone)] pub struct Manager { settings_manager: settings::Manager, user_manager: user::Manager, vfs_manager: vfs::Manager, ddns_manager: ddns::Manager, } impl Manager { pub fn new( settings_manager: settings::Manager, user_manager: user::Mana...
if let Some(ddns_config) = &config.ydns { self.ddns_manager .set_config(&ddns_config) .map_err(|_| Error::Unspecified)?; } if let Some(ref users) = config.users { let old_users: Vec<user::User> = self.user_manager.list().map_err(|_| Error::Unspecified)?; // Delete users that are not in ne...
{ self.vfs_manager .set_mount_dirs(&mount_dirs) .map_err(|_| Error::Unspecified)?; }
conditional_block
insert_usage_mysql.rs
use chrono::{offset::Utc, DateTime}; use rustorm::{pool, DbError, FromDao, Pool, ToColumnNames, ToDao, ToTableName}; /// Run using: /// ```sh /// cargo run --example insert_usage_mysql --features "with-mysql" /// ``` fn main() { mod for_insert { use super::*; #[derive(Debug, PartialEq, ToDao, ToCol...
}; let tom_hanks = for_insert::Actor { first_name: "TOM".into(), last_name: "HANKS".to_string(), }; println!("tom_cruise: {:#?}", tom_cruise); println!("tom_hanks: {:#?}", tom_hanks); let actors: Result<Vec<for_retrieve::Actor>, DbError> = em.insert(&[&tom_cruise, &tom_hanks]); ...
random_line_split
insert_usage_mysql.rs
use chrono::{offset::Utc, DateTime}; use rustorm::{pool, DbError, FromDao, Pool, ToColumnNames, ToDao, ToTableName}; /// Run using: /// ```sh /// cargo run --example insert_usage_mysql --features "with-mysql" /// ``` fn
() { mod for_insert { use super::*; #[derive(Debug, PartialEq, ToDao, ToColumnNames, ToTableName)] pub struct Actor { pub first_name: String, pub last_name: String, } } mod for_retrieve { use super::*; #[derive(Debug, FromDao, ToColumn...
main
identifier_name
usersfiles.py
# -*- coding: UTF-8 -*- """ Copyright (C) 2015 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
raise ResolverError('Unable to find userfiles video') def get_url(self, host, media_id): return 'http://usersfiles.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False ...
random_line_split
usersfiles.py
# -*- coding: UTF-8 -*- """ Copyright (C) 2015 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
def get_url(self, host, media_id): return 'http://usersfiles.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(sel...
web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content match = re.search('<script[^>]*>(eval.*?)</script>', html, re.DOTALL) if match: js_data = jsunpack.unpack(match.group(1)) stream_url = re.findall('<param\s+name="src"\s*value="([^"]+)', js_d...
identifier_body
usersfiles.py
# -*- coding: UTF-8 -*- """ Copyright (C) 2015 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
(self): self.net = common.Net() self.net.set_user_agent(common.IE_USER_AGENT) self.headers = {'User-Agent': common.IE_USER_AGENT} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content match = re.sear...
__init__
identifier_name
usersfiles.py
# -*- coding: UTF-8 -*- """ Copyright (C) 2015 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
return False
conditional_block
resolver.js
ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; nodes = require('./nodes'); util = requi...
{ this.constructor = child; }
identifier_body
resolver.js
ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; nodes = require('./nodes'); util = require('./util'); YAMLError = require('./errors').YAMLErro...
implicit = implicit[1]; } empty = true; for (k in this.yaml_path_resolvers) { if ({}[k] == null) { empty = false; } } if (!empty) { exact_paths = this.resolver_exact_paths.slice(-1)[0]; if (__indexOf.call(exact_paths, kind) >= 0) { ...
{ _ref4 = resolvers[_i], tag = _ref4[0], regexp = _ref4[1]; if (value.match(regexp)) { return tag; } }
conditional_block
resolver.js
() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; nodes = req...
ctor
identifier_name
resolver.js
new ctor(); child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; nodes = require('./nodes'); util = require('./util'); YAMLError = require('./errors').YAML...
return; } if (typeof index_check === 'string') { if (!(current_index instanceof nodes.ScalarNode) && index_check === current_index.value) { return; } } else if (typeof index_check === 'number') { if (index_check !== current_index) { return; }...
} if (index_check === true && current_index !== null) { return; } if ((index_check === false || index_check === null) && current_index === null) {
random_line_split
util.py
# Copyright (c) 2015-2017 Cisco Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge...
(options): verbose = 'v' verbose_flag = [] for i in range(0, 3): if options.get(verbose): verbose_flag = ['-{}'.format(verbose)] del options[verbose] if options.get('verbose'): del options['verbose'] break verbose = verbose + 'v...
verbose_flag
identifier_name
util.py
# Copyright (c) 2015-2017 Cisco Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge...
def safe_load_file(filename): """ Parse the provided YAML file and returns a dict. :param filename: A string containing an absolute path to the file to parse. :return: dict """ with open(filename, 'r') as stream: return safe_load(stream) def instance_with_scenario_name(instance_nam...
""" Parse the provided string returns a dict. :param string: A string to be parsed. :return: dict """ return yaml.safe_load(string) or {}
identifier_body
util.py
# Copyright (c) 2015-2017 Cisco Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge...
return cmd() def os_walk(directory, pattern): for root, _, files in os.walk(directory): for basename in files: if fnmatch.fnmatch(basename, pattern): filename = os.path.join(root, basename) yield filename def render_template(template, **kwargs): t = ...
print_environment_vars(cmd._partial_call_args.get('env', {})) print_debug('COMMAND', str(cmd))
conditional_block
util.py
# Copyright (c) 2015-2017 Cisco Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge...
def safe_load(string): """ Parse the provided string returns a dict. :param string: A string to be parsed. :return: dict """ return yaml.safe_load(string) or {} def safe_load_file(filename): """ Parse the provided YAML file and returns a dict. :param filename: A string containing...
random_line_split
ConnectedInventoryItem.tsx
import { RootState } from 'app/store/types'; import _ from 'lodash'; import React from 'react'; import { connect } from 'react-redux'; import { searchFilterSelector } from '../search/search-filter'; import { wishListSelector } from '../wishlists/selectors'; import { InventoryWishListRoll } from '../wishlists/wishlists'...
(state: RootState, props: ProvidedProps): StoreProps { const { item, dimArchived } = props; const itemInfos = itemInfosSelector(state); const itemHashTags = itemHashTagsSelector(state); const tag = getTag(item, itemInfos, itemHashTags); const currentFilter = searchFilterSelector(state); const defaultFilterA...
mapStateToProps
identifier_name
ConnectedInventoryItem.tsx
import { RootState } from 'app/store/types'; import _ from 'lodash'; import React from 'react'; import { connect } from 'react-redux'; import { searchFilterSelector } from '../search/search-filter'; import { wishListSelector } from '../wishlists/selectors'; import { InventoryWishListRoll } from '../wishlists/wishlists'...
export default connect<StoreProps>(mapStateToProps)(ConnectedInventoryItem);
{ return ( <InventoryItem item={item} id={id} isNew={isNew} tag={tag} notes={notes} wishlistRoll={wishlistRoll} onClick={onClick} onShiftClick={onShiftClick} onDoubleClick={onDoubleClick} searchHidden={searchHidden} ignoreSelectedPerks={ignoreSelec...
identifier_body
ConnectedInventoryItem.tsx
import { RootState } from 'app/store/types'; import _ from 'lodash'; import React from 'react'; import { connect } from 'react-redux'; import { searchFilterSelector } from '../search/search-filter'; import { wishListSelector } from '../wishlists/selectors'; import { InventoryWishListRoll } from '../wishlists/wishlists'...
searchHidden?: boolean; } function mapStateToProps(state: RootState, props: ProvidedProps): StoreProps { const { item, dimArchived } = props; const itemInfos = itemInfosSelector(state); const itemHashTags = itemHashTagsSelector(state); const tag = getTag(item, itemInfos, itemHashTags); const currentFilter ...
random_line_split
grpcProxy.py
# file LICENSE or http://www.opensource.org/licenses/mit-license.php. import argparse import os import simplejson as json import grpc from google.protobuf.json_format import MessageToJson from qrl.core import config from qrl.core.AddressState import AddressState from qrl.crypto.xmss import XMSS from qrl.core.txs.Trans...
@api.dispatcher.add_method def getblockheaderbyheight(height): return getlastblockheader(height) @api.dispatcher.add_method def getblocktemplate(reserve_size, wallet_address): stub = get_mining_stub() request = qrlmining_pb2.GetBlockToMineReq(wallet_address=wallet_address.encode()) grpc_response = ...
stub = get_mining_stub() request = qrlmining_pb2.GetLastBlockHeaderReq(height=height) grpc_response = stub.GetLastBlockHeader(request=request, timeout=10) block_header = { 'difficulty': grpc_response.difficulty, 'height': grpc_response.height, 'timestamp': grpc_response.timestamp, ...
identifier_body
grpcProxy.py
# file LICENSE or http://www.opensource.org/licenses/mit-license.php. import argparse import os import simplejson as json import grpc from google.protobuf.json_format import MessageToJson from qrl.core import config from qrl.core.AddressState import AddressState from qrl.crypto.xmss import XMSS from qrl.core.txs.Trans...
if not valid_payment_permission(public_stub, master_address_state, payment_xmss, payment_slaves[2]): return None return payment_xmss @app.route('/api/<api_method_name>') def api_proxy(api_method_name): """ Proxy JSON RPC requests to the gRPC server as well as converts back gRPC response ...
unused_ots_found = False for slave_seed in payment_slaves[1]: xmss = XMSS.from_extended_seed(slave_seed) addr_state = get_addr_state(xmss.address) if set_unused_ots_key(xmss, addr_state): # Unused ots_key_found payment_xmss = xmss unused_ots_f...
conditional_block
grpcProxy.py
# file LICENSE or http://www.opensource.org/licenses/mit-license.php. import argparse import os import simplejson as json import grpc from google.protobuf.json_format import MessageToJson from qrl.core import config from qrl.core.AddressState import AddressState from qrl.crypto.xmss import XMSS from qrl.core.txs.Transa...
(blob): stub = get_mining_stub() request = qrlmining_pb2.SubmitMinedBlockReq(blob=bytes(hstr2bin(blob))) response = stub.SubmitMinedBlock(request=request, timeout=10) if response.error: raise Exception # Mining pool expected exception when block submission fails return MessageToJson(respons...
submitblock
identifier_name
grpcProxy.py
# file LICENSE or http://www.opensource.org/licenses/mit-license.php. import argparse import os import simplejson as json import grpc from google.protobuf.json_format import MessageToJson from qrl.core import config from qrl.core.AddressState import AddressState from qrl.crypto.xmss import XMSS from qrl.core.txs.Trans...
response = stub.PushTransaction(request=qrl_pb2.PushTransactionReq(transaction_signed=tx.pbdata)) if response.error_code != 3: raise Exception('Transaction Submission Failed, Response Code: %s', response.error_code) response = {'tx_hash': bin2hstr(tx.txhash)} return response app.add_url_rul...
master_addr=payment_slaves[0]) tx.sign(xmss)
random_line_split
urls.py
"""todolist URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^app/', include("todoListApp.urls")), ]
"""
random_line_split
randomplay.rs
//! A bot playing randomly, but still following the rules.
pub fn genmove(goban: &mut board::Board, player: board::Colour) -> board::Vertex { let size = goban.get_size(); let mut rng = task_rng(); let mut i = 0u; // try at most 10 random moves while i < 10 { let (x, y) = (rng.gen_range(1u, size+1), rng.gen_range(1u, size+1)); if goban.play(p...
use std::rand::{task_rng, Rng}; use board;
random_line_split
randomplay.rs
//! A bot playing randomly, but still following the rules. use std::rand::{task_rng, Rng}; use board; pub fn genmove(goban: &mut board::Board, player: board::Colour) -> board::Vertex { let size = goban.get_size(); let mut rng = task_rng(); let mut i = 0u; // try at most 10 random moves while i < ...
i = i+1; } // if we reach this point, random failed, we go for a more deterministic // approach for x in range(1u, size+1) { for y in range(1u, size+1) { if goban.play(player, x, y){ return board::Put(x,y); } } } // can play nothin...
{ return board::Put(x,y); }
conditional_block
randomplay.rs
//! A bot playing randomly, but still following the rules. use std::rand::{task_rng, Rng}; use board; pub fn
(goban: &mut board::Board, player: board::Colour) -> board::Vertex { let size = goban.get_size(); let mut rng = task_rng(); let mut i = 0u; // try at most 10 random moves while i < 10 { let (x, y) = (rng.gen_range(1u, size+1), rng.gen_range(1u, size+1)); if goban.play(player, x, y){ ...
genmove
identifier_name
randomplay.rs
//! A bot playing randomly, but still following the rules. use std::rand::{task_rng, Rng}; use board; pub fn genmove(goban: &mut board::Board, player: board::Colour) -> board::Vertex
} // can play nothing ? board::Pass }
{ let size = goban.get_size(); let mut rng = task_rng(); let mut i = 0u; // try at most 10 random moves while i < 10 { let (x, y) = (rng.gen_range(1u, size+1), rng.gen_range(1u, size+1)); if goban.play(player, x, y){ return board::Put(x,y); } i = i+1; ...
identifier_body
lasoverlapPro.py
# -*- coding: utf-8 -*- """ *************************************************************************** lasoverlapPro.py --------------------- Date : October 2014 Copyright : (C) 2014 by Martin Isenburg Email : martin near rapidlasso point com *************...
self.addParametersCoresGUI() self.addParametersVerboseGUI() def processAlgorithm(self, progress): commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasoverlap")] self.addParametersVerboseCommands(commands) self.addParametersPointInputFolderCommands(commands) ...
self.name = "lasoverlapPro" self.group = "LAStools Production" self.addParametersPointInputFolderGUI() self.addParametersFilesAreFlightlinesGUI() self.addParametersFilter1ReturnClassFlagsGUI() self.addParameter(ParameterNumber(lasoverlapPro.CHECK_STEP, self.tr("size o...
identifier_body
lasoverlapPro.py
# -*- coding: utf-8 -*- """ *************************************************************************** lasoverlapPro.py --------------------- Date : October 2014 Copyright : (C) 2014 by Martin Isenburg Email : martin near rapidlasso point com *************...
import os from LAStoolsUtils import LAStoolsUtils from LAStoolsAlgorithm import LAStoolsAlgorithm from processing.core.parameters import ParameterBoolean from processing.core.parameters import ParameterNumber from processing.core.parameters import ParameterSelection class lasoverlapPro(LAStoolsAlgorithm): CHECK...
__revision__ = '$Format:%H$'
random_line_split
lasoverlapPro.py
# -*- coding: utf-8 -*- """ *************************************************************************** lasoverlapPro.py --------------------- Date : October 2014 Copyright : (C) 2014 by Martin Isenburg Email : martin near rapidlasso point com *************...
(LAStoolsAlgorithm): CHECK_STEP = "CHECK_STEP" ATTRIBUTE = "ATTRIBUTE" OPERATION = "OPERATION" ATTRIBUTES = ["elevation", "intensity", "number_of_returns", "scan_angle_abs", "density"] OPERATIONS = ["lowest", "highest", "average"] CREATE_OVERLAP_RASTER = "CREATE_OVERLAP_RASTER" CREATE_DIFFE...
lasoverlapPro
identifier_name
lasoverlapPro.py
# -*- coding: utf-8 -*- """ *************************************************************************** lasoverlapPro.py --------------------- Date : October 2014 Copyright : (C) 2014 by Martin Isenburg Email : martin near rapidlasso point com *************...
commands.append("-values") attribute = self.getParameterValue(lasoverlapPro.ATTRIBUTE) if attribute != 0: commands.append("-" + lasoverlapPro.ATTRIBUTES[attribute]) operation = self.getParameterValue(lasoverlapPro.OPERATION) if operation != 0: commands.ap...
commands.append("-step") commands.append(str(step))
conditional_block
performancetiming.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformanceTimingBinding; use dom::bindings::js::{JSRef, Temporary}; use dom...
{ reflector_: Reflector, navigationStart: u64, navigationStartPrecise: f64, } impl PerformanceTiming { pub fn new_inherited(navStart: u64, navStartPrecise: f64) -> PerformanceTiming { PerformanceTiming { reflector_: Reflector::new(), navigationS...
PerformanceTiming
identifier_name
performancetiming.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformanceTimingBinding; use dom::bindings::js::{JSRef, Temporary}; use dom...
} impl<'a> PerformanceTimingMethods for JSRef<'a, PerformanceTiming> { fn NavigationStart(&self) -> u64 { self.navigationStart } fn NavigationStartPrecise(&self) -> f64 { self.navigationStartPrecise } } impl Reflectable for PerformanceTiming { fn reflector<'a>(&'a self) -> &'a Ref...
} pub trait PerformanceTimingMethods { fn NavigationStart(&self) -> u64; fn NavigationStartPrecise(&self) -> f64;
random_line_split
listener.js
/* * written by @alicelieutier */ var Listener = function(audioContext) { var analyserNode = null; var freqByteData = null; var inputPoint = null; var lastLog = 0; var start = 0; var that = {}; var intervalID = null; var ready = false; var onBeepCalled = false; var ob_callback = null; var ob_int...
// Create an AudioNode from the stream. audioInput = audioContext.createMediaStreamSource(stream); audioInput.connect(inputPoint); analyserNode = audioContext.createAnalyser(); analyserNode.fftSize = 2048; inputPoint.connect( analyserNode ); zeroGain = audioContext.createGain(); zeroGa...
random_line_split
listener.js
/* * written by @alicelieutier */ var Listener = function(audioContext) { var analyserNode = null; var freqByteData = null; var inputPoint = null; var lastLog = 0; var start = 0; var that = {}; var intervalID = null; var ready = false; var onBeepCalled = false; var ob_callback = null; var ob_int...
} navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); navigator.getMedia( {audio:true}, gotStream, function(e) { alert('Error getting audio'...
{ that.onBeep(ob_callback, ob_interval); }
conditional_block
listener.js
/* * written by @alicelieutier */ var Listener = function(audioContext) { var analyserNode = null; var freqByteData = null; var inputPoint = null; var lastLog = 0; var start = 0; var that = {}; var intervalID = null; var ready = false; var onBeepCalled = false; var ob_callback = null; var ob_int...
function gotStream(stream, callback) { inputPoint = audioContext.createGain(); // Create an AudioNode from the stream. audioInput = audioContext.createMediaStreamSource(stream); audioInput.connect(inputPoint); analyserNode = audioContext.createAnalyser(); analyserNode.fftSize = 2048; i...
{ analyserNode.getByteFrequencyData(freqByteData); var samplerate = audioContext.sampleRate; var fftsize = analyserNode.fftSize; var antifreqs = [freq - REDUCE_BAND, freq + REDUCE_BAND]; var sound = freqByteData[Math.round(freq * fftsize / samplerate)]; for (var i = 0; i < antifreqs.length; i++...
identifier_body
listener.js
/* * written by @alicelieutier */ var Listener = function(audioContext) { var analyserNode = null; var freqByteData = null; var inputPoint = null; var lastLog = 0; var start = 0; var that = {}; var intervalID = null; var ready = false; var onBeepCalled = false; var ob_callback = null; var ob_int...
(){ analyserNode.getByteFrequencyData(freqByteData); var samplerate = audioContext.sampleRate; var fftsize = analyserNode.fftSize; var antifreqs = [freq - REDUCE_BAND, freq + REDUCE_BAND]; var sound = freqByteData[Math.round(freq * fftsize / samplerate)]; for (var i = 0; i < antifreqs.length; i...
updateAnalyser
identifier_name
rare-osr-exit-on-local.js
// This program attempts to relatively rare OSR exits due to mispredictions // on the value of a local variable, where the basic block in which the local // is assigned the offending value is different than the basic block in which // the misspeculation occurs. The occurrence of the value that causes // speculation fai...
var array = [1,2,3,4,5,6,7,8,9,10]; var result = 0; for (var i = 0; i < 300; ++i) { var v = i; if (i <= 100 || (i%4)) v = {f:{h:v}, g:{h:v+1}, h:array}; else v = {f:(i%3)==0, g:((i+1)%3)==0, h:array}; result += foo(v,(i%2)==0); } if (result != 16500033) throw "Bad result: " + re...
{ var x; // Assign to the value on one of two basic blocks. if (p) x = o.f; else x = o.g; var y = !x; var z = o.h; var w = 0; for (var i = 0; i < 10000; ++i) w += z[i%10]; return w + (y?1:0); }
identifier_body
rare-osr-exit-on-local.js
// This program attempts to relatively rare OSR exits due to mispredictions // on the value of a local variable, where the basic block in which the local // is assigned the offending value is different than the basic block in which // the misspeculation occurs. The occurrence of the value that causes // speculation fai...
} var array = [1,2,3,4,5,6,7,8,9,10]; var result = 0; for (var i = 0; i < 300; ++i) { var v = i; if (i <= 100 || (i%4)) v = {f:{h:v}, g:{h:v+1}, h:array}; else v = {f:(i%3)==0, g:((i+1)%3)==0, h:array}; result += foo(v,(i%2)==0); } if (result != 16500033) throw "Bad result: " + r...
var z = o.h; var w = 0; for (var i = 0; i < 10000; ++i) w += z[i%10]; return w + (y?1:0);
random_line_split
rare-osr-exit-on-local.js
// This program attempts to relatively rare OSR exits due to mispredictions // on the value of a local variable, where the basic block in which the local // is assigned the offending value is different than the basic block in which // the misspeculation occurs. The occurrence of the value that causes // speculation fai...
(o,p) { var x; // Assign to the value on one of two basic blocks. if (p) x = o.f; else x = o.g; var y = !x; var z = o.h; var w = 0; for (var i = 0; i < 10000; ++i) w += z[i%10]; return w + (y?1:0); } var array = [1,2,3,4,5,6,7,8,9,10]; var result = 0; for (...
foo
identifier_name
key.rs
use anyhow::{anyhow, Context, Result}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use serde::{ de::{self, Deserializer, Visitor}, Deserialize, Serialize, Serializer, }; use smallvec::SmallVec; use std::{ convert::{TryFrom, TryInto}, ops::Deref, result, }; #[derive(Debug, Clone, Copy, ...
key if key.starts_with('f') => { let num = key[1..].parse().context("invalid F key")?; if !(1..=12).contains(&num) { return Err(anyhow!("F key must be between 1-12")); } KeyCode::F(num) } unknown =...
{ let bytes = key.as_bytes(); KeyCode::Char(bytes[0] as char) }
conditional_block
key.rs
use anyhow::{anyhow, Context, Result}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use serde::{ de::{self, Deserializer, Visitor}, Deserialize, Serialize, Serializer, }; use smallvec::SmallVec; use std::{ convert::{TryFrom, TryInto}, ops::Deref, result, }; #[derive(Debug, Clone, Copy, ...
} impl Deref for Key { type Target = KeyCode; fn deref(&self) -> &Self::Target { &self.0.code } } impl TryFrom<&str> for Key { type Error = anyhow::Error; fn try_from(value: &str) -> Result<Self, Self::Error> { let value = value.to_ascii_lowercase(); let modifier_split =...
{ self.0.modifiers.contains(KeyModifiers::CONTROL) }
identifier_body
key.rs
use anyhow::{anyhow, Context, Result}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use serde::{ de::{self, Deserializer, Visitor}, Deserialize, Serialize, Serializer, }; use smallvec::SmallVec; use std::{ convert::{TryFrom, TryInto}, ops::Deref, result, }; #[derive(Debug, Clone, Copy, ...
() { test_key!("j", KeyCode::Char('j') => KeyModifiers::NONE); test_key!("f1", KeyCode::F(1) => KeyModifiers::NONE); test_key!("K", KeyCode::Char('k') => KeyModifiers::NONE); test_key!("ctrl+b", KeyCode::Char('b') => KeyModifiers::CONTROL); test_key!("CTRL+B", KeyCode::Char('b') ...
valid_keys
identifier_name
key.rs
use anyhow::{anyhow, Context, Result}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use serde::{ de::{self, Deserializer, Visitor}, Deserialize, Serialize, Serializer, }; use smallvec::SmallVec; use std::{ convert::{TryFrom, TryInto}, ops::Deref, result, }; #[derive(Debug, Clone, Copy, ...
"pageup" => KeyCode::PageUp, "pagedown" => KeyCode::PageDown, "tab" => KeyCode::Tab, "backtab" => KeyCode::BackTab, "delete" => KeyCode::Delete, "insert" => KeyCode::Insert, "unknown" => KeyCode::Null, "escape" => KeyCode::E...
"end" => KeyCode::End,
random_line_split
lang_items.rs
items: Vec<Option<ast::DefId>>, pub missing: Vec<LangItem>, } impl LanguageItems { pub fn new() -> LanguageItems { fn foo(_: LangItem) -> Option<ast::DefId> { None } LanguageItems { items: vec!($(foo($variant)),*), missing: Vec::new(), } } pub fn items...
DerefTraitLangItem, "deref", deref_trait; DerefMutTraitLangItem, "deref_mut", deref_mut_trait;
random_line_split
upsertMany.js
'use strict' const MongoClient = require('mongodb').MongoClient const muri = require('muri') const chai = require('chai') const expect = chai.expect const assert = chai.assert const chaiSubset = require('chai-subset') chai.use(chaiSubset) chai.should() const stringConnection = 'mongodb://localhost:27017/lambda-mongo...
it('should return an array', (done) => { const data = [ { title: "Title 2", code: 2 }, { title: "Title 3bis", code: 3 }, { title: "Title 4", code: 4 }, { title: "Title 5", code: 5 } ] crud.upsertMany(data, "code", PERMISSION.save, {}, (err, result) => { ...
})
random_line_split
partial-node.ts
import Asset from '../model/asset'; import FunctionObject from '../model/function-object'; import { GeneratorService } from '../generate/generator-service'; import GlobalNode from './global-node'; import HelperNode from './helper-node'; import ImageNode from './image-node'; import ImageResource from '../model/image-res...
(dependencies: any[]): Promise<IPartialMap> { return new Promise((resolve: (data: any) => void, reject: (data: any) => void) => { let globals = <{ [key: string]: any }> dependencies[0]; let helpers = <{ [key: string]: FunctionObject }> dependencies[1]; let images = <{ [name: string]: ImageResource...
runHandler_
identifier_name
partial-node.ts
import Asset from '../model/asset'; import FunctionObject from '../model/function-object'; import { GeneratorService } from '../generate/generator-service'; import GlobalNode from './global-node'; import HelperNode from './helper-node'; import ImageNode from './image-node'; import ImageResource from '../model/image-res...
let results = {}; let generator = this.generatorService_ .createGenerator(globals, helpers, images, {} /* partials */); for (let partialName in this.asset_.partials) { let partialString = this.asset_.partials[partialName]; results[partialName] = {}; for ...
try {
random_line_split
issue-2311-2.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 ...
<A>(b: A) -> foo<A> { foo { x: b } } pub fn main() { }
foo
identifier_name
issue-2311-2.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 ...
trait clam<A> { fn get(self) -> A; } struct foo<A> { x: A, } impl<A> foo<A> { pub fn bar<B,C:clam<A>>(&self, _c: C) -> B { panic!(); } } fn foo<A>(b: A) -> foo<A> { foo { x: b } } pub fn main() { }
// except according to those terms.
random_line_split
settings.py
""" Django settings for web project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import...
INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MutationInfoApp', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', '...
# Application definition
random_line_split
event_frequent.py
import os, sys origin_dir = 'del_201304now/' new_dir = 'freq_event_state/' files = os.listdir(origin_dir) state_dir = {} country_dir = {} for file in files: with open(origin_dir + file) as f: event_dir = {} for line in f: tmp_content = line.split('\t') code = tmp_content[4] ...
with open(dir_path+file, 'a') as writer: for event, freq in states.items(): writer.write(event+': '+str(freq)+'\n')
os.makedirs(dir_path)
conditional_block
event_frequent.py
origin_dir = 'del_201304now/' new_dir = 'freq_event_state/' files = os.listdir(origin_dir) state_dir = {} country_dir = {} for file in files: with open(origin_dir + file) as f: event_dir = {} for line in f: tmp_content = line.split('\t') code = tmp_content[4] loc...
import os, sys
random_line_split
helloworld.py
import time import http.server import os HOST_NAME = '0.0.0.0' # Host name of the http server # Gets the port number from $PORT0 environment variable PORT_NUMBER = int(os.environ['PORT0']) class MyHandler(http.server.BaseHTTPRequestHandler): def do_GET(s): """Respond to a GET request.""" s.send_r...
server_class = http.server.HTTPServer httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler) print(time.asctime(), "Server Starts - {}:{}".format(HOST_NAME, PORT_NUMBER)) try: httpd.serve_forever() except KeyboardInterrupt: pass httpd.server_close() print(time.asctime(), "...
s.wfile.write("</body></html>") if __name__ == '__main__':
random_line_split
helloworld.py
import time import http.server import os HOST_NAME = '0.0.0.0' # Host name of the http server # Gets the port number from $PORT0 environment variable PORT_NUMBER = int(os.environ['PORT0']) class MyHandler(http.server.BaseHTTPRequestHandler): def
(s): """Respond to a GET request.""" s.send_response(200) s.send_header("Content-type", "text/html") s.end_headers() s.wfile.write("<html><head><title>Time Server</title></head>") s.wfile.write("<body><p>The current time is {}</p>".format(time.asctime())) s.wfile....
do_GET
identifier_name
helloworld.py
import time import http.server import os HOST_NAME = '0.0.0.0' # Host name of the http server # Gets the port number from $PORT0 environment variable PORT_NUMBER = int(os.environ['PORT0']) class MyHandler(http.server.BaseHTTPRequestHandler): def do_GET(s):
if __name__ == '__main__': server_class = http.server.HTTPServer httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler) print(time.asctime(), "Server Starts - {}:{}".format(HOST_NAME, PORT_NUMBER)) try: httpd.serve_forever() except KeyboardInterrupt: pass httpd.server_close(...
"""Respond to a GET request.""" s.send_response(200) s.send_header("Content-type", "text/html") s.end_headers() s.wfile.write("<html><head><title>Time Server</title></head>") s.wfile.write("<body><p>The current time is {}</p>".format(time.asctime())) s.wfile.write("</body...
identifier_body
helloworld.py
import time import http.server import os HOST_NAME = '0.0.0.0' # Host name of the http server # Gets the port number from $PORT0 environment variable PORT_NUMBER = int(os.environ['PORT0']) class MyHandler(http.server.BaseHTTPRequestHandler): def do_GET(s): """Respond to a GET request.""" s.send_r...
server_class = http.server.HTTPServer httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler) print(time.asctime(), "Server Starts - {}:{}".format(HOST_NAME, PORT_NUMBER)) try: httpd.serve_forever() except KeyboardInterrupt: pass httpd.server_close() print(time.asctime(), "Serv...
conditional_block
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.match("__version__ = ['...
version = get_version('blog') if sys.argv[-1] == 'publish': os.system("python setup.py sdist upload") print("You probably want to also tag the version now:") print(" git tag -a %s -m 'version %s'" % (version, version)) print(" git push --tags") sys.exit() setup( name='django-blog-sl', ...
""" Return all files under the root package, that are not in a package themselves. """ walk = [(dirpath.replace(package + os.sep, '', 1), filenames) for dirpath, dirnames, filenames in os.walk(package) if not os.path.exists(os.path.join(dirpath, '__init__.py'))] filepaths = ...
identifier_body
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.match("__version__ = ['...
(package): """ Return root package and all sub-packages. """ return [dirpath for dirpath, dirnames, filenames in os.walk(package) if os.path.exists(os.path.join(dirpath, '__init__.py'))] def get_package_data(package): """ Return all files under the root package, that ar...
get_packages
identifier_name
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.match("__version__ = ['...
name='django-blog-sl', version=version, url='http://github.com/simonluijk/django-blog', license='BSD', description='Yet another django blog.', author='Simon Luijk', author_email='simon@simonluijk.com', # SEE NOTE BELOW (*) packages=get_packages('blog'), package_data=get_package_data...
sys.exit() setup(
random_line_split
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.match("__version__ = ['...
setup( name='django-blog-sl', version=version, url='http://github.com/simonluijk/django-blog', license='BSD', description='Yet another django blog.', author='Simon Luijk', author_email='simon@simonluijk.com', # SEE NOTE BELOW (*) packages=get_packages('blog'), package_data=get_pa...
os.system("python setup.py sdist upload") print("You probably want to also tag the version now:") print(" git tag -a %s -m 'version %s'" % (version, version)) print(" git push --tags") sys.exit()
conditional_block
test_domains_negative.py
# Copyright 2015 Red Hat 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 ...
(base.BaseIdentityV3AdminTest): _interface = 'json' @test.attr(type=['negative', 'gate']) @test.idempotent_id('1f3fbff5-4e44-400d-9ca1-d953f05f609b') def test_delete_active_domain(self): d_name = data_utils.rand_name('domain') d_desc = data_utils.rand_name('domain-desc') domain ...
DomainsNegativeTestJSON
identifier_name
test_domains_negative.py
# Copyright 2015 Red Hat 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 ...
domain_name = data_utils.rand_name('domain-dup') domain = self.domains_client.create_domain(domain_name)['domain'] domain_id = domain['id'] self.addCleanup(self.delete_domain, domain_id) # Domain name should be unique self.assertRaises( lib_exc.Conflict, self.domains_...
identifier_body
test_domains_negative.py
# Copyright 2015 Red Hat 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 ...
def test_delete_active_domain(self): d_name = data_utils.rand_name('domain') d_desc = data_utils.rand_name('domain-desc') domain = self.domains_client.create_domain( d_name, description=d_desc)['domain'] domain_id = domain['id'] self.addCleanup(self.d...
class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest): _interface = 'json' @test.attr(type=['negative', 'gate']) @test.idempotent_id('1f3fbff5-4e44-400d-9ca1-d953f05f609b')
random_line_split
main.rs
use std::error::Error; use std::path::{Path, PathBuf}; use yaml_rust::{Yaml, YamlEmitter, YamlLoader}; /// List of directories containing files to expand. The first tuple element is the source /// directory, while the second tuple element is the destination directory. #[rustfmt::skip] static TO_EXPAND: &[(&str, &str)]...
} Mode::Generate => { std::fs::write(dest, buf.as_bytes()) .with_context(|| format!("failed to write to {}", self.path(dest)))?; } } Ok(()) } fn path<'a>(&self, path: &'a Path) -> impl std::fmt::Display + 'a { path....
random_line_split
main.rs
use std::error::Error; use std::path::{Path, PathBuf}; use yaml_rust::{Yaml, YamlEmitter, YamlLoader}; /// List of directories containing files to expand. The first tuple element is the source /// directory, while the second tuple element is the destination directory. #[rustfmt::skip] static TO_EXPAND: &[(&str, &str)]...
() { if let Err(err) = App::from_args().and_then(|app| app.run()) { eprintln!("error: {}", err); let mut source = err.as_ref() as &dyn Error; while let Some(err) = source.source() { eprintln!("caused by: {}", err); source = err; } std::process::exit(...
main
identifier_name
mod.rs
#![allow(dead_code, unused_macros)] pub mod callback; #[macro_use] #[path = "../../src/utils/memzeroize.rs"] pub mod zeroize; #[path = "../../src/utils/environment.rs"] pub mod environment; pub mod pool; pub mod crypto; pub mod did; pub mod wallet; pub mod ledger; pub mod anoncreds; pub mod types; pub mod pairwise;...
() -> i32 { setup(); pool::create_and_open_pool_ledger(constants::POOL).unwrap() } pub fn tear_down_with_pool(pool_handle: i32) { pool::close(pool_handle).unwrap(); tear_down(); } pub fn setup_with_wallet_and_pool() -> (i32, i32) { let wallet_handle = setup_with_wallet(); let pool_handle = poo...
setup_with_pool
identifier_name
mod.rs
#![allow(dead_code, unused_macros)] pub mod callback; #[macro_use] #[path = "../../src/utils/memzeroize.rs"] pub mod zeroize; #[path = "../../src/utils/environment.rs"] pub mod environment; pub mod pool; pub mod crypto; pub mod did; pub mod wallet; pub mod ledger; pub mod anoncreds; pub mod types; pub mod pairwise;...
}
random_line_split
mod.rs
#![allow(dead_code, unused_macros)] pub mod callback; #[macro_use] #[path = "../../src/utils/memzeroize.rs"] pub mod zeroize; #[path = "../../src/utils/environment.rs"] pub mod environment; pub mod pool; pub mod crypto; pub mod did; pub mod wallet; pub mod ledger; pub mod anoncreds; pub mod types; pub mod pairwise;...
pub fn tear_down() { test::cleanup_storage(); } pub fn setup_with_wallet() -> i32 { setup(); wallet::create_and_open_default_wallet().unwrap() } pub fn setup_with_plugged_wallet() -> i32 { setup(); wallet::create_and_open_plugged_wallet().unwrap() } pub fn tear_down_with_wallet(wallet_handle: i...
{ test::cleanup_storage(); logger::set_default_logger(); }
identifier_body
__init__.py
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # LICENSE # # Copyright (c) 2010-2017, GEM Foundation, G. Weatherill, M. Pagani, # D. Monelli. # # The Hazard Modeller's Toolkit is free software: you can redistribute # it and/or modify it under the terms of the GNU Affero General Public #License a...
# # Feedback and contribution to the software is welcome, and can be # directed to the hazard scientific staff of the GEM Model Facility # (hazard@globalquakemodel.org). # # The Hazard Modeller's Toolkit (openquake.hmtk) is therefore distributed WITHOUT #ANY WARRANTY; without even the implied warranty of MERCHANTABILIT...
random_line_split
accounts-base.d.ts
import { Meteor } from 'meteor/meteor'; declare module "meteor/accounts-base" { interface URLS { resetPassword: (token: string) => string; verifyEmail: (token: string) => string; enrollAccount: (token: string) => string; } interface EmailFields { from?: (user: Meteor.User) =...
} module Accounts { interface LoginMethodOptions { /** * The method to call (default 'login') */ methodName?: string; /** * The arguments for the method */ methodArguments?: any[]; /** ...
} module Accounts { function onLogout(func: (options: { user: Meteor.User, connection: Meteor.Connection; }) => void): void;
random_line_split
2d.path.stroke.scale2.worker.js
// DO NOT EDIT! This test has been generated by tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.stroke.scale2 // Description:Stroke line widths are scaled by the current transformation matrix // Note: importScripts("/resources/testharness.js"); importScripts("/2dcontext/resources/canvas-tests.js"); var ...
}); done();
t.done();
random_line_split
integration_spec.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 '@angular/compiler'; import {withBody} from '@angular/private/testing';
import * as fs from 'fs'; import * as path from 'path'; const UTF8 = { encoding: 'utf-8' }; const PACKAGE = 'angular/packages/core/test/bundling/cyclic_import'; describe('treeshaking with uglify', () => { let content: string; const contentPath = require.resolve(path.join(PACKAGE, 'bundle.min_debug.js')); befo...
random_line_split
review-post.tsx
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import { PersistedBeatmapDiscussionReview } from 'interfaces/beatmap-discussion-review'; import * as React from 'react'; import * as ReactMarkd...
paragraph(source: string) { return ( <ReactMarkdown key={osu.uuid()} plugins={[ [ disableTokenizersPlugin, { allowedBlocks: ['paragraph'], allowedInlines: ['emphasis', 'strong'], }, ], autolinkPlu...
{ return ( <div key={osu.uuid()} className='beatmap-discussion-review-post__block'> <ReviewPostEmbed data={{discussion_id: id}} /> </div> ); }
identifier_body
review-post.tsx
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import { PersistedBeatmapDiscussionReview } from 'interfaces/beatmap-discussion-review'; import * as React from 'react'; import * as ReactMarkd...
], autolinkPlugin, timestampPlugin, ]} renderers={{ link: this.linkRenderer, paragraph: (props) => (<div className='beatmap-discussion-review-post__block'> <div className='beatmapset-discussion-message' {...props}/> </div>), ...
{ allowedBlocks: ['paragraph'], allowedInlines: ['emphasis', 'strong'], },
random_line_split
review-post.tsx
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import { PersistedBeatmapDiscussionReview } from 'interfaces/beatmap-discussion-review'; import * as React from 'react'; import * as ReactMarkd...
(id: number) { return ( <div key={osu.uuid()} className='beatmap-discussion-review-post__block'> <ReviewPostEmbed data={{discussion_id: id}} /> </div> ); } paragraph(source: string) { return ( <ReactMarkdown key={osu.uuid()} plugins={[ [ d...
embed
identifier_name
cstore.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 ...
-> @crate_metadata { return *cstore.metas.get(&cnum); } pub fn get_crate_hash(cstore: &CStore, cnum: ast::CrateNum) -> @str { let cdata = get_crate_data(cstore, cnum); decoder::get_crate_hash(cdata.data) } pub fn get_crate_vers(cstore: &CStore, cnum: ast::CrateNum) -> @str { let cda...
}; } pub fn get_crate_data(cstore: &CStore, cnum: ast::CrateNum)
random_line_split
cstore.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 ...
<'a>(cstore: &'a CStore) -> &'a [CrateSource] { cstore.used_crate_sources.as_slice() } pub fn get_used_crates(cstore: &CStore, prefer: LinkagePreference) -> ~[(ast::CrateNum, Option<Path>)] { let mut ret = ~[]; for src in cstore.used_crate_sources.iter() { ret.push((src.cnum, match prefer { ...
get_used_crate_sources
identifier_name
jquery.F_slider.js
(function($) { $.fn.F_slider = function(options){ var defaults = { page : 1, len : 0, // 滚动篇幅 axis : 'y' // y为上下滚动,x为左右滚动 } var options = $.extend(defaults,options); return this.each(function(){ var $this = $(this); var len = options.len; var page = options.page; if(options.axis == 'y'){...
').click(function(){ if(page == len){ eval("$this.find('.F-center').animate({"+Param+":0},'slow');"); page=1; }else{ eval("$this.find('.F-center').animate({"+Param+":'-=' + Val},'show');"); page++; } }); }); } })(jQuery);
nter').animate({"+Param+":'+=' + Val},'slow');"); page--; } }); $this.find('.F-next
conditional_block
jquery.F_slider.js
(function($) { $.fn.F_slider = function(options){ var defaults = { page : 1, len : 0, // 滚动篇幅 axis : 'y' // y为上下滚动,x为左右滚动 } var options = $.extend(defaults,options); return this.each(function(){ var $this = $(this); var len = options.len; var page = options.page; if(options.axis == 'y'){...
eval("$this.find('.F-center').animate({"+Param+":'+=' + Val},'slow');"); page--; } }); $this.find('.F-next').click(function(){ if(page == len){ eval("$this.find('.F-center').animate({"+Param+":0},'slow');"); page=1; }else{ eval("$this.find('.F-center').animate({"+Param+":'-=' ...
}else{
random_line_split
login.ts
import { separateLng } from 'i18n/helpers';
username_placeholder: { zh: '用户名/邮箱', en: 'Username / Phone number' }, password_message: { zh: '请输入密码!', en: 'Please enter password!' }, password_placeholder: { zh: '密码', en: 'Password' }, remember: { zh: '记住登录状态', en: 'Remember me' }, button: { zh: '登录', en: 'Sign in' }, no_account_tip: { zh: '如无账号,请发送...
const login = { slogan: { zh: '联邦学习', en: 'Federation Learner' }, vision: { zh: '打破数据孤岛,让数据安全“融合”建模,创造更大价值' }, form_title: { zh: '账号登录', en: 'Sign in' }, username_message: { zh: '请输入用户名!', en: 'Please enter username!' },
random_line_split
script.js
/** * Javascript for tagindex management * * @author Gina Haeussge, Michael Klier <dokuwiki@chimeric.de> * @author Andreas Gohr <andi@splitbrain.org> */ /** * Class to hold some values */ function plugin_tagindex_class()
var plugin_tag = new plugin_tagindex_class(); plugin_tag.sack = new sack(DOKU_BASE + 'lib/plugins/tag/ajax.php'); plugin_tag.sack.AjaxFailedAlert = ''; plugin_tag.sack.encodeURIString = false; /** * Display the loading gif */ function plugin_tagindex_throbber(on){ obj = document.getElementById('pl_si_throbber')...
{ this.pages = null; this.page = null; this.sack = null; this.done = 1; this.count = 0; }
identifier_body
script.js
/** * Javascript for tagindex management * * @author Gina Haeussge, Michael Klier <dokuwiki@chimeric.de> * @author Andreas Gohr <andi@splitbrain.org> */ /** * Class to hold some values */ function plugin_tagindex_class(){ this.pages = null; this.page = null; this.sack = null; this.done = 1; ...
else{ plugin_tagindex_status(ok); // get next one window.setTimeout("plugin_tagindex_index()",5000); } } /** * Starts the indexing of a page. */ function plugin_tagindex_index(){ if(plugin_tag.page){ plugin_tagindex_status('indexing<br />'+plugin_tag.page+'<br />('+plugin_tag....
{ plugin_tag.page = plugin_tag.pages.shift(); plugin_tag.done++; // get next one window.setTimeout("plugin_tagindex_index()",1000); }
conditional_block
script.js
/** * Javascript for tagindex management * * @author Gina Haeussge, Michael Klier <dokuwiki@chimeric.de> * @author Andreas Gohr <andi@splitbrain.org> */ /** * Class to hold some values */ function plugin_tagindex_class(){ this.pages = null; this.page = null; this.sack = null; this.done = 1; ...
(){ if(plugin_tag.page){ plugin_tagindex_status('indexing<br />'+plugin_tag.page+'<br />('+plugin_tag.done+'/'+plugin_tag.count+')<br />'); plugin_tag.sack.onCompletion = plugin_tagindex_cb_index; plugin_tag.sack.URLString = ''; plugin_tag.sack.runAJAX('call=indexpage&page='+encodeUR...
plugin_tagindex_index
identifier_name
script.js
/** * Javascript for tagindex management * * @author Gina Haeussge, Michael Klier <dokuwiki@chimeric.de> * @author Andreas Gohr <andi@splitbrain.org> */ /** * Class to hold some values */ function plugin_tagindex_class(){ this.pages = null; this.page = null; this.sack = null; this.done = 1; ...
} } /** * Starts the indexing of a page. */ function plugin_tagindex_index(){ if(plugin_tag.page){ plugin_tagindex_status('indexing<br />'+plugin_tag.page+'<br />('+plugin_tag.done+'/'+plugin_tag.count+')<br />'); plugin_tag.sack.onCompletion = plugin_tagindex_cb_index; plugin_tag.sac...
window.setTimeout("plugin_tagindex_index()",5000);
random_line_split
classstd_1_1allocator.js
var classstd_1_1allocator = [ [ "allocator", "d7/d75/classstd_1_1allocator.html#af58fb50c569cbd3244176fcbaedd8130", null ], [ "~allocator", "d7/d75/classstd_1_1allocator.html#a2391d38030fc1dca45118d2369ace201", null ], [ "allocate", "d7/d75/classstd_1_1allocator.html#aa134fbfdd3f8043f97cef77ce1956a40", null...
[ "deallocate", "d7/d75/classstd_1_1allocator.html#a023ddc78c271be016433e2e59a98df1c", null ], [ "get_name", "d7/d75/classstd_1_1allocator.html#acb0194676fc6dcf5df82e2b0c866b038", null ] ];
random_line_split
effect-transfer.min.js
/*! * jQuery UI Effects Transfer 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license.
* http://jquery.org/license * * http://api.jqueryui.com/transfer-effect/ */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./effect"],a):a(jQuery)}(function(a){return a.effects.effect.transfer=function(b,c){var d=a(this),e=a(b.to),f="fixed"===e.css("position"),g=a("body"),h=f?g.scrollTop():0,i...
random_line_split
relay.rs
: NameType, } impl RelayMap { /// This creates a new RelayMap. pub fn new(our_id: &Id) -> RelayMap { RelayMap { relay_map: BTreeMap::new(), lookup_map: HashMap::new(), unknown_connections: HashMap::new(), our_name: our_id.name(), } } /// ...
{ break; }
conditional_block
relay.rs
ences for the specific language governing permissions and limitations // relating to use of the SAFE Network Software. //! This module handle all connections that are not managed by the routing table. //! //! As such the relay module handles messages that need to flow in or out of the SAFE network. //! These messages ...
(our_id: &Id) -> RelayMap { RelayMap { relay_map: BTreeMap::new(), lookup_map: HashMap::new(), unknown_connections: HashMap::new(), our_name: our_id.name(), } } /// Adds an IP Node info to the relay map if the relay map has open /// slots. Th...
new
identifier_name
relay.rs
ences for the specific language governing permissions and limitations // relating to use of the SAFE Network Software. //! This module handle all connections that are not managed by the routing table. //! //! As such the relay module handles messages that need to flow in or out of the SAFE network. //! These messages ...
/// Returns false if the endpoint is already assigned to a different name. pub fn add_client(&mut self, relay_info: PublicId, relay_endpoint: Endpoint) -> bool { // always reject our own id if self.our_name == relay_info.name() { return false; } // impose limit on num...
random_line_split
relay.rs
ences for the specific language governing permissions and limitations // relating to use of the SAFE Network Software. //! This module handle all connections that are not managed by the routing table. //! //! As such the relay module handles messages that need to flow in or out of the SAFE network. //! These messages ...
/// Returns Option<NameType> if an endpoint is found pub fn lookup_endpoint(&self, relay_endpoint: &Endpoint) -> Option<Address> { match self.lookup_map.get(relay_endpoint) { Some(name) => Some(name.clone()), None => None } } /// This returns a pair of the stor...
{ self.lookup_map.contains_key(relay_endpoint) }
identifier_body
application_ref.ts
()`. */ abstract asyncApplication(bindingFn: (zone: NgZone) => Promise<Array<Type | Provider | any[]>>, providers?: Array<Type | Provider | any[]>): Promise<ApplicationRef>; /** * Destroy the Angular platform and all Angular applications on the page. */ abstract dispose(): vo...
{ if (this._runningTick) { throw new BaseException("ApplicationRef.tick is called recursively"); } var s = ApplicationRef_._tickScope(); try { this._runningTick = true; this._changeDetectorRefs.forEach((detector) => detector.detectChanges()); if (this._enforceNoNewChanges) { ...
identifier_body
application_ref.ts
injector.get(Testability)); } return componentRef; }); }, deps: [DynamicComponentLoader, ApplicationRef, Injector] }), provide(appComponentType, { ...
if (isPresent(exceptionHandler)) { exceptionHandler.call(e, e.stack); } else { print(e.toString()); } } }); app = new ApplicationRef_(this, zone, injector); this._applications.push(app); _runAppInitializers(injector); return app; } dispose(): vo...
} catch (e) {
random_line_split
application_ref.ts
injector.get(Testability)); } return componentRef; }); }, deps: [DynamicComponentLoader, ApplicationRef, Injector] }), provide(appComponentType, { useFactory: (p: Promise<any>) => p.the...
} else { return _createPlatform(providers); } } /** * Dispose the existing platform. */ export function disposePlatform(): void { if (isPresent(_platform)) { _platform.dispose(); _platform = null; } } function _createPlatform(providers?: Array<Type | Provider | any[]>): PlatformRef { _platfor...
{ throw new BaseException("platform cannot be initialized with different sets of providers."); }
conditional_block
application_ref.ts
require numerous providers to be properly instantiated. * When using `application()` to create a new app on the page, these providers * must be provided. Fortunately, there are helper functions to configure * typical providers, as shown in the example below. * * ### Example * ``` * var myAppProvid...
_loadComponent
identifier_name
bgmacro.rs
lang_args.push(path); } // Set the working dir to the directory containing the invoking rs file so // that clang searches for headers relative to it rather than the crate root let filename = cx.codemap().span_to_filename(sp); let mod_dir = Path::new(&filename).parent().unwrap(); let cwd = match...
} } match parser.token { // Match [ident] token::Ident(val, _) => { let val = parser.id_to_interned_str(val); span.hi = parser.span.hi; parser.bump(); // Bools are simply encoded as idents ...
{ let mut parser = cx.new_parser_from_tts(tts); let mut args_good = true; loop { let mut name: Option<String> = None; let mut span = parser.span; // Check for [ident=]value and if found save ident to name if parser.look_ahead(1, |t| t == &token::Eq) { match pars...
identifier_body