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
source-map-support.ts
import * as Path from 'path' import * as Fs from 'fs' const fileUriToPath: (uri: string) => string = require('file-uri-to-path') const sourceMapSupport = require('source-map-support') /** * This array tells the source map logic which files that we can expect to * be able to resolve a source map for and they should ...
}
{ let frames = stackFrameMap.get(error) if (!frames) { // At this point there's no guarantee that anyone has actually retrieved the // stack on this error which means that our custom prepareStackTrace handler // hasn't run and as a result of that we don't have the native frames stored // in our wea...
identifier_body
i18n.ts
/* * Copyright (c) 2017, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ /** * Conventions: * _message: is for unformatted text that will be shown as-is to * ...
\/\/ To edit your sObjects and their fields, edit the corresponding \/\/ .object-meta.xml and .field-meta.xml files. ` };
\/\/ corresponding sObject and its fields. \/\/ This read-only file is used by the Apex Language Server to \/\/ provide code smartness, and is deleted each time you \/\/ refresh your sObject definitions.
random_line_split
hops_editor.py
.isotope) # return isos def
(self): return { "detector": self.detector, "isotope": self.isotope, "active": True, "deflection": self.deflection, "protect": False, "is_baseline": False, } def to_string(self): s = "{}:{}".format(self.isotope, self.de...
to_yaml
identifier_name
hops_editor.py
from pyface.confirmation_dialog import ConfirmationDialog from pyface.constant import OK, CANCEL, YES from pyface.file_dialog import FileDialog from traits.api import ( HasTraits, Str, List, Int, Any, Button, Bool, on_trait_change, Instance, ) from traitsui.api import ( View, ...
import yaml
random_line_split
hops_editor.py
(self.isotope) # return isos def to_yaml(self): return { "detector": self.detector, "isotope": self.isotope, "active": True, "deflection": self.deflection, "protect": False, "is_baseline": False, } def to_string(sel...
@on_trait_change("positions:isotope, positions[]") def _handle_position_change(self): self.isotopes_label = ",".join([i.isotope for i in self.positions]) def traits_view(self): from pychron.pychron_constants import ISOTOPES cols = [ ObjectColumn(name="name", label="",...
idx = self.positions.index(self.selected) self.positions.remove(self.selected) if len(self.positions) > 0: self.selected = self.positions[idx - 1] else: self.selected = None
identifier_body
hops_editor.py
(self.isotope) # return isos def to_yaml(self): return { "detector": self.detector, "isotope": self.isotope, "active": True, "deflection": self.deflection, "protect": False, "is_baseline": False, } def to_string(sel...
def _load(self, p): self.hop_sequence = hs = HopSequence() if p.endswith(".txt"): self.use_yaml = False with open(p, "r") as rfile: hops = [eval(l) for l in fileiter(rfile)] for i, (hopstr, cnt, settle) in enumerate(hops): ...
dialog = FileDialog(action="save as", default_directory=paths.hops_dir) if dialog.open() == OK: p = dialog.path p = add_extension(p, ".yaml" if self.use_yaml else ".txt") self._save_file(p) self.path = p
conditional_block
tagMatcher.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TagMatcher { constructor(corpus, position) { let match = TagMatcher.TAG_REGEX.exec(corpus); const tags = []; // Gather all the existing tags. while (match) { // Node is a self closing tag, ...
else { // We have an unmatched closing tag, // so try and match it with any existing tag. for (let i = stack.length - 1; i >= 0; i--) { const openNode = stack[i]; if (openNode.type === 'open' && openNode.name === tag.na...
{ stack.push(tag); }
conditional_block
tagMatcher.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TagMatcher { constructor(corpus, position) { let match = TagMatcher.TAG_REGEX.exec(corpus); const tags = []; // Gather all the existing tags. while (match) { // Node is a self closing tag, ...
const tagsSurrounding = matchedTags.filter(n => { return position >= n.openingTagStart && position <= n.closingTagEnd; }); if (!tagsSurrounding.length) { return; } // The first one should be the most relevant tag. const nodeSurrounding = tagsSurrou...
} } }
random_line_split
tagMatcher.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TagMatcher {
(corpus, position) { let match = TagMatcher.TAG_REGEX.exec(corpus); const tags = []; // Gather all the existing tags. while (match) { // Node is a self closing tag, skip. if (match[TagMatcher.CLOSE_FORWARD_SLASH]) { match = TagMatcher.TAG_REGEX.exe...
constructor
identifier_name
main.rs
// This file is part of oxideNews-gtk // // Copyright © 2017-2018 red-oxide Developers // // 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 optio...
{ let application = gtk::Application::new(gtk3::APP_ID, gio::ApplicationFlags::empty()).expect("Could not create application"); gtk3::App::new(application).connect_events().then_execute(); }
pub mod common; #[cfg(feature = "gtk3")] fn main()
random_line_split
main.rs
// This file is part of oxideNews-gtk // // Copyright © 2017-2018 red-oxide Developers // // 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 optio...
let application = gtk::Application::new(gtk3::APP_ID, gio::ApplicationFlags::empty()).expect("Could not create application"); gtk3::App::new(application).connect_events().then_execute(); }
identifier_body
main.rs
// This file is part of oxideNews-gtk // // Copyright © 2017-2018 red-oxide Developers // // 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 optio...
) { let application = gtk::Application::new(gtk3::APP_ID, gio::ApplicationFlags::empty()).expect("Could not create application"); gtk3::App::new(application).connect_events().then_execute(); }
ain(
identifier_name
ResponsiveDateRangePicker.tsx
import * as React from 'react'; import TextField from '@material-ui/core/TextField'; import AdapterDateFns from '@material-ui/lab/AdapterDateFns'; import LocalizationProvider from '@material-ui/lab/LocalizationProvider'; import Box from '@material-ui/core/Box'; import MobileDateRangePicker from '@material-ui/lab/Mobile...
renderInput={(startProps, endProps) => ( <React.Fragment> <TextField {...startProps} variant="standard" /> <Box sx={{ mx: 2 }}> to </Box> <TextField {...endProps} variant="standard" /> </React.Fragment> )} /> <DesktopDateRangePicker ...
}}
random_line_split
vehicles_David.py
class Vehicle(object): def __init__(self, make, model, year): self.make = make self.model = model self.year = year def foo(self, a, b, c): print 'does some work' print a, b, c class Car(Vehicle): def __init__(self, doors, *args): Vehicle.__init__(self, ...
self.power = power class Airplane(Vehicle): def __init__(self): pass if __name__ == '__main__': car = Car('honda', 'civic', '2002', '2') car.foo(1, 2, 3) # ============================ EOF =============================
print 'warning: drive type not acceptable' raise TypeError
conditional_block
vehicles_David.py
class Vehicle(object): def __init__(self, make, model, year): self.make = make self.model = model self.year = year def foo(self, a, b, c): print 'does some work' print a, b, c
class Car(Vehicle): def __init__(self, doors, *args): Vehicle.__init__(self, *args) self.doors = doors def foo(self, *args, **kw): print args, kw super(Car, self).foo(*args) class Boat(Vehicle): def __init__(self, power, *args): Vehicle.__init__(self, *args) ...
random_line_split
vehicles_David.py
class Vehicle(object): def __init__(self, make, model, year): self.make = make self.model = model self.year = year def foo(self, a, b, c): print 'does some work' print a, b, c class Car(Vehicle): def __init__(self, doors, *args): Vehicle.__init__(self, ...
(self, power, *args): Vehicle.__init__(self, *args) if power not in ('propeller', 'sail'): print 'warning: drive type not acceptable' raise TypeError self.power = power class Airplane(Vehicle): def __init__(self): pass if __name__ == '__main__': car ...
__init__
identifier_name
vehicles_David.py
class Vehicle(object): def __init__(self, make, model, year): self.make = make self.model = model self.year = year def foo(self, a, b, c): print 'does some work' print a, b, c class Car(Vehicle): def __init__(self, doors, *args): Vehicle.__init__(self, ...
class Airplane(Vehicle): def __init__(self): pass if __name__ == '__main__': car = Car('honda', 'civic', '2002', '2') car.foo(1, 2, 3) # ============================ EOF =============================
Vehicle.__init__(self, *args) if power not in ('propeller', 'sail'): print 'warning: drive type not acceptable' raise TypeError self.power = power
identifier_body
xdisplay.rs
use std::{collections::HashMap, error::Error, fmt, os::raw::c_int, ptr}; use libc; use parking_lot::Mutex; use crate::window::CursorIcon; use super::ffi; /// A connection to an X server. pub struct XConnection { pub xlib: ffi::Xlib, /// Exposes XRandR functions from version < 1.5 pub xrandr: ffi::Xrandr...
(&self) { *self.latest_error.lock() = None; } } impl fmt::Debug for XConnection { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.display.fmt(f) } } impl Drop for XConnection { #[inline] fn drop(&mut self) { unsafe { (self.xlib.XCloseDisplay)(self.display) }...
ignore_error
identifier_name
xdisplay.rs
use std::{collections::HashMap, error::Error, fmt, os::raw::c_int, ptr}; use libc; use parking_lot::Mutex; use crate::window::CursorIcon; use super::ffi; /// A connection to an X server. pub struct XConnection { pub xlib: ffi::Xlib, /// Exposes XRandR functions from version < 1.5 pub xrandr: ffi::Xrandr...
let xlib = ffi::Xlib::open()?; let xcursor = ffi::Xcursor::open()?; let xrandr = ffi::Xrandr_2_2_0::open()?; let xrandr_1_5 = ffi::Xrandr::open().ok(); let xinput2 = ffi::XInput2::open()?; let xlib_xcb = ffi::Xlib_xcb::open()?; let xrender = ffi::Xrender::open()?;...
Option<unsafe extern "C" fn(*mut ffi::Display, *mut ffi::XErrorEvent) -> libc::c_int>; impl XConnection { pub fn new(error_handler: XErrorHandler) -> Result<XConnection, XNotSupported> { // opening the libraries
random_line_split
__init__.py
import logging from plumeria.command import commands, CommandError from plumeria.core.storage import pool from plumeria.core.user_prefs import prefs_manager from plumeria.message import Message from plumeria.message.mappings import build_mapping from plumeria.perms import direct_only from plumeria.core.scoped_config.m...
(message: Message): """ Remove a user preference that you have set. Example:: /punset ifttt_maker_key """ pref = find_preference(message.content.strip()) try: await prefs_manager.remove(pref, message.author) return "Removed **{}**.".format(pref.name) except KeyErro...
unset
identifier_name
__init__.py
import logging from plumeria.command import commands, CommandError from plumeria.core.storage import pool from plumeria.core.user_prefs import prefs_manager from plumeria.message import Message from plumeria.message.mappings import build_mapping from plumeria.perms import direct_only from plumeria.core.scoped_config.m...
@commands.create('pref list', 'prefs list', 'prefs', cost=4, category='User Preferences') async def list(message: Message): """ Get a list of preferences that have been set for yourself. Private preferences will not be shown with their value. """ try: prefs = await prefs_manager.get_all(...
""" Get what you have set for a preference. The values of private preferences will not be shown. Example:: /pget some_var """ pref = find_preference(message.content.strip()) try: value = await prefs_manager.get(pref, message.author) shown_value = value if not pref.pri...
identifier_body
__init__.py
import logging from plumeria.command import commands, CommandError from plumeria.core.storage import pool from plumeria.core.user_prefs import prefs_manager from plumeria.message import Message from plumeria.message.mappings import build_mapping from plumeria.perms import direct_only from plumeria.core.scoped_config.m...
raise CommandError("Could not set **{}**: {}".format(name, str(e))) @commands.create('pref unset', 'prefs unset', 'punset', cost=4, category='User Preferences') @direct_only async def unset(message: Message): """ Remove a user preference that you have set. Example:: /punset ifttt_maker_k...
await prefs_manager.put(pref, message.author, raw_value) shown_value = raw_value if not pref.private else "(private)" return "Set **{}** to '{}' for yourself.".format(name, shown_value) except (NotImplementedError, ValueError) as e:
random_line_split
__init__.py
import logging from plumeria.command import commands, CommandError from plumeria.core.storage import pool from plumeria.core.user_prefs import prefs_manager from plumeria.message import Message from plumeria.message.mappings import build_mapping from plumeria.perms import direct_only from plumeria.core.scoped_config.m...
except NotImplementedError as e: raise CommandError("Could not get your preferences: {}".format(str(e))) @commands.create('pref defaults', 'prefs defaults', cost=4, category='User Preferences') async def list_defaults(message: Message): """ Get a list of preferences that can be set. """ p...
raise CommandError("You have not set any preferences.")
conditional_block
zstdelta.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp; use std::ffi::CStr; use std::io; use libc::c_void; use zstd_sys::ZSTD_DCtx_setMaxWindowSize; use zstd_sys::ZSTD_compressBoun...
let outsize = ZSTD_decompress_usingDict( dctx, buf.as_mut_ptr() as *mut c_void, size, delta.as_ptr() as *const c_void, delta.len(), base.as_ptr() as *const c_void, base.len(), ); ZSTD_freeDCtx(dctx); if...
let mut buf: Vec<u8> = Vec::with_capacity(size); buf.set_len(size);
random_line_split
zstdelta.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp; use std::ffi::CStr; use std::io; use libc::c_void; use zstd_sys::ZSTD_DCtx_setMaxWindowSize; use zstd_sys::ZSTD_compressBoun...
else { Ok(buf) } } } #[cfg(test)] mod tests { use quickcheck::quickcheck; use rand::RngCore; use rand::SeedableRng; use rand_chacha::ChaChaRng; use super::*; fn check_round_trip(base: &[u8], data: &[u8]) -> bool { let delta = diff(base, data).expect("delta"); ...
{ let msg = format!( "decompress size mismatch (expected {}, got {})", size, outsize ); Err(io::Error::new(io::ErrorKind::Other, msg)) }
conditional_block
zstdelta.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp; use std::ffi::CStr; use std::io; use libc::c_void; use zstd_sys::ZSTD_DCtx_setMaxWindowSize; use zstd_sys::ZSTD_compressBoun...
(code: usize) -> &'static str { unsafe { // ZSTD_getErrorName returns a static string. let name = ZSTD_getErrorName(code); let cstr = CStr::from_ptr(name); cstr.to_str().expect("zstd error is utf-8") } } /// Create a "zstd delta". Compress `data` using dictionary `base`. pub fn ...
explain_error
identifier_name
zstdelta.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp; use std::ffi::CStr; use std::io; use libc::c_void; use zstd_sys::ZSTD_DCtx_setMaxWindowSize; use zstd_sys::ZSTD_compressBoun...
/// Create a "zstd delta". Compress `data` using dictionary `base`. pub fn diff(base: &[u8], data: &[u8]) -> io::Result<Vec<u8>> { // Customized wlog, hlog to let zstd do better at delta-ing. Use "fast" strategy, which is // good enough assuming the primary space saving is caused by "delta-ing". let log =...
{ unsafe { // ZSTD_getErrorName returns a static string. let name = ZSTD_getErrorName(code); let cstr = CStr::from_ptr(name); cstr.to_str().expect("zstd error is utf-8") } }
identifier_body
rfc-1014.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } } #[cfg(not(windows))] fn close_stdout() { unsafe { libc::close(1); } } fn main() { close_stdout(); println!("hello world"); }
close_stdout
identifier_name
rfc-1014.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[cfg(not(windows))] fn close_stdout() { unsafe { libc::close(1); } } fn main() { close_stdout(); println!("hello world"); }
{ const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } }
identifier_body
rfc-1014.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#![feature(rustc_private)] extern crate libc; type DWORD = u32; type HANDLE = *mut u8; #[cfg(windows)] extern "system" { fn GetStdHandle(which: DWORD) -> HANDLE; fn CloseHandle(handle: HANDLE) -> i32; } #[cfg(windows)] fn close_stdout() { const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; unsafe { Cl...
// ignore-cloudabi stdout does not map to file descriptor 1 by default // ignore-wasm32-bare no libc
random_line_split
pickerQuickAccess.ts
import { IDisposable, DisposableStore, Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { timeout } from 'vs/base/common/async'; export enum TriggerAction { /** * Do nothing after the button was clicked. */ NO_ACTION, /** * Close the picker. */ CLOSE_PICKER, /** * Update the re...
else { additionalPicks = awaitedAdditionalPicks; } if (additionalPicks.length > 0 || !fastPicksApplied) { applyPicks({ items: [...picks, ...additionalPicks], active: activePick || additionalActivePick }); } } finally { if (!picksToken.isCance...
{ additionalPicks = awaitedAdditionalPicks.items; additionalActivePick = awaitedAdditionalPicks.active; }
conditional_block
pickerQuickAccess.ts
import { IDisposable, DisposableStore, Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { timeout } from 'vs/base/common/async'; export enum TriggerAction { /** * Do nothing after the button was clicked. */ NO_ACTION, /** * Close the picker. */ CLOSE_PICKER, /** * Update the re...
<T>(obj: unknown): obj is FastAndSlowPicks<T> { const candidate = obj as FastAndSlowPicks<T>; return !!candidate.picks && candidate.additionalPicks instanceof Promise; } export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem> extends Disposable implements IQuickAccessProvider { private s...
isFastAndSlowPicks
identifier_name
pickerQuickAccess.ts
import { IDisposable, DisposableStore, Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { timeout } from 'vs/base/common/async'; export enum TriggerAction { /** * Do nothing after the button was clicked. */ NO_ACTION, /** * Close the picker. */ CLOSE_PICKER, /** * Update the re...
provide(picker: IQuickPick<T>, token: CancellationToken): IDisposable { const disposables = new DisposableStore(); // Apply options if any picker.canAcceptInBackground = !!this.options?.canAcceptInBackground; // Disable filtering & sorting, we control the results picker.matchOnLabel = picker.matchOnDescr...
{ super(); }
identifier_body
pickerQuickAccess.ts
import { IDisposable, DisposableStore, Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { timeout } from 'vs/base/common/async'; export enum TriggerAction { /** * Do nothing after the button was clicked. */ NO_ACTION, /** * Close the picker. */ CLOSE_PICKER, /** * Update the re...
// Fast and Slow Picks else if (isFastAndSlowPicks(providedPicks)) { let fastPicksApplied = false; let slowPicksApplied = false; await Promise.all([ // Fast Picks: to reduce amount of flicker, we race against // the slow picks over 500ms and then set the fast picks. // If the slow pi...
}
random_line_split
__init__.py
# AsteriskLint -- an Asterisk PBX config syntax checker # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. # # 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 ...
(FuncOdbcAggregator, FileReader): pass
FileFuncOdbcParser
identifier_name
__init__.py
# AsteriskLint -- an Asterisk PBX config syntax checker # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. # # 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 ...
pass class FileFuncOdbcParser(FuncOdbcAggregator, FileReader): pass
class FileConfigParser(ConfigAggregator, FileReader): pass class FileDialplanParser(DialplanAggregator, FileReader):
random_line_split
__init__.py
# AsteriskLint -- an Asterisk PBX config syntax checker # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. # # 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 ...
class FileDialplanParser(DialplanAggregator, FileReader): pass class FileFuncOdbcParser(FuncOdbcAggregator, FileReader): pass
pass
identifier_body
optimize-module.js
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */...
function mergeSourceMaps(file, originalMap, secondMap) { const merged = new sourceMap.SourceMapGenerator(); const inputMap = new sourceMap.SourceMapConsumer(originalMap); new sourceMap.SourceMapConsumer(secondMap) .eachMapping(mapping => { const original = inputMap.originalPositionFor({ line: ...
{ return babel.transform(code, { plugins: [ [constantFolding], [inline, {...inliningOptions, isWrapped: true}], ], babelrc: false, code: false, filename, }); }
identifier_body
optimize-module.js
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */...
const {code, file, transformed} = data; const result = {...data, transformed: {}}; //$FlowIssue #14545724 Object.entries(transformed).forEach(([k, t: TransformResult]: [*, TransformResult]) => { result.transformed[k] = optimize(t, file, code, optimizationOptions); }); return result; } function optim...
{ data = JSON.parse(data); }
conditional_block
optimize-module.js
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */...
(code, map, filename, inliningOptions) { return babel.transform(code, { plugins: [ [constantFolding], [inline, {...inliningOptions, isWrapped: true}], ], babelrc: false, code: false, filename, }); } function mergeSourceMaps(file, originalMap, secondMap) { const merged = new source...
optimizeCode
identifier_name
optimize-module.js
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */...
module.exports = optimizeModule;
}); }); return merged.toJSON(); }
random_line_split
generics.rs
// generics.rs //inline 1 // a function // there's an error here! fn fill_a_vector<T>(param: &T) -> Vec<T> { let mut a_vec: Vec<T> = Vec::new(); let the_param = param.clone(); for _ in range(0,5) { a_vec.push(the_param); } a_vec } // a type type SingleTypeMap<T> = std::collections:HashMap<T, T>; // a struct ...
} // an enum enum vec_or_map<T> { Vec<T>, std::collections::HashMap<T, T> } //end 1 // 2nd version //inline 2 fn fill_a_vector<T: Clone>(param: &T) -> Vec<T> { let mut a_vec: Vec<T> = Vec::new(); let the_param = param.clone(); for _ in range(0,5) { a_vec.push(the_param); } a_vec } //end 2 // final version ...
next: Option<Node<T>>
random_line_split
generics.rs
// generics.rs //inline 1 // a function // there's an error here! fn fill_a_vector<T>(param: &T) -> Vec<T> { let mut a_vec: Vec<T> = Vec::new(); let the_param = param.clone(); for _ in range(0,5) { a_vec.push(the_param); } a_vec } // a type type SingleTypeMap<T> = std::collections:HashMap<T, T>; // a struct ...
<T: Clone>(param: &T) -> Vec<T> { let mut a_vec: Vec<T> = Vec::new(); let the_param = param.clone(); for _ in range(0,5) { a_vec.push(the_param); } a_vec } //end 2 // final version //inline 3 fn fill_a_vector<T: Clone + Copy>(param: &T) -> Vec<T> { let mut a_vec: Vec<T> = Vec::new(); let the_param = param.cl...
fill_a_vector
identifier_name
pro.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Romain Bignon # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your opt...
age): def on_loaded(self): self.browser.select_form(name='telechargement') self.browser['dateDebutPeriode'] = (datetime.date.today() - relativedelta(months=11)).strftime('%d/%m/%Y') self.browser.submit() class ProAccountHistoryCSV(AccountHistory): def get_next_link(self): return...
oAccountHistoryDownload(P
identifier_name
pro.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Romain Bignon # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your opt...
yield a def get_account(self, id): for account in self.get_accounts_list(): if account.id == id: return account raise AccountNotFound('Unable to find account: %s' % id) class ProAccountHistory(Page): def on_loaded(self): link = self.document....
r table in self.document.xpath('//div[@class="comptestabl"]/table'): try: account_type = self.ACCOUNT_TYPES[table.xpath('./caption/text()')[0].strip()] except (IndexError,KeyError): account_type = Account.TYPE_UNKNOWN for tr in table.xpath('./tbody/tr'...
identifier_body
pro.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Romain Bignon # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your opt...
a = Account() a.type = account_type a.id, a.label = map(unicode, link.attrib['title'].split(' ', 1)) tmp_balance = self.parser.tocleanstring(cols[1]) a.currency = a.get_currency(tmp_balance) a.balance = Decimal(Transaction....
continue
random_line_split
pro.py
# -*- coding: utf-8 -*- # Copyright(C) 2014 Romain Bignon # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your opt...
a = Account() a.type = account_type a.id, a.label = map(unicode, link.attrib['title'].split(' ', 1)) tmp_balance = self.parser.tocleanstring(cols[1]) a.currency = a.get_currency(tmp_balance) a.balance = Decimal(Transaction.c...
ntinue
conditional_block
group-detail.component.ts
import {Component, Input} from '@angular/core'; import {Title} from '@angular/platform-browser'; import {RouteParams, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; import {TaxonImage} from './taxon-image'; import {Taxon} from './taxon'; import {Group} from './group'; import {TaxonService} fro...
{ private taxonImages:TaxonImage[] = []; private taxons:Taxon[] = []; id: string; constructor(_routeParams:RouteParams, _service: TaxonService, _title: Title){ let id = _routeParams.get('id'); this.id = id; this.taxonImages = _service.getTaxonImagesForGroup(id); this.taxons = _service.getTaxonsFo...
roupDetailComponent
identifier_name
group-detail.component.ts
import {Component, Input} from '@angular/core'; import {Title} from '@angular/platform-browser'; import {RouteParams, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; import {TaxonImage} from './taxon-image'; import {Taxon} from './taxon'; import {Group} from './group'; import {TaxonService} fro...
<small> <em>{{item.latin}}<span *ngIf="item.unsure">?</span></em> - {{item.name}}<span *ngIf="item.unsure">?</span><br/> <!--{{item.date}}, {{item.site}} &copy; {{item.photographer}}--> </small> </p> </div> </div> `, directives: [ROUTER_DIRECTIVES], providers: [TaxonService,Title] }...
<img src="{{item.image}}" class="img-responsive" alt="{{item.latin}} - {{item.name}} &copy; {{item.photographer}}" /> </a> <p class="text-center">
random_line_split
group-detail.component.ts
import {Component, Input} from '@angular/core'; import {Title} from '@angular/platform-browser'; import {RouteParams, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; import {TaxonImage} from './taxon-image'; import {Taxon} from './taxon'; import {Group} from './group'; import {TaxonService} fro...
let id = _routeParams.get('id'); this.id = id; this.taxonImages = _service.getTaxonImagesForGroup(id); this.taxons = _service.getTaxonsForGroup(id); _title.setTitle('Grupp ' + id + ' - Coleophoridae - Säckmalar'); } }
identifier_body
http_headers.rs
header! { (AmzDate, "X-Amz-Date") => [String] // Annoyingly, the tm! macro isn't exported: https://github.com/hyperium/hyper/pull/515 // test_amz_date {
// } } header! { (Authorization, "Authorization") => [String] // test_auth_header { // test_header!(test1, "AWS4-HMAC-SHA256 Credential=akid/20110909/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=ced6826de92d2bdeed8f846f0bf508e8559e98e4b0199114b84c54174deb456c")...
// test_header!(test1, "20110909T233600Z");
random_line_split
gulpfile.js
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ 'use strict'; // THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE // This is to ensure that we catch env issues b...
gulp.task('format:enforce', loadTask('format', 'enforce')); gulp.task('format', loadTask('format', 'format')); gulp.task('build.sh', loadTask('build', 'all')); gulp.task('build.sh:no-bundle', loadTask('build', 'no-bundle')); gulp.task('public-api:enforce', loadTask('public-api', 'enforce')); gulp.task('public-api:upd...
{ const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); }
identifier_body
gulpfile.js
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ 'use strict'; // THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE // This is to ensure that we catch env issues b...
(fileName, taskName) { const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); } gulp.task('format:enforce', loadTask('format', 'enforce')); gulp.task('format', loadTask('format', 'format')); gulp.task('build.sh', loadTask('build...
loadTask
identifier_name
gulpfile.js
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ 'use strict'; // THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE // This is to ensure that we catch env issues b...
gulp.task('validate-commit-messages', loadTask('validate-commit-message')); gulp.task('tools:build', loadTask('tools-build')); gulp.task('check-cycle', loadTask('check-cycle')); gulp.task('serve', loadTask('serve', 'default')); gulp.task('serve-examples', loadTask('serve', 'examples')); gulp.task('changelog', loadTask(...
random_line_split
multicast.ts
import { Subject } from '../Subject'; import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { Observable } from '../Observable'; import { ConnectableObservable, connectableObservableDescriptor } from '../observable/ConnectableObservable'; /* tslint:disable:max-line-length */ export...
ticastOperator<T> implements Operator<T, T> { constructor(private subjectFactory: () => Subject<T>, private selector: (source: Observable<T>) => Observable<T>) { } call(subscriber: Subscriber<T>, source: any): any { const { selector } = this; const subject = this.subjectFactory(); const ...
pe selector<T> = (source: Observable<T>) => Observable<T>; export class Mul
conditional_block
multicast.ts
import { Subject } from '../Subject'; import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { Observable } from '../Observable'; import { ConnectableObservable, connectableObservableDescriptor } from '../observable/ConnectableObservable'; /* tslint:disable:max-line-length */ export...
ribe(subscriber); subscription.add(source.subscribe(subject)); return subscription; } }
or(subject).subsc
identifier_name
multicast.ts
import { Subject } from '../Subject'; import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { Observable } from '../Observable'; import { ConnectableObservable, connectableObservableDescriptor } from '../observable/ConnectableObservable'; /* tslint:disable:max-line-length */ export...
connectable.subjectFactory = subjectFactory; return <ConnectableObservable<T>> connectable; } export type factoryOrValue<T> = T | (() => T); export type selector<T> = (source: Observable<T>) => Observable<T>; export class MulticastOperator<T> implements Operator<T, T> { constructor(private subjectFactory: () =...
random_line_split
Optimize.tsx
import TsxComponent, { createProps } from 'components/tsx-component'; import { Component } from 'vue-property-decorator'; import SmoothProgressBar from 'components/shared/SmoothProgressBar'; import { Inject } from 'services/core/injector'; import { AutoConfigService, IConfigProgress } from 'services/auto-config'; impor...
{ continue: () => void = () => {}; setProcessing: (bool: boolean) => void = () => {}; } @Component({ props: createProps(OptimizeProps) }) export default class Optimize extends TsxComponent<OptimizeProps> { @Inject() autoConfigService: AutoConfigService; @Inject() videoEncodingOptimizationService: VideoEncodin...
OptimizeProps
identifier_name
Optimize.tsx
import TsxComponent, { createProps } from 'components/tsx-component'; import { Component } from 'vue-property-decorator'; import SmoothProgressBar from 'components/shared/SmoothProgressBar'; import { Inject } from 'services/core/injector'; import { AutoConfigService, IConfigProgress } from 'services/auto-config'; impor...
return 0; } summaryForStep(progress: IConfigProgress) { return { detecting_location: $t('Detecting your location...'), location_found: $t('Detected %{continent}', { continent: progress.continent }), bandwidth_test: $t('Performing bandwidth test...'), streamingEncoder_test: $t('Testi...
return (this.steps.indexOf(this.stepInfo.description) + 1) / this.steps.length; }
random_line_split
Optimize.tsx
import TsxComponent, { createProps } from 'components/tsx-component'; import { Component } from 'vue-property-decorator'; import SmoothProgressBar from 'components/shared/SmoothProgressBar'; import { Inject } from 'services/core/injector'; import { AutoConfigService, IConfigProgress } from 'services/auto-config'; impor...
render() { return ( <div> <h1 class={commonStyles.titleContainer}> {this.optimizing ? `${$t('Optimizing...')} ${Math.floor(this.percentage * 100)}%` : $t('Optimize')} </h1> <div style="width: 60%; margin: auto; text-align: center;"> {$t( ...
{ return { detecting_location: $t('Detecting your location...'), location_found: $t('Detected %{continent}', { continent: progress.continent }), bandwidth_test: $t('Performing bandwidth test...'), streamingEncoder_test: $t('Testing streaming encoder...'), recordingEncoder_test: $t('Tes...
identifier_body
Optimize.tsx
import TsxComponent, { createProps } from 'components/tsx-component'; import { Component } from 'vue-property-decorator'; import SmoothProgressBar from 'components/shared/SmoothProgressBar'; import { Inject } from 'services/core/injector'; import { AutoConfigService, IConfigProgress } from 'services/auto-config'; impor...
else { this.stepInfo = { description: progress.description, summary: this.summaryForStep(progress), percentage: progress.percentage, }; } } else if (progress.event === 'done') { // We also default on video encoding optimizations this...
{ this.stepInfo.percentage = progress.percentage; }
conditional_block
15.9.3.1-2.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ /** File Name: 15.9.3...
new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.ge...
{ //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( S...
identifier_body
15.9.3.1-2.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ /** File Name: 15.9.3...
This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; v...
random_line_split
15.9.3.1-2.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ /** File Name: 15.9.3...
( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], Da...
addNewTestCase
identifier_name
centerModifier.ts
import type { ComponentGroup, ComponentPickCollection, ColorPickCollection, } from '../static-types'; export const centerModifier: ComponentGroup = { none: (components: ComponentPickCollection, colors: ColorPickCollection) => `${components.centerWrapper?.value(components, colors) ?? ''}`, lightGray: ( ...
};
random_line_split
bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex...
"what were you wearing?" ]; function highlightSexism(message) { for(var x = 0; x < offensivePhrases.length(); x++){ if(message.innerText.indexOf(offensivePhrases[x]) !== 1) { var rgxp = new RegExp(offensivePhrases[x], 'g'); var repl = '<span style="color:#FFFF00;">' + offensivePhrases[x] + '...
"good girl", "suck my dick", "deserve rape", "bad girl", "rape is good",
random_line_split
bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex...
var main = function(){ // NOTE: Always use the latest version of gmail.js from // https://github.com/KartikTalwar/gmail.js gmail = new Gmail(); console.log('Hello,', gmail.get.user_email()); gmail.observe.on('compose', function(compose, type){ console.log("compose obj:", compose); console.l...
{ if( (/in/.test(document.readyState)) || (typeof Gmail === undefined) ) { setTimeout('refresh(' + f + ')', 10); } else { f(); } }
identifier_body
bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o])
var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ var gmail; //const StanfordCoreNLPClient = require('corenlp...
{var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}
conditional_block
bundle.js
(function e(t,n,r){function
(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].ex...
s
identifier_name
vite-plugin-react-svg-tests.ts
import { PluginOption } from 'vite'; import reactSvgPlugin = require('vite-plugin-react-svg'); const testCases: Array<PluginOption | PluginOption[]> = [ reactSvgPlugin({ defaultExport: 'component', expandProps: 'start', memo: false, ref: false, replaceAttrValues: { ...
svgProps: { role: 'alert', }, svgo: true, svgoConfig: { datauri: 'base64', }, titleProp: true, }), reactSvgPlugin({ defaultExport: 'url', expandProps: 'end', }), reactSvgPlugin({ expandProps: false, }), ...
anotherKey: 'value', },
random_line_split
base.py
import pyactiveresource.connection from pyactiveresource.activeresource import ActiveResource, ResourceMeta, formats import shopify.yamlobjects import shopify.mixins as mixins import shopify import threading import sys from six.moves import urllib import six from shopify.collection import PaginatedCollection from pyac...
if parts.password: cls.password = urllib.parse.unquote(parts.password) site = property(get_site, set_site, None, "The base REST site to connect to.") def get_timeout(cls): return getattr(cls._threadlocal, "timeout", ShopifyResource._timeout) def set_timeout(cls, value...
cls.user = urllib.parse.unquote(parts.username)
conditional_block
base.py
import pyactiveresource.connection from pyactiveresource.activeresource import ActiveResource, ResourceMeta, formats import shopify.yamlobjects import shopify.mixins as mixins import shopify import threading import sys from six.moves import urllib import six from shopify.collection import PaginatedCollection from pyac...
# Store the response from the last request in the connection object class ShopifyConnection(pyactiveresource.connection.Connection): response = None def __init__(self, site, user=None, password=None, timeout=None, format=formats.JSONFormat): super(ShopifyConnection, self).__init__(site, user, passwor...
random_line_split
base.py
import pyactiveresource.connection from pyactiveresource.activeresource import ActiveResource, ResourceMeta, formats import shopify.yamlobjects import shopify.mixins as mixins import shopify import threading import sys from six.moves import urllib import six from shopify.collection import PaginatedCollection from pyac...
def is_new(self): return not self.id def _load_attributes_from_response(self, response): if response.body.strip(): self._update(self.__class__.format.decode(response.body)) @classmethod def activate_session(cls, session): cls.site = session.site cls.url = ...
if attributes is not None and prefix_options is None: prefix_options, attributes = self.__class__._split_options(attributes) return super(ShopifyResource, self).__init__(attributes, prefix_options)
identifier_body
base.py
import pyactiveresource.connection from pyactiveresource.activeresource import ActiveResource, ResourceMeta, formats import shopify.yamlobjects import shopify.mixins as mixins import shopify import threading import sys from six.moves import urllib import six from shopify.collection import PaginatedCollection from pyac...
(cls): if not hasattr(cls._threadlocal, "headers"): cls._threadlocal.headers = ShopifyResource._headers.copy() return cls._threadlocal.headers def set_headers(cls, value): cls._threadlocal.headers = value headers = property(get_headers, set_headers, None, "The headers sent ...
get_headers
identifier_name
utils.py
# Copyright 2015 Cloudbase Solutions. # 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 requ...
(cmd, process_input=None, addl_env=None, check_exit_code=True, return_stderr=False, log_fail_as_error=True, extra_ok_codes=None, run_as_root=False, do_decode=True): try: if process_input is not None: _process_input = encodeutils.to_utf8(process_input) else: ...
execute
identifier_name
utils.py
# Copyright 2015 Cloudbase Solutions. # 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 requ...
if obj.returncode and obj.returncode in extra_ok_codes: obj.returncode = None log_msg = m.strip().replace('\n', '; ') if obj.returncode and log_fail_as_error: LOG.error(log_msg) else: LOG.debug(log_msg) if obj.returncode and check_exit_code: ...
'stderr': _stderr} extra_ok_codes = extra_ok_codes or []
random_line_split
utils.py
# Copyright 2015 Cloudbase Solutions. # 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 requ...
obj = utils.subprocess_popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, preexec_fn=None, ...
env.update(addl_env)
conditional_block
utils.py
# Copyright 2015 Cloudbase Solutions. # 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 requ...
if obj.returncode and obj.returncode in extra_ok_codes: obj.returncode = None log_msg = m.strip().replace('\n', '; ') if obj.returncode and log_fail_as_error: LOG.error(log_msg) else: LOG.debug(log_msg) if obj.returncode and check_exit_code: ...
try: if process_input is not None: _process_input = encodeutils.to_utf8(process_input) else: _process_input = None obj, cmd = create_process(cmd, addl_env=addl_env) _stdout, _stderr = obj.communicate(_process_input) obj.stdin.close() _stdout = help...
identifier_body
handleApiError.ts
import { NextApiRequest, NextApiResponse } from 'next'; /** * A bunch of different ways an error might be encoded. Check in order */ type ErrorType =
| string | undefined | null; // Types of methods allowed or disallowed type HttpMethod = 'GET' | 'POST'; // Defaults to this if no error const FALLBACK_ERROR = 'Error from API'; /** * 500s and tries to parse an error for an API endpoint. There might be a * few different ways the error is encoded, try most of...
| { get?: () => string; message?: string; }
random_line_split
store.js
import { AsyncStorage } from 'react-native'; import {applyMiddleware, compose, createStore} from 'redux'; import thunk from 'redux-thunk'; import createLogger from 'redux-logger'; import client from './apolloClient'; import { initialState as configs } from '../reducers/configurations'; import rootReducer from '../redu...
middlewares.push(loggerMiddleware); if (typeof devToolsExtension === 'function') { const devToolsExtension = window.devToolsExtension; enhancers.push(devToolsExtension()); } } const composedEnhancers = compose( applyMiddleware(...middlewares), ...enhancers ); /* Hopefully by now yo...
const middlewares = [thunk, client.middleware()]; const enhancers = []; if (!isProduction && isClient) { const loggerMiddleware = createLogger();
random_line_split
store.js
import { AsyncStorage } from 'react-native'; import {applyMiddleware, compose, createStore} from 'redux'; import thunk from 'redux-thunk'; import createLogger from 'redux-logger'; import client from './apolloClient'; import { initialState as configs } from '../reducers/configurations'; import rootReducer from '../redu...
const composedEnhancers = compose( applyMiddleware(...middlewares), ...enhancers ); /* Hopefully by now you understand what a store is and how redux uses them, * But if not, take a look at: https://github.com/reactjs/redux/blob/master/docs/api/createStore.md * And https://egghead.io/lessons/javascript-redux...
{ const loggerMiddleware = createLogger(); middlewares.push(loggerMiddleware); if (typeof devToolsExtension === 'function') { const devToolsExtension = window.devToolsExtension; enhancers.push(devToolsExtension()); } }
conditional_block
make_rpm_test.py
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
def testCopyAndRewrite(self): with make_rpm.Tempdir(): WriteFile('test.txt', 'Some: data1', 'Other: data2', 'More: data3') make_rpm.CopyAndRewrite('test.txt', 'out.txt', { 'Some:': 'data1a', 'More:': 'data3a', }) self.assertTrue(FileExists('out.txt')) self.asse...
log = """ Lots of data. More data present. """ result = make_rpm.FindOutputFile(log) self.assertEquals(None, result)
identifier_body
make_rpm_test.py
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
(self): with make_rpm.Tempdir(): WriteFile('test.txt', 'Some: data1', 'Other: data2', 'More: data3') make_rpm.CopyAndRewrite('test.txt', 'out.txt', { 'Some:': 'data1a', 'More:': 'data3a', }) self.assertTrue(FileExists('out.txt')) self.assertItemsEqual(['Some: data1...
testCopyAndRewrite
identifier_name
make_rpm_test.py
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
def testSetupWorkdir(self): builder = make_rpm.RpmBuilder('test', '1.0', 'x86') with make_rpm.Tempdir() as outer: # Create spec_file, test files. WriteFile('test.spec', 'Name: test', 'Version: 0.1', 'Summary: test data') WriteFile('file1.txt', 'Hello') WriteFile('file2.txt', 'Goodbye'...
}) self.assertTrue(FileExists('out.txt')) self.assertItemsEqual(['Some: data1a', 'Other: data2', 'More: data3a'], FileContents('out.txt'))
random_line_split
make_rpm_test.py
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
unittest.main()
conditional_block
clone.rs
// A unit struct without resources #[deriving(Show, Copy)] struct
; // A tuple struct with resources that implements the `Clone` trait #[deriving(Clone,Show)] struct Pair(Box<int>, Box<int>); fn main() { // Instantiate `Nil` let nil = Nil; // Copy `Nil`, there are no resources to move let copied_nil = nil; // Both `Nil`s can be used independently println!("...
Nil
identifier_name
clone.rs
// A unit struct without resources #[deriving(Show, Copy)] struct Nil; // A tuple struct with resources that implements the `Clone` trait #[deriving(Clone,Show)] struct Pair(Box<int>, Box<int>); fn main() { // Instantiate `Nil` let nil = Nil; // Copy `Nil`, there are no resources to move let copied_ni...
println!("clone: {}", cloned_pair); }
random_line_split
HarshadNumber.py
""" Harshad Number implementation See: http://en.wikipedia.org/wiki/Harshad_number """ def is_harshad(n): result=0 while n: result+=n%10 n//=10 return n%result == 0 # Return if the remainder of n/result is 0 else return False def
(): # test contains a set of harshad numbers test=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100, 102, 108, 110, 111, 112, 114, 117, 120, 126, 132, 133, 135, 140, 144, 150, 15...
main
identifier_name
HarshadNumber.py
""" Harshad Number implementation See: http://en.wikipedia.org/wiki/Harshad_number """ def is_harshad(n): result=0 while n: result+=n%10 n//=10 return n%result == 0 # Return if the remainder of n/result is 0 else return False def main(): # test contains a set of harshad numbers ...
if __name__ == '__main__': main()
test=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100, 102, 108, 110, 111, 112, 114, 117, 120, 126, 132, 133, 135, 140, 144, 150, 152,153, 156, 162, 171, 180, 190, 192, 195, 1...
identifier_body
HarshadNumber.py
""" Harshad Number implementation See: http://en.wikipedia.org/wiki/Harshad_number """ def is_harshad(n): result=0 while n: result+=n%10 n//=10 return n%result == 0 # Return if the remainder of n/result is 0 else return False
12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100, 102, 108, 110, 111, 112, 114, 117, 120, 126, 132, 133, 135, 140, 144, 150, 152,153, 156, 162, 171, 180, 190, 192, 195, 198, 200, 201] flag=True ...
def main(): # test contains a set of harshad numbers test=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
random_line_split
HarshadNumber.py
""" Harshad Number implementation See: http://en.wikipedia.org/wiki/Harshad_number """ def is_harshad(n): result=0 while n: result+=n%10 n//=10 return n%result == 0 # Return if the remainder of n/result is 0 else return False def main(): # test contains a set of harshad numbers ...
print("The test was", "Successful"if flag else "Unsuccessful!"); if __name__ == '__main__': main()
flag=False break
conditional_block
legendPlain.ts
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may no...
import { install } from './legend/installLegendPlain'; use(install);
import { use } from '../extension';
random_line_split
file_map.py
import os import re from amlib import conf, utils, log ''' Functions for parsing AD automount maps into a common dict format. Part of ampush. https://github.com/sfu-rcg/ampush Copyright (C) 2016 Research Computing Group, Simon Fraser University. ''' # ff = flat file automount map def get_names(): ''' Return a li...
return d_map
''' Read flat file automount maps ${ampush.conf/flat_file_map_dir} and pass map names to parser_master_map or parse_submap. ''' map_pathname = conf.c['flat_file_map_dir'] + '/' + map_name map_lines = utils.ff_map_to_list(map_pathname) map_type = 'flat file' # different map types (master, direct, p...
identifier_body
file_map.py
import os import re from amlib import conf, utils, log ''' Functions for parsing AD automount maps into a common dict format. Part of ampush. https://github.com/sfu-rcg/ampush Copyright (C) 2016 Research Computing Group, Simon Fraser University. ''' # ff = flat file automount map def get_names(): ''' Return a li...
if len(l_orphans) > 0: l_orphans.sort() log_msg = 'Found unused maps listed in {0}: {1}' log_msg = log_msg.format(conf.c['master_map_name'], ' '.join(l_orphans)) log.m.warning(log_msg) print(log_msg) return def parse_master(map_lines=N...
l_orphans.append(ff_mapname)
conditional_block
file_map.py
import os import re from amlib import conf, utils, log ''' Functions for parsing AD automount maps into a common dict format. Part of ampush. https://github.com/sfu-rcg/ampush Copyright (C) 2016 Research Computing Group, Simon Fraser University. ''' # ff = flat file automount map def
(): ''' Return a list of files in ${conf/flat_file_map_dir} with the master map and (optional) direct map first. ''' l_names, fs_map_names = [], [] for root, dirs, filenames in os.walk(conf.c['flat_file_map_dir']): for map_name in filenames: fs_map_names.append(map_name) # ens...
get_names
identifier_name
file_map.py
import os import re from amlib import conf, utils, log ''' Functions for parsing AD automount maps into a common dict format. Part of ampush. https://github.com/sfu-rcg/ampush Copyright (C) 2016 Research Computing Group, Simon Fraser University. ''' # ff = flat file automount map def get_names(): ''' Return a li...
If a third field exists, use it as the NFS path. Otherwise use the second field as the NFS path. ''' try: # server:path pair with options server_hostname = chunks[2].split(':')[0] server_dir = chunks[2].split(':')[1] options = chunks[1] utils.validate_m...
random_line_split
unique-unique-kind.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 ...
() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let i = Box::new(Rc::new(100)); f(i); //~^ ERROR `core::marker::Send` is not implemented }
main
identifier_name
unique-unique-kind.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 ...
fn f<T:Send>(__isize: T) { } fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let i = Box::new(Rc::new(100)); f(i); //~^ ERROR `core::marker::Send` is not implemented }
use std::rc::Rc;
random_line_split
unique-unique-kind.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 ...
fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let i = Box::new(Rc::new(100)); f(i); //~^ ERROR `core::marker::Send` is not implemented }
{ }
identifier_body
index.ts
/** * @license * Copyright (c) 2019 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors ma...
} const grimlock = new Grimlock(packageRoot, [SoyGenerator]); const input = fs.readFileSync(inFile, 'utf8'); const outputFiles = grimlock.convertModule(inFile, input).files; for (const file of outputFiles) { const outputFilePath = path.relative(__dirname, file.filename); fs.writeFileSync(outputFilePat...
) { console.error(`Usage: grimlock input.ts`); process.exitCode = 1; return;
random_line_split