file_name large_stringlengths 4 140 | prefix large_stringlengths 0 12.1k | suffix large_stringlengths 0 12k | middle large_stringlengths 0 7.51k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
surveyRoutes.js | const _ = require("lodash");
const Path = require("path-parser");
const { URL } = require("url");
const mongoose = require("mongoose");
const requireSignIn = require("../middlewares/requireSignIn");
const requireCredits = require("../middlewares/requireCredits");
const Mailer = require("../services/Mailer");
const surv... | res.send({});
});
app.post("/api/surveys", requireSignIn, requireCredits, async (req, res) => {
const { title, subject, body, recipients } = req.body;
const survey = new Survey({
title,
subject,
body,
recipients: recipients.split(",").map(email => ({ email: email.trim() })),
... | random_line_split | |
surveyRoutes.js | const _ = require("lodash");
const Path = require("path-parser");
const { URL } = require("url");
const mongoose = require("mongoose");
const requireSignIn = require("../middlewares/requireSignIn");
const requireCredits = require("../middlewares/requireCredits");
const Mailer = require("../services/Mailer");
const surv... |
})
.compact()
.uniqBy("email", "surveyID")
.each(({ surveyID, email, choice }) => {
Survey.updateOne(
{
_id: surveyID,
recipients: {
$elemMatch: { email: email, responded: false }
}
},
{
$inc: { ... | {
return { email, surveyID: match.surveyID, choice: match.choice };
} | conditional_block |
TestGetDatasetMetadataHandler.py | # $Id: TestAll.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for WebBrick library functions (Functions.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
import sys, unittest, logging, zipfile, re, StringIO, os, logging, cgi
from os.path import normpath, abspath
from rdflib import URIRef
sys.path.append("..... | (select="unit"):
"""
Get test suite
select is one of the following:
"unit" return suite of unit tests only
"component" return suite of unit and component tests
"all" return suite of unit, component and integration tests
"pending" return suite of... | getTestSuite | identifier_name |
TestGetDatasetMetadataHandler.py | # $Id: TestAll.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for WebBrick library functions (Functions.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
import sys, unittest, logging, zipfile, re, StringIO, os, logging, cgi
from os.path import normpath, abspath
from rdflib import URIRef
sys.path.append("..... | TestConfig.setDatasetsBaseDir(".")
TestUtils.runTests("TestGetDatasetMetadataHandler.log", getTestSuite, sys.argv) | conditional_block | |
TestGetDatasetMetadataHandler.py | # $Id: TestAll.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for WebBrick library functions (Functions.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
import sys, unittest, logging, zipfile, re, StringIO, os, logging, cgi
from os.path import normpath, abspath
from rdflib import URIRef
sys.path.append("..... | import GetDatasetMetadataHandler, ManifestRDFUtils, SubmitDatasetUtils, TestConfig
from MiscLib import TestUtils
Logger = logging.getLogger("TestGetDatasetMetadataHandler")
class TestGetDatasetMetadataHandler(unittest.TestCase):
def setUp(self):
return
def tearDown(self):
return
... | import simplejson as json
except ImportError:
import json as json
| random_line_split |
TestGetDatasetMetadataHandler.py | # $Id: TestAll.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for WebBrick library functions (Functions.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
import sys, unittest, logging, zipfile, re, StringIO, os, logging, cgi
from os.path import normpath, abspath
from rdflib import URIRef
sys.path.append("..... |
def tearDown(self):
return
# Tests
# Test that the GetMetResponse
def testGetDatasetMetadataResponse(self):
outputStr = StringIO.StringIO()
# Create a manifest file from mocked up form data
ManifestRDFUtils.writeToManifestFile(TestConfig.Ma... | return | identifier_body |
lib.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 ... | {
use std::hash::Hasher;
let mut hasher = hash::SipHasher::new();
x.hash(&mut hasher);
hasher.finish()
} | identifier_body | |
lib.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 ... | //! ```
//! extern crate num;
//! # #[cfg(all(feature = "bigint", feature="rational"))]
//! # mod test {
//!
//! use num::FromPrimitive;
//! use num::bigint::BigInt;
//! use num::rational::{Ratio, BigRational};
//!
//! # pub
//! fn approx_sqrt(number: u64, iterations: usize) -> BigRational {
//! let start: Ratio<Bi... | //! This example uses the BigRational type and [Newton's method][newt] to
//! approximate a square root to arbitrary precision:
//! | random_line_split |
lib.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 ... |
while exp & 1 == 0 {
base = base.clone() * base;
exp >>= 1;
}
if exp == 1 { return base }
let mut acc = base.clone();
while exp > 1 {
exp >>= 1;
base = base.clone() * base;
if exp & 1 == 1 {
acc = acc * base.clone();
}
}
acc
}
#... | { return T::one() } | conditional_block |
lib.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: One>() -> T { One::one() }
/// Computes the absolute value.
///
/// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`
///
/// For signed integers, `::MIN` will be returned if the number is `::MIN`.
#[inline(always)]
pub fn abs<T: Signed>(value: T) -> T {
value.abs()
}
/// The positive differe... | one | identifier_name |
rison.js | var rison = exports;
//////////////////////////////////////////////////
//
// the stringifier is based on
// http://json.org/json.js as of 2006-04-28 from json.org
// the parser is based on
// http://osteele.com/sources/openlaszlo/json
//
if (typeof rison == 'undefined')
window.rison = {};
/**
* rules... | // Browser globals
factory((root.rison = {}));
}
}(this, function (exports) { | random_line_split | |
rison.js | ';
return '!f'
},
'null': function (x) {
return "!n";
},
number: function (x) {
if (!isFinite(x))
return '!n';
// strip '+' out of exponent, '-' is ok though
return String(... | {
//if (i == s.length) return this.error('unmatched "\'"');
if (!c) return this.error('unmatched "\'"');
if (c == '!') {
if (start < i-1)
segments.push(s.slice(start, i-1));
c = s.charAt(i++);
if ("!'".indexOf(c) >= ... | conditional_block | |
wait-for-element-to-be-removed.js | import {waitFor} from './wait-for'
const isRemoved = result => !result || (Array.isArray(result) && !result.length)
// Check if the element is not present.
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
function initialCheck(elements) {
if (isRemoved(elements)) { | throw new Error(
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
)
}
}
async function waitForElementToBeRemoved(callback, options) {
// created here so we get a nice stacktrace
cons... | random_line_split | |
wait-for-element-to-be-removed.js | import {waitFor} from './wait-for'
const isRemoved = result => !result || (Array.isArray(result) && !result.length)
// Check if the element is not present.
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
function initialCheck(elements) |
async function waitForElementToBeRemoved(callback, options) {
// created here so we get a nice stacktrace
const timeoutError = new Error('Timed out in waitForElementToBeRemoved.')
if (typeof callback !== 'function') {
initialCheck(callback)
const elements = Array.isArray(callback) ? callback : [callback... | {
if (isRemoved(elements)) {
throw new Error(
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
)
}
} | identifier_body |
wait-for-element-to-be-removed.js | import {waitFor} from './wait-for'
const isRemoved = result => !result || (Array.isArray(result) && !result.length)
// Check if the element is not present.
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
function | (elements) {
if (isRemoved(elements)) {
throw new Error(
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
)
}
}
async function waitForElementToBeRemoved(callback, options) {
// creat... | initialCheck | identifier_name |
wait-for-element-to-be-removed.js | import {waitFor} from './wait-for'
const isRemoved = result => !result || (Array.isArray(result) && !result.length)
// Check if the element is not present.
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
function initialCheck(elements) {
if (isRemoved(elements)) {
throw ne... |
initialCheck(callback())
return waitFor(() => {
let result
try {
result = callback()
} catch (error) {
if (error.name === 'TestingLibraryElementError') {
return undefined
}
throw error
}
if (!isRemoved(result)) {
throw timeoutError
}
return undefi... | {
initialCheck(callback)
const elements = Array.isArray(callback) ? callback : [callback]
const getRemainingElements = elements.map(element => {
let parent = element.parentElement
if (parent === null) return () => null
while (parent.parentElement) parent = parent.parentElement
return... | conditional_block |
Robot.py | import constants as c
from gui.windows import VideoStream
import socket
import cv2
import urllib
import numpy as np
class Robot(object):
def __init__(self, connection):
self.connection = connection
""" @type : Connections.ConnectionProcessEnd.RobotConnection """ | self.socket = None
self.stream = None
self.bytes = None
self.window = None
self.psychopy_disabled = None
self.stream_enabled = None
self.target_to_command = None
self.connection.waitMessages(self.start, self.exit, self.update, self.setup, self.sendMessage,... | random_line_split | |
Robot.py | import constants as c
from gui.windows import VideoStream
import socket
import cv2
import urllib
import numpy as np
class Robot(object):
def __init__(self, connection):
self.connection = connection
""" @type : Connections.ConnectionProcessEnd.RobotConnection """
self.socket = None
... |
def exitWindow(self):
if self.window is not None:
self.window.exitFlag = True
self.window.exit()
def update(self):
self.updateVideo()
self.updateWindow()
def exit(self):
self.exitWindow()
self.connection.close()
def sendRobotMessage(se... | if self.window is not None:
self.window.update() | identifier_body |
Robot.py | import constants as c
from gui.windows import VideoStream
import socket
import cv2
import urllib
import numpy as np
class Robot(object):
def __init__(self, connection):
self.connection = connection
""" @type : Connections.ConnectionProcessEnd.RobotConnection """
self.socket = None
... |
elif isinstance(message, basestring):
return message
else:
print("Robot message: " + str(message))
def updateVideo(self):
if self.stream_enabled:
if self.stream is not None:
self.bytes += self.stream.read(1... | self.sendMessage(message) | conditional_block |
Robot.py | import constants as c
from gui.windows import VideoStream
import socket
import cv2
import urllib
import numpy as np
class Robot(object):
def __init__(self, connection):
self.connection = connection
""" @type : Connections.ConnectionProcessEnd.RobotConnection """
self.socket = None
... | (self):
if self.stream_enabled:
if self.stream is not None:
self.bytes += self.stream.read(1024)
a = self.bytes.find('\xff\xd8')
b = self.bytes.find('\xff\xd9')
if a != -1 and b != -1:
jpg = self.bytes[a:b+2]
... | updateVideo | identifier_name |
main.rs | extern crate serenity;
use serenity::prelude::*;
use serenity::model::*;
use std::env;
struct Handler;
impl EventHandler for Handler {
// Set a handler for the `on_message` event - so that whenever a new message
// is received - the closure (or function) passed will be called.
//
// Event handlers ar... |
}
// Set a handler to be called on the `on_ready` event. This is called when a
// shard is booted, and a READY payload is sent by Discord. This payload
// contains data like the current user's guild Ids, current user data,
// private channels, and more.
//
// In this case, just print what ... | {
// Sending a message can fail, due to a network error, an
// authentication error, or lack of permissions to post in the
// channel, so log to stdout when some error happens, with a
// description of it.
if let Err(why) = msg.channel_id.say("Pong!") {
... | conditional_block |
main.rs | extern crate serenity;
use serenity::prelude::*;
use serenity::model::*;
use std::env;
struct Handler;
impl EventHandler for Handler {
// Set a handler for the `on_message` event - so that whenever a new message
// is received - the closure (or function) passed will be called.
//
// Event handlers ar... | (&self, _: Context, msg: Message) {
if msg.content == "!ping" {
// Sending a message can fail, due to a network error, an
// authentication error, or lack of permissions to post in the
// channel, so log to stdout when some error happens, with a
// description of ... | on_message | identifier_name |
main.rs | extern crate serenity;
use serenity::prelude::*;
use serenity::model::*;
use std::env;
struct Handler;
impl EventHandler for Handler {
// Set a handler for the `on_message` event - so that whenever a new message
// is received - the closure (or function) passed will be called.
//
// Event handlers ar... |
// Set a handler to be called on the `on_ready` event. This is called when a
// shard is booted, and a READY payload is sent by Discord. This payload
// contains data like the current user's guild Ids, current user data,
// private channels, and more.
//
// In this case, just print what the cu... | {
if msg.content == "!ping" {
// Sending a message can fail, due to a network error, an
// authentication error, or lack of permissions to post in the
// channel, so log to stdout when some error happens, with a
// description of it.
if let Err(why) = ... | identifier_body |
main.rs | extern crate serenity;
use serenity::prelude::*;
use serenity::model::*;
use std::env;
struct Handler;
impl EventHandler for Handler {
// Set a handler for the `on_message` event - so that whenever a new message
// is received - the closure (or function) passed will be called.
//
// Event handlers ar... | // Set a handler to be called on the `on_ready` event. This is called when a
// shard is booted, and a READY payload is sent by Discord. This payload
// contains data like the current user's guild Ids, current user data,
// private channels, and more.
//
// In this case, just print what the curr... | random_line_split | |
BestBuyWebService.js | export default class BestBuyWebService{
constructor(){
this.url ="";
this.apiKey = "";
this.productData = null;
this.products = null;
}
getData(theApp){
// theApp is a reference to the main app
// we can pass information to it, including data
// tha... |
getProducts(){
// this method explicity gets the products property
// from the JSON object. it assumes you have the JSON data
if(this.productData!=null){
let jsonData = JSON.parse(this.productData);
this.products = jsonData.products;
return this.products;
... | {
if (evt.target.readyState == 4 && evt.target.status == 200){
// assign this instance's productData to be the responseText
this.productData = evt.target.responseText;
// assign the app's productData to be the responseText too
theApp.productData = evt.target.resp... | identifier_body |
BestBuyWebService.js | export default class BestBuyWebService{
constructor(){
this.url ="";
this.apiKey = "";
this.productData = null;
this.products = null;
}
getData(theApp){
// theApp is a reference to the main app
// we can pass information to it, including data
// tha... | (theApp){
/*the addEventListener function near line 29 requires a proper function (an event handler) to be returned so we can create one to be returned.
*/
let thisService = this; // a reference to the instance created from this class
let eventHandler = function(evt){
thisSer... | resultsPreprocessor | identifier_name |
BestBuyWebService.js | export default class BestBuyWebService{
constructor(){
this.url ="";
this.apiKey = "";
this.productData = null;
this.products = null;
}
getData(theApp){
// theApp is a reference to the main app
// we can pass information to it, including data
// tha... |
return; // if we have no data, return nothing
}
}
| {
let jsonData = JSON.parse(this.productData);
this.products = jsonData.products;
return this.products;
} | conditional_block |
BestBuyWebService.js | export default class BestBuyWebService{
constructor(){
this.url ="";
this.apiKey = "";
this.productData = null;
this.products = null;
}
getData(theApp){
// theApp is a reference to the main app
// we can pass information to it, including data
// tha... | /*the addEventListener function near line 29 requires a proper function (an event handler) to be returned so we can create one to be returned.
*/
let thisService = this; // a reference to the instance created from this class
let eventHandler = function(evt){
thisService.resul... | }
resultsPreprocessor(theApp){ | random_line_split |
bin.rs | #[macro_use]
extern crate malachite_base_test_util;
extern crate malachite_nz;
extern crate malachite_nz_test_util;
extern crate malachite_q;
extern crate serde;
extern crate serde_json;
use crate::demo_and_bench::register;
use malachite_base_test_util::runner::cmd::read_command_line_arguments;
use malachite_base_test... |
mod demo_and_bench; | } | random_line_split |
bin.rs | #[macro_use]
extern crate malachite_base_test_util;
extern crate malachite_nz;
extern crate malachite_nz_test_util;
extern crate malachite_q;
extern crate serde;
extern crate serde_json;
use crate::demo_and_bench::register;
use malachite_base_test_util::runner::cmd::read_command_line_arguments;
use malachite_base_test... | () {
let args = read_command_line_arguments("malachite-q test utils");
let mut runner = Runner::new();
register(&mut runner);
if let Some(demo_key) = args.demo_key {
runner.run_demo(&demo_key, args.generation_mode, args.config, args.limit);
} else if let Some(bench_key) = args.bench_key {
... | main | identifier_name |
bin.rs | #[macro_use]
extern crate malachite_base_test_util;
extern crate malachite_nz;
extern crate malachite_nz_test_util;
extern crate malachite_q;
extern crate serde;
extern crate serde_json;
use crate::demo_and_bench::register;
use malachite_base_test_util::runner::cmd::read_command_line_arguments;
use malachite_base_test... | else {
panic!();
}
}
mod demo_and_bench;
| {
runner.run_bench(
&bench_key,
args.generation_mode,
args.config,
args.limit,
&args.out,
);
} | conditional_block |
bin.rs | #[macro_use]
extern crate malachite_base_test_util;
extern crate malachite_nz;
extern crate malachite_nz_test_util;
extern crate malachite_q;
extern crate serde;
extern crate serde_json;
use crate::demo_and_bench::register;
use malachite_base_test_util::runner::cmd::read_command_line_arguments;
use malachite_base_test... |
mod demo_and_bench;
| {
let args = read_command_line_arguments("malachite-q test utils");
let mut runner = Runner::new();
register(&mut runner);
if let Some(demo_key) = args.demo_key {
runner.run_demo(&demo_key, args.generation_mode, args.config, args.limit);
} else if let Some(bench_key) = args.bench_key {
... | identifier_body |
setup.py | import codecs
import os
from setuptools import setup, find_packages
def read(filename):
|
setup(
name='lemon-filebrowser',
version='0.1.2',
license='ISC',
description="Fork of Patrick Kranzlmueller's django-filebrowser app.",
url='https://github.com/trilan/lemon-filebrowser',
author='Trilan Team',
author_email='dev@lemon.io',
packages=find_packages(exclude=['tests', 'tests... | filepath = os.path.join(os.path.dirname(__file__), filename)
return codecs.open(filepath, encoding='utf-8').read() | identifier_body |
setup.py | import codecs
import os
from setuptools import setup, find_packages
def | (filename):
filepath = os.path.join(os.path.dirname(__file__), filename)
return codecs.open(filepath, encoding='utf-8').read()
setup(
name='lemon-filebrowser',
version='0.1.2',
license='ISC',
description="Fork of Patrick Kranzlmueller's django-filebrowser app.",
url='https://github.com/tri... | read | identifier_name |
setup.py | import codecs
import os
from setuptools import setup, find_packages
def read(filename):
filepath = os.path.join(os.path.dirname(__file__), filename)
return codecs.open(filepath, encoding='utf-8').read()
| version='0.1.2',
license='ISC',
description="Fork of Patrick Kranzlmueller's django-filebrowser app.",
url='https://github.com/trilan/lemon-filebrowser',
author='Trilan Team',
author_email='dev@lemon.io',
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
... |
setup(
name='lemon-filebrowser', | random_line_split |
home.ts | import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
import {ROUTER_DIRECTIVES} from 'angular2/router';
import UserRepo from '../../services/repositories/user_repo';
import User from '../../services/models/user';
import {Alert} from '../../ng2-bootstrap/alert/alert';
@Component({
selector: 'home'
})
... | } | random_line_split | |
home.ts | import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
import {ROUTER_DIRECTIVES} from 'angular2/router';
import UserRepo from '../../services/repositories/user_repo';
import User from '../../services/models/user';
import {Alert} from '../../ng2-bootstrap/alert/alert';
@Component({
selector: 'home'
})
... | () {
this.alertOpened = !this.alertOpened;
}
}
| toggle | identifier_name |
home.ts | import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
import {ROUTER_DIRECTIVES} from 'angular2/router';
import UserRepo from '../../services/repositories/user_repo';
import User from '../../services/models/user';
import {Alert} from '../../ng2-bootstrap/alert/alert';
@Component({
selector: 'home'
})
... |
}
| {
this.alertOpened = !this.alertOpened;
} | identifier_body |
1_7_active_tag_2b29f533fdfc.py | """1.7 : Add active tags to expense types and tva
Revision ID: 2b29f533fdfc
Revises: 4ce6b915de98
Create Date: 2013-09-03 16:05:22.824684
"""
# revision identifiers, used by Alembic.
revision = '2b29f533fdfc'
down_revision = '4ce6b915de98'
from alembic import op
import sqlalchemy as sa
def upgrade():
try:
... |
def downgrade():
op.drop_column("expense_type", "active")
op.drop_column("tva", "active") | sa.Boolean(),
default=True,
server_default=sa.sql.expression.true())
op.add_column("tva", col) | random_line_split |
1_7_active_tag_2b29f533fdfc.py | """1.7 : Add active tags to expense types and tva
Revision ID: 2b29f533fdfc
Revises: 4ce6b915de98
Create Date: 2013-09-03 16:05:22.824684
"""
# revision identifiers, used by Alembic.
revision = '2b29f533fdfc'
down_revision = '4ce6b915de98'
from alembic import op
import sqlalchemy as sa
def upgrade():
|
def downgrade():
op.drop_column("expense_type", "active")
op.drop_column("tva", "active")
| try:
col = sa.Column('active',
sa.Boolean(),
default=True,
server_default=sa.sql.expression.true())
op.add_column("expense_type", col)
except:
print "The column already exists"
col = sa.Column('active',
sa.Boolean(),
... | identifier_body |
1_7_active_tag_2b29f533fdfc.py | """1.7 : Add active tags to expense types and tva
Revision ID: 2b29f533fdfc
Revises: 4ce6b915de98
Create Date: 2013-09-03 16:05:22.824684
"""
# revision identifiers, used by Alembic.
revision = '2b29f533fdfc'
down_revision = '4ce6b915de98'
from alembic import op
import sqlalchemy as sa
def | ():
try:
col = sa.Column('active',
sa.Boolean(),
default=True,
server_default=sa.sql.expression.true())
op.add_column("expense_type", col)
except:
print "The column already exists"
col = sa.Column('active',
sa.Boolean(),
... | upgrade | identifier_name |
main.py | #-------------------------------------------------------------------------------
# Name: Main.py
# Purpose: This script creates chainages from a single or mutile line
#
# Author: smithc5
#
# Created: 10/02/2015
# Copyright: (c) smithc5 2015
# Licence: <your licence>
#------------------------... | ():
try:
create_chainages.check_if_gdb_exist(DATABASE_FLIEPATH)
create_chainages.create_gdb(database_location, database_name)
create_chainages.copy_features(source_align_location, new_fc_filepath)
create_chainages.create_route(new_fc_filepath, "Name", new_fc_filepath_with_m)
... | main | identifier_name |
main.py | #-------------------------------------------------------------------------------
# Name: Main.py
# Purpose: This script creates chainages from a single or mutile line
#
# Author: smithc5
#
# Created: 10/02/2015
# Copyright: (c) smithc5 2015
# Licence: <your licence>
#------------------------... |
def main():
try:
create_chainages.check_if_gdb_exist(DATABASE_FLIEPATH)
create_chainages.create_gdb(database_location, database_name)
create_chainages.copy_features(source_align_location, new_fc_filepath)
create_chainages.create_route(new_fc_filepath, "Name", new_fc_filepath_w... | chainage_feature_class = "{0}_Chainages".format(new_fc_filepath)
# This is the output feature class to store the chainages.
| random_line_split |
main.py | #-------------------------------------------------------------------------------
# Name: Main.py
# Purpose: This script creates chainages from a single or mutile line
#
# Author: smithc5
#
# Created: 10/02/2015
# Copyright: (c) smithc5 2015
# Licence: <your licence>
#------------------------... | main() | conditional_block | |
main.py | #-------------------------------------------------------------------------------
# Name: Main.py
# Purpose: This script creates chainages from a single or mutile line
#
# Author: smithc5
#
# Created: 10/02/2015
# Copyright: (c) smithc5 2015
# Licence: <your licence>
#------------------------... | pymsg = "PYTHON ERRORS:\nTraceback Info:\n{0}\nError Info:\n {1}: {2}\n".format(tbinfo,
str(sys.exc_type),
str(sys.exc_val... | try:
create_chainages.check_if_gdb_exist(DATABASE_FLIEPATH)
create_chainages.create_gdb(database_location, database_name)
create_chainages.copy_features(source_align_location, new_fc_filepath)
create_chainages.create_route(new_fc_filepath, "Name", new_fc_filepath_with_m)
cre... | identifier_body |
calendar.js | dhtmlXForm.prototype.items.calendar = {
render: function(item, data) {
var t = this;
item._type = "calendar";
item._enabled = true;
this.doAddLabel(item, data);
this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea");
item.childNodes[item._ll?1:0].childNodes[0... |
}
// accepted
item._value = d;
t.setValue(item, d);
item.callEvent("onChange", [this._itemIdd, item._value]);
}
return true;
});
this.setValue(item, data.value);
return this;
},
getCalendar: function(item) {
return item._c;
},
setSkin: functio... | {
return false;
} | conditional_block |
calendar.js | dhtmlXForm.prototype.items.calendar = {
render: function(item, data) {
var t = this;
item._type = "calendar";
item._enabled = true;
this.doAddLabel(item, data);
this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea");
item.childNodes[item._ll?1:0].childNodes[0... |
item._f = null;
try {delete item._f;} catch(e){}
item._f0 = null;
try {delete item._f0;} catch(e){}
// remove custom events/objects
item.childNodes[item._ll?1:0].childNodes[0]._idd = null;
// unload item
this.d2(item);
item = null;
}
};
(function(){
for (var a in {do... | item._c.unload();
item._c = null;
try {delete item._c;} catch(e){}
| random_line_split |
length_expr.rs | // Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com> | // option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: Only field names, constants, integers, basic arithmetic expressions (+ - * / %) and parentheses are allowed in the "length" attribute
#![feature(custom_attribute, plugin)]
#![plugin(pnet_macros)]
ex... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | random_line_split |
length_expr.rs | // Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or... | {} | identifier_body | |
length_expr.rs | // Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or... | () {}
| main | identifier_name |
string_renderer.ts | //
// Copyright 2017-21 Volker Sorge
//
// 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... | (descrs: AuditoryDescription[]) {
let str = '';
const markup = personalityMarkup(descrs);
const clean = markup.filter((x) => x.span);
if (!clean.length) {
return str;
}
const len = clean.length - 1;
for (let i = 0, descr; (descr = clean[i]); i++) {
if (descr.span) {
str +... | markup | identifier_name |
string_renderer.ts | //
// Copyright 2017-21 Volker Sorge
//
// 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... | }
return str;
}
} | continue;
}
const join = descr.join;
str += typeof join === 'undefined' ? this.getSeparator() : join; | random_line_split |
string_renderer.ts | //
// Copyright 2017-21 Volker Sorge
//
// 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... |
if (i >= len) {
continue;
}
const join = descr.join;
str += typeof join === 'undefined' ? this.getSeparator() : join;
}
return str;
}
}
| {
str += this.merge(descr.span);
} | conditional_block |
heroes.component.ts | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero } from './hero';
import { HeroService } from './hero.service';
@Component ({
moduleId: module.id,
selector: 'my-heroes',
templateUrl: 'heroes.component.html',
styleUrls: [ 'heroes.component.css' ... | this.router.navigate(['/detail', this.selectedHero.id]);
}
add(name: string): void {
name = name.trim();
if (!name) { return; }
this.heroService.create(name)
.then(hero => {
this.heroes.push(hero);
this.selectedHero = null;
});
... |
gotoDetail(): void { | random_line_split |
heroes.component.ts | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero } from './hero';
import { HeroService } from './hero.service';
@Component ({
moduleId: module.id,
selector: 'my-heroes',
templateUrl: 'heroes.component.html',
styleUrls: [ 'heroes.component.css' ... |
});
}
} | { this.selectedHero = null; } | conditional_block |
heroes.component.ts | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero } from './hero';
import { HeroService } from './hero.service';
@Component ({
moduleId: module.id,
selector: 'my-heroes',
templateUrl: 'heroes.component.html',
styleUrls: [ 'heroes.component.css' ... | (
private router: Router,
private heroService: HeroService) { }
getHeroes(): void {
this.heroService.getHeroes().then(heroes => this.heroes = heroes);
}
ngOnInit(): void {
this.getHeroes();
}
onSelect(hero: Hero): void {
this.selectedHero = hero;
... | constructor | identifier_name |
heroes.component.ts | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero } from './hero';
import { HeroService } from './hero.service';
@Component ({
moduleId: module.id,
selector: 'my-heroes',
templateUrl: 'heroes.component.html',
styleUrls: [ 'heroes.component.css' ... |
delete(hero: Hero): void {
this.heroService
.delete(hero.id)
.then(() => {
this.heroes = this.heroes.filter(h => h !== hero);
if (this.selectedHero === hero) { this.selectedHero = null; }
});
}
} | {
name = name.trim();
if (!name) { return; }
this.heroService.create(name)
.then(hero => {
this.heroes.push(hero);
this.selectedHero = null;
});
} | identifier_body |
org-groups.js | import React, { Component, Fragment } from 'react';
import { navigate } from '@reach/router';
import PropTypes from 'prop-types';
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
import { siteRoot, gettext, orgID } from '../../utils/constants';
import { seafileAPI } from '../../utils/s... | extends Component {
constructor(props) {
super(props);
this.state = {
page: 1,
pageNext: false,
orgGroups: [],
isItemFreezed: false
};
}
componentDidMount() {
let page = this.state.page;
this.initData(page);
}
initData = (page) => {
seafileAPI.orgAdminListOr... | OrgGroups | identifier_name |
org-groups.js | import React, { Component, Fragment } from 'react';
import { navigate } from '@reach/router';
import PropTypes from 'prop-types';
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
import { siteRoot, gettext, orgID } from '../../utils/constants';
import { seafileAPI } from '../../utils/s... | placeholder={this.props.placeholder}
value={this.state.value}
onChange={this.handleInputChange}
onKeyPress={this.handleKeyPress}
autoComplete="off"
/>
</div>
);
}
}
class OrgGroups extends Component {
constructor(props) {
super(props);
th... | <i className="d-flex input-icon-addon fas fa-search"></i>
<input
type="text"
className="form-control search-input h-6 mr-1"
style={{width: '15rem'}} | random_line_split |
org-groups.js | import React, { Component, Fragment } from 'react';
import { navigate } from '@reach/router';
import PropTypes from 'prop-types';
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
import { siteRoot, gettext, orgID } from '../../utils/constants';
import { seafileAPI } from '../../utils/s... |
this.initData(page);
}
onFreezedItem = () => {
this.setState({isItemFreezed: true});
}
onUnfreezedItem = () => {
this.setState({isItemFreezed: false});
}
deleteGroupItem = (group) => {
seafileAPI.orgAdminDeleteOrgGroup(orgID, group.id).then(res => {
this.setState({
orgGroup... | {
page = page - 1;
} | conditional_block |
lib.rs | // =================================================================
//
// * WARNING *
//
// This file is generated!
//
// Changes made to this file will be overwritten. If changes are | // must be updated to generate the changes.
//
// =================================================================
#![doc(html_logo_url = "https://raw.githubusercontent.com/rusoto/rusoto/master/assets/logo-square.png")]
//! <p>Use the AWS Elemental MediaTailor SDK to configure scalable ad insertion for your live and... | // required to the generated code, the service_crategen project | random_line_split |
run.py | """
Current driven domain-wall motion with constant current and spin accumulation.
"""
# Copyright (C) 2011-2015 Claas Abert
#
# This file is part of magnum.fe.
#
# magnum.fe is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Fre... | # You should have received a copy of the GNU Lesser General Public License
# along with magnum.fe. If not, see <http://www.gnu.org/licenses/>.
#
# Last modified by Claas Abert, 2015-02-16
from magnumfe import *
#######################################
#### DEFINE MESH, STATE AND MATERIAL
#############################... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# | random_line_split |
run.py | """
Current driven domain-wall motion with constant current and spin accumulation.
"""
# Copyright (C) 2011-2015 Claas Abert
#
# This file is part of magnum.fe.
#
# magnum.fe is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Fre... | if j % 10 == 0:
mfile << (state.m, state.t)
sfile << (state.s, state.t)
# calculate next step
state.step([llg, spindiff], 1e-12) | conditional_block | |
useQuietPeriod.hook.ts | import { REST } from '../../api';
import { useLatestPromise } from '../../presentation';
// Shape from back end
interface IQuietPeriodConfig {
startTime: number;
endTime: number;
enabled: boolean;
// Do not use in UI -- point-in-time data from back-end
inQuietPeriod: boolean;
}
class QuietPeriodService {
... | }
const { startTime, endTime, enabled } = result.result;
if (!enabled || !startTime || startTime < 0 || !endTime || endTime < 0) {
return { currentStatus: 'NO_QUIET_PERIOD', startTime: undefined, endTime: undefined };
}
const now = Date.now();
const currentStatus =
now < startTime ? 'BEFORE_QUIET_... | if (result.status !== 'RESOLVED') {
return { currentStatus: 'UNKNOWN', startTime: undefined, endTime: undefined }; | random_line_split |
useQuietPeriod.hook.ts | import { REST } from '../../api';
import { useLatestPromise } from '../../presentation';
// Shape from back end
interface IQuietPeriodConfig {
startTime: number;
endTime: number;
enabled: boolean;
// Do not use in UI -- point-in-time data from back-end
inQuietPeriod: boolean;
}
class QuietPeriodService {
... | (): IQuietPeriod {
const result = useLatestPromise(() => QuietPeriodService.quietPeriodConfig(), []);
if (result.status !== 'RESOLVED') {
return { currentStatus: 'UNKNOWN', startTime: undefined, endTime: undefined };
}
const { startTime, endTime, enabled } = result.result;
if (!enabled || !startTime || s... | useQuietPeriod | identifier_name |
useQuietPeriod.hook.ts | import { REST } from '../../api';
import { useLatestPromise } from '../../presentation';
// Shape from back end
interface IQuietPeriodConfig {
startTime: number;
endTime: number;
enabled: boolean;
// Do not use in UI -- point-in-time data from back-end
inQuietPeriod: boolean;
}
class QuietPeriodService {
... | {
const result = useLatestPromise(() => QuietPeriodService.quietPeriodConfig(), []);
if (result.status !== 'RESOLVED') {
return { currentStatus: 'UNKNOWN', startTime: undefined, endTime: undefined };
}
const { startTime, endTime, enabled } = result.result;
if (!enabled || !startTime || startTime < 0 || !... | identifier_body | |
useQuietPeriod.hook.ts | import { REST } from '../../api';
import { useLatestPromise } from '../../presentation';
// Shape from back end
interface IQuietPeriodConfig {
startTime: number;
endTime: number;
enabled: boolean;
// Do not use in UI -- point-in-time data from back-end
inQuietPeriod: boolean;
}
class QuietPeriodService {
... |
const now = Date.now();
const currentStatus =
now < startTime ? 'BEFORE_QUIET_PERIOD' : now > endTime ? 'AFTER_QUIET_PERIOD' : 'DURING_QUIET_PERIOD';
return { currentStatus, startTime, endTime };
}
| {
return { currentStatus: 'NO_QUIET_PERIOD', startTime: undefined, endTime: undefined };
} | conditional_block |
issue-17913.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. | // option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: too big for the current architecture
#![feature(box_syntax)]
#[cfg(target_pointer_width = "64")]
fn main() {
let n = 0_usize;
let a: Box<_> = box [&n; 0xF000000000000000_usize];
println... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | random_line_split |
issue-17913.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 ... |
#[cfg(target_pointer_width = "32")]
fn main() {
let n = 0_usize;
let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
println!("{}", a[0xFFFFFF_usize]);
}
| {
let n = 0_usize;
let a: Box<_> = box [&n; 0xF000000000000000_usize];
println!("{}", a[0xFFFFFF_usize]);
} | identifier_body |
issue-17913.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 ... | () {
let n = 0_usize;
let a: Box<_> = box [&n; 0xF000000000000000_usize];
println!("{}", a[0xFFFFFF_usize]);
}
#[cfg(target_pointer_width = "32")]
fn main() {
let n = 0_usize;
let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
println!("{}", a[0xFFFFFF_usize]);
}
| main | identifier_name |
ganeti.mcpu_unittest.py | # documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED... |
def testDifferentMode(self):
for level in [locking.LEVEL_NODE, locking.LEVEL_NODE_RES]:
lu = _FakeLuWithLocks({
level: ["foo"],
}, {
level: 0,
locking.LEVEL_NODE_ALLOC: 1,
})
glm = _FakeGlm(False)
try:
mcpu._VerifyLocks(lu, glm, _mode_whitelist=[... | for level in [locking.LEVEL_NODE, locking.LEVEL_NODE_RES]:
lu = _FakeLuWithLocks({
level: ["foo"],
}, {
level: 0,
locking.LEVEL_NODE_ALLOC: 0,
})
glm = _FakeGlm(False)
mcpu._VerifyLocks(lu, glm, _mode_whitelist=[], _nal_whitelist=[]) | identifier_body |
ganeti.mcpu_unittest.py | documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.... | (self, level):
return False
class TestVerifyLocks(unittest.TestCase):
def testNoLocks(self):
lu = _FakeLuWithLocks({}, {})
glm = _FakeGlm(False)
mcpu._VerifyLocks(lu, glm,
_mode_whitelist=NotImplemented,
_nal_whitelist=NotImplemented)
def testNotAllSame... | owning_all | identifier_name |
ganeti.mcpu_unittest.py | # documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED... | self.assertTrue("OP_TEST_DUMMY" in op.comment)
self.assertFalse(hasattr(op, "priority"))
self.assertFalse(hasattr(op, "debug_level"))
def testParams(self):
src = opcodes.OpTestDummy(priority=constants.OP_PRIO_HIGH,
debug_level=3)
res = mcpu._ProcessResult(self... | self.assertRaises(IndexError, self._submitted.pop)
for op in [op1, op2, op3]: | random_line_split |
ganeti.mcpu_unittest.py | # documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED... |
self.assertTrue(opcls in mcpu.Processor.DISPATCH_TABLE,
msg="%s missing handler class" % opcls)
# Check against BGL whitelist
lucls = mcpu.Processor.DISPATCH_TABLE[opcls]
if lucls.REQ_BGL:
self.assertTrue(opcls in REQ_BGL_WHITELIST,
msg=("%... | continue | conditional_block |
pilconvert.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97... |
if len(sys.argv) == 1:
usage()
try:
opt, argv = getopt.getopt(sys.argv[1:], "c:dfgopq:r")
except getopt.error as v:
print(v)
sys.exit(1)
output_format = None
convert = None
options = {}
for o, a in opt:
if o == "-f":
Image.init()
id = sorted(Image.ID)
print("Supported ... | print("PIL Convert 0.5/1998-12-30 -- convert image files")
print("Usage: pilconvert [option] infile outfile")
print()
print("Options:")
print()
print(" -c <format> convert to format (default is given by extension)")
print()
print(" -g convert to greyscale")
print(" -p ... | identifier_body |
pilconvert.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97... | print("cannot convert image", end=' ')
print("(%s:%s)" % (sys.exc_info()[0], sys.exc_info()[1])) | if output_format:
im.save(argv[1], output_format, **options)
else:
im.save(argv[1], **options)
except: | random_line_split |
pilconvert.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97... | ():
print("PIL Convert 0.5/1998-12-30 -- convert image files")
print("Usage: pilconvert [option] infile outfile")
print()
print("Options:")
print()
print(" -c <format> convert to format (default is given by extension)")
print()
print(" -g convert to greyscale")
print(" ... | usage | identifier_name |
pilconvert.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97... |
elif o == "-p":
convert = "P"
elif o == "-r":
convert = "RGB"
elif o == "-o":
options["optimize"] = 1
elif o == "-q":
options["quality"] = string.atoi(a)
if len(argv) != 2:
usage()
try:
im = Image.open(argv[0])
if convert and im.mode != convert:
im... | convert = "L" | conditional_block |
traversal.rs | CompoundSelector`.
///
/// Before a `Descendant` selector match is tried, it's compared against the
/// bloom filter. If the bloom filter can exclude it, the selector is quickly
/// rejected.
///
/// When done styling a node, all selectors previously inserted into the filter
/// are removed.
///
/// Since a work-steali... | (&self, node: LayoutNode) {
// Initialize layout data.
//
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
// parser.
node.initialize_layout_data();
// Get the parent node.
let parent_opt = node.layout_parent_node(self.layout... | process | identifier_name |
traversal.rs | `CompoundSelector`.
///
/// Before a `Descendant` selector match is tried, it's compared against the
/// bloom filter. If the bloom filter can exclude it, the selector is quickly
/// rejected.
///
/// When done styling a node, all selectors previously inserted into the filter
/// are removed.
///
/// Since a work-stea... | old_generation == layout_context.shared.generation {
// Hey, the cached parent is our parent! We can reuse the bloom filter.
debug!("[{}] Parent matches (={}). Reusing bloom filter.", tid(), old_node.0);
} else {
// Oh no. t... | if old_node == layout_node_to_unsafe_layout_node(&parent) && | random_line_split |
issue-20727-2.rs | // aux-build:issue-20727.rs
// ignore-cross-compile
extern crate issue_20727;
| // @has - '//*[@class="rust trait"]' 'trait Add<RHS = Self> {'
// @has - '//*[@class="rust trait"]' 'type Output;'
type Output;
// @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;'
fn add(self, rhs: RHS) -> Self::Output;
}
// @has issue_20727_2/reexport/trait.Add.html
pub... | // @has issue_20727_2/trait.Add.html
pub trait Add<RHS = Self> { | random_line_split |
es5ModuleInternalNamedImports.ts | // @target: ES5
// @module: AMD
export module M {
// variable
export var M_V = 0;
// interface
export interface M_I { }
//calss
export class | { }
// instantiated module
export module M_M { var x; }
// uninstantiated module
export module M_MU { }
// function
export function M_F() { }
// enum
export enum M_E { }
// type
export type M_T = number;
// alias
export import M_A = M_M;
// Reexports
... | M_C | identifier_name |
es5ModuleInternalNamedImports.ts | // @target: ES5
// @module: AMD
export module M {
// variable
export var M_V = 0;
// interface
| export module M_M { var x; }
// uninstantiated module
export module M_MU { }
// function
export function M_F() { }
// enum
export enum M_E { }
// type
export type M_T = number;
// alias
export import M_A = M_M;
// Reexports
export {M_V as v};
export... | export interface M_I { }
//calss
export class M_C { }
// instantiated module
| random_line_split |
es5ModuleInternalNamedImports.ts | // @target: ES5
// @module: AMD
export module M {
// variable
export var M_V = 0;
// interface
export interface M_I { }
//calss
export class M_C { }
// instantiated module
export module M_M { var x; }
// uninstantiated module
export module M_MU { }
// function
... |
// enum
export enum M_E { }
// type
export type M_T = number;
// alias
export import M_A = M_M;
// Reexports
export {M_V as v};
export {M_I as i};
export {M_C as c};
export {M_M as m};
export {M_MU as mu};
export {M_F as f};
export {M_E as e};
... | { } | identifier_body |
menu_link_weight.js | /**
* @file
* Menu Link Weight Javascript functionality.
*/
| */
Drupal.behaviors.menuLinkWeightAutomaticTitle = {
attach: function (context) {
$('fieldset.menu-link-form', context).each(function () {
var $checkbox = $('.form-item-menu-enabled input', this);
var $link_title = $('.form-item-menu-link-title input', context);
var $current_selec... | (function ($) {
/**
* Automatically update the current link title in the menu link weight list. | random_line_split |
menu_link_weight.js | /**
* @file
* Menu Link Weight Javascript functionality.
*/
(function ($) {
/**
* Automatically update the current link title in the menu link weight list.
*/
Drupal.behaviors.menuLinkWeightAutomaticTitle = {
attach: function (context) {
$('fieldset.menu-link-form', context).each(function () {
... |
// Take over any link title change.
$link_title.keyup(function () {
$current_selection.html($link_title.val().substring(0, 30));
});
// Also update on node title change, as this may update the link title.
$node_title.keyup(function () {
$current_selection.htm... | {
$current_selection.html($link_title.val().substring(0, 30));
} | conditional_block |
webkit.py | from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTe... | "env_options": "env_options",
"run_info_extras": "run_info_extras",
"timeout_multiplier": "get_timeout_multiplier"}
def check_args(**kwargs):
require_arg(kwargs, "binary")
require_arg(kwargs, "webdriver_binary")
require_arg(kwargs, "webkit_port")
def br... | "executor_kwargs": "executor_kwargs",
"env_extras": "env_extras", | random_line_split |
webkit.py | from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTe... |
return {}
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, run_info_data, **kwargs)
executor_kwargs["close_after_done"] = T... | port_key_map = {"gtk": "webkitgtk"}
browser_options_port = port_key_map.get(port_name, port_name)
browser_options_key = "%s:browserOptions" % browser_options_port
return {
"browserName": "MiniBrowser",
"browserVersion": "2.20",
"platformName": "ANY",
... | conditional_block |
webkit.py | from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTe... | (self):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
def cleanup(self):
self.stop()
def executor_browser(self):
return ExecutorBrowser, {"webdriver_url":... | is_alive | identifier_name |
webkit.py | from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTe... |
def run_info_extras(**kwargs):
return {"webkit_port": kwargs["webkit_port"]}
class WebKitBrowser(Browser):
"""Generic WebKit browser is backed by WebKit's WebDriver implementation,
which is supplied through ``wptrunner.webdriver.WebKitDriverServer``.
"""
def __init__(self, logger, binary, webd... | return {} | identifier_body |
big.js-global-tests.ts | where required.
*/
function constructorTests() {
const x = new Big(9); // '9'
const y = new Big(x); // '9'
const d = Big(435.345); // 'new' is optional
const e = Big('435.345'); // 'new' is optional
const a = new Big('5032485723458348569331745.33434346346912144534543');
const b = new Big('4.3... |
function toJSONTests() {
const x = new Big('177.7e+457');
const y = new Big(235.4325);
const z = new Big('0.0098074');
const str = JSON.stringify([x, y, z]);
const a = new Big('123').toJSON();
JSON.parse(str, (k, v) => k === '' ? v : new Big(v)); // Returns an array of three Big numbers.
}
... | {
const x = new Big('177.7e+457');
x.valueOf(); // '1.777e+459'
} | identifier_body |
big.js-global-tests.ts | definitions where required.
*/
function constructorTests() {
const x = new Big(9); // '9'
const y = new Big(x); // '9'
const d = Big(435.345); // 'new' is optional
const e = Big('435.345'); // 'new' is optional
const a = new Big('5032485723458348569331745.33434346346912144534543');
const b = ... | 0.3 - 0.2 >= 0.1; // false
const x = new Big(0.3).minus(0.2);
x.gte(0.1); // true
Big(1).gte(x); // true
}
function ltTests() {
0.3 - 0.2 < 0.1; // true
const x = new Big(0.3).minus(0.2);
x.lt(0.1); // false
Big(0).lt(x); // true
}
function lteTests() {
0.1 <= 0.3 - 0.2; // false
... | Big(0).gt(x); // false
}
function gteTests() { | random_line_split |
big.js-global-tests.ts | where required.
*/
function constructorTests() {
const x = new Big(9); // '9'
const y = new Big(x); // '9'
const d = Big(435.345); // 'new' is optional
const e = Big('435.345'); // 'new' is optional
const a = new Big('5032485723458348569331745.33434346346912144534543');
const b = new Big('4.3... | () {
const x = 45.6;
const y = new Big(x);
x.toExponential(); // '4.56e+1'
y.toExponential(); // '4.56e+1'
x.toExponential(0); // '5e+1'
y.toExponential(0); // '5e+1'
x.toExponential(1); // '4.6e+1'
y.toExponential(1); // '4.6e+1'
x.toExponential(3); // '4.560e+1'
y.toExponential... | toExponentialTests | identifier_name |
text_box.rs | use super::behaviors::{TextAction, TextBehavior};
use crate::{api::prelude::*, prelude::*, proc_macros::*, themes::theme_orbtk::*};
// --- KEYS --
pub static STYLE_TEXT_BOX: &str = "text_box";
static ID_CURSOR: &str = "id_cursor";
// --- KEYS --
widget!(
/// The `TextBox` widget represents a single line text inp... | (self, id: Entity, ctx: &mut BuildContext) -> Self {
let text_block = TextBlock::new()
.v_align("center")
.h_align("start")
.foreground(id)
.text(id)
.water_mark(id)
.font(id)
.font_size(id)
.localizable(false)
... | template | identifier_name |
text_box.rs | use super::behaviors::{TextAction, TextBehavior};
use crate::{api::prelude::*, prelude::*, proc_macros::*, themes::theme_orbtk::*};
// --- KEYS --
pub static STYLE_TEXT_BOX: &str = "text_box";
static ID_CURSOR: &str = "id_cursor";
// --- KEYS --
widget!(
/// The `TextBox` widget represents a single line text inp... | .v_align("center")
.h_align("start")
.foreground(id)
.text(id)
.water_mark(id)
.font(id)
.font_size(id)
.localizable(false)
.build(ctx);
let cursor = Cursor::new().id(ID_CURSOR).selection(id).build(ctx);... | fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
let text_block = TextBlock::new() | random_line_split |
text_box.rs | use super::behaviors::{TextAction, TextBehavior};
use crate::{api::prelude::*, prelude::*, proc_macros::*, themes::theme_orbtk::*};
// --- KEYS --
pub static STYLE_TEXT_BOX: &str = "text_box";
static ID_CURSOR: &str = "id_cursor";
// --- KEYS --
widget!(
/// The `TextBox` widget represents a single line text inp... | .font_size(id)
.lose_focus_on_activation(id)
.select_all_on_focus(id)
.request_focus(id)
.text(id)
.selection(id)
.build(ctx);
self.name("TextBox")
.style(STYLE_TEXT_BOX)
.background(colors::LYNCH_COLOR)... | {
let text_block = TextBlock::new()
.v_align("center")
.h_align("start")
.foreground(id)
.text(id)
.water_mark(id)
.font(id)
.font_size(id)
.localizable(false)
.build(ctx);
let cursor = Cursor::n... | identifier_body |
config.js | // # Ghost Configuration
// Setup your Ghost install for various environments
var path = require('path'),
config;
config = {
// ### Development **(default)**
development: {
// The url to use when providing links to the site, E.g. in RSS and email.
url: 'http://objectiveclem.local',
... | }
},
server: {
host: '127.0.0.1',
port: '2369'
}
},
// ### Travis
// Automated testing run through Github
travis: {
url: 'http://127.0.0.1:2368',
database: {
client: 'sqlite3',
connection: {
... | database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost-test.db') | random_line_split |
foundation.d.ts | /**
* Copyright 2017 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 appli... |
export class MDCDialogFoundation extends MDCFoundation<MSDDialogAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MSDDialogAdapter;
open(): void;
close(): void;
isOpen(): boolean;
accept(shouldNotify: boolean): void;
... | import { cssClasses, strings } from './constants';
import { MSDDialogAdapter } from './adapter'; | random_line_split |
foundation.d.ts | /**
* Copyright 2017 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 appli... | extends MDCFoundation<MSDDialogAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MSDDialogAdapter;
open(): void;
close(): void;
isOpen(): boolean;
accept(shouldNotify: boolean): void;
cancel(shouldNotify: boolean)... | MDCDialogFoundation | identifier_name |
util.py | import functools
import logging
import os
import random
import sys
import time
from gym import error
logger = logging.getLogger(__name__)
def utf8(value):
if isinstance(value, unicode) and sys.version_info < (3, 0):
|
else:
return value
def file_size(f):
return os.fstat(f.fileno()).st_size
def retry_exponential_backoff(f, errors, max_retries=5, interval=1):
@functools.wraps(f)
def wrapped(*args, **kwargs):
num_retries = 0
caught_errors = []
while True:
try:
... | return value.encode('utf-8') | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.