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 |
|---|---|---|---|---|
trait-bounds-in-arc.rs | // Copyright 2013-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-MI... | use std::task;
trait Pet {
fn name(&self, blk: |&str|);
fn num_legs(&self) -> uint;
fn of_good_pedigree(&self) -> bool;
}
struct Catte {
num_whiskers: uint,
name: StrBuf,
}
struct Dogge {
bark_decibels: uint,
tricks_known: uint,
name: StrBuf,
}
struct Goldfyshe {
swim_speed: uint... |
extern crate sync;
use sync::Arc; | random_line_split |
trait-bounds-in-arc.rs | // Copyright 2013-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-MI... |
}
impl Pet for Goldfyshe {
fn name(&self, blk: |&str|) { blk(self.name.as_slice()) }
fn num_legs(&self) -> uint { 0 }
fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
}
pub fn main() {
let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_strbuf() };
let dogge1 = Dogge {
... | {
self.bark_decibels < 70 || self.tricks_known > 20
} | identifier_body |
trait-bounds-in-arc.rs | // Copyright 2013-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-MI... | (&self) -> uint { 0 }
fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
}
pub fn main() {
let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_strbuf() };
let dogge1 = Dogge {
bark_decibels: 100,
tricks_known: 42,
name: "alan_turing".to_strbuf(),
};
let ... | num_legs | identifier_name |
Coupling2DCavities2D.py | import numpy as np
from Coupling import Coupling
class Coupling2DCavities2D(Coupling):
"""
Coupling for cavity2D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... | (self):
"""
Transmission coefficient.
"""
return np.zeros(self.frequency.amount)
@property
def clf(self):
"""
Coupling loss factor for transmission from a 2D cavity to a cavity.
.. math:: \\eta_{12} = \\frac{ \\tau_{12}}{4 \\pi}
... | tau | identifier_name |
Coupling2DCavities2D.py | import numpy as np
from Coupling import Coupling
class Coupling2DCavities2D(Coupling):
"""
Coupling for cavity2D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... |
@property
def clf(self):
"""
Coupling loss factor for transmission from a 2D cavity to a cavity.
.. math:: \\eta_{12} = \\frac{ \\tau_{12}}{4 \\pi}
See BAC, equation 3.14
"""
return self.tau / (4.0 * np.pi) | """
Transmission coefficient.
"""
return np.zeros(self.frequency.amount) | identifier_body |
Coupling2DCavities2D.py | import numpy as np
from Coupling import Coupling
class Coupling2DCavities2D(Coupling):
"""
Coupling for cavity2D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... | @property
def impedance_to(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as well.
"""
return self.subsystem_to.impedance
@property
def tau(self):
"""
Transmission coefficient.
"""
... | return self.subsystem_from.impedance
| random_line_split |
2.x.js | // Generated by CoffeeScript 1.11.1
(function() {
var Adapter, MinifyJS, W, convert, path, sourcemaps,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prot... | };
return MinifyJS;
})(Adapter);
module.exports = MinifyJS;
}).call(this); | } catch (error) {
err = error;
return W.reject(err);
}
return W.resolve(res); | random_line_split |
2.x.js | // Generated by CoffeeScript 1.11.1
(function() {
var Adapter, MinifyJS, W, convert, path, sourcemaps,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prot... | () {
return MinifyJS.__super__.constructor.apply(this, arguments);
}
MinifyJS.prototype.name = 'minify-js';
MinifyJS.prototype.extensions = ['js'];
MinifyJS.prototype.output = 'js';
MinifyJS.prototype.supportedEngines = ['uglify-js'];
MinifyJS.prototype.isolated = true;
MinifyJS.... | MinifyJS | identifier_name |
2.x.js | // Generated by CoffeeScript 1.11.1
(function() {
var Adapter, MinifyJS, W, convert, path, sourcemaps,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prot... |
};
})(this));
};
compile = function(fn, map) {
var err, res;
try {
res = fn();
} catch (error) {
err = error;
return W.reject(err);
}
return W.resolve(res);
};
return MinifyJS;
})(Adapter);
module.exports = MinifyJS;
}).call(t... | {
return obj;
} | conditional_block |
2.x.js | // Generated by CoffeeScript 1.11.1
(function() {
var Adapter, MinifyJS, W, convert, path, sourcemaps,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() | ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
Adapter = require('../../adapter_base');
sourcemaps = require('../../sourcemaps');
W = require('when');
path = require('path');
convert = require('conver... | { this.constructor = child; } | identifier_body |
navigation.js | ---
yuiCompress: !!bool true
---
(function($, window, document) {
/**
* Currently loaded page information.
*/
var curPage,
/**
* This function should be called in the jQuery click handler of a link
* element (`a`). It will try to use AJAX and history magic to kee... | if (addHistoryState) {
// not using page.url because the URL may need to be relative
window.history.pushState(page, page.title, this.url.split('page.json?')[0]);
}
// update document content and header, re-attach handlers in header
documen... | random_line_split | |
navigation.js | ---
yuiCompress: !!bool true
---
(function($, window, document) {
/**
* Currently loaded page information.
*/
var curPage,
/**
* This function should be called in the jQuery click handler of a link
* element (`a`). It will try to use AJAX and history magic to kee... | updatePage(event.originalEvent.state, false);
});
}
});
}(jQuery, window, document));
| {
var $window = $(window);
// save the current state
curPage = {
id: $('.nav-icon.active').attr('data-id'),
title: document.title,
url: window.location.pathname,
header: $('#header').html(),
html: $('#con... | conditional_block |
assign-to-method.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct cat {
priv... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
// | random_line_split |
assign-to-method.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
fn main() {
let nyan : cat = cat(52u, 99);
nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
}
| { self.meows += 1u; } | identifier_body |
assign-to-method.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
fn main() {
let nyan : cat = cat(52u, 99);
nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
}
| cat | identifier_name |
simple-struct-min-capture.rs | // edition:2021
#![feature(rustc_attrs)]
// Test to ensure that min analysis meets capture kind for all paths captured.
| #[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
fn main() {
let mut p = Point { x: 10, y: 20 };
//
// Requirements:
// p.x -> MutBoorrow
// p -> ImmBorrow
//
// Requirements met when p is captured via MutBorrow
//
let mut c = #[rustc_capture_analysis]
//~^ ERROR... | random_line_split | |
simple-struct-min-capture.rs | // edition:2021
#![feature(rustc_attrs)]
// Test to ensure that min analysis meets capture kind for all paths captured.
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
fn | () {
let mut p = Point { x: 10, y: 20 };
//
// Requirements:
// p.x -> MutBoorrow
// p -> ImmBorrow
//
// Requirements met when p is captured via MutBorrow
//
let mut c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: se... | main | identifier_name |
settings.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { ProfileModel } from '../../models/profile.model';
import { ProtectedPage } from '../protected/protec... |
}
| {
let modal = this.modalCtrl.create(PrivacyPolicyPage);
modal.present();
} | identifier_body |
settings.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { ProfileModel } from '../../models/profile.model';
import { ProtectedPage } from '../protected/protec... |
this.translate.setDefaultLang(language_to_set);
this.translate.use(language_to_set);
}
rateApp(){
// this.appRate.preferences.storeAppURL = {
// ios: '<my_app_id>',
// android: 'market://details?id=<package_name>',
// windows: 'ms-windows-store://review/?ProductId=<Store_ID>'
//... | {
language_to_set = lang.code;
} | conditional_block |
settings.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { ProfileModel } from '../../models/profile.model';
import { ProtectedPage } from '../protected/protec... | import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../providers/language.service';
import { LanguageModel } from '../../models/language.model';
import { AppRate } from '@ionic-native/app-rate';
import { AppVersion } from '@ionic-native/app-version';
import { Storage } from '@ion... | random_line_split | |
settings.ts | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { ProfileModel } from '../../models/profile.model';
import { ProtectedPage } from '../protected/protec... | () {
let modal = this.modalCtrl.create(PrivacyPolicyPage);
modal.present();
}
}
| showPrivacyModal | identifier_name |
build.rs | extern crate ffigen;
extern crate msbuild_util;
use std::process::Command;
use std::fs;
use std::env;
fn main() {
let mut context = ffigen::Context::new();
context.set_root("../scaffold".to_string());
context.add_lang(ffigen::Lang::CSharp, &[ffigen::Config::Output(".".to_string())]);
ffigen::gen(&co... |
#[cfg(not(target_os = "windows"))]
fn get_output_lib(name: &str) -> String {
format!("lib{}.so", name)
}
fn build(config: &String) {
let msbuild = msbuild_util::MSBuild::new()
.project("CSharp.csproj")
.platform(msbuild_util::Platform::X64)
.config(match config.as_ref() {
"deb... |
#[cfg(target_os = "windows")]
fn get_output_lib(name: &str) -> String {
format!("{}.dll", name)
} | random_line_split |
build.rs | extern crate ffigen;
extern crate msbuild_util;
use std::process::Command;
use std::fs;
use std::env;
fn main() {
let mut context = ffigen::Context::new();
context.set_root("../scaffold".to_string());
context.add_lang(ffigen::Lang::CSharp, &[ffigen::Config::Output(".".to_string())]);
ffigen::gen(&co... | (config: &String) {
let msbuild = msbuild_util::MSBuild::new()
.project("CSharp.csproj")
.platform(msbuild_util::Platform::X64)
.config(match config.as_ref() {
"debug" => msbuild_util::Config::Debug,
"release" => msbuild_util::Config::Release,
cfg => panic... | build | identifier_name |
build.rs | extern crate ffigen;
extern crate msbuild_util;
use std::process::Command;
use std::fs;
use std::env;
fn main() {
let mut context = ffigen::Context::new();
context.set_root("../scaffold".to_string());
context.add_lang(ffigen::Lang::CSharp, &[ffigen::Config::Output(".".to_string())]);
ffigen::gen(&co... |
fn build(config: &String) {
let msbuild = msbuild_util::MSBuild::new()
.project("CSharp.csproj")
.platform(msbuild_util::Platform::X64)
.config(match config.as_ref() {
"debug" => msbuild_util::Config::Debug,
"release" => msbuild_util::Config::Release,
cf... | {
format!("lib{}.so", name)
} | identifier_body |
valve_util.py | """Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | (func):
@wraps(func)
def __koe(*args, **kwargs):
try:
func(*args, **kwargs)
except:
logging.getLogger(logname).exception(
'Unhandled exception, killing RYU')
logging.shutdown()
os.kill(os.getpid()... | _koe | identifier_name |
valve_util.py | """Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... |
def stat_config_files(config_hashes):
"""Return dict of a subset of stat attributes on config files."""
config_files_stats = {}
for config_file in list(config_hashes.keys()):
try:
config_file_stat = os.stat(config_file)
except OSError:
continue
config_files... | """Return byte array/string as string."""
return b_str.encode('utf-8').decode('utf-8', 'strict') | identifier_body |
valve_util.py | """Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... |
return sysprefix
_PREFIX = get_sys_prefix()
# To specify a boolean-only setting, set the default value to a bool type.
DEFAULTS = {
'FAUCET_CONFIG': ''.join((
_PREFIX,
'/etc/faucet/faucet.yaml',
':',
_PREFIX,
'/etc/ryu/faucet/faucet.yaml')),
'FAUCET_CONFIG_STAT_RE... | sysprefix = sys.prefix | conditional_block |
valve_util.py | """Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
i... | #
# http://www.apache.org/licenses/LICENSE-2.0 | random_line_split |
MatrixLayout-dbg.js | /*!
* UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-2016 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.ui.commons.layout.MatrixLayout.
sap.ui.define(['jquery.sap.global', './MatrixLayoutCell', './MatrixLayoutRow'... |
}, /* bExport= */ true); | return MatrixLayout; | random_line_split |
MatrixLayout-dbg.js | /*!
* UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-2016 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.ui.commons.layout.MatrixLayout.
sap.ui.define(['jquery.sap.global', './MatrixLayoutCell', './MatrixLayoutRow'... |
return this;
};
/*
* Overwrites Setter for property <code>widths</code>.
* Sets the widths of the columns. The values must be stored in an array to be used in renderer.
* to be compatible with previous version also allow list of values.
* @param {sap.ui.core.CSSSize[]} aWidths new value for property <code... | {
var oContent = arguments[i];
var oCell;
if (oContent instanceof MatrixLayoutCell) {
// matrix layout cell given, use as is
oCell = oContent;
} else if (oContent instanceof Control) {
// any control given, wrap with matrix layout cell first
oCell = new MatrixLayoutCell({content : oConten... | conditional_block |
getNameOfClass.py | # ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... |
else:
if "New" in dir(T) and "GetNameOfClass" in dir(T):
totalName += 1
if wrongClassName(T, t):
msg = f"{T}: wrong class name: {t}"
print(msg, file=sys.stderr)
o = T.New()
print(itk.clas... | i = T.values()[0]
# GetNameOfClass() is a virtual method of the LightObject class,
# so we must instantiate an object with the New() method
if "New" in dir(i) and "GetNameOfClass" in dir(i):
totalName += 1
if wrongClassName(i, t):
m... | conditional_block |
getNameOfClass.py | # ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | wrongName += 1
print(f"{totalName} classes checked.")
if wrongName:
print(f"{wrongName} classes are not providing the correct name.", file=sys.stderr)
sys.exit(1) | msg = f"{T}: wrong class name: {t}"
print(msg, file=sys.stderr)
o = T.New()
print(itk.class_(o), file=sys.stderr)
print(o.GetNameOfClass(), file=sys.stderr) | random_line_split |
getNameOfClass.py | # ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... |
# a list of classes to exclude. Typically, the classes with a custom New()
# method, which return a subclass of the current class
exclude = [
"ForwardFFTImageFilter",
"Forward1DFFTImageFilter",
"InverseFFTImageFilter",
"Inverse1DFFTImageFilter",
"OutputWindow",
"MultiThreaderBase",
"FFTCo... | o = cl.New()
# be sure that the type of the instantiated object is the same
# than the one of the class. It can be different if the class
# is an "abstract" one and don't provide any New() method.
# In that case, the one of the superclass is used.
return o.GetNameOfClass() != name and itk.class_(o) ... | identifier_body |
getNameOfClass.py | # ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | (cl, name):
o = cl.New()
# be sure that the type of the instantiated object is the same
# than the one of the class. It can be different if the class
# is an "abstract" one and don't provide any New() method.
# In that case, the one of the superclass is used.
return o.GetNameOfClass() != name an... | wrongClassName | identifier_name |
ordereddict.py | #!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
def _zip_longest(*args, **kwds):
# izip_longe... |
def keys(self):
return list(self)
def values(self):
return [self[key] for key in self]
def items(self):
return [(key, self[key]) for key in self]
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self._... | try:
value = self[key]
except KeyError:
if default is self.__marker:
raise
return default
else:
del self[key]
return value | identifier_body |
ordereddict.py | #!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
def _zip_longest(*args, **kwds):
# izip_longe... | (self, key, default=__marker):
try:
value = self[key]
except KeyError:
if default is self.__marker:
raise
return default
else:
del self[key]
return value
def keys(self):
return list(self)
def values(sel... | pop | identifier_name |
ordereddict.py | #!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
def _zip_longest(*args, **kwds):
# izip_longe... |
def keys(self):
return list(self)
def values(self):
return [self[key] for key in self]
def items(self):
return [(key, self[key]) for key in self]
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__... | return default
else:
del self[key]
return value | random_line_split |
ordereddict.py | #!/usr/bin/env python
"""Backport from python2.7 to python <= 2.6."""
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
try:
from itertools import izip_longest as _zip_longest
except ImportError:
from itertools import izip
def _zip_longest(*args, **kwds):
# izip_longe... |
return '%s(%r)' % (self.__class__.__name__, list(self.items()))
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
... | return '%s()' % (self.__class__.__name__,) | conditional_block |
nurture_tubes.py | from flask import jsonify, request
from radar.api.serializers.nurture_tubes import OptionSerializer, SamplesSerializer
from radar.api.views.common import (
PatientObjectDetailView,
PatientObjectListView,
)
from radar.api.views.generics import ListModelView
from radar.database import db
from radar.exceptions im... |
json['protocol'] = PROTOCOL_OPTION_TYPE(json['protocol'])
serializer = self.get_serializer(data=json)
serializer.is_valid(raise_exception=True)
obj = serializer.save()
db.session.add(obj)
db.session.commit()
data = serializer.data
data = camel_case_ke... | raise BadRequest() | conditional_block |
nurture_tubes.py | from flask import jsonify, request
from radar.api.serializers.nurture_tubes import OptionSerializer, SamplesSerializer
from radar.api.views.common import (
PatientObjectDetailView,
PatientObjectListView,
)
from radar.api.views.generics import ListModelView
from radar.database import db
from radar.exceptions im... | (ListModelView):
serializer_class = OptionSerializer
model_class = SampleOption
def register_views(app):
app.add_url_rule('/samples', view_func=SamplesListView.as_view('samples_list'))
app.add_url_rule('/samples/<id>', view_func=SamplesDetailView.as_view('samples_detail'))
app.add_url_rule(
... | SamplesProtocolOptions | identifier_name |
nurture_tubes.py | from flask import jsonify, request
from radar.api.serializers.nurture_tubes import OptionSerializer, SamplesSerializer
from radar.api.views.common import (
PatientObjectDetailView,
PatientObjectListView,
)
from radar.api.views.generics import ListModelView
from radar.database import db
from radar.exceptions im... |
return jsonify(data), 200
class SamplesDetailView(PatientObjectDetailView):
serializer_class = SamplesSerializer
model_class = Samples
class SamplesProtocolOptions(ListModelView):
serializer_class = OptionSerializer
model_class = SampleOption
def register_views(app):
app.add_url_rule... | serializer_class = SamplesSerializer
model_class = Samples
def create(self, *args, **kwargs):
json = request.get_json()
if json is None:
raise BadRequest()
json['protocol'] = PROTOCOL_OPTION_TYPE(json['protocol'])
serializer = self.get_serializer(data=json)
... | identifier_body |
nurture_tubes.py | from flask import jsonify, request
from radar.api.serializers.nurture_tubes import OptionSerializer, SamplesSerializer
from radar.api.views.common import (
PatientObjectDetailView,
PatientObjectListView,
)
from radar.api.views.generics import ListModelView
from radar.database import db
from radar.exceptions im... |
json['protocol'] = PROTOCOL_OPTION_TYPE(json['protocol'])
serializer = self.get_serializer(data=json)
serializer.is_valid(raise_exception=True)
obj = serializer.save()
db.session.add(obj)
db.session.commit()
data = serializer.data
data = camel_case_key... | if json is None:
raise BadRequest() | random_line_split |
dom-class-debug.js | /*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('dom-class', function(Y) {
var addClass, hasClass, removeClass;
Y.mix(Y.DOM, {
/**
* Determines whether a DOM element has the given className.
... | * @param {HTMLElement} element The DOM element.
* @param {String} className the class name to remove from the class attribute
*/
removeClass: function(node, className) {
if (className && hasClass(node, className)) {
node.className = Y.Lang.trim(node.className.replace(Y.DOM._... | * Removes a class name from a given element.
* @method removeClass
* @for DOM
| random_line_split |
dom-class-debug.js | /*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('dom-class', function(Y) {
var addClass, hasClass, removeClass;
Y.mix(Y.DOM, {
/**
* Determines whether a DOM element has the given className.
... |
},
/**
* Replace a class with another class for a given element.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @for DOM
* @param {HTMLElement} element The DOM element
* @param {String} oldClassName the cla... | {
node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' +
className + '(?:\\s+|$)'), ' '));
if ( hasClass(node, className) ) { // in case of multiple adjacent
removeClass(node, className);
}
} | conditional_block |
11.1.1_20_c.js | // Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that the number of fractional digits is determined correctly for currencies.
* @author Norbert Li... |
if (max !== digits) {
$ERROR("Didn't get correct maximumFractionDigits for currency " +
currency + "; expected " + digits + ", got " + max + ".");
}
});
| {
$ERROR("Didn't get correct minimumFractionDigits for currency " +
currency + "; expected " + digits + ", got " + min + ".");
} | conditional_block |
11.1.1_20_c.js | // Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that the number of fractional digits is determined correctly for currencies.
* @author Norbert Li... | MDL: 2,
MGA: 2,
MKD: 2,
MMK: 2,
MNT: 2,
MOP: 2,
MRO: 2,
MUR: 2,
MVR: 2,
MWK: 2,
MXN: 2,
MXV: 2,
MYR: 2,
MZN: 2,
NAD: 2,
NGN: 2,
NIO: 2,
NOK: 2,
NPR: 2,
NZD: 2,
OMR: 3,
PAB: 2,
PEN: 2,
PGK: 2,
PHP: 2,
PKR: 2,
PLN:... | random_line_split | |
upgrade_schema.py | resource_loader
parser = argparse.ArgumentParser(
description="Script to move TFLite models from pre-release schema to "
"new schema.")
parser.add_argument(
"input",
type=str,
help="Input TensorFlow lite file in `.json`, `.bin` or `.tflite` format.")
parser.add_argument(
"output",
type=str... |
elif extension == ".json":
json_file = input_file
else:
raise ValueError("Invalid extension on input file %r" % input_file)
return json.load(open(json_file))
def _Write(self, data, output_file):
"""Output a json or bin version of the flatbuffer model.
Args:
data: Dic... | raise RuntimeError("Could not find %r" % json_file) | conditional_block |
upgrade_schema.py | resource_loader
parser = argparse.ArgumentParser(
description="Script to move TFLite models from pre-release schema to "
"new schema.")
parser.add_argument(
"input",
type=str,
help="Input TensorFlow lite file in `.json`, `.bin` or `.tflite` format.")
parser.add_argument(
"output",
type=str... | (self, data):
"""Upgrade data from Version 0 to Version 1.
Changes: Added subgraphs (which contains a subset of formally global
entries).
Args:
data: Dictionary representing the TensorFlow lite data to be upgraded.
This will be modified in-place to be an upgraded version.
"""
sub... | _Upgrade0To1 | identifier_name |
upgrade_schema.py | resource_loader
parser = argparse.ArgumentParser(
description="Script to move TFLite models from pre-release schema to "
"new schema.")
parser.add_argument(
"input",
type=str,
help="Input TensorFlow lite file in `.json`, `.bin` or `.tflite` format.")
parser.add_argument(
"output",
type=str... | ValueError: When the model has consistency problems.
Returns:
Upgraded builtin operator data type as a string.
"""
old_to_new = {
"PoolOptions": "Pool2DOptions",
"DepthwiseConvolutionOptions": "DepthwiseConv2DOptions",
"ConvolutionOptions": "Conv2DOptions"... | operator_type: String representing the builtin operator data type
string.
(see :schema.fbs).
Raises: | random_line_split |
upgrade_schema.py | resource_loader
parser = argparse.ArgumentParser(
description="Script to move TFLite models from pre-release schema to "
"new schema.")
parser.add_argument(
"input",
type=str,
help="Input TensorFlow lite file in `.json`, `.bin` or `.tflite` format.")
parser.add_argument(
"output",
type=str... | if os.path.exists(self._flatc_path): break
def FindSchema(base_name):
return resource_loader.get_path_to_datafile("%s" % base_name)
# Supported schemas for upgrade.
self._schemas = [
(0, FindSchema("schema_v0.fbs"), True, self._Upgrade0To1),
(1, FindSchema("schema_v1.fbs"), Tru... | """Converts TensorFlow flatbuffer models from old to new version of schema.
This can convert between any version to the latest version. It uses
an incremental upgrade strategy to go from version to version.
Usage:
converter = Converter()
converter.Convert("a.tflite", "a.json")
converter.Convert("b.j... | identifier_body |
lib.rs | tools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
/// Information about the initial window size.
pub window_size: Option<WindowSizeData>,
/// The ID of the pipeline namespace for this script thread.
pub pipeline_namespace_id: PipelineNamespaceId,
/// A ping will be sent on this channel once... | ConstellationMsg | identifier_name | |
lib.rs | The id to be used for a `TimerEvent` is defined by the corresponding `TimerEventRequest`.
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf, Deserialize, Serialize)]
pub struct TimerEventId(pub u32);
/// Unit of measurement.
#[derive(Clone, Copy, HeapSizeOf)]
pub enum Milliseconds {}
/// Unit of measurement.
#[d... | /// A fatal error | random_line_split | |
gamma_real.js | 5178644804694509993,
0.006061842346248906525783753964555936883222
];
var denom = [
0,
39916800,
120543840,
150917976,
105258076,
45995730,
13339535,
2637558,
... | lgamma | identifier_name | |
gamma_real.js | 35528455955485877361223,
-9.8907772644920670589288081640128194231,
4.408830289125943377923077727900630927902,
-0.5926941084905061794445733628891024027949,
0.01422519127192419234315002746252160965831,
-0.4506604409707170077136555010018549819192e-5,
... | {
var result = 1;
if(z <= 0)
{
if(Math.floor(z) == z)
return Infinity;
if(z <= -20)
{
result = gamma((-z)) * Little.gamma_helper.sinpx(z);
if( (Math.abs(result) < 1) && (Little.gamma_helper.max_value * Math.abs(result) < Math.PI ) )
return -si... | identifier_body | |
gamma_real.js | .2653952234950402949897160456992822,
8071.672002365816210638002902272250613822,
210.8242777515793458725097339207133627117,
2.506628274631000270164908177133837338626
];
var denom = [
0,
39916800,
12054384... | 4.408830289125943377923077727900630927902,
-0.5926941084905061794445733628891024027949,
0.01422519127192419234315002746252160965831,
-0.4506604409707170077136555010018549819192e-5,
-0.8183698410724358930823737982119474130069e-7,
0.91429... | lanczos_sum_near_2: function(dz)
{
var d = [
6.565936202082889535528455955485877361223,
-9.8907772644920670589288081640128194231, | random_line_split |
class-poly-methods-cross-crate.rs | // Copyright 2012-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-MI... | () {
let mut nyan : cat<char> = cat::<char>(52_usize, 99, vec!('p'));
let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string()));
assert_eq!(nyan.how_hungry, 99);
assert_eq!(kitty.how_hungry, 2);
nyan.speak(vec!(1_usize,2_usize,3_usize));
assert_eq!(nyan.meow_count(), 55_usize);
kitty.speak(vec!("meow"... | main | identifier_name |
class-poly-methods-cross-crate.rs | // Copyright 2012-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-MI... | assert_eq!(kitty.how_hungry, 2);
nyan.speak(vec!(1_usize,2_usize,3_usize));
assert_eq!(nyan.meow_count(), 55_usize);
kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()));
assert_eq!(kitty.meow_count(), 1004_usize);
} | let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string()));
assert_eq!(nyan.how_hungry, 99); | random_line_split |
class-poly-methods-cross-crate.rs | // Copyright 2012-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-MI... | {
let mut nyan : cat<char> = cat::<char>(52_usize, 99, vec!('p'));
let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string()));
assert_eq!(nyan.how_hungry, 99);
assert_eq!(kitty.how_hungry, 2);
nyan.speak(vec!(1_usize,2_usize,3_usize));
assert_eq!(nyan.meow_count(), 55_usize);
kitty.speak(vec!("meow".to... | identifier_body | |
connector.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import sqlite3
except ImportError:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
f... | (self):
self.initConnection()
self.checkFileDb()
try:
self.connector = self.__sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
cursor = self.connector.cursor()
cursor.execute("SELECT * FROM sqlite_master")
cursor.cl... | connect | identifier_name |
connector.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import sqlite3
except ImportError:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
f... | API: http://docs.python.org/library/sqlite3.html
Debian package: python-sqlite (SQLite 2), python-pysqlite3 (SQLite 3)
License: MIT
Possible connectors: http://wiki.python.org/moin/SQLite
"""
def __init__(self):
GenericConnector.__init__(self)
self.__sqlite = sqlite3
def c... | User guide: http://docs.python.org/release/2.5/lib/module-sqlite3.html | random_line_split |
connector.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import sqlite3
except ImportError:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
f... | self.execute(query)
return self.fetchall() | identifier_body | |
pmd.js | var util = require('util');
var path = require('path');
var chalk = require('chalk');
var BaseReporter = require('./base');
var Match = require('../match');
/**
* A PMD CPD XML reporter, which tries to fit jsinspect's output to something
* CI tools might expect from PMD.
*
* @construc... |
output += '<duplication lines="' + this._getTotalLines(nodes) + '">\n';
nodes.forEach(function(node) {
output += self._getFile(node);
});
output += '<codefragment>';
if (this._diff) {
for (i = 0; i < match.diffs.length; i++) {
diff += '\n- ' + this._getFormattedLocation(nodes[0]) + '\n+ ' +
... | {
output += '\n';
} | conditional_block |
pmd.js | var util = require('util');
var path = require('path');
var chalk = require('chalk');
var BaseReporter = require('./base');
var Match = require('../match');
/**
* A PMD CPD XML reporter, which tries to fit jsinspect's output to something
* CI tools might expect from PMD.
*
* @construc... | self._writableStream.write('</pmd-cpd>\n');
});
}
util.inherits(PMDReporter, BaseReporter);
module.exports = PMDReporter;
/**
* Returns an XML string containing a <duplication> element, with <file>
* children indicating the instance locations, and <codefragment> to hold the
* diff.
*
* @private
*
* @par... | {
var self, enabled;
self = this;
enabled = chalk.enabled;
opts = opts || {};
BaseReporter.call(this, inspector, opts);
this._diff = opts.diff;
inspector.on('start', function() {
chalk.enabled = false;
self._writableStream.write(
'<?xml version="1.0" encoding="utf-8"?>\n' +
'<pmd-cp... | identifier_body |
pmd.js | var util = require('util');
var path = require('path');
var chalk = require('chalk');
var BaseReporter = require('./base');
var Match = require('../match');
/**
* A PMD CPD XML reporter, which tries to fit jsinspect's output to something
* CI tools might expect from PMD.
*
* @construc... | * @param {[]Node} nodes The nodes for which to get the total
* @returns {int} Total number of lines
*/
PMDReporter.prototype._getTotalLines = function(nodes) {
return nodes.reduce(function(prev, curr) {
return prev + curr.loc.end.line - curr.loc.start.line + 1;
}, 0);
};
/**
* Returns an XML string co... |
/**
* Returns the total number of lines spanned by each node in an array.
* | random_line_split |
pmd.js | var util = require('util');
var path = require('path');
var chalk = require('chalk');
var BaseReporter = require('./base');
var Match = require('../match');
/**
* A PMD CPD XML reporter, which tries to fit jsinspect's output to something
* CI tools might expect from PMD.
*
* @construc... | (inspector, opts) {
var self, enabled;
self = this;
enabled = chalk.enabled;
opts = opts || {};
BaseReporter.call(this, inspector, opts);
this._diff = opts.diff;
inspector.on('start', function() {
chalk.enabled = false;
self._writableStream.write(
'<?xml version="1.0" encoding="utf-8"?>\n... | PMDReporter | identifier_name |
sort_colors.py | """
Two pointers - Sort Colours / Dutch National Flag Problem (medium)
Description:
Given an array containing 0s, 1s and 2s, sort the array in-place. You should treat numbers
of the array as objects, hence, we can’t count 0s, 1s, and 2s to recreate the array.
The flag of the Netherlands consists of three colors: red... | print(sort_colours([2, 2, 0, 1, 2, 0])) | random_line_split | |
sort_colors.py | """
Two pointers - Sort Colours / Dutch National Flag Problem (medium)
Description:
Given an array containing 0s, 1s and 2s, sort the array in-place. You should treat numbers
of the array as objects, hence, we can’t count 0s, 1s, and 2s to recreate the array.
The flag of the Netherlands consists of three colors: red... | ums:list) -> list:
""" Two pointers - similar to the idea of `partition` in quick sort.
Initially, we set two pointers called `low` and `high` which are pointing at the first
element and the last element in the array.
While iterating, we will move all 0s before low and all 2s after high, so in the end... | rt_colours(n | identifier_name |
sort_colors.py | """
Two pointers - Sort Colours / Dutch National Flag Problem (medium)
Description:
Given an array containing 0s, 1s and 2s, sort the array in-place. You should treat numbers
of the array as objects, hence, we can’t count 0s, 1s, and 2s to recreate the array.
The flag of the Netherlands consists of three colors: red... | int(sort_colours([1, 0, 2, 1, 0]))
print(sort_colours([2, 2, 0, 1, 2, 0]))
| conditional_block | |
sort_colors.py | """
Two pointers - Sort Colours / Dutch National Flag Problem (medium)
Description:
Given an array containing 0s, 1s and 2s, sort the array in-place. You should treat numbers
of the array as objects, hence, we can’t count 0s, 1s, and 2s to recreate the array.
The flag of the Netherlands consists of three colors: red... | i += 1
elif nums[i] == 2:
nums[i], nums[high] = nums[high], nums[i]
# Decrement only high, since after swap, the number at index
# i could be 0, 1, 2, so we will go through another loop.
high -= 1
else:
# numss[i] == 1
i... | " Two pointers - similar to the idea of `partition` in quick sort.
Initially, we set two pointers called `low` and `high` which are pointing at the first
element and the last element in the array.
While iterating, we will move all 0s before low and all 2s after high, so in the end,
all 1s will be bet... | identifier_body |
between.ts |
/** @module parjs/combinators */ /** */
import {ImplicitParjser, ParjsCombinator} from "../../index";
import {defineCombinator} from "./combinator";
import {qthen, thenq} from "./then";
import {ScalarConverter} from "../scalar-converter";
/**
* Applies `pre`, the source parser, and then `post`. Yields the result of
... | {
implPost = implPost || implPre;
let pre = ScalarConverter.convert(implPre);
let post = ScalarConverter.convert(implPost);
return defineCombinator(source => {
return pre.pipe(
qthen(source),
thenq(post)
);
});
} | identifier_body | |
between.ts |
/** @module parjs/combinators */ /** */
import {ImplicitParjser, ParjsCombinator} from "../../index";
import {defineCombinator} from "./combinator";
import {qthen, thenq} from "./then";
import {ScalarConverter} from "../scalar-converter";
/**
* Applies `pre`, the source parser, and then `post`. Yields the result of
... | <T>(implPre: ImplicitParjser<any>, implPost?: ImplicitParjser<any>)
: ParjsCombinator<T, T> {
implPost = implPost || implPre;
let pre = ScalarConverter.convert(implPre);
let post = ScalarConverter.convert(implPost);
return defineCombinator(source => {
return pre.pipe(
qthen(sourc... | between | identifier_name |
between.ts | /** @module parjs/combinators */ /** */
import {ImplicitParjser, ParjsCombinator} from "../../index"; | import {qthen, thenq} from "./then";
import {ScalarConverter} from "../scalar-converter";
/**
* Applies `pre`, the source parser, and then `post`. Yields the result of
* the source parser.
* @param pre The parser to precede the source.
* @param post The parser to proceed the source.
*/
export function between<T>(... | import {defineCombinator} from "./combinator"; | random_line_split |
IHomeHeaderComponentProps.ts | import StringAPI from 'api/StringAPI'
export interface IHomeHeaderComponentProps {
/**
* Sidebar is open {true} or not {false}
*
* @type {boolean} | * Logout user
*
* @memberof IHomeHeaderComponentProps
*/
logout?: () => void
/**
* Handle on resize window event
*
* @memberof IHomeHeaderComponentProps
*/
handleResize?: (event: any) => void
/**
* Number of notifications
*
* @memberof IHomeHeaderComponentProps
*/
notifyC... | * @memberof IHomeHeaderComponentProps
*/
drawerStatus: boolean
/** | random_line_split |
convert_dcm.py | #!/usr/bin/env python
import os
import sys
import glob
import argparse
from scai_utils import *
help_doc = "Convert raw DICOM images to nii format. (scai)"
# === Heuristics === #
heur = [["functionalsparse", "bold"],
["DIFFUSIONHIGHRES10Min", "diffusion"],
["AAHeadScout32", "aascout"],
["tf... | delete_file_if_exists(tmpDir, recursive=True)
check_dir(tmpDir, bCreate=True)
dcm2nii_cmd = "dcm2nii -a n -o %s %s" \
% (os.path.abspath(tmpDir), \
os.path.join(os.path.abspath(args.inputDir), "*"))
saydo(dcm2nii_cmd)
# Apply heuristics to move and rename... | ap = argparse.ArgumentParser(description=help_doc)
ap.add_argument("inputDir", type=str, \
help="Input raw DICOM data directory")
ap.add_argument("outputDir", type=str, \
help="Output directory (for saving the .nii.gz files)")
ap.add_argument("sID", type=str, \
... | conditional_block |
convert_dcm.py | #!/usr/bin/env python
import os
import sys
import glob
import argparse
from scai_utils import *
help_doc = "Convert raw DICOM images to nii format. (scai)"
# === Heuristics === #
heur = [["functionalsparse", "bold"],
["DIFFUSIONHIGHRES10Min", "diffusion"],
["AAHeadScout32", "aascout"],
["tf... |
if imgType == "diffusion" and not bvec_bval_done:
bvec = nii.replace(".nii.gz", ".bvec")
bval = nii.replace(".nii.gz", ".bval")
check_file(bvec)
check_file(bval)
bvec_new = imgFN.replace(".nii.gz", ".bvec")
bval_new = imgFN.re... | check_file(imgFN) | random_line_split |
lexical-scope-in-if.rs | // Copyright 2013 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 ... |
zzz();
sentinel();
if x > 1000 {
unreachable!();
} else {
zzz();
sentinel();
let x = 1004;
let y = 1005;
zzz();
sentinel();
}
zzz();
sentinel();
}
fn zzz() {()}
fn sentinel() {()}
| {
unreachable!();
} | conditional_block |
lexical-scope-in-if.rs | // Copyright 2013 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 zzz() {()}
fn sentinel() {()} | random_line_split | |
lexical-scope-in-if.rs | // Copyright 2013 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 = 999;
let y = -1;
zzz();
sentinel();
if x < 1000 {
zzz();
sentinel();
let x = 1001;
zzz();
sentinel();
let x = 1002;
let y = 1003;
zzz();
sentinel();
} else {
unreachable!();
}
zzz();
s... | main | identifier_name |
lexical-scope-in-if.rs | // Copyright 2013 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 ... | sentinel();
} else {
unreachable!();
}
zzz();
sentinel();
if x > 1000 {
unreachable!();
} else {
zzz();
sentinel();
let x = 1004;
let y = 1005;
zzz();
sentinel();
}
zzz();
sentinel();
}
fn zzz() {()}
fn sen... | {
let x = 999;
let y = -1;
zzz();
sentinel();
if x < 1000 {
zzz();
sentinel();
let x = 1001;
zzz();
sentinel();
let x = 1002;
let y = 1003;
zzz(); | identifier_body |
__init__.py | """
Copyright (c) 2012-2016 Ben Croston
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribut... | VERSION = '0.6.3' | random_line_split | |
non_max_suppression_async_test.ts | /**
* @license | * Copyright 2020 Google LLC. 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... | random_line_split | |
build.rs | // Copyright 2019 Google LLC | // 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 agreed to in writing, software
// distributed... | // | random_line_split |
build.rs | // Copyright 2019 Google LLC
//
// 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 agreed to in ... | () {
println!("cargo:rerun-if-changed=crypto_data/aaguid.txt");
let out_dir = env::var_os("OUT_DIR").unwrap();
let aaguid_bin_path = Path::new(&out_dir).join("opensk_aaguid.bin");
let mut aaguid_bin_file = File::create(&aaguid_bin_path).unwrap();
let mut aaguid_txt_file = File::open("crypto_data/a... | main | identifier_name |
build.rs | // Copyright 2019 Google LLC
//
// 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 agreed to in ... | {
println!("cargo:rerun-if-changed=crypto_data/aaguid.txt");
let out_dir = env::var_os("OUT_DIR").unwrap();
let aaguid_bin_path = Path::new(&out_dir).join("opensk_aaguid.bin");
let mut aaguid_bin_file = File::create(&aaguid_bin_path).unwrap();
let mut aaguid_txt_file = File::open("crypto_data/aagu... | identifier_body | |
eq.rs | // Copyright 2013 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 ... | (cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
cx, span, substr)
}
fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
cs_or(|cx, span, _, _| cx.expr_bool(span, true),
... | cs_eq | identifier_name |
eq.rs | // Copyright 2013 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 ... | args: vec!(borrowed_self()),
ret_ty: Literal(Path::new(vec!("bool"))),
attributes: attrs,
const_nonmatching: true,
combine_substructure: combine_substructure(|a, b, c| {
$f(a, b, c)
})
}
... | {
// structures are equal if all fields are equal, and non equal, if
// any fields are not equal or if the enum variants are different
fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
cx, span... | identifier_body |
eq.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ast::{MetaItem, Item, Expr};
use codemap::Span;
use ext::base::ExtCtxt;
use ext::bui... | random_line_split | |
index.js | import React, { useState, useRef } from 'react';
import { computeOutOffsetByIndex, computeInOffsetByIndex } from './lib/Util';
// import { SVGComponent } from './lib-hooks/svgComp-hooks';
import Spline from './lib/Spline';
import DragNode from './lib/Node';
const index = ({
data,
onNodeDeselect,
onNodeMove... | else {
reval++;
}
}
}
const getNodeById = (nodes, nid) => {
let reval = 0;
for(const node of nodes) {
if (node.nid === nid) {
return nodes[reval];
} else {
reval++;
}
}
}
l... | {
return reval;
} | conditional_block |
index.js | import React, { useState, useRef } from 'react';
import { computeOutOffsetByIndex, computeInOffsetByIndex } from './lib/Util';
// import { SVGComponent } from './lib-hooks/svgComp-hooks';
import Spline from './lib/Spline';
import DragNode from './lib/Node';
| onNodeMove,
onNodeStartMove,
onNodeSelect,
onNewConnector,
onRemoveConnector
}) => {
const [dataS, setDataS] = useState(data);
const [source, setSource] = useState([]);
const [dragging, setDragging] = useState(false);
const [mousePos, setMousePos] = useState({x: 0, y: 0});
const... | const index = ({
data,
onNodeDeselect, | random_line_split |
main.rs | otes;
use anyhow::Result;
use clap::{crate_authors, crate_version, App, AppSettings, ArgMatches, YamlLoader};
use colored::*;
use git2::ErrorCode;
use lazy_static::lazy_static;
use log::{debug, error, info, trace};
use std::io::{self, stdin, stdout, Cursor, Write};
use std::{env, include_str, process};
use tabwriter::... | (message: &str) -> ! {
eprintln!("{}", message.red());
process::exit(1);
}
/// Get the remote for the current project
fn get_remote(remote_name: &str, fetch_api_key: bool) -> Result<Box<dyn remotes::Remote>> {
let remote_url = git::get_remote_url(remote_name);
remotes::get_remote(remote_name, &remote_u... | abort | identifier_name |
main.rs | otes;
use anyhow::Result;
use clap::{crate_authors, crate_version, App, AppSettings, ArgMatches, YamlLoader};
use colored::*;
use git2::ErrorCode;
use lazy_static::lazy_static;
use log::{debug, error, info, trace};
use std::io::{self, stdin, stdout, Cursor, Write};
use std::{env, include_str, process};
use tabwriter::... | else if let Some(shell_name) = matches.value_of("GENERATE_COMPLETIONS") {
app = build_cli();
generate_completion(&mut app, &shell_name);
} else {
let request_id = matches.value_of("REQUEST_ID").unwrap();
let mr_id = if request_id == "-" {
trace!("Received request for pre... | {
set_default_remote(remote_name);
} | conditional_block |
main.rs | otes;
use anyhow::Result;
use clap::{crate_authors, crate_version, App, AppSettings, ArgMatches, YamlLoader};
use colored::*;
use git2::ErrorCode;
use lazy_static::lazy_static;
use log::{debug, error, info, trace};
use std::io::{self, stdin, stdout, Cursor, Write};
use std::{env, include_str, process};
use tabwriter::... |
/// Set the default remote for the repository
fn set_default_remote(remote_name: &str) {
trace!("Setting default remote {}", remote_name);
git::set_project_config("defaultremote", remote_name);
eprintln!("{}", "New default remote set!".green());
}
/// Print the open requests
fn list_open_requests(remote_... | {
trace!("Setting project ID: {} for remote: {}", new_id, remote_name);
git::set_config("projectid", remote_name, new_id);
eprintln!("{}", "New project ID set!".green());
} | identifier_body |
main.rs | remotes;
use anyhow::Result;
use clap::{crate_authors, crate_version, App, AppSettings, ArgMatches, YamlLoader};
use colored::*;
use git2::ErrorCode;
use lazy_static::lazy_static;
use log::{debug, error, info, trace};
use std::io::{self, stdin, stdout, Cursor, Write};
use std::{env, include_str, process};
use tabwrit... | &error
);
abort(&message);
})
}
/// Check out the branch corresponding to the MR ID and the remote's name
fn checkout_mr(remote_name: &str, mr_id: i64) {
info!("Getting MR: {}", mr_id);
let mut remote = get_remote_hard(remote_name, true);
debug!("Found remote: {}", remote);
... | random_line_split | |
changelist-controls-sk_po.ts | import { CheckOrRadio } from 'elements-sk/checkbox-sk/checkbox-sk';
import { PageObject } from '../../../infra-sk/modules/page_object/page_object';
import { PageObjectElement, PageObjectElementList } from '../../../infra-sk/modules/page_object/page_object_element';
/** A page object for the ChangelistControlsSk compon... | (): PageObjectElementList {
return this.bySelectorAll('.tryjob-container .tryjob');
}
isVisible() {
return this.element.applyFnToDOMNode((el) => el.children.length > 0);
}
async getPatchset() { return this.patchsetDropDown.value; }
async setPatchset(value: string) { await this.patchsetDropDown.ente... | tryjobs | identifier_name |
changelist-controls-sk_po.ts | import { CheckOrRadio } from 'elements-sk/checkbox-sk/checkbox-sk';
import { PageObject } from '../../../infra-sk/modules/page_object/page_object';
import { PageObjectElement, PageObjectElementList } from '../../../infra-sk/modules/page_object/page_object_element';
/** A page object for the ChangelistControlsSk compon... |
async isShowAllResultsRadioChecked() {
return this.includeMasterRadio.applyFnToDOMNode((el) => (el as CheckOrRadio).checked);
}
async clickShowAllResultsRadio() { await this.includeMasterRadio.click(); }
async getTryJobs() { return this.tryjobs.map((tryjob) => tryjob.innerText); }
} | async isExcludeResultsFromPrimaryRadioChecked() {
return this.excludeMasterRadio.applyFnToDOMNode((el) => (el as CheckOrRadio).checked);
}
async clickExcludeResultsFromPrimaryRadio() { await this.excludeMasterRadio.click(); } | random_line_split |
changelist-controls-sk_po.ts | import { CheckOrRadio } from 'elements-sk/checkbox-sk/checkbox-sk';
import { PageObject } from '../../../infra-sk/modules/page_object/page_object';
import { PageObjectElement, PageObjectElementList } from '../../../infra-sk/modules/page_object/page_object_element';
/** A page object for the ChangelistControlsSk compon... |
async setPatchset(value: string) { await this.patchsetDropDown.enterValue(value); }
async isExcludeResultsFromPrimaryRadioChecked() {
return this.excludeMasterRadio.applyFnToDOMNode((el) => (el as CheckOrRadio).checked);
}
async clickExcludeResultsFromPrimaryRadio() { await this.excludeMasterRadio.click... | { return this.patchsetDropDown.value; } | identifier_body |
classifier.py | import os
import codecs
import svmlight
from libsvm import svmutil, svm
# Optional LIBLinear
try:
from liblinear import liblinearutil, liblinear
liblinear_found = True
except ImportError:
liblinear_found = False
from ctypes import *
from dtbutils import *
from perceptron import KernelLBRankPerceptron, polyn... | (self):
if not os.path.isfile(self._modelname+"/"+self._pref+".model"):
return False
if self._classtype == "classifier":
self._model = svmutil.svm_load_model(self._modelname+\
| load_model | identifier_name |
classifier.py |
"""
Classifier for liblinear, svmlin. Agnostic about features or labels. Uses
'ranking', or dynamic classes.
"""
import sys
import os
import codecs
import svmlight
from libsvm import svmutil, svm
# Optional LIBLinear
try:
from liblinear import liblinearutil, liblinear
liblinear_found = True
except ImportError... | # Author: Enrique Henestroza Anguiano
# | random_line_split | |
classifier.py | import os
import codecs
import svmlight
from libsvm import svmutil, svm
# Optional LIBLinear
try:
from liblinear import liblinearutil, liblinear
liblinear_found = True
except ImportError:
liblinear_found = False
from ctypes import *
from dtbutils import *
from perceptron import KernelLBRankPerceptron, polyn... |
else:
cidx.append(X2cnt)
X2.append(feats)
if i == 0:
X2isdef.append(1)
else:
X2isdef.append(0)
X2cnt += 1
Xidx.append(tuple(cidx))
prin... | X1isdef.append(0) | conditional_block |
classifier.py | import os
import codecs
import svmlight
from libsvm import svmutil, svm
# Optional LIBLinear
try:
from liblinear import liblinearutil, liblinear
liblinear_found = True
except ImportError:
liblinear_found = False
from ctypes import *
from dtbutils import *
from perceptron import KernelLBRankPerceptron, polyn... | rex.append((glab, feats))
else:
allex.append(rex)
qid = cqid
rex = [(glab, feats)]
allex.append(rex)
efile.close()
# Only supports a one-vs-all ranking (highest glab over rest)
print >> sys.stderr, "Generating r... | efile = codecs.open(ef, 'r', 'ascii')
qid = None
allex = []
rex = []
print >> sys.stderr, "Reading ranking problem..."
for line in efile:
fields = line.rstrip().split(' ')
glab = int(fields.pop(0))
cqid = int(fields.pop(0).split(":")[1])
... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.