code
stringlengths
4
991k
repo_name
stringlengths
6
116
path
stringlengths
4
249
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
4
991k
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; namespace Window { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // ƒ^ƒCƒgƒ‹‚̕ύX Window.Title = "Ookumaneko"; // ƒ}ƒEƒXƒJ[ƒ\ƒ‹‚ð•\ަ‚·‚é IsMouseVisible = true; // ‹N“®’†‚ɃTƒCƒY‚ð•ύX‚Å‚«‚邿‚¤‚É‚·‚é Window.AllowUserResizing = true; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); } protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); } } }
ookumaneko/Blog_XNA
Window/Window/Window/Game1.cs
C#
mit
1,692
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 7513, 1012, 1060, 2532, 1012, 7705, 1025, 2478, 7513, 1012, 1060, 2532, 1012, 7705, 1012, 5746, 1025, 2478, 7513, 1012, 1060, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright 2009-2016 David Hadka * * This file is part of the MOEA Framework. * * The MOEA Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * The MOEA Framework is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the MOEA Framework. If not, see <http://www.gnu.org/licenses/>. */ package org.moeaframework.examples.ga.onemax; import org.moeaframework.core.Solution; import org.moeaframework.core.variable.BinaryVariable; import org.moeaframework.problem.AbstractProblem; /** * The one-max problem for maximizing the number of {@code 1} bits in a binary * string. The one-max problem is trivial for most GAs, and is often used to * measure the convergence speed of different crossover and mutation operators. */ public class OneMax extends AbstractProblem { /** * The number of bits in this OneMax problem instance. */ private final int numberOfBits; /** * Constructs the one-max problem with the specified number of bits. * * @param numberOfBits the number of bits in this instance */ public OneMax(int numberOfBits) { super(1, 1); this.numberOfBits = numberOfBits; } @Override public void evaluate(Solution solution) { BinaryVariable binary = (BinaryVariable)solution.getVariable(0); solution.setObjective(0, numberOfBits - binary.cardinality()); } @Override public Solution newSolution() { Solution solution = new Solution(1, 1); solution.setVariable(0, new BinaryVariable(numberOfBits)); return solution; } }
patrickneubauer/XMLIntellEdit
xmlintelledit/intelledit/lib/MOEAFramework-2.12.tar/MOEAFramework-2.12/examples/org/moeaframework/examples/ga/onemax/OneMax.java
Java
mit
1,956
[ 30522, 1013, 1008, 9385, 2268, 1011, 2355, 2585, 2018, 2912, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 22078, 2050, 7705, 1012, 1008, 1008, 1996, 22078, 2050, 7705, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; module.exports = { env: 'test' };
anishreddy202/ng2-scaffold
server/sdk/test/config.js
JavaScript
mit
51
[ 30522, 1005, 2224, 9384, 1005, 1025, 11336, 1012, 14338, 1027, 1063, 4372, 2615, 1024, 1005, 3231, 1005, 1065, 1025, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNet.Mvc.ModelBinding.Validation { /// <summary> /// A default implementation of <see cref="IClientModelValidatorProvider"/>. /// </summary> /// <remarks> /// The <see cref="DefaultClientModelValidatorProvider"/> provides validators from /// <see cref="IClientModelValidator"/> instances in <see cref="ModelMetadata.ValidatorMetadata"/>. /// </remarks> public class DefaultClientModelValidatorProvider : IClientModelValidatorProvider { /// <inheritdoc /> public void GetValidators(ClientValidatorProviderContext context) { foreach (var metadata in context.ValidatorMetadata) { var validator = metadata as IClientModelValidator; if (validator != null) { context.Validators.Add(validator); } } } } }
peterstevens130561/sonarlint-vs
its/Mvc-dev_b245996949/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs
C#
lgpl-3.0
1,080
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 1012, 5658, 3192, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1012, 2156, 6105, 1012, 19067, 2102, 1999, 1996, 2622, 7117, 2005, 6105, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jsonp({"cep":"72630403","logradouro":"Quadra Quadra 404 Conjunto 3","bairro":"Recanto das Emas","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
lfreneda/cepdb
api/v1/72630403.jsonp.js
JavaScript
cc0-1.0
162
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 5824, 2575, 14142, 12740, 2509, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 17718, 2527, 17718, 2527, 24837, 9530, 19792, 3406, 1017, 1000, 1010, 1000...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_02) on Mon Apr 25 06:16:42 CEST 2016 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>org.gradle.api.plugins.jetty (Gradle API 2.13)</title> <meta name="date" content="2016-04-25"> <link rel="stylesheet" type="text/css" href="../../../../../javadoc.css" title="Style"> </head> <body> <h1 class="bar"><a href="../../../../../org/gradle/api/plugins/jetty/package-summary.html" target="classFrame">org.gradle.api.plugins.jetty</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="AbstractJettyRunTask.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">AbstractJettyRunTask</a></li> <li><a href="JettyPlugin.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">JettyPlugin</a></li> <li><a href="JettyPluginConvention.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">JettyPluginConvention</a></li> <li><a href="JettyRun.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">JettyRun</a></li> <li><a href="JettyRunWar.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">JettyRunWar</a></li> <li><a href="JettyStop.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">JettyStop</a></li> <li><a href="ScanTargetPattern.html" title="class in org.gradle.api.plugins.jetty" target="classFrame">ScanTargetPattern</a></li> </ul> </div> </body> </html>
HenryHarper/Acquire-Reboot
gradle/docs/javadoc/org/gradle/api/plugins/jetty/package-frame.html
HTML
mit
1,627
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 30524, 2094, 1000, 1028, 1026, 999, 1011, 1011, 2047, 13704, 1011, 1011, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过下列属性集 // 控制。更改这些属性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("BookManage.BLL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BookManage.BLL")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 属性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("a9a59cfc-cb72-4464-a3c2-f723f5a50bdc")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 内部版本号 // 修订号 // // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
marlonwang/BookManage
BookManage.BLL/Properties/AssemblyInfo.cs
C#
gpl-2.0
1,324
[ 30522, 2478, 2291, 1012, 9185, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 6970, 11923, 2121, 7903, 2229, 1025, 1013, 1013, 1873, 100, 100, 100, 100, 1916, 100, 100, 1767, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>Image gallery</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="resources/style.css" type="text/css" /> <script type="text/javascript" src="resources/prefixfree.js"></script> <script type="text/javascript" src="resources/jquery.min.js"></script> <script type="text/javascript" src="resources/webgl-utils.js"></script> <script type="text/javascript" src="resources/WebGLFrame.js"></script> <script type="text/javascript" src="resources/neoBox.js"></script> </head> <body> <header id="header"> <h1>Image gallery</h1> <div id="htmlLogo"> <img src="resources/HTML5_logo.png" alt="HTML5 logo" /> </div> </header> <section id="section"> <header id="effects"> <div id="openEffects"> <h2>Open effect</h2> </div> <div id="closeEffects"> <h2>Close effect</h2> </div> <div id="switchEffects"> <h2>Switch effect</h2> </div> <span id="randomEffects">Choose random effects</span> </header> <div id="gallery"> <figure class="neoGallery"> <img src="resources/imgs/3437096285_c7da14ba27_b.jpg" width="240" height="150" /> <figcaption class="shortDesc"> Spring </figcaption> <figcaption class="longDesc"> <ul> <li><a href="http://www.flickr.com/photos/9619972@N08/3437096285/">by just.Luc </a></li> <li><a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">AttributionNoncommercialShare Alike Some rights reserved</a></li> <li>Taken on Apr 5, 2009</li> </ul> <div class="desc"> <blockquote>Spring is nature"s way of saying, "Let's party!" (Robin Williams)</blockquote> </div> </figcaption> </figure> <figure class="neoGallery"> <img src="resources/imgs/4452255702_422bbec040_o.jpg" width="240" height="150" /> <figcaption class="shortDesc"> ~ Spring ~ </figcaption> <figcaption class="longDesc"> <ul class="info"> <li><a href="http://www.flickr.com/photos/uteart/4452255702/">By uteart</a></li> <li><a href="http://creativecommons.org/licenses/by/2.0/deed.en">Some rights reserved</a></li> <li>Taken on March 20, 2007</li> </ul> <div class="desc"> <p>Spring-view looking up from my patio (((:</p> <p>A Primaver tree in full bloom - Mexico - (Spring tree)</p> <p>texture by skeletalmess</p> </div> </figcaption> </figure> <figure class="neoGallery"> <img src="resources/imgs/420955435_f8f05f1176_b.jpg" width="240" height="150" /> <figcaption class="shortDesc"> Spring Time in Tennessee </figcaption> <figcaption class="longDesc"> <ul class="info"> <li><a href="http://www.flickr.com/photos/countryboy1949/420955435/">By countryboy1949</a></li> <li><a href="http://creativecommons.org/licenses/by-nc/2.0/deed.en">Some rights reserved</a></li> <li>Taken on March 20, 2007</li> </ul> <div class="desc"> <p>Spring has sprung in Tennessee- #40 on</p> <p>Explore ~Thank You</p> </div> </figcaption> </figure> <figure class="neoGallery"> <img src="resources/imgs/7015169757_56ea71111b_b.jpg" width="240" height="150" /> <figcaption class="shortDesc"> Spring Came </figcaption> <figcaption class="longDesc"> <ul class="info"> <li><a href="http://www.flickr.com/photos/nawyspie/7015169757/">By NaWyspie</a></li> <li><a href="http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en">Some rights reserved</a></li> <li>Taken on March 25, 2012</li> </ul> <div class="desc"> <p>Spring in Cyprus, visit <a href="http://tomasz.cc/">tomasz.cc</a> for more!</p> </div> </figcaption> </figure> <figure class="neoGallery"> <img src="resources/imgs/4456023020_0d64a411f2_b.jpg" width="240" height="150" /> <figcaption class="shortDesc"> Spring is here </figcaption> <figcaption class="longDesc"> <ul class="info"> <li><a href="http://www.flickr.com/photos/ashleycampbellphotography/4456023020/">By Ashley Campbell Photography</a></li> <li><a href="http://creativecommons.org/licenses/by/2.0/deed.en">Some rights reserved</a></li> <li>Taken on March 20, 2010</li> </ul> <div class="desc"> <p>Spring is finally here! SOOC.</p> </div> </figcaption> </figure> <figure class="neoGallery"> <img src="resources/imgs/5607795855_628ce8645d_b.jpg" width="240" height="150" /> <figcaption class="shortDesc"> Spring Delight </figcaption> <figcaption class="longDesc"> <ul class="info"> <li><a href="http://www.flickr.com/photos/pavelahmed/5607795855/">By Pavel ahmed</a></li> <li><a href="http://creativecommons.org/licenses/by/2.0/deed.en">Some rights reserved</a></li> <li>Taken on April 9, 2011</li> </ul> <div class="desc"> <p>All the spring comes ones again!!</p> <p>Enjoy, Have a nice week ahead everyone.</p> <p><a href="http://bighugelabs.com/onblack.php?id=5607795855">View On Black</a></p> <p><a href="http://www.fluidr.com/photos/pavelahmed">www.fluidr.com/photos/pavelahmed</a></p> </div> </figcaption> </figure> </section> </div> <footer id="footer">Done by <a href="http://neo.infeo.pl/">Tomasz Kołodziejski</a>, Mozilla Dev Derby March 2012.</footer> </body> </html>
neojski/image-gallery
index.html
HTML
mit
7,472
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 3746, 3916, 1026, 1013, 2516, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 4180, 30524, 1000, 3793, 1013, 20116, 2015, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
export interface iGlobalConfig { database?: any; universe?: any; network?: any; }
jorsi/reverie
src/server/data/iGlobalConfig.ts
TypeScript
mit
93
[ 30522, 9167, 8278, 1045, 23296, 16429, 2389, 8663, 8873, 2290, 1063, 7809, 1029, 1024, 2151, 1025, 5304, 1029, 1024, 2151, 1025, 2897, 1029, 1024, 2151, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30524, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
\documentclass{article} \usepackage[spanish]{babel} \usepackage[utf8]{inputenc} \usepackage{fullpage} \usepackage{graphicx} \title{ \LARGE{PyTiger2C} \\ \Large{Documentación de la interfaz gráfica} } \author{ Yasser González Fernández \\ \small{ygonzalezfernandez@gmail.com} \and Ariel Hernández Amador \\ \small{gnuaha7@gmail.com} } \date{} \begin{document} \maketitle \thispagestyle{empty} \newpage \setcounter{page}{1} Este documento muestra, de manera general, los pasos a seguir para crear un nuevo programa Tiger utilizando la interfaz gráfica de PyTiger2C. Además, ilustra otras funcionalidades de la interfaz gráfica como la posibilidad de mostrar el árbol de sintáxis abstracta correspondiente al programa y el código C generado. La interfaz gráfica puede iniciarse ejecutando el \emph{script} Python \texttt{gpytiger2c.py} que se encuentra en el directorio \texttt{scripts} de la distribución en código fuente de PyTiger2C. Al ejecutar este \emph{script}, se mostrará la ventana principal de la interfaz gráfica como se ilustra en la figura~\ref{fig:1-main-window}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/1-main-window} \caption{Ventana principal.} \label{fig:1-main-window} \end{figure} El elemento principal de esta ventana es el control \emph{GtkSorceViewer} que permite introducir el código fuente del programa en el lenguaje Tiger. Este control brinda las siguientes funcionalidades: resaltado de sintáxis a partir de una descripción de la estructura del lenguaje mediante un archivo XML, permite deshacer y rehacer los cambios hechos durante la edición, muestra el número de cada línea del archivo y resalta la línea donde se encuentra el cursor y los caracteres que deben una pareja como paréntesis, llaves y corchetes. \newpage Las funcionalidades disponibles durante la edición descritas anteriormente se ilustran en la figura~\ref{fig:2-editing} con una implementación del conocido programa \emph{Hello, World!} en el lenguaje Tiger. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/2-editing} \caption{Creación de un programa.} \label{fig:2-editing} \end{figure} \newpage Luego de terminada la edición del nuevo programa Tiger y antes de efectuar su compilación se debe guardar el programa en un nuevo archivo. Para hacer esto se puede utilizar el elemento \emph{Save As...} del menú \emph{File} como se ilustra en la figura~\ref{fig:3-saving-as}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/3-saving-as} \caption{Guardando el nuevo programa creado.} \label{fig:3-saving-as} \end{figure} \newpage La acción anterior mostrará un diálogo donde se debe especificar el nombre que deberá tener el archivo, el directorio donde se guardará y confirmar utilizando el botón \emph{Save As} como se ilustra en la figura~\ref{fig:4-save-as}. \begin{figure}[htb] \centering \includegraphics[width=6in]{gui/4-save-as} \caption{Introduciendo el nombre del nuevo archivo.} \label{fig:4-save-as} \end{figure} \newpage Una vez guardado el nuevo programa Tiger en un archivo es posible compilarlo utilizando el elemento \emph{Build} del menú \emph{Project} como se ilustra en la figura~\ref{fig:5-building}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/5-building} \caption{Compilando el nuevo programa.} \label{fig:5-building} \end{figure} \newpage Si el programa Tiger no tiene ningún error se mostrará, en la pestaña \emph{Build Output}, un mensaje indicando que el proceso de compilación finalizó correctamente como se ilustra en la figura~\ref{fig:6-build-succeded}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/6-build-succeded} \caption{Mensaje indicando que el proceso de compilación finalizó correctamente.} \label{fig:6-build-succeded} \end{figure} \newpage Si el programa Tiger tuviera algún error semántico o sintáctico se mostrarán los mensajes correspondiente en la pestaña \emph{Build Output}. Por ejemplo, la figura~\ref{fig:7-build-errors} muestra el mismo programa \emph{Hello, World!} pero se ha sustituído el llamado a \texttt{print} de la línea 4 por un llamado a \texttt{printi}; esto genera un error semántico ya que la función \texttt{printi} recibe un \texttt{int} como argumento y se está llamando con un argumento \texttt{string}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/7-build-errors} \caption{Mensaje indicando los errores presentes en el programa.} \label{fig:7-build-errors} \end{figure} \newpage Una vez que el programa se ha compilado correctamente es posible ejecutarlo desde la interfaz gráfica utilizando el elemento \emph{Run} del menú \emph{Project} como se ilustra en la figura~\ref{fig:8-running}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/8-running} \caption{Ejecutando el nuevo programa.} \label{fig:8-running} \end{figure} \newpage La salida \emph{standard} y de errores del programa se mostrará en la pestaña \emph{Program Output} como se ilustra en la figura~\ref{fig:9-program-output}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/9-program-output} \caption{Salida del programa.} \label{fig:9-program-output} \end{figure} \newpage Es posible ver el código C generado para el programa Tiger durante el proceso de compilación. Para esto se utiliza el elemento \emph{C Code} del menú \emph{View} como se ilustra en la figura~\ref{fig:10-viewing-code}. Al hacer esto, se mostrará una ventana auxiliar con el código C como ilustra en la figura~\ref{fig:11-code-viewer}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/10-viewing-code} \caption{Ver el código C generado para el programa.} \label{fig:10-viewing-code} \end{figure} \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/11-code-viewer} \caption{Ventana auxiliar mostrando el código C generado para el programa.} \label{fig:11-code-viewer} \end{figure} \newpage La interfaz gráfica permite además ver el árbol de sintáxis abstracta correspondiente al programa en edición. Esto puede hacerce mediante el elemento \emph{AST} del menú \emph{View} como se ilustra en la figura~\ref{fig:12-viewing-ast}. Al hacer esto, se mostrará una ventana auxiliar con el árbol de sintáxis abstracta como se ilustra en la figura~\ref{fig:13-ast-viewer}. \begin{figure}[htb] \centering \includegraphics[width=5.5in]{gui/12-viewing-ast} \caption{Ver el árbol de sintáxis abstracta correspondiente al programa.} \label{fig:12-viewing-ast} \end{figure} \begin{figure}[htb] \centering \includegraphics[width=6.5in]{gui/13-ast-viewer} \caption{Ventana auxiliar mostrando el árbol de sintáxis abstracta correspondiente al programa.} \label{fig:13-ast-viewer} \end{figure} \end{document}
yasserglez/pytiger2c
docs/gui.tex
TeX
mit
6,933
[ 30522, 1032, 6254, 26266, 1063, 3720, 1065, 1032, 2224, 23947, 4270, 1031, 3009, 1033, 1063, 11561, 2140, 1065, 1032, 2224, 23947, 4270, 1031, 21183, 2546, 2620, 1033, 1063, 7953, 2368, 2278, 1065, 1032, 2224, 23947, 4270, 1063, 2440, 13704...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{% extends "graphos/gchart/base.html" %} {% block create_chart %} var chart = new google.visualization.LineChart(document.getElementById('{{ chart.get_html_id }}')); {% endblock %}
aorzh/django-graphos
graphos/templates/graphos/gchart/line_chart.html
HTML
bsd-2-clause
183
[ 30522, 1063, 1003, 8908, 1000, 10629, 2891, 1013, 1043, 7507, 5339, 1013, 2918, 1012, 16129, 1000, 1003, 1065, 1063, 1003, 3796, 3443, 1035, 3673, 1003, 1065, 13075, 3673, 1027, 2047, 8224, 1012, 5107, 3989, 1012, 2240, 7507, 5339, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* 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/. */ package info.zamojski.soft.towercollector.collector.converters; import android.os.Build; import android.telephony.CellIdentityCdma; import android.telephony.CellIdentityGsm; import android.telephony.CellIdentityLte; import android.telephony.CellIdentityNr; import android.telephony.CellIdentityTdscdma; import android.telephony.CellIdentityWcdma; import android.telephony.CellInfo; import android.telephony.CellInfoCdma; import android.telephony.CellInfoGsm; import android.telephony.CellInfoLte; import android.telephony.CellInfoNr; import android.telephony.CellInfoTdscdma; import android.telephony.CellInfoWcdma; import info.zamojski.soft.towercollector.MyApplication; import info.zamojski.soft.towercollector.collector.validators.specific.WcdmaCellValidator; import info.zamojski.soft.towercollector.model.Cell; import timber.log.Timber; public class CellIdentityConverter { private final WcdmaCellValidator wcdmaValidator; public CellIdentityConverter(WcdmaCellValidator wcdmaValidator) { this.wcdmaValidator = wcdmaValidator; } public Cell convert(CellInfo cellInfo) { Cell cell = new Cell(); cell.setNeighboring(!cellInfo.isRegistered()); if (cellInfo instanceof CellInfoGsm) { CellInfoGsm gsmCellInfo = (CellInfoGsm) cellInfo; CellIdentityGsm identity = gsmCellInfo.getCellIdentity(); if (wcdmaValidator.isValid(identity)) { Timber.d("update(): Updating WCDMA reported by API 17 as GSM"); cell.setWcdmaCellInfo(identity.getMcc(), identity.getMnc(), identity.getLac(), identity.getCid(), identity.getPsc()); } else { cell.setGsmCellInfo(identity.getMcc(), identity.getMnc(), identity.getLac(), identity.getCid()); } } else if (cellInfo instanceof CellInfoWcdma) { CellInfoWcdma wcdmaCellInfo = (CellInfoWcdma) cellInfo; CellIdentityWcdma identity = wcdmaCellInfo.getCellIdentity(); cell.setWcdmaCellInfo(identity.getMcc(), identity.getMnc(), identity.getLac(), identity.getCid(), identity.getPsc()); } else if (cellInfo instanceof CellInfoLte) { CellInfoLte lteCellInfo = (CellInfoLte) cellInfo; CellIdentityLte identity = lteCellInfo.getCellIdentity(); cell.setLteCellInfo(identity.getMcc(), identity.getMnc(), identity.getTac(), identity.getCi(), identity.getPci()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && cellInfo instanceof CellInfoNr) { CellInfoNr lteCellInfo = (CellInfoNr) cellInfo; CellIdentityNr identity = (CellIdentityNr) lteCellInfo.getCellIdentity(); cell.setNrCellInfo(identity.getMccString(), identity.getMncString(), identity.getTac(), identity.getNci(), identity.getPci()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && cellInfo instanceof CellInfoTdscdma) { CellInfoTdscdma lteCellInfo = (CellInfoTdscdma) cellInfo; CellIdentityTdscdma identity = lteCellInfo.getCellIdentity(); cell.setTdscdmaCellInfo(identity.getMccString(), identity.getMncString(), identity.getLac(), identity.getCid(), identity.getCpid()); } else if (cellInfo instanceof CellInfoCdma) { CellInfoCdma cdmaCellInfo = (CellInfoCdma) cellInfo; CellIdentityCdma identity = cdmaCellInfo.getCellIdentity(); cell.setCdmaCellInfo(identity.getSystemId(), identity.getNetworkId(), identity.getBasestationId()); } else { throw new UnsupportedOperationException("Cell identity type not supported `" + cellInfo.getClass().getName() + "`"); } return cell; } public String createCellKey(Cell cell) { StringBuilder sb = new StringBuilder(); sb.append(cell.getMcc()) .append("_").append(cell.getMnc()) .append("_").append(cell.getLac()) .append("_").append(cell.getCid()); return sb.toString(); } public String createCellKey(CellInfo cellInfo) { StringBuilder sb = new StringBuilder(); if (cellInfo instanceof CellInfoGsm) { CellInfoGsm gsmCellInfo = (CellInfoGsm) cellInfo; CellIdentityGsm identity = gsmCellInfo.getCellIdentity(); sb.append(identity.getMcc()) .append("_").append(identity.getMnc()) .append("_").append(identity.getLac()) .append("_").append(identity.getCid()); } else if (cellInfo instanceof CellInfoWcdma) { CellInfoWcdma wcdmaCellInfo = (CellInfoWcdma) cellInfo; CellIdentityWcdma identity = wcdmaCellInfo.getCellIdentity(); sb.append(identity.getMcc()) .append("_").append(identity.getMnc()) .append("_").append(identity.getLac()) .append("_").append(identity.getCid()); } else if (cellInfo instanceof CellInfoLte) { CellInfoLte lteCellInfo = (CellInfoLte) cellInfo; CellIdentityLte identity = lteCellInfo.getCellIdentity(); sb.append(identity.getMcc()) .append("_").append(identity.getMnc()) .append("_").append(identity.getTac()) .append("_").append(identity.getCi()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && cellInfo instanceof CellInfoNr) { CellInfoNr nrCellInfo = (CellInfoNr) cellInfo; CellIdentityNr identity = (CellIdentityNr) nrCellInfo.getCellIdentity(); sb.append(identity.getMccString()) .append("_").append(identity.getMncString()) .append("_").append(identity.getTac()) .append("_").append(identity.getNci()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && cellInfo instanceof CellInfoTdscdma) { CellInfoTdscdma tdscdmaCellInfo = (CellInfoTdscdma) cellInfo; CellIdentityTdscdma identity = tdscdmaCellInfo.getCellIdentity(); sb.append(identity.getMccString()) .append("_").append(identity.getMncString()) .append("_").append(identity.getLac()) .append("_").append(identity.getCid()); } else if (cellInfo instanceof CellInfoCdma) { CellInfoCdma cdmaCellInfo = (CellInfoCdma) cellInfo; CellIdentityCdma identity = cdmaCellInfo.getCellIdentity(); sb.append(Cell.UNKNOWN_CID) .append("_").append(identity.getSystemId()) .append("_").append(identity.getNetworkId()) .append("_").append(identity.getBasestationId()); } else { Exception ex = new UnsupportedOperationException("Cell identity type not supported `" + cellInfo.getClass().getName() + "` = `" + cellInfo.toString() + "`"); Timber.e(ex); MyApplication.handleSilentException(ex); } return sb.toString(); } }
zamojski/TowerCollector
app/src/main/java/info/zamojski/soft/towercollector/collector/converters/CellIdentityConverter.java
Java
mpl-2.0
7,256
[ 30522, 1013, 1008, 2023, 3120, 3642, 2433, 2003, 3395, 2000, 1996, 3408, 1997, 1996, 9587, 5831, 4571, 2270, 1008, 6105, 1010, 1058, 1012, 1016, 1012, 1014, 1012, 2065, 1037, 6100, 1997, 1996, 6131, 2140, 2001, 2025, 5500, 2007, 2023, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Windows.Data; namespace SqlServerRunnerNet.Infrastructure.Converters { public class FractionConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var value1 = (int)values[0]; var value2 = (int)values[1]; if (Math.Abs(value2) < 1e-6) return 0; return value1 / (double)value2; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }
kosmakoff/SqlRunnerNet
SqlServerRunnerNet/Infrastructure/Converters/FractionConverter.cs
C#
mit
611
[ 30522, 30524, 2291, 1012, 3645, 1012, 2951, 1025, 3415, 15327, 29296, 8043, 6299, 23195, 7159, 1012, 6502, 1012, 10463, 2545, 1063, 2270, 2465, 12884, 8663, 16874, 2121, 1024, 10047, 11314, 11444, 7630, 8586, 2239, 16874, 2121, 1063, 2270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//+------------------------------------------------------------------+ //| Método de Mínimos Quadrados | //| Copyright © 2014, Cleiton Gomes; Vanessa Barbosa | //| http://www.softwarecsg.com.br | //+------------------------------------------------------------------+ #include <stdio.h> #include <stdlib.h> double calculoCoeficienteLinear(); double calculoCoeficienteAngular(); double calculoCoeficienteLinear(int quantidadeVelas){ FILE *arquivo; double x[quantidadeVelas], y[quantidadeVelas]; double soma_x = 0, soma_y = 0; double numerador, denominador; double variacaoLinear; int i; arquivo = fopen("dadosMinimosQuadrados.txt","rt"); for(i = 1; i < quantidadeVelas; i++){ fscanf(arquivo, "%lf",&x[i]); fscanf(arquivo, "%lf",&y[i]); soma_x = soma_x + x[i]; soma_y = soma_y + y[i]; } for(i = 1; i < quantidadeVelas; i++){ numerador = x[i]*(y[i] - soma_x/quantidadeVelas); denominador = y[i]*(x[i] - soma_y/quantidadeVelas); } variacaoLinear = numerador/denominador; fclose(arquivo); return variacaoLinear; } double calculoCoeficienteAngular(int quantidadeVelas){ FILE *arquivo; double x[quantidadeVelas], y[quantidadeVelas]; double soma_x = 0, soma_y = 0; double variacaoAngular; int i; arquivo = fopen("dadosMinimosQuadrados.txt","rt"); for(i = 1; i < quantidadeVelas; i++){ fscanf(arquivo, "%lf",&x[i]); fscanf(arquivo, "%lf",&y[i]); soma_x = soma_x + x[i]; soma_y = soma_y + y[i]; } variacaoAngular = soma_y/quantidadeVelas - (calculoCoeficienteLinear(quantidadeVelas)*soma_x/quantidadeVelas); fclose(arquivo); return variacaoAngular; }
cleitoncsg/investMVC
metodosNumericosTeste/minimosQuadrados.c
C
gpl-3.0
1,882
[ 30522, 1013, 1013, 1009, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# leaflet-control-legend Leaflet control for legends. Legends can be added to the control. ## Demo http://jblarsen.github.io/leaflet-control-legend/ ## Requirements Leaflet and moment. http://leafletjs.com/ http://momentjs.com/ ## Usage Install the dependencies and include the Javascript and CSS file in this repository in your application. Example usage: var legendControl = new L.Control.Legend; map.addControl(legendControl); legendControl.addLegend({ imageUrl: 'images/colorbar2.png', attribution: '<a href="http://fcoo.dk">FCOO</a>', longName: 'Temperature', units: 'degC', lastUpdated: moment(new Date) }); ## Attribution Original code based on: https://github.com/buche/leaflet-openweathermap
FCOO/leaflet-tilelayer-impact
bower_components/leaflet-control-legend/README.md
Markdown
mit
803
[ 30522, 1001, 7053, 7485, 1011, 2491, 1011, 5722, 7053, 7485, 2491, 2005, 9489, 1012, 9489, 2064, 2022, 2794, 2000, 1996, 2491, 1012, 1001, 1001, 9703, 8299, 1024, 1013, 1013, 1046, 28522, 22573, 2078, 1012, 21025, 2705, 12083, 1012, 22834, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="da_DK"> <context> <name>ShowDesktop</name> <message> <location filename="../showdesktop.cpp" line="48"/> <source>Show desktop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../showdesktop.cpp" line="58"/> <source>Show Desktop: Global shortcut &apos;%1&apos; cannot be registered</source> <translation>Vis Skrivebord: Global genvej &apos;%1&apos; kan ikke registreres</translation> </message> <message> <location filename="../showdesktop.cpp" line="63"/> <source>Show Desktop</source> <translation>Vis Skrivebord</translation> </message> </context> </TS>
npmiller/lxqt-panel
plugin-showdesktop/translations/showdesktop_da_DK.ts
TypeScript
lgpl-2.1
784
[ 30522, 1026, 1029, 20950, 2544, 1027, 1000, 1015, 1012, 1014, 1000, 17181, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1029, 1028, 1026, 999, 9986, 13874, 24529, 1028, 1026, 24529, 2544, 1027, 1000, 1016, 1012, 1015, 1000, 2653, 1027, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Data.Entity; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; namespace YourGrowth.Models { // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return userIdentity; } } }
wolfbinary/YourGrowth
YourGrowth/Models/IdentityModels.cs
C#
gpl-2.0
880
[ 30522, 2478, 2291, 1012, 2951, 1012, 9178, 1025, 2478, 2291, 1012, 3036, 1012, 4447, 1025, 2478, 2291, 1012, 11689, 2075, 1012, 8518, 1025, 2478, 7513, 1012, 2004, 30524, 3531, 3942, 8299, 1024, 1013, 1013, 2175, 1012, 7513, 1012, 4012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; // 1. npm install body-parser express request // 2. Download and install ngrok from https://ngrok.com/download // 3. ./ngrok http 8445 // 4. WIT_TOKEN=your_access_token FB_PAGE_ID=your_page_id FB_PAGE_TOKEN=your_page_token FB_VERIFY_TOKEN=verify_token node examples/messenger.js // 5. Subscribe your page to the Webhooks using verify_token and `https://<your_ngrok_io>/fb` as callback URL. // 6. Talk to your bot on Messenger! const bodyParser = require('body-parser'); const express = require('express'); const request = require('request'); const Wit = require('node-wit').Wit; // Webserver parameter const PORT = process.env.PORT || 8445; // Wit.ai parameters const WIT_TOKEN = process.env.WIT_TOKEN; // Messenger API parameters const FB_PAGE_ID = process.env.FB_PAGE_ID; if (!FB_PAGE_ID) { throw new Error('missing FB_PAGE_ID'); } const FB_PAGE_TOKEN = process.env.FB_PAGE_TOKEN; if (!FB_PAGE_TOKEN) { throw new Error('missing FB_PAGE_TOKEN'); } const FB_VERIFY_TOKEN = process.env.FB_VERIFY_TOKEN; // Messenger API specific code // See the Send API reference // https://developers.facebook.com/docs/messenger-platform/send-api-reference const fbReq = request.defaults({ uri: 'https://graph.facebook.com/me/messages', method: 'POST', json: true, qs: { access_token: FB_PAGE_TOKEN }, headers: {'Content-Type': 'application/json'}, }); const fbMessage = (recipientId, msg, cb) => { const opts = { form: { recipient: { id: recipientId, }, message: { text: msg, }, }, }; fbReq(opts, (err, resp, data) => { if (cb) { cb(err || data.error && data.error.message, data); } }); }; // See the Webhook reference // https://developers.facebook.com/docs/messenger-platform/webhook-reference const getFirstMessagingEntry = (body) => { const val = body.object == 'page' && body.entry && Array.isArray(body.entry) && body.entry.length > 0 && body.entry[0] && body.entry[0].id === FB_PAGE_ID && body.entry[0].messaging && Array.isArray(body.entry[0].messaging) && body.entry[0].messaging.length > 0 && body.entry[0].messaging[0] ; return val || null; }; // Wit.ai bot specific code // This will contain all user sessions. // Each session has an entry: // sessionId -> {fbid: facebookUserId, context: sessionState} const sessions = {}; const findOrCreateSession = (fbid) => { let sessionId; // Let's see if we already have a session for the user fbid Object.keys(sessions).forEach(k => { if (sessions[k].fbid === fbid) { // Yep, got it! sessionId = k; } }); if (!sessionId) { // No session found for user fbid, let's create a new one sessionId = new Date().toISOString(); sessions[sessionId] = {fbid: fbid, context: {}}; } return sessionId; }; const firstEntityValue = (entities, entity) => { const val = entities && entities[entity] && Array.isArray(entities[entity]) && entities[entity].length > 0 && entities[entity][0].value ; if (!val) { return null; } return typeof val === 'object' ? val.value : val; }; // Our bot actions const actions = { say(sessionId, context, message, cb) { // Our bot has something to say! // Let's retrieve the Facebook user whose session belongs to const recipientId = sessions[sessionId].fbid; if (recipientId) { // Yay, we found our recipient! // Let's forward our bot response to her. fbMessage(recipientId, message, (err, data) => { if (err) { console.log( 'Oops! An error occurred while forwarding the response to', recipientId, ':', err ); } // Let's give the wheel back to our bot cb(); }); } else { console.log('Oops! Couldn\'t find user for session:', sessionId); // Giving the wheel back to our bot cb(); } }, merge(sessionId, context, entities, message, cb) { cb(context); }, error(sessionId, context, error) { console.log(error.message); }, ['blank'](sessionId, context, cb) { // Herer is where an API call would go // context.return = apiCall(context.loc); context.return = 'return String'; cb(context); } }; // Setting up our bot const wit = new Wit(WIT_TOKEN, actions); // Starting our webserver and putting it all together const app = express(); app.set('port', PORT); app.listen(app.get('port')); app.use(bodyParser.json()); // Webhook setup app.get('/fb', (req, res) => { if (!FB_VERIFY_TOKEN) { throw new Error('missing FB_VERIFY_TOKEN'); } if (req.query['hub.mode'] === 'subscribe' && req.query['hub.verify_token'] === FB_VERIFY_TOKEN) { res.send(req.query['hub.challenge']); } else { res.sendStatus(400); } }); // Message handler app.post('/fb', (req, res) => { // Parsing the Messenger API response const messaging = getFirstMessagingEntry(req.body); if (messaging && messaging.message && messaging.recipient.id === FB_PAGE_ID) { // Yay! We got a new message! // We retrieve the Facebook user ID of the sender const sender = messaging.sender.id; // We retrieve the user's current session, or create one if it doesn't exist // This is needed for our bot to figure out the conversation history const sessionId = findOrCreateSession(sender); // We retrieve the message content const msg = messaging.message.text; const atts = messaging.message.attachments; if (atts) { // We received an attachment // Let's reply with an automatic message fbMessage( sender, 'Sorry I can only process text messages for now.' ); } else if (msg) { // We received a text message // Let's forward the message to the Wit.ai Bot Engine // This will run all actions until our bot has nothing left to do wit.runActions( sessionId, // the user's current session msg, // the user's message sessions[sessionId].context, // the user's current session state (error, context) => { if (error) { console.log('Oops! Got an error from Wit:', error); } else { // Our bot did everything it has to do. // Now it's waiting for further messages to proceed. console.log('Waiting for futher messages.'); // Based on the session state, you might want to reset the session. // This depends heavily on the business logic of your bot. // Example: // if (context['done']) { // delete sessions[sessionId]; // } // Updating the user's current session state sessions[sessionId].context = context; } } ); } } res.sendStatus(200); });
bhberson/messenger-wit-bot
index.js
JavaScript
mit
6,836
[ 30522, 1005, 2224, 9384, 1005, 1025, 1013, 1013, 1015, 1012, 27937, 2213, 16500, 2303, 1011, 11968, 8043, 4671, 5227, 1013, 1013, 1016, 1012, 8816, 1998, 16500, 12835, 27923, 2013, 16770, 1024, 1013, 1013, 12835, 27923, 1012, 4012, 1013, 88...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
v1.2.13 (2014-02-18) -------------------- - Reverting compile_time work v1.2.12 (2014-02-18) -------------------- - Fixing last patch to play nicely with Chef Sugar v1.2.11 (2014-02-18) -------------------- - Fixing chef_gem for Chef below 12.1.0 v1.2.10 (2014-02-17) -------------------- - Being explicit about usage of the chef_gem's compile_time property. - Eliminating future deprecation warnings in Chef 12.1.0. v1.2.9 (2014-12-10) ------------------- - Re-release with stove 3.2.2 to get a metadata.rb v1.2.8 (2014-12-09) ------------------- - [#11] Fix warning message from build-essential - [#13] pin nokogiri to a working version v1.2.6 (2014-06-17) ------------------- - [COOK-4468] Only set ENV variable when needed v1.2.4 (2014-03-27) ------------------- - [COOK-4474] - Bump apt and yum versions in Berksfile, Lock to build-essentials 1.4 - [COOK-4468] - Set NOKOGIRI_USE_SYSTEM_LIBRARIES env variable v1.2.2 (2014-02-27) ------------------- [COOK-4382] - Fix xml cookbook spec test [COOK-4304] - Set proper packages for SUSE 11 v1.2.1 ------ ### Improvement - [COOK-4304](https://tickets.chef.io/browse/COOK-4304) - Now sets proper packages for SUSE 11 v1.2.0 ------ ### Improvement - **[COOK-3462](https://tickets.chef.io/browse/COOK-3462)** - Allow installing packages during compile time v1.1.2 ------ - [COOK-2059] - missing dependency on build-essential v1.1.0 ------ - [COOK-1826] - support nokogiri chef_gem - [COOK-1902] - add support for archlinux v1.0.4 ------ - [COOK-1232] - add xslt to xml cookbook v1.0.2 ------ - [COOK-953] - Add FreeBSD support - [COOK-775] - Add Amazon Linux support
jw7698/dpa1sbtest3
xml/CHANGELOG.md
Markdown
apache-2.0
1,635
[ 30522, 1058, 2487, 1012, 1016, 1012, 2410, 1006, 2297, 1011, 6185, 1011, 2324, 1007, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 7065, 8743, 2075, 4012, 220...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.*; import org.lwjgl.system.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.MemoryStack.*; /** * See {@link VkExportMemoryAllocateInfo}. * * <h3>Layout</h3> * * <pre><code> * struct VkExportMemoryAllocateInfoKHR { * VkStructureType sType; * void const * pNext; * VkExternalMemoryHandleTypeFlags handleTypes; * }</code></pre> */ public class VkExportMemoryAllocateInfoKHR extends VkExportMemoryAllocateInfo { /** * Creates a {@code VkExportMemoryAllocateInfoKHR} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be * visible to the struct instance and vice versa. * * <p>The created instance holds a strong reference to the container object.</p> */ public VkExportMemoryAllocateInfoKHR(ByteBuffer container) { super(container); } /** Sets the specified value to the {@code sType} field. */ @Override public VkExportMemoryAllocateInfoKHR sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; } /** Sets the {@link VK11#VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO} value to the {@code sType} field. */ @Override public VkExportMemoryAllocateInfoKHR sType$Default() { return sType(VK11.VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO); } /** Sets the specified value to the {@code pNext} field. */ @Override public VkExportMemoryAllocateInfoKHR pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; } /** Sets the specified value to the {@code handleTypes} field. */ @Override public VkExportMemoryAllocateInfoKHR handleTypes(@NativeType("VkExternalMemoryHandleTypeFlags") int value) { nhandleTypes(address(), value); return this; } /** Initializes this struct with the specified values. */ @Override public VkExportMemoryAllocateInfoKHR set( int sType, long pNext, int handleTypes ) { sType(sType); pNext(pNext); handleTypes(handleTypes); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkExportMemoryAllocateInfoKHR set(VkExportMemoryAllocateInfoKHR src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@code VkExportMemoryAllocateInfoKHR} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkExportMemoryAllocateInfoKHR malloc() { return wrap(VkExportMemoryAllocateInfoKHR.class, nmemAllocChecked(SIZEOF)); } /** Returns a new {@code VkExportMemoryAllocateInfoKHR} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkExportMemoryAllocateInfoKHR calloc() { return wrap(VkExportMemoryAllocateInfoKHR.class, nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@code VkExportMemoryAllocateInfoKHR} instance allocated with {@link BufferUtils}. */ public static VkExportMemoryAllocateInfoKHR create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(VkExportMemoryAllocateInfoKHR.class, memAddress(container), container); } /** Returns a new {@code VkExportMemoryAllocateInfoKHR} instance for the specified memory address. */ public static VkExportMemoryAllocateInfoKHR create(long address) { return wrap(VkExportMemoryAllocateInfoKHR.class, address); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkExportMemoryAllocateInfoKHR createSafe(long address) { return address == NULL ? null : wrap(VkExportMemoryAllocateInfoKHR.class, address); } /** * Returns a new {@link VkExportMemoryAllocateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer malloc(int capacity) { return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); } /** * Returns a new {@link VkExportMemoryAllocateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer calloc(int capacity) { return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkExportMemoryAllocateInfoKHR.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer create(int capacity) { ByteBuffer container = __create(capacity, SIZEOF); return wrap(Buffer.class, memAddress(container), capacity, container); } /** * Create a {@link VkExportMemoryAllocateInfoKHR.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer create(long address, int capacity) { return wrap(Buffer.class, address, capacity); } /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkExportMemoryAllocateInfoKHR.Buffer createSafe(long address, int capacity) { return address == NULL ? null : wrap(Buffer.class, address, capacity); } // ----------------------------------- /** Deprecated for removal in 3.4.0. Use {@link #malloc(MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR mallocStack() { return malloc(stackGet()); } /** Deprecated for removal in 3.4.0. Use {@link #calloc(MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR callocStack() { return calloc(stackGet()); } /** Deprecated for removal in 3.4.0. Use {@link #malloc(MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR mallocStack(MemoryStack stack) { return malloc(stack); } /** Deprecated for removal in 3.4.0. Use {@link #calloc(MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR callocStack(MemoryStack stack) { return calloc(stack); } /** Deprecated for removal in 3.4.0. Use {@link #malloc(int, MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR.Buffer mallocStack(int capacity) { return malloc(capacity, stackGet()); } /** Deprecated for removal in 3.4.0. Use {@link #calloc(int, MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR.Buffer callocStack(int capacity) { return calloc(capacity, stackGet()); } /** Deprecated for removal in 3.4.0. Use {@link #malloc(int, MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR.Buffer mallocStack(int capacity, MemoryStack stack) { return malloc(capacity, stack); } /** Deprecated for removal in 3.4.0. Use {@link #calloc(int, MemoryStack)} instead. */ @Deprecated public static VkExportMemoryAllocateInfoKHR.Buffer callocStack(int capacity, MemoryStack stack) { return calloc(capacity, stack); } /** * Returns a new {@code VkExportMemoryAllocateInfoKHR} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkExportMemoryAllocateInfoKHR malloc(MemoryStack stack) { return wrap(VkExportMemoryAllocateInfoKHR.class, stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@code VkExportMemoryAllocateInfoKHR} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkExportMemoryAllocateInfoKHR calloc(MemoryStack stack) { return wrap(VkExportMemoryAllocateInfoKHR.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkExportMemoryAllocateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer malloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); } /** * Returns a new {@link VkExportMemoryAllocateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkExportMemoryAllocateInfoKHR.Buffer calloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); } // ----------------------------------- /** An array of {@link VkExportMemoryAllocateInfoKHR} structs. */ public static class Buffer extends VkExportMemoryAllocateInfo.Buffer { private static final VkExportMemoryAllocateInfoKHR ELEMENT_FACTORY = VkExportMemoryAllocateInfoKHR.create(-1L); /** * Creates a new {@code VkExportMemoryAllocateInfoKHR.Buffer} instance backed by the specified container. * * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided * by {@link VkExportMemoryAllocateInfoKHR#SIZEOF}, and its mark will be undefined. * * <p>The created buffer instance holds a strong reference to the container object.</p> */ public Buffer(ByteBuffer container) { super(container); } public Buffer(long address, int cap) { super(address, null, -1, 0, cap, cap); } Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { super(address, container, mark, pos, lim, cap); } @Override protected Buffer self() { return this; } @Override protected VkExportMemoryAllocateInfoKHR getElementFactory() { return ELEMENT_FACTORY; } /** Sets the specified value to the {@code sType} field. */ @Override public VkExportMemoryAllocateInfoKHR.Buffer sType(@NativeType("VkStructureType") int value) { VkExportMemoryAllocateInfoKHR.nsType(address(), value); return this; } /** Sets the {@link VK11#VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO} value to the {@code sType} field. */ @Override public VkExportMemoryAllocateInfoKHR.Buffer sType$Default() { return sType(VK11.VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO); } /** Sets the specified value to the {@code pNext} field. */ @Override public VkExportMemoryAllocateInfoKHR.Buffer pNext(@NativeType("void const *") long value) { VkExportMemoryAllocateInfoKHR.npNext(address(), value); return this; } /** Sets the specified value to the {@code handleTypes} field. */ @Override public VkExportMemoryAllocateInfoKHR.Buffer handleTypes(@NativeType("VkExternalMemoryHandleTypeFlags") int value) { VkExportMemoryAllocateInfoKHR.nhandleTypes(address(), value); return this; } } }
LWJGL-CI/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkExportMemoryAllocateInfoKHR.java
Java
bsd-3-clause
12,279
[ 30522, 1013, 1008, 1008, 9385, 1048, 2860, 3501, 23296, 1012, 2035, 2916, 9235, 1012, 1008, 6105, 3408, 1024, 16770, 1024, 1013, 1013, 7479, 1012, 1048, 2860, 3501, 23296, 1012, 8917, 1013, 6105, 1008, 3698, 7013, 5371, 1010, 2079, 2025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import os import os.path as op import pytest import numpy as np from numpy.testing import (assert_array_equal, assert_equal, assert_allclose, assert_array_less, assert_almost_equal) import itertools import mne from mne.datasets import testing from mne.fixes import _get_img_fdata from mne import read_trans, write_trans from mne.io import read_info from mne.transforms import (invert_transform, _get_trans, rotation, rotation3d, rotation_angles, _find_trans, combine_transforms, apply_trans, translation, get_ras_to_neuromag_trans, _pol_to_cart, quat_to_rot, rot_to_quat, _angle_between_quats, _find_vector_rotation, _sph_to_cart, _cart_to_sph, _topo_to_sph, _average_quats, _SphericalSurfaceWarp as SphericalSurfaceWarp, rotation3d_align_z_axis, _read_fs_xfm, _write_fs_xfm, _quat_real, _fit_matched_points, _quat_to_euler, _euler_to_quat, _quat_to_affine, _compute_r2, _validate_pipeline) from mne.utils import requires_nibabel, requires_dipy data_path = testing.data_path(download=False) fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc-trans.fif') fname_eve = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc_raw-eve.fif') subjects_dir = op.join(data_path, 'subjects') fname_t1 = op.join(subjects_dir, 'fsaverage', 'mri', 'T1.mgz') base_dir = op.join(op.dirname(__file__), '..', 'io', 'tests', 'data') fname_trans = op.join(base_dir, 'sample-audvis-raw-trans.txt') test_fif_fname = op.join(base_dir, 'test_raw.fif') ctf_fname = op.join(base_dir, 'test_ctf_raw.fif') hp_fif_fname = op.join(base_dir, 'test_chpi_raw_sss.fif') def test_tps(): """Test TPS warping.""" az = np.linspace(0., 2 * np.pi, 20, endpoint=False) pol = np.linspace(0, np.pi, 12)[1:-1] sph = np.array(np.meshgrid(1, az, pol, indexing='ij')) sph.shape = (3, -1) assert_equal(sph.shape[1], 200) source = _sph_to_cart(sph.T) destination = source.copy() destination *= 2 destination[:, 0] += 1 # fit with 100 points warp = SphericalSurfaceWarp() assert 'no ' in repr(warp) warp.fit(source[::3], destination[::2]) assert 'oct5' in repr(warp) destination_est = warp.transform(source) assert_allclose(destination_est, destination, atol=1e-3) @testing.requires_testing_data def test_get_trans(): """Test converting '-trans.txt' to '-trans.fif'.""" trans = read_trans(fname) trans = invert_transform(trans) # starts out as head->MRI, so invert trans_2 = _get_trans(fname_trans)[0] assert trans.__eq__(trans_2, atol=1e-5) @testing.requires_testing_data def test_io_trans(tmpdir): """Test reading and writing of trans files.""" tempdir = str(tmpdir) os.mkdir(op.join(tempdir, 'sample')) pytest.raises(RuntimeError, _find_trans, 'sample', subjects_dir=tempdir) trans0 = read_trans(fname) fname1 = op.join(tempdir, 'sample', 'test-trans.fif') trans0.save(fname1) assert fname1 == _find_trans('sample', subjects_dir=tempdir) trans1 = read_trans(fname1) # check all properties assert trans0 == trans1 # check reading non -trans.fif files pytest.raises(IOError, read_trans, fname_eve) # check warning on bad filenames fname2 = op.join(tempdir, 'trans-test-bad-name.fif') with pytest.warns(RuntimeWarning, match='-trans.fif'): write_trans(fname2, trans0) def test_get_ras_to_neuromag_trans(): """Test the coordinate transformation from ras to neuromag.""" # create model points in neuromag-like space rng = np.random.RandomState(0) anterior = [0, 1, 0] left = [-1, 0, 0] right = [.8, 0, 0] up = [0, 0, 1] rand_pts = rng.uniform(-1, 1, (3, 3)) pts = np.vstack((anterior, left, right, up, rand_pts)) # change coord system rx, ry, rz, tx, ty, tz = rng.uniform(-2 * np.pi, 2 * np.pi, 6) trans = np.dot(translation(tx, ty, tz), rotation(rx, ry, rz)) pts_changed = apply_trans(trans, pts) # transform back into original space nas, lpa, rpa = pts_changed[:3] hsp_trans = get_ras_to_neuromag_trans(nas, lpa, rpa) pts_restored = apply_trans(hsp_trans, pts_changed) err = "Neuromag transformation failed" assert_allclose(pts_restored, pts, atol=1e-6, err_msg=err) def _cartesian_to_sphere(x, y, z): """Convert using old function.""" hypotxy = np.hypot(x, y) r = np.hypot(hypotxy, z) elev = np.arctan2(z, hypotxy) az = np.arctan2(y, x) return az, elev, r def _sphere_to_cartesian(theta, phi, r): """Convert using old function.""" z = r * np.sin(phi) rcos_phi = r * np.cos(phi) x = rcos_phi * np.cos(theta) y = rcos_phi * np.sin(theta) return x, y, z def test_sph_to_cart(): """Test conversion between sphere and cartesian.""" # Simple test, expected value (11, 0, 0) r, theta, phi = 11., 0., np.pi / 2. z = r * np.cos(phi) rsin_phi = r * np.sin(phi) x = rsin_phi * np.cos(theta) y = rsin_phi * np.sin(theta) coord = _sph_to_cart(np.array([[r, theta, phi]]))[0] assert_allclose(coord, (x, y, z), atol=1e-7) assert_allclose(coord, (r, 0, 0), atol=1e-7) rng = np.random.RandomState(0) # round-trip test coords = rng.randn(10, 3) assert_allclose(_sph_to_cart(_cart_to_sph(coords)), coords, atol=1e-5) # equivalence tests to old versions for coord in coords: sph = _cart_to_sph(coord[np.newaxis]) cart = _sph_to_cart(sph) sph_old = np.array(_cartesian_to_sphere(*coord)) cart_old = _sphere_to_cartesian(*sph_old) sph_old[1] = np.pi / 2. - sph_old[1] # new convention assert_allclose(sph[0], sph_old[[2, 0, 1]], atol=1e-7) assert_allclose(cart[0], cart_old, atol=1e-7) assert_allclose(cart[0], coord, atol=1e-7) def _polar_to_cartesian(theta, r): """Transform polar coordinates to cartesian.""" x = r * np.cos(theta) y = r * np.sin(theta) return x, y def test_polar_to_cartesian(): """Test helper transform function from polar to cartesian.""" r = 1 theta = np.pi # expected values are (-1, 0) x = r * np.cos(theta) y = r * np.sin(theta) coord = _pol_to_cart(np.array([[r, theta]]))[0] # np.pi is an approx since pi is irrational assert_allclose(coord, (x, y), atol=1e-7) assert_allclose(coord, (-1, 0), atol=1e-7) assert_allclose(coord, _polar_to_cartesian(theta, r), atol=1e-7) rng = np.random.RandomState(0) r = rng.randn(10) theta = rng.rand(10) * (2 * np.pi) polar = np.array((r, theta)).T assert_allclose([_polar_to_cartesian(p[1], p[0]) for p in polar], _pol_to_cart(polar), atol=1e-7) def _topo_to_phi_theta(theta, radius): """Convert using old function.""" sph_phi = (0.5 - radius) * 180 sph_theta = -theta return sph_phi, sph_theta def test_topo_to_sph(): """Test topo to sphere conversion.""" rng = np.random.RandomState(0) angles = rng.rand(10) * 360 radii = rng.rand(10) angles[0] = 30 radii[0] = 0.25 # new way sph = _topo_to_sph(np.array([angles, radii]).T) new = _sph_to_cart(sph) new[:, [0, 1]] = new[:, [1, 0]] * [-1, 1] # old way for ii, (angle, radius) in enumerate(zip(angles, radii)): sph_phi, sph_theta = _topo_to_phi_theta(angle, radius) if ii == 0: assert_allclose(_topo_to_phi_theta(angle, radius), [45, -30]) azimuth = sph_theta / 180.0 * np.pi elevation = sph_phi / 180.0 * np.pi assert_allclose(sph[ii], [1., azimuth, np.pi / 2. - elevation], atol=1e-7) r = np.ones_like(radius) x, y, z = _sphere_to_cartesian(azimuth, elevation, r) pos = [-y, x, z] if ii == 0: expected = np.array([1. / 2., np.sqrt(3) / 2., 1.]) expected /= np.sqrt(2) assert_allclose(pos, expected, atol=1e-7) assert_allclose(pos, new[ii], atol=1e-7) def test_rotation(): """Test conversion between rotation angles and transformation matrix.""" tests = [(0, 0, 1), (.5, .5, .5), (np.pi, 0, -1.5)] for rot in tests: x, y, z = rot m = rotation3d(x, y, z) m4 = rotation(x, y, z) assert_array_equal(m, m4[:3, :3]) back = rotation_angles(m) assert_almost_equal(actual=back, desired=rot, decimal=12) back4 = rotation_angles(m4) assert_almost_equal(actual=back4, desired=rot, decimal=12) def test_rotation3d_align_z_axis(): """Test rotation3d_align_z_axis.""" # The more complex z axis fails the assert presumably due to tolerance # inp_zs = [[0, 0, 1], [0, 1, 0], [1, 0, 0], [0, 0, -1], [-0.75071668, -0.62183808, 0.22302888]] exp_res = [[[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]], [[1., 0., 0.], [0., 0., 1.], [0., -1., 0.]], [[0., 0., 1.], [0., 1., 0.], [-1., 0., 0.]], [[1., 0., 0.], [0., -1., 0.], [0., 0., -1.]], [[0.53919688, -0.38169517, -0.75071668], [-0.38169517, 0.683832, -0.62183808], [0.75071668, 0.62183808, 0.22302888]]] for res, z in zip(exp_res, inp_zs): assert_allclose(res, rotation3d_align_z_axis(z), atol=1e-7) @testing.requires_testing_data def test_combine(): """Test combining transforms.""" trans = read_trans(fname) inv = invert_transform(trans) combine_transforms(trans, inv, trans['from'], trans['from']) pytest.raises(RuntimeError, combine_transforms, trans, inv, trans['to'], trans['from']) pytest.raises(RuntimeError, combine_transforms, trans, inv, trans['from'], trans['to']) pytest.raises(RuntimeError, combine_transforms, trans, trans, trans['from'], trans['to']) def test_quaternions(): """Test quaternion calculations.""" rots = [np.eye(3)] for fname in [test_fif_fname, ctf_fname, hp_fif_fname]: rots += [read_info(fname)['dev_head_t']['trans'][:3, :3]] # nasty numerical cases rots += [np.array([ [-0.99978541, -0.01873462, -0.00898756], [-0.01873462, 0.62565561, 0.77987608], [-0.00898756, 0.77987608, -0.62587152], ])] rots += [np.array([ [0.62565561, -0.01873462, 0.77987608], [-0.01873462, -0.99978541, -0.00898756], [0.77987608, -0.00898756, -0.62587152], ])] rots += [np.array([ [-0.99978541, -0.00898756, -0.01873462], [-0.00898756, -0.62587152, 0.77987608], [-0.01873462, 0.77987608, 0.62565561], ])] for rot in rots: assert_allclose(rot, quat_to_rot(rot_to_quat(rot)), rtol=1e-5, atol=1e-5) rot = rot[np.newaxis, np.newaxis, :, :] assert_allclose(rot, quat_to_rot(rot_to_quat(rot)), rtol=1e-5, atol=1e-5) # let's make sure our angle function works in some reasonable way for ii in range(3): for jj in range(3): a = np.zeros(3) b = np.zeros(3) a[ii] = 1. b[jj] = 1. expected = np.pi if ii != jj else 0. assert_allclose(_angle_between_quats(a, b), expected, atol=1e-5) y_180 = np.array([[-1, 0, 0], [0, 1, 0], [0, 0, -1.]]) assert_allclose(_angle_between_quats(rot_to_quat(y_180), np.zeros(3)), np.pi) h_180_attitude_90 = np.array([[0, 1, 0], [1, 0, 0], [0, 0, -1.]]) assert_allclose(_angle_between_quats(rot_to_quat(h_180_attitude_90), np.zeros(3)), np.pi) def test_vector_rotation(): """Test basic rotation matrix math.""" x = np.array([1., 0., 0.]) y = np.array([0., 1., 0.]) rot = _find_vector_rotation(x, y) assert_array_equal(rot, [[0, -1, 0], [1, 0, 0], [0, 0, 1]]) quat_1 = rot_to_quat(rot) quat_2 = rot_to_quat(np.eye(3)) assert_allclose(_angle_between_quats(quat_1, quat_2), np.pi / 2.) def test_average_quats(): """Test averaging of quaternions.""" sq2 = 1. / np.sqrt(2.) quats = np.array([[0, sq2, sq2], [0, sq2, sq2], [0, sq2, 0], [0, 0, sq2], [sq2, 0, 0]], float) # In MATLAB: # quats = [[0, sq2, sq2, 0]; [0, sq2, sq2, 0]; # [0, sq2, 0, sq2]; [0, 0, sq2, sq2]; [sq2, 0, 0, sq2]]; expected = [quats[0], quats[0], [0, 0.788675134594813, 0.577350269189626], [0, 0.657192299694123, 0.657192299694123], [0.100406058540540, 0.616329446922803, 0.616329446922803]] # Averaging the first two should give the same thing: for lim, ex in enumerate(expected): assert_allclose(_average_quats(quats[:lim + 1]), ex, atol=1e-7) quats[1] *= -1 # same quaternion (hidden value is zero here)! rot_0, rot_1 = quat_to_rot(quats[:2]) assert_allclose(rot_0, rot_1, atol=1e-7) for lim, ex in enumerate(expected): assert_allclose(_average_quats(quats[:lim + 1]), ex, atol=1e-7) # Assert some symmetry count = 0 extras = [[sq2, sq2, 0]] + list(np.eye(3)) for quat in np.concatenate((quats, expected, extras)): if np.isclose(_quat_real(quat), 0., atol=1e-7): # can flip sign count += 1 angle = _angle_between_quats(quat, -quat) assert_allclose(angle, 0., atol=1e-7) rot_0, rot_1 = quat_to_rot(np.array((quat, -quat))) assert_allclose(rot_0, rot_1, atol=1e-7) assert count == 4 + len(extras) @testing.requires_testing_data @pytest.mark.parametrize('subject', ('fsaverage', 'sample')) def test_fs_xfm(subject, tmpdir): """Test reading and writing of Freesurfer transforms.""" fname = op.join(data_path, 'subjects', subject, 'mri', 'transforms', 'talairach.xfm') xfm, kind = _read_fs_xfm(fname) if subject == 'fsaverage': assert_allclose(xfm, np.eye(4), atol=1e-5) # fsaverage is in MNI assert kind == 'MNI Transform File' tempdir = str(tmpdir) fname_out = op.join(tempdir, 'out.xfm') _write_fs_xfm(fname_out, xfm, kind) xfm_read, kind_read = _read_fs_xfm(fname_out) assert kind_read == kind assert_allclose(xfm, xfm_read, rtol=1e-5, atol=1e-5) # Some wacky one xfm[:3] = np.random.RandomState(0).randn(3, 4) _write_fs_xfm(fname_out, xfm, 'foo') xfm_read, kind_read = _read_fs_xfm(fname_out) assert kind_read == 'foo' assert_allclose(xfm, xfm_read, rtol=1e-5, atol=1e-5) # degenerate conditions with open(fname_out, 'w') as fid: fid.write('foo') with pytest.raises(ValueError, match='Failed to find'): _read_fs_xfm(fname_out) _write_fs_xfm(fname_out, xfm[:2], 'foo') with pytest.raises(ValueError, match='Could not find'): _read_fs_xfm(fname_out) @pytest.fixture() def quats(): """Make some unit quats.""" quats = np.random.RandomState(0).randn(5, 3) quats[:, 0] = 0 # identity quats /= 2 * np.linalg.norm(quats, axis=1, keepdims=True) # some real part return quats def _check_fit_matched_points( p, x, weights, do_scale, angtol=1e-5, dtol=1e-5, stol=1e-7): __tracebackhide__ = True mne.coreg._ALLOW_ANALITICAL = False try: params = mne.coreg.fit_matched_points( p, x, weights=weights, scale=do_scale, out='params') finally: mne.coreg._ALLOW_ANALITICAL = True quat_an, scale_an = _fit_matched_points(p, x, weights, scale=do_scale) assert len(params) == 6 + int(do_scale) q_co = _euler_to_quat(params[:3]) translate_co = params[3:6] angle = np.rad2deg(_angle_between_quats(quat_an[:3], q_co)) dist = np.linalg.norm(quat_an[3:] - translate_co) assert 0 <= angle < angtol, 'angle' assert 0 <= dist < dtol, 'dist' if do_scale: scale_co = params[6] assert_allclose(scale_an, scale_co, rtol=stol, err_msg='scale') # errs trans = _quat_to_affine(quat_an) trans[:3, :3] *= scale_an weights = np.ones(1) if weights is None else weights err_an = np.linalg.norm( weights[:, np.newaxis] * apply_trans(trans, p) - x) trans = mne.coreg._trans_from_params((True, True, do_scale), params) err_co = np.linalg.norm( weights[:, np.newaxis] * apply_trans(trans, p) - x) if err_an > 1e-14: assert err_an < err_co * 1.5 return quat_an, scale_an @pytest.mark.parametrize('scaling', [0.25, 1]) @pytest.mark.parametrize('do_scale', (True, False)) def test_fit_matched_points(quats, scaling, do_scale): """Test analytical least-squares matched point fitting.""" if scaling != 1 and not do_scale: return # no need to test this, it will not be good rng = np.random.RandomState(0) fro = rng.randn(10, 3) translation = rng.randn(3) for qi, quat in enumerate(quats): to = scaling * np.dot(quat_to_rot(quat), fro.T).T + translation for corrupted in (False, True): # mess up a point if corrupted: to[0, 2] += 100 weights = np.ones(len(to)) weights[0] = 0 else: weights = None est, scale_est = _check_fit_matched_points( fro, to, weights=weights, do_scale=do_scale) assert_allclose(scale_est, scaling, rtol=1e-5) assert_allclose(est[:3], quat, atol=1e-14) assert_allclose(est[3:], translation, atol=1e-14) # if we don't adjust for the corruption above, it should get worse angle = dist = None for weighted in (False, True): if not weighted: weights = None dist_bounds = (5, 20) if scaling == 1: angle_bounds = (5, 95) angtol, dtol, stol = 1, 15, 3 else: angle_bounds = (5, 105) angtol, dtol, stol = 20, 15, 3 else: weights = np.ones(len(to)) weights[0] = 10 # weighted=True here means "make it worse" angle_bounds = (angle, 180) # unweighted values as new min dist_bounds = (dist, 100) if scaling == 1: # XXX this angtol is not great but there is a hard to # identify linalg/angle calculation bug on Travis... angtol, dtol, stol = 180, 70, 3 else: angtol, dtol, stol = 50, 70, 3 est, scale_est = _check_fit_matched_points( fro, to, weights=weights, do_scale=do_scale, angtol=angtol, dtol=dtol, stol=stol) assert not np.allclose(est[:3], quat, atol=1e-5) assert not np.allclose(est[3:], translation, atol=1e-5) angle = np.rad2deg(_angle_between_quats(est[:3], quat)) assert_array_less(angle_bounds[0], angle) assert_array_less(angle, angle_bounds[1]) dist = np.linalg.norm(est[3:] - translation) assert_array_less(dist_bounds[0], dist) assert_array_less(dist, dist_bounds[1]) def test_euler(quats): """Test euler transformations.""" euler = _quat_to_euler(quats) quats_2 = _euler_to_quat(euler) assert_allclose(quats, quats_2, atol=1e-14) quat_rot = quat_to_rot(quats) euler_rot = np.array([rotation(*e)[:3, :3] for e in euler]) assert_allclose(quat_rot, euler_rot, atol=1e-14) @requires_nibabel() @requires_dipy() @pytest.mark.slowtest @testing.requires_testing_data def test_volume_registration(): """Test volume registration.""" import nibabel as nib from dipy.align import resample T1 = nib.load(fname_t1) affine = np.eye(4) affine[0, 3] = 10 T1_resampled = resample(moving=T1.get_fdata(), static=T1.get_fdata(), moving_affine=T1.affine, static_affine=T1.affine, between_affine=np.linalg.inv(affine)) for pipeline in ('rigids', ('translation', 'sdr')): reg_affine, sdr_morph = mne.transforms.compute_volume_registration( T1_resampled, T1, pipeline=pipeline, zooms=10, niter=[5]) assert_allclose(affine, reg_affine, atol=0.25) T1_aligned = mne.transforms.apply_volume_registration( T1_resampled, T1, reg_affine, sdr_morph) r2 = _compute_r2(_get_img_fdata(T1_aligned), _get_img_fdata(T1)) assert 99.9 < r2 # check that all orders of the pipeline work for pipeline_len in range(1, 5): for pipeline in itertools.combinations( ('translation', 'rigid', 'affine', 'sdr'), pipeline_len): _validate_pipeline(pipeline) _validate_pipeline(list(pipeline)) with pytest.raises(ValueError, match='Steps in pipeline are out of order'): _validate_pipeline(('sdr', 'affine')) with pytest.raises(ValueError, match='Steps in pipeline should not be repeated'): _validate_pipeline(('affine', 'affine'))
bloyl/mne-python
mne/tests/test_transforms.py
Python
bsd-3-clause
21,423
[ 30522, 12324, 9808, 12324, 9808, 1012, 4130, 2004, 6728, 12324, 1052, 17250, 3367, 12324, 16371, 8737, 2100, 2004, 27937, 2013, 16371, 8737, 2100, 1012, 5604, 12324, 1006, 20865, 1035, 9140, 1035, 5020, 1010, 20865, 1035, 5020, 1010, 20865, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>마봉아빠의 개발자를 위한 CSS 초급강의</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <link rel="stylesheet" href="../../template/style.css"> </head> <body> <p>##CSS의 기초 - 폰트명(font-family)</p> <p>웹에 사용될 폰트명을 지정합니다. 지정되지 않으면, 브라우저의 기본 폰트로 설정이 되고, 지정하게 되면 해당 폰트명을 검색하여 반영합니다. 만약 지정폰트명이 없으면, 브라우저의 폰트명을 상속받게 됩니다.</p> <p>폰트에는 두가지 종류가 있는데, 형태를 기준하는 제너릭명(generic-family) 방식과 실제 폰트명(font-name) 방식이 있습니다.</p> <h3 id="font-family">font-family</h3> <ul> <li>기본값 : 브라우저의 기본폰트</li> <li>상속성 : 있음</li> <li>작성방법 : <code>font-family: (제너릭명 | 폰트명)+|initial|inherit;</code></li> </ul> <h4 id="-">제너릭명?</h4> <p>폰트는 글자의 형태에 따라 크게 3가지 로 지칭합니다.</p> <ul> <li>Serif(쉐리프) : 곡선을 주로 사용하여 작성된 폰트 스타일들 (예 : Times New Roman , Georgia)</li> <li>Sans-serif(산쉐리프) : 직선을 주로 사용하여 작성된 폰트 스타일들 (예 : Arial , Verdana)</li> <li>Monospace(모노스페이스) : 곡선과 직선을 혼합하여 작성된 폰트 스타일들 (예 : Courier New , Lucida Console)</li> </ul> <h4 id="-">다양한 폰트설정</h4> <pre><code class="lang-css">body{font-family:&quot;Nanum Gothic&quot;,&quot;나눔고딕&quot;,&quot;Malgun Gothic&quot;,&quot;맑은고딕&quot;,Dotum,&quot;돋움&quot;,Gulim,&quot;굴림&quot;,&quot;Helvetica Neue&quot;,Helvetica,Tahoma,Verdana,&quot;Trebuchet MS&quot;,Arial,Apple-Gothic,Sans-serif;} </code></pre> <h4 id="qa">QA</h4> <p>Q. 제너릭명으로 지칭했는데, 포함되는 폰트가 많다면, 어떤것이 적용되나요?<br>A. 그건 브라우저에 설정된 폰트를 따라갑니다. 한글 윈도우7에 있는 크롬은 기본적으로 쉐리프 라면 &quot;batang&quot;(바탕체) 폰트를 사용합니다.<br>A. 산쉐리프라면? &quot;Malgun Gothic&quot; (맑은고딕) </p> <h2 id="a-gulimche-">A. 모노스페이스 라면? &quot;GulimChe&quot; (굴림체) </h2> <p>Q. 따움표로 감싸진것과 아닌것의 차이<br>A. 폰트명이 &quot;CJK&quot; 이거나 &quot;띄어쓰기&quot;가 있는경우엔 따옴표를 넣게 됩니다.</p> </body> </html>
dstyle0210/minipaper
css-page/step3/02_family.html
HTML
mit
3,124
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 100, 1455, 30007, 29996, 30006, 30...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Monoblepharis polymorpha var. polymorpha Cornu, 1872 VARIETY #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in Monogr. Saprolegn. 83 (1872) #### Original name Monoblepharis polymorpha var. polymorpha Cornu, 1872 ### Remarks null
mdoering/backbone
life/Fungi/Chytridiomycota/Monoblepharidomycetes/Monoblepharidales/Monoblepharidaceae/Monoblepharis/Monoblepharis polymorpha/ Syn. Monoblepharis polymorpha polymorpha/README.md
Markdown
apache-2.0
281
[ 30522, 1001, 18847, 3468, 21890, 6935, 26572, 5302, 14536, 3270, 13075, 1012, 26572, 5302, 14536, 3270, 9781, 2226, 1010, 7572, 3528, 1001, 1001, 1001, 1001, 3570, 10675, 1001, 1001, 1001, 1001, 2429, 2000, 1996, 10161, 1997, 2166, 1010, 38...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Ais.Internal.Dcm.ModernUIV2")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Ais.Internal.Dcm.ModernUIV2")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
AppliedIS/wams-manager
Source/Ais.Internal.Dcm/Ais.Internal.Dcm.ModernUIV2/Properties/AssemblyInfo.cs
C#
apache-2.0
2,263
[ 30522, 2478, 2291, 1012, 9185, 1025, 2478, 2291, 1012, 4219, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 6970, 11923, 2121, 7903, 2229, 1025, 2478, 2291, 1012, 3645, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import { put, takeEvery } from 'redux-saga/effects'; import { push } from 'react-router-redux'; import { CRUD_CREATE_FAILURE, CRUD_CREATE_SUCCESS, CRUD_DELETE_FAILURE, CRUD_DELETE_SUCCESS, CRUD_GET_LIST_FAILURE, CRUD_GET_MANY_FAILURE, CRUD_GET_MANY_REFERENCE_FAILURE, CRUD_GET_ONE_FAILURE, CRUD_UPDATE_FAILURE, CRUD_UPDATE_SUCCESS, } from '../../actions/dataActions'; import { showNotification } from '../../actions/notificationActions'; import linkToRecord from '../../util/linkToRecord'; /** * Side effects for fetch responses * * Mostly redirects and notifications */ function* handleResponse({ type, requestPayload, error, payload }) { switch (type) { case CRUD_UPDATE_SUCCESS: return requestPayload.redirect ? yield [ put(showNotification('aor.notification.updated')), put(push(requestPayload.basePath)), ] : yield [put(showNotification('aor.notification.updated'))]; case CRUD_CREATE_SUCCESS: return requestPayload.redirect ? yield [ put(showNotification('aor.notification.created')), put(push(linkToRecord(requestPayload.basePath, payload.data.id))), ] : yield [put(showNotification('aor.notification.created'))]; case CRUD_DELETE_SUCCESS: return requestPayload.redirect ? yield [ put(showNotification('aor.notification.deleted')), put(push(requestPayload.basePath)), ] : yield [put(showNotification('aor.notification.deleted'))]; case CRUD_GET_ONE_FAILURE: return requestPayload.basePath ? yield [ put(showNotification('aor.notification.item_doesnt_exist', 'warning')), put(push(requestPayload.basePath)), ] : yield []; case CRUD_GET_LIST_FAILURE: case CRUD_GET_MANY_FAILURE: case CRUD_GET_MANY_REFERENCE_FAILURE: case CRUD_CREATE_FAILURE: case CRUD_UPDATE_FAILURE: case CRUD_DELETE_FAILURE: { console.error(error); const errorMessage = typeof error === 'string' ? error : (error.message || 'aor.notification.http_error'); return yield [ put(showNotification(errorMessage, 'warning')), ]; } default: return yield []; } } export default function* () { yield takeEvery(action => action.meta && action.meta.fetchResponse, handleResponse); }
matteolc/admin-on-rest
src/sideEffect/saga/crudResponse.js
JavaScript
mit
2,388
[ 30522, 12324, 1063, 2404, 1010, 2202, 22507, 2100, 1065, 2013, 1005, 2417, 5602, 1011, 12312, 1013, 3896, 1005, 1025, 12324, 1063, 5245, 1065, 2013, 1005, 10509, 1011, 2799, 2099, 1011, 2417, 5602, 1005, 1025, 12324, 1063, 13675, 6784, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Oracle - initial API and implementation from Oracle TopLink ******************************************************************************/ package org.eclipse.persistence.testing.tests.jpa.advanced; import org.eclipse.persistence.testing.models.jpa.advanced.Project; /** * Tests the @PostUpdate events from an Entity. * * @author Guy Pelletier */ public class EntityMethodPostUpdateTest extends CallbackEventTest { public void test() throws Exception { m_beforeEvent = 0; // Loading a new object to update, count starts at 0. Project project = updateProject(); m_afterEvent = project.post_update_count; } }
RallySoftware/eclipselink.runtime
jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/advanced/EntityMethodPostUpdateTest.java
Java
epl-1.0
1,234
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Cyclon Cyclon [1] is a complete framework for inexpensive membership management in very large P2P overlays. It an improvement of the basic shuffling protocol developed by Stavrou et al. [2]. It is highly scalable, very robust, and completely decentralized. Most important is that the resulting communication graphs share important properties with random graphs. ## Cyclon as a container You should think of Cyclon as a single peer that autonomously runs the cyclon protocol. In fact, this is not simulation of peers which run Cyclon. To archive that, everything inside this folder is packed as a Docker container. This allows us to deploy as many containers as we want so that each of them play the role of a peer. Each container (peer) periodically exchange its [PartialView](https://github.com/robzenn92/EpTODocker/tree/master/partialView) via messages sent over the network by first contacting other peers through the APIs exposed by `app.py` and then executing Cyclon functions based on the messages received. ## The structure Cyclon has been developed as a web service. Although the core features such as shuffle and periodic view exchanges are defined in `cyclon.py`, it relies on REST APIs exposed as a Flask application in `app.py`. This allows peers to send messages each other over the network. ## References [1] S. Voulgaris, D. Gavidia, M. van Steen. [CYCLON: Inexpensive Membership Management for Unstructured P2P Overlays](http://gossple2.irisa.fr/~akermarr/cyclon.jnsm.pdf). J. Network Syst. Manage. 13(2): 197-217 (2005) [2] A. Stavrou, D. Rubenstein, and S. Sahu, [A lightweight robust P2P system to handle flash crowds](http://ieeexplore.ieee.org/document/1181410/), IEEE Journal on Selected Areas in Communications, Vol. 22, No. 1, pp. 6–17, 2004.
robzenn92/EpTODocker
cyclon_project/README.md
Markdown
mit
1,778
[ 30522, 1001, 22330, 20464, 2239, 22330, 20464, 2239, 1031, 1015, 1033, 2003, 1037, 3143, 7705, 2005, 23766, 5779, 2968, 1999, 2200, 2312, 1052, 2475, 2361, 2058, 8485, 2015, 1012, 2009, 2019, 7620, 1997, 1996, 3937, 24770, 8778, 2764, 2011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (6343, 6344, 6345, 6346, 6347); INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES (6343,6,4197,0,''), -- Wintergrasp (6343,1,16111,0,''), -- target Love Fool (6344,6,2177,0,''), -- Battle Ring (6344,1,16111,0,''), -- target Love Fool (6345,6,3421,0,''), -- Blacksmith (6345,1,16111,0,''), -- target Love Fool (6346,6,4100,0,''), -- The Culling of Stratholme (6346,1,16111,0,''), -- target Love Fool (6347,6,3456,0,''), -- Naxxramas (6347,1,16111,0,''); -- target Love Fool
heros/multi_realm_cell
sql/sql_cata/old/3.3.5a/2012_02_08_06_world_achievement_criteria_data.sql
SQL
gpl-2.0
591
[ 30522, 3972, 12870, 2013, 1036, 6344, 1035, 9181, 1035, 2951, 1036, 2073, 1036, 9181, 1035, 8909, 1036, 1999, 1006, 6191, 23777, 1010, 6191, 22932, 1010, 6191, 19961, 1010, 6191, 21472, 1010, 6191, 22610, 1007, 1025, 19274, 2046, 1036, 6344...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
module ArrayTests def test_array_value_type assert_instance_of Inquisitive::Array, array end def test_array_match assert array.postgres? end def test_array_miss refute array.sql_server? end def test_array_negative_match assert array.exclude.sql_server? end def test_array_negative_miss refute array.exclude.postgres? end def test_array_double_negative_match assert array.exclude.exclude.postgres? end def test_array_double_negative_miss refute array.exclude.exclude.sql_server? end def test_array_respond_to assert_respond_to array, :postgres? end def test_array_method_missing assert_raises(NoMethodError) { array.undefined } end end
christhekeele/inquisitive
test/shared/array_tests.rb
Ruby
mit
711
[ 30522, 11336, 9140, 22199, 2015, 13366, 3231, 1035, 9140, 1035, 3643, 1035, 2828, 20865, 1035, 6013, 1035, 1997, 1999, 15549, 28032, 3512, 1024, 1024, 9140, 1010, 9140, 2203, 13366, 3231, 1035, 9140, 1035, 2674, 20865, 9140, 1012, 2695, 176...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2012-2013 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Issue 4691: Ensure that functional-struct-updates operates // correctly and moves rather than copy when appropriate. #![allow(unknown_features)] #![feature(box_syntax)] use std::marker::NoCopy as NP; struct ncint { np: NP, v: int } fn ncint(v: int) -> ncint { ncint { np: NP, v: v } } struct NoFoo { copied: int, nocopy: ncint, } impl NoFoo { fn new(x:int,y:int) -> NoFoo { NoFoo { copied: x, nocopy: ncint(y) } } } struct MoveFoo { copied: int, moved: Box<int>, } impl MoveFoo { fn new(x:int,y:int) -> MoveFoo { MoveFoo { copied: x, moved: box y } } } struct DropNoFoo { inner: NoFoo } impl DropNoFoo { fn new(x:int,y:int) -> DropNoFoo { DropNoFoo { inner: NoFoo::new(x,y) } } } impl Drop for DropNoFoo { fn drop(&mut self) { } } struct DropMoveFoo { inner: MoveFoo } impl DropMoveFoo { fn new(x:int,y:int) -> DropMoveFoo { DropMoveFoo { inner: MoveFoo::new(x,y) } } } impl Drop for DropMoveFoo { fn drop(&mut self) { } } fn test0() { // just copy implicitly copyable fields from `f`, no moves // (and thus it is okay that these are Drop; compare against // compile-fail test: borrowck-struct-update-with-dtor.rs). // Case 1: Nocopyable let f = DropNoFoo::new(1, 2); let b = DropNoFoo { inner: NoFoo { nocopy: ncint(3), ..f.inner }}; let c = DropNoFoo { inner: NoFoo { nocopy: ncint(4), ..f.inner }}; assert_eq!(f.inner.copied, 1); assert_eq!(f.inner.nocopy.v, 2); assert_eq!(b.inner.copied, 1); assert_eq!(b.inner.nocopy.v, 3); assert_eq!(c.inner.copied, 1); assert_eq!(c.inner.nocopy.v, 4); // Case 2: Owned let f = DropMoveFoo::new(5, 6); let b = DropMoveFoo { inner: MoveFoo { moved: box 7, ..f.inner }}; let c = DropMoveFoo { inner: MoveFoo { moved: box 8, ..f.inner }}; assert_eq!(f.inner.copied, 5); assert_eq!(*f.inner.moved, 6); assert_eq!(b.inner.copied, 5); assert_eq!(*b.inner.moved, 7); assert_eq!(c.inner.copied, 5); assert_eq!(*c.inner.moved, 8); } fn test1() { // copying move-by-default fields from `f`, so it moves: let f = MoveFoo::new(11, 12); let b = MoveFoo {moved: box 13, ..f}; let c = MoveFoo {copied: 14, ..f}; assert_eq!(b.copied, 11); assert_eq!(*b.moved, 13); assert_eq!(c.copied, 14); assert_eq!(*c.moved, 12); } fn test2() { // move non-copyable field let f = NoFoo::new(21, 22); let b = NoFoo {nocopy: ncint(23), ..f}; let c = NoFoo {copied: 24, ..f}; assert_eq!(b.copied, 21); assert_eq!(b.nocopy.v, 23); assert_eq!(c.copied, 24); assert_eq!(c.nocopy.v, 22); } pub fn main() { test0(); test1(); test2(); }
bombless/rust
src/test/run-pass/fsu-moves-and-copies.rs
Rust
apache-2.0
3,163
[ 30522, 1013, 1013, 9385, 2262, 1011, 2286, 1996, 18399, 2622, 9797, 1012, 2156, 1996, 9385, 1013, 1013, 5371, 2012, 1996, 2327, 1011, 2504, 14176, 1997, 2023, 4353, 1998, 2012, 1013, 1013, 8299, 1024, 1013, 1013, 18399, 1011, 11374, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div class="commune_descr limited"> <p> Larzicourt est un village géographiquement positionné dans le département de Marne en Champagne-Ardenne. Elle comptait 301 habitants en 2008.</p> <p>À proximité de Larzicourt sont positionnées géographiquement les communes de <a href="{{VLROOT}}/immobilier/arrigny_51016/">Arrigny</a> à 1&nbsp;km, 265 habitants, <a href="{{VLROOT}}/immobilier/ecriennes_51224/">Écriennes</a> localisée à 6&nbsp;km, 144 habitants, <a href="{{VLROOT}}/immobilier/moncetz-labbaye_51373/">Moncetz-l'Abbaye</a> localisée à 4&nbsp;km, 108 habitants, <a href="{{VLROOT}}/immobilier/matignicourt-goncourt_51356/">Matignicourt-Goncourt</a> à 5&nbsp;km, 115 habitants, <a href="{{VLROOT}}/immobilier/orconte_51417/">Orconte</a> à 4&nbsp;km, 420 habitants, <a href="{{VLROOT}}/immobilier/cloyes-sur-marne_51156/">Cloyes-sur-Marne</a> située à 6&nbsp;km, 112 habitants, entre autres. De plus, Larzicourt est située à seulement 17&nbsp;km de <a href="{{VLROOT}}/immobilier/saint-dizier_52448/">Saint-Dizier</a>.</p> <p>Si vous pensez venir habiter à Larzicourt, vous pourrez facilement trouver une maison à acheter. </p> <p>La ville propose quelques équipements, elle propose entre autres un terrain de tennis.</p> <p>Le nombre d'habitations, à Larzicourt, était réparti en 2011 en six appartements et 153 maisons soit un marché relativement équilibré.</p> </div>
donaldinou/frontend
src/Viteloge/CoreBundle/Resources/descriptions/51316.html
HTML
mit
1,422
[ 30522, 1026, 4487, 2615, 2465, 1027, 1000, 5715, 1035, 4078, 26775, 3132, 1000, 1028, 1026, 1052, 1028, 2474, 15378, 11261, 19585, 9765, 4895, 2352, 20248, 14413, 7413, 3672, 2597, 2638, 18033, 3393, 18280, 13665, 2139, 25823, 4372, 12327, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.feiyu.storm.streamingdatacollection.spout; /** * from https://github.com/apache/incubator-storm/blob/master/examples/storm-starter/src/jvm/storm/starter/spout/RandomSentenceSpout.java * modified by feiyu */ import java.util.Map; import java.util.Random; import backtype.storm.spout.SpoutOutputCollector; import backtype.storm.task.TopologyContext; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.topology.base.BaseRichSpout; import backtype.storm.tuple.Fields; import backtype.storm.tuple.Values; import backtype.storm.utils.Utils; @SuppressWarnings("serial") public class ForTestFakeSpout extends BaseRichSpout { private SpoutOutputCollector _collector; private Random _rand; @SuppressWarnings("rawtypes") @Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; _rand = new Random(); } @Override public void nextTuple() { Utils.sleep(5000); String[] tweets = new String[]{ "I rated X-Men: Days of Future Past 8/10 #IMDb http://www.imdb.com/title/tt1877832", "I rated Game of Thrones 10/10 #IMDb http://www.imdb.com/title/tt0944947", "I rated Snowpiercer 7/10 #IMDb really enjoyed this. Beautifully shot & choreographed. Great performance from Swinton http://www.imdb.com/title/tt1706620", "Back on form. That ending = awesome! - I rated X-Men: Days of Future Past 7/10 #IMDb http://www.imdb.com/title/tt1877832", "A great movie especially for those trying to learn German ~> I rated Run Lola Run 8/10 #IMDb http://www.imdb.com/title/tt0130827", "I rated Breaking Bad 8/10 #IMDb :: I would say 7 but last season made it worth it... Matter of taste @mmelgarejoc http://www.imdb.com/title/tt0903747", "I rated White House Down 7/10 #IMDb bunch of explosions and one liners, fun for all http://www.imdb.com/title/tt2334879" }; String tweet = tweets[_rand.nextInt(tweets.length)]; _collector.emit(new Values(tweet)); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("tweet")); } }
faustineinsun/WiseCrowdRec
deprecated-wisecrowdrec-springmvc/WiseCrowdRec/src/main/java/com/feiyu/storm/streamingdatacollection/spout/ForTestFakeSpout.java
Java
apache-2.0
2,356
[ 30522, 7427, 4012, 1012, 24664, 10513, 1012, 4040, 1012, 11058, 2850, 2696, 26895, 18491, 1012, 11867, 5833, 1025, 1013, 1008, 1008, 1008, 2013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 15895, 1013, 4297, 19761, 4263, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>Home</title> <link rel="stylesheet" type="text/css" href="C:\Users\christopher.dye\Desktop\east-website\css\menu_bar.css"> <link rel="stylesheet" type="text/css" href="C:\Users\christopher.dye\Desktop\east-website\css\default.css"> <!--This is the beginning Menu Bar code.--> <div align="center" class="menu-wrap"> <nav class="menu"> <ul class="clearfix"> <li><a href="#">Home</a></li> <li> <a href="student.html">Students<span class="arrow">&#9660;</span></a> <ul class="sub-menu"> <li><a href="#">2015-2016</a></li> </ul> </li> <li> <a href="#">Projects<span class="arrow">&#9660;</span></a> <ul class="sub-menu"> <li><a href="#">2015-2016</a></li> </ul> </li> <li><a href="#">Events</a></li> <li> <a href="about_us.html">About Us<span class="arrow">&#9660;</span></a> <ul class="sub-menu"> <li><a href="#">Contact Us</a></li> </ul> </li> </ul> </nav> </div> <!--This is the end of the Menu Bar code.--> </head> <body> <br> <h1 class="center-children">Home</h1> <p>Welcome to the EAST website!</p> <p>This is the Home page of the EAST Website. To see our current students this year, do a quick click over to our <a hreh"#">Students Page</a>. If you want to see the people who work their magic to keep this show</p> </body> </html>
NTC-EAST/EAST-Website
html/index.html
HTML
gpl-2.0
1,668
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 30524, 1032, 12183, 1035, 3347, 1012, 20116, 2015, 1000, 1028, 1026, 4957, 2128, 2140, 1027, 1000, 6782, 21030, 2102, 1000, 2828, 1027, 1000, 3793, 1013, 20116...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.webbitserver.stub; import org.webbitserver.EventSourceConnection; import org.webbitserver.HttpRequest; import org.webbitserver.WebSocketConnection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Executor; /** * Implementation of {@link EventSourceConnection} and {@link WebSocketConnection} that is easy to construct and * makes it easy to inspect results. Useful for testing. */ public class StubConnection extends StubDataHolder implements EventSourceConnection, WebSocketConnection { private final List<String> sentMessages = new LinkedList<String>(); private final List<byte[]> sentBinaryMessages = new LinkedList<byte[]>(); private final List<byte[]> sentPings = new LinkedList<byte[]>(); private final List<byte[]> sentPongs = new LinkedList<byte[]>(); private boolean closed = false; private HttpRequest httpRequest; private String version = null; public StubConnection(HttpRequest httpRequest) { this.httpRequest = httpRequest; } public StubConnection() { this(new StubHttpRequest()); } @Override public HttpRequest httpRequest() { return httpRequest; } @Override public StubConnection send(org.webbitserver.EventSourceMessage message) { return send(message.build()); } public StubConnection httpRequest(HttpRequest httpRequest) { this.httpRequest = httpRequest; return this; } @Override public StubConnection send(String message) { sentMessages.add(message); return this; } @Override public StubConnection send(byte[] message) { return send(message, 0, message.length); } @Override public StubConnection send(byte[] message, int offset, int length) { byte[] subMessage = new byte[length]; System.arraycopy(message, offset, subMessage, 0, length); sentBinaryMessages.add(subMessage); return this; } @Override public StubConnection ping(byte[] message) { sentPings.add(message); return this; } @Override public StubConnection pong(byte[] message) { sentPongs.add(message); return this; } @Override public StubConnection close() { closed = true; return this; } public boolean closed() { return closed; } public List<String> sentMessages() { return sentMessages; } public List<byte[]> sentBinaryMessages() { return sentBinaryMessages; } public List<byte[]> sentPings() { return sentPings; } public List<byte[]> sentPongs() { return sentPongs; } @Override public StubConnection data(String key, Object value) { super.data(key, value); return this; } @Override public Executor handlerExecutor() { return this; } @Override public String version() { return version; } public StubConnection version(String version) { this.version = version; return this; } @Override public void execute(Runnable command) { command.run(); } }
webbit/webbit
src/main/java/org/webbitserver/stub/StubConnection.java
Java
bsd-3-clause
3,190
[ 30522, 7427, 8917, 1012, 10923, 12762, 2121, 6299, 1012, 24646, 2497, 1025, 12324, 8917, 1012, 10923, 12762, 2121, 6299, 1012, 2824, 8162, 3401, 8663, 2638, 7542, 1025, 12324, 8917, 1012, 10923, 12762, 2121, 6299, 1012, 8299, 2890, 15500, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.slack.api.methods.response.admin.conversations.restrict_access; import com.slack.api.methods.SlackApiResponse; import com.slack.api.model.ErrorResponseMetadata; import lombok.Data; import java.util.List; @Data public class AdminConversationsRestrictAccessListGroupsResponse implements SlackApiResponse { private boolean ok; private String warning; private String error; private String needed; private String provided; private List<String> groupIds; private ErrorResponseMetadata responseMetadata; }
seratch/jslack
slack-api-client/src/main/java/com/slack/api/methods/response/admin/conversations/restrict_access/AdminConversationsRestrictAccessListGroupsResponse.java
Java
mit
543
[ 30522, 7427, 4012, 1012, 19840, 1012, 17928, 1012, 4725, 1012, 3433, 1012, 4748, 10020, 1012, 11450, 1012, 21573, 1035, 3229, 1025, 12324, 4012, 1012, 19840, 1012, 17928, 1012, 4725, 1012, 19840, 9331, 7442, 13102, 5644, 2063, 1025, 12324, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2008, Michael Pradel * All rights reserved. See LICENSE for details. */ package applications import collaborations.Person import collaborations.StickyThesisSupervision._ object StickyThesisSupervisionTestApp { trait SpecialPerson extends Person { def x = 23 } def main(args : Array[String]) : Unit = { val klaus = new Person{ val name = "Klaus" } // a professor val peter = new Person{ val name = "Peter" } // another student val franz = new SpecialPerson{ val name = "Franz" } // a student val s = new StickyThesisSupervision(klaus, peter) s.professor.advise println(s.student.wisdom) println(s.professor.writeLetter) s.student.bind(franz) println(franz.title + " " + franz.name) println(s.student.wisdom) println(s.professor.writeLetter) s.professor.awardDiploma println(franz.title + " " + franz.name) // now, the student is a SpecialPerson val s2 = new StickyThesisSupervision(klaus, franz) println(s2.student.x) } }
tupshin/Scala-Roles
examples/applications/StickyThesisSupervisionTestApp.scala
Scala
bsd-3-clause
1,068
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2263, 1010, 2745, 10975, 9648, 2140, 1008, 2035, 2916, 9235, 1012, 2156, 6105, 2005, 4751, 1012, 1008, 1013, 7427, 5097, 12324, 17437, 1012, 2711, 12324, 17437, 1012, 15875, 25078, 6342, 4842...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2015-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.segmentrouting; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import org.onlab.packet.Ethernet; import org.onlab.packet.ICMP6; import org.onlab.packet.IPv4; import org.onlab.packet.IPv6; import org.onlab.packet.IpAddress; import org.onlab.packet.IpPrefix; import org.onlab.packet.MacAddress; import org.onlab.packet.VlanId; import org.onlab.util.KryoNamespace; import org.onlab.util.Tools; import org.onosproject.cfg.ComponentConfigService; import org.onosproject.cluster.ClusterEvent; import org.onosproject.cluster.ClusterEventListener; import org.onosproject.cluster.ClusterService; import org.onosproject.cluster.LeadershipService; import org.onosproject.cluster.NodeId; import org.onosproject.core.ApplicationId; import org.onosproject.core.CoreService; import org.onosproject.event.Event; import org.onosproject.mastership.MastershipEvent; import org.onosproject.mastership.MastershipListener; import org.onosproject.mastership.MastershipService; import org.onosproject.mcast.api.McastEvent; import org.onosproject.mcast.api.McastListener; import org.onosproject.mcast.api.MulticastRouteService; import org.onosproject.net.ConnectPoint; import org.onosproject.net.Device; import org.onosproject.net.DeviceId; import org.onosproject.net.Host; import org.onosproject.net.HostId; import org.onosproject.net.Link; import org.onosproject.net.Port; import org.onosproject.net.PortNumber; import org.onosproject.net.config.ConfigException; import org.onosproject.net.config.ConfigFactory; import org.onosproject.net.config.NetworkConfigEvent; import org.onosproject.net.config.NetworkConfigListener; import org.onosproject.net.config.NetworkConfigRegistry; import org.onosproject.net.config.basics.InterfaceConfig; import org.onosproject.net.config.basics.McastConfig; import org.onosproject.net.config.basics.SubjectFactories; import org.onosproject.net.device.DeviceAdminService; import org.onosproject.net.device.DeviceEvent; import org.onosproject.net.device.DeviceListener; import org.onosproject.net.device.DeviceService; import org.onosproject.net.flow.TrafficSelector; import org.onosproject.net.flow.TrafficTreatment; import org.onosproject.net.flowobjective.FlowObjectiveService; import org.onosproject.net.flowobjective.NextObjective; import org.onosproject.net.host.HostEvent; import org.onosproject.net.host.HostListener; import org.onosproject.net.host.HostProbingService; import org.onosproject.net.host.HostService; import org.onosproject.net.host.InterfaceIpAddress; import org.onosproject.net.intent.WorkPartitionService; import org.onosproject.net.intf.Interface; import org.onosproject.net.intf.InterfaceService; import org.onosproject.net.link.LinkEvent; import org.onosproject.net.link.LinkListener; import org.onosproject.net.link.LinkService; import org.onosproject.net.neighbour.NeighbourResolutionService; import org.onosproject.net.packet.InboundPacket; import org.onosproject.net.packet.PacketContext; import org.onosproject.net.packet.PacketProcessor; import org.onosproject.net.packet.PacketService; import org.onosproject.net.topology.TopologyEvent; import org.onosproject.net.topology.TopologyListener; import org.onosproject.net.topology.TopologyService; import org.onosproject.routeservice.ResolvedRoute; import org.onosproject.routeservice.RouteEvent; import org.onosproject.routeservice.RouteListener; import org.onosproject.routeservice.RouteService; import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; import org.onosproject.segmentrouting.config.DeviceConfiguration; import org.onosproject.segmentrouting.config.SegmentRoutingAppConfig; import org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig; import org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler; import org.onosproject.segmentrouting.grouphandler.DestinationSet; import org.onosproject.segmentrouting.grouphandler.NextNeighbors; import org.onosproject.segmentrouting.mcast.McastFilteringObjStoreKey; import org.onosproject.segmentrouting.mcast.McastHandler; import org.onosproject.segmentrouting.mcast.McastRole; import org.onosproject.segmentrouting.mcast.McastRoleStoreKey; import org.onosproject.segmentrouting.mcast.McastStoreKey; import org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService; import org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel; import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription; import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler; import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy; import org.onosproject.segmentrouting.pwaas.L2Tunnel; import org.onosproject.segmentrouting.pwaas.L2TunnelDescription; import org.onosproject.segmentrouting.pwaas.L2TunnelHandler; import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy; import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; import org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey; import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey; import org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey; import org.onosproject.segmentrouting.storekey.XConnectStoreKey; import org.onosproject.segmentrouting.xconnect.api.XconnectService; import org.onosproject.store.serializers.KryoNamespaces; import org.onosproject.store.service.EventuallyConsistentMap; import org.onosproject.store.service.EventuallyConsistentMapBuilder; import org.onosproject.store.service.StorageService; import org.onosproject.store.service.WallClockTimestamp; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.osgi.service.component.annotations.Modified; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.time.Instant; import java.util.ArrayList; import java.util.Collections; import java.util.Dictionary; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkState; import static org.onlab.packet.Ethernet.TYPE_ARP; import static org.onlab.util.Tools.groupedThreads; import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED; import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED; import static org.onosproject.segmentrouting.OsgiPropertyConstants.ACTIVE_PROBING_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.DEFAULT_INTERNAL_VLAN_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ACTIVE_PROBING; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_DEFAULT_INTERNAL_VLAN; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_PW_TRANSPORT_VLAN; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_RESPOND_TO_UNKNOWN_HOSTS; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_DOUBLE_TAGGED_HOSTS; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_SIMPLIFICATION; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SINGLE_HOMED_DOWN; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SYMMETRIC_PROBING; import static org.onosproject.segmentrouting.OsgiPropertyConstants.PW_TRANSPORT_VLAN_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.RESPOND_TO_UNKNOWN_HOSTS_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_SIMPLIFICATION_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.SINGLE_HOMED_DOWN_DEFAULT; import static org.onosproject.segmentrouting.OsgiPropertyConstants.SYMMETRIC_PROBING_DEFAULT; /** * Segment routing manager. */ @Component( immediate = true, service = SegmentRoutingService.class, property = { PROP_ACTIVE_PROBING + ":Boolean=" + ACTIVE_PROBING_DEFAULT, PROP_SINGLE_HOMED_DOWN + ":Boolean=" + SINGLE_HOMED_DOWN_DEFAULT, PROP_RESPOND_TO_UNKNOWN_HOSTS + ":Boolean=" + RESPOND_TO_UNKNOWN_HOSTS_DEFAULT, PROP_ROUTE_DOUBLE_TAGGED_HOSTS + ":Boolean=" + ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT, PROP_DEFAULT_INTERNAL_VLAN + ":Integer=" + DEFAULT_INTERNAL_VLAN_DEFAULT, PROP_PW_TRANSPORT_VLAN + ":Integer=" + PW_TRANSPORT_VLAN_DEFAULT, PROP_SYMMETRIC_PROBING + ":Boolean=" + SYMMETRIC_PROBING_DEFAULT, PROP_ROUTE_SIMPLIFICATION + ":Boolean=" + ROUTE_SIMPLIFICATION_DEFAULT } ) public class SegmentRoutingManager implements SegmentRoutingService { private static Logger log = LoggerFactory.getLogger(SegmentRoutingManager.class); private static final String NOT_MASTER = "Current instance is not the master of {}. Ignore."; @Reference(cardinality = ReferenceCardinality.MANDATORY) private ComponentConfigService compCfgService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public NeighbourResolutionService neighbourResolutionService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public CoreService coreService; @Reference(cardinality = ReferenceCardinality.MANDATORY) PacketService packetService; @Reference(cardinality = ReferenceCardinality.MANDATORY) HostService hostService; @Reference(cardinality = ReferenceCardinality.MANDATORY) HostProbingService probingService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public DeviceService deviceService; @Reference(cardinality = ReferenceCardinality.MANDATORY) DeviceAdminService deviceAdminService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public FlowObjectiveService flowObjectiveService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public LinkService linkService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public MastershipService mastershipService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public StorageService storageService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public MulticastRouteService multicastRouteService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public TopologyService topologyService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public RouteService routeService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public NetworkConfigRegistry cfgService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public InterfaceService interfaceService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public ClusterService clusterService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public WorkPartitionService workPartitionService; @Reference(cardinality = ReferenceCardinality.MANDATORY) public LeadershipService leadershipService; @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC) public volatile XconnectService xconnectService; @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC) volatile PhasedRecoveryService phasedRecoveryService; /** Enable active probing to discover dual-homed hosts. */ boolean activeProbing = ACTIVE_PROBING_DEFAULT; /** Enable only send probe on the same port number of the pair device. */ boolean symmetricProbing = SYMMETRIC_PROBING_DEFAULT; /** Enable administratively taking down single-homed hosts. */ boolean singleHomedDown = SINGLE_HOMED_DOWN_DEFAULT; /** Enable this to respond to ARP/NDP requests from unknown hosts. */ boolean respondToUnknownHosts = RESPOND_TO_UNKNOWN_HOSTS_DEFAULT; /** Program flows and groups to pop and route double tagged hosts. */ boolean routeDoubleTaggedHosts = ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT; /** internal vlan assigned by default to unconfigured ports. */ private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN_DEFAULT; /** vlan used for transport of pseudowires between switches. */ private int pwTransportVlan = PW_TRANSPORT_VLAN_DEFAULT; /** Enabling route simplification. */ boolean routeSimplification = ROUTE_SIMPLIFICATION_DEFAULT; ArpHandler arpHandler = null; IcmpHandler icmpHandler = null; IpHandler ipHandler = null; RoutingRulePopulator routingRulePopulator = null; ApplicationId appId; DeviceConfiguration deviceConfiguration = null; DefaultRoutingHandler defaultRoutingHandler = null; private TunnelHandler tunnelHandler = null; private PolicyHandler policyHandler = null; private InternalPacketProcessor processor = null; private InternalLinkListener linkListener = null; private InternalDeviceListener deviceListener = null; private AppConfigHandler appCfgHandler = null; McastHandler mcastHandler = null; HostHandler hostHandler = null; private RouteHandler routeHandler = null; LinkHandler linkHandler = null; private SegmentRoutingNeighbourDispatcher neighbourHandler = null; private DefaultL2TunnelHandler l2TunnelHandler = null; private TopologyHandler topologyHandler = null; private final InternalHostListener hostListener = new InternalHostListener(); private final InternalConfigListener cfgListener = new InternalConfigListener(this); private final InternalMcastListener mcastListener = new InternalMcastListener(); private final InternalRouteEventListener routeListener = new InternalRouteEventListener(); private final InternalTopologyListener topologyListener = new InternalTopologyListener(); private final InternalMastershipListener mastershipListener = new InternalMastershipListener(); final InternalClusterListener clusterListener = new InternalClusterListener(); //Completable future for network configuration process to buffer config events handling during activation private CompletableFuture<Boolean> networkConfigCompletion = null; private final Object networkConfigCompletionLock = new Object(); private List<Event> queuedEvents = new CopyOnWriteArrayList<>(); // Handles device, link, topology and network config events private ScheduledExecutorService mainEventExecutor; // Handles host, route and mcast events respectively private ScheduledExecutorService hostEventExecutor; private ScheduledExecutorService routeEventExecutor; private ScheduledExecutorService mcastEventExecutor; private ExecutorService packetExecutor; ExecutorService neighborExecutor; Map<DeviceId, DefaultGroupHandler> groupHandlerMap = new ConcurrentHashMap<>(); /** * Per device next objective ID store with (device id + destination set) as key. * Used to keep track on MPLS group information. */ private EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> dsNextObjStore = null; /** * Per device next objective ID store with (device id + vlanid) as key. * Used to keep track on L2 flood group information. */ private EventuallyConsistentMap<VlanNextObjectiveStoreKey, Integer> vlanNextObjStore = null; /** * Per device next objective ID store with (device id + port + treatment + meta) as key. * Used to keep track on L2 interface group and L3 unicast group information for direct hosts. */ private EventuallyConsistentMap<PortNextObjectiveStoreKey, Integer> portNextObjStore = null; /** * Per device next objective ID store with (device id + MAC address + vlan) as key. * Used to keep track of L3 unicast group for indirect hosts. */ private EventuallyConsistentMap<MacVlanNextObjectiveStoreKey, Integer> macVlanNextObjStore = null; private EventuallyConsistentMap<String, Tunnel> tunnelStore = null; private EventuallyConsistentMap<String, Policy> policyStore = null; private AtomicBoolean programmingScheduled = new AtomicBoolean(); private final ConfigFactory<DeviceId, SegmentRoutingDeviceConfig> deviceConfigFactory = new ConfigFactory<DeviceId, SegmentRoutingDeviceConfig>( SubjectFactories.DEVICE_SUBJECT_FACTORY, SegmentRoutingDeviceConfig.class, "segmentrouting") { @Override public SegmentRoutingDeviceConfig createConfig() { return new SegmentRoutingDeviceConfig(); } }; private final ConfigFactory<ApplicationId, SegmentRoutingAppConfig> appConfigFactory = new ConfigFactory<ApplicationId, SegmentRoutingAppConfig>( SubjectFactories.APP_SUBJECT_FACTORY, SegmentRoutingAppConfig.class, "segmentrouting") { @Override public SegmentRoutingAppConfig createConfig() { return new SegmentRoutingAppConfig(); } }; private ConfigFactory<ApplicationId, McastConfig> mcastConfigFactory = new ConfigFactory<ApplicationId, McastConfig>( SubjectFactories.APP_SUBJECT_FACTORY, McastConfig.class, "multicast") { @Override public McastConfig createConfig() { return new McastConfig(); } }; /** * Segment Routing App ID. */ public static final String APP_NAME = "org.onosproject.segmentrouting"; /** * Minumum and maximum value of dummy VLAN ID to be allocated. */ public static final int MIN_DUMMY_VLAN_ID = 2; public static final int MAX_DUMMY_VLAN_ID = 4093; private static final int DEFAULT_POOL_SIZE = 32; Instant lastEdgePortEvent = Instant.EPOCH; @Activate protected void activate(ComponentContext context) { appId = coreService.registerApplication(APP_NAME); mainEventExecutor = Executors.newSingleThreadScheduledExecutor( groupedThreads("onos/sr", "event-main-%d", log)); hostEventExecutor = Executors.newSingleThreadScheduledExecutor( groupedThreads("onos/sr", "event-host-%d", log)); routeEventExecutor = Executors.newSingleThreadScheduledExecutor( groupedThreads("onos/sr", "event-route-%d", log)); mcastEventExecutor = Executors.newSingleThreadScheduledExecutor( groupedThreads("onos/sr", "event-mcast-%d", log)); packetExecutor = Executors.newSingleThreadExecutor(groupedThreads("onos/sr", "packet-%d", log)); neighborExecutor = Executors.newFixedThreadPool(DEFAULT_POOL_SIZE, groupedThreads("onos/sr", "neighbor-%d", log)); log.debug("Creating EC map nsnextobjectivestore"); EventuallyConsistentMapBuilder<DestinationSetNextObjectiveStoreKey, NextNeighbors> nsNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder(); dsNextObjStore = nsNextObjMapBuilder .withName("nsnextobjectivestore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); log.trace("Current size {}", dsNextObjStore.size()); log.debug("Creating EC map vlannextobjectivestore"); EventuallyConsistentMapBuilder<VlanNextObjectiveStoreKey, Integer> vlanNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder(); vlanNextObjStore = vlanNextObjMapBuilder .withName("vlannextobjectivestore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); log.debug("Creating EC map macvlannextobjectivestore"); EventuallyConsistentMapBuilder<MacVlanNextObjectiveStoreKey, Integer> macVlanNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder(); macVlanNextObjStore = macVlanNextObjMapBuilder .withName("macvlannextobjectivestore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); log.debug("Creating EC map subnetnextobjectivestore"); EventuallyConsistentMapBuilder<PortNextObjectiveStoreKey, Integer> portNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder(); portNextObjStore = portNextObjMapBuilder .withName("portnextobjectivestore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); EventuallyConsistentMapBuilder<String, Tunnel> tunnelMapBuilder = storageService.eventuallyConsistentMapBuilder(); tunnelStore = tunnelMapBuilder .withName("tunnelstore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); EventuallyConsistentMapBuilder<String, Policy> policyMapBuilder = storageService.eventuallyConsistentMapBuilder(); policyStore = policyMapBuilder .withName("policystore") .withSerializer(createSerializer()) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .build(); processor = new InternalPacketProcessor(); linkListener = new InternalLinkListener(); deviceListener = new InternalDeviceListener(); appCfgHandler = new AppConfigHandler(this); mcastHandler = new McastHandler(this); hostHandler = new HostHandler(this); linkHandler = new LinkHandler(this); routeHandler = new RouteHandler(this); neighbourHandler = new SegmentRoutingNeighbourDispatcher(this); l2TunnelHandler = new DefaultL2TunnelHandler(this); topologyHandler = new TopologyHandler(this); compCfgService.preSetProperty("org.onosproject.provider.host.impl.HostLocationProvider", "requestInterceptsEnabled", "false", false); compCfgService.preSetProperty("org.onosproject.net.neighbour.impl.NeighbourResolutionManager", "requestInterceptsEnabled", "false", false); compCfgService.preSetProperty("org.onosproject.dhcprelay.DhcpRelayManager", "arpEnabled", "false", false); compCfgService.preSetProperty("org.onosproject.net.host.impl.HostManager", "greedyLearningIpv6", "true", false); compCfgService.preSetProperty("org.onosproject.routing.cpr.ControlPlaneRedirectManager", "forceUnprovision", "true", false); compCfgService.preSetProperty("org.onosproject.routeservice.store.RouteStoreImpl", "distributed", "true", false); compCfgService.preSetProperty("org.onosproject.provider.host.impl.HostLocationProvider", "multihomingEnabled", "true", false); compCfgService.preSetProperty("org.onosproject.provider.lldp.impl.LldpLinkProvider", "staleLinkAge", "15000", false); compCfgService.preSetProperty("org.onosproject.net.host.impl.HostManager", "allowDuplicateIps", "false", false); // For P4 switches compCfgService.preSetProperty("org.onosproject.net.flow.impl.FlowRuleManager", "fallbackFlowPollFrequency", "4", false); compCfgService.preSetProperty("org.onosproject.net.group.impl.GroupManager", "fallbackGroupPollFrequency", "3", false); compCfgService.registerProperties(getClass()); modified(context); cfgService.addListener(cfgListener); cfgService.registerConfigFactory(deviceConfigFactory); cfgService.registerConfigFactory(appConfigFactory); cfgService.registerConfigFactory(mcastConfigFactory); log.info("Configuring network before adding listeners"); cfgListener.configureNetwork(); hostService.addListener(hostListener); packetService.addProcessor(processor, PacketProcessor.director(2)); linkService.addListener(linkListener); deviceService.addListener(deviceListener); multicastRouteService.addListener(mcastListener); routeService.addListener(routeListener); topologyService.addListener(topologyListener); mastershipService.addListener(mastershipListener); clusterService.addListener(clusterListener); linkHandler.init(); l2TunnelHandler.init(); synchronized (networkConfigCompletionLock) { networkConfigCompletion.whenComplete((value, ex) -> { //setting to null for easier fall through networkConfigCompletion = null; //process all queued events queuedEvents.forEach(event -> { mainEventExecutor.execute(new InternalEventHandler(event)); }); }); } log.info("Started"); } KryoNamespace.Builder createSerializer() { return new KryoNamespace.Builder() .register(KryoNamespaces.API) .register(DestinationSetNextObjectiveStoreKey.class, VlanNextObjectiveStoreKey.class, DestinationSet.class, DestinationSet.DestinationSetType.class, NextNeighbors.class, Tunnel.class, DefaultTunnel.class, Policy.class, TunnelPolicy.class, Policy.Type.class, PortNextObjectiveStoreKey.class, XConnectStoreKey.class, L2Tunnel.class, L2TunnelPolicy.class, DefaultL2Tunnel.class, DefaultL2TunnelPolicy.class, MacVlanNextObjectiveStoreKey.class ); } @Deactivate protected void deactivate() { mainEventExecutor.shutdown(); hostEventExecutor.shutdown(); routeEventExecutor.shutdown(); mcastEventExecutor.shutdown(); packetExecutor.shutdown(); neighborExecutor.shutdown(); mainEventExecutor = null; hostEventExecutor = null; routeEventExecutor = null; mcastEventExecutor = null; packetExecutor = null; neighborExecutor = null; cfgService.removeListener(cfgListener); cfgService.unregisterConfigFactory(deviceConfigFactory); cfgService.unregisterConfigFactory(appConfigFactory); cfgService.unregisterConfigFactory(mcastConfigFactory); compCfgService.unregisterProperties(getClass(), false); hostService.removeListener(hostListener); packetService.removeProcessor(processor); linkService.removeListener(linkListener); deviceService.removeListener(deviceListener); multicastRouteService.removeListener(mcastListener); routeService.removeListener(routeListener); topologyService.removeListener(topologyListener); mastershipService.removeListener(mastershipListener); clusterService.removeListener(clusterListener); neighbourResolutionService.unregisterNeighbourHandlers(appId); processor = null; linkListener = null; deviceListener = null; groupHandlerMap.forEach((k, v) -> v.shutdown()); groupHandlerMap.clear(); defaultRoutingHandler.shutdown(); dsNextObjStore.destroy(); vlanNextObjStore.destroy(); macVlanNextObjStore.destroy(); portNextObjStore.destroy(); tunnelStore.destroy(); policyStore.destroy(); mcastHandler.terminate(); hostHandler.terminate(); log.info("Stopped"); } @Modified private void modified(ComponentContext context) { Dictionary<?, ?> properties = context.getProperties(); if (properties == null) { return; } String strActiveProbing = Tools.get(properties, PROP_ACTIVE_PROBING); boolean expectActiveProbing = Boolean.parseBoolean(strActiveProbing); if (expectActiveProbing != activeProbing) { activeProbing = expectActiveProbing; log.info("{} active probing", activeProbing ? "Enabling" : "Disabling"); } String strSymmetricProbing = Tools.get(properties, PROP_SYMMETRIC_PROBING); boolean expectSymmetricProbing = Boolean.parseBoolean(strSymmetricProbing); if (expectSymmetricProbing != symmetricProbing) { symmetricProbing = expectSymmetricProbing; log.info("{} symmetric probing", symmetricProbing ? "Enabling" : "Disabling"); } String strSingleHomedDown = Tools.get(properties, PROP_SINGLE_HOMED_DOWN); boolean expectSingleHomedDown = Boolean.parseBoolean(strSingleHomedDown); if (expectSingleHomedDown != singleHomedDown) { singleHomedDown = expectSingleHomedDown; log.info("{} downing of single homed hosts for lost uplinks", singleHomedDown ? "Enabling" : "Disabling"); if (singleHomedDown && linkHandler != null) { hostService.getHosts().forEach(host -> host.locations() .forEach(loc -> { if (interfaceService.isConfigured(loc)) { linkHandler.checkUplinksForHost(loc); } })); } else { log.warn("Disabling singleHomedDown does not re-enable already " + "downed ports for single-homed hosts"); } } String strRespondToUnknownHosts = Tools.get(properties, PROP_RESPOND_TO_UNKNOWN_HOSTS); boolean expectRespondToUnknownHosts = Boolean.parseBoolean(strRespondToUnknownHosts); if (expectRespondToUnknownHosts != respondToUnknownHosts) { respondToUnknownHosts = expectRespondToUnknownHosts; log.info("{} responding to ARPs/NDPs from unknown hosts", respondToUnknownHosts ? "Enabling" : "Disabling"); } String strRouteDoubleTaggedHosts = Tools.get(properties, PROP_ROUTE_DOUBLE_TAGGED_HOSTS); boolean expectRouteDoubleTaggedHosts = Boolean.parseBoolean(strRouteDoubleTaggedHosts); if (expectRouteDoubleTaggedHosts != routeDoubleTaggedHosts) { routeDoubleTaggedHosts = expectRouteDoubleTaggedHosts; log.info("{} routing for double tagged hosts", routeDoubleTaggedHosts ? "Enabling" : "Disabling"); if (routeDoubleTaggedHosts) { hostHandler.populateAllDoubleTaggedHost(); } else { hostHandler.revokeAllDoubleTaggedHost(); } } String strDefaultInternalVlan = Tools.get(properties, PROP_DEFAULT_INTERNAL_VLAN); int defIntVlan = Integer.parseInt(strDefaultInternalVlan); if (defIntVlan != defaultInternalVlan) { if (canUseVlanId(defIntVlan)) { log.warn("Default internal vlan value changed from {} to {}.. " + "re-programming filtering rules, but NOT any groups already " + "created with the former value", defaultInternalVlan, defIntVlan); VlanId oldDefIntVlan = VlanId.vlanId((short) defaultInternalVlan); defaultInternalVlan = defIntVlan; routingRulePopulator .updateSpecialVlanFilteringRules(true, oldDefIntVlan, VlanId.vlanId((short) defIntVlan)); } else { log.warn("Cannot change default internal vlan to unusable " + "value {}", defIntVlan); } } String strPwTxpVlan = Tools.get(properties, PROP_PW_TRANSPORT_VLAN); int pwTxpVlan = Integer.parseInt(strPwTxpVlan); if (pwTxpVlan != pwTransportVlan) { if (canUseVlanId(pwTxpVlan)) { log.warn("Pseudowire transport vlan value changed from {} to {}.. " + "re-programming filtering rules, but NOT any groups already " + "created with the former value", pwTransportVlan, pwTxpVlan); VlanId oldPwTxpVlan = VlanId.vlanId((short) pwTransportVlan); pwTransportVlan = pwTxpVlan; routingRulePopulator .updateSpecialVlanFilteringRules(false, oldPwTxpVlan, VlanId.vlanId((short) pwTxpVlan)); } else { log.warn("Cannot change pseudowire transport vlan to unusable " + "value {}", pwTxpVlan); } } String strRouteSimplification = Tools.get(properties, PROP_ROUTE_SIMPLIFICATION); boolean expectRouteSimplification = Boolean.parseBoolean(strRouteSimplification); if (expectRouteSimplification != routeSimplification) { routeSimplification = expectRouteSimplification; log.info("{} route simplification", routeSimplification ? "Enabling" : "Disabling"); } } /** * Returns true if given vlan id is not being used in the system currently, * either as one of the default system wide vlans or as one of the * configured interface vlans. * * @param vlanId given vlan id * @return true if vlan is not currently in use */ public boolean canUseVlanId(int vlanId) { if (vlanId >= 4095 || vlanId <= 1) { log.error("Vlan id {} value is not in valid range 2 <--> 4094", vlanId); return false; } VlanId vid = VlanId.vlanId((short) vlanId); if (getDefaultInternalVlan().equals(vid) || getPwTransportVlan().equals(vid)) { log.warn("Vlan id {} value is already in use system-wide. " + "DefaultInternalVlan:{} PwTransportVlan:{} ", vlanId, getDefaultInternalVlan(), getPwTransportVlan()); return false; } if (interfaceService.inUse(vid)) { log.warn("Vlan id {} value is already in use on a configured " + "interface in the system", vlanId); return false; } return true; } /** * Returns the VlanId assigned internally by default to unconfigured ports. * * @return the default internal vlan id */ public VlanId getDefaultInternalVlan() { return VlanId.vlanId((short) defaultInternalVlan); } /** * Returns the Vlan id used to transport pseudowire traffic across the * network. * * @return the pseudowire transport vlan id */ public VlanId getPwTransportVlan() { return VlanId.vlanId((short) pwTransportVlan); } @Override public List<Tunnel> getTunnels() { return tunnelHandler.getTunnels(); } @Override public TunnelHandler.Result createTunnel(Tunnel tunnel) { return tunnelHandler.createTunnel(tunnel); } @Override public TunnelHandler.Result removeTunnel(Tunnel tunnel) { for (Policy policy: policyHandler.getPolicies()) { if (policy.type() == Policy.Type.TUNNEL_FLOW) { TunnelPolicy tunnelPolicy = (TunnelPolicy) policy; if (tunnelPolicy.tunnelId().equals(tunnel.id())) { log.warn("Cannot remove the tunnel used by a policy"); return TunnelHandler.Result.TUNNEL_IN_USE; } } } return tunnelHandler.removeTunnel(tunnel); } @Override public PolicyHandler.Result removePolicy(Policy policy) { return policyHandler.removePolicy(policy); } @Override public PolicyHandler.Result createPolicy(Policy policy) { return policyHandler.createPolicy(policy); } @Override public List<Policy> getPolicies() { return policyHandler.getPolicies(); } @Override public Set<L2TunnelDescription> getL2TunnelDescriptions(boolean pending) { return l2TunnelHandler.getL2Descriptions(pending); } @Override public List<L2Tunnel> getL2Tunnels() { return l2TunnelHandler.getL2Tunnels(); } @Override public List<L2TunnelPolicy> getL2Policies() { return l2TunnelHandler.getL2Policies(); } @Override @Deprecated public L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> bulkPseudowires) { // get both added and pending pseudowires List<L2TunnelDescription> pseudowires = new ArrayList<>(); pseudowires.addAll(l2TunnelHandler.getL2Descriptions(false)); pseudowires.addAll(l2TunnelHandler.getL2Descriptions(true)); pseudowires.addAll(bulkPseudowires); Set<L2TunnelDescription> newPseudowires = new HashSet(bulkPseudowires); L2TunnelHandler.Result retRes = L2TunnelHandler.Result.SUCCESS; L2TunnelHandler.Result res; for (DefaultL2TunnelDescription pw : bulkPseudowires) { res = addPseudowire(pw); if (res != L2TunnelHandler.Result.SUCCESS) { log.error("Pseudowire with id {} can not be instantiated !", res); retRes = res; } } return retRes; } @Override public L2TunnelHandler.Result addPseudowire(L2TunnelDescription l2TunnelDescription) { return l2TunnelHandler.deployPseudowire(l2TunnelDescription); } @Override public L2TunnelHandler.Result removePseudowire(Integer pwId) { return l2TunnelHandler.tearDownPseudowire(pwId); } @Override public void rerouteNetwork() { cfgListener.configureNetwork(); } @Override public Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap() { Map<DeviceId, Set<IpPrefix>> deviceSubnetMap = Maps.newHashMap(); deviceConfiguration.getRouters().forEach(device -> deviceSubnetMap.put(device, deviceConfiguration.getSubnets(device))); return deviceSubnetMap; } @Override public ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg() { if (defaultRoutingHandler != null) { return defaultRoutingHandler.getCurrentEmcpSpgMap(); } else { return null; } } @Override public ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDstNextObjStore() { if (dsNextObjStore != null) { return ImmutableMap.copyOf(dsNextObjStore.entrySet()); } else { return ImmutableMap.of(); } } @Override public ImmutableMap<VlanNextObjectiveStoreKey, Integer> getVlanNextObjStore() { if (vlanNextObjStore != null) { return ImmutableMap.copyOf(vlanNextObjStore.entrySet()); } else { return ImmutableMap.of(); } } @Override public ImmutableMap<MacVlanNextObjectiveStoreKey, Integer> getMacVlanNextObjStore() { if (macVlanNextObjStore != null) { return ImmutableMap.copyOf(macVlanNextObjStore.entrySet()); } else { return ImmutableMap.of(); } } @Override public ImmutableMap<PortNextObjectiveStoreKey, Integer> getPortNextObjStore() { if (portNextObjStore != null) { return ImmutableMap.copyOf(portNextObjStore.entrySet()); } else { return ImmutableMap.of(); } } @Override public ImmutableMap<String, NextObjective> getPwInitNext() { if (l2TunnelHandler != null) { return l2TunnelHandler.getInitNext(); } else { return ImmutableMap.of(); } } @Override public ImmutableMap<String, NextObjective> getPwTermNext() { if (l2TunnelHandler != null) { return l2TunnelHandler.getTermNext(); } else { return ImmutableMap.of(); } } @Override public void invalidateNextObj(int nextId) { if (dsNextObjStore != null) { dsNextObjStore.entrySet().forEach(e -> { if (e.getValue().nextId() == nextId) { dsNextObjStore.remove(e.getKey()); } }); } if (vlanNextObjStore != null) { vlanNextObjStore.entrySet().forEach(e -> { if (e.getValue() == nextId) { vlanNextObjStore.remove(e.getKey()); } }); } if (macVlanNextObjStore != null) { macVlanNextObjStore.entrySet().forEach(e -> { if (e.getValue() == nextId) { macVlanNextObjStore.remove(e.getKey()); } }); } if (portNextObjStore != null) { portNextObjStore.entrySet().forEach(e -> { if (e.getValue() == nextId) { portNextObjStore.remove(e.getKey()); } }); } if (mcastHandler != null) { mcastHandler.removeNextId(nextId); } if (l2TunnelHandler != null) { l2TunnelHandler.removeNextId(nextId); } if (xconnectService != null) { xconnectService.removeNextId(nextId); } } @Override public void verifyGroups(DeviceId id) { DefaultGroupHandler gh = groupHandlerMap.get(id); if (gh != null) { gh.triggerBucketCorrector(); } } @Override public ImmutableMap<Link, Boolean> getSeenLinks() { return linkHandler.getSeenLinks(); } @Override public ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState() { return linkHandler.getDownedPorts(); } @Override public Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp) { return mcastHandler.getNextIds(mcastIp); } @Override public Map<McastRoleStoreKey, McastRole> getMcastRoles(IpAddress mcastIp, ConnectPoint sourcecp) { return mcastHandler.getMcastRoles(mcastIp, sourcecp); } @Override public Multimap<ConnectPoint, List<ConnectPoint>> getMcastTrees(IpAddress mcastIp, ConnectPoint sourcecp) { return mcastHandler.getMcastTrees(mcastIp, sourcecp); } @Override public Map<IpAddress, NodeId> getMcastLeaders(IpAddress mcastIp) { return mcastHandler.getMcastLeaders(mcastIp); } @Override public Map<DeviceId, List<McastFilteringObjStoreKey>> getMcastFilters() { return mcastHandler.getMcastFilters(); } @Override public Map<Set<DeviceId>, NodeId> getShouldProgram() { return defaultRoutingHandler == null ? ImmutableMap.of() : ImmutableMap.copyOf(defaultRoutingHandler.shouldProgram); } @Override public Map<DeviceId, Boolean> getShouldProgramCache() { return defaultRoutingHandler == null ? ImmutableMap.of() : ImmutableMap.copyOf(defaultRoutingHandler.shouldProgramCache); } @Override public boolean shouldProgram(DeviceId deviceId) { return defaultRoutingHandler.shouldProgram(deviceId); } @Override public boolean isRoutingStable() { return defaultRoutingHandler.isRoutingStable(); } @Override public void initHost(DeviceId deviceId) { hostEventExecutor.execute(() -> hostHandler.init(deviceId)); } @Override public void initRoute(DeviceId deviceId) { routeEventExecutor.execute(() -> routeHandler.init(deviceId)); } @Override public ApplicationId appId() { return appId; } /** * Returns the device configuration. * * @return device configuration */ public DeviceConfiguration deviceConfiguration() { return deviceConfiguration; } /** * Per device next objective ID store with (device id + destination set) as key. * Used to keep track on MPLS group information. * * @return next objective ID store */ public EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> dsNextObjStore() { return dsNextObjStore; } /** * Per device next objective ID store with (device id + vlanid) as key. * Used to keep track on L2 flood group information. * * @return vlan next object store */ public EventuallyConsistentMap<VlanNextObjectiveStoreKey, Integer> vlanNextObjStore() { return vlanNextObjStore; } /** * Per device next objective ID store with (device id + MAC address + vlan) as key. * Used to keep track on L3 Unicast group information for indirect hosts. * * @return mac vlan next object store */ public EventuallyConsistentMap<MacVlanNextObjectiveStoreKey, Integer> macVlanNextObjStore() { return macVlanNextObjStore; } /** * Per device next objective ID store with (device id + port + treatment + meta) as key. * Used to keep track on L2 interface group and L3 unicast group information for direct hosts. * * @return port next object store. */ public EventuallyConsistentMap<PortNextObjectiveStoreKey, Integer> portNextObjStore() { return portNextObjStore; } /** * Returns the MPLS-ECMP configuration which indicates whether ECMP on * labeled packets should be programmed or not. * * @return MPLS-ECMP value */ public boolean getMplsEcmp() { SegmentRoutingAppConfig segmentRoutingAppConfig = cfgService .getConfig(this.appId, SegmentRoutingAppConfig.class); return segmentRoutingAppConfig != null && segmentRoutingAppConfig.mplsEcmp(); } /** * Returns the tunnel object with the tunnel ID. * * @param tunnelId Tunnel ID * @return Tunnel reference */ public Tunnel getTunnel(String tunnelId) { return tunnelHandler.getTunnel(tunnelId); } @Override public VlanId getInternalVlanId(ConnectPoint connectPoint) { VlanId untaggedVlanId = interfaceService.getUntaggedVlanId(connectPoint); VlanId nativeVlanId = interfaceService.getNativeVlanId(connectPoint); return untaggedVlanId != null ? untaggedVlanId : nativeVlanId; } @Override public Optional<DeviceId> getPairDeviceId(DeviceId deviceId) { SegmentRoutingDeviceConfig deviceConfig = cfgService.getConfig(deviceId, SegmentRoutingDeviceConfig.class); return Optional.ofNullable(deviceConfig).map(SegmentRoutingDeviceConfig::pairDeviceId); } @Override public Optional<PortNumber> getPairLocalPort(DeviceId deviceId) { SegmentRoutingDeviceConfig deviceConfig = cfgService.getConfig(deviceId, SegmentRoutingDeviceConfig.class); return Optional.ofNullable(deviceConfig).map(SegmentRoutingDeviceConfig::pairLocalPort); } @Override public Set<PortNumber> getInfraPorts(DeviceId deviceId) { return deviceService.getPorts(deviceId).stream() .map(port -> new ConnectPoint(port.element().id(), port.number())) .filter(cp -> interfaceService.getInterfacesByPort(cp).isEmpty()) .map(ConnectPoint::port) .collect(Collectors.toSet()); } @Override public Set<PortNumber> getEdgePorts(DeviceId deviceId) { return deviceService.getPorts(deviceId).stream() .map(port -> new ConnectPoint(port.element().id(), port.number())) .filter(cp -> !interfaceService.getInterfacesByPort(cp).isEmpty() && !cp.port().equals(getPairLocalPort(deviceId).orElse(null))) .map(ConnectPoint::port) .collect(Collectors.toSet()); } /** * Returns locations of given resolved route. * * @param resolvedRoute resolved route * @return locations of nexthop. Might be empty if next hop is not found */ public Set<ConnectPoint> nextHopLocations(ResolvedRoute resolvedRoute) { HostId hostId = HostId.hostId(resolvedRoute.nextHopMac(), resolvedRoute.nextHopVlan()); return Optional.ofNullable(hostService.getHost(hostId)) .map(Host::locations).orElse(Sets.newHashSet()) .stream().map(l -> (ConnectPoint) l).collect(Collectors.toSet()); } /** * Returns vlan port map of given device. * * @param deviceId device id * @return vlan-port multimap */ public Multimap<VlanId, PortNumber> getVlanPortMap(DeviceId deviceId) { HashMultimap<VlanId, PortNumber> vlanPortMap = HashMultimap.create(); interfaceService.getInterfaces().stream() .filter(intf -> intf.connectPoint().deviceId().equals(deviceId)) .forEach(intf -> { vlanPortMap.put(intf.vlanUntagged(), intf.connectPoint().port()); intf.vlanTagged().forEach(vlanTagged -> vlanPortMap.put(vlanTagged, intf.connectPoint().port()) ); vlanPortMap.put(intf.vlanNative(), intf.connectPoint().port()); }); vlanPortMap.removeAll(VlanId.NONE); return vlanPortMap; } /** * Returns the next objective ID for the given vlan id. It is expected * that the next-objective has been pre-created from configuration. * * @param deviceId Device ID * @param vlanId VLAN ID * @return next objective ID or -1 if it was not found */ int getVlanNextObjectiveId(DeviceId deviceId, VlanId vlanId) { if (groupHandlerMap.get(deviceId) != null) { log.trace("getVlanNextObjectiveId query in device {}", deviceId); return groupHandlerMap.get(deviceId).getVlanNextObjectiveId(vlanId); } else { log.warn("getVlanNextObjectiveId query - groupHandler for " + "device {} not found", deviceId); return -1; } } /** * Returns the next objective ID for the given portNumber, given the treatment. * There could be multiple different treatments to the same outport, which * would result in different objectives. If the next object does not exist, * and should be created, a new one is created and its id is returned. * * @param deviceId Device ID * @param portNum port number on device for which NextObjective is queried * @param treatment the actions to apply on the packets (should include outport) * @param meta metadata passed into the creation of a Next Objective if necessary * @param createIfMissing true if a next object should be created if not found * @return next objective ID or -1 if an error occurred during retrieval or creation */ public int getPortNextObjectiveId(DeviceId deviceId, PortNumber portNum, TrafficTreatment treatment, TrafficSelector meta, boolean createIfMissing) { DefaultGroupHandler ghdlr = groupHandlerMap.get(deviceId); if (ghdlr != null) { return ghdlr.getPortNextObjectiveId(portNum, treatment, meta, createIfMissing); } else { log.warn("getPortNextObjectiveId query - groupHandler for device {}" + " not found", deviceId); return -1; } } /** * Returns the next Objective ID for the given mac and vlan, given the treatment. * There could be multiple different treatments to the same outport, which * would result in different objectives. If the next object does not exist, * and should be created, a new one is created and its id is returned. * * @param deviceId Device ID * @param macAddr mac of host for which Next ID is required. * @param vlanId vlan of host for which Next ID is required. * @param port port with which to create the Next Obj. * @param createIfMissing true if a next object should be created if not found * @return next objective ID or -1 if an error occurred during retrieval or creation */ public int getMacVlanNextObjectiveId(DeviceId deviceId, MacAddress macAddr, VlanId vlanId, PortNumber port, boolean createIfMissing) { DefaultGroupHandler ghdlr = groupHandlerMap.get(deviceId); if (ghdlr != null) { return ghdlr.getMacVlanNextObjectiveId(macAddr, vlanId, port, createIfMissing); } else { log.warn("getMacVlanNextObjectiveId query - groupHandler for device {}" + " not found", deviceId); return -1; } } /** * Updates the next objective for the given nextId . * * @param deviceId Device ID * @param hostMac mac of host for which Next obj is to be updated. * @param hostVlanId vlan of host for which Next obj is to be updated. * @param port port with which to update the Next Obj. * @param nextId of Next Obj which needs to be updated. */ public void updateMacVlanTreatment(DeviceId deviceId, MacAddress hostMac, VlanId hostVlanId, PortNumber port, int nextId) { // Check if we are the king of this device // just one instance should perform this update if (!defaultRoutingHandler.shouldProgram(deviceId)) { log.debug("This instance is not handling the routing towards the " + "device {}", deviceId); return; } // Get the handler and perform the update DefaultGroupHandler ghdlr = groupHandlerMap.get(deviceId); if (ghdlr != null) { ghdlr.updateL3UcastGroupBucket(hostMac, hostVlanId, port, nextId); } else { log.warn("updateL3UcastGroupBucket query - groupHandler for device {}" + " not found", deviceId); } } /** * Returns the group handler object for the specified device id. * * @param devId the device identifier * @return the groupHandler object for the device id, or null if not found */ DefaultGroupHandler getGroupHandler(DeviceId devId) { return groupHandlerMap.get(devId); } /** * Returns the default routing handler object. * * @return the default routing handler object */ public DefaultRoutingHandler getRoutingHandler() { return defaultRoutingHandler; } private class InternalPacketProcessor implements PacketProcessor { @Override public void process(PacketContext context) { packetExecutor.execute(() -> processPacketInternal(context)); } private void processPacketInternal(PacketContext context) { if (context.isHandled()) { return; } InboundPacket pkt = context.inPacket(); Ethernet ethernet = pkt.parsed(); if (ethernet == null) { return; } log.trace("Rcvd pktin from {}: {}", context.inPacket().receivedFrom(), ethernet); if (ethernet.getEtherType() == TYPE_ARP) { log.warn("Received unexpected ARP packet on {}", context.inPacket().receivedFrom()); log.trace("{}", ethernet); return; } else if (ethernet.getEtherType() == Ethernet.TYPE_IPV4) { IPv4 ipv4Packet = (IPv4) ethernet.getPayload(); //ipHandler.addToPacketBuffer(ipv4Packet); if (ipv4Packet.getProtocol() == IPv4.PROTOCOL_ICMP) { icmpHandler.processIcmp(ethernet, pkt.receivedFrom()); } else { // NOTE: We don't support IP learning at this moment so this // is not necessary. Also it causes duplication of DHCP packets. // ipHandler.processPacketIn(ipv4Packet, pkt.receivedFrom()); } } else if (ethernet.getEtherType() == Ethernet.TYPE_IPV6) { IPv6 ipv6Packet = (IPv6) ethernet.getPayload(); //ipHandler.addToPacketBuffer(ipv6Packet); // We deal with the packet only if the packet is a ICMP6 ECHO/REPLY if (ipv6Packet.getNextHeader() == IPv6.PROTOCOL_ICMP6) { ICMP6 icmp6Packet = (ICMP6) ipv6Packet.getPayload(); if (icmp6Packet.getIcmpType() == ICMP6.ECHO_REQUEST || icmp6Packet.getIcmpType() == ICMP6.ECHO_REPLY) { icmpHandler.processIcmpv6(ethernet, pkt.receivedFrom()); } else { log.trace("Received ICMPv6 0x{} - not handled", Integer.toHexString(icmp6Packet.getIcmpType() & 0xff)); } } else { // NOTE: We don't support IP learning at this moment so this // is not necessary. Also it causes duplication of DHCPv6 packets. // ipHandler.processPacketIn(ipv6Packet, pkt.receivedFrom()); } } } } private class InternalEventHandler implements Runnable { private Event event; InternalEventHandler(Event event) { this.event = event; } @Override public void run() { try { // TODO We should also change SR routing and PW to listen to TopologyEvents if (event.type() == LinkEvent.Type.LINK_ADDED || event.type() == LinkEvent.Type.LINK_UPDATED) { linkHandler.processLinkAdded((Link) event.subject()); } else if (event.type() == LinkEvent.Type.LINK_REMOVED) { linkHandler.processLinkRemoved((Link) event.subject()); } else if (event.type() == DeviceEvent.Type.DEVICE_ADDED || event.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || event.type() == DeviceEvent.Type.DEVICE_UPDATED) { DeviceId deviceId = ((Device) event.subject()).id(); if (deviceService.isAvailable(deviceId)) { log.info("** DEVICE UP Processing device event {} " + "for available device {}", event.type(), ((Device) event.subject()).id()); processDeviceAdded((Device) event.subject()); } else { if (event.type() == DeviceEvent.Type.DEVICE_ADDED) { // Note: For p4 devices, the device will be added but unavailable at the beginning. // The device will later on being marked as available once the pipeline is pushed // to the device. log.info("** DEVICE ADDED but unavailable. Ignore"); return; } log.info(" ** DEVICE DOWN Processing device event {}" + " for unavailable device {}", event.type(), ((Device) event.subject()).id()); processDeviceRemoved((Device) event.subject()); } } else if (event.type() == DeviceEvent.Type.PORT_ADDED) { // typically these calls come when device is added first time // so port filtering rules are handled at the device_added event. // port added calls represent all ports on the device, // enabled or not. log.trace("** PORT ADDED {}/{} -> {}", ((DeviceEvent) event).subject().id(), ((DeviceEvent) event).port().number(), event.type()); } else if (event.type() == DeviceEvent.Type.PORT_UPDATED) { // these calls happen for every subsequent event // ports enabled, disabled, switch goes away, comes back log.info("** PORT UPDATED {}/{} -> {}", event.subject(), ((DeviceEvent) event).port(), event.type()); processPortUpdatedInternal(((Device) event.subject()), ((DeviceEvent) event).port()); mcastHandler.processPortUpdate(((Device) event.subject()), ((DeviceEvent) event).port()); } else if (event.type() == TopologyEvent.Type.TOPOLOGY_CHANGED) { // Process topology event, needed for all modules relying on // topology service for path computation TopologyEvent topologyEvent = (TopologyEvent) event; log.info("Processing topology event {}, topology age {}, reasons {}", event.type(), topologyEvent.subject().time(), topologyEvent.reasons().size()); topologyHandler.processTopologyChange(topologyEvent.reasons()); } else if (event.type() == HostEvent.Type.HOST_ADDED) { hostHandler.processHostAddedEvent((HostEvent) event); } else if (event.type() == HostEvent.Type.HOST_MOVED) { hostHandler.processHostMovedEvent((HostEvent) event); routeHandler.processHostMovedEvent((HostEvent) event); } else if (event.type() == HostEvent.Type.HOST_AUX_MOVED) { hostHandler.processHostMovedEvent((HostEvent) event); // TODO RouteHandler also needs to process this event in order to // support nexthops that has auxLocations } else if (event.type() == HostEvent.Type.HOST_REMOVED) { hostHandler.processHostRemovedEvent((HostEvent) event); } else if (event.type() == HostEvent.Type.HOST_UPDATED) { hostHandler.processHostUpdatedEvent((HostEvent) event); } else if (event.type() == RouteEvent.Type.ROUTE_ADDED) { routeHandler.processRouteAdded((RouteEvent) event); } else if (event.type() == RouteEvent.Type.ROUTE_UPDATED) { routeHandler.processRouteUpdated((RouteEvent) event); } else if (event.type() == RouteEvent.Type.ROUTE_REMOVED) { routeHandler.processRouteRemoved((RouteEvent) event); } else if (event.type() == RouteEvent.Type.ALTERNATIVE_ROUTES_CHANGED) { routeHandler.processAlternativeRoutesChanged((RouteEvent) event); } else if (event.type() == McastEvent.Type.SOURCES_ADDED || event.type() == McastEvent.Type.SOURCES_REMOVED || event.type() == McastEvent.Type.SINKS_ADDED || event.type() == McastEvent.Type.SINKS_REMOVED || event.type() == McastEvent.Type.ROUTE_ADDED || event.type() == McastEvent.Type.ROUTE_REMOVED) { mcastHandler.processMcastEvent((McastEvent) event); } else if (event.type() == NetworkConfigEvent.Type.CONFIG_ADDED) { NetworkConfigEvent netcfgEvent = (NetworkConfigEvent) event; Class configClass = netcfgEvent.configClass(); if (configClass.equals(SegmentRoutingAppConfig.class)) { appCfgHandler.processAppConfigAdded(netcfgEvent); log.info("App config event .. configuring network"); cfgListener.configureNetwork(); } else if (configClass.equals(SegmentRoutingDeviceConfig.class)) { log.info("Segment Routing Device Config added for {}", event.subject()); cfgListener.configureNetwork(); } else if (configClass.equals(InterfaceConfig.class)) { log.info("Interface Config added for {}", event.subject()); cfgListener.configureNetwork(); } else { log.error("Unhandled config class: {}", configClass); } } else if (event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED) { NetworkConfigEvent netcfgEvent = (NetworkConfigEvent) event; Class configClass = netcfgEvent.configClass(); if (configClass.equals(SegmentRoutingAppConfig.class)) { appCfgHandler.processAppConfigUpdated(netcfgEvent); log.info("App config event .. configuring network"); cfgListener.configureNetwork(); } else if (configClass.equals(SegmentRoutingDeviceConfig.class)) { log.info("Segment Routing Device Config updated for {}", event.subject()); createOrUpdateDeviceConfiguration(); } else if (configClass.equals(InterfaceConfig.class)) { log.info("Interface Config updated for {}", event.subject()); createOrUpdateDeviceConfiguration(); updateInterface((InterfaceConfig) netcfgEvent.config().get(), (InterfaceConfig) netcfgEvent.prevConfig().get()); } else { log.error("Unhandled config class: {}", configClass); } } else if (event.type() == NetworkConfigEvent.Type.CONFIG_REMOVED) { NetworkConfigEvent netcfgEvent = (NetworkConfigEvent) event; Class configClass = netcfgEvent.configClass(); if (configClass.equals(SegmentRoutingAppConfig.class)) { appCfgHandler.processAppConfigRemoved(netcfgEvent); log.info("App config event .. configuring network"); cfgListener.configureNetwork(); } else if (configClass.equals(SegmentRoutingDeviceConfig.class)) { // TODO Handle sr device config removal log.info("SegmentRoutingDeviceConfig removal is not handled in current implementation"); } else if (configClass.equals(InterfaceConfig.class)) { // TODO Handle interface removal log.info("InterfaceConfig removal is not handled in current implementation"); } else { log.error("Unhandled config class: {}", configClass); } } else if (event.type() == MastershipEvent.Type.MASTER_CHANGED) { MastershipEvent me = (MastershipEvent) event; DeviceId deviceId = me.subject(); Optional<DeviceId> pairDeviceId = getPairDeviceId(deviceId); log.info(" ** MASTERSHIP CHANGED Invalidating shouldProgram cache" + " for {}/pair={} due to change", deviceId, pairDeviceId); defaultRoutingHandler.invalidateShouldProgramCache(deviceId); pairDeviceId.ifPresent(defaultRoutingHandler::invalidateShouldProgramCache); defaultRoutingHandler.checkFullRerouteForMasterChange(deviceId, me); } else { log.warn("Unhandled event type: {}", event.type()); } } catch (Exception e) { log.error("SegmentRouting event handler thread thrown an exception: {}", e.getMessage(), e); } } } void processDeviceAdded(Device device) { log.info("** DEVICE ADDED with ID {}", device.id()); // NOTE: Punt ARP/NDP even when the device is not configured. // Host learning without network config is required for CORD config generator. routingRulePopulator.populateIpPunts(device.id()); routingRulePopulator.populateArpNdpPunts(device.id()); if (deviceConfiguration == null || !deviceConfiguration.isConfigured(device.id())) { log.warn("Device configuration unavailable. Device {} will be " + "processed after configuration.", device.id()); return; } processDeviceAddedInternal(device.id()); } private void processDeviceAddedInternal(DeviceId deviceId) { // Irrespective of whether the local is a MASTER or not for this device, // we need to create a SR-group-handler instance. This is because in a // multi-instance setup, any instance can initiate forwarding/next-objectives // for any switch (even if this instance is a SLAVE or not even connected // to the switch). To handle this, a default-group-handler instance is necessary // per switch. log.debug("Current groupHandlerMap devs: {}", groupHandlerMap.keySet()); if (groupHandlerMap.get(deviceId) == null) { DefaultGroupHandler groupHandler; try { groupHandler = DefaultGroupHandler. createGroupHandler(deviceId, appId, deviceConfiguration, linkService, flowObjectiveService, this); } catch (DeviceConfigNotFoundException e) { log.warn(e.getMessage() + " Aborting processDeviceAdded."); return; } log.debug("updating groupHandlerMap with new grpHdlr for device: {}", deviceId); groupHandlerMap.put(deviceId, groupHandler); } if (mastershipService.isLocalMaster(deviceId)) { defaultRoutingHandler.populatePortAddressingRules(deviceId); defaultRoutingHandler.purgeSeenBeforeRoutes(deviceId); DefaultGroupHandler groupHandler = groupHandlerMap.get(deviceId); groupHandler.createGroupsFromVlanConfig(); routingRulePopulator.populateSubnetBroadcastRule(deviceId); phasedRecoveryService.init(deviceId); } appCfgHandler.init(deviceId); } private void processDeviceRemoved(Device device) { dsNextObjStore.entrySet().stream() .filter(entry -> entry.getKey().deviceId().equals(device.id())) .forEach(entry -> dsNextObjStore.remove(entry.getKey())); vlanNextObjStore.entrySet().stream() .filter(entry -> entry.getKey().deviceId().equals(device.id())) .forEach(entry -> vlanNextObjStore.remove(entry.getKey())); macVlanNextObjStore.entrySet().stream() .filter(entry -> entry.getKey().deviceId().equals(device.id())) .forEach(entry -> macVlanNextObjStore.remove(entry.getKey())); portNextObjStore.entrySet().stream() .filter(entry -> entry.getKey().deviceId().equals(device.id())) .forEach(entry -> portNextObjStore.remove(entry.getKey())); linkHandler.processDeviceRemoved(device); DefaultGroupHandler gh = groupHandlerMap.remove(device.id()); if (gh != null) { gh.shutdown(); } // Note that a switch going down is associated with all of its links // going down as well, but it is treated as a single switch down event // while the link-downs are ignored. We cannot rely on the ordering of // events - i.e we cannot expect all link-downs to come before the // switch down - so we purge all seen-links for the switch before // handling route-path changes for the switch-down defaultRoutingHandler .populateRoutingRulesForLinkStatusChange(null, null, device.id(), true); defaultRoutingHandler.purgeEcmpGraph(device.id()); // Cleanup all internal groupHandler stores for this device. Should be // done after all rerouting or rehashing has been completed groupHandlerMap.entrySet() .forEach(entry -> entry.getValue().cleanUpForNeighborDown(device.id())); phasedRecoveryService.reset(device.id()); } /** * Purge the destinationSet nextObjective store of entries with this device * as key. Erases app-level knowledge of hashed groups in this device. * * @param devId the device identifier */ void purgeHashedNextObjectiveStore(DeviceId devId) { log.debug("Purging hashed next-obj store for dev:{}", devId); dsNextObjStore.entrySet().stream() .filter(entry -> entry.getKey().deviceId().equals(devId)) .forEach(entry -> dsNextObjStore.remove(entry.getKey())); } private void processPortUpdatedInternal(Device device, Port port) { if (deviceConfiguration == null || !deviceConfiguration.isConfigured(device.id())) { log.warn("Device configuration uploading. Not handling port event for" + "dev: {} port: {}", device.id(), port.number()); return; } if (interfaceService.isConfigured(new ConnectPoint(device.id(), port.number()))) { lastEdgePortEvent = Instant.now(); } if (!mastershipService.isLocalMaster(device.id())) { log.debug("Not master for dev:{} .. not handling port updated event" + "for port {}", device.id(), port.number()); return; } processPortUpdated(device.id(), port); } /** * Adds or remove filtering rules for the given switchport. If switchport is * an edge facing port, additionally handles host probing and broadcast * rules. Must be called by local master of device. * * @param deviceId the device identifier * @param port the port to update */ void processPortUpdated(DeviceId deviceId, Port port) { // first we handle filtering rules associated with the port if (port.isEnabled()) { log.info("Switchport {}/{} enabled..programming filters", deviceId, port.number()); routingRulePopulator.processSinglePortFilters(deviceId, port.number(), true); } else { log.info("Switchport {}/{} disabled..removing filters", deviceId, port.number()); routingRulePopulator.processSinglePortFilters(deviceId, port.number(), false); } // portUpdated calls are for ports that have gone down or up. For switch // to switch ports, link-events should take care of any re-routing or // group editing necessary for port up/down. Here we only process edge ports // that are already configured. ConnectPoint cp = new ConnectPoint(deviceId, port.number()); VlanId untaggedVlan = interfaceService.getUntaggedVlanId(cp); VlanId nativeVlan = interfaceService.getNativeVlanId(cp); Set<VlanId> taggedVlans = interfaceService.getTaggedVlanId(cp); if (untaggedVlan == null && nativeVlan == null && taggedVlans.isEmpty()) { log.debug("Not handling port updated event for non-edge port (unconfigured) " + "dev/port: {}/{}", deviceId, port.number()); return; } if (untaggedVlan != null) { processEdgePort(deviceId, port, untaggedVlan, true); } if (nativeVlan != null) { processEdgePort(deviceId, port, nativeVlan, true); } if (!taggedVlans.isEmpty()) { taggedVlans.forEach(tag -> processEdgePort(deviceId, port, tag, false)); } } private void processEdgePort(DeviceId deviceId, Port port, VlanId vlanId, boolean popVlan) { boolean portUp = port.isEnabled(); if (portUp) { log.info("Device:EdgePort {}:{} is enabled in vlan: {}", deviceId, port.number(), vlanId); hostEventExecutor.execute(() -> hostHandler.processPortUp(new ConnectPoint(deviceId, port.number()))); } else { log.info("Device:EdgePort {}:{} is disabled in vlan: {}", deviceId, port.number(), vlanId); } DefaultGroupHandler groupHandler = groupHandlerMap.get(deviceId); if (groupHandler != null) { groupHandler.processEdgePort(port.number(), vlanId, popVlan, portUp); } else { log.warn("Group handler not found for dev:{}. Not handling edge port" + " {} event for port:{}", deviceId, (portUp) ? "UP" : "DOWN", port.number()); } } private void createOrUpdateDeviceConfiguration() { if (deviceConfiguration == null) { log.info("Creating new DeviceConfiguration"); deviceConfiguration = new DeviceConfiguration(this); } else { log.info("Updating DeviceConfiguration"); deviceConfiguration.updateConfig(); } } private void createOrUpdateDefaultRoutingHandler() { if (defaultRoutingHandler == null) { log.info("Creating new DefaultRoutingHandler"); defaultRoutingHandler = new DefaultRoutingHandler(this); } else { log.info("Updating DefaultRoutingHandler"); defaultRoutingHandler.update(this); } } /** * Registers the given connect point with the NRS, this is necessary * to receive the NDP and ARP packets from the NRS. * * @param portToRegister connect point to register */ public void registerConnectPoint(ConnectPoint portToRegister) { neighbourResolutionService.registerNeighbourHandler( portToRegister, neighbourHandler, appId ); } private class InternalConfigListener implements NetworkConfigListener { private static final long PROGRAM_DELAY = 2; SegmentRoutingManager srManager; /** * Constructs the internal network config listener. * * @param srManager segment routing manager */ InternalConfigListener(SegmentRoutingManager srManager) { this.srManager = srManager; } /** * Reads network config and initializes related data structure accordingly. */ void configureNetwork() { log.info("Configuring network ..."); // Setting handling of network configuration events completable future // The completable future is needed because of the async behaviour of the configureNetwork, // listener registration and event arrival // Enables us to buffer the events and execute them when the configure network is done. synchronized (networkConfigCompletionLock) { networkConfigCompletion = new CompletableFuture<>(); // add a small delay to absorb multiple network config added notifications if (!programmingScheduled.get()) { log.info("Buffering config calls for {} secs", PROGRAM_DELAY); programmingScheduled.set(true); mainEventExecutor.schedule(new ConfigChange(), PROGRAM_DELAY, TimeUnit.SECONDS); } createOrUpdateDeviceConfiguration(); arpHandler = new ArpHandler(srManager); icmpHandler = new IcmpHandler(srManager); ipHandler = new IpHandler(srManager); routingRulePopulator = new RoutingRulePopulator(srManager); createOrUpdateDefaultRoutingHandler(); tunnelHandler = new TunnelHandler(linkService, deviceConfiguration, groupHandlerMap, tunnelStore); policyHandler = new PolicyHandler(appId, deviceConfiguration, flowObjectiveService, tunnelHandler, policyStore); networkConfigCompletion.complete(true); } mcastHandler.init(); } @Override public void event(NetworkConfigEvent event) { if (mainEventExecutor == null) { return; } checkState(appCfgHandler != null, "NetworkConfigEventHandler is not initialized"); switch (event.type()) { case CONFIG_ADDED: case CONFIG_UPDATED: case CONFIG_REMOVED: log.trace("Schedule Network Config event {}", event); if (networkConfigCompletion == null || networkConfigCompletion.isDone()) { mainEventExecutor.execute(new InternalEventHandler(event)); } else { queuedEvents.add(event); } break; default: break; } } @Override public boolean isRelevant(NetworkConfigEvent event) { if (event.type() == CONFIG_REGISTERED || event.type() == CONFIG_UNREGISTERED) { log.debug("Ignore event {} due to type mismatch", event); return false; } if (!event.configClass().equals(SegmentRoutingDeviceConfig.class) && !event.configClass().equals(SegmentRoutingAppConfig.class) && !event.configClass().equals(InterfaceConfig.class)) { log.debug("Ignore event {} due to class mismatch", event); return false; } return true; } private final class ConfigChange implements Runnable { @Override public void run() { programmingScheduled.set(false); log.info("Reacting to config changes after buffer delay"); for (Device device : deviceService.getDevices()) { processDeviceAdded(device); } defaultRoutingHandler.startPopulationProcess(); } } } private class InternalLinkListener implements LinkListener { @Override public void event(LinkEvent event) { if (mainEventExecutor == null) { return; } if (event.type() == LinkEvent.Type.LINK_ADDED || event.type() == LinkEvent.Type.LINK_UPDATED || event.type() == LinkEvent.Type.LINK_REMOVED) { log.trace("Schedule Link event {}", event); if (networkConfigCompletion == null || networkConfigCompletion.isDone()) { mainEventExecutor.execute(new InternalEventHandler(event)); } else { queuedEvents.add(event); } } } } private class InternalDeviceListener implements DeviceListener { @Override public void event(DeviceEvent event) { if (mainEventExecutor == null) { return; } switch (event.type()) { case DEVICE_ADDED: case PORT_UPDATED: case PORT_ADDED: case DEVICE_UPDATED: case DEVICE_AVAILABILITY_CHANGED: log.trace("Schedule Device event {}", event); if (networkConfigCompletion == null || networkConfigCompletion.isDone()) { mainEventExecutor.execute(new InternalEventHandler(event)); } else { queuedEvents.add(event); } break; default: } } } private class InternalTopologyListener implements TopologyListener { @Override public void event(TopologyEvent event) { if (mainEventExecutor == null) { return; } switch (event.type()) { case TOPOLOGY_CHANGED: log.trace("Schedule Topology event {}", event); if (networkConfigCompletion == null || networkConfigCompletion.isDone()) { mainEventExecutor.execute(new InternalEventHandler(event)); } else { queuedEvents.add(event); } break; default: } } } private class InternalHostListener implements HostListener { @Override public void event(HostEvent event) { if (hostEventExecutor == null) { return; } switch (event.type()) { case HOST_ADDED: case HOST_MOVED: case HOST_REMOVED: case HOST_UPDATED: log.trace("Schedule Host event {}", event); hostEventExecutor.execute(new InternalEventHandler(event)); break; default: log.warn("Unsupported host event type: {}", event.type()); break; } } } private class InternalMcastListener implements McastListener { @Override public void event(McastEvent event) { if (mcastEventExecutor == null) { return; } switch (event.type()) { case SOURCES_ADDED: case SOURCES_REMOVED: case SINKS_ADDED: case SINKS_REMOVED: case ROUTE_REMOVED: case ROUTE_ADDED: log.trace("Schedule Mcast event {}", event); mcastEventExecutor.execute(new InternalEventHandler(event)); break; default: log.warn("Unsupported mcast event type: {}", event.type()); break; } } } private class InternalRouteEventListener implements RouteListener { @Override public void event(RouteEvent event) { if (routeEventExecutor == null) { return; } switch (event.type()) { case ROUTE_ADDED: case ROUTE_UPDATED: case ROUTE_REMOVED: case ALTERNATIVE_ROUTES_CHANGED: log.trace("Schedule Route event {}", event); routeEventExecutor.execute(new InternalEventHandler(event)); break; default: log.warn("Unsupported route event type: {}", event.type()); break; } } } private class InternalMastershipListener implements MastershipListener { @Override public void event(MastershipEvent event) { if (mainEventExecutor == null) { return; } switch (event.type()) { case MASTER_CHANGED: log.debug("Mastership event: {}/{}", event.subject(), event.roleInfo()); mainEventExecutor.execute(new InternalEventHandler(event)); break; case BACKUPS_CHANGED: case SUSPENDED: default: log.debug("Mastership event type {} not handled", event.type()); break; } } } class InternalClusterListener implements ClusterEventListener { private Instant lastClusterEvent = Instant.EPOCH; long timeSinceLastClusterEvent() { return Instant.now().toEpochMilli() - lastClusterEvent.toEpochMilli(); } @Override public void event(ClusterEvent event) { switch (event.type()) { case INSTANCE_ACTIVATED: case INSTANCE_ADDED: case INSTANCE_READY: log.debug("Cluster event {} ignored", event.type()); break; case INSTANCE_DEACTIVATED: case INSTANCE_REMOVED: log.info("** Cluster event {}", event.type()); lastClusterEvent = Instant.now(); break; default: break; } } } private void updateInterface(InterfaceConfig conf, InterfaceConfig prevConf) { try { Set<Interface> intfs = conf.getInterfaces(); Set<Interface> prevIntfs = prevConf.getInterfaces(); // Now we only handle one interface config at each port. if (intfs.size() != 1 || prevIntfs.size() != 1) { log.warn("Interface update aborted - one at a time is allowed, " + "but {} / {}(prev) received.", intfs.size(), prevIntfs.size()); return; } //The system is in an incoherent state, abort if (defaultRoutingHandler == null) { log.warn("Interface update aborted, defaultRoutingHandler is null"); return; } Interface intf = intfs.stream().findFirst().get(); Interface prevIntf = prevIntfs.stream().findFirst().get(); DeviceId deviceId = intf.connectPoint().deviceId(); PortNumber portNum = intf.connectPoint().port(); removeSubnetConfig(prevIntf.connectPoint(), Sets.difference(new HashSet<>(prevIntf.ipAddressesList()), new HashSet<>(intf.ipAddressesList()))); if (!prevIntf.vlanNative().equals(VlanId.NONE) && !prevIntf.vlanNative().equals(intf.vlanUntagged()) && !prevIntf.vlanNative().equals(intf.vlanNative())) { if (intf.vlanTagged().contains(prevIntf.vlanNative())) { // Update filtering objective and L2IG group bucket updatePortVlanTreatment(deviceId, portNum, prevIntf.vlanNative(), false); } else { // RemoveVlanNative updateVlanConfigInternal(deviceId, portNum, prevIntf.vlanNative(), true, false); } } if (!prevIntf.vlanUntagged().equals(VlanId.NONE) && !prevIntf.vlanUntagged().equals(intf.vlanUntagged()) && !prevIntf.vlanUntagged().equals(intf.vlanNative())) { if (intf.vlanTagged().contains(prevIntf.vlanUntagged())) { // Update filtering objective and L2IG group bucket updatePortVlanTreatment(deviceId, portNum, prevIntf.vlanUntagged(), false); } else { // RemoveVlanUntagged updateVlanConfigInternal(deviceId, portNum, prevIntf.vlanUntagged(), true, false); } } if (!prevIntf.vlanTagged().isEmpty() && !intf.vlanTagged().equals(prevIntf.vlanTagged())) { // RemoveVlanTagged Sets.difference(prevIntf.vlanTagged(), intf.vlanTagged()).stream() .filter(i -> !intf.vlanUntagged().equals(i)) .filter(i -> !intf.vlanNative().equals(i)) .forEach(vlanId -> updateVlanConfigInternal( deviceId, portNum, vlanId, false, false)); } if (!intf.vlanNative().equals(VlanId.NONE) && !prevIntf.vlanNative().equals(intf.vlanNative()) && !prevIntf.vlanUntagged().equals(intf.vlanNative())) { if (prevIntf.vlanTagged().contains(intf.vlanNative())) { // Update filtering objective and L2IG group bucket updatePortVlanTreatment(deviceId, portNum, intf.vlanNative(), true); } else { // AddVlanNative updateVlanConfigInternal(deviceId, portNum, intf.vlanNative(), true, true); } } if (!intf.vlanTagged().isEmpty() && !intf.vlanTagged().equals(prevIntf.vlanTagged())) { // AddVlanTagged Sets.difference(intf.vlanTagged(), prevIntf.vlanTagged()).stream() .filter(i -> !prevIntf.vlanUntagged().equals(i)) .filter(i -> !prevIntf.vlanNative().equals(i)) .forEach(vlanId -> updateVlanConfigInternal( deviceId, portNum, vlanId, false, true) ); } if (!intf.vlanUntagged().equals(VlanId.NONE) && !prevIntf.vlanUntagged().equals(intf.vlanUntagged()) && !prevIntf.vlanNative().equals(intf.vlanUntagged())) { if (prevIntf.vlanTagged().contains(intf.vlanUntagged())) { // Update filtering objective and L2IG group bucket updatePortVlanTreatment(deviceId, portNum, intf.vlanUntagged(), true); } else { // AddVlanUntagged updateVlanConfigInternal(deviceId, portNum, intf.vlanUntagged(), true, true); } } addSubnetConfig(prevIntf.connectPoint(), Sets.difference(new HashSet<>(intf.ipAddressesList()), new HashSet<>(prevIntf.ipAddressesList()))); } catch (ConfigException e) { log.error("Error in configuration"); } } private void updatePortVlanTreatment(DeviceId deviceId, PortNumber portNum, VlanId vlanId, boolean pushVlan) { DefaultGroupHandler grpHandler = getGroupHandler(deviceId); if (grpHandler == null) { log.warn("Failed to retrieve group handler for device {}", deviceId); return; } // Update filtering objective for a single port routingRulePopulator.updateSinglePortFilters(deviceId, portNum, !pushVlan, vlanId, false); routingRulePopulator.updateSinglePortFilters(deviceId, portNum, pushVlan, vlanId, true); if (getVlanNextObjectiveId(deviceId, vlanId) != -1) { // Update L2IG bucket of the port grpHandler.updateL2InterfaceGroupBucket(portNum, vlanId, pushVlan); // Update bridging and unicast routing rule for each host hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, !pushVlan, false)); hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, pushVlan, true)); } else { log.warn("Failed to retrieve next objective for vlan {} in device {}:{}", vlanId, deviceId, portNum); } } private void updateVlanConfigInternal(DeviceId deviceId, PortNumber portNum, VlanId vlanId, boolean pushVlan, boolean install) { DefaultGroupHandler grpHandler = getGroupHandler(deviceId); if (grpHandler == null) { log.warn("Failed to retrieve group handler for device {}", deviceId); return; } // Update filtering objective for a single port routingRulePopulator.updateSinglePortFilters(deviceId, portNum, pushVlan, vlanId, install); // Update filtering objective for multicast ingress port mcastHandler.updateFilterToDevice(deviceId, portNum, vlanId, install); int nextId = getVlanNextObjectiveId(deviceId, vlanId); if (nextId != -1 && !install) { // Remove L2 Bridging rule and L3 Unicast rule to the host hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, pushVlan, install)); // Remove broadcast forwarding rule and corresponding L2FG for VLAN // only if there is no port configured on that VLAN ID if (!getVlanPortMap(deviceId).containsKey(vlanId)) { // Remove broadcast forwarding rule for the VLAN routingRulePopulator.updateSubnetBroadcastRule(deviceId, vlanId, install); // Remove L2FG for VLAN grpHandler.removeBcastGroupFromVlan(deviceId, portNum, vlanId, pushVlan); } else { // Remove a single port from L2FG grpHandler.updateGroupFromVlanConfiguration(vlanId, portNum, nextId, install); } // Remove L2IG of the port grpHandler.removePortNextObjective(deviceId, portNum, vlanId, pushVlan); } else if (install) { // Create L2IG of the port grpHandler.createPortNextObjective(deviceId, portNum, vlanId, pushVlan); // Create L2 Bridging rule and L3 Unicast rule to the host hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, pushVlan, install)); if (nextId != -1) { // Add a single port to L2FG grpHandler.updateGroupFromVlanConfiguration(vlanId, portNum, nextId, install); } else { // Create L2FG for VLAN grpHandler.createBcastGroupFromVlan(vlanId, Collections.singleton(portNum)); routingRulePopulator.updateSubnetBroadcastRule(deviceId, vlanId, install); } } else { log.warn("Failed to retrieve next objective for vlan {} in device {}:{}", vlanId, deviceId, portNum); } } private void removeSubnetConfig(ConnectPoint cp, Set<InterfaceIpAddress> ipAddressSet) { Set<IpPrefix> ipPrefixSet = ipAddressSet.stream(). map(InterfaceIpAddress::subnetAddress).collect(Collectors.toSet()); Set<InterfaceIpAddress> deviceIntfIpAddrs = interfaceService.getInterfaces().stream() .filter(intf -> intf.connectPoint().deviceId().equals(cp.deviceId())) .filter(intf -> !intf.connectPoint().equals(cp)) .flatMap(intf -> intf.ipAddressesList().stream()) .collect(Collectors.toSet()); // 1. Partial subnet population // Remove routing rules for removed subnet from previous configuration, // which does not also exist in other interfaces in the same device Set<IpPrefix> deviceIpPrefixSet = deviceIntfIpAddrs.stream() .map(InterfaceIpAddress::subnetAddress) .collect(Collectors.toSet()); Set<IpPrefix> subnetsToBeRevoked = ipPrefixSet.stream() .filter(ipPrefix -> !deviceIpPrefixSet.contains(ipPrefix)) .collect(Collectors.toSet()); // Check if any of the subnets to be revoked is configured in the pairDevice. // If any, repopulate the subnet with pairDevice connectPoint instead of revoking. Optional<DeviceId> pairDevice = getPairDeviceId(cp.deviceId()); if (pairDevice.isPresent()) { Set<IpPrefix> pairDeviceIpPrefix = getDeviceSubnetMap().get(pairDevice.get()); Set<IpPrefix> subnetsExistingInPairDevice = subnetsToBeRevoked.stream() .filter(ipPrefix -> pairDeviceIpPrefix.contains(ipPrefix)) .collect(Collectors.toSet()); // Update the subnets existing in pair device with pair device connect point. if (!subnetsExistingInPairDevice.isEmpty()) { // PortNumber of connect point is not relevant in populate subnet and hence providing as ANY. ConnectPoint pairDeviceCp = new ConnectPoint(pairDevice.get(), PortNumber.ANY); log.debug("Updating the subnets: {} with pairDevice connectPoint as it exists in the Pair device: {}", subnetsExistingInPairDevice, pairDeviceCp); defaultRoutingHandler.populateSubnet(Collections.singleton(pairDeviceCp), subnetsExistingInPairDevice); } // Remove only the subnets that are not configured in the pairDevice. subnetsToBeRevoked = Sets.difference(subnetsToBeRevoked, subnetsExistingInPairDevice); } if (!subnetsToBeRevoked.isEmpty()) { log.debug("Removing subnets for connectPoint: {}, subnets: {}", cp, subnetsToBeRevoked); defaultRoutingHandler.revokeSubnet(subnetsToBeRevoked); } // 2. Interface IP punts // Remove IP punts for old Intf address Set<IpAddress> deviceIpAddrs = deviceIntfIpAddrs.stream() .map(InterfaceIpAddress::ipAddress) .collect(Collectors.toSet()); ipAddressSet.stream() .map(InterfaceIpAddress::ipAddress) .filter(interfaceIpAddress -> !deviceIpAddrs.contains(interfaceIpAddress)) .forEach(interfaceIpAddress -> routingRulePopulator.revokeSingleIpPunts( cp.deviceId(), interfaceIpAddress)); // 3. Host unicast routing rule // Remove unicast routing rule hostEventExecutor.execute(() -> hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, false)); } private void addSubnetConfig(ConnectPoint cp, Set<InterfaceIpAddress> ipAddressSet) { Set<IpPrefix> ipPrefixSet = ipAddressSet.stream(). map(InterfaceIpAddress::subnetAddress).collect(Collectors.toSet()); Set<InterfaceIpAddress> deviceIntfIpAddrs = interfaceService.getInterfaces().stream() .filter(intf -> intf.connectPoint().deviceId().equals(cp.deviceId())) .filter(intf -> !intf.connectPoint().equals(cp)) .flatMap(intf -> intf.ipAddressesList().stream()) .collect(Collectors.toSet()); // 1. Partial subnet population // Add routing rules for newly added subnet, which does not also exist in // other interfaces in the same device Set<IpPrefix> deviceIpPrefixSet = deviceIntfIpAddrs.stream() .map(InterfaceIpAddress::subnetAddress) .collect(Collectors.toSet()); Set<IpPrefix> subnetsToBePopulated = ipPrefixSet.stream() .filter(ipPrefix -> !deviceIpPrefixSet.contains(ipPrefix)) .collect(Collectors.toSet()); if (!subnetsToBePopulated.isEmpty()) { log.debug("Adding subnets for connectPoint: {}, subnets: {}", cp, subnetsToBePopulated); // check if pair-device has the same subnet configured? Optional<DeviceId> pairDevice = getPairDeviceId(cp.deviceId()); if (pairDevice.isPresent()) { Set<IpPrefix> pairDeviceIpPrefix = getDeviceSubnetMap().get(pairDevice.get()); Set<IpPrefix> subnetsToBePopulatedAsDualHomed = subnetsToBePopulated.stream() .filter(ipPrefix -> pairDeviceIpPrefix.contains(ipPrefix)) .collect(Collectors.toSet()); Set<IpPrefix> subnetsToBePopulatedAsSingleHomed = Sets.difference(subnetsToBePopulated, subnetsToBePopulatedAsDualHomed); if (!subnetsToBePopulatedAsSingleHomed.isEmpty()) { defaultRoutingHandler.populateSubnet( Collections.singleton(cp), subnetsToBePopulatedAsSingleHomed); } if (!subnetsToBePopulatedAsDualHomed.isEmpty()) { Set<ConnectPoint> cpts = new HashSet<>(); cpts.add(cp); // As Subnets is DualHomed adding the pairDevice also as ConnectPoint. // PortNumber of connect point is not relevant in populate subnet and hence providing as ANY. ConnectPoint pairCp = new ConnectPoint(pairDevice.get(), PortNumber.ANY); cpts.add(pairCp); log.debug("Adding DualHomed subnets for connectPoint: {} and its pair device: {}, subnets: {}", cp, pairCp, subnetsToBePopulatedAsDualHomed); // populating the subnets as DualHomed defaultRoutingHandler.populateSubnet( cpts, subnetsToBePopulated); // revoking the subnets populated in the device as it is now Dualhomed. defaultRoutingHandler.revokeSubnet(Collections.singleton(cp.deviceId()), subnetsToBePopulatedAsDualHomed); } } else { defaultRoutingHandler.populateSubnet( Collections.singleton(cp), subnetsToBePopulated); } } // 2. Interface IP punts // Add IP punts for new Intf address Set<IpAddress> deviceIpAddrs = deviceIntfIpAddrs.stream() .map(InterfaceIpAddress::ipAddress) .collect(Collectors.toSet()); ipAddressSet.stream() .map(InterfaceIpAddress::ipAddress) .filter(interfaceIpAddress -> !deviceIpAddrs.contains(interfaceIpAddress)) .forEach(interfaceIpAddress -> routingRulePopulator.populateSingleIpPunts( cp.deviceId(), interfaceIpAddress)); // 3. Host unicast routing rule // Add unicast routing rule hostEventExecutor.execute(() -> hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, true)); } }
oplinkoms/onos
apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
Java
apache-2.0
108,504
[ 30522, 1013, 1008, 1008, 9385, 2325, 1011, 2556, 2330, 14048, 3192, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Ti=Ownership sec=All {_Confidential_Information} furnished to {_the_Consultant} by {_the_Client} is the sole and exclusive property of {_the_Client} or its suppliers or customers. =[G/Z/ol/0]
CommonAccord/Cmacc-Org
Doc/Wx/com/cooleygo/US/Consult/Sec/Confidentiality_Ownership_v01.md
Markdown
mit
194
[ 30522, 14841, 1027, 6095, 10819, 1027, 2035, 1063, 1035, 18777, 1035, 2592, 1065, 19851, 2000, 1063, 1035, 1996, 1035, 8930, 1065, 2011, 1063, 1035, 1996, 1035, 7396, 1065, 2003, 1996, 7082, 1998, 7262, 3200, 1997, 1063, 1035, 1996, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class YoullNeverTakeMeAlive < Cask version '0.9.9' sha256 'e055e96ed1816b30b420533af8f9de90da088b339d51aa99a5c20c636e8ba9c8' url "https://github.com/iSECPartners/yontma-mac/releases/download/#{version}/yontma-#{version}.dmg" homepage 'https://github.com/iSECPartners/yontma-mac' app 'You\'ll Never Take Me Alive!.app' end
gregkare/homebrew-cask
Casks/youll-never-take-me-alive.rb
Ruby
bsd-2-clause
334
[ 30522, 2465, 2017, 3363, 2638, 16874, 13808, 4168, 11475, 3726, 1026, 25222, 2243, 2544, 1005, 1014, 1012, 1023, 1012, 1023, 1005, 21146, 17788, 2575, 1005, 1041, 2692, 24087, 2063, 2683, 2575, 2098, 15136, 16048, 2497, 14142, 2497, 20958, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * Name: Mahana Messaging Library for CodeIgniter * * Author: Jeff Madsen * jrmadsen67@gmail.com * http://www.codebyjeff.com * * Location: will be on github shortly * * Description: CI library for linking to application's existing user table and * creating basis of an internal messaging system. No views or controllers * included. * * DO CHECK the README.txt for setup instructions and notes! * */ class Mahana_messaging { public function __construct() { $this->ci =& get_instance(); // ------------------------------------------------------------------------ // @TODO: There must be a better way than this to specify a file // path that works in both standard CodeIgniter and HMVC modules. // ------------------------------------------------------------------------ require_once dirname(__FILE__).'/../config/mahana.php'; $this->ci->load->model('mahana_model'); $this->ci->load->helper('language'); $this->ci->lang->load('mahana'); } // ------------------------------------------------------------------------ /** * get_message() - will return a single message, including the status for specified user. * * @param integer $msg_id EQUIRED * @param integer $user_id REQUIRED * @return array */ function get_message($msg_id, $user_id) { if (empty($msg_id)) { return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); } if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if ($message = $this->ci->mahana_model->get_message($msg_id, $user_id)) { return $this->_success($message); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * get_full_thread() - will return a entire thread, including the status for specified user. * * @param integer $thread_id REQUIRED * @param integer $user_id REQUIRED * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant * @param string $order_by OPTIONAL * @return array */ function get_full_thread($thread_id, $user_id, $full_thread = FALSE, $order_by = 'ASC') { if (empty($thread_id)) { return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); } if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if ($message = $this->ci->mahana_model->get_full_thread($thread_id, $user_id, $full_thread, $order_by)) { return $this->_success($message); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * get_all_threads() - will return all threads for user, including the status for specified user. * * @param integer $user_id REQUIRED * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant * @param string $order_by OPTIONAL * @return array */ function get_all_threads($user_id, $full_thread = FALSE, $order_by = 'ASC') { if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } $message = $this->ci->mahana_model->get_all_threads($user_id, $full_thread, $order_by); if (is_array($message)) { return $this->_success($message); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * get_all_threads_grouped() - will return all threads for user, including the status for specified user. * - messages are grouped in threads. * * @param integer $user_id REQUIRED * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant * @param string $order_by OPTIONAL * @return array */ function get_all_threads_grouped($user_id, $full_thread = FALSE, $order_by = 'ASC') { if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } $message = $this->ci->mahana_model->get_all_threads($user_id, $full_thread, $order_by); if (is_array($message)) { $threads = array(); foreach ($message as $msg) { if ( ! isset($threads[$msg['thread_id']])) { $threads[$msg['thread_id']]['thread_id'] = $msg['thread_id']; $threads[$msg['thread_id']]['messages'] = array($msg); } else { $threads[$msg['thread_id']]['messages'][] = $msg; } } return $this->_success($threads); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * update_message_status() - will change status on message for particular user * * @param integer $msg_id REQUIRED * @param integer $user_id REQUIRED * @param integer $status_id REQUIRED - should come from config/mahana.php list of constants * @return array */ function update_message_status($msg_id, $user_id, $status_id ) { if (empty($msg_id)) { return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); } if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if (empty($status_id)) { return $this->_invalid_id(MSG_ERR_INVALID_STATUS_ID); } if ($this->ci->mahana_model->update_message_status($msg_id, $user_id, $status_id)) { return $this->_success(NULL, MSG_STATUS_UPDATE); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * add_participant() - adds user to existing thread * * @param integer $thread_id REQUIRED * @param integer $user_id REQUIRED * @return array */ function add_participant($thread_id, $user_id) { if (empty($thread_id)) { return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); } if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if ( ! $this->ci->mahana_model->valid_new_participant($thread_id, $user_id)) { $this->_particpant_error(MSG_ERR_PARTICIPANT_EXISTS); } if ( ! $this->ci->mahana_model->application_user($user_id)) { $this->_particpant_error(MSG_ERR_PARTICIPANT_NONSYSTEM); } if ($this->ci->mahana_model->add_participant($thread_id, $user_id )) { return $this->_success(NULL, MSG_PARTICIPANT_ADDED); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * remove_participant() - removes user from existing thread * * @param integer $thread_id REQUIRED * @param integer $user_id REQUIRED * @return array */ function remove_participant($thread_id, $user_id) { if (empty($thread_id)) { return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); } if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if ($this->ci->mahana_model->remove_participant($thread_id, $user_id)) { return $this->_success(NULL, MSG_PARTICIPANT_REMOVED); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * send_new_message() - sends new internal message. This function will create a new thread * * @param integer $sender_id REQUIRED * @param mixed $recipients REQUIRED - a single integer or an array of integers, representing user_ids * @param string $subject * @param string $body * @param integer $priority * @return array */ function send_new_message($sender_id, $recipients, $subject = '', $body = '', $priority = PRIORITY_NORMAL) { if (empty($sender_id)) { return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID); } if (empty($recipients)) { return array( 'err' => 1, 'code' => MSG_ERR_INVALID_RECIPIENTS, 'msg' => lang('mahana_'.MSG_ERR_INVALID_RECIPIENTS) ); } if ($thread_id = $this->ci->mahana_model->send_new_message($sender_id, $recipients, $subject, $body, $priority)) { return $this->_success($thread_id, MSG_MESSAGE_SENT); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * reply_to_message() - replies to internal message. This function will NOT create a new thread or participant list * * @param integer $msg_id REQUIRED * @param integer $sender_id REQUIRED * @param string $subject * @param string $body * @param integer $priority * @return array */ function reply_to_message($msg_id, $sender_id, $subject = '', $body = '', $priority = PRIORITY_NORMAL) { if (empty($sender_id)) { return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID); } if (empty($msg_id)) { return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); } if ($new_msg_id = $this->ci->mahana_model->reply_to_message($msg_id, $sender_id, $body, $priority)) { return $this->_success($new_msg_id, MSG_MESSAGE_SENT); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * get_participant_list() - returns list of participants on given thread. If sender_id set, sender_id will be left off list * * @param integer $thread_id REQUIRED * @param integer $sender_id REQUIRED * @return array */ function get_participant_list($thread_id, $sender_id = 0) { if (empty($thread_id)) { return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); } if ($participants = $this->ci->mahana_model-> get_participant_list($thread_id, $sender_id)) { return $this->_success($participants); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ /** * get_msg_count() - returns integer with count of message for user, by status. defaults to new messages * * @param integer $user_id REQUIRED * @param integer $status_id OPTIONAL - defaults to "Unread" * @return array */ function get_msg_count($user_id, $status_id = MSG_STATUS_UNREAD) { if (empty($user_id)) { return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); } if (is_numeric($message = $this->ci->mahana_model->get_msg_count($user_id, $status_id))) { return $this->_success($message); } // General Error Occurred return $this->_general_error(); } // ------------------------------------------------------------------------ // Private Functions from here out! // ------------------------------------------------------------------------ /** * Success * * @param mixed $retval * @return array */ private function _success($retval = '', $message = MSG_SUCCESS) { return array( 'err' => 0, 'code' => MSG_SUCCESS, 'msg' => lang('mahana_' . $message), 'retval' => $retval ); } // ------------------------------------------------------------------------ /** * Invalid ID * * @param integer config.php error code numbers * @return array */ private function _invalid_id($error = '') { return array( 'err' => 1, 'code' => $error, 'msg' => lang('mahana_'.$error) ); } // ------------------------------------------------------------------------ /** * Error Particpant Exists * * @return array */ private function _participant_error($error = '') { return array( 'err' => 1, 'code' => 1, 'msg' => lang('mahana_' . $error) ); } // ------------------------------------------------------------------------ /** * General Error * * @return array */ private function _general_error() { return array( 'err' => 1, 'code' => MSG_ERR_GENERAL, 'msg' => lang('mahana_'.MSG_ERR_GENERAL) ); } }
weboservicesltd/crmsoftware
application/libraries/Mahana_messaging.php
PHP
mit
14,074
[ 30522, 1026, 1029, 25718, 2065, 1006, 999, 4225, 1006, 1005, 2918, 15069, 1005, 1007, 1007, 6164, 1006, 1005, 2053, 3622, 5896, 3229, 3039, 1005, 1007, 1025, 1013, 1008, 1008, 1008, 2171, 1024, 24404, 2532, 24732, 3075, 2005, 3642, 23773, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package stubgenerator.traitStaticPropertiesStub; public class JavaXImpl extends GroovyXImpl { public static void main(String[] args) { new JavaXImpl(); } }
jwagenleitner/incubator-groovy
src/test-resources/stubgenerator/traitStaticPropertiesStub/JavaXImpl.java
Java
apache-2.0
995
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1008, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1008, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1008, 4953, 9385, 6095, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2017-2020 The Verible Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "verilog/CST/constraints.h" #include <memory> #include <string> #include <utility> #include <vector> #include "absl/strings/string_view.h" #include "common/analysis/syntax_tree_search_test_utils.h" #include "common/text/concrete_syntax_leaf.h" #include "common/text/concrete_syntax_tree.h" #include "common/text/symbol.h" #include "common/text/text_structure.h" #include "common/text/token_info.h" #include "common/util/casts.h" #include "common/util/logging.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "verilog/CST/match_test_utils.h" #include "verilog/CST/verilog_nonterminals.h" #include "verilog/analysis/verilog_analyzer.h" #include "verilog/parser/verilog_token_enum.h" #undef ASSERT_OK #define ASSERT_OK(value) ASSERT_TRUE((value).ok()) namespace verilog { namespace { using verible::SyntaxTreeSearchTestCase; using verible::TextStructureView; TEST(FindAllConstraintDeclarationsTest, BasicTests) { constexpr int kTag = 1; // don't care const SyntaxTreeSearchTestCase kTestCases[] = { {"module foo; logic a; endmodule"}, {"class foo; rand logic a; endclass"}, {"class foo; rand logic a; ", {kTag, "constraint Bar { a < 16; }"}, " endclass"}, {"class foo; rand logic a; ", {kTag, "constraint b { a >= 16; }"}, "; ", {kTag, "constraint c { a <= 20; }"}, "; endclass"}, {"class foo; rand logic a; ", {kTag, "constraint b { a >= 16; }"}, "; ", {kTag, "constraint c { a <= 20; }"}, "; endclass; " "class bar; rand logic x; ", {kTag, "constraint y { x == 10; }"}, "; endclass"}, }; for (const auto& test : kTestCases) { TestVerilogSyntaxRangeMatches( __FUNCTION__, test, [](const TextStructureView& text_structure) { const auto& root = text_structure.SyntaxTree(); return FindAllConstraintDeclarations(*root); }); } } TEST(IsOutOfLineConstraintDefinitionTest, BasicTests) { constexpr std::pair<absl::string_view, bool> kTestCases[] = { {"class foo; rand logic a; constraint Bar { a < 16; } endclass", false}, {"constraint classname::constraint_c { a <= b; }", true}, }; for (const auto& test : kTestCases) { VerilogAnalyzer analyzer(test.first, ""); ASSERT_OK(analyzer.Analyze()); const auto& root = analyzer.Data().SyntaxTree(); std::vector<verible::TreeSearchMatch> constraint_declarations = FindAllConstraintDeclarations(*root); EXPECT_EQ(constraint_declarations.size(), 1); const bool out_of_line = IsOutOfLineConstraintDefinition(*constraint_declarations.front().match); EXPECT_EQ(out_of_line, test.second); } } // Tests that GetSymbolIdentifierFromConstraintDeclaration correctly returns // the token of the symbol identifier. TEST(GetSymbolIdentifierFromConstraintDeclarationTest, BasicTests) { const std::pair<std::string, absl::string_view> kTestCases[] = { {"class foo; rand logic a; constraint Bar { a < 16; } endclass", "Bar"}, {"class foo; rand logic a; constraint b { a >= 16; } endclass", "b"}, {"class foo; rand logic a; constraint stH { a == 16; } endclass", "stH"}, }; for (const auto& test : kTestCases) { VerilogAnalyzer analyzer(test.first, ""); ASSERT_OK(analyzer.Analyze()); const auto& root = analyzer.Data().SyntaxTree(); std::vector<verible::TreeSearchMatch> constraint_declarations = FindAllConstraintDeclarations(*root); const auto name_token = GetSymbolIdentifierFromConstraintDeclaration( *constraint_declarations.front().match); EXPECT_EQ(name_token->text(), test.second); } } } // namespace } // namespace verilog
chipsalliance/verible
verilog/CST/constraints_test.cc
C++
apache-2.0
4,293
[ 30522, 1013, 1013, 9385, 2418, 1011, 12609, 1996, 2310, 3089, 3468, 6048, 1012, 1013, 1013, 1013, 1013, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1013, 1013, 2017, 2089, 2025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.nagopy.android.disablemanager2; import android.os.Build; import com.android.uiautomator.core.UiSelector; @SuppressWarnings("unused") public class UiSelectorBuilder { private UiSelector uiSelector; public UiSelector build() { return uiSelector; } /** * @since API Level 16 */ public UiSelectorBuilder() { uiSelector = new UiSelector(); } /** * @since API Level 16 */ public UiSelectorBuilder text(String text) { uiSelector = uiSelector.text(text); return this; } /** * @since API Level 17 */ public UiSelectorBuilder textMatches(String regex) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { uiSelector = uiSelector.textMatches(regex); } return this; } /** * @since API Level 16 */ public UiSelectorBuilder textStartsWith(String text) { uiSelector = uiSelector.textStartsWith(text); return this; } /** * @since API Level 16 */ public UiSelectorBuilder textContains(String text) { uiSelector = uiSelector.textContains(text); return this; } /** * @since API Level 16 */ public UiSelectorBuilder className(String className) { uiSelector = uiSelector.className(className); return this; } /** * @since API Level 17 */ public UiSelectorBuilder classNameMatches(String regex) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { uiSelector = uiSelector.classNameMatches(regex); } return this; } /** * @since API Level 17 */ public UiSelectorBuilder className(Class<?> type) { uiSelector = uiSelector.className(type.getName()); return this; } /** * @since API Level 16 */ public UiSelectorBuilder description(String desc) { uiSelector = uiSelector.description(desc); return this; } /** * @since API Level 17 */ public UiSelectorBuilder descriptionMatches(String regex) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { uiSelector = uiSelector.descriptionMatches(regex); } return this; } /** * @since API Level 16 */ public UiSelectorBuilder descriptionStartsWith(String desc) { uiSelector = uiSelector.descriptionStartsWith(desc); return this; } /** * @since API Level 16 */ public UiSelectorBuilder descriptionContains(String desc) { uiSelector = uiSelector.descriptionContains(desc); return this; } /** * @since API Level 18 */ public UiSelectorBuilder resourceId(String id) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { uiSelector = uiSelector.resourceId(id); } return this; } /** * @since API Level 18 */ public UiSelectorBuilder resourceIdMatches(String regex) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { uiSelector = uiSelector.resourceIdMatches(regex); } return this; } /** * @since API Level 16 */ public UiSelectorBuilder index(final int index) { uiSelector = uiSelector.index(index); return this; } /** * @since API Level 16 */ public UiSelectorBuilder instance(final int instance) { uiSelector = uiSelector.instance(instance); return this; } /** * @since API Level 16 */ public UiSelectorBuilder enabled(boolean val) { uiSelector = uiSelector.enabled(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder focused(boolean val) { uiSelector = uiSelector.focused(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder focusable(boolean val) { uiSelector = uiSelector.focusable(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder scrollable(boolean val) { uiSelector = uiSelector.scrollable(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder selected(boolean val) { uiSelector = uiSelector.selected(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder checked(boolean val) { uiSelector = uiSelector.checked(val); return this; } /** * @since API Level 16 */ public UiSelectorBuilder clickable(boolean val) { uiSelector = uiSelector.clickable(val); return this; } /** * @since API Level 18 */ public UiSelectorBuilder checkable(boolean val) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { uiSelector = uiSelector.checkable(val); } return this; } /** * @since API Level 17 */ public UiSelectorBuilder longClickable(boolean val) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { uiSelector = uiSelector.longClickable(val); } return this; } /** * @since API Level 16 */ public UiSelectorBuilder childSelector(UiSelector selector) { uiSelector = uiSelector.childSelector(selector); return this; } /** * @since API Level 16 */ public UiSelectorBuilder fromParent(UiSelector selector) { uiSelector = uiSelector.fromParent(selector); return this; } /** * @since API Level 16 */ public UiSelectorBuilder packageName(String name) { uiSelector = uiSelector.packageName(name); return this; } /** * @since API Level 17 */ public UiSelectorBuilder packageNameMatches(String regex) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { uiSelector = uiSelector.packageNameMatches(regex); } return this; } }
75py/DisableManager
uiautomator/src/main/java/com/nagopy/android/disablemanager2/UiSelectorBuilder.java
Java
apache-2.0
6,177
[ 30522, 7427, 4012, 1012, 6583, 3995, 7685, 1012, 11924, 1012, 4487, 19150, 24805, 4590, 2475, 1025, 12324, 11924, 1012, 9808, 1012, 3857, 1025, 12324, 4012, 1012, 11924, 1012, 21318, 4887, 20389, 8844, 1012, 4563, 1012, 21318, 11246, 22471, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var GUID = (function () { function _GUID() { return UUIDcreatePart(4) + UUIDcreatePart(2) + UUIDcreatePart(2) + UUIDcreatePart(2) + UUIDcreatePart(6); }; function UUIDcreatePart(length) { var uuidpart = ""; for (var i = 0; i < length; i++) { var uuidchar = parseInt((Math.random() * 256), 10).toString(16); if (uuidchar.length == 1) { uuidchar = "0" + uuidchar; } uuidpart += uuidchar; } return uuidpart; } return { newGuid: _GUID }; })(); var dataSource = (function () { var tablesStorageKey = "60AE0285-40EE-4A2D-BA5F-F75D601593DD"; var globalData = []; var tables = [ { Id: 5, Name: "Contact", Schema: [ { k: "name", t: 1 }, { k: "companyname", t: 1 }, { k: "position", t: 1 } ], Created: "2016-08-12T07:32:46.69" }, { Id: 6, Name: "Profile", Schema: [ { k: "Name", t: 1 }, { k: "Age", t: 2 }, { k: "Gender", t: 4 }, { k: "Rating", t: 3 }, { k: "Created", t: 5 } ], Created: "2016-09-28T21:53:40.19" } ]; function _loadData(){ globalData = JSON.parse(localStorage[tablesStorageKey] || "[]"); } function _save() { localStorage[tablesStorageKey] = JSON.stringify(globalData); } function _getSchema(tableId) { for (var t = 0; t < tables.length; t++) if (tableId === tables[t].Id) return tables[t].Schema; } function _find(data) { var skip = data.start; var take = data.length; return { draw: data.draw, recordsTotal: globalData.length, recordsFiltered: globalData.length, data: globalData.slice(skip, take + skip) }; } function _insert(data) { var id = GUID.newGuid(); globalData.push([id, data.Name, data.Age, data.Gender, data.Rating, data.Created]); _save() return { IsOk: true, id: id }; } function _update(data) { for (var t = 0; t < globalData.length; t++) if (data._id === globalData[t][0]) { globalData[t] = [data._id, data.Name, data.Age, data.Gender, data.Rating, data.Created]; _save() return { IsOk: true }; } return { IsOk: false }; } function _delete(id) { for (var t = 0; t < globalData.length; t++) if (id === globalData[t][0]) { globalData = globalData.filter(item => item !== globalData[t]); _save(); return { IsOk: true }; } return { IsOk: false }; } _loadData(); return { getSchema: _getSchema, find: _find, insert: _insert, update: _update, delete: _delete }; })();
storyclm/storyCLM.js
presentation/js/dataSource.js
JavaScript
mit
3,648
[ 30522, 13075, 26458, 2094, 1027, 1006, 3853, 1006, 1007, 1063, 3853, 1035, 26458, 2094, 1006, 1007, 1063, 2709, 1057, 21272, 16748, 3686, 19362, 2102, 1006, 1018, 1007, 1009, 1057, 21272, 16748, 3686, 19362, 2102, 1006, 1016, 1007, 1009, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <!-- Mirrored from www.w3schools.com/jquerymobile/tryjqmob_icons_carat-r.htm by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:16:53 GMT --> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="../../code.jquery.com/jquery-1.11.2.min.js"></script> <script src="../../code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <div data-role="main" class="ui-content"> <p>An example of the "Carat Pointing Right Icon" in different buttons.</p> <a href="#" class="ui-btn ui-icon-carat-r ui-btn-icon-left">Carat-r Anchor</a> <button class="ui-btn ui-icon-carat-r ui-btn-icon-left">Carat-r Button</button> <input type="button" data-icon="carat-r" value="Carat-r Input Button"> <p>Only the icon:</p> <a href="#" class="ui-btn ui-corner-all ui-icon-carat-r ui-btn-icon-notext">Carat-r Icon</a> </div> </div> </body> <!-- Mirrored from www.w3schools.com/jquerymobile/tryjqmob_icons_carat-r.htm by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:16:53 GMT --> </html>
platinhom/ManualHom
Coding/W3School/W3Schools_Offline_2015/www.w3schools.com/jquerymobile/tryjqmob_icons_carat-r.html
HTML
gpl-2.0
1,231
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 999, 1011, 1011, 22243, 2013, 7479, 1012, 1059, 2509, 11624, 13669, 2015, 1012, 4012, 1013, 1046, 4226, 2854, 17751, 1013, 3046, 3501, 4160, 5302, 2497, 1035, 18407, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package cn.binarywang.wx.miniapp.constant; /** * <pre> * 小程序常量. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public abstract class WxMaConstants { private WxMaConstants() { } /** * 默认的env_version值 */ public static final String DEFAULT_ENV_VERSION = "release"; /** * 微信接口返回的参数errcode. */ public static final String ERRCODE = "errcode"; /** * 素材类型. */ public abstract static class MediaType { /** * 图片. */ public static final String IMAGE = "image"; } /** * 消息格式. */ public abstract static class MsgDataFormat { public static final String XML = "XML"; public static final String JSON = "JSON"; } /** * 客服消息的消息类型. */ public static class KefuMsgType { /** * 文本消息. */ public static final String TEXT = "text"; /** * 图片消息. */ public static final String IMAGE = "image"; /** * 图文链接. */ public static final String LINK = "link"; /** * 小程序卡片消息. */ public static final String MA_PAGE = "miniprogrampage"; } /** * 内容安全检测的媒体类型 */ public static final class SecCheckMediaType { /** * 音频 */ public static final int VOICE = 1; /** * 图片 */ public static final int IMAGE = 2; } /** * 快递账号绑定类型 */ public static final class BindAccountType { /** * 绑定 */ public static final String BIND = "bind"; /** * 解绑 */ public static final String UNBIND = "unbind"; } /** * 快递下单订单来源 */ public static final class OrderAddSource { /** * 小程序 */ public static final int MINI_PROGRAM = 0; /** * APP或H5 */ public static final int APP_OR_H5 = 2; } /** * 快递下单保价 */ public static final class OrderAddInsured { private OrderAddInsured() { } /** * 不保价 */ public static final int INSURED_PROGRAM = 0; /** * 保价 */ public static final int USE_INSURED = 1; /** * 默认保价金额 */ public static final int DEFAULT_INSURED_VALUE = 0; } /** * 小程序订阅消息跳转小程序类型 * <p> * developer为开发版;trial为体验版;formal为正式版;默认为正式版 */ public static final class MiniProgramState { private MiniProgramState() { } /** * 开发版 */ public static final String DEVELOPER = "developer"; /** * 体验版 */ public static final String TRIAL = "trial"; /** * 正式版 */ public static final String FORMAL = "formal"; } /** * 进入小程序查看的语言类型 * 支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN */ public static final class MiniProgramLang { private MiniProgramLang() { } /** * 简体中文 */ public static final String ZH_CN = "zh_CN"; /** * 英文 */ public static final String EN_US = "en_US"; /** * 繁体中文 */ public static final String ZH_HK = "zh_HK"; /** * 繁体中文 */ public static final String ZH_TW = "zh_TW"; } }
Wechat-Group/WxJava
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaConstants.java
Java
apache-2.0
3,434
[ 30522, 7427, 27166, 1012, 12441, 16600, 1012, 1059, 2595, 1012, 7163, 29098, 1012, 5377, 1025, 1013, 1008, 1008, 1008, 1026, 3653, 1028, 1008, 1829, 100, 100, 100, 100, 1012, 1008, 1026, 1013, 3653, 1028, 1008, 1008, 1030, 3166, 1026, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>GNU Radio 7f75d35b C++ API: siso_type.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">GNU Radio 7f75d35b C++ API </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.1 --> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('siso__type_8h.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#enum-members">Enumerations</a> </div> <div class="headertitle"> <div class="title">siso_type.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p><a href="siso__type_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="enum-members"></a> Enumerations</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="siso__type_8h.html#ae9796e8d4233b80431bb2c59b916c0d8">trellis_siso_type_t</a> { <a class="el" href="siso__type_8h.html#ae9796e8d4233b80431bb2c59b916c0d8a94e9d0466722cb4ce35ffaf2ffe22000">TRELLIS_MIN_SUM</a> = 200, <a class="el" href="siso__type_8h.html#ae9796e8d4233b80431bb2c59b916c0d8afdedfc227969681667f10ef14ae6865e">TRELLIS_SUM_PRODUCT</a> }</td></tr> </table> <hr/><h2>Enumeration Type Documentation</h2> <a class="anchor" id="ae9796e8d4233b80431bb2c59b916c0d8"></a><!-- doxytag: member="siso_type.h::trellis_siso_type_t" ref="ae9796e8d4233b80431bb2c59b916c0d8" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="siso__type_8h.html#ae9796e8d4233b80431bb2c59b916c0d8">trellis_siso_type_t</a></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><em><a class="anchor" id="ae9796e8d4233b80431bb2c59b916c0d8a94e9d0466722cb4ce35ffaf2ffe22000"></a><!-- doxytag: member="TRELLIS_MIN_SUM" ref="ae9796e8d4233b80431bb2c59b916c0d8a94e9d0466722cb4ce35ffaf2ffe22000" args="" -->TRELLIS_MIN_SUM</em>&nbsp;</td><td> </td></tr> <tr><td valign="top"><em><a class="anchor" id="ae9796e8d4233b80431bb2c59b916c0d8afdedfc227969681667f10ef14ae6865e"></a><!-- doxytag: member="TRELLIS_SUM_PRODUCT" ref="ae9796e8d4233b80431bb2c59b916c0d8afdedfc227969681667f10ef14ae6865e" args="" -->TRELLIS_SUM_PRODUCT</em>&nbsp;</td><td> </td></tr> </table> </dd> </dl> </div> </div> </div><!-- contents --> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="siso__type_8h.html">siso_type.h</a> </li> <li class="footer">Generated on Thu Sep 27 2012 10:49:28 for GNU Radio 7f75d35b C++ API by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li> </ul> </div> </body> </html>
katsikas/gnuradio
build/docs/doxygen/html/siso__type_8h.html
HTML
gpl-3.0
4,068
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package ee.scanner.tablet.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor public class UserWrapperDTO { @Valid private List<UserManagementDTO> users = new ArrayList<>(); }
PriitPaluoja/TabletScanner
src/main/java/ee/scanner/tablet/dto/UserWrapperDTO.java
Java
mit
355
[ 30522, 7427, 25212, 1012, 26221, 1012, 13855, 1012, 26718, 2080, 1025, 12324, 8840, 13344, 2243, 1012, 25699, 10623, 9363, 23808, 6820, 16761, 1025, 12324, 8840, 13344, 2243, 1012, 2951, 1025, 12324, 8840, 13344, 2243, 1012, 2053, 2906, 5620,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
use std::sync::Mutex; lazy_static! { pub static ref ERROR_MUTEX: Mutex<()> = Mutex::new(()); }
tyleo/sharedlib
src/util/error_mutex.rs
Rust
isc
100
[ 30522, 2224, 2358, 2094, 1024, 1024, 26351, 1024, 1024, 20101, 2595, 1025, 13971, 1035, 10763, 999, 1063, 9047, 10763, 25416, 7561, 1035, 20101, 2595, 1024, 20101, 2595, 1026, 1006, 1007, 1028, 1027, 20101, 2595, 1024, 1024, 2047, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtGui> #include "buttonwidget.h" //! [0] ButtonWidget::ButtonWidget(QStringList texts, QWidget *parent) : QWidget(parent) { signalMapper = new QSignalMapper(this); QGridLayout *gridLayout = new QGridLayout; for (int i = 0; i < texts.size(); ++i) { QPushButton *button = new QPushButton(texts[i]); connect(button, SIGNAL(clicked()), signalMapper, SLOT(map())); //! [0] //! [1] signalMapper->setMapping(button, texts[i]); gridLayout->addWidget(button, i / 3, i % 3); } connect(signalMapper, SIGNAL(mapped(QString)), //! [1] //! [2] this, SIGNAL(clicked(QString))); setLayout(gridLayout); } //! [2]
klim-iv/phantomjs-qt5
src/qt/qtbase/src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp
C++
bsd-3-clause
2,655
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright 2017 Hortonworks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ package com.hortonworks.streamline.streams.service; import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.hortonworks.streamline.common.exception.service.exception.request.BadRequestException; import com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException; import com.hortonworks.streamline.common.exception.service.exception.server.UnhandledServerException; import com.hortonworks.streamline.common.util.WSUtils; import com.hortonworks.streamline.streams.actions.topology.service.TopologyActionsService; import com.hortonworks.streamline.streams.catalog.Topology; import com.hortonworks.streamline.streams.catalog.TopologySink; import com.hortonworks.streamline.streams.catalog.TopologySource; import com.hortonworks.streamline.streams.catalog.TopologyTestRunCase; import com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink; import com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource; import com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory; import com.hortonworks.streamline.streams.catalog.service.StreamCatalogService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.BooleanUtils; import org.datanucleus.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Stream; import static java.util.stream.Collectors.toList; import static javax.ws.rs.core.Response.Status.CREATED; import static javax.ws.rs.core.Response.Status.OK; @Path("/v1/catalog") @Produces(MediaType.APPLICATION_JSON) public class TopologyTestRunResource { private static final Logger LOG = LoggerFactory.getLogger(TopologyTestRunResource.class); private static final Integer DEFAULT_LIST_ENTITIES_COUNT = 5; public static final Charset ENCODING_UTF_8 = Charset.forName("UTF-8"); private final StreamCatalogService catalogService; private final TopologyActionsService actionsService; private final ObjectMapper objectMapper; public TopologyTestRunResource(StreamCatalogService catalogService, TopologyActionsService actionsService) { this.catalogService = catalogService; this.actionsService = actionsService; this.objectMapper = new ObjectMapper(); } @POST @Path("/topologies/{topologyId}/actions/testrun") @Timed public Response testRunTopology (@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, String testRunInputJson) throws Exception { Topology result = catalogService.getTopology(topologyId); if (result != null) { TopologyTestRunHistory history = actionsService.testRunTopology(result, testRunInputJson); return WSUtils.respondEntity(history, OK); } throw EntityNotFoundException.byId(topologyId.toString()); } @GET @Path("/topologies/{topologyId}/testhistories") @Timed public Response getHistoriesOfTestRunTopology (@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @QueryParam("limit") Integer limit) throws Exception { Collection<TopologyTestRunHistory> histories = catalogService.listTopologyTestRunHistory(topologyId); if (histories == null) { throw EntityNotFoundException.byFilter("topology id " + topologyId); } List<TopologyTestRunHistory> filteredHistories = filterHistories(limit, histories); return WSUtils.respondEntities(filteredHistories, OK); } @GET @Path("/topologies/{topologyId}/versions/{versionId}/testhistories") @Timed public Response getHistoriesOfTestRunTopology (@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @QueryParam("limit") Integer limit) throws Exception { Collection<TopologyTestRunHistory> histories = catalogService.listTopologyTestRunHistory(topologyId, versionId); if (histories == null) { throw EntityNotFoundException.byFilter("topology id " + topologyId); } List<TopologyTestRunHistory> filteredHistories = filterHistories(limit, histories); return WSUtils.respondEntities(filteredHistories, OK); } @GET @Path("/topologies/{topologyId}/testhistories/{historyId}") @Timed public Response getHistoryOfTestRunTopology (@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @QueryParam("simplify") Boolean simplify) throws Exception { TopologyTestRunHistory history = catalogService.getTopologyTestRunHistory(historyId); if (history == null) { throw EntityNotFoundException.byId(String.valueOf(historyId)); } if (!history.getTopologyId().equals(topologyId)) { throw BadRequestException.message("Test history " + historyId + " is not belong to topology " + topologyId); } if (BooleanUtils.isTrue(simplify)) { return WSUtils.respondEntity(new SimplifiedTopologyTestRunHistory(history), OK); } else { return WSUtils.respondEntity(history, OK); } } @GET @Path("/topologies/{topologyId}/testhistories/{historyId}/events") public Response getEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId) throws Exception { return getEventsOfTestRunTopologyHistory(topologyId, historyId, null); } @GET @Path("/topologies/{topologyId}/testhistories/{historyId}/events/{componentName}") public Response getEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @PathParam("componentName") String componentName) throws Exception { return getEventsOfTestRunTopologyHistory(topologyId, historyId, componentName); } @GET @Path("/topologies/{topologyId}/testhistories/{historyId}/events/download") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response downloadEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId) throws Exception { File eventLogFile = getEventLogFile(topologyId, historyId); String content = FileUtils.readFileToString(eventLogFile, ENCODING_UTF_8); InputStream is = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); String fileName = String.format("events-topology-%d-history-%d.log", topologyId, historyId); return Response.status(OK) .entity(is) .header("Content-Disposition", "attachment; filename=\"" + fileName + "\"") .build(); } private Response getEventsOfTestRunTopologyHistory(Long topologyId, Long historyId, String componentName) throws IOException { File eventLogFile = getEventLogFile(topologyId, historyId); List<String> lines = FileUtils.readLines(eventLogFile, ENCODING_UTF_8); Stream<Map<String, Object>> eventsStream = lines.stream().map(line -> { try { return objectMapper.readValue(line, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { throw new RuntimeException(e); } }); if (!StringUtils.isEmpty(componentName)) { eventsStream = eventsStream.filter(event -> { String eventComponentName = (String) event.get("componentName"); return eventComponentName != null && eventComponentName.equals(componentName); }); } return WSUtils.respondEntities(eventsStream.collect(toList()), OK); } private File getEventLogFile(Long topologyId, Long historyId) { TopologyTestRunHistory history = catalogService.getTopologyTestRunHistory(historyId); if (history == null) { throw EntityNotFoundException.byId(String.valueOf(historyId)); } if (!history.getTopologyId().equals(topologyId)) { throw BadRequestException.message("Test history " + historyId + " is not belong to topology " + topologyId); } String eventLogFilePath = history.getEventLogFilePath(); File eventLogFile = new File(eventLogFilePath); if (!eventLogFile.exists() || eventLogFile.isDirectory() || !eventLogFile.canRead()) { throw BadRequestException.message("Event log file of history " + historyId + " does not exist or is not readable."); } return eventLogFile; } private List<TopologyTestRunHistory> filterHistories(Integer limit, Collection<TopologyTestRunHistory> histories) { if (limit == null) { limit = DEFAULT_LIST_ENTITIES_COUNT; } return histories.stream() // reverse order .sorted((h1, h2) -> (int) (h2.getId() - h1.getId())) .limit(limit) .collect(toList()); } @POST @Path("/topologies/{topologyId}/testcases") public Response addTestRunCase(@PathParam("topologyId") Long topologyId, TopologyTestRunCase testRunCase) { testRunCase.setTopologyId(topologyId); Long currentVersionId = catalogService.getCurrentVersionId(topologyId); testRunCase.setVersionId(currentVersionId); TopologyTestRunCase addedCase = catalogService.addTopologyTestRunCase(testRunCase); return WSUtils.respondEntity(addedCase, CREATED); } @POST @Path("/topologies/{topologyId}/versions/{versionId}/testcases") public Response addTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, TopologyTestRunCase testRunCase) { testRunCase.setTopologyId(topologyId); testRunCase.setVersionId(versionId); TopologyTestRunCase addedCase = catalogService.addTopologyTestRunCase(testRunCase); return WSUtils.respondEntity(addedCase, CREATED); } @PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}") public Response addOrUpdateTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCase testRunCase) { testRunCase.setTopologyId(topologyId); testRunCase.setId(testCaseId); TopologyTestRunCase updatedCase = catalogService.addOrUpdateTopologyTestRunCase(topologyId, testRunCase); return WSUtils.respondEntity(updatedCase, OK); } @GET @Path("/topologies/{topologyId}/testcases/{testCaseId}") public Response getTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { TopologyTestRunCase testcase = catalogService.getTopologyTestRunCase(topologyId, testCaseId); if (testcase == null) { throw EntityNotFoundException.byId(Long.toString(testCaseId)); } return WSUtils.respondEntity(testcase, OK); } @GET @Path("/topologies/{topologyId}/testcases") @Timed public Response listTestRunCases(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @QueryParam("limit") Integer limit) throws Exception { Long currentVersionId = catalogService.getCurrentVersionId(topologyId); Collection<TopologyTestRunCase> cases = catalogService.listTopologyTestRunCase(topologyId, currentVersionId); if (cases == null) { throw EntityNotFoundException.byFilter("topology id " + topologyId); } List<TopologyTestRunCase> filteredCases = filterTestRunCases(limit, cases); return WSUtils.respondEntities(filteredCases, OK); } @GET @Path("/topologies/{topologyId}/versions/{versionId}/testcases") @Timed public Response listTestRunCases(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @QueryParam("limit") Integer limit) throws Exception { Collection<TopologyTestRunCase> cases = catalogService.listTopologyTestRunCase(topologyId, versionId); if (cases == null) { throw EntityNotFoundException.byFilter("topology id " + topologyId); } List<TopologyTestRunCase> filteredCases = filterTestRunCases(limit, cases); return WSUtils.respondEntities(filteredCases, OK); } @DELETE @Path("/topologies/{topologyId}/testcases/{testCaseId}") public Response removeTestRunCase(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { TopologyTestRunCase testRunCase = catalogService.removeTestRunCase(topologyId, testCaseId); if (testRunCase != null) { return WSUtils.respondEntity(testRunCase, OK); } throw EntityNotFoundException.byId(testCaseId.toString()); } private List<TopologyTestRunCase> filterTestRunCases(Integer limit, Collection<TopologyTestRunCase> cases) { if (limit == null) { limit = DEFAULT_LIST_ENTITIES_COUNT; } return cases.stream() // reverse order .sorted((h1, h2) -> (int) (h2.getId() - h1.getId())) .limit(limit) .collect(toList()); } @POST @Path("/topologies/{topologyId}/testcases/{testCaseId}/sources") public Response addTestRunCaseSource(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCaseSource testRunCaseSource) { TopologySource topologySource = getAssociatedTopologySource(topologyId, testCaseId, testRunCaseSource.getSourceId()); testRunCaseSource.setVersionId(topologySource.getVersionId()); TopologyTestRunCaseSource addedCaseSource = catalogService.addTopologyTestRunCaseSource(testRunCaseSource); return WSUtils.respondEntity(addedCaseSource, CREATED); } @PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}/sources/{id}") public Response addOrUpdateTestRunCaseSource(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSource testRunCaseSource) { testRunCaseSource.setId(id); testRunCaseSource.setTestCaseId(testCaseId); TopologySource topologySource = getAssociatedTopologySource(topologyId, testCaseId, testRunCaseSource.getSourceId()); testRunCaseSource.setVersionId(topologySource.getVersionId()); TopologyTestRunCaseSource updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSource(testRunCaseSource.getId(), testRunCaseSource); return WSUtils.respondEntity(updatedCase, OK); } private TopologySource getAssociatedTopologySource(Long topologyId, Long testCaseId, Long topologySourceId) { TopologyTestRunCase testCase = catalogService.getTopologyTestRunCase(topologyId, testCaseId); if (testCase == null) { throw EntityNotFoundException.byId("Topology test case with topology id " + topologyId + " and test case id " + testCaseId); } TopologySource topologySource = catalogService.getTopologySource(topologyId, topologySourceId, testCase.getVersionId()); if (topologySource == null) { throw EntityNotFoundException.byId("Topology source with topology id " + topologyId + " and version id " + testCase.getVersionId()); } else if (!testCase.getVersionId().equals(topologySource.getVersionId())) { throw new IllegalStateException("Test case and topology source point to the different version id: " + "version id of test case: " + testCase.getVersionId() + " / " + "version id of topology source: " + topologySource.getVersionId()); } return topologySource; } @GET @Path("/topologies/{topologyId}/testcases/{testcaseId}/sources/{id}") public Response getTestRunCaseSource(@PathParam("topologyId") Long topologyId, @PathParam("testcaseId") Long testcaseId, @PathParam("id") Long id) { TopologyTestRunCaseSource testCaseSource = catalogService.getTopologyTestRunCaseSource(testcaseId, id); if (testCaseSource == null) { throw EntityNotFoundException.byId(Long.toString(id)); } return WSUtils.respondEntity(testCaseSource, OK); } @GET @Path("/topologies/{topologyId}/testcases/{testCaseId}/sources/topologysource/{sourceId}") public Response getTestRunCaseSourceByTopologySource(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("sourceId") Long sourceId) { TopologyTestRunCaseSource testCaseSource = catalogService.getTopologyTestRunCaseSourceBySourceId(testCaseId, sourceId); if (testCaseSource == null) { throw EntityNotFoundException.byId("test case id: " + testCaseId + " , topology source id: " + sourceId); } return WSUtils.respondEntity(testCaseSource, OK); } @GET @Path("/topologies/{topologyId}/testcases/{testCaseId}/sources") public Response listTestRunCaseSource(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { Collection<TopologyTestRunCaseSource> sources = catalogService.listTopologyTestRunCaseSource(topologyId, testCaseId); if (sources == null) { throw EntityNotFoundException.byFilter("topologyId: " + topologyId + " / testCaseId: " + testCaseId); } return WSUtils.respondEntities(sources, OK); } @POST @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks") public Response addTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCaseSink testRunCaseSink) { TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink addedCaseSink = catalogService.addTopologyTestRunCaseSink(testRunCaseSink); return WSUtils.respondEntity(addedCaseSink, CREATED); } @PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/{id}") public Response addOrUpdateTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSink testRunCaseSink) { testRunCaseSink.setId(id); testRunCaseSink.setTestCaseId(testCaseId); TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSink(testRunCaseSink.getId(), testRunCaseSink); return WSUtils.respondEntity(updatedCase, OK); } private TopologySink getAssociatedTopologySink(Long topologyId, Long testCaseId, Long topologySinkId) { TopologyTestRunCase testCase = catalogService.getTopologyTestRunCase(topologyId, testCaseId); if (testCase == null) { throw EntityNotFoundException.byId("Topology test case with topology id " + topologyId + " and test case id " + testCaseId); } TopologySink topologySink = catalogService.getTopologySink(topologyId, topologySinkId, testCase.getVersionId()); if (topologySink == null) { throw EntityNotFoundException.byId("Topology sink with topology id " + topologyId + " and version id " + testCase.getVersionId()); } else if (!testCase.getVersionId().equals(topologySink.getVersionId())) { throw new IllegalStateException("Test case and topology sink point to the different version id: " + "version id of test case: " + testCase.getVersionId() + " / " + "version id of topology sink: " + topologySink.getVersionId()); } return topologySink; } @GET @Path("/topologies/{topologyId}/testcases/{testcaseId}/sinks/{id}") public Response getTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testcaseId") Long testcaseId, @PathParam("id") Long id) { TopologyTestRunCaseSink testCaseSink = catalogService.getTopologyTestRunCaseSink(testcaseId, id); if (testCaseSink == null) { throw EntityNotFoundException.byId(Long.toString(id)); } return WSUtils.respondEntity(testCaseSink, OK); } @GET @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/topologysink/{sinkId}") public Response getTestRunCaseSinkByTopologySink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("sinkId") Long sinkId) { TopologyTestRunCaseSink testCaseSink = catalogService.getTopologyTestRunCaseSinkBySinkId(testCaseId, sinkId); if (testCaseSink == null) { throw EntityNotFoundException.byId("test case id: " + testCaseId + " , topology source id: " + sinkId); } return WSUtils.respondEntity(testCaseSink, OK); } @GET @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks") public Response listTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId) { Collection<TopologyTestRunCaseSink> sources = catalogService.listTopologyTestRunCaseSink(topologyId, testCaseId); if (sources == null) { throw EntityNotFoundException.byFilter("topologyId: " + topologyId + " / testCaseId: " + testCaseId); } return WSUtils.respondEntities(sources, OK); } private static class SimplifiedTopologyTestRunHistory { private Long id; private Long topologyId; private Long versionId; private Boolean finished = false; private Boolean success = false; private Boolean matched = false; private Long startTime; private Long finishTime; private Long timestamp; SimplifiedTopologyTestRunHistory(TopologyTestRunHistory history) { id = history.getId(); topologyId = history.getTopologyId(); versionId = history.getVersionId(); finished = history.getFinished(); success = history.getSuccess(); matched = history.getMatched(); startTime = history.getStartTime(); finishTime = history.getFinishTime(); timestamp = history.getTimestamp(); } public Long getId() { return id; } public Long getTopologyId() { return topologyId; } public Long getVersionId() { return versionId; } public Boolean getFinished() { return finished; } public Boolean getSuccess() { return success; } public Boolean getMatched() { return matched; } public Long getStartTime() { return startTime; } public Long getFinishTime() { return finishTime; } public Long getTimestamp() { return timestamp; } } }
hmcl/Streams
streams/service/src/main/java/com/hortonworks/streamline/streams/service/TopologyTestRunResource.java
Java
apache-2.0
26,797
[ 30522, 1013, 1008, 1008, 1008, 9385, 2418, 18469, 9316, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// the following disclaimer. /// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and /// the following disclaimer in the documentation and/or other materials provided with the distribution. /// * Neither the name of Microsoft nor the names of its contributors may be used to /// endorse or promote products derived from this software without specific prior written permission. /// /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR /// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS /// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE /// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT /// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS /// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, /// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF /// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ES5Harness.registerTest({ id: "15.2.3.5-4-83", path: "TestCases/chapter15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-83.js", description: "Object.create - 'enumerable' property of one property in 'Properties' is a non-empty string (8.10.5 step 3.b)", test: function testcase() { var accessed = false; var newObj = Object.create({}, { prop: { enumerable: "AB\n\\cd" } }); for (var property in newObj) { if (property === "prop") { accessed = true; } } return accessed; }, precondition: function prereq() { return fnExists(Object.create); } });
hnafar/IronJS
Src/Tests/ietestcenter/chapter15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-83.js
JavaScript
apache-2.0
2,261
[ 30522, 1013, 1013, 1013, 9385, 1006, 1039, 1007, 2268, 7513, 3840, 1013, 1013, 1013, 1013, 1013, 1013, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 14080, 1010, 2024, 7936, 3024, 1013, 1013, 1013, 2008, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // JSZVCRPlayerDelegate.h // Pods // // Created by Jordan Zucker on 1/11/16. // // #ifndef JSZVCRPlayerDelegate_h #define JSZVCRPlayerDelegate_h /** * This is for relaying testing state during a run */ @protocol JSZVCRPlayerDelegate <NSObject> #if JSZTESTING /** * This provides an update if a testCase encounters an unmatched request * * @param testCase currently executing test case * @param request request that just failed to be matched * @param shouldFail if YES then test should be failed (in line with JSZVCRMatchingStrictnessFailWhenNoMatch) */ - (void)testCase:(XCTestCase *)testCase withUnmatchedRequest:(NSURLRequest *)request shouldFail:(BOOL)shouldFail; #else /** * This is provided when there is no XCTestCase as a framework for recording and replaying * * @param request * @param request request that just failed to be matched * @param shouldFail if YES then test should be failed (in line with JSZVCRMatchingStrictnessFailWhenNoMatch) */ - (void)unmatchedRequest:(NSURLRequest *)request shouldFail:(BOOL)shouldFail; /** * Network responses used to match against recorded network calls. * * @return array of network responses to parse for matcher */ - (NSArray *)networkResponses; #endif @end #endif /* JSZVCRPlayerDelegate_h */
jzucker2/JSZVCR
JSZVCR/Classes/Player/JSZVCRPlayerDelegate.h
C
mit
1,290
[ 30522, 1013, 1013, 1013, 1013, 1046, 17112, 25465, 14536, 24314, 9247, 29107, 2618, 1012, 1044, 1013, 1013, 26723, 1013, 1013, 1013, 1013, 2580, 2011, 5207, 16950, 9102, 2006, 1015, 1013, 2340, 1013, 2385, 1012, 1013, 1013, 1013, 1013, 1001...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * 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 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "TotemAI.h" #include "Totem.h" #include "Creature.h" #include "ObjectAccessor.h" #include "SpellMgr.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" int TotemAI::Permissible(Creature const* creature) { if (creature->IsTotem()) return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_NO; } TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid() { ASSERT(c->IsTotem()); } void TotemAI::MoveInLineOfSight(Unit* /*who*/) { } void TotemAI::EnterEvadeMode() { me->CombatStop(true); } void TotemAI::UpdateAI(uint32 /*diff*/) { if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->IsAlive() || me->IsNonMeleeSpellCast(false)) return; // Search spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell()); if (!spellInfo) return; // Get spell range float max_range = spellInfo->GetMaxRange(false); // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems // pointer to appropriate target if found any Unit* victim = !i_victimGuid.IsEmpty() ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || !victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim)) { victim = NULL; Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check); me->VisitNearbyObject(max_range, checker); } // If have target if (victim) { // remember i_victimGuid = victim->GetGUID(); // attack me->SetInFront(victim); // client change orientation by self me->CastSpell(victim, me->ToTotem()->GetSpell(), false); } else i_victimGuid.Clear(); } void TotemAI::AttackStart(Unit* /*victim*/) { }
Luis-Gomez/TrinityCore
src/server/game/AI/CoreAI/TotemAI.cpp
C++
gpl-2.0
2,935
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2263, 1011, 2355, 7124, 17345, 1026, 8299, 1024, 1013, 1013, 7479, 1012, 7124, 17345, 1012, 8917, 1013, 1028, 1008, 9385, 1006, 1039, 1007, 2384, 1011, 2268, 24792, 2015, 1026, 8299, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Package mdns provides node discovery via mDNS. package mdns import ( "fmt" "io/ioutil" "log" "net" "strconv" "time" m "github.com/hashicorp/mdns" ) // Provider implements the Provider interface. type Provider struct{} // Help returns help information for the mDNS package. func (p *Provider) Help() string { return `mDNS: provider: "mdns" service: The mDNS service name. domain: The mDNS discovery domain. Default "local". timeout: The mDNS lookup timeout. Default "5s" (five seconds). v6: IPv6 will be allowed and preferred when set to "true" and disabled when set to "false". Default "true". v4: IPv4 will be allowed when set to "true" and disabled when set to "false". Default "true". ` } // Addrs returns discovered addresses for the mDNS package. func (p *Provider) Addrs(args map[string]string, l *log.Logger) ([]string, error) { var params *m.QueryParam var ch chan *m.ServiceEntry var v6, v4 bool var addrs []string var err error // default to null logger if l == nil { l = log.New(ioutil.Discard, "", 0) } // init params params = new(m.QueryParam) // validate and set service record if args["service"] == "" { return nil, fmt.Errorf("discover-mdns: Service record not provided." + " Please specify a service record for the mDNS lookup.") } params.Service = args["service"] // validate and set domain if args["domain"] != "" { params.Domain = args["domain"] } else { params.Domain = "local" } // validate and set timeout if args["timeout"] != "" { if params.Timeout, err = time.ParseDuration(args["timeout"]); err != nil { return nil, fmt.Errorf("discover-mdns: Failed to parse timeout: %s", err) } } else { params.Timeout = 5 * time.Second } // validate and set v6 toggle if args["v6"] != "" { if v6, err = strconv.ParseBool(args["v6"]); err != nil { return nil, fmt.Errorf("discover-mdns: Failed to parse v6: %s", err) } } else { v6 = true } // validate and set v4 toggle if args["v4"] != "" { if v4, err = strconv.ParseBool(args["v4"]); err != nil { return nil, fmt.Errorf("discover-mdns: Failed to parse v4: %s", err) } } else { v4 = true } // init entries channel ch = make(chan *m.ServiceEntry) defer close(ch) params.Entries = ch // build addresses go func() { var addr string for e := range ch { addr = "" // reset addr each loop if v6 && e.AddrV6 != nil { addr = net.JoinHostPort(e.AddrV6.String(), strconv.Itoa(e.Port)) } if addr == "" && v4 && e.AddrV4 != nil { addr = net.JoinHostPort(e.AddrV4.String(), strconv.Itoa(e.Port)) } if addr != "" { l.Printf("[DEBUG] discover-mdns: %s -> %s", e.Host, addr) // build address list addrs = append(addrs, addr) } } }() // lookup and return return addrs, m.Query(params) }
42wim/consul
vendor/github.com/hashicorp/go-discover/provider/mdns/mdns_provider.go
GO
mpl-2.0
2,944
[ 30522, 1013, 1013, 7427, 9108, 3619, 3640, 13045, 5456, 3081, 9108, 3619, 1012, 7427, 9108, 3619, 12324, 1006, 1000, 4718, 2102, 1000, 1000, 22834, 1013, 22834, 21823, 2140, 1000, 1000, 8833, 1000, 1000, 5658, 1000, 1000, 2358, 29566, 2078,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (c) Citrix Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ using System; using System.ComponentModel; using System.Windows.Forms; using XenAdmin.Network; using XenAdmin.Core; using XenAPI; namespace XenAdmin.Controls { public partial class PoolHostPicker : CustomTreeView { public EventHandler<SelectedItemEventArgs> SelectedItemChanged; public bool SupressErrors = false; public PoolHostPicker() { InitializeComponent(); CollectionChangedWithInvoke = Program.ProgramInvokeHandler(CollectionChanged); ShowCheckboxes = false; ShowDescription = true; ShowImages = true; buildList(); ConnectionsManager.XenConnections.CollectionChanged += CollectionChanged; } public override int ItemHeight { get { return 18; } } private CollectionChangeEventHandler CollectionChangedWithInvoke; void CollectionChanged(object sender, CollectionChangeEventArgs e) { Program.BeginInvoke(this, buildList); } void PropertyChanged(object sender, PropertyChangedEventArgs e) { if(e.PropertyName == "name_label" || e.PropertyName == "metrics" || e.PropertyName == "enabled" || e.PropertyName == "live" || e.PropertyName == "patches") Program.Invoke(this, buildList); } public void buildList() { Program.AssertOnEventThread(); Host selectedhost = null; IXenConnection selectedconnection = null; if (SelectedItem != null) { if (SelectedItem is HostItem) { selectedhost = (SelectedItem as HostItem).TheHost; } else if (SelectedItem is PoolItem) { selectedconnection = (SelectedItem as PoolItem).Connection; } } BeginUpdate(); try { ClearAllNodes(); foreach (IXenConnection xc in ConnectionsManager.XenConnectionsCopy) { if (Helpers.GetPool(xc) != null) { PoolItem item = new PoolItem(xc); if (SupressErrors) { item.Enabled = false; item.Description = ""; } AddNode(item); foreach (Host host in xc.Cache.Hosts) { HostItem item2 = new HostItem(host); if (SupressErrors) { item2.Enabled = host.IsLive(); item2.Description = ""; } AddChildNode(item, item2); host.PropertyChanged -= PropertyChanged; host.PropertyChanged += PropertyChanged; } } else if (xc.IsConnected) { Host host = Helpers.GetCoordinator(xc); if (host != null) { HostItem item = new HostItem(host); if (SupressErrors) { item.Enabled = host.IsLive(); item.Description = ""; } AddNode(item); host.PropertyChanged -= PropertyChanged; host.PropertyChanged += PropertyChanged; } else { PoolItem item = new PoolItem(xc); if (SupressErrors) { item.Enabled = false; item.Description = ""; } AddNode(item); } } else { PoolItem item = new PoolItem(xc); if (SupressErrors) { item.Enabled = false; item.Description = ""; } AddNode(item); } Pool pool = Helpers.GetPoolOfOne(xc); if (pool != null) { pool.PropertyChanged -= PropertyChanged; pool.PropertyChanged += PropertyChanged; } xc.ConnectionStateChanged -= xc_ConnectionStateChanged; xc.ConnectionStateChanged += xc_ConnectionStateChanged; xc.CachePopulated -= xc_CachePopulated; xc.CachePopulated += xc_CachePopulated; xc.Cache.RegisterCollectionChanged<Host>(CollectionChangedWithInvoke); } } finally { EndUpdate(); if (selectedhost != null) SelectHost(selectedhost); else if (selectedconnection != null) SelectConnection(selectedconnection); else if (SelectedItemChanged != null) SelectedItemChanged(null, new SelectedItemEventArgs(false)); } } void xc_CachePopulated(IXenConnection conn) { Program.Invoke(this, buildList); } void xc_ConnectionStateChanged(IXenConnection conn) { Program.Invoke(this, buildList); } private void UnregisterHandlers() { ConnectionsManager.XenConnections.CollectionChanged -= CollectionChanged; foreach (IXenConnection xc in ConnectionsManager.XenConnectionsCopy) { Pool pool = Helpers.GetPoolOfOne(xc); if (pool != null) pool.PropertyChanged -= PropertyChanged; foreach (Host host in xc.Cache.Hosts) host.PropertyChanged -= PropertyChanged; xc.ConnectionStateChanged -= xc_ConnectionStateChanged; xc.CachePopulated -= xc_CachePopulated; xc.Cache.DeregisterCollectionChanged<Host>(CollectionChangedWithInvoke); } } private CustomTreeNode lastSelected; public bool AllowPoolSelect = true; protected override void OnSelectedIndexChanged(EventArgs e) { if (SelectedItem is CustomTreeNode) { CustomTreeNode item = SelectedItem as CustomTreeNode; if (!item.Enabled) { SelectedItem = lastSelected; } if (!AllowPoolSelect && item is PoolItem) { SelectedItem = lastSelected; } } lastSelected = SelectedItem as CustomTreeNode; base.OnSelectedIndexChanged(e); if(SelectedItemChanged != null) SelectedItemChanged(null,new SelectedItemEventArgs((SelectedItem is PoolItem || SelectedItem is HostItem) && (SelectedItem as CustomTreeNode).Enabled)); } private bool SelectNextEnabledNode(CustomTreeNode currentNode, bool searchForward) { CustomTreeNode nextEnabledNode = GetNextEnabledNode(currentNode, searchForward); if (nextEnabledNode != null) { SelectedItem = nextEnabledNode; return true; } return false; } protected override void OnKeyDown(KeyEventArgs e) { var node = SelectedItem as CustomTreeNode; if (node != null) { switch (e.KeyCode) { case Keys.Down: { e.Handled = SelectNextEnabledNode(node, true); break; } case Keys.Up: { e.Handled = SelectNextEnabledNode(node, false); break; } } } base.OnKeyDown(e); } public IXenConnection ChosenConnection { get { if (SelectedItem == null || SelectedItem is HostItem || !(SelectedItem as CustomTreeNode).Enabled) return null; return (SelectedItem as PoolItem).Connection; } } public Host ChosenHost { get { if (SelectedItem == null || SelectedItem is PoolItem || !(SelectedItem as CustomTreeNode).Enabled) return null; return (SelectedItem as HostItem).TheHost; } } public void SelectHost(Host host) { if (host == null) { return; } foreach (CustomTreeNode item in Items) { if (TryToSelectHost(item, host)) return; if (item is PoolItem) { foreach (CustomTreeNode childItem in item.ChildNodes) { if (TryToSelectHost(childItem, host)) return; } } } OnSelectedIndexChanged(null); } /// <summary> /// Tries to select the node if it is a host item. If it is a host item, but is disabled, selects its parent instead. /// </summary> /// <param name="item"></param> /// <param name="host"></param> /// <returns>True if successful</returns> private bool TryToSelectHost(CustomTreeNode item, Host host) { if (item is HostItem) { HostItem hostitem = item as HostItem; if (hostitem.TheHost.opaque_ref == host.opaque_ref) { if (hostitem.Enabled) { SelectedItem = hostitem; return true; } else if (hostitem.ParentNode is PoolItem) { SelectConnection(host.Connection); return true; } } } return false; } public void SelectConnection(IXenConnection xenConnection) { foreach (CustomTreeNode item in Items) { if (item is PoolItem) { PoolItem poolitem = item as PoolItem; if (poolitem.Connection.Equals(xenConnection)) { SelectedItem = poolitem; return; } } } OnSelectedIndexChanged(null); } internal void SelectFirstThing() { for (int i = 0; i < Items.Count; i++) { if (Items[i] is CustomTreeNode && (Items[i] as CustomTreeNode).Enabled) { if (!AllowPoolSelect && Items[i] is PoolItem) continue; SelectedIndex = i; return; } } } } public class PoolItem : CustomTreeNode { public IXenConnection Connection; public PoolItem(IXenConnection xc) { Connection = xc; Update(); } public void Update() { this.Image = Images.GetImage16For(Connection); this.Text = Helpers.GetName(Connection); this.Enabled = Connection.IsConnected && (Helpers.GetPool(Connection) == null || Helpers.HasFullyConnectedSharedStorage(Connection)); if (Enabled) this.Description = ""; else if (!Connection.IsConnected) this.Description = Messages.DISCONNECTED; else this.Description = Messages.POOL_HAS_NO_SHARED_STORAGE; } protected override int SameLevelSortOrder(CustomTreeNode other) { if (Enabled && !other.Enabled) return -1; else if (!Enabled && other.Enabled) return 1; else return base.SameLevelSortOrder(other); } } public class HostItem : CustomTreeNode { public Host TheHost; public HostItem(Host host) { TheHost = host; Update(); } public void Update() { this.Image = Images.GetImage16For(TheHost); this.Text = Helpers.GetName(TheHost); bool isLiveHost = TheHost.IsLive(); this.Enabled = isLiveHost && CanCreateVMsWithAffinityTo(TheHost); if (Enabled) this.Description = ""; else if (!isLiveHost) this.Description = Messages.HOST_NOT_LIVE; else this.Description = Messages.HOST_SEES_NO_STORAGE; } protected override int SameLevelSortOrder(CustomTreeNode other) { if (Enabled && !other.Enabled) return -1; else if (!Enabled && other.Enabled) return 1; else if (Enabled && other.Enabled && other is HostItem) return TheHost.CompareTo(((HostItem)other).TheHost); else return base.SameLevelSortOrder(other); } private static bool CanCreateVMsWithAffinityTo(Host TheHost) { if (Helpers.HasFullyConnectedSharedStorage(TheHost.Connection)) return true; else { foreach (SR sr in TheHost.Connection.Cache.SRs) { if (sr.CanBeSeenFrom(TheHost) && sr.SupportsVdiCreate() && !sr.IsBroken(false) && !sr.IsFull()) return true; } } return false; } } public class SelectedItemEventArgs : EventArgs { public bool SomethingSelected; public SelectedItemEventArgs(bool notnull) { SomethingSelected = notnull; } } }
xenserver/xenadmin
XenAdmin/Controls/PoolHostPicker.cs
C#
bsd-2-clause
16,719
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 25022, 29184, 3001, 1010, 4297, 1012, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 1008, 2007, 2030, 2302, 14080, 1010, 2024, 7936, 3024, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\FrameworkBundle\Tests\Kernel; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; require_once __DIR__.'/flex-style/src/FlexStyleMicroKernel.php'; class MicroKernelTraitTest extends TestCase { private $kernel; protected function tearDown(): void { if ($this->kernel) { $kernel = $this->kernel; $this->kernel = null; $fs = new Filesystem(); $fs->remove($kernel->getCacheDir()); } } public function test() { $kernel = $this->kernel = new ConcreteMicroKernel('test', false); $kernel->boot(); $request = Request::create('/'); $response = $kernel->handle($request); $this->assertEquals('halloween', $response->getContent()); $this->assertEquals('Have a great day!', $kernel->getContainer()->getParameter('halloween')); $this->assertInstanceOf('stdClass', $kernel->getContainer()->get('halloween')); } public function testAsEventSubscriber() { $kernel = $this->kernel = new ConcreteMicroKernel('test', false); $kernel->boot(); $request = Request::create('/danger'); $response = $kernel->handle($request); $this->assertSame('It\'s dangerous to go alone. Take this ⚔', $response->getContent()); } public function testRoutingRouteLoaderTagIsAdded() { $frameworkExtension = $this->createMock(ExtensionInterface::class); $frameworkExtension ->expects($this->atLeastOnce()) ->method('getAlias') ->willReturn('framework'); $container = new ContainerBuilder(); $container->registerExtension($frameworkExtension); $kernel = $this->kernel = new ConcreteMicroKernel('test', false); $kernel->registerContainerConfiguration(new ClosureLoader($container)); $this->assertTrue($container->getDefinition('kernel')->hasTag('routing.route_loader')); } public function testFlexStyle() { $kernel = new FlexStyleMicroKernel('test', false); $kernel->boot(); $request = Request::create('/'); $response = $kernel->handle($request); $this->assertEquals('Have a great day!', $response->getContent()); } public function testSecretLoadedFromExtension() { $kernel = $this->kernel = new ConcreteMicroKernel('test', false); $kernel->boot(); self::assertSame('$ecret', $kernel->getContainer()->getParameter('kernel.secret')); } public function testAnonymousMicroKernel() { $kernel = new class('anonymous_kernel') extends MinimalKernel { public function helloAction(): Response { return new Response('Hello World!'); } protected function configureContainer(ContainerConfigurator $c): void { $c->extension('framework', [ 'router' => ['utf8' => true], ]); $c->services()->set('logger', NullLogger::class); } protected function configureRoutes(RoutingConfigurator $routes): void { $routes->add('hello', '/')->controller([$this, 'helloAction']); } }; $request = Request::create('/'); $response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false); $this->assertSame('Hello World!', $response->getContent()); } public function testMissingConfigureContainer() { $kernel = new class('missing_configure_container') extends MinimalKernel { protected function configureRoutes(RoutingConfigurator $routes): void { } }; $this->expectException(\LogicException::class); $this->expectExceptionMessage('"Symfony\Bundle\FrameworkBundle\Tests\Kernel\MinimalKernel@anonymous" uses "Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait", but does not implement the required method "protected function configureContainer(ContainerConfigurator $c): void".'); $kernel->boot(); } public function testMissingConfigureRoutes() { $kernel = new class('missing_configure_routes') extends MinimalKernel { protected function configureContainer(ContainerConfigurator $c): void { $c->extension('framework', [ 'router' => ['utf8' => true], ]); } }; $this->expectException(\LogicException::class); $this->expectExceptionMessage('"Symfony\Bundle\FrameworkBundle\Tests\Kernel\MinimalKernel@anonymous" uses "Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait", but does not implement the required method "protected function configureRoutes(RoutingConfigurator $routes): void".'); $request = Request::create('/'); $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false); } } abstract class MinimalKernel extends Kernel { use MicroKernelTrait; private $cacheDir; public function __construct(string $cacheDir) { parent::__construct('test', false); $this->cacheDir = sys_get_temp_dir().'/'.$cacheDir; } public function registerBundles(): iterable { yield new FrameworkBundle(); } public function getCacheDir(): string { return $this->cacheDir; } public function getLogDir(): string { return $this->cacheDir; } }
gonzalovilaseca/symfony
src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php
PHP
mit
6,453
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 25353, 2213, 14876, 4890, 7427, 1012, 1008, 1008, 1006, 1039, 1007, 6904, 11283, 2078, 8962, 2368, 19562, 1026, 6904, 11283, 2078, 1030, 25353, 2213, 14876, 489...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// SPDX-License-Identifier: GPL-2.0 // // Exemples de la formation // "Ecriture de drivers et programmation noyau Linux" // Chapitre "Driver en mode caracteres" // // (c) 2001-2022 Christophe Blaess // // https://www.logilin.fr/ // #include <linux/cdev.h> #include <linux/device.h> #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/uaccess.h> #include <linux/version.h> #include <asm/uaccess.h> #include "example-IV-06.h" static int example_ppid_flag = 1; static ssize_t example_read(struct file *filp, char *u_buffer, size_t length, loff_t *offset) { char k_buffer[128]; int l; if (example_ppid_flag) snprintf(k_buffer, 128, "PID= %u, PPID= %u\n", current->pid, current->real_parent->pid); else snprintf(k_buffer, 128, "PID= %u\n", current->pid); l = strlen(k_buffer) - (*offset); if (l <= 0) return 0; if (length < l) l = length; if (copy_to_user(u_buffer, &k_buffer[*offset], l) != 0) return -EFAULT; *offset += l; return l; } static long example_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { if (_IOC_TYPE(cmd) != EXAMPLE_IOCTL_MAGIC) return -ENOTTY; switch (_IOC_NR(cmd)) { case EXAMPLE_GET_PPID_FLAG: if (copy_to_user((void *) arg, &example_ppid_flag, sizeof(example_ppid_flag)) != 0) return -EFAULT; break; case EXAMPLE_SET_PPID_FLAG: if (copy_from_user(&example_ppid_flag, (void *) arg, sizeof(example_ppid_flag)) != 0) return -EFAULT; break; default: return -ENOTTY; } return 0; } static const struct file_operations example_fops = { .owner = THIS_MODULE, .read = example_read, .unlocked_ioctl = example_ioctl, }; static struct miscdevice example_misc_driver = { .minor = MISC_DYNAMIC_MINOR, .name = THIS_MODULE->name, .fops = &example_fops, .mode = 0666, }; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) module_misc_device(example_misc_driver); #else module_driver(example_misc_driver, misc_register, misc_deregister) #endif MODULE_DESCRIPTION("ioctl() system call implementation."); MODULE_AUTHOR("Christophe Blaess <Christophe.Blaess@Logilin.fr>"); MODULE_LICENSE("GPL v2");
Logilin/ild
exemples/04-driver-caracteres/example-IV-06.c
C
gpl-2.0
2,215
[ 30522, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1016, 1012, 1014, 1013, 1013, 1013, 1013, 4654, 6633, 21112, 2139, 2474, 4195, 1013, 1013, 1000, 14925, 14778, 5397, 2139, 6853, 3802, 2565, 28649...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Volutella occidentalis Ellis & H.W. Anderson SPECIES #### Status ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Volutella occidentalis Ellis & H.W. Anderson ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Sordariomycetes/Hypocreales/Nectriaceae/Volutella/Volutella occidentalis/README.md
Markdown
apache-2.0
217
[ 30522, 1001, 5285, 10421, 4571, 1051, 14693, 16454, 13911, 8547, 1004, 1044, 1012, 1059, 1012, 5143, 2427, 1001, 30524, 1051, 14693, 16454, 13911, 8547, 1004, 1044, 1012, 1059, 1012, 5143, 1001, 1001, 1001, 12629, 19701, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>InteractiveGrid</title> <script type="text/javascript" src="/apps/2.0rc3/sdk.js"></script> <script type="text/javascript"> Rally.onReady(function () { Ext.define('CustomApp', { extend: 'Rally.app.App', componentCls: 'app', items:{ html:'<a href="https://help.rallydev.com/apps/2.0rc3/doc/">App SDK 2.0rc3 Docs</a>'}, launch: function() { //Write app code here } }); Rally.launchApp('CustomApp', { name:"InteractiveGrid", parentRepos:"" }); }); </script> <style type="text/css"> .app { /* Add app styles here */ } </style> </head> <body></body> </html>
edorsett/InteractiveGrid
deploy/App-uncompressed.html
HTML
mit
744
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 9123, 16523, 3593, 1026, 1013, 2516, 1028, 1026, 5896, 2828, 1027, 1000, 3793, 1013, 9262, 22483, 1000, 5034, 2278, 1027, 1000, 1013, 18726, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.apache.jackrabbit.oak.security.user.monitor; import org.apache.jackrabbit.oak.stats.MeterStats; import org.apache.jackrabbit.oak.stats.StatisticsProvider; import org.apache.jackrabbit.oak.stats.StatsOptions; import org.apache.jackrabbit.oak.stats.TimerStats; import static java.util.concurrent.TimeUnit.NANOSECONDS; public class UserMonitorImpl implements UserMonitor { private static final String ADD_MEMBERS_FAILED = "security.user.add_members.failed"; private static final String ADD_MEMBERS_SUCCEEDED = "security.user.add_members.succeeded"; private static final String ADD_MEMBERS_TIMER = "security.user.add_members.timer"; private static final String REMOVE_MEMBERS_FAILED = "security.user.remove_members.failed"; private static final String REMOVE_MEMBERS_SUCCEEDED = "security.user.remove_members.succeeded"; private static final String REMOVE_MEMBERS_TIMER = "security.user.remove_members.timer"; private static final String GET_MEMBERS_TIMER = "security.user.get_members.timer"; private static final String GET_DECLARED_MEMBERS_TIMER = "security.user.get_declared_members.timer"; private static final String MEMBEROF_TIMER = "security.user.memberof.timer"; private static final String DECLARED_MEMBEROF_TIMER = "security.user.declared_memberof.timer"; private final MeterStats addMembersFailed; private final MeterStats addMembersSucceeded; private final TimerStats addMembersTimer; private final MeterStats removeMembersFailed; private final MeterStats removeMembersSucceeded; private final TimerStats removeMembersTimer; private final TimerStats getMembersTimer; private final TimerStats getDeclaredMembersTimer; private final TimerStats memberOfTimer; private final TimerStats declaredMemberOfTimer; public UserMonitorImpl(StatisticsProvider statisticsProvider) { addMembersFailed = statisticsProvider.getMeter(ADD_MEMBERS_FAILED, StatsOptions.DEFAULT); addMembersSucceeded = statisticsProvider.getMeter(ADD_MEMBERS_SUCCEEDED, StatsOptions.DEFAULT); addMembersTimer = statisticsProvider.getTimer(ADD_MEMBERS_TIMER, StatsOptions.METRICS_ONLY); removeMembersFailed = statisticsProvider.getMeter(REMOVE_MEMBERS_FAILED, StatsOptions.DEFAULT); removeMembersSucceeded = statisticsProvider.getMeter(REMOVE_MEMBERS_SUCCEEDED, StatsOptions.DEFAULT); removeMembersTimer = statisticsProvider.getTimer(REMOVE_MEMBERS_TIMER, StatsOptions.METRICS_ONLY); getMembersTimer = statisticsProvider.getTimer(GET_MEMBERS_TIMER, StatsOptions.METRICS_ONLY); getDeclaredMembersTimer = statisticsProvider.getTimer(GET_DECLARED_MEMBERS_TIMER, StatsOptions.METRICS_ONLY); memberOfTimer = statisticsProvider.getTimer(MEMBEROF_TIMER, StatsOptions.METRICS_ONLY); declaredMemberOfTimer = statisticsProvider.getTimer(DECLARED_MEMBEROF_TIMER, StatsOptions.METRICS_ONLY); } @Override public void doneGetMembers(long timeTakenNanos, boolean declaredOnly) { if (declaredOnly) { getMembersTimer.update(timeTakenNanos, NANOSECONDS); } else { getDeclaredMembersTimer.update(timeTakenNanos, NANOSECONDS); } } @Override public void doneMemberOf(long timeTakenNanos, boolean declaredOnly) { if (declaredOnly) { declaredMemberOfTimer.update(timeTakenNanos, NANOSECONDS); } else { memberOfTimer.update(timeTakenNanos, NANOSECONDS); } } @Override public void doneUpdateMembers(long timeTakenNanos, long totalProcessed, long failed, boolean isRemove) { long successCnt = totalProcessed - failed; if (isRemove) { removeMembersFailed.mark(failed); removeMembersSucceeded.mark(successCnt); removeMembersTimer.update(timeTakenNanos, NANOSECONDS); } else { addMembersFailed.mark(failed); addMembersSucceeded.mark(successCnt); addMembersTimer.update(timeTakenNanos, NANOSECONDS); } } }
anchela/jackrabbit-oak
oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/monitor/UserMonitorImpl.java
Java
apache-2.0
4,084
[ 30522, 7427, 8917, 1012, 15895, 1012, 2990, 2527, 10322, 4183, 1012, 6116, 1012, 3036, 1012, 5310, 1012, 8080, 1025, 12324, 8917, 1012, 15895, 1012, 2990, 2527, 10322, 4183, 1012, 6116, 1012, 26319, 1012, 5563, 29336, 2015, 1025, 12324, 891...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class Tinyumbrella < Cask version '7.04' sha256 '2ce5ea70bbdf216aaff9fc30c1a33a58a6fc19a5ad5e4f0029aafae61c622db1' url 'http://cache.firmwareumbrella.com/downloads/TinyUmbrella-7.04.00.app.zip' homepage 'http://blog.firmwareumbrella.com/' link 'TinyUmbrella.app' end
flesch/homebrew-cask
Casks/tinyumbrella.rb
Ruby
bsd-2-clause
279
[ 30522, 2465, 4714, 25438, 21835, 1026, 25222, 2243, 2544, 1005, 1021, 1012, 5840, 1005, 21146, 17788, 2575, 1005, 1016, 3401, 2629, 5243, 19841, 10322, 20952, 17465, 2575, 11057, 4246, 2683, 11329, 14142, 2278, 2487, 2050, 22394, 2050, 27814,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.execution.junit; import com.intellij.openapi.roots.ExternalLibraryDescriptor; /** * @author nik */ public class JUnitExternalLibraryDescriptor extends ExternalLibraryDescriptor { public static final ExternalLibraryDescriptor JUNIT3 = new JUnitExternalLibraryDescriptor("3", "3.8.2"); public static final ExternalLibraryDescriptor JUNIT4 = new JUnitExternalLibraryDescriptor("4", "4.12"); public static final ExternalLibraryDescriptor JUNIT5 = new JUnitExternalLibraryDescriptor("org.junit.jupiter", "junit-jupiter-api", "5.2", null); private final String myVersion; private JUnitExternalLibraryDescriptor(String baseVersion, String preferredVersion) { this("junit", "junit", baseVersion, preferredVersion); } private JUnitExternalLibraryDescriptor(final String groupId, final String artifactId, final String version, String preferredVersion) { super(groupId, artifactId, version + ".0", version + ".999", preferredVersion); myVersion = version; } @Override public String getPresentableName() { return "JUnit" + myVersion; } }
goodwinnk/intellij-community
plugins/junit/src/com/intellij/execution/junit/JUnitExternalLibraryDescriptor.java
Java
apache-2.0
1,908
[ 30522, 1013, 1008, 1008, 9385, 2456, 1011, 2325, 6892, 10024, 7076, 1055, 1012, 1054, 1012, 1051, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Directus\Installation\Steps; use Directus\Bootstrap; class LanguageStep extends AbstractStep { protected $number = 1; protected $name = 'language'; protected $title = 'Language'; protected $shortTitle = 'Language'; protected $viewName = 'language.twig'; protected $fields = [ [ 'name' => 'default_language', 'label' => 'Default Language', 'rules' => 'required' ] ]; public function preRun(&$state) { $this->dataContainer->set('languages', Bootstrap::get('languagesManager')->getLanguagesAvailable()); return null; } public function run($formData, $step, &$state) { $response = parent::run($formData, $step, $state); $_SESSION['install_locale'] = $response->getData('lang_code'); return $response; } }
Sonans/directus
installation/includes/Steps/LanguageStep.php
PHP
gpl-3.0
869
[ 30522, 1026, 1029, 25718, 3415, 15327, 3622, 2271, 1032, 8272, 1032, 4084, 1025, 2224, 3622, 2271, 1032, 6879, 6494, 2361, 1025, 2465, 4155, 2618, 2361, 8908, 29474, 2618, 2361, 1063, 5123, 1002, 2193, 1027, 1015, 1025, 5123, 1002, 2171, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // displays the settings tab in Polylang settings $content_with_no_languages = $this->model->get_objects_with_no_lang() && $this->options['default_lang']; $page_on_front = 'page' == get_option('show_on_front') ? get_option('page_on_front') : 0; ?> <form id="options-lang" method="post" action="admin.php?page=mlang&amp;tab=settings&amp;noheader=true" class="validate"> <?php wp_nonce_field('options-lang', '_wpnonce_options-lang');?> <input type="hidden" name="pll_action" value="options" /> <table class="form-table"> <tr> <th <?php echo $content_with_no_languages ? 'rowspan=2' : ''; ?>> <label for='default_lang'><?php _e('Default language', 'polylang');?></label> </th> <td><?php $dropdown = new PLL_Walker_Dropdown; echo $dropdown->walk($listlanguages, array('name' => 'default_lang', 'selected' => $this->options['default_lang']));?> </td> </tr><?php // posts or terms without language set if ($content_with_no_languages) {?> <tr> <td> <label style="color: red"><?php printf( '<input name="fill_languages" type="checkbox" value="1" /> %s', __('There are posts, pages, categories or tags without language set. Do you want to set them all to default language ?', 'polylang') );?> </label> </td> </tr><?php }?> <tr> <th rowspan = <?php echo ($page_on_front ? 3 : 2) + $this->links_model->using_permalinks; ?>><?php _e('URL modifications', 'polylang') ?></th> <td><fieldset id='pll-force-lang'> <label><?php printf( '<input name="force_lang" type="radio" value="0" %s /> %s', $this->options['force_lang'] ? '' : 'checked="checked"', __('The language is set from content', 'polylang') );?> </label> <p class="description"><?php _e('Posts, pages, categories and tags urls are not modified.', 'polylang');?></p> <label><?php printf( '<input name="force_lang" type="radio" value="1" %s/> %s', 1 == $this->options['force_lang'] ? 'checked="checked"' : '', $this->links_model->using_permalinks ? __('The language is set from the directory name in pretty permalinks', 'polylang') : __('The language is set from the code in the URL', 'polylang') );?> </label> <p class="description"><?php echo __('Example:', 'polylang') . ' <code>'.esc_html(home_url($this->links_model->using_permalinks ? 'en/my-post/' : '?lang=en&p=1')).'</code>';?></p> <label><?php printf( '<input name="force_lang" type="radio" value="2" %s %s/> %s', $this->links_model->using_permalinks ? '' : 'disabled="disabled"', 2 == $this->options['force_lang'] ? 'checked="checked"' : '', __('The language is set from the subdomain name in pretty permalinks', 'polylang') );?> </label> <p class="description"><?php echo __('Example:', 'polylang') . ' <code>'.esc_html(str_replace(array('://', 'www.'), array('://en.', ''), home_url('my-post/'))).'</code>';?></p> <label><?php printf( '<input name="force_lang" type="radio" value="3" %s %s/> %s', $this->links_model->using_permalinks ? '' : 'disabled="disabled"', 3 == $this->options['force_lang'] ? 'checked="checked"' : '', __('The language is set from different domains', 'polylang') );?> </label> <table id="pll-domains-table" <?php echo 3 == $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>><?php foreach ($listlanguages as $lg) { printf( '<tr><td><label for="pll-domain[%1$s]">%2$s</label></td>' . '<td><input name="domains[%1$s]" id="pll-domain[%1$s]" type="text" value="%3$s" size="40" aria-required="true" /></td></tr>', esc_attr($lg->slug), esc_attr($lg->name), esc_url(isset($this->options['domains'][$lg->slug]) ? $this->options['domains'][$lg->slug] : ($lg->slug == $this->options['default_lang'] ? $this->links_model->home : '')) ); }?> </table> </fieldset></td> </tr> <tr> <td id="pll-hide-default" <?php echo 3 > $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>><fieldset> <label><?php printf( '<input name="hide_default" type="checkbox" value="1" %s /> %s', $this->options['hide_default'] ? 'checked="checked"' :'', __('Hide URL language information for default language', 'polylang') );?> </label> </fieldset></td> </tr><?php if ($this->links_model->using_permalinks) { ?> <tr> <td id="pll-rewrite" <?php echo 2 > $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>><fieldset> <label><?php printf( '<input name="rewrite" type="radio" value="1" %s %s/> %s', $this->links_model->using_permalinks ? '' : 'disabled="disabled"', $this->options['rewrite'] ? 'checked="checked"' : '', __('Remove /language/ in pretty permalinks', 'polylang') );?> </label> <p class="description"><?php echo __('Example:', 'polylang') . ' <code>'.esc_html(home_url('en/')).'</code>';?></p> <label><?php printf( '<input name="rewrite" type="radio" value="0" %s %s/> %s', $this->links_model->using_permalinks ? '' : 'disabled="disabled"', $this->options['rewrite'] ? '' : 'checked="checked"', __('Keep /language/ in pretty permalinks', 'polylang') );?> </label> <p class="description"><?php echo __('Example:', 'polylang') . ' <code>'.esc_html(home_url('language/en/')).'</code>';?></p> </fieldset></td> </tr><?php } if ($page_on_front) { ?> <tr> <td><fieldset> <label><?php printf( '<input name="redirect_lang" type="checkbox" value="1" %s/> %s', $this->options['redirect_lang'] ? 'checked="checked"' :'', __('The front page url contains the language code instead of the page name or page id', 'polylang') );?> </label> <p class="description"><?php // that's nice to display the right home urls but don't forget that the page on front may have no language yet $lang = $this->model->get_post_language($page_on_front); $lang = $lang ? $lang : $this->model->get_language($this->options['default_lang']); printf( __('Example: %s instead of %s', 'polylang'), '<code>' . esc_html($this->links_model->home_url($lang)) . '</code>', '<code>' . esc_html(_get_page_link($page_on_front)) . '</code>' ); ?> </p> </fieldset></td> </tr><?php } ?> <tr id="pll-detect-browser" <?php echo 3 > $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>> <th><?php _e('Detect browser language', 'polylang');?></th> <td> <label><?php printf( '<input name="browser" type="checkbox" value="1" %s /> %s', $this->options['browser'] ? 'checked="checked"' :'', __('When the front page is visited, set the language according to the browser preference', 'polylang') );?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Media', 'polylang') ?></th> <td> <label><?php printf( '<input name="media_support" type="checkbox" value="1" %s /> %s', $this->options['media_support'] ? 'checked="checked"' :'', __('Activate languages and translations for media', 'polylang') );?> </label> </td> </tr><?php if (!empty($post_types)) {?> <tr> <th scope="row"><?php _e('Custom post types', 'polylang') ?></th> <td> <ul class="pll_inline_block"><?php foreach ($post_types as $post_type) { $pt = get_post_type_object($post_type); printf( '<li><label><input name="post_types[%s]" type="checkbox" value="1" %s /> %s</label></li>', esc_attr($post_type), in_array($post_type, $this->options['post_types']) ? 'checked="checked"' :'', esc_html($pt->labels->name) ); }?> </ul> <p class="description"><?php _e('Activate languages and translations for custom post types.', 'polylang');?></p> </td> </tr><?php } if (!empty($taxonomies)) {?> <tr> <th scope="row"><?php _e('Custom taxonomies', 'polylang') ?></th> <td> <ul class="pll_inline_block"><?php foreach ($taxonomies as $taxonomy) { $tax = get_taxonomy($taxonomy); printf( '<li><label><input name="taxonomies[%s]" type="checkbox" value="1" %s /> %s</label></li>', esc_attr($taxonomy), in_array($taxonomy, $this->options['taxonomies']) ? 'checked="checked"' :'', esc_html($tax->labels->name) ); }?> </ul> <p class="description"><?php _e('Activate languages and translations for custom taxonomies.', 'polylang');?></p> </td> </tr><?php }?> <tr> <th scope="row"><?php _e('Synchronization', 'polylang') ?></th> <td> <ul class="pll_inline_block"><?php foreach (self::list_metas_to_sync() as $key => $str) printf( '<li><label><input name="sync[%s]" type="checkbox" value="1" %s /> %s</label></li>', esc_attr($key), in_array($key, $this->options['sync']) ? 'checked="checked"' :'', esc_html($str) );?> </ul> <p class="description"><?php _e('The synchronization options allow to maintain exact same values (or translations in the case of taxonomies and page parent) of meta content between the translations of a post or page.', 'polylang');?></p> </td> </tr> </table> <?php submit_button(); // since WP 3.1 ?> </form>
akashprabhakar/finance-house
wp-content/plugins/polylang/admin/view-tab-settings.php
PHP
gpl-2.0
9,177
[ 30522, 1026, 1029, 25718, 1013, 1013, 8834, 1996, 10906, 21628, 1999, 26572, 25023, 10906, 1002, 4180, 1035, 2007, 1035, 2053, 1035, 4155, 1027, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 2131, 1035, 5200, 1035, 2007, 1035, 2053, 1035, 11374...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2019_12_01 module Models # # A load balancer probe. # class Probe < SubResource include MsRestAzure # @return [Array<SubResource>] The load balancer rules that use this # probe. attr_accessor :load_balancing_rules # @return [ProbeProtocol] The protocol of the end point. If 'Tcp' is # specified, a received ACK is required for the probe to be successful. # If 'Http' or 'Https' is specified, a 200 OK response from the specifies # URI is required for the probe to be successful. Possible values # include: 'Http', 'Tcp', 'Https' attr_accessor :protocol # @return [Integer] The port for communicating the probe. Possible values # range from 1 to 65535, inclusive. attr_accessor :port # @return [Integer] The interval, in seconds, for how frequently to probe # the endpoint for health status. Typically, the interval is slightly # less than half the allocated timeout period (in seconds) which allows # two full probes before taking the instance out of rotation. The default # value is 15, the minimum value is 5. attr_accessor :interval_in_seconds # @return [Integer] The number of probes where if no response, will # result in stopping further traffic from being delivered to the # endpoint. This values allows endpoints to be taken out of rotation # faster or slower than the typical times used in Azure. attr_accessor :number_of_probes # @return [String] The URI used for requesting health status from the VM. # Path is required if a protocol is set to http. Otherwise, it is not # allowed. There is no default value. attr_accessor :request_path # @return [ProvisioningState] The provisioning state of the probe # resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', # 'Failed' attr_accessor :provisioning_state # @return [String] The name of the resource that is unique within the set # of probes used by the load balancer. This name can be used to access # the resource. attr_accessor :name # @return [String] A unique read-only string that changes whenever the # resource is updated. attr_accessor :etag # @return [String] Type of the resource. attr_accessor :type # # Mapper for Probe class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'Probe', type: { name: 'Composite', class_name: 'Probe', model_properties: { id: { client_side_validation: true, required: false, serialized_name: 'id', type: { name: 'String' } }, load_balancing_rules: { client_side_validation: true, required: false, read_only: true, serialized_name: 'properties.loadBalancingRules', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'SubResourceElementType', type: { name: 'Composite', class_name: 'SubResource' } } } }, protocol: { client_side_validation: true, required: true, serialized_name: 'properties.protocol', type: { name: 'String' } }, port: { client_side_validation: true, required: true, serialized_name: 'properties.port', type: { name: 'Number' } }, interval_in_seconds: { client_side_validation: true, required: false, serialized_name: 'properties.intervalInSeconds', type: { name: 'Number' } }, number_of_probes: { client_side_validation: true, required: false, serialized_name: 'properties.numberOfProbes', type: { name: 'Number' } }, request_path: { client_side_validation: true, required: false, serialized_name: 'properties.requestPath', type: { name: 'String' } }, provisioning_state: { client_side_validation: true, required: false, read_only: true, serialized_name: 'properties.provisioningState', type: { name: 'String' } }, name: { client_side_validation: true, required: false, serialized_name: 'name', type: { name: 'String' } }, etag: { client_side_validation: true, required: false, read_only: true, serialized_name: 'etag', type: { name: 'String' } }, type: { client_side_validation: true, required: false, read_only: true, serialized_name: 'type', type: { name: 'String' } } } } } end end end end
Azure/azure-sdk-for-ruby
management/azure_mgmt_network/lib/2019-12-01/generated/azure_mgmt_network/models/probe.rb
Ruby
mit
6,258
[ 30522, 1001, 17181, 1024, 21183, 2546, 1011, 1022, 1001, 3642, 7013, 2011, 7513, 1006, 1054, 1007, 8285, 28533, 3642, 13103, 1012, 1001, 3431, 2089, 3426, 16542, 5248, 1998, 2097, 2022, 2439, 2065, 1996, 3642, 30524, 1026, 4942, 6072, 8162,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Live media server object, represents a media server association with live stream entry * * @package Core * @subpackage model * */ class kLiveMediaServer { /** * @var int */ protected $mediaServerId; /** * @var int */ protected $index; /** * @var int */ protected $dc; /** * @var string */ protected $hostname; /** * @var int */ protected $time; /** * @var string */ protected $applicationName; public function __construct($index, $hostname, $dc = null, $id = null, $applicationName = null) { $this->index = $index; $this->mediaServerId = $id; $this->hostname = $hostname; $this->dc = $dc; $this->time = time(); $this->applicationName = $applicationName; } /** * @return int $mediaServerId */ public function getMediaServerId() { return $this->mediaServerId; } /** * @return MediaServerNode */ public function getMediaServer() { $mediaServer = ServerNodePeer::retrieveByPK($this->mediaServerId); if($mediaServer instanceof MediaServerNode) return $mediaServer; return null; } /** * @return int $index */ public function getIndex() { return $this->index; } /** * @return int $dc */ public function getDc() { return $this->dc; } /** * @return string $hostname */ public function getHostname() { return $this->hostname; } /** * @return int $time */ public function getTime() { return $this->time; } /** * @return the $applicationName */ public function getApplicationName() { return $this->applicationName; } }
doubleshot/server
alpha/lib/data/live/kLiveMediaServer.php
PHP
agpl-3.0
1,582
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 2444, 2865, 8241, 4874, 1010, 5836, 1037, 2865, 8241, 2523, 2007, 2444, 5460, 4443, 1008, 1008, 1030, 7427, 4563, 1008, 1030, 4942, 23947, 4270, 2944, 1008, 1008, 1013, 2465, 1047, 3669, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require "decoplan/algorithm" require "decoplan/dive_profile" module Decoplan class Algorithm class Buhlmann < Algorithm attr_accessor :lo attr_accessor :hi attr_accessor :compartments N2_HALF = [ 4.0, 5.0, 8.0, 12.5, 18.5, 27.0, 38.3, 54.3, 77.0, 109.0, 146.0, 187.0, 239.0, 305.0, 390.0, 498.0, 635.0 ] N2_A = [ 1.2599, 1.2599, 1.0000, 0.8618, 0.7562, 0.6667, 0.5600, 0.4947, 0.4500, 0.4187, 0.3798, 0.3497, 0.3223, 0.2971, 0.2737, 0.2523, 0.2327 ] N2_B = [ 0.5050, 0.5050, 0.6514, 0.7222, 0.7725, 0.8125, 0.8434, 0.8693, 0.8910, 0.9092, 0.9222, 0.9319, 0.9403, 0.9477, 0.9544, 0.9602, 0.9653 ] HE_HALF = [ 1.51, 1.88, 3.02, 4.72, 6.99, 10.21, 14.48, 20.53, 29.11, 41.20, 55.19, 70.69, 90.34, 115.29, 147.42, 188.24, 240.03 ] HE_A = [ 1.7424, 1.6189, 1.3830, 1.1919, 1.0458, 0.9220, 0.8205, 0.7305, 0.6502, 0.5950, 0.5545, 0.5333, 0.5189, 0.5181, 0.5176, 0.5172, 0.5119 ] HE_B = [ 0.4245, 0.4770, 0.5747, 0.6527, 0.7223, 0.7582, 0.7957, 0.8279, 0.8553, 0.8757, 0.8903, 0.8997, 0.9073, 0.9122, 0.9171, 0.9217, 0.9267 ] name :buhlmann, :zhl16b def initialize(profile, lo: 100, hi: 100) super @lo = lo @hi = hi end def compute reset_compartments! deco_profile = DiveProfile.new apply_profile(deco_profile) compute_deco(deco_profile) deco_profile end def reset_compartments! @compartments = (0..15).map { { n2: 0.79, he: 0.0 } } end private def apply_profile(deco_profile) profile.levels.each do |level| deco_profile.level level haldane_step(level) end end def haldane_step(level) @compartments = compartments.map.with_index do |p_inert, i| # FIXME: alveolar pressure { n2: haldane_equation(p_inert[:n2], level.depth * (1.0 - level.he - level.o2), N2_HALF[i], level.time), he: haldane_equation(p_inert[:he], level.depth * level.he, HE_HALF[i], level.time), } end end def compute_deco(deco_profile) deco_profile end end end end
lamont-granquist/decoplan
lib/decoplan/algorithm/buhlmann.rb
Ruby
apache-2.0
2,171
[ 30522, 5478, 1000, 21933, 24759, 2319, 1013, 9896, 1000, 5478, 1000, 21933, 24759, 2319, 1013, 11529, 1035, 6337, 1000, 11336, 21933, 24759, 2319, 2465, 9896, 2465, 20934, 7317, 5804, 1026, 9896, 2012, 16344, 1035, 3229, 2953, 1024, 8840, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python3 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test addressindex generation and fetching # import binascii from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut from test_framework.test_framework import BitcoinTestFramework from test_framework.test_node import ErrorMatch from test_framework.script import CScript, OP_CHECKSIG, OP_DUP, OP_EQUAL, OP_EQUALVERIFY, OP_HASH160 from test_framework.util import assert_equal, connect_nodes class AddressIndexTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 4 def skip_test_if_missing_module(self): self.skip_if_no_wallet() def setup_network(self): self.add_nodes(self.num_nodes) # Nodes 0/1 are "wallet" nodes self.start_node(0, []) self.start_node(1, ["-addressindex"]) # Nodes 2/3 are used for testing self.start_node(2, ["-addressindex"]) self.start_node(3, ["-addressindex"]) connect_nodes(self.nodes[0], 1) connect_nodes(self.nodes[0], 2) connect_nodes(self.nodes[0], 3) self.sync_all() def run_test(self): self.log.info("Test that settings can't be changed without -reindex...") self.stop_node(1) self.nodes[1].assert_start_raises_init_error(["-addressindex=0"], "You need to rebuild the database using -reindex to change -addressindex", match=ErrorMatch.PARTIAL_REGEX) self.start_node(1, ["-addressindex=0", "-reindex"]) connect_nodes(self.nodes[0], 1) self.sync_all() self.stop_node(1) self.nodes[1].assert_start_raises_init_error(["-addressindex"], "You need to rebuild the database using -reindex to change -addressindex", match=ErrorMatch.PARTIAL_REGEX) self.start_node(1, ["-addressindex", "-reindex"]) connect_nodes(self.nodes[0], 1) self.sync_all() self.log.info("Mining blocks...") mining_address = self.nodes[0].getnewaddress() self.nodes[0].generatetoaddress(105, mining_address) self.sync_all() chain_height = self.nodes[1].getblockcount() assert_equal(chain_height, 105) assert_equal(self.nodes[1].getbalance(), 0) assert_equal(self.nodes[2].getbalance(), 0) # Check that balances are correct balance0 = self.nodes[1].getaddressbalance("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB") balance_mining = self.nodes[1].getaddressbalance(mining_address) assert_equal(balance0["balance"], 0) assert_equal(balance_mining["balance"], 105 * 500 * COIN) assert_equal(balance_mining["balance_immature"], 100 * 500 * COIN) assert_equal(balance_mining["balance_spendable"], 5 * 500 * COIN) # Check p2pkh and p2sh address indexes self.log.info("Testing p2pkh and p2sh address index...") txid0 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 10) self.nodes[0].generate(1) txidb0 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 10) self.nodes[0].generate(1) txid1 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 15) self.nodes[0].generate(1) txidb1 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 15) self.nodes[0].generate(1) txid2 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 20) self.nodes[0].generate(1) txidb2 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 20) self.nodes[0].generate(1) self.sync_all() txids = self.nodes[1].getaddresstxids("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4") assert_equal(len(txids), 3) assert_equal(txids[0], txid0) assert_equal(txids[1], txid1) assert_equal(txids[2], txid2) txidsb = self.nodes[1].getaddresstxids("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB") assert_equal(len(txidsb), 3) assert_equal(txidsb[0], txidb0) assert_equal(txidsb[1], txidb1) assert_equal(txidsb[2], txidb2) # Check that limiting by height works self.log.info("Testing querying txids by range of block heights..") height_txids = self.nodes[1].getaddresstxids({ "addresses": ["93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB"], "start": 105, "end": 110 }) assert_equal(len(height_txids), 2) assert_equal(height_txids[0], txidb0) assert_equal(height_txids[1], txidb1) # Check that multiple addresses works multitxids = self.nodes[1].getaddresstxids({"addresses": ["93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", "yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4"]}) assert_equal(len(multitxids), 6) assert_equal(multitxids[0], txid0) assert_equal(multitxids[1], txidb0) assert_equal(multitxids[2], txid1) assert_equal(multitxids[3], txidb1) assert_equal(multitxids[4], txid2) assert_equal(multitxids[5], txidb2) # Check that balances are correct balance0 = self.nodes[1].getaddressbalance("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB") assert_equal(balance0["balance"], 45 * 100000000) # Check that outputs with the same address will only return one txid self.log.info("Testing for txid uniqueness...") addressHash = binascii.unhexlify("FE30B718DCF0BF8A2A686BF1820C073F8B2C3B37") scriptPubKey = CScript([OP_HASH160, addressHash, OP_EQUAL]) unspent = self.nodes[0].listunspent() tx = CTransaction() tx.vin = [CTxIn(COutPoint(int(unspent[0]["txid"], 16), unspent[0]["vout"]))] tx.vout = [CTxOut(10 * COIN, scriptPubKey), CTxOut(11 * COIN, scriptPubKey)] tx.rehash() signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex()) sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0) self.nodes[0].generate(1) self.sync_all() txidsmany = self.nodes[1].getaddresstxids("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB") assert_equal(len(txidsmany), 4) assert_equal(txidsmany[3], sent_txid) # Check that balances are correct self.log.info("Testing balances...") balance0 = self.nodes[1].getaddressbalance("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB") assert_equal(balance0["balance"], (45 + 21) * 100000000) # Check that balances are correct after spending self.log.info("Testing balances after spending...") privkey2 = "cU4zhap7nPJAWeMFu4j6jLrfPmqakDAzy8zn8Fhb3oEevdm4e5Lc" address2 = "yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3" addressHash2 = binascii.unhexlify("C5E4FB9171C22409809A3E8047A29C83886E325D") scriptPubKey2 = CScript([OP_DUP, OP_HASH160, addressHash2, OP_EQUALVERIFY, OP_CHECKSIG]) self.nodes[0].importprivkey(privkey2) unspent = self.nodes[0].listunspent() tx = CTransaction() tx_fee_sat = 1000 tx.vin = [CTxIn(COutPoint(int(unspent[0]["txid"], 16), unspent[0]["vout"]))] amount = int(unspent[0]["amount"] * 100000000) - tx_fee_sat tx.vout = [CTxOut(amount, scriptPubKey2)] tx.rehash() signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex()) spending_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0) self.nodes[0].generate(1) self.sync_all() balance1 = self.nodes[1].getaddressbalance(address2) assert_equal(balance1["balance"], amount) tx = CTransaction() tx.vin = [CTxIn(COutPoint(int(spending_txid, 16), 0))] send_amount = 1 * 100000000 + 12840 change_amount = amount - send_amount - 10000 tx.vout = [CTxOut(change_amount, scriptPubKey2), CTxOut(send_amount, scriptPubKey)] tx.rehash() signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex()) sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0) self.nodes[0].generate(1) self.sync_all() balance2 = self.nodes[1].getaddressbalance(address2) assert_equal(balance2["balance"], change_amount) # Check that deltas are returned correctly deltas = self.nodes[1].getaddressdeltas({"addresses": [address2], "start": 0, "end": 200}) balance3 = 0 for delta in deltas: balance3 += delta["satoshis"] assert_equal(balance3, change_amount) assert_equal(deltas[0]["address"], address2) assert_equal(deltas[0]["blockindex"], 1) # Check that entire range will be queried deltasAll = self.nodes[1].getaddressdeltas({"addresses": [address2]}) assert_equal(len(deltasAll), len(deltas)) # Check that deltas can be returned from range of block heights deltas = self.nodes[1].getaddressdeltas({"addresses": [address2], "start": 113, "end": 113}) assert_equal(len(deltas), 1) # Check that unspent outputs can be queried self.log.info("Testing utxos...") utxos = self.nodes[1].getaddressutxos({"addresses": [address2]}) assert_equal(len(utxos), 1) assert_equal(utxos[0]["satoshis"], change_amount) # Check that indexes will be updated with a reorg self.log.info("Testing reorg...") best_hash = self.nodes[0].getbestblockhash() self.nodes[0].invalidateblock(best_hash) self.nodes[1].invalidateblock(best_hash) self.nodes[2].invalidateblock(best_hash) self.nodes[3].invalidateblock(best_hash) # Allow some time for the reorg to start self.bump_mocktime(2) self.sync_all() balance4 = self.nodes[1].getaddressbalance(address2) assert_equal(balance4, balance1) utxos2 = self.nodes[1].getaddressutxos({"addresses": [address2]}) assert_equal(len(utxos2), 1) assert_equal(utxos2[0]["satoshis"], amount) # Check sorting of utxos self.nodes[2].generate(150) self.nodes[2].sendtoaddress(address2, 50) self.nodes[2].generate(1) self.nodes[2].sendtoaddress(address2, 50) self.nodes[2].generate(1) self.sync_all() utxos3 = self.nodes[1].getaddressutxos({"addresses": [address2]}) assert_equal(len(utxos3), 3) assert_equal(utxos3[0]["height"], 114) assert_equal(utxos3[1]["height"], 264) assert_equal(utxos3[2]["height"], 265) # Check mempool indexing self.log.info("Testing mempool indexing...") privKey3 = "cRyrMvvqi1dmpiCmjmmATqjAwo6Wu7QTjKu1ABMYW5aFG4VXW99K" address3 = "yWB15aAdpeKuSaQHFVJpBDPbNSLZJSnDLA" addressHash3 = binascii.unhexlify("6C186B3A308A77C779A9BB71C3B5A7EC28232A13") scriptPubKey3 = CScript([OP_DUP, OP_HASH160, addressHash3, OP_EQUALVERIFY, OP_CHECKSIG]) # address4 = "2N8oFVB2vThAKury4vnLquW2zVjsYjjAkYQ" scriptPubKey4 = CScript([OP_HASH160, addressHash3, OP_EQUAL]) unspent = self.nodes[2].listunspent() tx = CTransaction() tx.vin = [CTxIn(COutPoint(int(unspent[0]["txid"], 16), unspent[0]["vout"]))] amount = int(unspent[0]["amount"] * 100000000) - tx_fee_sat tx.vout = [CTxOut(amount, scriptPubKey3)] tx.rehash() signed_tx = self.nodes[2].signrawtransactionwithwallet(tx.serialize().hex()) memtxid1 = self.nodes[2].sendrawtransaction(signed_tx["hex"], 0) self.bump_mocktime(2) tx2 = CTransaction() tx2.vin = [CTxIn(COutPoint(int(unspent[1]["txid"], 16), unspent[1]["vout"]))] amount = int(unspent[1]["amount"] * 100000000) - tx_fee_sat tx2.vout = [ CTxOut(int(amount / 4), scriptPubKey3), CTxOut(int(amount / 4), scriptPubKey3), CTxOut(int(amount / 4), scriptPubKey4), CTxOut(int(amount / 4), scriptPubKey4) ] tx2.rehash() signed_tx2 = self.nodes[2].signrawtransactionwithwallet(tx2.serialize().hex()) memtxid2 = self.nodes[2].sendrawtransaction(signed_tx2["hex"], 0) self.bump_mocktime(2) mempool = self.nodes[2].getaddressmempool({"addresses": [address3]}) assert_equal(len(mempool), 3) assert_equal(mempool[0]["txid"], memtxid1) assert_equal(mempool[0]["address"], address3) assert_equal(mempool[0]["index"], 0) assert_equal(mempool[1]["txid"], memtxid2) assert_equal(mempool[1]["index"], 0) assert_equal(mempool[2]["txid"], memtxid2) assert_equal(mempool[2]["index"], 1) self.nodes[2].generate(1) self.sync_all() mempool2 = self.nodes[2].getaddressmempool({"addresses": [address3]}) assert_equal(len(mempool2), 0) tx = CTransaction() tx.vin = [ CTxIn(COutPoint(int(memtxid2, 16), 0)), CTxIn(COutPoint(int(memtxid2, 16), 1)) ] tx.vout = [CTxOut(int(amount / 2 - 10000), scriptPubKey2)] tx.rehash() self.nodes[2].importprivkey(privKey3) signed_tx3 = self.nodes[2].signrawtransactionwithwallet(tx.serialize().hex()) self.nodes[2].sendrawtransaction(signed_tx3["hex"], 0) self.bump_mocktime(2) mempool3 = self.nodes[2].getaddressmempool({"addresses": [address3]}) assert_equal(len(mempool3), 2) assert_equal(mempool3[0]["prevtxid"], memtxid2) assert_equal(mempool3[0]["prevout"], 0) assert_equal(mempool3[1]["prevtxid"], memtxid2) assert_equal(mempool3[1]["prevout"], 1) # sending and receiving to the same address privkey1 = "cMvZn1pVWntTEcsK36ZteGQXRAcZ8CoTbMXF1QasxBLdnTwyVQCc" address1 = "yM9Eed1bxjy7tYxD3yZDHxjcVT48WdRoB1" address1hash = binascii.unhexlify("0909C84A817651502E020AAD0FBCAE5F656E7D8A") address1script = CScript([OP_DUP, OP_HASH160, address1hash, OP_EQUALVERIFY, OP_CHECKSIG]) self.nodes[0].sendtoaddress(address1, 10) self.nodes[0].generate(1) self.sync_all() utxos = self.nodes[1].getaddressutxos({"addresses": [address1]}) assert_equal(len(utxos), 1) tx = CTransaction() tx.vin = [ CTxIn(COutPoint(int(utxos[0]["txid"], 16), utxos[0]["outputIndex"])) ] amount = int(utxos[0]["satoshis"] - 10000) tx.vout = [CTxOut(amount, address1script)] tx.rehash() self.nodes[0].importprivkey(privkey1) signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex()) self.nodes[0].sendrawtransaction(signed_tx["hex"], 0) self.sync_all() mempool_deltas = self.nodes[2].getaddressmempool({"addresses": [address1]}) assert_equal(len(mempool_deltas), 2) self.log.info("Passed") if __name__ == '__main__': AddressIndexTest().main()
thelazier/dash
test/functional/feature_addressindex.py
Python
mit
15,001
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 2509, 1001, 9385, 1006, 1039, 1007, 2297, 1011, 2325, 1996, 2978, 3597, 2378, 4563, 9797, 1001, 5500, 2104, 1996, 10210, 4007, 6105, 1010, 2156, 1996, 10860, 1001, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python from distutils.core import setup setup( name="flowtools", description="Tools for flow maps from modified Gromacs simulations", long_description="See README.md", license='GPLv3', version='0.2.30', url="https://github.com/pjohansson/flowtools", author="Petter Johansson", author_email="petter.johansson@scilifelab.se", packages=['flowtools'], requires=[ 'numpy (>=1.7.0)', 'matplotlib (>=1.2.0)', 'pandas (>=0.10.1)', 'scipy (>=0.11.0)' ], scripts=[ 'scripts/f_collect_spread.py', 'scripts/f_combine_maps.py', 'scripts/f_flowmaps.py', 'scripts/f_print.py', 'scripts/f_spread_delta_t.py', 'scripts/f_spread_plot.py', 'scripts/f_spread_ttest.py', 'scripts/f_spread_com.py', 'scripts/f_spread_std.py', 'scripts/f_velprofile.py', 'scripts/f_average_maps.py', 'scripts/f_spread_vel.py', 'scripts/f_combine_cells.py', 'scripts/f_viscous_dissipation.py', 'scripts/f_interface.py', 'scripts/f_shearmax.py', 'scripts/f_contactline.py' ] )
pjohansson/flowtools
setup.py
Python
gpl-3.0
1,324
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 2013, 4487, 3367, 21823, 4877, 1012, 4563, 12324, 16437, 16437, 1006, 2171, 1027, 1000, 4834, 3406, 27896, 1000, 1010, 6412, 1027, 1000, 5906, 2005, 4834, 7341, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace App\Repository; use Doctrine\ORM\EntityManager; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\HttpFoundation\ParameterBag; use App\Entity\Author; use App\Entity\Track; use App\Entity\Tracklist; use App\Entity\TracklistTrack; class TracklistRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Tracklist::class); } /** * @param Author $author * @param ParameterBag $tracklistData * * @return Tracklist */ public function create($author, $tracklistData) { /** @var EntityManager $em */ $em = $this->getEntityManager(); $tracklist = new Tracklist( $tracklistData->get("name"), new \DateTime($tracklistData->get("date")), $em->getRepository('App:Term')->find($tracklistData->get("termId")), $author ); $em->persist($tracklist); $this->updateTracklistTracks($tracklist, $tracklistData->get("tracks")); return $tracklist; } /** * @param Tracklist $tracklist * @param ParameterBag $tracklistData */ public function update($tracklist, $tracklistData) { /** @var EntityManager $em */ $em = $this->getEntityManager(); $tracklist ->setName($tracklistData->get("name")) ->setDate(new \DateTime($tracklistData->get("date"))) ->setTerm($em->getRepository('App:Term')->find($tracklistData->get("termId"))); $tracklistTracksData = $tracklistData->get("tracks"); $this->updateTracklistTracks($tracklist, $tracklistTracksData); $em->flush(); } /** * @param Tracklist $tracklist * @param $tracklistTracksData */ public function updateTracklistTracks($tracklist, $tracklistTracksData) { /** @var EntityManager $em */ $em = $this->getEntityManager(); $newTracklistTrackIds = []; foreach ($tracklistTracksData as $tracklistTrack) { if (isset($tracklistTrack["tracklistTrackId"])) { $newTracklistTrackIds[] = $tracklistTrack["tracklistTrackId"]; } } // Remove cleared tracklist tracks $currentTracklistTracks = $tracklist->getTracklistTracks(); foreach ($currentTracklistTracks as $currentTracklistTrack) { $id = $currentTracklistTrack->getId(); if (!in_array($id, $newTracklistTrackIds)) { // If it's an mp3, also remove the track entity $track = $currentTracklistTrack->getTrack(); $em->remove($currentTracklistTrack); if ($track->getMp3()) { $em->remove($track); } } } $tracklistTrackRepo = $em->getRepository('App:TracklistTrack'); $trackRepo = $em->getRepository('App:Track'); foreach ($tracklistTracksData as $trackNum=>$newTracklistTrackData) { if (isset($newTracklistTrackData["tracklistTrackId"])) { $id = $newTracklistTrackData["tracklistTrackId"]; $tracklistTrack = $tracklistTrackRepo->find($id); $tracklistTrack ->setTrackNum($trackNum) ->setComment($newTracklistTrackData["comment"]); // echo "updating track ".$oldTracklistTrack->getTrack()->getName()."\n"; // Fill mp3 data? if (isset($newTracklistTrackData['mp3']) && $newTracklistTrackData['mp3']) { $this->setMp3Data($tracklistTrack->getTrack(), $newTracklistTrackData); } } else { $tracklistTrack = new TracklistTrack(); $tracklistTrack ->setTracklist($tracklist) ->setComment($newTracklistTrackData["comment"]) ->setTrackNum($trackNum); // echo "adding track ".$newTracklistTrack->getTrack()->getName()."\n"; if (isset($newTracklistTrackData['id'])) { $track = $trackRepo->find($newTracklistTrackData["id"]); $tracklistTrack->setTrack($track); } elseif (isset($newTracklistTrackData['mp3']) && $newTracklistTrackData['mp3']) { // If it's an mp3, fill remaining fields $track = new Track(); $track->setMp3(true); $em->persist($track); $tracklistTrack->setTrack($track); $this->setMp3Data($track, $newTracklistTrackData); } $tracklist->getTracklistTracks()->add($tracklistTrack); } } $em->flush(); } protected function setMp3Data(Track $track, array $trackData) { if (!isset($trackData['fid']) || !$trackData['fid']) { throw new \Exception('Vsak mp3 potrebuje filename'); } #if (!isset($trackData['albumName']) || !$trackData['albumName']) { # throw new \Exception('Vsak mp3 potrebuje album'); #} if (!isset($trackData['artistName']) || !$trackData['artistName']) { throw new \Exception('Vsak mp3 potrebuje artista'); } if (!isset($trackData['name']) || !$trackData['name']) { throw new \Exception('Vsak mp3 potrebuje naslov'); } #if (!isset($trackData['year']) || !$trackData['year']) { # throw new \Exception('Vsak mp3 potrebuje leto'); #} if (!isset($trackData['duration']) || !$trackData['duration']) { throw new \Exception('Vsak mp3 potrebuje trajanje'); } $track->setFid($trackData['fid']); $track->setTrackNum($trackData['fid']); $track->setName($trackData['name']); $track->setMp3ArtistName($trackData['artistName']); if (isset($trackData['albumName'])) { $track->setMp3AlbumName($trackData['albumName']); } if (isset($trackData['year'])) { $track->setStrDate($trackData['year']); } $track->setDuration($trackData['duration']); $track->setDate(new \DateTime()); } }
RadioStudent/picapica
src/Repository/TracklistRepository.php
PHP
agpl-3.0
6,370
[ 30522, 1026, 1029, 25718, 3415, 15327, 10439, 1032, 22409, 1025, 2224, 8998, 1032, 2030, 2213, 1032, 9178, 24805, 4590, 1025, 2224, 8998, 1032, 14012, 1032, 8998, 27265, 2571, 1032, 22409, 1032, 2326, 4765, 3012, 2890, 6873, 28307, 2100, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#region License and Terms // // NCrontab - Crontab for .NET // Copyright (c) 2008 Atif Aziz. All rights reserved. // Portions Copyright (c) 2001 The OpenSymphony Group. 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 law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion namespace NCrontab { #region Imports using System; using System.Collections; using System.Globalization; using System.IO; #endregion /// <summary> /// Represents a single crontab field. /// </summary> // ReSharper disable once PartialTypeWithSinglePart public sealed partial class CrontabField : ICrontabField { readonly BitArray _bits; /* readonly */ int _minValueSet; /* readonly */ int _maxValueSet; readonly CrontabFieldImpl _impl; /// <summary> /// Parses a crontab field expression given its kind. /// </summary> public static CrontabField Parse(CrontabFieldKind kind, string expression) => TryParse(kind, expression, v => v, e => throw e()); public static CrontabField? TryParse(CrontabFieldKind kind, string expression) => TryParse(kind, expression, v => v, _ => (CrontabField?)null); public static T TryParse<T>(CrontabFieldKind kind, string expression, Func<CrontabField, T> valueSelector, Func<ExceptionProvider, T> errorSelector) { var field = new CrontabField(CrontabFieldImpl.FromKind(kind)); var error = field._impl.TryParse(expression, field.Accumulate, (ExceptionProvider?)null, e => e); return error == null ? valueSelector(field) : errorSelector(error); } /// <summary> /// Parses a crontab field expression representing seconds. /// </summary> public static CrontabField Seconds(string expression) => Parse(CrontabFieldKind.Second, expression); /// <summary> /// Parses a crontab field expression representing minutes. /// </summary> public static CrontabField Minutes(string expression) => Parse(CrontabFieldKind.Minute, expression); /// <summary> /// Parses a crontab field expression representing hours. /// </summary> public static CrontabField Hours(string expression) => Parse(CrontabFieldKind.Hour, expression); /// <summary> /// Parses a crontab field expression representing days in any given month. /// </summary> public static CrontabField Days(string expression) => Parse(CrontabFieldKind.Day, expression); /// <summary> /// Parses a crontab field expression representing months. /// </summary> public static CrontabField Months(string expression) => Parse(CrontabFieldKind.Month, expression); /// <summary> /// Parses a crontab field expression representing days of a week. /// </summary> public static CrontabField DaysOfWeek(string expression) => Parse(CrontabFieldKind.DayOfWeek, expression); CrontabField(CrontabFieldImpl impl) { _impl = impl ?? throw new ArgumentNullException(nameof(impl)); _bits = new BitArray(impl.ValueCount); _minValueSet = int.MaxValue; _maxValueSet = -1; } /// <summary> /// Gets the first value of the field or -1. /// </summary> public int GetFirst() => _minValueSet < int.MaxValue ? _minValueSet : -1; /// <summary> /// Gets the next value of the field that occurs after the given /// start value or -1 if there is no next value available. /// </summary> public int Next(int start) { if (start < _minValueSet) return _minValueSet; var startIndex = ValueToIndex(start); var lastIndex = ValueToIndex(_maxValueSet); for (var i = startIndex; i <= lastIndex; i++) { if (_bits[i]) return IndexToValue(i); } return -1; } int IndexToValue(int index) => index + _impl.MinValue; int ValueToIndex(int value) => value - _impl.MinValue; /// <summary> /// Determines if the given value occurs in the field. /// </summary> public bool Contains(int value) => _bits[ValueToIndex(value)]; /// <summary> /// Accumulates the given range (start to end) and interval of values /// into the current set of the field. /// </summary> /// <remarks> /// To set the entire range of values representable by the field, /// set <param name="start" /> and <param name="end" /> to -1 and /// <param name="interval" /> to 1. /// </remarks> T Accumulate<T>(int start, int end, int interval, T success, Func<ExceptionProvider, T> errorSelector) { var minValue = _impl.MinValue; var maxValue = _impl.MaxValue; if (start == end) { if (start < 0) { // // We're setting the entire range of values. // if (interval <= 1) { _minValueSet = minValue; _maxValueSet = maxValue; _bits.SetAll(true); return success; } start = minValue; end = maxValue; } else { // // We're only setting a single value - check that it is in range. // if (start < minValue) return OnValueBelowMinError(start, errorSelector); if (start > maxValue) return OnValueAboveMaxError(start, errorSelector); } } else { // // For ranges, if the start is bigger than the end value then // swap them over. // if (start > end) { end ^= start; start ^= end; end ^= start; } if (start < 0) start = minValue; else if (start < minValue) return OnValueBelowMinError(start, errorSelector); if (end < 0) end = maxValue; else if (end > maxValue) return OnValueAboveMaxError(end, errorSelector); } if (interval < 1) interval = 1; int i; // // Populate the _bits table by setting all the bits corresponding to // the valid field values. // for (i = start - minValue; i <= (end - minValue); i += interval) _bits[i] = true; // // Make sure we remember the minimum value set so far Keep track of // the highest and lowest values that have been added to this field // so far. // if (_minValueSet > start) _minValueSet = start; i += (minValue - interval); if (_maxValueSet < i) _maxValueSet = i; return success; } T OnValueAboveMaxError<T>(int value, Func<ExceptionProvider, T> errorSelector) => errorSelector( () => new CrontabException( $"{value} is higher than the maximum allowable value for the [{_impl.Kind}] field. " + $"Value must be between {_impl.MinValue} and {_impl.MaxValue} (all inclusive).")); T OnValueBelowMinError<T>(int value, Func<ExceptionProvider, T> errorSelector) => errorSelector( () => new CrontabException( $"{value} is lower than the minimum allowable value for the [{_impl.Kind}] field. " + $"Value must be between {_impl.MinValue} and {_impl.MaxValue} (all inclusive).")); public override string ToString() => ToString(null); public string ToString(string? format) { var writer = new StringWriter(CultureInfo.InvariantCulture); switch (format) { case "G": case null: Format(writer, true); break; case "N": Format(writer); break; default: throw new FormatException(); } return writer.ToString(); } public void Format(TextWriter writer) => Format(writer, false); public void Format(TextWriter writer, bool noNames) => _impl.Format(this, writer, noNames); } }
atifaziz/NCrontab
NCrontab/CrontabField.cs
C#
apache-2.0
9,666
[ 30522, 1001, 2555, 6105, 1998, 3408, 1013, 1013, 1013, 1013, 13316, 4948, 2696, 2497, 1011, 13675, 12162, 7875, 2005, 1012, 5658, 1013, 1013, 9385, 1006, 1039, 1007, 2263, 2012, 10128, 21196, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 8810, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import _plotly_utils.basevalidators class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs ): super(ArrowcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "arraydraw"), role=kwargs.pop("role", "style"), **kwargs )
plotly/python-api
packages/python/plotly/plotly/validators/layout/annotation/_arrowcolor.py
Python
mit
479
[ 30522, 12324, 1035, 5436, 2135, 1035, 21183, 12146, 1012, 2918, 10175, 8524, 6591, 2465, 8612, 18717, 10175, 8524, 4263, 1006, 1035, 5436, 2135, 1035, 21183, 12146, 1012, 2918, 10175, 8524, 6591, 1012, 3609, 10175, 8524, 4263, 1007, 1024, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_02) on Tue Jul 01 09:51:11 CEST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>org.gradle.tooling Class Hierarchy (Gradle API 2.0)</title> <meta name="date" content="2014-07-01"> <link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="org.gradle.tooling Class Hierarchy (Gradle API 2.0)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/gradle/testing/jacoco/tasks/package-tree.html">Prev</a></li> <li><a href="../../../org/gradle/tooling/exceptions/package-tree.html">Next</a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/gradle/tooling/package-tree.html" target="_top">Frames</a></li> <li><a href="package-tree.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 class="title">Hierarchy For Package org.gradle.tooling</h1> <span class="strong">Package Hierarchies:</span> <ul class="horizontal"> <li><a href="../../../overview-tree.html">All Packages</a></li> </ul> </div> <div class="contentContainer"> <h2 title="Class Hierarchy">Class Hierarchy</h2> <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><span class="strong">Object</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/GradleConnector.html" title="class in org.gradle.tooling"><span class="strong">GradleConnector</span></a></li> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><span class="strong">Throwable</span></a> (implements java.io.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>) <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang"><span class="strong">Exception</span></a> <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/RuntimeException.html?is-external=true" title="class or interface in java.lang"><span class="strong">RuntimeException</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/GradleConnectionException.html" title="class in org.gradle.tooling"><span class="strong">GradleConnectionException</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildActionFailureException.html" title="class in org.gradle.tooling"><span class="strong">BuildActionFailureException</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildException.html" title="class in org.gradle.tooling"><span class="strong">BuildException</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/UnsupportedVersionException.html" title="class in org.gradle.tooling"><span class="strong">UnsupportedVersionException</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/UnknownModelException.html" title="class in org.gradle.tooling"><span class="strong">UnknownModelException</span></a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <h2 title="Interface Hierarchy">Interface Hierarchy</h2> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildController.html" title="interface in org.gradle.tooling"><span class="strong">BuildController</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/LongRunningOperation.html" title="interface in org.gradle.tooling"><span class="strong">LongRunningOperation</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildActionExecuter.html" title="interface in org.gradle.tooling"><span class="strong">BuildActionExecuter</span></a>&lt;T&gt;</li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildLauncher.html" title="interface in org.gradle.tooling"><span class="strong">BuildLauncher</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/ModelBuilder.html" title="interface in org.gradle.tooling"><span class="strong">ModelBuilder</span></a>&lt;T&gt;</li> </ul> </li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/ProgressEvent.html" title="interface in org.gradle.tooling"><span class="strong">ProgressEvent</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/ProgressListener.html" title="interface in org.gradle.tooling"><span class="strong">ProgressListener</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/ProjectConnection.html" title="interface in org.gradle.tooling"><span class="strong">ProjectConnection</span></a></li> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/ResultHandler.html" title="interface in org.gradle.tooling"><span class="strong">ResultHandler</span></a>&lt;T&gt;</li> <li type="circle">java.io.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io"><span class="strong">Serializable</span></a> <ul> <li type="circle">org.gradle.tooling.<a href="../../../org/gradle/tooling/BuildAction.html" title="interface in org.gradle.tooling"><span class="strong">BuildAction</span></a>&lt;T&gt;</li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/gradle/testing/jacoco/tasks/package-tree.html">Prev</a></li> <li><a href="../../../org/gradle/tooling/exceptions/package-tree.html">Next</a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/gradle/tooling/package-tree.html" target="_top">Frames</a></li> <li><a href="package-tree.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
VolitionEos/DungFactory
.gradlew/wrapper/dists/gradle-2.0-all/7rd4e4rcg4riqi0j6j508m2lbk/gradle-2.0/docs/javadoc/org/gradle/tooling/package-tree.html
HTML
gpl-3.0
8,645
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2015 prashant kumar (prashant4nov). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.pearson.statsagg.webui.api; import com.pearson.statsagg.database_objects.notifications.NotificationGroupsDao; import com.pearson.statsagg.database_objects.notifications.NotificationGroup; import com.pearson.statsagg.utilities.StackTrace; import java.io.PrintWriter; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author prashant kumar (prashant4nov) */ @WebServlet(name="API_NotificationGroupDetails", urlPatterns={"/api/notification-group-details"}) public class NotificationGroupDetails extends HttpServlet { private static final Logger logger = LoggerFactory.getLogger(NotificationGroupDetails.class.getName()); public static final String PAGE_NAME = "API_NotificationGroupDetails"; /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return PAGE_NAME; } /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) { logger.debug("doGet"); try { JSONObject json = getNotificationGroup(request, new NotificationGroupsDao()); PrintWriter out = null; response.setContentType("application/json"); out = response.getWriter(); out.println(json); } catch (Exception e) { logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e)); } } /** * Returns a json object containing the details of the requested notification group. * * @param request servlet request * @param notificationGroupsDao NotificationGroupsDao object * @return details of the requested notification group */ JSONObject getNotificationGroup(HttpServletRequest request, NotificationGroupsDao notificationGroupsDao) { logger.debug("getNotificationGroup"); logger.debug(PAGE_NAME); JSONObject notificationGroupDetails = new JSONObject(); int notificationGroupId = 0; try { if (request.getParameter(Helper.id) != null) { notificationGroupId = Integer.parseInt(request.getParameter(Helper.id)); } NotificationGroup notificationGroup = notificationGroupsDao.getNotificationGroup(notificationGroupId); if (notificationGroup != null) { if (notificationGroup.getId() != null) { notificationGroupDetails.put("id", notificationGroup.getId()); } if (notificationGroup.getName() != null) { notificationGroupDetails.put("name", notificationGroup.getName()); } if (notificationGroup.getEmailAddresses() != null) { notificationGroupDetails.put("email_addresses", notificationGroup.getEmailAddresses()); } } else { notificationGroupDetails.put(Helper.error, Helper.noResult); } } catch (Exception e) { logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e)); notificationGroupDetails.put(Helper.error, Helper.errorMsg); } return notificationGroupDetails; } }
karimgarza/StatsAgg
src/main/java/com/pearson/statsagg/webui/api/NotificationGroupDetails.java
Java
apache-2.0
4,377
[ 30522, 1013, 1008, 1008, 9385, 2325, 10975, 11823, 4630, 9600, 1006, 10975, 11823, 4630, 2549, 16693, 1007, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class PresentDeliverer: present_locations = {} def __init__(self, name): self.name = name self.x = 0 self.y = 0 self.present_locations[self.get_key()]=1 def get_key(self): return str(self.x)+"-"+str(self.y) def status(self): print(self.name + " x: "+str(self.x)+" y: "+str(self.y)) def move(self,instruction): if instruction == ">": self.x += 1 elif instruction == "<": self.x -= 1 elif instruction == "^": self.y += 1 else: self.y -= 1 self.present_locations[self.get_key()]=1 def unique_houses(self): print("Unique houses: "+str(len(self.present_locations.keys()))) filename = "..\inputs\day_three_input.txt" f = open(filename) input_line = f.readline() santa = PresentDeliverer("Santa") robo = PresentDeliverer("RoboSanta") instruction_count = 0 for c in input_line: instruction_count += 1 if (instruction_count % 2): santa.move(c) else: robo.move(c) santa.unique_houses()
caw13/adventofcode
python/day_three_part2.py
Python
mit
939
[ 30522, 2465, 2556, 9247, 16402, 2121, 1024, 2556, 1035, 5269, 1027, 1063, 1065, 13366, 1035, 1035, 1999, 4183, 1035, 1035, 1006, 2969, 1010, 2171, 1007, 1024, 2969, 1012, 2171, 1027, 2171, 2969, 1012, 1060, 1027, 1014, 2969, 1012, 1061, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: page title: "About" description: "你是你周围关系的反映 " header-img: "img/green.jpg" --- 我是Edward,通过建立博客,希望能够学习互联网语言,read 这个时代 现在正在学习**python** 。 ###remind - 正确的激励产生正确的行为 - 解释宇宙需要不仅仅一个真理 - 你是你周围关系的反映 - 广末凉子很漂亮 ###关注: - [Python](http://liaoxuefeng.com) ###代表作: - [《暂无,此为模板测试》](http://cnfeat.com/blog/2015/05/22/a-24-chinese-fonts/) ###我的朋友们 - [lomo](http://huangyafei.com) ###联系 - [知乎@ewadrd.lv](http://www.zhihu.com/people/yinsi) - 公众号:暂无nulltext <center> <p><img src="" align="center"></p> </center>
Edwardvi/edwardvi.github.io
about.md
Markdown
apache-2.0
846
[ 30522, 1011, 1011, 1011, 9621, 1024, 3931, 2516, 1024, 1000, 2055, 1000, 6412, 1024, 1000, 100, 100, 100, 100, 100, 100, 100, 1916, 100, 100, 1000, 20346, 1011, 10047, 2290, 1024, 1000, 10047, 2290, 1013, 2665, 1012, 16545, 2290, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* jslint node: true */ var FILENAME = 'modules/empathy.js', ALL_JAVASCRIPT_FILES = ['Gruntfile.js', '*/*.js', 'public/javascripts/*.js']; module.exports = function(grunt) { 'use strict'; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { options: { jshintrc:true }, all: ALL_JAVASCRIPT_FILES }, clean: { // Clean any pre-commit hooks in .git/hooks directory hooks: ['.git/hooks/pre-commit'] }, // Run shell commands shell: { hooks: { // Copy the project's pre-commit hook into .git/hooks command: 'cp git-hooks/pre-commit .git/hooks/pre-commit' }, rmclogs: { // Run the script command: 'bash pre-build/script.bash' } }, watch: { scripts: { files: ALL_JAVASCRIPT_FILES, tasks: ['jshint'], options: { spawn: false }, }, } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); // Clean the .git/hooks/pre-commit file then copy in the latest version grunt.registerTask('hookmeup', ['clean:hooks', 'shell:hooks']); //build task grunt.registerTask('build', ['hookmeup']); grunt.event.on('watch', function(action, filepath) { grunt.log.writeln(filepath + ' has ' + action); }); };
prometheansacrifice/Socialysis
Gruntfile.js
JavaScript
gpl-2.0
1,733
[ 30522, 1013, 1008, 1046, 22908, 2102, 13045, 1024, 2995, 1008, 1013, 13075, 5371, 18442, 1027, 1005, 14184, 1013, 26452, 1012, 1046, 2015, 1005, 1010, 2035, 1035, 9262, 22483, 1035, 6764, 1027, 1031, 1005, 20696, 8873, 2571, 1012, 1046, 201...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*****************************************************************************/ /* ### */ /* ##### ### ### ### CREATE: 2009-12-17 */ /* ####### ### ### [CORE] ### ~~~~~~~~~~~~~~~~~~ */ /* ######## ### ### ### MODIFY: XXXX-XX-XX */ /* #### ## ### ### ### ~~~~~~~~~~~~~~~~~~ */ /* ### ### ### ### ### #### #### ### ## +-----------+ */ /* #### ######## ########## ####### ###### ### ### | A NEW C | */ /* ### ######## ########## ######## ###### ### ### | FRAMEWORK | */ /* ### ## #### ### ########## ### ### ### ###### | FOR ALL | */ /* #### ### ### ### ### ### ### ### ### ###### | PLATFORMS | */ /* ########## ### ### ### ######## ####### ####### | AND ALL | */ /* ####### ### ### ### ######## ###### ### ### | COMPILERS | */ /* ##### ### ### ### #### ## #### ### ## +-----------+ */ /* ======================================================================= */ /* >>>>>>>>>>>>>>>>>>>>>>>> CrHack 字节顺序头文件 <<<<<<<<<<<<<<<<<<<<<<<< */ /* ======================================================================= */ /*****************************************************************************/ #ifndef __CR_MORDER_H__ #define __CR_MORDER_H__ #include "defs.h" /* Visual C++ */ #if defined(_CR_CC_MSC_) #ifndef _CR_NO_INTRIN_ #ifndef _CR_OS_WINCE_ #include <intrin.h> #else #include <cmnintrin.h> #endif #include <stdlib.h> #endif #endif /*****************************************************************************/ /* 循环位移 */ /*****************************************************************************/ /* ======================================= 字节循环左移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotl08) #define rotl_byte_t(val, shift) \ cr_rotl08(val, (unsigned char)(shift)) #else cr_inline byte_t rotl_byte_t ( __CR_IN__ byte_t val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotl08) return (cr_rotl08(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("rolb %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((byte_t)((val << shift) | (val >> (8 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotl08 */ /* ======================================= 字节循环右移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotr08) #define rotr_byte_t(val, shift) \ cr_rotr08(val, (unsigned char)(shift)) #else cr_inline byte_t rotr_byte_t ( __CR_IN__ byte_t val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotr08) return (cr_rotr08(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("rorb %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((byte_t)((val >> shift) | (val << (8 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotr08 */ /* ======================================= 单字循环左移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotl16) #define rotl_int16u(val, shift) \ cr_rotl16(val, (unsigned char)(shift)) #else cr_inline int16u rotl_int16u ( __CR_IN__ int16u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotl16) return (cr_rotl16(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("rolw %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((int16u)((val << shift) | (val >> (16 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotl16 */ /* ======================================= 单字循环右移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotr16) #define rotr_int16u(val, shift) \ cr_rotr16(val, (unsigned char)(shift)) #else cr_inline int16u rotr_int16u ( __CR_IN__ int16u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotr16) return (cr_rotr16(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("rorw %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((int16u)((val >> shift) | (val << (16 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotr16 */ /* ======================================= 双字循环左移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotl32) #define rotl_int32u(val, shift) \ cr_rotl32(val, (unsigned char)(shift)) #else cr_inline int32u rotl_int32u ( __CR_IN__ int32u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotl32) return (cr_rotl32(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("roll %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((int32u)((val << shift) | (val >> (32 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotl32 */ /* ======================================= 双字循环右移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotr32) #define rotr_int32u(val, shift) \ cr_rotr32(val, (unsigned char)(shift)) #else cr_inline int32u rotr_int32u ( __CR_IN__ int32u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotr32) return (cr_rotr32(val, (unsigned char)shift)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("rorl %%cl, %0" : "=r"(val) : "0"(val), "c"(shift)); return (val); #else return ((int32u)((val >> shift) | (val << (32 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotr32 */ /* ======================================= 四字循环左移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotl64) #define rotl_int64u(val, shift) \ cr_rotl64(val, (unsigned char)(shift)) #else cr_inline int64u rotl_int64u ( __CR_IN__ int64u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotl64) return (cr_rotl64(val, (unsigned char)shift)); #else return ((int64u)((val << shift) | (val >> (64 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotl64 */ /* ======================================= 四字循环右移 [port] ======================================= */ #if defined(_CR_NO_INLINE_) && defined(cr_rotr64) #define rotr_int64u(val, shift) \ cr_rotr64(val, (unsigned char)(shift)) #else cr_inline int64u rotr_int64u ( __CR_IN__ int64u val, __CR_IN__ uint_t shift ) { /* Compiler intrinsic support */ #if defined(cr_rotr64) return (cr_rotr64(val, (unsigned char)shift)); #else return ((int64u)((val >> shift) | (val << (64 - shift)))); #endif /* AR & CP TYPE predefines */ } #endif /* _CR_NO_INLINE_ && cr_rotr64 */ /*****************************************************************************/ /* 字节顺序 */ /*****************************************************************************/ /* 字节顺序操作映射宏 */ #if defined(_CR_ORDER_LE_) #define WORD_LE(val) (val) #define DWORD_LE(val) (val) #define QWORD_LE(val) (val) #define WORD_BE(val) xchg_int16u(val) #define DWORD_BE(val) xchg_int32u(val) #define QWORD_BE(val) xchg_int64u(val) #define CWORD_LE(val) (val) #define CDWORD_LE(val) (val) #define CQWORD_LE(val) (val) #define CWORD_BE(val) xchg_cint16u(val) #define CDWORD_BE(val) xchg_cint32u(val) #define CQWORD_BE(val) xchg_cint64u(val) #else /* (_CR_ORDER_BE_) */ #define WORD_BE(val) (val) #define DWORD_BE(val) (val) #define QWORD_BE(val) (val) #define WORD_LE(val) xchg_int16u(val) #define DWORD_LE(val) xchg_int32u(val) #define QWORD_LE(val) xchg_int64u(val) #define CWORD_BE(val) (val) #define CDWORD_BE(val) (val) #define CQWORD_BE(val) (val) #define CWORD_LE(val) xchg_cint16u(val) #define CDWORD_LE(val) xchg_cint32u(val) #define CQWORD_LE(val) xchg_cint64u(val) #endif #if !defined(_CR_SICK_INLINE_) /* ======================================= 单字交换顺序 (常数用) ======================================= */ cr_inline int16u xchg_cint16u ( __CR_IN__ int16u val ) { return ((int16u)((((int16u)(((byte_t*)(&val))[0])) << 8) | (((int16u)(((byte_t*)(&val))[1]))))); } /* ======================================= 双字交换顺序 (常数用) ======================================= */ cr_inline int32u xchg_cint32u ( __CR_IN__ int32u val ) { return ((int32u)((((int32u)(((byte_t*)(&val))[0])) << 24) | (((int32u)(((byte_t*)(&val))[1])) << 16) | (((int32u)(((byte_t*)(&val))[2])) << 8) | (((int32u)(((byte_t*)(&val))[3]))))); } /* ======================================= 四字交换顺序 (常数用) ======================================= */ cr_inline int64u xchg_cint64u ( __CR_IN__ int64u val ) { return ((int64u)((((int64u)(((byte_t*)(&val))[0])) << 56) | (((int64u)(((byte_t*)(&val))[1])) << 48) | (((int64u)(((byte_t*)(&val))[2])) << 40) | (((int64u)(((byte_t*)(&val))[3])) << 32) | (((int64u)(((byte_t*)(&val))[4])) << 24) | (((int64u)(((byte_t*)(&val))[5])) << 16) | (((int64u)(((byte_t*)(&val))[6])) << 8) | (((int64u)(((byte_t*)(&val))[7]))))); } /* ======================================= 单字交换顺序 [port] ======================================= */ cr_inline int16u xchg_int16u ( __CR_IN__ int16u val ) { /* Compiler intrinsic support */ #if defined(cr_byteswap16) return (cr_byteswap16(val)); /* Intel style inline asm (ARM) */ #elif defined(_CR_ASM_INTL_) && defined(_CR_AR_ARM_) && \ ((_CR_ARM_V32_ != 0) || (_CR_ARM_V16_ > 3)) int32u r0, tmp = val; __asm { orr r0, tmp, tmp, lsl #16 mov tmp, r0, ror #8 } return ((int16u)tmp); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("xchgb %b0, %h0" : "=q"(val) : "0"(val)); return (val); /* AT&T style inline asm (X64) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X64_) __asm__("xchgb %b0, %h0" : "=Q"(val) : "0"(val)); return (val); #else #if !defined(_CR_CC_CX51_) return (rotr_int16u(val, 8)); #else return ((int16u)((val >> 8) | (val << 8))); #endif #endif /* AR & CP TYPE predefines */ } /* ======================================= 双字交换顺序 [port] ======================================= */ cr_inline int32u xchg_int32u ( __CR_IN__ int32u val ) { /* Compiler intrinsic support */ #if defined(cr_byteswap32) return (cr_byteswap32(val)); /* Intel style inline asm (ARM) */ #elif defined(_CR_ASM_INTL_) && defined(_CR_AR_ARM_) && \ ((_CR_ARM_V32_ != 0) || (_CR_ARM_V16_ > 3)) int32u r0, r1; __asm { mvn r0, #0x0000FF00 eor r1, val, val, ror #16 and r1, r0, r1, lsr #8 eor val, r1, val, ror #8 } return (val); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) __asm__("bswap %0" : "=r"(val) : "0"(val)); return (val); /* AT&T style inline asm (X64) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X64_) __asm__("bswapl %0" : "=r"(val) : "0"(val)); return (val); #else int16u hi, lo; lo = (int16u)(val); hi = (int16u)(val >> 16); val = xchg_int16u(lo); val <<= 16; val |= xchg_int16u(hi); return (val); #endif /* AR & CP TYPE predefines */ } /* ======================================= 四字交换顺序 [port] ======================================= */ cr_inline int64u xchg_int64u ( __CR_IN__ int64u val ) { /* Compiler intrinsic support */ #if defined(cr_byteswap64) return (cr_byteswap64(val)); /* AT&T style inline asm (X86) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X86_) union { int64u u; struct { int32u a, b; } s; } tmp; tmp.u = val; __asm__("bswapl %0; bswapl %1; xchgl %0, %1" : "=r"(tmp.s.a), "=r"(tmp.s.b) : "0"(tmp.s.a), "1"(tmp.s.b)); return (tmp.u); /* AT&T style inline asm (X64) */ #elif defined(_CR_ASM_ATnT_) && defined(_CR_AR_X64_) __asm__("bswapq %0" : "=r"(val) : "0"(val)); return (val); #else int32u hi, lo; lo = (int32u)(val); hi = (int32u)(val >> 32); val = xchg_int32u(lo); val <<= 32; val |= xchg_int32u(hi); return (val); #endif /* AR & CP TYPE predefines */ } #endif /* !_CR_SICK_INLINE_ */ #endif /* !__CR_MORDER_H__ */ /*****************************************************************************/ /* _________________________________________________________________________ */ /* uBMAzRBoAKAHaACQD6FoAIAPqbgA/7rIA+5CM9uKw8D4Au7u7mSIJ0t18mYz0mYz9rAQZCgHc */ /* wRIZIgHZovGBXUAZg+v0GbB+gRmgcJ7BAAAisIlAwB1Av7LSHUC/s9IdQL+w0h1Av7HZkZmgf */ /* 4JLgIAdb262gPsqAh0+zP/uQB9ZYsFZYktq+L3sMi/AAK7gAKJAUtLdfq5IANXvT8BiQzfBIv */ /* FLaAAweAEmff53wb+Adjx3kQE2xwy5Io8ithkigcFgACJBN8E3sneNvwB2xyLHDkdfA2JHSyA */ /* adtAAQPdZYgHR0dNdbZfSYP5UHWr/kQEtAHNFg+Eef/DWAKgDw== |~~~~~~~~~~~~~~~~~~~ */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> END OF FILE <<< */ /*****************************************************************************/
prefetchnta/crhack
inc/morder.h
C
lgpl-2.1
15,312
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * DAWN OF LIGHT - The first free open source DAoC server emulator * * 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 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #define NOENCRYPTION using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using DOL.Database; using DOL.Language; using log4net; namespace DOL.GS.PacketHandler { [PacketLib(1104, GameClient.eClientVersion.Version1104)] public class PacketLib1104 : PacketLib1103 { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// <summary> /// Constructs a new PacketLib for Client Version 1.104 /// </summary> /// <param name="client">the gameclient this lib is associated with</param> public PacketLib1104(GameClient client) : base(client) { } public override void SendCharacterOverview(eRealm realm) { if (realm < eRealm._FirstPlayerRealm || realm > eRealm._LastPlayerRealm) { throw new Exception("CharacterOverview requested for unknown realm " + realm); } int firstSlot = (byte)realm * 100; using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterOverview))) { pak.FillString(m_gameClient.Account.Name, 24); if (m_gameClient.Account.Characters == null) { pak.Fill(0x0, 1880); } else { Dictionary<int, DOLCharacters> charsBySlot = new Dictionary<int, DOLCharacters>(); string itemQuery = "("; foreach (DOLCharacters c in m_gameClient.Account.Characters) { try { charsBySlot.Add(c.AccountSlot, c); itemQuery += "OwnerID = '" + c.ObjectId + "' OR "; } catch (Exception ex) { log.Error("SendCharacterOverview - Duplicate char in slot? Slot: " + c.AccountSlot + ", Account: " + c.AccountName, ex); } } itemQuery = itemQuery.Substring(0, itemQuery.Length - 4); //remove last OR itemQuery += ") AND SlotPosition >= " + ((int)eInventorySlot.MinEquipable) + " AND SlotPosition <= " + ((int)eInventorySlot.MaxEquipable); var itemsByOwnerID = new Dictionary<string, Dictionary<eInventorySlot, InventoryItem>>(); var allItems = (InventoryItem[])GameServer.Database.SelectObjects<InventoryItem>(itemQuery); foreach (InventoryItem item in allItems) { try { if (!itemsByOwnerID.ContainsKey(item.OwnerID)) itemsByOwnerID.Add(item.OwnerID, new Dictionary<eInventorySlot, InventoryItem>()); itemsByOwnerID[item.OwnerID].Add((eInventorySlot)item.SlotPosition, item); } catch (Exception ex) { log.Error("SendCharacterOverview - Duplicate item on character? OwnerID: " + item.OwnerID + ", SlotPosition: " + item.SlotPosition + ", Account: " + m_gameClient.Account.Name, ex); } } for (int i = firstSlot; i < (firstSlot + 10); i++) { DOLCharacters c = null; if (!charsBySlot.TryGetValue(i, out c)) { pak.Fill(0x0, 188); } else { Dictionary<eInventorySlot, InventoryItem> charItems = null; if (!itemsByOwnerID.TryGetValue(c.ObjectId, out charItems)) charItems = new Dictionary<eInventorySlot, InventoryItem>(); byte extensionTorso = 0; byte extensionGloves = 0; byte extensionBoots = 0; InventoryItem item = null; if (charItems.TryGetValue(eInventorySlot.TorsoArmor, out item)) extensionTorso = item.Extension; if (charItems.TryGetValue(eInventorySlot.HandsArmor, out item)) extensionGloves = item.Extension; if (charItems.TryGetValue(eInventorySlot.FeetArmor, out item)) extensionBoots = item.Extension; pak.Fill(0x00, 4);//new heading bytes in from 1.99 relocated in 1.104 pak.FillString(c.Name, 24); pak.WriteByte(0x01); pak.WriteByte((byte)c.EyeSize); pak.WriteByte((byte)c.LipSize); pak.WriteByte((byte)c.EyeColor); pak.WriteByte((byte)c.HairColor); pak.WriteByte((byte)c.FaceType); pak.WriteByte((byte)c.HairStyle); pak.WriteByte((byte)((extensionBoots << 4) | extensionGloves)); pak.WriteByte((byte)((extensionTorso << 4) | (c.IsCloakHoodUp ? 0x1 : 0x0))); pak.WriteByte((byte)c.CustomisationStep); //1 = auto generate config, 2= config ended by player, 3= enable config to player pak.WriteByte((byte)c.MoodType); pak.Fill(0x0, 13); //0 String string locationDescription = string.Empty; Region region = WorldMgr.GetRegion((ushort)c.Region); if (region != null) { locationDescription = m_gameClient.GetTranslatedSpotDescription(region, c.Xpos, c.Ypos, c.Zpos); } pak.FillString(locationDescription, 24); string classname = ""; if (c.Class != 0) classname = ((eCharacterClass)c.Class).ToString(); pak.FillString(classname, 24); string racename = m_gameClient.RaceToTranslatedName(c.Race, c.Gender); pak.FillString(racename, 24); pak.WriteByte((byte)c.Level); pak.WriteByte((byte)c.Class); pak.WriteByte((byte)c.Realm); pak.WriteByte((byte)((((c.Race & 0x10) << 2) + (c.Race & 0x0F)) | (c.Gender << 4))); // race max value can be 0x1F pak.WriteShortLowEndian((ushort)c.CurrentModel); pak.WriteByte((byte)c.Region); if (region == null || (int)m_gameClient.ClientType > region.Expansion) pak.WriteByte(0x00); else pak.WriteByte((byte)(region.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone pak.WriteInt(0x0); // Internal database ID pak.WriteByte((byte)c.Strength); pak.WriteByte((byte)c.Dexterity); pak.WriteByte((byte)c.Constitution); pak.WriteByte((byte)c.Quickness); pak.WriteByte((byte)c.Intelligence); pak.WriteByte((byte)c.Piety); pak.WriteByte((byte)c.Empathy); pak.WriteByte((byte)c.Charisma); InventoryItem rightHandWeapon = null; charItems.TryGetValue(eInventorySlot.RightHandWeapon, out rightHandWeapon); InventoryItem leftHandWeapon = null; charItems.TryGetValue(eInventorySlot.LeftHandWeapon, out leftHandWeapon); InventoryItem twoHandWeapon = null; charItems.TryGetValue(eInventorySlot.TwoHandWeapon, out twoHandWeapon); InventoryItem distanceWeapon = null; charItems.TryGetValue(eInventorySlot.DistanceWeapon, out distanceWeapon); InventoryItem helmet = null; charItems.TryGetValue(eInventorySlot.HeadArmor, out helmet); InventoryItem gloves = null; charItems.TryGetValue(eInventorySlot.HandsArmor, out gloves); InventoryItem boots = null; charItems.TryGetValue(eInventorySlot.FeetArmor, out boots); InventoryItem torso = null; charItems.TryGetValue(eInventorySlot.TorsoArmor, out torso); InventoryItem cloak = null; charItems.TryGetValue(eInventorySlot.Cloak, out cloak); InventoryItem legs = null; charItems.TryGetValue(eInventorySlot.LegsArmor, out legs); InventoryItem arms = null; charItems.TryGetValue(eInventorySlot.ArmsArmor, out arms); pak.WriteShortLowEndian((ushort)(helmet != null ? helmet.Model : 0)); pak.WriteShortLowEndian((ushort)(gloves != null ? gloves.Model : 0)); pak.WriteShortLowEndian((ushort)(boots != null ? boots.Model : 0)); ushort rightHandColor = 0; if (rightHandWeapon != null) { rightHandColor = (ushort)(rightHandWeapon.Emblem != 0 ? rightHandWeapon.Emblem : rightHandWeapon.Color); } pak.WriteShortLowEndian(rightHandColor); pak.WriteShortLowEndian((ushort)(torso != null ? torso.Model : 0)); pak.WriteShortLowEndian((ushort)(cloak != null ? cloak.Model : 0)); pak.WriteShortLowEndian((ushort)(legs != null ? legs.Model : 0)); pak.WriteShortLowEndian((ushort)(arms != null ? arms.Model : 0)); ushort helmetColor = 0; if (helmet != null) { helmetColor = (ushort)(helmet.Emblem != 0 ? helmet.Emblem : helmet.Color); } pak.WriteShortLowEndian(helmetColor); ushort glovesColor = 0; if (gloves != null) { glovesColor = (ushort)(gloves.Emblem != 0 ? gloves.Emblem : gloves.Color); } pak.WriteShortLowEndian(glovesColor); ushort bootsColor = 0; if (boots != null) { bootsColor = (ushort)(boots.Emblem != 0 ? boots.Emblem : boots.Color); } pak.WriteShortLowEndian(bootsColor); ushort leftHandWeaponColor = 0; if (leftHandWeapon != null) { leftHandWeaponColor = (ushort)(leftHandWeapon.Emblem != 0 ? leftHandWeapon.Emblem : leftHandWeapon.Color); } pak.WriteShortLowEndian(leftHandWeaponColor); ushort torsoColor = 0; if (torso != null) { torsoColor = (ushort)(torso.Emblem != 0 ? torso.Emblem : torso.Color); } pak.WriteShortLowEndian(torsoColor); ushort cloakColor = 0; if (cloak != null) { cloakColor = (ushort)(cloak.Emblem != 0 ? cloak.Emblem : cloak.Color); } pak.WriteShortLowEndian(cloakColor); ushort legsColor = 0; if (legs != null) { legsColor = (ushort)(legs.Emblem != 0 ? legs.Emblem : legs.Color); } pak.WriteShortLowEndian(legsColor); ushort armsColor = 0; if (arms != null) { armsColor = (ushort)(arms.Emblem != 0 ? arms.Emblem : arms.Color); } pak.WriteShortLowEndian(armsColor); //weapon models pak.WriteShortLowEndian((ushort)(rightHandWeapon != null ? rightHandWeapon.Model : 0)); pak.WriteShortLowEndian((ushort)(leftHandWeapon != null ? leftHandWeapon.Model : 0)); pak.WriteShortLowEndian((ushort)(twoHandWeapon != null ? twoHandWeapon.Model : 0)); pak.WriteShortLowEndian((ushort)(distanceWeapon != null ? distanceWeapon.Model : 0)); if (c.ActiveWeaponSlot == (byte)DOL.GS.GameLiving.eActiveWeaponSlot.TwoHanded) { pak.WriteByte(0x02); pak.WriteByte(0x02); } else if (c.ActiveWeaponSlot == (byte)DOL.GS.GameLiving.eActiveWeaponSlot.Distance) { pak.WriteByte(0x03); pak.WriteByte(0x03); } else { byte righthand = 0xFF; byte lefthand = 0xFF; if (rightHandWeapon != null) righthand = 0x00; if (leftHandWeapon != null) lefthand = 0x01; pak.WriteByte(righthand); pak.WriteByte(lefthand); } if (region == null || region.Expansion != 1) pak.WriteByte(0x00); else pak.WriteByte(0x01); //0x01=char in SI zone, classic client can't "play" pak.WriteByte((byte)c.Constitution); } } } pak.Fill(0x0, 94); SendTCP(pak); } } public override void SendDupNameCheckReply(string name, bool nameExists) { if (m_gameClient == null || m_gameClient.Account == null) return; // This presents the user with Name Not Allowed which may not be correct but at least it prevents duplicate char creation // - tolakram using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DupNameCheckReply))) { pak.FillString(name, 30); pak.FillString(m_gameClient.Account.Name, 24); pak.WriteByte((byte)(nameExists ? 0x1 : 0x0)); pak.Fill(0x0, 3); SendTCP(pak); } } } }
dudemanvox/Dawn-of-Light-Server
GameServer/packets/Server/PacketLib1104.cs
C#
gpl-2.0
12,267
[ 30522, 1013, 1008, 1008, 6440, 1997, 2422, 1011, 1996, 2034, 2489, 2330, 3120, 4830, 10085, 8241, 7861, 20350, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 1008, 19933, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.phpdoctrine.org>. */ namespace Doctrine\ORM\Mapping; /** * A MappingException indicates that something is wrong with the mapping setup. * * @since 2.0 */ class MappingException extends \Doctrine\ORM\ORMException { public static function pathRequired() { return new self("Specifying the paths to your entities is required ". "in the AnnotationDriver to retrieve all class names."); } public static function identifierRequired($entityName) { return new self("No identifier/primary key specified for Entity '$entityName'." . " Every Entity must have an identifier/primary key."); } public static function invalidInheritanceType($entityName, $type) { return new self("The inheritance type '$type' specified for '$entityName' does not exist."); } public static function generatorNotAllowedWithCompositeId() { return new self("Id generators can't be used with a composite id."); } public static function missingFieldName() { return new self("The association mapping misses the 'fieldName' attribute."); } public static function missingTargetEntity($fieldName) { return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute."); } public static function missingSourceEntity($fieldName) { return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); } public static function mappingFileNotFound($entityName, $fileName) { return new self("No mapping file found named '$fileName' for class '$entityName'."); } public static function mappingNotFound($className, $fieldName) { return new self("No mapping found for field '$fieldName' on class '$className'."); } public static function oneToManyRequiresMappedBy($fieldName) { return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute."); } public static function joinTableRequired($fieldName) { return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute."); } /** * Called if a required option was not found but is required * * @param string $field which field cannot be processed? * @param string $expectedOption which option is required * @param string $hint Can optionally be used to supply a tip for common mistakes, * e.g. "Did you think of the plural s?" * @return MappingException */ static function missingRequiredOption($field, $expectedOption, $hint = '') { $message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required."; if ( ! empty($hint)) { $message .= ' (Hint: ' . $hint . ')'; } return new self($message); } /** * Generic exception for invalid mappings. * * @param string $fieldName */ public static function invalidMapping($fieldName) { return new self("The mapping of field '$fieldName' is invalid."); } /** * Exception for reflection exceptions - adds the entity name, * because there might be long classnames that will be shortened * within the stacktrace * * @param string $entity The entity's name * @param \ReflectionException $previousException */ public static function reflectionFailure($entity, \ReflectionException $previousException) { return new self('An error occurred in ' . $entity, 0, $previousException); } public static function joinColumnMustPointToMappedField($className, $joinColumn) { return new self('The column ' . $joinColumn . ' must be mapped to a field in class ' . $className . ' since it is referenced by a join column of another class.'); } public static function classIsNotAValidEntityOrMappedSuperClass($className) { return new self('Class '.$className.' is not a valid entity or mapped super class.'); } public static function propertyTypeIsRequired($className, $propertyName) { return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName."."); } public static function tableIdGeneratorNotImplemented($className) { return new self("TableIdGenerator is not yet implemented for use with class ".$className); } /** * * @param string $entity The entity's name * @param string $fieldName The name of the field that was already declared */ public static function duplicateFieldMapping($entity, $fieldName) { return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); } public static function duplicateAssociationMapping($entity, $fieldName) { return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); } public static function singleIdNotAllowedOnCompositePrimaryKey($entity) { return new self('Single id is not allowed on composite primary key in entity '.$entity); } public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType) { return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") ' .'is not supported by Doctrine.' ); } public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) { if ( ! empty($path)) { $path = '[' . $path . ']'; } return new self( 'File mapping drivers must have a valid directory path, ' . 'however the given path ' . $path . ' seems to be incorrect!' ); } /** * Throws an exception that indicates that a class used in a discriminator map does not exist. * An example would be an outdated (maybe renamed) classname. * * @param string $className The class that could not be found * @param string $owningClass The class that declares the discriminator map. * @return self */ public static function invalidClassInDiscriminatorMap($className, $owningClass) { return new self( "Entity class '$className' used in the discriminator map of class '$owningClass' ". "does not exist." ); } public static function missingDiscriminatorMap($className) { return new self("Entity class '$className' is using inheritance but no discriminator map was defined."); } public static function missingDiscriminatorColumn($className) { return new self("Entity class '$className' is using inheritance but no discriminator column was defined."); } public static function invalidDiscriminatorColumnType($className, $type) { return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!"); } public static function cannotVersionIdField($className, $fieldName) { return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported."); } /** * @param string $className * @param string $columnName * @return self */ public static function duplicateColumnName($className, $columnName) { return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping."); } }
notmessenger/ZF-REST-API
library/Doctrine/ORM/Mapping/MappingException.php
PHP
bsd-3-clause
8,678
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 4007, 2003, 3024, 2011, 1996, 9385, 13304, 1998, 16884, 1008, 1000, 2004, 2003, 1000, 1998, 2151, 4671, 2030, 13339, 10943, 3111, 1010, 2164, 1010, 2021, 2025, 1008, 3132, 2000, 1010, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var doNothing = function () {} /** * The `Base` log defines methods that transports will share. */ var Base = module.exports = function (config, defaults) { var cedar = require('../../cedar') // A log is a shorthand for `log.log`, among other things. var log = function () { log.log.apply(log, arguments) } // Don't run `setMethods` until all config properties are set. var setMethods = doNothing // Define properties that trigger `setMethods`. Base.resetters.forEach(function (property) { var value Object.defineProperty(log, property, { get: function () { return value }, set: function (newValue) { value = newValue setMethods.apply(log) } }) }) // Copy `config` properties to the `log`. Base.decorate(log, config, true) // Apply default properties. Base.decorate(log, defaults || Base.defaults) // Set up logging methods. Base.setMethods.apply(log) // Re-run `setMethods` if `resetters` change. setMethods = Base.setMethods // Return the fully-decorated log function. return log } /** * Some properties will reset methods if changed. */ Base.resetters = ['level', 'prefixes', 'format', 'showTrace'] /** * Cedar supports 7 levels of logging. */ Base.levels = ['trace', 'debug', 'log', 'info', 'warn', 'error', 'fatal'] /** * Share defaults between log objects. */ Base.defaults = { // Show all log messages by default. level: 'trace', // Stream to `stdout` (using `write`). stream: process.stdout, // Don't add any space to JSON. space: '', // Stringify with `JSON.stringify`. stringify: JSON.stringify, // Join arguments together as an array. join: function (args) { var list = [] for (var index = 0, length = args.length; index < length; index++) { var arg = args[index] if (arg instanceof Error) { arg = '"' + (arg.stack || arg.toString()).replace(/\n/, '\\n') + '"' } else { arg = JSON.stringify(arg, null, this.space) } list.push(arg) } return '[' + list.join(',') + ']' }, // Start messages with a prefix for each log method. prefixes: { trace: 'TRACE ', debug: 'DEBUG ', log: 'LOG ', info: 'INFO ', warn: 'WARN ', error: 'ERROR ', fatal: 'FATAL ' }, // Format a log message. format: function (message, type, prefix) { return prefix + message + '\n' } } /** * Decorate an object with the properties of another. */ Base.decorate = function (object, defaults, shouldOverwrite) { object = object || {} for (var key in defaults) { if (shouldOverwrite || (typeof object[key] === 'undefined')) { object[key] = defaults[key] } } return object } /** * Create logging methods based on the configured `level`. */ Base.setMethods = function () { var self = this var found = false if ((Base.levels.indexOf(self.level) < 0) && self.level !== 'nothing') { self.error('Unknown log level: "' + self.level + '".') } else { Base.levels.forEach(function (methodName, index) { if (methodName === self.level) { found = true } var prefix = self.prefixes[methodName] || '' var format = self.format // If this log is an Emitter, we can catch and emit errors. if (self.emit) { self[methodName] = found ? function () { var message = self.join(arguments) message = format.call(self, message, methodName, prefix) try { self.stream.write(message) } catch (e) { self.emit('error', e) } } : doNothing // Otherwise, they'll just throw. } else { self[methodName] = found ? function () { var message = self.join(arguments) message = format.call(self, message, methodName, prefix) self.stream.write(message) } : doNothing } }) // Wrap the trace method with a stack tracer. if (self.trace !== doNothing) { var traceMethod = self.trace self.trace = function () { var e = new Error('') Error.captureStackTrace(e, self.trace) var l = arguments.length arguments[l] = e.stack.split('\n').splice(2).join('\n') arguments.length = ++l traceMethod.apply(self, arguments) } } } }
zerious/cedar
lib/transports/base.js
JavaScript
isc
4,332
[ 30522, 13075, 2123, 14573, 2075, 1027, 3853, 1006, 1007, 1063, 1065, 1013, 1008, 1008, 1008, 1996, 1036, 2918, 1036, 8833, 11859, 4725, 2008, 19003, 2097, 3745, 1012, 1008, 1013, 13075, 2918, 1027, 11336, 1012, 14338, 1027, 3853, 1006, 9530...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `wl_region` struct in crate `wayland_client`."> <meta name="keywords" content="rust, rustlang, rust-lang, wl_region"> <title>wayland_client::ffi::interfaces::region::wl_region - Rust</title> <link rel="stylesheet" type="text/css" href="../../../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../../../index.html'>wayland_client</a>::<wbr><a href='../../index.html'>ffi</a>::<wbr><a href='../index.html'>interfaces</a>::<wbr><a href='index.html'>region</a></p><script>window.sidebarCurrent = {name: 'wl_region', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content struct"> <h1 class='fqn'><span class='in-band'>Struct <a href='../../../index.html'>wayland_client</a>::<wbr><a href='../../index.html'>ffi</a>::<wbr><a href='../index.html'>interfaces</a>::<wbr><a href='index.html'>region</a>::<wbr><a class='struct' href=''>wl_region</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-10643' class='srclink' href='../../../../src/wayland_client/ffi/interfaces/region.rs.html#10' title='goto source code'>[src]</a></span></h1> <pre class='rust struct'>pub struct wl_region;</pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../../../"; window.currentCrate = "wayland_client"; window.playgroundUrl = ""; </script> <script src="../../../../jquery.js"></script> <script src="../../../../main.js"></script> <script async src="../../../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
wayland_client/ffi/interfaces/region/struct.wl_region.html
HTML
mpl-2.0
4,128
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ .heap-snapshot-sidebar-tree-item .icon { content: url(Images/profileIcon.png); } .heap-snapshot-sidebar-tree-item.small .icon { content: url(Images/profileSmallIcon.png); } .heap-snapshot-view { overflow: hidden; } .heap-snapshot-view .data-grid { border: none; } .heap-snapshot-view .data-grid tr:empty { height: 16px; visibility: hidden; } .heap-snapshot-view .data-grid span.percent-column { width: 32px; } .heap-snapshot-view .object-value-object, .object-value-node { display: inline; position: static; } .detached-dom-tree-node { background-color: #FF9999; } .heap-snapshot-view .object-value-string { white-space: nowrap; } .heap-snapshot-view tr:not(.selected) .object-value-id { color: grey; } .heap-snapshot-view .data-grid { flex: auto; } .heap-snapshot-view .heap-tracking-overview { flex: 0 0 80px; height: 80px; } .heap-snapshot-view .retaining-paths-view { overflow: hidden; } .heap-snapshot-view .heap-snapshot-view-resizer { background-image: url(Images/statusbarResizerVertical.png); background-color: #eee; border-bottom: 1px solid rgb(179, 179, 179); background-repeat: no-repeat; background-position: right center, center; flex: 0 0 21px; } .heap-snapshot-view .heap-snapshot-view-resizer .title > span { display: inline-block; padding-top: 3px; vertical-align: middle; margin-left: 4px; margin-right: 8px; } .heap-snapshot-view .heap-snapshot-view-resizer * { pointer-events: none; } .heap-snapshot-view .heap-object-details-header { background-color: #eee; } .heap-snapshot-view tr:not(.selected) td.object-column span.highlight { background-color: rgb(255, 255, 200); } .heap-snapshot-view td.object-column span.grayed { color: gray; } .cycled-ancessor-node { opacity: 0.6; } #heap-recording-view .heap-snapshot-view { top: 80px; } .heap-overview-container { overflow: hidden; position: absolute; top: 0; width: 100%; height: 80px; } #heap-recording-overview-grid .resources-dividers-label-bar { pointer-events: auto; } #heap-recording-overview-container { border-bottom: 1px solid rgba(0, 0, 0, 0.3); } .heap-recording-overview-canvas { position: absolute; top: 20px; left: 0; right: 0; bottom: 0; } .heap-snapshot-stats-pie-chart { margin: 12px 30px; } .heap-snapshot-stats-legend { margin-left: 24px; } .heap-snapshot-stats-legend > div { margin-top: 1px; width: 170px; } .heap-snapshot-stats-swatch { display: inline-block; width: 10px; height: 10px; border: 1px solid rgba(100, 100, 100, 0.3); } .heap-snapshot-stats-swatch.heap-snapshot-stats-empty-swatch { border: none; } .heap-snapshot-stats-name, .heap-snapshot-stats-size { display: inline-block; margin-left: 6px; } .heap-snapshot-stats-size { float: right; text-align: right; } .heap-allocation-stack .stack-frame { display: flex; justify-content: space-between; border-bottom: 1px solid rgb(240, 240, 240); padding: 2px; } .heap-allocation-stack .stack-frame a { color: rgb(33%, 33%, 33%); } .no-heap-allocation-stack { padding: 5px; }
sgraham/nope
third_party/WebKit/Source/devtools/front_end/profiler/heapProfiler.css
CSS
bsd-3-clause
4,832
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2268, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 9385, 1006, 1039, 1007, 2230, 6207, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# ============================================================================ # Literals # ============================================================================ include literals FORSCRED=$(subst /,\/,$(FORS_CREDENTIALS)) OXIDCRED=$(subst /,\/,$(OXID_CREDENTIALS)) OPENXID=$(subst /,\/,$(OPENXID_URL)) # ============================================================================ # Commands # ============================================================================ CC=php -l # ============================================================================ # Objects # ============================================================================ SOURCES=$(patsubst %.php,%.chk,$(wildcard *.php)) # ============================================================================ # Targets # ============================================================================ all: install compile test doxygen compile: $(SOURCES) %.chk: %.php $(CC) $< test: @echo "Unit tests is not implemented yet!" install: cp -f openxid.ini_INSTALL openxid.ini sed -i 's/^;*aaa_credentials[ ]*=[ ]*.*/aaa_credentials = $(FORSCRED)/' openxid.ini chmod -w openxid.ini cp -f openxid.wsdl_INSTALL openxid.wsdl sed -i 's/^.*openxid.addi.dk.*/ <soap:address location="$(OPENXID)"\/>/' openxid.wsdl chmod -w openxid.wsdl cp -f robots.txt_INSTALL robots.txt chmod -w robots.txt literals: @echo "Before installation, please copy literals_INSTALL to literals, and edit" doxygen: doxygen openxid.doxygen
DBCDK/OpenXId-webservice
Makefile
Makefile
agpl-3.0
1,513
[ 30522, 1001, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
app.controller('JoinGameController', function ($scope, $location, authorization, identity, ticTacToeData, notifier) { 'use strict'; $scope.joinGame = function (gameId) { if (identity.isAuthenticated() === true) { ticTacToeData.joinGame(authorization.getAuthorizationHeader(), gameId) .then(function () { notifier.success('Game joined!'); }, function () { notifier.error('Invalid data!'); }); } else { notifier.error('Please login!'); } }; $scope.joinRandomGame = function () { if (identity.isAuthenticated() === true) { ticTacToeData.joinRandomGame(authorization.getAuthorizationHeader()) .then(function () { notifier.success('Game joined!'); }); } else { notifier.error('Please login!'); } } });
svilenbonev/TelerikAcademy
JavaScript-SPA/Tic-Tac-Toe-Game/TicTacToe.Client/app/js/controllers/JoinGameController.js
JavaScript
mit
956
[ 30522, 10439, 1012, 11486, 1006, 1005, 3693, 16650, 8663, 13181, 10820, 1005, 1010, 3853, 1006, 1002, 9531, 1010, 1002, 3295, 1010, 20104, 1010, 4767, 1010, 14841, 25572, 6593, 29099, 6790, 1010, 2025, 18095, 1007, 1063, 1005, 2224, 9384, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* eslint-disable no-console */ import assert from "assert"; import * as fs from "fs"; import * as os from "os"; import * as asyncio from "@azure-tools/async-io"; import * as tasks from "@azure-tools/tasks"; import { ExtensionManager, InvalidPackageIdentityException, UnresolvedPackageException } from "../src"; const tmpFolder = fs.mkdtempSync(`${fs.mkdtempSync(`${os.tmpdir()}/test`)}/install-pkg`); // Those test do install pacakge and could take a little bit of time. Increasing timeout to 50s. const TEST_TIMEOUT = 50_000; describe("TestExtensions", () => { let extensionManager: ExtensionManager; beforeEach(async () => { extensionManager = await ExtensionManager.Create(tmpFolder); }); afterEach(async () => { try { await extensionManager.dispose(); try { await tasks.Delay(500); await asyncio.rmdir(tmpFolder); } catch (E) { console.error("rmdir is giving grief... [probably intermittent]"); } } catch (e) { console.error("ABORTING\n"); console.error(e); throw "AFTER TEST ABORTED"; } }); it( "reset", async () => { await extensionManager.reset(); { console.log("Installing Once"); // install it once const dni = await extensionManager.findPackage("echo-cli", "*"); const installing = extensionManager.installPackage(dni, false, 60000, (i) => {}); const extension = await installing; assert.notEqual(await extension.configuration, "the configuration file isnt where it should be?"); } { console.log("Attempt Overwrite"); // install/overwrite const dni = await extensionManager.findPackage("echo-cli", "*"); const installing = extensionManager.installPackage(dni, true, 60000, (i) => {}); // install at the same time? const dni2 = await extensionManager.findPackage("echo-cli", "*"); const installing2 = extensionManager.installPackage(dni2, true, 60000, (i) => {}); // wait for it. const extension = await installing; assert.notEqual(await extension.configuration, ""); const extension2 = await installing2; assert.notEqual(await extension.configuration, ""); let done = false; for (const each of await extensionManager.getInstalledExtensions()) { done = true; // make sure we have one extension installed and that it is echo-cli (for testing) assert.equal(each.name, "echo-cli"); } assert.equal(done, true, "Package is not installed"); //await tasks.Delay(5000); } }, TEST_TIMEOUT, ); /* @test async 'FindPackage- in github'() { // github repo style const npmpkg = await extensionManager.findPackage('npm', 'npm/npm'); assert.equal(npmpkg.name, 'npm'); } */ it( "FindPackage- in npm", async () => { const p = await extensionManager.findPackage("autorest"); assert.equal(p.name, "autorest"); }, TEST_TIMEOUT, ); it( "FindPackage- unknown package", async () => { let threw = false; try { const p = await extensionManager.findPackage("koooopasdpasdppasdpa"); } catch (e) { if (e instanceof UnresolvedPackageException) { threw = true; } } assert.equal(threw, true, "Expected unknown package to throw UnresolvedPackageException"); }, TEST_TIMEOUT, ); it( "BadPackageID- garbage name", async () => { let threw = false; try { await extensionManager.findPackage("LLLLl", "$DDFOIDFJIODFJ"); } catch (e) { if (e instanceof InvalidPackageIdentityException) { threw = true; } } assert.equal(threw, true, "Expected bad package id to throw InvalidPackageIdentityException"); }, TEST_TIMEOUT, ); it("View Versions", async () => { // gets a package const pkg = await extensionManager.findPackage("echo-cli"); // finds out if there are more versions assert.equal((await pkg.allVersions).length > 5, true); }); it( "Install Extension", async () => { const dni = await extensionManager.findPackage("echo-cli", "1.0.8"); const installing = extensionManager.installPackage(dni, false, 5 * 60 * 1000, (installing) => {}); const extension = await installing; assert.notEqual(await extension.configuration, ""); let done = false; for (const each of await extensionManager.getInstalledExtensions()) { done = true; // make sure we have one extension installed and that it is echo-cli (for testing) assert.equal(each.name, "echo-cli"); } assert.equal(done, true, "Package is not installed"); }, TEST_TIMEOUT, ); it( "Install Extension via star", async () => { const dni = await extensionManager.findPackage("echo-cli", "*"); const installing = extensionManager.installPackage(dni, false, 5 * 60 * 1000, (installing) => {}); const extension = await installing; assert.notEqual(await extension.configuration, ""); let done = false; for (const each of await extensionManager.getInstalledExtensions()) { done = true; // make sure we have one extension installed and that it is echo-cli (for testing) assert.equal(each.name, "echo-cli"); } assert.equal(done, true, "Package is not installed"); }, TEST_TIMEOUT, ); it( "Force install", async () => { const dni = await extensionManager.findPackage("echo-cli", "*"); const installing = extensionManager.installPackage(dni, false, 5 * 60 * 1000, (installing) => {}); const extension = await installing; assert.notEqual(await extension.configuration, ""); // erase the readme.md file in the installed folder (check if force works to reinstall) await asyncio.rmFile(await extension.configurationPath); // reinstall with force! const installing2 = extensionManager.installPackage(dni, true, 5 * 60 * 1000, (installing) => {}); const extension2 = await installing2; // is the file back? assert.notEqual(await extension2.configuration, ""); }, TEST_TIMEOUT, ); it( "Test Start", async () => { try { const dni = await extensionManager.findPackage("none", "fearthecowboy/echo-cli"); const installing = extensionManager.installPackage(dni, false, 5 * 60 * 1000, (installing) => {}); const extension = await installing; assert.notEqual(await extension.configuration, ""); const proc = await extension.start(); await tasks.When(proc, "exit"); } catch (E) { // oh well... console.error(E); assert(false, "FAILED DURING START TEST."); } }, TEST_TIMEOUT, ); });
Azure/autorest
packages/libs/extension/test/test-extensions.test.ts
TypeScript
mit
6,880
[ 30522, 1013, 1008, 9686, 4115, 2102, 1011, 4487, 19150, 2053, 1011, 10122, 1008, 1013, 12324, 20865, 2013, 1000, 20865, 1000, 1025, 12324, 1008, 2004, 1042, 2015, 2013, 1000, 1042, 2015, 1000, 1025, 12324, 1008, 2004, 9808, 2013, 1000, 9808...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
all: linux linux: main tresmeios rostorobo movimentos curvas help headers/debug.h g++ -o trabalho1compgraf_linux -fwhole-program -O2 -Wall -Wextra main.o tresmeios.o movimentos.o rostorobo.o curvas.o help.o -lglui -lglut -lGLU -lGL -lm #Compilação para Windows NAO FOI TESTADA pois nenhum dos membros utilizava ambiente Windows durante o desenvolvimento do projeto win: main tresmeios rostorobo movimentos curvas help headers/debug.h g++ -o trabalho1compgraf_win.exe -O2 -Wall -Wextra main.o tresmeios.o movimentos.o rostorobo.o curvas.o help.o -lglui32 -lglut32 -lglu32 -lopengl32 -lm main: src/main.c headers/main.h g++ -c -o main.o -O2 -Wall -Wextra src/main.c tresmeios: src/tresmeios.c headers/tresmeios.h g++ -c -o tresmeios.o -O2 -Wall -Wextra src/tresmeios.c rostorobo: src/rostorobo.c headers/rostorobo.h g++ -c -o movimentos.o -O2 -Wall -Wextra src/movimentos.c movimentos: src/movimentos.c headers/movimentos.h g++ -c -o rostorobo.o -O2 -Wall -Wextra src/rostorobo.c curvas: src/curvas.c headers/curvas.h g++ -c -o curvas.o -O2 -Wall -Wextra src/curvas.c help: src/help.c headers/help.h g++ -c -o help.o -O2 -Wall -Wextra src/help.c clean: rm trabalho1compgraf_linux rm main.o rm tresmeios.o rm movimentos.o rm rostorobo.o rm curvas.o rm help.o
brunobuss/trabcompgraf
Makefile
Makefile
mit
1,287
[ 30522, 2035, 1024, 11603, 11603, 1024, 2364, 24403, 26432, 2891, 20996, 23809, 16429, 2080, 9587, 5737, 23065, 2015, 12731, 19146, 2015, 2393, 20346, 30524, 2057, 18413, 2527, 2364, 1012, 1051, 24403, 26432, 2891, 1012, 1051, 9587, 5737, 2306...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{ var x = f; x = items[0]; x = items[1]; }
stas-vilchik/bdd-ml
data/2043.js
JavaScript
mit
49
[ 30522, 1063, 13075, 1060, 1027, 1042, 1025, 1060, 1027, 5167, 1031, 1014, 1033, 1025, 1060, 1027, 5167, 1031, 1015, 1033, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; /** * app settings factory * stores the custom user settings and shares it app wide */ var app = angular.module('istart'); app.factory('appSettings', ['$q', '$rootScope',function ($q, $rootScope) { /** * migrate the old settings from istart 1.x to the * istartV2! * @type {{loaded: null, settingsDefault: {background: {imageadd: boolean, cssadd: boolean, css: string, image: string}}, config: null, save: save, loadOptions: loadOptions, background: background}} */ //if(localStorage.istartbackground) var settings = { loaded:null, backgroundSizeOptions: ['cover', 'initial'], backgroundRepeatOptions: ['no-repeat', 'repeat'], settingsDefault : { background: { imageadd:false, cssadd:false, css: '', image:'', options:null, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }, mouseWheel: { active:true }, globalsearch: { active:false }, updateCenter: { show:false, version:"2.0.1.60" }, header: { alternative:false, menuIconColor:'rgba(0, 0, 0, 0.87)', menuDimension: { w:30, h:30 } } }, config:null, save : function() { try { chrome.storage.local.set({'options': JSON.stringify(settings.config)}, function( ){ }); } catch(e) { console.error(e); } }, loadOptions : function() { var defer = $q.defer(); chrome.storage.local.get('options', function(settingsRaw) { var settingsArr=null; if(typeof settingsRaw.options == "undefined") { //first run save init config settings.config=settings.settingsDefault; settings.loaded=true; settings.save(); defer.resolve(); return; } try { settingsArr = JSON.parse(settingsRaw.options); console.log(settingsArr); settings.config=settingsArr; settings.loaded=true; defer.resolve(); } catch(e) { } }); return defer.promise; }, setBackgroundImage: function(bgImage) { settings.config.background.imageadd=true; settings.config.background.image=bgImage; settings.save(); }, setBackgroundSize: function(backgroundSize) { settings.config.background.backgroundSize = backgroundSize; settings.save(); $rootScope.$broadcast('changeBackground'); }, setBackgroundRepeat: function(backgroundRepeat) { settings.config.background.backgroundRepeat = backgroundRepeat; settings.save(); $rootScope.$broadcast('changeBackground'); }, setmouseWheelActive: function(activeState) { if(typeof settings.config.mouseWheel !== "undefined") { settings.config.mouseWheel.active=activeState; } else { settings.config.mouseWheel = { active: activeState }; } settings.save(); $rootScope.$broadcast('mouseWheelSettingsChanged', {}); }, checkSettingsLoaded: function() { var defer = $q.defer(); if(settings.loaded==null) { //console.log(localStorage.istartbackground, 'BACKGROUND SETTINGS', localStorage.istartbackground!="null", localStorage.istartbackground!==null); if(localStorage.istartbackground!="null") { settings.loadV1BackgroundSettings(); } //nothing loaded load the settings settings.loadOptions() .then(function() { defer.resolve(true); }) } else { defer.resolve(true); } return defer.promise; }, updateCenter: function() { var defer = $q.defer(); this.checkSettingsLoaded().then( function() { if(typeof settings.config.updateCenter !== "undefined") { defer.resolve(settings.config.updateCenter); } else { /** * if the settings are not present than this version didnt has the * updated settings object! So we add simply true to this object * and resolve it */ defer.resolve(settings.settingsDefault.updateCenter); } }); return defer.promise; }, setUpdateCenter: function(show, versionString) { if(typeof settings.config.updateCenter !== "undefined") { settings.config.updateCenter.show=show; settings.config.updateCenter.version=versionString; } else { settings.config.updateCenter = { show: show, version: versionString }; } settings.save(); //$rootScope.$broadcast('globalsearchSettingsChanged', {}); }, setGlobalSearch: function(activeState) { if(typeof settings.config.globalsearch !== "undefined") { settings.config.globalsearch.active=activeState; } else { settings.config.globalsearch = { active: activeState }; } settings.save(); $rootScope.$broadcast('globalsearchSettingsChanged', {}); }, globalSearch: function() { var defer = $q.defer(); this.checkSettingsLoaded().then( function() { if(typeof settings.config.globalsearch !== "undefined") { defer.resolve(settings.config.globalsearch); } else { /** * if the settings are not present than this version didnt has the * updated settings object! So we add simply true to this object * and resolve it */ defer.resolve(settings.settingsDefault.globalsearch); } }); return defer.promise; }, ensureHeaderConfigExists: function() { if(typeof settings.config.header == "undefined") { settings.config.header = settings.settingsDefault.header; } }, setHeaderAlternative: function(alternativeState) { settings.ensureHeaderConfigExists(); settings.config.header.alternative = alternativeState; settings.save(); $rootScope.$broadcast('globalHeaderChanged'); }, setMenuIconColor: function(color) { settings.ensureHeaderConfigExists(); settings.config.header.menuIconColor=color; settings.save(); $rootScope.$broadcast('globalHeaderChanged'); }, setMenuDimension: function(dimsObject) { settings.ensureHeaderConfigExists(); settings.config.header.menuDimension=dimsObject; settings.save(); $rootScope.$broadcast('globalHeaderChanged'); }, setHeader: function(headerConfigObject) { settings.config.header = headerConfigObject; settings.save(); $rootScope.$broadcast('globalHeaderChanged'); //we need an relaod, this works with an ng-if! }, header: function() { var defer = $q.defer(); this.checkSettingsLoaded().then( function() { if(typeof settings.config.header !== "undefined") { defer.resolve(settings.config.header); } else { /** * if the settings are not present than this version didnt has the * updated settings object! So we add simply true to this object * and resolve it */ defer.resolve(settings.settingsDefault.header); } }); return defer.promise; }, mouseWheel: function() { var defer = $q.defer(); this.checkSettingsLoaded().then( function() { if(typeof settings.config.mouseWheel !== "undefined") { defer.resolve(settings.config.mouseWheel); } else { /** * if the settings are not present than this version didnt has the * updated settings object! So we add simply true to this object * and resolve it */ defer.resolve(settings.settingsDefault.mouseWheel); } }); return defer.promise; }, background : function() { var deferr = $q.defer(); var resolveBackground = function() { if(typeof settings.config.background !== "undefined") { deferr.resolve(settings.config.background); } else { deferr.reject(settings.config.background); } }; if(settings.loaded==null) { //console.log(localStorage.istartbackground, 'BACKGROUND SETTINGS', localStorage.istartbackground!="null", localStorage.istartbackground!==null); if(localStorage.istartbackground!="null") { settings.loadV1BackgroundSettings(); } //nothing loaded load the settings settings.loadOptions() .then(function() { resolveBackground(); }) } else { resolveBackground(); } return deferr.promise; }, loadV1BackgroundSettings: function() { /** * migrate here the old Settings into the new settingsFormat. * clear the old settings directly after setting them into * the new format of V2 */ var bgsetting; var bgoptions; console.log(localStorage.istartbackground); if(localStorage.istartbackground != "null" && typeof localStorage.istartbackground != "undefined") { if(settings.config==null) { settings.config = settings.settingsDefault; } bgsetting = localStorage.istartbackground; /** * check if this is an image or color: */ if(bgsetting.indexOf('url(')!=-1) { //image ! settings.config.background.imageadd=true; settings.config.background.image = bgsetting;//the complete string? } else{ //css gradient settings.config.background.imageadd=false; settings.config.background.cssadd=true; settings.config.background.css = bgsetting; settings.save();//store the new things } } //load additional settings if(localStorage.istartbgoptions != null) { if(settings.config==null) { settings.config = settings.settingsDefault; } bgoptions = JSON.parse(localStorage.istartbgoptions); settings.config.background.options = bgoptions; settings.save();//store the new things } //todo:implement load functions to load the background from options //$('#mbg').css('backgroundImage', this.bgsetting ); localStorage.istartbackground=null; localStorage.istartbgoptions=null; /*if(this.bgoptions != null) { this.setBgOptionsFromObj(); }*/ }, setBgOptionsFromObj: function () { /** * TODO:replace this into the backGroundSettings * directive */ for(var option in this.bgoptions) { var cso = option; if(option == 'backgroundattachment') { cso = 'background-attachment'; } $('#mbg').css(cso, this.bgoptions[option] ); } } }; /** * returns the current apps list! */ return { settings:settings } }]);
KaySchneider/istart-ntp
app/service/settings.js
JavaScript
gpl-3.0
13,401
[ 30522, 1005, 2224, 9384, 1005, 1025, 1013, 1008, 1008, 1008, 10439, 10906, 4713, 1008, 5324, 1996, 7661, 5310, 10906, 1998, 6661, 2009, 10439, 2898, 1008, 1013, 13075, 10439, 1027, 16108, 1012, 11336, 1006, 1005, 21541, 8445, 1005, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.thorbenlindhauer.inference; import static org.assertj.core.api.Assertions.assertThat; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import org.junit.Before; import org.junit.Test; import com.github.thorbenlindhauer.cluster.Cluster; import com.github.thorbenlindhauer.cluster.ClusterGraph; import com.github.thorbenlindhauer.cluster.Edge; import com.github.thorbenlindhauer.cluster.messagepassing.BeliefUpdateContextFactory; import com.github.thorbenlindhauer.factor.GaussianFactor; import com.github.thorbenlindhauer.inference.loopy.MessageInstruction; import com.github.thorbenlindhauer.inference.loopy.StaticCalibrationContextFactory; import com.github.thorbenlindhauer.network.StandaloneGaussiaFactorBuilder; import com.github.thorbenlindhauer.test.util.LinearAlgebraUtil; import com.github.thorbenlindhauer.test.util.TestConstants; import com.github.thorbenlindhauer.variable.ContinuousVariable; /** * @author Thorben * */ public class GaussianModelInferencerTest { ClusterGraph<GaussianFactor> clusterGraph; Cluster<GaussianFactor> barometricCluster; Cluster<GaussianFactor> temperatureCluster; Cluster<GaussianFactor> rainCluster; Edge<GaussianFactor> tempRainEdge; Edge<GaussianFactor> baroRainEdge; @Before public void setUp() { StandaloneGaussiaFactorBuilder builder = StandaloneGaussiaFactorBuilder.withVariables( new ContinuousVariable("RainAmount"), new ContinuousVariable("Temperature"), new ContinuousVariable("BarometricPressure")); // the following factors make no sense meteorologically ;) GaussianFactor barometricFactor = builder .scope("BarometricPressure") .momentForm() .parameters(LinearAlgebraUtil.asVector(100.0d), LinearAlgebraUtil.asMatrix(10.0d)); GaussianFactor temperatureFactor = builder .scope("Temperature") .momentForm() .parameters(LinearAlgebraUtil.asVector(15.0d), LinearAlgebraUtil.asMatrix(12.0d)); GaussianFactor rainFactor = builder .scope("RainAmount", "BarometricPressure", "Temperature") .conditional() .conditioningScope("BarometricPressure", "Temperature") .parameters(LinearAlgebraUtil.asVector(900.0d), LinearAlgebraUtil.asMatrix(50.0d), LinearAlgebraUtil.asRowMatrix(0.1d, 2.0d)); barometricCluster = new Cluster<GaussianFactor>(Collections.singleton(barometricFactor)); temperatureCluster = new Cluster<GaussianFactor>(Collections.singleton(temperatureFactor)); rainCluster = new Cluster<GaussianFactor>(Collections.singleton(rainFactor)); Set<Cluster<GaussianFactor>> clusters = new HashSet<Cluster<GaussianFactor>>(); clusters.add(barometricCluster); clusters.add(temperatureCluster); clusters.add(rainCluster); clusterGraph = new ClusterGraph<GaussianFactor>(clusters); tempRainEdge = clusterGraph.connect(temperatureCluster, rainCluster); baroRainEdge = clusterGraph.connect(barometricCluster, rainCluster); } @Test public void testPointEstimate() { List<MessageInstruction> propagationOrder = new ArrayList<MessageInstruction>(); propagationOrder.add(new MessageInstruction(tempRainEdge, temperatureCluster)); propagationOrder.add(new MessageInstruction(baroRainEdge, rainCluster)); propagationOrder.add(new MessageInstruction(baroRainEdge, barometricCluster)); propagationOrder.add(new MessageInstruction(tempRainEdge, rainCluster)); GaussianModelInferencer inferencer = new GaussianClusterGraphInferencer(clusterGraph, new BeliefUpdateContextFactory(), new StaticCalibrationContextFactory(propagationOrder)); double[] marginalRainMean = inferencer.posteriorMean(clusterGraph.getScope().subScope("RainAmount")); assertThat(marginalRainMean).hasSize(1); assertThat(marginalRainMean[0]).isEqualTo(940.0d, TestConstants.DOUBLE_VALUE_TOLERANCE); double[][] marginalRainVariance = inferencer.posteriorCovariance(clusterGraph.getScope().subScope("RainAmount")); assertThat(marginalRainVariance).hasSize(1); assertThat(marginalRainVariance[0]).hasSize(1); assertThat(marginalRainVariance[0][0]).isEqualTo(98.1d, TestConstants.DOUBLE_VALUE_TOLERANCE); double marginalRainProbability = inferencer.jointProbability(clusterGraph.getScope().subScope("RainAmount"), new double[]{950.0d}); assertThat(marginalRainProbability).isEqualTo(0.0241948, TestConstants.DOUBLE_VALUE_TOLERANCE); } }
ThorbenLindhauer/graphical-models
inference-engine/src/test/java/com/github/thorbenlindhauer/inference/GaussianModelInferencerTest.java
Java
apache-2.0
5,129
[ 30522, 1013, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 1008, 2017, 2089, 6855, 1037, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*********************************************************************************************************************** * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all * applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of * this software. By using this software, you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * * Copyright (C) 2015(2018) Renesas Electronics Corporation. All rights reserved. ***********************************************************************************************************************/ /*********************************************************************************************************************** * File Name : r_usb_psignal.c * Description : USB Peripheral signal control code ***********************************************************************************************************************/ /********************************************************************************************************************** * History : DD.MM.YYYY Version Description * : 08.01.2014 1.00 First Release * : 26.12.2014 1.10 RX71M is added * : 30.09.2015 1.11 RX63N/RX631 is added. * : 30.09.2016 1.20 RX65N/RX651 is added. * : 31.03.2018 1.23 Supporting Smart Configurator ***********************************************************************************************************************/ /****************************************************************************** Includes <System Includes> , "Project Includes" ******************************************************************************/ #include "r_usb_basic_if.h" #include "r_usb_typedef.h" #include "r_usb_extern.h" #include "r_usb_bitdefine.h" #include "r_usb_reg_access.h" #if ((USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_PERI) /****************************************************************************** Exported global variables (to be accessed by other files) ******************************************************************************/ #if USB_CFG_BC == USB_CFG_ENABLE extern uint16_t g_usb_bc_detect; #endif /* USB_CFG_BC == USB_CFG_ENABLE */ /****************************************************************************** Renesas Abstracted Peripheral signal control functions ******************************************************************************/ /****************************************************************************** Function Name : usb_pstd_bus_reset Description : A USB bus reset was issued by the host. Execute relevant pro- : cessing. Arguments : none Return value : none ******************************************************************************/ void usb_pstd_bus_reset (void) { uint16_t connect_info; /* Bus Reset */ usb_pstd_busreset_function(); /* Memory clear */ usb_pstd_clr_mem(); connect_info = usb_cstd_port_speed(USB_NULL); /* Callback */ if (USB_NULL != g_usb_pstd_driver.devdefault) { #if USB_CFG_BC == USB_CFG_ENABLE (*g_usb_pstd_driver.devdefault)(USB_NULL, connect_info, g_usb_bc_detect); #else /* USB_CFG_BC == USB_CFG_ENABLE */ (*g_usb_pstd_driver.devdefault)(USB_NULL, connect_info, USB_NULL); #endif /* USB_CFG_BC == USB_CFG_ENABLE */ } /* DCP configuration register (0x5C) */ hw_usb_write_dcpcfg(USB_NULL, 0); /* DCP maxpacket size register (0x5E) */ hw_usb_write_dcpmxps(USB_NULL, g_usb_pstd_driver.p_devicetbl[USB_DEV_MAX_PKT_SIZE]); } /****************************************************************************** End of function usb_pstd_bus_reset ******************************************************************************/ /****************************************************************************** Function Name : usb_pstd_attach_process Description : USB attach setting. Arguments : none Return value : none ******************************************************************************/ void usb_pstd_attach_process (void) { usb_cpu_delay_xms((uint16_t) 10); #if USB_CFG_BC == USB_CFG_ENABLE usb_pstd_bc_detect_process(); #endif /* USB_CFG_BC == USB_CFG_ENABLE */ hw_usb_pset_dprpu(); } /****************************************************************************** End of function usb_pstd_attach_process ******************************************************************************/ /****************************************************************************** Function Name : usb_pstd_detach_process Description : Initialize USB registers for detaching, and call the callback : function that completes the detach. Arguments : none Return value : none ******************************************************************************/ void usb_pstd_detach_process (void) { uint16_t i; #if defined(BSP_MCU_RX64M) || defined(BSP_MCU_RX71M) hw_usb_clear_cnen(USB_NULL); #endif /* defined(BSP_MCU_RX64M) || defined(BSP_MCU_RX71M) */ /* Pull-up disable */ hw_usb_pclear_dprpu(); /* Configuration number */ g_usb_pstd_config_num = 0; /* Remote wakeup enable flag */ g_usb_pstd_remote_wakeup = USB_FALSE; /* WAIT_LOOP */ for (i = USB_MIN_PIPE_NO; i < (USB_MAXPIPE_NUM +1); i++) { if (USB_TRUE == g_usb_pipe_table[USB_CFG_USE_USBIP][i].use_flag) { usb_pstd_forced_termination(i, (uint16_t) USB_DATA_STOP); usb_cstd_clr_pipe_cnfg(USB_NULL, i); } } /* Callback */ if (USB_NULL != g_usb_pstd_driver.devdetach) { (*g_usb_pstd_driver.devdetach)(USB_NULL, USB_NO_ARG, USB_NULL); } usb_pstd_stop_clock(); } /****************************************************************************** End of function usb_pstd_detach_process ******************************************************************************/ /****************************************************************************** Function Name : usb_pstd_suspend_process Description : Perform a USB peripheral suspend. Arguments : none Return value : none ******************************************************************************/ void usb_pstd_suspend_process (void) { uint16_t intsts0; uint16_t buf; /* Resume interrupt enable */ hw_usb_pset_enb_rsme(); intsts0 = hw_usb_read_intsts(); buf = hw_usb_read_syssts(USB_NULL); if (((uint16_t) 0 != (intsts0 & USB_DS_SUSP)) && (USB_FS_JSTS == (buf & USB_LNST))) { /* Suspend */ usb_pstd_stop_clock(); usb_pstd_suspend_function(); /* Callback */ if (USB_NULL != g_usb_pstd_driver.devsuspend) { (*g_usb_pstd_driver.devsuspend)(USB_NULL, g_usb_pstd_remote_wakeup, USB_NULL); } } /* --- SUSPEND -> RESUME --- */ else { /* RESM status clear */ hw_usb_pclear_sts_resm(); /* RESM interrupt disable */ hw_usb_pclear_enb_rsme(); } } /****************************************************************************** End of function usb_pstd_suspend_process ******************************************************************************/ #endif /* (USB_CFG_MODE & USB_CFG_PERI) == USB_CFG_REPI */ /****************************************************************************** End Of File ******************************************************************************/
hirakuni45/RX
r_usb/basic/src/driver/r_usb_psignal.c
C
bsd-3-clause
8,671
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Copyright 2017 The TensorFlow 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 applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for Grappler LayoutOptimizer.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.core.protobuf import config_pb2 from tensorflow.core.protobuf import device_properties_pb2 from tensorflow.core.protobuf import rewriter_config_pb2 from tensorflow.core.protobuf import saver_pb2 from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed from tensorflow.python.framework import test_util from tensorflow.python.grappler import cluster as gcluster from tensorflow.python.grappler import tf_optimizer from tensorflow.python.layers import convolutional as conv_layers from tensorflow.python.ops import array_ops from tensorflow.python.ops import functional_ops from tensorflow.python.ops import gen_array_ops from tensorflow.python.ops import gen_math_ops from tensorflow.python.ops import gen_nn_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn from tensorflow.python.ops import random_ops from tensorflow.python.ops import state_ops from tensorflow.python.ops import variables from tensorflow.python.platform import test from tensorflow.python.training import gradient_descent from tensorflow.python.training import saver as saver_lib def _weight(shape): """Generates a weight of a given shape.""" return random_ops.truncated_normal(shape, seed=0, stddev=0.1) def _bias(shape): """Generates a bias of a given shape.""" return constant_op.constant(0.1, shape=shape) def _conv2d(x, w): """Returns a 2d convolution layer with full stride.""" return nn.conv2d(x, w, strides=[1, 1, 1, 1], padding='SAME') def _max_pool_2x2(x): """Downsamples a feature map by 2X.""" return nn.max_pool( x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME') # Taken from tensorflow/examples/tutorials/mnist/mnist_deep.py def _two_layer_model(x): x_image = array_ops.reshape(x, [-1, 28, 28, 1]) w_conv1 = _weight([5, 5, 1, 32]) b_conv1 = _bias([32]) h_conv1 = nn.relu(_conv2d(x_image, w_conv1) + b_conv1) h_pool1 = _max_pool_2x2(h_conv1) w_conv2 = _weight([5, 5, 32, 64]) b_conv2 = _bias([64]) h_conv2 = nn.relu(_conv2d(h_pool1, w_conv2) + b_conv2) h_pool2 = _max_pool_2x2(h_conv2) return h_pool2 def _model_with_second_port(): random_seed.set_random_seed(0) x = random_ops.truncated_normal([2, 5, 5, 4], seed=0) scale = constant_op.constant(0.1, shape=[4]) offset = constant_op.constant(0.3, shape=[4]) y, mean, _ = nn.fused_batch_norm(x, scale, offset) mul = math_ops.add(y, mean) output = array_ops.identity(mul) return output def _model_with_branch(x): x_image = array_ops.reshape(x, [-1, 28, 28, 1]) w_conv1 = _weight([5, 5, 1, 32]) w_conv2 = _weight([5, 5, 1, 32]) c_conv1 = _conv2d(x_image, w_conv1) c_conv2 = _conv2d(x_image, w_conv2) add = math_ops.add(c_conv1, c_conv2) return add def _model_with_vec_and_4d(x): x_image = array_ops.reshape(x, [-1, 28, 28, 1]) w_conv1 = _weight([5, 5, 1, 32]) c_conv1 = _conv2d(x_image, w_conv1) vector = constant_op.constant(6.4, shape=[32]) add = math_ops.add(c_conv1, vector) return add def _loop(): random_seed.set_random_seed(0) x1 = random_ops.truncated_normal([1, 784], seed=0) x2 = random_ops.truncated_normal([1, 784], seed=0) x3 = random_ops.truncated_normal([1, 784], seed=0) x4 = random_ops.truncated_normal([1, 784], seed=0) elems = (x1, x2, x3, x4) outputs = functional_ops.map_fn(_two_layer_model, elems, dtype=dtypes.float32) return outputs def _loop_with_branch(): random_seed.set_random_seed(0) x1 = random_ops.truncated_normal([1, 784], seed=0) x2 = random_ops.truncated_normal([1, 784], seed=0) x3 = random_ops.truncated_normal([1, 784], seed=0) x4 = random_ops.truncated_normal([1, 784], seed=0) elems = (x1, x2, x3, x4) outputs = functional_ops.map_fn( _model_with_branch, elems, dtype=dtypes.float32) return outputs def _loop_with_vec_and_4d(): random_seed.set_random_seed(0) x1 = random_ops.truncated_normal([1, 784], seed=0) x2 = random_ops.truncated_normal([1, 784], seed=0) x3 = random_ops.truncated_normal([1, 784], seed=0) x4 = random_ops.truncated_normal([1, 784], seed=0) elems = (x1, x2, x3, x4) outputs = functional_ops.map_fn( _model_with_vec_and_4d, elems, dtype=dtypes.float32) return outputs def _get_config(layout_optimizer=True): if layout_optimizer: rewrite_options = rewriter_config_pb2.RewriterConfig( layout_optimizer=rewriter_config_pb2.RewriterConfig.ON, # do not remove duplicated nodes arithmetic_optimization=rewriter_config_pb2.RewriterConfig.OFF) else: rewrite_options = rewriter_config_pb2.RewriterConfig( layout_optimizer=rewriter_config_pb2.RewriterConfig.OFF, # do not remove duplicated nodes arithmetic_optimization=rewriter_config_pb2.RewriterConfig.OFF) rewrite_options.min_graph_nodes = -1 graph_options = config_pb2.GraphOptions( rewrite_options=rewrite_options, build_cost_model=1) config = config_pb2.ConfigProto(graph_options=graph_options) config.graph_options.optimizer_options.opt_level = -1 return config def _simple_metagraph(depthwise=False): random_seed.set_random_seed(0) x = variables.Variable(random_ops.truncated_normal([1, 200, 200, 3], seed=0)) conv = conv_layers.separable_conv2d if depthwise else conv_layers.conv2d y = conv(x, 32, [3, 3]) z = conv(y, 32, [3, 3]) optimizer = gradient_descent.GradientDescentOptimizer(1e-4) loss = math_ops.reduce_mean(z) train_op = optimizer.minimize(loss) graph = ops.get_default_graph() graph.add_to_collection('train_op', train_op) meta_graph = saver_lib.export_meta_graph(graph_def=graph.as_graph_def()) return meta_graph def _get_cluster(): named_device = device_properties_pb2.NamedDevice() named_device.name = '/GPU:0' named_device.properties.type = 'GPU' named_device.properties.num_cores = 24 named_device.properties.frequency = 1000 named_device.properties.environment['architecture'] = '4' cluster = gcluster.Cluster(devices=[named_device]) return cluster def _is_transpose(node): return node.endswith('TransposeNHWCToNCHW-LayoutOptimizer') or node.endswith( 'TransposeNCHWToNHWC-LayoutOptimizer') def _is_permute(node): return node.endswith('VecPermuteNHWCToNCHW-LayoutOptimizer') or node.endswith( 'VecPermuteNCHWToNHWC-LayoutOptimizer') class LayoutOptimizerTest(test.TestCase): """Tests the Grappler layout optimizer.""" def _assert_trans_nchw_to_nhwc(self, name, nodes): self.assertIn(name + '-TransposeNCHWToNHWC-LayoutOptimizer', nodes) def _assert_trans_nhwc_to_nchw(self, name, nodes): self.assertIn(name + '-TransposeNHWCToNCHW-LayoutOptimizer', nodes) def _assert_map_nhwc_to_nchw(self, name, nodes): self.assertIn(name + '-DimMapNHWCToNCHW-LayoutOptimizer', nodes) def _assert_vec_nchw_to_nhwc(self, name, nodes): self.assertIn(name + '-VecPermuteNCHWToNHWC-LayoutOptimizer', nodes) def _assert_vec_nhwc_to_nchw(self, name, nodes): self.assertIn(name + '-VecPermuteNHWCToNCHW-LayoutOptimizer', nodes) def _train(self, checkpoint_path, layout_optimizer=False, restore=False): ops.reset_default_graph() graph = ops.get_default_graph() with session.Session( config=_get_config(layout_optimizer), graph=graph) as sess: batch = 2 height = 6 width = 7 input_channels = 3 shape = [batch, height, width, input_channels] image = array_ops.placeholder(dtype='float32', shape=shape) conv1 = conv_layers.conv2d(image, 32, [3, 3]) conv2 = conv_layers.conv2d(conv1, 32, [3, 3]) optimizer = gradient_descent.GradientDescentOptimizer(0.01) loss = math_ops.reduce_mean(conv2) train_op = optimizer.minimize(loss) saver = saver_lib.Saver(write_version=saver_pb2.SaverDef.V2) if restore: saver.restore(sess, checkpoint_path) else: self.evaluate(variables.global_variables_initializer()) np.random.seed(0) for _ in range(2): image_val = np.random.rand(*shape).astype(np.float32) sess.run([loss, train_op], feed_dict={image: image_val}) if restore: all_vars = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES) all_vars_values = [var.eval(session=sess) for var in all_vars] return all_vars_values else: saver.save(sess, checkpoint_path) def testTwoConvLayers(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) output = _two_layer_model(x) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Relu_1-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSplitWithNonConstAxis(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) dim = array_ops.placeholder(dtype='int32') split = array_ops.split(conv, 2, axis=dim) scale = constant_op.constant(0.1, shape=[32]) offset = constant_op.constant(0.3, shape=[32]) bn0 = nn.fused_batch_norm(split[0], scale, offset) bn1 = nn.fused_batch_norm(split[1], scale, offset) add = bn0[0] + bn1[0] output = array_ops.identity(add) with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={dim: 3}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata, feed_dict={dim: 3}) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('add_2-0-0', nodes) self._assert_map_nhwc_to_nchw('split-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSplitVWithNonConstAxis(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) dim = array_ops.placeholder(dtype='int32') sizes = constant_op.constant([50, 10, 4], shape=[3]) split = gen_array_ops.split_v( value=conv, size_splits=sizes, axis=dim, num_split=3) output = math_ops.reduce_sum(split[0]) with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={dim: 3}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata, feed_dict={dim: 3}) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('SplitV-0-0', nodes) self._assert_map_nhwc_to_nchw('SplitV-2', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testPadWithConstPaddings(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) paddings_val = [[1, 2], [3, 4], [5, 6], [7, 8]] paddings = constant_op.constant( paddings_val, dtype='int32', name='PaddingsConst') pad = array_ops.pad(conv, paddings) output = array_ops.identity(pad) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Pad-0-0', nodes) self.assertIn('Pad-1-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSum(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testCast(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) cast = math_ops.cast(conv, dtype='bool') output = array_ops.identity(cast) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Cast-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSqueeze(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[1, 2]) squeeze = array_ops.squeeze(reduce_sum) output = array_ops.identity(squeeze) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSqueezeAlongHW(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[1, 2], keepdims=True) squeeze = array_ops.squeeze(reduce_sum, axis=[1, 2]) output = array_ops.identity(squeeze) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSqueezeAlongNHW(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[0, 1, 2], keepdims=True) squeeze = array_ops.squeeze(reduce_sum, axis=[0, 1, 2]) output = array_ops.identity(squeeze) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongHWC(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[1, 2, 3]) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongNHW(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[0, 1, 2]) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongC(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[3]) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Three transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongCKeepDims(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[3], keepdims=True) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Sum-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongHKeepDims(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[2], keepdims=True) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReduceSumAlongWCKeepDims(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) reduce_sum = math_ops.reduce_sum(conv, axis=[2, 3], keepdims=True) output = array_ops.identity(reduce_sum) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testConcatWithControlDependency(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) axis = constant_op.constant(3) var = variables.Variable(3) assign = state_ops.assign(var, 6) with ops.control_dependencies([assign]): concat = array_ops.concat([conv, conv], axis) output = array_ops.identity(concat) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('concat-0-0', nodes) self.assertIn('concat-2-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testFill(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = array_ops.placeholder(dtype='float32') conv = _two_layer_model(x) shape = array_ops.shape(conv) scalar = array_ops.constant(5.7) fill = array_ops.fill(shape, scalar) output = array_ops.identity(fill) x_val = [3.4] * 784 with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={x: x_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ x: x_val }) nodes = [] num_transposes = 0 num_vec_permute = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 if _is_permute(node.name): num_vec_permute += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) # Two vector permute nodes were initially added in the Expand phase of # LayoutOptimizer; they cancelled out each other in the Collapse phase. expected_vec_permute = 0 self.assertEqual(expected_vec_permute, num_vec_permute) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Fill-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testTile(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) multiple = array_ops.placeholder(dtype='int32') tile = array_ops.tile(conv, multiple) output = array_ops.identity(tile) multiple_val = [2, 3, 4, 1] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={multiple: multiple_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ multiple: multiple_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Tile-0-0', nodes) self._assert_vec_nhwc_to_nchw('Tile-1', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReverseWithConstDims(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) dims = constant_op.constant([3, 1], name='DimsConst') reverse = array_ops.reverse(conv, dims) output = array_ops.identity(reverse) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('ReverseV2-0-0', nodes) self.assertIn('ReverseV2-1-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testReverseWithNonConstDims(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) dims = array_ops.placeholder(dtype='int32') reverse = array_ops.reverse(conv, dims) output = array_ops.identity(reverse) dims_val = [2, 3] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={dims: dims_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ dims: dims_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('ReverseV2-0-0', nodes) self._assert_map_nhwc_to_nchw('ReverseV2-1', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSelectOp(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) add = math_ops.add(conv, conv) mean = math_ops.reduce_mean(conv) condition = math_ops.less(conv, mean) select = gen_math_ops.select(condition, conv, add) output = array_ops.identity(select) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Select-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSelectOpConditionUnknownShape(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) add = math_ops.add(conv, conv) condition = array_ops.placeholder(dtype='bool') select = gen_math_ops.select(condition, conv, add) output = array_ops.identity(select) condition_val = np.zeros((1, 7, 7, 64)) with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={condition: condition_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={condition: condition_val}) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 3 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSelectOpScalarCondition(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) add = math_ops.add(conv, conv) condition = constant_op.constant(True) select = gen_math_ops.select(condition, conv, add) output = array_ops.identity(select) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Select-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testPadWithNonConstPaddings(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) paddings = array_ops.placeholder(dtype='int32') pad = array_ops.pad(conv, paddings) output = array_ops.identity(pad) paddings_val = [[1, 2], [3, 4], [5, 6], [7, 8]] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={paddings: paddings_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ paddings: paddings_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Pad-0-0', nodes) self._assert_vec_nhwc_to_nchw('Pad-1', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testMaxPoolV2(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) ksize = constant_op.constant([1, 2, 3, 1], shape=[4]) strides = array_ops.placeholder(dtype='int32', shape=[4]) max_pool = gen_nn_ops.max_pool_v2(conv, ksize, strides, 'VALID') output = array_ops.identity(max_pool) strides_val = [1, 3, 2, 1] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={strides: strides_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ strides: strides_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('MaxPoolV2-0-0', nodes) self._assert_vec_nhwc_to_nchw('MaxPoolV2-2', nodes) self.assertIn('MaxPoolV2-1-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testMaxPoolGradV2(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) ksize = constant_op.constant([1, 2, 3, 1], shape=[4]) strides = array_ops.placeholder(dtype='int32', shape=[4]) max_pool_grad = gen_nn_ops.max_pool_grad_v2(conv, conv, conv, ksize, strides, 'VALID') output = array_ops.identity(max_pool_grad) strides_val = [1, 3, 2, 1] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={strides: strides_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ strides: strides_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('MaxPoolGradV2-0-0', nodes) self._assert_vec_nhwc_to_nchw('MaxPoolGradV2-4', nodes) self.assertIn('MaxPoolGradV2-3-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testSliceWithNonConstAxis(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) size = array_ops.placeholder(dtype='int32') s = array_ops.slice(conv, [0, 0, 0, 0], size) output = array_ops.identity(s) size_val = [1, 2, 3, 4] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={size: size_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ size: size_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('Slice-0-0', nodes) self._assert_vec_nhwc_to_nchw('Slice-2', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testStridedSliceWithNonConstAxis(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) end = array_ops.placeholder(dtype='int32') s = array_ops.strided_slice(conv, [0, 0, 0, 0], end, strides=[1, 2, 3, 1]) output = array_ops.identity(s) end_val = [1, 2, 3, 4] with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={end: end_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ end: end_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('StridedSlice-0-0', nodes) self._assert_vec_nhwc_to_nchw('StridedSlice-2', nodes) self.assertIn('StridedSlice-1-LayoutOptimizer', nodes) self.assertIn('StridedSlice-3-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testStridedSliceWithMask1011(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) # This will generate a StridedSlice op with begin mask and # end mask 11(1011). s = conv[:, :, 1:-1, :] output = array_ops.identity(s) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('strided_slice-0-0', nodes) self.assertIn('strided_slice-1-LayoutOptimizer', nodes) self.assertIn('strided_slice-2-LayoutOptimizer', nodes) self.assertIn('strided_slice-3-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testStridedSliceWithMask0111(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) # This will generate a StridedSlice op with begin mask and # end mask 7(0111). s = conv[:, :, :, 1:-1] output = array_ops.identity(s) with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('strided_slice-0-0', nodes) self.assertIn('strided_slice-1-LayoutOptimizer', nodes) self.assertIn('strided_slice-2-LayoutOptimizer', nodes) self.assertIn('strided_slice-3-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testStridedSliceGradWithNonConstAxis(self): if test.is_gpu_available(cuda_only=True): random_seed.set_random_seed(0) x = random_ops.truncated_normal([1, 784], seed=0) conv = _two_layer_model(x) end = array_ops.placeholder(dtype='int32') shape = array_ops.shape(conv) end_val = [1, 2, 3, 4] s = array_ops.strided_slice( conv, [0, 0, 0, 0], end_val, strides=[1, 2, 3, 1]) s_grad = array_ops.strided_slice_grad(shape, [0, 0, 0, 0], end, [1, 2, 3, 1], s) output = array_ops.identity(s_grad) with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={end: end_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ end: end_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('StridedSliceGrad-0-0', nodes) self._assert_vec_nhwc_to_nchw('StridedSliceGrad-2', nodes) self.assertIn('StridedSlice-1-LayoutOptimizer', nodes) self.assertIn('StridedSlice-2-LayoutOptimizer', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testShapeN(self): if test.is_gpu_available(cuda_only=True): x = array_ops.placeholder(dtype='float32') conv = _two_layer_model(x) shapen = array_ops.shape_n([conv, conv]) output = math_ops.add(shapen[0], shapen[1]) x_val = [1.7] * 784 with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={x: x_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={ x: x_val }) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 1 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self._assert_vec_nchw_to_nhwc('ShapeN-0-0', nodes) self.assertAllEqual(output_val_ref, output_val) def testShapeNFollowedByNotConvertibleNodeReshape(self): if test.is_gpu_available(cuda_only=True): x = array_ops.placeholder(dtype='float32') conv = _two_layer_model(x) conv_reshape = array_ops.reshape(conv, [1, 1, 1, -1]) shapen = array_ops.shape_n([conv, conv_reshape]) shape = array_ops.identity(shapen[1]) ones = array_ops.ones(shape) output = math_ops.add_n([conv_reshape, ones]) x_val = [1.7] * 784 with session.Session(config=_get_config(False)) as sess: output_val_ref = sess.run(output, feed_dict={x: x_val}) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run( output, run_metadata=metadata, feed_dict={x: x_val}) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('Conv2D-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testLoop(self): if test.is_gpu_available(cuda_only=True): output = _loop() with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) # Four transposes were initially added in the Expand phase of # LayoutOptimizer; two of them are cancelled out in the Collapse phase. expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('map/while/Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('map/while/MaxPool_1-0-2', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testLoopWithBranch(self): if test.is_gpu_available(cuda_only=True): output = _loop_with_branch() with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 3 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('map/while/Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('map/while/Add_1-0-2', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testLoopWithVecAnd4D(self): if test.is_gpu_available(cuda_only=True): output = _loop_with_vec_and_4d() with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('map/while/Conv2D-0', nodes) self._assert_trans_nchw_to_nhwc('map/while/Add_1-0-2', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) def testBinaryOpSecondPort(self): if test.is_gpu_available(cuda_only=True): output = _model_with_second_port() with session.Session(config=_get_config(False)) as sess: output_val_ref = self.evaluate(output) with session.Session(config=_get_config()) as sess: metadata = config_pb2.RunMetadata() output_val = sess.run(output, run_metadata=metadata) nodes = [] num_transposes = 0 for node in metadata.cost_graph.node: if _is_transpose(node.name): num_transposes += 1 nodes.append(node.name) expected_num_transposes = 2 self.assertEqual(expected_num_transposes, num_transposes) self._assert_trans_nhwc_to_nchw('FusedBatchNorm-0', nodes) self._assert_trans_nchw_to_nhwc('Add-0-0', nodes) self.assertAllClose(output_val_ref, output_val, atol=1e-3) @test_util.run_deprecated_v1 def testGradient(self): meta_graph = _simple_metagraph() config = config_pb2.ConfigProto() config.graph_options.rewrite_options.CopyFrom( rewriter_config_pb2.RewriterConfig( layout_optimizer=rewriter_config_pb2.RewriterConfig.ON, min_graph_nodes=-1)) optimized_graph = tf_optimizer.OptimizeGraph( config, meta_graph, cluster=_get_cluster()) found = 0 for node in optimized_graph.node: if node.op in ['Conv2D', 'Conv2DBackpropFilter', 'Conv2DBackpropInput']: found += 1 self.assertEqual(node.attr['data_format'].s, b'NCHW') self.assertEqual(found, 5) @test_util.run_deprecated_v1 def testDepthwise(self): meta_graph = _simple_metagraph(depthwise=True) config = config_pb2.ConfigProto() config.graph_options.rewrite_options.CopyFrom( rewriter_config_pb2.RewriterConfig( layout_optimizer=rewriter_config_pb2.RewriterConfig.ON, min_graph_nodes=-1)) optimized_graph = tf_optimizer.OptimizeGraph( config, meta_graph, cluster=_get_cluster()) found = 0 for node in optimized_graph.node: if node.op in [ 'DepthwiseConv2dNative', 'DepthwiseConv2dNativeBackpropFilter', 'DepthwiseConv2dNativeBackpropInput' ]: found += 1 self.assertEqual(node.attr['data_format'].s, b'NCHW') self.assertEqual(found, 6) def testCheckpointCompatibility(self): if not test.is_gpu_available(cuda_only=True): self.skipTest('GPU required') checkpoint_path = self.get_temp_dir() self._train(checkpoint_path) vars_expected = self._train(checkpoint_path, restore=True) vars_layout_optimized = self._train( checkpoint_path, restore=True, layout_optimizer=True) for var_expected, var_layout_optimized in zip(vars_expected, vars_layout_optimized): self.assertAllClose(var_expected, var_layout_optimized, atol=1e-6) if __name__ == '__main__': test.main()
hfp/tensorflow-xsmm
tensorflow/python/grappler/layout_optimizer_test.py
Python
apache-2.0
58,406
[ 30522, 1001, 9385, 2418, 1996, 23435, 12314, 6048, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1001, 2017, 2089, 2025, 2224, 2023, 5371, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/sh test_description='test untracked cache' . ./test-lib.sh avoid_racy() { sleep 1 } git update-index --untracked-cache # It's fine if git update-index returns an error code other than one, # it'll be caught in the first test. if test $? -eq 1; then skip_all='This system does not support untracked cache' test_done fi test_expect_success 'setup' ' git init worktree && cd worktree && mkdir done dtwo dthree && touch one two three done/one dtwo/two dthree/three && git add one two done/one && : >.git/info/exclude && git update-index --untracked-cache ' test_expect_success 'untracked cache is empty' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 0000000000000000000000000000000000000000 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 EOF test_cmp ../expect ../actual ' cat >../status.expect <<EOF && A done/one A one A two ?? dthree/ ?? dtwo/ ?? three EOF cat >../dump.expect <<EOF && info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / 0000000000000000000000000000000000000000 recurse valid dthree/ dtwo/ three /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid three /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_expect_success 'status first time (empty cache)' ' avoid_racy && : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 3 gitignore invalidation: 1 directory invalidation: 0 opendir: 4 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'untracked cache after first status' ' test-dump-untracked-cache >../actual && test_cmp ../dump.expect ../actual ' test_expect_success 'status second time (fully populated cache)' ' avoid_racy && : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 0 directory invalidation: 0 opendir: 0 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'untracked cache after second status' ' test-dump-untracked-cache >../actual && test_cmp ../dump.expect ../actual ' test_expect_success 'modify in root directory, one dir invalidation' ' avoid_racy && : >four && : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && cat >../status.expect <<EOF && A done/one A one A two ?? dthree/ ?? dtwo/ ?? four ?? three EOF test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 0 directory invalidation: 1 opendir: 1 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'verify untracked cache dump' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / 0000000000000000000000000000000000000000 recurse valid dthree/ dtwo/ four three /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid three /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'new .gitignore invalidates recursively' ' avoid_racy && echo four >.gitignore && : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && cat >../status.expect <<EOF && A done/one A one A two ?? .gitignore ?? dthree/ ?? dtwo/ ?? three EOF test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 1 directory invalidation: 1 opendir: 4 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'verify untracked cache dump' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid .gitignore dthree/ dtwo/ three /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid three /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'new info/exclude invalidates everything' ' avoid_racy && echo three >>.git/info/exclude && : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && cat >../status.expect <<EOF && A done/one A one A two ?? .gitignore ?? dtwo/ EOF test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 1 directory invalidation: 0 opendir: 4 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'verify untracked cache dump' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid .gitignore dtwo/ /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'move two from tracked to untracked' ' git rm --cached two && test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'status after the move' ' : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && cat >../status.expect <<EOF && A done/one A one ?? .gitignore ?? dtwo/ ?? two EOF test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 0 directory invalidation: 0 opendir: 1 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'verify untracked cache dump' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid .gitignore dtwo/ two /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'move two from untracked to tracked' ' git add two && test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_expect_success 'status after the move' ' : >../trace && GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \ git status --porcelain >../actual && cat >../status.expect <<EOF && A done/one A one A two ?? .gitignore ?? dtwo/ EOF test_cmp ../status.expect ../actual && cat >../trace.expect <<EOF && node creation: 0 gitignore invalidation: 0 directory invalidation: 0 opendir: 1 EOF test_cmp ../trace.expect ../trace ' test_expect_success 'verify untracked cache dump' ' test-dump-untracked-cache >../actual && cat >../expect <<EOF && info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0 core.excludesfile 0000000000000000000000000000000000000000 exclude_per_dir .gitignore flags 00000006 / e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid .gitignore dtwo/ /done/ 0000000000000000000000000000000000000000 recurse valid /dthree/ 0000000000000000000000000000000000000000 recurse check_only valid /dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid two EOF test_cmp ../expect ../actual ' test_done
diegolagoglez/git
t/t7063-status-untracked-cache.sh
Shell
gpl-2.0
9,108
[ 30522, 1001, 999, 1013, 8026, 1013, 14021, 3231, 1035, 6412, 1027, 1005, 3231, 4895, 6494, 18141, 17053, 1005, 1012, 1012, 1013, 3231, 1011, 5622, 2497, 1012, 14021, 4468, 1035, 10958, 5666, 1006, 1007, 1063, 3637, 1015, 1065, 21025, 2102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
"use strict"; const removeDiacritics = require('diacritics').remove; const request = require('request'); //const pSegCases = require('../test/promiseSwitchCase.js'); var utils = { /** * Resolve all promises in Object via for ... in loop * @param {object} obj - The object containing function properties => Switch cases that resolve */ switchCasePromiseResolver: function switchCasePromiseResolver (obj, event) { //Promise Resolver For...In Loop - returns out to Var as Array let i = -1; var promisesArr = []; //Loop through the segmented Switch Cases (test is an obj with each Switch Case as a property) for (var ligneFn in obj) { //console.log(ligneFn); i++; //resolve each switch case with the event.message.text and return resolve promisesArr[i] = Promise.resolve( obj[ligneFn](event) ); } /** * Returns newly filled in Arr from loop * @return {array} - returns array with promise status (resolve, false) in array */ return promisesArr; }, ////////////////// // Text Cleaners ////////////////// cleanseText: function cleanseText (text) { return removeDiacritics( text.toLowerCase() .replace(/\s\s+|[.-]/g, function (match) { return (match === "-" || " " ? " " : "") } ).trim()) //([\uD800-\uDBFF][\uDC00-\uDFFF]) to remove emojis }, ////////////////////////////////////////// //Format Time before SearchStop Function ///////////////////////////////////////// timeFormatter (time) { var timeArr = time.split('T'); var finalTime = timeArr[1].slice(0,2) + ':' + timeArr[1].slice(2,4); return finalTime; }, //Random Number between 2 values randNum (min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; }, //Whitelist them domains bruh setWhiteList(domains) { if (!Array.isArray(domains)) { throw "Error ... domains param MUST be an array. You passed in: " + typeof domains; } else { request( { method: 'POST', uri: 'https://graph.facebook.com/v2.6/me/messenger_profile?access_token=' + process.env.PAGE_ACCESS_TOKEN, headers: { 'content-type': 'application/json' }, body: { whitelisted_domains: domains }, json: true }, function (error, response, body) { if (!error) { request( { method: 'GET', uri: 'https://graph.facebook.com/v2.6/me/messenger_profile?fields=whitelisted_domains&access_token=' + process.env.PAGE_ACCESS_TOKEN }, function (error, response, body) { if (!error) { console.log('Displaying whitelisted sites:'); console.log(body); } else if (error) { console.error (error); } }) } else if (error) { console.error(error); } } ); }; } } module.exports = utils;
W3stside/glitch
lib/utils.js
JavaScript
mit
3,112
[ 30522, 1000, 2224, 9384, 1000, 1025, 9530, 3367, 3718, 20469, 14778, 6558, 1027, 5478, 1006, 1005, 22939, 26775, 18291, 2015, 1005, 1007, 1012, 6366, 1025, 9530, 3367, 5227, 1027, 5478, 1006, 1005, 5227, 1005, 1007, 1025, 1013, 1013, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Qt #include <QDateTime> // Application #include "CRemoteControlData.h" //------------------------------------------------------------------------------------------------- quint32 CFileTransferData::m_ulNextTransferID = 1; CFileTransferData::CFileTransferData(QTcpSocket* pSocket, const QString& sSourceName, const QString& sTargetName, quint32 ulFileSize, bool bOut) : m_pSocket(pSocket) , m_pFile(nullptr) , m_tLastIncomingMessageTime(QDateTime::currentDateTime()) , m_sSourceName(sSourceName) , m_sTargetName(sTargetName) , m_ulOffsetInFile(0) , m_ulFileSize(ulFileSize) , m_bOut(bOut) , m_bDone(false) , m_bCompCRC(false) , m_bSameCRC(false) , m_bFileInfoSent(false) , m_bGotFileInfo(false) , m_bEchoFileCRC(false) { m_ulTransferID = getNewTransferID(); } CFileTransferData::CFileTransferData(QTcpSocket* pSocket, const QString& sSourceName, const QString& sTargetName, quint32 ulFileSize, quint32 ulTransferID, bool bOut) : m_pSocket(pSocket) , m_pFile(nullptr) , m_tLastIncomingMessageTime(QDateTime::currentDateTime()) , m_sSourceName(sSourceName) , m_sTargetName(sTargetName) , m_ulOffsetInFile(0) , m_ulFileSize(ulFileSize) , m_bOut(bOut) , m_bDone(false) , m_bCompCRC(false) , m_bSameCRC(false) , m_bFileInfoSent(false) , m_bGotFileInfo(false) , m_bEchoFileCRC(false) { m_ulTransferID = ulTransferID; m_ulNextTransferID = ulTransferID + 1; } CFileTransferData::~CFileTransferData() { if (m_pFile != nullptr) { if (m_pFile->isOpen()) m_pFile->close(); delete m_pFile; } } // Generates a file transfer ID using current time and an auto-incremented integer quint32 CFileTransferData::getNewTransferID() { m_ulNextTransferID++; return QDateTime::currentDateTime().time().second() + QDateTime::currentDateTime().time().msec() + m_ulNextTransferID; }
Jango73/qt-plus
source/cpp/RemoteControl/CRemoteControlData.cpp
C++
gpl-3.0
1,927
[ 30522, 1013, 1013, 1053, 2102, 1001, 2421, 1026, 1053, 13701, 7292, 1028, 1013, 1013, 4646, 1001, 2421, 1000, 13675, 6633, 12184, 8663, 13181, 15150, 2696, 1012, 1044, 1000, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Routing\Generator; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Exception\InvalidParameterException; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; use Psr\Log\LoggerInterface; /** * UrlGenerator can generate a URL or a path for any route in the RouteCollection * based on the passed parameters. * * @author Fabien Potencier <fabien@symfony.com> * @author Tobias Schultze <http://tobion.de> */ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface { /** * @var RouteCollection */ protected $routes; /** * @var RequestContext */ protected $context; /** * @var bool|null */ protected $strictRequirements = true; /** * @var LoggerInterface|null */ protected $logger; /** * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. * * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. * "?" and "#" (would be interpreted wrongly as query and fragment identifier), * "'" and """ (are used as delimiters in HTML). */ protected $decodedChars = array( // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning // some webservers don't allow the slash in encoded form in the path for security reasons anyway // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss '%2F' => '/', // the following chars are general delimiters in the URI specification but have only special meaning in the authority component // so they can safely be used in the path in unencoded form '%40' => '@', '%3A' => ':', // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability '%3B' => ';', '%2C' => ',', '%3D' => '=', '%2B' => '+', '%21' => '!', '%2A' => '*', '%7C' => '|', ); /** * @var string This regexp matches all characters that are not or should not be encoded by rawurlencode (see list in array above). */ private $urlEncodingSkipRegexp = '#[^-.~a-zA-Z0-9_/@:;,=+!*|]#'; /** * Constructor. * * @param RouteCollection $routes A RouteCollection instance * @param RequestContext $context The context * @param LoggerInterface|null $logger A logger instance */ public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) { $this->routes = $routes; $this->context = $context; $this->logger = $logger; } /** * {@inheritdoc} */ public function setContext(RequestContext $context) { $this->context = $context; } /** * {@inheritdoc} */ public function getContext() { return $this->context; } /** * {@inheritdoc} */ public function setStrictRequirements($enabled) { $this->strictRequirements = null === $enabled ? null : (bool) $enabled; } /** * {@inheritdoc} */ public function isStrictRequirements() { return $this->strictRequirements; } /** * {@inheritdoc} */ public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) { if (null === $route = $this->routes->get($name)) { throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); } // the Route has a cache of its own and is not recompiled as long as it does not get modified $compiledRoute = $route->compile(); return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens(), $route->getSchemes()); } /** * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */ protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) { $variables = array_flip($variables); $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters); // all params must be given if ($diff = array_diff_key($variables, $mergedParams)) { throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name)); } $url = ''; $optional = true; foreach ($tokens as $token) { if ('variable' === $token[0]) { if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { // check requirement if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#', $mergedParams[$token[3]])) { $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]); if ($this->strictRequirements) { throw new InvalidParameterException($message); } if ($this->logger) { $this->logger->error($message); } return; } $url = $token[1].$mergedParams[$token[3]].$url; $optional = false; } } else { // static text $url = $token[1].$url; $optional = false; } } if ('' === $url) { $url = '/'; } elseif (preg_match($this->urlEncodingSkipRegexp, $url)) { // the context base URL is already encoded (see Symfony\Component\HttpFoundation\Request) $url = strtr(rawurlencode($url), $this->decodedChars); } // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 // so we need to encode them as they are not used for this purpose here // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route if (false !== strpos($url, '/.')) { $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); if ('/..' === substr($url, -3)) { $url = substr($url, 0, -2).'%2E%2E'; } elseif ('/.' === substr($url, -2)) { $url = substr($url, 0, -1).'%2E'; } } $schemeAuthority = ''; if ($host = $this->context->getHost()) { $scheme = $this->context->getScheme(); if ($requiredSchemes) { if (!in_array($scheme, $requiredSchemes, true)) { $referenceType = self::ABSOLUTE_URL; $scheme = current($requiredSchemes); } } if ($hostTokens) { $routeHost = ''; foreach ($hostTokens as $token) { if ('variable' === $token[0]) { if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i', $mergedParams[$token[3]])) { $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]); if ($this->strictRequirements) { throw new InvalidParameterException($message); } if ($this->logger) { $this->logger->error($message); } return; } $routeHost = $token[1].$mergedParams[$token[3]].$routeHost; } else { $routeHost = $token[1].$routeHost; } } if ($routeHost !== $host) { $host = $routeHost; if (self::ABSOLUTE_URL !== $referenceType) { $referenceType = self::NETWORK_PATH; } } } if (self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) { $port = ''; if ('http' === $scheme && 80 != $this->context->getHttpPort()) { $port = ':'.$this->context->getHttpPort(); } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { $port = ':'.$this->context->getHttpsPort(); } $schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://"; $schemeAuthority .= $host.$port; } } if (self::RELATIVE_PATH === $referenceType) { $url = self::getRelativePath($this->context->getPathInfo(), $url); } else { $url = $schemeAuthority.$this->context->getBaseUrl().$url; } // add a query string if needed $extra = array_udiff_assoc(array_diff_key($parameters, $variables), $defaults, function ($a, $b) { return $a == $b ? 0 : 1; }); if ($extra && $query = http_build_query($extra, '', '&')) { // "/" and "?" can be left decoded for better user experience, see // http://tools.ietf.org/html/rfc3986#section-3.4 $url .= '?'.(false === strpos($query, '%2F') ? $query : strtr($query, array('%2F' => '/'))); } return $url; } /** * Returns the target path as relative reference from the base path. * * Only the URIs path component (no schema, host etc.) is relevant and must be given, starting with a slash. * Both paths must be absolute and not contain relative parts. * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives. * Furthermore, they can be used to reduce the link size in documents. * * Example target paths, given a base path of "/a/b/c/d": * - "/a/b/c/d" -> "" * - "/a/b/c/" -> "./" * - "/a/b/" -> "../" * - "/a/b/c/other" -> "other" * - "/a/x/y" -> "../../x/y" * * @param string $basePath The base path * @param string $targetPath The target path * * @return string The relative target path */ public static function getRelativePath($basePath, $targetPath) { if ($basePath === $targetPath) { return ''; } $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); $targetDirs = explode('/', isset($targetPath[0]) && '/' === $targetPath[0] ? substr($targetPath, 1) : $targetPath); array_pop($sourceDirs); $targetFile = array_pop($targetDirs); foreach ($sourceDirs as $i => $dir) { if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) { unset($sourceDirs[$i], $targetDirs[$i]); } else { break; } } $targetDirs[] = $targetFile; $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); // A reference to the same base directory or an empty subdirectory must be prefixed with "./". // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used // as the first segment of a relative-path reference, as it would be mistaken for a scheme name // (see http://tools.ietf.org/html/rfc3986#section-4.2). return '' === $path || '/' === $path[0] || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos) ? "./$path" : $path; } }
AngelSanz1/quieroundoc
vendor/symfony/routing/Generator/UrlGenerator.php
PHP
gpl-3.0
13,482
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 25353, 2213, 14876, 4890, 7427, 1012, 1008, 1008, 1006, 1039, 1007, 6904, 11283, 2078, 8962, 2368, 19562, 1026, 6904, 11283, 2078, 1030, 25353, 2213, 14876, 489...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# $FreeBSD$ PROG= getfmac MAN= getfmac.8 .include <bsd.prog.mk>
jhbsz/OSI-OS
usr.sbin/getfmac/Makefile
Makefile
bsd-3-clause
68
[ 30522, 1001, 1002, 2489, 5910, 2094, 1002, 4013, 2290, 1027, 2131, 16715, 6305, 2158, 1027, 2131, 16715, 6305, 1012, 1022, 1012, 2421, 1026, 18667, 2094, 1012, 4013, 2290, 1012, 12395, 1028, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. """This module is deprecated. Please use `airflow.providers.amazon.aws.operators.emr_terminate_job_flow`.""" import warnings # pylint: disable=unused-import from airflow.providers.amazon.aws.operators.emr_terminate_job_flow import EmrTerminateJobFlowOperator # noqa warnings.warn( "This module is deprecated. Please use `airflow.providers.amazon.aws.operators.emr_terminate_job_flow`.", DeprecationWarning, stacklevel=2, )
airbnb/airflow
airflow/contrib/operators/emr_terminate_job_flow_operator.py
Python
apache-2.0
1,226
[ 30522, 1001, 1001, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1001, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1001, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1001, 4953, 9385, 6095, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include <QtGui/QApplication> #include "dialog.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog w; w.show(); return a.exec(); }
urykhy/qcryptdisk
main.cpp
C++
gpl-3.0
170
[ 30522, 1001, 2421, 1026, 1053, 2102, 25698, 1013, 1053, 29098, 19341, 3508, 1028, 1001, 2421, 1000, 13764, 8649, 1012, 1044, 1000, 20014, 2364, 1006, 20014, 12098, 18195, 1010, 25869, 1008, 12098, 2290, 2615, 1031, 1033, 1007, 1063, 1053, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...