file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
account_setup.py
# -*- coding: utf-8 -*- ############################################################################## # # Post-installation configuration helpers # Copyright (C) 2015 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General P...
if code_digits: data.update({'code_digits': code_digits}) conf_id = chart_wizard.create(cr, uid, data, context=context) chart_wizard.execute(cr, uid, [conf_id], context=context) def create_fiscal_year(cr, registry, uid, company_id, name, code, start_date, end_date, context=None): fy_model = re...
onchange = chart_wizard.onchange_chart_template_id(cr, uid, [], data['chart_template_id'], context=context) data.update(onchange['value'])
random_line_split
account_setup.py
# -*- coding: utf-8 -*- ############################################################################## # # Post-installation configuration helpers # Copyright (C) 2015 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General P...
(cr, registry, uid, company_id, name, code, start_date, end_date, context=None): fy_model = registry['account.fiscalyear'] fy_data = fy_model.default_get(cr, uid, ['state', 'company_id'], context=context).copy() fy_data.update({ 'company_id': company_id, 'name': name, 'code': code, ...
create_fiscal_year
identifier_name
account_setup.py
# -*- coding: utf-8 -*- ############################################################################## # # Post-installation configuration helpers # Copyright (C) 2015 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General P...
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
fy_model = registry['account.fiscalyear'] fy_data = fy_model.default_get(cr, uid, ['state', 'company_id'], context=context).copy() fy_data.update({ 'company_id': company_id, 'name': name, 'code': code, 'date_start': start_date, 'date_stop': end_date, }) fy_id = fy...
identifier_body
dimensions.js
/** * Copyright 2020 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
// Move outwards, since the closer indicies are more likely to overlap. for (let i = 1; i <= children.length / 2; i++) { const nextIndex = mod(startIndex + i, children.length); const prevIndex = mod(startIndex - i, children.length); if (overlaps(axis, children[nextIndex], pos)) { return nextInd...
{ return startIndex; }
conditional_block
dimensions.js
/** * Copyright 2020 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
} /** * Finds the index of a child that overlaps a point within the parent, * determined by an axis and alignment. A startIndex is used to look at the * children that are more likely to overlap first. * @param {!Axis} axis The axis to look along. * @param {!Alignment} alignment The alignment to look for within th...
) { const elPos = getPosition(axis, alignment, el); const containerPos = getPosition(axis, alignment, container); const {length: elLength} = getDimension(axis, el); return (elPos - containerPos) / elLength;
random_line_split
dimensions.js
/** * Copyright 2020 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
/** * Finds the index of a child that overlaps a point within the parent, * determined by an axis and alignment. A startIndex is used to look at the * children that are more likely to overlap first. * @param {!Axis} axis The axis to look along. * @param {!Alignment} alignment The alignment to look for within the...
{ const elPos = getPosition(axis, alignment, el); const containerPos = getPosition(axis, alignment, container); const {length: elLength} = getDimension(axis, el); return (elPos - containerPos) / elLength; }
identifier_body
dimensions.js
/** * Copyright 2020 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
(axis, alignment, el) { return alignment == Alignment.START ? getStart(axis, el) : getCenter(axis, el); } /** * @param {!Axis} axis The axis to check for overlap. * @param {!Element} el The Element to check for overlap. * @param {number} position A position to check. * @return {boolean} If the element ov...
getPosition
identifier_name
webauthn.js
/*! * Copyright (c) 2015-2016, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by ...
return Object.freeze({ credential: {id: cred.id}, publicKey: JSON.parse(cred.publicKey), attestation: cred.attestation }); }); return adaptToOkta(promise); } function getAssertion(challenge, allowList) { var accept = allowList.map(function (item) { return {typ...
var promise = window.msCredentials.makeCredential(accountInfo, cryptoParams, challenge) .then(function (cred) {
random_line_split
webauthn.js
/*! * Copyright (c) 2015-2016, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by ...
(challenge, allowList) { var accept = allowList.map(function (item) { return {type: 'FIDO_2_0', id: item.id}; }); var filters = {accept: accept}; var promise = window.msCredentials.getAssertion(challenge, filters) .then(function (attestation) { var signature = attestation.signature; ...
getAssertion
identifier_name
webauthn.js
/*! * Copyright (c) 2015-2016, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by ...
function makeCredential(accountInfo, cryptoParams, challenge) { cryptoParams = cryptoParams.map(function (param) { return {type: 'FIDO_2_0', algorithm: param.algorithm}; }); var promise = window.msCredentials.makeCredential(accountInfo, cryptoParams, challenge) .then(function (cred) { r...
{ return new Q(promise); }
identifier_body
test_views_item_delete.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Delete record tests.""" from __future__ import absolute_import, print_function f...
# Force an SQLAlchemy error that will rollback the transaction. with patch.object(PersistentIdentifier, 'delete', side_effect=raise_error): res = client.delete(record_url(pid)) assert res.status_code == 500 with app.test_client() as client: ...
with app.test_client() as client: def raise_error(): raise SQLAlchemyError()
random_line_split
test_views_item_delete.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Delete record tests.""" from __future__ import absolute_import, print_function f...
(app, indexed_records): """Test INVALID record delete request (DELETE .../records/<record_id>).""" with app.test_client() as client: # Check that GET with non existing id will return 404 res = client.delete(url_for( 'invenio_records_rest.recid_item', pid_value=0)) assert res....
test_delete_notfound
identifier_name
test_views_item_delete.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Delete record tests.""" from __future__ import absolute_import, print_function f...
# Force an SQLAlchemy error that will rollback the transaction. with patch.object(PersistentIdentifier, 'delete', side_effect=raise_error): res = client.delete(record_url(pid)) assert res.status_code == 500 with app.test_client() as client: ...
raise SQLAlchemyError()
identifier_body
test_views_item_delete.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Delete record tests.""" from __future__ import absolute_import, print_function f...
def test_delete_deleted(app, indexed_records): """Test deleting a perviously deleted record.""" pid, record = indexed_records[0] with app.test_client() as client: res = client.delete(record_url(pid)) assert res.status_code == 204 res = client.delete(record_url(pid)) asse...
pid, record = indexed_records[i] with app.test_client() as client: res = client.delete(record_url(pid), headers=headers) assert res.status_code == 204 res = client.get(record_url(pid)) assert res.status_code == 410
conditional_block
barChart.js
import barChart from 'britecharts/dist/umd/bar.min'; import {select} from 'd3-selection'; import {validateConfiguration, validateContainer, validateData} from '../helpers/validation'; import {applyConfiguration} from '../helpers/configuration'; import { bar as barLoadingState } from 'britecharts/dist/umd/loading.min';...
validateContainer(container); validateConfiguration(chart, configuration); // Calls the chart with the container and dataset container.datum(data).call(applyConfiguration(chart, configuration)); return chart; }; bar.update = (el, data, configuration = {}, chart) => { let container = select(el)...
bar.create = (el, data, configuration = {}) => { let container = select(el); let chart = barChart(); validateData(data);
random_line_split
barChart.js
import barChart from 'britecharts/dist/umd/bar.min'; import {select} from 'd3-selection'; import {validateConfiguration, validateContainer, validateData} from '../helpers/validation'; import {applyConfiguration} from '../helpers/configuration'; import { bar as barLoadingState } from 'britecharts/dist/umd/loading.min';...
else { container.call(chart); } return chart; }; bar.destroy = () => {}; bar.loading = () => barLoadingState; export default bar;
{ container.datum(data).call(chart); }
conditional_block
event.py
""" sentry.models.event ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import logging from django.db import models from django.utils import timezone from django.utils.datastructures import SortedDict from django.utils.tr...
def as_dict(self): # We use a SortedDict to keep elements ordered for a potential JSON serializer data = SortedDict() data['id'] = self.event_id data['checksum'] = self.checksum data['project'] = self.project.slug data['logger'] = self.logger data['level'] =...
try: return [ (t, v) for t, v in self.data.get('tags') or () if not t.startswith('sentry:') ] except ValueError: # at one point Sentry allowed invalid tag sets such as (foo, bar) # vs ((tag, foo), (tag, bar)) return []
identifier_body
event.py
""" sentry.models.event ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import logging from django.db import models from django.utils import timezone from django.utils.datastructures import SortedDict from django.utils.tr...
(self): # We use a SortedDict to keep elements ordered for a potential JSON serializer data = SortedDict() data['id'] = self.event_id data['checksum'] = self.checksum data['project'] = self.project.slug data['logger'] = self.logger data['level'] = self.get_level_d...
as_dict
identifier_name
event.py
""" sentry.models.event ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import logging
from sentry.constants import LOG_LEVELS, MAX_CULPRIT_LENGTH from sentry.db.models import ( Model, NodeField, BoundedIntegerField, BoundedPositiveIntegerField, BaseManager, sane_repr ) from sentry.utils.cache import memoize from sentry.utils.imports import import_string from sentry.utils.safe import safe_execute...
from django.db import models from django.utils import timezone from django.utils.datastructures import SortedDict from django.utils.translation import ugettext_lazy as _
random_line_split
event.py
""" sentry.models.event ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import logging from django.db import models from django.utils import timezone from django.utils.datastructures import SortedDict from django.utils.tr...
result.append((key, value)) return SortedDict((k, v) for k, v in sorted(result, key=lambda x: x[1].get_score(), reverse=True)) def get_version(self): if not self.data: return if '__sentry__' not in self.data: return if 'version' not in self.dat...
continue
conditional_block
thisInLambda.js
//// [thisInLambda.ts] class Foo { x = "hello"; bar() { this.x; // 'this' is type 'Foo' var f = () => this.x; // 'this' should be type 'Foo' as well } } function myFn(a:any) { } class myCls { constructor () { myFn(() => { myFn(() => { var x = this;
//// [thisInLambda.js] var Foo = /** @class */ (function () { function Foo() { this.x = "hello"; } Foo.prototype.bar = function () { var _this = this; this.x; // 'this' is type 'Foo' var f = function () { return _this.x; }; // 'this' should be type 'Foo' as well ...
}); }); } }
random_line_split
thisInLambda.js
//// [thisInLambda.ts] class Foo { x = "hello"; bar() { this.x; // 'this' is type 'Foo' var f = () => this.x; // 'this' should be type 'Foo' as well } } function myFn(a:any) { } class
{ constructor () { myFn(() => { myFn(() => { var x = this; }); }); } } //// [thisInLambda.js] var Foo = /** @class */ (function () { function Foo() { this.x = "hello"; } Foo.prototype.bar = function () { var _this = th...
myCls
identifier_name
shareDialog.js
const html = require('choo/html'); module.exports = function(name, url) { const dialog = function(state, emit, close) { return html` <send-share-dialog class="flex flex-col items-center text-center p-4 max-w-sm m-auto" > <h1 class="text-3xl font-bold my-4"> ${state.translate...
console.error(e); } close(); } }; dialog.type = 'share'; return dialog; };
{ return; }
conditional_block
shareDialog.js
const html = require('choo/html'); module.exports = function(name, url) { const dialog = function(state, emit, close) { return html` <send-share-dialog class="flex flex-col items-center text-center p-4 max-w-sm m-auto" > <h1 class="text-3xl font-bold my-4"> ${state.translate...
}; dialog.type = 'share'; return dialog; };
{ event.stopPropagation(); try { await navigator.share({ title: state.translate('-send-brand'), text: state.translate('shareMessage', { name }), url }); } catch (e) { if (e.code === e.ABORT_ERR) { return; } console.error(e...
identifier_body
shareDialog.js
const html = require('choo/html'); module.exports = function(name, url) { const dialog = function(state, emit, close) { return html` <send-share-dialog class="flex flex-col items-center text-center p-4 max-w-sm m-auto" > <h1 class="text-3xl font-bold my-4"> ${state.translate...
try { await navigator.share({ title: state.translate('-send-brand'), text: state.translate('shareMessage', { name }), url }); } catch (e) { if (e.code === e.ABORT_ERR) { return; } console.error(e); } close(); } ...
async function share(event) { event.stopPropagation();
random_line_split
shareDialog.js
const html = require('choo/html'); module.exports = function(name, url) { const dialog = function(state, emit, close) { return html` <send-share-dialog class="flex flex-col items-center text-center p-4 max-w-sm m-auto" > <h1 class="text-3xl font-bold my-4"> ${state.translate...
(event) { event.stopPropagation(); try { await navigator.share({ title: state.translate('-send-brand'), text: state.translate('shareMessage', { name }), url }); } catch (e) { if (e.code === e.ABORT_ERR) { return; } console...
share
identifier_name
callsMainLast.ts
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
, }; }, };
{ if (!hasSnippets(node)) { return; } const source = context.getSourceCode().text.trim(); if (source.endsWith('main();')) { // only attemp to to autofix `main()` to // `main(...process.arv.slice(2))` - otherwise it's unclear what // the user was tr...
identifier_body
callsMainLast.ts
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
else if (!source.endsWith(block)) { context.report({ node, messageId: noCallMainMessageId, }); } }, }; }, };
{ // only attemp to to autofix `main()` to // `main(...process.arv.slice(2))` - otherwise it's unclear what // the user was trying to do const mainNode = node.body[node.body.length - 1]; context.report({ node: mainNode, messageId: mainPassesNoArg...
conditional_block
callsMainLast.ts
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
node, messageId: noCallMainMessageId, }); } }, }; }, };
fix: fixer => fixer.replaceText(mainNode, block), }); } else if (!source.endsWith(block)) { context.report({
random_line_split
callsMainLast.ts
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
(node) { if (!hasSnippets(node)) { return; } const source = context.getSourceCode().text.trim(); if (source.endsWith('main();')) { // only attemp to to autofix `main()` to // `main(...process.arv.slice(2))` - otherwise it's unclear what // the user...
Program
identifier_name
App.tsx
import * as React from 'react'; import { FormColor } from './FormColor'; interface State { color: string; } export class App extends React.Component<{}, State> { constructor(props) { super(props); this.state = { color: '', }; this.onSubmit = this.onSubmit.bind(this); } render() { r...
shouldComponentUpdate(nextProps, nextState: State) { // Do not trigger render if colors are the same return this.state.color !== nextState.color; } }
onSubmit(color: string) { alert(`The sent color '${color}' was stored in <App /> model.`); this.setState({ color }); }
random_line_split
App.tsx
import * as React from 'react'; import { FormColor } from './FormColor'; interface State { color: string; } export class App extends React.Component<{}, State> { constructor(props) { super(props); this.state = { color: '', }; this.onSubmit = this.onSubmit.bind(this); } render()
onSubmit(color: string) { alert(`The sent color '${color}' was stored in <App /> model.`); this.setState({ color }); } shouldComponentUpdate(nextProps, nextState: State) { // Do not trigger render if colors are the same return this.state.color !== nextState.color; } }
{ return ( <main className="container"> <header> <h2 className="col-sm-6 col-sm-offset-1">React component lifecycle methods</h2> </header> <FormColor onSubmit={this.onSubmit} /> </main > ); }
identifier_body
App.tsx
import * as React from 'react'; import { FormColor } from './FormColor'; interface State { color: string; } export class App extends React.Component<{}, State> { constructor(props) { super(props); this.state = { color: '', }; this.onSubmit = this.onSubmit.bind(this); } render() { r...
(color: string) { alert(`The sent color '${color}' was stored in <App /> model.`); this.setState({ color }); } shouldComponentUpdate(nextProps, nextState: State) { // Do not trigger render if colors are the same return this.state.color !== nextState.color; } }
onSubmit
identifier_name
config_flow.py
"""Config flow to configure the OVO Energy integration.""" import aiohttp from ovoenergy.ovoenergy import OVOEnergy import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigFlow from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from .const import DOMA...
"""Handle configuration by re-auth.""" errors = {} if user_input and user_input.get(CONF_USERNAME): self.username = user_input[CONF_USERNAME] self.context["title_placeholders"] = {CONF_USERNAME: self.username} if user_input is not None and user_input.get(CONF_PASSWORD) is ...
identifier_body
config_flow.py
"""Config flow to configure the OVO Energy integration.""" import aiohttp from ovoenergy.ovoenergy import OVOEnergy import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigFlow from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from .const import DOMA...
errors["base"] = "authorization_error" return self.async_show_form( step_id="reauth", data_schema=REAUTH_SCHEMA, errors=errors )
if entry.unique_id == self.unique_id: self.hass.config_entries.async_update_entry( entry, data={ CONF_USERNAME: self.username, CONF_PASSWORD: user_input[CON...
conditional_block
config_flow.py
"""Config flow to configure the OVO Energy integration.""" import aiohttp from ovoenergy.ovoenergy import OVOEnergy import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigFlow from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from .const import DOMA...
(self, user_input=None): """Handle a flow initiated by the user.""" errors = {} if user_input is not None: client = OVOEnergy() try: authenticated = await client.authenticate( user_input[CONF_USERNAME], user_input[CONF_PASSWORD] ...
async_step_user
identifier_name
config_flow.py
"""Config flow to configure the OVO Energy integration.""" import aiohttp from ovoenergy.ovoenergy import OVOEnergy import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigFlow from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from .const import DOMA...
errors["base"] = "authorization_error" return self.async_show_form( step_id="reauth", data_schema=REAUTH_SCHEMA, errors=errors )
}, ) return self.async_abort(reason="reauth_successful")
random_line_split
conf.py
# -*- coding: utf-8 -*- # # sympa documentation build configuration file, created by # sphinx-quickstart on Mon Aug 25 18:11:49 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file...
# The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Ad...
#html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None
random_line_split
test_go.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2020 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
(self): plugin = GoPlugin(part_name="my-part", options=lambda: None) self.assertThat(plugin.get_build_packages(), Equals({"gcc"})) def test_get_build_environment(self): plugin = GoPlugin(part_name="my-part", options=lambda: None) self.assertThat( plugin.get_build_envir...
test_get_build_packages
identifier_name
test_go.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2020 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
plugin = GoPlugin(part_name="my-part", options=Options()) self.assertThat(plugin.get_build_snaps(), Equals({"go/14/latest"})) def test_get_build_packages(self): plugin = GoPlugin(part_name="my-part", options=lambda: None) self.assertThat(plugin.get_build_packages(), Equals({"gcc"...
class Options: go_channel = "14/latest"
random_line_split
test_go.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2020 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
plugin = GoPlugin(part_name="my-part", options=Options()) self.assertThat(plugin.get_build_snaps(), Equals({"go/14/latest"})) def test_get_build_packages(self): plugin = GoPlugin(part_name="my-part", options=lambda: None) self.assertThat(plugin.get_build_packages(), Equals({"gcc...
go_channel = "14/latest"
identifier_body
result.py
"""Test result object""" import os import sys import traceback from StringIO import StringIO from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() retur...
def startTestRun(self): """Called once before any tests are executed. See startTest for a method called before each test. """ def stopTest(self, test): """Called when the given test has been run""" self._restoreStdout() self._mirrorOutput = False def _res...
if self._stderr_buffer is None: self._stderr_buffer = StringIO() self._stdout_buffer = StringIO() sys.stdout = self._stdout_buffer sys.stderr = self._stderr_buffer
conditional_block
result.py
"""Test result object""" import os import sys import traceback from StringIO import StringIO from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() retur...
def startTestRun(self): """Called once before any tests are executed. See startTest for a method called before each test. """ def stopTest(self, test): """Called when the given test has been run""" self._restoreStdout() self._mirrorOutput = False def _res...
if self.buffer: if self._stderr_buffer is None: self._stderr_buffer = StringIO() self._stdout_buffer = StringIO() sys.stdout = self._stdout_buffer sys.stderr = self._stderr_buffer
identifier_body
result.py
"""Test result object""" import os import sys import traceback from StringIO import StringIO from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() retur...
(self, err, test): """Converts a sys.exc_info()-style tuple of values into a string.""" exctype, value, tb = err # Skip test runner traceback levels while tb and self._is_relevant_tb_level(tb): tb = tb.tb_next if exctype is test.failureException: # Skip a...
_exc_info_to_string
identifier_name
result.py
"""Test result object""" import os import sys import traceback from StringIO import StringIO from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() retur...
self._restoreStdout() self._mirrorOutput = False def _restoreStdout(self): if self.buffer: if self._mirrorOutput: output = sys.stdout.getvalue() error = sys.stderr.getvalue() if output: if not output.endswith('\...
See startTest for a method called before each test. """ def stopTest(self, test): """Called when the given test has been run"""
random_line_split
else-if.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { if 1i == 2 { assert!((false)); } else if 2i == 3 { assert!((false)); } else if 3i == 4 { assert!((false)); } else { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { if ...
main
identifier_name
else-if.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ if 1i == 2 { assert!((false)); } else if 2i == 3 { assert!((false)); } else if 3i == 4 { assert!((false)); } else { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { if 1i ...
identifier_body
else-if.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { assert!((true)); } if 1i == 2 { assert!((false)); } else if 2i == 2 { if 1i == 1 { assert!((true)); } else { if 2i == 1 { assert!((false)); } else { assert!((false)); } } } if 1i == 2 { ...
{ assert!((false)); }
conditional_block
else-if.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} else { if 1i == 2 { assert!((false)); } else { assert!((true)); } } }
assert!((false));
random_line_split
data_stuff.js
'use strict'; var path = require('path'), fs = require('fs'), q = require('q'), _ = require('lodash'); var readFile = q.denodeify(fs.readFile); var writeFile = q.denodeify(fs.writeFile); var dataPath = path.normalize(__dirname + '/../data'); //read all files extract precinct name and year end totals. var...
} else { return null; } var precinct = { 'id': fileData.precinct_id, 'name': fileData.precinct, 'totals': [] }; console.log(precinct.name, precinct.id); precinct.totals = getYearlyTotals(fileData['monthly_totals']); return precinct; }; // build the yearly totals for a precinct. var getYearly...
{ console.log('Skipping: ' + fileData.precinct); return null; }
conditional_block
data_stuff.js
'use strict'; var path = require('path'), fs = require('fs'), q = require('q'), _ = require('lodash'); var readFile = q.denodeify(fs.readFile); var writeFile = q.denodeify(fs.writeFile); var dataPath = path.normalize(__dirname + '/../data'); //read all files extract precinct name and year end totals. var...
}); }; getTotals();
random_line_split
TreeViewItem.tsx
import { DragEvent, MouseEvent, ReactNode } from 'react'; export interface Props { disabled?: boolean; loading?: boolean; content?: ReactNode; toggled?: boolean; focussed?: boolean; children?: ReactNode; onDragEnd?: () => void; onToggle?: () => void; onFocus?: () => void; onDrag...
onToggle?.(); }; return ( <li title={title} role={children ? 'treeitem' : 'none'} tabIndex={focussed ? 0 : -1} onClick={handleClick} onFocus={onFocus} aria-expanded={toggled} className="treeview-item" ...
{ return; }
conditional_block
TreeViewItem.tsx
import { DragEvent, MouseEvent, ReactNode } from 'react'; export interface Props { disabled?: boolean; loading?: boolean; content?: ReactNode; toggled?: boolean; focussed?: boolean; children?: ReactNode;
onDragOver?: (event: DragEvent) => void; onDrop?: () => void; onDrag?: () => void; draggable?: boolean; title?: string; } const TreeView = ({ draggable = false, onDragEnd, onDragStart, onDragOver, onDrop, onDrag, disabled, content, toggled = false, focussed =...
onDragEnd?: () => void; onToggle?: () => void; onFocus?: () => void; onDragStart?: () => void;
random_line_split
time.rs
//! A module for time use system::syscall::{sys_clock_gettime, CLOCK_REALTIME, CLOCK_MONOTONIC, TimeSpec}; // 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, Ve...
else { secs = secs.checked_sub(1) .expect("overflow when subtracting durations"); self.nanos + NANOS_PER_SEC - rhs.nanos }; debug_assert!(nanos < NANOS_PER_SEC); Duration { secs: secs, nanos: nanos } } } impl Mul<u32> for Duration { type O...
{ self.nanos - rhs.nanos }
conditional_block
time.rs
//! A module for time use system::syscall::{sys_clock_gettime, CLOCK_REALTIME, CLOCK_MONOTONIC, TimeSpec}; // 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, Ve...
} impl Mul<u32> for Duration { type Output = Duration; fn mul(self, rhs: u32) -> Duration { // Multiply nanoseconds as u64, because it cannot overflow that way. let total_nanos = self.nanos as u64 * rhs as u64; let extra_secs = total_nanos / (NANOS_PER_SEC as u64); let nanos =...
{ let mut secs = self.secs.checked_sub(rhs.secs) .expect("overflow when subtracting durations"); let nanos = if self.nanos >= rhs.nanos { self.nanos - rhs.nanos } else { secs = secs.checked_sub(1) .expect("overflow when su...
identifier_body
time.rs
//! A module for time use system::syscall::{sys_clock_gettime, CLOCK_REALTIME, CLOCK_MONOTONIC, TimeSpec}; // 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, Ve...
/// produced synthetically. pub fn elapsed(&self) -> Duration { Instant::now().0 - self.0 } } #[derive(Copy, Clone)] pub struct SystemTime(Duration); impl SystemTime { /// Returns the system time corresponding to "now". pub fn now() -> SystemTime { let mut tp = TimeSpec { ...
/// instant, which is something that can happen if an `Instant` is
random_line_split
time.rs
//! A module for time use system::syscall::{sys_clock_gettime, CLOCK_REALTIME, CLOCK_MONOTONIC, TimeSpec}; // 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, Ve...
(self, rhs: Duration) -> Duration { let mut secs = self.secs.checked_sub(rhs.secs) .expect("overflow when subtracting durations"); let nanos = if self.nanos >= rhs.nanos { self.nanos - rhs.nanos } else { secs = secs.checked_sub(1) ...
sub
identifier_name
list-user-pools.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_cognitoidentityprovider::{Client, Error, Region, PKG_VERSION}; use aws_smithy_types_convert::date_time::DateTimeExt; use structopt::StructO...
let shared_config = aws_config::from_env().region(region_provider).load().await; let client = Client::new(&shared_config); show_pools(&client).await }
{ println!("Cognito client version: {}", PKG_VERSION); println!( "Region: {}", region_provider.region().await.unwrap().as_ref() ); println!(); }
conditional_block
list-user-pools.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_cognitoidentityprovider::{Client, Error, Region, PKG_VERSION}; use aws_smithy_types_convert::date_time::DateTimeExt; use structopt::StructO...
(client: &Client) -> Result<(), Error> { let response = client.list_user_pools().max_results(10).send().await?; if let Some(pools) = response.user_pools() { println!("User pools:"); for pool in pools { println!(" ID: {}", pool.id().unwrap_or_default()); prin...
show_pools
identifier_name
list-user-pools.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_cognitoidentityprovider::{Client, Error, Region, PKG_VERSION}; use aws_smithy_types_convert::date_time::DateTimeExt; use structopt::StructO...
pool.creation_date().unwrap().to_chrono_utc() ); println!(); } } println!("Next token: {}", response.next_token().unwrap_or_default()); Ok(()) } // snippet-end:[cognitoidentityprovider.rust.list-user-pools] /// Lists your Amazon Cognito user pools in the Reg...
" Last modified: {}", pool.last_modified_date().unwrap().to_chrono_utc() ); println!( " Creation date: {:?}",
random_line_split
index.js
var FS = require('fs'); var Path = require('path'); var io = module.exports = function () { // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} ...
F.prototype = io.prototype; return function () { var o = new F (arguments); if ('error' in o) { return; } else { return o; } } })(); io.prototype.inspect = function (depth, opts) { if (opts && opts.showHidden) return this else return "{path: "+this.path+"}"; } io.prototype.relative = functio...
{ try { return io.apply (this, args); } catch (e) { return {error: true}; } }
identifier_body
index.js
var FS = require('fs'); var Path = require('path'); var io = module.exports = function () { // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} ...
(args) { try { return io.apply (this, args); } catch (e) { return {error: true}; } } F.prototype = io.prototype; return function () { var o = new F (arguments); if ('error' in o) { return; } else { return o; } } })(); io.prototype.inspect = function (depth, opts) { if (opts && opts.sho...
F
identifier_name
index.js
var FS = require('fs'); var Path = require('path'); var io = module.exports = function () { // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} ...
// console.log (process.cwd (), Path.resolve (process.cwd ())); this.options.anchorDir = this.options.anchorDir || Path.resolve (process.cwd ()); this.setAnchorDir (this.options.anchorDir); this.path = Path.join.apply (Path, args.map (function (arg) { return arg.path ? arg.path : arg })); // console.log (pa...
{ this.options = {}; }
conditional_block
index.js
var FS = require('fs'); var Path = require('path'); var io = module.exports = function () { // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} ...
}; io.prototype.mkpath = function (path, mode, callback) { if ("function" === typeof mode && callback === undefined) { callback = mode; mode = 0777; // node defaults } if (!path) { if (callback) callback (); return; } var self = this; var pathChunks = path.split (Path.sep); var currentPathChunk = pat...
callback = mode; mode = 0777; // node defaults } return FS.mkdir (this.path, mode, callback);
random_line_split
mobile.js
// +------------------------------------------------------------------+ // | ____ _ _ __ __ _ __ | // | / ___| |__ ___ ___| | __ | \/ | |/ / | // | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | // | | |___| | | | __...
/* Disable data-ajax per default, as it makes problems in most of our cases */ $(document).ready(function() { $("a").attr("data-ajax", "false"); $("form").attr("data-ajax", "false"); $("div.error").addClass("ui-shadow"); $("div.success").addClass("ui-shadow"); $("div.really").addClass("ui-shadow...
// License along with GNU Make; see the file COPYING. If not, write // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA.
random_line_split
utils.py
import re from main import sc __author__ = 'minh' class Utils: def __init__(self): pass not_allowed_chars = '[\/*?"<>|\s\t]' numeric_regex = r"\A((\\-)?[0-9]{1,3}(,[0-9]{3})+(\\.[0-9]+)?)|((\\-)?[0-9]*\\.[0-9]+)|((\\-)?[0-9]+)|((\\-)?[0" \ r"-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)...
return False @staticmethod def clean_examples_numeric(examples): return sc.parallelize(examples).map(lambda x: float(x) if Utils.is_number(x) else "").filter( lambda x: x).collect() @staticmethod def get_distribution(data): return sc.parallelize(data).map(lambd...
return True
conditional_block
utils.py
import re from main import sc __author__ = 'minh' class Utils: def __init__(self):
not_allowed_chars = '[\/*?"<>|\s\t]' numeric_regex = r"\A((\\-)?[0-9]{1,3}(,[0-9]{3})+(\\.[0-9]+)?)|((\\-)?[0-9]*\\.[0-9]+)|((\\-)?[0-9]+)|((\\-)?[0" \ r"-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)\Z" @staticmethod def is_number(example): matches = re.match(Utils.numeric_regex, exampl...
pass
random_line_split
utils.py
import re from main import sc __author__ = 'minh' class Utils: def __init__(self): pass not_allowed_chars = '[\/*?"<>|\s\t]' numeric_regex = r"\A((\\-)?[0-9]{1,3}(,[0-9]{3})+(\\.[0-9]+)?)|((\\-)?[0-9]*\\.[0-9]+)|((\\-)?[0-9]+)|((\\-)?[0" \ r"-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)...
(data): return sc.parallelize(data).map(lambda word: (word, 1)).reduceByKey(lambda a, b: a + b).sortBy( lambda x: x).zipWithIndex().flatMap(lambda value, idx: [str(idx)] * int(value/len(data) * 100)) @staticmethod def get_index_name(index_config): return "%s!%s" % (index_config['nam...
get_distribution
identifier_name
utils.py
import re from main import sc __author__ = 'minh' class Utils:
def __init__(self): pass not_allowed_chars = '[\/*?"<>|\s\t]' numeric_regex = r"\A((\\-)?[0-9]{1,3}(,[0-9]{3})+(\\.[0-9]+)?)|((\\-)?[0-9]*\\.[0-9]+)|((\\-)?[0-9]+)|((\\-)?[0" \ r"-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)\Z" @staticmethod def is_number(example): matches = re...
identifier_body
test_sh_base.py
import shesha.config as conf simul_name = "bench_scao_sh_16x16_8pix" # loop p_loop = conf.Param_loop() p_loop.set_niter(100) p_loop.set_ittime(0.002) # =1/500 # geom p_geom = conf.Param_geom() p_geom.set_zenithangle(0.) # tel
p_tel.set_diam(4.0) p_tel.set_cobs(0.12) # atmos p_atmos = conf.Param_atmos() p_atmos.set_r0(0.16) p_atmos.set_nscreens(1) p_atmos.set_frac([1.0]) p_atmos.set_alt([0.0]) p_atmos.set_windspeed([20.0]) p_atmos.set_winddir([45.]) p_atmos.set_L0([1.e5]) # target p_target = conf.Param_target() p_targets = [p_target] # p...
p_tel = conf.Param_tel()
random_line_split
moves.js
exports.BattleMovedex = { "waterpulse": { inherit: true, basePower: 80 }, "paleowave": { inherit: true, isNonstandard: false }, "submission": { inherit: true, accuracy: 100, base...
basePower: 120, category: "Physical", desc: "Deals damage to one adjacent target by crashing into the target with a cloak of mystical energy.", shortDesc: "Deals damage and has recoil Basically Double Edge for faries.", id: "mysticcrash", isViable: true, name: "Mystic Crash", pp: 15, priority: 0, is...
"mysticcrash": { num: 1002, accuracy: 100,
random_line_split
diagnostics.rs
// Copyright (c) 2014 Richard Diamond & contributors. // // This file is part of Rust Rocket. // // Rust Rocket is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (...
_ => NestedEntry(None, None), } } } #[deriving(Clone)] pub struct Emittion { addr: Address, // Note to Rocket devs: if SpanOrigin, the Span offsets must be normalized // as if the offending file is the only member of the CodeMap. This is so we // don't have to share or otherwi...
{ let filemap = cm.lookup_byte_offset(sp.lo).fm; let addr = address() .clone() .with_source(Path::new(filemap.name)); unimplemented!(); let file_start = filemap.start_pos; let new_sp = mk_sp(sp.lo - f...
conditional_block
diagnostics.rs
// Copyright (c) 2014 Richard Diamond & contributors. // // This file is part of Rust Rocket. // // Rust Rocket is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (...
.clone() .with_source(Path::new(filemap.name)); unimplemented!(); let file_start = filemap.start_pos; let new_sp = mk_sp(sp.lo - file_start, sp.hi - file_start); let nested = sp.exp...
let filemap = cm.lookup_byte_offset(sp.lo).fm; let addr = address()
random_line_split
diagnostics.rs
// Copyright (c) 2014 Richard Diamond & contributors. // // This file is part of Rust Rocket. // // Rust Rocket is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (...
() -> SessionIf { SessionIf { errors: Cell::new(0), queue: Arc::new(mpsc_queue::Queue::new()), } } // An expected failure. pub fn fail(&self) -> ! { fail!(FatalError) } fn bump_error_count(&self) { self.errors.set(self.errors.get() + 1); }...
new
identifier_name
AppRootPage.tsx
// Libraries import React, { Component } from 'react'; import { hot } from 'react-hot-loader'; import { connect } from 'react-redux'; // Types import { StoreState } from 'app/types'; import { AppEvents, AppPlugin, AppPluginMeta, NavModel, PluginType, UrlQueryMap } from '@grafana/data'; import { createHtmlPortalNode, In...
(meta: AppPluginMeta) { if (!meta) { return 'Unknown Plugin'; } if (meta.type !== PluginType.app) { return 'Plugin must be an app'; } if (!meta.enabled) { return 'Application Not Enabled'; } return null; } class AppRootPage extends Component<Props, State> { constructor(props: Props) { s...
getAppPluginPageError
identifier_name
AppRootPage.tsx
// Libraries import React, { Component } from 'react'; import { hot } from 'react-hot-loader'; import { connect } from 'react-redux'; // Types import { StoreState } from 'app/types'; import { AppEvents, AppPlugin, AppPluginMeta, NavModel, PluginType, UrlQueryMap } from '@grafana/data'; import { createHtmlPortalNode, In...
async componentDidMount() { const { pluginId } = this.props; try { const app = await getPluginSettings(pluginId).then(info => { const error = getAppPluginPageError(info); if (error) { appEvents.emit(AppEvents.alertError, [error]); this.setState({ nav: getWarningNav...
{ super(props); this.state = { loading: true, portalNode: createHtmlPortalNode(), }; }
identifier_body
AppRootPage.tsx
// Libraries import React, { Component } from 'react'; import { hot } from 'react-hot-loader'; import { connect } from 'react-redux'; // Types import { StoreState } from 'app/types'; import { AppEvents, AppPlugin, AppPluginMeta, NavModel, PluginType, UrlQueryMap } from '@grafana/data'; import { createHtmlPortalNode, In...
} } const mapStateToProps = (state: StoreState) => ({ pluginId: state.location.routeParams.pluginId, slug: state.location.routeParams.slug, query: state.location.query, path: state.location.path, }); export default hot(module)(connect(mapStateToProps)(AppRootPage));
</> );
random_line_split
AppRootPage.tsx
// Libraries import React, { Component } from 'react'; import { hot } from 'react-hot-loader'; import { connect } from 'react-redux'; // Types import { StoreState } from 'app/types'; import { AppEvents, AppPlugin, AppPluginMeta, NavModel, PluginType, UrlQueryMap } from '@grafana/data'; import { createHtmlPortalNode, In...
if (!meta.enabled) { return 'Application Not Enabled'; } return null; } class AppRootPage extends Component<Props, State> { constructor(props: Props) { super(props); this.state = { loading: true, portalNode: createHtmlPortalNode(), }; } async componentDidMount() { const { ...
{ return 'Plugin must be an app'; }
conditional_block
mod.rs
pub mod op; use std::any::Any; use std::fmt; use std::fmt::{Display, Formatter}; use spv::Op; use spv::ExtInst; use spv::ExtInstSet; use spv::raw::MemoryBlock; use spv::raw::MemoryBlockResult; use spv::raw::ReadError; use self::op::*; #[derive(Clone, Debug, PartialEq)] pub enum Inst { Sin(Sin), Cos(Cos), } i...
Sin(ref op) => op.fmt(f), Cos(ref op) => op.fmt(f), } } } pub struct InstSet; impl ExtInstSet for InstSet { fn get_name(&self) -> &'static str { "GLSL.std.450" } fn read_instruction<'a, 'b>(&'b self, instruction: u32, ...
match *self {
random_line_split
mod.rs
pub mod op; use std::any::Any; use std::fmt; use std::fmt::{Display, Formatter}; use spv::Op; use spv::ExtInst; use spv::ExtInstSet; use spv::raw::MemoryBlock; use spv::raw::MemoryBlockResult; use spv::raw::ReadError; use self::op::*; #[derive(Clone, Debug, PartialEq)] pub enum Inst { Sin(Sin), Cos(Cos), } ...
} fn read_sin<'a>(block: MemoryBlock<'a>) -> MemoryBlockResult<'a, Inst> { let (block, x) = try!(block.read_op_id()); Ok((block, Inst::Sin(Sin { x: x }))) } fn read_cos(block: MemoryBlock) -> MemoryBlockResult<Inst> { let (block, x) = try!(block.read_op_id()); Ok((block, Inst::Cos(Cos { x: x }))) }
{ Box::new(InstSet) }
identifier_body
mod.rs
pub mod op; use std::any::Any; use std::fmt; use std::fmt::{Display, Formatter}; use spv::Op; use spv::ExtInst; use spv::ExtInstSet; use spv::raw::MemoryBlock; use spv::raw::MemoryBlockResult; use spv::raw::ReadError; use self::op::*; #[derive(Clone, Debug, PartialEq)] pub enum Inst { Sin(Sin), Cos(Cos), } ...
(&self) -> &'static str { "GLSL.std.450" } fn read_instruction<'a, 'b>(&'b self, instruction: u32, block: MemoryBlock<'a>) -> MemoryBlockResult<'a, Box<ExtInst>> { let (block, inst) = try!(match instr...
get_name
identifier_name
skpicture_printer_unittest.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import shutil import tempfile from telemetry import decorators from telemetry.testing import options_for_unittests from telemetry.testing import page_test_t...
measurement = skpicture_printer.SkpicturePrinter(self._skp_outdir) results = self.RunMeasurement(measurement, ps, options=self._options) # Picture printing is not supported on all platforms. if results.failures: assert 'not supported' in results.failures[0].exc_info[1].message return s...
@decorators.Disabled('android') def testSkpicturePrinter(self): ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html')
random_line_split
skpicture_printer_unittest.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import shutil import tempfile from telemetry import decorators from telemetry.testing import options_for_unittests from telemetry.testing import page_test_t...
@decorators.Disabled('android') def testSkpicturePrinter(self): ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') measurement = skpicture_printer.SkpicturePrinter(self._skp_outdir) results = self.RunMeasurement(measurement, ps, options=self._options) # Picture printing is not suppor...
shutil.rmtree(self._skp_outdir)
identifier_body
skpicture_printer_unittest.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import shutil import tempfile from telemetry import decorators from telemetry.testing import options_for_unittests from telemetry.testing import page_test_t...
(self): self._options = options_for_unittests.GetCopy() self._skp_outdir = tempfile.mkdtemp('_skp_test') def tearDown(self): shutil.rmtree(self._skp_outdir) @decorators.Disabled('android') def testSkpicturePrinter(self): ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') measure...
setUp
identifier_name
skpicture_printer_unittest.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import shutil import tempfile from telemetry import decorators from telemetry.testing import options_for_unittests from telemetry.testing import page_test_t...
saved_picture_count = results.FindAllPageSpecificValuesNamed( 'saved_picture_count') self.assertEquals(len(saved_picture_count), 1) self.assertGreater(saved_picture_count[0].GetRepresentativeNumber(), 0)
assert 'not supported' in results.failures[0].exc_info[1].message return
conditional_block
clock.rs
use std::time::{Duration, Instant}; use tokio_core::reactor::Handle; use error::{Error, Result}; use component::Component; use tokio_timer::Timer; use futures::Stream; use time; /// A `Clock` that automatically determines the refresh rate. /// /// This uses the default [strftime](http://man7.org/linux/man-pages/man3/s...
else { Ok(Duration::from_secs(60)) } } impl Component for Clock { type Error = Error; type Stream = Box<Stream<Item = String, Error = Error>>; fn stream(self, _: Handle) -> Self::Stream { let timer = Timer::default(); let format = self.format.clone(); timer.interval_a...
{ Ok(Duration::from_secs(1)) }
conditional_block
clock.rs
use std::time::{Duration, Instant}; use tokio_core::reactor::Handle; use error::{Error, Result}; use component::Component; use tokio_timer::Timer; use futures::Stream; use time; /// A `Clock` that automatically determines the refresh rate. /// /// This uses the default [strftime](http://man7.org/linux/man-pages/man3/s...
}
random_line_split
clock.rs
use std::time::{Duration, Instant}; use tokio_core::reactor::Handle; use error::{Error, Result}; use component::Component; use tokio_timer::Timer; use futures::Stream; use time; /// A `Clock` that automatically determines the refresh rate. /// /// This uses the default [strftime](http://man7.org/linux/man-pages/man3/s...
() -> Clock { Clock { format: "%T".into(), refresh_rate: Duration::from_secs(1), } } } impl Clock { /// Create a new `Clock` specifying the time format as argument. /// /// # Errors /// /// Returns `Err` if the specified `strftime` format could not be par...
default
identifier_name
pkt_deserializer.rs
use std::io::Read; use byteorder::{BigEndian, ReadBytesExt}; use serde::de; use serde::de::Visitor; use error::{Error, ResultE}; use super::osc_reader::OscReader; use super::msg_visitor::MsgVisitor; use super::bundle_visitor::BundleVisitor; /// Deserializes an entire OSC packet or bundle element (they are syntactical...
(reader: &'a mut R) -> Self { Self{ reader } } } impl<'de, 'a, R> de::Deserializer<'de> for &'a mut PktDeserializer<'a, R> where R: Read + 'a { type Error = Error; fn deserialize_any<V>(self, visitor: V) -> ResultE<V::Value> where V: Visitor<'de> { // First, extract the leng...
new
identifier_name
pkt_deserializer.rs
use std::io::Read; use byteorder::{BigEndian, ReadBytesExt}; use serde::de; use serde::de::Visitor; use error::{Error, ResultE}; use super::osc_reader::OscReader; use super::msg_visitor::MsgVisitor; use super::bundle_visitor::BundleVisitor; /// Deserializes an entire OSC packet or bundle element (they are syntactical...
{ pub fn new(reader: &'a mut R) -> Self { Self{ reader } } } impl<'de, 'a, R> de::Deserializer<'de> for &'a mut PktDeserializer<'a, R> where R: Read + 'a { type Error = Error; fn deserialize_any<V>(self, visitor: V) -> ResultE<V::Value> where V: Visitor<'de> { // First, ...
impl<'a, R> PktDeserializer<'a, R> where R: Read + 'a
random_line_split
pkt_deserializer.rs
use std::io::Read; use byteorder::{BigEndian, ReadBytesExt}; use serde::de; use serde::de::Visitor; use error::{Error, ResultE}; use super::osc_reader::OscReader; use super::msg_visitor::MsgVisitor; use super::bundle_visitor::BundleVisitor; /// Deserializes an entire OSC packet or bundle element (they are syntactical...
// This struct only deserializes sequences; ignore all type hints. // More info: https://github.com/serde-rs/serde/blob/b7d6c5d9f7b3085a4d40a446eeb95976d2337e07/serde/src/macros.rs#L106 forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option seq...
{ // First, extract the length of the packet. let length = self.reader.read_i32::<BigEndian>()?; let mut reader = self.reader.take(length as u64); // See if packet is a bundle or a message. let address = reader.parse_str()?; let result = match address.as_str() { ...
identifier_body
util.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use super::{Error, Result}; use tikv_util::codec; use tikv_util::codec::number::{self, NumberEncoder}; /// Check if key in range [`start_key`, `end_key`). #[allow(dead_code)] pub fn check_key_in_range( key: &[u8], region_id: u64, start_key...
(value_with_ttl: &[u8]) -> &[u8] { let len = value_with_ttl.len(); &value_with_ttl[..len - number::U64_SIZE] } pub fn truncate_expire_ts(value_with_ttl: &mut Vec<u8>) -> Result<()> { let len = value_with_ttl.len(); if len < number::U64_SIZE { return Err(Error::Codec(codec::Error::ValueLength));...
strip_expire_ts
identifier_name
util.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use super::{Error, Result}; use tikv_util::codec; use tikv_util::codec::number::{self, NumberEncoder}; /// Check if key in range [`start_key`, `end_key`). #[allow(dead_code)] pub fn check_key_in_range( key: &[u8], region_id: u64, start_key...
pub fn get_expire_ts(value_with_ttl: &[u8]) -> Result<u64> { let len = value_with_ttl.len(); if len < number::U64_SIZE { return Err(Error::Codec(codec::Error::ValueLength)); } let mut ts = &value_with_ttl[len - number::U64_SIZE..]; Ok(number::decode_u64(&mut ts)?) } pub fn strip_expire_ts(v...
pub fn append_expire_ts(value: &mut Vec<u8>, expire_ts: u64) { value.encode_u64(expire_ts).unwrap(); }
random_line_split
util.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use super::{Error, Result}; use tikv_util::codec; use tikv_util::codec::number::{self, NumberEncoder}; /// Check if key in range [`start_key`, `end_key`). #[allow(dead_code)] pub fn check_key_in_range( key: &[u8], region_id: u64, start_key...
else { Err(Error::NotInRange { key: key.to_vec(), region_id, start: start_key.to_vec(), end: end_key.to_vec(), }) } } pub fn append_expire_ts(value: &mut Vec<u8>, expire_ts: u64) { value.encode_u64(expire_ts).unwrap(); } pub fn get_expire_ts(val...
{ Ok(()) }
conditional_block
util.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use super::{Error, Result}; use tikv_util::codec; use tikv_util::codec::number::{self, NumberEncoder}; /// Check if key in range [`start_key`, `end_key`). #[allow(dead_code)] pub fn check_key_in_range( key: &[u8], region_id: u64, start_key...
pub fn get_expire_ts(value_with_ttl: &[u8]) -> Result<u64> { let len = value_with_ttl.len(); if len < number::U64_SIZE { return Err(Error::Codec(codec::Error::ValueLength)); } let mut ts = &value_with_ttl[len - number::U64_SIZE..]; Ok(number::decode_u64(&mut ts)?) } pub fn strip_expire_ts...
{ value.encode_u64(expire_ts).unwrap(); }
identifier_body
ro_dlg.js
tinyMCE.addI18n('ro.advimage_dlg',{ tab_general:"General", tab_appearance:"Afi\u015Fare", tab_advanced:"Avansat", general:"General", title:"Titlu", preview:"Previzualizare", constrain_proportions:"Men\u0163ine propor\u0163ii", langdir:"Direc\u0163ie limb\u0103", langcode:"Cod limb\u0103", long_desc:"Link desc...
hspace:"Spa\u0163iu orizontal", align:"Aliniere", align_baseline:"Baseline", align_top:"Sus", align_middle:"La mijloc", align_bottom:"Jos", align_texttop:"Textul sus", align_textbottom:"Textul jos", align_left:"St\u00E2nga", align_right:"Dreapta", image_list:"List\u0103 de imagini" });
dimensions:"Dimensiuni", vspace:"Spa\u0163iu vertical",
random_line_split
messages_cs.js
/* * Copyright (c) 2015-2016 Dilvan Moreira. * Copyright (c) 2015-2016 John Garavito. *
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. ...
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
random_line_split
messages_cs.js
/* * Copyright (c) 2015-2016 Dilvan Moreira. * Copyright (c) 2015-2016 John Garavito. * * 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/LICENS...
}(function( $ ) { /* * Translated default messages for the jQuery validation plugin. * Locale: CS (Czech; čeština, český jazyk) */ $.extend( $.validator.messages, { required: "Tento údaj je povinný.", remote: "Prosím, opravte tento údaj.", email: "Prosím, zadejte platný e-mail.", url: "Prosím, zadejte platné U...
{ factory( jQuery ); }
conditional_block
mod.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
#[macro_use] mod test_common; mod transaction; mod executive; mod state; mod chain; mod homestead_state; mod homestead_chain; mod eip150_state; mod eip161_state; mod trie;
// GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Parity. If not, see <http://www.gnu.org/licenses/>.
random_line_split
printing.py
# Copyright (C) 2010, 2012 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions an...
def _print_worker_statistics(self, run_results, num_workers): self._print_debug("Thread timing:") stats = {} cuml_time = 0 for result in run_results.results_by_name.values(): stats.setdefault(result.worker_name, {'num_tests': 0, 'total_time': 0}) stats[resul...
self._print_debug("Test timing:") self._print_debug(" %6.2f total testing time" % total_time) self._print_debug("") self._print_worker_statistics(run_results, int(self._options.child_processes)) self._print_aggregate_test_statistics(run_results) self._print_individual_test_time...
identifier_body