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 |
|---|---|---|---|---|
autocomplete.component.ts | import { Component, OnInit, ViewChild, ElementRef, Input, Output, ViewEncapsulation } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import { Observable, Subject } from 'rxjs/Rx';
import bem from 'bem-cn';
import {DataService, ICity} from '../shared';
const selector = 'tch-au... | ({title, value}) {
this.isListVisible = false;
this.autocompleteGroup.setValue({
value: title,
id: value,
});
}
//https://stackoverflow.com/questions/38008334/angular-rxjs-when-should-i-unsubscribe-from-subscription
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.com... | onSelect | identifier_name |
Message.ts | // SPDX-FileCopyrightText: 2018-2021 The Manyverse Authors
//
// SPDX-License-Identifier: MPL-2.0
import xs, {Stream} from 'xstream';
import debounce from 'xstream/extra/debounce';
import {PureComponent} from 'react';
import {h} from '@cycle/react';
import {withXstreamProps} from 'react-xstream-hoc';
import {Msg, Feed... | (error: any, info: any) {
console.warn('Message componentDidCatch');
this.setState(() => ({hasError: true}));
}
public render() {
const {msg, replyCount} = this.props;
const metadata = msg.value._$manyverse$metadata;
const reactions = (
metadata.reactions ?? (xs.never() as Stream<Reaction... | componentDidCatch | identifier_name |
Message.ts | // SPDX-FileCopyrightText: 2018-2021 The Manyverse Authors
//
// SPDX-License-Identifier: MPL-2.0
import xs, {Stream} from 'xstream';
import debounce from 'xstream/extra/debounce';
import {PureComponent} from 'react';
import {h} from '@cycle/react';
import {withXstreamProps} from 'react-xstream-hoc';
import {Msg, Feed... | const props = {
...this.props,
msg: msg as Msg<any>,
reactions,
replyCount: replyCount ?? 0,
name: metadata.about.name,
imageUrl: metadata.about.imageUrl,
contactName: metadata.contact ? metadata.contact.name : undefined,
};
if (this.state.hasError) return h(RawMes... | const metadata = msg.value._$manyverse$metadata;
const reactions = (
metadata.reactions ?? (xs.never() as Stream<Reactions>)
).compose(debounce(80)); // avoid DB reads flickering | random_line_split |
classfile.rs | use std::fmt;
use std::vec::Vec;
use super::{Attributes, ConstantPool, FieldInfo, MethodInfo};
#[derive(Debug)]
pub struct ClassFile {
/// Java classfile magic number. `0xcafebabe` is the only valid value for
/// this field.
pub magic: u32,
/// The minor version of this classfile.
pub minor_versio... | (&self, method_name: &str) -> Option<&MethodInfo> {
for method in self.methods.iter() {
let name = self.constants[method.name_index].as_utf8();
if name == method_name {
return Some(method);
}
}
None
}
pub fn find_field(&self, field_nam... | find_method | identifier_name |
classfile.rs | use std::fmt;
use std::vec::Vec;
use super::{Attributes, ConstantPool, FieldInfo, MethodInfo};
#[derive(Debug)]
pub struct ClassFile {
/// Java classfile magic number. `0xcafebabe` is the only valid value for
/// this field.
pub magic: u32,
/// The minor version of this classfile.
pub minor_versio... | if self.is_annotation() {
v.push("ACC_ANNOTATION");
}
if self.is_enum() {
v.push("ACC_ENUM");
}
write!(f, "{}", v.join(", "))
}
}
| {
let mut v = Vec::new();
if self.is_public() {
v.push("ACC_PUBLIC");
}
if self.is_final() {
v.push("ACC_FINAL");
}
if self.is_super() {
v.push("ACC_SUPER");
}
if self.is_interface() {
v.push("ACC_INTERFACE")... | identifier_body |
classfile.rs | use std::fmt;
use std::vec::Vec;
use super::{Attributes, ConstantPool, FieldInfo, MethodInfo};
#[derive(Debug)]
pub struct ClassFile {
/// Java classfile magic number. `0xcafebabe` is the only valid value for
/// this field.
pub magic: u32,
/// The minor version of this classfile.
pub minor_versio... | }
let name_index = self.constants[self.super_class].as_class();
Some(self.constants[name_index].as_utf8())
}
pub fn find_method(&self, method_name: &str) -> Option<&MethodInfo> {
for method in self.methods.iter() {
let name = self.constants[method.name_index].as_utf8... | /// that holds the super class name. If `super_class == 0` then `None` is
/// returned.
pub fn super_class_name(&self) -> Option<&String> {
if self.super_class == 0 {
return None; | random_line_split |
classfile.rs | use std::fmt;
use std::vec::Vec;
use super::{Attributes, ConstantPool, FieldInfo, MethodInfo};
#[derive(Debug)]
pub struct ClassFile {
/// Java classfile magic number. `0xcafebabe` is the only valid value for
/// this field.
pub magic: u32,
/// The minor version of this classfile.
pub minor_versio... |
}
None
}
}
bitflags! {
pub flags ClassAccessFlags: u16 {
const CLASS_ACC_PUBLIC = 0x0001,
const CLASS_ACC_FINAL = 0x0010,
const CLASS_ACC_SUPER = 0x0020,
const CLASS_ACC_INTERFACE = 0x0200,
const CLASS_ACC_ABSTRACT = 0x040... | {
return Some(field);
} | conditional_block |
__init__.py | # Copyright (C) 2015 The Debsources developers <info@sources.debian.net>.
# See the AUTHORS file at the top-level directory of this distribution and at
# https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD
#
# This file is part of Debsources. Debsources is free software: you can
# redistrib... | static_folder='static')
from . import routes # NOQA | static_url_path='/static/sources', | random_line_split |
views.py | import os
from flask import render_template, redirect, url_for, abort, flash
from flask.ext.login import login_required
from flask.ext.rq import get_queue
from wtforms.fields import SelectField
from wtforms.validators import (
Optional
)
from .. import db
from ..models import EditableHTML, Resource, ContactCatego... |
@contact.route('/<int:category_id>/delete')
@login_required
def delete_category(category_id):
"""Deletes a contact category."""
category = ContactCategory.query.get(category_id)
if category is None:
abort(404)
db.session.delete(category)
try:
db.session.commit()
flash('Succ... | """Shows the page for deletion of a contact category."""
category = ContactCategory.query.get(category_id)
if category is None:
abort(404)
return render_template('contact/manage_category.html',
category=category) | identifier_body |
views.py | import os
from flask import render_template, redirect, url_for, abort, flash
from flask.ext.login import login_required
from flask.ext.rq import get_queue
from wtforms.fields import SelectField
from wtforms.validators import (
Optional
)
from .. import db
from ..models import EditableHTML, Resource, ContactCatego... |
return render_template('contact/manage_category.html',
category=category)
@contact.route('/<int:category_id>/delete')
@login_required
def delete_category(category_id):
"""Deletes a contact category."""
category = ContactCategory.query.get(category_id)
if category is None:
... | abort(404) | conditional_block |
views.py | import os
from flask import render_template, redirect, url_for, abort, flash
from flask.ext.login import login_required
from flask.ext.rq import get_queue
from wtforms.fields import SelectField
from wtforms.validators import (
Optional
)
from .. import db
from ..models import EditableHTML, Resource, ContactCatego... | return render_template('contact/manage_category.html',
category=category,
form=form)
form.name.data = category.name
return render_template('contact/manage_category.html',
category=category,
... | random_line_split | |
views.py | import os
from flask import render_template, redirect, url_for, abort, flash
from flask.ext.login import login_required
from flask.ext.rq import get_queue
from wtforms.fields import SelectField
from wtforms.validators import (
Optional
)
from .. import db
from ..models import EditableHTML, Resource, ContactCatego... | (category_id):
"""Edit a category"""
category = ContactCategory.query.get(category_id)
if category is None:
abort(404)
old_name = category.name
form = EditCategoryNameForm()
if form.validate_on_submit():
if ContactCategory.query.filter(ContactCategory.name == form.name.data).firs... | edit_category_name | identifier_name |
adminPops.js | /**
* Ekiline for WordPress Theme, Copyright 2018 Uri Lazcano. Ekiline is distributed under the terms of the GNU GPL. http://ekiline.com
*
* adminPops.js
*
* Oficial tinyMce.
* https://www.tinymce.com/docs/advanced/creating-custom-dialogs/
* https://www.tinymce.com/docs/demo/custom-toolbar-listbox/
*
* Ejem... | //title: 'Create a tooltip or popover item',
title : editor.getLang('ekiline_tinymce.ttiptitlex'),
minWidth: 500,
minHeight: 100,
body: [
{
type : 'label',
//text: 'By defa... | random_line_split | |
search_column.js | define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
var tweetItems = require('component/tweet_items');
var templates = require('templates');
var _ = require('underscore');
/**
* Module exports
*/
return defineComp... | () {
this.defaultAttrs({
query: null,
// selectors
titleSelector: '.title',
tweetHolderSelector: '.td-tweet-holder'
});
this.onTitleChangeRequested = function () {
this.trigger('uiShowSearchPrompt');
};
this.onSearchPromptSave = function (ev, data) {
console.lo... | searchColumn | identifier_name |
search_column.js | define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
var tweetItems = require('component/tweet_items');
var templates = require('templates');
var _ = require('underscore');
/**
* Module exports
*/
return defineComp... | this.requestStream();
Platform.performMicrotaskCheckpoint();
};
this.after('initialize', function () {
this.tag = _.uniqueId('search-');
this.model = {};
this.requestStream = function () {
this.trigger('dataSearchStreamRequested', {
tag: this.tag,
quer... | console.log('Model for', this.node, ':', this.model); | random_line_split |
search_column.js | define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
var tweetItems = require('component/tweet_items');
var templates = require('templates');
var _ = require('underscore');
/**
* Module exports
*/
return defineComp... | this.onRemove = function (ev, data) {
ev.stopPropagation();
this.teardown();
// Reraise with tag annotation
this.trigger('uiRemoveColumnRequested', { tag: this.attr.tag });
};
this.render = function () {
this.node.innerHTML = templates.column();
// Not very pretty ...
... | {
this.defaultAttrs({
query: null,
// selectors
titleSelector: '.title',
tweetHolderSelector: '.td-tweet-holder'
});
this.onTitleChangeRequested = function () {
this.trigger('uiShowSearchPrompt');
};
this.onSearchPromptSave = function (ev, data) {
console.log('... | identifier_body |
ipfs-util.js | module.exports = IpfsUtil;
var fs = require('fs');
var formstream = require('formstream');
var http = require('http');
var request = require('request');
function IpfsUtil() |
IpfsUtil.prototype.init = function (config) {
this.__host = config.ipfs.host;
this.__port = config.ipfs.port;
};
IpfsUtil.prototype.getTar = function (key, toFile, callback) {
var self = this;
var uri = 'http://' + self.__host + ':' + self.__port + '/api/v0/tar/cat?arg=' + key;
console.log(uri)... | {
} | identifier_body |
ipfs-util.js | module.exports = IpfsUtil;
var fs = require('fs');
var formstream = require('formstream');
var http = require('http');
var request = require('request');
function | () {
}
IpfsUtil.prototype.init = function (config) {
this.__host = config.ipfs.host;
this.__port = config.ipfs.port;
};
IpfsUtil.prototype.getTar = function (key, toFile, callback) {
var self = this;
var uri = 'http://' + self.__host + ':' + self.__port + '/api/v0/tar/cat?arg=' + key;
console.lo... | IpfsUtil | identifier_name |
ipfs-util.js | module.exports = IpfsUtil;
var fs = require('fs');
var formstream = require('formstream');
var http = require('http');
var request = require('request');
function IpfsUtil() {
}
IpfsUtil.prototype.init = function (config) {
this.__host = config.ipfs.host;
this.__port = config.ipfs.port;
};
IpfsUtil.prototype... | console.log(data);
callback(null, (JSON.parse(data)).Hash);
});
//res.on('end', function () {
// console.log('Request ended...');
// callback();
//});
res.on('error', function (err) {
console.log(err);
return callbac... | res.on('data', function (data) { | random_line_split |
unsupported.rs | use std::ffi::{OsStr, OsString};
use std::os::unix::io::RawFd;
use std::path::Path;
use std::io;
use ::UnsupportedPlatformError;
#[derive(Clone, Debug)]
pub struct XAttrs;
impl Iterator for XAttrs {
type Item = OsString;
fn next(&mut self) -> Option<OsString> {
unreachable!("this should never exist")... | (_: &Path, _: &OsStr) -> io::Result<Vec<u8>> {
Err(io::Error::new(io::ErrorKind::Other, UnsupportedPlatformError))
}
pub fn set_path(_: &Path, _: &OsStr, _: &[u8]) -> io::Result<()> {
Err(io::Error::new(io::ErrorKind::Other, UnsupportedPlatformError))
}
pub fn remove_path(_: &Path, _: &OsStr) -> io::Result<()... | get_path | identifier_name |
unsupported.rs | use std::ffi::{OsStr, OsString};
use std::os::unix::io::RawFd;
use std::path::Path;
use std::io;
use ::UnsupportedPlatformError;
#[derive(Clone, Debug)]
pub struct XAttrs;
impl Iterator for XAttrs {
type Item = OsString;
fn next(&mut self) -> Option<OsString> { | }
fn size_hint(&self) -> (usize, Option<usize>) {
unreachable!("this should never exist")
}
}
pub fn get_fd(_: RawFd, _: &OsStr) -> io::Result<Vec<u8>> {
Err(io::Error::new(io::ErrorKind::Other, UnsupportedPlatformError))
}
pub fn set_fd(_: RawFd, _: &OsStr, _: &[u8]) -> io::Result<()> {
... | unreachable!("this should never exist") | random_line_split |
unsupported.rs | use std::ffi::{OsStr, OsString};
use std::os::unix::io::RawFd;
use std::path::Path;
use std::io;
use ::UnsupportedPlatformError;
#[derive(Clone, Debug)]
pub struct XAttrs;
impl Iterator for XAttrs {
type Item = OsString;
fn next(&mut self) -> Option<OsString> |
fn size_hint(&self) -> (usize, Option<usize>) {
unreachable!("this should never exist")
}
}
pub fn get_fd(_: RawFd, _: &OsStr) -> io::Result<Vec<u8>> {
Err(io::Error::new(io::ErrorKind::Other, UnsupportedPlatformError))
}
pub fn set_fd(_: RawFd, _: &OsStr, _: &[u8]) -> io::Result<()> {
Err(i... | {
unreachable!("this should never exist")
} | identifier_body |
rfc3414.py | #
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# SNMPv3 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3414.txt
#
from pyasn1.type import constraint
from pyasn1.type import namedtype
from ... | (univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('msgAuthoritativeEngineID', univ.OctetString()),
namedtype.NamedType('msgAuthoritativeEngineBoots',
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
name... | UsmSecurityParameters | identifier_name |
rfc3414.py | #
# This file is part of pyasn1-modules software.
# | # Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# SNMPv3 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3414.txt
#
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import univ
class UsmSecurityParameter... | random_line_split | |
rfc3414.py | #
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# SNMPv3 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3414.txt
#
from pyasn1.type import constraint
from pyasn1.type import namedtype
from ... | componentType = namedtype.NamedTypes(
namedtype.NamedType('msgAuthoritativeEngineID', univ.OctetString()),
namedtype.NamedType('msgAuthoritativeEngineBoots',
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
namedtype.NamedType('msgA... | identifier_body | |
form_group_name.d.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { OnDestroy, OnInit } from '@angular/core';
import { FormArray } from '../../model';
import { AbstractFormGrou... | * <h3>Name value:</h3>
* <pre>{{ nameGroup | json }}</pre>
* <p>Name is {{nameGroup?.valid ? "valid" : "invalid"}}</p>
* <h3>What's your favorite food?</h3>
* <p><input formControlName="food"></p>
* <h3>Form value</h3>
* <pre> {{ myForm | json }} </pre>
* ... | * <p>Middle: <input formControlName="middle"></p>
* <p>Last: <input formControlName="last"></p>
* </div> | random_line_split |
form_group_name.d.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { OnDestroy, OnInit } from '@angular/core';
import { FormArray } from '../../model';
import { AbstractFormGrou... | extends AbstractFormGroupDirective implements OnInit, OnDestroy {
name: string;
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
}
export declare const formArrayNameProvider: any;
/**
* Syncs an existing form array to a DOM element.
*
* This directive can only be used as a c... | FormGroupName | identifier_name |
_password.service.ts | <%#
Copyright 2013-2017 the original author or authors.
This file is part of the JHipster project, see https://jhipster.github.io/
for more information.
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 L... |
save(newPassword: string): Observable<any> {
return this.http.post(<% if (authenticationType === 'uaa') { %>'<%= uaaBaseName.toLowerCase() %>/api/account/change_password'<%} else { %>'api/account/change_password'<% } %>, newPassword);
}
}
| {} | identifier_body |
_password.service.ts | <%#
Copyright 2013-2017 the original author or authors.
This file is part of the JHipster project, see https://jhipster.github.io/
for more information.
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 L... | (private http: Http) {}
save(newPassword: string): Observable<any> {
return this.http.post(<% if (authenticationType === 'uaa') { %>'<%= uaaBaseName.toLowerCase() %>/api/account/change_password'<%} else { %>'api/account/change_password'<% } %>, newPassword);
}
}
| constructor | identifier_name |
_password.service.ts | <%#
Copyright 2013-2017 the original author or authors.
This file is part of the JHipster project, see https://jhipster.github.io/
for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. | 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.
-%>
import { Injectable } from '@angular/core';
import { Http } from '@angular... | 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 | random_line_split |
path.rs | nannou's API.
use crate::geom::{Point2, Vector2};
/// A wrapper around a 2D lyon path exposing a nannou-friendly API.
pub struct Path {
path: lyon::path::Path,
}
/// A type used for building a 2D lyon path.
pub struct Builder {
builder: lyon::path::Builder,
}
impl Path {
/// Begin building a new path.
... |
}
// Simplified constructors
/// Begin building a path.
pub fn path() -> Builder {
Builder::new()
}
/// Build a path with the given capacity | {
self.as_slice()
} | identifier_body |
path.rs | of nannou's API.
use crate::geom::{Point2, Vector2};
/// A wrapper around a 2D lyon path exposing a nannou-friendly API.
pub struct Path {
path: lyon::path::Path,
}
/// A type used for building a 2D lyon path.
pub struct Builder {
builder: lyon::path::Builder,
}
impl Path {
/// Begin building a new pat... | (mut self, to: Point2) -> Self {
self.builder.line_to(to.into());
self
}
/// Closes the current sub path and sets the current position to the first position of the
/// current sub-path.
pub fn close(mut self) -> Self {
self.builder.close();
self
}
/// Add a quad... | line_to | identifier_name |
path.rs | of nannou's API.
use crate::geom::{Point2, Vector2};
/// A wrapper around a 2D lyon path exposing a nannou-friendly API.
pub struct Path {
path: lyon::path::Path,
}
/// A type used for building a 2D lyon path.
pub struct Builder {
builder: lyon::path::Builder,
}
impl Path {
/// Begin building a new pat... | /// Returns a lyon view on this **Path**.
pub fn as_slice(&self) -> lyon::path::PathSlice {
self.path.as_slice()
}
/// Returns a slice over an endpoint's custom attributes.
pub fn attributes(&self, endpoint: lyon::path::EndpointId) -> &[f32] {
self.path.attributes(endpoint)
}
... | pub fn new() -> Self {
lyon::path::Path::new().into()
}
| random_line_split |
cli.py | from cfme.utils.version import get_stream
from collections import namedtuple
from contextlib import contextmanager
from cfme.test_framework.sprout.client import SproutClient
from cfme.utils.conf import cfme_data, credentials
from cfme.utils.log import logger
import pytest
from wait_for import wait_for
from cfme.test_fr... |
@pytest.fixture()
def app_creds():
return {
'username': credentials['database']['username'],
'password': credentials['database']['password'],
'sshlogin': credentials['ssh']['username'],
'sshpass': credentials['ssh']['password']
}
@pytest.fixture(scope="module")
def app_creds... | configured_appliance.appliance_console_cli.configure_ipa(ipa_creds['ipaserver'],
ipa_creds['username'], ipa_creds['password'], ipa_creds['domain'], ipa_creds['realm'])
yield(configured_appliance) | identifier_body |
cli.py | from cfme.utils.version import get_stream
from collections import namedtuple
from contextlib import contextmanager
from cfme.test_framework.sprout.client import SproutClient
from cfme.utils.conf import cfme_data, credentials
from cfme.utils.log import logger
import pytest
from wait_for import wait_for
from cfme.test_fr... | (app_creds, appliance):
"""'ap' launch appliance_console, '' clear info screen, '5/8' setup db, '1' Creates v2_key,
'1' selects internal db, 'y' continue, '1' use partition, 'y' create dedicated db, 'pwd'
db password, 'pwd' confirm db password + wait 360 secs and '' finish."""
if appliance.version > '5.... | dedicated_db_appliance | identifier_name |
cli.py | from cfme.utils.version import get_stream
from collections import namedtuple
from contextlib import contextmanager
from cfme.test_framework.sprout.client import SproutClient
from cfme.utils.conf import cfme_data, credentials
from cfme.utils.log import logger
import pytest
from wait_for import wait_for
from cfme.test_fr... |
else:
logger.error("Couldn't provision an appliance at all")
raise SproutException('No provision available')
yield apps[0]
apps[0].ssh_client.close()
sp.destroy_pool(pool_id)
@pytest.yield_fixture()
def unconfigured_appliance(appliance):
with fqdn_appliance(appliance, preconfigur... | try:
apps, pool_id = sp.provision_appliances(
count=1, preconfigured=preconfigured, version=version, stream=stream,
provider=provider
)
break
except Exception as e:
logger.warning("Couldn't provision appliance with following error:"... | conditional_block |
cli.py | from cfme.utils.version import get_stream
from collections import namedtuple
from contextlib import contextmanager
from cfme.test_framework.sprout.client import SproutClient
from cfme.utils.conf import cfme_data, credentials
from cfme.utils.log import logger
import pytest
from wait_for import wait_for
from cfme.test_fr... | 'hostname': fqdn[0],
'domain': fqdn[1],
'realm': cfme_data['auth_modes']['ext_ipa']['iparealm'],
'ipaserver': cfme_data['auth_modes']['ext_ipa']['ipaserver'],
'username': credentials[creds_key]['principal'],
'password': credentials[creds_key]['password']
} | fqdn = cfme_data['auth_modes']['ext_ipa']['ipaserver'].split('.', 1)
creds_key = cfme_data['auth_modes']['ext_ipa']['credentials']
return{ | random_line_split |
text.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Tex... | underline: false, overline: false, line_through: false,
};
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
return Ok(result)
}
let mut blink = false;
let mut empty = true;
while input.try(|input| {
if let Ok(ide... | }
/// none | [ underline || overline || line-through || blink ]
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
let mut result = SpecifiedValue { | random_line_split |
text.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Tex... | else {
return Err(());
}
Ok(())
}).is_ok() {
}
if !empty { Ok(result) } else { Err(()) }
}
% if product == "servo":
fn cascade_property_custom<C: ComputedValues>(
_declaration: &Property... | {
match_ignore_ascii_case! { ident,
"underline" => if result.underline { return Err(()) }
else { empty = false; result.underline = true },
"overline" => if result.overline { return Err(()) }
... | conditional_block |
text.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Tex... | () -> computed_value::T {
computed_value::none
}
/// none | [ underline || overline || line-through || blink ]
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
let mut result = SpecifiedValue {
underline: false, overline: false, line_thro... | get_initial_value | identifier_name |
text.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Tex... | else { empty = false; blink = true },
_ => return Err(())
}
} else {
return Err(());
}
Ok(())
}).is_ok() {
}
if !empty { Ok(result) } else { Err... | {
let mut result = SpecifiedValue {
underline: false, overline: false, line_through: false,
};
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
return Ok(result)
}
let mut blink = false;
let mut empty = true;
while input... | identifier_body |
base.py | ):
"""Predict using the linear model
Parameters
----------
X : {array-like, sparse matrix}, shape = (n_samples, n_features)
Samples.
Returns
-------
C : array, shape = (n_samples,)
Returns predicted values.
"""
return self... | self.coef_ = np.ravel(self.coef_) | conditional_block | |
base.py | # transform variance to std in-place
# XXX: currently scaled to variance=n_samples to match center_data
X_var *= X.shape[0]
X_std = np.sqrt(X_var, X_var)
del X_var
X_std[X_std == 0] = 1
inplace_column_scale(X, 1. / X_std)
else:
... | Samples.
Returns
-------
C : array, shape = (n_samples,)
Returns predicted values.
"""
return self._decision_function(X)
_center_data = staticmethod(center_data)
def _set_intercept(self, X_mean, y_mean, X_std):
"""Set the intercept_
... |
Parameters
----------
X : {array-like, sparse matrix}, shape = (n_samples, n_features) | random_line_split |
base.py | # transform variance to std in-place
# XXX: currently scaled to variance=n_samples to match center_data
X_var *= X.shape[0]
X_std = np.sqrt(X_var, X_var)
del X_var
X_std[X_std == 0] = 1
inplace_column_scale(X, 1. / X_std)
else:
... | (self):
"""Convert coefficient matrix to sparse format.
Converts the ``coef_`` member to a scipy.sparse matrix, which for
L1-regularized models can be much more memory- and storage-efficient
than the usual numpy.ndarray representation.
The ``intercept_`` member is not converted... | sparsify | identifier_name |
base.py | # transform variance to std in-place
# XXX: currently scaled to variance=n_samples to match center_data
X_var *= X.shape[0]
X_std = np.sqrt(X_var, X_var)
del X_var
X_std[X_std == 0] = 1
inplace_column_scale(X, 1. / X_std)
else:
... |
class SparseCoefMixin(object):
"""Mixin for converting coef_ to and from CSR format.
L1-regularizing estimators should inherit this.
"""
def densify(self):
"""Convert coefficient matrix to dense array format.
Converts the ``coef_`` member (back) to a numpy.ndarray. This is the
... | """Probability estimation for OvR logistic regression.
Positive class probabilities are computed as
1. / (1. + np.exp(-self.decision_function(X)));
multiclass is handled by normalizing that over all classes.
"""
prob = self.decision_function(X)
prob *= -1
np.exp(... | identifier_body |
pgn-test.js | "use strict";
| var test_pgn = "[Event \"Live Chess\"]\n[Site \"Chess.com\"]\n[Date \"2017.06.01\"]\n[Round \"-\"]\n[White \"tryingtolearn1234\"]\n[Black \"HifiPhil\"]\n[Result \"1-0\"]\n[ECO \"C00\"]\n[ECOUrl \"https://www.chess.com/openings/C00-French-Defense-St-George-Defense\"]\n[WhiteElo \"1118\"]\n[BlackElo \"953\"]\n[TimeContro... | const assert = require('assert');
const should = require('should');
const PGN = require("../pgn/index.js"); | random_line_split |
marshalling.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
return value;
}
function reviver(key: string, value: any): any {
let marshallingConst: number | null = null;
if (value !== void 0 && value !== null) {
marshallingConst = (<MarshalledObject>value).$mid;
}
switch (marshallingConst) {
case 1:
return URI.revive(value);
case 2:
return ne... | {
return {
$mid: 2,
source: (<RegExp>value).source,
flags:
((<RegExp>value).global ? 'g' : '') +
((<RegExp>value).ignoreCase ? 'i' : '') +
((<RegExp>value).multiline ? 'm' : ''),
};
} | conditional_block |
marshalling.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
function reviver(key: string, value: any): any {
let marshallingConst: number | null = null;
if (value !== void 0 && value !== null) {
marshallingConst = (<MarshalledObject>value).$mid;
}
switch (marshallingConst) {
case 1:
return URI.revive(value);
case 2:
return new RegExp(value.sou... | {
// URI is done via toJSON-member
if (value instanceof RegExp) {
return {
$mid: 2,
source: (<RegExp>value).source,
flags:
((<RegExp>value).global ? 'g' : '') +
((<RegExp>value).ignoreCase ? 'i' : '') +
((<RegExp>value).multiline ? 'm' : ''),
};
}
return val... | identifier_body |
marshalling.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
function replacer(key: string, value: any): any {
// URI is done via toJSON-member
if (value instanceof RegExp) {
return {
$mid: 2,
source: (<RegExp>value).source,
flags:
((<RegExp>value).global ? 'g' : '') +
((<RegExp>value).ignoreCase ? 'i' : '') +
((<RegExp>valu... | }
interface MarshalledObject {
$mid: number;
} | random_line_split |
marshalling.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | (text: string): any {
return JSON.parse(text, reviver);
}
interface MarshalledObject {
$mid: number;
}
function replacer(key: string, value: any): any {
// URI is done via toJSON-member
if (value instanceof RegExp) {
return {
$mid: 2,
source: (<RegExp>value).source,
flags:
((<Reg... | parse | identifier_name |
app-routing.module.ts | import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { WelcomeComponent } from '../home/welcome.component';
// import { ProductListComponent } from '../products/product-list.component';
// import { ProductDetailComponent } from '../products/product-detail.component';... | export class AppRoutingModule {} | ],
exports: [RouterModule]
}) | random_line_split |
app-routing.module.ts | import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { WelcomeComponent } from '../home/welcome.component';
// import { ProductListComponent } from '../products/product-list.component';
// import { ProductDetailComponent } from '../products/product-detail.component';... | {}
| AppRoutingModule | identifier_name |
pool.py | """ Tools for creating pools of worker processes
"""
from __future__ import absolute_import
import multiprocessing.pool
import functools
from multiprocessing import TimeoutError
import types
import signal
import atexit
def is_main_process():
""" Check if this is the main control process and may handle one time tas... |
_process_lock = None
_numdone = None
def _lockstep_fcn(values):
""" Wrapper to ensure that all processes execute together """
numrequired, fcn, args = values
with _process_lock:
_numdone.value += 1
# yep this is an ugly busy loop, do something better please
# when we care about the perform... | return init(*args) | conditional_block |
pool.py | """ Tools for creating pools of worker processes
"""
from __future__ import absolute_import
import multiprocessing.pool
import functools
from multiprocessing import TimeoutError
import types
import signal
import atexit
def is_main_process():
""" Check if this is the main control process and may handle one time tas... | (self, processes=None, initializer=None, initargs=(), **kwds):
global _process_lock
global _numdone
_process_lock = multiprocessing.Lock()
_numdone = multiprocessing.Value('i', 0)
noint = functools.partial(_noint, initializer)
super(BroadcastPool, self).__init__(processes... | __init__ | identifier_name |
pool.py | """ Tools for creating pools of worker processes
"""
from __future__ import absolute_import
import multiprocessing.pool
import functools
from multiprocessing import TimeoutError
import types
import signal
import atexit
def is_main_process():
""" Check if this is the main control process and may handle one time tas... |
def __len__(self):
return len(self._pool)
def broadcast(self, fcn, args):
""" Do a function call on every worker.
Parameters
----------
fcn: funtion
Function to call.
args: tuple
The arguments for Pool.map
"""
results = ... | global _process_lock
global _numdone
_process_lock = multiprocessing.Lock()
_numdone = multiprocessing.Value('i', 0)
noint = functools.partial(_noint, initializer)
super(BroadcastPool, self).__init__(processes, noint, initargs, **kwds)
atexit.register(_shutdown_pool, self... | identifier_body |
pool.py | """ Tools for creating pools of worker processes
"""
from __future__ import absolute_import
import multiprocessing.pool
import functools
from multiprocessing import TimeoutError
import types
import signal
import atexit
def is_main_process():
""" Check if this is the main control process and may handle one time tas... |
# Allow the pool to be interrupted, need to disable the children processes
# from intercepting the keyboard interrupt
def _noint(init, *args):
signal.signal(signal.SIGINT, signal.SIG_IGN)
if init is not None:
return init(*args)
_process_lock = None
_numdone = None
def _lockstep_fcn(values):
""" Wr... | comm = MPI.COMM_WORLD
rank = comm.Get_rank()
return rank == 0
except (ImportError, ValueError, RuntimeError):
return True | random_line_split |
virtualKeyboard.ts | /*
* Copyright (c) 2016 Charles University in Prague, Faculty of Arts,
* Institute of the Czech National Corpus
* Copyright (c) 2016 Tomas Machalek <tomas.machalek@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public ... | ():number {
return this.currLayout;
}
getActiveKey():[number, number] {
for (let i = 0; i < this.keyCodes.length; i += 1) {
for (let j = 0; j < this.keyCodes[i].length; j += 1) {
if (this.keyCodes[i][j] === this.externalKeyHit) {
return [i, j];
... | getCurrentLayoutIdx | identifier_name |
virtualKeyboard.ts | /*
* Copyright (c) 2016 Charles University in Prague, Faculty of Arts,
* Institute of the Czech National Corpus
* Copyright (c) 2016 Tomas Machalek <tomas.machalek@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public ... | }
getLayoutNames():Kontext.ListOfPairs {
return this.layouts.map<[string, string]>(item => [item.name, item.label]);
}
getCurrentLayout():Kontext.VirtualKeyboardLayout {
return this.layouts[this.currLayout];
}
getCurrentLayoutIdx():number {
return this.currLayout;
... | {
const ans = [];
const walkThru = (fn:(item:string)=>boolean) => {
for (let i = 0; i < this.layouts.length; i += 1) {
for (let code of this.layouts[i].codes || ['en_US']) {
if (fn((code || '').replace('-', '_').toLowerCase())) {
an... | identifier_body |
virtualKeyboard.ts | /*
* Copyright (c) 2016 Charles University in Prague, Faculty of Arts,
* Institute of the Czech National Corpus
* Copyright (c) 2016 Tomas Machalek <tomas.machalek@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public ... |
}
}
};
const normLang = lang.toLowerCase();
walkThru(item => item === normLang);
walkThru(item => item.substr(0, 2) === normLang.substr(0, 2));
if (ans.length > 0) {
return ans[0];
} else {
throw new Error('Unable to f... | {
ans.push(i);
} | conditional_block |
virtualKeyboard.ts | /*
* Copyright (c) 2016 Charles University in Prague, Faculty of Arts,
* Institute of the Czech National Corpus
* Copyright (c) 2016 Tomas Machalek <tomas.machalek@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public ... |
private keyCodes:Array<Array<number>> = [
[192, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 189, 187, 8],
[null, 81, 87, 69, 82, 84, 89, 85, 73, 79, 80, 219, 221, 220],
[20, 65, 83, 68, 70, 71, 72, 74, 75, 76, 186, 222, 18],
[null, 90, 88, 67, 86, 66, 78, 77, 188, 190, 191, 18],
... | private layouts:VirtualKeyboardLayouts;
private currLayout:number;
private externalKeyHit:number; | random_line_split |
joystick.py | # Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... |
joysticks = { }
def count():
return pygame_sdl2.joystick.get_count()
def get(n):
if n in joysticks:
return joysticks[n]
try:
joysticks[n] = pygame_sdl2.joystick.Joystick(n)
return joysticks[n]
except:
return None
| """
This is a behavior intended for joystick calibration. If a joystick
event occurs, this returns it as a string.
"""
pass | identifier_body |
joystick.py | # Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | (n):
if n in joysticks:
return joysticks[n]
try:
joysticks[n] = pygame_sdl2.joystick.Joystick(n)
return joysticks[n]
except:
return None
| get | identifier_name |
joystick.py | # Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, O... | #
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | random_line_split |
joystick.py | # Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... |
try:
joysticks[n] = pygame_sdl2.joystick.Joystick(n)
return joysticks[n]
except:
return None
| return joysticks[n] | conditional_block |
toolbutton.rs | // This file is part of rgtk.
//
// rgtk is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// rgtk is distributed in the hop... |
pub fn new_from_stock(stock_id: &str) -> Option<ToolButton> {
let tmp_pointer = stock_id.with_c_str(|c_str| {
unsafe { ffi::gtk_tool_button_new_from_stock(c_str) }
});
check_pointer!(tmp_pointer, ToolButton)
}
}
impl_drop!(ToolButton)
impl_TraitWidget!(ToolButton)
impl gtk... | let tmp_pointer = unsafe {
match label {
Some(l) => {
l.with_c_str(|c_str| {
match icon_widget {
Some(i) => ffi::gtk_tool_button_new(i.get_widget(), c_str),
None => ffi::gtk_tool_bu... | identifier_body |
toolbutton.rs | // This file is part of rgtk.
//
// rgtk is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// rgtk is distributed in the hop... | : gtk::WidgetTrait>(icon_widget: Option<&T>, label: Option<&str>) -> Option<ToolButton> {
let tmp_pointer = unsafe {
match label {
Some(l) => {
l.with_c_str(|c_str| {
match icon_widget {
Some(i) => ffi::gtk_tool_... | w<T | identifier_name |
toolbutton.rs | // rgtk is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// rgtk is distributed in the hope that it will be useful,
// but ... | // This file is part of rgtk.
// | random_line_split | |
mod.rs | // Zinc, the bare metal stack for rust.
// Copyright 2014 Ben Gamari <bgamari@gmail.com>
//
// 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... |
This module also provides `isr.rs`, that is not compiled as a part of this
crate. `isr.rs` provides ISR vector table.
*/
pub use super::cortex_common::systick;
pub use super::cortex_common::scb;
pub use super::cortex_common::nvic;
pub use super::cortex_common::irq;
pub mod lock; | // See the License for the specific language governing permissions and
// limitations under the License.
/*!
Generic routines for ARM Cortex-M3 cores. | random_line_split |
frameBarComponent.tsx | import { Nullable } from "babylonjs/types";
import * as React from "react";
import { GlobalState } from "../../../../../../globalState";
import { Context, IActiveAnimationChangedOptions } from "../context";
import { Observer } from "babylonjs/Misc/observable";
// x distance between consecutive ticks on the frame... |
let minFrame = this.props.context.referenceMinFrame;
let maxFrame = this.props.context.referenceMaxFrame;
let range = maxFrame - minFrame;
let convertRatio = range / this._GraphAbsoluteWidth;
const dist = Math.max(baseTickDistance * this._viewScale, minTickDistance) ; /... | {
return null;
} | conditional_block |
frameBarComponent.tsx | import { Nullable } from "babylonjs/types";
import * as React from "react";
import { GlobalState } from "../../../../../../globalState";
import { Context, IActiveAnimationChangedOptions } from "../context";
import { Observer } from "babylonjs/Misc/observable";
// x distance between consecutive ticks on the frame... | (props: IFrameBarComponentProps) {
super(props);
this.state = {};
this._svgHost = React.createRef();
this.props.context.onHostWindowResized.add(() => {
this._computeSizes();
});
this._onActiveAnimationChangedObserver = this.props.context.onActiv... | constructor | identifier_name |
frameBarComponent.tsx | import { Nullable } from "babylonjs/types";
import * as React from "react";
import { GlobalState } from "../../../../../../globalState";
import { Context, IActiveAnimationChangedOptions } from "../context";
import { Observer } from "babylonjs/Misc/observable";
// x distance between consecutive ticks on the frame... | return;
}
this._viewWidth = this._svgHost.current.clientWidth;
this.forceUpdate();
}
private _buildFrames() {
if (this.props.context.activeAnimations.length === 0) {
return null;
}
let minFrame = this.props.context.referenceM... | private _computeSizes() {
if (!this._svgHost.current) {
| random_line_split |
frameBarComponent.tsx | import { Nullable } from "babylonjs/types";
import * as React from "react";
import { GlobalState } from "../../../../../../globalState";
import { Context, IActiveAnimationChangedOptions } from "../context";
import { Observer } from "babylonjs/Misc/observable";
// x distance between consecutive ticks on the frame... |
private _computeSizes() {
if (!this._svgHost.current) {
return;
}
this._viewWidth = this._svgHost.current.clientWidth;
this.forceUpdate();
}
private _buildFrames() {
if (this.props.context.activeAnimations.length === 0) {
retur... | {
if (this._onActiveAnimationChangedObserver) {
this.props.context.onActiveAnimationChanged.remove(this._onActiveAnimationChangedObserver);
}
} | identifier_body |
Form.tsx | import { css, cx } from '@emotion/css';
import JSONForm, { Schema } from 'jsoninput';
import * as React from 'react';
import { DropMenu } from '../../Components/DropMenu';
import { deepDifferent } from '../../Components/Hooks/storeHookFactory';
import { ConfirmButton } from '../../Components/Inputs/Buttons/ConfirmButto... | </div>
</Toolbar.Content>
</Toolbar>
);
} | random_line_split | |
Form.tsx | import { css, cx } from '@emotion/css';
import JSONForm, { Schema } from 'jsoninput';
import * as React from 'react';
import { DropMenu } from '../../Components/DropMenu';
import { deepDifferent } from '../../Components/Hooks/storeHookFactory';
import { ConfirmButton } from '../../Components/Inputs/Buttons/ConfirmButto... |
const closeAction = actions.find(a => a.sorting === 'close');
const deleteAction = actions.find(a => a.sorting === 'delete');
const duplicateAction = actions.find(a => a.sorting === 'duplicate');
const findUsageAction = actions.find(a => a.sorting === 'findUsage');
return (
<Toolbar className={expandHe... | {
setVal(entity);
} | conditional_block |
licenses.rs | use std::fs::File;
use proc_macro::TokenStream;
use quote;
use serde_json;
use serde::de::IgnoredAny;
const SOURCES: &[&str] = &[
"src/licenses/license-hound.json",
"src/licenses/other.json",
];
#[derive(Debug, Copy, Clone, Deserialize)]
pub enum LicenseId {
Bsd3Clause,
Mit,
Mpl2,
Ofl11,
}
i... | (&self, tokens: &mut quote::Tokens) {
let c: &LicenseDescription = self.conclusion.as_ref().unwrap();
let (name, link, copyright, license) =
(&self.package_name, &c.link, &c.copyright_notice, &c.chosen_license);
let link = match link {
&Some(ref link) => quote! { Some(#l... | to_tokens | identifier_name |
licenses.rs | use std::fs::File;
use proc_macro::TokenStream;
use quote;
use serde_json;
use serde::de::IgnoredAny;
const SOURCES: &[&str] = &[
"src/licenses/license-hound.json",
"src/licenses/other.json",
];
#[derive(Debug, Copy, Clone, Deserialize)]
pub enum LicenseId {
Bsd3Clause,
Mit,
Mpl2,
Ofl11,
}
i... |
let copyright = match license.include_notice() {
true => copyright,
false => "",
};
tokens.append(quote! {
LicenseInfo {
name: #name,
link: #link,
copyright: #copyright,
license: License::#licen... | &Some(ref link) => quote! { Some(#link) },
&None => quote! { None },
}; | random_line_split |
basicmixing.py | import numpy as np
__all__ = ['vanDerWaalsMixing']
def | (kij=0):
"""Simple van der Waals mixing rules, returns a mixingrule function.
kij is an numpy array of binary interaction parameters"""
def vdw_mixing(molefraction, theta, TdthetadT, B, delta=None, epsilon=None, eta=None):
"""Takes molefraction, theta, T*dtheta/dT, B and returns mixed values
... | vanDerWaalsMixing | identifier_name |
basicmixing.py | import numpy as np
__all__ = ['vanDerWaalsMixing']
def vanDerWaalsMixing(kij=0):
"""Simple van der Waals mixing rules, returns a mixingrule function.
kij is an numpy array of binary interaction parameters"""
def vdw_mixing(molefraction, theta, TdthetadT, B, delta=None, epsilon=None, eta=None):
"... | B_m = np.dot(molefraction, B)
TdthetadT_ij = 0.5 * (1 - kij) * np.outer(theta, theta)**-0.5 * (np.outer(TdthetadT, theta) + np.outer(theta, TdthetadT,))
return np.dot(molefraction, dtheta_m), np.dot(molefraction, np.dot(TdthetadT_ij, molefraction)), 2 * dtheta_m, B_m, B
return vdw_mixing | random_line_split | |
basicmixing.py | import numpy as np
__all__ = ['vanDerWaalsMixing']
def vanDerWaalsMixing(kij=0):
"""Simple van der Waals mixing rules, returns a mixingrule function.
kij is an numpy array of binary interaction parameters"""
def vdw_mixing(molefraction, theta, TdthetadT, B, delta=None, epsilon=None, eta=None):
|
return vdw_mixing
| """Takes molefraction, theta, T*dtheta/dT, B and returns mixed values
theta_m, T*dtheta/dT_m, dtheta/dn, B_b, dB/dn"""
theta_ij = (1 - kij) * np.sqrt(np.outer(theta, theta))
dtheta_m = np.dot(molefraction, theta_ij)
B_m = np.dot(molefraction, B)
TdthetadT_ij = 0.5 * (1 - kij) * n... | identifier_body |
in-memory-data.service.ts | import { InMemoryDbService } from 'angular-in-memory-web-api';
export class InMemoryDataService implements InMemoryDbService {
createDb() | } | {
let heroes = [
{ id: 10, name: 'Eduardo C', secretIdentity: 'Eduardo Allen'},
{ id: 11, name: 'Débora', secretIdentity: 'Eduardo Allen'},
{ id: 12, name: 'Daniel', secretIdentity: 'Eduardo Allen'},
{ id: 13, name: 'Max', secretIdentity: 'Eduardo Allen'},
{ id: 14, name: 'Su... | identifier_body |
in-memory-data.service.ts | import { InMemoryDbService } from 'angular-in-memory-web-api';
export class | implements InMemoryDbService {
createDb() {
let heroes = [
{ id: 10, name: 'Eduardo C', secretIdentity: 'Eduardo Allen'},
{ id: 11, name: 'Débora', secretIdentity: 'Eduardo Allen'},
{ id: 12, name: 'Daniel', secretIdentity: 'Eduardo Allen'},
{ id: 13, name: 'Max', secretIdentity: ... | InMemoryDataService | identifier_name |
in-memory-data.service.ts | import { InMemoryDbService } from 'angular-in-memory-web-api';
export class InMemoryDataService implements InMemoryDbService {
createDb() { | let heroes = [
{ id: 10, name: 'Eduardo C', secretIdentity: 'Eduardo Allen'},
{ id: 11, name: 'Débora', secretIdentity: 'Eduardo Allen'},
{ id: 12, name: 'Daniel', secretIdentity: 'Eduardo Allen'},
{ id: 13, name: 'Max', secretIdentity: 'Eduardo Allen'},
{ id: 14, name: 'Supe... | random_line_split | |
precisionoptics.ts | import throat from 'throat'
import { scrape, Info, Selectors } from '../common'
import * as helpers from '../../helpers'
import { ItemType, IItemListing } from '../../graphql-types'
import { PRECISION_OPTICS } from '../../vendors'
export function precisionOptics(type: ItemType): Promise<IItemListing[]> | }
}
| {
const throttle = throat(1)
const info: Info = PRECISION_OPTICS
const selectors: Selectors = null
const BASE = `https://www.${info.link}`
const work = (t) => scrape((p) => `${BASE}category_s/${t}.htm`, info, selectors)
switch (type) {
case ItemType.centerfire:
return Promise.all([].map((t) => t... | identifier_body |
precisionoptics.ts | import throat from 'throat'
import { scrape, Info, Selectors } from '../common'
import * as helpers from '../../helpers'
import { ItemType, IItemListing } from '../../graphql-types'
import { PRECISION_OPTICS } from '../../vendors'
export function precisionOptics(type: ItemType): Promise<IItemListing[]> {
const thro... | case ItemType.rimfire:
case ItemType.shotgun:
case ItemType.shot:
case ItemType.primer:
case ItemType.case:
case ItemType.powder:
return Promise.resolve(null) // 20200101 no reloading or shotgun or rimfire
default:
return Promise.reject(new Error('unknown type: ' + type))
}
} | random_line_split | |
precisionoptics.ts | import throat from 'throat'
import { scrape, Info, Selectors } from '../common'
import * as helpers from '../../helpers'
import { ItemType, IItemListing } from '../../graphql-types'
import { PRECISION_OPTICS } from '../../vendors'
export function | (type: ItemType): Promise<IItemListing[]> {
const throttle = throat(1)
const info: Info = PRECISION_OPTICS
const selectors: Selectors = null
const BASE = `https://www.${info.link}`
const work = (t) => scrape((p) => `${BASE}category_s/${t}.htm`, info, selectors)
switch (type) {
case ItemType.centerfire... | precisionOptics | identifier_name |
fetch-user.util.spec.ts | // std
import { ServiceManager } from '@foal/core';
import { notStrictEqual, strictEqual } from 'assert';
// 3p
import { Column, createConnection, Entity, getConnection, getManager, PrimaryGeneratedColumn } from 'typeorm';
// FoalTS
import { fetchUser } from './fetch-user.util';
function testSuite(type: 'mysql'|'mar... | default:
break;
}
user = new User();
user.name = 'foobar';
await getManager().save(user);
});
after(() => getConnection().close());
it('should return the user fetched from the database (id: number).', async () => {
const actual = await fetchUser(User)(user... | break; | random_line_split |
fetch-user.util.spec.ts | // std
import { ServiceManager } from '@foal/core';
import { notStrictEqual, strictEqual } from 'assert';
// 3p
import { Column, createConnection, Entity, getConnection, getManager, PrimaryGeneratedColumn } from 'typeorm';
// FoalTS
import { fetchUser } from './fetch-user.util';
function testSuite(type: 'mysql'|'mar... | {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
}
let user: User;
before(async () => {
switch (type) {
case 'mysql':
case 'mariadb':
await createConnection({
database: 'test',
dropSchema: true,
en... | User | identifier_name |
fis.js | /*
* fis
* http://fis.baidu.com/
*/
'use strict';
//kernel
//加载fis-kernel模块
var fis = module.exports = require('fis-kernel');
//merge standard conf
//增加modules配置信息
fis.config.merge({
modules : {
preprocessor: { //预处理器
js: 'components',
css: 'components',
html: 'comp... | ' _' + '\\///'.bold.red + '______________' + '\\///////////'.bold.yellow + '____' + '\\///////////'.bold.green + '_____',
''
].join('\n');
console.log(content);
};
//循环判断argv里是否有参数search,并删除搜索到的参数。
//@argv {Array}
//@search {String}
function hasArgv(argv, search){
var pos = argv.ind... | ' _' + '\\/\\\\\\'.bold.red + '______________' + '/\\\\\\\\\\\\\\\\\\\\\\'.bold.yellow + '_' + '\\///\\\\\\\\\\\\\\\\\\\\\\/'.bold.green + '___', | random_line_split |
fis.js | /*
* fis
* http://fis.baidu.com/
*/
'use strict';
//kernel
//加载fis-kernel模块
var fis = module.exports = require('fis-kernel');
//merge standard conf
//增加modules配置信息
fis.config.merge({
modules : {
preprocessor: { //预处理器
js: 'components',
css: 'components',
html: 'comp... | er
//https://github.com/tj/commander.js/tree/1.3.2
var commander = fis.cli.commander = require('commander');
/*cmd如下:
cmd = {
name: 'install',
usage: '[options] <components...>',
desc: 'install components,
register: func... | , 'server' ]3个命令的命令控制台。
//commander 参考:
//https://www.npmjs.com/package/command | conditional_block |
fis.js | /*
* fis
* http://fis.baidu.com/
*/
'use strict';
//kernel
//加载fis-kernel模块
var fis = module.exports = require('fis-kernel');
//merge standard conf
//增加modules配置信息
fis.config.merge({
modules : {
preprocessor: { //预处理器
js: 'components',
css: 'components',
html: 'comp... | :"/Users/hanli/git/SCI/fis"
//如果有参数'--no-color',则说明console输出不带color。
if(hasArgv(argv, '--no-color')){
fis.cli.colors.mode = 'none'; //控制台输出颜色模式
}
//如:$ bin/fis -v => first === '-v'
var first = argv[2];
//查看fis帮助信息,如:fis 或 fis -h 或 fis --help。
if(argv.length < 3 || first === '-h' ||... | 为process.argv,即:[ 'node', '/Users/hanli/git/SCI/fis/bin/fis', ... ]。
fis.cli.run = function(argv){
// console.log(argv)
fis.processCWD = process.cwd(); //process.cwd()返回当前进程的工作目录,如 | identifier_body |
fis.js | /*
* fis
* http://fis.baidu.com/
*/
'use strict';
//kernel
//加载fis-kernel模块
var fis = module.exports = require('fis-kernel');
//merge standard conf
//增加modules配置信息
fis.config.merge({
modules : {
preprocessor: { //预处理器
js: 'components',
css: 'components',
html: 'comp... | s启动接口方法,argv参数为process.argv,即:[ 'node', '/Users/hanli/git/SCI/fis/bin/fis', ... ]。
fis.cli.run = function(argv){
// console.log(argv)
fis.processCWD = process.cwd(); //process.cwd()返回当前进程的工作目录,如:"/Users/hanli/git/SCI/fis"
//如果有参数'--no-color',则说明console输出不带color。
if(hasArgv(argv, '--no-color')){
... | ls
//fi | identifier_name |
home.client.controller.js | 'use strict';
angular.module('core').controller('HomeController', ['$scope', 'Authentication',
function($scope, Authentication) {
// This provides Authentication context.
$scope.authentication = Authentication;
$scope.alerts = [
{
icon:'glyphicon-user',
color:'btn-success',
total:'20,408',
... | description:'FOLLOW UPS REQUIRED'
},
{
icon:'glyphicon-flag',
color:'btn-danger',
total:'348',
description:'REFERRALS TO MODERATE'
}
];
}
]); | color:'btn-warning',
total:'20,408', | random_line_split |
decorators.py | # This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to the responsive locomotion way of traveling!
#... | return get_serializer(serpy=obj.output_type_serializer) | identifier_body | |
decorators.py | # This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to the responsive locomotion way of traveling!
#... |
from __future__ import absolute_import, print_function, unicode_literals, division
from jormungandr.interfaces.v1.serializer import serialize_with
def get_serializer(serpy):
return serialize_with(serpy)
def get_obj_serializer(obj):
return get_serializer(serpy=obj.output_type_serializer) | random_line_split | |
decorators.py | # This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to the responsive locomotion way of traveling!
#... | (serpy):
return serialize_with(serpy)
def get_obj_serializer(obj):
return get_serializer(serpy=obj.output_type_serializer)
| get_serializer | identifier_name |
tools.py | # Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | for port in FLAGS.auth_host_port:
port_number = port
try:
httpd = ClientRedirectServer((FLAGS.auth_host_name, port),
ClientRedirectHandler)
except socket.error as e:
pass
else:
success = True
break
FLAGS.auth_local_webs... | port_number = 0 | random_line_split |
tools.py | # Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
class ClientRedirectHandler(http.server.BaseHTTPRequestHandler):
"""A handler for OAuth 2.0 redirects back to localhost.
Waits for a single request and parses the query parameters
into the servers query_params and then stops serving.
"""
def do_GET(s):
"""Handle a GET request.
Parses the query p... | """A server to handle OAuth 2.0 redirects back to localhost.
Waits for a single request and parses the query parameters
into query_params and then stops serving.
"""
query_params = {} | identifier_body |
tools.py | # Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
else:
print('Go to the following link in your browser:')
print()
print(' ' + authorize_url)
print()
code = None
if FLAGS.auth_local_webserver:
httpd.handle_request()
if 'error' in httpd.query_params:
sys.exit('Authentication request was rejected.')
if 'code' in httpd.query_p... | webbrowser.open(authorize_url, new=1, autoraise=True)
print('Your browser has been opened to visit:')
print()
print(' ' + authorize_url)
print()
print('If your browser is on a different machine then exit and re-run this')
print('application with the command-line parameter ')
print()
p... | conditional_block |
tools.py | # Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | (s):
"""Handle a GET request.
Parses the query parameters and prints a message
if the flow has completed. Note that we can't detect
if an error occurred.
"""
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
query = s.path.split('?', 1)[-1]
query = ... | do_GET | identifier_name |
pane2.js | ((bbn) => {
let script = document.createElement('script');
script.innerHTML = `<div :class="[componentClass, 'bbn-background', 'bbn-border-box']"
:style="currentStyle"
>
<div :class="['bbn-overlay', $parent.currentOrientation === 'vertical' ? 'bbn-flex-height' : 'bbn-flex-width']">
<div v-if="title"
... | let rect = this.$el.getBoundingClientRect();
return this.splitter ?
(this.splitter.isVertical ? rect.height : rect.width) :
(rect.height > rect.width ? rect.height : rect.width);
},
getSize(){
return parseInt(this.realSize) + 'px';
},
setSize(size){
... | ealSize(){
| identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.