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
setup.py
# -*- coding: utf-8 -*- import re import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand class
(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): import pytest errcode = pytest.main(self.test_args) sys.exit(errcode) def find_version(fname): '''Attempts to find ...
PyTest
identifier_name
Atherite.py
from ..base.MagicOre import MagicOre from erukar.system.engine import Observation import erukar class Atherite(MagicOre): Probability = 200 Desirability = 4.0 InventoryDescription = "A whitish alloy infused with chaotic energies; enhances random effects by 25%" InventoryName = "Atherite" PriceMu...
PermittedEntities = [ erukar.system.Weapon, erukar.system.Armor, erukar.system.Ammunition ]
random_line_split
Atherite.py
from ..base.MagicOre import MagicOre from erukar.system.engine import Observation import erukar class Atherite(MagicOre):
Observation(acuity=35, sense=0, result="The {EssentialPart} of the {BaseName} has been forged from a metal known as Atherite."), Observation(acuity=35, sense=10, result="The {BaseName}'s {EssentialPart} has been forged from Atherite, a magical ore which is white and shimmers a blue light; you feel that ...
Probability = 200 Desirability = 4.0 InventoryDescription = "A whitish alloy infused with chaotic energies; enhances random effects by 25%" InventoryName = "Atherite" PriceMultiplier = 12.5 WeightMultiplier = 3.1 DurabilityMultiplier = 1.2 Glances = [ Observation(acuity=5, sense=0...
identifier_body
Atherite.py
from ..base.MagicOre import MagicOre from erukar.system.engine import Observation import erukar class
(MagicOre): Probability = 200 Desirability = 4.0 InventoryDescription = "A whitish alloy infused with chaotic energies; enhances random effects by 25%" InventoryName = "Atherite" PriceMultiplier = 12.5 WeightMultiplier = 3.1 DurabilityMultiplier = 1.2 Glances = [ Observation(a...
Atherite
identifier_name
get-cursor-until-event-types.ts
import { AdapterPool } from './types' import { cursorToThreadArray, StoredEvent,
const getCursorUntilEventTypes = async ( { executeStatement, escapeId, escape, eventsTableName, shapeEvent, }: AdapterPool, cursor: InputCursor, untilEventTypes: Array<StoredEvent['type']> ): Promise<string> => { if (untilEventTypes.length < 1) { throw new Error('Must define at least ...
threadArrayToCursor, initThreadArray, InputCursor, } from '@resolve-js/eventstore-base'
random_line_split
get-cursor-until-event-types.ts
import { AdapterPool } from './types' import { cursorToThreadArray, StoredEvent, threadArrayToCursor, initThreadArray, InputCursor, } from '@resolve-js/eventstore-base' const getCursorUntilEventTypes = async ( { executeStatement, escapeId, escape, eventsTableName, shapeEvent, }: Adapt...
const tableNameAsId = escapeId(eventsTableName) const vectorConditions = cursorToThreadArray(cursor) const minThreadCounterConditions = `${vectorConditions .map( (threadCounter, threadId) => `${escapeId('threadId')} = ${+threadId} AND ${escapeId( 'threadCounter' )} >= ${+th...
{ throw new Error('Must define at least one event type') }
conditional_block
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 https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
} } fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); let s = Stylesheet::from_str( css, ServoUrl::parse("http://localhost").unwrap(), Origin::Author, media, lock,...
}
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 https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
#[bench] fn bench_insertion_basic(b: &mut Bencher) { let r = RuleTree::new(); thread_state::initialize(ThreadState::SCRIPT); let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .baz { display: block; }", ); b.iter(|| { let _gc = ...
{ let mut rules = rules.to_vec(); rules.push(( StyleSource::from_declarations(Arc::new(shared_lock.wrap( PropertyDeclarationBlock::with_one( PropertyDeclaration::Display(longhands::display::SpecifiedValue::Block), Importance::Normal, ), )))...
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 https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
(b: &mut Bencher) { let r = RuleTree::new(); thread_state::initialize(ThreadState::SCRIPT); let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .baz { display: block; }", ); b.iter(|| { let _gc = AutoGCRuleTree::new(&r); f...
bench_insertion_basic
identifier_name
webpack.d.ts
interface WebpackConfig { cache?: boolean; target?: string; devtool?: string; entry?: any; externals?: any; output?: any; module?: any; plugins?: Array<any>; resolve?: { extensions?: Array<string>; }; devServer?: { contentBase?: string; port?: number; historyApiFallback?: {[key: st...
quiet?: boolean; noInfo?: boolean; watchOptions?: any; https?: boolean; disableHostCheck: boolean; }; node?: { process?: boolean; global?: boolean; Buffer?: boolean; crypto?: boolean; module?: boolean; clearImmediate?: boolean; setImmediate?: boolean clearTimeout?...
inline?: boolean; proxy?: any; host?: string;
random_line_split
2d.fillStyle.parse.hsl-clamp-4.worker.js
// DO NOT EDIT! This test has been generated by tools/gentest.py. // OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-clamp-4 // Description:
importScripts("/2dcontext/resources/canvas-tests.js"); var t = async_test(""); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); ctx.fillStyle = '#f00'; ct...
// Note:<p class="notes"> importScripts("/resources/testharness.js");
random_line_split
query.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2015,掌阅科技 All rights reserved. 摘 要: query.py 创 建 者: WangLichao 创建日期: 2015-03-06 """ # pylint: disable=arguments-differ from tornado.web import UIModule OPERATOR = { 'like': '包含',
'=': '等于', '!=': '不等于', '>': '大于', '>=': '大于等于', '<': '小于', '<=': '小于等于', } class Query(UIModule): '''操作条件 ''' def render(self, column, default_column, default_operator, time_flag=False): ''' Args: column: 数据库列字典 default_colu...
random_line_split
query.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2015,掌阅科技 All rights reserved. 摘 要: query.py 创 建 者: WangLichao 创建日期: 2015-03-06 """ # pylint: disable=arguments-differ from tornado.web import UIModule OPERATOR = { 'like': '包含', '=': '等于', '!=': '不等于', '>': '大于', '>=': '大于等于', ...
g=False): ''' Args: column: 数据库列字典 default_column: 默认列 operator: 操作字典 default_operator: 默认操作 time_flag: 输入为时间字段标记 ''' return self.render_string("uimodule/query.html", column=column, ...
me_fla
identifier_name
query.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2015,掌阅科技 All rights reserved. 摘 要: query.py 创 建 者: WangLichao 创建日期: 2015-03-06 """ # pylint: disable=arguments-differ from tornado.web import UIModule OPERATOR = { 'like': '包含', '=': '等于', '!=': '不等于', '>': '大于', '>=': '大于等于', ...
默认列 operator: 操作字典 default_operator: 默认操作 time_flag: 输入为时间字段标记 ''' return self.render_string("uimodule/query.html", column=column, default_column=default_column, def...
identifier_body
ep2.py
# Universidade de Aveiro - Physics Department # 2016/2017 Project - Andre Calatre, 73207 # "Simulation of an epidemic" - 25/3/2017 # The following code has been based on: # Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/ import numpy as np import matplotlib.pyplot as plt from matplotlib import...
def iterate(X): """Iterate the map according to the epidemic rules.""" # lottery = np.random.random() # The boundary of the map is always empty, so only consider cells # indexed from 1 to nx-2, 1 to ny-2 X1 = np.zeros((ny, nx)) for ix in range(1, nx - 1): for iy in range(1, ny - 1): ...
# Defining the main function:
random_line_split
ep2.py
# Universidade de Aveiro - Physics Department # 2016/2017 Project - Andre Calatre, 73207 # "Simulation of an epidemic" - 25/3/2017 # The following code has been based on: # Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/ import numpy as np import matplotlib.pyplot as plt from matplotlib import...
(i): im.set_data(animate.X) animate.X = iterate(animate.X) # Bind our grid to the identifier X in the animate function's namespace. animate.X = X # Interval between frames (ms). interval = 1 anim = animation.FuncAnimation(fig, animate, interval=interval) plt.show()
animate
identifier_name
ep2.py
# Universidade de Aveiro - Physics Department # 2016/2017 Project - Andre Calatre, 73207 # "Simulation of an epidemic" - 25/3/2017 # The following code has been based on: # Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/ import numpy as np import matplotlib.pyplot as plt from matplotlib import...
# Bind our grid to the identifier X in the animate function's namespace. animate.X = X # Interval between frames (ms). interval = 1 anim = animation.FuncAnimation(fig, animate, interval=interval) plt.show()
im.set_data(animate.X) animate.X = iterate(animate.X)
identifier_body
ep2.py
# Universidade de Aveiro - Physics Department # 2016/2017 Project - Andre Calatre, 73207 # "Simulation of an epidemic" - 25/3/2017 # The following code has been based on: # Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/ import numpy as np import matplotlib.pyplot as plt from matplotlib import...
if X[iy, ix] == SICK and np.random.random() <= s: X1[iy, ix] = SICK # if you're immune, you're not going anywhere if X[iy, ix] == IMM: # and np.random.random() >= (1/ept): X1[iy, ix] = IMM # if you're healthy the same, except... ...
X1[iy, ix] = IMM # if sick, probability (s-i) of surviving one more turn
conditional_block
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct
<T> { v: UnsafeCell<T> } unsafe impl Sync for A<T> {} impl<T> A<T> { fn new(v: T) -> A<T> { A { v: UnsafeCell::<T>::new(v) } } } type T = isize; macro_rules! atomic_max_acqrel_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::...
A
identifier_name
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsa...
($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data.clone(); thread::spawn(move || { let dst: *mut T = clone.v.get(); let src: T = $value; let old: T = unsafe { atom...
macro_rules! atomic_max_acqrel_test {
random_line_split
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsa...
} type T = isize; macro_rules! atomic_max_acqrel_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data.clone(); thread::spawn(move || { let dst: *mut...
{ A { v: UnsafeCell::<T>::new(v) } }
identifier_body
documentSymbolProvider.ts
/*--------------------------------------------------------------------------------------------- * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vsc...
) { } public async provideDocumentSymbolInformation(document: SkinnyTextDocument): Promise<vscode.SymbolInformation[]> { const toc = await new TableOfContentsProvider(this.engine, document).getToc(); return toc.map(entry => this.toSymbolInformation(entry)); } public async provideDocumentSymbols(document: Skin...
private lastRunTime: number = 1000, private RunTimeFactor: number = 1.5
random_line_split
documentSymbolProvider.ts
/*--------------------------------------------------------------------------------------------- * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vsc...
return this.root.children; } private buildTree(parent: AsciidocSymbol, entries: TocEntry[]) { if (!entries.length) { return; } const entry = entries[0]; const symbol = this.toDocumentSymbol(entry); symbol.children = []; while (parent && entry.level <= parent.level) { parent = parent.parent!; ...
{ const toc = await new TableOfContentsProvider(this.engine, document).getToc(); this.root = { level: -Infinity, children: [], parent: undefined } this.buildTree(this.root, toc); this.lastSymbolCall = (new Date).getTime(); this.lastRunTime = this.lastSymbolCall - startTime; }
conditional_block
documentSymbolProvider.ts
/*--------------------------------------------------------------------------------------------- * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vsc...
(entry: TocEntry): vscode.SymbolInformation { return new vscode.SymbolInformation( entry.text, vscode.SymbolKind.String, '', entry.location); } private toDocumentSymbol(entry: TocEntry) { return new vscode.DocumentSymbol( entry.text, '', vscode.SymbolKind.String, entry.location.range, ...
toSymbolInformation
identifier_name
documentSymbolProvider.ts
/*--------------------------------------------------------------------------------------------- * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vsc...
private toSymbolInformation(entry: TocEntry): vscode.SymbolInformation { return new vscode.SymbolInformation( entry.text, vscode.SymbolKind.String, '', entry.location); } private toDocumentSymbol(entry: TocEntry) { return new vscode.DocumentSymbol( entry.text, '', vscode.SymbolKind.Strin...
{ if (!entries.length) { return; } const entry = entries[0]; const symbol = this.toDocumentSymbol(entry); symbol.children = []; while (parent && entry.level <= parent.level) { parent = parent.parent!; } parent.children.push(symbol); this.buildTree({ level: entry.level, children: symbol.childre...
identifier_body
lib.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. #[macro_use] extern crate quote; extern crate proc_macro; use proc_macro2::{Group, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::*; /// This crate provides a macr...
{ template_ident: Ident, substitutes: Punctuated<Substitution, Token![,]>, match_exp: Box<Expr>, template_arm: Arm, remaining_arms: Vec<Arm>, } impl Parse for MatchTemplate { fn parse(input: ParseStream<'_>) -> Result<Self> { let template_ident = input.parse()?; input.parse::<T...
MatchTemplate
identifier_name
lib.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. #[macro_use] extern crate quote; extern crate proc_macro; use proc_macro2::{Group, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::*; /// This crate provides a macr...
"#; let expect_output_stream: TokenStream = expect_output.parse().unwrap(); let mt: MatchTemplate = syn::parse_str(input).unwrap(); let output = mt.expand(); assert_eq!(output.to_string(), expect_output_stream.to_string()); } #[test] fn test_map() { let inpu...
VectorValue::Bar => EvalType::Bar, _ => unreachable!(), }
random_line_split
confirm.js
/*! * OS.js - JavaScript Operating System * * Copyright (c) 2011-2015, Anders Evenrud <andersevenrud@gmail.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions o...
args = Utils.mergeObject({ title: API._('DIALOG_CONFIRM_TITLE'), icon: 'status/dialog-question.png', message: msg, buttons: ['cancel', 'ok'] }, (args || {})); _StandardDialog.apply(this, ['ConfirmDialog', args, {width:350, height:120}, onClose]); }; ConfirmDialog.prototype = Obje...
* @class */ var ConfirmDialog = function(msg, onClose, args) {
random_line_split
typeValueConflict1.js
var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function
() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var M1; (function (M1) { var A = (function () { function A() { } return A; })(); M1.A = A; })(M1 || (M1 = {})); var M2; (function (M2) { var M1 = 0; // Should error. ...
__
identifier_name
typeValueConflict1.js
var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var M1; (function (M1) { var A = (function () { function A() { } ...
__extends(B, _super); function B() { _super.apply(this, arguments); } return B; })(M1.A); })(M2 || (M2 = {}));
// Should error. M1 should bind to the variable, not to the module. var B = (function (_super) {
random_line_split
typeValueConflict1.js
var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __()
__.prototype = b.prototype; d.prototype = new __(); }; var M1; (function (M1) { var A = (function () { function A() { } return A; })(); M1.A = A; })(M1 || (M1 = {})); var M2; (function (M2) { var M1 = 0; // Should error. M1 should bind to the varia...
{ this.constructor = d; }
identifier_body
new.js
/* * Copyright (c) 2015 by Rafael Angel Aznar Aparici (rafaaznar at gmail dot com) * * sisane: The stunning micro-library that helps you to develop easily * AJAX web applications by using Angular.js 1.x & sisane-server * sisane is distributed under the MIT License (MIT) * Sources at https://github....
} else { $scope.status = "Error en la recepción de datos del servidor"; } }).catch(function (data) { $scope.status = "Error en la recepción de datos del servidor"; }); ; }; $scope.back = function () {...
{ $scope.status = "Error en la recepción de datos del servidor"; }
conditional_block
new.js
/* * Copyright (c) 2015 by Rafael Angel Aznar Aparici (rafaaznar at gmail dot com) * * sisane: The stunning micro-library that helps you to develop easily * AJAX web applications by using Angular.js 1.x & sisane-server * sisane is distributed under the MIT License (MIT) * Sources at https://github....
* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel...
random_line_split
EquationGroups.js
/* * * (c) Copyright Ascensio System SIA 2010-2019 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL it...
'backbone', 'documenteditor/main/app/model/EquationGroup' ], function(Backbone){ 'use strict'; DE.Collections = DE.Collections || {}; DE.Collections.EquationGroups = Backbone.Collection.extend({ model: DE.Models.EquationGroup }); });
define([
random_line_split
ps_dispatcher.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...
class RoundRobin(PSDispatcher): """ Distribute variables to several endpoints using RondRobin<https://en.wikipedia.org/wiki/Round-robin_scheduling> method. Args: pserver_endpoints (list): list of endpoint(ip:port). Examples: .. code-block:: python pserver_endpoints = ["...
""" use `HashName` method to dispatch variables with each parameter server. Args: varlist (list): a list of Variables """ eplist = [] for var in varlist: server_id = self._hash_block(var.name(), len(self._eps)) server_for_param = self._eps[ser...
identifier_body
ps_dispatcher.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...
return eplist
self._step = 0
conditional_block
ps_dispatcher.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.
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing ...
# You may obtain a copy of the License at
random_line_split
ps_dispatcher.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...
(self, pserver_endpoints): super(HashName, self).__init__(pserver_endpoints) def _hash_block(self, block_str, total): return hash(block_str) % total def dispatch(self, varlist): """ use `HashName` method to dispatch variables with each parameter server. Args: ...
__init__
identifier_name
search.service.js
cortes.service('searchService', function ($q, $filter, client, esFactory) { var searchQ = $q.defer(); var searchData = []; this.getDefer = function (searchQuery) { if (searchQuery.match(/[a-z]/i)) { var fields = [ "vout.scriptPubKey.addresses.keyword", ...
searchQ.resolve(); }); return searchQ.promise; }; this.getSearchResults = function () { searchQ = $q.defer(); return searchData; } });
"_count": temp.length };
random_line_split
extract-intl.js
/* eslint-disable */ /** * This script will extract the internationalization messages from all components and package them in the translation json files in the translations file. */ const fs = require('fs'); const nodeGlob = require('glob'); const transform = require('babel-core').transform; const animateProgress...
const oldLocaleMapping = oldLocaleMappings[locale][message.id]; // Merge old translations into the babel extracted instances where react-intl is used const newMsg = ( locale === DEFAULT_LOCALE) ? message.defaultMessage : ''; localeMappings[locale][message.id] = (oldLocaleMapping) ...
const code = await readFile(fileName); // Use babel plugin to extract instances where react-intl is used const { metadata: result } = await transform(code, { presets, plugins }); // object-shorthand for (const message of result['react-intl'].messages) { for (const locale of locales) {
random_line_split
extract-intl.js
/* eslint-disable */ /** * This script will extract the internationalization messages from all components and package them in the translation json files in the translations file. */ const fs = require('fs'); const nodeGlob = require('glob'); const transform = require('babel-core').transform; const animateProgress...
clearTimeout(progress); return addCheckmark(() => newLine()); } } // Wrap async functions below into a promise const glob = (pattern) => new Promise((resolve, reject) => { nodeGlob(pattern, (error, value) => (error ? reject(error) : resolve(value))); }); const readFile = (fileName) => new Promise((resolv...
{ process.stderr.write(error); }
conditional_block
overworld.biomes.ts
/* Code to generate overworld biomes. */ import {ELEM} from '../data/elem-constants'; import {Noise} from './noise'; type Level = import('./level').Level; type OWMap = import('./overworld.map').OWMap; const TEMP_HIGH = 1.45; const TEMP_LOW = 0.85; const MOUNT_WALL = 5.0; // Elevation for huge mountain walls const...
(elev: number, moist: number, temp: number): any { if (elev < WATER_LEVEL) { if (temp < TEMP_LOW) { return ELEM.WATER_FROZEN; } else { if (elev < (WATER_LEVEL - 0.2)) { return ELEM.DEEP_WATER; } else if (elev < (WATER_LEVEL - 0....
biome
identifier_name
overworld.biomes.ts
/* Code to generate overworld biomes. */ import {ELEM} from '../data/elem-constants'; import {Noise} from './noise'; type Level = import('./level').Level; type OWMap = import('./overworld.map').OWMap; const TEMP_HIGH = 1.45; const TEMP_LOW = 0.85; const MOUNT_WALL = 5.0; // Elevation for huge mountain walls const ...
return 2.0 * (y / (rows - 1)) - 0.3 * x / (cols - 1); } function biome(elev: number, moist: number, temp: number): any { if (elev < WATER_LEVEL) { if (temp < TEMP_LOW) { return ELEM.WATER_FROZEN; } else { if (elev < (WATER_LEVEL - 0.2)) { return E...
OWBiomes.debug = false; function getTemp(x: number, y: number, cols: number, rows: number): number {
random_line_split
overworld.biomes.ts
/* Code to generate overworld biomes. */ import {ELEM} from '../data/elem-constants'; import {Noise} from './noise'; type Level = import('./level').Level; type OWMap = import('./overworld.map').OWMap; const TEMP_HIGH = 1.45; const TEMP_LOW = 0.85; const MOUNT_WALL = 5.0; // Elevation for huge mountain walls const...
else if (elev < (WATER_LEVEL - 0.1)) { return ELEM.WATER; } return ELEM.SHALLOW_WATER; } } else if (elev <= (WATER_LEVEL + GAP)) { if (temp < TEMP_LOW) { return ELEM.SNOW; } else { return ELEM.FLOOR; ...
{ return ELEM.DEEP_WATER; }
conditional_block
overworld.biomes.ts
/* Code to generate overworld biomes. */ import {ELEM} from '../data/elem-constants'; import {Noise} from './noise'; type Level = import('./level').Level; type OWMap = import('./overworld.map').OWMap; const TEMP_HIGH = 1.45; const TEMP_LOW = 0.85; const MOUNT_WALL = 5.0; // Elevation for huge mountain walls const...
function biome(elev: number, moist: number, temp: number): any { if (elev < WATER_LEVEL) { if (temp < TEMP_LOW) { return ELEM.WATER_FROZEN; } else { if (elev < (WATER_LEVEL - 0.2)) { return ELEM.DEEP_WATER; } else if (elev < (...
{ return 2.0 * (y / (rows - 1)) - 0.3 * x / (cols - 1); }
identifier_body
poisonBush.py
import src class PoisonBush(src.items.Item): """ a hard to remove poison plant """ type = "PoisonBush" name = "poison brush" description = "" usageInfo = """ You can use it to loose 100 satiation. """ walkable = False charges = 0 def __init__(self): """ set up...
): return if not ( newPos in self.container.itemByCoordinates and len(self.container.itemByCoordinates[newPos]) ): new = itemMap["PoisonBloom"]() self.container.addItem(new,newPos) def getLongInfo(self): """ retur...
""" spawn a new poison bloom Parameters: distance: the spawning distance """ if not (self.xPosition and self.yPosition): return direction = ( 2 * self.xPosition + 3 * self.yPosition + src.gamestate.gamestate.tick ) % 4 directi...
identifier_body
poisonBush.py
import src class PoisonBush(src.items.Item): """ a hard to remove poison plant """ type = "PoisonBush" name = "poison brush" description = "" usageInfo = """ You can use it to loose 100 satiation. """ walkable = False charges = 0 def __init__(self): """ set up...
(self, character): """ handle a character trying to use this item by killing the character Parameters: character: the character trying to use this item """ self.charges += 1 if 100 > character.satiation: character.satiation = 0 el...
apply
identifier_name
poisonBush.py
import src class PoisonBush(src.items.Item): """ a hard to remove poison plant """ type = "PoisonBush" name = "poison brush" description = "" usageInfo = """ You can use it to loose 100 satiation. """ walkable = False charges = 0 def __init__(self): """ set up...
""" super().__init__(display=src.canvas.displayChars.poisonBush) self.attributesToStore.extend(["charges"]) def apply(self, character): """ handle a character trying to use this item by killing the character Parameters: character: the character ...
random_line_split
poisonBush.py
import src class PoisonBush(src.items.Item): """ a hard to remove poison plant """ type = "PoisonBush" name = "poison brush" description = "" usageInfo = """ You can use it to loose 100 satiation. """ walkable = False charges = 0 def __init__(self): """ set up...
direction = ( 2 * self.xPosition + 3 * self.yPosition + src.gamestate.gamestate.tick ) % 4 direction = (random.randint(1, distance + 1), random.randint(1, distance + 1)) newPos = (self.xPosition + direction[0] - 5, self.yPosition + direction[1] - 5, self.zPosition) ...
return
conditional_block
range1d.ts
import {Range} from "./range" import * as p from "core/properties" export namespace Range1d { export interface Attrs extends Range.Attrs { start: number end: number } export interface Props extends Range.Props {} } export interface Range1d extends Range1d.Attrs {} export class Range1d extends Range { ...
(): void { if (this.bounds == 'auto') { const min = Math.min(this._initial_start, this._initial_end) const max = Math.max(this._initial_start, this._initial_end) this.setv({bounds: [min, max]}, {silent: true}) } } initialize(): void { super.initialize() this._initial_start = this...
_set_auto_bounds
identifier_name
range1d.ts
import {Range} from "./range" import * as p from "core/properties" export namespace Range1d { export interface Attrs extends Range.Attrs { start: number end: number } export interface Props extends Range.Props {} } export interface Range1d extends Range1d.Attrs {} export class Range1d extends Range { ...
const max = Math.max(this._initial_start, this._initial_end) this.setv({bounds: [min, max]}, {silent: true}) } } initialize(): void { super.initialize() this._initial_start = this.start this._initial_end = this.end this._set_auto_bounds() } get min(): number { return Math...
random_line_split
range1d.ts
import {Range} from "./range" import * as p from "core/properties" export namespace Range1d { export interface Attrs extends Range.Attrs { start: number end: number } export interface Props extends Range.Props {} } export interface Range1d extends Range1d.Attrs {} export class Range1d extends Range { ...
get min(): number { return Math.min(this.start, this.end) } get max(): number { return Math.max(this.start, this.end) } get is_reversed(): boolean { return this.start > this.end } reset(): void { this._set_auto_bounds() if (this.start != this._initial_start || this.end != this._in...
{ super.initialize() this._initial_start = this.start this._initial_end = this.end this._set_auto_bounds() }
identifier_body
selectors.ts
import { IApplicationState } from 'setup/store/store'; import { ICompareDatasetsState, ComparedDatasetVersionIds, } from './types'; import { ComparedDatasetVersions, getDatasetVersionsDifferentProps } from './compareDatasets'; import { selectDatasetVersion } from 'features/datasetVersions'; const selectState = (sta...
: undefined; };
); return comparedDatasetVersions.length === 2 ? getDatasetVersionsDifferentProps( ...(comparedDatasetVersions as Required<ComparedDatasetVersions>) )
random_line_split
main.py
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
(): LOG.debug("Remote {remote} is loading".format(remote=CONF.remote)) return _load_driver('sahara.remote', CONF.remote) def _get_ops_driver(driver_name): LOG.debug("Ops {driver} is loading".format(driver=driver_name)) return _load_driver('sahara.run.mode', driver_name) def start_server(app): ...
_get_remote_driver
identifier_name
main.py
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
LOG = log.getLogger(__name__) opts = [ cfg.StrOpt('os_region_name', help='Region name used to get services endpoints.'), cfg.StrOpt('infrastructure_engine', default='heat', help='An engine which will be used to provision ' 'infrastructure for Ha...
from sahara.utils.openstack import cinder from sahara.utils import remote from sahara.utils import rpc as messaging from sahara.utils import wsgi
random_line_split
main.py
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
def _get_ops_driver(driver_name): LOG.debug("Ops {driver} is loading".format(driver=driver_name)) return _load_driver('sahara.run.mode', driver_name) def start_server(app): server = wsgi.Server() server.start(app) systemd.notify_once() server.wait()
LOG.debug("Remote {remote} is loading".format(remote=CONF.remote)) return _load_driver('sahara.remote', CONF.remote)
identifier_body
main.py
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
if CONF.debug and not CONF.log_exchange: LOG.debug('Logging of request/response exchange could be enabled using' ' flag --log-exchange') # Create a CORS wrapper, and attach sahara-specific defaults that must be # included in all CORS responses. app.wsgi_app = cors_middleware...
app.error_handler_spec[None][code] = make_json_error
conditional_block
TL.Media.js
el = { container: {}, content_container: {}, content: {}, content_item: {}, content_link: {}, caption: null, credit: null, parent: {}, link: null }; // Player (If Needed) this.player = null; // Timer (If Needed) this.timer = null; this.load_timer = null; // Message this.mes...
this._el.container.style.maxWidth = this.options.width + "px"; // Fix for max-width issues in Firefox if (TL.Browser.firefox) { if (this._el.content_item.offsetWidth > this._el.content_item.offsetHeight) { //this._el.content_item.style.width = "100%"; } } this._updateMediaDisplay(layout);...
random_line_split
TL.Media.js
el = { container: {}, content_container: {}, content: {}, content_item: {}, content_link: {}, caption: null, credit: null, parent: {}, link: null }; // Player (If Needed) this.player = null; // Timer (If Needed) this.timer = null; this.load_timer = null; // Message this.mes...
if (!this.data.caption && this.data.caption_alternate) { this._el.caption = TL.Dom.create("div", "tl-caption", this._el.content_container); this._el.caption.innerHTML = this.data.caption_alternate; this.options.caption_height = this._el.caption.offsetHeight; } this.updateDisplay(); }, onAdd: f...
{ this._el.credit = TL.Dom.create("div", "tl-credit", this._el.content_container); this._el.credit.innerHTML = this.data.credit_alternate; this.options.credit_height = this._el.credit.offsetHeight; }
conditional_block
extensions.js
const registry = (() => { if (!process.env.EXTENSION_DATA) { // console.log("no EXTENSION_DATA found"); return {}; } const extensions = typeof process.env.EXTENSION_DATA === "string" ? JSON.parse(process.env.EXTENSION_DATA) : process.env.EXTENSION_DATA; Object.keys(extensions).forEach((key) => { ...
console.error("Requested non-existing extension", what); return false; }; export const hasExtension = (what) => { return Object.keys(registry).includes(what); };
{ return registry[what]; }
conditional_block
extensions.js
const registry = (() => { if (!process.env.EXTENSION_DATA) { // console.log("no EXTENSION_DATA found"); return {}; } const extensions = typeof process.env.EXTENSION_DATA === "string" ? JSON.parse(process.env.EXTENSION_DATA) : process.env.EXTENSION_DATA;
extensions[key] = require(`@extensions/${extensions[key]}`).default; // eslint-disable-line } }); // console.log("extensions", extensions); return extensions; })(); export const getExtension = (what) => { if (registry[what]) { return registry[what]; } console.error("Requested non-existing e...
Object.keys(extensions).forEach((key) => { if (key.endsWith("Component")) { // console.log("loading component", key); /* "@extensions" is a webpack alias */
random_line_split
channels.js
/** * IRCAnywhere server/channels.js * * @title ChannelManager * @copyright (c) 2013-2014 http://ircanywhere.com * @license GPL v2 * @author Ricki Hastings */ var _ = require('lodash'), hooks = require('hooks'); /** * This object is responsible for managing everything related to channel records, ...
/** * Gets a tab record from the parameters passed in, strictly speaking this doesn't have to * be a channel, a normal query window will also be returned. However this class doesn't * need to work with anything other than channels. * * A new object is created but not inserted into the database if the chan...
{ this.channel = { network: '', channel: '', topic: {}, modes: '' }; // a default channel object }
identifier_body
channels.js
/** * IRCAnywhere server/channels.js * * @title ChannelManager * @copyright (c) 2013-2014 http://ircanywhere.com * @license GPL v2 * @author Ricki Hastings */ var _ = require('lodash'), hooks = require('hooks'); /** * This object is responsible for managing everything related to channel records, ...
() { this.channel = { network: '', channel: '', topic: {}, modes: '' }; // a default channel object } /** * Gets a tab record from the parameters passed in, strictly speaking this doesn't have to * be a channel, a normal query window will also be returned. However this class doesn't * need t...
ChannelManager
identifier_name
channels.js
/** * IRCAnywhere server/channels.js * * @title ChannelManager * @copyright (c) 2013-2014 http://ircanywhere.com * @license GPL v2 * @author Ricki Hastings */ var _ = require('lodash'), hooks = require('hooks'); /** * This object is responsible for managing everything related to channel records, ...
} /** * Removes a specific user from a channel, if users is omitted, channel should be equal to a nickname * and that nickname will be removed from all channels records on that network. * * @method removeUsers * @param {String} network A valid network name * @param {String} [channel] A valid channel n...
{ return []; }
conditional_block
channels.js
/** * IRCAnywhere server/channels.js * * @title ChannelManager * @copyright (c) 2013-2014 http://ircanywhere.com * @license GPL v2 * @author Ricki Hastings */ var _ = require('lodash'), hooks = require('hooks'); /** * This object is responsible for managing everything related to channel records, ...
var channel = channel.toLowerCase(), chan = this.getChannel(key, channel); var topic = { topic: topic, setter: setby || '' }; // updat the topic record application.Tabs.update({network: key, target: channel}, {$set: {topic: topic}}, {safe: false}); // update the record } exports.ChannelManag...
* @return void */ ChannelManager.prototype.updateTopic = function(key, channel, topic, setby) {
random_line_split
score.rs
use std::collections::HashMap; use std::cmp::Ordering; ///An enum to store whether a scale is major or minor. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Scale { Major, Minor } ///A type of staff display. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum StaffType { Piano, Normal } ///A...
() -> Attachments { Attachments { tie: false, start_slur: false, end_slur: false, start_beam: false, end_beam: false, articulation: Vec::new(), } } } impl Ord for Voice { fn cmp(&self, other: &Voice) -> Ordering { m...
default
identifier_name
score.rs
use std::collections::HashMap; use std::cmp::Ordering; ///An enum to store whether a scale is major or minor.
} ///A type of staff display. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum StaffType { Piano, Normal } ///A note with accidentals. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct Note { pub base: u8, pub octave: i8, pub accidentals: i8, } ///The types of possible voices. #[derive...
#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Scale { Major, Minor
random_line_split
app.js
"use strict"; function MainCtrl () { } angular .module('admin.ngApp', ['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap']) .controller('MainCtrl', MainCtrl) .config(["$asideProvider", function($asideProvider) { angular.extend( $asideProvider.defaults,{container:"body",html:!0} ...
angular.module("admin.ngApp") .controller("AsideCtrl", AsideCtrl); function TypeaheadCtrl ($scope, $http) { $scope.selectedContent = "Content"; $scope.selectedTags = "Tags"; $scope.selectedTitle = ""; $scope.getEntries = function(viewValue) { var args = {title: viewValue}; return $h...
title:"Settings", content:"<br/>" } }
random_line_split
app.js
"use strict"; function MainCtrl ()
angular .module('admin.ngApp', ['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap']) .controller('MainCtrl', MainCtrl) .config(["$asideProvider", function($asideProvider) { angular.extend( $asideProvider.defaults,{container:"body",html:!0} ); }]); function AsideCtrl ($scop...
{ }
identifier_body
app.js
"use strict"; function MainCtrl () { } angular .module('admin.ngApp', ['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap']) .controller('MainCtrl', MainCtrl) .config(["$asideProvider", function($asideProvider) { angular.extend( $asideProvider.defaults,{container:"body",html:!0} ...
($scope) { $scope.aside = { title:"Settings", content:"<br/>" } } angular.module("admin.ngApp") .controller("AsideCtrl", AsideCtrl); function TypeaheadCtrl ($scope, $http) { $scope.selectedContent = "Content"; $scope.selectedTags = "Tags"; $scope.selectedTitle = ""; $scope...
AsideCtrl
identifier_name
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File;
use errors::*; use regex::Regex; pub enum Condition { Include(Regex), Exclude(Regex), Everything, // TODO: do we need this? } impl Condition { pub fn exclude_from(spec: &str) -> Result<(PathBuf, Condition)> { let mut split = spec.splitn(2, ','); let path = PathBuf::from( s...
use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf};
random_line_split
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf}; use errors::*; use regex::Regex; pub enum Cond...
() { let from = Path::new("/dev/null"); let conds = Conditions::default(); assert_eq!( Host::named("foo*.oink.example.com", from).ineligible(&conds), true ); assert_eq!(Host::named("*", from).ineligible(&conds), true); assert_eq!( Host::named("foobar.oink.example.com", f...
test_host_eligibility
identifier_name
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf}; use errors::*; use regex::Regex; pub enum Cond...
#[test] fn test_conditions_match() { let from = Path::new("/dev/null"); let host = Host::named("foo.bar.com", from); // empty conditions means the host goes in: { let conds = Conditions::default(); assert!(conds.eligible(&host)); } // An include for the host means the host goe...
{ let from = Path::new("/dev/null"); let conds = Conditions::default(); assert_eq!( Host::named("foo*.oink.example.com", from).ineligible(&conds), true ); assert_eq!(Host::named("*", from).ineligible(&conds), true); assert_eq!( Host::named("foobar.oink.example.com", from...
identifier_body
unknown_user_apply_for_membership_unit.py
from rest_framework import generics from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from aklub.models import UserProfile, AdministrativeUnit from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope from rest_framework import serializers from rest_framework.p...
return Response( {"user_id": user.pk}, status=status.HTTP_200_OK, ) def test_apply_for_membership(administrative_unit_1, app_request): from rest_framework.reverse import reverse from freezegun import freeze_time url = reverse("unknown_user_apply_for_membership") ...
permission_classes = [TokenHasReadWriteScope | IsAuthenticated] required_scopes = ["can_create_userprofile_interaction"] serializer_class = ApplyForMembershipSerializer def post(self, request, *args, **kwargs): serializer = ApplyForMembershipSerializer(data=self.request.data) serializer.is_...
identifier_body
unknown_user_apply_for_membership_unit.py
from rest_framework import generics from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from aklub.models import UserProfile, AdministrativeUnit from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope from rest_framework import serializers from rest_framework.p...
assert new_user.interaction_set.count() == 2
random_line_split
unknown_user_apply_for_membership_unit.py
from rest_framework import generics from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from aklub.models import UserProfile, AdministrativeUnit from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope from rest_framework import serializers from rest_framework.p...
(administrative_unit_1, app_request): from rest_framework.reverse import reverse from freezegun import freeze_time url = reverse("unknown_user_apply_for_membership") post_data = { "first_name": "John", "last_name": "Dock", "telephone": "720000000", "email": "john@rock.c...
test_apply_for_membership
identifier_name
vmware_guest_find.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
) pyv = PyVmomiHelper(module) # Check if the VM exists before continuing folders = pyv.getvm_folder_paths() # VM already exists if folders: try: module.exit_json(folders=folders) except Exception as exc: module.fail_json(msg="Folde...
random_line_split
vmware_guest_find.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
(PyVmomi): def __init__(self, module): super(PyVmomiHelper, self).__init__(module) self.name = self.params['name'] self.uuid = self.params['uuid'] def getvm_folder_paths(self): results = [] # compare the folder path of each VM against the search path vmList = ge...
PyVmomiHelper
identifier_name
vmware_guest_find.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
def main(): argument_spec = vmware_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), datacenter=dict(removed_in_version=2.9, type='str') ) module = AnsibleModule(argument_spec=argument_spec, required_one_of=[['name'...
results = [] # compare the folder path of each VM against the search path vmList = get_all_objs(self.content, [vim.VirtualMachine]) for item in vmList.items(): vobj = item[0] if not isinstance(vobj.parent, vim.Folder): continue # Match by name...
identifier_body
vmware_guest_find.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
if __name__ == '__main__': main()
module.fail_json(msg="Unable to find folders for virtual machine %s" % (module.params.get('name') or module.params.get('uuid')))
conditional_block
js.rs
::new(&**root) }, } } /// Create a JS<T> from a &T #[allow(unrooted_must_root)] pub fn from_ref(obj: &T) -> JS<T> { debug_assert!(task_state::get().is_script()); JS { ptr: unsafe { NonZero::new(&*obj) }, } } } impl<T: Reflectable> Deref for JS<T> { ty...
else { None } } } } impl<T: Reflectable> LayoutJS<T> { /// Get the reflector. pub unsafe fn get_jsobject(&self) -> *mut JSObject { debug_assert!(task_state::get().is_layout()); (**self.ptr).reflector().get_jsobject().get() } } impl<T> Copy for Layou...
{ Some(mem::transmute_copy(self)) }
conditional_block
js.rs
<T> { ptr: NonZero<*const T>, } // JS<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting. // For now, we choose not to follow any such pointers. impl<T> HeapSizeOf for JS<T> { fn heap_size_of_children(&self) -> usize { 0 } } impl<T> JS<T> { /// Returns `LayoutJS...
JS
identifier_name
js.rs
: NonZero::new(addr as *const Node), } } } /// A trait to be implemented for JS-managed types that can be stored in /// mutable member fields. /// /// Do not implement this trait yourself. pub trait HeapGCValue: JSTraceable { } impl HeapGCValue for Heap<JSVal> { } impl<T: Reflectable> HeapGCValue for JS...
} } /// Start tracking a stack-based root
random_line_split
drude.py
class Drude(ut.TestCase): @ut.skipIf(not espressomd.has_features("P3M", "THOLE", "LANGEVIN_PER_PARTICLE"), "Test needs P3M, THOLE and LANGEVIN_PER_PARTICLE") def test(self): """ Sets up a BMIM PF6 pair separated in y-direction with fixed cores. Adds the Drude particles and related fea...
import espressomd.interactions from espressomd import drude_helpers
random_line_split
drude.py
strom * kJ/mol coulomb_prefactor = 1.67101e5 * kb_kjmol #POLARIZATION #polarization = 1.0 #In (Angstrom^3)_CGS # alpha_SI = 4*Pi*eps_0 alpha_CGS; # 4*Pi*epsilon_0*Angstrom^3/((elementary charge)^2*Angstrom^2*N_A/kJ) conv_pol_CGS_SI = 7.197586e-4 #alpha = conv_po...
calc_pol
identifier_name
drude.py
ref_mu0_c1 = [0.00076652, 0.15238767, 0.00135291] ref_mu0_c2 = [-0.00020222, 0.11084197, 0.00135842] ref_mu0_c3 = [0.00059177, 0.23949626, -0.05238468] ref_mu0_bmim = [0.00115606, 0.5027259, -0.04967335] #Polarisation Tensor diagonals ref_pol_pf6 = [ 4.553569...
@ut.skipIf(not espressomd.has_features("P3M", "THOLE", "LANGEVIN_PER_PARTICLE"), "Test needs P3M, THOLE and LANGEVIN_PER_PARTICLE") def test(self): """ Sets up a BMIM PF6 pair separated in y-direction with fixed cores. Adds the Drude particles and related features (intramolecular exclusion b...
identifier_body
drude.py
dt = time_step_fs * fs_to_md_time #COM TEMPERATURE #Global thermostat temperature, for com and langevin. #LangevinPerParticle temperature is set to 0 for drude and core to properly account for com forces. # Like that, langevin thermostat can still be used for non-drude #...
system.integrator.run(1) dm_pf6.append(dipole_moment(0, 1)) dm_C1.append(dipole_moment(2, 3)) dm_C2.append(dipole_moment(4, 5)) dm_C3.append(dipole_moment(6, 7))
conditional_block
index.ts
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future * Default: 0 */ id?: number; /** * First row of the notification * Default: Empty string (iOS) or the app name (Android) */ title?: string; /** * Second row of the notification * De...
/** * Checks presence of a notification * @param notificationId {number} * @returns {Promise<boolean>} */ @Cordova() isPresent(notificationId: number): Promise<boolean> { return; } /** * Checks is a notification is scheduled * @param notificationId {number} * @returns {Promise<boolean>} ...
{ return; }
identifier_body
index.ts
/** * A unique identifier required to clear, cancel, update or retrieve the local notification in the future * Default: 0 */ id?: number; /** * First row of the notification * Default: Empty string (iOS) or the app name (Android) */ title?: string; /** * Second row of the notification ...
* This plugin allows you to display local notifications on the device * * @usage * ```typescript * import { LocalNotifications } from '@ionic-native/local-notifications'; * * * constructor(private localNotifications: LocalNotifications) { } * * ... * * * // Schedule a single notification * this.localNotif...
/** * @name Local Notifications * @description
random_line_split
index.ts
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future * Default: 0 */ id?: number; /** * First row of the notification * Default: Empty string (iOS) or the app name (Android) */ title?: string; /** * Second row of the notification * De...
(): Promise<Array<ILocalNotification>> { return; } /** * Register permission to show notifications if not already granted. * @returns {Promise<boolean>} */ @Cordova() registerPermission(): Promise<boolean> { return; } /** * Informs if the app has the permission to show notifications. * @returns...
getAllTriggered
identifier_name
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
(cx: &Context, did: ast::DefId, value: &str) -> bool { cx.tcx.get_attrs(did).iter().any(|attr| { match attr.node.value.node { ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => { match val.node { ast::LitStr(ref v, _) if &**v == value => { ...
match_lang_did
identifier_name
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
} /// Checks if a type has a #[servo_lang = "str"] attribute pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { match ty.node { TyPath(..) => {}, _ => return false, } let def_id = match cx.tcx.def_map.borrow().get(&ty.id) { Some(&def::PathResolution { base_def: def:...
} }, _ => None }
random_line_split
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
} /// Checks if a type has a #[servo_lang = "str"] attribute pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { match ty.node { TyPath(..) => {}, _ => return false, } let def_id = match cx.tcx.def_map.borrow().get(&ty.id) { Some(&def::PathResolution { base_def: def...
{ match ty.node { TyPath(_, Path {segments: ref seg, ..}) => { // So ast::Path isn't the full path, just the tokens that were provided. // I could muck around with the maps and find the full path // however the more efficient way is to simply reverse the iterators and zip...
identifier_body
note_pitch.rs
// Copyright 2017 Google Inc. 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 applicable...
pub struct NotePitch { value: f32, } impl NotePitch { pub fn new() -> NotePitch { NotePitch { value: 0.0 } } } impl Module for NotePitch { fn n_ctrl_out(&self) -> usize { 1 } fn handle_note(&mut self, midi_num: f32, _velocity: f32, on: bool) { if on { self.value = midi...
random_line_split
note_pitch.rs
// Copyright 2017 Google Inc. 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 applicable...
} fn process(&mut self, _control_in: &[f32], control_out: &mut [f32], _buf_in: &[&Buffer], _buf_out: &mut [Buffer]) { control_out[0] = self.value; } }
{ self.value = midi_num * (1.0 / 12.0) + (440f32.log2() - 69.0 / 12.0); }
conditional_block
note_pitch.rs
// Copyright 2017 Google Inc. 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 applicable...
{ value: f32, } impl NotePitch { pub fn new() -> NotePitch { NotePitch { value: 0.0 } } } impl Module for NotePitch { fn n_ctrl_out(&self) -> usize { 1 } fn handle_note(&mut self, midi_num: f32, _velocity: f32, on: bool) { if on { self.value = midi_num * (1.0 / 12.0) ...
NotePitch
identifier_name
note_pitch.rs
// Copyright 2017 Google Inc. 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 applicable...
fn process(&mut self, _control_in: &[f32], control_out: &mut [f32], _buf_in: &[&Buffer], _buf_out: &mut [Buffer]) { control_out[0] = self.value; } }
{ if on { self.value = midi_num * (1.0 / 12.0) + (440f32.log2() - 69.0 / 12.0); } }
identifier_body
extern-call-scrub.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { count(data - 1u) + count(data - 1u) } } fn count(n: uint) -> uint { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { ...
{ data }
conditional_block
extern-call-scrub.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
mod rustrt { use std::libc; #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) -> libc::uintptr_t; } } extern fn cb(data: libc::uintptr_t) -> libc::uintp...
use std::libc; use std::task;
random_line_split
extern-call-scrub.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { let result = count(12u); println!("result = {}", result); assert_eq!(result, 2048u); }); }
{ unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) } }
identifier_body