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 |
|---|---|---|---|---|
silence.rs | // STD Dependencies -----------------------------------------------------------
use std::fmt;
| // Internal Dependencies ------------------------------------------------------
use ::bot::{Bot, BotConfig};
use ::core::{EventQueue, Message};
use ::action::{ActionHandler, ActionGroup};
// Action Implementation ------------------------------------------------------
pub struct Action {
message: Message
}
impl A... | random_line_split | |
valueconverters.js | export class kendoToStringValueConverter {
toView(value, format, language) {
return kendo.toString(value, format, language);
}
}
export class kendoParseDateValueConverter {
toView(value, format, language) {
return kendo.parseDate(value, format, language);
}
}
export class kendoParseIntValueConverter {... | }
}
export class kendoParseColorValueConverter {
toView(value) {
return kendo.parseColor(value);
}
}
export class kendoStringifyValueConverter {
toView(obj) {
return kendo.stringify(obj);
}
}
export class kendoFormatValueConverter {
toView(value, ...params) {
params.unshift(value);
retur... | random_line_split | |
valueconverters.js | export class kendoToStringValueConverter {
toView(value, format, language) {
return kendo.toString(value, format, language);
}
}
export class kendoParseDateValueConverter {
toView(value, format, language) {
return kendo.parseDate(value, format, language);
}
}
export class kendoParseIntValueConverter {... | (obj) {
return kendo.stringify(obj);
}
}
export class kendoFormatValueConverter {
toView(value, ...params) {
params.unshift(value);
return kendo.format.apply(this, params);
}
}
| toView | identifier_name |
valueconverters.js | export class kendoToStringValueConverter {
toView(value, format, language) {
return kendo.toString(value, format, language);
}
}
export class kendoParseDateValueConverter {
toView(value, format, language) {
return kendo.parseDate(value, format, language);
}
}
export class kendoParseIntValueConverter {... |
}
export class kendoFormatValueConverter {
toView(value, ...params) {
params.unshift(value);
return kendo.format.apply(this, params);
}
}
| {
return kendo.stringify(obj);
} | identifier_body |
configurator-ios.component.ts | import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { Ios... |
}
onCancelClick() {
this.dialogRef.close();
}
}
| {
this.toasterService.error(`Fill all required fields.`);
} | conditional_block |
configurator-ios.component.ts | import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { Ios... | this.consoleTypes = this.configurationService.getConsoleTypes();
}
onSaveClick() {
if (this.generalSettingsForm.valid && this.memoryForm.valid) {
this.nodeService.updateNode(this.server, this.node).subscribe(() => {
this.toasterService.success(`Node ${this.node.name} updated.`);
this.... | });
}
getConfiguration() { | random_line_split |
configurator-ios.component.ts | import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { Ios... |
ngOnInit() {
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
this.node = node;
this.name = node.name;
this.getConfiguration();
});
}
getConfiguration() {
this.consoleTypes = this.configurationService.getConsoleTypes();
}
onSaveClick() {
if (th... | {
this.generalSettingsForm = this.formBuilder.group({
name: new FormControl('', Validators.required),
});
this.memoryForm = this.formBuilder.group({
ram: new FormControl('', Validators.required),
nvram: new FormControl('', Validators.required),
});
} | identifier_body |
configurator-ios.component.ts | import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { Ios... | () {
this.dialogRef.close();
}
}
| onCancelClick | identifier_name |
YAHOO.js | /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/**
* @class The Yahoo global namespace
*/
var YAHOO = function() {
return {
/**
* Yahoo presentation platform utils namespace
*/
util: {},
/**
* Yahoo presentation platform widgets namespace
... |
var levels = sNameSpace.split(".");
var currentNS = YAHOO;
// YAHOO is implied, so it is ignored if it is included
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
currentNS[levels[i]] = currentNS[levels[i]] || {};
cur... | {
return null;
} | conditional_block |
YAHOO.js | /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/**
* @class The Yahoo global namespace
*/
var YAHOO = function() {
return {
/**
* Yahoo presentation platform utils namespace
*/
util: {},
/**
* Yahoo presentation platform widgets namespace
... | * Returns the namespace specified and creates it if it doesn't exist
*
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
*
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
... | * Yahoo presentation platform examples namespace
*/
example: {},
/** | random_line_split |
TagInput.js | import m from "mithril";
import Stream from "mithril/stream";
export default class TagInput {
add (e, tags) {
if (e.keyCode === 13 && e.target.value) {
if (tags().indexOf(e.target.value) === -1) {
let tmp = tags();
tmp.push(e.target.value);
tags(tmp);
}
e.target.value = ... |
view(vnode) {
return m(".tag-input.mar-t-xs",
[
vnode.attrs.tags().map((tag) => {
return m('span.badge.mar-r-xs.mar-b-xs',
{
style: {
"cursor": "pointer",
},
onclick: (e) => vnode.state.del(tag, vnode.attrs.tags)
},
... | {
let tmp = tags().filter(function(v) {
return v != tag;
});
tags(tmp);
} | identifier_body |
TagInput.js | import m from "mithril";
import Stream from "mithril/stream";
export default class TagInput {
add (e, tags) {
if (e.keyCode === 13 && e.target.value) {
if (tags().indexOf(e.target.value) === -1) |
e.target.value = '';
}
}
del (tag, tags) {
let tmp = tags().filter(function(v) {
return v != tag;
});
tags(tmp);
}
view(vnode) {
return m(".tag-input.mar-t-xs",
[
vnode.attrs.tags().map((tag) => {
return m('span.badge.mar-r-xs.mar-b-xs',
{
... | {
let tmp = tags();
tmp.push(e.target.value);
tags(tmp);
} | conditional_block |
TagInput.js | import m from "mithril";
import Stream from "mithril/stream";
export default class TagInput {
add (e, tags) {
if (e.keyCode === 13 && e.target.value) {
if (tags().indexOf(e.target.value) === -1) {
let tmp = tags();
tmp.push(e.target.value);
tags(tmp);
}
e.target.value = ... | }
} | onkeypress: (e) => vnode.state.add(e, vnode.attrs.tags)
})
]) | random_line_split |
TagInput.js | import m from "mithril";
import Stream from "mithril/stream";
export default class TagInput {
| (e, tags) {
if (e.keyCode === 13 && e.target.value) {
if (tags().indexOf(e.target.value) === -1) {
let tmp = tags();
tmp.push(e.target.value);
tags(tmp);
}
e.target.value = '';
}
}
del (tag, tags) {
let tmp = tags().filter(function(v) {
return v != tag... | add | identifier_name |
form-field.d.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Directionality } from '@angular/cdk/bidi';
import { BooleanInput } from '@angular/cdk/coercion';
import { Aft... | /**
* Whether the label for form fields should by default float `always`,
* `never`, or `auto` (only when necessary).
*/
floatLabel?: FloatLabelType;
}
/**
* Injection token that can be used to configure the
* default options for all form field within an app.
*/
export declare const MAT_FORM_F... | hideRequiredMarker?: boolean; | random_line_split |
form-field.d.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Directionality } from '@angular/cdk/bidi';
import { BooleanInput } from '@angular/cdk/coercion';
import { Aft... | extends _MatFormFieldBase implements AfterContentInit, AfterContentChecked, AfterViewInit, OnDestroy, CanColor {
private _changeDetectorRef;
private _dir;
private _defaults;
private _platform;
private _ngZone;
/**
* Whether the outline gap needs to be calculated
* immediately on the n... | MatFormField | identifier_name |
extendableevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
use dom::bindings::codegen::Bindings::Ex... | () -> ExtendableEventBinding::ExtendableEventInit {
ExtendableEventBinding::ExtendableEventInit {
parent: EventBinding::EventInit::default(),
}
}
}
| default | identifier_name |
extendableevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
use dom::bindings::codegen::Bindings::Ex... |
// Step 2
// TODO add a extended_promises array to enqueue the `val`
Ok(())
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
pub fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
impl Default for ExtendableEventBinding::ExtendableEventInit {
fn default(... | {
return Err(Error::InvalidState);
} | conditional_block |
extendableevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
use dom::bindings::codegen::Bindings::Ex... | }
} | } | random_line_split |
extendableevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
use dom::bindings::codegen::Bindings::Ex... |
// https://w3c.github.io/ServiceWorker/#wait-until-method
pub fn WaitUntil(&self, _cx: *mut JSContext, _val: HandleValue) -> ErrorResult {
// Step 1
if !self.extensions_allowed {
return Err(Error::InvalidState);
}
// Step 2
// TODO add a extended_promises ar... | {
Ok(ExtendableEvent::new(worker,
Atom::from(type_),
init.parent.bubbles,
init.parent.cancelable))
} | identifier_body |
property.js | /**
* Checks if a given DOM property of an element has the expected value. For all the available DOM element properties, consult the [Element doc at MDN](https://developer.mozilla.org/en-US/docs/Web/API/element).
*
* @example
* this.demoTest = function (browser) {
* browser.expect.element('body').to.have.propert... |
this.done();
}
}
onResultFailed() {
this.passed = false;
}
}
module.exports = PropertyAssertion;
| {
this.messageParts.push(' - property was not found');
} | conditional_block |
property.js | /**
* Checks if a given DOM property of an element has the expected value. For all the available DOM element properties, consult the [Element doc at MDN](https://developer.mozilla.org/en-US/docs/Web/API/element).
* | * browser.expect.element('body').to.not.have.property('classList').equals('test-class');
* browser.expect.element('body').to.have.property('classList').deep.equal(['class-one', 'class-two']);
* browser.expect.element('body').to.have.property('classList').contain('class-two');
* };
*
* @method property
* @p... | * @example
* this.demoTest = function (browser) {
* browser.expect.element('body').to.have.property('className').equals('test-class');
* browser.expect.element('body').to.have.property('className').matches(/^something\ else/); | random_line_split |
property.js | /**
* Checks if a given DOM property of an element has the expected value. For all the available DOM element properties, consult the [Element doc at MDN](https://developer.mozilla.org/en-US/docs/Web/API/element).
*
* @example
* this.demoTest = function (browser) {
* browser.expect.element('body').to.have.propert... | () {
this.processFlags();
this.passed = this.hasCondition() ? false : this.negate;
if (!this.passed && this.shouldRetry()) {
this.scheduleRetry();
} else {
this.addExpectedInMessagePart();
if (!this.hasCondition()) {
//this.expected = this.negate ? 'not found' : 'found';
... | propertyNotFound | identifier_name |
property.js | /**
* Checks if a given DOM property of an element has the expected value. For all the available DOM element properties, consult the [Element doc at MDN](https://developer.mozilla.org/en-US/docs/Web/API/element).
*
* @example
* this.demoTest = function (browser) {
* browser.expect.element('body').to.have.propert... |
propertyNotFound() {
this.processFlags();
this.passed = this.hasCondition() ? false : this.negate;
if (!this.passed && this.shouldRetry()) {
this.scheduleRetry();
} else {
this.addExpectedInMessagePart();
if (!this.hasCondition()) {
//this.expected = this.negate ? 'not fou... | {
if (this.retries > 0 && this.negate) {
return;
}
if (!this.hasCondition()) {
this.passed = !this.negate;
this.expected = this.negate ? 'not found' : 'found';
this.actual = 'found';
}
this.addExpectedInMessagePart();
} | identifier_body |
products.client.controller.test.js | 'use strict';
(function() {
// ProductAppliers Controller Spec
describe('ProductAppliersController', function() {
// Initialize global variables
var ProductAppliersController,
scope,
$httpBackend,
$stateParams,
$location;
// The $resource service augments the response object with methods for updat... | });
// Create a sample productApplier response
var sampleProductApplierResponse = new ProductAppliers({
_id: '525cf20451979dea2c000001',
title: 'An ProductApplier about MEAN',
content: 'MEAN rocks!'
});
// Fixture mock form input values
scope.title = 'An ProductApplier about MEAN';
sc... | random_line_split | |
setup.py | # encoding: utf-8
#
# 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/. | # Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from distutils.util import convert_path
import os
from setuptools import setup
root = os.path.abspath(os.path.dirname(__file__))
path = lambda *p: os.path.join(root, *p)
try:
long_desc = open(path('README.txt')).read()
except Exception:
long_desc = "<Missing R... | # | random_line_split |
setup.py | # encoding: utf-8
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from distutils.util import convert_path
import os... | (where='.', lib_prefix='', exclude=()):
"""
SNAGGED FROM distribute-0.6.49-py2.7.egg/setuptools/__init__.py
"""
out = []
stack=[(convert_path(where), lib_prefix)]
while stack:
where,prefix = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where,name)
... | find_packages | identifier_name |
setup.py | # encoding: utf-8
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from distutils.util import convert_path
import os... |
for pat in list(exclude)+['ez_setup', 'distribute_setup']:
from fnmatch import fnmatchcase
out = [item for item in out if not fnmatchcase(item,pat)]
return out
setup(
name='mo-hg',
version="2.18.18240",
description='Fast cache for Mozilla\'s Mercurial repository',
long_descrip... | out.append(prefix+name); stack.append((fn,prefix+name+'.')) | conditional_block |
setup.py | # encoding: utf-8
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from distutils.util import convert_path
import os... |
setup(
name='mo-hg',
version="2.18.18240",
description='Fast cache for Mozilla\'s Mercurial repository',
long_description=long_desc,
author='Kyle Lahnakoski',
author_email='kyle@lahnakoski.com',
url='https://github.com/klahnakoski/mo-hg',
license='MPL 2.0',
packages=find_packages(... | """
SNAGGED FROM distribute-0.6.49-py2.7.egg/setuptools/__init__.py
"""
out = []
stack=[(convert_path(where), lib_prefix)]
while stack:
where,prefix = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where,name)
if ('.' not in name and os.path.isd... | identifier_body |
proj_desc.py | #! /bin/python3
# $Id
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
# Eclipse Public Licen... |
# -----------------------------------------------------------------------------
# update cppad_conf_dir
#
cppad_conf_dir = os.environ['HOME'] + '/cppad.svn/conf'
if os.path.exists(cppad_conf_dir ) :
cmd = 'svn update ' + cppad_conf_dir
print( cmd )
else :
cmd = 'svn checkout https://projects.coin-or.org/svn/CppAD/c... | try :
output = subprocess.check_output(
cmd,
stderr=subprocess.STDOUT,
shell=True
)
except subprocess.CalledProcessError as info :
msg = str( info.output , 'ascii' )
msg += '\nbin/proj_desc.py exiting because command above failed'
sys.exit(msg)
return str( output, 'ascii' ) | identifier_body |
proj_desc.py | #! /bin/python3
# $Id
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
# Eclipse Public Licen... | text='\n'
for name in other_package :
url = other_package[name]
text += ' <otherPackage>\n'
text += ' <packageName>' + name + '</packageName>\n'
text += ' <packageURL>' + url + '</packageURL>\n'
text += ' <requiredOrOptional>Optional</requiredOrOptional>\n'
text += ' </otherPac... | 'http,//pubs.opengroup.org/onlinepubs/009695399/basedefs/pthread.h.html'),
('Sacado', 'http://trilinos.org/packages/sacado')
] ) | random_line_split |
proj_desc.py | #! /bin/python3
# $Id
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
# Eclipse Public Licen... | (cmd) :
try :
output = subprocess.check_output(
cmd,
stderr=subprocess.STDOUT,
shell=True
)
except subprocess.CalledProcessError as info :
msg = str( info.output , 'ascii' )
msg += '\nbin/proj_desc.py exiting because command above failed'
sys.exit(msg)
return str( output, 'ascii' )
# ------------... | system_cmd | identifier_name |
proj_desc.py | #! /bin/python3
# $Id
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
# Eclipse Public Licen... |
# -----------------------------------------------------------------------------
def system_cmd(cmd) :
try :
output = subprocess.check_output(
cmd,
stderr=subprocess.STDOUT,
shell=True
)
except subprocess.CalledProcessError as info :
msg = str( info.output , 'ascii' )
msg += '\nbin/proj_desc.py exit... | msg = 'expected 0 but found ' + str(narg-1) + ' command line arguments'
sys.exit(usage + msg) | conditional_block |
setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of captlog.
#
# captlog - The Captain's Log (secret diary and notes application)
#
# Written in 2013 by Ricardo Garcia <r@rg3.name>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to... |
setup(
name='captlog',
version=VERSION,
description="The Captain's Log (secret diary and notes application)",
author='Ricardo Garcia',
author_email='r@rg3.name',
url='http://www.github.com/rg3/captlog',
packages=['CaptainsLog'],
package_dir={'CaptainsLog': 'src/lib'},
package_data={... | # <http://creativecommons.org/publicdomain/zero/1.0/>.
from distutils.core import setup
VERSION = '0.1.1' | random_line_split |
float.rs | use super::sort::{sort_by};
use num_traits::{Float, zero};
use unreachable::UncheckedOptionExt;
/// Sorts floating point numbers efficiently.
/// The ordering used is
/// | -inf | < 0 | -0 | +0 | > 0 | +inf | NaN |
pub fn sort_floats<T: Float>(v: &mut [T]) | // Skip NaNs already in place
while rnan > 0 && v[rnan].is_nan() {
rnan -= 1;
}
let mut p = rnan;
while p > 0 {
p -= 1;
if v[p].is_nan() {
v.swap(p, rnan);
rnan -= 1;
}
}
// Sort the non-NaN part with efficient comparisons
sort_by(... | {
/*
* We don't have hardware support for a total order on floats. NaN is not
* smaller or greater than any number. We want NaNs to be last, so we could
* just use is_nan() in the comparison function. It turns out that this hurts
* performance a lot, and in most cases we probably don't have any ... | identifier_body |
float.rs | use super::sort::{sort_by};
use num_traits::{Float, zero};
use unreachable::UncheckedOptionExt;
/// Sorts floating point numbers efficiently.
/// The ordering used is
/// | -inf | < 0 | -0 | +0 | > 0 | +inf | NaN |
pub fn sort_floats<T: Float>(v: &mut [T]) {
/*
* We don't have hardware support for a total ord... | for x in v[left..].iter() {
if *x != zero() {
break;
}
if x.is_sign_negative() {
neg_zeros += 1;
} else {
zeros += 1;
}
}
for x in v[left..].iter_mut() {
if neg_zeros > 0 {
*x = Float::neg_zero();
neg... |
// Count zeros of each type and then fill them in in the right order
let mut zeros = 0;
let mut neg_zeros = 0; | random_line_split |
float.rs | use super::sort::{sort_by};
use num_traits::{Float, zero};
use unreachable::UncheckedOptionExt;
/// Sorts floating point numbers efficiently.
/// The ordering used is
/// | -inf | < 0 | -0 | +0 | > 0 | +inf | NaN |
pub fn sort_floats<T: Float>(v: &mut [T]) {
/*
* We don't have hardware support for a total ord... | <T: Float>(v: &[T]) -> usize {
if v.len() == 0 { return 0; }
let mut hi = v.len() - 1;
let mut left = 0;
while left < hi {
let mid = ((hi - left) / 2) + left;
if v[mid] < zero() {
left = mid + 1;
} else {
hi = mid;
}
}
while left < v.len(... | find_first_zero | identifier_name |
float.rs | use super::sort::{sort_by};
use num_traits::{Float, zero};
use unreachable::UncheckedOptionExt;
/// Sorts floating point numbers efficiently.
/// The ordering used is
/// | -inf | < 0 | -0 | +0 | > 0 | +inf | NaN |
pub fn sort_floats<T: Float>(v: &mut [T]) {
/*
* We don't have hardware support for a total ord... |
}
for x in v[left..].iter_mut() {
if neg_zeros > 0 {
*x = Float::neg_zero();
neg_zeros -= 1;
} else if zeros > 0 {
*x = zero();
zeros -= 1;
} else {
break;
}
}
}
/// Find the first zero in `v`.
/// If there is no... | {
zeros += 1;
} | conditional_block |
vimeo.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... |
else:
yield ServiceError("Can't find any streams.")
return
| yield HTTP(copy.copy(self.config), i["url"], i["height"], output=self.output) | conditional_block |
vimeo.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... |
jsondata = json.loads(player_data)
if ("hls" in jsondata["request"]["files"]) and ("fastly_skyfire" in jsondata["request"]["files"]["hls"]["cdns"]):
hls_elem = jsondata["request"]["files"]["hls"]["cdns"]["fastly_skyfire"]
yield from hlsparse(self.config, self.ht... | supported_domains = ["vimeo.com", "player.vimeo.com"]
def get(self):
data = self.get_urldata()
match_cfg_url = re.search('data-config-url="([^"]+)" data-fallback-url', data)
match_clip_page_cfg = re.search(r"vimeo\.clip_page_config\s*=\s*({.+?});", data)
if match_cfg_url:
... | identifier_body |
vimeo.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... |
def get(self):
data = self.get_urldata()
match_cfg_url = re.search('data-config-url="([^"]+)" data-fallback-url', data)
match_clip_page_cfg = re.search(r"vimeo\.clip_page_config\s*=\s*({.+?});", data)
if match_cfg_url:
player_url = match_cfg_url.group(1).replace("&... | random_line_split | |
vimeo.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... | (self):
data = self.get_urldata()
match_cfg_url = re.search('data-config-url="([^"]+)" data-fallback-url', data)
match_clip_page_cfg = re.search(r"vimeo\.clip_page_config\s*=\s*({.+?});", data)
if match_cfg_url:
player_url = match_cfg_url.group(1).replace("&", "&")
... | get | identifier_name |
infoblox.py | #!/usr/bin/env python
#
# (c) 2018, Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | ():
parser = argparse.ArgumentParser()
parser.add_argument('--list', action='store_true',
help='List host records from NIOS for use in Ansible')
parser.add_argument('--host',
help='List meta data about single host (not used)')
return parser.parse_args()... | parse_args | identifier_name |
infoblox.py | #!/usr/bin/env python
#
# (c) 2018, Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
hostvars = {}
inventory = {
'_meta': {
'hostvars': hostvars
}
}
return_fields = ['name', 'view', 'extattrs', 'ipv4addrs']
hosts = connector.get_object('record:host',
host_filter,
extattrs=extattrs,
... | extattrs = {} | conditional_block |
infoblox.py | #!/usr/bin/env python
#
# (c) 2018, Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | else:
host_filter = {}
config_filters = config.get('filters')
if config_filters.get('view') is not None:
host_filter['view'] = config_filters['view']
if config_filters.get('extattrs'):
extattrs = normalize_extattrs(config_filters['extattrs'])
else:
extattrs = {}
... | args = parse_args()
for config_file in CONFIG_FILES:
if os.path.exists(config_file):
break
else:
sys.stdout.write('unable to locate config file at /etc/ansible/infoblox.yaml\n')
sys.exit(-1)
try:
loader = DataLoader()
config = loader.load_from_file(confi... | identifier_body |
infoblox.py | #!/usr/bin/env python
#
# (c) 2018, Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
if __name__ == '__main__':
main() | random_line_split | |
unix.rs | /*
* This file is part of the uutils coreutils package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use std::io::{Result, Error};
use ::libc;
use self::c_types::{c_passwd, getpwuid};... | () -> Result<String> {
// Get effective user id
let uid = geteuid();
// Try to find username for uid
let passwd: *const c_passwd = getpwuid(uid);
if passwd.is_null() {
return Err(Error::last_os_error())
}
// Extract username from passwd struct
let pw_name: *const libc::c_char =... | getusername | identifier_name |
unix.rs | /*
* This file is part of the uutils coreutils package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use std::io::{Result, Error};
use ::libc;
use self::c_types::{c_passwd, getpwuid};... | pub unsafe fn getusername() -> Result<String> {
// Get effective user id
let uid = geteuid();
// Try to find username for uid
let passwd: *const c_passwd = getpwuid(uid);
if passwd.is_null() {
return Err(Error::last_os_error())
}
// Extract username from passwd struct
let pw_na... | }
| random_line_split |
unix.rs | /*
* This file is part of the uutils coreutils package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use std::io::{Result, Error};
use ::libc;
use self::c_types::{c_passwd, getpwuid};... |
// Extract username from passwd struct
let pw_name: *const libc::c_char = (*passwd).pw_name;
let username = String::from_utf8_lossy(::std::ffi::CStr::from_ptr(pw_name).to_bytes()).to_string();
Ok(username)
}
| {
return Err(Error::last_os_error())
} | conditional_block |
unix.rs | /*
* This file is part of the uutils coreutils package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use std::io::{Result, Error};
use ::libc;
use self::c_types::{c_passwd, getpwuid};... | {
// Get effective user id
let uid = geteuid();
// Try to find username for uid
let passwd: *const c_passwd = getpwuid(uid);
if passwd.is_null() {
return Err(Error::last_os_error())
}
// Extract username from passwd struct
let pw_name: *const libc::c_char = (*passwd).pw_name;
... | identifier_body | |
core.py | # coding=utf-8
from __future__ import print_function
import cmd
import inspect
import sys
from panshell.base import FS
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.stack = []
self.fsmap = {}
self.fs = None
self._funcs = []
self._keyword... |
def get_names(self):
"""
rewrite cmd.Cmd `dir(self.__class__)`
"""
return dir(self)
def __getattr__(self, name):
if name.startswith('do_'):
action = name[3:]
if action not in self._keywords:
return getattr(self.fs, name)
... | raise Exception('FS <{}> has already plugin in '.format(name))
fs = fscls(**setting)
self.fsmap[name] = (fscls, setting, fs) | random_line_split |
core.py | # coding=utf-8
from __future__ import print_function
import cmd
import inspect
import sys
from panshell.base import FS
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.stack = []
self.fsmap = {}
self.fs = None
self._funcs = []
self._keyword... |
fs = fscls(**setting)
self.fsmap[name] = (fscls, setting, fs)
def get_names(self):
"""
rewrite cmd.Cmd `dir(self.__class__)`
"""
return dir(self)
def __getattr__(self, name):
if name.startswith('do_'):
action = name[3:]
if actio... | raise Exception('FS <{}> has already plugin in '.format(name)) | conditional_block |
core.py | # coding=utf-8
from __future__ import print_function
import cmd
import inspect
import sys
from panshell.base import FS
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.stack = []
self.fsmap = {}
self.fs = None
self._funcs = []
self._keyword... | def do_use(self, name):
"""use <fs> 选择使用某个fs
use baidu
use local
"""
if name not in self.fsmap:
raise Exception('not plugin in this FS with name %s', name)
fscls, setting, _ = self.fsmap[name]
fs = fscls(**setting)
self.stack.append(s... | elf.fs is not None:
self._plugin_out()
self.fs = fs
self._plugin_in(fs)
| identifier_body |
core.py | # coding=utf-8
from __future__ import print_function
import cmd
import inspect
import sys
from panshell.base import FS
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.stack = []
self.fsmap = {}
self.fs = None
self._funcs = []
self._keyword... | (self):
"""
rewrite cmd.Cmd `dir(self.__class__)`
"""
return dir(self)
def __getattr__(self, name):
if name.startswith('do_'):
action = name[3:]
if action not in self._keywords:
return getattr(self.fs, name)
if name in self.__... | get_names | identifier_name |
multi_map_contains_value_codec.py | from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.multi_map_message_type import *
REQUEST_TYPE = MULTIMAP_CONTAINSVALUE
RESPONSE_TYPE = 101
R... | (name, value):
""" Calculates the request payload size"""
data_size = 0
data_size += calculate_size_str(name)
data_size += calculate_size_data(value)
return data_size
def encode_request(name, value):
""" Encode request into client_message"""
client_message = ClientMessage(payload_size=calc... | calculate_size | identifier_name |
multi_map_contains_value_codec.py | from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.multi_map_message_type import *
REQUEST_TYPE = MULTIMAP_CONTAINSVALUE
RESPONSE_TYPE = 101
R... |
def encode_request(name, value):
""" Encode request into client_message"""
client_message = ClientMessage(payload_size=calculate_size(name, value))
client_message.set_message_type(REQUEST_TYPE)
client_message.set_retryable(RETRYABLE)
client_message.append_str(name)
client_message.append_data(va... | random_line_split | |
multi_map_contains_value_codec.py | from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.multi_map_message_type import *
REQUEST_TYPE = MULTIMAP_CONTAINSVALUE
RESPONSE_TYPE = 101
R... |
def decode_response(client_message, to_object=None):
""" Decode response from client message"""
parameters = dict(response=None)
parameters['response'] = client_message.read_bool()
return parameters
| """ Encode request into client_message"""
client_message = ClientMessage(payload_size=calculate_size(name, value))
client_message.set_message_type(REQUEST_TYPE)
client_message.set_retryable(RETRYABLE)
client_message.append_str(name)
client_message.append_data(value)
client_message.update_frame_l... | identifier_body |
webapi.mock.d.ts | /// <reference types="xrm" />
export declare class | implements Xrm.WebApi {
online: Xrm.WebApiOnline;
offline: Xrm.WebApiOffline;
private clientContext;
private isOffline;
constructor(clientContext: Xrm.ClientContext, online: Xrm.WebApiOnline, offline: Xrm.WebApiOffline);
createRecord(entityLogicalName: string, record: any): Xrm.Async.PromiseLik... | WebApiMock | identifier_name |
webapi.mock.d.ts | /// <reference types="xrm" />
export declare class WebApiMock implements Xrm.WebApi {
online: Xrm.WebApiOnline;
offline: Xrm.WebApiOffline;
private clientContext;
private isOffline;
constructor(clientContext: Xrm.ClientContext, online: Xrm.WebApiOnline, offline: Xrm.WebApiOffline);
createRecord(... | } | random_line_split | |
p035.rs | //! [Problem 35](https://projecteuler.net/problem=35) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate integer;
extern crate prime;
use integer::Integer;
use prime::PrimeSet;
... | }
} | }
#[test]
fn below100() {
assert_eq!(13, super::compute(100)); | random_line_split |
p035.rs | //! [Problem 35](https://projecteuler.net/problem=35) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate integer;
extern crate prime;
use integer::Integer;
use prime::PrimeSet;
... | () {
assert_eq!(13, super::compute(100));
}
}
| below100 | identifier_name |
p035.rs | //! [Problem 35](https://projecteuler.net/problem=35) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate integer;
extern crate prime;
use integer::Integer;
use prime::PrimeSet;
... |
}
true
}
fn compute(limit: u64) -> usize {
let ps = PrimeSet::new();
ps.iter()
.take_while(|&p| p < limit)
.filter(|&n| is_circular_prime(&ps, n))
.count()
}
fn solve() -> String {
compute(1000000).to_string()
}
problem!("55", solve);
#[cfg(test)]
mod tests {
use pr... | {
return false;
} | conditional_block |
p035.rs | //! [Problem 35](https://projecteuler.net/problem=35) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate integer;
extern crate prime;
use integer::Integer;
use prime::PrimeSet;
... |
fn solve() -> String {
compute(1000000).to_string()
}
problem!("55", solve);
#[cfg(test)]
mod tests {
use prime::PrimeSet;
#[test]
fn is_circular_prime() {
let ps = PrimeSet::new();
assert_eq!(true, super::is_circular_prime(&ps, 197));
assert_eq!(false, super::is_circular_pr... | {
let ps = PrimeSet::new();
ps.iter()
.take_while(|&p| p < limit)
.filter(|&n| is_circular_prime(&ps, n))
.count()
} | identifier_body |
package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
| for (scientific) software on HPC systems.
"""
homepage = 'https://easybuilders.github.io/easybuild'
url = 'https://pypi.io/packages/source/e/easybuild-framework/easybuild-framework-4.0.0.tar.gz'
maintainers = ['boegel']
version('4.0.0', sha256='f5c40345cc8b9b5750f53263ade6c9c3a8cd3dfab488... |
class PyEasybuildFramework(PythonPackage):
"""The core of EasyBuild, a software build and installation framework | random_line_split |
package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyEasybuildFramework(PythonPackage):
| """The core of EasyBuild, a software build and installation framework
for (scientific) software on HPC systems.
"""
homepage = 'https://easybuilders.github.io/easybuild'
url = 'https://pypi.io/packages/source/e/easybuild-framework/easybuild-framework-4.0.0.tar.gz'
maintainers = ['boegel']
... | identifier_body | |
package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class | (PythonPackage):
"""The core of EasyBuild, a software build and installation framework
for (scientific) software on HPC systems.
"""
homepage = 'https://easybuilders.github.io/easybuild'
url = 'https://pypi.io/packages/source/e/easybuild-framework/easybuild-framework-4.0.0.tar.gz'
maintain... | PyEasybuildFramework | identifier_name |
filter_form.js | function setupFilterForm() {
// make filter form expandable
$('#filter-panel .card-header').on('click', function() {
$('#filter-panel .card-body').toggle(200);
if($('#filter-panel').hasClass('filter-panel-bottom')) {
$('html,body').animate({
scrollTop: $(document).hei... | return filterLabels;
} | }
}
if(filterLabels.length > 0) {
$('#filter-panel .card-header').find('span').text('current: ' + filterLabels.join(', '));
} | random_line_split |
filter_form.js | function setupFilterForm() {
// make filter form expandable
$('#filter-panel .card-header').on('click', function() {
$('#filter-panel .card-body').toggle(200);
if($('#filter-panel').hasClass('filter-panel-bottom')) {
$('html,body').animate({
scrollTop: $(document).hei... | lse {
var input = $('<input/>');
input.attr('value', val);
input.attr('name', key);
input.attr('hidden', true);
$('#filter-form').append(input);
}
}
}
if(filterLabels.length > 0) {
$('#filter-panel .card-... | filterLabels.push(filterLabel);
} e | conditional_block |
filter_form.js | function setupFilterForm() | }
});
}
function parseFilterArguments(paramHandler) {
var varPairs = window.location.search.substring(1).split('&');
var filterLabels = [];
for (var j = 0; j < varPairs.length; ++j) {
var pair = varPairs[j].split('=');
if(pair.length > 1) {
var key = decodeURICompone... | {
// make filter form expandable
$('#filter-panel .card-header').on('click', function() {
$('#filter-panel .card-body').toggle(200);
if($('#filter-panel').hasClass('filter-panel-bottom')) {
$('html,body').animate({
scrollTop: $(document).height()
});
... | identifier_body |
filter_form.js | function setupFilterForm() {
// make filter form expandable
$('#filter-panel .card-header').on('click', function() {
$('#filter-panel .card-body').toggle(200);
if($('#filter-panel').hasClass('filter-panel-bottom')) {
$('html,body').animate({
scrollTop: $(document).hei... | aramHandler) {
var varPairs = window.location.search.substring(1).split('&');
var filterLabels = [];
for (var j = 0; j < varPairs.length; ++j) {
var pair = varPairs[j].split('=');
if(pair.length > 1) {
var key = decodeURIComponent(pair[0].replace(/\+/g, '%20'));
var v... | rseFilterArguments(p | identifier_name |
LCMRover.py | '''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | (self, botname):
'''
Init the rover and store the name
'''
self.__botname = botname
self.__lcm = lcm.LCM("udpm://239.255.76.67:7667?ttl=1")
self.__controlSubscription = self.__lcm.subscribe("ARNerve_Bot_Control_" + self.__botname, self.UpdateBotC... | Initialize | identifier_name |
LCMRover.py | '''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | #except:
# print "Exception", sys.exc_info()[0]
# pass
def Update(self):
'''
Update the LCM
'''
self.__lcm.handle()
def Disconnect(self):
self.lc.unsubscribe(self.__controlSubscription)
def UpdateBotControlHandler(s... | battery = self.getBatteryPercentage()
camUpdate.batteryPercentage = battery
self.__lcm.publish("ARNerve_Bot_Update_" + self.__botname, camUpdate.encode())
| random_line_split |
LCMRover.py | '''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... |
self.setTreads(controlParams.botTreadVelLeft, controlParams.botTreadVelright)
print "Setting the treads to {0}, {1}".format(controlParams.botTreadVelLeft, controlParams.botTreadVelright)
if self.__lightsOn != controlParams.isLightsOn:
if controlParams.isLightsOn != 0:
... | return | conditional_block |
LCMRover.py | '''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | else:
self.turnInfraredOff()
self.__infraredOn = controlParams.isInfraredOn
| '''
Get the updated bot parameters and send them to the bot.
'''
controlParams = bot_control_command_t.decode(data)
# Check if it is the right bot.
if self.__botname != controlParams.name:
return
self.setTreads(controlParams.botTreadVelLeft,... | identifier_body |
transaction-json.py | from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
try:
import json
except ImportError:
import simplejson as json
requires_api_version = '2.5'
plugin_type = (TYPE_INTERACTIVE,)
def config_hook(conduit):
parser = conduit.getOptParser()
parser.add_option('', '--json', dest='json', acti... | (conduit):
opts, commands = conduit.getCmdLine()
if opts.json:
packages = {}
for transaction in conduit.getTsInfo():
if transaction.name not in packages:
packages[transaction.name] = {}
version = {
"version": transaction.version,
... | postresolve_hook | identifier_name |
transaction-json.py | from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
try:
import json
except ImportError:
import simplejson as json
requires_api_version = '2.5'
plugin_type = (TYPE_INTERACTIVE,)
def config_hook(conduit):
parser = conduit.getOptParser()
parser.add_option('', '--json', dest='json', acti... |
print(json.dumps(packages))
raise PluginYumExit('')
| if transaction.name not in packages:
packages[transaction.name] = {}
version = {
"version": transaction.version,
"release": transaction.release,
"epoch": transaction.epoch,
"arch": transaction.arch,
"state": tra... | conditional_block |
transaction-json.py | from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
try:
import json
except ImportError:
import simplejson as json
requires_api_version = '2.5'
plugin_type = (TYPE_INTERACTIVE,)
def config_hook(conduit):
|
def postresolve_hook(conduit):
opts, commands = conduit.getCmdLine()
if opts.json:
packages = {}
for transaction in conduit.getTsInfo():
if transaction.name not in packages:
packages[transaction.name] = {}
version = {
"version": trans... | parser = conduit.getOptParser()
parser.add_option('', '--json', dest='json', action='store_true',
default=False,
help="show pending package changes as JSON") | identifier_body |
transaction-json.py | from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
try:
import json
except ImportError:
import simplejson as json
requires_api_version = '2.5'
plugin_type = (TYPE_INTERACTIVE,)
def config_hook(conduit):
parser = conduit.getOptParser()
parser.add_option('', '--json', dest='json', acti... | if opts.json:
packages = {}
for transaction in conduit.getTsInfo():
if transaction.name not in packages:
packages[transaction.name] = {}
version = {
"version": transaction.version,
"release": transaction.release,
... | opts, commands = conduit.getCmdLine()
| random_line_split |
html.py | import re
def | (txtlines):
outline = []
lcnt = -1
for line in txtlines:
lcnt += 1
typ = None
itmText = None
spc = (len(line) -len(line.lstrip()))*' '
tls = line.lstrip()
if tls.lower().startswith('<body'):
itmText = '<BODY>'
typ... | analyzeLine | identifier_name |
html.py | import re
def analyzeLine(txtlines):
outline = []
lcnt = -1
| typ = None
itmText = None
spc = (len(line) -len(line.lstrip()))*' '
tls = line.lstrip()
if tls.lower().startswith('<body'):
itmText = '<BODY>'
typ = 'object'
elif tls.lower().startswith('<head'):
itmText = '<HEAD>'
... | for line in txtlines:
lcnt += 1
| random_line_split |
html.py | import re
def analyzeLine(txtlines):
outline = []
lcnt = -1
for line in txtlines:
lcnt += 1
typ = None
itmText = None
spc = (len(line) -len(line.lstrip()))*' '
tls = line.lstrip()
if tls.lower().startswith('<body'):
itmText... |
elif tls.startswith('//---'):
itmText =tls[5:]
typ = 'heading'
# CSS
elif tls.startswith('/*---'):
itmText =tls[5:].split('*/')[0]
typ = 'heading'
if itmText != None:
outline.append([spc+itmText,typ,lcnt])
r... | itmText =tls[9:].rstrip()
if itmText.endswith('{'): itmText = itmText[:-1]
typ = 'function' | conditional_block |
html.py | import re
def analyzeLine(txtlines):
| itmText =tls[5:].replace('-->','')
typ = 'heading'
# Javascript
elif tls.startswith('function '):
itmText =tls[9:].rstrip()
if itmText.endswith('{'): itmText = itmText[:-1]
typ = 'function'
elif tls.startswith('//---'):
itm... | outline = []
lcnt = -1
for line in txtlines:
lcnt += 1
typ = None
itmText = None
spc = (len(line) -len(line.lstrip()))*' '
tls = line.lstrip()
if tls.lower().startswith('<body'):
itmText = '<BODY>'
typ = 'object'
... | identifier_body |
link-dialog.component.ts | import { Component, Inject, Input, OnChanges, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatListOption } from '@angular/material/list';
import { LinkDialogInterface } from '../../interfaces';
import { Link... |
implements OnInit, OnChanges, LinkDialogInterface {
@Input() titleString: string;
objects: Array<any>;
constructor(private route: ActivatedRoute,
public dialogRef: MatDialogRef<LinkDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: LinkDialogData) {
}
ngOnInit() {
}
ngOnChanges() {
}
... | LinkDialogComponent | identifier_name |
link-dialog.component.ts | import { Component, Inject, Input, OnChanges, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatListOption } from '@angular/material/list';
import { LinkDialogInterface } from '../../interfaces';
import { Link... | }
onNoClick(): void {
this.dialogRef.close();
}
onSelection(e, v: Array<MatListOption>) {
this.data.selected = new Array<LinkItem>();
for (const a of v) {
const li = { index: 0, label: a.getLabel(), id: a.value };
this.data.selected.push(li);
}
}
} |
ngOnChanges() { | random_line_split |
link-dialog.component.ts | import { Component, Inject, Input, OnChanges, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatListOption } from '@angular/material/list';
import { LinkDialogInterface } from '../../interfaces';
import { Link... |
ngOnInit() {
}
ngOnChanges() {
}
onNoClick(): void {
this.dialogRef.close();
}
onSelection(e, v: Array<MatListOption>) {
this.data.selected = new Array<LinkItem>();
for (const a of v) {
const li = { index: 0, label: a.getLabel(), id: a.value };
this.data.selected.push(li);
... | {
} | identifier_body |
index.js | #!/usr/bin/env node
var _ = require('underscore');
var app = require('./package.json');
var opts = require('commander');
var path = require('path');
var utils = require('./utils');
// globals for keeping track of walked files/dirs
var dirs = [];
var files = [];
// There are only two options: encrypt, and decrypt.
//... | *
* @param {String} root
* @param {Object} stats
* @param {function} next
*/
var walkErrorCallback = function(root, stats, next) {
console.log('walk error!');
process.exit(1);
// next();
};
if (opts.encrypt) {
// locally backup encrypted dir before we try to encrypt
utils.copyDirectory('./encrypted', '... |
/**
* Reports error and exits | random_line_split |
test_delivery_trip.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
import unittest
from frappe.utils import nowdate, add_days
from erpnext.tests.utils import create_test_contact_and_address
from erpnext.sto... | })
vehicle.insert() | random_line_split | |
test_delivery_trip.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
import unittest
from frappe.utils import nowdate, add_days
from erpnext.tests.utils import create_test_contact_and_address
from erpnext.sto... |
def test_delivery_trip(self):
contact = get_contact_and_address("_Test Customer")
if not frappe.db.exists("Delivery Trip", "TOUR-00000"):
delivery_trip = frappe.new_doc("Delivery Trip")
delivery_trip.company = erpnext.get_default_company()
delivery_trip.date = add_days(nowdate(), 5)
delivery_trip.dr... | create_driver()
create_vehicle()
create_delivery_notfication()
create_test_contact_and_address() | identifier_body |
test_delivery_trip.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
import unittest
from frappe.utils import nowdate, add_days
from erpnext.tests.utils import create_test_contact_and_address
from erpnext.sto... | ():
if not frappe.db.exists("Driver", "Newton Scmander"):
driver = frappe.new_doc("Driver")
driver.full_name = "Newton Scmander"
driver.cell_number = "98343424242"
driver.license_number = "B809"
driver.insert()
def create_delivery_notfication():
if not frappe.db.exists("Standard Reply", "Delivery Notificat... | create_driver | identifier_name |
test_delivery_trip.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
import unittest
from frappe.utils import nowdate, add_days
from erpnext.tests.utils import create_test_contact_and_address
from erpnext.sto... |
def create_delivery_notfication():
if not frappe.db.exists("Standard Reply", "Delivery Notification"):
frappe.get_doc({
'doctype': 'Standard Reply',
'name': 'Delivery Notification',
'response': 'Test Delivery Trip',
'subject': 'Test Subject',
'owner': frappe.session.user
}).insert()
def create_ve... | driver = frappe.new_doc("Driver")
driver.full_name = "Newton Scmander"
driver.cell_number = "98343424242"
driver.license_number = "B809"
driver.insert() | conditional_block |
noDuplicateVariableRuleTests.ts | /*
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | it("ensures that variable declarations are unique within a scope", () => {
var fileName = "rules/duplicate-variable.test.ts";
var NoDuplicateVariableRule = Lint.Test.getRule("no-duplicate-variable");
var failureString = NoDuplicateVariableRule.FAILURE_STRING + "duplicated'";
var cre... | describe("<no-duplicate-variable>", () => { | random_line_split |
factory.py | # Copyright 2019 The TensorFlow 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 applica... | """Generator function for various evaluators."""
if params.type == 'box':
evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_json_file, include_mask=False)
elif params.type == 'box_and_mask':
evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_json_file, in... | identifier_body | |
factory.py | # Copyright 2019 The TensorFlow 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 applica... | (params):
"""Generator function for various evaluators."""
if params.type == 'box':
evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_json_file, include_mask=False)
elif params.type == 'box_and_mask':
evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_j... | evaluator_generator | identifier_name |
factory.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved. | # 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... | #
# Licensed under the Apache License, Version 2.0 (the "License"); | random_line_split |
factory.py | # Copyright 2019 The TensorFlow 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 applica... |
elif params.type == 'box_and_mask':
evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_json_file, include_mask=True)
else:
raise ValueError('Evaluator %s is not supported.' % params.type)
return coco_evaluator.MetricWrapper(evaluator)
| evaluator = coco_evaluator.COCOEvaluator(
annotation_file=params.val_json_file, include_mask=False) | conditional_block |
index.ts | import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatCardModule} from '@angular/material/card';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatRadioModule} from '@angular/material/radio';
import {CheckboxCo... | {
}
| CheckboxExamplesModule | identifier_name |
index.ts | import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatCardModule} from '@angular/material/card';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatRadioModule} from '@angular/material/radio';
import {CheckboxCo... | @NgModule({
imports: [
CommonModule,
MatCardModule,
MatCheckboxModule,
MatRadioModule,
FormsModule,
],
declarations: EXAMPLES,
exports: EXAMPLES,
entryComponents: EXAMPLES,
})
export class CheckboxExamplesModule {
} | CheckboxHarnessExample,
];
| random_line_split |
normalize.ts | */
export interface EntityMap {
[key: string]: { [id: string]: any };
}
/**
* The state interface from which the app state should extend.
* Holds an instance of `NormalizedEntityState` itself.
*/
export interface NormalizedState {
/** The normalized state property */
normalized: NormalizedEntityState;
}
/**
*... | <T>(
schema: schema.Entity
): MemoizedSelector<{}, T[]> {
return createSelector(
getNormalizedEntities,
createEntitiesProjector<T>(schema)
);
}
/**
* Create a schema bound projector function to denormalize a single entity.
* @param schema The schema to bind this selector to
*/
function createEntityProjector<... | createEntitiesSelector | identifier_name |
normalize.ts | string]: any };
}
/**
* The state interface from which the app state should extend.
* Holds an instance of `NormalizedEntityState` itself.
*/
export interface NormalizedState {
/** The normalized state property */
normalized: NormalizedEntityState;
}
/**
* The normalized state, representing a `normalizr.normal... | if (!entities || !entities[key]) { | random_line_split | |
normalize.ts | export interface EntityMap {
[key: string]: { [id: string]: any };
}
/**
* The state interface from which the app state should extend.
* Holds an instance of `NormalizedEntityState` itself.
*/
export interface NormalizedState {
/** The normalized state property */
normalized: NormalizedEntityState;
}
/**
* The... |
/**
* Create a schema bound denormalizer.
* @param schema The schema to bind this selector to
*/
function createSingleDenormalizer(schema: schema.Entity) {
const key = schema.key;
return (entities: { [key: string]: {} }, id: string) => {
/* | {
return (entities: {}, ids?: Array<string>) =>
createMultipleDenormalizer(schema)(entities, ids) as T[];
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.