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 |
|---|---|---|---|---|
histogram.py | from __future__ import print_function, division, absolute_import
from george import kernels, GP
import numpy as np
from kglib import fitters
from scipy.integrate import quad
from scipy.optimize import minimize
class HistFitter(fitters.Bayesian_LS): | def __init__(self, mcmc_samples, bin_edges):
"""
Histogram Inference a la Dan Foreman-Mackey
Parameters:
===========
- mcmc_samples: numpy array of shape (Nobs, Nsamples)
MCMC samples for the thing you want to histogram
- bin_edges:... | random_line_split | |
histogram.py | from __future__ import print_function, division, absolute_import
from george import kernels, GP
import numpy as np
from kglib import fitters
from scipy.integrate import quad
from scipy.optimize import minimize
class HistFitter(fitters.Bayesian_LS):
def __init__(self, mcmc_samples, bin_edges):
"""
... |
cube[self.Nbins] = cube[self.Nbins] * 30 - 10
cube[self.Nbins + 1] = cube[self.Nbins + 1] * 20 - 10
cube[self.Nbins + 2] = cube[self.Nbins + 2] * 7 - 2
cube[self.Nbins + 3] = cube[self.Nbins + 3] * 20 - 10
return | cube[i] *= 10 | conditional_block |
histogram.py | from __future__ import print_function, division, absolute_import
from george import kernels, GP
import numpy as np
from kglib import fitters
from scipy.integrate import quad
from scipy.optimize import minimize
class HistFitter(fitters.Bayesian_LS):
def __init__(self, mcmc_samples, bin_edges):
"""
... | (self, pars):
# Pull theta out of pars
theta = pars[:self.Nbins]
# Generate the inner summation
gamma = np.ones_like(self.bin_idx) * np.nan
good = (self.bin_idx < self.Nbins) & (self.bin_idx >= 0) # nans in q get put in nonexistent bins
gamma[good] = self.Nobs * self.ce... | lnlike | identifier_name |
histogram.py | from __future__ import print_function, division, absolute_import
from george import kernels, GP
import numpy as np
from kglib import fitters
from scipy.integrate import quad
from scipy.optimize import minimize
class HistFitter(fitters.Bayesian_LS):
def __init__(self, mcmc_samples, bin_edges):
| self.bin_idx = np.digitize(self.mcmc_samples, self.bin_edges) - 1
# Determine the censoring function for each bin (used in the integral)
self.censor_integrals = np.array([quad(func=self.censoring_fcn,
a=left, b=right)[0] for (left, right) in
... | """
Histogram Inference a la Dan Foreman-Mackey
Parameters:
===========
- mcmc_samples: numpy array of shape (Nobs, Nsamples)
MCMC samples for the thing you want to histogram
- bin_edges: numpy.ndarray array
... | identifier_body |
comments.js | import React from 'react'
import Icon from 'react-icon-base'
const FaComments = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m31.4 17.1q0 3.1-2.1 5.8t-5.7 4.1-7.9 1.6q-1.9 0-3.9-0.4-2.8 2-6.2 2.9-0.8 0.2-1.9 0.3h-0.1q-0.3 0-0.5-0.2t-0.2-0.4q0-0.1 0-0.2t0-0.1 0-0.1l0.1-0.2 0-0.1 0.1-0.1 0.1-... |
export default FaComments | </Icon>
) | random_line_split |
__init__.py | # -*- coding: utf-8 -*-
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 ... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#... | # This program is distributed in the hope that it will be useful, | random_line_split |
estimated-input-latency.js | /**
* @license Copyright 2016 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or a... | extends Audit {
/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'estimated-input-latency',
title: str_(UIStrings.title),
description: str_(UIStrings.description),
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
requiredArtifacts: ['traces'],
};
}
/*... | EstimatedInputLatency | identifier_name |
estimated-input-latency.js | /**
* @license Copyright 2016 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or a... | };
}
}
module.exports = EstimatedInputLatency;
module.exports.UIStrings = UIStrings; | displayValue: str_(i18n.UIStrings.ms, {timeInMs: metricResult.timing}), | random_line_split |
estimated-input-latency.js | /**
* @license Copyright 2016 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or a... |
/**
* @return {LH.Audit.ScoreOptions}
*/
static get defaultOptions() {
return {
// see https://www.desmos.com/calculator/srv0hqhf7d
scorePODR: 50,
scoreMedian: 100,
};
}
/**
* Audits the page to estimate input latency.
* @see https://github.com/GoogleChrome/lighthouse/is... | {
return {
id: 'estimated-input-latency',
title: str_(UIStrings.title),
description: str_(UIStrings.description),
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
requiredArtifacts: ['traces'],
};
} | identifier_body |
i16_add_with_overflow.rs | #![feature(core, core_intrinsics)]
extern crate core;
#[cfg(test)]
mod tests {
use core::intrinsics::i16_add_with_overflow;
// pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
#[test]
fn i16_add_with_overflow_test1() |
#[test]
#[allow(overflowing_literals)]
fn i16_add_with_overflow_test2() {
let x: i16 = 0x7fff; // 32767
let y: i16 = 0x0001; // 1
let (result, is_overflow): (i16, bool) = unsafe {
i16_add_with_overflow(x, y)
};
assert_eq!(result, 0x8000); // -32768
assert_eq!(is_overflow, true);
}
#[... | {
let x: i16 = 0x7f00; // 32512
let y: i16 = 0x00ff; // 255
let (result, is_overflow): (i16, bool) = unsafe {
i16_add_with_overflow(x, y)
};
assert_eq!(result, 0x7fff); // 32767
assert_eq!(is_overflow, false);
} | identifier_body |
i16_add_with_overflow.rs | #![feature(core, core_intrinsics)]
extern crate core;
#[cfg(test)]
mod tests {
use core::intrinsics::i16_add_with_overflow;
// pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
#[test]
fn i16_add_with_overflow_test1() {
let x: i16 = 0x7f00; // 32512
let y: i16 = 0x00ff; // 255
let (res... | () {
let x: i16 = 0x7fff; // 32767
let y: i16 = 0x0001; // 1
let (result, is_overflow): (i16, bool) = unsafe {
i16_add_with_overflow(x, y)
};
assert_eq!(result, 0x8000); // -32768
assert_eq!(is_overflow, true);
}
#[test]
#[allow(overflowing_literals)]
fn i16_add_with_overflow_test3() {
le... | i16_add_with_overflow_test2 | identifier_name |
i16_add_with_overflow.rs | #![feature(core, core_intrinsics)]
extern crate core; |
#[cfg(test)]
mod tests {
use core::intrinsics::i16_add_with_overflow;
// pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
#[test]
fn i16_add_with_overflow_test1() {
let x: i16 = 0x7f00; // 32512
let y: i16 = 0x00ff; // 255
let (result, is_overflow): (i16, bool) = unsafe {
i16_add... | random_line_split | |
HelloWorldWebPart.ts | import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneCheckbox,
PropertyPaneDropdown,
PropertyPaneToggle
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles fr... |
else if (Environment.type == EnvironmentType.SharePoint ||
Environment.type == EnvironmentType.ClassicSharePoint) {
this._getListData()
.then((response) => {
this._renderList(response.value);
});
}
}
private _renderList(items: ISPList[]): void {
let html: string =... | {
this._getMockListData().then((response) => {
this._renderList(response.value);
});
} | conditional_block |
HelloWorldWebPart.ts | import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneCheckbox,
PropertyPaneDropdown,
PropertyPaneToggle
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles fr... | private _renderListAsync(): void {
// Local environment
if (Environment.type === EnvironmentType.Local) {
this._getMockListData().then((response) => {
this._renderList(response.value);
});
}
else if (Environment.type == EnvironmentType.SharePoint ||
Environment.type == Enviro... | });
}
| random_line_split |
HelloWorldWebPart.ts | import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneCheckbox,
PropertyPaneDropdown,
PropertyPaneToggle
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles fr... | (): void {
// Local environment
if (Environment.type === EnvironmentType.Local) {
this._getMockListData().then((response) => {
this._renderList(response.value);
});
}
else if (Environment.type == EnvironmentType.SharePoint ||
Environment.type == EnvironmentType.ClassicSharePoin... | _renderListAsync | identifier_name |
lib.rs | //! Letter count: library.
//!
//! Functions to count graphemes in a string and print a summary.
use unicode_segmentation::UnicodeSegmentation;
use std::collections::HashMap;
/// Prints a summary of the contents of a grapheme counter.
pub fn | <S: ::std::hash::BuildHasher>(counter: &HashMap<String, u64, S>) {
for (key, val) in counter.iter() {
println!("{}: {}", key, val);
}
}
/// Counts all the graphemes in a string.
pub fn count_graphemes_in_string<S: ::std::hash::BuildHasher>(
to_parse: &str,
counter: &mut HashMap<String, u64, S>,... | print_summary | identifier_name |
lib.rs | //! Letter count: library.
//!
//! Functions to count graphemes in a string and print a summary.
use unicode_segmentation::UnicodeSegmentation;
use std::collections::HashMap;
| pub fn print_summary<S: ::std::hash::BuildHasher>(counter: &HashMap<String, u64, S>) {
for (key, val) in counter.iter() {
println!("{}: {}", key, val);
}
}
/// Counts all the graphemes in a string.
pub fn count_graphemes_in_string<S: ::std::hash::BuildHasher>(
to_parse: &str,
counter: &mut Hash... | /// Prints a summary of the contents of a grapheme counter. | random_line_split |
lib.rs | //! Letter count: library.
//!
//! Functions to count graphemes in a string and print a summary.
use unicode_segmentation::UnicodeSegmentation;
use std::collections::HashMap;
/// Prints a summary of the contents of a grapheme counter.
pub fn print_summary<S: ::std::hash::BuildHasher>(counter: &HashMap<String, u64, S>... | {
// Loop through each character in the current string...
for grapheme in UnicodeSegmentation::graphemes(to_parse, true) {
// If the character we are looking at already exists in the counter
// hash, get its value. Otherwise, start a new counter at zero.
let count = counter.entry(graphem... | identifier_body | |
Combinatorics.py | # Parallel Biclustering Algorithm - Fast Algorithm for finding all biclusters in a GEM
# Copyright (C) 2006 Luke Imhoff
#
# 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 2
# of t... |
return recursiveXCombinations(0, self.subsetSize)
def permutations(setSize, subsetSize):
"""Return 'setSize permute subsetSize' or nPk
@param setSize number of elements in set to select from
@param subsetSize number for elements chosen from set
@return number of permutations of s... | a[index] = i
for j in recursiveXCombinations(i + 1, recursiveSubsetSize - 1):
yield a | conditional_block |
Combinatorics.py | # Parallel Biclustering Algorithm - Fast Algorithm for finding all biclusters in a GEM
# Copyright (C) 2006 Luke Imhoff
#
# 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 2
# of t... | (setIndex):
if setIndex == setCount:
yield None
else:
for i in xrange(0, self.setSizes[setIndex]):
a[setIndex] = i
for j in recursiveXSelections(setIndex + 1):
yield a
return recursiv... | recursiveXSelections | identifier_name |
Combinatorics.py | # Parallel Biclustering Algorithm - Fast Algorithm for finding all biclusters in a GEM
# Copyright (C) 2006 Luke Imhoff
#
# 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 2
# of t... | raise ValueError("setSize (%d) must be >= subsetSize (%d)" %
(setSize, subsetSize))
self.setSize = setSize
self.subsetSize = subsetSize
def len(self):
return nChooseK(self.setSize, self.subsetSize)
def __iter__(self):
a... | if setSize < subsetSize: | random_line_split |
Combinatorics.py | # Parallel Biclustering Algorithm - Fast Algorithm for finding all biclusters in a GEM
# Copyright (C) 2006 Luke Imhoff
#
# 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 2
# of t... |
def __iter__(self):
a = zeros(self.subsetSize)
items = range(self.setSize)
# using a closure faster than passing setSize
def recursiveXPermutations(recursiveItems, recursiveSubsetSize):
if recursiveSubsetSize == 0:
yield None
else:
... | return permutations(self.setSize, self.subsetSize) | identifier_body |
PopularArtists_popular_artists.graphql.ts | /* tslint:disable */
import { ReaderFragment } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type PopularArtists_popular_artists = ReadonlyArray<{
readonly slug: string;
readonly internalID: string;
readonly id: string;
readonly name: string | null; | } | null;
readonly " $refType": "PopularArtists_popular_artists";
}>;
export type PopularArtists_popular_artists$data = PopularArtists_popular_artists;
export type PopularArtists_popular_artists$key = ReadonlyArray<{
readonly " $data"?: PopularArtists_popular_artists$data;
readonly " $fragmentRefs": Fra... | readonly image: {
readonly cropped: {
readonly url: string | null;
} | null; | random_line_split |
snapshot_helpers.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Element an snapshot common logic.
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{... | .__bindgen_anon_1
.mValue
.as_ref()
.__bindgen_anon_1
.mAtomArray
.as_ref();
Class::More(&***array)
}
#[inline(always)]
unsafe fn get_id_from_attr(attr: &structs::nsAttrValue) -> &WeakAtom {
debug_assert_eq!(
base_type(attr),
structs::nsAttrValue_... | (*container).mType,
structs::nsAttrValue_ValueType_eAtomArray
);
let array = (*container) | random_line_split |
snapshot_helpers.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Element an snapshot common logic.
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{... |
/// Finds the id attribute from a list of attributes.
#[inline(always)]
pub fn get_id(attrs: &[structs::AttrArray_InternalAttr]) -> Option<&WeakAtom> {
Some(unsafe { get_id_from_attr(find_attr(attrs, &atom!("id"))?) })
}
#[inline(always)]
pub(super) fn exported_part(
attrs: &[structs::AttrArray_InternalAttr]... | {
attrs
.iter()
.find(|attr| attr.mName.mBits == name.as_ptr() as usize)
.map(|attr| &attr.mValue)
} | identifier_body |
snapshot_helpers.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Element an snapshot common logic.
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{... | <'a> {
None,
One(*const nsAtom),
More(&'a [structs::RefPtr<nsAtom>]),
}
#[inline(always)]
fn base_type(attr: &structs::nsAttrValue) -> structs::nsAttrValue_ValueBaseType {
(attr.mBits & structs::NS_ATTRVALUE_BASETYPE_MASK) as structs::nsAttrValue_ValueBaseType
}
#[inline(always)]
unsafe fn ptr<T>(attr... | Class | identifier_name |
qualified_ident.rs | use nom::{
branch::alt,
bytes::complete::{is_not, tag},
character::complete::{alpha1, alphanumeric1, space0},
combinator::{opt, recognize},
multi::{many0_count, separated_list0, separated_list1},
sequence::{delimited, pair, preceded, terminated},
IResult,
};
use super::prelude::*;
pub type... | ))
);
assert_eq!(
qident_segment("string < 42 >"),
Ok((
"",
QIdentSegment {
ident: "string",
parameters: vec![QIdentParam::Other("42")]
}
))
);
assert_eq!(
qident_segment("string < 2, 3.0 >"),
... | {
assert_eq!(
qident_segment("string"),
Ok((
"",
QIdentSegment {
ident: "string",
parameters: vec![],
}
))
);
assert_eq!(
qident_segment("string<42>"),
Ok((
"",
QIdentSegment ... | identifier_body |
qualified_ident.rs | use nom::{
branch::alt,
bytes::complete::{is_not, tag},
character::complete::{alpha1, alphanumeric1, space0},
combinator::{opt, recognize},
multi::{many0_count, separated_list0, separated_list1},
sequence::{delimited, pair, preceded, terminated},
IResult,
};
use super::prelude::*;
pub type... | (input: Span) -> IResult<Span, QIdentParam> {
match qualified_ident(input) {
Ok((rest, result)) => Ok((rest, QIdentParam::QIdent(result))),
Err(_) => match recognize(is_not("<,>"))(input) {
Ok((rest, result)) => Ok((rest, QIdentParam::Other(result.trim()))),
Err(err) => Err(e... | template_param | identifier_name |
qualified_ident.rs | use nom::{
branch::alt,
bytes::complete::{is_not, tag},
character::complete::{alpha1, alphanumeric1, space0},
combinator::{opt, recognize},
multi::{many0_count, separated_list0, separated_list1},
sequence::{delimited, pair, preceded, terminated},
IResult,
};
use super::prelude::*;
pub type... | "",
QIdentSegment {
ident: "string",
parameters: vec![QIdentParam::Other("42")]
}
))
);
assert_eq!(
qident_segment("string < 2, 3.0 >"),
Ok((
"",
QIdentSegment {
ident: "string",
... | Ok(( | random_line_split |
util.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (&mut self, _n: usize) {}
}
/// A reader which infinitely yields one byte.
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Repeat { byte: u8 }
/// Creates an instance of a reader that infinitely repeats one byte.
///
/// All reads from this reader will succeed by filling the specified buffer with
/// the giv... | consume | identifier_name |
util.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { Ok(0) }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl BufRead for Empty {
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
fn consume(&mut self, _n: usize) {}
}
/// A reader which infinitely yields one byte.
#[stable(feature = "rust1"... | impl Read for Empty { | random_line_split |
por.form.js | _form_load_time = new Date();
ef.debug( "ef(" + ef_version + ") form took: " +
(ef_form_load_time.getTime() - ef_form_init_time.getTime()).toString()
+ "ms to load" );
}
efform.alertTime = function(msg_info) {
var ef_form_load_time = new Date();
ef.debug( msg_info +
(ef_form_load_time.getT... | var column_obj = efform.getSubGridDiv().getAttribute( "efDisplayingCol" );
var cell_value = "";
| random_line_split | |
ie.d.ts | import * as webdriver from './index';
/**
* A WebDriver client for Microsoft's Internet Explorer.
*/
export class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {promise.ControlFlow=} opt_flow T... | {
constructor();
/**
* Extracts the IEDriver specific options from the given capabilities
* object.
* @param {!capabilities.Capabilities} caps The capabilities object.
* @return {!Options} The IEDriver options.
*/
static fromCapabilities(caps: webdriver.Capabilities): Opt... | Options | identifier_name |
ie.d.ts | import * as webdriver from './index';
/**
* A WebDriver client for Microsoft's Internet Explorer.
*/
export class Driver extends webdriver.WebDriver {
/**
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {promise.ControlFlow=} opt_flow T... | * @return {!Options} A self reference.
*/
setExtractPath(path: string): Options;
/**
* Sets whether the driver should start in silent mode.
* @param {boolean} silent Whether to run in silent mode.
* @return {!Options} A self reference.
*/
silent(silent: boolean): Opti... | random_line_split | |
issue-12127.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn do_it(x: &isize) { }
fn main() {
let x: Box<_> = box 22;
let f = to_fn_once(move|| do_it(&*x));
to_fn_once(move|| {
f();
f();
//~^ ERROR: use of moved value: `f`
})()
}
| { f } | identifier_body |
issue-12127.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let x: Box<_> = box 22;
let f = to_fn_once(move|| do_it(&*x));
to_fn_once(move|| {
f();
f();
//~^ ERROR: use of moved value: `f`
})()
}
| main | identifier_name |
issue-12127.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | // option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax, unboxed_closures)]
fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
fn do_it(x: &isize) { }
fn main() {
let x: Box<_> = box 22;
let f = to_fn_once(move|| do_it(&*x));
to_fn_once(move||... | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | random_line_split |
AgreeItem.web.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = undefined;
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallChe... |
AgreeItem.prototype.render = function render() {
var _classNames;
var _props = this.props,
prefixCls = _props.prefixCls,
style = _props.style,
className = _props.className;
var wrapCls = (0, _classnames2["default"])((_classNames = {}, (0, _defineProper... | {
(0, _classCallCheck3["default"])(this, AgreeItem);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
} | identifier_body |
AgreeItem.web.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = undefined;
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallChe... | var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _Checkbox = require('./Checkbox.web');
var _Checkbox2 = _interopRequireDefault(_Checkbox);
var _getDataAttr = require('../_util/getDataAttr');
var _getDataAttr2 = _interopRequireDefault(_getDataAttr);
var _omit = ... |
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
| random_line_split |
AgreeItem.web.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = undefined;
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallChe... | () {
(0, _classCallCheck3["default"])(this, AgreeItem);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
}
AgreeItem.prototype.render = function render() {
var _classNames;
var _props = this.props,
prefixCls = _props... | AgreeItem | identifier_name |
AgreeItem.web.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = undefined;
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallChe... |
return t;
};
var AgreeItem = function (_React$Component) {
(0, _inherits3["default"])(AgreeItem, _React$Component);
function AgreeItem() {
(0, _classCallCheck3["default"])(this, AgreeItem);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
... | {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
} | conditional_block |
dummy_backend.py | # Copyright 2010-2012 Institut Mines-Telecom
#
# 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 law or agre... | (self, entity):
'''
Get the Entity's information
'''
logger.debug('The read operation of the dummy_backend')
def update(self, old_entity, new_entity):
'''
Update an Entity's information
'''
logger.debug('The update operation of the dummy_backend')... | read | identifier_name |
dummy_backend.py | # Copyright 2010-2012 Institut Mines-Telecom
#
# 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 law or agre... | print "i got to do action = " + action
print " my attributes are = "
print attributes
logger.debug('The Entity\'s action operation of the dummy_backend') | print "i got entity = " + str(entity) | random_line_split |
dummy_backend.py | # Copyright 2010-2012 Institut Mines-Telecom
#
# 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 law or agre... |
def read(self, entity):
'''
Get the Entity's information
'''
logger.debug('The read operation of the dummy_backend')
def update(self, old_entity, new_entity):
'''
Update an Entity's information
'''
logger.debug('The update operation of the d... | '''
Create an entity (Resource or Link)
'''
logger.debug('The create operation of the dummy_backend') | identifier_body |
test_xlog_cleanup.py | #!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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... |
# Resume basebackup
result = self.resume('base_backup_post_create_checkpoint')
logger.info(result.stdout)
self.assertEqual(result.rc, 0, result.stdout)
# Wait until basebackup end
logger.info('Waiting for basebackup to end ...')
sql = "SELECT count(*) FROM pg_... | PSQL.run_sql_command('select pg_switch_xlog(); select pg_switch_xlog(); checkpoint;')
count = count + 1 | conditional_block |
test_xlog_cleanup.py | #!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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... | (self, fault_name):
return self.run_gpfaultinjector('reset', fault_name)
def fault_status(self, fault_name):
return self.run_gpfaultinjector('status', fault_name)
def wait_triggered(self, fault_name):
search = "fault injection state:'triggered'"
for i in walrepl.polling(10, 3)... | reset_fault | identifier_name |
test_xlog_cleanup.py | #!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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... | , stderr = subprocess.PIPE)
# Give basebackup a moment to reach the fault &
# trigger it
logger.info('Check if suspend fault is hit ...')
triggered = self.wait_triggered(
'base_backup_post_create_checkpoint')
self.as... | """
Test for verifying if xlog seg created while basebackup
dumps out data does not get cleaned
"""
shutil.rmtree('base', True)
PSQL.run_sql_command('DROP table if exists foo')
# Inject fault at post checkpoint create (basebackup)
logger.info ('Injecting base_ba... | identifier_body |
test_xlog_cleanup.py | #!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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... |
# Wait until basebackup end
logger.info('Waiting for basebackup to end ...')
sql = "SELECT count(*) FROM pg_stat_replication"
with dbconn.connect(dbconn.DbURL(), utility=True) as conn:
while (True):
curs = dbconn.execSQL(conn, sql)
results = ... | result = self.resume('base_backup_post_create_checkpoint')
logger.info(result.stdout)
self.assertEqual(result.rc, 0, result.stdout) | random_line_split |
models.py | from sqlalchemy import (
Column,
Index,
Integer,
Text,
Table,
ForeignKey,
String,
Boolean,
DateTime,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,
)
from zope.sqlalchemy import... |
#Index('my_index', MyModel.name, unique=True, mysql_length=255)
| __tablename__ = 'gsClassNote'
Noteid = Column(Integer, primary_key=True)
classStudentid = Column(Integer, ForeignKey('gsClassStudent.id'))
note = Column(Text, index=False, unique=False)
value = Column(Integer, index=False)
date = Column(DateTime, index=True) | identifier_body |
models.py | from sqlalchemy import (
Column,
Index,
Integer,
Text,
Table,
ForeignKey,
String,
Boolean,
DateTime,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,
)
from zope.sqlalchemy import... | #Index('my_index', MyModel.name, unique=True, mysql_length=255) | random_line_split | |
models.py | from sqlalchemy import (
Column,
Index,
Integer,
Text,
Table,
ForeignKey,
String,
Boolean,
DateTime,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,
)
from zope.sqlalchemy import... | (self):
return '<User %r>' % (self.username)
class gsStudent(Base):
__tablename__ = 'gsStudent'
id = Column(Integer, primary_key=True, autoincrement=False)
username = Column(String(64), index=True, unique=True)
FirstName = Column(String(120), index=True, unique=False)
LastName = Column(Stri... | __repr__ | identifier_name |
ContainerTable.react.js | // libs
import { Component } from 'react';
import 'antd/dist/antd.css';
import { connect } from 'react-redux';
import Immutable from 'seamless-immutable';
import { Table, Card, Icon, Tag, Button } from 'antd';
import ReactJson from 'react-json-view';
import { openModal } from '../actions/modal.action';
import { createS... | </Row>
)
}
];
return (
<div>
<Table
columns={columns}
dataSource={dataSource.asMutable()}
expandedRowRender={(record) => (
<Card title="Card title">
<ReactJson src={record}/>
</Card>
)}/>
</div>
);
};
const containerT... | {/* <Tag color="green">{record.podName}</Tag>*/}
| random_line_split |
ContainerTable.react.js | // libs
import { Component } from 'react';
import 'antd/dist/antd.css';
import { connect } from 'react-redux';
import Immutable from 'seamless-immutable';
import { Table, Card, Icon, Tag, Button } from 'antd';
import ReactJson from 'react-json-view';
import { openModal } from '../actions/modal.action';
import { createS... |
return returnData;
}
);
ContainerTable.propTypes = {
// columns: React.PropTypes.array.isRequired,
dataSource: React.PropTypes.array.isRequired
};
const mapStateToProps = (state) => ({
// columns: state.containerTable.columns,
dataSource: tableDataSelector(state)
});
export default connect(mapStateToP... | {
returnData = containerTable.filter((row) =>
Object.values(row).find((f) => f.toString().includes(autoCompleteFilter))
);
} | conditional_block |
settings.py | """
Django settings for lostanimals project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | SECRET_KEY = 'ul!uc(_bz_fe=u2$k1^di#*dr3+-&gxwagi%-_@i2d&a09eo#d'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# Templetes path debug
TEMPLATE_DEBUG = True
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'... |
# SECURITY WARNING: keep the secret key used in production secret! | random_line_split |
hangman.py | # This is a hangman game.
# Your game must do the following things.
# Everytime a user guesses a character, it should tell them if their character
# is in the secret word or not.
#
# Also, it should print the guessed character in the following format
# if the secret word is unicorn and the user guessed the letter 'n'
#... |
# copy your function from lesson6 here.
def hide_word(guesses, secret_word):
hidden_word = ""
for letter in secret_word:
if letter in guesses:
...
# This is the
while(True):
guess = raw_input()
# Check if the guess was a letter that the user already guessed. If so,
# give ... | identifier_body | |
hangman.py | # This is a hangman game.
# Your game must do the following things.
# Everytime a user guesses a character, it should tell them if their character
# is in the secret word or not.
#
# Also, it should print the guessed character in the following format
# if the secret word is unicorn and the user guessed the letter 'n'
#... | (guesses, secret_word):
hidden_word = ""
for letter in secret_word:
if letter in guesses:
...
# This is the
while(True):
guess = raw_input()
# Check if the guess was a letter that the user already guessed. If so,
# give them a warning and go back to the beginning of the loop.
... | hide_word | identifier_name |
hangman.py | # This is a hangman game.
# Your game must do the following things.
# Everytime a user guesses a character, it should tell them if their character
# is in the secret word or not.
#
# Also, it should print the guessed character in the following format
# if the secret word is unicorn and the user guessed the letter 'n'
#... |
print(HANGMANPICS[mistakes]) # this line will print a picture of the hanged man
# If the user made 6 mistakes, tell them the game is over and break out of the
# loop.
| guess = raw_input()
# Check if the guess was a letter that the user already guessed. If so,
# give them a warning and go back to the beginning of the loop.
# If this is a new guess, add it to the list of letters the user guessed.
# Maybe you could use one of the list methods...
# Check if the new ... | conditional_block |
hangman.py | # Also, it should print the guessed character in the following format
# if the secret word is unicorn and the user guessed the letter 'n'
# you program should print _n____n
#
# It should also print a picture of the current state of the hanged man.
#
# If the user guesses a letter he already guessed, give them a warning... | # This is a hangman game.
# Your game must do the following things.
# Everytime a user guesses a character, it should tell them if their character
# is in the secret word or not.
# | random_line_split | |
settings.py | """
Django settings for ross project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... | {
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# http... | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
}, | random_line_split |
audit-package-versions.js | /**
* Make sure that all versions of all required packages are what they oughta be.
*/
/* eslint-disable no-console */
const { resolve } = require("path");
const fs = require("fs");
function | (dir) {
if (!dir) {
throw new Error("Missing directory!");
}
const problems = [];
const correctVersion = "^" + require(resolve(dir, "lerna.json")).version;
const packages = fs.readdirSync(resolve(dir, "packages"));
packages.forEach(pkgName => {
const pkgJson = resolve(dir, "packages", pkgName, "pack... | auditPackageVersions | identifier_name |
audit-package-versions.js | /**
* Make sure that all versions of all required packages are what they oughta be.
*/
/* eslint-disable no-console */
const { resolve } = require("path");
const fs = require("fs");
function auditPackageVersions(dir) {
if (!dir) |
const problems = [];
const correctVersion = "^" + require(resolve(dir, "lerna.json")).version;
const packages = fs.readdirSync(resolve(dir, "packages"));
packages.forEach(pkgName => {
const pkgJson = resolve(dir, "packages", pkgName, "package.json");
try {
fs.statSync(pkgJson);
} catch (e) {
... | {
throw new Error("Missing directory!");
} | conditional_block |
audit-package-versions.js | /**
* Make sure that all versions of all required packages are what they oughta be.
*/
/* eslint-disable no-console */
const { resolve } = require("path");
const fs = require("fs");
function auditPackageVersions(dir) | }
const localDeps = Object.keys(pkg[category]).filter(depName => {
return packages.indexOf(depName) !== -1;
});
localDeps.forEach(depName => {
const depVersion = pkg[category][depName];
if (depVersion !== correctVersion) {
problems.push(
... | {
if (!dir) {
throw new Error("Missing directory!");
}
const problems = [];
const correctVersion = "^" + require(resolve(dir, "lerna.json")).version;
const packages = fs.readdirSync(resolve(dir, "packages"));
packages.forEach(pkgName => {
const pkgJson = resolve(dir, "packages", pkgName, "package.js... | identifier_body |
audit-package-versions.js | /**
* Make sure that all versions of all required packages are what they oughta be.
*/
/* eslint-disable no-console */
const { resolve } = require("path");
const fs = require("fs");
function auditPackageVersions(dir) {
if (!dir) {
throw new Error("Missing directory!");
}
const problems = []; | const correctVersion = "^" + require(resolve(dir, "lerna.json")).version;
const packages = fs.readdirSync(resolve(dir, "packages"));
packages.forEach(pkgName => {
const pkgJson = resolve(dir, "packages", pkgName, "package.json");
try {
fs.statSync(pkgJson);
} catch (e) {
// No package.json... | random_line_split | |
code-mirror-host.tsx | import * as React from 'react'
import CodeMirror, {
Doc,
EditorChangeLinkedList,
Editor,
EditorConfiguration,
LineHandle,
} from 'codemirror'
// Required for us to be able to customize the foreground color of selected text
import 'codemirror/addon/selection/mark-selection'
// Autocompletion plugin
import 'c... | else {
cancelActiveSelection(cm)
cm.swapDoc(value)
}
}
private wrapper: HTMLDivElement | null = null
private codeMirror: Editor | null = null
/**
* Resize observer used for tracking width changes and
* refreshing the internal codemirror instance when
* they occur
*/
private read... | {
cm.setValue(value)
} | conditional_block |
code-mirror-host.tsx | import * as React from 'react'
import CodeMirror, {
Doc,
EditorChangeLinkedList,
Editor,
EditorConfiguration,
LineHandle,
} from 'codemirror'
// Required for us to be able to customize the foreground color of selected text
import 'codemirror/addon/selection/mark-selection'
// Autocompletion plugin
import 'c... | if (entries.length === 1 && this.codeMirror) {
const newWidth = entries[0].contentRect.width
// We don't care about the first resize, let's just
// store what we've got. Codemirror already does a good
// job of height changes through monitoring window resize,
// we just ne... | random_line_split | |
code-mirror-host.tsx | import * as React from 'react'
import CodeMirror, {
Doc,
EditorChangeLinkedList,
Editor,
EditorConfiguration,
LineHandle,
} from 'codemirror'
// Required for us to be able to customize the foreground color of selected text
import 'codemirror/addon/selection/mark-selection'
// Autocompletion plugin
import 'c... |
/**
* A component hosting a CodeMirror instance
*/
export class CodeMirrorHost extends React.Component<ICodeMirrorHostProps, {}> {
private static updateDoc(cm: Editor, value: string | Doc) {
if (typeof value === 'string') {
cm.setValue(value)
} else {
cancelActiveSelection(cm)
cm.swapDoc... | {
if (cm.state && cm.state.selectingText instanceof Function) {
try {
// Simulate a mouseup event which will cause CodeMirror
// to abort its currently active selection. If no selection
// is active the selectingText property will not be a function
// so we won't end up here.
cm.stat... | identifier_body |
code-mirror-host.tsx | import * as React from 'react'
import CodeMirror, {
Doc,
EditorChangeLinkedList,
Editor,
EditorConfiguration,
LineHandle,
} from 'codemirror'
// Required for us to be able to customize the foreground color of selected text
import 'codemirror/addon/selection/mark-selection'
// Autocompletion plugin
import 'c... | () {
this.codeMirror = CodeMirror(this.wrapper!, this.props.options)
this.codeMirror.on('renderLine', this.onRenderLine)
this.codeMirror.on('changes', this.onChanges)
this.codeMirror.on('viewportChange', this.onViewportChange)
this.codeMirror.on('beforeSelectionChange', this.beforeSelectionChanged)... | componentDidMount | identifier_name |
lib.py | """Suit + values are ints"""
from random import shuffle
class Card:
suits = ("spades", "hearts", "diamonds", "clubs")
values = (None, None, '2', '3',
'4', '5', '6', '7',
'8', '9', '10',
'Jack','Queen',
'King', 'Ace')
def __init__(self, v, s):
... |
if self.value == c2.value:
if self.suite < c2.suite:
return True
else:
return False
return False
def __gt__(self,c2):
if self.value > c2.value:
return True
if self.value == c2.value:
if self.suite > c2.... | return True | conditional_block |
lib.py | """Suit + values are ints"""
from random import shuffle
class Card:
suits = ("spades", "hearts", "diamonds", "clubs")
values = (None, None, '2', '3',
'4', '5', '6', '7',
'8', '9', '10',
'Jack','Queen',
'King', 'Ace')
def __init__(self, v, s):
... | else:
return False
return False
def __gt__(self,c2):
if self.value > c2.value:
return True
if self.value == c2.value:
if self.suite > c2.suite:
return True
else:
return False
return False... | return True | random_line_split |
lib.py | """Suit + values are ints"""
from random import shuffle
class Card:
suits = ("spades", "hearts", "diamonds", "clubs")
values = (None, None, '2', '3',
'4', '5', '6', '7',
'8', '9', '10',
'Jack','Queen',
'King', 'Ace')
def __init__(self, v, s):
... |
def __repr__(self):
v = self.values[self.value] +\
" of " + \
self.suits[self.suite]
return v
class Deck():
def __init__(self):
self.cards = []
for i in range(2,15):
for j in range(0,4):
self.cards\
.append(C... | if self.value > c2.value:
return True
if self.value == c2.value:
if self.suite > c2.suite:
return True
else:
return False
return False | identifier_body |
lib.py | """Suit + values are ints"""
from random import shuffle
class Card:
suits = ("spades", "hearts", "diamonds", "clubs")
values = (None, None, '2', '3',
'4', '5', '6', '7',
'8', '9', '10',
'Jack','Queen',
'King', 'Ace')
def __init__(self, v, s):
... | (self,c2):
if self.value < c2.value:
return True
if self.value == c2.value:
if self.suite < c2.suite:
return True
else:
return False
return False
def __gt__(self,c2):
if self.value > c2.value:
return Tru... | __lt__ | identifier_name |
WalletRecoveryPhraseDisplayDialog.tsx | import React, { Component } from 'react';
import { observer } from 'mobx-react';
import classnames from 'classnames';
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl';
import WalletRecoveryPhraseMnemonic from './WalletRecoveryPhraseMnemonic';
import DialogCloseButton from '../../widgets/Dial... | onCancelBackup: (...args: Array<any>) => any;
isSubmitting: boolean;
};
@observer
class WalletRecoveryPhraseDisplayDialog extends Component<Props> {
static contextTypes = {
intl: intlShape.isRequired,
};
render() {
const { intl } = this.context;
const {
recoveryPhrase,
onStartWalletB... | },
});
type Props = {
recoveryPhrase: string;
onStartWalletBackup: (...args: Array<any>) => any; | random_line_split |
WalletRecoveryPhraseDisplayDialog.tsx | import React, { Component } from 'react';
import { observer } from 'mobx-react';
import classnames from 'classnames';
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl';
import WalletRecoveryPhraseMnemonic from './WalletRecoveryPhraseMnemonic';
import DialogCloseButton from '../../widgets/Dial... | () {
const { intl } = this.context;
const {
recoveryPhrase,
onStartWalletBackup,
onCancelBackup,
isSubmitting,
} = this.props;
const dialogClasses = classnames([
styles.component,
'WalletRecoveryPhraseDisplayDialog',
]);
const buttonLabel = !isSubmitting ? (
... | render | identifier_name |
IPostService.ts | import { User } from 'core/domain/users'
import { Post } from 'core/domain/posts'
/**
* Post service interface
*
* @export
* @interface IPostService
*/
export interface IPostService {
addPost: (post: Post) => Promise<string>
updatePost: (post: Post) => Promise<void>
deletePost: (postId: string) => Promise<v... | } | getPostById: (postId: string) => Promise<Post> | random_line_split |
Comments.js | import {
GET_COMMENTS,
GET_COMMENT,
SUBMIT_VOTE_COMMENT,
DELETE_COMMENT,
EDIT_COMMENT,
ADD_COMMENT,
} from '../actions';
import _ from 'lodash';
function commentsReducer(state = {}, action) | return {
...state,
[id]: {...state[id], voteScore: newScore},
};
case DELETE_COMMENT:
return _.omit(state, [action.payload]);
case EDIT_COMMENT:
return state;
case ADD_COMMENT:
return state;
default:
return state;
}
}
export default commentsRed... | {
switch (action.type) {
case GET_COMMENTS:
let comments = _.mapKeys(
_.orderBy(action.payload.data, 'voteScore', 'desc'),
'id',
);
return {
...state,
...comments,
};
case GET_COMMENT:
return action.payload.data;
case SUBMIT_VOTE_COMMENT:
... | identifier_body |
Comments.js | import {
GET_COMMENTS,
GET_COMMENT,
SUBMIT_VOTE_COMMENT,
DELETE_COMMENT,
EDIT_COMMENT,
ADD_COMMENT,
} from '../actions';
import _ from 'lodash';
function | (state = {}, action) {
switch (action.type) {
case GET_COMMENTS:
let comments = _.mapKeys(
_.orderBy(action.payload.data, 'voteScore', 'desc'),
'id',
);
return {
...state,
...comments,
};
case GET_COMMENT:
return action.payload.data;
case SU... | commentsReducer | identifier_name |
Comments.js | import {
GET_COMMENTS,
GET_COMMENT,
SUBMIT_VOTE_COMMENT,
DELETE_COMMENT, | function commentsReducer(state = {}, action) {
switch (action.type) {
case GET_COMMENTS:
let comments = _.mapKeys(
_.orderBy(action.payload.data, 'voteScore', 'desc'),
'id',
);
return {
...state,
...comments,
};
case GET_COMMENT:
return action.pa... | EDIT_COMMENT,
ADD_COMMENT,
} from '../actions';
import _ from 'lodash';
| random_line_split |
foo.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | }
fn _main() {
let _a = unsafe { _foo() };
} | #[lang="start"]
fn start(_main: *const u8, _argc: int, _argv: *const *const u8) -> int { 0 }
extern {
fn _foo() -> [u8; 16]; | random_line_split |
foo.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
extern {
fn _foo() -> [u8; 16];
}
fn _main() {
let _a = unsafe { _foo() };
}
| { 0 } | identifier_body |
foo.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (_main: *const u8, _argc: int, _argv: *const *const u8) -> int { 0 }
extern {
fn _foo() -> [u8; 16];
}
fn _main() {
let _a = unsafe { _foo() };
}
| start | identifier_name |
actors.js | var fs = require('fs')
, child_process = require('child_process')
, _glob = require('glob')
, bunch = require('./bunch')
;
exports.loadEnv = function loadEnv(env, cb) {
var loaders = []
function load(name, cb) {
fs.readFile(env[name], function(error, data) {
env[name] = env[name].match(/.*\.json$... |
});
return cmd;
}
}
exports.jsonParse = function(str, cb) {
try {
cb(null, JSON.parse(str));
} catch (ex) {
cb(ex);
}
}
exports.jsonStringify = function(obj, cb) {
try {
cb(null, JSON.stringify(obj));
} catch (ex) {
cb(ex);
}
}
exports.glob = function glob(pattern, cb) {
conso... | {
cb();
} | conditional_block |
actors.js | var fs = require('fs')
, child_process = require('child_process')
, _glob = require('glob')
, bunch = require('./bunch')
;
exports.loadEnv = function loadEnv(env, cb) {
var loaders = []
function load(name, cb) |
for (var name in env) {
loaders.push([load, name])
}
bunch(loaders, cb)
}
exports.commandActor = function command(executable) {
return function command(args, opts, cb) {
if (!cb) {
cb = opts;
opts = {}
}
var cmd = child_process.spawn(executable, args, opts);
function log(b) { c... | {
fs.readFile(env[name], function(error, data) {
env[name] = env[name].match(/.*\.json$/) ? JSON.parse(data) : data;
cb(error, data)
})
} | identifier_body |
actors.js | var fs = require('fs')
, child_process = require('child_process')
, _glob = require('glob')
, bunch = require('./bunch')
;
exports.loadEnv = function loadEnv(env, cb) {
var loaders = []
function load(name, cb) {
fs.readFile(env[name], function(error, data) {
env[name] = env[name].match(/.*\.json$... | (b) { console.log(b.toString()) }
cmd.stdout.on('data', log);
cmd.stderr.on('data', log);
cmd.on('exit', function(code) {
if (code) {
cb(new Error(executable + ' exited with status ' + code));
} else {
cb();
}
});
return cmd;
}
}
exports.jsonParse = function(str... | log | identifier_name |
actors.js | var fs = require('fs')
, child_process = require('child_process')
, _glob = require('glob')
, bunch = require('./bunch')
;
exports.loadEnv = function loadEnv(env, cb) {
var loaders = []
function load(name, cb) {
fs.readFile(env[name], function(error, data) {
env[name] = env[name].match(/.*\.json$... | try {
cb(null, JSON.parse(str));
} catch (ex) {
cb(ex);
}
}
exports.jsonStringify = function(obj, cb) {
try {
cb(null, JSON.stringify(obj));
} catch (ex) {
cb(ex);
}
}
exports.glob = function glob(pattern, cb) {
console.log('pattern', pattern);
_glob(pattern, function(error, files) {
... | random_line_split | |
conf.py | # -*- coding: utf-8 -*-
#
# Baobab documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 7 00:44:28 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | # A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinxdoc'
# Theme options are th... | pygments_style = 'sphinx'
| random_line_split |
mod.rs | from(Qraw_text)
} else {
xsignal!(Qcoding_system_error, coding_system);
}
} else {
coding_system
}
}
fn get_coding_system_for_string(string: LispStringRef, coding_system: LispObject) -> LispObject {
if coding_system.is_nil() {
/* Decide the coding-system to encod... | (
object: LispObject,
start: LispObject,
end: LispObject,
coding_system: LispObject,
noerror: LispObject,
) -> LispObject {
_secure_hash(
HashAlg::MD5,
object,
| md5 | identifier_name |
mod.rs | use lisp::{LispNumber, LispObject};
use lisp::defsubr;
use multibyte::LispStringRef;
use symbols::{fboundp, symbol_name};
use threads::ThreadState;
#[derive(Clone, Copy)]
enum HashAlg {
MD5,
SHA1,
SHA224,
SHA256,
SHA384,
SHA512,
}
static MD5_DIGEST_LEN: usize = 16;
static SHA1_DIGEST_LEN: usiz... | random_line_split | ||
mod.rs | from(Qraw_text)
} else {
xsignal!(Qcoding_system_error, coding_system);
}
} else {
coding_system
}
}
fn get_coding_system_for_string(string: LispStringRef, coding_system: LispObject) -> LispObject {
if coding_system.is_nil() {
/* Decide the coding-system to encod... |
if buffer_file_name(object).is_not_nil() {
/* Check file-coding-system-alist. */
let mut args = [
Qwrite_region,
start.to_raw(),
end.to_raw(),
buffer_file_name(object).to_raw(),
];
let val = LispObject::from(unsafe {
Ffind_... | {
if LispObject::from(buffer.enable_multibyte_characters).is_nil() {
return LispObject::from(Qraw_text);
}
} | conditional_block |
mod.rs | BufferRef>,
start: LispObject,
end: LispObject,
coding_system: LispObject,
noerror: LispObject,
) -> LispStringRef {
if object.is_string() {
if string.unwrap().is_multibyte() {
let coding_system = check_coding_system_or_error(
get_coding_system_for_string(string.u... | {
sha2_hash_buffer(Sha512::new(), buffer, dest_buf);
} | identifier_body | |
virtual_usbxhci_controller_option.py | import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
| def VirtualUSBXHCIControllerOption(vim, *args, **kwargs):
'''The VirtualUSBXHCIControllerOption data object type contains the options for a
virtual USB Extensible Host Controller Interface (USB 3.0).'''
obj = vim.client.factory.create('ns0:VirtualUSBXHCIControllerOption')
# do some validation chec... | log = logging.getLogger(__name__)
| random_line_split |
virtual_usbxhci_controller_option.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def | (vim, *args, **kwargs):
'''The VirtualUSBXHCIControllerOption data object type contains the options for a
virtual USB Extensible Host Controller Interface (USB 3.0).'''
obj = vim.client.factory.create('ns0:VirtualUSBXHCIControllerOption')
# do some validation checking...
if (len(args) + len(kw... | VirtualUSBXHCIControllerOption | identifier_name |
virtual_usbxhci_controller_option.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualUSBXHCIControllerOption(vim, *args, **kwargs):
| setattr(obj, name, value)
else:
raise InvalidArgumentError("Invalid argument: %s. Expected one of %s" % (name, ", ".join(required + optional)))
return obj
| '''The VirtualUSBXHCIControllerOption data object type contains the options for a
virtual USB Extensible Host Controller Interface (USB 3.0).'''
obj = vim.client.factory.create('ns0:VirtualUSBXHCIControllerOption')
# do some validation checking...
if (len(args) + len(kwargs)) < 7:
raise In... | identifier_body |
virtual_usbxhci_controller_option.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualUSBXHCIControllerOption(vim, *args, **kwargs):
'''The VirtualUSBXHCIController... |
else:
raise InvalidArgumentError("Invalid argument: %s. Expected one of %s" % (name, ", ".join(required + optional)))
return obj
| setattr(obj, name, value) | conditional_block |
context.rs | update_animations(el: E,
before_change_style: Option<Arc<ComputedValues>>,
tasks: UpdateAnimationsTasks) -> Self {
use self::SequentialTask::*;
UpdateAnimations {
el: unsafe { SendElement::new(el) },
before_change_style: ... | random_line_split | ||
context.rs | AnimationsTasks_CSSTransitions;
/// Update effect properties.
const EFFECT_PROPERTIES = structs::UpdateAnimationsTasks_EffectProperties;
/// Update animation cacade results for animations running on the compositor.
const CASCADE_RESULTS = structs::UpdateAnimationsTasks_CascadeResults;
... | get_sp | identifier_name | |
builder.rs | use ramp::{ Int, RandomInt};
use rand::{ OsRng, StdRng };
use super::{ KeyPair, PublicKey, PrivateKey };
use bigint_extensions::{ ModPow, ModInverse };
pub struct KeyPairBuilder {
bits: usize,
certainty: u32
}
impl KeyPairBuilder {
pub fn new() -> KeyPairBuilder {
KeyPairBuilder { bits: 512, cer... |
}
return pp;
}
fn miller_rabin(n: &Int, k: u32) -> bool{
if n <= &Int::from(3) {
return true;
}
let n_minus_one = n - Int::one();
let mut s = 0;
let mut r = n_minus_one.clone();
let two = Int::from(2);
while &r % &two == Int::zero() {
s += 1;
r = r / &two;
... | {
break;
} | conditional_block |
builder.rs | use ramp::{ Int, RandomInt};
use rand::{ OsRng, StdRng };
use super::{ KeyPair, PublicKey, PrivateKey };
use bigint_extensions::{ ModPow, ModInverse };
pub struct KeyPairBuilder {
bits: usize,
certainty: u32
}
impl KeyPairBuilder {
pub fn new() -> KeyPairBuilder {
KeyPairBuilder { bits: 512, cer... | (&self) -> KeyPair {
let mut sec_rng = match OsRng::new() {
Ok(g) => g,
Err(e) => panic!("Failed to obtain OS RNG: {}", e)
};
let p = &generate_possible_prime(&mut sec_rng, self.bits, self.certainty);
let q = &generate_possible_prime(&mut sec_rng, self.bits, sel... | finalize | identifier_name |
builder.rs | use ramp::{ Int, RandomInt};
use rand::{ OsRng, StdRng };
use super::{ KeyPair, PublicKey, PrivateKey };
use bigint_extensions::{ ModPow, ModInverse };
pub struct KeyPairBuilder {
bits: usize,
certainty: u32
}
impl KeyPairBuilder {
pub fn new() -> KeyPairBuilder {
KeyPairBuilder { bits: 512, cer... | Ok(g) => g,
Err(e) => panic!("Failed to obtain OS RNG: {}", e)
};
let mut a = Int::from(2);
for _ in 0..k {
let mut x = a.mod_pow(&r, &n);
if x == Int::one() || x == n_minus_one {
continue;
}
for _ in 1..(s - 1) {
x = &x * &x % n;
... | }
let mut rng = match StdRng::new() { | random_line_split |
cachestatus.js | var current = round_memory_usage( aDeviceInfo.totalSize/1024/1024 );
var max = round_memory_usage( aDeviceInfo.maximumSize/1024/1024 );
var cs_id = 'cachestatus';
var bool_pref_key = 'auto_clear';
var int_pref_key = 'ac';
var clear_directive;
if ( type == 'memory' ) {
cs_id += '-... |
//FF < 4.*
var versionComparator = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
.getService(Components.interfaces.nsIVersionComparator)
.compare(version, "4.0");
if (versionComparator < 0) {
var extMan = Components.classes["@mozilla.o... | {
if (csExtension._prefs.getCharPref( 'version' ) == version) {
return;
}
//Showing welcome screen
setTimeout(function () {
var newTab = getBrowser().addTab("http://add0n.com/cache-status.html?version=" + version);
ge... | identifier_body |
cachestatus.js | var current = round_memory_usage( aDeviceInfo.totalSize/1024/1024 );
var max = round_memory_usage( aDeviceInfo.maximumSize/1024/1024 );
var cs_id = 'cachestatus';
var bool_pref_key = 'auto_clear';
var int_pref_key = 'ac';
var clear_directive;
if ( type == 'memory' ) {
cs_id += '-... | cs_updated_stat( device, aDeviceInfo, prefs );
}
}
cache_service.visitEntries( cache_visitor );
}
/*
* This function takes what could be 15.8912576891 and drops it to just
* one decimal place. In a future version, I could have the user say
* how many decimal places...
*/
fu... | var prefs = prefService.getBranch("extensions.cachestatus.");
var cache_visitor = {
visitEntry: function(a,b) {},
visitDevice: function( device, aDeviceInfo ) {
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.