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 |
|---|---|---|---|---|
test_qcut.py | .
labels, bins = qcut(arr, 4, retbins=True)
ex_bins = quantile(arr, [0, 0.25, 0.5, 0.75, 1.0])
result = labels.categories.left.values
assert np.allclose(result, ex_bins[:-1], atol=1e-2)
result = labels.categories.right.values
assert np.allclose(result, ex_bins[1:], atol=1e-2)
ex_levels = ... | ({}, "Bin edges must be unique"),
({"duplicates": "raise"}, "Bin edges must be unique"),
({"duplicates": "foo"}, "invalid value for 'duplicates' parameter"),
],
)
def test_qcut_duplicates_bin(kwargs, msg):
# see gh-7751
values = [0, 0, 0, 0, 1, 2, 3]
if msg is not None:
... | random_line_split | |
EventInner.tsx | /*
* SonarQube
* Copyright (C) 2009-2019 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program 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, o... | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Bost... | * but WITHOUT ANY WARRANTY; without even the implied warranty of | random_line_split |
BMNGOneImageLayer.js | /*
* Copyright (C) 2014 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration. All Rights Reserved.
*/
/**
* @exports BMNGOneImageLayer
* @version $Id: BMNGOneImageLayer.js 2942 2015-03-30 21:16:36Z tgaskins $
*/
define([
'../layer/Ren... | * @alias BMNGOneImageLayer
* @constructor
* @augments RenderableLayer
* @classdesc Displays a Blue Marble image layer that spans the entire globe with a single image.
*/
var BMNGOneImageLayer = function () {
RenderableLayer.call(this, "Blue Marble I... | * Constructs a Blue Marble image layer that spans the entire globe.
| random_line_split |
about_iteration.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
total = 0
for num in it:
total += num
self.assertEqual(15 , total)
def test_iterating_with_next(self):... |
# ------------------------------------------------------------------
def add_ten(self, item):
return item + 10
def test_map_transforms_elements_of_a_list(self):
seq = [1, 2, 3]
mapped_seq = list()
mapping = map(self.add_ten, seq)
self.assertNotEqual(list, mapping... | self.assertRegex(err_msg, 'Ran out') | random_line_split |
about_iteration.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
total = 0
for num in it:
total += num
self.assertEqual(15 , total)
def test_iterating_with_next(self):... | (item):
return (item % 2) == 0
seq = [1, 2, 3, 4, 5, 6]
even_numbers = list()
for item in filter(is_even, seq):
even_numbers.append(item)
self.assertEqual([2,4,6], even_numbers)
def test_just_return_first_item_found(self):
def is_big_name(item):
... | is_even | identifier_name |
about_iteration.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
total = 0
for num in it:
|
self.assertEqual(15 , total)
def test_iterating_with_next(self):
stages = iter(['alpha','beta','gamma'])
try:
self.assertEqual('alpha', next(stages))
next(stages)
self.assertEqual('gamma', next(stages))
next(stages)
except StopItera... | total += num | conditional_block |
about_iteration.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
total = 0
for num in it:
total += num
self.assertEqual(15 , total)
def test_iterating_with_next(self):... |
# ------------------------------------------------------------------
def add_ten(self, item):
return item + 10
def test_map_transforms_elements_of_a_list(self):
seq = [1, 2, 3]
mapped_seq = list()
mapping = map(self.add_ten, seq)
self.assertNotEqual(list, mappin... | stages = iter(['alpha','beta','gamma'])
try:
self.assertEqual('alpha', next(stages))
next(stages)
self.assertEqual('gamma', next(stages))
next(stages)
except StopIteration as ex:
err_msg = 'Ran out of iterations'
self.assertRegex(err_... | identifier_body |
contextView.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | extends Action {
constructor(label: string, public entries: (ContextSubMenu | IAction)[]) {
super('contextsubmenu', label, '', true);
}
}
| ContextSubMenu | identifier_name |
contextView.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}
| {
super('contextsubmenu', label, '', true);
} | identifier_body |
contextView.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | export const IContextMenuService = createDecorator<IContextMenuService>('contextMenuService');
export interface IContextMenuService {
_serviceBrand: any;
showContextMenu(delegate: IContextMenuDelegate): void;
}
export interface IEvent {
shiftKey?: boolean;
ctrlKey?: boolean;
altKey?: boolean;
metaKey?: boolean;... | onHide?(data?: any): void;
}
| random_line_split |
timed-snowman.ts |
import { Spawner } from '../../../../base/Spawner';
import { HolidayHelper } from '../../../../../shared/helpers/holiday-helper';
import { Holiday } from '../../../../../shared/interfaces/holiday';
const npcIds = [
{ chance: 50, result: 'Christmas Weak Snowman' },
{ chance: 10, result: 'Christmas Strong Snowman' ... | () {
const minute = new Date().getMinutes();
return HolidayHelper.isHoliday(Holiday.Christmas)
&& ((minute % 3) === 0 || (minute % 4) === 0);
}
}
| isActive | identifier_name |
timed-snowman.ts | import { Spawner } from '../../../../base/Spawner';
import { HolidayHelper } from '../../../../../shared/helpers/holiday-helper';
import { Holiday } from '../../../../../shared/interfaces/holiday';
const npcIds = [
{ chance: 50, result: 'Christmas Weak Snowman' },
{ chance: 10, result: 'Christmas Strong Snowman' }... | respawnRate: 15,
initialSpawn: 1,
maxCreatures: 3,
spawnRadius: 1,
randomWalkRadius: 15,
leashRadius: 20,
npcIds
});
}
isActive() {
const minute = new Date().getMinutes();
return HolidayHelper.isHoliday(Holiday.Christmas)
&& ((minute % 3) === 0 || (minute... | random_line_split | |
timed-snowman.ts |
import { Spawner } from '../../../../base/Spawner';
import { HolidayHelper } from '../../../../../shared/helpers/holiday-helper';
import { Holiday } from '../../../../../shared/interfaces/holiday';
const npcIds = [
{ chance: 50, result: 'Christmas Weak Snowman' },
{ chance: 10, result: 'Christmas Strong Snowman' ... |
isActive() {
const minute = new Date().getMinutes();
return HolidayHelper.isHoliday(Holiday.Christmas)
&& ((minute % 3) === 0 || (minute % 4) === 0);
}
}
| {
super(room, opts, {
respawnRate: 15,
initialSpawn: 1,
maxCreatures: 3,
spawnRadius: 1,
randomWalkRadius: 15,
leashRadius: 20,
npcIds
});
} | identifier_body |
index.js | const Benchmark = require("benchmark");
const {
test,
match,
sort: fuzzySort,
filter: fuzzyFilter,
} = require("../build/cjs");
process.stdout.write("Setting up benmarks...");
let cities = require("./cities.json");
cities = cities.map((city, i) => ({ id: i, ...city }));
console.log(" Done.");
const benchm... | test("av", cities[0].city);
});
process.stdout.write(`Running unoptimized sort on ${cities.length} objects...`);
benchmarkUnoptimizedSort.run();
console.log(" Done.");
process.stdout.write(`Running optimized sort on ${cities.length} objects...`);
benchmarkOptimizedSort.run();
console.log(" Done.");
process.stdout.... | const benchmarkTest = new Benchmark("test", () => { | random_line_split |
__init__.py | """
* Copyright 2015, Roberto Prevato roberto.prevato@gmail.com
* https://github.com/RobertoPrevato/Flask-three-template
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
"""
from bll.membership.membershipprovider import MembershipProvider
def register_membership(app):
"""
Initializ... |
else:
raise Exception("MembershipStore for `{}` implemented".format(DAL_PROJECT))
# instantiate the membership provider
provider = MembershipProvider({ "store": membership_store })
# attach to the application
setattr(app, "membership", provider)
| from dalmongo.membership.membershipstore import MembershipStore
membership_store = MembershipStore() | conditional_block |
__init__.py | """
* Copyright 2015, Roberto Prevato roberto.prevato@gmail.com
* https://github.com/RobertoPrevato/Flask-three-template
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
"""
from bll.membership.membershipprovider import MembershipProvider
def register_membership(app):
"""
Initializ... | This template includes a global membership provider, because it is a simpler model that suffices in most cases.
"""
DAL_PROJECT = app.config["DAL_PROJECT"]
# initialize an application membership provider
# NB: an alternative, if needed, is to initialize a membership provider for each area (e.g. adm... | random_line_split | |
__init__.py | """
* Copyright 2015, Roberto Prevato roberto.prevato@gmail.com
* https://github.com/RobertoPrevato/Flask-three-template
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
"""
from bll.membership.membershipprovider import MembershipProvider
def | (app):
"""
Initialize an application global membership provider.
NB:
an alternative, if needed, is to initialize a membership provider for each logical area (e.g. admin, public, etc.);
which allows to use different database structures to store accounts and sessions for different parts of
th... | register_membership | identifier_name |
__init__.py | """
* Copyright 2015, Roberto Prevato roberto.prevato@gmail.com
* https://github.com/RobertoPrevato/Flask-three-template
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
"""
from bll.membership.membershipprovider import MembershipProvider
def register_membership(app):
|
# attach to the application
setattr(app, "membership", provider)
| """
Initialize an application global membership provider.
NB:
an alternative, if needed, is to initialize a membership provider for each logical area (e.g. admin, public, etc.);
which allows to use different database structures to store accounts and sessions for different parts of
the applicati... | identifier_body |
datetime_spoke.py |
def initialize(self):
NormalSpoke.initialize(self)
self.initialize_start()
self._daysStore = self.builder.get_object("days")
self._monthsStore = self.builder.get_object("months")
self._yearsStore = self.builder.get_object("years")
self._regionsStore = self.builder.g... | NormalSpoke.__init__(self, *args)
# taking values from the kickstart file?
self._kickstarted = flags.flags.automatedInstall
self._update_datetime_timer = None
self._start_updating_timer = None
self._shown = False
self._tz = None
self._timezone_module = TIMEZONE... | identifier_body | |
datetime_spoke.py | ][1]
def _restore_old_city_region(self):
"""Restore stored "old" (or last valid) values."""
# check if there are old values to go back to
if self._old_region and self._old_city:
self._set_timezone(self._old_region + "/" + self._old_city)
def on_up_hours_clicked(self, *args)... | return server
return None
| random_line_split | |
datetime_spoke.py | (FirstbootSpokeMixIn, NormalSpoke):
"""
.. inheritance-diagram:: DatetimeSpoke
:parts: 3
"""
builderObjects = ["datetimeWindow",
"days", "months", "years", "regions", "cities",
"upImage", "upImage1", "upImage2", "downImage",
... | DatetimeSpoke | identifier_name | |
datetime_spoke.py | dating_timer.timeout_sec(interval, self._save_system_time)
def _set_combo_selection(self, combo, item):
model = combo.get_model()
if not model:
return False
itr = model.get_iter_first()
while itr:
if model[itr][0] == item:
combo.set_active_it... | self._set_amPm_part_sensitive(True)
new_hours, new_amPm = self._to_amPm(hours)
self._amPmLabel.set_text(new_amPm)
self._amPmRevealer.set_reveal_child(True) | conditional_block | |
Button.js |
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level di... | /* ************************************************************************ | random_line_split | |
performance.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this |
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceMethods;
use dom::bindings::js::{JS, Root};
use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::performancetiming::PerformanceTiming;
use do... | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | random_line_split |
performance.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::codegen::Bindings::PerformanceBinding... | (window: &Window,
navigation_start: u64,
navigation_start_precise: f64) -> Root<Performance> {
reflect_dom_object(box Performance::new_inherited(window,
navigation_start,
... | new | identifier_name |
performance.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::PerformanceBinding;
use dom::bindings::codegen::Bindings::PerformanceBinding... |
}
impl PerformanceMethods for Performance {
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#performance-timing-attribute
fn Timing(&self) -> Root<PerformanceTiming> {
Root::from_ref(&*self.timing)
}
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighR... | {
reflect_dom_object(box Performance::new_inherited(window,
navigation_start,
navigation_start_precise),
window,
PerformanceBinding::Wrap)
... | identifier_body |
ColorTable.js | define(function() {
function ColorTable(params) {
this.colors = [];
this.errorColor = params.errorColor;
}
ColorTable.prototype.hasColor = function(r, g, b, a) {
return this.lookUpColor(r, g, b, a) >= 0;
};
ColorTable.prototype.lookUpColor = function(r, g, b, a) {
for(var i = 0; i < this.colors.length; i++... |
};
return ColorTable;
}); | {
return this.addColor(r, g, b, a);
} | conditional_block |
ColorTable.js | define(function() {
function | (params) {
this.colors = [];
this.errorColor = params.errorColor;
}
ColorTable.prototype.hasColor = function(r, g, b, a) {
return this.lookUpColor(r, g, b, a) >= 0;
};
ColorTable.prototype.lookUpColor = function(r, g, b, a) {
for(var i = 0; i < this.colors.length; i++) {
if(this.colors[i].r === r &&
... | ColorTable | identifier_name |
ColorTable.js | define(function() {
function ColorTable(params) |
ColorTable.prototype.hasColor = function(r, g, b, a) {
return this.lookUpColor(r, g, b, a) >= 0;
};
ColorTable.prototype.lookUpColor = function(r, g, b, a) {
for(var i = 0; i < this.colors.length; i++) {
if(this.colors[i].r === r &&
this.colors[i].g === g &&
this.colors[i].b === b &&
this.colors[... | {
this.colors = [];
this.errorColor = params.errorColor;
} | identifier_body |
ColorTable.js | define(function() {
function ColorTable(params) {
this.colors = [];
this.errorColor = params.errorColor;
} | };
ColorTable.prototype.lookUpColor = function(r, g, b, a) {
for(var i = 0; i < this.colors.length; i++) {
if(this.colors[i].r === r &&
this.colors[i].g === g &&
this.colors[i].b === b &&
this.colors[i].a === a) {
return i;
}
}
return -1;
};
ColorTable.prototype.lookUpIndex = function(i)... | ColorTable.prototype.hasColor = function(r, g, b, a) {
return this.lookUpColor(r, g, b, a) >= 0; | random_line_split |
request.py | # -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
class Request(WebObRequest):
"""The OAuth version of the WebOb Request.
Provides an easier way to obtain O... |
params = property(params, doc=WebObRequest.params.__doc__)
@property
def oauth_params(self):
"""Simple way to get the OAuth parameters without sifting through
the entire stack of parameters.
We check the header first, because it is low hanging fruit.
However, it w... | params = WebObRequest.params.fget(self)
return NestedMultiDict(params, self.str_oauth_header) | identifier_body |
request.py | # -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
| """The OAuth version of the WebOb Request.
Provides an easier way to obtain OAuth request parameters
(e.g. oauth_token) from the WSGI environment."""
def _checks_positive_for_oauth(self, params_var):
"""Simple check for the presence of OAuth parameters."""
checks = [ p.find('oauth... |
class Request(WebObRequest):
| random_line_split |
request.py | # -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
class Request(WebObRequest):
"""The OAuth version of the WebOb Request.
Provides an easier way to obtain O... |
return extracted
@property
def str_oauth_POST(self):
extracted = {}
if self._checks_positive_for_oauth(self.str_POST):
extracted = dict([ (k, v,) for k, v in self.str_POST.iteritems()
if (k.find('oauth_') >= 0) ])
return extracted
@pr... | auth_header = self.headers['authorization']
# Check that the authorization header is OAuth.
if auth_header[:6] == 'OAuth ':
auth_header = auth_header.lstrip('OAuth ')
try:
# Extract the parameters from the header.
extr... | conditional_block |
request.py | # -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
class Request(WebObRequest):
"""The OAuth version of the WebOb Request.
Provides an easier way to obtain O... | (self):
"""Simple way to get the OAuth parameters without sifting through
the entire stack of parameters.
We check the header first, because it is low hanging fruit.
However, it would be more efficient to check for the POSTed
parameters, because the specification defines the... | oauth_params | identifier_name |
set.rs | matset!(set1, &["a", "a"], "a", 0, 1);
matset!(set2, &["a", "a"], "ba", 0, 1);
matset!(set3, &["a", "b"], "a", 0);
matset!(set4, &["a", "b"], "b", 1);
matset!(set5, &["a|b", "b|a"], "b", 0, 1);
matset!(set6, &["foo", "oo"], "foo", 0, 1);
matset!(set7, &["^foo", "bar$"], "foo", 0);
matset!(set8, &["^foo", "bar$"], "foo ... | {
let set = regex_set!(&["ab", "b"]);
let text = text!("ba");
assert!(set.matches(text).matched(1));
assert!(set.matches(text).matched(1));
} | identifier_body | |
set.rs | matset!(set1, &["a", "a"], "a", 0, 1);
matset!(set2, &["a", "a"], "ba", 0, 1);
matset!(set3, &["a", "b"], "a", 0);
matset!(set4, &["a", "b"], "b", 1);
matset!(set5, &["a|b", "b|a"], "b", 0, 1);
matset!(set6, &["foo", "oo"], "foo", 0, 1);
matset!(set7, &["^foo", "bar$"], "foo", 0);
matset!(set8, &["^foo", "bar$"], "foo ... | () {
let set = regex_set!(&["ab", "b"]);
let text = text!("ba");
assert!(set.matches(text).matched(1));
assert!(set.matches(text).matched(1));
}
| regression_subsequent_matches | identifier_name |
set.rs | matset!(set1, &["a", "a"], "a", 0, 1);
matset!(set2, &["a", "a"], "ba", 0, 1);
matset!(set3, &["a", "b"], "a", 0);
matset!(set4, &["a", "b"], "b", 1);
matset!(set5, &["a|b", "b|a"], "b", 0, 1);
matset!(set6, &["foo", "oo"], "foo", 0, 1);
matset!(set7, &["^foo", "bar$"], "foo", 0);
matset!(set8, &["^foo", "bar$"], "foo ... | #[test]
fn regression_subsequent_matches() {
let set = regex_set!(&["ab", "b"]);
let text = text!("ba");
assert!(set.matches(text).matched(1));
assert!(set.matches(text).matched(1));
} | nomatset!(nset3, { let xs: &[&str] = &[]; xs }, "a");
// See: https://github.com/rust-lang-nursery/regex/issues/187 | random_line_split |
TableDialog.js | ({
insertTableTitle: "Inserir tabela",
modifyTableTitle: "Modificar tabela",
rows: "Linhas:",
columns: "Colunas:",
align: "Alinhar:",
cellPadding: "Preenchimento de células:",
cellSpacing: "Espaçamento de células:",
tableWidth: "Largura da tabela:",
backgroundColor: "Cor de segundo plano:",
borderColor: "Cor ... | insertTableColumnBeforeLabel: "Adicionar coluna antes",
insertTableColumnAfterLabel: "Adicionar coluna depois",
deleteTableRowLabel: "Eliminar linha",
deleteTableColumnLabel: "Eliminar coluna"
}) | random_line_split | |
p2p_addrfetch.py | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test p2p addr-fetch connections
"""
import time
from test_framework.messages import msg_addr, CAddress, N... | (BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
def run_test(self):
node = self.nodes[0]
self.log.info("Connect to an addr-fetch peer")
peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=0, connection_type... | P2PAddrFetch | identifier_name |
p2p_addrfetch.py | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test p2p addr-fetch connections
"""
import time
from test_framework.messages import msg_addr, CAddress, N... | msg = msg_addr()
msg.addrs = [ADDR]
peer.send_and_ping(msg)
assert_equal(len(node.getpeerinfo()), 1)
self.log.info("Check that answering with larger addr messages leads to disconnect")
msg.addrs = [ADDR] * 2
peer.send_message(msg)
peer.wait_for_disconnect... | def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
def run_test(self):
node = self.nodes[0]
self.log.info("Connect to an addr-fetch peer")
peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=0, connection_type="addr-fetch")
info =... | identifier_body |
p2p_addrfetch.py | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test p2p addr-fetch connections
"""
import time
from test_framework.messages import msg_addr, CAddress, N... | P2PAddrFetch().main() | node.setmocktime(int(time.time()) + 301) # Timeout: 5 minutes
peer.wait_for_disconnect(timeout=5)
if __name__ == '__main__': | random_line_split |
p2p_addrfetch.py | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test p2p addr-fetch connections
"""
import time
from test_framework.messages import msg_addr, CAddress, N... | P2PAddrFetch().main() | conditional_block | |
menubar.component.spec.ts | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MenubarComponent } from './menubar.component';
import { ProjectService } from '../../shared/project.service';
import { BsDropdownModule } from 'ngx-bootstrap';
import { TabsModule } from 'ngx-bootstrap';
import { ModalModule } from 'ng... | {
}
describe('MenubarComponent', () => {
let component: MenubarComponent;
let fixture: ComponentFixture<MenubarComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MenubarComponent ],
providers:[{provide:ProjectService, useValue:MockProjectService}],
imp... | MockProjectService | identifier_name |
menubar.component.spec.ts | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MenubarComponent } from './menubar.component';
import { ProjectService } from '../../shared/project.service';
import { BsDropdownModule } from 'ngx-bootstrap';
import { TabsModule } from 'ngx-bootstrap';
import { ModalModule } from 'ng... | it('should create', () => {
expect(component).toBeTruthy();
});
it('should have file menu', () => {
expect(component.menus.findIndex((val)=>val.name=='File')).toBeGreaterThan(-1);
});
it('should have file menu and childmenu openimage', () => {
expect(component.menus.find((val)=>val.name=='File')... | });
| random_line_split |
freeIntApi.js | /*
* API covering the free interfaces
*/
function freeIntApi(db) {
var colDevices = db.collection('devices');
var colLinks = db.collection('links');
var colIous = db.collection('ious');
function iouInterfaces(deviceId, cb) {
colDevices.findOne({
id : parseInt(deviceId)
}, function(err, devObj) {
if... |
if (n.target.id == parseInt(deviceId)) {
delete (intf.ethernet[n.target.name]);
delete (intf.serial[n.target.name]);
}
});
if (cb)
cb(intf); // return the free interfaces
});
});
}
function iouFreeEthInts(deviceId, cb) { // Return object with all the free eth interfaces
con... | {
delete (intf.ethernet[n.source.name]);
delete (intf.serial[n.source.name]);
} | conditional_block |
freeIntApi.js | /*
* API covering the free interfaces
*/
function freeIntApi(db) {
var colDevices = db.collection('devices');
var colLinks = db.collection('links');
var colIous = db.collection('ious');
function iouInterfaces(deviceId, cb) {
colDevices.findOne({
id : parseInt(deviceId)
}, function(err, devObj) {
if... | (deviceId, cb) { // Return object with all the free eth interfaces
console.log(arguments.callee);
iouFreeInterfaces(deviceId, function(intf) {
delete intf.serial;
if (cb)
cb(intf);
});
}
function iouFreeSerInts(deviceId, cb) { // Return object with all the free ser interfaces
console.log(arguments.... | iouFreeEthInts | identifier_name |
freeIntApi.js | /*
* API covering the free interfaces
*/
function freeIntApi(db) {
var colDevices = db.collection('devices');
var colLinks = db.collection('links');
var colIous = db.collection('ious');
function iouInterfaces(deviceId, cb) {
colDevices.findOne({
id : parseInt(deviceId)
}, function(err, devObj) {
if... |
function iouFreeSerial(deviceId, cb) { // Return the first free serial interface
console.log(arguments.callee);
iouFreeSerInts(deviceId, function(q) {
cb(Object.keys(q.serial).sort()[0]);
});
}
return {
iouInterfaces: iouInterfaces,
iouFreeInterfaces: iouFreeInterfaces,
iouFreeEthInts: iouFreeEthI... | { // Return the first free ethernet interface
console.log(arguments.callee);
iouFreeEthInts(deviceId, function(q) {
cb(Object.keys(q.ethernet).sort()[0]);
});
} | identifier_body |
freeIntApi.js | /*
* API covering the free interfaces
*/
function freeIntApi(db) {
var colDevices = db.collection('devices');
var colLinks = db.collection('links');
var colIous = db.collection('ious');
function iouInterfaces(deviceId, cb) {
colDevices.findOne({
id : parseInt(deviceId)
}, function(err, devObj) {
if... | }
function iouFreeSerInts(deviceId, cb) { // Return object with all the free ser interfaces
console.log(arguments.callee);
iouFreeInterfaces(deviceId, function(intf) {
delete intf.ethernet;
if (cb)
cb(intf);
});
}
function iouFreeEthernet(deviceId, cb) { // Return the first free ethernet interface... | iouFreeInterfaces(deviceId, function(intf) {
delete intf.serial;
if (cb)
cb(intf);
}); | random_line_split |
error_meta.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::pin::Pin;
pub struct ErrorMeta<E> {
/// Errors that were captured
pub errors: Vec<E>,
/// Extra erorrs that were obs... | (&self) -> u64 {
// NOTE: unwrap is safe since we if we have all those elements in a Vec, we're going to be
// able to fit that into a u64.
let n: u64 = self.errors.len().try_into().unwrap();
n + self.extra_error_count
}
}
pub trait ErrorMetaProvider<E> {
fn report_errors(self: ... | error_count | identifier_name |
error_meta.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::pin::Pin;
pub struct ErrorMeta<E> {
/// Errors that were captured
pub errors: Vec<E>,
/// Extra erorrs that were obs... |
pub fn one_error(e: E) -> Self {
Self {
errors: vec![e],
extra_error_count: 0,
}
}
pub fn error_count(&self) -> u64 {
// NOTE: unwrap is safe since we if we have all those elements in a Vec, we're going to be
// able to fit that into a u64.
... | {
Self {
errors: Vec::new(),
extra_error_count: 0,
}
} | identifier_body |
error_meta.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates. |
use std::pin::Pin;
pub struct ErrorMeta<E> {
/// Errors that were captured
pub errors: Vec<E>,
/// Extra erorrs that were observed but not captured.
pub extra_error_count: u64,
}
impl<E> ErrorMeta<E> {
pub fn new() -> Self {
Self {
errors: Vec::new(),
extra_error_... | *
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/ | random_line_split |
qquote.rs | // Copyright 2015 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 ... | }
let abc = quote_expr!(cx, 23);
check!(expr_to_string, abc, *quote_expr!(cx, $abc); "23");
let ty = quote_ty!(cx, isize);
check!(ty_to_string, ty, *quote_ty!(cx, $ty); "isize");
let item = quote_item!(cx, static x: $ty = 10;).unwrap();
check!(item_to_string, item, quote_item!(cx, $item).... | {
let ps = syntax::parse::new_parse_sess();
let mut cx = syntax::ext::base::ExtCtxt::new(
&ps, vec![],
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()));
cx.bt_push(syntax::codemap::ExpnInfo {
call_site: DUMMY_SP,
callee: syntax::codemap::NameAndSpan {
... | identifier_body |
qquote.rs | // Copyright 2015 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 ... | () {
let ps = syntax::parse::new_parse_sess();
let mut cx = syntax::ext::base::ExtCtxt::new(
&ps, vec![],
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()));
cx.bt_push(syntax::codemap::ExpnInfo {
call_site: DUMMY_SP,
callee: syntax::codemap::NameAndSpan {
... | main | identifier_name |
qquote.rs | // Copyright 2015 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 ... |
// ignore-cross-compile
#![feature(quote, rustc_private)]
extern crate syntax;
use syntax::codemap::DUMMY_SP;
use syntax::print::pprust::*;
fn main() {
let ps = syntax::parse::new_parse_sess();
let mut cx = syntax::ext::base::ExtCtxt::new(
&ps, vec![],
syntax::ext::expand::ExpansionConfig::... | random_line_split | |
userThread.py | #This thread handles user operations of only 1 user
#, and is connected to the matchmaking thread and to the database thread
#The list of operations is as follows:
#userType: 0 for normal, 1 for facebook
# ID | ARGUMENTS
# 0 --- User signup | userType(fb or norma... | matchQueue.put(playerToken)
print 'Send data to match making thread'
break
#now send data
dbQueue.put(data)
result = answerQueue.get()
print 'result of operation is %r' % result
if result:
replySocket.send('0\n')
else:
... | playerToken['socket'] = replySocket
#now send to matchmaking thread
print 'Send data to %s' % name
replySocket.send('0\n') | random_line_split |
userThread.py | #This thread handles user operations of only 1 user
#, and is connected to the matchmaking thread and to the database thread
#The list of operations is as follows:
#userType: 0 for normal, 1 for facebook
# ID | ARGUMENTS
# 0 --- User signup | userType(fb or norma... |
#dbQueue is for communicating with database thread
#matchQueue is for communicating with matchmaking thread
def userThread(replySocket,dbQueue,matchQueue,userType = None,userId = None,name = None,email = None):
answerQueue = Queue.Queue()
replySocket.settimeout(None)
while True:
message = replySoc... | setupSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#Listen on all interfaces
setupSocket.bind(('0.0.0.0',PORT))
setupSocket.setblocking(True)
while True:
setupSocket.settimeout(None)
setupSocket.listen(1)
print 'LISTENING'
replySocket,address = setupSock... | identifier_body |
userThread.py | #This thread handles user operations of only 1 user
#, and is connected to the matchmaking thread and to the database thread
#The list of operations is as follows:
#userType: 0 for normal, 1 for facebook
# ID | ARGUMENTS
# 0 --- User signup | userType(fb or norma... | (queueToDatabase,queueToMatchMaking,setupSocket):
#Configure server Socket
setupSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#Listen on all interfaces
setupSocket.bind(('0.0.0.0',PORT))
setupSocket.setblocking(True)
while True:
setupSocket.settimeout(None)
setu... | listener | identifier_name |
userThread.py | #This thread handles user operations of only 1 user
#, and is connected to the matchmaking thread and to the database thread
#The list of operations is as follows:
#userType: 0 for normal, 1 for facebook
# ID | ARGUMENTS
# 0 --- User signup | userType(fb or norma... |
elif args[0] == '2':
password = args[1]
data = {'operation':6,'answer':answerQueue,'name':name,'email':email,'newPass':password}
elif args[0] == '3':
email = None if args[1] == '0' else args[1]
name = None if args[2] == '0' else args[2]
data =... | data = {'operation':3,'answer':answerQueue,'id':userId} | conditional_block |
response_type.rs | use ffi;
use glib::translate::{FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut, from_glib};
use glib::value::{FromValue, FromValueOptional, SetValue};
use glib::{StaticType, Type, Value};
use gobject_ffi;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ResponseType {
None,
Reject,
Ac... | unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for ResponseType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for ResponseT... |
impl<'a> FromValueOptional<'a> for ResponseType { | random_line_split |
response_type.rs | use ffi;
use glib::translate::{FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut, from_glib};
use glib::value::{FromValue, FromValueOptional, SetValue};
use glib::{StaticType, Type, Value};
use gobject_ffi;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum | {
None,
Reject,
Accept,
DeleteEvent,
Ok,
Cancel,
Close,
Yes,
No,
Apply,
Help,
Other(u16),
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for ResponseType {
type GlibType = ffi::GtkResponseType;
fn to_glib(&self) -> ffi::GtkResponseType {
... | ResponseType | identifier_name |
response_type.rs | use ffi;
use glib::translate::{FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut, from_glib};
use glib::value::{FromValue, FromValueOptional, SetValue};
use glib::{StaticType, Type, Value};
use gobject_ffi;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ResponseType {
None,
Reject,
Ac... |
}
impl SetValue for ResponseType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
| {
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
} | identifier_body |
issue-23620-invalid-escapes.rs | // Copyright 2015 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 ... | () {
let _ = b"\u{a66e}";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u{a66e}';
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u';
//~^ ERROR incorrect unicode escape sequence
//~^^ ERROR unicode e... | main | identifier_name |
issue-23620-invalid-escapes.rs | // Copyright 2015 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 ... |
let _ = '\xxy';
//~^ ERROR invalid character in numeric character escape: x
//~^^ ERROR invalid character in numeric character escape: y
let _ = b"\u{a4a4} \xf \u";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
//~^^ ERROR invalid character in numeric charact... | {
let _ = b"\u{a66e}";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u{a66e}';
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u';
//~^ ERROR incorrect unicode escape sequence
//~^^ ERROR unicode esca... | identifier_body |
issue-23620-invalid-escapes.rs | // Copyright 2015 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 |
fn main() {
let _ = b"\u{a66e}";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u{a66e}';
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = b'\u';
//~^ ERROR incorrect unicode escape sequence
//~^^ ERROR u... | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms. | random_line_split |
comm.rs |
use serial::prelude::*;
use serial::{self, SystemPort};
use events::{EventManager, Event, EventType};
use std::sync::{Arc, Mutex};
use std::thread::{self, JoinHandle};
use std::time::Duration;
use std::io::{Read, Write};
pub struct SerialComm {
port: SystemPort,
db: Arc<Mutex<EventManager>>,
thread: Opti... |
let node_id = buffer[2];
let bat_lvl = buffer[3];
match buffer[1] {
0 => {
let is_pir = buffer[4];
let id = buffer[5];
let event = Event::new(
node_id,... | {
println!("Received garbage");
continue;
} | conditional_block |
comm.rs | use serial::prelude::*;
use serial::{self, SystemPort};
use events::{EventManager, Event, EventType};
use std::sync::{Arc, Mutex};
use std::thread::{self, JoinHandle};
use std::time::Duration;
use std::io::{Read, Write};
pub struct SerialComm {
port: SystemPort,
db: Arc<Mutex<EventManager>>,
thread: Optio... | data[5] = bitmask;
data[6] = 1;
self.port.write_all(&data).unwrap();
}
pub fn update_switch_pir_time(&mut self, device_id: u8, switch_id: u8, pir_time: u16) {
let mut data = [0; 7];
data[0] = 123;
data[1] = 2;
data[2] = device_id;
data[3] = switch... | }
} | random_line_split |
comm.rs |
use serial::prelude::*;
use serial::{self, SystemPort};
use events::{EventManager, Event, EventType};
use std::sync::{Arc, Mutex};
use std::thread::{self, JoinHandle};
use std::time::Duration;
use std::io::{Read, Write};
pub struct SerialComm {
port: SystemPort,
db: Arc<Mutex<EventManager>>,
thread: Opti... | (&mut self, device_id: u8, switch_id: u8, pir_time: u16) {
let mut data = [0; 7];
data[0] = 123;
data[1] = 2;
data[2] = device_id;
data[3] = switch_id;
data[4] = (pir_time>>8) as u8;
data[5] = (pir_time & 0xFF) as u8;
self.port.write_all(&data).unwrap();
... | update_switch_pir_time | identifier_name |
comm.rs |
use serial::prelude::*;
use serial::{self, SystemPort};
use events::{EventManager, Event, EventType};
use std::sync::{Arc, Mutex};
use std::thread::{self, JoinHandle};
use std::time::Duration;
use std::io::{Read, Write};
pub struct SerialComm {
port: SystemPort,
db: Arc<Mutex<EventManager>>,
thread: Opti... | if pir.0 == source {
bitmask |= 1<<pir.1;
}
}
data[5] = bitmask;
data[6] = 1;
self.port.write_all(&data).unwrap();
}
pub fn update_switch_pir_time(&mut self, device_id: u8, switch_id: u8, pir_time: u16) {
let mut data = [0; 7];
... | {
let mut data = [0; 7];
data[0] = 123;
data[1] = 1;
data[2] = device_id;
data[3] = switch_id;
data[4] = source;
// Button configuration
let mut bitmask = 0;
for button in buttons {
if button.0 == source {
bitmask |= 1<<... | identifier_body |
settings.py | # -*- coding: utf-8 -*-
# Scrapy settings for miner project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'miner'
SPIDER_MODULES = ['miner.spiders']
NEWSPIDER_... |
MONGODB_URI = "localhost"
MONGODB_PORT = 27017
MONGODB_DB = "HupuMiner" | } | random_line_split |
spectrometer_task.py | an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
# ============= enthought library import... | (self, scanner):
sim | _scan_event | identifier_name |
spectrometer_task.py | an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
# ============= enthought library import... | dpc = DefinePeakCenterView(detectors=dets,
isotopes=isos,
detector=dets[0],
isotope=isos[0])
info = dpc.edit_traits()
if info.result:
det = dpc.detector
isotope = dpc.... | dets = spec.detector_names
isos = spec.isotopes
| random_line_split |
spectrometer_task.py | an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
# ============= enthought library import... |
self.scan_manager.prepare_destroy()
super(SpectrometerTask, self).prepare_destroy()
# def activated(self):
# self.scan_manager.activate()
# self._scan_factory()
# super(SpectrometerTask, self).activated()
def create_dock_panes(self):
panes = [
ControlsPane(mod... | e.stop() | conditional_block |
spectrometer_task.py | .api import Any, Instance, on_trait_change
# ============= local library imports ==========================
from pychron.core.ui.gui import invoke_in_main_thread
from pychron.envisage.tasks.editor_task import EditorTask
from pychron.spectrometer.tasks.editor import PeakCenterEditor, ScanEditor, CoincidenceEditor, Sca... | sim = self.scan_manager.spectrometer.simulation
name = 'Magnet Scan (Simulation)' if sim else 'Magnet Scan'
editor = next((e for e in self.editor_area.editors if e.id == 'pychron.scanner'), None)
if editor is not None:
scanner.reset()
else:
editor = ScannerEditor... | identifier_body | |
c-variadic.rs | // ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -C no-prepopulate-passes
//
#![crate_type = "lib"]
#![feature(c_variadic)]
#![feature(c_unwind)]
#![no_std]
use core::ffi::VaList;
extern "C" {
fn foreign_c_variadic_0(_: i32, ...);
fn foreign_c_variadic_1(_: VaList, ...);
}
pub uns... | (ap: VaList) {
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
foreign_c_variadic_1(ap, 42i32);
}
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
foreign_c... | use_foreign_c_variadic_1_1 | identifier_name |
c-variadic.rs | // ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -C no-prepopulate-passes
//
#![crate_type = "lib"]
#![feature(c_variadic)]
#![feature(c_unwind)]
#![no_std]
use core::ffi::VaList;
extern "C" {
fn foreign_c_variadic_0(_: i32, ...);
fn foreign_c_variadic_1(_: VaList, ...);
}
pub uns... |
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
foreign_c_variadic_1(ap, 2i32, 42i32);
}
pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
// CHECK: call void ({{.*}}*, ...) @f... | {
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
foreign_c_variadic_1(ap, 42i32);
} | identifier_body |
c-variadic.rs | // ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -C no-prepopulate-passes
//
#![crate_type = "lib"]
#![feature(c_variadic)]
#![feature(c_unwind)]
#![no_std]
use core::ffi::VaList;
extern "C" {
fn foreign_c_variadic_0(_: i32, ...);
fn foreign_c_variadic_1(_: VaList, ...);
}
pub uns... | // defined C-variadic.
pub unsafe fn test_c_variadic_call() {
// CHECK: call [[RET:(signext )?i32]] (i32, ...) @c_variadic([[PARAM]] 0)
c_variadic(0);
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42)
c_variadic(0, 42i32);
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]... | // Ensure that we generate the correct `call` signature when calling a Rust | random_line_split |
selection-model.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Subject} from 'rxjs';
/**
* Class to be used to power selecting one or more options from a list.
*/
export... |
/** Clears out the selected values. */
private _unmarkAll() {
if (!this.isEmpty()) {
this._selection.forEach(value => this._unmarkSelected(value));
}
}
/**
* Verifies the value assignment and throws an error if the specified value array is
* including multiple values while the selection m... | {
if (this.isSelected(value)) {
this._selection.delete(value);
if (this._emitChanges) {
this._deselectedToEmit.push(value);
}
}
} | identifier_body |
selection-model.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Subject} from 'rxjs';
/**
* Class to be used to power selecting one or more options from a list.
*/
export... | (value: T) {
if (!this.isSelected(value)) {
if (!this._multiple) {
this._unmarkAll();
}
this._selection.add(value);
if (this._emitChanges) {
this._selectedToEmit.push(value);
}
}
}
/** Deselects a value. */
private _unmarkSelected(value: T) {
if (this.i... | _markSelected | identifier_name |
selection-model.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Subject} from 'rxjs';
/**
* Class to be used to power selecting one or more options from a list.
*/
export... | /** Clears out the selected values. */
private _unmarkAll() {
if (!this.isEmpty()) {
this._selection.forEach(value => this._unmarkSelected(value));
}
}
/**
* Verifies the value assignment and throws an error if the specified value array is
* including multiple values while the selection mod... | }
}
}
| random_line_split |
selection-model.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Subject} from 'rxjs';
/**
* Class to be used to power selecting one or more options from a list.
*/
export... |
}
/** Selects a value. */
private _markSelected(value: T) {
if (!this.isSelected(value)) {
if (!this._multiple) {
this._unmarkAll();
}
this._selection.add(value);
if (this._emitChanges) {
this._selectedToEmit.push(value);
}
}
}
/** Deselects a value. ... | {
this.changed.next({
source: this,
added: this._selectedToEmit,
removed: this._deselectedToEmit,
});
this._deselectedToEmit = [];
this._selectedToEmit = [];
} | conditional_block |
interfaces.ts | import { HttpClient } from './http-client';
/**
* Interceptors can process requests before they are sent, and responses
* before they are returned to callers.
*/
export interface Interceptor {
/**
* Called with the request before it is sent. Request interceptors can modify and
* return the request, or retur... | export interface RetryConfiguration {
maxRetries: number;
interval?: number;
strategy?: number| ((retryCount: number) => number);
minRandomInterval?: number;
maxRandomInterval?: number;
counter?: number;
requestClone?: Request;
doRetry?: (response: Response, request: Request) => boolean | Promise<boolea... | */
signal?: AbortSignal | null;
}
| random_line_split |
PrimaryPanes.spec.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import React from "react";
import { shallow } from "enzyme";
import { showMenu } from "devtools-contex... | (overrides = {}) {
const props = generateDefaults(overrides);
// $FlowIgnore
const component = shallow(<PrimaryPanes.WrappedComponent {...props} />);
const defaultState = component.state();
const instance = component.instance();
instance.shouldComponentUpdate = () => true;
return { component, props, def... | render | identifier_name |
PrimaryPanes.spec.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import React from "react";
import { shallow } from "enzyme";
import { showMenu } from "devtools-contex... | {
const props = generateDefaults(overrides);
// $FlowIgnore
const component = shallow(<PrimaryPanes.WrappedComponent {...props} />);
const defaultState = component.state();
const instance = component.instance();
instance.shouldComponentUpdate = () => true;
return { component, props, defaultState, instan... | identifier_body | |
PrimaryPanes.spec.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import React from "react";
import { shallow } from "enzyme";
import { showMenu } from "devtools-contex... | import { copyToTheClipboard } from "../../../utils/clipboard";
import PrimaryPanes from "..";
jest.mock("devtools-contextmenu", () => ({ showMenu: jest.fn() }));
jest.mock("../../../utils/clipboard", () => ({
copyToTheClipboard: jest.fn()
}));
describe("PrimaryPanes", () => {
afterEach(() => {
(copyToTheClipb... | random_line_split | |
regions-free-region-ordering-caller.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 ... |
fn call2<'a, 'b>(a: &'a uint, b: &'b uint) {
let z: Option<&'b &'a uint> = None;
//~^ ERROR pointer has a longer lifetime than the data it references
}
fn call3<'a, 'b>(a: &'a uint, b: &'b uint) {
let y: Paramd<'a> = Paramd { x: a };
let z: Option<&'b Paramd<'a>> = None;
//~^ ERROR pointer has a ... | {
let y: uint = 3;
let z: &'a &'blk uint = &(&y);
//~^ ERROR pointer has a longer lifetime than the data it references
} | identifier_body |
regions-free-region-ordering-caller.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 ... |
struct Paramd<'self> { x: &'self uint }
fn call1<'a>(x: &'a uint) {
let y: uint = 3;
let z: &'a &'blk uint = &(&y);
//~^ ERROR pointer has a longer lifetime than the data it references
}
fn call2<'a, 'b>(a: &'a uint, b: &'b uint) {
let z: Option<&'b &'a uint> = None;
//~^ ERROR pointer has a long... | // except according to those terms.
// Test various ways to construct a pointer with a longer lifetime
// than the thing it points at and ensure that they result in
// errors. See also regions-free-region-ordering-callee.rs | random_line_split |
regions-free-region-ordering-caller.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 ... | <'self> { x: &'self uint }
fn call1<'a>(x: &'a uint) {
let y: uint = 3;
let z: &'a &'blk uint = &(&y);
//~^ ERROR pointer has a longer lifetime than the data it references
}
fn call2<'a, 'b>(a: &'a uint, b: &'b uint) {
let z: Option<&'b &'a uint> = None;
//~^ ERROR pointer has a longer lifetime th... | Paramd | identifier_name |
backgrid.d.ts | // Type definitions for Backgrid 0.2.6
// Project: http://backgridjs.com/
// Definitions by: Jeremy Lujan <https://github.com/jlujan/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module Backgrid {
interface GridOptions {
columns: Colu... | {
cancel();
moveDown();
moveLeft();
moveRight();
moveUp();
passThru();
save();
}
interface ColumnAttr {
name: string;
cell: string;
headerCell: string;
label: string;
sortable: bool;
editable: bool;
renderable: bool;
formater: string;
}
class Column extends Backbone.Model {
initialize... | Command | identifier_name |
backgrid.d.ts | // Type definitions for Backgrid 0.2.6
// Project: http://backgridjs.com/
// Definitions by: Jeremy Lujan <https://github.com/jlujan/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module Backgrid {
interface GridOptions {
columns: Colu... | className: string;
footer: any;
header: any;
tagName: string;
initialize(options: any);
getSelectedModels(): Backbone.Model[];
insertColumn(...options: any[]): Grid;
insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
remove():Grid;
removeColumn(...options: any[]): Grid;
removeR... | render(): Body;
}
class Grid extends Backbone.View {
body: Backgrid.Body; | random_line_split |
types.ts | import { SelectableValue } from '../../../data';
import React from 'react';
export type SelectValue<T> = T | SelectableValue<T> | T[] | Array<SelectableValue<T>>;
export type InputActionMeta = {
action: 'set-value' | 'input-change' | 'input-blur' | 'menu-close';
};
export interface SelectCommonProps<T> {
/** Aria... | /** allowCustomValue must be enabled. Function decides what to do with that custom value. */
onCreateOption?: (value: string) => void;
onInputChange?: (value: string, actionMeta: InputActionMeta) => void;
onKeyDown?: (event: React.KeyboardEvent) => void;
onOpenMenu?: () => void;
openMenuOnFocus?: boolean;
... | onCloseMenu?: () => void; | random_line_split |
glyph_item_iter.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use pango_sys;
use GlyphItem;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct GlyphItemIter(Boxed<pango_sys::PangoG... | (&mut self) -> bool {
unsafe {
from_glib(pango_sys::pango_glyph_item_iter_next_cluster(
self.to_glib_none_mut().0,
))
}
}
pub fn prev_cluster(&mut self) -> bool {
unsafe {
from_glib(pango_sys::pango_glyph_item_iter_prev_cluster(
... | next_cluster | identifier_name |
glyph_item_iter.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use pango_sys;
use GlyphItem;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct GlyphItemIter(Boxed<pango_sys::PangoG... |
pub fn init_start(&mut self, glyph_item: &mut GlyphItem, text: &str) -> bool {
unsafe {
from_glib(pango_sys::pango_glyph_item_iter_init_start(
self.to_glib_none_mut().0,
glyph_item.to_glib_none_mut().0,
text.to_glib_none().0,
))
... | {
unsafe {
from_glib(pango_sys::pango_glyph_item_iter_init_end(
self.to_glib_none_mut().0,
glyph_item.to_glib_none_mut().0,
text.to_glib_none().0,
))
}
} | identifier_body |
glyph_item_iter.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use pango_sys;
use GlyphItem;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct GlyphItemIter(Boxed<pango_sys::PangoG... | ))
}
}
pub fn init_start(&mut self, glyph_item: &mut GlyphItem, text: &str) -> bool {
unsafe {
from_glib(pango_sys::pango_glyph_item_iter_init_start(
self.to_glib_none_mut().0,
glyph_item.to_glib_none_mut().0,
text.to_glib_... | from_glib(pango_sys::pango_glyph_item_iter_init_end(
self.to_glib_none_mut().0,
glyph_item.to_glib_none_mut().0,
text.to_glib_none().0, | random_line_split |
pendulum-banner-element.ts | interface MessageOptions {
delay?: number;
}
class PendulumBannerElement extends HTMLElement {
private timeoutID: number | null = null;
connectedCallback() {
this.classList.add('pendulum-banner');
this.displayMessage = this.displayMessage.bind(this);
}
disconnectedCallback() {
if (typeof this.t... | (message: string | null, options: MessageOptions = {}) {
if (typeof this.timeoutID === 'number') {
clearTimeout(this.timeoutID);
}
if (!message) {
this.classList.remove('pendulum-banner--open');
return;
}
if (options.delay) {
this.timeoutID = window.setTimeout(() => {
... | sendMessage | identifier_name |
pendulum-banner-element.ts | interface MessageOptions {
delay?: number;
}
class PendulumBannerElement extends HTMLElement {
private timeoutID: number | null = null;
connectedCallback() {
this.classList.add('pendulum-banner');
this.displayMessage = this.displayMessage.bind(this);
}
| }
}
sendMessage(message: string | null, options: MessageOptions = {}) {
if (typeof this.timeoutID === 'number') {
clearTimeout(this.timeoutID);
}
if (!message) {
this.classList.remove('pendulum-banner--open');
return;
}
if (options.delay) {
this.timeoutID = window.... | disconnectedCallback() {
if (typeof this.timeoutID === 'number') {
clearTimeout(this.timeoutID); | random_line_split |
pendulum-banner-element.ts | interface MessageOptions {
delay?: number;
}
class PendulumBannerElement extends HTMLElement {
private timeoutID: number | null = null;
connectedCallback() {
this.classList.add('pendulum-banner');
this.displayMessage = this.displayMessage.bind(this);
}
disconnectedCallback() {
if (typeof this.t... |
if (!message) {
this.classList.remove('pendulum-banner--open');
return;
}
if (options.delay) {
this.timeoutID = window.setTimeout(() => {
this.displayMessage(message);
}, options.delay);
} else {
this.displayMessage(message);
}
}
private displayMessage(m... | {
clearTimeout(this.timeoutID);
} | conditional_block |
pendulum-banner-element.ts | interface MessageOptions {
delay?: number;
}
class PendulumBannerElement extends HTMLElement {
private timeoutID: number | null = null;
connectedCallback() |
disconnectedCallback() {
if (typeof this.timeoutID === 'number') {
clearTimeout(this.timeoutID);
}
}
sendMessage(message: string | null, options: MessageOptions = {}) {
if (typeof this.timeoutID === 'number') {
clearTimeout(this.timeoutID);
}
if (!message) {
this.classLis... | {
this.classList.add('pendulum-banner');
this.displayMessage = this.displayMessage.bind(this);
} | identifier_body |
setup.py | from setuptools import setup, find_packages
setup(
name="gevent-websocket",
version="0.3.6",
description="Websocket handler for the gevent pywsgi server, a Python network library",
long_description=open("README.rst").read(),
author="Jeffrey Gelens",
author_email="jeffrey@noppo.pro",
license... | "Operating System :: POSIX",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers",
],
) | "Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Operating System :: MacOS :: MacOS X", | random_line_split |
includer.js | const log = require('app/lib/core/log')
module.exports = config => props => {
const [
pluginName,
pluginPath,
pluginExports
] = props
log.trace(`Initialzing includer: ${log.ul(pluginPath)}.`)
const exports = {}
exports.name = pluginExports.name || pluginName
exports.options = pluginExports.options
exp... | })
return exports
} | random_line_split | |
includer.js | const log = require('app/lib/core/log')
module.exports = config => props => {
const [
pluginName,
pluginPath,
pluginExports
] = props
log.trace(`Initialzing includer: ${log.ul(pluginPath)}.`)
const exports = {}
exports.name = pluginExports.name || pluginName
exports.options = pluginExports.options
exp... |
resolve(exports)
})
return exports
}
| {
const msg = `Could not configure includer: ${pluginName}.`
log.error(msg)
// return reject(msg)
resolve(exports)
} | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.