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
rawDebugSession.ts
export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSession { private serverProcess: cp.ChildProcess; private socket: net.Socket = null; private cachedInitServer: TPromise<void>; private startTime: number; private stopServerPending: boolean; public isAttach: boolean; public capablities: ...
{ this.serverProcess.kill('SIGTERM'); ret = TPromise.as(null); }
conditional_block
rawDebugSession.ts
arts/debug/node/v8Protocol'); import stdfork = require('vs/base/node/stdFork'); import { IMessageService } from 'vs/platform/message/common/message'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSession { priva...
(args: DebugProtocol.NextArguments): TPromise<DebugProtocol.NextResponse> { return this.sendAndLazyEmit('next', args); } public stepIn(args: DebugProtocol.StepInArguments): TPromise<DebugProtocol.StepInResponse> { return this.sendAndLazyEmit('stepIn', args); } public stepOut(args: DebugProtocol.StepOutArgumen...
next
identifier_name
quiz.py
import sys # this allows you to read the user input from keyboard also called "stdin" import classOne # This imports all the classOne functions import classTwo # This imports all the classTwo functions import classThree # This imports all the classThree functions import classFour # This imports all the classFour fun...
elif(usersClass == 4): classFour.classFourQuiz()
classTwo.classTwoQuiz() elif(usersClass == 3): classThree.classThreeQuiz()
random_line_split
quiz.py
import sys # this allows you to read the user input from keyboard also called "stdin" import classOne # This imports all the classOne functions import classTwo # This imports all the classTwo functions import classThree # This imports all the classThree functions import classFour # This imports all the classFour fun...
elif(usersClass == 3): classThree.classThreeQuiz() elif(usersClass == 4): classFour.classFourQuiz()
classTwo.classTwoQuiz()
conditional_block
quiz.py
import sys # this allows you to read the user input from keyboard also called "stdin" import classOne # This imports all the classOne functions import classTwo # This imports all the classTwo functions import classThree # This imports all the classThree functions import classFour # This imports all the classFour fun...
(): #main ''' This function will get the user's class. It will compare the class with MAX_CLASS and will return False if it is more than the MAX_CLASS. Class also has to be a natural number ''' print("Please tell me which Class you are in? ") try: usersClass = int(sys.stdin.readline().strip()) ...
getUsersClass
identifier_name
quiz.py
import sys # this allows you to read the user input from keyboard also called "stdin" import classOne # This imports all the classOne functions import classTwo # This imports all the classTwo functions import classThree # This imports all the classThree functions import classFour # This imports all the classFour fun...
if __name__ == '__main__': while(True) : usersClass = getUsersClass() if (usersClass != False) : break print(QUIZ_INSTRUCTIONS) sys.stdin.readline() if (usersClass == 1) : classOne.classOneQuiz() elif (usersClass == 2) : classTwo.classTwoQuiz() eli...
''' This function will get the user's class. It will compare the class with MAX_CLASS and will return False if it is more than the MAX_CLASS. Class also has to be a natural number ''' print("Please tell me which Class you are in? ") try: usersClass = int(sys.stdin.readline().strip()) if (us...
identifier_body
test_ovs_lib.py
# Copyright 2014 Mirantis 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 agre...
self.execute = self.execute_p.start() def tearDown(self): self.execute_p.stop() super(OVS_Lib_Test, self).tearDown() def test_reset_bridge(self): self.br.reset_bridge() self.execute.assert_has_calls([mock.call("ovs-vsctl", self.TO, "--", ...
self.br = ovs_lib.OVSBridge(self.BR_NAME) self.execute_p = mock.patch('manila.utils.execute')
random_line_split
test_ovs_lib.py
# Copyright 2014 Mirantis 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 agre...
(self): self.execute_p.stop() super(OVS_Lib_Test, self).tearDown() def test_reset_bridge(self): self.br.reset_bridge() self.execute.assert_has_calls([mock.call("ovs-vsctl", self.TO, "--", "--if-exists", "del-br", ...
tearDown
identifier_name
test_ovs_lib.py
# Copyright 2014 Mirantis 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 agre...
def test_delete_port(self): pname = "tap5" self.br.delete_port(pname) self.execute.assert_called_once_with("ovs-vsctl", self.TO, "--", "--if-exists", "del-port", self.BR_NAME, pname, ...
self.br.reset_bridge() self.execute.assert_has_calls([mock.call("ovs-vsctl", self.TO, "--", "--if-exists", "del-br", self.BR_NAME, run_as_root=True), ...
identifier_body
index.d.ts
// Type definitions for parity-pmd 0.4
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// <reference types="node" /> /** * Declares Parity PMD message structure * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/PMD.md */ export interface PMDMessage { ...
// Project: https://github.com/paritytrading/node-parity-pmd#readme // Definitions by: Leonard Vujanić <https://github.com/leovujanic> // Vilim Stubičan <https://github.com/jewbre>
random_line_split
mongo_perf_test.js
// http://bonesmoses.org/2016/07/15/pg-phriday-a-postgres-persepctive-on-mongodb/ use db var timing = new Array() var currentDate = new Date(); currentDate.setHours(0,0,0,0) var batch = new Array() var start = new Date() for (var i = 1; i <= 1000000; i++) { batch[i] = { _id: i, location: i % 1000, ...
// Produce the series (data frame) q = { "mongo" : output } db.dropDatabase()
random_line_split
mongo_perf_test.js
// http://bonesmoses.org/2016/07/15/pg-phriday-a-postgres-persepctive-on-mongodb/ use db var timing = new Array() var currentDate = new Date(); currentDate.setHours(0,0,0,0) var batch = new Array() var start = new Date() for (var i = 1; i <= 1000000; i++)
db.sensorLog.insert(batch) // We start at 1 to match the ID of the MySQL query performance data timing[1] = (new Date() - start) / 1000 // 13.638 start = new Date() db.sensorLog.ensureIndex( { readingDate: 1 } ) timing[2] = (new Date() - start) / 1000 // 3.013 var currentDate = new Date() currentDate.setHours(0,...
{ batch[i] = { _id: i, location: i % 1000, reading: i % 100, readingDate: new Date(currentDate - i * 10000) } }
conditional_block
assignment.ts
import { AssignmentRelatedUser } from './assignment-related-user'; import { BaseModelWithAgendaItemAndListOfSpeakers } from '../base/base-model-with-agenda-item-and-list-of-speakers'; export interface AssignmentWithoutNestedModels extends BaseModelWithAgendaItemAndListOfSpeakers<Assignment> {
title: string; description: string; open_posts: number; phase: number; // see Openslides constants default_poll_description: string; tags_id: number[]; attachments_id: number[]; number_poll_candidates: boolean; } /** * Representation of an assignment. * @ignore */ export class Assign...
id: number;
random_line_split
assignment.ts
import { AssignmentRelatedUser } from './assignment-related-user'; import { BaseModelWithAgendaItemAndListOfSpeakers } from '../base/base-model-with-agenda-item-and-list-of-speakers'; export interface AssignmentWithoutNestedModels extends BaseModelWithAgendaItemAndListOfSpeakers<Assignment> { id: number; title...
(input?: any) { super(Assignment.COLLECTIONSTRING, input); } } export interface Assignment extends AssignmentWithoutNestedModels {}
constructor
identifier_name
workloadItemResourceList.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
/** * Defines the metadata of WorkloadItemResourceList * * @returns {object} metadata of WorkloadItemResourceList * */ mapper() { return { required: false, serializedName: 'WorkloadItemResourceList', type: { name: 'Composite', className: 'WorkloadItemResourceLi...
{ super(); }
identifier_body
workloadItemResourceList.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
() { super(); } /** * Defines the metadata of WorkloadItemResourceList * * @returns {object} metadata of WorkloadItemResourceList * */ mapper() { return { required: false, serializedName: 'WorkloadItemResourceList', type: { name: 'Composite', className: 'W...
constructor
identifier_name
workloadItemResourceList.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
type: { name: 'String' } }, value: { required: false, serializedName: '', type: { name: 'Sequence', element: { required: false, serializedName: 'WorkloadItemResou...
random_line_split
build.rs
fn
() { println!("cargo:rerun-if-changed=build.rs"); #[cfg(feature = "ispc")] { if std::env::var("CARGO_FEATURE_ISPC").is_ok() { let mut cfg = ispc::Config::new(); if cfg!(windows) { cfg.debug(false); } let ispc_files = vec!["volta/mand...
main
identifier_name
build.rs
fn main()
ispc::opt::TargetISA::SSE4i32x4, ispc::opt::TargetISA::AVX1i32x8, ispc::opt::TargetISA::AVX2i32x8, ispc::opt::TargetISA::AVX512KNLi32x16, ]); cfg.compile("mandelbrot"); } } }
{ println!("cargo:rerun-if-changed=build.rs"); #[cfg(feature = "ispc")] { if std::env::var("CARGO_FEATURE_ISPC").is_ok() { let mut cfg = ispc::Config::new(); if cfg!(windows) { cfg.debug(false); } let ispc_files = vec!["volta/mandelb...
identifier_body
build.rs
fn main() { println!("cargo:rerun-if-changed=build.rs"); #[cfg(feature = "ispc")] { if std::env::var("CARGO_FEATURE_ISPC").is_ok()
cfg.compile("mandelbrot"); } } }
{ let mut cfg = ispc::Config::new(); if cfg!(windows) { cfg.debug(false); } let ispc_files = vec!["volta/mandelbrot.ispc"]; for s in &ispc_files[..] { cfg.file(*s); } cfg.target_isas(vec![ ...
conditional_block
build.rs
fn main() { println!("cargo:rerun-if-changed=build.rs"); #[cfg(feature = "ispc")] { if std::env::var("CARGO_FEATURE_ISPC").is_ok() { let mut cfg = ispc::Config::new(); if cfg!(windows) { cfg.debug(false); } let ispc_files = vec!["vol...
cfg.compile("mandelbrot"); } } }
ispc::opt::TargetISA::AVX512KNLi32x16, ]);
random_line_split
such.py
tests that depend on those fixtures. """ _helper = helper def __init__(self, description): self._group = Group('A %s' % description, 0) @contextmanager def having(self, description): """Define a new group under the current group. Fixtures and tests defined within the ...
def _makeTestCase(self, group, layer, parent_layer): attr = { 'layer': layer, 'group': group, 'description': group.description, } def _make_test_func(case): ''' Needs to be outside of the for-loop scope, so that ``case`` is prope...
layer = self._makeLayer(group, parent_layer, position) case = self._makeTestCase(group, layer, parent_layer) log.debug( "Made test case %s with layer %s from %s", case, layer, group) mod[layer.__name__] = layer layer.__module__ = mod['__name__'] name = case.__name__ ...
identifier_body
such.py
tests that depend on those fixtures. """ _helper = helper def __init__(self, description): self._group = Group('A %s' % description, 0) @contextmanager def having(self, description): """Define a new group under the current group. Fixtures and tests defined within the ...
def _makeGroupTest(self, mod, group, parent_layer=None, position=0): layer = self._makeLayer(group, parent_layer, position) case = self._makeTestCase(group, layer, parent_layer) log.debug( "Made test case %s with layer %s from %s", case, layer, group) mod[layer.__name__]...
if not currentSession: return if not currentSession.isPluginLoaded('nose2.plugins.layers'): sys.stderr.write(LAYERS_PLUGIN_NOT_LOADED_MESSAGE)
random_line_split
such.py
tests that depend on those fixtures. """ _helper = helper def __init__(self, description): self._group = Group('A %s' % description, 0) @contextmanager def having(self, description): """Define a new group under the current group. Fixtures and tests defined within the ...
attr['tearDown'] = tearDown def methodDescription(self): return getattr(self, self._testMethodName).description attr['methodDescription'] = methodDescription return type(group.description, (unittest.TestCase,), attr) def _makeLayer(self, group, parent_layer=None, ...
util.call_with_args_if_expected(func, self)
conditional_block
such.py
has_setup(self, func): """Add a :func:`setup` method to this group. The :func:`setup` method will run once, before any of the tests in the containing group. A group may define any number of :func:`setup` functions. They will execute in the order in which they are defined. ...
addTestTearDown
identifier_name
index.js
'use strict'; module.exports = TinyQueue; function TinyQueue(data, compare) { this.data = data || []; this.length = this.data.length; this.compare = compare || defaultCompare; if (data) for (var i = Math.floor(this.length / 2); i >= 0; i--) this._down(i); } function defaultCompare(a, b)
TinyQueue.prototype = { push: function (item) { this.data.push(item); this.length++; this._up(this.length - 1); }, pop: function () { var top = this.data[0]; this.data[0] = this.data[this.length - 1]; this.length--; this.data.pop(); this._d...
{ return a < b ? -1 : a > b ? 1 : 0; }
identifier_body
index.js
'use strict'; module.exports = TinyQueue; function TinyQueue(data, compare) { this.data = data || []; this.length = this.data.length; this.compare = compare || defaultCompare; if (data) for (var i = Math.floor(this.length / 2); i >= 0; i--) this._down(i); } function defaultCompare(a, b) { return...
this.length++; this._up(this.length - 1); }, pop: function () { var top = this.data[0]; this.data[0] = this.data[this.length - 1]; this.length--; this.data.pop(); this._down(0); return top; }, peek: function () { return this.data[...
TinyQueue.prototype = { push: function (item) { this.data.push(item);
random_line_split
index.js
'use strict'; module.exports = TinyQueue; function
(data, compare) { this.data = data || []; this.length = this.data.length; this.compare = compare || defaultCompare; if (data) for (var i = Math.floor(this.length / 2); i >= 0; i--) this._down(i); } function defaultCompare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } TinyQueue.prototype = { p...
TinyQueue
identifier_name
user.js
define([ 'soundcloud', 'backbone', 'c/favourites', 'constants' ], function( SC, Backbone, FavouritesCollection, c ){ return Backbone.Model.extend({ defaults: { favourites: null }, url: function() { return '/me';
initialize: function() { _.extend(this, this.options); }, fetch: function() { var def = new $.Deferred(), _this = this, favourites = []; SC.initialize(c('clientAuth')); SC.connect(function() { SC.get('/me', function(user) { _this.set(user); ...
},
random_line_split
user.js
define([ 'soundcloud', 'backbone', 'c/favourites', 'constants' ], function( SC, Backbone, FavouritesCollection, c ){ return Backbone.Model.extend({ defaults: { favourites: null }, url: function() { return '/me'; }, initialize: function() { _.extend(this, this....
// return the array of deferreds return defs; }; var promises = getFaves(_this.get('id'), _this.get('public_favorites_count')); $.when.apply($, promises).done(function() { window.localStorage.setItem('favourites', JSON.stringify(favourites)); ...
{ var d = new $.Deferred(); goGet(pageSize, i, d); defs.push(d.promise()); i += pageSize; count++; }
conditional_block
_Execution.py
'''Execution data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class Execution(object): '''Data structure to describe a trade execution. ''' def __init__(self, order_id=0, client_id=0, exec_id="", time="", acct_number="", exchange="", side="", ...
return True if ( (self.m_execId == other.m_execId) ) else False
return False
conditional_block
_Execution.py
'''Execution data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class Execution(object): '''Data structure to describe a trade execution. '''
self.m_clientId = client_id self.m_execId = exec_id self.m_time = time self.m_acctNumber = acct_number self.m_exchange = exchange self.m_side = side self.m_shares = shares self.m_price = price self.m_permId = perm_id self.m_liquidation = li...
def __init__(self, order_id=0, client_id=0, exec_id="", time="", acct_number="", exchange="", side="", shares=0, price=0.0, perm_id=0, liquidation=0, cum_qty=0, avg_price=0.0): self.m_orderId = order_id
random_line_split
_Execution.py
'''Execution data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class Execution(object):
def __eq__(self, other): if id(self) == id(other): return True if not isinstance(other, self.__class__): return False return True if ( (self.m_execId == other.m_execId) ) else False
'''Data structure to describe a trade execution. ''' def __init__(self, order_id=0, client_id=0, exec_id="", time="", acct_number="", exchange="", side="", shares=0, price=0.0, perm_id=0, liquidation=0, cum_qty=0, avg_price=0.0): self.m_orderId = order_id self.m_clientId ...
identifier_body
_Execution.py
'''Execution data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class Execution(object): '''Data structure to describe a trade execution. ''' def __init__(self, order_id=0, client_id=0, exec_id="", time="", acct_number="", exchange="", side="", ...
(self, other): if id(self) == id(other): return True if not isinstance(other, self.__class__): return False return True if ( (self.m_execId == other.m_execId) ) else False
__eq__
identifier_name
link-handler.ts
// (C) Copyright 2015 Moodle Pty Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
* @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. * @return List of params to pass to navigateToModule / navigateToModuleByInstance. */ getPageParams(url...
/** * Get the mod params necessary to open an activity. *
random_line_split
link-handler.ts
// (C) Copyright 2015 Moodle Pty Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
extends CoreContentLinksModuleIndexHandler { name = 'AddonModBookLinkHandler'; constructor(courseHelper: CoreCourseHelperProvider, protected bookProvider: AddonModBookProvider) { super(courseHelper, 'AddonModBook', 'book', 'b'); } /** * Get the mod params necessary to open an...
AddonModBookLinkHandler
identifier_name
link-handler.ts
// (C) Copyright 2015 Moodle Pty Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
/** * Check if the handler is enabled for a certain site (site + user) and a URL. * * @param siteId The site ID. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recomm...
{ return params.chapterid ? {chapterId: parseInt(params.chapterid, 10)} : undefined; }
identifier_body
buildlocal.py
# Copyright (C) 2013-2015 Red Hat, Inc. # Copyright (C) 2015 Thomas Spura # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is di...
# reload the sack self.base.fill_sack() def _get_query(self, pkg_spec): """Return a query to match a pkg_spec.""" subj = dnf.subject.Subject(pkg_spec) q = subj.get_best_query(self.base.sack) q = q.available() q = q.latest() return q def _get_que...
source_repo = self.base.repos[source_repo_id] logger.info(_('enabled %s repository'), source_repo.id) source_repo.enable()
conditional_block
buildlocal.py
# Copyright (C) 2013-2015 Red Hat, Inc. # Copyright (C) 2015 Thomas Spura # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is di...
self.parser = dnfpluginscore.ArgumentParser(self.aliases[0]) self.parser.add_argument('packages', nargs='+', help=_('packages to install')) self.parser.add_argument("--source", #action='store_true', help=_('download the src.rpm in...
aliases = ['buildlocal'] summary = _('Locally build and install package') usage = _('PACKAGE...') def __init__(self, cli): super(BuildLocalCommand, self).__init__(cli) self.opts = None self.parser = None def configure(self, args): # setup sack and populate it with enabl...
identifier_body
buildlocal.py
# Copyright (C) 2013-2015 Red Hat, Inc. # Copyright (C) 2015 Thomas Spura # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is di...
Don't disable the binary ones because they can contain SRPMs as well (this applies to COPR and to user-managed repos). The dnf sack will be reloaded. """ # enable the source repos for repo in self.base.repos.iter_enabled(): source_repo_id = '%s-source' % repo...
"""Enable source repositories for enabled binary repositories.
random_line_split
buildlocal.py
# Copyright (C) 2013-2015 Red Hat, Inc. # Copyright (C) 2015 Thomas Spura # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is di...
(self, pkg_spec): """Return a query to match a pkg_spec.""" subj = dnf.subject.Subject(pkg_spec) q = subj.get_best_query(self.base.sack) q = q.available() q = q.latest() return q def _get_query_source(self, pkg_spec): """"Return a query to match a source rpm ...
_get_query
identifier_name
PadV2.ts
/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
const resVals = util.getTypedArrayFromDType(x.dtype as NumericDataType, resultSize); if (constantValue !== 0) { resVals.fill(constantValue); } for (let i = 0; i < xSize; i++) { const coords = util.indexToLoc(i, xRank, xStrides); const outCoords = coords.map((c, i) => c + start[i]); const...
{ const {inputs, backend, attrs} = args; const {x} = inputs; const {paddings, constantValue} = attrs; assertNotComplex(x, 'pad'); const outShape = paddings.map( (p, i) => p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */); const start = paddings.map(p => p[0]); const xVals = backend.data.g...
identifier_body
PadV2.ts
/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
( args: {inputs: PadV2Inputs, backend: MathBackendCPU, attrs: PadV2Attrs}): TensorInfo { const {inputs, backend, attrs} = args; const {x} = inputs; const {paddings, constantValue} = attrs; assertNotComplex(x, 'pad'); const outShape = paddings.map( (p, i) => p[0] /* beforePad */ + x.shape[i] + ...
padV2
identifier_name
PadV2.ts
/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
const outId = backend.write(resVals, outShape, x.dtype); return {dataId: outId, shape: outShape, dtype: x.dtype}; } export const padV2Config: KernelConfig = { kernelName: PadV2, backendName: 'cpu', kernelFunc: padV2 as {} as KernelFunc };
{ const coords = util.indexToLoc(i, xRank, xStrides); const outCoords = coords.map((c, i) => c + start[i]); const outIndex = util.locToIndex(outCoords, resultRank, resultStrides); resVals[outIndex] = xVals[i]; }
conditional_block
PadV2.ts
/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
if (constantValue !== 0) { resVals.fill(constantValue); } for (let i = 0; i < xSize; i++) { const coords = util.indexToLoc(i, xRank, xStrides); const outCoords = coords.map((c, i) => c + start[i]); const outIndex = util.locToIndex(outCoords, resultRank, resultStrides); resVals[outIndex] = xV...
const resultStrides = util.computeStrides(outShape); const resVals = util.getTypedArrayFromDType(x.dtype as NumericDataType, resultSize);
random_line_split
backend-logger.ts
const winston = require('winston');
const logLevels: LogLevels<LogTypes> = { trace: 'trace', debug: 'debug', info: 'info', warn: 'warn', error: 'error', fatal: 'fatal' }; const winstonLogger = new winston.Logger({ transports: [ new (winston.transports.Console)({ colorize: 'all', timestamp: function() {...
import { LogLevels, Logger, LogTypes, logType, logSide } from '../../lib/logger';
random_line_split
parserEDNA.py
"This program will parse matrix files to convert them into objects usable by JS files" # libraries' imports for create the parser ## librairy to create the json object import json import os ## library for using regular expressions import re # opening of all files, each containing an EDNA matrix EDNAFULL=open("EDNA/ED...
#for each line, delete spaces, write the matrix name and, after, scores into the matrix for i in lines: j=i.split(" ") for k in range(len(j)): if j[0]=="#": pass if j[0]!="#": if re.match(r"[-][0-9]",j[k]) or re.match(r"[0-9]",j[k]): matrix.append(float(j[k])) #convert the Python list in JS...
lines= content.split("\n")
random_line_split
parserEDNA.py
"This program will parse matrix files to convert them into objects usable by JS files" # libraries' imports for create the parser ## librairy to create the json object import json import os ## library for using regular expressions import re # opening of all files, each containing an EDNA matrix EDNAFULL=open("EDNA/ED...
#execution of the parser for all matrices liste=[EDNAFULL,EDNAMAT,EDNASIMPLE] for i in range(len(test)): test1=test[i].split(".") parserEDNA(liste[i],test1[0]) # closing of all matrix files, writing the end of the JSON file et closing of this one EDNAFULL.close() EDNAMAT.close() EDNASIMPLE.close() mat.write("}")...
matrix=[] content= matrix1.read() lines= content.split("\n") #for each line, delete spaces, write the matrix name and, after, scores into the matrix for i in lines: j=i.split(" ") for k in range(len(j)): if j[0]=="#": pass if j[0]!="#": if re.match(r"[-][0-9]",j[k]) or re.match(r"[0-9]",j[k]): ...
identifier_body
parserEDNA.py
"This program will parse matrix files to convert them into objects usable by JS files" # libraries' imports for create the parser ## librairy to create the json object import json import os ## library for using regular expressions import re # opening of all files, each containing an EDNA matrix EDNAFULL=open("EDNA/ED...
#convert the Python list in JSON object matrix2=json.dumps(matrix) #writing in the JSON document of the matrix mat.write(name) mat.write(":") mat.write(matrix2) mat.write("\n") #execution of the parser for all matrices liste=[EDNAFULL,EDNAMAT,EDNASIMPLE] for i in range(len(test)): test1=test[i].split(".") ...
if re.match(r"[-][0-9]",j[k]) or re.match(r"[0-9]",j[k]): matrix.append(float(j[k]))
conditional_block
parserEDNA.py
"This program will parse matrix files to convert them into objects usable by JS files" # libraries' imports for create the parser ## librairy to create the json object import json import os ## library for using regular expressions import re # opening of all files, each containing an EDNA matrix EDNAFULL=open("EDNA/ED...
(matrix1,name): #reading of the matrix file, line by line matrix=[] content= matrix1.read() lines= content.split("\n") #for each line, delete spaces, write the matrix name and, after, scores into the matrix for i in lines: j=i.split(" ") for k in range(len(j)): if j[0]=="#": pass if j[0]!="#": ...
parserEDNA
identifier_name
test_gridmap0.py
# -*- coding: utf-8 -*- """Unit tests for gridmap classed""" # ---------------------------------- # Bjørn Ådlandsvik <bjorn@imr.no> # Institute of Marine Research # ---------------------------------- import sys from math import pi import unittest import numpy as np sys.path = ['..'] + sys.path # import from develop...
self.assertEqual((x0, y0), (self.xp, self.yp)) # WGS84 x1, y1 = self.map1.ll2grid(lon, lat) self.assertEqual((x1, y1), (self.xp, self.yp)) def test_north_pole_backward(self): """Longitude is not defined at the North Pole""" # Should raise an exception ...
"Test some analytic properties of the polar stereographic map""" xp, yp, dx, ylon = 418.25, 257.25, 10000.0, 58.0 map0 = gridmap.PolarStereographic(xp, yp, dx, ylon) map1 = gridmap.PolarStereographic(xp, yp, dx, ylon, ellipsoid=gridmap.WGS84) # Flytt de to første...
identifier_body
test_gridmap0.py
# -*- coding: utf-8 -*- """Unit tests for gridmap classed""" # ---------------------------------- # Bjørn Ådlandsvik <bjorn@imr.no> # Institute of Marine Research # ---------------------------------- import sys from math import pi import unittest import numpy as np sys.path = ['..'] + sys.path # import from develop...
"""Should return a scalar for scalar input""" pass def test_vector(self): """Return arrays of the same shape as the input""" def test_north_pole_forward(self): """The coordinates of the North Pole are xp, yp""" lon, lat = 17.2, 90.0 # sphere x0, y0 =...
# Flytt de to første, til test_Interface def test_scalar(self):
random_line_split
test_gridmap0.py
# -*- coding: utf-8 -*- """Unit tests for gridmap classed""" # ---------------------------------- # Bjørn Ådlandsvik <bjorn@imr.no> # Institute of Marine Research # ---------------------------------- import sys from math import pi import unittest import numpy as np sys.path = ['..'] + sys.path # import from develop...
lf): """scale = 1 at 60 deg""" lon, lat = -10.0, 60.0 # sphere x0, y0 = self.map0.ll2grid(lon, lat) scale0 = self.map0.map_scale(x0, y0) self.assertAlmostEqual(scale0, 1.0, places=15) # WGS84 x1, y1 = self.map1.ll2grid(lon, lat) scale1 = self.map1....
t_scale(se
identifier_name
test_gridmap0.py
# -*- coding: utf-8 -*- """Unit tests for gridmap classed""" # ---------------------------------- # Bjørn Ådlandsvik <bjorn@imr.no> # Institute of Marine Research # ---------------------------------- import sys from math import pi import unittest import numpy as np sys.path = ['..'] + sys.path # import from develop...
ttest.main()
conditional_block
dom.rs
} None => return None, } } } } /// An iterator over the DOM children of a node. pub struct DomChildren<N>(Option<N>); impl<N> Iterator for DomChildren<N> where N: TNode { type Item = N; fn next(&mut self) -> Option<N> { match self.0.take() {...
{ return Some(n) }
conditional_block
dom.rs
/// to know this so we can properly grab the pseudo-element style from the /// parent element. /// /// Note that we still need to compute the pseudo-elements before-hand, /// given otherwise we don't know if we need to create an element or not. /// /// Servo doesn't have to deal with this. ...
{ &self.0 }
identifier_body
dom.rs
has native /// anonymous content). fn is_native_anonymous(&self) -> bool { false } /// Returns the pseudo-element implemented by this element, if any. /// /// Gecko traverses pseudo-elements during the style traversal, and we need /// to know this so we can properly grab the pseudo-element sty...
new
identifier_name
dom.rs
descendants bit, the lazy frame construction bit, /// and the lazy frame construction descendants bit. unsafe fn clear_dirty_bits(&self) { self.unset_dirty_descendants(); } /// Returns true if this element is a visited link. /// /// Servo doesn't support visited styles yet. fn is_visited_link(...
}
random_line_split
mod.rs
use protocol_derive::{Decode, Encode}; #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 161)] pub struct CharacterCreationResultMessage<'a> { pub result: u8, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 5544)] pub struct...
<'a> { pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 164)] pub struct CharacterNameSuggestionFailureMessage<'a> { pub reason: u8, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[pr...
CharacterNameSuggestionRequestMessage
identifier_name
mod.rs
use protocol_derive::{Decode, Encode}; #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 161)] pub struct CharacterCreationResultMessage<'a> { pub result: u8, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 5544)] pub struct...
#[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 6733)] pub struct CharacterCanBeCreatedResultMessage<'a> { pub yes_you_can: bool, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 6732)] pub struct CharacterCanBeCreatedReques...
pub reason: u8, pub _phantom: std::marker::PhantomData<&'a ()>, }
random_line_split
advanced.js
import { IndexInterface } from "../../type.js"; import { regex, replace, collapse } from "../../lang.js"; import { encode as encode_balance } from "./balance.js"; export const rtl = false; export const tokenize = ""; export default { encode: encode, rtl: rtl, tokenize: tokenize } // Phonetic Normalization...
if(str.length > 1){ str = collapse(str); } if(str){ str = str.split(" "); } } } return str || []; }
random_line_split
advanced.js
import { IndexInterface } from "../../type.js"; import { regex, replace, collapse } from "../../lang.js"; import { encode as encode_balance } from "./balance.js"; export const rtl = false; export const tokenize = ""; export default { encode: encode, rtl: rtl, tokenize: tokenize } // Phonetic Normalization...
} } return str || []; }
{ str = encode_balance.call(this, str).join(" "); if(str.length > 2){ str = replace(str, pairs); } if(!_skip_postprocessing){ if(str.length > 1){ str = collapse(str); } if(str){ str = str.split(" "); ...
conditional_block
advanced.js
import { IndexInterface } from "../../type.js"; import { regex, replace, collapse } from "../../lang.js"; import { encode as encode_balance } from "./balance.js"; export const rtl = false; export const tokenize = ""; export default { encode: encode, rtl: rtl, tokenize: tokenize } // Phonetic Normalization...
(str, _skip_postprocessing){ if(str){ str = encode_balance.call(this, str).join(" "); if(str.length > 2){ str = replace(str, pairs); } if(!_skip_postprocessing){ if(str.length > 1){ str = collapse(str); } if(str)...
encode
identifier_name
advanced.js
import { IndexInterface } from "../../type.js"; import { regex, replace, collapse } from "../../lang.js"; import { encode as encode_balance } from "./balance.js"; export const rtl = false; export const tokenize = ""; export default { encode: encode, rtl: rtl, tokenize: tokenize } // Phonetic Normalization...
str = str.split(" "); } } } return str || []; }
{ if(str){ str = encode_balance.call(this, str).join(" "); if(str.length > 2){ str = replace(str, pairs); } if(!_skip_postprocessing){ if(str.length > 1){ str = collapse(str); } if(str){
identifier_body
quickopen.py
# -*- coding: utf-8 -*- """ :copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ # stdlib import os.path # gtk import gtk, gobject # PIDA Imports # core from kiwi.ui.objectlist import Column from pida.core.service import Service from pida.core.features impor...
path = os.path.join(project.source_directory, item.relpath) if item.is_dir: self.boss.cmd('filemanager', 'browse', new_path=path) self.boss.cmd('filemanager', 'present_view') else: self.boss.cmd('buffer', 'open_file', file_name=path) # Required Service attri...
return
conditional_block
quickopen.py
# -*- coding: utf-8 -*- """ :copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ # stdlib import os.path # gtk import gtk, gobject # PIDA Imports # core from kiwi.ui.objectlist import Column from pida.core.service import Service from pida.core.features impor...
locale = Locale('') _ = locale.gettext class QItem(object): name = '' path = '' class QOpenView(PidaView): key = 'qopen.view' gladefile = 'qopen' label_text = _('Quick Open') def create_ui(self): self._history = gtk.ListStore(gobject.TYPE_STRING) self.filter.set_model(self._h...
# locale from pida.core.locale import Locale
random_line_split
quickopen.py
# -*- coding: utf-8 -*- """ :copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ # stdlib import os.path # gtk import gtk, gobject # PIDA Imports # core from kiwi.ui.objectlist import Column from pida.core.service import Service from pida.core.features impor...
def on_filter_activate(self, *args): if len(self.olist): self.svc.open(self.olist[0]) def on_filter_changed(self, *args): self.last_entered = time.time() gobject.timeout_add(self.svc.opt('start_delay'), self.set_filter, self.filter.child.props....
if event.keyval == gtk.keysyms.Tab and len(self.olist): gcall(self.olist.grab_focus) if event.keyval == gtk.keysyms.Escape and self.pane.get_params().detached: self.can_be_closed()
identifier_body
quickopen.py
# -*- coding: utf-8 -*- """ :copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ # stdlib import os.path # gtk import gtk, gobject # PIDA Imports # core from kiwi.ui.objectlist import Column from pida.core.service import Service from pida.core.features impor...
(self, *args): if len(self.olist): self.svc.open(self.olist[0]) def on_filter_changed(self, *args): self.last_entered = time.time() gobject.timeout_add(self.svc.opt('start_delay'), self.set_filter, self.filter.child.props.text, ...
on_filter_activate
identifier_name
gulp-series.js
// gulp-series var gulp = require("gulp"); module.exports = new function() { var self = this; this.tasks = {}; function getSeriesTaskName(index, seriesOrName) { return index+"."+(Array.isArray(seriesOrName) ? seriesOrName[index] : seriesOrName); } function runSeriesTask(series)
return gulp.start(getSeriesTaskName(series.length - 1, series)); }; } this.registerTasks = function(tasks) { for(var n in tasks) { if(!tasks.hasOwnProperty(n)) continue; gulp.task(n, tasks[n]); } self.tasks = tasks; }; this.registerSeries = function(name, series) { gulp.task(name, runSeriesT...
{ var tasks = self.tasks; series.forEach(function(t) { if(!tasks.hasOwnProperty(t)) throw "task " + t + " is not registered"; }); return function() { if(!series.length) throw "no series provided"; series.forEach(function(t, i) { if(i === 0) gulp.task(getSeriesTaskName(i, t), tasks[...
identifier_body
gulp-series.js
// gulp-series var gulp = require("gulp"); module.exports = new function() { var self = this; this.tasks = {}; function getSeriesTaskName(index, seriesOrName) { return index+"."+(Array.isArray(seriesOrName) ? seriesOrName[index] : seriesOrName); } function runSeriesTask(series) { var tasks = self.tasks; s...
this.registerTasks = function(tasks) { for(var n in tasks) { if(!tasks.hasOwnProperty(n)) continue; gulp.task(n, tasks[n]); } self.tasks = tasks; }; this.registerSeries = function(name, series) { gulp.task(name, runSeriesTask(series)); }; };
}; }
random_line_split
gulp-series.js
// gulp-series var gulp = require("gulp"); module.exports = new function() { var self = this; this.tasks = {}; function
(index, seriesOrName) { return index+"."+(Array.isArray(seriesOrName) ? seriesOrName[index] : seriesOrName); } function runSeriesTask(series) { var tasks = self.tasks; series.forEach(function(t) { if(!tasks.hasOwnProperty(t)) throw "task " + t + " is not registered"; }); return function() { if...
getSeriesTaskName
identifier_name
ProductPropertyInput.js
/** * @flow * @module ProductPropertyInput * @extends React.PureComponent * * @author Oleg Nosov <olegnosov1@gmail.com> * @license MIT * * @description * React form for product property(options select only). * */ import React, { PureComponent } from "react"; import { isObject } from "../../../helpers"; imp...
, get localizedCurrency() { return getLocalization(currency, localizationScope); }, }; return ( <div className="form-group row"> <label htmlFor={name} className="col-xs-3 col-sm-3 col-md-3 col-lg-3 col-form-label" > {getLocalization("prope...
{ return getLocalization(name, localizationScope); }
identifier_body
ProductPropertyInput.js
/** * @flow * @module ProductPropertyInput * @extends React.PureComponent * * @author Oleg Nosov <olegnosov1@gmail.com> * @license MIT * * @description * React form for product property(options select only). * */ import React, { PureComponent } from "react"; import { isObject } from "../../../helpers"; imp...
() { return getLocalization(name, localizationScope); }, get localizedCurrency() { return getLocalization(currency, localizationScope); }, }; return ( <div className="form-group row"> <label htmlFor={name} className="col-xs-3 col-sm-3 col-md-3...
localizedName
identifier_name
ProductPropertyInput.js
/** * @flow * @module ProductPropertyInput * @extends React.PureComponent * * @author Oleg Nosov <olegnosov1@gmail.com> * @license MIT * * @description * React form for product property(options select only). * */ import React, { PureComponent } from "react"; import { isObject } from "../../../helpers"; imp...
additionalCost?: Prices, value: ProductPropertyOption, |}; /** @ */ export type PropertyOption = ProductPropertyOption | OptionObject; /** @ */ export type PropertyOptions = Array<PropertyOption>; /** @ */ export type OnChange = (obj: { value: OptionIndex }) => void; export type Props = {| name: string, opt...
onSelect?: (option: OptionObject) => void,
random_line_split
hl_prometheus.py
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security # 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 # #...
items_itr = prom_data._by_id.items() # pylint: disable=protected-access for id_index, all_metrics in items_itr: acc_ts = [] for elt in all_metrics: metric_name = elt['metric']['__name__'] index, data = zip(*elt['values']) index = [convert_timestamp_to_posix(z...
result = {}
random_line_split
hl_prometheus.py
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security # 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 # #...
(prom_data: PrometheusData) -> Dict[str, pandas.DataFrame]: """Build a dict of dataframe. Each dataframe contains the values matching the corresponding id""" # noqa TODO: find the longest metrics and use it as the index. Interpolate the # othe...
build_sonata_df_by_id
identifier_name
hl_prometheus.py
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security # 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 # #...
dataframe = dataframe.interpolate(method='index') # import pdb; pdb.set_trace() result[id_index] = dataframe return result
"""Build a dict of dataframe. Each dataframe contains the values matching the corresponding id""" # noqa TODO: find the longest metrics and use it as the index. Interpolate the # other metric against it before the merge result = {} items_itr = prom_data._by_id.items() # pylint: disable=protected-ac...
identifier_body
hl_prometheus.py
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security # 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 # #...
dataframe = pandas.concat(acc_ts, join='outer', axis=1) dataframe.index = pandas.date_range( start=dataframe.index[0], periods=len(dataframe.index), freq='S') dataframe = dataframe.interpolate(method='index') # import pdb; pdb.set_trace() resu...
metric_name = elt['metric']['__name__'] index, data = zip(*elt['values']) index = [convert_timestamp_to_posix(z) for z in index] this_serie = pandas.Series(data, index=index) this_serie.name = metric_name acc_ts.append(this_serie)
conditional_block
archive.py
import os import logging import boto3 import mimetypes from datetime import datetime from morphium.util import env, TAG_LATEST log = logging.getLogger(__name__) config = {} class
(object): """A scraper archive on S3. This is called when a scraper has generated a file which needs to be backed up to a bucket.""" def __init__(self, bucket=None, prefix=None): self.tag = datetime.utcnow().date().isoformat() self.bucket = bucket or env('aws_bucket') self.prefix = ...
Archive
identifier_name
archive.py
import os import logging import boto3 import mimetypes from datetime import datetime from morphium.util import env, TAG_LATEST log = logging.getLogger(__name__) config = {} class Archive(object): """A scraper archive on S3. This is called when a scraper has generated a file which needs to be backed up to a ...
if file_name is None: file_name = os.path.basename(source_path) if mime_type is None: mime_type, _ = mimetypes.guess_type(file_name) mime_type = mime_type or 'application/octet-stream' key_name = os.path.join(self.prefix, self.tag, file_name) log.i...
return
conditional_block
archive.py
import os import logging import boto3 import mimetypes from datetime import datetime from morphium.util import env, TAG_LATEST log = logging.getLogger(__name__) config = {} class Archive(object): """A scraper archive on S3. This is called when a scraper has generated a file which needs to be backed up to a ...
def upload_file(self, source_path, file_name=None, mime_type=None): """Upload a file to the given bucket.""" if self.client is None: return if file_name is None: file_name = os.path.basename(source_path) if mime_type is None: mime_type, _ = mim...
if not hasattr(self, '_client'): if self.bucket is None: log.warning("No $AWS_BUCKET, skipping upload.") self._client = None return None access_key = env('aws_access_key_id') if access_key is None: log.warning("No $AWS_A...
identifier_body
archive.py
import os import logging import boto3 import mimetypes from datetime import datetime from morphium.util import env, TAG_LATEST log = logging.getLogger(__name__) config = {} class Archive(object): """A scraper archive on S3. This is called when a scraper has generated a file which needs to be backed up to a ...
log.warning("No $AWS_BUCKET, skipping upload.") self._client = None return None access_key = env('aws_access_key_id') if access_key is None: log.warning("No $AWS_ACCESS_KEY_ID, skipping upload.") self._client = None ...
if self.bucket is None:
random_line_split
ia_configure.py
# -*- coding: utf-8 -*- # # The internetarchive module is a Python/CLI interface to Archive.org. # # Copyright (C) 2012-2016 Internet Archive # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundat...
args = docopt(__doc__, argv=argv) try: if args['--username'] and args['--password']: config_file_path = configure(args['--username'], args['--password'], session.config_file) print('Config saved to: {0}...
identifier_body
ia_configure.py
# -*- coding: utf-8 -*- # # The internetarchive module is a Python/CLI interface to Archive.org. # # Copyright (C) 2012-2016 Internet Archive # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundat...
(argv, session): args = docopt(__doc__, argv=argv) try: if args['--username'] and args['--password']: config_file_path = configure(args['--username'], args['--password'], session.config_file) print(...
main
identifier_name
ia_configure.py
# -*- coding: utf-8 -*- # # The internetarchive module is a Python/CLI interface to Archive.org. # # Copyright (C) 2012-2016 Internet Archive # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundat...
sys.exit(1)
print('\nerror: {0}'.format(str(exc)))
conditional_block
ia_configure.py
# -*- coding: utf-8 -*- # # The internetarchive module is a Python/CLI interface to Archive.org. # # Copyright (C) 2012-2016 Internet Archive # # This program is free software: you can redistribute it and/or modify
# published by the Free Software Foundation, either version 3 of the # License, or (at 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 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GN...
# it under the terms of the GNU Affero General Public License as
random_line_split
dep-graph-struct-signature.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn main() { } #[rustc_if_this_changed] struct WillChange { x: u32, y: u32 } struct WontChange { x: u32, y: u32 } // these are valid dependencies mod signatures { use WillChange; #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path #[rustc_then_this_would_need(AssociatedItems)] //...
#![allow(dead_code)] #![allow(unused_variables)]
random_line_split
dep-graph-struct-signature.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} struct WillChanges { #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK x: WillChange, #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK y: WillChange } // The fields change, not the type itself. #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no pat...
{ }
identifier_body
dep-graph-struct-signature.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ x: u32, y: u32 } struct WontChange { x: u32, y: u32 } // these are valid dependencies mod signatures { use WillChange; #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path #[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path #[rustc_then_this_would_need(TraitDefO...
WillChange
identifier_name
js_xQakYN1JdEe2CVqj3lwGPtFTa7lWeqakpJ85uyNlf0c.js
tags, these will go to the target of the anchor rather // than the usual location. if ($(this).attr('href')) { element_settings.url = $(this).attr('href'); element_settings.event = 'click'; } var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, el...
// Do not perform another ajax command if one is already in progress. if (ajax.ajaxing) { return false; } try { if (ajax.form) { // If setClick is set, we must set this to ensure that the button's // value is passed. if (ajax.setClick) { // Mark the clicked button. 'form.clk' ...
var ajax = this;
random_line_split
js_xQakYN1JdEe2CVqj3lwGPtFTa7lWeqakpJ85uyNlf0c.js
, these will go to the target of the anchor rather // than the usual location. if ($(this).attr('href')) { element_settings.url = $(this).attr('href'); element_settings.event = 'click'; } var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element...
}; /** * Handle a key press. * * The AJAX object will, if instructed, bind to a key press response. This * will test to see if the key press is valid to trigger this event and * if it is, trigger it for us and prevent other keypresses from triggering. */ Drupal.ajax.prototype.keypressResponse = function (elemen...
{ $(element_settings.element).keypress(function (event) { return ajax.keypressResponse(this, event); }); }
conditional_block
scrapeMps.js
/* eslint-disable */ // not run locally - here for reference function pageFunction(context) { // called on every page the crawler visits, use it to extract data from it var $ = context.jQuery; var result = { constituency: $('#commons-constituency').text(), fullName: $('#commons-biography-header h1')....
result[type] = link; }); return result; }
random_line_split
scrapeMps.js
/* eslint-disable */ // not run locally - here for reference function pageFunction(context)
return result; }
{ // called on every page the crawler visits, use it to extract data from it var $ = context.jQuery; var result = { constituency: $('#commons-constituency').text(), fullName: $('#commons-biography-header h1').text(), party: $('#commons-party').text(), email: $('#ctl00_ctl00_FormContent_Sit...
identifier_body
scrapeMps.js
/* eslint-disable */ // not run locally - here for reference function
(context) { // called on every page the crawler visits, use it to extract data from it var $ = context.jQuery; var result = { constituency: $('#commons-constituency').text(), fullName: $('#commons-biography-header h1').text(), party: $('#commons-party').text(), email: $('#ctl00_ctl00_FormC...
pageFunction
identifier_name
helperFunctions.ts
import { eventNames } from './constants'; import { AllEvents, DefaultEvents, EventGroups } from './eventGroups'; import { MediaEvent, SnowplowEvent } from './mediaEvents'; import { EventGroup, MediaTrackingOptions, TextTrack, TrackingOptions } from './types'; export function timeRangesToObjectArray(t: TimeRanges): { s...
(id: string, trackingOptions?: MediaTrackingOptions): TrackingOptions { const defaults: TrackingOptions = { id: id, captureEvents: DefaultEvents, progress: { boundaries: [10, 25, 50, 75], boundaryTimeoutIds: [], }, volume: { trackingInterval: 250, }, }; if (!trackingOpti...
trackingOptionsParser
identifier_name
helperFunctions.ts
import { eventNames } from './constants'; import { AllEvents, DefaultEvents, EventGroups } from './eventGroups'; import { MediaEvent, SnowplowEvent } from './mediaEvents'; import { EventGroup, MediaTrackingOptions, TextTrack, TrackingOptions } from './types'; export function timeRangesToObjectArray(t: TimeRanges): { s...
}); } export function isType(e: string, _type: Record<string, string>): boolean { return ( Object.keys(_type) .map((k: string) => _type[k]) .indexOf(e) !== -1 ); } export function isElementFullScreen(id: string): boolean { return document.fullscreenElement?.id === id || false; } export functi...
kind: textTrackList[i].kind, mode: textTrackList[i].mode, };
random_line_split
helperFunctions.ts
import { eventNames } from './constants'; import { AllEvents, DefaultEvents, EventGroups } from './eventGroups'; import { MediaEvent, SnowplowEvent } from './mediaEvents'; import { EventGroup, MediaTrackingOptions, TextTrack, TrackingOptions } from './types'; export function timeRangesToObjectArray(t: TimeRanges): { s...
else if (!Object.keys(AllEvents).filter((k) => k === ev)) { console.warn(`'${ev}' is not a valid event.`); } else { parsedEvents.push(ev in eventNames ? eventNames[ev] : ev); } }); trackingOptions.captureEvents = parsedEvents; if (trackingOptions.captureEvents.indexOf(SnowplowE...
{ parsedEvents = parsedEvents.concat(EventGroups[ev]); }
conditional_block
helperFunctions.ts
import { eventNames } from './constants'; import { AllEvents, DefaultEvents, EventGroups } from './eventGroups'; import { MediaEvent, SnowplowEvent } from './mediaEvents'; import { EventGroup, MediaTrackingOptions, TextTrack, TrackingOptions } from './types'; export function timeRangesToObjectArray(t: TimeRanges): { s...
export function isElementFullScreen(id: string): boolean { return document.fullscreenElement?.id === id || false; } export function boundaryErrorHandling(boundaries: number[]): number[] { // Remove any elements that are out of bounds if (boundaries.some((b) => b < 1 || 100 < b)) { boundaries = boundaries.f...
{ return ( Object.keys(_type) .map((k: string) => _type[k]) .indexOf(e) !== -1 ); }
identifier_body
__init__.py
# (C) 2012-2015 by Daniel Nyga # # 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, merge, publish, # distrib...
# the following conditions: # # 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, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FIT...
# permit persons to whom the Software is furnished to do so, subject to
random_line_split
auth.service.ts
import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { Moment } from 'moment/moment'; import * as moment from 'moment/moment'; import * as jwtDecode from 'jwt-decode'; import { DataService } from './data.service'; import { Credentia...
} }
// get auth JWT from local storage const jwt = localStorage.getItem('jwtComplex'); return jwt ? `Bearer ${jwt}` : '';
random_line_split