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
sync_test_megacli.py
""" Application for testing syncing algorithm (c) 2013-2014 by Mega Limited, Wellsford, New Zealand This file is part of the MEGA SDK - Client Access Engine. Applications using the MEGA API must present a valid application key and comply with the the rules set forth in the Terms of Service. The MEGA SDK is di...
import logging import argparse class SyncTestMegaCliApp(SyncTestApp): """ operates with megacli application """ def __init__(self, local_mount_in, local_mount_out, delete_tmp_files=True, use_large_files=True, check_if_alive=True): """ local_mount_in: local upsync folder local_m...
import xmlrunner import subprocess import re from sync_test_app import SyncTestApp from sync_test import SyncTest
random_line_split
sync_test_megacli.py
""" Application for testing syncing algorithm (c) 2013-2014 by Mega Limited, Wellsford, New Zealand This file is part of the MEGA SDK - Client Access Engine. Applications using the MEGA API must present a valid application key and comply with the the rules set forth in the Terms of Service. The MEGA SDK is di...
def finish(self): try: shutil.rmtree(self.work_dir) except OSError, e: logging.error("Failed to remove dir: %s (%s)" % (self.work_dir, e)) def is_alive(self): """ return True if application instance is running """ if not self.check_if_al...
return True
identifier_body
sync_test_megacli.py
""" Application for testing syncing algorithm (c) 2013-2014 by Mega Limited, Wellsford, New Zealand This file is part of the MEGA SDK - Client Access Engine. Applications using the MEGA API must present a valid application key and comply with the the rules set forth in the Terms of Service. The MEGA SDK is di...
(self): """ pause application """ # TODO: implement this ! raise NotImplementedError("Not Implemented !") def unpause(self): """ unpause application """ # TODO: implement this ! raise NotImplementedError("Not Implemented !") if __nam...
pause
identifier_name
sync_test_megacli.py
""" Application for testing syncing algorithm (c) 2013-2014 by Mega Limited, Wellsford, New Zealand This file is part of the MEGA SDK - Client Access Engine. Applications using the MEGA API must present a valid application key and comply with the the rules set forth in the Terms of Service. The MEGA SDK is di...
return False def pause(self): """ pause application """ # TODO: implement this ! raise NotImplementedError("Not Implemented !") def unpause(self): """ unpause application """ # TODO: implement this ! raise NotImplementedE...
if re.search("megacli", x): return True
conditional_block
validation-controller-factory.ts
import { Container, Optional } from 'aurelia-dependency-injection'; import { GlobalValidationConfiguration, ValidationControllerFactory, ValidationController,
Validator, validateTrigger } from '../src/aurelia-validation'; describe('ValidationControllerFactory', () => { it('createForCurrentScope', () => { const container = new Container(); const standardValidator = {}; container.registerInstance(Validator, standardValidator); const config = new...
random_line_split
blog-engine.js
import fetch from 'node-fetch'; export class HttpError extends Error { constructor(message, response, request) { super();ß this.message = message; this.response = response; this.request = request; this.name = 'Http Error'; } } const encode = params => { return Object.keys(params).map(key => ...
config) { this.url = config.url; } prefix (url) { // add the prefix url config return this.url + url; } post (url, body) { url = this.prefix(url); return fetch(url, { method: 'POST', body: JSON.stringify(body), headers: {'Content-Type': 'application-json'} }) .the...
onstructor(
identifier_name
blog-engine.js
import fetch from 'node-fetch'; export class HttpError extends Error { constructor(message, response, request) { super();ß this.message = message; this.response = response; this.request = request; this.name = 'Http Error'; } } const encode = params => { return Object.keys(params).map(key => ...
return fetch(url, { method: 'get' }) .then(analyze({url})) .then(unserialize) } } export const blogEngine = config => { return async (ctx, next) => { ctx.engine = new Client(config); await next(); } }
url = `${url}?${encode(params)}`; }
conditional_block
blog-engine.js
import fetch from 'node-fetch'; export class HttpError extends Error { constructor(message, response, request) { super();ß this.message = message; this.response = response; this.request = request; this.name = 'Http Error'; } } const encode = params => { return Object.keys(params).map(key => ...
const analyze = request => res => { // analyze the result code if (!res.ok) { let body = unserialize(res); let status = res.status; throw HttpError('Blog Service Error', {body, status}, request); } return res; } class Client { constructor(config) { this.url = config.url; } prefix (url) ...
}
random_line_split
camera.py
"""Support for Abode Security System cameras.""" from datetime import timedelta import logging import requests from homeassistant.components.camera import Camera from homeassistant.util import Throttle from . import DOMAIN as ABODE_DOMAIN, AbodeDevice DEPENDENCIES = ['abode'] MIN_TIME_BETWEEN_UPDATES = timedelta(s...
(self): """Get a camera image.""" self.refresh_image() if self._response: return self._response.content return None def _capture_callback(self, capture): """Update the image with the device then refresh device.""" self._device.update_image_location(capt...
camera_image
identifier_name
camera.py
"""Support for Abode Security System cameras.""" from datetime import timedelta import logging import requests from homeassistant.components.camera import Camera from homeassistant.util import Throttle from . import DOMAIN as ABODE_DOMAIN, AbodeDevice DEPENDENCIES = ['abode'] MIN_TIME_BETWEEN_UPDATES = timedelta(s...
data.devices.extend(devices) add_entities(devices) class AbodeCamera(AbodeDevice, Camera): """Representation of an Abode camera.""" def __init__(self, data, device, event): """Initialize the Abode device.""" AbodeDevice.__init__(self, data, device) Camera.__init__(self) ...
if data.is_excluded(device): continue devices.append(AbodeCamera(data, device, TIMELINE.CAPTURE_IMAGE))
conditional_block
camera.py
"""Support for Abode Security System cameras.""" from datetime import timedelta import logging import requests from homeassistant.components.camera import Camera from homeassistant.util import Throttle from . import DOMAIN as ABODE_DOMAIN, AbodeDevice DEPENDENCIES = ['abode'] MIN_TIME_BETWEEN_UPDATES = timedelta(s...
return self._device.capture() @Throttle(MIN_TIME_BETWEEN_UPDATES) def refresh_image(self): """Find a new image on the timeline.""" if self._device.refresh_image(): self.get_image() def get_image(self): """Attempt to download the most recent capture.""" i...
"""Representation of an Abode camera.""" def __init__(self, data, device, event): """Initialize the Abode device.""" AbodeDevice.__init__(self, data, device) Camera.__init__(self) self._event = event self._response = None async def async_added_to_hass(self): """...
identifier_body
camera.py
"""Support for Abode Security System cameras.""" from datetime import timedelta import logging import requests from homeassistant.components.camera import Camera from homeassistant.util import Throttle from . import DOMAIN as ABODE_DOMAIN, AbodeDevice DEPENDENCIES = ['abode'] MIN_TIME_BETWEEN_UPDATES = timedelta(s...
_LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode camera devices.""" import abodepy.helpers.constants as CONST import abodepy.helpers.timeline as TIMELINE data = hass.data[ABODE_DOMAIN] devices = [] for device in data.a...
random_line_split
components.d.ts
import WoundFrame from './woundframe/WoundFrame'; import QuickSelect from './quickselect/QuickSelect'; import Animate from './Animate'; declare var _default: { UnitFrame: __React.ClassicComponentClass<any>; Effects: __React.ClassicComponentClass<any>; HealthBar: __React.ClassicComponentClass<any>; Healt...
StaminaText: __React.ClassicComponentClass<any>; Injuries: __React.ClassicComponentClass<any>; Injury: __React.ClassicComponentClass<any>; InjuryLocation: __React.ClassicComponentClass<any>; InjuryBar: __React.ClassicComponentClass<any>; InjuryText: __React.ClassicComponentClass<any>; Injury...
Name: __React.ClassicComponentClass<any>; Portrait: __React.ClassicComponentClass<any>; StaminaBar: __React.ClassicComponentClass<any>;
random_line_split
carrier.py
# -*- coding: utf-8 -*- """ :copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from trytond.model import ModelSQL, ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, Bool from trytond.transaction import T...
def get_purchase_price(self): Address = Pool().get('party.address') ZonePriceList = Pool().get('carrier.zone_price_list') price, currency_id = super(Carrier, self).get_purchase_price() if self.carrier_cost_method == 'zone': zone = None if 'address' in Transa...
if zone is not None: return zone.price, self.zone_currency.id return price, currency_id
random_line_split
carrier.py
# -*- coding: utf-8 -*- """ :copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from trytond.model import ModelSQL, ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, Bool from trytond.transaction import T...
(self): Address = Pool().get('party.address') ZonePriceList = Pool().get('carrier.zone_price_list') price, currency_id = super(Carrier, self).get_purchase_price() if self.carrier_cost_method == 'zone': zone = None if 'address' in Transaction().context: ...
get_purchase_price
identifier_name
carrier.py
# -*- coding: utf-8 -*- """ :copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from trytond.model import ModelSQL, ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, Bool from trytond.transaction import T...
return 2 def get_sale_price(self): Address = Pool().get('party.address') ZonePriceList = Pool().get('carrier.zone_price_list') price, currency_id = super(Carrier, self).get_sale_price() if self.carrier_cost_method == 'zone': zone = None if 'address'...
return self.zone_currency.digits
conditional_block
carrier.py
# -*- coding: utf-8 -*- """ :copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from trytond.model import ModelSQL, ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, Bool from trytond.transaction import T...
def find_zone_for_address(self, address): """ A helper function that finds the most matching zone from the given address. :param address: Active Record of the address :return: Active Record of the zone_price_list """ CarrierZone = Pool().get('carrier.zone_p...
Address = Pool().get('party.address') ZonePriceList = Pool().get('carrier.zone_price_list') price, currency_id = super(Carrier, self).get_purchase_price() if self.carrier_cost_method == 'zone': zone = None if 'address' in Transaction().context: zone = sel...
identifier_body
lib.rs
The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource...
() -> Option<Box<Terminal<WriterWrapper> + Send>> { TerminfoTerminal::new(WriterWrapper { wrapped: box std::io::stdout() as Box<Write + Send>, }) } #[cfg(windows)] /// Return a Terminal wrapping stdout, or None if a terminal couldn't be /// opened. pub fn stdout() -> Option<Box<Terminal<WriterWrapper> ...
stdout
identifier_name
lib.rs
The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource...
#[inline] fn flush(&mut self) -> io::Result<()> { self.wrapped.flush() } } #[cfg(not(windows))] /// Return a Terminal wrapping stdout, or None if a terminal couldn't be /// opened. pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> { TerminfoTerminal::new(WriterWrapper { w...
{ self.wrapped.write(buf) }
identifier_body
lib.rs
The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource...
/// Terminal color definitions pub mod color { /// Number for a terminal color pub type Color = u16; pub const BLACK: Color = 0; pub const RED: Color = 1; pub const GREEN: Color = 2; pub const YELLOW: Color = 3; pub const BLUE: Color = 4; pub const MAGENTA: Color = 5; pu...
random_line_split
extract_doc.js
'use strict'; var minilog = require('minilog') , log = minilog('traverson'); /* * This transform is meant to be run at the very end of a getResource call. It * just extracts the last doc from the step and calls t.callback with it. */ module.exports = function extractDoc(t) { log.debug('walker.walk has finished...
*/ t.callback(null, t.step.doc); // This is a so called final transform that is only applied at the very end // and it always calls t.callback - in contrast to other transforms it does // not call t.callback in the error case, but as a success. // We return false to make sure processing ends here. retur...
t.callback(createError('No document available', errors.InvalidStateError)); return false; }
random_line_split
state.rs
use ::libc; #[cfg(feature = "task")] use super::task::BufProc; use super::{In, Out, Sig}; use super::control::Control; #[derive(Copy, Clone, Debug)] pub enum DeviceState { /// The current task. #[cfg(feature = "task")] Proc(BufProc), /// Update. Idle,
/// The current character. InText(Control), } impl DeviceState { #[cfg(feature = "task")] /// The constructor method `from_task` returns a Process' event. pub fn from_task(name: BufProc) -> Self { DeviceState::Proc(name) } /// The constructor method `from_idle` returns a Update's ...
/// As catched a signal. Sig(Sig), /// The output of new lines. OutText(Out, libc::size_t),
random_line_split
state.rs
use ::libc; #[cfg(feature = "task")] use super::task::BufProc; use super::{In, Out, Sig}; use super::control::Control; #[derive(Copy, Clone, Debug)] pub enum DeviceState { /// The current task. #[cfg(feature = "task")] Proc(BufProc), /// Update. Idle, /// As catched a signal. Sig(Sig), ///...
/// The accessor method `is_signal` returns a Option for Signal's event. pub fn is_signal(&self) -> Option<libc::c_int> { match *self { DeviceState::Sig(sig) => Some(sig), _ => None, } } }
{ match *self { DeviceState::InText(event) => Some(event), _ => None, } }
identifier_body
state.rs
use ::libc; #[cfg(feature = "task")] use super::task::BufProc; use super::{In, Out, Sig}; use super::control::Control; #[derive(Copy, Clone, Debug)] pub enum DeviceState { /// The current task. #[cfg(feature = "task")] Proc(BufProc), /// Update. Idle, /// As catched a signal. Sig(Sig), ///...
(&self) -> Option<Control> { match *self { DeviceState::InText(event) => Some(event), _ => None, } } /// The accessor method `is_signal` returns a Option for Signal's event. pub fn is_signal(&self) -> Option<libc::c_int> { match *self { DeviceStat...
is_input
identifier_name
alg_shortest_game.py
"""Shortest game. When we play games, we always bet in one of two ways in each game: - betting one chip - betting all-in Wins are paid equal to the wager, so if we bet C chips and wins, we get 2C chips back. Suppose yesterday was a lucky day for us, we won every game we played. Starting with 1 chip and leaving the ...
(): # Output: 7 N = 8 K = 0 print(shortest_game(N, K)) # Output: 6 N = 18 K = 2 print(shortest_game(N, K)) # Output: 4 N = 10 K = 10 print(shortest_game(N, K)) # Output: 0 N = 1 K = 0 print(shortest_game(N, K)) # Output: 8 N = 100 K = 5 ...
main
identifier_name
alg_shortest_game.py
"""Shortest game. When we play games, we always bet in one of two ways in each game: - betting one chip - betting all-in Wins are paid equal to the wager, so if we bet C chips and wins, we get 2C chips back. Suppose yesterday was a lucky day for us, we won every game we played. Starting with 1 chip and leaving the ...
def main(): # Output: 7 N = 8 K = 0 print(shortest_game(N, K)) # Output: 6 N = 18 K = 2 print(shortest_game(N, K)) # Output: 4 N = 10 K = 10 print(shortest_game(N, K)) # Output: 0 N = 1 K = 0 print(shortest_game(N, K)) # Output: 8 N = 100 ...
if N <= 2 or K == 0: # Base cases: If N is 1 or 2, or K is 0, bet N-1 times of 1 chip. return N - 1 if N % 2 == 0: # If N is even, bet 1 all-in, and # continue playing game for N//2 with K-1 all-in opportunities. return 1 + shortest_game(N // 2, K - 1) else: # ...
identifier_body
alg_shortest_game.py
"""Shortest game. When we play games, we always bet in one of two ways in each game: - betting one chip - betting all-in Wins are paid equal to the wager, so if we bet C chips and wins, we get 2C chips back. Suppose yesterday was a lucky day for us, we won every game we played. Starting with 1 chip and leaving the ...
else: # If N is odd, bet 1 chip, and # continue playing game for N-1 with K all-in opportunities. return 1 + shortest_game(N - 1, K) def main(): # Output: 7 N = 8 K = 0 print(shortest_game(N, K)) # Output: 6 N = 18 K = 2 print(shortest_game(N, K)) # O...
return 1 + shortest_game(N // 2, K - 1)
conditional_block
alg_shortest_game.py
"""Shortest game. When we play games, we always bet in one of two ways in each game: - betting one chip - betting all-in Wins are paid equal to the wager, so if we bet C chips and wins, we get 2C chips back. Suppose yesterday was a lucky day for us, we won every game we played. Starting with 1 chip and leaving the ...
K = 10 print(shortest_game(N, K)) # Output: 0 N = 1 K = 0 print(shortest_game(N, K)) # Output: 8 N = 100 K = 5 print(shortest_game(N, K)) if __name__ == '__main__': main()
N = 10
random_line_split
jspsych-categorize-animation.js
/** * jspsych plugin for categorization trials with feedback and animated stimuli * Josh de Leeuw * * documentation: docs.jspsych.org **/ jsPsych.plugins["categorize-animation"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('categorize-animation', 'stimuli', 'image'); plugin.info = ...
} else if (!responded) { // in here if the user has to wait to respond until animation is done. // if this is the case, don't show the prompt until the animation is over. if (!showAnimation) { if (trial.prompt !== null) { if (trial.render_on_canvas) { p...
{ if (!showAnimation) { canvas.remove(); } }
conditional_block
jspsych-categorize-animation.js
/** * jspsych plugin for categorization trials with feedback and animated stimuli * Josh de Leeuw * * documentation: docs.jspsych.org **/ jsPsych.plugins["categorize-animation"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('categorize-animation', 'stimuli', 'image'); plugin.info = ...
() { clearInterval(animate_interval); // stop animation! display_element.innerHTML = ''; // clear everything jsPsych.finishTrial(trial_data); } }; return plugin; })();
endTrial
identifier_name
jspsych-categorize-animation.js
/** * jspsych plugin for categorization trials with feedback and animated stimuli * Josh de Leeuw * * documentation: docs.jspsych.org **/ jsPsych.plugins["categorize-animation"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('categorize-animation', 'stimuli', 'image'); plugin.info = ...
}; return plugin; })();
{ clearInterval(animate_interval); // stop animation! display_element.innerHTML = ''; // clear everything jsPsych.finishTrial(trial_data); }
identifier_body
jspsych-categorize-animation.js
/** * jspsych plugin for categorization trials with feedback and animated stimuli * Josh de Leeuw * * documentation: docs.jspsych.org **/ jsPsych.plugins["categorize-animation"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('categorize-animation', 'stimuli', 'image'); plugin.info = ...
var feedback_div = document.createElement("div"); display_element.insertBefore(feedback_div, display_element.nextElementSibling); } // show animation var animate_interval = setInterval(function() { if (!trial.render_on_canvas) { display_element.innerHTML = ''; // clear everything ...
prompt_div.style.visibility = "hidden"; prompt_div.innerHTML = trial.prompt; display_element.insertBefore(prompt_div, canvas.nextElementSibling); }
random_line_split
Slider.js
/************************************** { x:0, y:0, width:433, min:1, max:25, step:1, message: "rules/turns" } **************************************/ function Slider(config)
knob.className = "slider_knob"; dom.appendChild(knob); // Set value self.value = 0; var _paramToValue = function(param){ var value = config.min + (config.max-config.min)*param; value = Math.round(value/config.step)*config.step; return value; }; var _valueToParam = function(value){ var param = (value-con...
{ var self = this; self.id = config.id; // Create DOM var dom = document.createElement("div"); dom.className = "slider"; dom.style.left = config.x+"px"; dom.style.top = config.y+"px"; dom.style.width = config.width+"px"; self.dom = dom; // Background var bg = document.createElement("div"); bg.className =...
identifier_body
Slider.js
/************************************** { x:0, y:0, width:433, min:1, max:25, step:1, message: "rules/turns" } **************************************/ function
(config){ var self = this; self.id = config.id; // Create DOM var dom = document.createElement("div"); dom.className = "slider"; dom.style.left = config.x+"px"; dom.style.top = config.y+"px"; dom.style.width = config.width+"px"; self.dom = dom; // Background var bg = document.createElement("div"); bg.cla...
Slider
identifier_name
Slider.js
/************************************** { x:0, y:0, width:433, min:1, max:25, step:1, message: "rules/turns" } **************************************/ function Slider(config){ var self = this; self.id = config.id; // Create DOM var dom = document.createElement("div"); dom.className = "slider"; dom.style.left...
// Add... self.add = function(){ _add(self); }; // Remove... self.remove = function(){ unlisten(self); _remove(self); }; }
////////////////////////////////////////
random_line_split
main.rs
#[macro_use] extern crate serde_derive; extern crate serde; extern crate cargo; extern crate rustc_serialize; extern crate itertools; extern crate tera; extern crate toml; #[cfg(test)] #[macro_use] extern crate hamcrest; mod context; mod planning; mod rendering; mod settings; mod util; mod bazel; use bazel::BazelRen...
<T: AsRef<Path>>(cargo_toml_path: T) -> Result<RazeSettings, CargoError> { let path = cargo_toml_path.as_ref(); let mut toml = try!(File::open(path) .map_err(|e| { println!("{:?}", e); CargoError::from(format!("Could not load {:?}", path)) ...
load_settings
identifier_name
main.rs
#[macro_use] extern crate serde_derive; extern crate serde; extern crate cargo; extern crate rustc_serialize; extern crate itertools; extern crate tera; extern crate toml; #[cfg(test)] #[macro_use] extern crate hamcrest; mod context; mod planning; mod rendering; mod settings; mod util; mod bazel; use bazel::BazelRen...
if settings.workspace_path.ends_with("/") { settings.workspace_path.pop(); } return Ok(()) } fn write_to_file_loudly(path: &str, contents: &str) -> CargoResult<()> { try!(File::create(&path) .and_then(|mut f| f.write_all(contents.as_bytes())) .map_err(|_| CargoError::from(format!("failed to cr...
{ return Err(CargoError::from("raze.workspace_path must not be '//' (it is currently unsupported). Its probably not what you want anyway, as this would vendor the crates directly into //vendor.")); }
conditional_block
main.rs
#[macro_use] extern crate serde_derive; extern crate serde; extern crate cargo; extern crate rustc_serialize; extern crate itertools; extern crate tera; extern crate toml; #[cfg(test)] #[macro_use] extern crate hamcrest; mod context; mod planning; mod rendering; mod settings; mod util; mod bazel; use bazel::BazelRen...
fn write_to_file_loudly(path: &str, contents: &str) -> CargoResult<()> { try!(File::create(&path) .and_then(|mut f| f.write_all(contents.as_bytes())) .map_err(|_| CargoError::from(format!("failed to create {}", path)))); println!("Generated {} successfully", path); Ok(()) } fn load_settings<T: AsRef...
{ if !settings.workspace_path.starts_with("//") { return Err(CargoError::from("raze.workspace_path must start with \"//\". Paths into local repositories (such as @local//path) are currently unsupported.")) } if settings.workspace_path == "//" { return Err(CargoError::from("raze.workspace_path must not be...
identifier_body
main.rs
#[macro_use] extern crate serde_derive; extern crate serde; extern crate cargo; extern crate rustc_serialize; extern crate itertools; extern crate tera; extern crate toml; #[cfg(test)] #[macro_use] extern crate hamcrest; mod context; mod planning; mod rendering; mod settings; mod util; mod bazel; use bazel::BazelRen...
let planned_build = try!(planner.plan_build()); let mut bazel_renderer = BazelRenderer::new(); let render_details = RenderDetails { path_prefix: "./".to_owned(), }; let bazel_file_outputs = match settings.genmode { GenMode::Vendored => try!(bazel_renderer.render_planned_build(&render_details, &plann...
random_line_split
passmanager.js
() {} PassManager.prototype = { classID: Components.ID("{1dadf2b7-f243-41b4-a2f2-e53207f29167}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginManagerStorage]), _environment: null, _propMap: null, _passCmd: "", _realm: "", _fuzzy: false, _save_as_username: false, _storage_json: null, _strip_hostnames: [...
PassManager
identifier_name
passmanager.js
}; let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); entry.timer = timer; entry.cache = this; this._entries[key] = entry; timer.initWithCallback(entry, lifetime, Ci.nsITimer.TYPE_ONE_SHOT); } }, del: function (key) { if (this._entries[key]) { this._entries[key].ti...
else { login.formSubmitURL = md.formSubmitURL; login.httpRealm = md.httpRealm; } } if (!login.usernameField) { login.usernameField = md.usernameField; } if (!login.passwordField) { login.passwordField = md.passwordField; } return login; }, _filterLogins: function (matchData) { // copy...
{ // no info if protocol or HTML login requested, // choose HTML since we may return an empty string // as wildcard here login.formSubmitURL = ""; }
conditional_block
passmanager.js
._propMap[prop]) { for each (let name in this._propMap[prop]) { if (props[name]) { login[prop] = props[name]; break; } } } } return login; }, _saveLogin: function (loginPath, login) { this._pass(["insert", "-m", "-f", loginPath], this._loginToStr(login)); // update cach...
return;
random_line_split
passmanager.js
PassManager.prototype = { classID: Components.ID("{1dadf2b7-f243-41b4-a2f2-e53207f29167}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginManagerStorage]), _environment: null, _propMap: null, _passCmd: "", _realm: "", _fuzzy: false, _save_as_username: false, _storage_json: null, _strip_hostnames: [], ...
{}
identifier_body
present-to-all.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDe...
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var CommunicationPresentToAll = function CommunicationPresentToAll(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M21 3H3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h18c1.11 0 2...
_interopRequireDefault
identifier_name
present-to-all.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDe...
CommunicationPresentToAll.muiName = 'SvgIcon'; exports.default = CommunicationPresentToAll;
_react2.default.createElement('path', { d: 'M21 3H3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h18c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2zm0 16.02H3V4.98h18v14.04zM10 12H8l4-4 4 4h-2v4h-4v-4z' }) ); }; CommunicationPresentToAll = (0, _pure2.default)(CommunicationPresentToAll); CommunicationPresentToAll.displayName = 'Commu...
random_line_split
present-to-all.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDe...
var CommunicationPresentToAll = function CommunicationPresentToAll(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M21 3H3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h18c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2zm0 16.02H3V4.98h18v14.04zM10 12H8l4-...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
models.py
from django.db import models from django.utils import timezone class ReceiveAddress(models.Model): address = models.CharField(max_length=128, blank=True) available = models.BooleanField(default=True) @classmethod
receive_address.address = address receive_address.available = True return receive_address def use(self): self.available = False self.save() class MoneySent(models.Model): from_address = models.CharField(max_length=128) to_address = models.CharField(max_length=128) ...
def newAddress(cls, address): receive_address = cls()
random_line_split
models.py
from django.db import models from django.utils import timezone class ReceiveAddress(models.Model): address = models.CharField(max_length=128, blank=True) available = models.BooleanField(default=True) @classmethod def
(cls, address): receive_address = cls() receive_address.address = address receive_address.available = True return receive_address def use(self): self.available = False self.save() class MoneySent(models.Model): from_address = models.CharField(max_length=128) ...
newAddress
identifier_name
models.py
from django.db import models from django.utils import timezone class ReceiveAddress(models.Model): address = models.CharField(max_length=128, blank=True) available = models.BooleanField(default=True) @classmethod def newAddress(cls, address): receive_address = cls() receive_address.add...
def confirm_trn(self): self.status = MoneySent.CONFIRMED_TRN self.touch() self.save()
if self.status == MoneySent.CREATED or self.status == MoneySent.SENT: self.status = MoneySent.CONFIRMED_IPN self.touch() self.save()
identifier_body
models.py
from django.db import models from django.utils import timezone class ReceiveAddress(models.Model): address = models.CharField(max_length=128, blank=True) available = models.BooleanField(default=True) @classmethod def newAddress(cls, address): receive_address = cls() receive_address.add...
self.touch() self.save() def confirm_trn(self): self.status = MoneySent.CONFIRMED_TRN self.touch() self.save()
self.status = MoneySent.CONFIRMED_IPN
conditional_block
fibonacci_word.rs
// Implements http://rosettacode.org/wiki/Fibonacci_word use entropy::shannon_entropy; mod entropy; // Returns "amount" fibonacci words as a vector of tuples // The first value of the tuple is the length of the word // and the second one its entropy fn fib_words(amount: usize) -> Vec<(usize, f64)> { let mut data =...
let mut next = String::from("0"); // The first two words (we need to add them manually because // they are the base of the sequence) data.push((previous.len(), shannon_entropy(&previous[..]))); data.push((next.len(), shannon_entropy(&next[..]))); // The rest of the words for _ in (3..amoun...
random_line_split
fibonacci_word.rs
// Implements http://rosettacode.org/wiki/Fibonacci_word use entropy::shannon_entropy; mod entropy; // Returns "amount" fibonacci words as a vector of tuples // The first value of the tuple is the length of the word // and the second one its entropy fn fib_words(amount: usize) -> Vec<(usize, f64)>
#[cfg(not(test))] fn main() { println!("Calculating... This may take a couple of minutes...\n"); let words = fib_words(18); let mut i = 1; println!("{:>2}:{:>10} {}", "N", "length", "entropy"); for &(length, entropy) in &words { println!("{:>2}:{:>10} {:.15}", i, length, entropy); ...
{ let mut data = Vec::with_capacity(amount); let mut previous = String::from("1"); let mut next = String::from("0"); // The first two words (we need to add them manually because // they are the base of the sequence) data.push((previous.len(), shannon_entropy(&previous[..]))); data.push((nex...
identifier_body
fibonacci_word.rs
// Implements http://rosettacode.org/wiki/Fibonacci_word use entropy::shannon_entropy; mod entropy; // Returns "amount" fibonacci words as a vector of tuples // The first value of the tuple is the length of the word // and the second one its entropy fn fib_words(amount: usize) -> Vec<(usize, f64)> { let mut data =...
() { let expected = vec![ (1, 0.000000000000000f64), (1, 0.000000000000000), (2, 1.000000000000000), (3, 0.918295834054490), (5, 0.970950594454669), (8, 0.954434002924965), (13, 0.961236604722876), (21, 0.958711882977132), (34, 0.9596868937742...
test_fibonacii_words
identifier_name
editorModel.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
extends BaseTextEditorModel { } suite('Workbench - EditorModel', () => { test('EditorModel', function (done) { let m = new MyEditorModel(); m.load().then(function (model) { assert(model === m); assert.strictEqual(m.isResolved(), true); }).done(() => done()); }); test('BaseTextEditorModel', function (...
MyTextEditorModel
identifier_name
editorModel.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
}); test('TextDiffEditorModel', function (done) { let services = new ServiceCollection(); services.set(IModeService, createMockModeService()); services.set(IModelService, createMockModelService()); let inst = new InstantiationService(services); let input = inst.createInstance(StringEditorInput, 'name', 'de...
}); }).done(() => { m.dispose(); done(); });
random_line_split
0026_auto_20160426_1232.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-04-26 12:32 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
), migrations.AddField( model_name='staff', name='designation', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='iiits.StaffDesignation'), ), ]
dependencies = [ ('iiits', '0025_auto_20160425_1937'), ] operations = [ migrations.CreateModel( name='Staff', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharF...
identifier_body
0026_auto_20160426_1232.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-04-26 12:32 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ ('iiits', '0025_auto_20160425_1937'), ] operations = [ migrations.CreateModel( name='Staff', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
Migration
identifier_name
0026_auto_20160426_1232.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-04-26 12:32 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
('iiits', '0025_auto_20160425_1937'), ] operations = [ migrations.CreateModel( name='Staff', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=1...
dependencies = [
random_line_split
4d0be367f095_station_timezone.py
"""add timezone to each station Revision ID: 4d0be367f095 Revises: 6722b0ef4e1 Create Date: 2014-03-19 16:43:00.326820 """ # revision identifiers, used by Alembic. revision = '4d0be367f095' down_revision = '6722b0ef4e1' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated ...
op.drop_column('radio_station', 'timezone') ### end Alembic commands ###
identifier_body
4d0be367f095_station_timezone.py
"""add timezone to each station Revision ID: 4d0be367f095 Revises: 6722b0ef4e1 Create Date: 2014-03-19 16:43:00.326820 """ # revision identifiers, used by Alembic. revision = '4d0be367f095' down_revision = '6722b0ef4e1' from alembic import op import sqlalchemy as sa def
(): ### commands auto generated by Alembic - please adjust! ### op.add_column('radio_station', sa.Column('timezone', sa.String(length=32), nullable=True)) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('radio_station', 'time...
upgrade
identifier_name
4d0be367f095_station_timezone.py
"""add timezone to each station Revision ID: 4d0be367f095 Revises: 6722b0ef4e1 Create Date: 2014-03-19 16:43:00.326820 """ # revision identifiers, used by Alembic. revision = '4d0be367f095' down_revision = '6722b0ef4e1' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated ...
### commands auto generated by Alembic - please adjust! ### op.drop_column('radio_station', 'timezone') ### end Alembic commands ###
op.add_column('radio_station', sa.Column('timezone', sa.String(length=32), nullable=True)) ### end Alembic commands ### def downgrade():
random_line_split
emoji-objects-outlined.js
import { h } from 'omi'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon(h(h.f, null, h("path", { d: "M12 3c-.46 0-.93.04-1.4.14-2.76.53-4.96 2.76-5.48 5.52-.48 2.61.48 5.01 2.22 6.56.43.38.66.91.66 1.47V19c0 1.1.9 2 2 2h.28c.35.6.98 1 1.72 1s1.38-.4 1.72-1H14c1.1 0 2-.9 2-2v-2.31c0-.5...
})), 'EmojiObjectsOutlined');
random_line_split
Asm.py
def filename_directive(filename): return "\t.file\t\"{0}\"\n".format(filename) def compiler_ident_directive(): return "\t.ident\t\"{0}\"\n".format("HEROCOMP - Tomas Mikula 2017") def text_directive(): return "\t.text\n" def data_directive(): return "\t.data\n" def quad_directive(arg): return...
code += "\n" return code def number_constant(number): return "${0}".format(number)
if i == len(args) - 1: code += "{0}".format(args[i]) else: code += "{0}, ".format(args[i])
conditional_block
Asm.py
def filename_directive(filename): return "\t.file\t\"{0}\"\n".format(filename) def compiler_ident_directive(): return "\t.ident\t\"{0}\"\n".format("HEROCOMP - Tomas Mikula 2017") def text_directive(): return "\t.text\n" def data_directive(): return "\t.data\n" def quad_directive(arg): return...
def global_directive(arg): return "\t.global\t{0}\n".format(arg) def label(name): return "{0}:\n".format(name) def instruction(name, *args): code = "\t{0}\t".format(name) for i in range(len(args)): if i == len(args) - 1: code += "{0}".format(args[i]) else: c...
def global_array(identifier, size): return "\t.comm {0},{1},32\n".format(identifier, size * 8)
random_line_split
Asm.py
def filename_directive(filename): return "\t.file\t\"{0}\"\n".format(filename) def compiler_ident_directive(): return "\t.ident\t\"{0}\"\n".format("HEROCOMP - Tomas Mikula 2017") def text_directive(): return "\t.text\n" def
(): return "\t.data\n" def quad_directive(arg): return "\t.quad\t{}\n".format(arg) def global_array(identifier, size): return "\t.comm {0},{1},32\n".format(identifier, size * 8) def global_directive(arg): return "\t.global\t{0}\n".format(arg) def label(name): return "{0}:\n".format(name) d...
data_directive
identifier_name
Asm.py
def filename_directive(filename): return "\t.file\t\"{0}\"\n".format(filename) def compiler_ident_directive(): return "\t.ident\t\"{0}\"\n".format("HEROCOMP - Tomas Mikula 2017") def text_directive():
def data_directive(): return "\t.data\n" def quad_directive(arg): return "\t.quad\t{}\n".format(arg) def global_array(identifier, size): return "\t.comm {0},{1},32\n".format(identifier, size * 8) def global_directive(arg): return "\t.global\t{0}\n".format(arg) def label(name): return "{0}...
return "\t.text\n"
identifier_body
cmd_user_info.py
# -*- coding: utf-8 -*- # Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com) # # Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> # # 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 ...
(*args, **kw): from pykolab import wap_client try: user = conf.cli_args.pop(0) except IndexError, errmsg: user = utils.ask_question(_("User")) # Create the authentication object. # TODO: Binds with superuser credentials! wap_client.authenticate(username=conf.get("ldap", "bind_d...
execute
identifier_name
cmd_user_info.py
# -*- coding: utf-8 -*- # Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com) # # Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> # # 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 ...
from pykolab import wap_client try: user = conf.cli_args.pop(0) except IndexError, errmsg: user = utils.ask_question(_("User")) # Create the authentication object. # TODO: Binds with superuser credentials! wap_client.authenticate(username=conf.get("ldap", "bind_dn"), password=conf....
identifier_body
cmd_user_info.py
# -*- coding: utf-8 -*- # Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com) # # Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> # # 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 ...
import pykolab from pykolab import utils from pykolab.translate import _ log = pykolab.getLogger('pykolab.cli') conf = pykolab.getConf() def __init__(): commands.register('user_info', execute, description="Display user information.") def execute(*args, **kw): from pykolab import wap_client try: ...
import commands
random_line_split
migrations.config.ts
import {ethers} from "ethers" const defaultConfig = { bondingManager: { numTranscoders: 20, numActiveTranscoders: 10, unbondingPeriod: 7, maxEarningsClaimsRounds: 20 }, broker: { // TODO: Consider updating these values prior to deploying to testnet unlockPeri...
(network: string) { if (!(network in networkConfigs)) { return defaultConfig } return networkConfigs[network] }
getNetworkConfig
identifier_name
migrations.config.ts
import {ethers} from "ethers" const defaultConfig = { bondingManager: { numTranscoders: 20, numActiveTranscoders: 10, unbondingPeriod: 7, maxEarningsClaimsRounds: 20 }, broker: { // TODO: Consider updating these values prior to deploying to testnet unlockPeri...
rinkeby, rinkebyDevnet, arbitrumRinkeby, arbitrumRinkebyDevnet, arbitrumMainnet } export default function getNetworkConfig(network: string) { if (!(network in networkConfigs)) { return defaultConfig } return networkConfigs[network] }
random_line_split
migrations.config.ts
import {ethers} from "ethers" const defaultConfig = { bondingManager: { numTranscoders: 20, numActiveTranscoders: 10, unbondingPeriod: 7, maxEarningsClaimsRounds: 20 }, broker: { // TODO: Consider updating these values prior to deploying to testnet unlockPeri...
return networkConfigs[network] }
{ return defaultConfig }
conditional_block
migrations.config.ts
import {ethers} from "ethers" const defaultConfig = { bondingManager: { numTranscoders: 20, numActiveTranscoders: 10, unbondingPeriod: 7, maxEarningsClaimsRounds: 20 }, broker: { // TODO: Consider updating these values prior to deploying to testnet unlockPeri...
{ if (!(network in networkConfigs)) { return defaultConfig } return networkConfigs[network] }
identifier_body
move_semantics2.rs
// Make me compile without changing line 9! Scroll down for hints :) pub fn main()
fn fill_vec(vec: &mut Vec<i32>) { vec.push(22); vec.push(44); vec.push(66); } // So `vec0` is being *moved* into the function `fill_vec` when we call it on // line 6, which means it gets dropped at the end of `fill_vec`, which means we // can't use `vec0` again on line 9 (or anywhere else in...
{ let mut vec0 = Vec::new(); fill_vec(&mut vec0); // Do not change the following line! println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0); vec0.push(88); println!("{} has length {} content `{:?}`", "vec1", vec0.len(), vec0); }
identifier_body
move_semantics2.rs
// Make me compile without changing line 9! Scroll down for hints :) pub fn main() { let mut vec0 = Vec::new(); fill_vec(&mut vec0); // Do not change the following line! println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0); vec0.push(88); println!("{} has length {} content ...
// `fill_vec` call for that matter). We could fix this in a few ways, try them // all! // 1. Make another, separate version of the data that's in `vec0` and pass that // to `fill_vec` instead. // 2. Make `fill_vec` borrow its argument instead of taking ownership of it, // and then copy the data within the function in o...
// line 6, which means it gets dropped at the end of `fill_vec`, which means we // can't use `vec0` again on line 9 (or anywhere else in `main` after the
random_line_split
move_semantics2.rs
// Make me compile without changing line 9! Scroll down for hints :) pub fn main() { let mut vec0 = Vec::new(); fill_vec(&mut vec0); // Do not change the following line! println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0); vec0.push(88); println!("{} has length {} content ...
(vec: &mut Vec<i32>) { vec.push(22); vec.push(44); vec.push(66); } // So `vec0` is being *moved* into the function `fill_vec` when we call it on // line 6, which means it gets dropped at the end of `fill_vec`, which means we // can't use `vec0` again on line 9 (or anywhere else in `main` after...
fill_vec
identifier_name
contact_model.rs
#![allow(missing_docs)] use downcast_rs::Downcast; use na::{DVector, RealField}; use ncollide::query::ContactId; use crate::detection::ColliderContactManifold; use crate::material::MaterialsCoefficientsTable; use crate::object::{BodyHandle, BodySet, ColliderHandle}; use crate::solver::{ConstraintSet, IntegrationParam...
manifolds: &[ColliderContactManifold<N, Handle, CollHandle>], ground_j_id: &mut usize, j_id: &mut usize, jacobians: &mut [N], constraints: &mut ConstraintSet<N, Handle, CollHandle, ContactId>, ); /// Stores all the impulses found by the solver into a cache for warmstarti...
random_line_split
index.js
/* * Katana - a powerful, open-source screenshot utility * * Copyright (C) 2018, Gage Alexander <gage@washedout.co> * * Katana 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 th...
console.log(`Package created, path: ${path}`) })
{ return ( console.log(`Error: ${error}`) ) }
conditional_block
index.js
/* * Katana - a powerful, open-source screenshot utility * * Copyright (C) 2018, Gage Alexander <gage@washedout.co> * * Katana 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 th...
return ( console.log(`Error: ${error}`) ) } console.log(`Package created, path: ${path}`) })
packager(options, (error, path) => { if (error) {
random_line_split
index.d.ts
// store.js exposes a simple API for cross browser local storage interface StoreJSStatic { set(key: string, value: any): any; get(key: string): any; remove(key: string): void; clear(): void; enabled: boolean; disabled: boolean; transact(key: string, defaultValue: any, transactionFn?: (val: any) => void): void;...
// Type definitions for store.js 1.3 // Project: https://github.com/marcuswestin/store.js/ // Definitions by: Vincent Bortone <https://github.com/vbortone/> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
random_line_split
IGuildCollection.js
"use strict"; const ICollectionBase = require("./ICollectionBase"); const IGuild = require("./IGuild"); const Utils = require("../core/Utils"); const rest = require("../networking/rest"); /** * @interface * @extends ICollectionBase */ class IGuildCollection extends ICollectionBase { constructor(discordie, value...
const toRaw = (data, param) => { data = data || []; if (!Array.isArray(data)) throw TypeError("Param '" + param + "' must be an array"); return data.map(v => { return typeof v.getRaw === "function" ? v.getRaw() : null; }).filter(v => v); }; roles = toRaw(roles, "r...
{ icon = Utils.imageToDataURL(icon); }
conditional_block
IGuildCollection.js
"use strict"; const ICollectionBase = require("./ICollectionBase"); const IGuild = require("./IGuild"); const Utils = require("../core/Utils"); const rest = require("../networking/rest"); /** * @interface * @extends ICollectionBase */ class IGuildCollection extends ICollectionBase { constructor(discordie, value...
roles = toRaw(roles, "roles"); channels = toRaw(channels, "channels"); return new Promise((rs, rj) => { rest(this._discordie).guilds.createGuild( name, region, icon, roles, channels, verificationLevel, defaultMessageNotifications ) .then(guild => rs(this._discordi...
}).filter(v => v); };
random_line_split
IGuildCollection.js
"use strict"; const ICollectionBase = require("./ICollectionBase"); const IGuild = require("./IGuild"); const Utils = require("../core/Utils"); const rest = require("../networking/rest"); /** * @interface * @extends ICollectionBase */ class IGuildCollection extends ICollectionBase { constructor(discordie, value...
(name, region, icon, roles, channels, verificationLevel, defaultMessageNotifications) { if (icon instanceof Buffer) { icon = Utils.imageToDataURL(icon); } const toRaw = (data, param) => { data = data || []; if (!Array.isArray(data)) throw TypeError("Param '" + pa...
create
identifier_name
cmdline_args.py
import sys import logging import argparse argparser = argparse.ArgumentParser(description='Hummingbird - ' 'Monitoring and Analysing FXI experiments.') _group = argparser.add_mutually_exclusive_group() _group.add_argument("-i", "--interface", help="start the con...
global _config_argument_group if _config_argument_group is None: _config_argument_group = argparser.add_argument_group('Configuration file', 'Configuration file specific options') # Avoid that arguments get added twice when reloading the configuration file added = any([(args == args_added) and all(s...
identifier_body
cmdline_args.py
import sys import logging import argparse argparser = argparse.ArgumentParser(description='Hummingbird - ' 'Monitoring and Analysing FXI experiments.') _group = argparser.add_mutually_exclusive_group() _group.add_argument("-i", "--interface", help="start the con...
(*args, **kwargs): global _config_argument_group if _config_argument_group is None: _config_argument_group = argparser.add_argument_group('Configuration file', 'Configuration file specific options') # Avoid that arguments get added twice when reloading the configuration file added = any([(args =...
add_config_file_argument
identifier_name
cmdline_args.py
import sys import logging import argparse argparser = argparse.ArgumentParser(description='Hummingbird - ' 'Monitoring and Analysing FXI experiments.') _group = argparser.add_mutually_exclusive_group() _group.add_argument("-i", "--interface", help="start the con...
# Add euxfel-specific arguments to argparser try: from backend.euxfel import add_cmdline_args add_cmdline_args() from backend.euxfel_trains import add_cmdline_args add_cmdline_args() except ImportError: pass _config_argument_group = None _config_file_arguments_added = [] def add_config_file_argumen...
random_line_split
cmdline_args.py
import sys import logging import argparse argparser = argparse.ArgumentParser(description='Hummingbird - ' 'Monitoring and Analysing FXI experiments.') _group = argparser.add_mutually_exclusive_group() _group.add_argument("-i", "--interface", help="start the con...
# Avoid that arguments get added twice when reloading the configuration file added = any([(args == args_added) and all(set(kwargs.items()) & set(kwargs_added.items())) for args_added,kwargs_added in _config_file_arguments_added]) if not added: _config_argument_group.add_argument(*args, **kwargs) ...
_config_argument_group = argparser.add_argument_group('Configuration file', 'Configuration file specific options')
conditional_block
constants.ts
export class Constants { static ROW_BUFFER_SIZE = 10; static LAYOUT_INTERVAL = 500; static BATCH_WAIT_MILLIS = 50; static EXPORT_TYPE_DRAG_COPY = 'dragCopy'; static EXPORT_TYPE_CLIPBOARD = 'clipboard'; static EXPORT_TYPE_EXCEL = 'excel'; static EXPORT_TYPE_CSV = 'csv'; static ROW_MODE...
static SORT_DESC = 'desc'; static INPUT_SELECTOR = 'input, select, button, textarea'; static FOCUSABLE_SELECTOR = '[tabindex], input, select, button, textarea'; static FOCUSABLE_EXCLUDE = '.ag-hidden, .ag-hidden *, [disabled], .ag-disabled, .ag-disabled *'; }
static SORT_ASC = 'asc';
random_line_split
constants.ts
export class
{ static ROW_BUFFER_SIZE = 10; static LAYOUT_INTERVAL = 500; static BATCH_WAIT_MILLIS = 50; static EXPORT_TYPE_DRAG_COPY = 'dragCopy'; static EXPORT_TYPE_CLIPBOARD = 'clipboard'; static EXPORT_TYPE_EXCEL = 'excel'; static EXPORT_TYPE_CSV = 'csv'; static ROW_MODEL_TYPE_INFINITE = 'inf...
Constants
identifier_name
ddm_mla_test.py
#!/usr/bin/env python """ Copyright (C) 2017, California Institute of Technology This file is part of addm_toolbox. addm_toolbox 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, ...
(args): """ Wrapper for DDM.get_model_log_likelihood(), intended for parallel computation using a threadpool. Args: args: a tuple where the first item is a DDM object, and the remaining item are the same arguments required by DDM.get_model_log_likelihood(). Returns: T...
wrap_ddm_get_model_log_likelihood
identifier_name
ddm_mla_test.py
#!/usr/bin/env python """ Copyright (C) 2017, California Institute of Technology This file is part of addm_toolbox. addm_toolbox 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, ...
trialConditions = load_trial_conditions_from_csv(trialsFileName) # Generate artificial data. dataRTLeft = dict() dataRTRight = dict() for trialCondition in trialConditions: dataRTLeft[trialCondition] = list() dataRTRight[trialCondition] = list() model = DDM(d, sigma) for tr...
trialsFileName = pkg_resources.resource_filename( u"addm_toolbox", u"test_data/test_trial_conditions.csv")
conditional_block
ddm_mla_test.py
#!/usr/bin/env python """ Copyright (C) 2017, California Institute of Technology This file is part of addm_toolbox. addm_toolbox 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, ...
def main(d, sigma, rangeD, rangeSigma, trialsFileName=None, numTrials=10, numSimulations=10, binStep=100, maxRT=8000, numThreads=9, verbose=False): """ Args: d: float, DDM parameter for generating artificial data. sigma: float, DDM parameter for generating artificial data. ...
""" Wrapper for DDM.get_model_log_likelihood(), intended for parallel computation using a threadpool. Args: args: a tuple where the first item is a DDM object, and the remaining item are the same arguments required by DDM.get_model_log_likelihood(). Returns: The output of...
identifier_body
ddm_mla_test.py
#!/usr/bin/env python """ Copyright (C) 2017, California Institute of Technology This file is part of addm_toolbox. addm_toolbox 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, ...
""" from __future__ import absolute_import import numpy as np import pkg_resources from builtins import range, str from multiprocessing import Pool from .ddm_mla import DDM from .util import load_trial_conditions_from_csv def wrap_ddm_get_model_log_likelihood(args): """ Wrapper for DDM.get_model_log_likel...
a maximum likelihood estimation procedure, using a grid search over the 2 free parameters of the model.
random_line_split
tr-TR.js
(function (global, factory) { if (typeof define === "function" && define.amd) { define('element/locale/tr-TR', ['module', 'exports'], factory); } else if (typeof exports !== "undefined") { factory(module, exports); } else { var mod = { exports: {} }; factory(mod, mod.exports); global...
month2: 'Şubat', month3: 'Mart', month4: 'Nisan', month5: 'Mayıs', month6: 'Haziran', month7: 'Temmuz', month8: 'Ağustos', month9: 'Eylül', month10: 'Ekim', month11: 'Kasım', month12: 'Aralık', // week: 'week', weeks...
endDate: 'Bitiş Tarihi', endTime: 'Bitiş Saati', year: '', month1: 'Ocak',
random_line_split
tr-TR.js
(function (global, factory) { if (typeof define === "function" && define.amd) { define('element/locale/tr-TR', ['module', 'exports'], factory); } else if (typeof exports !== "undefined") { factory(module, exports); } else
})(this, function (module, exports) { 'use strict'; exports.__esModule = true; exports.default = { el: { colorpicker: { confirm: 'OK', clear: 'Temizle' }, datepicker: { now: 'Şimdi', today: 'Bugün', cancel: 'İptal', clear: 'Temizle', ...
{ var mod = { exports: {} }; factory(mod, mod.exports); global.ELEMENT.lang = global.ELEMENT.lang || {}; global.ELEMENT.lang.trTR = mod.exports; }
conditional_block
editor.js
(function() { tinymce.PluginManager.requireLangPack('kotofey_shortcodes'); tinymce.create('tinymce.plugins.kotofey_shortcodes', { init : function(ed, url) { ed.addCommand('mcekotofey_shortcodes', function() { ed.windowManager.open({ file : url + '/interface.php', width : 290 + ed.getLang('kotofey_...
ed.onNodeChange.add(function(ed, cm, n) { cm.setActive('kotofey_shortcodes', n.nodeName == 'IMG'); }); }, createControl : function(n, cm) { return null; }, getInfo : function() { return { longname : 'kotofey_shortcodes', author : 'kotofey', authorurl : 'http://themefor...
ed.addButton('kotofey_shortcodes', { title : 'Click to add a shortcode', cmd : 'mcekotofey_shortcodes', image : url + '/shortcode_button.png' });
random_line_split
index.js
'use strict'; const globalHooks = require('../../../hooks'); const hooks = require('feathers-hooks'); const auth = require('feathers-authentication').hooks; exports.before = { all: [], find: [ // auth.verifyToken(), // auth.populateUser(), // auth.restrictToAuthenticated() ], get: [ // auth.ve...
exports.after = { all: [hooks.remove('password')], find: [], get: [], create: [], update: [], patch: [], remove: [] };
] };
random_line_split
Bills.py
import time from Facturacion.Objects.Bill import Bill, ItemLine from Facturacion.Controllers.ControlDB import BillsController from Facturacion.Collections.Vendors import Vendors from Facturacion.Collections.Clients import Clients from Facturacion.Collections.Items import Items class Bills: facturas = {} contr...
(cls): for bill in cls.controller.get_bills(): cls.facturas[bill[0]] = Bill(bill[0], Vendors.vendedores[bill[1]], Clients.clientes[bill[2]], bill[3]) cls.load_items(bill[0]) @classmethod def load_items(cls, cod_factura): factura = cls.facturas[cod_factura] for it...
load_bills
identifier_name
Bills.py
import time from Facturacion.Objects.Bill import Bill, ItemLine from Facturacion.Controllers.ControlDB import BillsController from Facturacion.Collections.Vendors import Vendors from Facturacion.Collections.Clients import Clients from Facturacion.Collections.Items import Items class Bills: facturas = {} contr...
@classmethod def get_max_code(cls): if not cls.facturas: return 1 return max(cls.facturas, key=int) + 1 @classmethod def items_to_il(cls, cod_factura, dict_articulos): il_list = [] for item, cant in dict_articulos.items(): il_list.append(ItemLin...
factura.add_item(ItemLine(factura, Items.articulos[item[0]], item[1]))
conditional_block
Bills.py
import time from Facturacion.Objects.Bill import Bill, ItemLine from Facturacion.Controllers.ControlDB import BillsController from Facturacion.Collections.Vendors import Vendors from Facturacion.Collections.Clients import Clients from Facturacion.Collections.Items import Items class Bills: facturas = {} contr...
def add_bill(cls, cod_factura, cif_vendedor, cif_cliente, dict_articulos): if cod_factura in cls.facturas: return vendedor = Vendors.vendedores[cif_vendedor] cliente = Clients.clientes[cif_cliente] fecha = time.strftime("%d/%m/%Y") factura = Bill(cod_factura, vend...
random_line_split