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 |
|---|---|---|---|---|
solvers.rs | use super::{Matrix, Trans, RectMat};
use lapack::*;
use factorizations::*;
use matrixerror::MatrixError;
/// Solve Ax = b via LU Factorization.
///
/// # Arguments
///
/// * `Matrix` - Matrix of type f64
///
/// # Example
/// ```
///#[macro_use] extern crate numbers;
///use numbers::Matrix;
/// pub fn main(){
/// let... | }
}
| {
let (a,ipiv) = try!(lufact(a));
let lda = a.row_size;
let n = a.col_size;
let ldb = b.row_size;
let nrhs = b.col_size;
let mut info = 0;
dgetrs(b'N', n, nrhs, &a.elements, lda, &ipiv, &mut b.elements, ldb , &mut info);
match info {
x if x > 0 => Err(MatrixError::LapackComputa... | identifier_body |
solvers.rs | use super::{Matrix, Trans, RectMat};
use lapack::*;
use factorizations::*;
use matrixerror::MatrixError;
/// Solve Ax = b via LU Factorization.
///
/// # Arguments
///
/// * `Matrix` - Matrix of type f64
///
/// # Example
/// ```
///#[macro_use] extern crate numbers;
///use numbers::Matrix;
/// pub fn main(){
/// let... | <T: RectMat>(a : &mut T, b : &mut T) -> Result<T,MatrixError>{
let (a,ipiv) = try!(lufact(a));
let lda = a.row_size;
let n = a.col_size;
let ldb = b.row_size;
let nrhs = b.col_size;
let mut info = 0;
dgetrs(b'N', n, nrhs, &a.elements, lda, &ipiv, &mut b.elements, ldb , &mut info);
mat... | lusolve | identifier_name |
solvers.rs | use super::{Matrix, Trans, RectMat};
use lapack::*;
use factorizations::*;
use matrixerror::MatrixError;
/// Solve Ax = b via LU Factorization.
///
/// # Arguments
///
/// * `Matrix` - Matrix of type f64
///
/// # Example
/// ```
///#[macro_use] extern crate numbers;
///use numbers::Matrix;
/// pub fn main(){
/// let... |
dgetrs(b'N', n, nrhs, &a.elements, lda, &ipiv, &mut b.elements, ldb , &mut info);
match info {
x if x > 0 => Err(MatrixError::LapackComputationError),
0 => Ok(Matrix {
elements : b.elements.to_owned(),
row_size : ldb,
col_size : nrhs,
transpose :... | let mut info = 0; | random_line_split |
cli.py | 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 dis... | log(clr("{prefix}@{cf}{name:<" + max_name_len + "}@| (@{yf}{build_type}@|)")
.format(prefix=clr('@!@{kf}(skip)@| ') if start_with else prefix, name=pkg.name, build_type=build_type))
log("Total packages: " + str(len(packages_to_be_built)))
def main(opts):
# Context-aware args
if opts.... | log(context.summary())
# Find list of packages in the workspace
packages_to_be_built, packages_to_be_built_deps, all_packages = determine_packages_to_be_built(packages, context)
# Assert start_with package is in the workspace
verify_start_with_option(start_with, packages, all_packages, packages_to_be_bu... | identifier_body |
cli.py | 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 dis... | # Extend packages to be built to include their deps
packages_to_be_built.extend(packages_to_be_built_deps)
# Also resort
packages_to_be_built = topological_order_packages(dict(packages_to_be_built))
# Print packages
log("Packages to be built:")
max_name_len = str(max([len(pkg... | random_line_split | |
cli.py | 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 distrib... |
# If --start--with was used without any packages and --this was specified, start with this package
if opts.start_with_this:
if this_package:
opts.start_with = this_package
else:
sys.exit("catkin build: --this was specified, but this directory is ... | if this_package:
opts.packages += [this_package]
else:
sys.exit("catkin build: --this was specified, but this directory is not contained by a catkin package.") | conditional_block |
cli.py | 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 distrib... | (opts):
# Context-aware args
if opts.build_this or opts.start_with_this:
# Determine the enclosing package
try:
this_package = find_enclosing_package()
except InvalidPackage:
pass
# Handle context-based package building
if opts.build_this:
... | main | identifier_name |
instagram.test.js | require('chai').should();
var fakeweb = require('node-fakeweb');
var path = require('path');
var helper = require(path.join(__dirname, '..', '..', 'support', | describe("Instagram connector", function () {
var pinfo;
var apiBase = "https://api.instagram.com:443/v1/";
beforeEach(function () {
fakeweb.allowNetConnect = false;
pinfo = helper.loadFixture(path.join(__dirname, '..', '..', 'fixtures',
'connectors', 'instagram.json'));
});
afterEach(functio... | 'locker-helper.js'));
var follows = require(path.join('services', 'instagram', 'follows.js'));
var feed = require(path.join('services', 'instagram', 'feed.js'));
| random_line_split |
email_manager.py | raise Exception("Invalid Message Number!")
return self.__imap_fetch_content_type(msg_nums, self.HTML)
def fetch_plaintext(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/plain content.
@Params
msg_nums - message n... | if fetch:
msgs = {}
for msgnum in results:
msgs[msgnum] = self.fetch_message(msgnum)
return msgs
elif not content_type:
return results
else:
return self.__imap_fetc... | conditional_block | |
email_manager.py | breaks
:returns: List of message numbers as strings matched by given criteria
"""
self.imap_connect()
criteria = []
for key in criteria_dict:
if criteria_dict[key] is True:
criteria.append('(%s)' % key)
else:
criteria.appe... | search | identifier_name | |
email_manager.py | BEFORE <date>, SENTON <date>, SENTSINCE <date>, SINCE <date>,
SMALLER <n>, SUBJECT <string>, TEXT <string>, TO <string>,
UID <sequence set>, UNANSWERED, UNDELETED, UNDRAFT, UNFLAGGED,
UNKEYWORD <flag>, UNSEEN.
For details on keys and their values, see
http://tools.ietf.org/html/... |
def fetch_plaintext(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/plain content.
@Params
msg_nums - message number to get message for
@Returns
Plaintext content of message matched by message number
"""
... | """
Given a message number that we found with imap_search,
get the text/html content.
@Params
msg_nums - message number to get html message for
@Returns
HTML content of message matched by message number
"""
if not msg_nums:
raise Exception("Inv... | identifier_body |
email_manager.py | BEFORE <date>, SENTON <date>, SENTSINCE <date>, SINCE <date>,
SMALLER <n>, SUBJECT <string>, TEXT <string>, TO <string>,
UID <sequence set>, UNANSWERED, UNDELETED, UNDRAFT, UNFLAGGED,
UNKEYWORD <flag>, UNSEEN.
For details on keys and their values, see
http://tools.ietf.org/html/... | return results
else:
time.sleep(15)
count += 15
if count >= timer:
raise EmailException("Failed to match criteria %s in %s minutes" %
(args, timeout / 60))
def __check_msg_for_headers(self, msg, ** emai... | return []
if results and len(results) == count: | random_line_split |
image_tags.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from django import template
FMT = 'JPEG'
EXT = 'jpg'
QUAL = 75
register = template.Library()
def resized_path(path, size, method):
|
def scale(imagefield, size, method='scale'):
"""
Template filter used to scale an image
that will fit inside the defined area.
Returns the url of the resized image.
{% load image_tags %}
{{ profile.picture|scale:"48x48" }}
"""
# imagefield can be a dict with "path" and "url" keys
... | "Returns the path for the resized image."
dir, name = os.path.split(path)
image_name, ext = name.rsplit('.', 1)
return os.path.join(dir, '%s_%s_%s.%s' % (image_name, method, size, EXT)) | identifier_body |
image_tags.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from django import template
FMT = 'JPEG'
EXT = 'jpg'
QUAL = 75
register = template.Library()
def resized_path(path, size, method):
"Returns the path for the resized image."
dir, name = os.path.split(path)
image_name, ext = name.rsplit('.', 1)... | # imagefield can be a dict with "path" and "url" keys
if imagefield.__class__.__name__ == 'dict':
imagefield = type('imageobj', (object,), imagefield)
image_path = resized_path(imagefield.path, size, method)
if not os.path.exists(image_path):
try:
import Image
excep... | random_line_split | |
image_tags.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from django import template
FMT = 'JPEG'
EXT = 'jpg'
QUAL = 75
register = template.Library()
def resized_path(path, size, method):
"Returns the path for the resized image."
dir, name = os.path.split(path)
image_name, ext = name.rsplit('.', 1)... | image.save(image_path, FMT)
elif method == 'crop':
try:
import ImageOps
except ImportError:
from PIL import ImageOps
ImageOps.fit(image, (width, height), Image.ANTIALIAS
).save(image_path, FMT)
retur... | try:
import Image
except ImportError:
try:
from PIL import Image
except ImportError:
raise ImportError('Cannot import the Python Image Library.')
image = Image.open(imagefield.path)
# normalize image mode
if image.mode... | conditional_block |
image_tags.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from django import template
FMT = 'JPEG'
EXT = 'jpg'
QUAL = 75
register = template.Library()
def resized_path(path, size, method):
"Returns the path for the resized image."
dir, name = os.path.split(path)
image_name, ext = name.rsplit('.', 1)... | (imagefield, size, method='scale'):
"""
Template filter used to scale an image
that will fit inside the defined area.
Returns the url of the resized image.
{% load image_tags %}
{{ profile.picture|scale:"48x48" }}
"""
# imagefield can be a dict with "path" and "url" keys
if imagef... | scale | identifier_name |
regress-435345-01.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
var gTestfile = 'regress-43... | actual = '';
arr.pop();
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary + ': 3');
try
{
expect = 'watcher: propname=length, oldval=1, newval=2; ';
actual = '';
arr.length++;
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summa... | try
{
expect = 'watcher: propname=length, oldval=2, newval=1; '; | random_line_split |
regress-435345-01.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
var gTestfile = 'regress-43... | (propname, oldval, newval)
{
actual += 'watcher: propname=' + propname + ', oldval=' + oldval +
', newval=' + newval + '; ';
return newval;
}
| watcher | identifier_name |
regress-435345-01.js | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
var gTestfile = 'regress-43... |
try
{
expect = 'watcher: propname=length, oldval=1, newval=2; ' +
'watcher: propname=length, oldval=2, newval=2; ';
actual = '';
arr.push(5);
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary + ': 2');
try
{
expect = 'watcher: propname=length, oldval=... | {
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var arr;
try
{
expect = 'watcher: propname=length, oldval=0, newval=1; ';
actual = '';
arr = [];
arr.watch('length', watcher);
arr[0] = '0';
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, ... | identifier_body |
RowDialog.ts | /**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import { Fun } from '@ephox/katamari';
import Tools from 'tinymce/cor... |
if (getRowClassList(editor).length > 0) {
classListCtrl = {
name: 'class',
type: 'listbox',
label: 'Class',
values: Helpers.buildListItems(
getRowClassList(editor),
function (item) {
if (item.value) {
item.textStyle = function () {
retu... | {
data = extractDataFromElement(editor, rowElm);
} | conditional_block |
RowDialog.ts | /**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import { Fun } from '@ephox/katamari';
import Tools from 'tinymce/cor... |
editor.undoManager.transact(function () {
Tools.each(rows, function (rowElm: HTMLElement) {
setAttrib(rowElm, 'scope', data.scope);
setAttrib(rowElm, 'style', data.style);
setAttrib(rowElm, 'class', data.class);
setStyle(rowElm, 'height', Util.addSizeSuffix(data.height));
if (data.... | {
const dom = editor.dom;
function setAttrib(elm: Node, name: string, value: string) {
if (rows.length === 1 || value) {
dom.setAttrib(elm, name, value);
}
}
function setStyle(elm: Node, name: string, value: string) {
if (rows.length === 1 || value) {
dom.setStyle(elm, name, value);
... | identifier_body |
RowDialog.ts | /**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import { Fun } from '@ephox/katamari';
import Tools from 'tinymce/cor... | (elm: Node, name: string, value: string) {
if (rows.length === 1 || value) {
dom.setStyle(elm, name, value);
}
}
if (hasAdvancedRowTab(editor)) {
Helpers.syncAdvancedStyleFields(editor, evt);
}
const data: FormData = evt.control.rootControl.toJSON();
editor.undoManager.transact(function (... | setStyle | identifier_name |
RowDialog.ts | /**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import { Fun } from '@ephox/katamari';
import Tools from 'tinymce/cor... | rowElm = rows[0];
if (!rowElm) {
// If this element is null, return now to avoid crashing.
return;
}
if (rows.length > 1) {
data = {
height: '',
scope: '',
style: '',
class: '',
align: '',
type: rowElm.parentNode.nodeName.toLowerCase()
};
} else {
data ... | }
});
});
| random_line_split |
summary.js | var repository = require('../utils/repository.js');
var util = require('../utils/util.js');
var sevenDaySummary = function () {
var dates = [];
var types = repository.getRecordTypes();
var todayVal = new Date().valueOf();
for (var i = 0; i < 7; i++) {
var today = new Date(todayVal);
var... |
return result;
}
var dateDefaultSummary = function (dateNode) {
var types = repository.getDefaultTypes();
return dateSummary(dateNode, types);
}
module.exports.sevenDaySummary = sevenDaySummary;
module.exports.dateDefaultSummary = dateDefaultSummary; | {
for (var i = 0; i < dateNode.records.length; i++) {
var record = dateNode.records[i];
var amount = parseInt(record.amount);
var typeResult = result[record.type];
if (!typeResult) {
typeResult = {
name: record.type,
... | conditional_block |
summary.js | var repository = require('../utils/repository.js');
var util = require('../utils/util.js');
var sevenDaySummary = function () {
var dates = [];
var types = repository.getRecordTypes();
var todayVal = new Date().valueOf();
for (var i = 0; i < 7; i++) {
var today = new Date(todayVal);
var... | }
return result;
}
var dateDefaultSummary = function (dateNode) {
var types = repository.getDefaultTypes();
return dateSummary(dateNode, types);
}
module.exports.sevenDaySummary = sevenDaySummary;
module.exports.dateDefaultSummary = dateDefaultSummary; | random_line_split | |
13a57b7f084_add_user.py | """Add user
Revision ID: 13a57b7f084
Revises: None
Create Date: 2014-05-11 17:12:17.244013
"""
# revision identifiers, used by Alembic.
revision = '13a57b7f084'
down_revision = None
from alembic import op
import sqlalchemy as sa
def | ():
### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(length=100), nullable=True),
sa.Column('password_hash', sa.String(length=1000), nullable=True),
sa.PrimaryKeyConstraint('id')
)
... | upgrade | identifier_name |
13a57b7f084_add_user.py | """Add user
Revision ID: 13a57b7f084
Revises: None
Create Date: 2014-05-11 17:12:17.244013
"""
# revision identifiers, used by Alembic.
revision = '13a57b7f084'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op... | ### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('user')
### end Alembic commands ### | random_line_split | |
13a57b7f084_add_user.py | """Add user
Revision ID: 13a57b7f084
Revises: None
Create Date: 2014-05-11 17:12:17.244013
"""
# revision identifiers, used by Alembic.
revision = '13a57b7f084'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op... | op.drop_table('user')
### end Alembic commands ### | identifier_body | |
numeric-input-validation.service.ts | // Copyright 2014 The Oppia Authors. 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 ap... | range.lbi = lbi;
range.ubi = ubi;
};
var isEnclosedBy = (ra: Range, rb: Range) => {
// Checks if range ra is enclosed by range rb.
var lowerBoundConditionIsSatisfied =
(rb.lb < ra.lb) || (rb.lb === ra.lb && (!ra.lbi || rb.lbi));
var upperBoundConditionIsSatisfied =
... | {
var warningsList: Warning[] = [];
warningsList = warningsList.concat(
this.getCustomizationArgsWarnings(customizationArgs));
/*
Store an answer range for every rule, then check for redundant
ranges. A range is an object of the form:
{
lb: float, lower bound
ub: float, upper... | identifier_body |
numeric-input-validation.service.ts | // Copyright 2014 The Oppia Authors. 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 ap... | (
value: number, customizationArgs: boolean
): string | undefined {
let stringValue = null;
// Convert exponential notation to decimal number.
// Logic derived from https://stackoverflow.com/a/16139848.
var data = String(value).split(/[eE]/);
if (data.length === 1) {
stringValue = data... | getErrorString | identifier_name |
numeric-input-validation.service.ts | // Copyright 2014 The Oppia Authors. 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 ap... |
angular.module('oppia').factory(
'NumericInputValidationService',
downgradeInjectable(NumericInputValidationService)); | } | random_line_split |
numeric-input-validation.service.ts | // Copyright 2014 The Oppia Authors. 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 ap... |
stringValue = str + z;
}
}
const stringValueRegExp = stringValue.match(/\d/g);
if (
customizationArgs &&
(stringValueRegExp === null || stringValueRegExp.length > 15)
) {
return 'The answer should be greater than or equal to zero and ' +
'can contain at most 15 dig... | {
z += '0';
} | conditional_block |
all-settled.js | import Enumerator from './enumerator';
import { makeSettledResult } from './enumerator';
import Promise from './promise';
import { o_create } from './utils';
function AllSettled(Constructor, entries, label) {
this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
}
AllSettled.protot... | // third item, reason.message will be "3".
}, function(error) {
// Not run. (This block would only be called if allSettled had failed,
// for instance if passed an incorrect argument type.)
});
```
@method allSettled
@static
@for RSVP
@param {Array} promises
@param {String} label - optional... | // { state: 'rejected', reason: Error },
// { state: 'rejected', reason: Error }
// ]
// Note that for the second item, reason.message will be "2", and for the | random_line_split |
all-settled.js | import Enumerator from './enumerator';
import { makeSettledResult } from './enumerator';
import Promise from './promise';
import { o_create } from './utils';
function | (Constructor, entries, label) {
this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
}
AllSettled.prototype = o_create(Enumerator.prototype);
AllSettled.prototype._superConstructor = Enumerator;
AllSettled.prototype._makeResult = makeSettledResult;
AllSettled.prototype._validationE... | AllSettled | identifier_name |
all-settled.js | import Enumerator from './enumerator';
import { makeSettledResult } from './enumerator';
import Promise from './promise';
import { o_create } from './utils';
function AllSettled(Constructor, entries, label) {
this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
}
AllSettled.protot... | {
return new AllSettled(Promise, entries, label).promise;
} | identifier_body | |
method-trait-object-with-hrtb.rs | // build-pass (FIXME(62277): could be check-pass?)
// Check that method probing ObjectCandidate works in the presence of
// auto traits and/or HRTBs.
mod internal {
pub trait MyObject<'a> {
type Output;
fn foo(&self) -> Self::Output;
}
impl<'a> MyObject<'a> for () {
type Output =... | fn t4(d: &(dyn internal::MyObject<'static, Output=&'static u32> + Sync)) {
d.foo();
}
fn main() {
t1(&());
t2(&());
t3(&());
t4(&());
} |
fn t3(d: &(dyn for<'a> internal::MyObject<'a, Output=&'a u32> + Sync)) {
d.foo();
}
| random_line_split |
method-trait-object-with-hrtb.rs | // build-pass (FIXME(62277): could be check-pass?)
// Check that method probing ObjectCandidate works in the presence of
// auto traits and/or HRTBs.
mod internal {
pub trait MyObject<'a> {
type Output;
fn foo(&self) -> Self::Output;
}
impl<'a> MyObject<'a> for () {
type Output =... | (&self) -> Self::Output { &4 }
}
}
fn t1(d: &dyn for<'a> internal::MyObject<'a, Output=&'a u32>) {
d.foo();
}
fn t2(d: &dyn internal::MyObject<'static, Output=&'static u32>) {
d.foo();
}
fn t3(d: &(dyn for<'a> internal::MyObject<'a, Output=&'a u32> + Sync)) {
d.foo();
}
fn t4(d: &(dyn internal::MyOb... | foo | identifier_name |
method-trait-object-with-hrtb.rs | // build-pass (FIXME(62277): could be check-pass?)
// Check that method probing ObjectCandidate works in the presence of
// auto traits and/or HRTBs.
mod internal {
pub trait MyObject<'a> {
type Output;
fn foo(&self) -> Self::Output;
}
impl<'a> MyObject<'a> for () {
type Output =... |
fn main() {
t1(&());
t2(&());
t3(&());
t4(&());
}
| {
d.foo();
} | identifier_body |
connection.rs | extension::{ClientId, Extension, MailBodyParameter, MailParameter, ServerInfo},
response::{parse_response, Response},
},
};
#[cfg(feature = "tracing")]
use super::escape_crlf;
macro_rules! try_smtp (
($err: expr, $client: ident) => ({
match $err {
Ok(val) => val,
Err(e... | }
}
Err(error::response("incomplete response")) | random_line_split | |
connection.rs | SocketAddrs,
time::Duration,
};
use super::{ClientCodec, NetworkStream, TlsParameters};
use crate::{
address::Envelope,
transport::smtp::{
authentication::{Credentials, Mechanism},
commands::*,
error,
error::Error,
extension::{ClientId, Extension, MailBodyParameter, ... | }
if challenges == 0 {
Err(error::response("Unexpected number of challenges"))
} else {
Ok(response)
}
}
/// Sends the message content
pub fn message(&mut self, message: &[u8]) -> Result<Response, Error> {
let mut out_buf: Vec<u8> = vec![];
... | {
let mechanism = self
.server_info
.get_auth_mechanism(mechanisms)
.ok_or_else(|| error::client("No compatible authentication mechanism was found"))?;
// Limit challenges to avoid blocking
let mut challenges = 10;
let mut response = self.command(Auth... | identifier_body |
connection.rs | SocketAddrs,
time::Duration,
};
use super::{ClientCodec, NetworkStream, TlsParameters};
use crate::{
address::Envelope,
transport::smtp::{
authentication::{Credentials, Mechanism},
commands::*,
error,
error::Error,
extension::{ClientId, Extension, MailBodyParameter, ... | (&mut self, message: &[u8]) -> Result<Response, Error> {
let mut out_buf: Vec<u8> = vec![];
let mut codec = ClientCodec::new();
codec.encode(message, &mut out_buf);
self.write(out_buf.as_slice())?;
self.write(b"\r\n.\r\n")?;
self.read_response()
}
/// Sends an SM... | message | identifier_name |
paraphrase_ms_coco_test.py | # coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | (self):
inputs = ["A", "B", "C"]
expected_combination = [("A", "B"), ("A", "C"), ("B", "C")]
actual_combination = paraphrase_ms_coco.create_combination(inputs)
self.assertEqual(actual_combination, expected_combination)
@mock.patch("tensor2tensor.data_generators"
".paraphrase_ms_coco.Par... | testCombinationPairs | identifier_name |
paraphrase_ms_coco_test.py | # coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
if __name__ == "__main__":
tf.test.main()
| paraphrase_problem = paraphrase_ms_coco.ParaphraseGenerationProblem()
paraphrase_problem.bidirectional = False
expected_generated_data = [{"inputs": "sentence1", "targets": "sentence2"}]
actual_generated_data = list(paraphrase_problem
.generate_samples("data_dir",
... | identifier_body |
paraphrase_ms_coco_test.py | # coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0 | # Unless required by 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 |
paraphrase_ms_coco_test.py | # coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | tf.test.main() | conditional_block | |
fstree.py | #!/usr/bin/env python
import sys
| from fs.commands.runner import Command
from fs.utils import print_fs
class FSTree(Command):
usage = """fstree [OPTION]... [PATH]
Recursively display the contents of PATH in an ascii tree"""
def get_optparse(self):
optparse = super(FSTree, self).get_optparse()
optparse.add_opt... | from fs.opener import opener | random_line_split |
fstree.py | #!/usr/bin/env python
import sys
from fs.opener import opener
from fs.commands.runner import Command
from fs.utils import print_fs
class FSTree(Command):
usage = """fstree [OPTION]... [PATH]
Recursively display the contents of PATH in an ascii tree"""
def get_optparse(self):
optparse = supe... | max_levels=max_levels,
terminal_colors=self.terminal_colors,
hide_dotfiles=not options.all,
dirs_first=options.dirsfirst)
def run():
return FSTree().run()
if __name__ == "__main__":
sy... | if not args:
args = ['.']
for fs, path, is_dir in self.get_resources(args, single=True):
if not is_dir:
self.error(u"'%s' is not a dir\n" % path)
return 1
fs.cache_hint(True)
if options.gui:
... | identifier_body |
fstree.py | #!/usr/bin/env python
import sys
from fs.opener import opener
from fs.commands.runner import Command
from fs.utils import print_fs
class FSTree(Command):
usage = """fstree [OPTION]... [PATH]
Recursively display the contents of PATH in an ascii tree"""
def get_optparse(self):
optparse = supe... |
else:
max_levels = options.depth
print_fs(fs, path or '',
file_out=self.output_file,
max_levels=max_levels,
terminal_colors=self.terminal_colors,
hide_dotfiles=not opt... | max_levels = None | conditional_block |
fstree.py | #!/usr/bin/env python
import sys
from fs.opener import opener
from fs.commands.runner import Command
from fs.utils import print_fs
class | (Command):
usage = """fstree [OPTION]... [PATH]
Recursively display the contents of PATH in an ascii tree"""
def get_optparse(self):
optparse = super(FSTree, self).get_optparse()
optparse.add_option('-l', '--level', dest='depth', type="int", default=5,
... | FSTree | identifier_name |
dropck_tarena_unsound_drop.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a>(_arena: &'a TypedArena<C<'a>>) {}
fn main() {
let arena: TypedArena<C> = TypedArena::new();
f(&arena); //~ ERROR `arena` does not live long enough
}
| f | identifier_name |
dropck_tarena_unsound_drop.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | struct CheckId<T:HasId> { v: T }
// In the code below, the impl of HasId for `&'a usize` does not
// actually access the borrowed data, but the point is that the
// interface to CheckId does not (and cannot) know that, and therefore
// when encountering the a value V of type CheckId<S>, we must
// conservatively force... |
trait HasId { fn count(&self) -> usize; }
| random_line_split |
HTMLElement.py | #!/usr/bin/env python
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import bs4 as BeautifulSoup
import logging
from thug.DOM.W3C.Element import Element
from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyl... |
def getInnerHTML(self):
if not self.hasChildNodes():
return ""
html = StringIO()
for tag in self.tag.contents:
html.write(unicode(tag))
return html.getvalue()
def setInnerHTML(self, html):
self.tag.clear()
soup = BeautifulSoup.Beauti... | Element.__init__(self, doc, tag)
ElementCSSInlineStyle.__init__(self, doc, tag) | identifier_body |
HTMLElement.py | #!/usr/bin/env python
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import bs4 as BeautifulSoup
import logging
from thug.DOM.W3C.Element import Element
from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyl... | (self):
if not self.hasChildNodes():
return ""
html = StringIO()
for tag in self.tag.contents:
html.write(unicode(tag))
return html.getvalue()
def setInnerHTML(self, html):
self.tag.clear()
soup = BeautifulSoup.BeautifulSoup(html, "html5li... | getInnerHTML | identifier_name |
HTMLElement.py | #!/usr/bin/env python
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
| from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyle import ElementCSSInlineStyle
from .attr_property import attr_property
log = logging.getLogger("Thug")
class HTMLElement(Element, ElementCSSInlineStyle):
id = attr_property("id")
title = attr_property("title")
lang = attr_... | import bs4 as BeautifulSoup
import logging
from thug.DOM.W3C.Element import Element | random_line_split |
HTMLElement.py | #!/usr/bin/env python
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import bs4 as BeautifulSoup
import logging
from thug.DOM.W3C.Element import Element
from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyl... |
innerHTML = property(getInnerHTML, setInnerHTML)
# WARNING: NOT DEFINED IN W3C SPECS!
def focus(self):
pass
@property
def sourceIndex(self):
return None
| name = getattr(node, 'name', None)
if not name:
continue
p = getattr(self.doc.window.doc.DFT, 'handle_%s' % (name, ), None)
if p is None:
p = getattr(log.DFT, 'handle_%s' % (name, ), None)
if p:
p(node) | conditional_block |
index.tsx | /**
* 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/.
*/
import * as React from 'react';
import {webAPI, utils} from 'camelot-unchained';
import QuickSelect from '..... |
}
export interface GameSelectProps {
servers: utils.Dictionary<PatcherServer>;
selectType: (serverType: ServerType) => void;
}
export interface GameSelectState {
selectedType: ServerType;
}
class GameSelect extends React.Component<GameSelectProps, GameSelectState> {
constructor(props: GameSelectProps) {
... | {
const { type } = this.props;
return <div className='ActiveGameView'>{serverTypeToString(type)}</div>;
} | identifier_body |
index.tsx | /**
* 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/.
*/
import * as React from 'react';
import {webAPI, utils} from 'camelot-unchained';
import QuickSelect from '..... |
export interface GameSelectState {
selectedType: ServerType;
}
class GameSelect extends React.Component<GameSelectProps, GameSelectState> {
constructor(props: GameSelectProps) {
super(props);
this.state = {
selectedType: ServerType.CUGAME,
};
}
public render() {
const values: ServerT... |
export interface GameSelectProps {
servers: utils.Dictionary<PatcherServer>;
selectType: (serverType: ServerType) => void;
} | random_line_split |
index.tsx | /**
* 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/.
*/
import * as React from 'react';
import {webAPI, utils} from 'camelot-unchained';
import QuickSelect from '..... | () {
const { type } = this.props;
return <div className='ActiveGameView'>{serverTypeToString(type)}</div>;
}
}
class GameListView extends React.Component<{type: ServerType}, {}> {
public render() {
const { type } = this.props;
return <div className='ActiveGameView'>{serverTypeToString(type)}</div>;... | render | identifier_name |
index.tsx | /**
* 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/.
*/
import * as React from 'react';
import {webAPI, utils} from 'camelot-unchained';
import QuickSelect from '..... |
}
if (anyOfType) values.push(i);
}
const {selectedType} = this.state;
return <QuickSelect items={values}
containerClass='GameSelect'
selectedItemIndex={utils.findIndexWhere(values, t => t === selectedType)}
activeViewCompon... | {
anyOfType = true;
break;
} | conditional_block |
quicklaunch_cy.ts | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="cy">
<context>
<name>LXQtQuickLaunch</name>
<message>
<location filename="../lxqtquicklaunch.cpp" line="229"/>
<source>Drop Error</source>
<translation></translation>
</message>
<message>
<lo... | <source>Remove from quicklaunch</source>
<translation></translation>
</message>
</context>
</TS> | </message>
<message>
<location filename="../quicklaunchbutton.cpp" line="64"/> | random_line_split |
da.js | /*!
* FileInput Danish Translations
*
* This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
* any HTML markup tags in the messages must not be converted or translated.
*
* @see http://github.com/kartik-v/bootstrap-fileinput
*
* NOTE: this file must be saved in UTF-8 encoding.
*/... | next: 'View next file',
toggleheader: 'Toggle header',
fullscreen: 'Toggle full screen',
borderless: 'Toggle borderless mode',
close: 'Close detailed preview'
}
};
})(window.jQuery); | },
previewZoomButtonTitles: {
prev: 'View previous file',
| random_line_split |
development.ts | import BaseEnv = require('./base');
const DevelopmentEnv = {
postgres: {
options: {
host: process.env.PG_ADDR || 'localhost',
port: process.env.PG_PORT || 5432,
username: '',
password: '',
database: 'burgerstack_dev',
// Logging method
// 'console.log', 'false', default ... | // logging with Morgan - https://github.com/expressjs/morgan
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
format: 'dev',
fileLogger: {
directoryPath: process.cwd(),
fileName: 'server.log',
maxsize: 10485760,
maxFiles: 2,
json: false
},
// true:... | pass: ''
}
},
log: { | random_line_split |
actions.js | // 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 un... | else if (doc.validationError && doc.validationError === 'Cannot change a documents id.') {
errorNotification('You cannot edit the _id of an existing document. Try this: Click \'Clone Document\', then change the _id on the clone before saving.');
delete doc.validationError;
} else {
errorNotification('Ple... | {
FauxtonAPI.addNotification({
msg: 'Saving document.',
clear: true
});
doc.save().then(function () {
onSave(doc.prettyJSON());
FauxtonAPI.navigate('#/' + FauxtonAPI.urls('allDocs', 'app', FauxtonAPI.url.encode(doc.database.id)), {trigger: true});
}).fail(function (xhr) {
... | conditional_block |
actions.js | // 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 un... | type: ActionTypes.FILE_UPLOAD_ERROR,
options: {
error: 'Please select a file to be uploaded.'
}
});
return;
}
FauxtonAPI.dispatch({ type: ActionTypes.START_FILE_UPLOAD });
// store the xhr in parent scope to allow us to cancel any uploads if the user closes the modal
xhr = $.... |
function uploadAttachment (params) {
if (params.files.length === 0) {
FauxtonAPI.dispatch({ | random_line_split |
actions.js | // 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 un... |
function hideDeleteDocModal () {
FauxtonAPI.dispatch({ type: ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL });
}
function deleteDoc (doc) {
var databaseName = doc.database.safeID();
var query = '?rev=' + doc.get('_rev');
$.ajax({
url: FauxtonAPI.urls('document', 'server', databaseName, doc.safeID(), qu... | {
FauxtonAPI.dispatch({ type: ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL });
} | identifier_body |
actions.js | // 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 un... | () {
xhr.abort();
}
function resetUploadModal () {
FauxtonAPI.dispatch({ type: ActionTypes.RESET_UPLOAD_MODAL });
}
// helpers
function errorNotification (msg) {
FauxtonAPI.addNotification({
msg: msg,
type: 'error',
clear: true
});
}
export default {
initDocEditor: initDocEditor,
saveDoc: ... | cancelUpload | identifier_name |
class-attributes-2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct cat {
name... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
// | random_line_split |
class-attributes-2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let _kitty = cat(~"Spotty");
} | identifier_body | |
class-attributes-2.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (name: ~str) -> cat {
cat {
name: name
}
}
pub fn main() {
let _kitty = cat(~"Spotty");
}
| cat | identifier_name |
index.d.ts | // Type definitions for polymer v1.2.6
// Project: https://github.com/Polymer/polymer
// Definitions by: Louis Grignon <https://github.com/lgrignon>, Suguru Inatomi <https://github.com/laco0416>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { CustomElementConstructor } from "webcomponents.j... |
behaviors?:Object[];
// Constructors
factoryImpl?(...args: any[]): void;
// Debouncer
debounce?(jobName: string, callback: Function, wait?: number): void;
isDebouncerActive?(jobName: string): boolean;
flushDebouncer?(jobName: string): void;
cancelDebouncer?(jobNam... | deserialize?(value: string, type: StringConstructor): string;
serialize?(value: any): string;
// Behaviors | random_line_split |
config.ts | import nconf from 'nconf';
import { debug } from 'debug';
const log = debug('sockethub:bootstrap:config');
export class Config {
constructor() {
log('initializing config');
// assign config loading priorities (command-line, environment, cfg, defaults)
nconf.argv({
'port': {
alias: 'service... | (host: string, port: string | number, prop: string) {
nconf.set(prop + ':host', host);
nconf.set(prop + ':port', port);
}
defaultEnvParams(
process.env.HOST || nconf.get('service:host'),
process.env.PORT || nconf.get('service:port'),
'service'
);
defaultEnvParams(
p... | defaultEnvParams | identifier_name |
config.ts | import nconf from 'nconf';
import { debug } from 'debug';
const log = debug('sockethub:bootstrap:config');
export class Config {
constructor() {
log('initializing config');
// assign config loading priorities (command-line, environment, cfg, defaults)
nconf.argv({
'port': {
alias: 'service... |
}
get = (key: string): any => nconf.get(key);
}
const config = new Config();
export default config; | {
nconf.set('redis:url', process.env.REDIS_URL);
nconf.clear('redis:host');
nconf.clear('redis:port');
} | conditional_block |
config.ts | import nconf from 'nconf';
import { debug } from 'debug';
const log = debug('sockethub:bootstrap:config');
export class Config {
constructor() {
log('initializing config');
// assign config loading priorities (command-line, environment, cfg, defaults)
nconf.argv({
'port': {
alias: 'service... | },
'redis_host': {
alias: 'redis.host'
},
'redis_port': {
alias: 'redis.port'
},
'redis_url': {
alias: 'redis.url'
}
});
nconf.env();
// get value of flags defined by any command-line params
const examples = nconf.get('examples');
/... | random_line_split | |
res_core_data_mthd1.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# res_core_data_mthd1.py
import unittest
import sys
import os
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_folder)
import core_data as mod_core
def | ():
"""
returns a description in RST for the research paper
"""
txt = 'Method 1 - Ontological Mapping\n'
txt += '---------------------------------------\n\n'
txt += 'Using an ontology, map the columns in raw data to a set of standard tables\n\n'
return txt
def get_results(fname, dat):
... | get_method | identifier_name |
res_core_data_mthd1.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# res_core_data_mthd1.py
import unittest
import sys
import os
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_folder)
import core_data as mod_core
def get_method():
"""
returns a des... | cols = parse_csv(line)
print(cols)
def append_rst(fname, txt):
with open(fname, 'a') as f:
f.write(txt)
def parse_csv(txt):
cols = txt.split(',')
return cols | with open(dat, 'r') as f:
for line in f: | random_line_split |
res_core_data_mthd1.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# res_core_data_mthd1.py
import unittest
import sys
import os
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_folder)
import core_data as mod_core
def get_method():
"""
returns a des... |
def append_rst(fname, txt):
with open(fname, 'a') as f:
f.write(txt)
def parse_csv(txt):
cols = txt.split(',')
return cols | cols = parse_csv(line)
print(cols) | conditional_block |
res_core_data_mthd1.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# res_core_data_mthd1.py
import unittest
import sys
import os
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_folder)
import core_data as mod_core
def get_method():
"""
returns a des... |
def append_rst(fname, txt):
with open(fname, 'a') as f:
f.write(txt)
def parse_csv(txt):
cols = txt.split(',')
return cols | append_rst(fname, '\nMethod 1: running source data ' + dat + ' .... \n')
with open(dat, 'r') as f:
for line in f:
cols = parse_csv(line)
print(cols) | identifier_body |
default.py | # -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: 2007 by Tiberius Teng.
:copyright: 2006 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword... | Name.Builtin: "#008000",
Name.Function: "#0000FF",
Name.Class: "bold #0000FF",
Name.Namespace: "bold #0000FF",
Name.Exception: "bold #D2413A",
Name.Variable: "#19177C",
Name.Constant: ... | """
The default style (inspired by Emacs 22).
"""
background_color = "#f8f8f8"
default_style = ""
styles = {
Whitespace: "#bbbbbb",
Comment: "italic #408080",
Comment.Preproc: "noitalic #BC7A00",
#Keyword: ... | identifier_body |
default.py | # -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: 2007 by Tiberius Teng.
:copyright: 2006 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword... | (Style):
"""
The default style (inspired by Emacs 22).
"""
background_color = "#f8f8f8"
default_style = ""
styles = {
Whitespace: "#bbbbbb",
Comment: "italic #408080",
Comment.Preproc: "noitalic #BC7A00",
#Keyword: ... | DefaultStyle | identifier_name |
default.py | # -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: 2007 by Tiberius Teng.
:copyright: 2006 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword... | String.Regex: "#BB6688",
#String.Symbol: "#B8860B",
String.Symbol: "#19177C",
String.Other: "#008000",
Number: "#666666",
Generic.Heading: "bold #000080",
Generic.Subheading: "b... | String: "#BA2121",
String.Doc: "italic",
String.Interpol: "bold #BB6688",
String.Escape: "bold #BB6622", | random_line_split |
test_weekday.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | weekdays = "MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY"
weekdays = weekdays.split()
for i, weekday in enumerate(weekdays, start=1):
weekday_enum = WeekDay(i)
assert weekday_enum == i
assert int(weekday_enum) == i
assert weekday_enum.name == w... | identifier_body | |
test_weekday.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | (unittest.TestCase):
def test_weekday_enum_length(self):
assert len(WeekDay) == 7
def test_weekday_name_value(self):
weekdays = "MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY"
weekdays = weekdays.split()
for i, weekday in enumerate(weekdays, start=1):
week... | TestWeekDay | identifier_name |
test_weekday.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | weekday_enum = WeekDay(i)
assert weekday_enum == i
assert int(weekday_enum) == i
assert weekday_enum.name == weekday
assert weekday_enum in WeekDay
assert 0 < weekday_enum < 8
assert isinstance(weekday_enum, WeekDay)
assert isinstance(w... | conditional_block | |
test_weekday.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | #
# 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... | # with the License. You may obtain a copy of the License at | random_line_split |
setup.py | """
Build extension modules, package and install Fatiando.
"""
import sys
import os
from setuptools import setup, Extension, find_packages
import numpy
# Get the version number and setup versioneer
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = 'fatiando/_version.py'
versioneer.versionfile_bu... | setup(name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
license=LICENSE,
... | conditional_block | |
setup.py | """
Build extension modules, package and install Fatiando.
"""
import sys
import os
from setuptools import setup, Extension, find_packages
import numpy
# Get the version number and setup versioneer
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = 'fatiando/_version.py'
versioneer.versionfile_bu... | if USE_CYTHON:
sys.argv.remove('--cython')
from Cython.Build import cythonize
extensions = cythonize(extensions)
if __name__ == '__main__':
setup(name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
... | extensions.append(
Extension('.'.join(e), [os.path.join(*e) + ext],
libraries=libs,
include_dirs=[numpy.get_include()],
**extra_args)) | random_line_split |
branch.ts | import * as project from './project'
import { makeId, BranchDefinition, BlockDefinition } from 'playback'
import { StringMap } from 'blocks/lucidity';
import { LiveBlock } from './block'
import { LiveProject } from './project'
export class LiveBranch {
blocks: { [ key: string ]: LiveBlock }
entry: string
id: st... |
this.blocks [ block.id ] = block
return block
}
}
| {
parent.children [ slotIdx ] = block.id
} | conditional_block |
branch.ts | import * as project from './project'
import { makeId, BranchDefinition, BlockDefinition } from 'playback'
import { StringMap } from 'blocks/lucidity';
import { LiveBlock } from './block'
import { LiveProject } from './project'
export class LiveBranch {
blocks: { [ key: string ]: LiveBlock }
entry: string
id: st... | parent.children [ slotIdx ] = block.id
}
this.blocks [ block.id ] = block
return block
}
} | } else { | random_line_split |
branch.ts | import * as project from './project'
import { makeId, BranchDefinition, BlockDefinition } from 'playback'
import { StringMap } from 'blocks/lucidity';
import { LiveBlock } from './block'
import { LiveProject } from './project'
export class LiveBranch {
blocks: { [ key: string ]: LiveBlock }
entry: string
id: st... |
( parentId: string
, slotIdx?: number
) {
const parent = this.blocks [ parentId ]
if ( ! parent ) {
throw new Error ( `Cannot create block (invalid parent block id '${ parentId }')` )
}
const block = new LiveBlock ( this )
if ( slotIdx === undefined ) {
parent.children.push ( bloc... | identifier_name | |
branch.ts | import * as project from './project'
import { makeId, BranchDefinition, BlockDefinition } from 'playback'
import { StringMap } from 'blocks/lucidity';
import { LiveBlock } from './block'
import { LiveProject } from './project'
export class LiveBranch {
blocks: { [ key: string ]: LiveBlock }
entry: string
id: st... |
}
| {
const parent = this.blocks [ parentId ]
if ( ! parent ) {
throw new Error ( `Cannot create block (invalid parent block id '${ parentId }')` )
}
const block = new LiveBlock ( this )
if ( slotIdx === undefined ) {
parent.children.push ( block.id )
} else {
parent.children [ slo... | identifier_body |
faRocketchat.js | 'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var prefix = 'fab'; | var ligatures = [];
var unicode = 'f3e8';
var svgPathData = 'M448 256.2c0-87.2-99.6-153.3-219.8-153.3-18.8 0-37.3 1.6-55.3 4.8-11.1-10.5-24.2-20-38-27.4C61.2 44.2 0 79.4 0 79.4s56.9 47.1 47.6 88.3c-52.3 52.3-52.5 124.1 0 176.6C56.9 385.6 0 432.6 0 432.6s61.2 35.2 134.9-.8c13.8-7.5 26.9-16.9 38-27.4 18 3.2 36.5 4.8 55.3... | var iconName = 'rocketchat';
var width = 448;
var height = 512; | random_line_split |
options.radio.js | export default class {
constructor(jsonInputData = {}, storyInputData = {}) {
this.jsonInputData = jsonInputData;
this.storyInputData = storyInputData;
}
get input() {
let {jsonInputData = {}, storyInputData = {}} = this;
let {radioButtons = []} = jsonInputData;
let ... | }
}
} | }) | random_line_split |
options.radio.js | export default class {
constructor(jsonInputData = {}, storyInputData = {}) {
this.jsonInputData = jsonInputData;
this.storyInputData = storyInputData;
}
get input() |
let newInputData = Object.assign({},
jsonInputData, {
radioButtons: newRadioButtons,
type: "radio"
})
return newInputData;
function hasRadio(option, radioButtons = []) {
return radioButtons.find(radioButton => {
... | {
let {jsonInputData = {}, storyInputData = {}} = this;
let {radioButtons = []} = jsonInputData;
let {options = []} = storyInputData;
let newRadioButtons = options.map(option => {
let {display, value} = option;
let radio = hasRadio(option, radioButtons);
... | identifier_body |
options.radio.js | export default class {
constructor(jsonInputData = {}, storyInputData = {}) {
this.jsonInputData = jsonInputData;
this.storyInputData = storyInputData;
}
get input() {
let {jsonInputData = {}, storyInputData = {}} = this;
let {radioButtons = []} = jsonInputData;
let ... | else {
return {
value,
label: display
}
}
});
let newInputData = Object.assign({},
jsonInputData, {
radioButtons: newRadioButtons,
type: "radio"
})
retu... | {
let newRadio = Object.assign({}, radio);
return newRadio;
} | conditional_block |
options.radio.js | export default class {
constructor(jsonInputData = {}, storyInputData = {}) {
this.jsonInputData = jsonInputData;
this.storyInputData = storyInputData;
}
get input() {
let {jsonInputData = {}, storyInputData = {}} = this;
let {radioButtons = []} = jsonInputData;
let ... | (option, radioButtons = []) {
return radioButtons.find(radioButton => {
return radioButton.value === option.value;
})
}
}
} | hasRadio | identifier_name |
callAll.js | //
// If `options.workflowMissingLocalesLocales` is set to an array of locales, the
// document is exported if needed only to those locales. Otherwise, by default,
// the document is exported if needed to all locales. If `replicateAcrossLocales` is
// `false` as a module-level option, it is replicated only be... | // there.
//
// These newly created docs in other locales are initially trash so they
// don't clutter reorganize as "unpublished." | random_line_split | |
callAll.js | {
// We are not auto-replicating across locales, but we are still
// maintaining at least draft/live relationship for all workflow docs
candidates = [ self.draftify(doc.workflowLocale), self.liveify(doc.workflowLocale) ];
}
}
return _.filter(candidates, fun... |
return self.resolveRelationships(req, _doc, _doc.workflowLocale, callback);
}
function insert(callback) {
// This is tricky: for pieces, we need the beforeInsert/afterInsert etc.
// callbacks to run. Whereas for pages, not all of those exist, and those
// that d... | {
return callback(null);
} | conditional_block |
callAll.js | {
if (!self.isAncestorOf(options.workflowMissingLocalesDescendantsOf, locale)) {
return false;
}
}
return true;
});
}
}
function insertInMissingLocales(callback) {
if (!missingLocales.length) {
return callback(null);
}... | {
// If I can edit a specific page in ch-fr, I can also edit that same page in gb-en,
// PROVIDED THAT I can edit pages in gb-en at all (we have locale-specific
// permission checks). This eliminates complexities in the permissions interface.
if (!doc.docPermissions) {
return callback(nu... | identifier_body | |
callAll.js | // simple
return manager.insert(req, _doc, { permissions: false, workflowMissingLocalesLive: options.workflowMissingLocalesLive }, callback);
} else {
// Something Else. Currently, nothing in this category, but
// inserting via docs.insert is a good fallback
re... | after | identifier_name | |
borrowck-move-subcomponent.rs | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | {
let a : S = S { x : box 1 };
let pb = &a;
let S { x: ax } = a; //~ ERROR cannot move out
f(pb);
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.