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 |
|---|---|---|---|---|
smn-FI.js | Bridge.merge(new System.Globalization.CultureInfo("smn-FI", true), {
englishName: "Sami, Inari (Finland)",
nativeName: "anarâškielâ (Suomâ)",
numberFormat: Bridge.merge(new System.Globalization.NumberFormatInfo(), {
nanSymbol: "epiloho",
negativeSign: "-",
positiveSign: "+",
... | currencyGroupSizes: [3],
currencyDecimalDigits: 2,
currencyDecimalSeparator: ",",
currencyGroupSeparator: " ",
currencyNegativePattern: 8,
currencyPositivePattern: 3,
numberGroupSizes: [3],
numberDecimalDigits: 2,
numberDecimalSeparator: ",",
... | currencySymbol: "€", | random_line_split |
plot_from_pp_geop_height_by_day_dkbhu.py | #pp_file = ''
plot_diags=['408']
#plot_diags=['sp_hum']
plot_levels = [925, 850, 700, 500]
#experiment_ids = ['dkmbq', 'dklyu']
experiment_ids = ['djznw', 'djzny', 'djznq', 'djzns', 'dklwu', 'dklzq'] # All minus large 2
#Experiment_ids = ['djzny', 'djznq', 'djzns', 'dkjxq', 'dklyu', 'dkmbq', 'dklwu', 'dklzq', 'dkbhu... | ():
for p_level in plot_levels:
# Set pressure height contour min/max
if p_level == 925:
clev_min = 0.
clev_max = 810.
elif p_level == 850:
clev_min = 1435.
clev_max = 1530.
elif p_level == 700:
clev_min = 3090.
clev_... | main | identifier_name |
plot_from_pp_geop_height_by_day_dkbhu.py | #pp_file = ''
plot_diags=['408']
#plot_diags=['sp_hum']
plot_levels = [925, 850, 700, 500]
#experiment_ids = ['dkmbq', 'dklyu']
experiment_ids = ['djznw', 'djzny', 'djznq', 'djzns', 'dklwu', 'dklzq'] # All minus large 2
#Experiment_ids = ['djzny', 'djznq', 'djzns', 'dkjxq', 'dklyu', 'dkmbq', 'dklwu', 'dklzq', 'dkbhu... | clevpt_min = 300.
clevpt_max = 312.
elif p_level == 850:
clevpt_min = 302.
clevpt_max = 310.
elif p_level == 700:
clevpt_min = 312.
clevpt_max = 320.
elif p_level == 500:
clevpt_min = 325.
clevpt_max ... | for p_level in plot_levels:
# Set pressure height contour min/max
if p_level == 925:
clev_min = 0.
clev_max = 810.
elif p_level == 850:
clev_min = 1435.
clev_max = 1530.
elif p_level == 700:
clev_min = 3090.
clev_max = 3155... | identifier_body |
plot_from_pp_geop_height_by_day_dkbhu.py | #pp_file = ''
plot_diags=['408']
#plot_diags=['sp_hum']
plot_levels = [925, 850, 700, 500]
#experiment_ids = ['dkmbq', 'dklyu']
experiment_ids = ['djznw', 'djzny', 'djznq', 'djzns', 'dklwu', 'dklzq'] # All minus large 2
#Experiment_ids = ['djzny', 'djznq', 'djzns', 'dkjxq', 'dklyu', 'dkmbq', 'dklwu', 'dklzq', 'dkbhu... |
else:
print 'Specific humidity min/max not set for this pressure level'
#clevs_col = np.arange(clev_min, clev_max)
clevs_lin = np.arange(clev_min, clev_max, 256)
p_level_constraint = iris.Constraint(pressure=p_level)
for plot_diag in plot_diags: ... | clevsh_min = 0.001
clevsh_max = 0.005 | conditional_block |
plot_from_pp_geop_height_by_day_dkbhu.py | 'dkmbq', 'dklwu', 'dklzq', 'dkbhu', 'djznu', 'dkhgu' ] # All 12
#experiment_ids = ['djzny', 'djznq', 'djzns', 'dkjxq', 'dklwu', 'dklzq', 'dkbhu',] # All 12
#experiment_ids = ['dkbhu', 'dkjxq']
experiment_ids = ['dkmbq', 'dklyu', 'djznw', 'djzny', 'djznq', 'djzns', 'dklwu', 'dklzq'] # All minus large 2
experiment_ids =... |
#del time_cube
#plt.clabel(cont, fmt='%d')
#ax.stock_img() | random_line_split | |
panels.py | # -*- coding: utf-8 -*-
import tcod
from ..logger import get_logger
logger = get_logger(__name__) |
__all__ = ['Panel']
class Panel(object):
"""Creates a panel on the screen.
Args:
width(int): Width of panel [default: 80]
height(int): height of panel [default: 50]
name(str): Title of panel [default: Untitled]
position(tuple): (int: y, int: x) position on parent [default: (... | random_line_split | |
panels.py | # -*- coding: utf-8 -*-
import tcod
from ..logger import get_logger
logger = get_logger(__name__)
__all__ = ['Panel']
class | (object):
"""Creates a panel on the screen.
Args:
width(int): Width of panel [default: 80]
height(int): height of panel [default: 50]
name(str): Title of panel [default: Untitled]
position(tuple): (int: y, int: x) position on parent [default: (0, 0)]
parent(int): parent... | Panel | identifier_name |
panels.py | # -*- coding: utf-8 -*-
import tcod
from ..logger import get_logger
logger = get_logger(__name__)
__all__ = ['Panel']
class Panel(object):
"""Creates a panel on the screen.
Args:
width(int): Width of panel [default: 80]
height(int): height of panel [default: 50]
name(str): Title ... |
def __repr__(self):
cname = self.__class__.__name__
name = self.name
size = (self.width, self.height)
position = self.position
string = f'<{cname} {name} [{position} -> ({size})]>'
return string
| self.width = width or 80
self.height = height or 50
self.name = name or 'Untitled'
self.position = position or (0, 0)
self.parent = parent
self.panel = tcod.console_new(self.width, self.height) | identifier_body |
domain_tests.js | odoo.define('web.domain_tests', function (require) {
"use strict";
var Domain = require('web.Domain');
QUnit.module('core', {}, function () {
QUnit.module('domain');
QUnit.test("basic", function (assert) {
assert.expect(3);
var fields = {
a: 3,
group_method: 'line',
... |
QUnit.test("or", function (assert) {
assert.expect(3);
var web = {
section_id: null,
user_id: null,
member_ids: null,
};
var currentDomain = [
'|',
['section_id', '=', 42],
'|',
['us... | assert.ok(new Domain([['group_method','!=','count']]).compute(fields));
assert.ok(new Domain([['select1','=','day'], ['rrule_type','=','monthly']]).compute(fields));
}); | random_line_split |
TabbedContainer.tsx | import React, { useState } from 'react';
import { css } from '@emotion/css';
import { SelectableValue, GrafanaTheme2 } from '../../../data';
import { stylesFactory, useTheme2 } from '../../themes';
import { IconName, TabsBar, Tab, IconButton, CustomScrollbar, TabContent } from '../..';
export interface TabConfig {
... | (props: TabbedContainerProps) {
const [activeTab, setActiveTab] = useState(
props.tabs.some((tab) => tab.value === props.defaultTab) ? props.defaultTab : props.tabs?.[0].value
);
const onSelectTab = (item: SelectableValue<string>) => {
setActiveTab(item.value!);
};
const { tabs, onClose, closeIconTo... | TabbedContainer | identifier_name |
TabbedContainer.tsx | import React, { useState } from 'react';
import { css } from '@emotion/css';
import { SelectableValue, GrafanaTheme2 } from '../../../data';
import { stylesFactory, useTheme2 } from '../../themes';
import { IconName, TabsBar, Tab, IconButton, CustomScrollbar, TabContent } from '../..';
export interface TabConfig {
... | active={t.value === activeTab}
onChangeTab={() => onSelectTab(t)}
icon={t.icon}
/>
))}
<IconButton className={styles.close} onClick={onClose} name="times" title={closeIconTooltip ?? 'Close'} />
</TabsBar>
<CustomScrollbar autoHeightMin="100%">
... | {
const [activeTab, setActiveTab] = useState(
props.tabs.some((tab) => tab.value === props.defaultTab) ? props.defaultTab : props.tabs?.[0].value
);
const onSelectTab = (item: SelectableValue<string>) => {
setActiveTab(item.value!);
};
const { tabs, onClose, closeIconTooltip } = props;
const theme... | identifier_body |
TabbedContainer.tsx | import React, { useState } from 'react';
import { css } from '@emotion/css';
import { SelectableValue, GrafanaTheme2 } from '../../../data';
import { stylesFactory, useTheme2 } from '../../themes';
import { IconName, TabsBar, Tab, IconButton, CustomScrollbar, TabContent } from '../..';
export interface TabConfig {
... | font-size: ${theme.typography.size.lg};
`,
tabs: css`
padding-top: ${theme.spacing(1)};
border-color: ${theme.colors.border.weak};
ul {
margin-left: ${theme.spacing(2)};
}
`,
};
});
export function TabbedContainer(props: TabbedContainerProps) {
const [activeTab, se... | random_line_split | |
app.component.ts | import { Component } from '@angular/core';
import {contactStore} from '../contact.store';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Contacto';
message = 'Participa en la Red Precordillera';
contact_form... | })
}
} | random_line_split | |
app.component.ts | import { Component } from '@angular/core';
import {contactStore} from '../contact.store';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Contacto';
message = 'Participa en la Red Precordillera';
contact_form... | () {
contactStore.findAll('contacttypes')
.then((contacttypes) => {
this.contacttypes = contacttypes
// console.log(contacttypes)
})
.catch((error) => {
console.error(error)
})
}
}
| constructor | identifier_name |
modalStudent.js | $('.registerModalButton').on("click", function () {
var courseId = $(this).data('id'),
courseName = $(this).data('name');
$("#studentModal .registerOkButton").data('courseToRegisterId', courseId);
$("#studentModal #courseNameModal").text(courseName);
});
$(".registerOkButton").on("click", function... | .appendTo('.registerdSection')
.find('button')
.remove();
},
error: function (data) {
$("#errorModal .modal-title").text(data.responseText);
$('#errorModal').modal();
console.log('fail to register');
}
});
}... | random_line_split | |
settings.js | /**
* SETTINGS
* --------
*
* This file explains many default values and lower level abstraction
*/
//TODO:100 get token from state!
const basicHeaderRequest = (
token = '7924JKEE2H1O1EFKRGZ28N8FZ0JBV5UHLU36YQ02K23VUK7Q12ZEAXQ79MGFQ9WOC5VZ5GMBI3Y27F6091'
) => ( {
credentials: 'same-origin', //cors
headers: {... | lastUpdated: Date.now()
};
const notification = {
error: null,
success: null
};
//console.log('NODE_ENV = ', process.env.NODE_ENV);
if ( process.env.NODE_ENV === 'test' ) {
return {
data,
auth,
config,
notification
};
} else {
return {
data,
auth: {
...auth,
username: ( loca... | {
const data = {
data: [],
//keys: [],
//translations: [],
//words: [],
mappingKLN: [],
selectedNS: { id: 0, label: 'default' },
nameSpaceSet: [],
selectedTS: { id: 0, label: 'default' }
};
const auth = {
username: 'No username',
token: null,
isAuthenticated: false
};
const config = {
langu... | identifier_body |
settings.js | /**
* SETTINGS
* --------
*
* This file explains many default values and lower level abstraction
*/
//TODO:100 get token from state!
const basicHeaderRequest = (
token = '7924JKEE2H1O1EFKRGZ28N8FZ0JBV5UHLU36YQ02K23VUK7Q12ZEAXQ79MGFQ9WOC5VZ5GMBI3Y27F6091'
) => ( {
credentials: 'same-origin', //cors
headers: {... | success: null
};
//console.log('NODE_ENV = ', process.env.NODE_ENV);
if ( process.env.NODE_ENV === 'test' ) {
return {
data,
auth,
config,
notification
};
} else {
return {
data,
auth: {
...auth,
username: ( localStorage && localStorage.lastLogin ) || 'No username'
},
config... | didInvalidate: false,
lastUpdated: Date.now()
};
const notification = {
error: null, | random_line_split |
settings.js | /**
* SETTINGS
* --------
*
* This file explains many default values and lower level abstraction
*/
//TODO:100 get token from state!
const basicHeaderRequest = (
token = '7924JKEE2H1O1EFKRGZ28N8FZ0JBV5UHLU36YQ02K23VUK7Q12ZEAXQ79MGFQ9WOC5VZ5GMBI3Y27F6091'
) => ( {
credentials: 'same-origin', //cors
headers: {... | () {
const data = {
data: [],
//keys: [],
//translations: [],
//words: [],
mappingKLN: [],
selectedNS: { id: 0, label: 'default' },
nameSpaceSet: [],
selectedTS: { id: 0, label: 'default' }
};
const auth = {
username: 'No username',
token: null,
isAuthenticated: false
};
const config = {
la... | createInitialState | identifier_name |
settings.js | /**
* SETTINGS
* --------
*
* This file explains many default values and lower level abstraction
*/
//TODO:100 get token from state!
const basicHeaderRequest = (
token = '7924JKEE2H1O1EFKRGZ28N8FZ0JBV5UHLU36YQ02K23VUK7Q12ZEAXQ79MGFQ9WOC5VZ5GMBI3Y27F6091'
) => ( {
credentials: 'same-origin', //cors
headers: {... |
}
export const initialState = createInitialState();
| {
return {
data,
auth: {
...auth,
username: ( localStorage && localStorage.lastLogin ) || 'No username'
},
config: {
...config,
language: ( localStorage && localStorage.language ) || navigatorLanguage()
},
notification
};
} | conditional_block |
Example1.tsx | import React, { Component } from 'react';
import { Slider, Rail, Handles, Tracks } from 'react-compound-slider';
import ValueViewer from '../ValueViewer';
import { SliderRail, Handle, Track } from './components';
const sliderStyle = {
position: 'relative' as 'relative',
width: '100%',
touchAction: 'none',
};
co... | onChange = (values: ReadonlyArray<number>) => {
this.setState({ values });
};
render() {
const {
state: { values, update },
} = this;
return (
<div style={{ height: 120, width: '100%' }}>
<ValueViewer values={values} update={update} />
<Slider
mode={1}
... | random_line_split | |
colorpicker.js | /*
* JCE Editor 2.2.4
* @package JCE
* @url http://www.joomlacontenteditor.net
* @copyright Copyright (C) 2006 - 2012 Ryan Demmer. All rights reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html... | tinyMCEPopup.requireLangPack();var ColorPicker={settings:{},init:function(){var self=this,ed=tinyMCEPopup.editor,color=tinyMCEPopup.getWindowArg('input_color')||'#FFFFFF';$('#tmp_color').val(color).colorpicker($.extend(this.settings,{dialog:false,insert:function(){return ColorPicker.insert();},close:function(){return t... | */ | random_line_split |
worker.ts | require("reflect-metadata/Reflect");
import * as express from "express";
import * as Config from "../../config";
import * as securityConfig from "../../security-config";
import {router} from "../exports";
import * as data from "../../mongoose";
import { Decorators } from '../constants/decorators';
import { DecoratorTyp... |
}
else{
response.message="No service found.";
response.status="failure";
process.send(JSON.stringify(response));
//process.send("No service found.");
process.exit();
}
}else{
response.message="Worker param is null";
response.status=... | {
//return Q.when(true);
response.message="Method could not be executed";
response.status="failure";
response.error=JSON.stringify(ret);
process.send(JSON.stringify(response));
//process.send("Method could not be executed an... | conditional_block |
worker.ts | require("reflect-metadata/Reflect");
import * as express from "express";
import * as Config from "../../config";
import * as securityConfig from "../../security-config";
import {router} from "../exports";
import * as data from "../../mongoose";
import { Decorators } from '../constants/decorators';
import { DecoratorTyp... | //var cls = require('continuation-local-storage');
var serverUp= function(){
winstonLog.logInfo("+++++++++++++++++++ =======\n +++++++++++ Wroker executed +++++++++++ \n +++++++++++++++++++ =======");
const app = express();
const Main = require("../../core");
Config.Config.ignorePaths= Config.Config.i... | import {Container} from '../../di';
import {responseDetails} from './interfaces/response';
//var domain = require('../../security/auth/domain'); | random_line_split |
karma.underscore.conf.js | // Karma configuration
// Generated on Sun Apr 14 2013 18:31:17 GMT+0200 (CEST)
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files / patterns to load in the browser
files = [
JASMINE,
JASMINE_ADAPTER,
'http://code.angularjs.org/1.1.4/angular.js',
'http://code.angula... | // list of files to exclude
exclude = [
];
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['progress'];
// web server port
port = 9877;
// cli runner port
runnerPort = 9101;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of... | 'test/*.js'
];
| random_line_split |
simple.rs | /*
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
*
* 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, ... | (&mut self) {
self.widgets.label.set_text("Test");
}
fn model() -> LabelModel {
LabelModel {
counter: 0,
}
}
fn update(&mut self, _event: LabelMsg) {
self.widgets.label.set_text("");
}
view! {
#[name="label"]
gtk::Label {
... | init_view | identifier_name |
simple.rs | /*
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
*
* 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, ... |
#[cfg(test)]
mod tests {
use gtk::prelude::LabelExt;
use gtk_test::assert_text;
use crate::Win;
#[test]
fn root_widget() {
let (_component, _, widgets) = relm::init_test::<Win>(()).expect("init_test failed");
let label = &widgets.label;
assert_text!(label, "Test");
}... | {
Win::run(()).expect("Win::run failed");
} | identifier_body |
simple.rs | /*
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
*
* 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, ... | * 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, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/... | random_line_split | |
cluster_destroyed_event.py | import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterDestroyedEvent(vim, *args, **kwargs):
'''This event records when a cluster is d... | raise IndexError('Expected at least 5 arguments got: %d' % len(args))
required = [ 'chainId', 'createdTime', 'key', 'userName' ]
optional = [ 'changeTag', 'computeResource', 'datacenter', 'ds', 'dvs',
'fullFormattedMessage', 'host', 'net', 'vm', 'dynamicProperty', 'dynamicType' ]
for name,... |
# do some validation checking...
if (len(args) + len(kwargs)) < 4: | random_line_split |
cluster_destroyed_event.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterDestroyedEvent(vim, *args, **kwargs):
'''This event records when a cluster is ... |
else:
raise InvalidArgumentError("Invalid argument: %s. Expected one of %s" % (name, ", ".join(required + optional)))
return obj
| setattr(obj, name, value) | conditional_block |
cluster_destroyed_event.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterDestroyedEvent(vim, *args, **kwargs):
|
return obj
| '''This event records when a cluster is destroyed.'''
obj = vim.client.factory.create('ns0:ClusterDestroyedEvent')
# do some validation checking...
if (len(args) + len(kwargs)) < 4:
raise IndexError('Expected at least 5 arguments got: %d' % len(args))
required = [ 'chainId', 'createdTime'... | identifier_body |
cluster_destroyed_event.py |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def | (vim, *args, **kwargs):
'''This event records when a cluster is destroyed.'''
obj = vim.client.factory.create('ns0:ClusterDestroyedEvent')
# do some validation checking...
if (len(args) + len(kwargs)) < 4:
raise IndexError('Expected at least 5 arguments got: %d' % len(args))
required ... | ClusterDestroyedEvent | identifier_name |
util.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 {AbsoluteFsPath} from '../../../src/ngtsc/file_system';
import {Folder, MockFileSystemPosix} from '../../../sr... | {
const tmpFs = new MockFileSystemPosix(true);
const basePath = '/' as AbsoluteFsPath;
loadTsLib(tmpFs, basePath);
loadTestDirectory(
tmpFs, resolveNpmTreeArtifact('@angular/core-12'),
tmpFs.resolve('/node_modules/@angular/core'));
loadTestDirectory(
tmpFs, resolveNpmTreeArtifact('@angular/... | identifier_body | |
util.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 {AbsoluteFsPath} from '../../../src/ngtsc/file_system';
import {Folder, MockFileSystemPosix} from '../../../sr... | (): Folder {
const tmpFs = new MockFileSystemPosix(true);
const basePath = '/' as AbsoluteFsPath;
loadTsLib(tmpFs, basePath);
loadTestDirectory(
tmpFs, resolveNpmTreeArtifact('@angular/core-12'),
tmpFs.resolve('/node_modules/@angular/core'));
loadTestDirectory(
tmpFs, resolveNpmTreeArtifact... | loadNgccIntegrationTestFiles | identifier_name |
util.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 {AbsoluteFsPath} from '../../../src/ngtsc/file_system';
import {Folder, MockFileSystemPosix} from '../../../sr... | loadTestDirectory(
tmpFs, resolveNpmTreeArtifact('@angular/core-12'),
tmpFs.resolve('/node_modules/@angular/core'));
loadTestDirectory(
tmpFs, resolveNpmTreeArtifact('@angular/common-12'),
tmpFs.resolve('/node_modules/@angular/common'));
loadTestDirectory(
tmpFs, resolveNpmTreeArtifa... | const basePath = '/' as AbsoluteFsPath;
loadTsLib(tmpFs, basePath); | random_line_split |
get-source-type-options.factory.js | export default
function | (Rest, ProcessErrors, GetBasePath) {
return function(params) {
var scope = params.scope,
variable = params.variable;
if (scope[variable] === undefined) {
scope[variable] = [];
Rest.setUrl(GetBasePath('inventory_sources'));
Rest... | GetSourceTypeOptions | identifier_name |
get-source-type-options.factory.js | export default
function GetSourceTypeOptions(Rest, ProcessErrors, GetBasePath) {
return function(params) {
var scope = params.scope,
variable = params.variable;
if (scope[variable] === undefined) {
scope[variable] = [];
Rest.setUrl(GetBase... |
scope.cloudCredentialRequired = false;
scope.$emit('sourceTypeOptionsReady');
})
.catch(({data, status}) => {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to retrieve ... | {
if (choices[i][0] !== 'file' && choices[i][0] !== "") {
scope[variable].push({
label: choices[i][1],
value: choices[i][0]
});
}
} | conditional_block |
get-source-type-options.factory.js | export default
function GetSourceTypeOptions(Rest, ProcessErrors, GetBasePath) {
return function(params) {
var scope = params.scope,
variable = params.variable;
if (scope[variable] === undefined) {
scope[variable] = [];
Rest.setUrl(GetBase... |
GetSourceTypeOptions.$inject =
[ 'Rest',
'ProcessErrors',
'GetBasePath'
]; | random_line_split | |
get-source-type-options.factory.js | export default
function GetSourceTypeOptions(Rest, ProcessErrors, GetBasePath) | scope.$emit('sourceTypeOptionsReady');
})
.catch(({data, status}) => {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to retrieve options for inventory_sources.source. OPTIONS status: ' + st... | {
return function(params) {
var scope = params.scope,
variable = params.variable;
if (scope[variable] === undefined) {
scope[variable] = [];
Rest.setUrl(GetBasePath('inventory_sources'));
Rest.options()
.then(({... | identifier_body |
iter_count.rs | use super::utils::derefs_to_slice;
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::is_type_diagnostic_item;
use rustc_errors::Applicability;
use rustc_hir::Expr;
use rustc_lint::LateContext;
use rustc_span::sym;
use super::ITER_COUNT;
pub(... | <'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, recv: &'tcx Expr<'tcx>, iter_method: &str) {
let ty = cx.typeck_results().expr_ty(recv);
let caller_type = if derefs_to_slice(cx, recv, ty).is_some() {
"slice"
} else if is_type_diagnostic_item(cx, ty, sym::vec_type) {
"Vec"
} else if is_ty... | check | identifier_name |
iter_count.rs | use super::utils::derefs_to_slice;
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::is_type_diagnostic_item;
use rustc_errors::Applicability;
use rustc_hir::Expr; |
pub(crate) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, recv: &'tcx Expr<'tcx>, iter_method: &str) {
let ty = cx.typeck_results().expr_ty(recv);
let caller_type = if derefs_to_slice(cx, recv, ty).is_some() {
"slice"
} else if is_type_diagnostic_item(cx, ty, sym::vec_type) {
"Vec"... | use rustc_lint::LateContext;
use rustc_span::sym;
use super::ITER_COUNT; | random_line_split |
iter_count.rs | use super::utils::derefs_to_slice;
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::is_type_diagnostic_item;
use rustc_errors::Applicability;
use rustc_hir::Expr;
use rustc_lint::LateContext;
use rustc_span::sym;
use super::ITER_COUNT;
pub(... | else if is_type_diagnostic_item(cx, ty, sym::BinaryHeap) {
"BinaryHeap"
} else {
return;
};
let mut applicability = Applicability::MachineApplicable;
span_lint_and_sugg(
cx,
ITER_COUNT,
expr.span,
&format!("called `.{}().count()` on a `{}`", iter_method, ... | {
"LinkedList"
} | conditional_block |
iter_count.rs | use super::utils::derefs_to_slice;
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::is_type_diagnostic_item;
use rustc_errors::Applicability;
use rustc_hir::Expr;
use rustc_lint::LateContext;
use rustc_span::sym;
use super::ITER_COUNT;
pub(... | } else {
return;
};
let mut applicability = Applicability::MachineApplicable;
span_lint_and_sugg(
cx,
ITER_COUNT,
expr.span,
&format!("called `.{}().count()` on a `{}`", iter_method, caller_type),
"try",
format!(
"{}.len()",
... | {
let ty = cx.typeck_results().expr_ty(recv);
let caller_type = if derefs_to_slice(cx, recv, ty).is_some() {
"slice"
} else if is_type_diagnostic_item(cx, ty, sym::vec_type) {
"Vec"
} else if is_type_diagnostic_item(cx, ty, sym::vecdeque_type) {
"VecDeque"
} else if is_type_d... | identifier_body |
pathmatics.py | from math import sqrt, pow
def linepoint(t, x0, y0, x1, y1):
"""Returns coordinates for point at t on the line.
Calculates the coordinates of x and y for a point
at t on a straight line.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of the line,
x1 and ... | return length | yi = pt_y
| random_line_split |
pathmatics.py | from math import sqrt, pow
def linepoint(t, x0, y0, x1, y1):
"""Returns coordinates for point at t on the line.
Calculates the coordinates of x and y for a point
at t on a straight line.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of the line,
x1 and ... | (x0, y0, x1, y1):
"""Returns the length of the line."""
a = pow(abs(x0 - x1), 2)
b = pow(abs(y0 - y1), 2)
return sqrt(a+b)
def curvepoint(t, x0, y0, x1, y1, x2, y2, x3, y3, handles=False):
"""Returns coordinates for point at t on the spline.
Calculates the coordinates of x and y for a point... | linelength | identifier_name |
pathmatics.py | from math import sqrt, pow
def linepoint(t, x0, y0, x1, y1):
"""Returns coordinates for point at t on the line.
Calculates the coordinates of x and y for a point
at t on a straight line.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of the line,
x1 and ... | x01 = x0 * mint + x1 * t
y01 = y0 * mint + y1 * t
x12 = x1 * mint + x2 * t
y12 = y1 * mint + y2 * t
x23 = x2 * mint + x3 * t
y23 = y2 * mint + y3 * t
out_c1x = x01 * mint + x12 * t
out_c1y = y01 * mint + y12 * t
out_c2x = x12 * mint + x23 * t
out_c2y = y12 * mint ... | """Returns coordinates for point at t on the spline.
Calculates the coordinates of x and y for a point
at t on the cubic bezier spline, and its control points,
based on the de Casteljau interpolation algorithm.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of... | identifier_body |
pathmatics.py | from math import sqrt, pow
def linepoint(t, x0, y0, x1, y1):
"""Returns coordinates for point at t on the line.
Calculates the coordinates of x and y for a point
at t on a straight line.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of the line,
x1 and ... |
def curvelength(x0, y0, x1, y1, x2, y2, x3, y3, n=20):
"""Returns the length of the spline.
Integrates the estimated length of the cubic bezier spline
defined by x0, y0, ... x3, y3, by adding the lengths of
lineair lines between points at t.
The number of points is defined by n
(n=10 would... | return (out_x, out_y, out_c1x, out_c1y, out_c2x, out_c2y, x01, y01, x23, y23) | conditional_block |
overlay.ts | /* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
type OverlayType = 'click' | 'hover';
let clickOverlay: HTMLElement;
let hoverOverlay: HTMLElement;
function getOverlay(type: OverlayType) {
if (type === 'click') {
if (!clickOverlay) {
clickOverlay = document.createElement('div');
... |
export function showOverlay(rect: Rectangle, type: OverlayType, scrollIntoView: boolean): void {
const overlay = getOverlay(type);
if (rect) {
const { top, left, width, height } = rect;
if (top || left || width || height) {
const offset = getBodyOffset();
const overlayTop = top - offset.top;... | {
const rect = document.body.getBoundingClientRect();
const style = window.getComputedStyle(document.body);
const marginTop = getPixelValue(style.marginTop) ?? 0;
const marginLeft = getPixelValue(style.marginLeft) ?? 0;
return {
top: rect.top - marginTop,
left: rect.left - marginLeft,
};
} | identifier_body |
overlay.ts | /* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
type OverlayType = 'click' | 'hover';
let clickOverlay: HTMLElement;
let hoverOverlay: HTMLElement;
function getOverlay(type: OverlayType) {
if (type === 'click') {
if (!clickOverlay) {
clickOverlay = document.createElement('div');
... |
}
}
}
}
export function hideOverlay(type: OverlayType): void {
const overlay = getOverlay(type);
overlay.className = 'out';
}
| {
const scrollPadding = 50;
window.scrollTo({
behavior: 'smooth',
top: overlayTop - scrollPadding,
left: overlayLeft - scrollPadding,
});
} | conditional_block |
overlay.ts | /* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
type OverlayType = 'click' | 'hover';
let clickOverlay: HTMLElement;
let hoverOverlay: HTMLElement;
function getOverlay(type: OverlayType) {
if (type === 'click') {
if (!clickOverlay) {
clickOverlay = document.createElement('div');
... | overlay.className = 'out';
} | export function hideOverlay(type: OverlayType): void {
const overlay = getOverlay(type); | random_line_split |
overlay.ts | /* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
type OverlayType = 'click' | 'hover';
let clickOverlay: HTMLElement;
let hoverOverlay: HTMLElement;
function getOverlay(type: OverlayType) {
if (type === 'click') {
if (!clickOverlay) {
clickOverlay = document.createElement('div');
... | () {
const rect = document.body.getBoundingClientRect();
const style = window.getComputedStyle(document.body);
const marginTop = getPixelValue(style.marginTop) ?? 0;
const marginLeft = getPixelValue(style.marginLeft) ?? 0;
return {
top: rect.top - marginTop,
left: rect.left - marginLeft,
};
}
expo... | getBodyOffset | identifier_name |
run-sequence.spec.js | import {CssAnimator} from '../src/animator';
import {animationEvent} from 'aurelia-templating';
jasmine.getFixtures().fixturesPath = 'base/test/fixtures/';
describe('animator-css', () => {
var sut;
beforeEach(() => {
sut = new CssAnimator();
});
describe('runSequence function', () => {
var elems;
... | });
});
});
}); | document.removeEventListener(animationEvent.sequenceDone, listenerDone);
expect(beginFired).toBe(true);
expect(doneFired).toBe(true); | random_line_split |
baked.py | session)
def __call__(self, session):
return self.for_session(session)
def spoil(self, full=False):
"""Cancel any query caching that will occur on this BakedQuery object.
The BakedQuery can continue to be used normally, however additional
creational functions will not be cach... | bk._cache_key = cache_key
q = bk.for_session(session)
for fn in post_criteria:
q = q.with_post_criteria(fn)
context.attributes[k] = q.params(**params)
class Result(object):
"""Invokes a :class:`.BakedQuery` against a :class:`.Session`.
The :clas... | ) | random_line_split |
baked.py |
def __call__(self, session):
return self.for_session(session)
def spoil(self, full=False):
"""Cancel any query caching that will occur on this BakedQuery object.
The BakedQuery can continue to be used normally, however additional
creational functions will not be cached; they ... | """Return a :class:`.Result` object for this :class:`.BakedQuery`.
This is equivalent to calling the :class:`.BakedQuery` as a
Python callable, e.g. ``result = my_baked_query(session)``.
"""
return Result(self, session) | identifier_body | |
baked.py | session)
def __call__(self, session):
return self.for_session(session)
def spoil(self, full=False):
"""Cancel any query caching that will occur on this BakedQuery object.
The BakedQuery can continue to be used normally, however additional
creational functions will not be cach... |
return context
def to_query(self, query_or_session):
"""Return the :class:`_query.Query` object for use as a subquery.
This method should be used within the lambda callable being used
to generate a step of an enclosing :class:`.BakedQuery`. The
parameter should normally... | self._bakery[self._effective_key(session)] = context | conditional_block |
baked.py | (object):
"""Callable which returns a :class:`.BakedQuery`.
This object is returned by the class method
:meth:`.BakedQuery.bakery`. It exists as an object
so that the "cache" can be easily inspected.
.. versionadded:: 1.2
"""
__slots__ = "cls", "cache"
def __init__(self, cls_, cac... | Bakery | identifier_name | |
test.py | keyrrsig = server.dig("example.com", "DNSKEY", dnssec=True, bufsize=4096)
found_rrsigs = qdnskeyrrsig.count("RRSIG")
qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096)
found_soa_rrsigs = qsoa.count("RRSIG")
check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys));
check_lo... |
if found_rrsigs != dnskey_rrsigs:
set_err("BAD DNSKEY RRSIG COUNT: " + msg)
detail_log("!RRSIGs not published and activated as expected: " + msg)
detail_log(SEP)
server.zone_backup(zone, flush=True)
server.zone_verify(zone)
def wait_for_rrsig_count(t, server, rrtype, rrsig_count, ti... | set_err("BAD RRSIG COUNT: " + msg)
detail_log("!RRSIGs not published and activated as expected: " + msg) | conditional_block |
test.py | keyrrsig = server.dig("example.com", "DNSKEY", dnssec=True, bufsize=4096)
found_rrsigs = qdnskeyrrsig.count("RRSIG")
qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096)
found_soa_rrsigs = qsoa.count("RRSIG")
check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys));
check_lo... |
if time.monotonic() > endtime:
break
def writef(filename, contents):
with open(filename, "w") as f:
f.write(contents)
t = Test()
knot = t.server("knot")
ZONE = "example.com."
FUTURE = 55
TICK = 5
STARTUP = 10
NONSENSE = 4396
zone = t.zone(ZONE)
t.link(zone, knot)
knot.zonefile_sync... | else:
t.sleep(0.5) | random_line_split |
test.py | (skr_in, skr_out):
rrsigs_total = 9
after_rrsig = -1000
rrsig_now = 0
rrsig_chosen = random.randint(1, rrsigs_total)
with open(skr_in, "r") as fin:
with open(skr_out, "w") as fout:
for linein in fin:
lineout = linein
linesplit = linein.split()
... | cripple_skr | identifier_name | |
test.py |
if found_rrsigs != dnskey_rrsigs:
set_err("BAD DNSKEY RRSIG COUNT: " + msg)
detail_log("!RRSIGs not published and activated as expected: " + msg)
detail_log(SEP)
server.zone_backup(zone, flush=True)
server.zone_verify(zone)
def wait_for_rrsig_count(t, server, rrtype, rrsig_count, ti... | qdnskeys = server.dig("example.com", "DNSKEY", bufsize=4096)
found_dnskeys = qdnskeys.count("DNSKEY")
qdnskeyrrsig = server.dig("example.com", "DNSKEY", dnssec=True, bufsize=4096)
found_rrsigs = qdnskeyrrsig.count("RRSIG")
qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096)
found_so... | identifier_body | |
LoadTestRESTR.py | #! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | now = datetime.datetime.now()
while len(processes) < MAX_THREADS:
p = Process(target=test, args=(MAX_CLIENTS - remaining,))
p.start()
processes.append(p)
remaining -= 1
while len(processes) >= MAX_THREADS:
new_processes = []
for p ... | conditional_block | |
LoadTestRESTR.py | #! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... |
processes = []
remaining = MAX_CLIENTS
while remaining > 0:
now = datetime.datetime.now()
while len(processes) < MAX_THREADS:
p = Process(target=test, args=(MAX_CLIENTS - remaining,))
p.start()
processes.append(p)
remaining -= 1
while... | del sys.argv[1] | random_line_split |
LoadTestRESTR.py | #! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | (self):
resp = self.create_request("GET", "/infrastructures")
self.assertEqual(resp.status_code, 200,
msg="ERROR listing user infrastructures:" + resp.text)
if resp.text:
for inf_id in resp.text.split("\n"):
inf_id = os.path.basename(inf_id)
... | test_10_list | identifier_name |
LoadTestRESTR.py | #! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... |
def getstate(self, inf_id):
resp = self.create_request("GET", "/infrastructures/" + inf_id + "/state")
self.assertEqual(
resp.status_code, 200, msg="ERROR getting the infrastructure state:" + resp.text)
res = json.loads(resp.text)
state = res['state']['state']
v... | resp = self.create_request("GET", "/infrastructures/" + inf_id)
self.assertEqual(resp.status_code, 200,
msg="ERROR getting the infrastructure info:" + resp.text) | identifier_body |
getcustom.py | import datetime
import sys
import os.path
#hardcoded directories
dir_input = "input/"
dir_output = "output/"
#check that the login credentials and input file location are being passed in
numOfArgs = len(sys.argv) - 1
if numOfArgs != 3:
print "Please run this python script with username,password and input file locat... | from pydatastream import Datastream
import json | random_line_split | |
getcustom.py | from pydatastream import Datastream
import json
import datetime
import sys
import os.path
#hardcoded directories
dir_input = "input/"
dir_output = "output/"
#check that the login credentials and input file location are being passed in
numOfArgs = len(sys.argv) - 1
if numOfArgs != 3:
print "Please run this python s... |
startTime = datetime.datetime.now()
#send request to retrieve the data from Datastream
req = DWE.fetch(str(search_code),custom_fields,date_from=str(start_date),only_data=False)
time_taken = time_taken + datetime.datetime.now() - startTime
#format date and convert to json
raw_json = req... | custom_fields[:] = []
custom_fields.append(value) | conditional_block |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | version('1.16', 'b86318f2b6ac6af3ee985299e1e38fe5')
depends_on('pkgconfig', type=('build', 'run')) |
homepage = "http://search.cpan.org/~xaoc/ExtUtils-PkgConfig-1.16/lib/ExtUtils/PkgConfig.pm"
url = "http://search.cpan.org/CPAN/authors/id/X/XA/XAOC/ExtUtils-PkgConfig-1.16.tar.gz"
| random_line_split |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | (PerlPackage):
"""simplistic interface to pkg-config"""
homepage = "http://search.cpan.org/~xaoc/ExtUtils-PkgConfig-1.16/lib/ExtUtils/PkgConfig.pm"
url = "http://search.cpan.org/CPAN/authors/id/X/XA/XAOC/ExtUtils-PkgConfig-1.16.tar.gz"
version('1.16', 'b86318f2b6ac6af3ee985299e1e38fe5')
depe... | PerlExtutilsPkgconfig | identifier_name |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | """simplistic interface to pkg-config"""
homepage = "http://search.cpan.org/~xaoc/ExtUtils-PkgConfig-1.16/lib/ExtUtils/PkgConfig.pm"
url = "http://search.cpan.org/CPAN/authors/id/X/XA/XAOC/ExtUtils-PkgConfig-1.16.tar.gz"
version('1.16', 'b86318f2b6ac6af3ee985299e1e38fe5')
depends_on('pkgconfig',... | identifier_body | |
security_utils.py | #########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... | (user_list):
default_tenant = Tenant.query.get(DEFAULT_TENANT_ID)
for user in user_list:
role = user_datastore.find_role(user['role'])
user_obj = user_datastore.create_user(
username=user['username'],
password=hash_password(user['password']),
roles=[role]
... | add_users_to_db | identifier_name |
security_utils.py | #########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... |
def get_status_reporters():
return [
{
'username': MANAGER_STATUS_REPORTER,
'password': 'password',
'role': MANAGER_STATUS_REPORTER,
'id': MANAGER_STATUS_REPORTER_ID
},
{
'username': BROKER_STATUS_REPORTER,
'password'... | return {
'username': 'admin',
'password': 'admin',
'role': ADMIN_ROLE
} | identifier_body |
security_utils.py | #########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... | user_obj.active = user.get('active', True)
user_tenant_association = UserTenantAssoc(
user=user_obj,
tenant=default_tenant,
role=default_tenant_role,
)
user_obj.tenant_associations.append(user_tenant_association)
user_datastore.commit() | password=hash_password(user['password']),
roles=[role]
)
default_tenant_role = user_datastore.find_role(DEFAULT_TENANT_ROLE) | random_line_split |
security_utils.py | #########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... |
user_datastore.commit()
| role = user_datastore.find_role(user['role'])
user_obj = user_datastore.create_user(
username=user['username'],
password=hash_password(user['password']),
roles=[role]
)
default_tenant_role = user_datastore.find_role(DEFAULT_TENANT_ROLE)
user_obj.activ... | conditional_block |
semi-strict-navigation-mode.ts | import {EventEmitter} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
import {NavigationMode} from './navigation-mode.interface';
import {WizardState} from './wizard-state.model';
/**
* A [[NavigationMo... | (destinationIndex: number): boolean {
if (this.wizardState.getStepAtIndex(destinationIndex) instanceof WizardCompletionStep) {
// a completion step can only be entered, if all previous steps have been completed, are optional, or selected
return this.wizardState.wizardSteps.filter((step, index) => index ... | isNavigable | identifier_name |
semi-strict-navigation-mode.ts | import {EventEmitter} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
import {NavigationMode} from './navigation-mode.interface';
import {WizardState} from './wizard-state.model';
/**
* A [[NavigationMo... | return Promise.resolve(
!(this.wizardState.getStepAtIndex(destinationIndex) instanceof WizardCompletionStep) || allNormalStepsCompleted);
} else {
return Promise.resolve(false);
}
};
return Promise.resolve(hasStep)
.then(canExitCurrentStep)
.then(canEnterDestin... | {
const hasStep = this.wizardState.hasStep(destinationIndex);
const movingDirection = this.wizardState.getMovingDirection(destinationIndex);
const canExitCurrentStep = (previous: boolean) => {
return previous ? this.wizardState.currentStep.canExitStep(movingDirection) : Promise.resolve(false);
}... | identifier_body |
semi-strict-navigation-mode.ts | import {EventEmitter} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
import {NavigationMode} from './navigation-mode.interface';
import {WizardState} from './wizard-state.model';
/**
* A [[NavigationMo... |
};
return Promise.resolve(hasStep)
.then(canExitCurrentStep)
.then(canEnterDestinationStep)
.then(destinationStep);
}
/**
* Tries to enter the wizard step with the given destination index.
* When entering the destination step, the following actions are done:
* - the old current... | {
return Promise.resolve(false);
} | conditional_block |
semi-strict-navigation-mode.ts | import {EventEmitter} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
import {NavigationMode} from './navigation-mode.interface';
import {WizardState} from './wizard-state.model';
/**
* A [[NavigationMo... | // a completion step can only be entered, if all previous steps have been completed, are optional, or selected
return this.wizardState.wizardSteps.filter((step, index) => index < destinationIndex)
.every(step => step.completed || step.optional || step.selected);
} else {
// a "normal" step... | isNavigable(destinationIndex: number): boolean {
if (this.wizardState.getStepAtIndex(destinationIndex) instanceof WizardCompletionStep) { | random_line_split |
block-scroll-strategy.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 {ScrollStrategy} from './scroll-strategy';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {coerc... |
/** Blocks page-level scroll while the attached overlay is open. */
enable() {
if (this._canBeEnabled()) {
const root = this._document.documentElement!;
this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();
// Cache the previous inline styles in case the user had s... | }
/** Attaches this scroll strategy to an overlay. */
attach() {} | random_line_split |
block-scroll-strategy.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 {ScrollStrategy} from './scroll-strategy';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {coerc... | if (scrollBehaviorSupported) {
htmlStyle.scrollBehavior = bodyStyle.scrollBehavior = 'auto';
}
window.scroll(this._previousScrollPosition.left, this._previousScrollPosition.top);
if (scrollBehaviorSupported) {
htmlStyle.scrollBehavior = previousHtmlScrollBehavior;
bodyS... | {
if (this._isEnabled) {
const html = this._document.documentElement!;
const body = this._document.body!;
const htmlStyle = html.style;
const bodyStyle = body.style;
const previousHtmlScrollBehavior = htmlStyle.scrollBehavior || '';
const previousBodyScrollBehavior = bodyStyle.sc... | identifier_body |
block-scroll-strategy.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 {ScrollStrategy} from './scroll-strategy';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {coerc... | () {
if (this._canBeEnabled()) {
const root = this._document.documentElement!;
this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();
// Cache the previous inline styles in case the user had set them.
this._previousHTMLStyles.left = root.style.left || '';
thi... | enable | identifier_name |
block-scroll-strategy.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 {ScrollStrategy} from './scroll-strategy';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {coerc... |
}
}
private _canBeEnabled(): boolean {
// Since the scroll strategies can't be singletons, we have to use a global CSS class
// (`cdk-global-scrollblock`) to make sure that we don't try to disable global
// scrolling multiple times.
const html = this._document.documentElement!;
if (html.c... | {
htmlStyle.scrollBehavior = previousHtmlScrollBehavior;
bodyStyle.scrollBehavior = previousBodyScrollBehavior;
} | conditional_block |
predictor.py | , so we don't need to convert them
# to BGR, they are already! So all we need to do is to normalize
# by 255 if we want to convert to BGR255 format, or flip the channels
# if we want it to be in RGB in [0-1] range.
if cfg.INPUT.TO_BGR255:
to_bgr_transform = T.Lambda(lambda x:... | """
dataset_keypoints = PersonKeypoints.NAMES | random_line_split | |
predictor.py | phone",
"microwave",
"oven",
"toaster",
"sink",
"refrigerator",
"book",
"clock",
"vase",
"scissors",
"teddy bear",
"hair drier",
"toothbrush",
]
def __init__(
self,
cfg,
confidence_threshold... |
normalize_transform = T.Normalize(
mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD
)
transform = T.Compose(
[
T.ToPILImage(),
T.Resize(self.min_image_size),
T.ToTensor(),
to_bgr_transform,
... | to_bgr_transform = T.Lambda(lambda x: x[[2, 1, 0]]) | conditional_block |
predictor.py | phone",
"microwave",
"oven",
"toaster",
"sink",
"refrigerator",
"book",
"clock",
"vase",
"scissors",
"teddy bear",
"hair drier",
"toothbrush",
]
def __init__(
self,
cfg,
confidence_threshold... | result = self.overlay_class_names(result, top_predictions)
return result
def compute_prediction(self, original_image):
"""
Arguments:
original_image (np.ndarray): an image as returned by OpenCV
Returns:
prediction (BoxList): the detected objects. A... | """
Arguments:
image (np.ndarray): an image as returned by OpenCV
Returns:
prediction (BoxList): the detected objects. Additional information
of the detection properties can be found in the fields of
the BoxList via `prediction.fields()`
"... | identifier_body |
predictor.py | "hair drier",
"toothbrush",
]
def __init__(
self,
cfg,
confidence_threshold=0.7,
show_mask_heatmaps=False,
masks_per_dim=2,
min_image_size=224,
):
self.cfg = cfg.clone()
self.model = build_detection_model(cfg)
self.model.eval(... | overlay_class_names | identifier_name | |
analyze_altmetric.py | # -*- coding: utf-8 -*-
__author__ = "Sal Aguinaga"
__copyright__ = "Copyright 2015, The Phoenix Project"
__credits__ = ["Sal Aguinaga", "Rodrigo Palacios", "Tim Weninger"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Sal Aguinaga"
__email__ = "saguinag (at) nd dot edu"
import json
import argparse,trac... |
# << Begin >>
args = parse_input_args()
in_json_path = args['injson']
# reads in the JSON file
json_data = []
docsd = {}
with open(in_json_path) as f:
for line in f:
jobj=json.loads(line)
json_data.append(jobj)
# for jl in json_data:
# print jl['details_url']
# for alt_k in jl.keys():
# ... | parser = argparse.ArgumentParser(description='query twitter and output to file')
parser.add_argument('injson', metavar='INJSON', help='Input JSON path')
parser.add_argument('--version', action='version', version=__version__)
args = vars(parser.parse_args())
return args | identifier_body |
analyze_altmetric.py | # -*- coding: utf-8 -*-
__author__ = "Sal Aguinaga"
__copyright__ = "Copyright 2015, The Phoenix Project"
__credits__ = ["Sal Aguinaga", "Rodrigo Palacios", "Tim Weninger"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Sal Aguinaga"
__email__ = "saguinag (at) nd dot edu"
import json
import argparse,trac... |
print packet_ar
print '-'*80
alt_pub = json_data[-1]
pprint(alt_pub.keys())
pub_title = 'Publication title: {}'.format(alt_pub['title'])
print pub_title
print alt_pub['cited_by_tweeters_count']
## counts
'''
for ak in jl.keys():
# print [x for x in str(ak)]
if '_id' in ak: packet_ar.append(jl[ak])
if 'cou... | packet_ar.append(jl[ak]) | conditional_block |
analyze_altmetric.py | # -*- coding: utf-8 -*-
__author__ = "Sal Aguinaga"
__copyright__ = "Copyright 2015, The Phoenix Project"
__credits__ = ["Sal Aguinaga", "Rodrigo Palacios", "Tim Weninger"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Sal Aguinaga"
__email__ = "saguinag (at) nd dot edu"
import json
import argparse,trac... | '''
cnt_d = {}
for k,v in alt_pub.items():
if 'count' in k:
cnt_d[k] = v
pprint(cnt_d)
print '-'*80
pprint(alt_pub['tq'])
#### | for ak in jl.keys():
# print [x for x in str(ak)]
if '_id' in ak: packet_ar.append(jl[ak])
if 'count' in ak: packet_ar.append(jl[ak])count_ar = | random_line_split |
analyze_altmetric.py | # -*- coding: utf-8 -*-
__author__ = "Sal Aguinaga"
__copyright__ = "Copyright 2015, The Phoenix Project"
__credits__ = ["Sal Aguinaga", "Rodrigo Palacios", "Tim Weninger"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Sal Aguinaga"
__email__ = "saguinag (at) nd dot edu"
import json
import argparse,trac... | ():
parser = argparse.ArgumentParser(description='query twitter and output to file')
parser.add_argument('injson', metavar='INJSON', help='Input JSON path')
parser.add_argument('--version', action='version', version=__version__)
args = vars(parser.parse_args())
return args
# << Begin >>
args = parse_input_... | parse_input_args | identifier_name |
frwz_nk.rs | %-------------------------------------------------------------
% Nonlinear New Keynesian Model
% Reference: Foerster, Rubio-Ramirez, Waggoner and Zha (2013)
% Perturbation Methods for Markov Switching Models.
%-------------------------------------------------------------
endogenous PAI, "Inflation", Y, "Output gap", R... | steady_state_model
PAI=1;
Y=(eta-1)/eta;
R=exp(mu)/betta*PAI;
parameterization
a_tp_1_2,1-.9;
a_tp_2_1,1-.9;
betta, .99;
kappa, 161;
eta, 10;
rhor, .8;
sigr, 0.0025;
mu(a,1), 0.03;
mu(a,2), 0.01;
psi(a,1), 3.1;
psi(a,2), 0.9; | random_line_split | |
matrix.py | """
@summary: Module contain matrix base classes
@author: CJ Grady
@version: 1.0
@status: alpha
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawre... | (self, fn):
with open(fn, 'w') as f:
for row in self.data:
f.write('%s\n' % ' '.join([str(i) for i in row]))
# .............................................................................
class _CompressedGrid(Grid):
# ...........................
def __init__(self):
raise Except... | write | identifier_name |
matrix.py | """
@summary: Module contain matrix base classes
@author: CJ Grady
@version: 1.0
@status: alpha
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawre... |
# ...........................
def query(self, x, y):
return self.data[y][x]
# ...........................
def read(self, fn):
self.data = []
with open(fn) as f:
for line in f:
self.data.append([int(i) for i in line.split(' ')])
# ...........................
... | for col in row:
self.classes.add(col) | conditional_block |
matrix.py | """
@summary: Module contain matrix base classes
@author: CJ Grady
@version: 1.0
@status: alpha
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawre... | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin S... | your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of | random_line_split |
matrix.py | """
@summary: Module contain matrix base classes
@author: CJ Grady
@version: 1.0
@status: alpha
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawre... |
# ...........................
def findClasses(self):
"""
@summary: Finds all of the unique classes in the data
"""
self.classes = set([])
for row in self.data:
for col in row:
self.classes.add(col)
# ...........................
def query(self, x... | self.ySize = len(griddedData)
self.xSize = len(griddedData[0])
self.data = griddedData
self.findClasses() | identifier_body |
StringLiteralNode.ts | import { inject, injectable, } from 'inversify';
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
import { TStatement } from '../../types/node/TStatement';
import { ICustomCode... | (
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
@inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
@inject(ServiceIdentifiers.IRandomGenerat... | constructor | identifier_name |
StringLiteralNode.ts | import { inject, injectable, } from 'inversify';
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
import { TStatement } from '../../types/node/TStatement';
import { ICustomCode... |
}
| {
const structure: TStatement = NodeFactory.expressionStatementNode(
NodeFactory.literalNode(this.literalValue)
);
return [structure];
} | identifier_body |
StringLiteralNode.ts | import { inject, injectable, } from 'inversify';
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
import { TStatement } from '../../types/node/TStatement';
import { ICustomCode... |
return [structure];
}
} | ); | random_line_split |
PageWithNav.js | import React from 'react'
import { connect } from 'react-redux'
import { VelocityComponent } from 'velocity-react'
import TopNav from '../components/TopNav'
import NetworkNav from '../components/NetworkNav'
import LeftNav, { leftNavWidth, leftNavEasing } from '../components/LeftNav'
import { toggleLeftNav, updateCurren... |
}
const openLeftNav = () => toggleLeftNavAndSave(true)
const closeLeftNav = () => toggleLeftNavAndSave(false)
const links = makeNavLinks(currentUser, community)
const showNetworkNav = currentUser && !isMobile && networkCommunities &&
networkCommunities.length > 1 && !path.startsWith('/t/')
const tagNot... | {
setTimeout(() => {
const settings = {leftNavIsOpen: open}
dispatch(updateCurrentUser({settings}))
}, 5000)
} | conditional_block |
PageWithNav.js | import React from 'react'
import { connect } from 'react-redux'
import { VelocityComponent } from 'velocity-react'
import TopNav from '../components/TopNav'
import NetworkNav from '../components/NetworkNav'
import LeftNav, { leftNavWidth, leftNavEasing } from '../components/LeftNav'
import { toggleLeftNav, updateCurren... | opened={leftNavIsOpen}
tagNotificationCount={tagNotificationCount} />
<VelocityComponent animation={moveWithMenu} easing={leftNavEasing}>
<div id='main'>
{showNetworkNav && <NetworkNav
communities={networkCommunities}
network={network || community.network} />}
... | leftNavIsOpen={leftNavIsOpen}
path={path} | random_line_split |
mainThreadNotebookDocuments.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}));
this._documentEventListenersMapping.set(textModel.uri, disposableStore);
}
}
private _handleNotebooksRemoved(uris: URI[]): void {
for (const uri of uris) {
this._documentEventListenersMapping.get(uri)?.dispose();
this._documentEventListenersMapping.delete(uri);
}
}
async $tryCreateNotebo... | {
this._proxy.$acceptDocumentPropertiesChanged(textModel.uri, { metadata: textModel.metadata });
} | conditional_block |
mainThreadNotebookDocuments.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | if (hasDocumentMetadataChangeEvent) {
this._proxy.$acceptDocumentPropertiesChanged(textModel.uri, { metadata: textModel.metadata });
}
}));
this._documentEventListenersMapping.set(textModel.uri, disposableStore);
}
}
private _handleNotebooksRemoved(uris: URI[]): void {
for (const uri of uris)... | this._notebookEditorModelResolverService.isDirty(textModel.uri)
);
const hasDocumentMetadataChangeEvent = event.rawEvents.find(e => e.kind === NotebookCellsChangeType.ChangeDocumentMetadata); | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.