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 |
|---|---|---|---|---|
cat.js | var shell = require('..');
var assert = require('assert'),
path = require('path'),
fs = require('fs');
// Node shims for < v0.7
fs.existsSync = fs.existsSync || path.existsSync;
shell.silent();
function | (str) {
return typeof str === 'string' ? str.match(/\n/g).length : 0;
}
// save current dir
var cur = shell.pwd();
shell.rm('-rf', 'tmp');
shell.mkdir('tmp')
//
// Invalids
//
shell.cat();
assert.ok(shell.error());
assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
shell.cat('/adsfasdf'); // file d... | numLines | identifier_name |
cat.js | var shell = require('..');
var assert = require('assert'),
path = require('path'),
fs = require('fs');
// Node shims for < v0.7
fs.existsSync = fs.existsSync || path.existsSync;
shell.silent();
function numLines(str) |
// save current dir
var cur = shell.pwd();
shell.rm('-rf', 'tmp');
shell.mkdir('tmp')
//
// Invalids
//
shell.cat();
assert.ok(shell.error());
assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
shell.cat('/adsfasdf'); // file does not exist
assert.ok(shell.error());
//
// Valids
//
// simple
var r... | {
return typeof str === 'string' ? str.match(/\n/g).length : 0;
} | identifier_body |
wrapper.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/. */
//! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes
//! escape, an... |
// If this is a text node, use the parent element, since that's what
// controls our style.
if node.is_text_node() {
node = node.parent_node().unwrap();
debug_assert!(node.is_element());
}
let damage = {
let data = node.get_raw_data().unwrap(... | // We need the underlying node to potentially access the parent in the
// case of text nodes. This is safe as long as we don't let the parent
// escape and never access its descendants.
let mut node = unsafe { self.unsafe_get() }; | random_line_split |
wrapper.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/. */
//! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes
//! escape, an... | (&self) -> Option<AtomicRefMut<LayoutData>> {
self.get_raw_data().map(|d| d.layout_data.borrow_mut())
}
fn flow_debug_id(self) -> usize {
self.borrow_layout_data()
.map_or(0, |d| d.flow_construction_result.debug_id())
}
}
pub trait GetRawData {
fn get_raw_data(&self) -> Opt... | mutate_layout_data | identifier_name |
wrapper.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/. */
//! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes
//! escape, an... |
fn text_content(&self) -> TextContent {
if self.get_pseudo_element_type().is_replaced_content() {
let style = self.as_element().unwrap().resolved_style();
return TextContent::GeneratedContent(match style.as_ref().get_counters().content {
Content::Items(ref value) =... | {
self.mutate_layout_data().unwrap().flags.remove(flags);
} | identifier_body |
game.js | document.addEventListener("DOMContentLoaded", function() {
"use_strict";
// Store game in global variable
const CASUDOKU = {};
CASUDOKU.game = (function() {
// Controls the state of the game
// Game UI
let uiStats = document.getElementById("gameStats"),
uiComplete = document.getElementById("gameCo... |
workerSudokuValidator.onmessage = function(e) {
let correct = e.data;
if (correct) {
CASUDOKU.game.over();
}
draw();
};
};
draw = function () {
// renders the canvas
let regionPosX = 0, regionPosY = 0,
cellPosX = 0, cellPosY = 0,
textPosX = cellWidth * 0.4, textPosY = c... | workerSudokuValidator.postMessage(grid); | random_line_split |
game.js | document.addEventListener("DOMContentLoaded", function() {
"use_strict";
// Store game in global variable
const CASUDOKU = {};
CASUDOKU.game = (function() {
// Controls the state of the game
// Game UI
let uiStats = document.getElementById("gameStats"),
uiComplete = document.getElementById("gameCo... | () {
// set fixed puzzle values
this.isDefault = true;
this.value = 0;
// Store position on the canvas
this.x = 0;
this.y = 0;
this.col = 0;
this.row = 0;
}
};
for (let i = 0; i < puzzle.length; i++) {
grid[i] = new Cell();
grid[i].value = puzzle[i];
if... | constructor | identifier_name |
game.js | document.addEventListener("DOMContentLoaded", function() {
"use_strict";
// Store game in global variable
const CASUDOKU = {};
CASUDOKU.game = (function() {
// Controls the state of the game
// Game UI
let uiStats = document.getElementById("gameStats"),
uiComplete = document.getElementById("gameCo... |
};
for (let i = 0; i < puzzle.length; i++) {
grid[i] = new Cell();
grid[i].value = puzzle[i];
if (puzzle[i] === 0) {
grid[i].isDefault = false;
}
// Set cell column and row
grid[i].col = colCounter;
grid[i].row = rowCounter;
colCounter++;
// change row
if ((i + 1)... | {
// set fixed puzzle values
this.isDefault = true;
this.value = 0;
// Store position on the canvas
this.x = 0;
this.y = 0;
this.col = 0;
this.row = 0;
} | identifier_body |
game.js | document.addEventListener("DOMContentLoaded", function() {
"use_strict";
// Store game in global variable
const CASUDOKU = {};
CASUDOKU.game = (function() {
// Controls the state of the game
// Game UI
let uiStats = document.getElementById("gameStats"),
uiComplete = document.getElementById("gameCo... |
if (grid[i].value !== 0 && !grid[i].isDefault) {
context.font = "1.4em Droid Sans, sans-serif";
context.fillStyle = "grey";
context.fillText(grid[i].value, textPosX, textPosY);
}
// Cell background colour
if (i == selectedCellIndex) {
context.fillStyle = "#00B4FF";
}
else {... | {
context.font = "bold 1.6em Droid Sans, sans-serif";
context.fillStyle = "black";
context.fillText(grid[i].value, textPosX, textPosY);
} | conditional_block |
c_type.rs | pub fn rustify_pointers(c_type: &str) -> (String, String) {
let mut input = c_type.trim();
let leading_const = input.starts_with("const ");
if leading_const {
input = &input[6..];
}
let end = [
input.find(" const"),
input.find("*const"),
input.find("*"),
Some(... | () {
assert_eq!(rustify_ptr("char"), s("", "char"));
assert_eq!(rustify_ptr("char*"), s("*mut", "char"));
assert_eq!(rustify_ptr("const char*"), s("*const", "char"));
assert_eq!(rustify_ptr("char const*"), s("*const", "char"));
assert_eq!(rustify_ptr("char const *"), s("*const", ... | rustify_pointers | identifier_name |
c_type.rs | pub fn rustify_pointers(c_type: &str) -> (String, String) |
#[cfg(test)]
mod tests {
use super::rustify_pointers as rustify_ptr;
fn s(x: &str, y: &str) -> (String, String) {
(x.into(), y.into())
}
#[test]
fn rustify_pointers() {
assert_eq!(rustify_ptr("char"), s("", "char"));
assert_eq!(rustify_ptr("char*"), s("*mut", "char"));
... | {
let mut input = c_type.trim();
let leading_const = input.starts_with("const ");
if leading_const {
input = &input[6..];
}
let end = [
input.find(" const"),
input.find("*const"),
input.find("*"),
Some(input.len()),
].iter().filter_map(|&x| x).min().unwrap... | identifier_body |
c_type.rs | pub fn rustify_pointers(c_type: &str) -> (String, String) {
let mut input = c_type.trim();
let leading_const = input.starts_with("const ");
if leading_const {
input = &input[6..];
}
let end = [
input.find(" const"),
input.find("*const"),
input.find("*"),
Some(... | else { "*mut" }).collect();
if let (true, Some(p)) = (leading_const, ptrs.last_mut()) {
*p = "*const";
}
let res = (ptrs.join(" "), inner);
trace!("rustify `{}` -> `{}` `{}`", c_type, res.0, res.1);
res
}
#[cfg(test)]
mod tests {
use super::rustify_pointers as rustify_ptr;
fn s(x... | { "*const" } | conditional_block |
c_type.rs | pub fn rustify_pointers(c_type: &str) -> (String, String) {
let mut input = c_type.trim();
let leading_const = input.starts_with("const ");
if leading_const {
input = &input[6..];
}
let end = [
input.find(" const"),
input.find("*const"),
input.find("*"),
Some(... | }
#[test]
fn rustify_pointers() {
assert_eq!(rustify_ptr("char"), s("", "char"));
assert_eq!(rustify_ptr("char*"), s("*mut", "char"));
assert_eq!(rustify_ptr("const char*"), s("*const", "char"));
assert_eq!(rustify_ptr("char const*"), s("*const", "char"));
assert_eq!... | random_line_split | |
example.py | from __future__ import print_function
import time
from flask import Flask, session, url_for
from flask_debugtoolbar import DebugToolbarExtension
from weblablib import WebLab, requires_active, weblab_user, poll
app = Flask(__name__)
# XXX: IMPORTANT SETTINGS TO CHANGE
app.config['SECRET_KEY'] = 'something random' # e... | ():
"""
This is your code. If you provide @requires_active to any other URL, it is secured.
"""
user = weblab_user
return "Hello %s. You didn't poll in %.2f seconds (timeout configured to %s). Total time left: %s" % (user.username, user.time_without_polling, weblab.timeout, user.time_left)
@app.rou... | lab | identifier_name |
example.py | from __future__ import print_function
import time
from flask import Flask, session, url_for
from flask_debugtoolbar import DebugToolbarExtension
from weblablib import WebLab, requires_active, weblab_user, poll
app = Flask(__name__)
# XXX: IMPORTANT SETTINGS TO CHANGE
app.config['SECRET_KEY'] = 'something random' # e... | print("Run the following:")
print()
print(" (optionally) $ export FLASK_DEBUG=1")
print(" $ export FLASK_APP={}".format(__file__))
print(" $ flask run")
print() | conditional_block | |
example.py | from __future__ import print_function
import time
from flask import Flask, session, url_for
from flask_debugtoolbar import DebugToolbarExtension
from weblablib import WebLab, requires_active, weblab_user, poll
app = Flask(__name__)
# XXX: IMPORTANT SETTINGS TO CHANGE
app.config['SECRET_KEY'] = 'something random' # e... | # app.config['WEBLAB_REDIS_BASE'] = 'lab1' # If you have more than one lab in the same redis database
# app.config['WEBLAB_CALLBACK_URL'] = '/lab/public' # If you don't pass it in the creator
# app.config['WEBLAB_TIMEOUT'] = 15 # in seconds, default value
# app.config['WEBLAB_SCHEME'] = 'https'
weblab = WebLab(app, ca... | random_line_split | |
example.py | from __future__ import print_function
import time
from flask import Flask, session, url_for
from flask_debugtoolbar import DebugToolbarExtension
from weblablib import WebLab, requires_active, weblab_user, poll
app = Flask(__name__)
# XXX: IMPORTANT SETTINGS TO CHANGE
app.config['SECRET_KEY'] = 'something random' # e... |
@app.route("/")
def index():
return "<html><head></head><body><a href='{}'>Access to the lab</a></body></html>".format(url_for('.lab'))
if __name__ == '__main__':
print("Run the following:")
print()
print(" (optionally) $ export FLASK_DEBUG=1")
print(" $ export FLASK_APP={}".format(__file__))
... | """
This is your code. If you provide @requires_active to any other URL, it is secured.
"""
user = weblab_user
return "Hello %s. You didn't poll in %.2f seconds (timeout configured to %s). Total time left: %s" % (user.username, user.time_without_polling, weblab.timeout, user.time_left) | identifier_body |
mirror_gen.py | """
A "mirroring" ``stdout`` context manager.
While active, the context manager reverses text output to
``stdout``::
# BEGIN MIRROR_GEN_DEMO_1
>>> from mirror_gen import looking_glass
>>> with looking_glass() as what: # <1>
... print('Alice, Kitty and Snowdrop')
... print(what)
... | >>> manager.__exit__(None, None, None) # <4>
>>> monster
'JABBERWOCKY'
# END MIRROR_GEN_DEMO_2
"""
# BEGIN MIRROR_GEN_EX
import contextlib
@contextlib.contextmanager # <1>
def looking_glass():
import sys
original_write = sys.stdout.write # <2>
def reverse_write(text... | >>> manager # doctest: +ELLIPSIS
>...x0 ta tcejbo reganaMtxetnoCrotareneG_.biltxetnoc<
| random_line_split |
mirror_gen.py | """
A "mirroring" ``stdout`` context manager.
While active, the context manager reverses text output to
``stdout``::
# BEGIN MIRROR_GEN_DEMO_1
>>> from mirror_gen import looking_glass
>>> with looking_glass() as what: # <1>
... print('Alice, Kitty and Snowdrop')
... print(what)
... | (text): # <3>
original_write(text[::-1])
sys.stdout.write = reverse_write # <4>
yield 'JABBERWOCKY' # <5>
sys.stdout.write = original_write # <6>
# END MIRROR_GEN_EX
| reverse_write | identifier_name |
mirror_gen.py | """
A "mirroring" ``stdout`` context manager.
While active, the context manager reverses text output to
``stdout``::
# BEGIN MIRROR_GEN_DEMO_1
>>> from mirror_gen import looking_glass
>>> with looking_glass() as what: # <1>
... print('Alice, Kitty and Snowdrop')
... print(what)
... |
sys.stdout.write = reverse_write # <4>
yield 'JABBERWOCKY' # <5>
sys.stdout.write = original_write # <6>
# END MIRROR_GEN_EX
| original_write(text[::-1]) | identifier_body |
struct_micro_build_1_1_metadata_type.js | var struct_micro_build_1_1_metadata_type =
[
[ "Ptr", "struct_micro_build_1_1_metadata_type.html#a4cb44d30301190706bf098f7a5fa0be0", null ],
[ "ToString", "struct_micro_build_1_1_metadata_type.html#ae5531987a72657871f60ae4831836919", null ],
[ "ClangType", "struct_micro_build_1_1_metadata_type.html#a6d24689... | [ "PointerType", "struct_micro_build_1_1_metadata_type.html#a9ed2f6e751801e3a27feaa4d7311ccc3", null ],
[ "PrimitiveType", "struct_micro_build_1_1_metadata_type.html#ab2034de9aae0f91a9904d1a6204039ce", null ]
]; | random_line_split | |
job.rs | //
// Copyright:: Copyright (c) 2016 Chef Software, Inc.
// License:: Apache License, Version 2.0
//
// 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... |
}
fn with_default<'a>(val: &'a str, default: &'a str, local: &bool) -> &'a str {
if !local || !val.is_empty() {
val
} else {
default
}
}
pub fn clap_subcommand<'c>() -> App<'c, 'c> {
SubCommand::with_name(SUBCOMMAND_NAME)
.about("Run one or more phase jobs")
.args(&vec... | {
let project = try!(project::project_or_from_cwd(&self.project));
let mut new_config = config
.set_pipeline(&self.pipeline)
.set_user(with_default(&self.user, "you", &&self.local))
.set_server(with_default(&self.server, "localhost", &&self.local))
.set_e... | identifier_body |
job.rs | //
// Copyright:: Copyright (c) 2016 Chef Software, Inc.
// License:: Apache License, Version 2.0
//
// 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... | () -> Self {
JobClapOptions {
stage: "",
phases: "",
change: "",
pipeline: "master",
job_root: "",
project: "",
user: "",
server: "",
ent: "",
org: "",
patchset: "",
ch... | default | identifier_name |
job.rs | //
// Copyright:: Copyright (c) 2016 Chef Software, Inc.
// License:: Apache License, Version 2.0
//
// 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... |
fips::merge_fips_options_and_config(
self.fips,
self.fips_git_port,
self.fips_custom_cert_filename,
new_config,
)
}
}
fn with_default<'a>(val: &'a str, default: &'a str, local: &bool) -> &'a str {
if !local || !val.is_empty() {
val
}... | {
new_config.saml = Some(true)
} | conditional_block |
job.rs | //
// Copyright:: Copyright (c) 2016 Chef Software, Inc.
// License:: Apache License, Version 2.0
//
// 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... | None
},
}
}
}
impl<'n> Options for JobClapOptions<'n> {
fn merge_options_and_config(&self, config: Config) -> DeliveryResult<Config> {
let project = try!(project::project_or_from_cwd(&self.project));
let mut new_config = config
.set_pipeline(&sel... | a2_mode: if matches.is_present("a2-mode") {
Some(true)
} else { | random_line_split |
directivesSpec.js | 'use strict';
/* jasmine specs for directives go here */
describe('directives', function () {
beforeEach(module('myApp.directives'));
describe('app-version', function () {
it('should print current version', function () {
module(function ($provide) {
$provide.value('version... |
});
});
});
| {
expect(lis.eq(i).text()).toEqual('' + i);
} | conditional_block |
directivesSpec.js | 'use strict';
/* jasmine specs for directives go here */
describe('directives', function () {
beforeEach(module('myApp.directives'));
describe('app-version', function () {
it('should print current version', function () {
module(function ($provide) {
$provide.value('version... | $scope.currentPage = 2;
element = $compile('<pagination num-pages="numPages" current-page="currentPage"></pagination>')($scope);
$scope.$digest();
lis = function () {
return element.find('li');
};
}));
it('has the number of t... | $scope.numPage = 5; | random_line_split |
local_cloud_datastore.py | #
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | (self, working_directory, gcd_zip, java=None):
"""Constructs a factory for building local datastore instances.
Args:
working_directory: path to a directory where temporary files will be
stored
gcd_zip: path to the gcd zip file
java: path to a java executable
Raises:
Value... | __init__ | identifier_name |
local_cloud_datastore.py | #
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
class LocalCloudDatastore(object):
"""A local datastore (based on gcd.sh)."""
def __init__(self, gcd_sh, working_directory, project_id, deadline,
start_options):
"""Constructs a local datastore.
Clients should use LocalCloudDatastoreFactory to construct
LocalCloudDatastore instances.... | shutil.rmtree(self._gcd_dir) | identifier_body |
local_cloud_datastore.py | #
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
else:
raise ValueError('could not find gcd.sh in zip file')
os.chmod(self._gcd_sh, 0700) # executable
# Make GCD use our copy of Java.
if java:
os.environ['JAVA'] = java
def Get(self, project_id):
"""Returns an existing local datastore instance for the provided project_id.
If ... | if d.startswith('gcd'):
self._gcd_sh = os.path.join(self._gcd_dir, d, 'gcd.sh')
break | conditional_block |
local_cloud_datastore.py | #
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | p = subprocess.Popen([gcd_sh,
'create',
'--project_id=%s' % self._project_id,
self._project_directory])
if p.wait() != 0:
raise IOError('could not create project in directory: %s'
% self._project_directory)
... | random_line_split | |
UIFileInputBehavior.js | BASE.require([
"jQuery"
], function () {
BASE.namespace("components.ui.inputs");
var Future = BASE.async.Future;
components.ui.inputs.UIFileInputBehavior = function (elem) {
var self = this;
var $elem = $(elem);
var $fileInput = $('<input type="file">');
$elem.data('f... | readerFunction(uri, function (fileEntry) {
fileEntry.file(function (file) {
setValue(file);
}, function (error) {
setError(error);
});
}, setError);
}).then().ifError(... | readerFunction = window.resolveLocalFileSystemURI;
}
| conditional_block |
UIFileInputBehavior.js | BASE.require([
"jQuery" | BASE.namespace("components.ui.inputs");
var Future = BASE.async.Future;
components.ui.inputs.UIFileInputBehavior = function (elem) {
var self = this;
var $elem = $(elem);
var $fileInput = $('<input type="file">');
$elem.data('fileInput', self);
var getFileFromUri ... | ], function () { | random_line_split |
segos_mv.py | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2016 mrknow
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 ... | return sources
except:
return sources
def resolve(self, url):
control.log('CDA-ONLINE RESOLVE URL %s' % url)
try:
url = resolvers.request(url)
return url
except:
return
| :
host = urlparse.urlparse(i).netloc
host = host.split('.')
host = host[-2]+"."+host[-1]
host = host.lower()
host = client.replaceHTMLCodes(host)
host = host.encode('utf-8')
source... | conditional_block |
segos_mv.py | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2016 mrknow
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 ... | lf, url):
control.log('CDA-ONLINE RESOLVE URL %s' % url)
try:
url = resolvers.request(url)
return url
except:
return
| olve(se | identifier_name |
segos_mv.py | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2016 mrknow
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 ... |
def get_episode(self, url, imdb, tvdb, title, date, season, episode):
if url == None: return
url += self.episode_link % (int(season), int(episode))
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
def get_sources(self, url, hosthdDict, hostDic... | try:
query = self.moviesearch_link % (urllib.unquote(tvshowtitle))
query = urlparse.urljoin(self.base_link, query)
result = client.source(query)
result = json.loads(result)
tvshowtitle = cleantitle.tv(tvshowtitle)
years = ['%s' % str(year), '%s' ... | identifier_body |
segos_mv.py | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2016 mrknow
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 ... |
def get_episode(self, url, imdb, tvdb, title, date, season, episode):
if url == None: return
url += self.episode_link % (int(season), int(episode))
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
def get_sources(self, url, hosthdDict, hostDict... | return | random_line_split |
Stochastic Utility.py | from chowdren.writers.objects import ObjectWriter
from chowdren.common import get_animation_name, to_c, make_color
from chowdren.writers.events import (StaticConditionWriter,
StaticActionWriter, StaticExpressionWriter, make_table)
class Util(ObjectWriter):
class_name = 'Utility'
static = True
def wr... | ():
return Util | get_object | identifier_name |
Stochastic Utility.py | from chowdren.writers.objects import ObjectWriter
from chowdren.common import get_animation_name, to_c, make_color
from chowdren.writers.events import (StaticConditionWriter,
StaticActionWriter, StaticExpressionWriter, make_table)
class Util(ObjectWriter):
class_name = 'Utility'
static = True
def wr... |
expressions = make_table(StaticExpressionWriter, {
0 : 'IntGenerateRandom',
1 : 'GenerateRandom',
3 : 'Substr',
4 : 'Nearest',
6 : 'ModifyRange',
2 : 'Limit',
13 : 'IntNearest',
15 : 'IntModifyRange',
21 : 'ExpressionCompare',
22 : 'IntExpressionCompare',
23 : 'StrExpression... | 1 : 'SetRandomSeedToTimer'
})
conditions = make_table(StaticConditionWriter, {
}) | random_line_split |
Stochastic Utility.py | from chowdren.writers.objects import ObjectWriter
from chowdren.common import get_animation_name, to_c, make_color
from chowdren.writers.events import (StaticConditionWriter,
StaticActionWriter, StaticExpressionWriter, make_table)
class Util(ObjectWriter):
class_name = 'Utility'
static = True
def wr... | return Util | identifier_body | |
index.js | module.exports = middleware;
var states = {
STANDBY: 0,
BUSY: 1
};
function middleware(options) { | current;
camera.on('ready', function() {
hwReady = true;
current = states.STANDBY;
});
app.get('/', handler);
function handler(req, res) {
if (hwReady) {
if (current === states.STANDBY) {
current = states.BUSY;
camera.takePicture(function (err, image) {
res.s... | var regio = require('regio'),
tessel = require('tessel'),
camera = require('camera-vc0706').use(tessel.port[options.port]),
app = regio.router(),
hwReady = false, | random_line_split |
index.js | module.exports = middleware;
var states = {
STANDBY: 0,
BUSY: 1
};
function middleware(options) {
var regio = require('regio'),
tessel = require('tessel'),
camera = require('camera-vc0706').use(tessel.port[options.port]),
app = regio.router(),
hwReady = false,
current;
camera.on... |
} else {
res.status(503).end();
}
}
return app;
}
| {
res.set('Retry-After', 100);
res.status(503).end();
} | conditional_block |
index.js | module.exports = middleware;
var states = {
STANDBY: 0,
BUSY: 1
};
function middleware(options) | {
var regio = require('regio'),
tessel = require('tessel'),
camera = require('camera-vc0706').use(tessel.port[options.port]),
app = regio.router(),
hwReady = false,
current;
camera.on('ready', function() {
hwReady = true;
current = states.STANDBY;
});
app.get('/', handler... | identifier_body | |
index.js | module.exports = middleware;
var states = {
STANDBY: 0,
BUSY: 1
};
function middleware(options) {
var regio = require('regio'),
tessel = require('tessel'),
camera = require('camera-vc0706').use(tessel.port[options.port]),
app = regio.router(),
hwReady = false,
current;
camera.on... | (req, res) {
if (hwReady) {
if (current === states.STANDBY) {
current = states.BUSY;
camera.takePicture(function (err, image) {
res.set('Content-Type', 'image/jpeg');
res.set('Content-Length', image.length);
res.status(200).end(image);
current = states.S... | handler | identifier_name |
test_tab.py | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | (self, win_id, mode_manager, parent=None):
super().__init__(win_id=win_id, mode_manager=mode_manager,
parent=parent)
self.history = browsertab.AbstractHistory(self)
self.scroller = browsertab.AbstractScroller(self, parent=self)
self.caret = browsertab.AbstractCar... | __init__ | identifier_name |
test_tab.py | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
class Tab(browsertab.AbstractTab):
# pylint: disable=abstract-method
def __init__(self, win_id, mode_manager, parent=None):
super().__init__(win_id=win_id, mode_manager=mode_manager,
parent=parent)
self.history = browsertab.AbstractHistory(self)
self.scroller ... | random_line_split | |
test_tab.py | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
elif request.param == 'webengine':
webenginetab = pytest.importorskip(
'qutebrowser.browser.webengine.webenginetab')
tab_class = webenginetab.WebEngineTab
else:
assert False
t = tab_class(win_id=0, mode_manager=mode_manager)
qtbot.add_widget(t)
yield t
class Z... | webkittab = pytest.importorskip('qutebrowser.browser.webkit.webkittab')
tab_class = webkittab.WebKitTab | conditional_block |
test_tab.py | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
@pytest.mark.xfail(run=False, reason='Causes segfaults, see #1638')
def test_tab(qtbot, view, config_stub, tab_registry, mode_manager):
tab_w = Tab(win_id=0, mode_manager=mode_manager)
qtbot.add_widget(tab_w)
assert tab_w.win_id == 0
assert tab_w._widget is None
tab_w._set_widget(view)
asse... | pass | identifier_body |
sort.rs | use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::process::Command;
static PROGNAME: &'static str = "./sort";
#[test]
fn numeric1() {
numeric_helper(1);
}
#[test]
fn numeric2() {
numeric_helper(2);
}
#[test]
fn numeric3() {
numeric_helper(3);
}
#[test]
fn numeric4() {
numeric_help... | Ok(_) => {},
Err(err) => panic!("{}", err)
}
assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(answer).unwrap());
} | });
let mut answer = vec!();
match f.read_to_end(&mut answer) { | random_line_split |
sort.rs | use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::process::Command;
static PROGNAME: &'static str = "./sort";
#[test]
fn numeric1() {
numeric_helper(1);
}
#[test]
fn numeric2() {
numeric_helper(2);
}
#[test]
fn numeric3() {
numeric_helper(3);
}
#[test]
fn numeric4() {
numeric_help... | ,
Err(err) => panic!("{}", err)
}
assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(answer).unwrap());
}
| {} | conditional_block |
sort.rs | use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::process::Command;
static PROGNAME: &'static str = "./sort";
#[test]
fn numeric1() {
numeric_helper(1);
}
#[test]
fn numeric2() |
#[test]
fn numeric3() {
numeric_helper(3);
}
#[test]
fn numeric4() {
numeric_helper(4);
}
#[test]
fn numeric5() {
numeric_helper(5);
}
fn numeric_helper(test_num: isize) {
let mut cmd = Command::new(PROGNAME);
cmd.arg("-n");
let po = match cmd.arg(format!("{}{}{}", "numeric", test_num, ".tx... | {
numeric_helper(2);
} | identifier_body |
sort.rs | use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::process::Command;
static PROGNAME: &'static str = "./sort";
#[test]
fn numeric1() {
numeric_helper(1);
}
#[test]
fn numeric2() {
numeric_helper(2);
}
#[test]
fn numeric3() {
numeric_helper(3);
}
#[test]
fn numeric4() {
numeric_help... | (test_num: isize) {
let mut cmd = Command::new(PROGNAME);
cmd.arg("-n");
let po = match cmd.arg(format!("{}{}{}", "numeric", test_num, ".txt")).output() {
Ok(p) => p,
Err(err) => panic!("{}", err)
};
let filename = format!("{}{}{}", "numeric", test_num, ".ans");
let mut f = File... | numeric_helper | identifier_name |
plot_2cdfs.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import scipy
import numpy
import pmagpy.pmagplotlib as pmagplotlib
def | ():
"""
NAME
plot_2cdfs.py
DESCRIPTION
makes plots of cdfs of data in input file
SYNTAX
plot_2cdfs.py [-h][command line options]
OPTIONS
-h prints help message and quits
-f FILE1 FILE2
-t TITLE
-fmt [svg,eps,png,pdf,jpg..] specify format of... | main | identifier_name |
plot_2cdfs.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import scipy
import numpy
import pmagpy.pmagplotlib as pmagplotlib
def main():
"""
NAME
plot_2cdfs.py
DESCRIPTION
makes plots of cdfs of data in input file
SYNTAX
plot_2cdfs.py... |
if '-fmt' in sys.argv:
ind=sys.argv.index('-fmt')
fmt=sys.argv[ind+1]
if '-t' in sys.argv:
ind=sys.argv.index('-t')
title=sys.argv[ind+1]
CDF={'X':1}
pmagplotlib.plot_init(CDF['X'],5,5)
pmagplotlib.plot_cdf(CDF['X'],X,'','r','')
pmagplotlib.plot_cdf(CDF['X'],X2,tit... | print('-f option required')
print(main.__doc__)
sys.exit() | conditional_block |
plot_2cdfs.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import scipy
import numpy
import pmagpy.pmagplotlib as pmagplotlib
def main():
"""
NAME
plot_2cdfs.py
DESCRIPTION
makes plots of cdfs of data in input file
SYNTAX
plot_2cdfs.py... | ind=sys.argv.index('-t')
title=sys.argv[ind+1]
CDF={'X':1}
pmagplotlib.plot_init(CDF['X'],5,5)
pmagplotlib.plot_cdf(CDF['X'],X,'','r','')
pmagplotlib.plot_cdf(CDF['X'],X2,title,'b','')
D,p=scipy.stats.ks_2samp(X,X2)
if p>=.05:
print(D,p,' not rejected at 95%')
else:
... | if '-fmt' in sys.argv:
ind=sys.argv.index('-fmt')
fmt=sys.argv[ind+1]
if '-t' in sys.argv: | random_line_split |
plot_2cdfs.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import scipy
import numpy
import pmagpy.pmagplotlib as pmagplotlib
def main():
|
if __name__ == "__main__":
main()
| """
NAME
plot_2cdfs.py
DESCRIPTION
makes plots of cdfs of data in input file
SYNTAX
plot_2cdfs.py [-h][command line options]
OPTIONS
-h prints help message and quits
-f FILE1 FILE2
-t TITLE
-fmt [svg,eps,png,pdf,jpg..] specify format of output ... | identifier_body |
lib.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
mod handlers;
use crate::handlers::get_routes;
use diem_logger::prelude::*;
use diemdb::DiemDB;
use std::{net::SocketAddr, sync::Arc};
use tokio::runtime::{Builder, Runtime};
pub fn start_backup_service(address: SocketAddr, db: Arc<Di... | () {
let tmpdir = TempPath::new();
let db = Arc::new(DiemDB::new_for_test(&tmpdir));
let port = get_available_port();
let _rt = start_backup_service(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port), db);
// Endpoint doesn't exist.
let resp = get(&format!("http://12... | routing_and_error_codes | identifier_name |
lib.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
mod handlers;
use crate::handlers::get_routes;
use diem_logger::prelude::*;
use diemdb::DiemDB;
use std::{net::SocketAddr, sync::Arc};
use tokio::runtime::{Builder, Runtime};
pub fn start_backup_service(address: SocketAddr, db: Arc<Di... | "http://127.0.0.1:{}/state_range_proof/{}",
port, 123
))
.unwrap();
assert_eq!(resp.status(), 400);
let resp = get(&format!("http://127.0.0.1:{}/state_snapshot", port)).unwrap();
assert_eq!(resp.status(), 400);
// Params fail to parse (HashValue)
... | let resp = get(&format!( | random_line_split |
lib.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
mod handlers;
use crate::handlers::get_routes;
use diem_logger::prelude::*;
use diemdb::DiemDB;
use std::{net::SocketAddr, sync::Arc};
use tokio::runtime::{Builder, Runtime};
pub fn start_backup_service(address: SocketAddr, db: Arc<Di... |
}
| {
let tmpdir = TempPath::new();
let db = Arc::new(DiemDB::new_for_test(&tmpdir));
let port = get_available_port();
let _rt = start_backup_service(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port), db);
// Endpoint doesn't exist.
let resp = get(&format!("http://127.0... | identifier_body |
scope.rs | // https://rustbyexample.com/variable_bindings/scope.html
// http://rust-lang-ja.org/rust-by-example/variable_bindings/scope.html
fn | () {
// This binding lives in the main function
let long_lived_binding = 1;
// This is a block, and has a smaller scope than the main function
{
// This binding only exists in this block
let short_lived_binding = 2;
println!("inner short: {}", short_lived_binding);
// ... | main | identifier_name |
scope.rs | // https://rustbyexample.com/variable_bindings/scope.html
// http://rust-lang-ja.org/rust-by-example/variable_bindings/scope.html
fn main() { |
// This is a block, and has a smaller scope than the main function
{
// This binding only exists in this block
let short_lived_binding = 2;
println!("inner short: {}", short_lived_binding);
// This binding *shadows* the outer one
let long_lived_binding = 5_f32;
... | // This binding lives in the main function
let long_lived_binding = 1; | random_line_split |
scope.rs | // https://rustbyexample.com/variable_bindings/scope.html
// http://rust-lang-ja.org/rust-by-example/variable_bindings/scope.html
fn main() | {
// This binding lives in the main function
let long_lived_binding = 1;
// This is a block, and has a smaller scope than the main function
{
// This binding only exists in this block
let short_lived_binding = 2;
println!("inner short: {}", short_lived_binding);
// Thi... | identifier_body | |
index.d.ts | /*
* @license Apache-2.0
*
* Copyright (c) 2019 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. | * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
... | * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* | random_line_split |
components.module.ts | // (C) Copyright 2015 Moodle Pty Ltd.
//
// 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 agree... | {}
| AddonModQuizComponentsModule | identifier_name |
components.module.ts | // (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// | // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.... | random_line_split | |
argument-passing.rs | // run-pass
struct X {
x: isize
}
fn f1(a: &mut X, b: &mut isize, c: isize) -> isize {
let r = a.x + *b + c;
a.x = 0;
*b = 10;
return r;
}
fn | <F>(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; }
pub fn main() {
let mut a = X {x: 1};
let mut b = 2;
let c = 3;
assert_eq!(f1(&mut a, &mut b, c), 6);
assert_eq!(a.x, 0);
assert_eq!(b, 10);
assert_eq!(f2(a.x, |_| a.x = 50), 0);
assert_eq!(a.x, 50);
}
| f2 | identifier_name |
argument-passing.rs | // run-pass
struct X {
x: isize
}
fn f1(a: &mut X, b: &mut isize, c: isize) -> isize { | }
fn f2<F>(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; }
pub fn main() {
let mut a = X {x: 1};
let mut b = 2;
let c = 3;
assert_eq!(f1(&mut a, &mut b, c), 6);
assert_eq!(a.x, 0);
assert_eq!(b, 10);
assert_eq!(f2(a.x, |_| a.x = 50), 0);
assert_eq!(a.x, 50);
} | let r = a.x + *b + c;
a.x = 0;
*b = 10;
return r; | random_line_split |
argument-passing.rs | // run-pass
struct X {
x: isize
}
fn f1(a: &mut X, b: &mut isize, c: isize) -> isize {
let r = a.x + *b + c;
a.x = 0;
*b = 10;
return r;
}
fn f2<F>(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; }
pub fn main() | {
let mut a = X {x: 1};
let mut b = 2;
let c = 3;
assert_eq!(f1(&mut a, &mut b, c), 6);
assert_eq!(a.x, 0);
assert_eq!(b, 10);
assert_eq!(f2(a.x, |_| a.x = 50), 0);
assert_eq!(a.x, 50);
} | identifier_body | |
gray_conversion.py | #!/usr/bin/env python3
html_colors = {
"aliceblue": "f0f8ff",
"antiquewhite": "faebd7",
"aqua": "00ffff",
"aquamarine": "7fffd4",
"azure": "f0ffff",
"beige": "f5f5dc",
"bisque": "ffe4c4",
"black": "000000",
"blanchedalmond": "ffebcd",
"blue": "0000ff",
"blueviolet": "8a2be2"... |
# Input: a hex string like this: "abcdef"
def get_gray_value(hex_str):
# https://stackoverflow.com/a/17619494
gray_value = (
int(hex_str[0:2], 16) / 255.0 * 0.2126
+ int(hex_str[2:4], 16) / 255.0 * 0.7152
+ int(hex_str[4:], 16) / 255.0 * 0.0722
)
if gray_value <= 0.0031308:
... | return html_colors.get(color, None) | identifier_body |
gray_conversion.py | #!/usr/bin/env python3
html_colors = {
"aliceblue": "f0f8ff",
"antiquewhite": "faebd7",
"aqua": "00ffff",
"aquamarine": "7fffd4",
"azure": "f0ffff",
"beige": "f5f5dc",
"bisque": "ffe4c4",
"black": "000000",
"blanchedalmond": "ffebcd",
"blue": "0000ff",
"blueviolet": "8a2be2"... | + int(hex_str[4:], 16) / 255.0 * 0.0722
)
if gray_value <= 0.0031308:
gray_value *= 12.92
else:
gray_value = 1.055 * gray_value ** (1 / 2.4) - 0.055
return gray_value
if __name__ == "__main__":
import os
color_hex_str = get_html_color(os.environ.get("COLOR", "white"))... | # https://stackoverflow.com/a/17619494
gray_value = (
int(hex_str[0:2], 16) / 255.0 * 0.2126
+ int(hex_str[2:4], 16) / 255.0 * 0.7152 | random_line_split |
gray_conversion.py | #!/usr/bin/env python3
html_colors = {
"aliceblue": "f0f8ff",
"antiquewhite": "faebd7",
"aqua": "00ffff",
"aquamarine": "7fffd4",
"azure": "f0ffff",
"beige": "f5f5dc",
"bisque": "ffe4c4",
"black": "000000",
"blanchedalmond": "ffebcd",
"blue": "0000ff",
"blueviolet": "8a2be2"... |
else:
gray_value = 1.055 * gray_value ** (1 / 2.4) - 0.055
return gray_value
if __name__ == "__main__":
import os
color_hex_str = get_html_color(os.environ.get("COLOR", "white")) or "ffffff"
print("Using hex value: ", color_hex_str)
gray_value = get_gray_value(color_hex_str)
pr... | gray_value *= 12.92 | conditional_block |
gray_conversion.py | #!/usr/bin/env python3
html_colors = {
"aliceblue": "f0f8ff",
"antiquewhite": "faebd7",
"aqua": "00ffff",
"aquamarine": "7fffd4",
"azure": "f0ffff",
"beige": "f5f5dc",
"bisque": "ffe4c4",
"black": "000000",
"blanchedalmond": "ffebcd",
"blue": "0000ff",
"blueviolet": "8a2be2"... | (hex_str):
# https://stackoverflow.com/a/17619494
gray_value = (
int(hex_str[0:2], 16) / 255.0 * 0.2126
+ int(hex_str[2:4], 16) / 255.0 * 0.7152
+ int(hex_str[4:], 16) / 255.0 * 0.0722
)
if gray_value <= 0.0031308:
gray_value *= 12.92
else:
gray_value = 1.055 ... | get_gray_value | identifier_name |
AndroidCalendar.js | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class AndroidCalendar extends React.Component {
render() {
if(this.props.bare) {
return <g>
<g>
<path d="M368.005,272h-96v96h96V272z M336.005,64v32h-160V64h-48v32h-24.01c-22.002,0-40,17.998-40,40v272
c0,22.002,1... | };AndroidCalendar.defaultProps = {bare: false} | random_line_split | |
AndroidCalendar.js | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class AndroidCalendar extends React.Component {
| () {
if(this.props.bare) {
return <g>
<g>
<path d="M368.005,272h-96v96h96V272z M336.005,64v32h-160V64h-48v32h-24.01c-22.002,0-40,17.998-40,40v272
c0,22.002,17.998,40,40,40h304.01c22.002,0,40-17.998,40-40V136c0-22.002-17.998-40-40-40h-24V64H336.005z M408.005,408h-304.01
V196h304.01V408z"></path>
</g>
</g>;
... | render | identifier_name |
AndroidCalendar.js | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class AndroidCalendar extends React.Component {
render() {
if(this.props.bare) | return <IconBase>
<g>
<path d="M368.005,272h-96v96h96V272z M336.005,64v32h-160V64h-48v32h-24.01c-22.002,0-40,17.998-40,40v272
c0,22.002,17.998,40,40,40h304.01c22.002,0,40-17.998,40-40V136c0-22.002-17.998-40-40-40h-24V64H336.005z M408.005,408h-304.01
V196h304.01V408z"></path>
</g>
</IconBase>;
}
};AndroidCalenda... | {
return <g>
<g>
<path d="M368.005,272h-96v96h96V272z M336.005,64v32h-160V64h-48v32h-24.01c-22.002,0-40,17.998-40,40v272
c0,22.002,17.998,40,40,40h304.01c22.002,0,40-17.998,40-40V136c0-22.002-17.998-40-40-40h-24V64H336.005z M408.005,408h-304.01
V196h304.01V408z"></path>
</g>
</g>;
} | conditional_block |
users.py | # -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.a... |
return users
| u = User()
u.first_name = fake.first_name()
u.last_name = fake.last_name()
u.email_address = fake.email()
u.password = u.original_password = fake.password()
u.tracking_key = fake.random_number(digits=6)
users.append(u) | conditional_block |
users.py | # -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.a... | (n=50):
fake = Faker(locale='de_DE')
fake.seed(42)
users = []
for i in xrange(n):
u = User()
u.first_name = fake.first_name()
u.last_name = fake.last_name()
u.email_address = fake.email()
u.password = u.original_password = fake.password()
u.tracking_key =... | test_users | identifier_name |
users.py | # -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.a... | return u1
def test_users(n=50):
fake = Faker(locale='de_DE')
fake.seed(42)
users = []
for i in xrange(n):
u = User()
u.first_name = fake.first_name()
u.last_name = fake.last_name()
u.email_address = fake.email()
u.password = u.original_password = fake.passw... | random_line_split | |
users.py | # -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
|
def test_user():
u1 = User()
u1.first_name = u'Example'
u1.last_name = u'User'
u1.email_address = u'example@test.de'
u1.password = u1.original_password = u'test'
u1.tracking_key = 123456
u1.tracking_delay = 2
return u1
def test_users(n=50):
fake = Faker(locale='de_DE')
fake.... | u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.admin = True
return u | identifier_body |
GameData.js | var GameData = {
// --- Begin Pages ----------------------------------------------------------
genderImages: {
male: 'M.jpg',
female: 'F.jpg',
},
raceImages:{
human_male: 'M.H.jpg',
human_female: 'F.H.jpg',
dwarf_male: 'M.D.jpg',
elf_female: 'F.E.jpg',
troll_male: 'M.T.j... |
// --- Mobs -----------------------------------------------------------------
mobSlots: [
{name:'Weapon', slot:'weapon'},
{name:'Armor', slot:'armor'},
],
}; |
currencyMediumIcon: 'icons/medium/inv_misc_coin_16.jpg',
categoryOrder: ['Weapons', 'Armor', 'Equipment', 'Artifacts', 'Tools',
'Potions', 'Food', 'Material'], | random_line_split |
pruning.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... | self.nodes[1].invalidateblock(curhash)
curhash = self.nodes[1].getblockhash(invalidheight - 1)
assert(self.nodes[1].getblockcount() == invalidheight - 1)
print("New best height", self.nodes[1].getblockcount())
# Reboot node1 to clear those giant tx's from mempool
... | curhash = self.nodes[1].getblockhash(invalidheight - 1)
while curhash != mainchainhash: | random_line_split |
pruning.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... | (index):
return os.path.isfile(self.options.tmpdir + "/node{}/regtest/blocks/blk{:05}.dat".format(node_number, index))
# should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
assert_raises_jsonrpc(-1, "Blockchain is too short for pruning", node.pruneblockchain, height... | has_block | identifier_name |
pruning.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... |
# should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
assert_raises_jsonrpc(-1, "Blockchain is too short for pruning", node.pruneblockchain, height(500))
# mine 6 blocks so we are at height 1001 (i.e., above PruneAfterHeight)
node.generate(6)
assert_eq... | return os.path.isfile(self.options.tmpdir + "/node{}/regtest/blocks/blk{:05}.dat".format(node_number, index)) | identifier_body |
pruning.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... |
sync_blocks(self.nodes[0:3], timeout=300)
usage = calc_usage(self.prunedir)
print("Usage should be below target:", usage)
if (usage > 550):
raise AssertionError("Pruning target not being met")
return invalidheight,badhash
def reorg_back(self):
# Verify... | self.nodes[0].generate(10) #node 0 has many large tx's in its mempool from the disconnects | conditional_block |
order.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import with_metaclass
from decimal import Decimal
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models, transaction
from django.db.models.aggregates import Sum
from django.utils.encoding import py... | (self):
return self.get_number()
def __repr__(self):
return "<{}(pk={})>".format(self.__class__.__name__, self.pk)
def get_or_assign_number(self):
"""
Hook to get or to assign the order number. It shall be invoked, every time an Order
object is created. If you prefer to... | __str__ | identifier_name |
order.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import with_metaclass
from decimal import Decimal
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models, transaction
from django.db.models.aggregates import Sum
from django.utils.encoding import py... | """
auto_transition = self._auto_transitions.get(self.status)
if callable(auto_transition):
auto_transition(self)
self._subtotal = BaseOrder.round_amount(self._subtotal)
self._total = BaseOrder.round_amount(self._total)
super(BaseOrder, self).save(**kwargs)
... | def save(self, **kwargs):
"""
Before saving the Order object to the database, round the total to the given decimal_places | random_line_split |
order.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import with_metaclass
from decimal import Decimal
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models, transaction
from django.db.models.aggregates import Sum
from django.utils.encoding import py... |
@cached_property
def subtotal(self):
"""
The summed up amount for all ordered items excluding extra order lines.
"""
return MoneyMaker(self.currency)(self._subtotal)
@cached_property
def total(self):
"""
The final total to charge for this order.
... | """
Hook to get the order number.
"""
return str(self.id) | identifier_body |
order.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import with_metaclass
from decimal import Decimal
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models, transaction
from django.db.models.aggregates import Sum
from django.utils.encoding import py... |
return result
@python_2_unicode_compatible
class BaseOrder(with_metaclass(WorkflowMixinMetaclass, models.Model)):
"""
An Order is the "in process" counterpart of the shopping cart, which freezes the state of the
cart on the moment of purchase. It also holds stuff like the shipping and billing add... | for name, transition in method._django_fsm.transitions.items():
if transition.custom.get('auto'):
result.update({name: method}) | conditional_block |
headers.d.ts | /**
* Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as
* specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class). The only known
* difference from the spec is the lack of an `entries` method.
*/
export declare class | {
_headersMap: Map<string, List<string>>;
constructor(headers?: Headers | StringMap<string, any>);
/**
* Appends a header to existing list of header values for a given header name.
*/
append(name: string, value: string): void;
/**
* Deletes all header values for the given nam... | Headers | identifier_name |
headers.d.ts | /**
* Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as
* specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class). The only known
* difference from the spec is the lack of an `entries` method.
*/
export declare class Headers {
_headersMap: Map... | /**
* Check for existence of header by given name.
*/
has(header: string): boolean;
/**
* Provides names of set headers
*/
keys(): List<string>;
/**
* Sets or overrides header value for given name.
*/
set(header: string, value: string | List<string>): voi... | * Returns first header that matches given name.
*/
get(header: string): string;
| random_line_split |
base.model.ts | module App.Models
{
export class BaseModel implements breeze.Entity
{
//#region Private Static Properties
//#endregion
//#region Public Static Properties
//#endregion
//#region Private Properties
//#endregion
//#region Public Properties
public... | public get viewUrl(): string { throw "Not Implemented"; }
//#endregion
//#region Constructors
//#endregion
//#region Public Static Methods
public static getWipKey(...keys: any[]): string
{
throw "BaseModel.getWipKey: Not implemented.";
}
... | throw "Not Implemented"; }
| identifier_body |
base.model.ts | {
export class BaseModel implements breeze.Entity
{
//#region Private Static Properties
//#endregion
//#region Public Static Properties
//#endregion
//#region Private Properties
//#endregion
//#region Public Properties
public entityAspect: bree... | module App.Models | random_line_split | |
base.model.ts | module App.Models
{
export class BaseModel implements breeze.Entity
{
//#region Private Static Properties
//#endregion
//#region Public Static Properties
//#endregion
//#region Private Properties
//#endregion
//#region Public Properties
public... | : any { throw "Not Implemented"; }
public get viewUrl(): string { throw "Not Implemented"; }
//#endregion
//#region Constructors
//#endregion
//#region Public Static Methods
public static getWipKey(...keys: any[]): string
{
throw "BaseModel.getWipK... | okupValue() | identifier_name |
file-input.js | jQuery( function ( $ )
{ | var frame;
$( 'body' ).on( 'click', '.rwmb-file-input-select', function ( e )
{
e.preventDefault();
var $el = $( this );
// Create a frame only if needed
if ( !frame )
{
frame = wp.media( {
className: 'media-frame rwmb-file-frame',
multiple : false,
title : rwmbFileInput.frameTitle
}... | 'use strict';
| random_line_split |
file-input.js | jQuery( function ( $ )
{
'use strict';
var frame;
$( 'body' ).on( 'click', '.rwmb-file-input-select', function ( e )
{
e.preventDefault();
var $el = $( this );
// Create a frame only if needed
if ( !frame )
|
// Open media uploader
frame.open();
// Remove all attached 'select' event
frame.off( 'select' );
// Handle selection
frame.on( 'select', function ()
{
var url = frame.state().get( 'selection' ).first().toJSON().url;
$el.siblings( 'input' ).val( url ).siblings( 'a' ).removeClass( 'hidden' );
}... | {
frame = wp.media( {
className: 'media-frame rwmb-file-frame',
multiple : false,
title : rwmbFileInput.frameTitle
} );
} | conditional_block |
setup.py | import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
vers... |
raise RuntimeError("Unable to find version string.")
setup(
name='django-constance',
version=find_version("constance", "__init__.py"),
url="http://github.com/jezdez/django-constance",
description='Django live settings with pluggable backends, including Redis.',
long_description=read('README.r... | return version_match.group(1) | conditional_block |
setup.py | import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def | (*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name='django-consta... | find_version | identifier_name |
setup.py | import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
vers... | 'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Progr... | platforms='any',
classifiers=[ | random_line_split |
setup.py | import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
|
setup(
name='django-constance',
version=find_version("constance", "__init__.py"),
url="http://github.com/jezdez/django-constance",
description='Django live settings with pluggable backends, including Redis.',
long_description=read('README.rst'),
author='Jannis Leidel',
author_email='janni... | version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.") | identifier_body |
dx.aspnet.mvc.js | /*!
* DevExtreme (dx.aspnet.mvc.js)
* Version: 20.1.8 (build 20303-1716)
* Build date: Thu Oct 29 2020
*
* Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
! function(factory) {
if ("function" === typeof define && d... | acceptText(bag, chunks.shift());
for (var i = 0; i < chunks.length; i++) {
var tmp = chunks[i].split(enableAlternativeTemplateTags ? EXTENDED_CLOSE_TAG : CLOSE_TAG);
if (2 !== tmp.length) {
throw "Template syntax error"
}
... | }
| random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.