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
Map.js
import EntityService from './EntityService'; import LevelService from './LevelService'; import {Point} from 'pixi.js'; import {centeredToTopLeft} from '../../utils/coordinate'; // coordinate system: // top-left origin // // 0---x+ // | // y // + const WIDTH = 1000; const HEIGHT = 1000; export default class ...
toggleVisibility() { this.isVisible = !this.isVisible; if (this.isVisible) { this.element.style.display = 'block'; } else { this.element.style.display = 'none'; } } positionRelativeToPlayer(position) { let player = EntityService.get().getLocalPlayer().getPosition(); return {...
{ this.context.clearRect(0, 0, WIDTH, HEIGHT); this.blips.forEach(blip => { this.context.fillStyle = blip.color; this.context.fillRect(blip.x, blip.y, blip.w, blip.h); }); }
identifier_body
Map.js
import EntityService from './EntityService'; import LevelService from './LevelService'; import {Point} from 'pixi.js'; import {centeredToTopLeft} from '../../utils/coordinate'; // coordinate system: // top-left origin // // 0---x+ // | // y // + const WIDTH = 1000; const HEIGHT = 1000; export default class ...
this.element.height = HEIGHT; document.body.appendChild(this.element); this.context = this.element.getContext('2d'); this.blips = []; this.isVisible = false; } update(entities) { this.blips = []; entities.forEach(entity => { let size = entity.getSize(); size = this.sizeScale...
this.element.width = WIDTH;
random_line_split
microdata.py
"""Thin wrapper around the microdata library.""" from __future__ import absolute_import import microdata class Item(microdata.Item):
if not isinstance(other, microdata.Item): return False return (self.itemid == other.itemid and self.itemtype == other.itemtype and self.props == other.props and self.extra == getattr(other, 'extra', {})) def __repr__(self): return...
"""Add an "extra" field to microdata Items, so people won't feel the need to make up ad-hoc properties. Also add __eq__() and __repr__(). """ def __init__(self, *args, **kwargs): super(Item, self).__init__(*args, **kwargs) self.extra = {} def json_dict(self): item = super...
identifier_body
microdata.py
"""Thin wrapper around the microdata library.""" from __future__ import absolute_import import microdata class Item(microdata.Item): """Add an "extra" field to microdata Items, so people won't feel the need to make up ad-hoc properties. Also add __eq__() and __repr__(). """ def __init__(self, *a...
return item def __eq__(self, other): if not isinstance(other, microdata.Item): return False return (self.itemid == other.itemid and self.itemtype == other.itemtype and self.props == other.props and self.extra == getattr(other, '...
item['extra'] = self.extra
conditional_block
microdata.py
"""Thin wrapper around the microdata library.""" from __future__ import absolute_import import microdata class Item(microdata.Item): """Add an "extra" field to microdata Items, so people won't feel the need to make up ad-hoc properties. Also add __eq__() and __repr__(). """ def __init__(self, *a...
self.props == other.props and self.extra == getattr(other, 'extra', {})) def __repr__(self): return '%s(%r, %r, props=%r, extra=%r)' % ( self.__class__.__name__, ' '.join(uri.string for uri in self.itemtype), self.itemid, self.pro...
return (self.itemid == other.itemid and self.itemtype == other.itemtype and
random_line_split
microdata.py
"""Thin wrapper around the microdata library.""" from __future__ import absolute_import import microdata class Item(microdata.Item): """Add an "extra" field to microdata Items, so people won't feel the need to make up ad-hoc properties. Also add __eq__() and __repr__(). """ def __init__(self, *a...
(self): return '%s(%r, %r, props=%r, extra=%r)' % ( self.__class__.__name__, ' '.join(uri.string for uri in self.itemtype), self.itemid, self.props, self.extra)
__repr__
identifier_name
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
(display: &Display, pixbuf: &Pixbuf, x: i32, y: i32) -> Cursor { skip_assert_initialized!(); unsafe { from_glib_full( ffi::gdk_cursor_new_from_pixbuf(display.to_glib_none().0, pixbuf.to_glib_none().0, x, y)) } } pub fn new_from_name(displa...
new_from_pixbuf
identifier_name
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
} pub fn new_from_pixbuf(display: &Display, pixbuf: &Pixbuf, x: i32, y: i32) -> Cursor { skip_assert_initialized!(); unsafe { from_glib_full( ffi::gdk_cursor_new_from_pixbuf(display.to_glib_none().0, pixbuf.to_glib_none().0, x, y)) } }...
pub fn new(cursor_type: Type) -> Cursor { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gdk_cursor_new(cursor_type)) }
random_line_split
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
}
{ unsafe { ffi::gdk_cursor_get_cursor_type(self.to_glib_none().0) } }
identifier_body
issue-59523-on-implemented-is-not-unused.rs
// We should not see the unused_attributes lint fire for // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. // revisions: cfail1 cfail2 // build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)]...
(&self, index: usize) -> &i32 { &self[index] } } fn main() { Index::<usize>::index(&[1, 2, 3] as &[i32], 2); }
index
identifier_name
issue-59523-on-implemented-is-not-unused.rs
// We should not see the unused_attributes lint fire for // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. // revisions: cfail1 cfail2 // build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)]...
{ Index::<usize>::index(&[1, 2, 3] as &[i32], 2); }
identifier_body
bench.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 cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
test::black_box(test_insertion_style_attribute(&r, &rules_matched)); } }) }) } }); }); }
test::black_box(test_insertion_style_attribute(&r, &rules_matched)); } s.spawn(|_| { for _ in 0..100 {
random_line_split
bench.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 cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
fn test_insertion(rule_tree: &RuleTree, rules: Vec<(StyleSource, CascadeLevel)>) -> StrongRuleNode { rule_tree.insert_ordered_rules(rules.into_iter()) } fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, CascadeLevel)]) -> StrongRuleNode { let mut rules = rules.to_vec(); rules...
{ let s = Stylesheet::from_str(css, ServoUrl::parse("http://localhost").unwrap(), Origin::Author, MediaList { media_queries: vec![], }, ...
identifier_body
bench.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 cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
(b: &mut Bencher) { let r = RuleTree::new(); // This test case tests a case where you style a bunch of siblings // matching the same rules, with a different style attribute each // one. let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .b...
bench_expensive_insertion
identifier_name
deviceMotion.d.ts
// Type definitions for ngCordova device motion plugin // Project: https://github.com/driftyco/ng-cordova // Definitions by: Kapil Sachdeva <https://github.com/ksachdeva> // Definitions: https://github.com/ksachdeva/DefinitelyTyped declare module ngCordova { export interface IDeviceMotionAcceleration { x: n...
export interface IDeviceMotionService { getCurrentAcceleration(): ng.IPromise<IDeviceMotionAcceleration>; watchAcceleration(options: IDeviceMotionAccelerometerOptions): IDeviceMotionWatchPromise; clearWatch(watchId: number): void; } }
export interface IDeviceMotionWatchPromise extends ng.IPromise<IDeviceMotionAcceleration> { watchID: number; cancel: () => void; clearWatch: (watchId?: number) => void; }
random_line_split
calc_velocity.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 9 15:39:28 2014 @author: ibackus """ import numpy as np import pynbody SimArray = pynbody.array.SimArray import isaac import subprocess import os import glob import time def v_xy(f, param, changbin=None, nr=50, min_per_bin=100): """ Attempts to calculate the...
nr = len(r_edges) - 1 r_bins, ar2_mean, err = isaac.binned_mean(r, ar2, binedges=r_edges, \ weighted_bins=True) # Fit lines to ar2 vs cos for each radial bin m = np.zeros(nr) b = np.zeros(nr) for i in range(nr): ...
random_line_split
calc_velocity.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 9 15:39:28 2014 @author: ibackus """ import numpy as np import pynbody SimArray = pynbody.array.SimArray import isaac import subprocess import os import glob import time def v_xy(f, param, changbin=None, nr=50, min_per_bin=100):
**RETURNS** vel : SimArray An N by 3 SimArray of gas particle velocities. """ if changbin is None: # Try to find the ChaNGa binary full path changbin = os.popen('which ChaNGa').read().strip() # Load stuff from the snapshot x = f.g['x'] y = f.g['y'] ...
""" Attempts to calculate the circular velocities for particles in a thin (not flat) keplerian disk. Requires ChaNGa **ARGUMENTS** f : tipsy snapshot For a gaseous disk param : dict a dictionary containing params for changa. (see isaac.configparser) changbin : str (OP...
identifier_body
calc_velocity.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 9 15:39:28 2014 @author: ibackus """ import numpy as np import pynbody SimArray = pynbody.array.SimArray import isaac import subprocess import os import glob import time def
(f, param, changbin=None, nr=50, min_per_bin=100): """ Attempts to calculate the circular velocities for particles in a thin (not flat) keplerian disk. Requires ChaNGa **ARGUMENTS** f : tipsy snapshot For a gaseous disk param : dict a dictionary containing params for c...
v_xy
identifier_name
calc_velocity.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 9 15:39:28 2014 @author: ibackus """ import numpy as np import pynbody SimArray = pynbody.array.SimArray import isaac import subprocess import os import glob import time def v_xy(f, param, changbin=None, nr=50, min_per_bin=100): """ Attempts to calculate the...
# Load stuff from the snapshot x = f.g['x'] y = f.g['y'] z = f.g['z'] r = f.g['rxy'] vel0 = f.g['vel'].copy() # Remove units from all quantities r = isaac.strip_units(r) x = isaac.strip_units(x) y = isaac.strip_units(y) z = isaac.strip_units(z) # Temporary...
changbin = os.popen('which ChaNGa').read().strip()
conditional_block
_pid_correction.py
import torch from deluca.lung.core import Controller, LungEnv class PIDCorrection(Controller): def __init__(self, base_controller: Controller, sim: LungEnv, pid_K=[0.0, 0.0], decay=0.1, **kwargs): self.base_controller = base_controller self.sim = sim self.I = 0.0 self.K = pid_K ...
def compute_action(self, state, t): u_in_base, u_out = self.base_controller(state, t) err = self.sim.pressure - state self.I = self.I * (1 - self.decay) + err * self.decay pid_correction = self.K[0] * err + self.K[1] * self.I u_in = torch.clamp(u_in_base + pid_correction, ...
def reset(self): self.base_controller.reset() self.sim.reset() self.I = 0.0
random_line_split
_pid_correction.py
import torch from deluca.lung.core import Controller, LungEnv class PIDCorrection(Controller): def
(self, base_controller: Controller, sim: LungEnv, pid_K=[0.0, 0.0], decay=0.1, **kwargs): self.base_controller = base_controller self.sim = sim self.I = 0.0 self.K = pid_K self.decay = decay self.reset() def reset(self): self.base_controller.reset() ...
__init__
identifier_name
_pid_correction.py
import torch from deluca.lung.core import Controller, LungEnv class PIDCorrection(Controller): def __init__(self, base_controller: Controller, sim: LungEnv, pid_K=[0.0, 0.0], decay=0.1, **kwargs): self.base_controller = base_controller self.sim = sim self.I = 0.0 self.K = pid_K ...
def compute_action(self, state, t): u_in_base, u_out = self.base_controller(state, t) err = self.sim.pressure - state self.I = self.I * (1 - self.decay) + err * self.decay pid_correction = self.K[0] * err + self.K[1] * self.I u_in = torch.clamp(u_in_base + pid_correction...
self.base_controller.reset() self.sim.reset() self.I = 0.0
identifier_body
base-demographic-estimate-controller.js
/* * Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting. * * Copyright (C) 2015 John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAI...
DemographicEstimateCategories.get({}, function (data) { deferred.resolve(data.estimate_categories); }, {}); }, 100); return deferred.promise; }, years: function ($q, $timeout, OperationYears) { var deferred = $q.defer(); $timeout(function () { OperationYears.get({}, function...
categories: function ($q, $timeout, DemographicEstimateCategories) { var deferred = $q.defer(); $timeout(function () {
random_line_split
base-demographic-estimate-controller.js
/* * Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting. * * Copyright (C) 2015 John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAI...
$scope.pageLineItems(); } }); $scope.isDirty = function () { return $scope.$dirty; }; $scope.hasPermission = function (permission) { return ($scope.rights.indexOf(permission) >= 0); }; $scope.showParent = function (index) { if (index > 0) { return ($scope.form.estimateLineItem...
{ //TODO: read this configuration from backend. $scope.enableAutoCalculate = false; $scope.showFacilityAggregatesOption = false; $scope.currentPage = 1; $scope.pageSize = 50; $scope.categories = categories; $scope.rights = rights; $scope.years = years; $scope.programs = programs; $scope.$watch(...
identifier_body
base-demographic-estimate-controller.js
/* * Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting. * * Copyright (C) 2015 John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAI...
($scope, rights, categories, programs , years, $filter) { //TODO: read this configuration from backend. $scope.enableAutoCalculate = false; $scope.showFacilityAggregatesOption = false; $scope.currentPage = 1; $scope.pageSize = 50; $scope.categories = categories; $scope.rights = rights; $scope.years ...
BaseDemographicEstimateController
identifier_name
base-demographic-estimate-controller.js
/* * Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting. * * Copyright (C) 2015 John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAI...
}; $scope.clearMessages = function(){ $scope.message = ''; $scope.error = ''; }; $scope.init = function(){ // default to the current year $scope.year = Number( $filter('date')(new Date(), 'yyyy') ); // when the available program is only 1, default to this program. if(programs.length =...
{ $scope.form.estimateLineItems = $scope.lineItems; }
conditional_block
MockStore.ts
import { Action, ActionReducer, Store } from '@ngrx/store'; import { State, prodReducer } from 'app/store'; import { State as LayerState } from 'app/store/layers/reducer'; import { State as PlaybackState } from 'app/store/playback/reducer'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { Observable } f...
setLayerState(layers: LayerState) { const state = this.getState(); const newState: State = { ...state, present: { ...state.present, layers } }; this.subject.next(newState); } setPlaybackState(playback: PlaybackState) { const state = this.getState(); const newState: State = { ...state, prese...
{ return this.subject.getValue(); }
identifier_body
MockStore.ts
import { Action, ActionReducer, Store } from '@ngrx/store'; import { State, prodReducer } from 'app/store'; import { State as LayerState } from 'app/store/layers/reducer'; import { State as PlaybackState } from 'app/store/playback/reducer'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { Observable } f...
(action: Action) {} getState() { return this.subject.getValue(); } setLayerState(layers: LayerState) { const state = this.getState(); const newState: State = { ...state, present: { ...state.present, layers } }; this.subject.next(newState); } setPlaybackState(playback: PlaybackState) { c...
dispatch
identifier_name
MockStore.ts
import { Action, ActionReducer, Store } from '@ngrx/store'; import { State, prodReducer } from 'app/store'; import { State as LayerState } from 'app/store/layers/reducer'; import { State as PlaybackState } from 'app/store/playback/reducer'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { Observable } f...
getState() { return this.subject.getValue(); } setLayerState(layers: LayerState) { const state = this.getState(); const newState: State = { ...state, present: { ...state.present, layers } }; this.subject.next(newState); } setPlaybackState(playback: PlaybackState) { const state = this.get...
random_line_split
views.py
from django.shortcuts import render_to_response from django.template import RequestContext from apps.members.models import Member def show_all_current_members(request): members = Member.objects.filter(is_renegade=False).order_by('function', 'started_nsi_date') return render_to_response( 'show_all_curr...
(request): members = Member.objects.filter(is_renegade=True) return render_to_response( 'show_all_former_members.html', {'members': members}, context_instance=RequestContext(request) )
show_all_former_members
identifier_name
views.py
from django.shortcuts import render_to_response from django.template import RequestContext from apps.members.models import Member def show_all_current_members(request):
def show_member(request, slug): member = Member.objects.get(slug=slug) participation_list = member.participation_set.all() members = Member.objects.all() return render_to_response( 'show_member.html', {'member': member, 'participation_list': participation_list, 'members': members}, ...
members = Member.objects.filter(is_renegade=False).order_by('function', 'started_nsi_date') return render_to_response( 'show_all_current_members.html', {'members': members}, context_instance=RequestContext(request) )
identifier_body
views.py
from django.shortcuts import render_to_response from django.template import RequestContext from apps.members.models import Member def show_all_current_members(request): members = Member.objects.filter(is_renegade=False).order_by('function', 'started_nsi_date') return render_to_response( 'show_all_curr...
def show_all_former_members(request): members = Member.objects.filter(is_renegade=True) return render_to_response( 'show_all_former_members.html', {'members': members}, context_instance=RequestContext(request) )
random_line_split
ruleFeedbackHistoryAPIs.ts
import { handleApiError, mainApiFetch, getRuleFeedbackHistoriesUrl, getRuleFeedbackHistoryUrl, getActivityStatsUrl } from '../../helpers/evidence/routingHelpers'; export const fetchRuleFeedbackHistories = async (key: string, activityId: string, selectedConjunction: string, startDate?: string, endDate?: string, turkSes...
error: handleApiError('Failed to fetch rule feedback histories, please refresh the page.', response), prompts: promptHealth }; }
const url = getActivityStatsUrl({ activityId, startDate, endDate, turkSessionID }); const response = await mainApiFetch(url); const promptHealth = await response.json(); return {
random_line_split
ruleFeedbackHistoryAPIs.ts
import { handleApiError, mainApiFetch, getRuleFeedbackHistoriesUrl, getRuleFeedbackHistoryUrl, getActivityStatsUrl } from '../../helpers/evidence/routingHelpers'; export const fetchRuleFeedbackHistories = async (key: string, activityId: string, selectedConjunction: string, startDate?: string, endDate?: string, turkSes...
const url = getRuleFeedbackHistoriesUrl({ activityId, selectedConjunction, startDate, endDate, turkSessionID }); const response = await mainApiFetch(url); const ruleFeedbackHistories = await response.json(); return { error: handleApiError('Failed to fetch rule feedback histories, please refresh the page.',...
{ return }
conditional_block
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(...
{ run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM3)), operand2: Some(IndirectScaledIndexed(RDX, RDX, Four, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82, 28, 1...
identifier_body
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*;
use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM2)), operand2: Some(Direct(XMM6)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82,...
use ::Operand::*; use ::Reg::*;
random_line_split
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(...
() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM0)), operand2: Some(Direct(XMM4)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82, 196], OperandSize::Qword) } #[test] fn rsqrtps_4() { run...
rsqrtps_3
identifier_name
EIDSS.BvMessages.en-US.js
operation.', 'errDatabaseNotFound': 'Cannot open database \'{0}\' on server \'{1}\'. Check the correctness of database name.', 'ErrDataValidation': 'Some field contains invalid data.', 'ErrEmptyUserLogin': 'User login can\'t be empty', 'ErrFieldSampleIDNotFound': 'Sample is not found.', 'ErrFillDataset': 'Er...
'SecurityLog_EIDSS_finished_successfully': 'EIDSS finished successfully', 'SecurityLog_EIDSS_started_abnormaly': 'EIDSS started abnormaly', 'SecurityLog_EIDSS_started_successfully': 'EIDSS started successfully', 'strCancel_Id': 'Cancel', 'strChangeDiagnosisReason_msgId': 'Reason is required.', 'strDelete_Id...
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
depends_on('python@2.7:') depends_on('py-setuptools', type=('build'))
version('1.1.6', 'b33f54f1257ab541f4df4bacc7509f5a')
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(PythonPackage): """ A fast LRU cache""" homepage = "https://github.com/amitdev/lru-dict" url = "https://pypi.io/packages/source/l/lru-dict/lru-dict-1.1.6.tar.gz" version('1.1.6', 'b33f54f1257ab541f4df4bacc7509f5a') depends_on('python@2.7:') depends_on('py-setuptools', type=('build'))
PyLrudict
identifier_name
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
""" A fast LRU cache""" homepage = "https://github.com/amitdev/lru-dict" url = "https://pypi.io/packages/source/l/lru-dict/lru-dict-1.1.6.tar.gz" version('1.1.6', 'b33f54f1257ab541f4df4bacc7509f5a') depends_on('python@2.7:') depends_on('py-setuptools', type=('build'))
identifier_body
15.2.3.7-5-b-84.js
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this n...
() { var obj = {}; try { fnGlobalObject().configurable = true; Object.defineProperties(obj, { prop: fnGlobalObject() }); var result1 = obj.hasOwnProperty("prop"); delete obj.prop; var result2 = obj.hasOwnProperty...
testcase
identifier_name
15.2.3.7-5-b-84.js
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this n...
runTestCase(testcase);
{ var obj = {}; try { fnGlobalObject().configurable = true; Object.defineProperties(obj, { prop: fnGlobalObject() }); var result1 = obj.hasOwnProperty("prop"); delete obj.prop; var result2 = obj.hasOwnProperty("p...
identifier_body
15.2.3.7-5-b-84.js
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this n...
var obj = {}; try { fnGlobalObject().configurable = true; Object.defineProperties(obj, { prop: fnGlobalObject() }); var result1 = obj.hasOwnProperty("prop"); delete obj.prop; var result2 = obj.hasOwnProperty("pro...
- runTestCase.js - fnGlobalObject.js ---*/ function testcase() {
random_line_split
setup_win32.py
#!/usr/bin/env python import glob import os import site from cx_Freeze import setup, Executable import meld.build_helpers import meld.conf site_dir = site.getsitepackages()[1] include_dll_path = os.path.join(site_dir, "gnome") missing_dll = [ 'libgtk-3-0.dll', 'libgdk-3-0.dll', 'libatk-1.0-0.dll', ...
setup( name="Meld", version=meld.conf.__version__, description='Visual diff and merge tool', author='The Meld project', author_email='meld-list@gnome.org', maintainer='Kai Willadsen', url='http://meldmerge.org', classifiers=[ 'Development Status :: 5 - Production/Stable', ...
random_line_split
utils.spec.ts
import * as utils from '../utils'; import '@testing-library/jest-dom/extend-expect'; describe('isCoveredByReact', () => { it('should identify standard events as covered by React', () => { expect(utils.isCoveredByReact('click')).toEqual(true); }); it('should identify custom events as not covered by React', ()...
utils.syncEvent(div, 'ionClick', ionClickCallback); expect(removeEventListener).not.toHaveBeenCalled(); expect(addEventListener).toHaveBeenCalledWith('ionClick', expect.any(Function)); utils.syncEvent(div, 'ionClick', ionClickCallback); expect(removeEventListener).toHaveBeenCalledWith('ionClick', e...
random_line_split
cc_salt_minion.py
# vi: ts=4 expandtab # # Copyright (C) 2014 Amazon.com, Inc. or its affiliates. # # Author: Jeff Bauer <jbauer@rubic.com> # Author: Andrew Jorgensen <ajorgens@amazon.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License versio...
(name, cfg, cloud, log, _args): # If there isn't a salt key in the configuration don't do anything if 'salt_minion' not in cfg: log.debug(("Skipping module named %s," " no 'salt_minion' key in configuration"), name) return salt_cfg = cfg['salt_minion'] # Start by ins...
handle
identifier_name
cc_salt_minion.py
# vi: ts=4 expandtab # # Copyright (C) 2014 Amazon.com, Inc. or its affiliates. # # Author: Jeff Bauer <jbauer@rubic.com> # Author: Andrew Jorgensen <ajorgens@amazon.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License versio...
minion_config = os.path.join(config_dir, 'minion') minion_data = util.yaml_dumps(salt_cfg.get('conf')) util.write_file(minion_config, minion_data) # ... copy the key pair if specified if 'public_key' in salt_cfg and 'private_key' in salt_cfg: pki_dir = salt_cfg.get('pki_dir', '/...
util.ensure_dir(config_dir) # ... and then update the salt configuration if 'conf' in salt_cfg: # Add all sections from the conf object to /etc/salt/minion
random_line_split
cc_salt_minion.py
# vi: ts=4 expandtab # # Copyright (C) 2014 Amazon.com, Inc. or its affiliates. # # Author: Jeff Bauer <jbauer@rubic.com> # Author: Andrew Jorgensen <ajorgens@amazon.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License versio...
salt_cfg = cfg['salt_minion'] # Start by installing the salt package ... cloud.distro.install_packages(('salt-minion',)) # Ensure we can configure files at the right dir config_dir = salt_cfg.get("config_dir", '/etc/salt') util.ensure_dir(config_dir) # ... and then update the salt confi...
log.debug(("Skipping module named %s," " no 'salt_minion' key in configuration"), name) return
conditional_block
cc_salt_minion.py
# vi: ts=4 expandtab # # Copyright (C) 2014 Amazon.com, Inc. or its affiliates. # # Author: Jeff Bauer <jbauer@rubic.com> # Author: Andrew Jorgensen <ajorgens@amazon.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License versio...
# ... copy the key pair if specified if 'public_key' in salt_cfg and 'private_key' in salt_cfg: pki_dir = salt_cfg.get('pki_dir', '/etc/salt/pki') with util.umask(077): util.ensure_dir(pki_dir) pub_name = os.path.join(pki_dir, 'minion.pub') pem_name = os.path...
if 'salt_minion' not in cfg: log.debug(("Skipping module named %s," " no 'salt_minion' key in configuration"), name) return salt_cfg = cfg['salt_minion'] # Start by installing the salt package ... cloud.distro.install_packages(('salt-minion',)) # Ensure we can confi...
identifier_body
preferencesEditorInput.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
export class PreferencesEditorInput extends SideBySideEditorInput { static readonly ID: string = 'workbench.editorinputs.preferencesEditorInput'; getTypeId(): string { return PreferencesEditorInput.ID; } getTitle(verbosity: Verbosity): string { return this.master.getTitle(verbosity); } } export class Defau...
import { KeybindingsEditorModel } from 'vs/workbench/services/preferences/common/keybindingsEditorModel'; import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; import { Settings2EditorModel } from 'vs/workbench/services/preferences/common/preferencesModels';
random_line_split
preferencesEditorInput.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if (!super.matches(other)) { return false; } return true; } } export class KeybindingsEditorInput extends EditorInput { static readonly ID: string = 'workbench.input.keybindings'; readonly keybindingsModel: KeybindingsEditorModel; constructor(@IInstantiationService instantiationService: IInstantiationS...
{ return true; }
conditional_block
preferencesEditorInput.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(): string { return SettingsEditor2Input.ID; } getName(): string { return nls.localize('settingsEditor2InputName', "Settings"); } resolve(): Promise<Settings2EditorModel> { return Promise.resolve(this._settingsModel); } getResource(): URI { return this.resource; } }
getTypeId
identifier_name
test_contact_compare.py
__author__ = 'Keiran' from model.contact import Contact import pytest def
(app, orm): with pytest.allure.step('Given a sorted contact list from DB'): contacts_from_db = orm.get_contact_list() sorted_contacts_from_db = list(sorted(contacts_from_db, key=Contact.id_or_max)) with pytest.allure.step('Given a sorted contact list from home page'): contacts_from_home_...
test_contact_compare
identifier_name
test_contact_compare.py
__author__ = 'Keiran' from model.contact import Contact import pytest def test_contact_compare(app, orm): with pytest.allure.step('Given a sorted contact list from DB'): contacts_from_db = orm.get_contact_list() sorted_contacts_from_db = list(sorted(contacts_from_db, key=Contact.id_or_max)) wi...
assert sorted_contacts_from_db[index] == sorted_contacts_from_home_page[index] assert sorted_contacts_from_db[index].join_mails() == sorted_contacts_from_home_page[index].all_mails assert sorted_contacts_from_db[index].join_phones() == sorted_contacts_from_home_page[index].all_phones
conditional_block
test_contact_compare.py
__author__ = 'Keiran' from model.contact import Contact import pytest def test_contact_compare(app, orm): with pytest.allure.step('Given a sorted contact list from DB'): contacts_from_db = orm.get_contact_list() sorted_contacts_from_db = list(sorted(contacts_from_db, key=Contact.id_or_max)) wi...
assert sorted_contacts_from_db[index] == sorted_contacts_from_home_page[index] assert sorted_contacts_from_db[index].join_mails() == sorted_contacts_from_home_page[index].all_mails assert sorted_contacts_from_db[index].join_phones() == sorted_contacts_from_home_page[index].all_phones
random_line_split
test_contact_compare.py
__author__ = 'Keiran' from model.contact import Contact import pytest def test_contact_compare(app, orm):
with pytest.allure.step('Given a sorted contact list from DB'): contacts_from_db = orm.get_contact_list() sorted_contacts_from_db = list(sorted(contacts_from_db, key=Contact.id_or_max)) with pytest.allure.step('Given a sorted contact list from home page'): contacts_from_home_page = app.conta...
identifier_body
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
#[test] fn test_armv7_hard_float_matcher() { assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-gnueabihf")); assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-musleabihf")); } }
#[cfg(test)] mod tests { use super::*;
random_line_split
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
(s: &str) -> Result<Self, Self::Err> { match s { x if x.starts_with("x86_64-unknown-linux-") => Ok(Target::Amd64Linux), x if x.starts_with("aarch64-unknown-linux-") => Ok(Target::Arm64Linux), x if ARMV7_HARD_FLOAT.is_match(x) => Ok(Target::ArmV7LinuxHardFloat), x ...
from_str
identifier_name
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
} static ARMV7_HARD_FLOAT: Lazy<Regex> = Lazy::new(|| Regex::new(r"armv7-unknown-linux.*hf").unwrap()); #[cfg(test)] mod tests { use super::*; #[test] fn test_armv7_hard_float_matcher() { assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-gnueabihf")); assert!(ARMV7_HARD_FLOAT.is...
{ match s { x if x.starts_with("x86_64-unknown-linux-") => Ok(Target::Amd64Linux), x if x.starts_with("aarch64-unknown-linux-") => Ok(Target::Arm64Linux), x if ARMV7_HARD_FLOAT.is_match(x) => Ok(Target::ArmV7LinuxHardFloat), x if x.starts_with("armv7-unknown-linux...
identifier_body
test_fragments.py
# # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under the GNU Public Licence, v2 or any higher version # # Please cite your use of MDAnalysis in published work: # # R. J. Gowers, M....
assert ag.n_fragments == 0 def test_atomgroup_fragments_nobonds_NDE(self): # should raise NDE u = make_Universe() ag = u.atoms[:10] with pytest.raises(NoDataError): getattr(ag, 'fragments') with pytest.raises(NoDataError): getattr(ag, 'fragind...
assert ag.fragments == tuple() assert_equal(ag.fragindices, np.array([], dtype=np.int64))
random_line_split
test_fragments.py
# # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under the GNU Public Licence, v2 or any higher version # # Please cite your use of MDAnalysis in published work: # # R. J. Gowers, M. ...
u.add_TopologyAttr(Bonds(bonds)) return u def case1(): return make_starshape() def case2(): u = make_Universe() bonds = [] for seg in range(5): segbase = seg * 25 for res in range(5): # offset for atoms in this res base = segbase + 5 * res ...
bonds.append((4 + base, 5 + base))
conditional_block
test_fragments.py
# # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under the GNU Public Licence, v2 or any higher version # # Please cite your use of MDAnalysis in published work: # # R. J. Gowers, M....
class TestFragments(object): r"""Use 125 atom test Universe 5 segments of 5 residues of 5 atoms Case1 ----- Star shapes to try and test the branching prediction o | o | o | | | | | o-o-o-|-o-o-o-|-o-o-o | | | | | o | o |x3 o Cas...
u = make_Universe() bonds = [] for seg in range(5): segbase = seg * 25 for res in range(5): # offset for atoms in this res base = segbase + 5 * res bonds.append((0 + base, 1 + base)) bonds.append((1 + base, 2 + base)) bonds.append((2 + ...
identifier_body
test_fragments.py
# # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under the GNU Public Licence, v2 or any higher version # # Please cite your use of MDAnalysis in published work: # # R. J. Gowers, M. ...
(self, u): # check atom can access fragment and fragindex: for at in (u.atoms[0], u.atoms[76], u.atoms[111]): frag = at.fragment assert isinstance(frag, groups.AtomGroup) assert len(frag) == 25 assert at in frag fragindex = at.fragindex ...
test_atom_access
identifier_name
note.py
= createBarcodeDrawing("Code128", value=text_value.encode("utf-8"), barHeight=10 * mm, width=80 * mm) Drawing.__init__(self, barcode.width, barcode.height, *args, **kwargs) self.add(barc...
(request, text): """Return text as a barcode.""" if request.GET.get('f') == 'svg': import barcode output = StringIO.StringIO() code = barcode.Code39(text, add_checksum=False) code.write(output) contents = output.getvalue() output.close() return HttpRespons...
show_barcode
identifier_name
note.py
attachments a.pk = None a.content_object = new_note a.save() new_note.attachments.add(a) return redirect(edit, pk=new_note.pk, order_id=note.order_id) @permission_required('servo.change_note') def edit(request, pk=None, order_id=None, parent=None, recipient=None, custome...
random_line_split
note.py
all_notes = Article.objects.all().order_by('-date_created') if kind == "inbox": all_notes = all_notes.filter(order=None).order_by("is_read", "-created_at") if kind == "sent": all_notes = all_notes.filter(created_by=request.user) if kind == "flagged": all_notes = all_notes.fil...
results = results.filter(body__icontains=fdata['body'])
conditional_block
note.py
.subject new_note.save() new_note.labels = note.labels.all() for a in note.attachments.all(): # also copy the attachments a.pk = None a.content_object = new_note a.save() new_note.attachments.add(a) return redirect(edit, pk=new_note.pk, order_id=note.order_id) @perm...
esc = Escalation() form = EscalationForm() title = _('Edit Escalation') if request.method == 'POST': data = request.POST.copy() data['created_by'] = request.user form = EscalationForm(data, request.FILES, instance=esc) if form.is_valid(): note = form.save() ...
identifier_body
ToontownLauncher.py
02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2], ltime[3], ltime[4], ltime[5]) logfile = 'toontownD-' + logSuffix + '.log' class LogAndOutput: def __init__(self, orig, log): self.orig = orig self.log = log def write(self, str): self.log.writ...
def setValue(self, key, value): self.setRegistry(key, value) def getVerifyFiles(self): return 1 def getTestServerFlag(self): return self.testServerFlag def getGameServer(self): return self.gameServer def getLogFileName(self): return 'toontown' def p...
try: return self.getRegistry(key, default) except: return self.getRegistry(key)
identifier_body
ToontownLauncher.py
%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2],
def __init__(self, orig, log): self.orig = orig self.log = log def write(self, str): self.log.write(str) self.log.flush() self.orig.write(str) self.orig.flush() def flush(self): self.log.flush() self.orig.flush() log = open(logfile, 'a') log...
ltime[3], ltime[4], ltime[5]) logfile = 'toontownD-' + logSuffix + '.log' class LogAndOutput:
random_line_split
ToontownLauncher.py
02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2], ltime[3], ltime[4], ltime[5]) logfile = 'toontownD-' + logSuffix + '.log' class LogAndOutput: def __init__(self, orig, log): self.orig = orig self.log = log def write(self, str): self.log.writ...
(self, bytesWritten): if self.totalPatchDownload: return LauncherBase.getPercentPatchComplete(self, bytesWritten) else: return 0 def hashIsValid(self, serverHash, hashStr): return serverHash.setFromDec(hashStr) or serverHash.setFromHex(hashStr) def launcherMessa...
getPercentPatchComplete
identifier_name
ToontownLauncher.py
02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2], ltime[3], ltime[4], ltime[5]) logfile = 'toontownD-' + logSuffix + '.log' class LogAndOutput: def __init__(self, orig, log): self.orig = orig self.log = log def write(self, str): self.log.writ...
elif t == WindowsRegistry.TString: if missingValue == None: missingValue = '' return WindowsRegistry.getStringValue(self.toontownRegistryKey, name, missingValue) else: return missingValue def ge...
if missingValue == None: missingValue = 0 return WindowsRegistry.getIntValue(self.toontownRegistryKey, name, missingValue)
conditional_block
peturb.py
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d # returns a random d dimensional vector, a direction to peturb in def direction(d,t): # if type == uniform if(t == 'u'): return np.random.uniform(-1/np.sqrt(2), 1/np.sqrt(2), d) elif(t == 'n'): return np.ra...
x[i] = temp*np.cos(angles[i]) x[d-1] = x[d-2]*np.tan(angles[d-2]) return x fig = plt.figure() ax = plt.axes(projection='3d') for i in range(1000): R = np.random.uniform(0,1,1)[0] R2 = np.random.uniform(0,1,1)[0] xs = np.sin(np.arccos(1-2*R))*np.cos(2*np.pi*R2) ys = np.sin(...
temp = temp * np.sin(angles[j])
conditional_block
peturb.py
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d # returns a random d dimensional vector, a direction to peturb in def direction(d,t): # if type == uniform if(t == 'u'): return np.random.uniform(-1/np.sqrt(2), 1/np.sqrt(2), d) elif(t == 'n'): return np.ra...
for j in range(i): temp = temp * np.sin(angles[j]) x[i] = temp*np.cos(angles[i]) x[d-1] = x[d-2]*np.tan(angles[d-2]) return x fig = plt.figure() ax = plt.axes(projection='3d') for i in range(1000): R = np.random.uniform(0,1,1)[0] R2 = np.random.uniform(0...
x = np.zeros(d) x[0] = np.cos(angles[0]) for i in range(1,d-1): temp = 1
random_line_split
peturb.py
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d # returns a random d dimensional vector, a direction to peturb in def direction(d,t): # if type == uniform
fig = plt.figure() ax = plt.axes(projection='3d') for i in range(1000): R = np.random.uniform(0,1,1)[0] R2 = np.random.uniform(0,1,1)[0] xs = np.sin(np.arccos(1-2*R))*np.cos(2*np.pi*R2) ys = np.sin(np.arccos(1-2*R))*np.sin(2*np.pi*R2) zs = 1- 2*R ax.scatter3D(xs, ys, zs, cmap='Greens') ax.se...
if(t == 'u'): return np.random.uniform(-1/np.sqrt(2), 1/np.sqrt(2), d) elif(t == 'n'): return np.random.normal(0, 1/np.sqrt(d), d) elif(t == 's'): # a point on the N-Sphere angles = np.random.uniform(0, np.pi, d-2) x = np.zeros(d) x[0] = np.cos(angles[0]) ...
identifier_body
peturb.py
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d # returns a random d dimensional vector, a direction to peturb in def
(d,t): # if type == uniform if(t == 'u'): return np.random.uniform(-1/np.sqrt(2), 1/np.sqrt(2), d) elif(t == 'n'): return np.random.normal(0, 1/np.sqrt(d), d) elif(t == 's'): # a point on the N-Sphere angles = np.random.uniform(0, np.pi, d-2) x = np.zeros(d) ...
direction
identifier_name
vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py
import logging from pyvisdk.exceptions import InvalidArgumentError # This module is NOT auto-generated # Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar # Unless states otherside, the methods and attributes were not used by esxcli, # and thus not tested log = logging.getLogger(__name__) de...
(vim, *args, **kwargs): obj = vim.client.factory.create('ns0:VimEsxCLInetworkfirewallrulesetallowediplistFirewallRulesetAllowedip') # do some validation checking... if (len(args) + len(kwargs)) < 0: raise IndexError('Expected at least 1 arguments got: %d' % len(args)) required = [ ] optio...
VimEsxCLInetworkfirewallrulesetallowediplistFirewallRulesetAllowedip
identifier_name
vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py
import logging from pyvisdk.exceptions import InvalidArgumentError # This module is NOT auto-generated # Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar # Unless states otherside, the methods and attributes were not used by esxcli, # and thus not tested log = logging.getLogger(__name__) de...
obj = vim.client.factory.create('ns0:VimEsxCLInetworkfirewallrulesetallowediplistFirewallRulesetAllowedip') # do some validation checking... if (len(args) + len(kwargs)) < 0: raise IndexError('Expected at least 1 arguments got: %d' % len(args)) required = [ ] optional = [ 'AllowedIPAddresses'...
identifier_body
vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py
import logging from pyvisdk.exceptions import InvalidArgumentError # This module is NOT auto-generated # Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar # Unless states otherside, the methods and attributes were not used by esxcli, # and thus not tested log = logging.getLogger(__name__) de...
else: raise InvalidArgumentError("Invalid argument: %s. Expected one of %s" % (name, ", ".join(required + optional))) return obj
setattr(obj, name, value)
conditional_block
vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py
import logging from pyvisdk.exceptions import InvalidArgumentError # This module is NOT auto-generated # Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar # Unless states otherside, the methods and attributes were not used by esxcli, # and thus not tested log = logging.getLogger(__name__) def...
return obj
random_line_split
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree]) -> Box<MacResult+'static> { let string = match base::get_single_str_from_tts(cx, sp, tts, "named") { None => return DummyResult::expr(sp), Some(s) => s }; // make sure unclosed braces don't escape. static NAMES: regex::Regex...
named
identifier_name
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
let new = NAMES.replace_all(&string, |c: &regex::Captures| { let full = c.at(0).unwrap(); if !full.ends_with("}") { cx.span_err(sp, &format!("unclosed escape in `named!`: {}", full)); } else { let name = c.at(1).unwrap(); match unicode_names::character(nam...
random_line_split
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
fn named_char(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree]) -> Box<MacResult+'static> { match base::get_single_str_from_tts(cx, sp, tts, "named_char") { None => {} Some(name) => match unicode_names::character(&name) { None => cx.span_err(sp, &format!("`{}` d...
{ registrar.register_macro("named_char", named_char); registrar.register_macro("named", named); }
identifier_body
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
} } // failed :( String::new() }); MacEager::expr(cx.expr_str(sp, token::intern_and_get_ident(&new))) }
{ cx.span_err(sp, &format!("`{}` does not name a character", name)); }
conditional_block
OpacitySlider.js
BR.OpacitySlider = L.Control.extend({ options: { position: 'topleft', callback: function(opacity) {} }, onAdd: function (map) { var container = L.DomUtil.create('div', 'leaflet-bar control-slider'), input = $('<input id="slider" type="text"/>'), item = localSt...
var stopClickAfterSlide = function(evt) { L.DomEvent.stop(evt); removeStopClickListeners(); }; var removeStopClickListeners = function() { document.removeEventListener('click', stopClickAfterSlide, true); document.removeEventListener('mousedown',...
{ value = minOpacity; }
conditional_block
OpacitySlider.js
BR.OpacitySlider = L.Control.extend({ options: { position: 'topleft', callback: function(opacity) {} }, onAdd: function (map) { var container = L.DomUtil.create('div', 'leaflet-bar control-slider'), input = $('<input id="slider" type="text"/>'), item = localSt...
evt.data.self.options.callback(evt.value / 100); }).on('slideStop', function (evt) { localStorage.opacitySliderValue = evt.value; // When dragging outside slider and over map, click event after mouseup // adds marker when active on Chromium. So disable click (not...
}).on('slide slideStop', { self: this }, function (evt) {
random_line_split
reflector.ts
/** * @license * Copyright Google Inc. 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 {Type} from '../type'; import {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; imp...
(public reflectionCapabilities: PlatformReflectionCapabilities) { super(); } updateCapabilities(caps: PlatformReflectionCapabilities) { this.reflectionCapabilities = caps; } factory(type: Type<any>): Function { return this.reflectionCapabilities.factory(type); } parameters(typeOrFunc: Type<any>): any[][] { ...
constructor
identifier_name
reflector.ts
/** * @license * Copyright Google Inc. 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 {Type} from '../type'; import {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; imp...
resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any { return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); } resolveEnum(identifier: any, name: string): any { return this.reflectionCapabilities.resolveEnum(identifier, name); } }
importUri(type: any): string { return this.reflectionCapabilities.importUri(type); }
random_line_split
reflector.ts
/** * @license * Copyright Google Inc. 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 {Type} from '../type'; import {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; imp...
hasLifecycleHook(type: any, lcProperty: string): boolean { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } getter(name: string): GetterFn { return this.reflectionCapabilities.getter(name); } setter(name: string): SetterFn { return this.reflectionCapabilities.setter(name); } m...
{ return this.reflectionCapabilities.propMetadata(typeOrFunc); }
identifier_body
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
(requested: &mut [QualityItem<Encoding>]) -> Option<Encoding> { requested.sort_by_key(|e| e.quality); requested.iter().filter(|e| e.quality.0 != 0).find(|e| SUPPORTED_ENCODINGS.contains(&e.item)).map(|e| e.item.clone()) } /// Encode a string slice using a specified encoding or `None` if encoding failed or is n...
response_encoding
identifier_name
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
/// Find best supported encoding to use, or `None` for identity. pub fn response_encoding(requested: &mut [QualityItem<Encoding>]) -> Option<Encoding> { requested.sort_by_key(|e| e.quality); requested.iter().filter(|e| e.quality.0 != 0).find(|e| SUPPORTED_ENCODINGS.contains(&e.item)).map(|e| e.item.clone()) } ...
pub const MAX_ENCODING_SIZE: u64 = 100 * 1024 * 1024; /// The minimal size gain at which to preserve encoded filesystem files. pub const MIN_ENCODING_GAIN: f64 = 1.1;
random_line_split
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
{ brotli_compress(&mut inf, &mut outf, &BROTLI_PARAMS).is_ok() }
identifier_body
wiggle_to_binned_array.py
#!/afs/bx.psu.edu/project/pythons/py2.7-linux-x86_64-ucs4/bin/python2.7 """ Convert wiggle data to a binned array. This assumes the input data is on a single chromosome and does no sanity checks! usage: %prog score_file out_file < wiggle_data -c, --comp=type: compression type (none, zlib, lzo) """ from __future_...
# Status if i % 10000 == 0: print i, "scores processed" out = open( out_fname, "w" ) if comp_type: scores.to_file( out, comp_type=comp_type ) else: scores.to_file( out ) out.close() if __name__ == "__main__": main()
options, args = doc_optparse.parse( __doc__ ) try: if options.comp: comp_type = options.comp else: comp_type = None score_fname = args[0] out_fname = args[1] except: doc_optparse.exit() scores = BinnedArray() ## last_chrom = None for ...
identifier_body
wiggle_to_binned_array.py
#!/afs/bx.psu.edu/project/pythons/py2.7-linux-x86_64-ucs4/bin/python2.7 """ Convert wiggle data to a binned array. This assumes the input data is on a single chromosome and does no sanity checks! usage: %prog score_file out_file < wiggle_data -c, --comp=type: compression type (none, zlib, lzo) """ from __future_...
score_fname = args[0] out_fname = args[1] except: doc_optparse.exit() scores = BinnedArray() ## last_chrom = None for i, ( chrom, pos, val ) in enumerate( bx.wiggle.Reader( misc.open_compressed( score_fname ) ) ): #if last_chrom is None: # last_chrom = chro...
comp_type = None
conditional_block
wiggle_to_binned_array.py
#!/afs/bx.psu.edu/project/pythons/py2.7-linux-x86_64-ucs4/bin/python2.7 """ Convert wiggle data to a binned array. This assumes the input data is on a single chromosome and does no sanity checks! usage: %prog score_file out_file < wiggle_data -c, --comp=type: compression type (none, zlib, lzo) """ from __future_...
## last_chrom = None for i, ( chrom, pos, val ) in enumerate( bx.wiggle.Reader( misc.open_compressed( score_fname ) ) ): #if last_chrom is None: # last_chrom = chrom #else: # assert chrom == last_chrom, "This script expects a 'wiggle' input on only one chromosome" ...
scores = BinnedArray()
random_line_split
wiggle_to_binned_array.py
#!/afs/bx.psu.edu/project/pythons/py2.7-linux-x86_64-ucs4/bin/python2.7 """ Convert wiggle data to a binned array. This assumes the input data is on a single chromosome and does no sanity checks! usage: %prog score_file out_file < wiggle_data -c, --comp=type: compression type (none, zlib, lzo) """ from __future_...
(): # Parse command line options, args = doc_optparse.parse( __doc__ ) try: if options.comp: comp_type = options.comp else: comp_type = None score_fname = args[0] out_fname = args[1] except: doc_optparse.exit() scores = BinnedArra...
main
identifier_name
ConnectedMessage.tsx
/* * Wire * Copyright (C) 2021 Wire Swiss GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progr...
{isOutgoingRequest && ( <div className="message-connected-cancel accent-text" onClick={onClickCancelRequest} data-uie-name="do-cancel-request" > {t('conversationConnectionCancelRequest')} </div> )} {showServicesWarning && ( <div c...
random_line_split
index.py
import os import traceback import json import requests from flask import Flask, request from cities_list import CITIES from messages import get_message, search_keyword token = os.environ.get('FB_ACCESS_TOKEN') api_key = os.environ.get('WEATHER_API_KEY') app = Flask(__name__) def location_quick_reply(sender, text=N...
message = send_text(sender, get_message('error')) send_message(message) # Send location button payload = location_quick_reply(sender) send_message(payload) ...
if _return == 'error':
random_line_split
index.py
import os import traceback import json import requests from flask import Flask, request from cities_list import CITIES from messages import get_message, search_keyword token = os.environ.get('FB_ACCESS_TOKEN') api_key = os.environ.get('WEATHER_API_KEY') app = Flask(__name__) def location_quick_reply(sender, text=N...
else: text = message['text'] for city in CITIES: if text.lower() in city: _return = send_weather_info(sender, city_name=text) if _return == 'error': message = send_text(sender, get...
sage = send_text(sender, get_message('error')) send_message(message) payload = location_quick_reply(sender) send_message(payload)
conditional_block
index.py
import os import traceback import json import requests from flask import Flask, request from cities_list import CITIES from messages import get_message, search_keyword token = os.environ.get('FB_ACCESS_TOKEN') api_key = os.environ.get('WEATHER_API_KEY') app = Flask(__name__) def location_quick_reply(sender, text=N...
(sender, type, payload): return { "recipient": { "id": sender }, "message": { "attachment": { "type": type, "payload": payload, } } } def send_text(sender, text): return { "recipient": { ...
send_attachment
identifier_name