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 |
|---|---|---|---|---|
test_adapter.py | array = self.zeros_adapter([10], keys=key)
self.assertEqual(array.shape, shape)
def test_shape_2d(self):
pairs = [
[(), (30, 40)],
[(5,), (40,)],
[(slice(1, 3),), (2, 40)],
[(slice(None, None),), (30, 40)],
[(5, 3), ()],
... | ortho = TestOrthoAdapter.Ortho(ndarray)
array = biggus.OrthoArrayAdapter(ortho, keys)
return array | identifier_body | |
test_adapter.py | [(), (10,)],
[(5,), ()],
[(slice(1, 3),), (2,)],
]
for key, shape in pairs:
array = self.zeros_adapter([10], keys=key)
self.assertEqual(array.shape, shape)
def test_shape_2d(self):
pairs = [
[(), (30, 40)],
[(5,), (40,... | wrap | identifier_name | |
test.rs | use rand::{SeedableRng, Rng, rngs::SmallRng};
// Having more than 1 test does seem to make a difference
// (i.e., this calls ptr::swap which having just one test does not).
#[test]
fn simple1() |
#[test]
fn simple2() {
assert_ne!(42, 24);
}
// A test that won't work on miri (tests disabling tests).
#[test]
#[cfg_attr(miri, ignore)]
fn does_not_work_on_miri() {
let x = 0u8;
assert!(&x as *const _ as usize % 4 < 4);
}
// We also use this to test some external crates, that we cannot depend on in th... | {
assert_eq!(4, 4);
} | identifier_body |
test.rs | use rand::{SeedableRng, Rng, rngs::SmallRng};
// Having more than 1 test does seem to make a difference
// (i.e., this calls ptr::swap which having just one test does not).
#[test]
fn simple1() {
assert_eq!(4, 4);
}
#[test]
fn simple2() {
assert_ne!(42, 24);
}
// A test that won't work on miri (tests disabli... | () {
assert_eq!(num_cpus::get(), 1);
}
// FIXME: Remove this `cfg` once we fix https://github.com/rust-lang/miri/issues/1059.
// We cfg-gate the `should_panic` attribute and the `panic!` itself, so that the test
// stdout does not depend on the platform.
#[test]
#[cfg_attr(not(windows), should_panic(expected="Exp... | num_cpus | identifier_name |
test.rs | use rand::{SeedableRng, Rng, rngs::SmallRng};
// Having more than 1 test does seem to make a difference
// (i.e., this calls ptr::swap which having just one test does not).
#[test]
fn simple1() {
assert_eq!(4, 4);
}
#[test]
fn simple2() {
assert_ne!(42, 24);
}
// A test that won't work on miri (tests disabli... | // We cfg-gate the `should_panic` attribute and the `panic!` itself, so that the test
// stdout does not depend on the platform.
#[test]
#[cfg_attr(not(windows), should_panic(expected="Explicit panic"))]
fn do_panic() { // In large, friendly letters :)
#[cfg(not(windows))]
panic!("Explicit panic from test!");
}... | }
// FIXME: Remove this `cfg` once we fix https://github.com/rust-lang/miri/issues/1059. | random_line_split |
Main.tsx | 'use strict'
import * as React from 'react';
import { connect } from 'react-redux';
import { exampleActions } from './actions/example';
interface Main {
exampleMember: string;
}
export interface MainProps {
dispatch: any;
selectedItem: string;
}
class Main extends React.Component<MainProps, {}> {
constru... | (): JSX.Element[] {
let items = ['one', 'two', 'three', 'four', 'five'];
return items.map(
item => <li key={item} onClick={this.selected.bind(this, item)}>{item}</li>);
}
selectedText(): string {
return this.props.selectedItem === null ? 'No selection' : 'You selected ' + this.props.selectedItem... | renderItems | identifier_name |
Main.tsx | 'use strict'
import * as React from 'react';
import { connect } from 'react-redux';
import { exampleActions } from './actions/example';
interface Main {
exampleMember: string;
}
export interface MainProps {
dispatch: any;
selectedItem: string;
}
class Main extends React.Component<MainProps, {}> {
constru... |
selected(item) {
this.props.dispatch(exampleActions.selectItem(item));
}
renderItems(): JSX.Element[] {
let items = ['one', 'two', 'three', 'four', 'five'];
return items.map(
item => <li key={item} onClick={this.selected.bind(this, item)}>{item}</li>);
}
selectedText(): string {
ret... | {
super(props);
this.exampleMember = "This is an example member"
} | identifier_body |
Main.tsx | 'use strict'
import * as React from 'react';
import { connect } from 'react-redux';
import { exampleActions } from './actions/example';
interface Main {
exampleMember: string;
}
export interface MainProps {
dispatch: any;
selectedItem: string;
}
class Main extends React.Component<MainProps, {}> {
constru... | export default connect(subscribedState)(Main); | random_line_split | |
demo-application.ts | import {Application} from "../../src/application";
import {IApplication} from "../../src/iapplication";
import {UILoader} from "../../src/ui-loader/ui-loader"
import {IViewModel} from "../../src/mvvm/iview-model"
var themeURL = "/demos/assets/theme/default/theme.js";
var appThemeURL = "/demos/assets/theme/default/... | (app:IApplication) {
var ui = new UILoader();
var win = ui.load(this, this.mainwindowJson, this.viewModel);
win.open();
}
public start() {
this.preload(assetsURLs, () => {
this.init({sysThemeDataURL:themeURL, appThemeDataURL:appThemeURL});
this.run();
});
}
private mainwindowJson : any;
private v... | onReady | identifier_name |
demo-application.ts | import {Application} from "../../src/application";
import {IApplication} from "../../src/iapplication";
import {UILoader} from "../../src/ui-loader/ui-loader"
import {IViewModel} from "../../src/mvvm/iview-model"
var themeURL = "/demos/assets/theme/default/theme.js";
var appThemeURL = "/demos/assets/theme/default/... |
private mainwindowJson : any;
private viewModel : IViewModel;
}
| {
this.preload(assetsURLs, () => {
this.init({sysThemeDataURL:themeURL, appThemeDataURL:appThemeURL});
this.run();
});
} | identifier_body |
demo-application.ts | import {Application} from "../../src/application";
import {IApplication} from "../../src/iapplication";
import {UILoader} from "../../src/ui-loader/ui-loader"
import {IViewModel} from "../../src/mvvm/iview-model"
var themeURL = "/demos/assets/theme/default/theme.js";
var appThemeURL = "/demos/assets/theme/default/... | private viewModel : IViewModel;
} | random_line_split | |
DropdownLayout.uni.driver.d.ts | import { BaseUniDriver } from 'wix-ui-test-utils/base-driver';
export interface DropdownLayoutUniDriver extends BaseUniDriver {
/** @deprecated should be private */
classes: (name: string) => Promise<any>;
clickAtOption: (index: number) => Promise<void>; | clickAtOptionByDataHook: (dataHook: string) => Promise<void>;
clickAtOptionWithValue: (value: string) => Promise<void>;
hasTopArrow: () => Promise<boolean>;
isDown: () => Promise<boolean>;
isLinkOption: (position: number) => Promise<boolean>;
isOptionADivider: (position: number) => Promise<boolean>;
isOpt... | random_line_split | |
BoardModule.js | var BoardVo = require(_path.src + "/vo/BoardVo.js");
var BoardDao = require(_path.src + "/dao/BoardDao.js");
var RoleDao = require(_path.src + "/dao/RoleDao.js");
module.exports.board = function($, el, param, req, next)
{
var template = this.getTemplate($, el);
BoardDao.getBoard(param.id, function(board)
{
$(el).... |
var template = this.getTemplate($, el);
BoardDao.getBoardList(vo, function(boardList)
{
RoleDao.getRoleList(function(roleList)
{
$(el).html(template({boardList : boardList, roleList : roleList}));
next();
});
});
}; | {
vo.signinUserId = req.session.user.id;
vo.signinUserLevel = req.session.user.level;
} | conditional_block |
BoardModule.js | var BoardVo = require(_path.src + "/vo/BoardVo.js");
var BoardDao = require(_path.src + "/dao/BoardDao.js"); | module.exports.board = function($, el, param, req, next)
{
var template = this.getTemplate($, el);
BoardDao.getBoard(param.id, function(board)
{
$(el).html(template(board));
next();
});
};
module.exports.boardList = function($, el, param, req, next)
{
var vo = new BoardVo();
if(req.session.user != null)
{
... | var RoleDao = require(_path.src + "/dao/RoleDao.js");
| random_line_split |
config.rs | //! Configuration module, read and write config file.
use APP_INFO;
use error::*;
use json::JsonValue;
use std::fs::File;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use vars::VarsHandler;
/// Configuration structure to read and write config.
#[derive(Clone, Debug)]
pub struct Config {
/// Path to... | () -> Config {
let metadata_path = ::app_dirs::app_root(::app_dirs::AppDataType::UserData, &APP_INFO)
.unwrap()
.join("metadata.json");
let vars_path = VarsHandler::get_default_path().unwrap();
Config::new(metadata_path, 3600, vars_path)
}
}
#[cfg(test)]
mod unit_tes... | default | identifier_name |
config.rs | //! Configuration module, read and write config file.
use APP_INFO;
use error::*;
use json::JsonValue;
use std::fs::File;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use vars::VarsHandler;
/// Configuration structure to read and write config.
#[derive(Clone, Debug)]
pub struct Config {
/// Path to... |
/// Read config from readable stream
pub fn from_json_stream<R: Read>(stream: &mut R) -> Result<Config> {
let mut buf = String::new();
stream.read_to_string(&mut buf)?;
let json = ::json::parse(&buf)?;
let metadata_path = match json["metadata_path"].as_str() {
Some(s... | ::app_dirs::app_root(::app_dirs::AppDataType::UserConfig, &APP_INFO)?
.join("config"),
)
} | random_line_split |
config.rs | //! Configuration module, read and write config file.
use APP_INFO;
use error::*;
use json::JsonValue;
use std::fs::File;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use vars::VarsHandler;
/// Configuration structure to read and write config.
#[derive(Clone, Debug)]
pub struct Config {
/// Path to... |
/// Path to the config
pub fn config_path() -> Result<PathBuf> {
Ok(
::app_dirs::app_root(::app_dirs::AppDataType::UserConfig, &APP_INFO)?
.join("config"),
)
}
/// Read config from readable stream
pub fn from_json_stream<R: Read>(stream: &mut R) -> Resu... | {
Config {
metadata_path: metadata_path.as_ref().to_path_buf(),
autobackup_interval: autobackup_interval,
vars_path: vars_path.as_ref().to_path_buf(),
}
} | identifier_body |
sqlreturn.rs | /// Indicates the overall success or failure of the function
///
/// Each function in ODBC returns a code, known as its return code, which indicates the overall
/// success or failure of the function. Program logic is generally based on return codes.
/// See [ODBC reference](https://docs.microsoft.com/en-us/sql/odbc/re... | ///
/// The application calls `SQLGetDiagRec` or `SQLGetDiagField` to retrieve additional
/// information.
pub const SUCCESS_WITH_INFO: SqlReturn = SqlReturn(1);
/// A function that was started asynchronously is still executing
///
/// The application `SQLGetDiagRec` or `SQLGetDiagField` to... | /// record.
pub const SUCCESS: SqlReturn = SqlReturn(0);
/// Function completed successfully, possibly with a nonfatal error (warning) | random_line_split |
sqlreturn.rs | /// Indicates the overall success or failure of the function
///
/// Each function in ODBC returns a code, known as its return code, which indicates the overall
/// success or failure of the function. Program logic is generally based on return codes.
/// See [ODBC reference](https://docs.microsoft.com/en-us/sql/odbc/re... | (pub i16);
impl SqlReturn {
/// `SQL_INVALID_HANDLE`; Function failed due to an invalid environment, connection, statement,
/// or descriptor handle.
///
/// This indicates a programming error. No additional information is available from
/// `SQLGetDiagRec` or `SQLGetDiagField`. This code is return... | SqlReturn | identifier_name |
server.rs | use iron::prelude::*;
use iron::status;
use router::Router;
use urlencoded::UrlEncodedQuery;
fn handler(req: &mut Request) -> IronResult<Response> {
// match req.get_ref::<UrlEncodedQuery>() {
// Err(ref e) => {
// let err_msg = format!("{:?}", e); | // Ok(Response::with((status::Ok, "he")))
// }
// }
panic!("fix me, something in Iron broke")
}
pub fn run() {
let mut router = Router::new(); // Alternative syntax:
router.get("/check", handler); // get "/:query" => handler);
Iron::new(router).http("127.... | // Ok(Response::with((status::Ok, &err_msg[..])))
// },
// Ok(ref hashmap) => {
// println!("Parsed GET request query string:\n {:?}", hashmap); | random_line_split |
server.rs | use iron::prelude::*;
use iron::status;
use router::Router;
use urlencoded::UrlEncodedQuery;
fn handler(req: &mut Request) -> IronResult<Response> {
// match req.get_ref::<UrlEncodedQuery>() {
// Err(ref e) => {
// let err_msg = format!("{:?}", e);
// Ok(Response::with((status::Ok, ... | {
let mut router = Router::new(); // Alternative syntax:
router.get("/check", handler); // get "/:query" => handler);
Iron::new(router).http("127.0.0.1:3000").unwrap();
} | identifier_body | |
server.rs | use iron::prelude::*;
use iron::status;
use router::Router;
use urlencoded::UrlEncodedQuery;
fn | (req: &mut Request) -> IronResult<Response> {
// match req.get_ref::<UrlEncodedQuery>() {
// Err(ref e) => {
// let err_msg = format!("{:?}", e);
// Ok(Response::with((status::Ok, &err_msg[..])))
// },
// Ok(ref hashmap) => {
// println!("Parsed GET reques... | handler | identifier_name |
io_handler.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | (&self, io: &IoContext<ClientIoMessage>) {
io.register_timer(INFO_TIMER, 5000).expect("Error registering timer");
}
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
if timer == INFO_TIMER && !self.shutdown.load(Ordering::SeqCst) {
self.info.tick();
}
}
}
pub struct ImportIoHandler ... | initialize | identifier_name |
io_handler.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | pub shutdown: Arc<AtomicBool>
}
impl IoHandler<ClientIoMessage> for ClientIoHandler {
fn initialize(&self, io: &IoContext<ClientIoMessage>) {
io.register_timer(INFO_TIMER, 5000).expect("Error registering timer");
}
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
if timer == INFO_TIMER... | pub accounts: Arc<AccountProvider>,
pub info: Arc<Informant>, | random_line_split |
io_handler.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
}
}
pub struct ImportIoHandler {
pub info: Arc<Informant>,
}
impl IoHandler<ClientIoMessage> for ImportIoHandler {
fn initialize(&self, io: &IoContext<ClientIoMessage>) {
io.register_timer(INFO_TIMER, 5000).expect("Error registering timer");
}
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerT... | {
self.info.tick();
} | conditional_block |
test_python_parser_only.py | ", "B", "C"],
index=Index(["foo", "bar", "baz"], name="index"),
)
tm.assert_frame_equal(result, expected)
@pytest.mark.parametrize("encoding", [None, "utf-8"])
def test_sniff_delimiter_encoding(python_parser_only, encoding):
parser = python_parser_only
data = """ignore this
ignore this too
ind... | test_skipfooter_bad_row | identifier_name | |
test_python_parser_only.py | msg = "skipfooter must be an integer"
with pytest.raises(ValueError, match=msg):
parser.read_csv(StringIO(data), skipfooter=skipfooter)
def test_invalid_skipfooter_negative(python_parser_only):
# see gh-15925 (comment)
data = "a\n1\n2"
parser = python_parser_only
msg = "skipfooter can... |
expected = DataFrame.from_records(
[(1, 3, 7, 0, 3, 6), (3, 1, 4, 1, 5, 9)],
columns=list("abcABC"),
index=list("abc"),
)
result = parser.read_csv(StringIO(data), sep=r"\s+")
tm.assert_frame_equal(result, expected)
@pytest.mark.parametrize("add_footer", [True, False])
def test... | # see gh-6893
data = " A B C\na b c\n1 3 7 0 3 6\n3 1 4 1 5 9"
parser = python_parser_only | random_line_split |
test_python_parser_only.py | encoding is not None:
from io import TextIOWrapper
data = data.encode(encoding)
data = BytesIO(data)
data = TextIOWrapper(data, encoding=encoding)
else:
data = StringIO(data)
result = parser.read_csv(data, index_col=0, sep=None, skiprows=2, encoding=encoding)
expec... | msg = "unexpected end of data|expected after"
with pytest.raises(ParserError, match=msg):
parser.read_csv(StringIO(data), skipfooter=skipfooter) | conditional_block | |
test_python_parser_only.py | bar|4|5|6
baz|7|8|9
"""
parser = python_parser_only
result = parser.read_csv(StringIO(data), index_col=0, **kwargs)
expected = DataFrame(
[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
columns=["A", "B", "C"],
index=Index(["foo", "bar", "baz"], name="index"),
)
tm.assert_frame_equal(resu... | kwargs = {"sep": ",,"}
parser = python_parser_only
data = 'a,,b\n1,,a\n2,,"2,,b"'
if quoting == csv.QUOTE_NONE:
msg = "Expected 2 fields in line 3, saw 3"
with pytest.raises(ParserError, match=msg):
parser.read_csv(StringIO(data), quoting=quoting, **kwargs)
else:
ms... | identifier_body | |
local_device_instrumentation_test_run.py | ('EnormousTest', 10 * 60),
('LargeTest', 5 * 60),
('MediumTest', 3 * 60),
('SmallTest', 1 * 60),
]
# TODO(jbudorick): Make this private once the instrumentation test_runner is
# deprecated.
def DidPackageCrashOnDevice(package_name, device):
# Dismiss any error dialogs. Limit the number in case we have an err... | def individual_device_tear_down(dev):
if str(dev) in self._flag_changers:
self._flag_changers[str(dev)].Restore()
# Remove package-specific configuration
dev.RunShellCommand(['am', 'clear-debug-app'], check_return=True)
valgrind_tools.SetChromeTimeoutScale(dev, None)
self._env... | self._test_instance.GetDataDependencies())
def TearDown(self):
@local_device_test_run.handle_shard_failures_with(
self._env.BlacklistDevice) | random_line_split |
local_device_instrumentation_test_run.py | EnormousTest', 10 * 60),
('LargeTest', 5 * 60),
('MediumTest', 3 * 60),
('SmallTest', 1 * 60),
]
# TODO(jbudorick): Make this private once the instrumentation test_runner is
# deprecated.
def DidPackageCrashOnDevice(package_name, device):
# Dismiss any error dialogs. Limit the number in case we have an error
... | ():
if self._test_instance.flags:
if not self._test_instance.package_info:
logging.error("Couldn't set flags: no package info")
elif not self._test_instance.package_info.cmdline_file:
logging.error("Couldn't set flags: no cmdline_file")
else:
sel... | create_flag_changer | identifier_name |
local_device_instrumentation_test_run.py | EnormousTest', 10 * 60),
('LargeTest', 5 * 60),
('MediumTest', 3 * 60),
('SmallTest', 1 * 60),
]
# TODO(jbudorick): Make this private once the instrumentation test_runner is
# deprecated.
def DidPackageCrashOnDevice(package_name, device):
# Dismiss any error dialogs. Limit the number in case we have an error
... |
test_names, timeouts = zip(*(name_and_timeout(t) for t in test))
test_name = ','.join(test_names)
test_display_name = test_name
target = '%s/%s' % (
self._test_instance.driver_package,
self._test_instance.driver_name)
extras.update(
self._test_instance.GetD... | n = self._GetTestName(t)
i = self._GetTimeoutFromAnnotations(t['annotations'], n)
return (n, i) | identifier_body |
local_device_instrumentation_test_run.py | EnormousTest', 10 * 60),
('LargeTest', 5 * 60),
('MediumTest', 3 * 60),
('SmallTest', 1 * 60),
]
# TODO(jbudorick): Make this private once the instrumentation test_runner is
# deprecated.
def DidPackageCrashOnDevice(package_name, device):
# Dismiss any error dialogs. Limit the number in case we have an error
... |
for apk in self._test_instance.additional_apks:
dev.Install(apk)
# Set debug app in order to enable reading command line flags on user
# builds
if self._test_instance.flags:
if not self._test_instance.package_info:
logging.error("Couldn't set debug app:... | permissions = self._test_instance.test_apk.GetPermissions()
dev.Install(self._test_instance.test_apk, permissions=permissions) | conditional_block |
server.js | "use strict";
var express = require('express');
var app = express(); // define our app using express
var path = require('path');
var fs = require('fs')
var handlebars = require('express-handlebars'), hbs;
var bodyParser = require('body-parser');
// handlebars template engine
hbs = handlebars.create({ def... |
});
// custom 404 page (middleware) - MUST be placed after controllers because they have already defined valid routes
app.use(function(req,res,next){ res.status(404); res.render("layouts/_404.hview"); }); //error page
app.listen(app.get('port'));
console.log("Server listening on localhost:" + app.get('port'));
| {
// var route = require('./controllers/' + file); // these 2 lines result the same as uncommented one
// route.controller(app);
require('./controllers/' + file).controller(app);
/* passes the app instance to controller
(means controllers are imported, but don't have to be binded to... | conditional_block |
server.js | "use strict";
var express = require('express');
var app = express(); // define our app using express
var path = require('path');
var fs = require('fs')
var handlebars = require('express-handlebars'), hbs;
var bodyParser = require('body-parser');
// handlebars template engine
hbs = handlebars.create({ def... | app.set('view engine', 'hview');
//app.use(express.favicon());
app.use(express.static(path.join(__dirname, 'assets')));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// dynamically include routes (from Controllers)
fs.readdirSync('./controllers').forEach(function (file) {
if(file.s... | app.set('port', 3000);
app.set('views', path.join(__dirname, 'views')); | random_line_split |
voipCredentials.js | /*
Copyright Jesus Perez <jesusprubio gmail com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. | This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License... | random_line_split | |
GlitchPass.js | /**
*/
THREE.GlitchPass = function ( dt_size ) {
if ( THREE.DigitalGlitch === undefined ) console.error( "THREE.GlitchPass relies on THREE.DigitalGlitch" );
var shader = THREE.DigitalGlitch;
this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
if (dt_size == undefined) dt_size = 64;
this.unifo... | this.uniforms[ 'byp' ].value = 0;
if (this.curF % this.randX == 0 || this.goWild == true)
{
this.uniforms[ 'amount' ].value = Math.random() / 30;
this.uniforms[ 'angle' ].value = THREE.Math.randFloat(-Math.PI, Math.PI);
this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat(-1, 1);
this.uniforms[ '... |
render: function ( renderer, writeBuffer, readBuffer, delta )
{
this.uniforms[ "tDiffuse" ].value = readBuffer;
this.uniforms[ 'seed' ].value = Math.random();//default seeding | random_line_split |
index.ts | import { FileSystemAdapter } from './adapters/fs';
import * as async from './providers/async';
import * as sync from './providers/sync';
import Settings, { Options } from './settings';
import { Dirent, Entry } from './types';
type AsyncCallback = async.AsyncCallback;
function scandir(path: string, callback: AsyncCall... |
// https://github.com/typescript-eslint/typescript-eslint/issues/60
// eslint-disable-next-line no-redeclare
declare namespace scandir {
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
}
function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry... | {
if (typeof optionsOrSettingsOrCallback === 'function') {
return async.read(path, getSettings(), optionsOrSettingsOrCallback);
}
async.read(path, getSettings(optionsOrSettingsOrCallback), callback as AsyncCallback);
} | identifier_body |
index.ts | import { FileSystemAdapter } from './adapters/fs';
import * as async from './providers/async';
import * as sync from './providers/sync';
import Settings, { Options } from './settings';
import { Dirent, Entry } from './types';
type AsyncCallback = async.AsyncCallback;
function scandir(path: string, callback: AsyncCall... |
return new Settings(settingsOrOptions);
}
export {
scandir,
scandirSync,
Settings,
// https://github.com/typescript-eslint/typescript-eslint/issues/131
// eslint-disable-next-line no-undef
AsyncCallback,
Dirent,
Entry,
FileSystemAdapter,
Options
};
| {
return settingsOrOptions;
} | conditional_block |
index.ts | import { FileSystemAdapter } from './adapters/fs';
import * as async from './providers/async';
import * as sync from './providers/sync';
import Settings, { Options } from './settings';
import { Dirent, Entry } from './types';
type AsyncCallback = async.AsyncCallback;
function scandir(path: string, callback: AsyncCall... | (path: string, optionsOrSettings?: Options | Settings): Entry[] {
const settings = getSettings(optionsOrSettings);
return sync.read(path, settings);
}
function getSettings(settingsOrOptions: Settings | Options = {}): Settings {
if (settingsOrOptions instanceof Settings) {
return settingsOrOptions;
}
return ne... | scandirSync | identifier_name |
index.ts | import { FileSystemAdapter } from './adapters/fs';
import * as async from './providers/async';
import * as sync from './providers/sync';
import Settings, { Options } from './settings';
import { Dirent, Entry } from './types';
type AsyncCallback = async.AsyncCallback;
function scandir(path: string, callback: AsyncCall... |
function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[] {
const settings = getSettings(optionsOrSettings);
return sync.read(path, settings);
}
function getSettings(settingsOrOptions: Settings | Options = {}): Settings {
if (settingsOrOptions instanceof Settings) {
return settingsOrOp... | // eslint-disable-next-line no-redeclare
declare namespace scandir {
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
} | random_line_split |
parametric_attention_test.py | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
def test_parametric_attention_model_with_multiple_representations(self):
model = parametric_attention.SimpleParametricAttention(
output_dimension=2,
input_embedding_dimension=2,
vocab_size=10,
num_representations=3,
max_sequence_size=20)
input_batch = tf.convert_to_t... | random_line_split | |
parametric_attention_test.py | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
def test_parametric_attention_model_with_multiple_representations(self):
model = parametric_attention.SimpleParametricAttention(
output_dimension=2,
input_embedding_dimension=2,
vocab_size=10,
num_representations=3,
max_sequence_size=20)
input_batch = tf.convert_to_... | model = parametric_attention.SimpleParametricAttention(
output_dimension=2,
input_embedding_dimension=2,
vocab_size=10,
num_representations=1,
max_sequence_size=20)
input_batch = tf.convert_to_tensor(
np.random.randint(low=0, high=10, size=(10, 20)))
output = mod... | identifier_body |
parametric_attention_test.py | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | (self):
model = parametric_attention.SimpleParametricAttention(
output_dimension=2,
input_embedding_dimension=2,
vocab_size=10,
num_representations=3,
max_sequence_size=20)
input_batch = tf.convert_to_tensor(
np.random.randint(low=0, high=10, size=(10, 20)))
... | test_parametric_attention_model_with_multiple_representations | identifier_name |
parametric_attention_test.py | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | tf.test.main() | conditional_block | |
views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.modules.events.management.views import WPEventManagement
from indico.modules.events.views impo... |
class WPDisplaySurveySimpleEvent(DisplaySurveyMixin, WPSimpleEventDisplayBase):
template_prefix = 'events/surveys/'
base_class = WPSimpleEventDisplayBase
bundles = ('module_events.surveys.js', 'module_events.surveys.css')
| template_prefix = 'events/surveys/'
base_class = WPConferenceDisplayBase
menu_entry_name = 'surveys'
bundles = ('module_events.surveys.js', 'module_events.surveys.css') | identifier_body |
views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.modules.events.management.views import WPEventManagement
from indico.modules.events.views impo... | (WPManageSurvey):
pass
class DisplaySurveyMixin(WPJinjaMixin):
template_prefix = 'events/surveys/'
base_class = None
def _get_body(self, params):
return WPJinjaMixin._get_page_content(self, params)
class WPDisplaySurveyConference(DisplaySurveyMixin, WPConferenceDisplayBase):
template_pr... | WPSurveyResults | identifier_name |
views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.modules.events.management.views import WPEventManagement
from indico.modules.events.views impo... | base_class = WPSimpleEventDisplayBase
bundles = ('module_events.surveys.js', 'module_events.surveys.css') |
class WPDisplaySurveySimpleEvent(DisplaySurveyMixin, WPSimpleEventDisplayBase):
template_prefix = 'events/surveys/' | random_line_split |
mod.rs | // Copyright 2019 The Exonum Team
//
// 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 i... | <T: Access> {
pub counter: ProofEntry<T::Base, u64>,
}
impl<T: Access> CounterSchema<T> {
fn new(access: T) -> Self {
Self::from_root(access).unwrap()
}
}
impl<T> CounterSchema<T>
where
T: Access,
T::Base: RawAccessMut,
{
fn inc_counter(&mut self, inc: u64) -> u64 {
let count =... | CounterSchema | identifier_name |
mod.rs | // Copyright 2019 The Exonum Team
//
// 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 i... | fn before_transactions(&self, context: ExecutionContext<'_>) -> Result<(), ExecutionError> {
let mut schema = CounterSchema::new(context.service_data());
if schema.counter.get() == Some(13) {
schema.counter.set(0);
Err(Error::BadLuck.into())
} else {
Ok(()... | }
impl Service for CounterService { | random_line_split |
mod.rs | // Copyright 2019 The Exonum Team
//
// 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 i... |
}
fn after_transactions(&self, context: ExecutionContext<'_>) -> Result<(), ExecutionError> {
let schema = CounterSchema::new(context.service_data());
if schema.counter.get() == Some(42) {
Err(Error::AnswerToTheUltimateQuestion.into())
} else {
Ok(())
}
... | {
Ok(())
} | conditional_block |
google.py | # coding: utf-8
# pylint: disable=missing-docstring, invalid-name
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/google/')
def signin_google():
auth.save_request_params()
google_url = ... | email=google_user.email(),
verified=True,
admin=users.is_current_user_admin(),
) |
return auth.create_or_get_user_db(
auth_id=auth_id,
name=util.create_name_from_email(google_user.email()),
username=google_user.email(), | random_line_split |
google.py | # coding: utf-8
# pylint: disable=missing-docstring, invalid-name
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/google/')
def signin_google():
auth.save_request_params()
google_url = ... |
def retrieve_user_from_google(google_user):
auth_id = 'federated_%s' % google_user.user_id()
user_db = model.User.get_by('auth_ids', auth_id)
if user_db:
if not user_db.admin and users.is_current_user_admin():
user_db.admin = True
user_db.put()
return user_db
... | google_user = users.get_current_user()
if google_user is None:
flask.flash('You denied the request to sign in.')
return flask.redirect(flask.url_for('index'))
user_db = retrieve_user_from_google(google_user)
return auth.signin_via_social(user_db) | identifier_body |
google.py | # coding: utf-8
# pylint: disable=missing-docstring, invalid-name
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/google/')
def signin_google():
auth.save_request_params()
google_url = ... |
user_db = retrieve_user_from_google(google_user)
return auth.signin_via_social(user_db)
def retrieve_user_from_google(google_user):
auth_id = 'federated_%s' % google_user.user_id()
user_db = model.User.get_by('auth_ids', auth_id)
if user_db:
if not user_db.admin and users.is_current_user... | flask.flash('You denied the request to sign in.')
return flask.redirect(flask.url_for('index')) | conditional_block |
google.py | # coding: utf-8
# pylint: disable=missing-docstring, invalid-name
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/google/')
def signin_google():
auth.save_request_params()
google_url = ... | ():
google_user = users.get_current_user()
if google_user is None:
flask.flash('You denied the request to sign in.')
return flask.redirect(flask.url_for('index'))
user_db = retrieve_user_from_google(google_user)
return auth.signin_via_social(user_db)
def retrieve_user_from_google(goog... | google_authorized | identifier_name |
qa_alsa.py | #!/usr/bin/env python
#
# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your opt... | (self):
"""Just see if we can import the module...
They may not have ALSA drivers, etc. Don't try to run anything"""
pass
if __name__ == '__main__':
gr_unittest.main ()
| test_000_nop | identifier_name |
qa_alsa.py | #!/usr/bin/env python
#
# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your opt... |
if __name__ == '__main__':
gr_unittest.main ()
| def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_000_nop (self):
"""Just see if we can import the module...
They may not have ALSA drivers, etc. Don't try to run anything"""
pass | identifier_body |
qa_alsa.py | #!/usr/bin/env python
#
# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your opt... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 021... | # any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of | random_line_split |
qa_alsa.py | #!/usr/bin/env python
#
# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your opt... | gr_unittest.main () | conditional_block | |
column-height.pipe.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... | @Pipe({
name: 'columnHeight',
})
export class ColumnHeightPipe implements PipeTransform {
public transform(column: TableConfigColumn, table: TableModel, cursor: TableHeaderCursor): number {
if (column.children.length) {
return TABLE_ROW_HEIGHT;
}
const rowspan =
calculateColumnRowspan(table... | export const TABLE_ROW_HEIGHT = 35;
| random_line_split |
column-height.pipe.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... |
const rowspan =
calculateColumnRowspan(table, cursor.partIndex, cursor.columnPath.slice(0, cursor.columnPath.length - 1)) || 1;
return rowspan * TABLE_ROW_HEIGHT;
}
}
| {
return TABLE_ROW_HEIGHT;
} | conditional_block |
column-height.pipe.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... | (column: TableConfigColumn, table: TableModel, cursor: TableHeaderCursor): number {
if (column.children.length) {
return TABLE_ROW_HEIGHT;
}
const rowspan =
calculateColumnRowspan(table, cursor.partIndex, cursor.columnPath.slice(0, cursor.columnPath.length - 1)) || 1;
return rowspan * TABLE... | transform | identifier_name |
column-height.pipe.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either ... |
}
| {
if (column.children.length) {
return TABLE_ROW_HEIGHT;
}
const rowspan =
calculateColumnRowspan(table, cursor.partIndex, cursor.columnPath.slice(0, cursor.columnPath.length - 1)) || 1;
return rowspan * TABLE_ROW_HEIGHT;
} | identifier_body |
DwtWizardDialog.ts | /*
* T4Z - TypeScript 4 Zimlet
* Copyright (C) 2017 ZeXtras S.r.l.
*
* This file is part of T4Z - TypeScript 4 Zimlet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2 of
* t... |
import {DwtDialog} from "./DwtDialog";
import {DwtShell} from "./DwtShell";
export class DwtWizardDialog extends DwtDialog {
public static FINISH_BUTTON: number;
public static NEXT_BUTTON: number;
public static PREV_BUTTON: number;
constructor(parent: DwtShell, className: string, title: string, w?: string, ... | * You should have received a copy of the GNU General Public License
* along with T4Z - TypeScript 4 Zimlet. If not, see <http://www.gnu.org/licenses/>.
*/ | random_line_split |
DwtWizardDialog.ts | /*
* T4Z - TypeScript 4 Zimlet
* Copyright (C) 2017 ZeXtras S.r.l.
*
* This file is part of T4Z - TypeScript 4 Zimlet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2 of
* t... | extends DwtDialog {
public static FINISH_BUTTON: number;
public static NEXT_BUTTON: number;
public static PREV_BUTTON: number;
constructor(parent: DwtShell, className: string, title: string, w?: string, h?: string) {
super({
className: className,
parent: parent,
title: title,
});
... | DwtWizardDialog | identifier_name |
DwtWizardDialog.ts | /*
* T4Z - TypeScript 4 Zimlet
* Copyright (C) 2017 ZeXtras S.r.l.
*
* This file is part of T4Z - TypeScript 4 Zimlet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2 of
* t... |
}
| {
super({
className: className,
parent: parent,
title: title,
});
} | identifier_body |
support.rs | #![allow(dead_code)]
extern crate file_lock;
use std::env;
use std::borrow::Borrow;
use std::path::{PathBuf, Path};
use std::os::unix::io::{RawFd, AsRawFd};
use std::fs::{File, OpenOptions, remove_file};
use file_lock::fd::Mode;
/// A utility type to assure the removal of a file.
///
/// It is useful when a temporar... | <P: Borrow<PathBuf>> {
inner: File,
remover: Remover<P>
}
impl<P> TempFile<P> where P: Borrow<PathBuf> {
pub fn fd(&self) -> RawFd {
self.inner.as_raw_fd()
}
pub fn path(&self) -> &Path {
self.remover.path.borrow()
}
pub fn path_buf(&self) -> PathBuf {
self.remove... | TempFile | identifier_name |
support.rs | #![allow(dead_code)]
extern crate file_lock;
use std::env;
use std::borrow::Borrow;
use std::path::{PathBuf, Path};
use std::os::unix::io::{RawFd, AsRawFd};
use std::fs::{File, OpenOptions, remove_file};
use file_lock::fd::Mode;
/// A utility type to assure the removal of a file.
/// | /// It is useful when a temporary lock file is created. When an instance dropped
/// of this type is dropped, the lock file will be removed. It is not an error
/// if the file doesn't exist anymore.
///
pub struct Remover<P: Borrow<PathBuf>> {
pub path: P,
}
impl<P> Drop for Remover<P>
where P: Borrow<PathBuf> ... | random_line_split | |
support.rs | #![allow(dead_code)]
extern crate file_lock;
use std::env;
use std::borrow::Borrow;
use std::path::{PathBuf, Path};
use std::os::unix::io::{RawFd, AsRawFd};
use std::fs::{File, OpenOptions, remove_file};
use file_lock::fd::Mode;
/// A utility type to assure the removal of a file.
///
/// It is useful when a temporar... |
}
impl TempFile<PathBuf> {
pub fn new(name: &str, mode: Mode) -> TempFile<PathBuf> {
let mut path = env::temp_dir();
path.push(name);
TempFile {
inner: OpenOptions::new()
.create(true)
.read(mode == Mode::Read)
... | {
&mut self.inner
} | identifier_body |
lib.rs | //! # Teleborg
//!
//! Teleborg is a fast, reliable and easy to use wrapper for the [Telegram bot
//! API](https://core.telegram.org/bots/api).
//! This crate aims to provide everything the user needs to create a high
//! performant Telegram bot.
//!
//! ## Getting started
//!
//! ``` no_run
//! extern crate teleborg;
... | (&mut self, bot: &Bot, update: objects::Update, args: Option<Vec<&str>>) {
self(bot, update, args);
}
}
/// Construct an API URL with the base bot URL and an
/// array of strings which will construct the path.
fn construct_api_url(bot_url: &str, path: &[&str]) -> String {
format!("{}/{}", bot_url, path... | execute | identifier_name |
lib.rs | //! # Teleborg
//!
//! Teleborg is a fast, reliable and easy to use wrapper for the [Telegram bot
//! API](https://core.telegram.org/bots/api).
//! This crate aims to provide everything the user needs to create a high
//! performant Telegram bot.
//!
//! ## Getting started
//!
//! ``` no_run
//! extern crate teleborg;
... | mod dispatcher;
mod marker;
mod updater;
/// Pass this to a method which requires markup where you do not want markup.
pub const NO_MARKUP: Option<objects::NullMarkup> = None;
impl<T: Sync + Send + 'static + FnMut(&Bot, objects::Update, Option<Vec<&str>>)> Command for T {
fn execute(&mut self, bot: &Bot, update: ... | mod bot;
mod command; | random_line_split |
lib.rs | //! # Teleborg
//!
//! Teleborg is a fast, reliable and easy to use wrapper for the [Telegram bot
//! API](https://core.telegram.org/bots/api).
//! This crate aims to provide everything the user needs to create a high
//! performant Telegram bot.
//!
//! ## Getting started
//!
//! ``` no_run
//! extern crate teleborg;
... |
}
/// Construct an API URL with the base bot URL and an
/// array of strings which will construct the path.
fn construct_api_url(bot_url: &str, path: &[&str]) -> String {
format!("{}/{}", bot_url, path.join("/"))
}
| {
self(bot, update, args);
} | identifier_body |
coherence-overlap-all-t-and-tuple.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
impl <T> From<T> for T {
}
impl <T11, U11> From<(U11,)> for (T11,) { //~ ERROR E0119
}
fn main() { }
| {} | identifier_body |
coherence-overlap-all-t-and-tuple.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {}
}
impl <T> From<T> for T {
}
impl <T11, U11> From<(U11,)> for (T11,) { //~ ERROR E0119
}
fn main() { }
| foo | identifier_name |
coherence-overlap-all-t-and-tuple.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // Check that we detect an overlap here in the case where:
//
// for some type X:
// T = (X,)
// T11 = X, U11 = X
//
// Seems pretty basic, but then there was issue #24241. :)
trait From<U> {
fn foo() {}
}
impl <T> From<T> for T {
}
impl <T11, U11> From<(U11,)> for (T11,) { //~ ERROR E0119
}
fn mai... | random_line_split | |
yo-BJ.js | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
global... | (n) {
return 5;
}
global.ng.common.locales['yo-bj'] = [
'yo-BJ',
[['Àárɔ̀', 'Ɔ̀sán'], u, u],
u,
[
['À', 'A', 'Ì', 'Ɔ', 'Ɔ', 'Ɛ', 'À'], ['Àìk', 'Aj', 'Ìsɛ́g', 'Ɔjɔ́r', 'Ɔjɔ́b', 'Ɛt', 'Àbám'],
['Ɔjɔ́ Àìkú', 'Ɔjɔ́ Ajé', 'Ɔjɔ́ Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɔjɔ́ Ɛtì', 'Ɔjɔ́ Àbámɛ́ta'],
['Àìkú', 'Ajé',... | plural | identifier_name |
yo-BJ.js | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
global... |
global.ng.common.locales['yo-bj'] = [
'yo-BJ',
[['Àárɔ̀', 'Ɔ̀sán'], u, u],
u,
[
['À', 'A', 'Ì', 'Ɔ', 'Ɔ', 'Ɛ', 'À'], ['Àìk', 'Aj', 'Ìsɛ́g', 'Ɔjɔ́r', 'Ɔjɔ́b', 'Ɛt', 'Àbám'],
['Ɔjɔ́ Àìkú', 'Ɔjɔ́ Ajé', 'Ɔjɔ́ Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɔjɔ́ Ɛtì', 'Ɔjɔ́ Àbámɛ́ta'],
['Àìkú', 'Ajé', 'Ìsɛ́gun', 'Ɔjɔ́rú... | {
return 5;
} | identifier_body |
yo-BJ.js | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
global... | const u = undefined;
function plural(n) {
return 5;
}
global.ng.common.locales['yo-bj'] = [
'yo-BJ',
[['Àárɔ̀', 'Ɔ̀sán'], u, u],
u,
[
['À', 'A', 'Ì', 'Ɔ', 'Ɔ', 'Ɛ', 'À'], ['Àìk', 'Aj', 'Ìsɛ́g', 'Ɔjɔ́r', 'Ɔjɔ́b', 'Ɛt', 'Àbám'],
['Ɔjɔ́ Àìkú', 'Ɔjɔ́ Ajé', 'Ɔjɔ́ Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɔjɔ́ Ɛtì', '... | global.ng.common = global.ng.common || {};
global.ng.common.locales = global.ng.common.locales || {}; | random_line_split |
test_mozilla_processor_2015.py | from configman import ConfigurationManager
from configman.dotdict import DotDict
from mock import Mock, patch
import ujson
from socorro.processor.mozilla_processor_2015 import (
MozillaProcessorAlgorithm2015
)
from socorro.unittest.testbase import TestCase
thread_over_255_chars = {
"frames": [
{
... | (TestCase):
@patch('socorro.processor.breakpad_transform_rules.subprocess')
def test_process_over_255_chars(self, mocked_subprocess_module):
cm = ConfigurationManager(
definition_source=(
MozillaProcessorAlgorithm2015.get_required_config(),
),
values_... | TestMozillaProcessorAlgorithm2015 | identifier_name |
test_mozilla_processor_2015.py | from configman import ConfigurationManager
from configman.dotdict import DotDict
from mock import Mock, patch
import ujson
from socorro.processor.mozilla_processor_2015 import (
MozillaProcessorAlgorithm2015
)
from socorro.unittest.testbase import TestCase
thread_over_255_chars = {
"frames": [
{
... | "CrashTime": "1336519554",
"SecondsSinceLastCrash": "86985",
"PluginHang": "1",
"ProductName": "Firefox",
"Version": "19",
"BuildID": "20121031"
})
raw_dumps = {"upload_file_minidump": "a_fake_dump.dump"}
processed_crash = ... | cm = ConfigurationManager(
definition_source=(
MozillaProcessorAlgorithm2015.get_required_config(),
),
values_source_list=[]
)
config = cm.get_config()
config.logger = Mock()
config.processor_name = 'dwight'
mocked_subprocess_h... | identifier_body |
test_mozilla_processor_2015.py | from configman import ConfigurationManager
from configman.dotdict import DotDict
from mock import Mock, patch
import ujson
from socorro.processor.mozilla_processor_2015 import (
MozillaProcessorAlgorithm2015
)
from socorro.unittest.testbase import TestCase
thread_over_255_chars = {
"frames": [
{
... |
@patch('socorro.processor.breakpad_transform_rules.subprocess')
def test_process_over_255_chars(self, mocked_subprocess_module):
cm = ConfigurationManager(
definition_source=(
MozillaProcessorAlgorithm2015.get_required_config(),
),
values_source_list=... | class TestMozillaProcessorAlgorithm2015(TestCase): | random_line_split |
serverDetail.js | 'use strict';
describe('Controller: ServerDetailCtrl', function () {
var $httpBackend, $rootScope, $resource, configuration, $controller, _, ServerDetailCtrl;
var scope;
// load the controller's module
beforeEach(module('kheoApp'));
beforeEach(inject(function($injector) {
$httpBackend = $injector.get('... | it('should give string value for a plugin property', function() {
$httpBackend.flush();
var stringValue = scope.stringValue(scope.server.serverProperties[0]);
expect(stringValue).toBe('key=logo, description=logo');
});
}); | random_line_split | |
BootState.js | var Phaser = Phaser || {};
var Mst = Mst || {};
Mst.BootState = function () {
"use strict";
Phaser.State.call(this);
};
Mst.prototype = Object.create(Phaser.State.prototype);
Mst.prototype.constructor = Mst.BootState; | Mst.BootState.prototype.init = function (map_int, usr_id) {
"use strict";
var d = new Date();
var n = d.getTime();
this.core_file = "assets/maps/core.json";
this.quest_file = "assets/maps/quest.json";
this.map_int = map_int;
this.map_file = "map.php?time="+n+"&uid="+usr_id+"&mapi="+map_int;
//... | random_line_split | |
BootState.js | var Phaser = Phaser || {};
var Mst = Mst || {};
Mst.BootState = function () {
"use strict";
Phaser.State.call(this);
};
Mst.prototype = Object.create(Phaser.State.prototype);
Mst.prototype.constructor = Mst.BootState;
Mst.BootState.prototype.init = function (map_int, usr_id) {
"use strict";
var d = new Date... |
root_data = { map_int: this.map_int, usr_id: this.usr_id };
console.log("Boot State");
console.log(root_data);
this.game.state.start("LoadingState", true, false, core_data, map_data, root_data, quest_data);
}; | {
map_text = this.game.cache.getText("map");
var n = map_text.lastIndexOf(">");
if (n > -1) {
map_text = map_text.substring(n + 1);
}
//console.log(map_text);
map_data = JSON.parse(map_text);
console.log(map_data);
core_text = this.game.cache.getText("core")... | conditional_block |
test.repo.js | 'use strict';
var test = require('tape'); //jshint ignore:line
var Github = require("../");
var test_user = require('./user.json');
test("Repo API", function(t) {
var timeout = setTimeout(function () { t.fail(); }, 100000);
var github = new Github({
username: test_user.USERNAME,
password: test_use... | t.equals(err.request.status, 422, 'Returns 422 status');
clearTimeout(timeout);
t.end();
});
}); | random_line_split | |
script.js | angular.module('dialogDemo1', ['ngMaterial'])
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.alert = '';
$scope.showAlert = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
// Modal dialogs should fully cover application
// to prevent interaction outside of... | {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
} | identifier_body | |
script.js | angular.module('dialogDemo1', ['ngMaterial'])
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.alert = '';
$scope.showAlert = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
// Modal dialogs should fully cover application
// to prevent interaction outside of... | ($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
| DialogController | identifier_name |
script.js | angular.module('dialogDemo1', ['ngMaterial'])
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.alert = '';
$scope.showAlert = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
// Modal dialogs should fully cover application
// to prevent interaction outside of... | $mdDialog.alert()
.parent(angular.element(document.body))
.clickOutsideToClose(true)
.title('This is an alert title')
.content('You can specify some description text in here.')
.ariaLabel('Alert Dialog Demo')
.ok('Got it!')
.targetEvent(ev)
);
};
$s... | random_line_split | |
websocket-transport-adapter.js | // Copyright (c) 2015 Uber Technologies, Inc.
//
// 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... | }
util.inherits(WebSocketTransportAdapter, BaseTransportAdapter);
WebSocketTransportAdapter.prototype.connect = function() {
if (this._status !== Constants.TransportStatus.CLOSED) {
return;
}
this._socket = new WebSocket(this.url);
this._bindSocketEvents();
this._changeStatus(Constants.TransportStatu... | {
options = options || {};
assert(typeof options.url === 'string', 'Invalid WebSocketTransportAdapter url');
BaseTransportAdapter.call(this, options);
this.name = 'WebSocketTransport';
this.url = options.url;
this._explicitlyClosed = false;
this._nonAckedMessages = [];
this._session = null;
this._... | identifier_body |
websocket-transport-adapter.js | // Copyright (c) 2015 Uber Technologies, Inc.
//
// 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... | this._session = null;
this._socket.close();
this._socket = null;
};
WebSocketTransportAdapter.prototype.reconnect = function() {
if (this._status !== Constants.TransportStatus.CONNECTED) {
return;
}
this.disconnect();
};
WebSocketTransportAdapter.prototype.sendMessage = function(message) {
try {
... |
this._explicitlyClosed = true; | random_line_split |
websocket-transport-adapter.js | // Copyright (c) 2015 Uber Technologies, Inc.
//
// 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... |
this._socket = new WebSocket(this.url);
this._bindSocketEvents();
this._changeStatus(Constants.TransportStatus.CONNECTING);
};
WebSocketTransportAdapter.prototype.disconnect = function() {
if (this._status === Constants.TransportStatus.CLOSED) {
return;
}
this._stopPing();
this._explicitlyClosed... | {
return;
} | conditional_block |
websocket-transport-adapter.js | // Copyright (c) 2015 Uber Technologies, Inc.
//
// 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... | (options) {
options = options || {};
assert(typeof options.url === 'string', 'Invalid WebSocketTransportAdapter url');
BaseTransportAdapter.call(this, options);
this.name = 'WebSocketTransport';
this.url = options.url;
this._explicitlyClosed = false;
this._nonAckedMessages = [];
this._session = null... | WebSocketTransportAdapter | identifier_name |
prod.py | import os
from .base import * # NOQA
import dj_database_url
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
DATABASES = {'default': dj_database_url.config()}
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.R... | },
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'django.utils.log.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'mail_admins': {
... | random_line_split | |
app.module.ts | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | import {AuthGuard} from './shared/auth-guard';
import {AuthenticationService} from './service/authentication.service';
import {LoginGuard} from './shared/login-guard';
import {UpdateService} from './service/update.service';
import {MetaAlertService} from './service/meta-alert.service';
import { MetaAlertsModule } from ... | import {ConfigureRowsModule} from './alerts/configure-rows/configure-rows.module';
import {ColumnNamesService} from './service/column-names.service';
import {DataSource} from './service/data-source';
import {ElasticSearchLocalstorageImpl} from './service/elasticsearch-localstorage-impl';
import {LoginModule} from './lo... | random_line_split |
app.module.ts | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
const icons: IconDefinition[] = [ ToolOutline, WarningOutline, FileOutline ];
@NgModule({
declarations: [
AppComponent,
MetronDialogComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
MetronAlertsRoutingModule,
LoginModule,
AlertsListModule,
AlertDetailsMod... | {
return () => appConfigService.loadAppConfig();
} | identifier_body |
app.module.ts | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | (appConfigService: AppConfigService) {
return () => appConfigService.loadAppConfig();
}
const icons: IconDefinition[] = [ ToolOutline, WarningOutline, FileOutline ];
@NgModule({
declarations: [
AppComponent,
MetronDialogComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
... | initConfig | identifier_name |
utils.js | /*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program 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... | (domain, action) {
return domain + '/' + action;
}
export const isDomainPathActive = (path, splat) => {
const pathTokens = path.split('/');
const splatTokens = splat.split('/');
if (pathTokens.length > splatTokens.length) {
return false;
}
for (let i = 0; i < pathTokens.length; i++) {
if (pathTo... | getActionKey | identifier_name |
utils.js | /*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program 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... |
}
return true;
};
| {
return false;
} | conditional_block |
utils.js | * SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program 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, o... | /* | random_line_split | |
utils.js | /*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program 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... |
export const isDomainPathActive = (path, splat) => {
const pathTokens = path.split('/');
const splatTokens = splat.split('/');
if (pathTokens.length > splatTokens.length) {
return false;
}
for (let i = 0; i < pathTokens.length; i++) {
if (pathTokens[i] !== splatTokens[i]) {
return false;
... | {
return domain + '/' + action;
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.