file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
graph-edge-popover.js | /*
Copyright 2012 Twitter, Inc.
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
distr... |
if (sourceData) {
var hdfsBytesWritten = JobData.getHdfsBytesWritten(sourceData);
if (hdfsBytesWritten != null) addItem('HDFS Bytes Written', hdfsBytesWritten.commafy());
var reduceOutputRecords = JobData.getReduceOutputRecords(sourceData);
if (reduceOutputRecords != nu... | {
$('<dt>').appendTo(list).text(name);
$('<dd>').appendTo(list).text(value);
itemCount++;
} | identifier_body |
graph-edge-popover.js | /*
Copyright 2012 Twitter, Inc.
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
distr... | (edgeObj) {
// Create the popover body section based on the node.
var edge = edgeObj.__data__;
var sourceData = edge.source.pseudo ? edge.source.source.data : edge.source.data;
var targetData = edge.target.pseudo ? edge.target.target.data : edge.target.data;
var defaultContent = ... | getContent | identifier_name |
users.test.ts | import { bpConfig } from '../assets/config'
import { clickOn, expectMatch, fillField } from '../utils/expectPuppeteer'
import { closeToaster, CONFIRM_DIALOG, expectAdminApiCallSuccess, gotoAndExpect, clickButtonForUser } from '../utils'
describe('Admin - Users', () => {
const testUserEmail = 'someguy@me.com'
befo... | await clickOn('#div-role-admin')
await clickButtonForUser('#btn-deleteUser', testUserEmail)
await clickOn(CONFIRM_DIALOG.ACCEPT)
await expectAdminApiCallSuccess(`workspace/collaborators/default/${testUserEmail}/delete`, 'POST')
})
}) | await clickOn('#btn-role-admin')
await expectAdminApiCallSuccess('workspace/collaborators/workspace/update_role', 'POST')
})
it('Delete created user', async () => { | random_line_split |
date_pipe.ts | import {
isDate,
isNumber,
isPresent,
Date,
DateWrapper,
CONST,
isBlank,
FunctionWrapper
} from 'angular2/src/core/facade/lang';
import {DateFormatter} from 'angular2/src/core/facade/intl';
import {Injectable} from 'angular2/src/core/di';
import {Pipe} from 'angular2/src/core/metadata';
import {PipeTran... |
supports(obj: any): boolean { return isDate(obj) || isNumber(obj); }
}
| {
if (isBlank(value)) return null;
if (!this.supports(value)) {
throw new InvalidPipeArgumentException(DatePipe, value);
}
var pattern: string = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate';
if (isNumber(value)) {
value = DateWrapper.fromMillis(value);
}
if (Stri... | identifier_body |
date_pipe.ts | import {
isDate,
isNumber,
isPresent,
Date,
DateWrapper,
CONST,
isBlank,
FunctionWrapper
} from 'angular2/src/core/facade/lang';
import {DateFormatter} from 'angular2/src/core/facade/intl';
import {Injectable} from 'angular2/src/core/di';
import {Pipe} from 'angular2/src/core/metadata';
import {PipeTran... |
transform(value: any, args: any[]): string {
if (isBlank(value)) return null;
if (!this.supports(value)) {
throw new InvalidPipeArgumentException(DatePipe, value);
}
var pattern: string = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate';
if (isNumber(value)) {
value = Dat... | };
| random_line_split |
date_pipe.ts | import {
isDate,
isNumber,
isPresent,
Date,
DateWrapper,
CONST,
isBlank,
FunctionWrapper
} from 'angular2/src/core/facade/lang';
import {DateFormatter} from 'angular2/src/core/facade/intl';
import {Injectable} from 'angular2/src/core/di';
import {Pipe} from 'angular2/src/core/metadata';
import {PipeTran... | (value: any, args: any[]): string {
if (isBlank(value)) return null;
if (!this.supports(value)) {
throw new InvalidPipeArgumentException(DatePipe, value);
}
var pattern: string = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate';
if (isNumber(value)) {
value = DateWrapper.fro... | transform | identifier_name |
react-router-dom_v4.x.x.js | // flow-typed signature: cf916fca23433d4bbcb7a75f2604407d
// flow-typed version: f821d89401/react-router-dom_v4.x.x/flow_>=v0.53.x
declare module "react-router-dom" {
declare export class BrowserRouter extends React$Component<{
basename?: string,
forceRefresh?: boolean,
getUserConfirmation?: GetUserConfi... | options?: MatchPathOptions | string
): null | Match;
} | pathname: string, | random_line_split |
webdriver_msg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(missing_docs)]
use cookie::Cookie;
use euclid::default::Rect;
use hyper_serde::Serde;
use ipc_channel::... | pub enum WebDriverScriptCommand {
AddCookie(
#[serde(
deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize"
)]
Cookie<'static>,
IpcSender<Result<(), WebDriverCookieError>>,
),
DeleteCookies(IpcSender<Result<(), Er... | use webdriver::common::{WebElement, WebFrame, WebWindow};
use webdriver::error::ErrorStatus;
#[derive(Debug, Deserialize, Serialize)] | random_line_split |
webdriver_msg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![allow(missing_docs)]
use cookie::Cookie;
use euclid::default::Rect;
use hyper_serde::Serde;
use ipc_channel::... | {
Short(u16),
Element(String),
Parent,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum LoadStatus {
LoadComplete,
LoadTimeout,
}
| WebDriverFrameId | identifier_name |
safebooru.spec.ts | import Booru, { BooruClass, search, sites } from '../src/index';
import Post from '../src/structures/Post';
import SearchResults from '../src/structures/SearchResults';
let tag1: string;
let site: string;
beforeEach(() => {
site = 'sb';
tag1 = 'glaceon';
});
describe('Using instantiation method', () ... | const searchResult: SearchResults = await danbooru.search([tag1]);
const image: Post = searchResult[0];
expect(searchResult.booru.domain).toBe('safebooru.org');
expect(searchResult.booru.site).toMatchObject(sites[searchResult.booru.domain]);
expect(typeof image.fileUrl).toBe('string');
});
}... | danbooru = Booru(site);
});
it('should return an image', async () => {
| random_line_split |
clickable_cell_renderer.rs | /*
* niepce - npc-fwk/toolkit/clickable_cell_renderer.rs | *
* Copyright (C) 2020 Hubert Figuière
*
* 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 di... | random_line_split | |
borrowck-forbid-static-unsafe-interior.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <T> {
VariantSafe,
VariantUnsafe(Unsafe<T>)
}
static STATIC1: UnsafeEnum<int> = VariantSafe;
static STATIC2: Unsafe<int> = Unsafe{value: 1, marker1: marker::InvariantType};
static STATIC3: MyUnsafe<int> = MyUnsafe{value: STATIC2};
static STATIC4: &'static Unsafe<int> = &STATIC2;
//~^ ERROR borrow of immutabl... | UnsafeEnum | identifier_name |
borrowck-forbid-static-unsafe-interior.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn main() {
let a = &STATIC1;
//~^ ERROR borrow of immutable static items with unsafe interior is not allowed
STATIC3.forbidden()
//~^ ERROR borrow of immutable static items with unsafe interior is not allowed
} | static UNSAFE: Unsafe<int> = Unsafe{value: 1, marker1: marker::InvariantType};
static WRAPPED_UNSAFE: Wrap<&'static Unsafe<int>> = Wrap { value: &UNSAFE };
//~^ ERROR borrow of immutable static items with unsafe interior is not allowed | random_line_split |
Header.tsx | import * as React from 'react';
import { Animated, Platform, StyleSheet, View, ViewStyle } from 'react-native';
import {
useSafeAreaFrame,
useSafeAreaInsets,
} from 'react-native-safe-area-context';
import type { HeaderOptions, Layout } from '../types';
import getDefaultHeaderHeight from './getDefaultHeaderHeight'... | else if (value !== undefined) {
console.warn(
`${styleProp} was given a value of ${value}, this has no effect on headerStyle.`
);
}
});
};
export default function Header(props: Props) {
const insets = useSafeAreaInsets();
const frame = useSafeAreaFrame();
const isParentHeaderShown = R... | {
console.warn(
"position: 'absolute' is not supported on headerStyle. If you would like to render content under the header, use the 'headerTransparent' option."
);
} | conditional_block |
Header.tsx | import * as React from 'react';
import { Animated, Platform, StyleSheet, View, ViewStyle } from 'react-native';
import {
useSafeAreaFrame,
useSafeAreaInsets,
} from 'react-native-safe-area-context';
import type { HeaderOptions, Layout } from '../types';
import getDefaultHeaderHeight from './getDefaultHeaderHeight'... | }
const styles = StyleSheet.create({
content: {
flex: 1,
flexDirection: 'row',
alignItems: 'stretch',
},
title: {
marginHorizontal: 16,
justifyContent: 'center',
},
left: {
justifyContent: 'center',
alignItems: 'flex-start',
},
right: {
justifyContent: 'center',
alignI... | </React.Fragment>
); | random_line_split |
Storage.ts | import { Database, Statement } from 'sqlite3';
import { getSqlLocal, getSqlUtc } from '../helpers/DateHelper';
/** Describes the two potential date source from DB */
export type DateSource = 'date_utc' | 'date_local';
/** Defines the row function type */
export type RowFunction = (err: any, row: any) => void;
export... | /** Saves a dataitem into DB */
save(dataItem: any): void {
this._db.serialize(() => {
this.migrate();
this._stmt = this._db.prepare('INSERT INTO history VALUES (?, ?, ?, ?, ?, ?)');
dataItem.data.forEach(d => {
this._stmt.run(getSqlUtc(dataItem.time), getSqlLocal(dataItem.time), d.data, dataItem.name,... | register TEXT,
unit TEXT)`);
}
| random_line_split |
Storage.ts | import { Database, Statement } from 'sqlite3';
import { getSqlLocal, getSqlUtc } from '../helpers/DateHelper';
/** Describes the two potential date source from DB */
export type DateSource = 'date_utc' | 'date_local';
/** Defines the row function type */
export type RowFunction = (err: any, row: any) => void;
export... |
/** Just assure that the DB exists */
migrate(): void {
this._db.run(`CREATE TABLE IF NOT EXISTS history (
date_utc INTEGER,
date_local INTEGER,
value REAL,
controller TEXT,
register TEXT,
unit TEXT)`);
}
/** Saves a dataitem into DB */
save(dataItem: any): void {
this._d... | {
this._dateSource = dateSource;
const dbName = inMemory ? ':memory:' : 'localdb.sqlite';
this._db = new Database(dbName);
} | identifier_body |
Storage.ts | import { Database, Statement } from 'sqlite3';
import { getSqlLocal, getSqlUtc } from '../helpers/DateHelper';
/** Describes the two potential date source from DB */
export type DateSource = 'date_utc' | 'date_local';
/** Defines the row function type */
export type RowFunction = (err: any, row: any) => void;
export... | (keepDays: number): void {
this._db.serialize(() => {
const src = this._dateSource;
const triggerDate = new Date()
triggerDate.setDate(triggerDate.getDate() - keepDays);
const triggerStrDate = getSqlLocal(triggerDate).slice(0, 10);
this._db.run(`
DELETE FROM history
WHERE date(${src}) < date('$... | cleanOldData | identifier_name |
main.js | // Restrict output in a codecell to a maximum length
define([
'base/js/namespace',
'jquery',
'notebook/js/outputarea',
'base/js/dialog',
'notebook/js/codecell',
'services/config',
'base/js/utils'
], function(IPython, $, oa, dialog, cc, configmod, utils) {
"use strict";
var base_url... |
config.loaded.then(function() {
var MAX_CHARACTERS = params.limit_output;
update_params();
if (isNumber(params.limit_output)) MAX_CHARACTERS = params.limit_output;
oa.OutputArea.prototype._handle_output = oa.OutputArea.prototype.handle_output;
oa.OutputArea.prototype.handl... | {
var count = 0,
currentCount = 0,
lastWasCR = false;
// Libraries like TQDM don't nessessarily send messages on clean
// boundaries (i.e. line breaks). This makes counting stateful!
var printCounter = function(str) {
for(var i=0; i<str.length; i+=1){... | identifier_body |
main.js | // Restrict output in a codecell to a maximum length
define([
'base/js/namespace',
'jquery',
'notebook/js/outputarea',
'base/js/dialog',
'notebook/js/codecell',
'services/config',
'base/js/utils'
], function(IPython, $, oa, dialog, cc, configmod, utils) {
"use strict";
var base_url... | () {
var count = 0,
currentCount = 0,
lastWasCR = false;
// Libraries like TQDM don't nessessarily send messages on clean
// boundaries (i.e. line breaks). This makes counting stateful!
var printCounter = function(str) {
for(var i=0; i<str.length; i+=... | makePrintCounter | identifier_name |
main.js | // Restrict output in a codecell to a maximum length
define([
'base/js/namespace',
'jquery',
'notebook/js/outputarea',
'base/js/dialog',
'notebook/js/codecell',
'services/config',
'base/js/utils'
], function(IPython, $, oa, dialog, cc, configmod, utils) {
"use strict";
var base_url... | else {
currentCount += 1;
}
lastWasCR = false;
}
}
return count + currentCount;
};
return printCounter;
}
config.loaded.then(function() {
var MAX_CHARACTERS = params.lim... | {
currentCount = 1;
} | conditional_block |
main.js | // Restrict output in a codecell to a maximum length
define([
'base/js/namespace',
'jquery',
'notebook/js/outputarea',
'base/js/dialog',
'notebook/js/codecell',
'services/config',
'base/js/utils'
], function(IPython, $, oa, dialog, cc, configmod, utils) {
"use strict";
var base_url... | };
var extension = {
load_ipython_extension : load_ipython_extension
};
return extension;
}); | random_line_split | |
treegen.py | ### Use pydoc.render_doc(<mod>) to output contents of generated help to a string
###
import sys
import os
import glob
from os.path import join, getsize
import re
import json
def is_pkg(path_parts, files):
return "__init__.py" in files
def count_class_refs(class_name, all_files):
"""
Patterns:
=\s+<cl... |
def make_pkg_tree(coderoot):
if os.path.exists(coderoot):
# Add to the system path so we can import modules
sys.path.append(coderoot)
treename = os.path.basename(coderoot)
pkg_tree = {}
all_files = []
for root, dirs, files in os.wa... | }
treemap_data.append(node)
return treemap_data
| random_line_split |
treegen.py | ### Use pydoc.render_doc(<mod>) to output contents of generated help to a string
###
import sys
import os
import glob
from os.path import join, getsize
import re
import json
def is_pkg(path_parts, files):
return "__init__.py" in files
def count_class_refs(class_name, all_files):
"""
Patterns:
=\s+<cl... |
return curr_node
def add_mod_classes(coderoot, modules):
coderoot_base = os.path.basename(coderoot)
for m in modules:
if coderoot_base == m['pkg']:
full_pkg_path = m['mod']
else:
full_pkg_path = "%s.%s" % (m['pkg'], m['mod'])
mod_file_path = full_pkg_path.re... | if p not in curr_node:
curr_node[p] = {}
curr_node = curr_node[p] | conditional_block |
treegen.py | ### Use pydoc.render_doc(<mod>) to output contents of generated help to a string
###
import sys
import os
import glob
from os.path import join, getsize
import re
import json
def is_pkg(path_parts, files):
return "__init__.py" in files
def count_class_refs(class_name, all_files):
|
def add_to_tree(pkg_tree, pkg_node_path):
curr_node = pkg_tree
for p in pkg_node_path:
if p not in curr_node:
curr_node[p] = {}
curr_node = curr_node[p]
return curr_node
def add_mod_classes(coderoot, modules):
coderoot_base = os.path.basename(coderoot)
for m in module... | """
Patterns:
=\s+<class_name>\s*\(
<class_name>\.
"""
refs = 0
pats = [
'=\s+%s\s*\(' % class_name,
'\s+%s\.' % class_name
]
# print "Searching for refs to class [%s]..." % class_name
for fpath in all_files:
with open(fpath, "r") as f:
for line in... | identifier_body |
treegen.py | ### Use pydoc.render_doc(<mod>) to output contents of generated help to a string
###
import sys
import os
import glob
from os.path import join, getsize
import re
import json
def | (path_parts, files):
return "__init__.py" in files
def count_class_refs(class_name, all_files):
"""
Patterns:
=\s+<class_name>\s*\(
<class_name>\.
"""
refs = 0
pats = [
'=\s+%s\s*\(' % class_name,
'\s+%s\.' % class_name
]
# print "Searching for refs to class [%s]... | is_pkg | identifier_name |
number_pipe.d.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { PipeTransform } from '@angular/core';
/**
* Formats a number as text. Group sizing and separator and other ... | implements PipeTransform {
private _locale;
constructor(_locale: string);
transform(value: any, currencyCode?: string, symbolDisplay?: boolean, digits?: string): string | null;
}
| DeprecatedCurrencyPipe | identifier_name |
number_pipe.d.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { PipeTransform } from '@angular/core';
/**
* Formats a number as text. Group sizing and separator and other ... | *
* - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
* as `USD` for the US dollar and `EUR` for the euro.
* - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
* - `true`: use symbol (e.g. `$`).
* - `false`(default): use code (... | random_line_split | |
table_size.js | function loadText()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Rij Invoegen";
txtLang[1].innerHTML = "Kolom Invoegen";
txtLang[2].innerHTML = "Rij Samenvoegen";
txtLang[3].innerHTML = "Kolom Samenvoegen";
txtLang[4].innerHTML = "Rij Verwijderen";
txtL... | {
document.write("<title>Grootte</title>")
} | identifier_body | |
table_size.js | function | ()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Rij Invoegen";
txtLang[1].innerHTML = "Kolom Invoegen";
txtLang[2].innerHTML = "Rij Samenvoegen";
txtLang[3].innerHTML = "Kolom Samenvoegen";
txtLang[4].innerHTML = "Rij Verwijderen";
txtLang[5].innerHTML ... | loadText | identifier_name |
table_size.js | function loadText()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Rij Invoegen";
txtLang[1].innerHTML = "Kolom Invoegen";
txtLang[2].innerHTML = "Rij Samenvoegen";
txtLang[3].innerHTML = "Kolom Samenvoegen";
txtLang[4].innerHTML = "Rij Verwijderen";
txtL... | return "Cannot delete row. The row contains spanned cells from another rows. Please remove the span first.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Grootte</title>")
} | case "Cannot delete row.": | random_line_split |
gopherlib.py | """Gopher protocol client interface."""
__all__ = ["send_selector","send_query"]
# Default selector, host and port
DEF_SELECTOR = '1/'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
# Recognized file types
A_TEXT = '0'
A_MENU = '1'
A_CSO = '2'
A_ERROR = '3'
A_MACBINHEX = '4'
A_PCBIN... | (selector, host, port = 0):
"""Send a selector to a given host and port, return a file with the reply."""
import socket
if not port:
i = host.find(':')
if i >= 0:
host, port = host[:i], int(host[i+1:])
if not port:
port = DEF_PORT
elif type(port) == type(''):
... | send_selector | identifier_name |
gopherlib.py | """Gopher protocol client interface."""
__all__ = ["send_selector","send_query"]
# Default selector, host and port
DEF_SELECTOR = '1/'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
# Recognized file types
A_TEXT = '0'
A_MENU = '1'
A_CSO = '2'
A_ERROR = '3'
A_MACBINHEX = '4'
A_PCBIN... |
else:
parts.append('')
parts.insert(0, gtype)
list.append(parts)
return list
def get_textfile(f):
"""Get a text file as a list of lines, with trailing CRLF stripped."""
list = []
get_alt_textfile(f, list.append)
return list
def get_alt_textfile(f, func):
""... | print '(Extra info from server:',
print parts[4:], ')' | conditional_block |
gopherlib.py | """Gopher protocol client interface."""
__all__ = ["send_selector","send_query"]
# Default selector, host and port
DEF_SELECTOR = '1/'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
# Recognized file types
A_TEXT = '0'
A_MENU = '1'
A_CSO = '2'
A_ERROR = '3'
A_MACBINHEX = '4'
A_PCBIN... |
def get_alt_textfile(f, func):
"""Get a text file and pass each line to a function, with trailing CRLF stripped."""
while 1:
line = f.readline()
if not line:
print '(Unexpected EOF from server)'
break
if line[-2:] == CRLF:
line = line[:-2]
el... | """Get a text file as a list of lines, with trailing CRLF stripped."""
list = []
get_alt_textfile(f, list.append)
return list | identifier_body |
gopherlib.py | """Gopher protocol client interface."""
__all__ = ["send_selector","send_query"]
# Default selector, host and port
DEF_SELECTOR = '1/'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
# Recognized file types
A_TEXT = '0'
A_MENU = '1'
A_CSO = '2'
A_ERROR = '3'
A_MACBINHEX = '4'
A_PCBIN... | A_SOUND = 's'
A_EVENT = 'e'
A_CALENDAR = 'c'
A_HTML = 'h'
A_TN3270 = 'T'
A_MIME = 'M'
A_IMAGE = 'I'
A_WHOIS = 'w'
A_QUERY = 'q'
A_GIF = 'g'
A_HTML = 'h' # HTML file
A_WWW = 'w' # WWW address
A_PLUS_IMAGE = ':'
A_PLUS_MOVIE = ';'
A_PLUS_SOU... | A_DUPLICATE = '+' | random_line_split |
script.js | $(document).ready(function() {
$("#logInBtn").click(function(){
$("#chatSection").slideToggle("slow",function() {
});
});
});
var doTimeout = true;
var lastid = 0;
window.addEventListener("load", function() {
/*
var btn = document.getElementById("startBtn");
btn.addEventListener("click", function() {
doTimeo... | () {
var val = document.getElementById("messageInput").value;
// Check val is ok before doing AJAX
var xhr = null;
if(window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
if(xhr) {
xhr.onreadystatechange = function() {
... | sendMsgs | identifier_name |
script.js | $(document).ready(function() {
$("#logInBtn").click(function(){
$("#chatSection").slideToggle("slow",function() {
});
});
});
var doTimeout = true;
var lastid = 0;
window.addEventListener("load", function() {
/*
var btn = document.getElementById("startBtn");
btn.addEventListener("click", function() {
doTimeo... |
tbl.innerHTML += "<tr><td>" + msgs[i].childNodes[1].firstChild.nodeValue + "</td></tr>";
}
if(doTimeout) {
setTimeout(getChat, 1000);
}
}
}
};
xhr.open("GET", "http://itsuite.it.brighton.ac.uk/john10/ci227/a1/channel.php?username=guest&lastid=" + lastid, true);
xhr.send(nu... | {
lastid = id;
} | conditional_block |
script.js | $(document).ready(function() {
$("#logInBtn").click(function(){
$("#chatSection").slideToggle("slow",function() {
});
});
});
var doTimeout = true;
var lastid = 0;
window.addEventListener("load", function() {
/*
var btn = document.getElementById("startBtn");
btn.addEventListener("click", function() {
doTimeo... |
function sendMsgs() {
var val = document.getElementById("messageInput").value;
// Check val is ok before doing AJAX
var xhr = null;
if(window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
if(xhr) {
xhr.onreadystatecha... | {
var xhr = null;
if(window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
if(xhr) {
xhr.onreadystatechange = function() {
if(xhr.readyState === 4) {
if(xhr.status === 200) {
var value = xhr.responseXML;
var m... | identifier_body |
script.js | $(document).ready(function() {
$("#logInBtn").click(function(){
$("#chatSection").slideToggle("slow",function() {
});
});
});
var doTimeout = true;
var lastid = 0;
window.addEventListener("load", function() {
/*
var btn = document.getElementById("startBtn");
btn.addEventListener("click", function() {
doTimeo... | } else {
console.error("Can't continue");
}
}
function sendMsgs() {
var val = document.getElementById("messageInput").value;
// Check val is ok before doing AJAX
var xhr = null;
if(window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.XMLHttpRequest) {
xhr = new XMLH... | xhr.send(null); | random_line_split |
lib.rs | use std::collections::{HashMap, HashSet};
use elasticlunr::{Index, Language};
use lazy_static::lazy_static;
use config::Config;
use errors::{bail, Result};
use library::{Library, Section};
pub const ELASTICLUNR_JS: &str = include_str!("elasticlunr.min.js");
lazy_static! {
static ref AMMONIA: ammonia::Builder<'s... | }
}
#[cfg(test)]
mod tests {
use super::*;
use config::Config;
#[test]
fn can_build_fields() {
let mut config = Config::default();
let fields = build_fields(&config);
assert_eq!(fields, vec!["title", "body"]);
config.search.include_content = false;
config.... | &fill_index(config, &page.meta.title, &page.meta.description, &page.content),
); | random_line_split |
lib.rs | use std::collections::{HashMap, HashSet};
use elasticlunr::{Index, Language};
use lazy_static::lazy_static;
use config::Config;
use errors::{bail, Result};
use library::{Library, Section};
pub const ELASTICLUNR_JS: &str = include_str!("elasticlunr.min.js");
lazy_static! {
static ref AMMONIA: ammonia::Builder<'s... |
#[test]
fn can_fill_index_description() {
let mut config = Config::default();
config.search.include_description = true;
let title = Some("A title".to_string());
let description = Some("A description".to_string());
let content = "Some content".to_string();
let r... | {
let config = Config::default();
let title = Some("A title".to_string());
let description = Some("A description".to_string());
let content = "Some content".to_string();
let res = fill_index(&config, &title, &description, &content);
assert_eq!(res.len(), 2);
asse... | identifier_body |
lib.rs | use std::collections::{HashMap, HashSet};
use elasticlunr::{Index, Language};
use lazy_static::lazy_static;
use config::Config;
use errors::{bail, Result};
use library::{Library, Section};
pub const ELASTICLUNR_JS: &str = include_str!("elasticlunr.min.js");
lazy_static! {
static ref AMMONIA: ammonia::Builder<'s... | (config: &Config) -> Vec<String> {
let mut fields = vec![];
if config.search.include_title {
fields.push("title".to_owned());
}
if config.search.include_description {
fields.push("description".to_owned());
}
if config.search.include_content {
fields.push("body".to_owned... | build_fields | identifier_name |
lib.rs | use std::collections::{HashMap, HashSet};
use elasticlunr::{Index, Language};
use lazy_static::lazy_static;
use config::Config;
use errors::{bail, Result};
use library::{Library, Section};
pub const ELASTICLUNR_JS: &str = include_str!("elasticlunr.min.js");
lazy_static! {
static ref AMMONIA: ammonia::Builder<'s... |
if config.search.include_content {
fields.push("body".to_owned());
}
fields
}
fn fill_index(
config: &Config,
title: &Option<String>,
description: &Option<String>,
content: &str,
) -> Vec<String> {
let mut row = vec![];
if config.search.include_title {
row.push(t... | {
fields.push("description".to_owned());
} | conditional_block |
son.py | import pygame
pygame.mixer.init()
sons = []
#Initialisation
def sonSaut():
son = pygame.mixer.Sound('sons/saut.ogg')
son.play()
sons.append(sons)
def sonMort():
son = pygame.mixer.Sound('sons/mort.ogg')
son.play()
sons.append(sons)
def sonBlessureEnnemi():
son = pygame.mixer.Sound('sons... | son.play()
sons.append(sons)
def sonTir():
son = pygame.mixer.Sound('sons/tir.ogg')
son.set_volume(0.5)
son.play()
sons.append(sons)
def sonVictoire():
son = pygame.mixer.Sound('sons/victory.ogg')
son.play()
sons.append(sons)
def sonCheckpoint():
son = pygame.mixer.Sound('sons... | sons.append(sons)
def sonBlessureJoueur():
son = pygame.mixer.Sound('sons/blessureJoueur.ogg') | random_line_split |
son.py | import pygame
pygame.mixer.init()
sons = []
#Initialisation
def sonSaut():
son = pygame.mixer.Sound('sons/saut.ogg')
son.play()
sons.append(sons)
def sonMort():
son = pygame.mixer.Sound('sons/mort.ogg')
son.play()
sons.append(sons)
def sonBlessureEnnemi():
son = pygame.mixer.Sound('sons... | ():
son = pygame.mixer.Sound('sons/checkpoint.ogg')
son.play()
sons.append(sons)
| sonCheckpoint | identifier_name |
son.py | import pygame
pygame.mixer.init()
sons = []
#Initialisation
def sonSaut():
son = pygame.mixer.Sound('sons/saut.ogg')
son.play()
sons.append(sons)
def sonMort():
son = pygame.mixer.Sound('sons/mort.ogg')
son.play()
sons.append(sons)
def sonBlessureEnnemi():
son = pygame.mixer.Sound('sons... | son = pygame.mixer.Sound('sons/checkpoint.ogg')
son.play()
sons.append(sons) | identifier_body | |
export_to_elasticsearch.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
host = sys.argv[1]
port = sys.argv[2]
user = sys.argv[3]
password = sys.argv[4]
tmpDir = sys.argv[5]
conf = SparkConf().setAppName("Elasticsearch example")
# see https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html
conf.set("es.nodes",host)
... | print("Usage: export_to_elasticsearch.py <host> <port> <user> <pass> <tmpdir>", file=sys.stderr)
exit(-1) | conditional_block |
export_to_elasticsearch.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
from __future__ import print_function
import sys
from operator import add
from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.sql import SQLContext
if __name__ == "__main__":
if len(sys.argv) != 6:
print("Usage: export_to_elasticsearch.py <host> <port> <user> <pass> <tmpdir>", fi... | # limitations under the License.
# | random_line_split |
CreateWorkspace.py | # -*- coding: utf-8 -*-
"""
***************************************************************************
CreateWorkspace.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | self.addParameter(ParameterString(self.WORKSPACE, 'Workspace'))
self.addParameter(ParameterString(self.WORKSPACEURI, 'Workspace URI'))
self.addOutput(OutputString(self.WORKSPACE, 'Workspace')) | self.name = 'Create workspace'
self.group = 'GeoServer management tools' | random_line_split |
CreateWorkspace.py | # -*- coding: utf-8 -*-
"""
***************************************************************************
CreateWorkspace.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | (GeoServerToolsAlgorithm):
WORKSPACE = 'WORKSPACE'
WORKSPACEURI = 'WORKSPACEURI'
def processAlgorithm(self, progress):
self.createCatalog()
workspaceName = self.getParameterValue(self.WORKSPACE)
workspaceUri = self.getParameterValue(self.WORKSPACEURI)
self.catalog.create_wo... | CreateWorkspace | identifier_name |
CreateWorkspace.py | # -*- coding: utf-8 -*-
"""
***************************************************************************
CreateWorkspace.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | self.addBaseParameters()
self.name = 'Create workspace'
self.group = 'GeoServer management tools'
self.addParameter(ParameterString(self.WORKSPACE, 'Workspace'))
self.addParameter(ParameterString(self.WORKSPACEURI, 'Workspace URI'))
self.addOutput(OutputString(self.WORKSPACE, 'Wo... | identifier_body | |
textMessage.js | 'use strict';
const Twilio = require('twilio');
class TextMessage {
constructor(twilioConfig) {
this.config = twilioConfig;
this.toNumber = twilioConfig.toNumber;
this.twilioNumber = twilioConfig.twilioNumber;
}
| (message) {
const motionData = message || {};
const client = Twilio(this.config.accountSid, this.config.authToken);
return new Promise((resolve, reject) => {
const smsParams = {
to: this.toNumber,
from: this.twilioNumber,
body: `A cat was seen at ${motionData.timestamp}. See t... | sendMessage | identifier_name |
textMessage.js | 'use strict';
|
class TextMessage {
constructor(twilioConfig) {
this.config = twilioConfig;
this.toNumber = twilioConfig.toNumber;
this.twilioNumber = twilioConfig.twilioNumber;
}
sendMessage(message) {
const motionData = message || {};
const client = Twilio(this.config.accountSid, this.config.authToken);
... | const Twilio = require('twilio'); | random_line_split |
textMessage.js | 'use strict';
const Twilio = require('twilio');
class TextMessage {
constructor(twilioConfig) |
sendMessage(message) {
const motionData = message || {};
const client = Twilio(this.config.accountSid, this.config.authToken);
return new Promise((resolve, reject) => {
const smsParams = {
to: this.toNumber,
from: this.twilioNumber,
body: `A cat was seen at ${motionData.ti... | {
this.config = twilioConfig;
this.toNumber = twilioConfig.toNumber;
this.twilioNumber = twilioConfig.twilioNumber;
} | identifier_body |
textMessage.js | 'use strict';
const Twilio = require('twilio');
class TextMessage {
constructor(twilioConfig) {
this.config = twilioConfig;
this.toNumber = twilioConfig.toNumber;
this.twilioNumber = twilioConfig.twilioNumber;
}
sendMessage(message) {
const motionData = message || {};
const client = Twilio(... |
return resolve('The SMS message was sent successfully!');
});
});
}
}
module.exports = TextMessage;
| {
console.log('This SMS message was not sent due to errors:', err);
return reject(new Error('This SMS message was not sent due to errors: #{err}'));
} | conditional_block |
mod.rs | // OpenAOE: An open source reimplementation of Age of Empires (1997)
// Copyright (c) 2016 Kevin Fuller
//
// 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 wi... | // SOFTWARE.
mod component;
pub mod resource;
pub mod render_system;
pub mod system;
mod world;
pub use self::component::*;
pub use self::world::{SystemGroup, WorldPlanner, create_world_planner}; | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | random_line_split |
call.rs | use std::fmt;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::Instant;
use prost::Message;
/// A remote procedure call.
///
/// `Call` describes a remote procedure call: the remote service, the method, the required feature
/// flags, the deadline, the request, and the response type. `Call` instances ... | }
impl<Req, Resp> Call<Req, Resp>
where
Req: Message + 'static,
Resp: Message + Default,
{
/// Creates a new `Call` instance.
pub fn new(
service: &'static str,
method: &'static str,
request: Arc<Req>,
deadline: Instant,
) -> Call<Req, Resp> {
Call {
... | random_line_split | |
call.rs | use std::fmt;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::Instant;
use prost::Message;
/// A remote procedure call.
///
/// `Call` describes a remote procedure call: the remote service, the method, the required feature
/// flags, the deadline, the request, and the response type. `Call` instances ... |
dbg.field("deadline", &self.deadline);
dbg.finish()
}
}
impl<Req, Resp> Clone for Call<Req, Resp>
where
Req: Message + 'static,
Resp: Message + Default,
{
fn clone(&self) -> Call<Req, Resp> {
Call {
service: self.service,
method: self.method,
... | {
dbg.field("required_feature_flags", &self.required_feature_flags);
} | conditional_block |
call.rs | use std::fmt;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::Instant;
use prost::Message;
/// A remote procedure call.
///
/// `Call` describes a remote procedure call: the remote service, the method, the required feature
/// flags, the deadline, the request, and the response type. `Call` instances ... | (
service: &'static str,
method: &'static str,
request: Arc<Req>,
deadline: Instant,
) -> Call<Req, Resp> {
Call {
service,
method,
required_feature_flags: &[],
deadline,
request,
_marker: PhantomData::de... | new | identifier_name |
call.rs | use std::fmt;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::Instant;
use prost::Message;
/// A remote procedure call.
///
/// `Call` describes a remote procedure call: the remote service, the method, the required feature
/// flags, the deadline, the request, and the response type. `Call` instances ... |
/// Returns the call's deadline.
pub fn deadline(&self) -> Instant {
self.deadline
}
/// Retrieves the required feature flags of the call.
pub fn required_feature_flags(&self) -> &'static [u32] {
self.required_feature_flags
}
pub fn set_deadline(&mut self, deadline: Insta... | {
self.method
} | identifier_body |
admin.py | # -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \
PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import Translatable... | (self, request, obj=None):
return {'slug': ('title',)}
def get_queryset(self, request):
current_site = Site.objects.get_current()
return Post.objects.filter(sites=current_site)
def save_model(self, request, obj, form, change):
if not obj.author_id and get_setting('AUTHOR_DEFAUL... | get_prepopulated_fields | identifier_name |
admin.py | # -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \
PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import Translatable... |
def get_fieldsets(self, request, obj=None):
fsets = deepcopy(self._fieldsets)
if get_setting('MULTISITE'):
fsets[1][1]['fields'][0].append('sites')
return fsets
def save_related(self, request, form, formsets, change):
if not form.cleaned_data['sites']:
f... | return BlogCategory.objects.filter(sites=current_site) | random_line_split |
admin.py | # -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \
PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import Translatable... |
def get_queryset(self, request):
current_site = Site.objects.get_current()
return Post.objects.filter(sites=current_site)
def save_model(self, request, obj, form, change):
if not obj.author_id and get_setting('AUTHOR_DEFAULT'):
if get_setting('AUTHOR_DEFAULT') is True:
... | return {'slug': ('title',)} | identifier_body |
admin.py | # -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \
PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import Translatable... |
if request.user.is_superuser:
fsets[1][1]['fields'][0].append('author')
return fsets
def get_prepopulated_fields(self, request, obj=None):
return {'slug': ('title',)}
def get_queryset(self, request):
current_site = Site.objects.get_current()
return Post.obj... | fsets[1][1]['fields'][0].append('sites') | conditional_block |
Renderer2D.Effort.js | window.Rendxx = window.Rendxx || {};
window.Rendxx.Game = window.Rendxx.Game || {};
window.Rendxx.Game.Ghost = window.Rendxx.Game.Ghost || {};
window.Rendxx.Game.Ghost.Renderer2D = window.Rendxx.Game.Ghost.Renderer2D || {};
(function (RENDERER) {
var Data = RENDERER.Data;
var GridSize = Data.grid.size;
va... | };
this.render = function (delta) {
};
// private method -------------------------------------------------
var createEffort = function (effort) {
if (effort==null) return;
var effortName = effort[0];
var x = effort[1];
var y = effo... | createEffort(newEffort[i]);
}
| conditional_block |
Renderer2D.Effort.js | window.Rendxx = window.Rendxx || {};
window.Rendxx.Game = window.Rendxx.Game || {};
window.Rendxx.Game.Ghost = window.Rendxx.Game.Ghost || {};
window.Rendxx.Game.Ghost.Renderer2D = window.Rendxx.Game.Ghost.Renderer2D || {};
| tileSize: 128,
tileDispDuration: 50,
Name: {
'Blood': 0,
'Electric': 1
}
};
var Effort = function (entity) {
// data ----------------------------------------------------------
var that = this,
tex = {},
_scene = ent... | (function (RENDERER) {
var Data = RENDERER.Data;
var GridSize = Data.grid.size;
var _Data = {
size: 3, | random_line_split |
sujiko.rs | //! Sujiko.
//!
//! https://en.wikipedia.org/wiki/Sujiko
//! https://www.simetric.co.uk/sujiko/index.htm
extern crate puzzle_solver;
use puzzle_solver::{Puzzle,Solution,Val,VarToken};
const SIZE: usize = 3;
type Board = [[Val; SIZE]; SIZE];
fn make_sujiko(board: &Board, tl: Val, tr: Val, bl: Val, br: Val)
-... |
}
}
(sys, vars)
}
fn print_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>) {
for y in 0..SIZE {
for x in 0..SIZE {
print!(" {}", dict[vars[y][x]]);
}
println!();
}
}
fn verify_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>, expected: &Board) {
fo... | {
sys.set_value(vars[y][x], value);
} | conditional_block |
sujiko.rs | //! Sujiko.
//!
//! https://en.wikipedia.org/wiki/Sujiko
//! https://www.simetric.co.uk/sujiko/index.htm
extern crate puzzle_solver;
use puzzle_solver::{Puzzle,Solution,Val,VarToken};
const SIZE: usize = 3;
type Board = [[Val; SIZE]; SIZE];
fn make_sujiko(board: &Board, tl: Val, tr: Val, bl: Val, br: Val)
-... |
fn verify_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>, expected: &Board) {
for y in 0..SIZE {
for x in 0..SIZE {
assert_eq!(dict[vars[y][x]], expected[y][x]);
}
}
}
#[test]
fn sujiko_simetric() {
let puzzle = [ [ 6,0,9 ], [ 0,0,0 ], [ 5,0,0 ] ];
let expected = [ [ ... | {
for y in 0..SIZE {
for x in 0..SIZE {
print!(" {}", dict[vars[y][x]]);
}
println!();
}
} | identifier_body |
sujiko.rs | //! Sujiko.
//!
//! https://en.wikipedia.org/wiki/Sujiko
//! https://www.simetric.co.uk/sujiko/index.htm
extern crate puzzle_solver;
use puzzle_solver::{Puzzle,Solution,Val,VarToken};
const SIZE: usize = 3;
type Board = [[Val; SIZE]; SIZE];
fn make_sujiko(board: &Board, tl: Val, tr: Val, bl: Val, br: Val)
-... | (dict: &Solution, vars: &Vec<Vec<VarToken>>) {
for y in 0..SIZE {
for x in 0..SIZE {
print!(" {}", dict[vars[y][x]]);
}
println!();
}
}
fn verify_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>, expected: &Board) {
for y in 0..SIZE {
for x in 0..SIZE {
... | print_sujiko | identifier_name |
sujiko.rs | //! Sujiko.
//!
//! https://en.wikipedia.org/wiki/Sujiko
//! https://www.simetric.co.uk/sujiko/index.htm
extern crate puzzle_solver;
use puzzle_solver::{Puzzle,Solution,Val,VarToken};
const SIZE: usize = 3;
type Board = [[Val; SIZE]; SIZE];
fn make_sujiko(board: &Board, tl: Val, tr: Val, bl: Val, br: Val)
-... | for y in 0..SIZE {
for x in 0..SIZE {
print!(" {}", dict[vars[y][x]]);
}
println!();
}
}
fn verify_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>, expected: &Board) {
for y in 0..SIZE {
for x in 0..SIZE {
assert_eq!(dict[vars[y][x]], expected[y][x]... | (sys, vars)
}
fn print_sujiko(dict: &Solution, vars: &Vec<Vec<VarToken>>) { | random_line_split |
cell.py | from collections.abc import Mapping, Iterable
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError
from . import _dll
from .core import _FortranObject... |
def __len__(self):
return _dll.cells_size()
def __repr__(self):
return repr(dict(self))
cells = _CellMapping()
| yield Cell(index=i).id | conditional_block |
cell.py | from collections.abc import Mapping, Iterable
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError
from . import _dll
from .core import _FortranObject... | (self, T, instance=None):
"""Set the temperature of a cell
Parameters
----------
T : float
Temperature in K
instance : int or None
Which instance of the cell
"""
_dll.openmc_cell_set_temperature(self._index, T, c_int32(instance))
class ... | set_temperature | identifier_name |
cell.py | from collections.abc import Mapping, Iterable
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError
from . import _dll
from .core import _FortranObject... |
def __repr__(self):
return repr(dict(self))
cells = _CellMapping() | yield Cell(index=i).id
def __len__(self):
return _dll.cells_size() | random_line_split |
cell.py | from collections.abc import Mapping, Iterable
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError
from . import _dll
from .core import _FortranObject... |
class _CellMapping(Mapping):
def __getitem__(self, key):
index = c_int32()
try:
_dll.openmc_get_cell_index(key, index)
except (AllocationError, InvalidIDError) as e:
# __contains__ expects a KeyError to work correctly
raise KeyError(str(e))
retu... | """Cell stored internally.
This class exposes a cell that is stored internally in the OpenMC
library. To obtain a view of a cell with a given ID, use the
:data:`openmc.capi.cells` mapping.
Parameters
----------
index : int
Index in the `cells` array.
Attributes
----------
... | identifier_body |
urlsearchparams.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::URLSearchParamsBinding;
use dom::bindin... | (global: GlobalRef, init: Option<StringOrURLSearchParams>) -> Fallible<Temporary<URLSearchParams>> {
let usp = URLSearchParams::new(global).root();
match init {
Some(eString(_s)) => {
// XXXManishearth we need to parse the input here
// http://url.spec.whatwg.... | Constructor | identifier_name |
urlsearchparams.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::URLSearchParamsBinding;
use dom::bindin... | Some(eString(_s)) => {
// XXXManishearth we need to parse the input here
// http://url.spec.whatwg.org/#concept-urlencoded-parser
// We can use rust-url's implementation here:
// https://github.com/SimonSapin/rust-url/blob/master/form_urlencode... |
pub fn Constructor(global: GlobalRef, init: Option<StringOrURLSearchParams>) -> Fallible<Temporary<URLSearchParams>> {
let usp = URLSearchParams::new(global).root();
match init { | random_line_split |
urlsearchparams.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::URLSearchParamsBinding;
use dom::bindin... |
fn Get(self, name: DOMString) -> Option<DOMString> {
self.data.borrow().get(&name).map(|v| v[0].clone())
}
fn Has(self, name: DOMString) -> bool {
self.data.borrow().contains_key(&name)
}
fn Set(self, name: DOMString, value: DOMString) {
self.data.borrow_mut().insert(name... | {
self.data.borrow_mut().remove(&name);
self.update_steps();
} | identifier_body |
util.py | import collections
import hashlib
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from corehq.util.soft_assert import soft_assert
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.userreports.con... |
def add_event(request, event):
events = request.session.get(REPORT_BUILDER_EVENTS_KEY, [])
request.session[REPORT_BUILDER_EVENTS_KEY] = events + [event]
def has_report_builder_trial(request):
return has_privilege(request, privileges.REPORT_BUILDER_TRIAL)
def can_edit_report(request, report):
ucr_... | builder_enabled = toggle_enabled(request, toggles.REPORT_BUILDER)
legacy_builder_priv = has_privilege(request, privileges.REPORT_BUILDER)
beta_group_enabled = toggle_enabled(request, toggles.REPORT_BUILDER_BETA_GROUP)
has_add_on_priv = has_report_builder_add_on_privilege(request)
return (builder_enable... | identifier_body |
util.py | import collections
import hashlib
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from corehq.util.soft_assert import soft_assert
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.userreports.con... |
return config.backend_id
| return settings.OVERRIDE_UCR_BACKEND | conditional_block |
util.py | import collections
import hashlib
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from corehq.util.soft_assert import soft_assert
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.userreports.con... | if settings.OVERRIDE_UCR_BACKEND:
return settings.OVERRIDE_UCR_BACKEND
return config.backend_id | random_line_split | |
util.py | import collections
import hashlib
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from corehq.util.soft_assert import soft_assert
from corehq import privileges, toggles
from corehq.apps.hqwebapp.templatetags.hq_shared_tags import toggle_enabled
from corehq.apps.userreports.con... | (request):
"""
Return the number of report builder reports allowed
"""
builder_enabled = toggle_enabled(request, toggles.REPORT_BUILDER)
legacy_builder_priv = has_privilege(request, privileges.REPORT_BUILDER)
beta_group_enabled = toggle_enabled(request, toggles.REPORT_BUILDER_BETA_GROUP)
if... | allowed_report_builder_reports | identifier_name |
regress-crbug-245480.js | // Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-synt... | random_line_split | |
regress-crbug-245480.js | // Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... |
function assertHoley(obj, name_opt) {
assertEquals(true, isHoley(obj), name_opt);
}
function assertNotHoley(obj, name_opt) {
assertEquals(false, isHoley(obj), name_opt);
}
if (support_smi_only_arrays) {
function create_array(arg) {
return new Array(arg);
}
obj = create_array(0);
assertNotHoley(obj)... | {
if (%HasFastHoleyElements(obj)) return true;
return false;
} | identifier_body |
regress-crbug-245480.js | // Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | (a) {
return a[0];
}
var b = [0];
g(b);
g(b);
assertEquals(undefined, g(a)); | g | identifier_name |
regress-crbug-245480.js | // Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... |
function isHoley(obj) {
if (%HasFastHoleyElements(obj)) return true;
return false;
}
function assertHoley(obj, name_opt) {
assertEquals(true, isHoley(obj), name_opt);
}
function assertNotHoley(obj, name_opt) {
assertEquals(false, isHoley(obj), name_opt);
}
if (support_smi_only_arrays) {
function create_a... | {
print("Tests do NOT include smi-only arrays.");
} | conditional_block |
step-over-for-of-closure.js | var webpack4Babel6StepOverForOfClosure =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(ins... | /******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./input.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./input.js":
/*!***************... | /******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__ | random_line_split |
step-over-for-of-closure.js | var webpack4Babel6StepOverForOfClosure =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) |
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = ... | {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l... | identifier_body |
step-over-for-of-closure.js | var webpack4Babel6StepOverForOfClosure =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function | (moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/*... | __webpack_require__ | identifier_name |
ambig_impl_2_exe.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... | } //~ NOTE is `uint.me2::me`
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
//~^ NOTE is `ambig_impl_2_lib::uint.me::me`
| { *self } | identifier_body |
ambig_impl_2_exe.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... | }
impl me2 for uint { fn me(&self) -> uint { *self } } //~ NOTE is `uint.me2::me`
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
//~^ NOTE is `ambig_impl_2_lib::uint.me::me` | trait me2 {
fn me(&self) -> uint; | random_line_split |
ambig_impl_2_exe.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... | () { 1u.me(); } //~ ERROR multiple applicable methods in scope
//~^ NOTE is `ambig_impl_2_lib::uint.me::me`
| main | identifier_name |
builtins_generate_wrapper_implementation.py | #!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... |
return '\n'.join(self.generate_includes_from_entries(header_includes))
| header_includes.append((["WebCore"], ("WebCore", object.object_name + "Builtins.cpp"))) | conditional_block |
builtins_generate_wrapper_implementation.py | #!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... | (self):
return "%sJSBuiltins.cpp" % self.model().framework.setting('namespace')
def generate_output(self):
args = {
'namespace': self.model().framework.setting('namespace'),
}
sections = []
sections.append(self.generate_license())
sections.append(Templat... | output_filename | identifier_name |
builtins_generate_wrapper_implementation.py | #!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... |
def generate_output(self):
args = {
'namespace': self.model().framework.setting('namespace'),
}
sections = []
sections.append(self.generate_license())
sections.append(Template(Templates.DoNotEditWarning).substitute(args))
sections.append(self.generate_... | return "%sJSBuiltins.cpp" % self.model().framework.setting('namespace') | identifier_body |
builtins_generate_wrapper_implementation.py | #!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved. | # modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditio... | #
# Redistribution and use in source and binary forms, with or without | random_line_split |
net.py | # Copyright 2018 Flight Lab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | def get_ip():
"""Get primary IP (the one with a default route) of local machine.
This works on both Linux and Windows platforms, and doesn't require working
internet connection.
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255... | random_line_split | |
net.py | # Copyright 2018 Flight Lab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | """Get primary IP (the one with a default route) of local machine.
This works on both Linux and Windows platforms, and doesn't require working
internet connection.
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255.255', 1))
r... | identifier_body | |
net.py | # Copyright 2018 Flight Lab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ():
"""Get primary IP (the one with a default route) of local machine.
This works on both Linux and Windows platforms, and doesn't require working
internet connection.
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255.255', 1))... | get_ip | identifier_name |
test.factory.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib 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 a... | t.end();
});
tape( 'the function returns a function', function test( t ) {
var mgf = factory( 0.0, 1.0 );
t.equal( typeof mgf, 'function', 'returns a function' );
t.end();
});
tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', function test( t ) {
var mgf;
var y;
mgf = factory( 1... | // TESTS //
tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.equal( typeof factory, 'function', 'main export is a function' ); | random_line_split |
test.factory.js | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib 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 a... | t.end();
});
| {
mgf = factory( k[i] );
y = mgf( x[i] );
if ( y === expected[i] ) {
t.equal( y, expected[i], 'x: '+x[i]+', k: '+k[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'... | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.