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 |
|---|---|---|---|---|
disallow_typename_on_root_test.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2ea6403534fde8fe5781de95bd4059c7>>
*/
mod disallow_typename_on_root;
use disallow_typename_on_root::... | {
let input = include_str!("disallow_typename_on_root/fixtures/valid.graphql");
let expected = include_str!("disallow_typename_on_root/fixtures/valid.expected");
test_fixture(transform_fixture, "valid.graphql", "disallow_typename_on_root/fixtures/valid.expected", input, expected);
} | identifier_body | |
disallow_typename_on_root_test.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2ea6403534fde8fe5781de95bd4059c7>>
*/
mod disallow_typename_on_root;
use disallow_typename_on_root::... | #[test]
fn typename_on_query_invalid() {
let input = include_str!("disallow_typename_on_root/fixtures/typename-on-query.invalid.graphql");
let expected = include_str!("disallow_typename_on_root/fixtures/typename-on-query.invalid.expected");
test_fixture(transform_fixture, "typename-on-query.invalid.graphql"... | let expected = include_str!("disallow_typename_on_root/fixtures/typename-on-mutation.invalid.expected");
test_fixture(transform_fixture, "typename-on-mutation.invalid.graphql", "disallow_typename_on_root/fixtures/typename-on-mutation.invalid.expected", input, expected);
}
| random_line_split |
disallow_typename_on_root_test.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2ea6403534fde8fe5781de95bd4059c7>>
*/
mod disallow_typename_on_root;
use disallow_typename_on_root::... | () {
let input = include_str!("disallow_typename_on_root/fixtures/typename-on-mutation.invalid.graphql");
let expected = include_str!("disallow_typename_on_root/fixtures/typename-on-mutation.invalid.expected");
test_fixture(transform_fixture, "typename-on-mutation.invalid.graphql", "disallow_typename_on_roo... | typename_on_mutation_invalid | identifier_name |
decolar-data.ts | 'use strict'
/* LIBS */
/* EXEC */
export interface DecolarFare {
raw: { | },
formatted: {
code: string,
amount: string,
mask: string
}
}
export interface DecolarLocation {
city: {
code: string
},
airport: {
code: string
},
takeAsCity: boolean,
code: string
}
export interface DecolarItinerariesBox {
outboundLocations: {
departure: DecolarLocation,... | code: string,
amount: number | random_line_split |
tr.js | /* -----------------------------------------------------------------------------
Kebab Project 1.5.x (Kebab Reloaded)
http://kebab-project.com
Copyright (c) 2010-2011 lab2023 - internet technologies TURKEY Inc.
http://www.lab2023.com | * This source file is subject to the Dual Licensing Model that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.kebab-project.com/cms/licensing
* If you did not receive a copy of the license and are unable to
* o... |
* LICENSE
* | random_line_split |
test_convert.py | from tempfile import TemporaryFile
import pytest
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'anima/clear.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'fixed/bordered.jpg',
'convert': 'L',
'mode'... | (path, image):
with Img(fp=path(image['sub'])) as src, TemporaryFile() as tf:
src.convert(image['convert'])
src.save(fp=tf)
with Img(fp=tf) as dest:
assert (dest.width, dest.height, dest.mode, dest.frame_count) == (
src.width, src.height, image['mode'], src.frame_... | test_convert | identifier_name |
test_convert.py | from tempfile import TemporaryFile
import pytest
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'anima/clear.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'fixed/bordered.jpg',
'convert': 'L',
'mode'... | assert (dest.width, dest.height, dest.mode, dest.frame_count) == (
src.width, src.height, image['mode'], src.frame_count) | src.save(fp=tf)
with Img(fp=tf) as dest: | random_line_split |
test_convert.py | from tempfile import TemporaryFile
import pytest
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'anima/clear.gif',
'convert': 'L',
'mode': 'P'
}, {
'sub': 'fixed/bordered.jpg',
'convert': 'L',
'mode'... | with Img(fp=path(image['sub'])) as src, TemporaryFile() as tf:
src.convert(image['convert'])
src.save(fp=tf)
with Img(fp=tf) as dest:
assert (dest.width, dest.height, dest.mode, dest.frame_count) == (
src.width, src.height, image['mode'], src.frame_count) | identifier_body | |
webpack.config.js | 'use strict';
var webpack = require('webpack');
var cfg = {
entry: './src/main.jsx',
output: {
path: __dirname + '/dist',
filename: 'main.js',
},
externals: {
yaspm: 'commonjs yaspm'
},
target: process.env.NODE_ENV === 'web' ? 'web' : 'node-webkit',
module: {
loaders: [
{
t... | module.exports = cfg; | random_line_split | |
array_builder.rs | use serde_json::{Value, to_value};
use serde::{Serialize, Serializer};
pub type JsonArray = Vec<Value>;
use object_builder;
pub struct ArrayBuilder {
pub array: JsonArray,
pub null: bool,
pub skip: bool,
pub root: Option<String>
}
/// Use ArrayBuilder to produce JSON arrays
impl ArrayBuilder {
... | array: array,
null: false,
skip: false,
root: None
}),
_ => None
}
}
/// Create new ArrayBuilder, pass it to closure as mutable ref and return.
pub fn build<F>(builder: F) -> ArrayBuilder where F: FnOnce(&mut Ar... | random_line_split | |
array_builder.rs | use serde_json::{Value, to_value};
use serde::{Serialize, Serializer};
pub type JsonArray = Vec<Value>;
use object_builder;
pub struct ArrayBuilder {
pub array: JsonArray,
pub null: bool,
pub skip: bool,
pub root: Option<String>
}
/// Use ArrayBuilder to produce JSON arrays
impl ArrayBuilder {
... |
/// Create new array and push it.
pub fn array<F>(&mut self, builder: F) where F: FnOnce(&mut ArrayBuilder) {
self.push(ArrayBuilder::build(builder).unwrap());
}
/// Create new object and push it
pub fn object<F>(&mut self, builder: F) where F: FnOnce(&mut object_builder::ObjectBuilder) {... | {
self.array.push(value);
} | identifier_body |
array_builder.rs | use serde_json::{Value, to_value};
use serde::{Serialize, Serializer};
pub type JsonArray = Vec<Value>;
use object_builder;
pub struct ArrayBuilder {
pub array: JsonArray,
pub null: bool,
pub skip: bool,
pub root: Option<String>
}
/// Use ArrayBuilder to produce JSON arrays
impl ArrayBuilder {
... | (&mut self) {
self.skip = true;
}
// Set custom root for result Value object
pub fn root(&mut self, root: &str) {
self.root = Some(root.to_string());
}
pub fn has_root(&mut self) -> bool {
self.root.is_some()
}
/// Move out internal JSON value.
pub fn unwrap(se... | skip | identifier_name |
main.rs | /*
Copyright 2013 Jesse 'Jeaye' Wilkerson
See licensing in LICENSE file, or at:
http://www.opensource.org/licenses/BSD-3-Clause
File: server/main.rs
Author: Jesse 'Jeaye' Wilkerson
Description:
Main engine controller and entry point
for the server.
*/
#[feature(globs)];
#[featu... |
{
log::Log::initialize();
let mut server = Server::new();
server.initialize();
}
| in() | identifier_name |
main.rs | /*
Copyright 2013 Jesse 'Jeaye' Wilkerson
See licensing in LICENSE file, or at:
http://www.opensource.org/licenses/BSD-3-Clause
File: server/main.rs
Author: Jesse 'Jeaye' Wilkerson
Description:
Main engine controller and entry point
for the server.
*/
#[feature(globs)];
#[featu... |
else
{ ui::term::initialize() };
log_assert!(driver.is_some(), "Unable to initialize UI");
self.ui_driver = driver;
}
fn show_version()
{
println!("Q³ Server {}.{}", env!("VERSION"), env!("COMMIT"));
fail!("Exiting");
}
fn show_help()
{
let args = os::args();
println!("Q³... | { log_fail!("GUI mode is not yet implemented"); } | conditional_block |
main.rs | /*
Copyright 2013 Jesse 'Jeaye' Wilkerson
See licensing in LICENSE file, or at:
http://www.opensource.org/licenses/BSD-3-Clause
File: server/main.rs
Author: Jesse 'Jeaye' Wilkerson
Description:
Main engine controller and entry point
for the server.
*/
#[feature(globs)];
#[featu... |
fn main()
{
log::Log::initialize();
let mut server = Server::new();
server.initialize();
}
|
let args = os::args();
println!("Q³ Server {}.{}", env!("VERSION"), env!("COMMIT"));
println!("Usage:");
println!("\t{} [options...]", args[0]);
println!("");
println!("Options:");
println!("\t--help\tShows this help menu and exits");
println!("\t--tui\tEnable textual user interface mo... | identifier_body |
main.rs | /*
Copyright 2013 Jesse 'Jeaye' Wilkerson
See licensing in LICENSE file, or at:
http://www.opensource.org/licenses/BSD-3-Clause
File: server/main.rs
Author: Jesse 'Jeaye' Wilkerson
Description:
Main engine controller and entry point
for the server.
*/
#[feature(globs)];
#[featu... | { log_fail!("GUI mode is not yet implemented"); }
else
{ ui::term::initialize() };
log_assert!(driver.is_some(), "Unable to initialize UI");
self.ui_driver = driver;
}
fn show_version()
{
println!("Q³ Server {}.{}", env!("VERSION"), env!("COMMIT"));
fail!("Exiting");
}
fn show_he... |
/* Determine the UI driver. */
let driver =
if args.contains(&~"--gui") | random_line_split |
variable.py | from sqlalchemy import String, Column, Float, Integer, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from base import Base
from unit import Unit
class | (Base):
__tablename__ = 'Variables'
id = Column('VariableID', Integer, primary_key=True)
code = Column('VariableCode', String, nullable=False)
name = Column('VariableName', String, nullable=False)
speciation = Column('Speciation', String, nullable=False)
variable_unit_id = Column('Variable... | Variable | identifier_name |
variable.py | from sqlalchemy import String, Column, Float, Integer, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from base import Base
from unit import Unit
class Variable(Base):
__tablename__ = 'Variables'
| sample_medium = Column('SampleMedium', String, nullable=False)
value_type = Column('ValueType', String, nullable=False)
is_regular = Column('IsRegular', Boolean, nullable=False)
time_support = Column('TimeSupport', Float, nullable=False)
time_unit_id = Column('TimeUnitsID', Integer, ForeignKey('Units.U... | id = Column('VariableID', Integer, primary_key=True)
code = Column('VariableCode', String, nullable=False)
name = Column('VariableName', String, nullable=False)
speciation = Column('Speciation', String, nullable=False)
variable_unit_id = Column('VariableUnitsID', Integer, ForeignKey('Units.U... | random_line_split |
variable.py | from sqlalchemy import String, Column, Float, Integer, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from base import Base
from unit import Unit
class Variable(Base):
| def __repr__(self):
return "<Variable('%s', '%s', '%s')>" % (self.id, self.code, self.name)
| __tablename__ = 'Variables'
id = Column('VariableID', Integer, primary_key=True)
code = Column('VariableCode', String, nullable=False)
name = Column('VariableName', String, nullable=False)
speciation = Column('Speciation', String, nullable=False)
variable_unit_id = Column('VariableUnitsID',... | identifier_body |
secure_message_sign_verify_rsa.rs | // Copyright 2020 Cossack Labs Limited
//
// 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... | themis_secure_message_sign(
private.as_ptr(),
private.len(),
message.as_ptr(),
message.len(),
std::ptr::null_mut(),
&mut signatu... | {
let (private, _) = gen_rsa_key_pair().split();
let private = private.as_ref();
// Allocate buffer large enough for maximum test
let mut signature = vec![0; 10 * MB];
let mut group = c.benchmark_group("Secure Message signing - RSA");
for message_size in MESSAGE_SIZES {
group.throughpu... | identifier_body |
secure_message_sign_verify_rsa.rs | // Copyright 2020 Cossack Labs Limited
//
// 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... | criterion_main!(benches); | random_line_split | |
secure_message_sign_verify_rsa.rs | // Copyright 2020 Cossack Labs Limited
//
// 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... | else {
format!("{}", size)
}
}
criterion_group!(benches, signing, verification);
criterion_main!(benches);
| {
format!("{} KB", size / KB)
} | conditional_block |
secure_message_sign_verify_rsa.rs | // Copyright 2020 Cossack Labs Limited
//
// 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... | (size: usize) -> String {
if size >= MB {
format!("{} MB", size / MB)
} else if size >= KB {
format!("{} KB", size / KB)
} else {
format!("{}", size)
}
}
criterion_group!(benches, signing, verification);
criterion_main!(benches);
| pretty | identifier_name |
gammainc_asy.py | """
Precompute coefficients of Temme's asymptotic expansion for gammainc.
This takes about 8 hours to run on a 2.3 GHz Macbook Pro with 4GB ram.
Sources:
[1] NIST, "Digital Library of Mathematical Functions",
http://dlmf.nist.gov/
"""
from __future__ import division, print_function, absolute_import
import os
fr... | else:
return 0
def compute_alpha(n):
"""alpha_n from DLMF 8.12.13"""
coeffs = mp.taylor(eta, 0, n - 1)
return lagrange_inversion(coeffs)
def compute_d(K, N):
"""d_{k, n} from DLMF 8.12.12"""
M = N + 2*K
d0 = [-mp.mpf(1)/3]
alpha = compute_alpha(M + 2)
for n in range(1... | if lam > 0:
return mp.sqrt(2*(lam - mp.log(lam + 1)))
elif lam < 0:
return -mp.sqrt(2*(lam - mp.log(lam + 1))) | random_line_split |
gammainc_asy.py | """
Precompute coefficients of Temme's asymptotic expansion for gammainc.
This takes about 8 hours to run on a 2.3 GHz Macbook Pro with 4GB ram.
Sources:
[1] NIST, "Digital Library of Mathematical Functions",
http://dlmf.nist.gov/
"""
from __future__ import division, print_function, absolute_import
import os
fr... |
def compute_g(n):
"""g_k from DLMF 5.11.3/5.11.5"""
a = compute_a(2*n)
g = []
for k in range(n):
g.append(mp.sqrt(2)*mp.rf(0.5, k)*a[2*k])
return g
def eta(lam):
"""Function from DLMF 8.12.1 shifted to be centered at 0."""
if lam > 0:
return mp.sqrt(2*(lam - mp.log(lam +... | """a_k from DLMF 5.11.6"""
a = [mp.sqrt(2)/2]
for k in range(1, n):
ak = a[-1]/k
for j in range(1, len(a)):
ak -= a[j]*a[-j]/(j + 1)
ak /= a[0]*(1 + mp.mpf(1)/(k + 1))
a.append(ak)
return a | identifier_body |
gammainc_asy.py | """
Precompute coefficients of Temme's asymptotic expansion for gammainc.
This takes about 8 hours to run on a 2.3 GHz Macbook Pro with 4GB ram.
Sources:
[1] NIST, "Digital Library of Mathematical Functions",
http://dlmf.nist.gov/
"""
from __future__ import division, print_function, absolute_import
import os
fr... | (K, N):
"""d_{k, n} from DLMF 8.12.12"""
M = N + 2*K
d0 = [-mp.mpf(1)/3]
alpha = compute_alpha(M + 2)
for n in range(1, M):
d0.append((n + 2)*alpha[n+2])
d = [d0]
g = compute_g(K)
for k in range(1, K):
dk = []
for n in range(M - 2*k):
dk.append((-1)**k... | compute_d | identifier_name |
gammainc_asy.py | """
Precompute coefficients of Temme's asymptotic expansion for gammainc.
This takes about 8 hours to run on a 2.3 GHz Macbook Pro with 4GB ram.
Sources:
[1] NIST, "Digital Library of Mathematical Functions",
http://dlmf.nist.gov/
"""
from __future__ import division, print_function, absolute_import
import os
fr... |
def compute_alpha(n):
"""alpha_n from DLMF 8.12.13"""
coeffs = mp.taylor(eta, 0, n - 1)
return lagrange_inversion(coeffs)
def compute_d(K, N):
"""d_{k, n} from DLMF 8.12.12"""
M = N + 2*K
d0 = [-mp.mpf(1)/3]
alpha = compute_alpha(M + 2)
for n in range(1, M):
d0.append((n... | return 0 | conditional_block |
settings.py | """
Django settings for sample project.
Generated by 'django-admin startproject' using Django 1.10.1.
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
... |
ROOT_URLCONF = 'sample_project.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_pro... | ] | random_line_split |
UserController.js | (function(){
angular
.module('users')
.controller('UserController', [
'userService', '$mdSidenav', '$mdBottomSheet', '$log', '$q',
UserController
]);
/**
* Main Controller for the Angular Material Starter App
* @param $scope
* @param $mdSidenav
* @param avatars... | () {
var pending = $mdBottomSheet.hide() || $q.when(true);
pending.then(function(){
$mdSidenav('left').toggle();
});
}
/**
* Select the current avatars
* @param menuId
*/
function selectUser ( user ) {
self.selected = angular.isNumber(user) ? $scope.users[use... | toggleUsersList | identifier_name |
UserController.js | (function(){
angular
.module('users')
.controller('UserController', [
'userService', '$mdSidenav', '$mdBottomSheet', '$log', '$q',
UserController
]);
/**
* Main Controller for the Angular Material Starter App
* @param $scope
* @param $mdSidenav
* @param avatars... |
}
}
})();
| {
this.user = user;
this.items = [
{ name: 'Github' , icon: 'github' , icon_url: 'assets/svg/github.svg', urlPath: "https://github.com/hassanabidpk/"},
{ name: 'Twitter' , icon: 'twitter' , icon_url: 'assets/svg/twitter.svg', urlPath: "https://twitter.com/... | identifier_body |
UserController.js | (function(){
angular
.module('users')
.controller('UserController', [
'userService', '$mdSidenav', '$mdBottomSheet', '$log', '$q',
UserController
]);
/**
* Main Controller for the Angular Material Starter App
* @param $scope
* @param $mdSidenav
* @param avatars... |
// *********************************
// Internal methods
// *********************************
/**
* First hide the bottomsheet IF visible, then
* hide or Show the 'left' sideNav area
*/
function toggleUsersList() {
var pending = $mdBottomSheet.hide() || $q.when(true);
p... | random_line_split | |
characterdata.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! DOM bindings for `CharacterData`.
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::... | (&self) -> u32 {
self.data.borrow().encode_utf16().count() as u32
}
// https://dom.spec.whatwg.org/#dom-characterdata-substringdata
fn SubstringData(&self, offset: u32, count: u32) -> Fallible<DOMString> {
let data = self.data.borrow();
// Step 1.
let data_from_offset = matc... | Length | identifier_name |
characterdata.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! DOM bindings for `CharacterData`.
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::... | }
// https://dom.spec.whatwg.org/#dom-childnode-remove
fn Remove(&self) {
let node = self.upcast::<Node>();
node.remove_self();
}
// https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling
fn GetPreviousElementSibling(&self) -> Option<Root<Element>> {
... | fn ReplaceWith(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
self.upcast::<Node>().replace_with(nodes) | random_line_split |
characterdata.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! DOM bindings for `CharacterData`.
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::... |
// https://dom.spec.whatwg.org/#dom-childnode-after
fn After(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
self.upcast::<Node>().after(nodes)
}
// https://dom.spec.whatwg.org/#dom-childnode-replacewith
fn ReplaceWith(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
self.upcas... | {
self.upcast::<Node>().before(nodes)
} | identifier_body |
characterdata.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! DOM bindings for `CharacterData`.
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::... | else {
None
}
}
| {
Some(s.len())
} | conditional_block |
pagination.js | (function () {
'use strict';
var components = angular.module('lavagna.components');
components.component('lvgPagination', {
templateUrl: 'app/components/pagination/pagination.html',
bindings: {
totalPages: '<',
currentPage: '<',
maxSize: '<',
... |
angular.forEach(elems, function (v) {
ctrl.pages.push({value: v, text: v});
});
if (elems[elems.length - 1] < ctrl.totalPages - 1) {
ctrl.pages.push({text: '...'});
}
i... | {
ctrl.pages.push({text: '...'});
} | conditional_block |
pagination.js | (function () {
'use strict';
var components = angular.module('lavagna.components');
components.component('lvgPagination', {
templateUrl: 'app/components/pagination/pagination.html',
bindings: {
totalPages: '<',
currentPage: '<',
maxSize: '<',
... | }
} else {
var isFirstPage = ctrl.currentPage === 1;
var isLastPage = ctrl.currentPage === ctrl.totalPages;
if (!isFirstPage) {
ctrl.pages.push({value: 1, text: 1});
}
... | random_line_split | |
chiptune-sample.rs | extern crate chiptune;
extern crate sdl2;
use std::thread;
use std::time::Duration;
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn play_sound(player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let sound = player.load_sound(path);
match so... |
Err(e) => println!("ERROR {:?}", e),
}
sound
}
fn play_sound_from_memory(player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let mut data = Vec::new();
let mut f = File::open(path.as_str()).unwrap();
f.read_to_end(&mut data).unwrap()... | {
println!("Playing sound");
player.play_sound(&mut chip_sound, -1, 13312, chiptune::CYD_PAN_CENTER, 50);
} | conditional_block |
chiptune-sample.rs | extern crate chiptune;
extern crate sdl2;
use std::thread;
use std::time::Duration;
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn | (player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let sound = player.load_sound(path);
match sound {
Ok(mut chip_sound) => {
println!("Playing sound");
player.play_sound(&mut chip_sound, -1, 13312, chiptune::CYD_PAN_CENT... | play_sound | identifier_name |
chiptune-sample.rs | extern crate chiptune;
extern crate sdl2;
use std::thread;
use std::time::Duration;
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn play_sound(player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let sound = player.load_sound(path);
match so... | sound
}
fn play_sound_from_memory(player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let mut data = Vec::new();
let mut f = File::open(path.as_str()).unwrap();
f.read_to_end(&mut data).unwrap();
println!("DATA = {:?}", data.len());
... | Err(e) => println!("ERROR {:?}", e),
} | random_line_split |
chiptune-sample.rs | extern crate chiptune;
extern crate sdl2;
use std::thread;
use std::time::Duration;
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn play_sound(player: &mut chiptune::Chiptune, path: String) -> Result<chiptune::ChiptuneSound, chiptune::ChiptuneError> {
let sound = player.load_sound(path);
match so... |
println!("SOUND POSITION = {:?}", player.get_sound_position(0));
println!("Play sound");
/*let sound = play_sound(&mut player, "./src/chiptune/libksnd-source/src/assets/sounds/major.ki".to_string());
match sound {
Ok(mut chip_sound) => {
let program = player.get_sound_program(c... | {
sdl2::init();
let mut player = chiptune::Chiptune::new();
println!("Play music");
let song = player.load_music("./src/chiptune/libksnd-source/src/assets/ringmod.kt".to_string());
match song {
Ok(mut chip_song) => {
player.play_music(&mut chip_song, 0);
///println!... | identifier_body |
app-root.d.ts | import { ComponentFactoryResolver, ElementRef, OnInit, OpaqueToken, Renderer, ViewContainerRef } from '@angular/core';
import { App } from './app';
import { Config } from '../../config/config';
import { Ion } from '../ion';
import { OverlayPortal } from '../nav/overlay-portal';
import { Platform } from '../../platform/... | extends Ion implements OnInit {
private _userCmp;
private _cfr;
private _platform;
private _stopScrollPlugin;
private _rafId;
_viewport: ViewContainerRef;
_modalPortal: OverlayPortal;
_overlayPortal: OverlayPortal;
_loadingPortal: OverlayPortal;
_toastPortal: OverlayPortal;
... | IonicApp | identifier_name |
app-root.d.ts | import { ComponentFactoryResolver, ElementRef, OnInit, OpaqueToken, Renderer, ViewContainerRef } from '@angular/core';
import { App } from './app';
import { Config } from '../../config/config';
import { Ion } from '../ion';
import { OverlayPortal } from '../nav/overlay-portal'; | import { Platform } from '../../platform/platform';
export declare const AppRootToken: OpaqueToken;
/**
* @private
*/
export declare class IonicApp extends Ion implements OnInit {
private _userCmp;
private _cfr;
private _platform;
private _stopScrollPlugin;
private _rafId;
_viewport: ViewConta... | random_line_split | |
index.ts | import { Config } from '@pnpm/config'
import defaultReporter from '@pnpm/default-reporter'
import { LogLevel, streamParser, writeToConsole } from '@pnpm/logger'
import silentReporter from './silentReporter'
export type ReporterType = 'default' | 'ndjson' | 'silent' | 'append-only'
export default (
reporterType: Rep... | streamParser,
})
return
case 'append-only':
defaultReporter({
useStderr: opts.config.useStderr,
context: {
argv: opts.cmd ? [opts.cmd] : [],
config: opts.config,
},
reportingOptions: {
appendOnly: true,
logLevel: opts.config.loglevel as LogLeve... | random_line_split | |
User.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _db = require('../db');
var _db2 = _interopRequireDefault(_db);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class User {
static findOne(...args) {
return _db2.default.table(... | (...args) {
return _db2.default.raw('SELECT EXISTS ?', _db2.default.table('users').where(...args).select(_db2.default.raw('1'))).then(x => x.rows[0].exists);
}
static create(user) {
return _db2.default.table('users').insert(user, ['id', 'email']).then(x => x[0]);
}
static setClaims(userId, provider, p... | any | identifier_name |
User.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _db = require('../db');
var _db2 = _interopRequireDefault(_db);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class User {
static findOne(...args) {
return _db2.default.table(... | trx.table('user_claims').where({ user_id: userId, type: claim.type }).update({ value: claim.value }) : trx.table('user_claims').insert({ user_id: userId, type: claim.type, value: claim.value })))]));
}
} /**
* Node.js API Starter Kit (https://reactstarter.com/nodejs)
*
* Copyright © 2016-present Kriasoft... | name: provider,
key: providerKey
}), ...claims.map(claim => trx.raw('SELECT EXISTS ?', trx.table('user_claims').where({ user_id: userId, type: claim.type })).then(x => x.rows[0].exists ? // eslint-disable-line no-confusing-arrow | random_line_split |
string-quartet2.js | var utils = require('../src/utils');
var key = require('../src/rudiments').key;
var scale = require('../src/rudiments').scale;
var ensemble = require("../src/instruments/ensemble"); | var players = utils.playersFromEnsemble(stringQuartet, performer, true);
utils.addPlayer(players, instruments.piano, 'piano1');
utils.addPlayer(players, instruments.piano, 'piano2',5);
var rules = {
v1a: ' >e F ',
v1b: ' cD ',
v1c: ' BC^///DE^',
v1d: ' Fd/+FGAg',
v1e: ' 48,v1a 24,v1b 48,v1a 0:24, v1c ... | var instruments = require("../src/instruments/instruments");
var stringQuartet = ensemble.stringQuartet;
var performer = ensemble.stringQuartet.performers.sacconi.individual; | random_line_split |
max.js | module( "max test" );
test('숫자 순차 배열의 최대값',function(){
var fn = Pascal.max([1,2,,3,4,5,10]);
deepEqual(fn, 10, "Pascal.fact([1,2,,3,4,5,10]) === 10");
});
| deepEqual(fn, 5, "Pascal.fact(1,-2,-3,4,5,-10]) === 5");
});
test('문자열이 포함된 배열의 최대값',function(){
var fn = Pascal.max(['hello',1,-2,-3,4,5,-10]);
deepEqual(fn, 5, "Pascal.fact('hello',1,-2,-3,4,5,-10]) === 5");
});
test('숫자형 문자열이 포함된 배열의 최대값',function(){
var fn = Pascal.max(['1000',1,-2,-3,4,5,-10]);
deepEqual(... | test('순서 없는 숫자 배열의 최대값',function(){
var fn = Pascal.max([1,-2,-3,4,5,-10]); | random_line_split |
224dac8f951c_merge_ee7bf_f6a9c.py | """Merge ee7bff1d660c and f6a9c7e6694b
Revision ID: 224dac8f951c
Revises: ee7bff1d660c, f6a9c7e6694b
Create Date: 2018-03-30 09:56:19.308323
"""
# revision identifiers, used by Alembic.
revision = '224dac8f951c'
down_revision = ('ee7bff1d660c', 'f6a9c7e6694b')
branch_labels = None
depends_on = None
from alembic imp... |
def downgrade_data_broker():
pass |
def upgrade_data_broker():
pass
| random_line_split |
224dac8f951c_merge_ee7bf_f6a9c.py | """Merge ee7bff1d660c and f6a9c7e6694b
Revision ID: 224dac8f951c
Revises: ee7bff1d660c, f6a9c7e6694b
Create Date: 2018-03-30 09:56:19.308323
"""
# revision identifiers, used by Alembic.
revision = '224dac8f951c'
down_revision = ('ee7bff1d660c', 'f6a9c7e6694b')
branch_labels = None
depends_on = None
from alembic imp... | ():
pass
def downgrade_data_broker():
pass
| upgrade_data_broker | identifier_name |
224dac8f951c_merge_ee7bf_f6a9c.py | """Merge ee7bff1d660c and f6a9c7e6694b
Revision ID: 224dac8f951c
Revises: ee7bff1d660c, f6a9c7e6694b
Create Date: 2018-03-30 09:56:19.308323
"""
# revision identifiers, used by Alembic.
revision = '224dac8f951c'
down_revision = ('ee7bff1d660c', 'f6a9c7e6694b')
branch_labels = None
depends_on = None
from alembic imp... |
def downgrade_data_broker():
pass
| pass | identifier_body |
main.js | import { define, render, WeElement, html } from '../../src/omi'
define('my-clock', class extends WeElement {
install = this.updateTime
updateTime() |
installed() {
setInterval(() => {
this.updateTime()
this.update()
}, 1000)
}
arr = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
render() {
const { hours, minutes, seconds } = this
return (
<svg viewBox='-50 -50 100 100'>
<circle class='clock-face' r='48' />
... | {
const time = new Date()
this.hours = time.getHours()
this.minutes = time.getMinutes()
this.seconds = time.getSeconds()
} | identifier_body |
main.js | import { define, render, WeElement, html } from '../../src/omi'
define('my-clock', class extends WeElement {
install = this.updateTime
updateTime() {
const time = new Date()
this.hours = time.getHours()
this.minutes = time.getMinutes()
this.seconds = time.getSeconds()
}
installed() {
set... | stroke-width: 1;
}
.hour {
stroke: #333;
}
.minute {
stroke: #666;
}
.second,
.second-counterweight {
stroke: rgb(180, 0, 0);
}
.second-counterweight {
stroke-width: 3;
}
`
})
render(<my-clock></my-clock>, 'body') | stroke: #333; | random_line_split |
main.js | import { define, render, WeElement, html } from '../../src/omi'
define('my-clock', class extends WeElement {
install = this.updateTime
updateTime() {
const time = new Date()
this.hours = time.getHours()
this.minutes = time.getMinutes()
this.seconds = time.getSeconds()
}
| () {
setInterval(() => {
this.updateTime()
this.update()
}, 1000)
}
arr = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
render() {
const { hours, minutes, seconds } = this
return (
<svg viewBox='-50 -50 100 100'>
<circle class='clock-face' r='48' />
{this.ar... | installed | identifier_name |
dottoxedit.rs | extern crate clap;
extern crate tox;
extern crate ttyaskpass;
extern crate secstr;
use std::fs::File;
use std::path::Path;
use std::collections::HashSet;
use std::io::{ stdout, Read, Write };
use clap::{ App, Arg, SubCommand };
use secstr::SecStr;
use ttyaskpass::askpass;
use tox::core::{ Tox, ToxOptions, Status, Frie... | <P: AsRef<Path>>(path: P, data: &[u8], passphrase: Option<SecStr>) {
File::create(path).unwrap().write(&match passphrase {
Some(pass) => ToxPassKey::new(pass).unwrap()
.encrypt(data).unwrap(),
None => data.into()
}).unwrap();
}
fn main() {
let app = App::new("Edit .TOX")
... | write | identifier_name |
dottoxedit.rs | extern crate clap;
extern crate tox;
extern crate ttyaskpass;
extern crate secstr;
use std::fs::File;
use std::path::Path;
use std::collections::HashSet;
use std::io::{ stdout, Read, Write };
use clap::{ App, Arg, SubCommand };
use secstr::SecStr;
use ttyaskpass::askpass;
use tox::core::{ Tox, ToxOptions, Status, Frie... | let data = ToxPassKey::from(passphrase.clone(), &data).unwrap()
.decrypt(&data).unwrap();
(ToxOptions::default().from(&data).generate().unwrap(), Some(passphrase))
} else {
(ToxOptions::default().from(&data).generate().unwrap(), None)
}
}
fn write<P: AsRef<Path>>(path: P, da... | None => askpass(b"~")
}; | random_line_split |
dottoxedit.rs | extern crate clap;
extern crate tox;
extern crate ttyaskpass;
extern crate secstr;
use std::fs::File;
use std::path::Path;
use std::collections::HashSet;
use std::io::{ stdout, Read, Write };
use clap::{ App, Arg, SubCommand };
use secstr::SecStr;
use ttyaskpass::askpass;
use tox::core::{ Tox, ToxOptions, Status, Frie... |
fn write<P: AsRef<Path>>(path: P, data: &[u8], passphrase: Option<SecStr>) {
File::create(path).unwrap().write(&match passphrase {
Some(pass) => ToxPassKey::new(pass).unwrap()
.encrypt(data).unwrap(),
None => data.into()
}).unwrap();
}
fn main() {
let app = App::new("Edit .TO... | {
let mut data = Vec::new();
File::open(path).unwrap().read_to_end(&mut data).unwrap();
if is_encrypted(&data) {
let passphrase = match passphrase {
Some(pass) => pass.into(),
None => askpass(b"~")
};
let data = ToxPassKey::from(passphrase.clone(), &data).unwr... | identifier_body |
dottoxedit.rs | extern crate clap;
extern crate tox;
extern crate ttyaskpass;
extern crate secstr;
use std::fs::File;
use std::path::Path;
use std::collections::HashSet;
use std::io::{ stdout, Read, Write };
use clap::{ App, Arg, SubCommand };
use secstr::SecStr;
use ttyaskpass::askpass;
use tox::core::{ Tox, ToxOptions, Status, Frie... | ,
Some("diff") => println!("{}", pk),
_ => unreachable!()
}
}
},
_ => unreachable!()
};
write(path, &tox.save(), passphrase);
},
_ => { stdout().wr... | { tox.add_friend(pk).unwrap(); } | conditional_block |
build-json.build.js | import fp from 'lodash/fp'
import HTMLElementAttributes from 'html-element-attributes/index.json'
import jsdom from 'jsdom'
import bail from 'bail'
import fs from 'fs'
import { join } from 'path'
import svgTags from 'svg-tags'
import htmlTags from 'html-tags'
const htmlAttributeListTitleSelector = 'h2:contains("All Su... |
function writeJSONToFile(fileName, object) {
fs.writeFile(
join(__dirname, 'src', fileName),
`${JSON.stringify(object, 0, 2)}\n`,
bail,
)
}
jsdom.env(
reactDomElementDocUrl,
[jQueryScriptUrl],
(err, pageWindow) => {
bail(err)
const jQuery = pageWindow.$
const reactSVGAttributesCraw... | {
const titleNode = jQuery(listTitleSelector)
const listNode = titleNode.nextAll(attributeListParentNodeSelector).first()
return listNode.text().replace(/\n/g, ' ').trim().split(' ')
} | identifier_body |
build-json.build.js | import fp from 'lodash/fp'
import HTMLElementAttributes from 'html-element-attributes/index.json'
import jsdom from 'jsdom'
import bail from 'bail'
import fs from 'fs'
import { join } from 'path'
import svgTags from 'svg-tags'
import htmlTags from 'html-tags'
const htmlAttributeListTitleSelector = 'h2:contains("All Su... | (jQuery, listTitleSelector) {
const titleNode = jQuery(listTitleSelector)
const listNode = titleNode.nextAll(attributeListParentNodeSelector).first()
return listNode.text().replace(/\n/g, ' ').trim().split(' ')
}
function writeJSONToFile(fileName, object) {
fs.writeFile(
join(__dirname, 'src', fileName),
... | getList | identifier_name |
build-json.build.js | import fp from 'lodash/fp'
import HTMLElementAttributes from 'html-element-attributes/index.json'
import jsdom from 'jsdom'
import bail from 'bail'
import fs from 'fs'
import { join } from 'path'
import svgTags from 'svg-tags'
import htmlTags from 'html-tags'
const htmlAttributeListTitleSelector = 'h2:contains("All Su... | const jQuery = pageWindow.$
const reactSVGAttributesCrawled = getList(
jQuery, svgAttributeListTitleSelector,
)
const reactHtmlAttributesCrawled = getList(
jQuery, htmlAttributeListTitleSelector,
)
const reactHtmlAttributesFull = fp.pipe([
// Get rid of normal HTML attributes ... | random_line_split | |
nl.js | "editorPanel": "Tekstverwerker beheerpaneel",
"common": {
"editorHelp": "Druk ALT 0 voor hulp",
"browseServer": "Bladeren op server",
"url": "URL",
"protocol": "Protocol",
"upload": "Upload",
"uploadSubmit": "Naar server verzenden",
"image": "Afbeelding",
... | "editor": "Tekstverwerker", | random_line_split | |
iso8859_7.py | (self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codec... |
### Decoding Map
decoding_map = codecs.make_identity_dict(range(256))
decoding_map.update({
0x00a1: 0x2018, # LEFT SINGLE QUOTATION MARK
0x00a2: 0x2019, # RIGHT SINGLE QUOTATION MARK
0x00a4: None,
0x00a5: None,
0x00aa: None,
0x00ae: None,
0x00af: 0x2015, # HORIZONTAL BAR
0x00b4: 0x0384, # GR... | return (Codec().encode,Codec().decode,StreamReader,StreamWriter) | identifier_body |
iso8859_7.py | (self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codec... | encode | identifier_name | |
iso8859_7.py | 0aa: None,
0x00ae: None,
0x00af: 0x2015, # HORIZONTAL BAR
0x00b4: 0x0384, # GREEK TONOS
0x00b5: 0x0385, # GREEK DIALYTIKA TONOS
0x00b6: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS
0x00b8: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS
0x00b9: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS
0x... | encoding_map[v] = k | conditional_block | |
iso8859_7.py | (self,input,errors='strict'):
|
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return (Codec(... |
return codecs.charmap_encode(input,errors,encoding_map)
| random_line_split |
alg_misc.rs | , point: Self::T) -> Self::T {
point2(self.x_range().clamp(point.x), self.y_range().clamp(point.y))
}
}
/// Deterministic noise.
///
/// Turns an input value into a noise value.
///
/// # Examples
///
/// ```
/// use rand::distributions::Uniform;
/// use calx::Noise;
///
/// let depth = Uniform::new_inclus... |
}
impl AddAssign for Deciban {
fn add_assign(&mut self, rhs: Deciban) { self.0 += rhs.0; }
}
impl Sub for Deciban {
type Output = Deciban;
fn sub(self, rhs: Deciban) -> Deciban { Deciban(self.0 - rhs.0) }
}
impl SubAssign for Deciban {
fn sub_assign(&mut self, rhs: Deciban) { self.0 -= rhs.0; }
}
/... | { Deciban(self.0 + rhs.0) } | identifier_body |
alg_misc.rs | , point: Self::T) -> Self::T {
point2(self.x_range().clamp(point.x), self.y_range().clamp(point.y))
}
}
/// Deterministic noise.
///
/// Turns an input value into a noise value.
///
/// # Examples
///
/// ```
/// use rand::distributions::Uniform;
/// use calx::Noise;
///
/// let depth = Uniform::new_inclus... | (pub f32);
impl Deciban {
/// Build a deciban value from a probability in [0, 1).
pub fn new(p: f32) -> Deciban {
debug_assert!(p >= 0.0 && p < 1.0);
Deciban(10.0 * (p / (1.0 - p)).log(10.0))
}
/// Convert a deciban value to the corresponding probability in [0, 1).
pub fn to_p(self... | Deciban | identifier_name |
alg_misc.rs | , point: Self::T) -> Self::T {
point2(self.x_range().clamp(point.x), self.y_range().clamp(point.y))
}
}
/// Deterministic noise.
///
/// Turns an input value into a noise value.
///
/// # Examples
///
/// ```
/// use rand::distributions::Uniform;
/// use calx::Noise;
///
/// let depth = Uniform::new_inclus... | .fold((0.0, None), |(weight_sum, prev_item), item| {
let item_weight = weight_fn(&item);
debug_assert!(item_weight >= 0.0);
let p = item_weight / (weight_sum + item_weight);
let next_item = if dist.sample(rng) < p {
Some(ite... | {
let dist = Uniform::new(0.0, 1.0);
let (_, ret) = self
.into_iter() | random_line_split |
widget.js | function WPATH(s) {
var index = s.lastIndexOf("/");
var path = -1 === index ? "foo/" + s : s.substring(0, index) + "/foo/" + s.substring(index + 1);
return path;
}
function __processArg(obj, key) {
var arg = null;
if (obj) {
arg = obj[key] || null;
delete obj[key];
}
return ... |
var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._;
module.exports = Controller; | {
new (require("alloy/widget"))("foo");
this.__widgetId = "foo";
require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments));
this.__controllerPath = "widget";
this.args = arguments[0] || {};
if (arguments[0]) {
__processArg(arguments[0], "__parentSymbo... | identifier_body |
widget.js | function | (s) {
var index = s.lastIndexOf("/");
var path = -1 === index ? "foo/" + s : s.substring(0, index) + "/foo/" + s.substring(index + 1);
return path;
}
function __processArg(obj, key) {
var arg = null;
if (obj) {
arg = obj[key] || null;
delete obj[key];
}
return arg;
}
functi... | WPATH | identifier_name |
widget.js | function WPATH(s) {
var index = s.lastIndexOf("/");
var path = -1 === index ? "foo/" + s : s.substring(0, index) + "/foo/" + s.substring(index + 1);
return path;
}
function __processArg(obj, key) {
var arg = null;
if (obj) {
arg = obj[key] || null;
delete obj[key];
}
return ... |
var $ = this;
var exports = {};
exports.destroy = function() {};
_.extend($, $.__views);
_.extend($, exports);
}
var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._;
module.exports = Controller; | {
__processArg(arguments[0], "__parentSymbol");
__processArg(arguments[0], "$model");
__processArg(arguments[0], "__itemTemplate");
} | conditional_block |
widget.js | function WPATH(s) {
var index = s.lastIndexOf("/");
var path = -1 === index ? "foo/" + s : s.substring(0, index) + "/foo/" + s.substring(index + 1);
return path;
}
function __processArg(obj, key) {
var arg = null;
if (obj) {
arg = obj[key] || null;
delete obj[key];
}
return ... |
module.exports = Controller; | var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._; | random_line_split |
AlleleSubmission.py | # This file is part of saddle-bags.
#
# saddle-bags is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# saddle-bags is distribut... |
self.enaUserName = None
self.enaPassword = None
self.ipdSubmitterId = None
self.ipdSubmitterName = None
self.ipdAltContact = None
self.ipdSubmitterEmail = None
self.labOfOrigin = None
self.labContact = None
self.studyAccession = None
self.... | self.submissionBatch = [] | conditional_block |
AlleleSubmission.py | # This file is part of saddle-bags.
#
# saddle-bags is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# saddle-bags is distribut... | #
# You should have received a copy of the GNU Lesser General Public License
# along with saddle-bags. If not, see <http://www.gnu.org/licenses/>.
from saddlebags.HlaSequence import HlaSequence
import logging
class SubmissionBatch():
def __init__(self, includeInitialSubmission):
if(includeInitialSubmiss... | # GNU Lesser General Public License for more details. | random_line_split |
AlleleSubmission.py | # This file is part of saddle-bags.
#
# saddle-bags is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# saddle-bags is distribut... | self.studyAbstract = None
class AlleleSubmission():
def __init__(self):
self.submittedAllele=HlaSequence()
self.localAlleleName = None
self.closestAlleleWrittenDescription = None
self.ipdSubmissionIdentifier = None
self.ipdSubmissionVersion = None
self.enaA... | def __init__(self, includeInitialSubmission):
if(includeInitialSubmission):
# Starting with a single empty submission in the batch.
self.submissionBatch = [AlleleSubmission()]
else:
# Starting with an empty batch
self.submissionBatch = []
self.ena... | identifier_body |
AlleleSubmission.py | # This file is part of saddle-bags.
#
# saddle-bags is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# saddle-bags is distribut... | (self, includeInitialSubmission):
if(includeInitialSubmission):
# Starting with a single empty submission in the batch.
self.submissionBatch = [AlleleSubmission()]
else:
# Starting with an empty batch
self.submissionBatch = []
self.enaUserName = N... | __init__ | identifier_name |
banning_queue.rs | 16;
/// Auto-Banning threshold
pub enum Threshold {
/// Should ban after given number of misbehaves reported.
BanAfter(Count),
/// Should never ban anything
NeverBan
}
impl Default for Threshold {
fn default() -> Self {
Threshold::NeverBan
}
}
/// Transaction queue with banlist.
pub struct BanningTransaction... |
fn gas_required(_tx: &SignedTransaction) -> U256 {
0.into()
}
fn transaction(action: Action) -> SignedTransaction {
let keypair = Random.generate().unwrap();
Transaction {
action: action,
value: U256::from(100),
data: "3331600055".from_hex().unwrap(),
gas: U256::from(100_000),
gas_price: U256... | {
AccountDetails {
nonce: U256::zero(),
balance: !U256::zero(),
}
} | identifier_body |
banning_queue.rs | _or(0);
if count > threshold {
debug!(target: "txqueue", "Ignoring transaction {:?} because sender is banned.", transaction.hash());
return Err(Error::Transaction(TransactionError::SenderBanned));
}
}
// Check recipient
if let Action::Call(recipient) = transaction.action {
let count = se... | random_line_split | ||
banning_queue.rs | 16;
/// Auto-Banning threshold
pub enum Threshold {
/// Should ban after given number of misbehaves reported.
BanAfter(Count),
/// Should never ban anything
NeverBan
}
impl Default for Threshold {
fn default() -> Self {
Threshold::NeverBan
}
}
/// Transaction queue with banlist.
pub struct BanningTransaction... | ,
None => false,
}
}
/// Ban given sender.
/// If bans threshold is reached all subsequent transactions from this sender will be rejected.
/// Reaching bans threshold also removes all existsing transaction from this sender that are already in the
/// queue.
fn ban_sender(&mut self, address: Address) -> bool... | {
let sender = transaction.sender().expect("Transaction is in queue, so the sender is already validated; qed");
// Ban sender
let sender_banned = self.ban_sender(sender);
// Ban recipient and codehash
let recipient_or_code_banned = match transaction.action {
Action::Call(recipient) => {
s... | conditional_block |
banning_queue.rs | 16;
/// Auto-Banning threshold
pub enum Threshold {
/// Should ban after given number of misbehaves reported.
BanAfter(Count),
/// Should never ban anything
NeverBan
}
impl Default for Threshold {
fn default() -> Self {
Threshold::NeverBan
}
}
/// Transaction queue with banlist.
pub struct BanningTransaction... | (&self) -> &Self::Target {
&self.queue
}
}
impl DerefMut for BanningTransactionQueue {
fn deref_mut(&mut self) -> &mut Self::Target {
self.queue()
}
}
#[cfg(test)]
mod tests {
use std::time::Duration;
use super::{BanningTransactionQueue, Threshold};
use ethkey::{Random, Generator};
use transaction::{Transac... | deref | identifier_name |
kernel_density_estimation.py | #
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import njit, prange
import numpy as np
import argparse
import time
def kde(X):
b = 0.5
points = np.array([-1.0, 2.0, 5.0])
N = points.shape[0]
n = X.shape[0]
exps = 0
# "prange" in a normal function i... | print("checksum:", res)
print("SELFTIMED:", t)
if __name__ == '__main__':
main() | random_line_split | |
kernel_density_estimation.py | #
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import njit, prange
import numpy as np
import argparse
import time
def kde(X):
b = 0.5
points = np.array([-1.0, 2.0, 5.0])
N = points.shape[0]
n = X.shape[0]
exps = 0
# "prange" in a normal function i... |
if __name__ == '__main__':
main()
| parser = argparse.ArgumentParser(description='Kernel-Density')
parser.add_argument('--size', dest='size', type=int, default=10000000)
parser.add_argument('--iterations', dest='iterations', type=int, default=20)
args = parser.parse_args()
size = args.size
iterations = args.iterations
np.random.s... | identifier_body |
kernel_density_estimation.py | #
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import njit, prange
import numpy as np
import argparse
import time
def kde(X):
b = 0.5
points = np.array([-1.0, 2.0, 5.0])
N = points.shape[0]
n = X.shape[0]
exps = 0
# "prange" in a normal function i... |
t = time.time()-t1
print("checksum:", res)
print("SELFTIMED:", t)
if __name__ == '__main__':
main()
| res = kde(X) | conditional_block |
kernel_density_estimation.py | #
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import njit, prange
import numpy as np
import argparse
import time
def | (X):
b = 0.5
points = np.array([-1.0, 2.0, 5.0])
N = points.shape[0]
n = X.shape[0]
exps = 0
# "prange" in a normal function is identical to "range"
for i in prange(n):
p = X[i]
d = (-(p-points)**2)/(2*b**2)
m = np.min(d)
exps += m-np.log(b*N)+np.log(np.sum(np... | kde | identifier_name |
main.rs | pub fn sort_disjoint(values: &mut [i32], indices: &[usize]) {
let mut sublist_indices = indices.to_owned();
sublist_indices.sort_unstable();
let mut sublist: Vec<i32> = sublist_indices.iter().map(|&i| values[i]).collect();
sublist.sort_unstable();
for i in 0..sublist.len() {
values[sublist_i... | use super::sort_disjoint;
#[test]
fn test_example() {
let mut values = [7, 6, 5, 4, 3, 2, 1, 0];
let indices = [6, 1, 7];
sort_disjoint(&mut values, &indices);
assert_eq!(values, [7, 0, 5, 4, 3, 2, 1, 6]);
}
#[test]
fn test_sort_one() {
let mut values = [0... | mod tests { | random_line_split |
main.rs | pub fn sort_disjoint(values: &mut [i32], indices: &[usize]) {
let mut sublist_indices = indices.to_owned();
sublist_indices.sort_unstable();
let mut sublist: Vec<i32> = sublist_indices.iter().map(|&i| values[i]).collect();
sublist.sort_unstable();
for i in 0..sublist.len() {
values[sublist_i... |
}
| {
let mut values = [7, 6, 5, 4, 3, 2, 1, 0];
let indices = [6, 1, 7, 2, 0, 4, 3, 5];
sort_disjoint(&mut values, &indices);
assert_eq!(values, [0, 1, 2, 3, 4, 5, 6, 7]);
} | identifier_body |
main.rs | pub fn sort_disjoint(values: &mut [i32], indices: &[usize]) {
let mut sublist_indices = indices.to_owned();
sublist_indices.sort_unstable();
let mut sublist: Vec<i32> = sublist_indices.iter().map(|&i| values[i]).collect();
sublist.sort_unstable();
for i in 0..sublist.len() {
values[sublist_i... | () {
let mut values = [7, 6, 5, 4, 3, 2, 1, 0];
let indices = [6, 1, 7];
sort_disjoint(&mut values, &indices);
println!("{:?}", values);
}
#[cfg(test)]
mod tests {
use super::sort_disjoint;
#[test]
fn test_example() {
let mut values = [7, 6, 5, 4, 3, 2, 1, 0];
let indices = ... | main | identifier_name |
confirmation-form-control.directive.ts | import {
Directive,
OnChanges,
Input,
SimpleChanges,
} from '@angular/core';
import {
NG_VALIDATORS,
Validator,
Validators,
ValidatorFn,
AbstractControl,
FormGroup,
} from '@angular/forms';
@Directive({
selector: '[confirmationFormControl]',
providers: [{provide: NG_VALIDATORS, useExisting: Con... | else {
this.valFn = Validators.nullValidator;
}
}
validate(control: AbstractControl): {[key: string]: any} {
return this.valFn(control);
}
}
export function confirmationFormControl(formControlName: string): ValidatorFn {
return (control: AbstractControl): {[key: string]: any} => {
let isVali... | {
const val: string = change.currentValue;
this.valFn = confirmationFormControl(val);
} | conditional_block |
confirmation-form-control.directive.ts | import {
Directive,
OnChanges,
Input,
SimpleChanges,
} from '@angular/core';
import {
NG_VALIDATORS,
Validator,
Validators,
ValidatorFn,
AbstractControl,
FormGroup,
} from '@angular/forms';
@Directive({
selector: '[confirmationFormControl]',
providers: [{provide: NG_VALIDATORS, useExisting: Con... | implements Validator, OnChanges {
@Input() confirmationFormControl: string;
private valFn = Validators.nullValidator;
ngOnChanges(changes: SimpleChanges): void {
const change = changes['confirmationFormControl'];
if (change) {
const val: string = change.currentValue;
this.valFn = confirmation... | ConfirmationFormControl | identifier_name |
confirmation-form-control.directive.ts | import {
Directive,
OnChanges,
Input,
SimpleChanges,
} from '@angular/core';
import {
NG_VALIDATORS,
Validator,
Validators,
ValidatorFn,
AbstractControl,
FormGroup,
} from '@angular/forms'; | })
export class ConfirmationFormControl implements Validator, OnChanges {
@Input() confirmationFormControl: string;
private valFn = Validators.nullValidator;
ngOnChanges(changes: SimpleChanges): void {
const change = changes['confirmationFormControl'];
if (change) {
const val: string = change.curren... |
@Directive({
selector: '[confirmationFormControl]',
providers: [{provide: NG_VALIDATORS, useExisting: ConfirmationFormControl, multi: true}] | random_line_split |
window.js | 'use strict';
/**
* @ngdoc service
* @name $window
*
* @description
* A reference to the browser's `window` object. While `window`
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In angular we always refer to it through the
* `$window` service, so it ma... | {
this.$get = valueFn(window);
} | identifier_body | |
window.js | 'use strict';
/**
* @ngdoc service
* @name $window
*
* @description
* A reference to the browser's `window` object. While `window`
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In angular we always refer to it through the
* `$window` service, so it ma... | (){
this.$get = valueFn(window);
}
| $WindowProvider | identifier_name |
window.js | 'use strict';
/**
* @ngdoc service
* @name $window
*
* @description
* A reference to the browser's `window` object. While `window`
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In angular we always refer to it through the
* `$window` service, so it ma... | $scope.doGreeting = function(greeting) {
$window.alert(greeting);
};
}
</script>
<div ng-controller="Ctrl">
<input type="text" ng-model="greeting" />
<button ng-click="doGreeting(greeting)">ALERT</button>
</div>
</file>
<file... | random_line_split | |
tea-knowledge.component.js | class TeaKnowledgeController {
constructor ($scope, $state, $compile, DTOptionsBuilder, DTColumnBuilder, API) {
'ngInject'
this.API = API
this.$state = $state
// let TeaKnowledges = this.API.service('teakns', this.API.all('users'))
let TeaKnowledges = this.API.service('teaknowledges', this.API.al... | .withOption('createdRow', createdRow)
.withOption('responsive', true)
.withBootstrap()
this.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID'),
DTColumnBuilder.newColumn('title').withTitle('Title'),
// DTColumnBuilder.newColumn('content').withTitle('Content'),
... | .withOption('data', dataSet) | random_line_split |
tea-knowledge.component.js | class TeaKnowledgeController {
constructor ($scope, $state, $compile, DTOptionsBuilder, DTColumnBuilder, API) {
'ngInject'
this.API = API
this.$state = $state
// let TeaKnowledges = this.API.service('teakns', this.API.all('users'))
let TeaKnowledges = this.API.service('teaknowledges', this.API.al... | rl: './views/app/components/tea-knowledge/tea-knowledge.component.html',
controller: TeaKnowledgeController,
controllerAs: 'vm',
bindings: {}
}
| eU | identifier_body |
tea-knowledge.component.js | class TeaKnowledgeController {
constructor ($scope, $state, $compile, DTOptionsBuilder, DTColumnBuilder, API) {
'ngInject'
this.API = API
this.$state = $state
// let TeaKnowledges = this.API.service('teakns', this.API.all('users'))
let TeaKnowledges = this.API.service('teaknowledges', this.API.al... | (teaknowledgeId) {
let API = this.API
let $state = this.$state
swal({
title: '确认是否删除?',
text: '删除后将无法恢复!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: '删除!',
closeOnConfirm: false,
showLoaderOnConfirm: true,
... | delete | identifier_name |
functions_3.js | var searchData=
[ | ['cleardropdownalignmentpreference',['clearDropdownAlignmentPreference',['../select2_8js.html#a720684602e142b73d3f2c3bc8a9abfa6',1,'select2.js']]],
['clearsearch',['clearSearch',['../select2_8js.html#a0daa3a419e750a83f25eae438fd78e7f',1,'select2.js']]],
['click',['click',['../select2_8js.html#afc4f810ddf843d199e0... | ['call',['call',['../select2_8js.html#aed63747d658b9ef1878fda471c519855',1,'select2.js']]], | random_line_split |
globs.rs | // Copyright 2017 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 ... |
}
}
n!(f); //~ ERROR cannot find function `f` in this scope
n_with_super!(f);
mod test2 {
super::n! {
f //~ ERROR cannot find function `f` in this scope
}
super::n_with_super! {
f
}
}
... | {
let _: u32 = $i();
let _: () = f();
super::$j();
} | identifier_body |
globs.rs | // Copyright 2017 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 ... | () -> u32 { 0 }
pub fn f() {}
mod test {
use super::*;
fn g() {
let _: u32 = $i();
let _: () = f();
}
}
macro n($j:ident) {
mod test {
use super::*;
fn g() {
... | $i | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.