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
rsqrt.rs
#![feature(cfg_target_feature, link_llvm_intrinsics, platform_intrinsics, simd_ffi, test)] extern crate hagane_simd; extern crate test; use hagane_simd::*; use test::*; #[cfg(target_feature = "sse")] extern "platform-intrinsic" { fn x86_mm_sqrt_ps(x: float4) -> float4; fn x86_mm_rsqrt_ps(x: float4) -> float4; } ...
(b: &mut Bencher) { let n = black_box(float4(1.0, 3.0, 5.0, 7.0)); b.iter(|| { let mut sum = n; for _ in 0 .. 10000 { let sqrt = unsafe { x86_mm_sqrt_ps(sum) }; sum = sum + 1.0 / sqrt; } sum }); } #[cfg(target_feature = "sse")] #[bench] fn bench_intel_rsqrt(b: &mut Bencher) { le...
bench_sqrt_plus_div
identifier_name
rsqrt.rs
#![feature(cfg_target_feature, link_llvm_intrinsics, platform_intrinsics, simd_ffi, test)] extern crate hagane_simd; extern crate test; use hagane_simd::*; use test::*; #[cfg(target_feature = "sse")] extern "platform-intrinsic" { fn x86_mm_sqrt_ps(x: float4) -> float4; fn x86_mm_rsqrt_ps(x: float4) -> float4; } ...
fn bench_apple_rsqrt(b: &mut Bencher) { let n = black_box(float4(1.0, 3.0, 5.0, 7.0)); b.iter(|| { let mut sum = n; for _ in 0 .. 10000 { let r = unsafe { x86_mm_rsqrt_ps(sum) }; let r = r * (1.5 - 0.5 * sum.eq(float4::broadcast(0.0)).bitselect(sum, float4::broadcast(-std::f32::INFINITY)) * r ...
#[bench]
random_line_split
rsqrt.rs
#![feature(cfg_target_feature, link_llvm_intrinsics, platform_intrinsics, simd_ffi, test)] extern crate hagane_simd; extern crate test; use hagane_simd::*; use test::*; #[cfg(target_feature = "sse")] extern "platform-intrinsic" { fn x86_mm_sqrt_ps(x: float4) -> float4; fn x86_mm_rsqrt_ps(x: float4) -> float4; } ...
#[cfg(target_feature = "sse")] #[bench] fn bench_apple_rsqrt(b: &mut Bencher) { let n = black_box(float4(1.0, 3.0, 5.0, 7.0)); b.iter(|| { let mut sum = n; for _ in 0 .. 10000 { let r = unsafe { x86_mm_rsqrt_ps(sum) }; let r = r * (1.5 - 0.5 * sum.eq(float4::broadcast(0.0)).bitselect(sum, fl...
{ let n = black_box(float4(1.0, 3.0, 5.0, 7.0)); b.iter(|| { let mut sum = n; for _ in 0 .. 10000 { let r = unsafe { x86_mm_rsqrt_ps(sum) }; sum = sum - 0.5 * (r * (3.0 - r * r * sum)); } sum }); }
identifier_body
test_dynamodb_consumedcapacity.py
import boto3 import pytest import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 @mock_dynamodb2 def test_error_on_wrong_value_for_consumed_capacity(): resource = boto3.resource("dynamodb", region_name="ap-northeast-3") client = boto3....
response.shouldnt.have.key("ConsumedCapacity")
) else:
random_line_split
test_dynamodb_consumedcapacity.py
import boto3 import pytest import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 @mock_dynamodb2 def
(): resource = boto3.resource("dynamodb", region_name="ap-northeast-3") client = boto3.client("dynamodb", region_name="ap-northeast-3") client.create_table( TableName="jobs", KeySchema=[{"AttributeName": "job_id", "KeyType": "HASH"}], AttributeDefinitions=[{"AttributeName": "job_id",...
test_error_on_wrong_value_for_consumed_capacity
identifier_name
test_dynamodb_consumedcapacity.py
import boto3 import pytest import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 @mock_dynamodb2 def test_error_on_wrong_value_for_consumed_capacity(): resource = boto3.resource("dynamodb", region_name="ap-northeast-3") client = boto3....
response = client.query(**args) validate_response(response, should_have_capacity, should_have_table) # QUERY_INDEX args["IndexName"] = "job_name-index" response = client.query(**args) validate_response(response, should_have_capacity, should_have_table, is_index=True) def validate_response( ...
args["ReturnConsumedCapacity"] = capacity
conditional_block
test_dynamodb_consumedcapacity.py
import boto3 import pytest import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 @mock_dynamodb2 def test_error_on_wrong_value_for_consumed_capacity(): resource = boto3.resource("dynamodb", region_name="ap-northeast-3") client = boto3....
@mock_dynamodb2 @pytest.mark.parametrize( "capacity,should_have_capacity,should_have_table", [ [None, False, False], ["NONE", False, False], ["TOTAL", True, False], ["INDEXES", True, True], ], ) def test_only_return_consumed_capacity_when_required( capacity, should_hav...
conn = boto3.client("dynamodb", region_name="us-east-1") conn.create_table( TableName="test_table", KeySchema=[{"AttributeName": "u", "KeyType": "HASH"}], AttributeDefinitions=[{"AttributeName": "u", "AttributeType": "S"}], BillingMode="PAY_PER_REQUEST", ) response = conn.get...
identifier_body
mariaDBManagementClient.d.ts
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ i...
* * @param {object} [options] - The parameter options * * @param {Array} [options.filters] - Filters to be added to the request pipeline * * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Optio...
* @param {credentials} credentials - Credentials needed for the client to connect to Azure. * * @param {string} subscriptionId - The subscription ID that identifies an Azure subscription. * * @param {string} [baseUri] - The base URI of the service.
random_line_split
mariaDBManagementClient.d.ts
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ i...
extends AzureServiceClient { /** * Initializes a new instance of the MariaDBManagementClient class. * @constructor * * @class * @param {credentials} credentials - Credentials needed for the client to connect to Azure. * * @param {string} subscriptionId - The subscription ID that identifies an Az...
MariaDBManagementClient
identifier_name
flat.rs
// 書き換えたがLexerと同様の構造にするのが難しそうだったので一旦保留 /* #[derive(Eq, PartialEq, Clone, Debug)] enum State { Aexp, WaitOtag, Error(String),
/* fn parse_flat() { loop { let s = self.state.clone(); let t = self.current_token.borrow().clone(); println!("parser state: {:?} token: {:?}", s, t); match s { State::Aexp => { match t { CurrentToken::SOT => { ...
} */
random_line_split
popup.py
._key_entries(x[1].lower().find(lpart))) if lpart == '..': newdirs.append(d.get_parent()) for dd in newdirs: found.extend(self.do_search_dir(parts[1:], dd)) return found def _replace_insensitive(self, s, find, rep): out = '' l = s.lower() f...
do_configure_event
identifier_name
popup.py
._dirs.append(path) unique.append(path.get_uri()) def get_final_size(self):
def _build_ui(self): self.set_border_width(5) vbox = self.get_content_area() vbox.set_spacing(3) self._entry = Gtk.SearchEntry() self._entry.connect('changed', self.on_changed) self._entry.connect('key-press-event', self.on_key_press_event) sw = Gtk.Scrol...
return self._size
identifier_body
popup.py
._dirs.append(path) unique.append(path.get_uri()) def get_final_size(self): return self._size def _build_ui(self): self.set_border_width(5) vbox = self.get_content_area() vbox.set_spacing(3) self._entry = Gtk.SearchEntry() self._entry.connect('...
def do_search(self): self._set_busy(True) self._remove_cursor() text = self._entry.get_text().strip() self._clear_store() if text == '': self._show_virtuals() else: parts = self.normalize_relative(text.split(os.sep)) files = [] ...
path = self._cursor.get_path() self._cursor = None self._store.row_changed(path, self._store.get_iter(path))
conditional_block
popup.py
._dirs.append(path) unique.append(path.get_uri()) def get_final_size(self): return self._size def _build_ui(self): self.set_border_width(5) vbox = self.get_content_area() vbox.set_spacing(3) self._entry = Gtk.SearchEntry() self._entry.connect('...
entries.append((gfile.get_child(entry.get_name()), entry)) else: entries = ret children = [] for entry in entries: children.append((entry[0], entry[1].get_name(), entry[1].get_file_type(), ...
break if not entry.get_is_backup():
random_line_split
dependency-checker.ts
/// <reference path="../inc.d.ts" /> module SpeedShifter.Services { export interface IDepCheckerOptions { expires?: number; // expiration time in ms dependent?: string[]; // dependencies, array of strings } export interface IDepCheckerDepend { name: string; value: any; comparator?: (item1: any, item2: an...
} return false; } composeDeps (dep: string[]): {[prop: string]: any} { if (dep && dep.length > 0) { var result = <{[prop: string]: any}>{}, i, depend, c = 0; for (i=0; i<dep.length; i++) { depend = this.getDepend(dep[i]); if (depend) { result[dep[i]] = depend.value; ...
{ // dependency is required, depStorages doesn't contains it, or vals doesn't so return true; }
conditional_block
dependency-checker.ts
/// <reference path="../inc.d.ts" /> module SpeedShifter.Services { export interface IDepCheckerOptions { expires?: number; // expiration time in ms dependent?: string[]; // dependencies, array of strings } export interface IDepCheckerDepend { name: string; value: any; comparator?: (item1: any, item2: an...
() { delete this.storage; this.storage = {}; } setDependenceVal(name:string, val:any) { if (!name) return; this.storage[name] = angular.extend(this.storage[name] || {}, <ILocalStorageDepend> { name: name, value: val }); } static compare(dep: IDepCheckerDepend, val) { return dep ...
clear
identifier_name
dependency-checker.ts
/// <reference path="../inc.d.ts" /> module SpeedShifter.Services { export interface IDepCheckerOptions { expires?: number; // expiration time in ms dependent?: string[]; // dependencies, array of strings } export interface IDepCheckerDepend { name: string; value: any; comparator?: (item1: any, item2: an...
} } return null; } isDependentFailed (vals: {[name: string]: any}, deps: string[]) { if (!deps || deps.length == 0) return false; if (!vals) return true; var i, name, depend; for (i=0; i<deps.length; i++) { depend = this.getDepend(deps[i]); if (!depend || angular.is...
var global = this.global, i, dep; for (i=global.length-1; i>=0; i--) { dep = global[i].getDepend(name); if (dep) return dep;
random_line_split
dependency-checker.ts
/// <reference path="../inc.d.ts" /> module SpeedShifter.Services { export interface IDepCheckerOptions { expires?: number; // expiration time in ms dependent?: string[]; // dependencies, array of strings } export interface IDepCheckerDepend { name: string; value: any; comparator?: (item1: any, item2: an...
appendGlobals (...globals: DepStorage[]) { return this.global = (this.global || []).concat(globals); } prependGlobals (...globals: DepStorage[]) { return this.global = (globals).concat(this.global || []); } clearGlobals () { delete this.global; } getGlobals () { return this.global || []; } ...
{ this.global = globals; }
identifier_body
port_status_update.py
# Copyright (c) 2017 OpenStack Foundation # 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 ...
def stop(self): if self.odl_websocket_client: self.odl_websocket_client.set_exit_flag() def wait(self): """Wait for service to complete.""" @staticmethod def reset(): pass def run_websocket(self): # OpenDaylight path to recieve websocket notifications...
super(OdlPortStatusUpdate, self).start() LOG.debug('OdlPortStatusUpdate worker running') if odl_features.has(odl_features.OPERATIONAL_PORT_STATUS): self.run_websocket()
identifier_body
port_status_update.py
# Copyright (c) 2017 OpenStack Foundation # 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 ...
client = odl_client.OpenDaylightRestClient.create_client( url=port_fetch_url) for port in ports: port_id = port["id"] response = client.get(port_id) if response.status_code != 200: LOG.warning("Non-200 response code %s", str(response)) ...
port_fetch_url = utils.get_odl_url(self.PORT_PATH)
random_line_split
port_status_update.py
# Copyright (c) 2017 OpenStack Foundation # 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 ...
odl_status = response.json()['port'][0]['status'] if odl_status == n_const.PORT_STATUS_ACTIVE: # for now we only support transition from DOWN->ACTIVE # See https://bugs.launchpad.net/networking-odl/+bug/1686023 provisioning_blocks.provisioning_com...
LOG.warning("Non-200 response code %s", str(response)) continue
conditional_block
port_status_update.py
# Copyright (c) 2017 OpenStack Foundation # 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 ...
(self): LOG.debug("starting to pull pending statuses...") plugin = directory.get_plugin() filter = {"status": [n_const.PORT_STATUS_DOWN], "vif_type": ["unbound"]} ports = plugin.get_ports(context.get_admin_context(), filter) if not ports: LOG.debug(...
_pull_missed_statuses
identifier_name
world-population-visualizer.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { FormsModule } from '@angular/forms';
import { MaterialAppModule } from '../../../modules/material/material-app.module'; import { RouterTestingModule } from '@angular/router/testing'; import { WorldPopulationVisualizerComponent } from './world-population-visualizer.component'; describe('WorldPopulationVisualizerComponent', () => { let component: WorldP...
random_line_split
options.js
// Copyright (c) 2014 The Chromebleed Contributors. All rights reserved. /* Grays out or [whatever the opposite of graying out is called] the option field. */ function ghost(isDeactivated) { options.style.color = isDeactivated ? 'graytext' : 'black'; // The label color. } window.addEventListener('load', fu...
// Set the display activation options.isActivated.onchange = function() { localStorage.isActivated = options.isActivated.checked; ghost(!options.isActivated.checked); console.log("isActivated:" + options.isActivated.checked); //Visual icon for on Activated. var...
{ ghost(true); }
conditional_block
options.js
// Copyright (c) 2014 The Chromebleed Contributors. All rights reserved. /* Grays out or [whatever the opposite of graying out is called] the option field. */ function ghost(isDeactivated) { options.style.color = isDeactivated ? 'graytext' : 'black'; // The label color. } window.addEventListener('load', fu...
//Set the version var name = chrome.app.getDetails().name; var nameversion = name + ' (' + chrome.app.getDetails().version + ')'; document.getElementById("runningversion").innerHTML = nameversion; document.getElementById("runningname").innerHTML = name; });
alert('Cached Sites Cleared!'); //console.log(" Cached Sites after clear:" + JSON.stringify(cachedSites) + JSON.stringify(cachedBleedSites)); };
random_line_split
options.js
// Copyright (c) 2014 The Chromebleed Contributors. All rights reserved. /* Grays out or [whatever the opposite of graying out is called] the option field. */ function ghost(isDeactivated)
window.addEventListener('load', function() { // Initialize the option controls. options.isActivated.checked = JSON.parse(localStorage.isActivated); options.isShowingAll.checked = JSON.parse(localStorage.isShowingAll); options.isShowOnGoogle.checked = JSON.parse(localStorage.isShowOnGoogle); if (!...
{ options.style.color = isDeactivated ? 'graytext' : 'black'; // The label color. }
identifier_body
options.js
// Copyright (c) 2014 The Chromebleed Contributors. All rights reserved. /* Grays out or [whatever the opposite of graying out is called] the option field. */ function
(isDeactivated) { options.style.color = isDeactivated ? 'graytext' : 'black'; // The label color. } window.addEventListener('load', function() { // Initialize the option controls. options.isActivated.checked = JSON.parse(localStorage.isActivated); options.isShowingAll.checked = JSON.parse(localStor...
ghost
identifier_name
store.js
/**** MarketPress Checkout JS *********/ jQuery(document).ready(function($) { //coupon codes $('#coupon-link').click(function() { $('#coupon-link').hide(); $('#coupon-code').show(); $('#coupon_code').focus(); return false; }); //payment method choice $('input.mp_choose_gatewa...
() { $("#mp-shipping-select-holder").html('<img src="'+MP_Ajax.imgUrl+'" alt="Loading..." />'); var serializedForm = $('form#mp_shipping_form').serialize(); $.post(MP_Ajax.ajaxUrl, serializedForm, function(data) { $("#mp-shipping-select-holder").html(data); }); } });
mp_refresh_shipping
identifier_name
store.js
/**** MarketPress Checkout JS *********/ jQuery(document).ready(function($) { //coupon codes $('#coupon-link').click(function() { $('#coupon-link').hide(); $('#coupon-code').show(); $('#coupon_code').focus(); return false; });
var gid = $('input.mp_choose_gateway:checked').val(); $('div.mp_gateway_form').hide(); $('div#' + gid).show(); }); //province field choice $('#mp_country').change(function() { $("#mp_province_field").html('<img src="'+MP_Ajax.imgUrl+'" alt="Loading..." />'); var country = $(this).val(...
//payment method choice $('input.mp_choose_gateway').change(function() {
random_line_split
store.js
/**** MarketPress Checkout JS *********/ jQuery(document).ready(function($) { //coupon codes $('#coupon-link').click(function() { $('#coupon-link').hide(); $('#coupon-code').show(); $('#coupon_code').focus(); return false; }); //payment method choice $('input.mp_choose_gatewa...
});
{ $("#mp-shipping-select-holder").html('<img src="'+MP_Ajax.imgUrl+'" alt="Loading..." />'); var serializedForm = $('form#mp_shipping_form').serialize(); $.post(MP_Ajax.ajaxUrl, serializedForm, function(data) { $("#mp-shipping-select-holder").html(data); }); }
identifier_body
SyncDisabledTwoTone.js
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon';
, 'SyncDisabledTwoTone');
export default createSvgIcon( <path d="M10 6.35V4.26c-.66.17-1.29.43-1.88.75l1.5 1.5c.13-.05.25-.11.38-.16zM20 12c0-2.21-.91-4.2-2.36-5.64L20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 .85-.19 1.65-.51 2.38l1.5 1.5C19.63 14.74 20 13.41 20 12zM4.27 4L2.86 5.41l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.6...
random_line_split
useToggle.ts
import { Dispatch, SetStateAction, useCallback, useState } from "react"; import { useRefCache } from "./useRefCache"; type Enable = () => void; type Disable = () => void; type Toggle = () => void; type SetToggle = Dispatch<SetStateAction<boolean>>; type ReturnValue = [boolean, Enable, Disable, Toggle, SetToggle]; /...
// disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const toggle = useCallback(() => { setToggled((prevVisible) => !prevVisible); }, []); return [toggled, enable, disable, toggle, setToggled]; }
setToggled(false); }
random_line_split
useToggle.ts
import { Dispatch, SetStateAction, useCallback, useState } from "react"; import { useRefCache } from "./useRefCache"; type Enable = () => void; type Disable = () => void; type Toggle = () => void; type SetToggle = Dispatch<SetStateAction<boolean>>; type ReturnValue = [boolean, Enable, Disable, Toggle, SetToggle]; /...
setToggled((prevVisible) => !prevVisible); }, []); return [toggled, enable, disable, toggle, setToggled]; }
{ const [toggled, setToggled] = useState(defaultToggled); const previous = useRefCache(toggled); const enable = useCallback(() => { if (!previous.current) { setToggled(true); } // disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const disable = ...
identifier_body
useToggle.ts
import { Dispatch, SetStateAction, useCallback, useState } from "react"; import { useRefCache } from "./useRefCache"; type Enable = () => void; type Disable = () => void; type Toggle = () => void; type SetToggle = Dispatch<SetStateAction<boolean>>; type ReturnValue = [boolean, Enable, Disable, Toggle, SetToggle]; /...
// disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const toggle = useCallback(() => { setToggled((prevVisible) => !prevVisible); }, []); return [toggled, enable, disable, toggle, setToggled]; }
{ setToggled(false); }
conditional_block
useToggle.ts
import { Dispatch, SetStateAction, useCallback, useState } from "react"; import { useRefCache } from "./useRefCache"; type Enable = () => void; type Disable = () => void; type Toggle = () => void; type SetToggle = Dispatch<SetStateAction<boolean>>; type ReturnValue = [boolean, Enable, Disable, Toggle, SetToggle]; /...
( defaultToggled: boolean | (() => boolean) ): ReturnValue { const [toggled, setToggled] = useState(defaultToggled); const previous = useRefCache(toggled); const enable = useCallback(() => { if (!previous.current) { setToggled(true); } // disabled since useRefCache // eslint-disable-next-...
useToggle
identifier_name
hidecm.rs
extern crate usbg; use std::path::PathBuf; use std::fs; use usbg::UsbGadget; use usbg::UsbGadgetState; use usbg::UsbGadgetFunction; use usbg::UsbGadgetConfig; use usbg::hid; use usbg::ecm; fn
() { // general setup let mut g1 = UsbGadget::new("g1", 0x1d6b, // Linux Foundation 0x0104, // Multifunction Composite Gadget usbg::LANGID_EN_US, // LANGID English "USB Armory", ...
main
identifier_name
hidecm.rs
extern crate usbg; use std::path::PathBuf; use std::fs; use usbg::UsbGadget; use usbg::UsbGadgetState; use usbg::UsbGadgetFunction; use usbg::UsbGadgetConfig; use usbg::hid; use usbg::ecm; fn main()
// add HID keyboard let hid_function = Box::new(hid::HIDFunction { instance_name: "usb0", protocol: hid::HID_PROTOCOL_KEYBOARD, subclass: hid::HID_SUBCLASS_BOOT, report...
{ // general setup let mut g1 = UsbGadget::new("g1", 0x1d6b, // Linux Foundation 0x0104, // Multifunction Composite Gadget usbg::LANGID_EN_US, // LANGID English "USB Armory", ...
identifier_body
hidecm.rs
extern crate usbg; use std::path::PathBuf;
use usbg::UsbGadget; use usbg::UsbGadgetState; use usbg::UsbGadgetFunction; use usbg::UsbGadgetConfig; use usbg::hid; use usbg::ecm; fn main() { // general setup let mut g1 = UsbGadget::new("g1", 0x1d6b, // Linux Foundation 0x0104, // Multifuncti...
use std::fs;
random_line_split
traits-negative-impls.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 ...
struct TestType; impl !Send for TestType {} is_send(TestType); //~^ ERROR `dummy1b::TestType` cannot be sent between threads safely } fn dummy1c() { struct TestType; impl !Send for TestType {} is_send((8, TestType)); //~^ ERROR `dummy1c::TestType` cannot be sent between threads safely...
//~| ERROR `dummy::TestType` cannot be sent between threads safely } fn dummy1b() {
random_line_split
traits-negative-impls.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 ...
() { struct TestType; impl !Send for TestType {} // This will complain about a missing Send impl because `Sync` is implement *just* // for T that are `Send`. Look at #20366 and #19950 is_sync(Outer2(TestType)); //~^ ERROR `main::TestType` cannot be sent between threads safely }
main
identifier_name
recent_chooser_dialog.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 Bin; use Buildable; use Container;
use Window; use ffi; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::mem; use std::ptr; glib_wrapper! { pub struct RecentChooserDialog(Object<ffi::GtkRecentChooserDialog, ffi::GtkRecentChooserDialogClass>): Dialog, Window, Bin, Container, Widget, Buildable, RecentChooser; match fn { ge...
use Dialog; use RecentChooser; use Widget;
random_line_split
ReduxScreen.tsx
import React from 'react'; import { Platform, View, StyleSheet, Image } from 'react-native'; import { Provider } from 'react-redux'; import { ReduxNetworkProvider } from 'react-native-offline'; import ConnectionToggler from '../components/ConnectionToggler'; import DummyNetworkContext from '../DummyNetworkContext'; im...
android: { elevation: 20, }, }), backgroundColor: '#fbfbfb', paddingTop: 10, }, });
shadowColor: 'black', shadowOffset: { height: -3, width: 1 }, shadowOpacity: 0.1, shadowRadius: 3, },
random_line_split
linereport_test.js
if (typeof process !== "undefined") { require("amd-loader"); require("../../test/setup_paths"); } define(function(require, exports, module) { var assert = require("assert"); var report = require("./linereport_base"); module.exports = { "test parse line" : function(next) { var results = repor...
var results = report.parseOutput("1:1: line 1\n1:2: line 2"); assert.equal(results.length, 2); next(); }, "test ignore lines" : function(next) { var results = report.parseOutput("1:1: line 1\n1:2: line 2\bmove zig"); assert.equal(results.length, 2); next(); ...
}, "test parse two lines" : function(next) {
random_line_split
linereport_test.js
if (typeof process !== "undefined")
define(function(require, exports, module) { var assert = require("assert"); var report = require("./linereport_base"); module.exports = { "test parse line" : function(next) { var results = report.parseOutput("1:2: 3"); console.log(results[0]); assert.equal(results[0].pos.sl, 0); ...
{ require("amd-loader"); require("../../test/setup_paths"); }
conditional_block
race_generated.rs
// automatically generated by the FlatBuffers compiler, do not modify extern crate flatbuffers; use std::mem; use std::cmp::Ordering; use self::flatbuffers::{EndianScalar, Follow}; use super::*; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub cons...
} impl flatbuffers::Push for Race { type Output = Race; #[inline] fn push(&self, dst: &mut [u8], _rest: &[u8]) { unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); } } } impl flatbuffers::EndianScalar for Race { #[inline] fn to_little_endian(self) -> Self { let b = i8::to_le(sel...
{ let b = unsafe { flatbuffers::read_scalar_at::<i8>(buf, loc) }; Self(b) }
identifier_body
race_generated.rs
// automatically generated by the FlatBuffers compiler, do not modify extern crate flatbuffers; use std::mem; use std::cmp::Ordering; use self::flatbuffers::{EndianScalar, Follow}; use super::*; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub cons...
(pub i8); #[allow(non_upper_case_globals)] impl Race { pub const None: Self = Self(-1); pub const Human: Self = Self(0); pub const Dwarf: Self = Self(1); pub const Elf: Self = Self(2); pub const ENUM_MIN: i8 = -1; pub const ENUM_MAX: i8 = 2; pub const ENUM_VALUES: &'static [Self] = &[ Self::None, ...
Race
identifier_name
race_generated.rs
// automatically generated by the FlatBuffers compiler, do not modify extern crate flatbuffers; use std::mem; use std::cmp::Ordering; use self::flatbuffers::{EndianScalar, Follow}; use super::*; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub cons...
pub const ENUM_VALUES_RACE: [Race; 4] = [ Race::None, Race::Human, Race::Dwarf, Race::Elf, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[repr(transparent)] pub struct Race(pub i8); #[allow(non_upper_case_globals)] impl Race { pub const None: Self = Self(-1); pub const Human: Se...
pub const ENUM_MAX_RACE: i8 = 2; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[allow(non_camel_case_types)]
random_line_split
hw_wallet.py
#!/usr/bin/env python2 # -*- mode: python -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2016 The Electrum developers # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without...
# When creating a wallet we need to ask the device for the # master public key xpub = self.get_public_key(derivation) return xpub, None def i4b(self, x): return pack('>I', x)
return BIP44_wallet.derive_xkeys(self, root, derivation, password)
conditional_block
hw_wallet.py
#!/usr/bin/env python2 # -*- mode: python -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2016 The Electrum developers # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without...
(self): '''A device paired with the wallet was diconnected. This can be called in any thread context.''' self.print_error("unpaired") def paired(self): '''A device paired with the wallet was (re-)connected. This can be called in any thread context.''' self.print_er...
unpaired
identifier_name
hw_wallet.py
#!/usr/bin/env python2 # -*- mode: python -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2016 The Electrum developers # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without...
return False def is_watching_only(self): '''The wallet is not watching-only; the user will be prompted for pin and passphrase as appropriate when needed.''' assert not self.has_seed() return False def can_change_password(self): return False def get_client(s...
random_line_split
hw_wallet.py
#!/usr/bin/env python2 # -*- mode: python -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2016 The Electrum developers # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without...
def paired(self): '''A device paired with the wallet was (re-)connected. This can be called in any thread context.''' self.print_error("paired") def get_action(self): pass def can_create_accounts(self): return True def can_export(self): return False ...
'''A BIP44 hardware wallet base class.''' # Derived classes must set: # - device # - DEVICE_IDS # - wallet_type restore_wallet_class = BIP44_Wallet max_change_outputs = 1 def __init__(self, storage): BIP44_Wallet.__init__(self, storage) # Errors and other user interac...
identifier_body
histogram.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
self.flush() self.__cursor.execute( '''SELECT hour, value FROM histogram WHERE histogram = ? AND run = ? ORDER BY hour ASC;''', (self.__name, run)) transposed = {} for timestamp, intervals in ite...
run = self.runs
conditional_block
histogram.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
WHERE histogram = ? AND run = ? ORDER BY hour ASC;''', (self.__name, run)) dct = {i: numpy.ascontiguousarray([i[1] for i in g]) for i, g in itertools.groupby( self.__cursor.fetchall(), operator.itemgetter(0))} ...
'''SELECT hour, value FROM histogram
random_line_split
histogram.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
def get_all_hourly_percentiles( self, percentile: float, run: int = None) -> typing.List[float]: """Gets all the summaries per hour.""" if run is None: run = self.runs percentiles = [] for hist in self.get_all_hourly_histograms(run): try: ...
"""Returns all the histogram values.""" return numpy.asarray([i for _, i in self.get_all_events(cid, run)])
identifier_body
histogram.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
(self, run: int = None): """Returns all the intervals per hour.""" if run is None: run = self.runs self.flush() self.__cursor.execute( '''SELECT hour, value FROM histogram WHERE histogram = ? AND run = ? ...
get_all_hourly_distributions
identifier_name
text.py
BREADABILITY_AVAILABLE = True try: from breadability.readable import Article, prep_article, check_siblings except ImportError: BREADABILITY_AVAILABLE = False Article = object from operator import attrgetter from werkzeug.utils import cached_property import re from lxml.etree import tounicode, tostring ...
text = re.sub(whitespace, replacement, text) return text def slice(self, before=1, reverse=True): if self.candidates: # cleanup by removing the should_drop we spotted. [n.drop_tree() for n in self._should_drop if n.getparent() is not None] ...
def stripped(self, text): for replacement, whitespace in self.WHITESPACE.items():
random_line_split
text.py
BREADABILITY_AVAILABLE = True try: from breadability.readable import Article, prep_article, check_siblings except ImportError: BREADABILITY_AVAILABLE = False Article = object from operator import attrgetter from werkzeug.utils import cached_property import re from lxml.etree import tounicode, tostring ...
(self, text): for replacement, whitespace in self.WHITESPACE.items(): text = re.sub(whitespace, replacement, text) return text def slice(self, before=1, reverse=True): if self.candidates: # cleanup by removing the should_drop we spotted. [n.drop_tree() fo...
stripped
identifier_name
text.py
BREADABILITY_AVAILABLE = True try: from breadability.readable import Article, prep_article, check_siblings except ImportError: BREADABILITY_AVAILABLE = False Article = object from operator import attrgetter from werkzeug.utils import cached_property import re from lxml.etree import tounicode, tostring ...
def stripped(self, text): for replacement, whitespace in self.WHITESPACE.items(): text = re.sub(whitespace, replacement, text) return text def slice(self, before=1, reverse=True): if self.candidates: # cleanup by removing the should_drop we spotted. ...
return self.winner()
identifier_body
text.py
BREADABILITY_AVAILABLE = True try: from breadability.readable import Article, prep_article, check_siblings except ImportError: BREADABILITY_AVAILABLE = False Article = object from operator import attrgetter from werkzeug.utils import cached_property import re from lxml.etree import tounicode, tostring ...
def winner(self, greed=1): if not self.candidates: return u'' if isinstance(greed, float): if 0 > greed > 1.0: raise ValueError('greed coeft should be integer or 0<x<1.0') greed = int(round(len(self.candidates)*greed)) return self.CAND...
winner = check_siblings(winner, self.candidates) # updated_winner.node = prep_article(updated_winner.node) if winner.node is not None: yield winner.node
conditional_block
media.js
var m = m || false; var imgs = []; if (m && m.images && m.images.length > 0) imgs = m.images; $(function(){ var visible = 0, add = false; var pswpElement = document.querySelectorAll('.pswp')[0]; var FixSize = (function(){ var E = function() { // Меряем размер панельки заголовков var WW = $(window).width(...
var margin = 6; var Show = function() { if (adding) return; var area = $('.imgs.e').width(); var imageSize = $('.imgs.e a')[0].style.height; var size = Number(imageSize.replace('px','')) + margin; var height = $(window).height() + window.scrollY; var count = Math.round(height/size + 1) * Math.roun...
var visibleImages = 0;
random_line_split
media.js
var m = m || false; var imgs = []; if (m && m.images && m.images.length > 0) imgs = m.images; $(function(){ var visible = 0, add = false; var pswpElement = document.querySelectorAll('.pswp')[0]; var FixSize = (function(){ var E = function() { // Меряем размер панельки заголовков var WW = $(window).width(...
(3)[0] || ''; } }()); // Bookmark (function() { var request = false; var e = $(".bookmark"); if (e.length == 0) return; if (m.bookmark) e.addClass('saved')[0].dataset.tooltip = 'Убрать из закладок'; e.click(function() { if (level == 0) return Login(); if (request) return; request = true; ...
return UpdateUrl(); var index = image.data('i'); if (gallery) return gallery.goTo(index); var options = { index : index }; gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options); gallery.listen('close', function() { UpdateUrl(); gallery = false; }); gallery.listen('...
identifier_body
media.js
var m = m || false; var imgs = []; if (m && m.images && m.images.length > 0) imgs = m.images; $(function(){ var visible = 0, add = false; var pswpElement = document.querySelectorAll('.pswp')[0]; var FixSize = (function(){ var E = function() { // Меряем размер панельки заголовков var WW = $(window).width(...
]; title.push(m.title, m.author, 'Мазепа'); $('title').html(title.join(' ∞ ')); var url = location.pathname.indexOf('/albums/') ? '/' : '/albums/'; url += Number(m.id).toString(32) + '.' + m.secret + '/'; if (i || i === 0) url += imgs[i].id; history.pushState(false, title.join(' ∞ '), url); } fu...
itle] : [
identifier_name
media.js
var m = m || false; var imgs = []; if (m && m.images && m.images.length > 0) imgs = m.images; $(function(){ var visible = 0, add = false; var pswpElement = document.querySelectorAll('.pswp')[0]; var FixSize = (function(){ var E = function() { // Меряем размер панельки заголовков var WW = $(window).width(...
eturn Show; }()); window.onresize = function(){ Stack(FixSize, 300); Stack(ShowImages, 50); }; window.onscroll = function(){ Stack(ShowImages, 50); }; // Просмотр изображений в альбома (function(){ var items = []; for (var i in imgs) { var src = Picture.Src(imgs[i]); var size = Picture.Size(src); i...
adding = false; } }, 50); }; Show(); r
conditional_block
typed_ast.py
"""A set of AST classes with types and aliases filled in.""" import collections import type_context class Select(collections.namedtuple( 'Select', ['select_fields', 'table', 'where_expr', 'group_set', 'limit', 'type_ctx'])): """A compiled query. Fields: select_fields: A l...
class ColumnRef(collections.namedtuple( 'ColumnRef', ['table', 'column', 'type']), Expression): """References a column from the current context."""
class Literal(collections.namedtuple( 'Literal', ['value', 'type']), Expression): pass
random_line_split
typed_ast.py
"""A set of AST classes with types and aliases filled in.""" import collections import type_context class Select(collections.namedtuple( 'Select', ['select_fields', 'table', 'where_expr', 'group_set', 'limit', 'type_ctx'])): """A compiled query. Fields: select_fields: A l...
(collections.namedtuple( 'Literal', ['value', 'type']), Expression): pass class ColumnRef(collections.namedtuple( 'ColumnRef', ['table', 'column', 'type']), Expression): """References a column from the current context."""
Literal
identifier_name
typed_ast.py
"""A set of AST classes with types and aliases filled in.""" import collections import type_context class Select(collections.namedtuple( 'Select', ['select_fields', 'table', 'where_expr', 'group_set', 'limit', 'type_ctx'])): """A compiled query. Fields: select_fields: A l...
class FunctionCall(collections.namedtuple( 'FunctionCall', ['func', 'args', 'type']), Expression): """Expression representing a call to a built-in function. Fields: func: A runtime.Function for the function to call. args: A list of expressions to pass in as the function's arguments. ...
"""Abstract interface for all expression ASTs.""" def __init__(self, *args): assert hasattr(self, 'type')
identifier_body
regular_rods.py
# * ************************************************************* # * # * Soft Active Mater on Surfaces (SAMoS) # * # * Author: Rastko Sknepnek # * # * Division of Physics # * School of Engineering, Physics and Mathematics # * University of Dundee # * # * (c) 2013, 2014 # * # * School of Scienc...
else: self.particles.append(Particle(i)) self.particles[i].r = [x,y,0.0] self.particles[i].n = [2.0*(randint(0,1)-0.5),0.0,0.0] self.particles[i].v = [0.0,0.0,0.0] self.particles[i].R = 0.5*self.sigma self.particles[i].l = self.l ...
add_m = False
conditional_block
regular_rods.py
# * ************************************************************* # * # * Soft Active Mater on Surfaces (SAMoS) # * # * Author: Rastko Sknepnek # * # * Division of Physics # * School of Engineering, Physics and Mathematics # * University of Dundee # * # * (c) 2013, 2014 # * # * School of Scienc...
: def __init__(self, Lx, Ly, N, lx, ly, sigma, l): self.L = (Lx,Ly) self.N = N self.lx = lx self.ly = ly self.sigma = sigma self.l = l self.__generate() def __generate(self): self.particles = [] i = 0 n = 0 add_n = True while add_n: x = -0.5*self.L[0...
Plane
identifier_name
regular_rods.py
# * ************************************************************* # * # * Soft Active Mater on Surfaces (SAMoS) # * # * Author: Rastko Sknepnek # * # * Division of Physics # * School of Engineering, Physics and Mathematics # * University of Dundee # * # * (c) 2013, 2014 # * # * School of Scienc...
p = (args.length+sigma)/sigma lx = sqrt(Arod*p/args.phi) ly = sqrt(Arod/(p*args.phi)) print p, lx, ly print print "\tActive Particles on Curved Spaces (APCS)" print "\tBuilding of a random flat configuration (xy plane)" print print "\tRastko Sknepnek" print "\tUniversity of Dundee" print "\t(c) 2013, 2014, 2015" pri...
random_line_split
regular_rods.py
# * ************************************************************* # * # * Soft Active Mater on Surfaces (SAMoS) # * # * Author: Rastko Sknepnek # * # * Division of Physics # * School of Engineering, Physics and Mathematics # * University of Dundee # * # * (c) 2013, 2014 # * # * School of Scienc...
def __generate(self): self.particles = [] i = 0 n = 0 add_n = True while add_n: x = -0.5*self.L[0] + (n+0.5)*self.lx if x > 0.5*(self.L[0]-self.lx)+1e-3: add_n = False else: m = 0 add_m = True while add_m: y = -0.5*self.L[1] + (...
self.L = (Lx,Ly) self.N = N self.lx = lx self.ly = ly self.sigma = sigma self.l = l self.__generate()
identifier_body
rect.rs
use crate::{fragment::Bounds, util, Cell, Point}; use std::fmt; use ncollide2d::shape::{Segment, Shape}; use sauron::{ html::{attributes, attributes::*}, svg::{attributes::*, *}, Node, }; use std::cmp::Ordering; #[derive(Debug, Clone)] pub struct Rect { pub start: Point, pub end: Point, pub is...
pub(in crate) fn rounded_new( start: Point, end: Point, is_filled: bool, radius: f32, is_broken: bool, ) -> Self { let mut rect = Rect { start, end, is_filled, radius: Some(radius), is_broken, }...
{ let mut rect = Rect { start, end, is_filled, radius: None, is_broken, }; rect.sort_reorder_end_points(); rect }
identifier_body
rect.rs
use crate::{fragment::Bounds, util, Cell, Point}; use std::fmt; use ncollide2d::shape::{Segment, Shape}; use sauron::{ html::{attributes, attributes::*}, svg::{attributes::*, *}, Node, }; use std::cmp::Ordering; #[derive(Debug, Clone)] pub struct Rect { pub start: Point, pub end: Point, pub is...
} /// recompute the rect with start and end point offset by the cell /// location pub(in crate) fn absolute_position(&self, cell: Cell) -> Self { Rect { start: cell.absolute_position(self.start), end: cell.absolute_position(self.end), ..*self } }...
{ let tmp_start = self.start; self.start = self.end; self.end = tmp_start; }
conditional_block
rect.rs
use crate::{fragment::Bounds, util, Cell, Point}; use std::fmt; use ncollide2d::shape::{Segment, Shape}; use sauron::{ html::{attributes, attributes::*}, svg::{attributes::*, *}, Node, }; use std::cmp::Ordering; #[derive(Debug, Clone)] pub struct Rect { pub start: Point, pub end: Point, pub is...
} } pub(in crate) fn scale(&self, scale: f32) -> Self { Rect { start: self.start.scale(scale), end: self.end.scale(scale), radius: self.radius.map(|r| r * scale), ..*self } } pub(crate) fn width(&self) -> f32 { self.end.x ...
pub(in crate) fn absolute_position(&self, cell: Cell) -> Self { Rect { start: cell.absolute_position(self.start), end: cell.absolute_position(self.end), ..*self
random_line_split
rect.rs
use crate::{fragment::Bounds, util, Cell, Point}; use std::fmt; use ncollide2d::shape::{Segment, Shape}; use sauron::{ html::{attributes, attributes::*}, svg::{attributes::*, *}, Node, }; use std::cmp::Ordering; #[derive(Debug, Clone)] pub struct Rect { pub start: Point, pub end: Point, pub is...
(start: Point, end: Point, is_filled: bool, is_broken: bool) -> Self { let mut rect = Rect { start, end, is_filled, radius: None, is_broken, }; rect.sort_reorder_end_points(); rect } pub(in crate) fn rounded_new( ...
new
identifier_name
reducer.js
import {makeInstanceAction} from '#/main/app/store/actions' import {makeReducer} from '#/main/app/store/reducer' import {makeFormReducer} from '#/main/app/content/form/store/reducer' import {RESOURCE_LOAD} from '#/main/core/resource/store/actions' import {selectors as rssSelectors} from '#/plugin/rss/resources/rss-fe...
reducer }
random_line_split
test_failover_status.py
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
(self, request, mgmt_root): failover_status = mgmt_root.tm.cm.failover_status assert failover_status._meta_data['uri'].endswith( "/mgmt/tm/cm/failover-status/") failover_status.refresh() des =\ (failover_status.entries['https://localhost/mgmt/tm/cm/failover-status...
test_get_status
identifier_name
test_failover_status.py
# Copyright 2016 F5 Networks Inc. #
# # 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. # See the License for the specific language governing permissions and # limitations under the License. # ...
# 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
random_line_split
test_failover_status.py
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
def test_get_status(self, request, mgmt_root): failover_status = mgmt_root.tm.cm.failover_status assert failover_status._meta_data['uri'].endswith( "/mgmt/tm/cm/failover-status/") failover_status.refresh() des =\ (failover_status.entries['https://localhost/mgmt/tm...
identifier_body
proxy.ts
import { pick } from 'lodash'; import { CommandModule } from 'yargs'; import { createMultiProcessPrism, CreateProxyServerOptions, createSingleProcessPrism } from '../util/createServer'; import sharedOptions from './sharedOptions'; import { runPrismAndSetupWatcher } from '../util/runner'; const proxyCommand: CommandMod...
default: true, }, 'upstream-proxy': { description: 'If an http proxy is required to reach upstream, formatted as "{protocol}://[{user}[:{password}]@]{host}[:{port}]". eg "http://myUser:myPassword@proxy.example.com:1234"', string: true, }, }), han...
description: 'Validate incoming HTTP requests.', boolean: true,
random_line_split
broadcast.plugin.js
'use strict'; /* eslint-disable no-empty-function, no-unused-vars */ /** * Every received message will be sent to all clients that are connected to the instance. * Client A, B and C are connected to a WebSocket server instance with this plugin. * When A sends a message then it will be sent to B and C, but not back...
context.log.debug('Execute command: ' + command.name); connections.forEach(connection => { context.log.debug('Sending message to ' + connection.id); connection.send(data); }); return Promise.resolve({ message: `Data was send on instance "${context.instance.name}" to ${connection...
* @param {CommandConfig} command */ function executeBroadcastCommand(data, context, command) { const connections = context.instance.getConnections();
random_line_split
broadcast.plugin.js
'use strict'; /* eslint-disable no-empty-function, no-unused-vars */ /** * Every received message will be sent to all clients that are connected to the instance. * Client A, B and C are connected to a WebSocket server instance with this plugin. * When A sends a message then it will be sent to B and C, but not back...
module.exports = { name: 'broadcast', description: 'Every received message will be sent to all connected clients.', createWorker: context => new BroadcastPlugin(context), commands: [ { name: 'broadcast', displayName: 'Broadcast', description: 'Send a message...
{ const connections = context.instance.getConnections(); context.log.debug('Execute command: ' + command.name); connections.forEach(connection => { context.log.debug('Sending message to ' + connection.id); connection.send(data); }); return Promise.resolve({ message: `Data w...
identifier_body
broadcast.plugin.js
'use strict'; /* eslint-disable no-empty-function, no-unused-vars */ /** * Every received message will be sent to all clients that are connected to the instance. * Client A, B and C are connected to a WebSocket server instance with this plugin. * When A sends a message then it will be sent to B and C, but not back...
(context) { /** * @param {!WebSocketMessage} message * @param {!WebSocketConnection} myConnection */ this.onMessage = (message, myConnection) => { const connections = context.instance.getConnections(); connections.forEach(connection => { if (connection.id !== myConnec...
BroadcastPlugin
identifier_name
broadcast.plugin.js
'use strict'; /* eslint-disable no-empty-function, no-unused-vars */ /** * Every received message will be sent to all clients that are connected to the instance. * Client A, B and C are connected to a WebSocket server instance with this plugin. * When A sends a message then it will be sent to B and C, but not back...
}); }; } /** * @param {?} data * @param {PluginContext} context * @param {CommandConfig} command */ function executeBroadcastCommand(data, context, command) { const connections = context.instance.getConnections(); context.log.debug('Execute command: ' + command.name); connections.forEach(...
{ context.log.debug('Sending message to ' + connection.id); connection.send(message.data); }
conditional_block
Latin1Supplement.js
/* * /MathJax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Latin1Supplement.js * * Copyright (c) 2009-2017 The MathJax Consortium
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distri...
*
random_line_split
add_helpers.rs
use proc_macro2::TokenStream; use quote::quote; use syn::{Field, Ident, Index}; pub fn tuple_exprs(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> { let mut exprs = vec![]; for i in 0..fields.len() { let i = Index::from(i); // generates `self.0.add(rhs.0)` let expr = quote...
exprs }
exprs.push(expr) }
random_line_split
add_helpers.rs
use proc_macro2::TokenStream; use quote::quote; use syn::{Field, Ident, Index}; pub fn tuple_exprs(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> { let mut exprs = vec![]; for i in 0..fields.len() { let i = Index::from(i); // generates `self.0.add(rhs.0)` let expr = quote...
{ let mut exprs = vec![]; for field in fields { // It's safe to unwrap because struct fields always have an identifier let field_id = field.ident.as_ref().unwrap(); // generates `x: self.x.add(rhs.x)` let expr = quote!(self.#field_id.#method_ident(rhs.#field_id)); exprs....
identifier_body
add_helpers.rs
use proc_macro2::TokenStream; use quote::quote; use syn::{Field, Ident, Index}; pub fn tuple_exprs(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> { let mut exprs = vec![]; for i in 0..fields.len() { let i = Index::from(i); // generates `self.0.add(rhs.0)` let expr = quote...
(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> { let mut exprs = vec![]; for field in fields { // It's safe to unwrap because struct fields always have an identifier let field_id = field.ident.as_ref().unwrap(); // generates `x: self.x.add(rhs.x)` let expr = quote...
struct_exprs
identifier_name
subpipeline.py
# Copyright 2020 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 writing, ...
'problem_statement': text_format.MessageToString( message=problem_statement, as_utf8=True), 'sequence_length': max_sequence_length, }, instance_name=self.id) @property def id(self) -> str: """Returns the AutoTrainer sub...
random_line_split
subpipeline.py
# Copyright 2020 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 writing, ...
return autotrainer_instance_name @property def components(self) -> List[base_component.BaseComponent]: """Returns the AutoTrainer sub-pipeline's constituent components.""" return ([self._tuner] if self._tuner else []) + [self._trainer] @property def outputs(self) -> subpipeline.SubpipelineOutput...
autotrainer_instance_name = f'{autotrainer_instance_name}.{self._instance_name}'
conditional_block
subpipeline.py
# Copyright 2020 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 writing, ...
pipeline = task.components + autodata.components + autotrainer.components ``` """ def __init__(self, problem_statement: ps_pb2.ProblemStatement, transformed_examples: types.Channel, transform_graph: types.Channel, schema: types.Channel, ...
"""A self-tuning trainer that produces a model for tabular datasets. It is designed to be used in conjunction with NitroML's `AutoData` subpipeline using the `BasicPreprocessor`. ## Example: ```python task = MyBenchmarkTask(...) autodata = AutoData( task.problem_statement, examples=task.tr...
identifier_body
subpipeline.py
# Copyright 2020 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 writing, ...
(subpipeline.Subpipeline): """A self-tuning trainer that produces a model for tabular datasets. It is designed to be used in conjunction with NitroML's `AutoData` subpipeline using the `BasicPreprocessor`. ## Example: ```python task = MyBenchmarkTask(...) autodata = AutoData( task.problem_statem...
AutoTrainer
identifier_name
StaffUpsertForm.tsx
// 3rd Party import * as React from 'react'; // Base import { BaseComponent } from '../../BaseComponent'; // Material Ui import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import SelectField from 'material-ui/SelectField'; import TextField from 'material-ui/TextField'; ...
//#region handlers private nameChange = (e: React.KeyboardEvent<HTMLInputElement>, value: string) => { this.upsert.model.name = value; this.modelBinder(this.upsert); } private emailChange = (e: React.KeyboardEvent<HTMLInputElement>, value: string) => { this.upsert.model.email...
const { appActions } = this.props; this.modelBinder = appActions.staff.receiveStaffUpsert; }
identifier_body
StaffUpsertForm.tsx
// 3rd Party import * as React from 'react'; // Base import { BaseComponent } from '../../BaseComponent'; // Material Ui import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import SelectField from 'material-ui/SelectField'; import TextField from 'material-ui/TextField'; ...
type updateFunc = (upsert: StaffUpsertViewModel) => void; export class StaffUpsertForm extends BaseComponent<{}> { private modelBinder: updateFunc; private upsert: StaffUpsertViewModel; componentDidMount() { const { appActions } = this.props; this.modelBinder = appActions.staff.receiveS...
// State import { IAppActions } from '../../../State';
random_line_split
StaffUpsertForm.tsx
// 3rd Party import * as React from 'react'; // Base import { BaseComponent } from '../../BaseComponent'; // Material Ui import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import SelectField from 'material-ui/SelectField'; import TextField from 'material-ui/TextField'; ...
} render() { const { appActions, appState } = this.props; this.upsert = ObjectHelper.deepClone(appState.staff.staffUpsert); const model = this.upsert && this.upsert.model; const tools = this.upsert && this.upsert.tools; return ( <div className="form-horizon...
appActions.staff.createStaffAsync(upsert.model); }
conditional_block
StaffUpsertForm.tsx
// 3rd Party import * as React from 'react'; // Base import { BaseComponent } from '../../BaseComponent'; // Material Ui import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import SelectField from 'material-ui/SelectField'; import TextField from 'material-ui/TextField'; ...
{ const { appActions } = this.props; this.modelBinder = appActions.staff.receiveStaffUpsert; } //#region handlers private nameChange = (e: React.KeyboardEvent<HTMLInputElement>, value: string) => { this.upsert.model.name = value; this.modelBinder(this.upsert); } ...
mponentDidMount()
identifier_name
device.py
# Copyright (c) 2018 PaddlePaddle 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 required by app...
type='get_places', outputs={"Out": [out_places]}, attrs=attrs) return out_places
attrs['device_type'] = str(device_type) helper.append_op(
random_line_split
device.py
# Copyright (c) 2018 PaddlePaddle 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 required by app...
(device_count=None, device_type=None): helper = LayerHelper('get_places', **locals()) out_places = helper.create_variable( name=unique_name.generate_with_ignorable_key(helper.name + ".out")) attrs = dict() if device_count is not None: attrs['device_count'] = int(device_count) if devi...
get_places
identifier_name
device.py
# Copyright (c) 2018 PaddlePaddle 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 required by app...
if device_type is not None: attrs['device_type'] = str(device_type) helper.append_op( type='get_places', outputs={"Out": [out_places]}, attrs=attrs) return out_places
attrs['device_count'] = int(device_count)
conditional_block
device.py
# Copyright (c) 2018 PaddlePaddle 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 required by app...
helper = LayerHelper('get_places', **locals()) out_places = helper.create_variable( name=unique_name.generate_with_ignorable_key(helper.name + ".out")) attrs = dict() if device_count is not None: attrs['device_count'] = int(device_count) if device_type is not None: attrs['device_...
identifier_body
test_clusters_acceptance.py
from __future__ import division from math import sqrt, pi import unittest from sapphire import clusters class SimpleClusterTest(unittest.TestCase):
self.assertIsInstance(expected, tuple) msg = "Tuples differ: %s != %s" % (str(actual), str(expected)) for actual_value, expected_value in zip(actual, expected): self.assertAlmostEqual(actual_value, expected_value, msg=msg) if __name__ == '__main__': unittest.main()
def setUp(self): self.cluster = clusters.SimpleCluster(size=100) def test_station_positions_and_angles(self): a = sqrt(100 ** 2 - 50 ** 2) expected = [(0, 2 * a / 3, 0, 0), (0, 0, 0, 0), (-50, -a / 3, 0, 2 * pi / 3), (50, -a / 3, 0, -2 * pi / 3)] actual = [(stati...
identifier_body