text
stringlengths
2
1.04M
meta
dict
<?php namespace Rocketeer\Console; use Rocketeer\Dummies\DummyPromptingCommand; use Rocketeer\TestCases\RocketeerTestCase; class RocketeerStyleTest extends RocketeerTestCase { public function testDisplaysWarningInNonInteractiveMode() { $command = new DummyPromptingCommand(); $tester = $this->executeCommand($command, [], ['interactive' => false]); $this->assertContains('prompt was skipped: Annie are you ok', $tester->getDisplay()); } public function testCanReturnDefaultValueInNonInteractiveMode() { $command = new DummyPromptingCommand(); $tester = $this->executeCommand($command, [], ['interactive' => false]); $this->assertContains('Foo', $tester->getDisplay()); } }
{ "content_hash": "5ed9289e0ec45a740ebfdf08add88591", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 93, "avg_line_length": 27.88888888888889, "alnum_prop": 0.6918990703851262, "repo_name": "rocketeers/rocketeer", "id": "e11abe4f500f69b406aec32886c685bbf3d42614", "size": "969", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/Console/RocketeerStyleTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "778879" } ], "symlink_target": "" }
package org.backbone.orm.mybatis.dao; import org.backbone.orm.EntityAccessor; import org.backbone.orm.mybatis.DatabaseRouter; /** * @author bianliang (05/07/2017) */ public interface DatabaseRouterDao extends EntityAccessor { DatabaseRouter getDatabaseRouter(); }
{ "content_hash": "dbfdc0f87de6b1f1938608e01ecd9b40", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 59, "avg_line_length": 22.75, "alnum_prop": 0.7802197802197802, "repo_name": "cyanqueen/backbone", "id": "4e24156362f2e7821929a0a2d80ec15f9d5c712b", "size": "273", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backbone-orm/src/main/java/org/backbone/orm/mybatis/dao/DatabaseRouterDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "67819" } ], "symlink_target": "" }
using ENode.Messaging; namespace ENode.Commanding { /// <summary>Represents a command. /// </summary> public interface ICommand : IMessage { /// <summary>Represents the associated aggregate root string id. /// </summary> string AggregateRootId { get; } } }
{ "content_hash": "68ef4ec5b0071da70031843a7c179efa", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 72, "avg_line_length": 23.307692307692307, "alnum_prop": 0.6204620462046204, "repo_name": "tangxuehua/enode", "id": "f78f07c54953e2aa39e8a7b154afcb361393d206", "size": "305", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ENode/Commanding/ICommand.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "570099" }, { "name": "TSQL", "bytes": "1681" } ], "symlink_target": "" }
module Elmas class Item include Elmas::Resource def base_path "logistics/Items" end def mandatory_attributes [:code, :description] end def other_attributes # rubocop:disable Metrics/MethodLength [ :class_01, :class_02, :class_03, :class_04, :class_05, :copy_remarks, :cost_price_currency, :cost_price_new, :cost_price_standard, :end_date, :extra_description, :free_bool_field_01, :free_bool_field_02, :free_bool_field_03, :free_bool_field_04, :free_bool_field_05, :free_date_field_01, :free_date_field_02, :free_date_field_03, :free_date_field_04, :free_date_field_05, :free_number_field_01, :free_number_field_02, :free_number_field_03, :free_number_field_04, :free_number_field_05, :free_number_field_06, :free_number_field_07, :free_number_field_08, :free_text_field_01, :free_text_field_02, :free_text_field_03, :free_text_field_04, :free_text_field_05, :free_text_field_06, :free_text_field_07, :free_text_field_08, :free_text_field_09, :free_text_field_10, :GL_costs, :GL_revenue, :GL_stock, :is_batch_item, :is_batch_number_item, :is_fraction_allowed_item, :is_make_item, :is_new_contract, :is_on_demand_item, :is_package_item, :is_registration_code_item, :is_purchase_item, :is_sales_item, :is_serial_item, :is_serial_number_item, :is_stock_item, :is_subcontracted_item, :is_time, :is_webshop_item, :item_group, :notes, :sales_vat_code, :search_code, :security_level, :start_date, :unit ] end end end
{ "content_hash": "83ec86e6f3b3f009948b262178241750", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 99, "avg_line_length": 48.121212121212125, "alnum_prop": 0.6479848866498741, "repo_name": "mistaguy/exactonline-api-ruby-client", "id": "2575c7034426484651c305d6d7827194e96a15ac", "size": "1588", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/elmas/resources/item.rb", "mode": "33261", "license": "mit", "language": [ { "name": "Ruby", "bytes": "131201" }, { "name": "Shell", "bytes": "621" } ], "symlink_target": "" }
import { TestBed, inject } from '@angular/core/testing'; import { RecipesService } from './recipes.service'; describe('RecipesService', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [RecipesService] }); }); it('should ...', inject([RecipesService], (service: RecipesService) => { expect(service).toBeTruthy(); })); });
{ "content_hash": "55fd11acf18cef16824f16c0784b964a", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 74, "avg_line_length": 24.866666666666667, "alnum_prop": 0.6300268096514745, "repo_name": "WindMay/angular-tablita", "id": "b9a012cb4777b715439e51cbf1bf192304773c48", "size": "373", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo/src/app/services/recipes.service.spec.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "6333" }, { "name": "TypeScript", "bytes": "26148" } ], "symlink_target": "" }
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8"> <title>withFlippedAroundX</title> <link href="../../../images/logo-icon.svg" rel="icon" type="image/svg"> <script>var pathToRoot = "../../../";</script> <script type="text/javascript" src="../../../scripts/sourceset_dependencies.js" async="async"></script> <link href="../../../styles/style.css" rel="Stylesheet"> <link href="../../../styles/logo-styles.css" rel="Stylesheet"> <link href="../../../styles/jetbrains-mono.css" rel="Stylesheet"> <link href="../../../styles/main.css" rel="Stylesheet"> <script type="text/javascript" src="../../../scripts/clipboard.js" async="async"></script> <script type="text/javascript" src="../../../scripts/navigation-loader.js" async="async"></script> <script type="text/javascript" src="../../../scripts/platform-content-handler.js" async="async"></script> <script type="text/javascript" src="../../../scripts/main.js" async="async"></script> </head> <body> <div id="container"> <div id="leftColumn"> <div id="logo"></div> <div id="paneSearch"></div> <div id="sideMenu"></div> </div> <div id="main"> <div id="leftToggler"><span class="icon-toggler"></span></div> <script type="text/javascript" src="../../../scripts/pages.js"></script> <script type="text/javascript" src="../../../scripts/main.js"></script> <div class="main-content" id="content" pageIds="org.hexworks.zircon.api.data.base/BaseBlock/withFlippedAroundX/#/PointingToDeclaration//-828656838"> <div class="navigation-wrapper" id="navigation-wrapper"> <div class="breadcrumbs"><a href="../../index.html">zircon.core</a>/<a href="../index.html">org.hexworks.zircon.api.data.base</a>/<a href="index.html">BaseBlock</a>/<a href="with-flipped-around-x.html">withFlippedAroundX</a></div> <div class="pull-right d-flex"> <div class="filter-section" id="filter-section"><button class="platform-tag platform-selector common-like" data-active="" data-filter=":zircon.core:dokkaHtml/commonMain">common</button></div> <div id="searchBar"></div> </div> </div> <div class="cover "> <h1 class="cover"><span>with</span><wbr></wbr><span>Flipped</span><wbr></wbr><span>Around</span><wbr></wbr><span>X</span></h1> </div> <div class="divergent-group" data-filterable-current=":zircon.core:dokkaHtml/commonMain" data-filterable-set=":zircon.core:dokkaHtml/commonMain"><div class="with-platform-tags"><span class="pull-right"></span></div> <div> <div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":zircon.core:dokkaHtml/commonMain"><div class="symbol monospace">open override fun <a href="with-flipped-around-x.html">withFlippedAroundX</a>(): <a href="../../org.hexworks.zircon.api.data/-block/index.html">Block</a>&lt;<a href="index.html">T</a>&gt;<span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div> </div> <p class="paragraph">Returns a new <a href="../../org.hexworks.zircon.api.data/-block/index.html">Block</a> which is a rotation of this <a href="../../org.hexworks.zircon.api.data/-block/index.html">Block</a> around the x axis.</p></div> <h2 class="">Sources</h2> <div class="table" data-togglable="Sources"><a data-name="%5Borg.hexworks.zircon.api.data.base%2FBaseBlock%2FwithFlippedAroundX%2F%23%2FPointingToDeclaration%2F%5D%2FSource%2F-828656838" anchor-label="https://github.com/Hexworks/zircon/tree/master/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/data/base/BaseBlock.kt#L68" id="%5Borg.hexworks.zircon.api.data.base%2FBaseBlock%2FwithFlippedAroundX%2F%23%2FPointingToDeclaration%2F%5D%2FSource%2F-828656838" data-filterable-set=":zircon.core:dokkaHtml/commonMain"></a> <div class="table-row" data-filterable-current=":zircon.core:dokkaHtml/commonMain" data-filterable-set=":zircon.core:dokkaHtml/commonMain"> <div class="main-subrow keyValue "> <div class=""><span class="inline-flex"><a href="https://github.com/Hexworks/zircon/tree/master/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/data/base/BaseBlock.kt#L68">(source)</a><span class="anchor-wrapper"><span class="anchor-icon" pointing-to="%5Borg.hexworks.zircon.api.data.base%2FBaseBlock%2FwithFlippedAroundX%2F%23%2FPointingToDeclaration%2F%5D%2FSource%2F-828656838"></span> <div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div> </span></span></div> <div></div> </div> </div> </div> </div> <div class="footer"><span class="go-to-top-icon"><a href="#content"></a></span><span>© 2020 Copyright</span><span class="pull-right"><span>Sponsored and developed by dokka</span><a href="https://github.com/Kotlin/dokka"><span class="padded-icon"></span></a></span></div> </div> </div> </body> </html>
{ "content_hash": "7d77b896605e582b390ea0ee4c0427fd", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 627, "avg_line_length": 86.19354838709677, "alnum_prop": 0.655875748502994, "repo_name": "Hexworks/zircon", "id": "069964931336923d465f1cbc27a8a7b1a8d36898", "size": "5345", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/2020.2.0-RELEASE-KOTLIN/zircon.core/zircon.core/org.hexworks.zircon.api.data.base/-base-block/with-flipped-around-x.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "121457" }, { "name": "Kotlin", "bytes": "1792092" }, { "name": "Shell", "bytes": "152" } ], "symlink_target": "" }
<!DOCTYPE html> <!-- The MIT License (MIT) Copyright (c) 2015 Mickael Jeanroy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> <html> <head> <title>WaffleJS sample</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="/vendors/html5shiv/dist/html5shiv.js"></script> <script src="/vendors/Respond/dest/respond.src.js"></script> <![endif]--> <link rel="stylesheet" href="./vendors/bootstrap/dist/css/bootstrap.css"> </head> <body> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="/">WaffleJS</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="/bare">Bare</a></li> <li><a href="/standalone">Standalone</a></li> <li><a href="/jquery">jQuery</a></li> <li><a href="/underscore">Underscore.js</a></li> <li><a href="/angular">AngularJS</a></li> <li><a href="/polymer">Polymer</a></li> <li><a href="/react">React</a></li> <li><a href="/backbone">Backbone</a></li> </ul> </div> </div> </nav> <div class="container"> <div class="jumbotron"> <h1>WaffleJS sample!</h1> <p>WaffleJS is another js grid but it's not just another js grid.</p> <p>Dependence free and yet ready to get the better of well-known libraries if you want it to.</p> <p>Choose your flavor!</p> </div> <div class="row"> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>Bare</h3> <p>Light weight.</p> <p>You already have jQuery and Underscore.js as dependencies? This waffle distribution is for you.</p> <p>Put some $ and _ on your waffles!</p> <p><a href="/bare" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>Standalone</h3> <p>Dependence free.</p> <p>Without any requirements, this waffle distribution is packaged with everything needed.</p> <p>Waffles and only waffles!</p> <p><a href="/standalone" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>jQuery</h3> <p>Half-light weight.</p> <p>Put some $ on your waffles!</p> <p><a href="/jquery" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>Underscore.js</h3> <p>Half-light weight.</p> <p>Put some _ on your waffles!</p> <p><a href="/underscore" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>AngularJS</h3> <p>This one is a bit special.</p> <p>Did I hear waffle AngularJS module?</p> <p><a href="/angular" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <div class="caption"> <h3>Polymer</h3> <p>This is the future, right now.</p> <p>Put polymer in the mix!</p> <p><a href="/polymer" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-md-4 col-md-offset-4 col-sm-offset-3"> <div class="thumbnail"> <div class="caption"> <h3>React</h3> <p>React component.</p> <p>Reactify your waffle!</p> <p><a href="/react" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> <div class="col-sm-6 col-md-4 col-md-offset-4 col-sm-offset-3"> <div class="thumbnail"> <div class="caption"> <h3>Backbone</h3> <p>Backbone View.</p> <p>Backbone for your app!</p> <p><a href="/backbone" class="btn btn-primary" role="button">Show sample!</a></p> </div> </div> </div> </div> </div> </body> </html>
{ "content_hash": "ca4e713c45219f5d0ed914b920b80fe4", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 114, "avg_line_length": 37.36477987421384, "alnum_prop": 0.5707793300791113, "repo_name": "mjeanroy/wafflejs", "id": "37ff2b1c1485fa96d086205a21875f40ddc2008d", "size": "5941", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sample/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10335" }, { "name": "HTML", "bytes": "41747" }, { "name": "JavaScript", "bytes": "913103" } ], "symlink_target": "" }
layout: page title: Stephen Oconnor's 62nd Birthday date: 2016-05-24 author: Keith Haley tags: weekly links, java status: published summary: Vestibulum sed velit iaculis, venenatis neque at, cursus odio. banner: images/banner/people.jpg booking: startDate: 10/23/2018 endDate: 10/28/2018 ctyhocn: MDTYSHX groupCode: SO6B published: true --- Duis sit amet est et enim pellentesque convallis ac in mauris. Sed egestas vestibulum lectus rhoncus porta. Ut quis nibh magna. Phasellus non facilisis lectus. Suspendisse lacinia est vel accumsan posuere. Ut sed nunc vel dolor iaculis facilisis. Proin ut hendrerit odio. Praesent maximus commodo urna, non posuere felis semper vel. * Donec a eros ac enim egestas pretium non vel sapien * Vivamus facilisis leo consectetur, mollis tortor ut, aliquam ipsum * Maecenas eleifend justo non sapien maximus, in ultricies lacus maximus. In hac habitasse platea dictumst. Cras ligula risus, feugiat id porta sed, efficitur ac ante. Ut vulputate enim mauris, sed ultricies turpis tristique suscipit. Morbi dolor dui, lobortis semper varius quis, malesuada sit amet est. Vestibulum eget massa in leo lobortis commodo. Donec sodales, neque at placerat placerat, erat turpis consequat dolor, tempor blandit augue risus sit amet risus. Mauris posuere lacus lorem, vitae imperdiet arcu condimentum porttitor. Suspendisse vel tristique risus, at scelerisque lacus. Phasellus auctor ligula arcu, eu lobortis nisl laoreet at. Curabitur placerat urna et tristique fermentum. Cras quis bibendum augue. Duis scelerisque lorem et lorem lacinia consectetur. Nulla ac dolor nisi. Pellentesque id molestie metus. Quisque mattis metus quis neque feugiat lacinia. Sed cursus mauris sapien, vel faucibus eros gravida vitae. Integer dictum ultrices ante nec facilisis. Nulla feugiat ipsum non ex blandit ultricies. Nunc eget nulla justo. Vestibulum placerat libero at augue vehicula, eu pellentesque justo suscipit.
{ "content_hash": "54b6b0d51a15b38d6af7112a39af1e8b", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 652, "avg_line_length": 84.30434782608695, "alnum_prop": 0.8107271789582259, "repo_name": "KlishGroup/prose-pogs", "id": "754f015c41b7790acc5c5a0ba92e7a76c673fd50", "size": "1943", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "pogs/M/MDTYSHX/SO6B/index.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #pragma once #include <folly/futures/Future.h> #include <folly/futures/Promise.h> #include <folly/Unit.h> #include <cstdint> #include <functional> #include <map> #include <memory> #include <set> #include <vector> namespace module0 { } // namespace module0
{ "content_hash": "3496db90c551c60149eec89cfe7ef189", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 67, "avg_line_length": 16.608695652173914, "alnum_prop": 0.7068062827225131, "repo_name": "getyourguide/fbthrift", "id": "21e3ca2a7af053bbdee41165b806a74ed8f21a8c", "size": "382", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "thrift/compiler/test/fixtures/qualified/gen-py3/module0/clients_wrapper.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "154349" }, { "name": "C#", "bytes": "28929" }, { "name": "C++", "bytes": "17798156" }, { "name": "CMake", "bytes": "33182" }, { "name": "D", "bytes": "669764" }, { "name": "Emacs Lisp", "bytes": "5154" }, { "name": "Erlang", "bytes": "23039" }, { "name": "Go", "bytes": "375816" }, { "name": "HTML", "bytes": "404999" }, { "name": "Hack", "bytes": "768869" }, { "name": "Haskell", "bytes": "305707" }, { "name": "Java", "bytes": "2408919" }, { "name": "JavaScript", "bytes": "6018" }, { "name": "Lex", "bytes": "11934" }, { "name": "M4", "bytes": "99563" }, { "name": "Makefile", "bytes": "53670" }, { "name": "OCaml", "bytes": "32043" }, { "name": "Objective-C", "bytes": "152361" }, { "name": "PHP", "bytes": "322092" }, { "name": "Perl", "bytes": "70682" }, { "name": "Protocol Buffer", "bytes": "585" }, { "name": "Python", "bytes": "2413275" }, { "name": "Ruby", "bytes": "328584" }, { "name": "Shell", "bytes": "32559" }, { "name": "Smalltalk", "bytes": "22812" }, { "name": "TeX", "bytes": "48707" }, { "name": "Thrift", "bytes": "259661" }, { "name": "Vim script", "bytes": "2837" }, { "name": "Yacc", "bytes": "36158" } ], "symlink_target": "" }
package com.autochime.autochimeapplication.fragments; import android.app.LoaderManager; import android.content.CursorLoader; import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import com.autochime.autochimeapplication.R; public class AddContactFragment extends DialogFragment implements LoaderManager.LoaderCallbacks<Cursor>, AdapterView.OnItemClickListener{ private final static String[] FROM_COLUMNS = { ContactsContract.Contacts.DISPLAY_NAME_PRIMARY }; private final static int[] TO_IDS = { R.id.addcontact_contact_name }; ListView mContactsList; Uri mContactUri; private SimpleCursorAdapter mCursorAdapter; private static final String[] PROJECTION = { ContactsContract.Contacts._ID, ContactsContract.Contacts.LOOKUP_KEY, ContactsContract.Contacts.DISPLAY_NAME_PRIMARY }; private static final long CONTACT_ID_INDEX = 0; public AddContactFragment() { } public static AddContactFragment newInstance() { AddContactFragment f = new AddContactFragment(); return f; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_addcontact_list, container, false); } public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mContactsList = (ListView) getView().findViewById(R.id.addcontact_list); mContactsList.setOnItemClickListener(this); mCursorAdapter = new SimpleCursorAdapter( getActivity(), R.layout.fragment_addcontact, null, FROM_COLUMNS, TO_IDS, 0); mContactsList.setAdapter(mCursorAdapter); getLoaderManager().initLoader(0, null, this); } @Override public void onItemClick(AdapterView<?> parent, View item, int position, long rowID) { Cursor cursor = ((SimpleCursorAdapter)parent.getAdapter()).getCursor(); cursor.moveToPosition(position); mContactUri = ContactsContract.Contacts.getLookupUri(CONTACT_ID_INDEX, null); /* * You can use mContactUri as the content URI for retrieving * the details for a contact. */ } @Override public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) { return new CursorLoader( getActivity(), ContactsContract.Contacts.CONTENT_URI, PROJECTION, null, null, null ); } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { // Put the result Cursor in the adapter for the ListView mCursorAdapter.swapCursor(cursor); } @Override public void onLoaderReset(Loader<Cursor> loader) { // Delete the reference to the existing Cursor mCursorAdapter.swapCursor(null); } }
{ "content_hash": "408c67beeb53886351e7f52d62940f07", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 89, "avg_line_length": 31.628318584070797, "alnum_prop": 0.661723559037493, "repo_name": "yuwilbur/autochime", "id": "ae7aa134f33c758020f5b94ad5b857e29a1de86c", "size": "3574", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/autochime/autochimeapplication/fragments/AddContactFragment.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "43470" }, { "name": "HTML", "bytes": "24475" }, { "name": "Java", "bytes": "63139" } ], "symlink_target": "" }
/* * Author : Shujia Huang & Siyang Liu * Date : 2013-11-22 14:37:13 * * Modfiy from '~/Bin/software_pip/Reapr/Reapr_1.0.16/src/task_stats.cpp' wrote by Matin Hunt * 2013-11-26 23:02:07 I shift to calculate the read coverage instead of fragment coverage!! * */ #include <iostream> #include <fstream> #include <map> #include <set> #include <cstring> #include <string> #include <list> #include <getopt.h> #include <algorithm> #include "Stats.h" struct CmdLineOptions { uint16_t minMapQuality; // ignore reads mapped with quality less than this uint32_t minAlignScore; uint32_t iniReadLength; // Just use to init the size of coverage deque string bamInfile; string gapInfile; string refGCfile; string gc2covfile; }; // deals with command line options: fills the options struct void ParseOptions(int argc, char** argv, CmdLineOptions& ops); void Usage ( const char* prog ); int main ( int argc, char** argv ) { CmdLineOptions ops; ParseOptions(argc, argv, ops); cerr << "\nCommand Important Parameters: -q " << ops.minMapQuality << " -a " << ops.minAlignScore << " -l " << ops.iniReadLength << "\n" << endl; Stats stats; map<string, list<pair<long,long> > > refgaps; LoadGaps (ops.gapInfile, refgaps); //GetInsersizeFromBam (ops.bamInfile , stats.insert); //Tabix tigc(ops.refGCfile); //LoadGC2Cov(ops.gc2covfile, stats.gc2cov); // Go through input bam file getting local stats cerr << "************ Go through input bam file getting local stats **********\n" << endl; BamReader bamReader; SamHeader header; RefVector references; if (!bamReader.Open(ops.bamInfile)) { cerr << ERROR_PREFIX << "Error opening bam file '" << ops.bamInfile << "'" << endl; return 1; } header = bamReader.GetHeader(); references = bamReader.GetReferenceData(); bool firstRecord (true); int32_t currentRefID(-1); //int32_t alignScore; uint32_t alignScore; //int32_t isToosmall, isToobig; string currentRefIDstring, rg, sa; BamAlignment al; unsigned long num = 0; //cout << "#CHROM\tPOS\tTOTAL_COV\tPROPER_PAIR_COV\tLOW_ALIGN_SCORE_PROPER_PAIR\tBAD_INSERT_COV\tWRONG_ORIETATION_COV\tSINGLE_END_COV\t" // << "CLIP_AND_SA_COV\tEXPECTED_COV(Correct by GC contain)\n"; cout << "#CHROM\tPOS\tTOTAL_COV\tPROPER_PAIR_COV\tLOW_ALIGN_SCORE_PROPER_PAIR\tCROSS_READ_COV\tBAD_INSERT_COV\tWRONG_ORIETATION_COV\tSINGLE_END_COV\t" << "CLIP_AND_SA_COV\n"; while ( bamReader.GetNextAlignment(al) ) { ++num; if ( num % 1000000 == 0 ) cerr << ">>> Reading lines number : " << num << endl; if ( !al.IsMapped() || al.IsDuplicate() || al.MapQuality < ops.minMapQuality ) continue; //al.GetTag("AS", alignScore); //cerr << "alignScore: " << alignScore << "\t# " << al.GetTag("AS", alignScore) << "\t# " << al.HasTag("AS") << endl; if (!al.GetTag("AS", alignScore)) { cerr << "Read " << al.Name << " doesn't have an alignment score AS:... Cannot continue" << endl; exit(1); } if (!al.GetTag("RG", rg)) { cerr << "Read " << al.Name << " doesn't have an alignment score RG:... Cannot continue " << endl; exit(1); } //if (!stats.insert.count(rg)) { // cerr << "Read " << al.Name << " doesn't have a RG id( " << rg << " ) at bam header ... Cannot continue " << endl; exit(1); //} // Deal with the case when we find a new reference sequence in the bam if ( currentRefID != al.RefID ) { if ( firstRecord ) { firstRecord = false; } else { OutputStats( currentRefIDstring, references[currentRefID].RefLength + 1, stats, refgaps ); } currentRefID = al.RefID; currentRefIDstring = references[al.RefID].RefName; unsigned long startPos = 1; stats.properPair = Coverage( ops.iniReadLength, startPos ); stats.pLowAlignScore = Coverage( ops.iniReadLength, startPos ); stats.crossSignal = Coverage( ops.iniReadLength, startPos ); // to be a cross signal reads then the reads must be a proper-pair first! stats.badInserSizePair = Coverage( ops.iniReadLength, startPos ); stats.wrongOrientation = Coverage( ops.iniReadLength, startPos ); stats.single = Coverage( ops.iniReadLength, startPos ); stats.clipAlign = Coverage( ops.iniReadLength, startPos ); //LoadGC(tigc, currentRefIDstring, stats.refGC); } // print all stats to left 100bp of current read mapped position // It's very important to keep away from the current mapped position 100bp, this distance is for reads clip situation! OutputStats ( currentRefIDstring, al.Position - 100, stats, refgaps ); // Acturally I dn't have to set -100 now! 2013-11-26 22:57:32 // Now the coordinate in Coverage should equal to al.Position //isToosmall = stats.insert[rg].first - 3 * stats.insert[rg].second; if ( isToosmall < 0 ) isToosmall = 1; //isToobig = stats.insert[rg].first + 3 * stats.insert[rg].second; // Caution: Bamtools give the 0-base coordinate system which interval is half closed '(]', I shift it to 1-base // coordinate system which interval is closed '[]' below. // al.Position is 0-base; // al.GetEndPosition() is 1-base by default if ( al.CigarData[0].Type == 'S' && (al.Position+1) > 1 ) stats.clipAlign.Add((al.Position+1) - 1); if ( al.CigarData.back().Type == 'S' && al.GetEndPosition()+1 <= references[al.RefID].RefLength ) stats.clipAlign.Add(al.GetEndPosition() + 1); short pairOrientation = GetPairOrientation( al ); if ( !al.IsMateMapped() || pairOrientation == UNPAIRED || pairOrientation == DIFF_CHROM ) { stats.single.Add (al.Position + 1, al.GetEndPosition()); // al.Position is 0-base, shift to 1-base } else if ( pairOrientation == INNER ) { //Correct orientation but the insertsize could be good or bad if ( al.IsProperPair() ) { if ( alignScore >= ops.minAlignScore ) { // stats.properPair // Should consider cross signal first! map< char, vector<pair<int32_t,int32_t> > > indelSignal = IndelSignalRefPos(al.Position + 1, al.CigarData); if ( indelSignal.count('I') ) { for ( size_t i(0); i < indelSignal['I'].size(); ++i ) stats.crossSignal.Add( indelSignal['I'][i].first, indelSignal['I'][i].second ); } if ( indelSignal.count('D') ) { for ( size_t i(0); i < indelSignal['D'].size(); ++i ) stats.crossSignal.Add( indelSignal['D'][i].first, indelSignal['D'][i].second ); } if ( !indelSignal.count('I') && !indelSignal.count('D') ) stats.properPair.Add ( al.Position + 1, al.GetEndPosition() ); } else { // stats.pLowAlignScore stats.pLowAlignScore.Add( al.Position + 1, al.GetEndPosition() ); // read coverage } } else { stats.badInserSizePair.Add ( al.Position + 1, al.GetEndPosition() ); } } else if ( pairOrientation == SAME || pairOrientation == OUTTER ) { // Wrong Orientation stats.wrongOrientation.Add ( (al.Position + 1), al.GetEndPosition() ); } else { cerr << ERROR_PREFIX << "Didn't expect this to happen... " << al.Name << endl; exit(1); } } bamReader.Close(); cerr << ">>> Total lines number in bamInfile : " << num << endl; // print the remaining stats from the last ref sequence in the bam OutputStats( currentRefIDstring, references[currentRefID].RefLength + 1, stats, refgaps ); cerr << "***************************** All Done ******************************\n" << endl; return 0; } void ParseOptions(int argc, char** argv, CmdLineOptions& ops) { // Set Default ops.minMapQuality = 30; ops.minAlignScore = 90; ops.iniReadLength = 1000; char c; while ( (c = getopt(argc, argv, "b:a:l:q:r:g:c:h") ) != -1 ) { switch ( c ) { case 'b' : ops.bamInfile = optarg; break; case 'r' : ops.refGCfile = optarg; break; case 'g' : ops.gapInfile = optarg; break; case 'c' : ops.gc2covfile = optarg; break; // gc contain to coverage case 'q' : ops.minMapQuality = atoi(optarg); break; case 'a' : ops.minAlignScore = atoi(optarg); break; case 'l' : ops.iniReadLength = atoi(optarg); break; case 'h' : Usage( argv[0] ); default : cerr << "\n[ERROR]Unknow option: -" << c << "\n" << endl; exit(1); } } //if ( ops.bamInfile.empty() || ops.refGCfile.empty() || ops.gc2covfile.empty() || ops.gapInfile.empty() ) Usage ( argv[0] ); if ( ops.bamInfile.empty() || ops.gapInfile.empty() ) Usage ( argv[0] ); } void Usage ( const char* prog ) { cerr << "\nVersion : 0.0.0 (2013-11-25 22:33:53) \n" << "Author : Shujia Huang \n\n" << "\nUsage : " << prog << " [Option] [-b bamInfile] > Output \n\n" << " Options : \n\n" << " -b bam input file. Required! \n" //<< " -r File of reference's GC contain. Required! \n" << " -g File of reference gap' regions. Required! \n" //<< " -c File of GC contain vs coverage. Required! \n" << " -q Min Mapped quality. [30] \n" << " -a Min alignment score. [90] \n" << " -l Init fragment length.[1000] Not Suggest to change this parameter.\n" << " -h Show this help. \n" << endl; exit(1); }
{ "content_hash": "587f5356dd7a4f88427a2d6f2d327cb3", "timestamp": "", "source": "github", "line_count": 217, "max_line_length": 151, "avg_line_length": 43.60829493087557, "alnum_prop": 0.605938920004227, "repo_name": "ShujiaHuang/AsmVar", "id": "711c260b7be1a1563c5223e5414546f7e96c8184", "size": "9463", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/AsmvarBaseStat/StatsMain.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "197531" }, { "name": "C++", "bytes": "1541677" }, { "name": "CMake", "bytes": "89392" }, { "name": "Groff", "bytes": "3862" }, { "name": "Java", "bytes": "12023" }, { "name": "Makefile", "bytes": "181674" }, { "name": "Perl", "bytes": "114628" }, { "name": "Python", "bytes": "181562" }, { "name": "Shell", "bytes": "10676" }, { "name": "TeX", "bytes": "4876" }, { "name": "XS", "bytes": "1031" } ], "symlink_target": "" }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor.Graphing.Util; using UnityEditor.ShaderGraph.Drawing.Controls; using UnityEditor.UIElements; using UnityEngine.UIElements; namespace UnityEditor.ShaderGraph.Drawing { class PBRSettingsView : VisualElement { PBRMasterNode m_Node; public PBRSettingsView(PBRMasterNode node) { m_Node = node; PropertySheet ps = new PropertySheet(); ps.Add(new PropertyRow(new Label("Workflow")), (row) => { row.Add(new EnumField(PBRMasterNode.Model.Metallic), (field) => { field.value = m_Node.model; field.RegisterValueChangedCallback(ChangeWorkFlow); }); }); ps.Add(new PropertyRow(new Label("Surface")), (row) => { row.Add(new EnumField(SurfaceType.Opaque), (field) => { field.value = m_Node.surfaceType; field.RegisterValueChangedCallback(ChangeSurface); }); }); ps.Add(new PropertyRow(new Label("Blend")), (row) => { row.Add(new EnumField(AlphaMode.Additive), (field) => { field.value = m_Node.alphaMode; field.RegisterValueChangedCallback(ChangeAlphaMode); }); }); ps.Add(new PropertyRow(new Label("Two Sided")), (row) => { row.Add(new Toggle(), (toggle) => { toggle.value = m_Node.twoSided.isOn; toggle.OnToggleChanged(ChangeTwoSided); }); }); Add(ps); } void ChangeWorkFlow(ChangeEvent<Enum> evt) { if (Equals(m_Node.model, evt.newValue)) return; m_Node.owner.owner.RegisterCompleteObjectUndo("Work Flow Change"); m_Node.model = (PBRMasterNode.Model)evt.newValue; } void ChangeSurface(ChangeEvent<Enum> evt) { if (Equals(m_Node.surfaceType, evt.newValue)) return; m_Node.owner.owner.RegisterCompleteObjectUndo("Surface Change"); m_Node.surfaceType = (SurfaceType)evt.newValue; } void ChangeAlphaMode(ChangeEvent<Enum> evt) { if (Equals(m_Node.alphaMode, evt.newValue)) return; m_Node.owner.owner.RegisterCompleteObjectUndo("Alpha Mode Change"); m_Node.alphaMode = (AlphaMode)evt.newValue; } void ChangeTwoSided(ChangeEvent<bool> evt) { m_Node.owner.owner.RegisterCompleteObjectUndo("Two Sided Change"); ToggleData td = m_Node.twoSided; td.isOn = evt.newValue; m_Node.twoSided = td; } } }
{ "content_hash": "621975d6707944172ea1ccdb2314b962", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 83, "avg_line_length": 32.51578947368421, "alnum_prop": 0.5150534153447718, "repo_name": "Unity-Technologies/ScriptableRenderLoop", "id": "b92e40832a94b3352c7a71978041d445e5c6dfab", "size": "3089", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "com.unity.shadergraph/Editor/Drawing/Views/PBRSettingsView.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "9056" }, { "name": "C#", "bytes": "2152773" }, { "name": "GLSL", "bytes": "13708" }, { "name": "HLSL", "bytes": "833428" }, { "name": "ShaderLab", "bytes": "231099" } ], "symlink_target": "" }
module Exercises.ChapterSeven ( chop8 , mychop8 , mymap , altMap , anyLuhn , myiterate , encode , decode , encodeWithParity , decodeWithParity , transmit , transmitWithParity , faultyTransmit ) where import Data.Char import Exercises.ChapterOneToFive (luhnDouble) unfold :: (a -> Bool) -> (a -> b) -> (a -> a) -> a -> [b] unfold p h t x | p x = [] | otherwise = h x : unfold p h t (t x) type Bit = Int bin2int :: [Bit] -> Int bin2int bits = sum [w * b | (w, b) <- zip weights bits] where weights = iterate (* 2) 1 -- truncate or extend a list to exactly 8 bits make8 :: [Bit] -> [Bit] make8 bits = take 8 (bits ++ repeat 0) encode :: String -> [Bit] encode = concatMap (make8 . int2bin . ord) parity :: [Bit] -> Bit parity bits = if odd ones then 1 else 0 where ones = length $ filter (1 ==) bits encodeWithParity :: String -> [Bit] encodeWithParity = concatMap (pbits . make8 . int2bin . ord) where pbits bs = parity bs : bs decode :: [Bit] -> String decode = map (chr . bin2int) . chop8 decodeWithParity :: [Bit] -> String decodeWithParity = map (chr . bin2intWithParity) . chopn 9 where bin2intWithParity (p:bits) = if parity bits == p then bin2int bits else error "Parity error" bin2intWithParity [] = error "bin2intWithParity called on empty list" transmit :: String -> String transmit = decode . channel . encode transmitWithParity :: String -> String transmitWithParity = decodeWithParity . channel . encodeWithParity faultyTransmit :: String -> String faultyTransmit = decodeWithParity . faultyChannel . encodeWithParity channel :: [Bit] -> [Bit] channel = id faultyChannel :: [Bit] -> [Bit] faultyChannel = tail -- from chapter text int2bin :: Int -> [Bit] int2bin = unfold (== 0) (`mod` 2) (`div` 2) chop8 :: [Bit] -> [[Bit]] chop8 [] = [] chop8 bits = take 8 bits : chop8 (drop 8 bits) chopn :: Int -> [Bit] -> [[Bit]] chopn _ [] = [] chopn n bits = unfold null (take n) (drop n) bits mychop8 :: [Bit] -> [[Bit]] mychop8 = chopn 8 mymap :: (a -> b) -> [a] -> [b] mymap f = unfold null (f . head) tail myiterate :: (a -> a) -> a -> [a] myiterate = unfold (const False) id altMap :: (a -> b) -> (a -> b) -> [a] -> [b] altMap _ _ [] = [] altMap f1 f2 (x:xs) = f1 x : altMap f2 f1 xs anyLuhn :: [Int] -> Bool anyLuhn digits = sum (altMap id luhnDouble (reverse digits)) `mod` 10 == 0
{ "content_hash": "60dc724641d5a21a7e3e548a4b59c6e0", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 74, "avg_line_length": 22.70754716981132, "alnum_prop": 0.6202742002492729, "repo_name": "philipcraig/hutton", "id": "2721a6121774aa7b8260a3e4b330be5fb3c0a63a", "size": "2407", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Exercises/ChapterSeven.hs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "174" }, { "name": "Haskell", "bytes": "35299" } ], "symlink_target": "" }
package org.robovm.samples.uicatalog.viewcontrollers; import org.robovm.apple.foundation.NSArray; import org.robovm.apple.uikit.UIColor; import org.robovm.apple.uikit.UIImage; import org.robovm.apple.uikit.UIImageView; import org.robovm.apple.uikit.UIViewContentMode; import org.robovm.apple.uikit.UIViewController; import org.robovm.objc.annotation.CustomClass; @CustomClass("AAPLImageViewController") public class AAPLImageViewController extends UIViewController { @Override public void viewDidLoad() { super.viewDidLoad(); // The root view of the view controller set in Interface Builder is a // UIImageView. UIImageView imageView = (UIImageView) getView(); imageView.setAnimationImages(new NSArray<UIImage>(UIImage.getImage("image_animal_1"), UIImage.getImage("image_animal_2"), UIImage.getImage("image_animal_3"), UIImage.getImage("image_animal_4"), UIImage.getImage("image_animal_5"))); // We want the image to be scaled to the correct aspect ratio within // imageView's bounds. imageView.setContentMode(UIViewContentMode.ScaleAspectFit); // If the image does not have the same aspect ratio as imageView's // bounds, then imageView's backgroundColor will be applied to the // "empty" space. imageView.setBackgroundColor(UIColor.white()); imageView.setAnimationDuration(5); imageView.startAnimating(); imageView.setAccessibilityElement(true); imageView.setAccessibilityLabel("Animated"); } }
{ "content_hash": "ee66c4a778cc73fe7b7163b3863228f3", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 93, "avg_line_length": 37.44186046511628, "alnum_prop": 0.7006211180124223, "repo_name": "robovm/robovm-samples", "id": "755e6677a78daa2353dec340104b648fdb795872", "size": "2340", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ios/uicatalog/src/main/java/org/robovm/samples/uicatalog/viewcontrollers/AAPLImageViewController.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "138738" }, { "name": "CSS", "bytes": "71066" }, { "name": "HTML", "bytes": "8115" }, { "name": "Java", "bytes": "1850579" }, { "name": "JavaScript", "bytes": "59006" }, { "name": "Metal", "bytes": "2383" }, { "name": "Objective-C", "bytes": "17457" }, { "name": "Shell", "bytes": "6548" }, { "name": "Swift", "bytes": "1227" } ], "symlink_target": "" }
from pkg_resources import get_distribution __version__ = get_distribution('rvo').version
{ "content_hash": "cf9fb4abc6937286b744fa143f15af1e", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 45, "avg_line_length": 44.5, "alnum_prop": 0.7752808988764045, "repo_name": "noqqe/rvo", "id": "a5603ab3fe8374a1042109aa6dd6dbd748b2715d", "size": "114", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "rvo/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "96671" }, { "name": "Shell", "bytes": "724" } ], "symlink_target": "" }
namespace llvm { class AliasAnalysis; class DataLayout; class MDNode; /// isSafeToLoadUnconditionally - Return true if we know that executing a load /// from this value cannot trap. If it is not obviously safe to load from the /// specified pointer, we do a quick local scan of the basic block containing /// ScanFrom, to determine if the address is already accessed. bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, unsigned Align, const DataLayout *TD = nullptr); /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at /// the instruction before ScanFrom) checking to see if we have the value at /// the memory address *Ptr locally available within a small number of /// instructions. If the value is available, return it. /// /// If not, return the iterator for the last validated instruction that the /// value would be live through. If we scanned the entire block and didn't /// find something that invalidates *Ptr or provides it, ScanFrom would be /// left at begin() and this returns null. ScanFrom could also be left /// /// MaxInstsToScan specifies the maximum instructions to scan in the block. /// If it is set to 0, it will scan the whole block. You can also optionally /// specify an alias analysis implementation, which makes this more precise. /// /// If AATags is non-null and a load or store is found, the AA tags from the /// load or store are recorded there. If there are no AA tags or if no access /// is found, it is left unmodified. Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, BasicBlock::iterator &ScanFrom, unsigned MaxInstsToScan = 6, AliasAnalysis *AA = nullptr, AAMDNodes *AATags = nullptr); } #endif
{ "content_hash": "f65ecfa7b51b8d7b3cc3c50ce7bacbe5", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 78, "avg_line_length": 47.275, "alnum_prop": 0.6795346377578001, "repo_name": "Fairly/opencor", "id": "010fee99c266ec13647d61ec3933a9988a817086", "size": "2481", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/plugins/thirdParty/LLVM/include/llvm/Analysis/Loads.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "1617" }, { "name": "Batchfile", "bytes": "5129" }, { "name": "C", "bytes": "9283641" }, { "name": "C++", "bytes": "127655731" }, { "name": "CMake", "bytes": "216018" }, { "name": "HTML", "bytes": "9294" }, { "name": "NSIS", "bytes": "4599" }, { "name": "Objective-C", "bytes": "282234" }, { "name": "PHP", "bytes": "317578" }, { "name": "Shell", "bytes": "2879" }, { "name": "SourcePawn", "bytes": "1544" }, { "name": "Visual Basic", "bytes": "332" }, { "name": "XSLT", "bytes": "58213" } ], "symlink_target": "" }
//--------------------------------------------------------------------- // <copyright file="DataServicePagingProviderWrapper.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // <summary> // Wrapper for IDataServicePagingProvider discovery by service instance. // </summary> // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Providers { /// <summary>Wrapper for IDataServicePagingProvider interface discovery.</summary> internal sealed class DataServicePagingProviderWrapper { /// <summary>IDataServicePagingProvider interface for the service.</summary> private IDataServicePagingProvider pagingProvider; /// <summary>Service instance.</summary> private IDataService service; /// <summary>Was interface already requested.</summary> private bool checkedForIDataServicePagingProvider; /// <summary>Constructor.</summary> /// <param name="serviceInstance">Service instance.</param> public DataServicePagingProviderWrapper(IDataService serviceInstance) { this.service = serviceInstance; } /// <summary>Gives reference to IDataServicePagingProvider interface implemented by the service.</summary> public IDataServicePagingProvider PagingProviderInterface { get { if (!this.checkedForIDataServicePagingProvider) { this.pagingProvider = this.service.Provider.GetService<IDataServicePagingProvider>(this.service); this.checkedForIDataServicePagingProvider = true; } return this.pagingProvider; } } /// <summary>Is custom paging enabled for the service for query processing.</summary> public bool IsCustomPagedForQuery { get { return this.PagingProviderInterface != null; } } /// <summary>Do we need to handle custom paging during serialization.</summary> public bool IsCustomPagedForSerialization { get { if (!this.checkedForIDataServicePagingProvider) { return false; } else { return this.pagingProvider != null; } } } /// <summary> /// Dispose the pagingProvider provider instance /// </summary> internal void DisposeProvider() { if (this.pagingProvider != null) { WebUtil.Dispose(this.pagingProvider); this.pagingProvider = null; } } } }
{ "content_hash": "6c0f0df5ca8dac0fe219d20f9d8e8314", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 117, "avg_line_length": 33.78823529411765, "alnum_prop": 0.5543175487465181, "repo_name": "mind0n/hive", "id": "ff25d5e5b8bde67855549ee5fc88551857b3575e", "size": "2874", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Cache/Libs/net46/ndp/fx/src/DataWeb/Server/System/Data/Services/Providers/DataServicePagingProviderWrapper.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "670329" }, { "name": "ActionScript", "bytes": "7830" }, { "name": "ApacheConf", "bytes": "47" }, { "name": "Batchfile", "bytes": "18096" }, { "name": "C", "bytes": "19746409" }, { "name": "C#", "bytes": "258148996" }, { "name": "C++", "bytes": "48534520" }, { "name": "CSS", "bytes": "933736" }, { "name": "ColdFusion", "bytes": "10780" }, { "name": "GLSL", "bytes": "3935" }, { "name": "HTML", "bytes": "4631854" }, { "name": "Java", "bytes": "10881" }, { "name": "JavaScript", "bytes": "10250558" }, { "name": "Logos", "bytes": "1526844" }, { "name": "MAXScript", "bytes": "18182" }, { "name": "Mathematica", "bytes": "1166912" }, { "name": "Objective-C", "bytes": "2937200" }, { "name": "PHP", "bytes": "81898" }, { "name": "Perl", "bytes": "9496" }, { "name": "PowerShell", "bytes": "44339" }, { "name": "Python", "bytes": "188058" }, { "name": "Shell", "bytes": "758" }, { "name": "Smalltalk", "bytes": "5818" }, { "name": "TypeScript", "bytes": "50090" } ], "symlink_target": "" }
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { Comp2304Component } from './comp-2304.component'; describe('Comp2304Component', () => { let component: Comp2304Component; let fixture: ComponentFixture<Comp2304Component>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ Comp2304Component ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(Comp2304Component); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); });
{ "content_hash": "e724a3eed173f1cc1b263380b2216890", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 73, "avg_line_length": 23.88888888888889, "alnum_prop": 0.6744186046511628, "repo_name": "angular/angular-cli-stress-test", "id": "efe2be2e248bfa8725fc4d500b59e48d7db47a2c", "size": "847", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/components/comp-2304/comp-2304.component.spec.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1040888" }, { "name": "HTML", "bytes": "300322" }, { "name": "JavaScript", "bytes": "2404" }, { "name": "TypeScript", "bytes": "8535506" } ], "symlink_target": "" }
#include <common.h> #include <asm/io.h> #include <asm/mpc512x.h> /* * MDDRC Config Runtime Settings */ ddr512x_config_t default_mddrc_config = { .ddr_sys_config = CONFIG_SYS_MDDRC_SYS_CFG, .ddr_time_config0 = CONFIG_SYS_MDDRC_TIME_CFG0, .ddr_time_config1 = CONFIG_SYS_MDDRC_TIME_CFG1, .ddr_time_config2 = CONFIG_SYS_MDDRC_TIME_CFG2, }; u32 default_init_seq[] = { CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_PCHG_ALL, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_RFSH, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_RFSH, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_MICRON_INIT_DEV_OP, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_EM2, CONFIG_SYS_DDRCMD_NOP, CONFIG_SYS_DDRCMD_PCHG_ALL, CONFIG_SYS_DDRCMD_EM2, CONFIG_SYS_DDRCMD_EM3, CONFIG_SYS_DDRCMD_EN_DLL, CONFIG_SYS_MICRON_INIT_DEV_OP, CONFIG_SYS_DDRCMD_PCHG_ALL, CONFIG_SYS_DDRCMD_RFSH, CONFIG_SYS_MICRON_INIT_DEV_OP, CONFIG_SYS_DDRCMD_OCD_DEFAULT, CONFIG_SYS_DDRCMD_PCHG_ALL, CONFIG_SYS_DDRCMD_NOP }; /* * fixed sdram init: * The board doesn't use memory modules that have serial presence * detect or similar mechanism for discovery of the DRAM settings */ long int fixed_sdram(ddr512x_config_t *mddrc_config, u32 *dram_init_seq, int seq_sz) { volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR; u32 msize = CONFIG_SYS_MAX_RAM_SIZE; u32 msize_log2 = __ilog2(msize); u32 i; /* take default settings and init sequence if necessary */ if (mddrc_config == NULL) mddrc_config = &default_mddrc_config; if (dram_init_seq == NULL) { dram_init_seq = default_init_seq; seq_sz = sizeof(default_init_seq)/sizeof(u32); } /* Initialize IO Control */ out_be32(&im->io_ctrl.io_control_mem, CONFIG_SYS_IOCTRL_MUX_DDR); /* Initialize DDR Local Window */ out_be32(&im->sysconf.ddrlaw.bar, CONFIG_SYS_DDR_BASE & 0xFFFFF000); out_be32(&im->sysconf.ddrlaw.ar, msize_log2 - 1); sync_law(&im->sysconf.ddrlaw.ar); /* DDR Enable */ /* * the "enable" combination: DRAM controller out of reset, * clock enabled, command mode -- BUT leave CKE low for now */ i = MDDRC_SYS_CFG_EN & ~MDDRC_SYS_CFG_CKE_MASK; out_be32(&im->mddrc.ddr_sys_config, i); /* maintain 200 microseconds of stable power and clock */ udelay(200); /* apply a NOP, it shouldn't harm */ out_be32(&im->mddrc.ddr_command, CONFIG_SYS_DDRCMD_NOP); /* now assert CKE (high) */ i |= MDDRC_SYS_CFG_CKE_MASK; out_be32(&im->mddrc.ddr_sys_config, i); /* Initialize DDR Priority Manager */ out_be32(&im->mddrc.prioman_config1, CONFIG_SYS_MDDRCGRP_PM_CFG1); out_be32(&im->mddrc.prioman_config2, CONFIG_SYS_MDDRCGRP_PM_CFG2); out_be32(&im->mddrc.hiprio_config, CONFIG_SYS_MDDRCGRP_HIPRIO_CFG); out_be32(&im->mddrc.lut_table0_main_upper, CONFIG_SYS_MDDRCGRP_LUT0_MU); out_be32(&im->mddrc.lut_table0_main_lower, CONFIG_SYS_MDDRCGRP_LUT0_ML); out_be32(&im->mddrc.lut_table1_main_upper, CONFIG_SYS_MDDRCGRP_LUT1_MU); out_be32(&im->mddrc.lut_table1_main_lower, CONFIG_SYS_MDDRCGRP_LUT1_ML); out_be32(&im->mddrc.lut_table2_main_upper, CONFIG_SYS_MDDRCGRP_LUT2_MU); out_be32(&im->mddrc.lut_table2_main_lower, CONFIG_SYS_MDDRCGRP_LUT2_ML); out_be32(&im->mddrc.lut_table3_main_upper, CONFIG_SYS_MDDRCGRP_LUT3_MU); out_be32(&im->mddrc.lut_table3_main_lower, CONFIG_SYS_MDDRCGRP_LUT3_ML); out_be32(&im->mddrc.lut_table4_main_upper, CONFIG_SYS_MDDRCGRP_LUT4_MU); out_be32(&im->mddrc.lut_table4_main_lower, CONFIG_SYS_MDDRCGRP_LUT4_ML); out_be32(&im->mddrc.lut_table0_alternate_upper, CONFIG_SYS_MDDRCGRP_LUT0_AU); out_be32(&im->mddrc.lut_table0_alternate_lower, CONFIG_SYS_MDDRCGRP_LUT0_AL); out_be32(&im->mddrc.lut_table1_alternate_upper, CONFIG_SYS_MDDRCGRP_LUT1_AU); out_be32(&im->mddrc.lut_table1_alternate_lower, CONFIG_SYS_MDDRCGRP_LUT1_AL); out_be32(&im->mddrc.lut_table2_alternate_upper, CONFIG_SYS_MDDRCGRP_LUT2_AU); out_be32(&im->mddrc.lut_table2_alternate_lower, CONFIG_SYS_MDDRCGRP_LUT2_AL); out_be32(&im->mddrc.lut_table3_alternate_upper, CONFIG_SYS_MDDRCGRP_LUT3_AU); out_be32(&im->mddrc.lut_table3_alternate_lower, CONFIG_SYS_MDDRCGRP_LUT3_AL); out_be32(&im->mddrc.lut_table4_alternate_upper, CONFIG_SYS_MDDRCGRP_LUT4_AU); out_be32(&im->mddrc.lut_table4_alternate_lower, CONFIG_SYS_MDDRCGRP_LUT4_AL); /* * Initialize MDDRC * put MDDRC in CMD mode and * set the max time between refreshes to 0 during init process */ out_be32(&im->mddrc.ddr_sys_config, mddrc_config->ddr_sys_config | MDDRC_SYS_CFG_CMD_MASK); out_be32(&im->mddrc.ddr_time_config0, mddrc_config->ddr_time_config0 & MDDRC_REFRESH_ZERO_MASK); out_be32(&im->mddrc.ddr_time_config1, mddrc_config->ddr_time_config1); out_be32(&im->mddrc.ddr_time_config2, mddrc_config->ddr_time_config2); /* Initialize DDR with either default or supplied init sequence */ for (i = 0; i < seq_sz; i++) out_be32(&im->mddrc.ddr_command, dram_init_seq[i]); /* Start MDDRC */ out_be32(&im->mddrc.ddr_time_config0, mddrc_config->ddr_time_config0); out_be32(&im->mddrc.ddr_sys_config, mddrc_config->ddr_sys_config); /* Allow for the DLL to startup before accessing data */ udelay(10); msize = get_ram_size(CONFIG_SYS_DDR_BASE, CONFIG_SYS_MAX_RAM_SIZE); /* Fix DDR Local Window for new size */ out_be32(&im->sysconf.ddrlaw.ar, __ilog2(msize) - 1); sync_law(&im->sysconf.ddrlaw.ar); return msize; }
{ "content_hash": "7e936ba31f28f6862dacbb1d2fd8d5d5", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 78, "avg_line_length": 36.11920529801324, "alnum_prop": 0.7165383204987166, "repo_name": "guileschool/BEAGLEBONE-tutorials", "id": "6451ea9a4aa5abef6712cc1359ca2db9a052e33f", "size": "5553", "binary": false, "copies": "47", "ref": "refs/heads/master", "path": "BBB-firmware/u-boot-v2015.10-rc2/arch/powerpc/cpu/mpc512x/fixed_sdram.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "3031801" }, { "name": "Awk", "bytes": "679" }, { "name": "Batchfile", "bytes": "451009" }, { "name": "C", "bytes": "187049589" }, { "name": "C#", "bytes": "2330" }, { "name": "C++", "bytes": "9495850" }, { "name": "CSS", "bytes": "3499" }, { "name": "GDB", "bytes": "7284" }, { "name": "Lex", "bytes": "27285" }, { "name": "Makefile", "bytes": "1485717" }, { "name": "Objective-C", "bytes": "1073082" }, { "name": "Perl", "bytes": "679475" }, { "name": "Prolog", "bytes": "258849" }, { "name": "Python", "bytes": "1962938" }, { "name": "Roff", "bytes": "24714" }, { "name": "Shell", "bytes": "319726" }, { "name": "Tcl", "bytes": "1934" }, { "name": "XSLT", "bytes": "1335" }, { "name": "Yacc", "bytes": "56953" } ], "symlink_target": "" }
import testtools import taskflow.engines from taskflow import exceptions as exc from taskflow.patterns import graph_flow as gf from taskflow.patterns import linear_flow as lf from taskflow.patterns import unordered_flow as uf from taskflow import retry from taskflow import states as st from taskflow import test from taskflow.tests import utils from taskflow.types import failure from taskflow.utils import eventlet_utils as eu class FailingRetry(retry.Retry): def execute(self, **kwargs): raise ValueError('OMG I FAILED') def revert(self, history, **kwargs): self.history = history def on_failure(self, **kwargs): return retry.REVERT class NastyFailingRetry(FailingRetry): def revert(self, history, **kwargs): raise ValueError('WOOT!') class RetryTest(utils.EngineTestBase): def test_run_empty_linear_flow(self): flow = lf.Flow('flow-1', utils.OneReturnRetry(provides='x')) engine = self._make_engine(flow) engine.run() self.assertEqual({'x': 1}, engine.storage.fetch_all()) def test_run_empty_unordered_flow(self): flow = uf.Flow('flow-1', utils.OneReturnRetry(provides='x')) engine = self._make_engine(flow) engine.run() self.assertEqual({'x': 1}, engine.storage.fetch_all()) def test_run_empty_graph_flow(self): flow = gf.Flow('flow-1', utils.OneReturnRetry(provides='x')) engine = self._make_engine(flow) engine.run() self.assertEqual({'x': 1}, engine.storage.fetch_all()) def test_states_retry_success_linear_flow(self): flow = lf.Flow('flow-1', retry.Times(4, 'r1', provides='x')).add( utils.ProgressingTask("task1"), utils.ConditionalTask("task2") ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r RETRYING', 'task1.t PENDING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_states_retry_reverted_linear_flow(self): flow = lf.Flow('flow-1', retry.Times(2, 'r1', provides='x')).add( utils.ProgressingTask("task1"), utils.ConditionalTask("task2") ) engine = self._make_engine(flow) engine.storage.inject({'y': 4}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) self.assertEqual({'y': 4}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r RETRYING', 'task1.t PENDING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_states_retry_failure_linear_flow(self): flow = lf.Flow('flow-1', retry.Times(2, 'r1', provides='x')).add( utils.NastyTask("task1"), utils.ConditionalTask("task2") ) engine = self._make_engine(flow) engine.storage.inject({'y': 4}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Gotcha', engine.run) self.assertEqual({'y': 4, 'x': 1}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERT_FAILURE(Failure: RuntimeError: Gotcha!)', 'flow-1.f FAILURE'] self.assertEqual(expected, capturer.values) def test_states_retry_failure_nested_flow_fails(self): flow = lf.Flow('flow-1', utils.retry.AlwaysRevert('r1')).add( utils.TaskNoRequiresNoReturns("task1"), lf.Flow('flow-2', retry.Times(3, 'r2', provides='x')).add( utils.TaskNoRequiresNoReturns("task2"), utils.ConditionalTask("task3") ), utils.TaskNoRequiresNoReturns("task4") ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(None)', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'r2.r RUNNING', 'r2.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t FAILURE(Failure: RuntimeError: Woot!)', 'task3.t REVERTING', 'task3.t REVERTED(None)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r2.r RETRYING', 'task2.t PENDING', 'task3.t PENDING', 'r2.r RUNNING', 'r2.r SUCCESS(2)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t SUCCESS(None)', 'task4.t RUNNING', 'task4.t SUCCESS(None)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_new_revert_vs_old(self): flow = lf.Flow('flow-1').add( utils.TaskNoRequiresNoReturns("task1"), lf.Flow('flow-2', retry.Times(1, 'r1', provides='x')).add( utils.TaskNoRequiresNoReturns("task2"), utils.ConditionalTask("task3") ), utils.TaskNoRequiresNoReturns("task4") ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: try: engine.run() except Exception: pass expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t FAILURE(Failure: RuntimeError: Woot!)', 'task3.t REVERTING', 'task3.t REVERTED(None)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) engine = self._make_engine(flow, defer_reverts=True) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: try: engine.run() except Exception: pass expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t FAILURE(Failure: RuntimeError: Woot!)', 'task3.t REVERTING', 'task3.t REVERTED(None)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_states_retry_failure_parent_flow_fails(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1', provides='x1')).add( utils.TaskNoRequiresNoReturns("task1"), lf.Flow('flow-2', retry.Times(3, 'r2', provides='x2')).add( utils.TaskNoRequiresNoReturns("task2"), utils.TaskNoRequiresNoReturns("task3") ), utils.ConditionalTask("task4", rebind={'x': 'x1'}) ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() self.assertEqual({'y': 2, 'x1': 2, 'x2': 1}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'r2.r RUNNING', 'r2.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t SUCCESS(None)', 'task4.t RUNNING', 'task4.t FAILURE(Failure: RuntimeError: Woot!)', 'task4.t REVERTING', 'task4.t REVERTED(None)', 'task3.t REVERTING', 'task3.t REVERTED(None)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r2.r REVERTING', 'r2.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r RETRYING', 'task1.t PENDING', 'r2.r PENDING', 'task2.t PENDING', 'task3.t PENDING', 'task4.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(None)', 'r2.r RUNNING', 'r2.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task3.t RUNNING', 'task3.t SUCCESS(None)', 'task4.t RUNNING', 'task4.t SUCCESS(None)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_unordered_flow_task_fails_parallel_tasks_should_be_reverted(self): flow = uf.Flow('flow-1', retry.Times(3, 'r', provides='x')).add( utils.ProgressingTask("task1"), utils.ConditionalTask("task2") ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r.r RUNNING', 'r.r SUCCESS(1)', 'task1.t RUNNING', 'task2.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task1.t REVERTING', 'task2.t REVERTED(None)', 'task1.t REVERTED(None)', 'r.r RETRYING', 'task1.t PENDING', 'task2.t PENDING', 'r.r RUNNING', 'r.r SUCCESS(2)', 'task1.t RUNNING', 'task2.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t SUCCESS(None)', 'flow-1.f SUCCESS'] self.assertItemsEqual(capturer.values, expected) def test_nested_flow_reverts_parent_retries(self): retry1 = retry.Times(3, 'r1', provides='x') retry2 = retry.Times(0, 'r2', provides='x2') flow = lf.Flow('flow-1', retry1).add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry2).add(utils.ConditionalTask("task2")) ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2, 'x2': 1}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r2.r RUNNING', 'r2.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r2.r REVERTING', 'r2.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r RETRYING', 'task1.t PENDING', 'r2.r PENDING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r2.r RUNNING', 'r2.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_nested_flow_with_retry_revert(self): retry1 = retry.Times(0, 'r1', provides='x2') flow = lf.Flow('flow-1').add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry1).add( utils.ConditionalTask("task2", inject={'x': 1})) ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: try: engine.run() except Exception: pass self.assertEqual({'y': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_nested_flow_with_retry_revert_all(self): retry1 = retry.Times(0, 'r1', provides='x2', revert_all=True) flow = lf.Flow('flow-1').add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry1).add( utils.ConditionalTask("task2", inject={'x': 1})) ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: try: engine.run() except Exception: pass self.assertEqual({'y': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_revert_all_retry(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1', provides='x')).add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry.AlwaysRevertAll('r2')).add( utils.ConditionalTask("task2")) ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) self.assertEqual({'y': 2}, engine.storage.fetch_all()) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r2.r RUNNING', 'r2.r SUCCESS(None)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r2.r REVERTING', 'r2.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_restart_reverted_flow_with_retry(self): flow = lf.Flow('test', retry=utils.OneReturnRetry(provides='x')).add( utils.FailingTask('fail')) engine = self._make_engine(flow) self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) def test_run_just_retry(self): flow = utils.OneReturnRetry(provides='x') engine = self._make_engine(flow) self.assertRaises(TypeError, engine.run) def test_use_retry_as_a_task(self): flow = lf.Flow('test').add(utils.OneReturnRetry(provides='x')) engine = self._make_engine(flow) self.assertRaises(TypeError, engine.run) def test_resume_flow_that_had_been_interrupted_during_retrying(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1')).add( utils.ProgressingTask('t1'), utils.ProgressingTask('t2'), utils.ProgressingTask('t3') ) engine = self._make_engine(flow) engine.compile() engine.prepare() with utils.CaptureListener(engine) as capturer: engine.storage.set_atom_state('r1', st.RETRYING) engine.storage.set_atom_state('t1', st.PENDING) engine.storage.set_atom_state('t2', st.REVERTED) engine.storage.set_atom_state('t3', st.REVERTED) engine.run() expected = ['flow-1.f RUNNING', 't2.t PENDING', 't3.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 't1.t RUNNING', 't1.t SUCCESS(5)', 't2.t RUNNING', 't2.t SUCCESS(5)', 't3.t RUNNING', 't3.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_resume_flow_that_should_be_retried(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1')).add( utils.ProgressingTask('t1'), utils.ProgressingTask('t2') ) engine = self._make_engine(flow) engine.compile() engine.prepare() with utils.CaptureListener(engine) as capturer: engine.storage.set_atom_intention('r1', st.RETRY) engine.storage.set_atom_state('r1', st.SUCCESS) engine.storage.set_atom_state('t1', st.REVERTED) engine.storage.set_atom_state('t2', st.REVERTED) engine.run() expected = ['flow-1.f RUNNING', 'r1.r RETRYING', 't1.t PENDING', 't2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 't1.t RUNNING', 't1.t SUCCESS(5)', 't2.t RUNNING', 't2.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_retry_tasks_that_has_not_been_reverted(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1', provides='x')).add( utils.ConditionalTask('c'), utils.ProgressingTask('t1') ) engine = self._make_engine(flow) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine) as capturer: engine.run() expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 'c.t RUNNING', 'c.t FAILURE(Failure: RuntimeError: Woot!)', 'c.t REVERTING', 'c.t REVERTED(None)', 'r1.r RETRYING', 'c.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'c.t RUNNING', 'c.t SUCCESS(None)', 't1.t RUNNING', 't1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_default_times_retry(self): flow = lf.Flow('flow-1', retry.Times(3, 'r1')).add( utils.ProgressingTask('t1'), utils.FailingTask('t2')) engine = self._make_engine(flow) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(1)', 't1.t RUNNING', 't1.t SUCCESS(5)', 't2.t RUNNING', 't2.t FAILURE(Failure: RuntimeError: Woot!)', 't2.t REVERTING', 't2.t REVERTED(None)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 't2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 't1.t RUNNING', 't1.t SUCCESS(5)', 't2.t RUNNING', 't2.t FAILURE(Failure: RuntimeError: Woot!)', 't2.t REVERTING', 't2.t REVERTED(None)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 't2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t SUCCESS(5)', 't2.t RUNNING', 't2.t FAILURE(Failure: RuntimeError: Woot!)', 't2.t REVERTING', 't2.t REVERTED(None)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_for_each_with_list(self): collection = [3, 2, 3, 5] retry1 = retry.ForEach(collection, 'r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.FailingTaskWithOneArg('t1')) engine = self._make_engine(flow) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 3)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 2)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 3)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 5)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_for_each_with_set(self): collection = set([3, 2, 5]) retry1 = retry.ForEach(collection, 'r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.FailingTaskWithOneArg('t1')) engine = self._make_engine(flow) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 2)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 3)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 5)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertItemsEqual(capturer.values, expected) def test_nested_for_each_revert(self): collection = [3, 2, 3, 5] retry1 = retry.ForEach(collection, 'r1', provides='x') flow = lf.Flow('flow-1').add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry1).add( utils.FailingTaskWithOneArg('task2') ) ) engine = self._make_engine(flow) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 2)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 5)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_nested_for_each_revert_all(self): collection = [3, 2, 3, 5] retry1 = retry.ForEach(collection, 'r1', provides='x', revert_all=True) flow = lf.Flow('flow-1').add( utils.ProgressingTask("task1"), lf.Flow('flow-2', retry1).add( utils.FailingTaskWithOneArg('task2') ) ) engine = self._make_engine(flow) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 2)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r RETRYING', 'task2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot with 5)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_for_each_empty_collection(self): values = [] retry1 = retry.ForEach(values, 'r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.ConditionalTask('t1')) engine = self._make_engine(flow) engine.storage.inject({'y': 1}) self.assertRaisesRegex(exc.NotFound, '^No elements left', engine.run) def test_parameterized_for_each_with_list(self): values = [3, 2, 5] retry1 = retry.ParameterizedForEach('r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.FailingTaskWithOneArg('t1')) engine = self._make_engine(flow) engine.storage.inject({'values': values, 'y': 1}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 3)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 2)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 5)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_parameterized_for_each_with_set(self): values = ([3, 2, 5]) retry1 = retry.ParameterizedForEach('r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.FailingTaskWithOneArg('t1')) engine = self._make_engine(flow) engine.storage.inject({'values': values, 'y': 1}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 3)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 2)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r RETRYING', 't1.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 't1.t RUNNING', 't1.t FAILURE(Failure: RuntimeError: Woot with 5)', 't1.t REVERTING', 't1.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertItemsEqual(capturer.values, expected) def test_nested_parameterized_for_each_revert(self): values = [3, 2, 5] retry1 = retry.ParameterizedForEach('r1', provides='x') flow = lf.Flow('flow-1').add( utils.ProgressingTask('task-1'), lf.Flow('flow-2', retry1).add( utils.FailingTaskWithOneArg('task-2') ) ) engine = self._make_engine(flow) engine.storage.inject({'values': values, 'y': 1}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'task-1.t RUNNING', 'task-1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r RETRYING', 'task-2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 2)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r RETRYING', 'task-2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 5)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_nested_parameterized_for_each_revert_all(self): values = [3, 2, 5] retry1 = retry.ParameterizedForEach('r1', provides='x', revert_all=True) flow = lf.Flow('flow-1').add( utils.ProgressingTask('task-1'), lf.Flow('flow-2', retry1).add( utils.FailingTaskWithOneArg('task-2') ) ) engine = self._make_engine(flow) engine.storage.inject({'values': values, 'y': 1}) with utils.CaptureListener(engine) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['flow-1.f RUNNING', 'task-1.t RUNNING', 'task-1.t SUCCESS(5)', 'r1.r RUNNING', 'r1.r SUCCESS(3)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 3)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r RETRYING', 'task-2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(2)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 2)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r RETRYING', 'task-2.t PENDING', 'r1.r RUNNING', 'r1.r SUCCESS(5)', 'task-2.t RUNNING', 'task-2.t FAILURE(Failure: RuntimeError: Woot with 5)', 'task-2.t REVERTING', 'task-2.t REVERTED(None)', 'r1.r REVERTING', 'r1.r REVERTED(None)', 'task-1.t REVERTING', 'task-1.t REVERTED(None)', 'flow-1.f REVERTED'] self.assertEqual(expected, capturer.values) def test_parameterized_for_each_empty_collection(self): values = [] retry1 = retry.ParameterizedForEach('r1', provides='x') flow = lf.Flow('flow-1', retry1).add(utils.ConditionalTask('t1')) engine = self._make_engine(flow) engine.storage.inject({'values': values, 'y': 1}) self.assertRaisesRegex(exc.NotFound, '^No elements left', engine.run) def _pretend_to_run_a_flow_and_crash(self, when): flow = uf.Flow('flow-1', retry.Times(3, provides='x')).add( utils.ProgressingTask('task1')) engine = self._make_engine(flow) engine.compile() engine.prepare() # imagine we run engine engine.storage.set_flow_state(st.RUNNING) engine.storage.set_atom_intention('flow-1_retry', st.EXECUTE) engine.storage.set_atom_intention('task1', st.EXECUTE) # we execute retry engine.storage.save('flow-1_retry', 1) # task fails fail = failure.Failure.from_exception(RuntimeError('foo')) engine.storage.save('task1', fail, state=st.FAILURE) if when == 'task fails': return engine # we save it's failure to retry and ask what to do engine.storage.save_retry_failure('flow-1_retry', 'task1', fail) if when == 'retry queried': return engine # it returned 'RETRY', so we update it's intention engine.storage.set_atom_intention('flow-1_retry', st.RETRY) if when == 'retry updated': return engine # we set task1 intention to REVERT engine.storage.set_atom_intention('task1', st.REVERT) if when == 'task updated': return engine # we schedule task1 for reversion engine.storage.set_atom_state('task1', st.REVERTING) if when == 'revert scheduled': return engine raise ValueError('Invalid crash point: %s' % when) def test_resumption_on_crash_after_task_failure(self): engine = self._pretend_to_run_a_flow_and_crash('task fails') with utils.CaptureListener(engine) as capturer: engine.run() expected = ['task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1_retry.r RETRYING', 'task1.t PENDING', 'flow-1_retry.r RUNNING', 'flow-1_retry.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_resumption_on_crash_after_retry_queried(self): engine = self._pretend_to_run_a_flow_and_crash('retry queried') with utils.CaptureListener(engine) as capturer: engine.run() expected = ['task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1_retry.r RETRYING', 'task1.t PENDING', 'flow-1_retry.r RUNNING', 'flow-1_retry.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_resumption_on_crash_after_retry_updated(self): engine = self._pretend_to_run_a_flow_and_crash('retry updated') with utils.CaptureListener(engine) as capturer: engine.run() expected = ['task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1_retry.r RETRYING', 'task1.t PENDING', 'flow-1_retry.r RUNNING', 'flow-1_retry.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_resumption_on_crash_after_task_updated(self): engine = self._pretend_to_run_a_flow_and_crash('task updated') with utils.CaptureListener(engine) as capturer: engine.run() expected = ['task1.t REVERTING', 'task1.t REVERTED(None)', 'flow-1_retry.r RETRYING', 'task1.t PENDING', 'flow-1_retry.r RUNNING', 'flow-1_retry.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_resumption_on_crash_after_revert_scheduled(self): engine = self._pretend_to_run_a_flow_and_crash('revert scheduled') with utils.CaptureListener(engine) as capturer: engine.run() expected = ['task1.t REVERTED(None)', 'flow-1_retry.r RETRYING', 'task1.t PENDING', 'flow-1_retry.r RUNNING', 'flow-1_retry.r SUCCESS(2)', 'task1.t RUNNING', 'task1.t SUCCESS(5)', 'flow-1.f SUCCESS'] self.assertEqual(expected, capturer.values) def test_retry_fails(self): r = FailingRetry() flow = lf.Flow('testflow', r) engine = self._make_engine(flow) self.assertRaisesRegex(ValueError, '^OMG', engine.run) self.assertEqual(1, len(engine.storage.get_retry_histories())) self.assertEqual(0, len(r.history)) self.assertEqual([], list(r.history.outcomes_iter())) self.assertIsNotNone(r.history.failure) self.assertTrue(r.history.caused_by(ValueError, include_retry=True)) def test_retry_revert_fails(self): r = NastyFailingRetry() flow = lf.Flow('testflow', r) engine = self._make_engine(flow) self.assertRaisesRegex(ValueError, '^WOOT', engine.run) def test_nested_provides_graph_reverts_correctly(self): flow = gf.Flow("test").add( utils.ProgressingTask('a', requires=['x']), lf.Flow("test2", retry=retry.Times(2)).add( utils.ProgressingTask('b', provides='x'), utils.FailingTask('c'))) engine = self._make_engine(flow) engine.compile() engine.prepare() engine.storage.save('test2_retry', 1) engine.storage.save('b', 11) engine.storage.save('a', 10) with utils.CaptureListener(engine, capture_flow=False) as capturer: self.assertRaisesRegex(RuntimeError, '^Woot', engine.run) expected = ['c.t RUNNING', 'c.t FAILURE(Failure: RuntimeError: Woot!)', 'a.t REVERTING', 'c.t REVERTING', 'a.t REVERTED(None)', 'c.t REVERTED(None)', 'b.t REVERTING', 'b.t REVERTED(None)'] self.assertItemsEqual(capturer.values[:8], expected) # Task 'a' was or was not executed again, both cases are ok. self.assertIsSuperAndSubsequence(capturer.values[8:], [ 'b.t RUNNING', 'c.t FAILURE(Failure: RuntimeError: Woot!)', 'b.t REVERTED(None)', ]) self.assertEqual(st.REVERTED, engine.storage.get_flow_state()) def test_nested_provides_graph_retried_correctly(self): flow = gf.Flow("test").add( utils.ProgressingTask('a', requires=['x']), lf.Flow("test2", retry=retry.Times(2)).add( utils.ProgressingTask('b', provides='x'), utils.ProgressingTask('c'))) engine = self._make_engine(flow) engine.compile() engine.prepare() engine.storage.save('test2_retry', 1) engine.storage.save('b', 11) # pretend that 'c' failed fail = failure.Failure.from_exception(RuntimeError('Woot!')) engine.storage.save('c', fail, st.FAILURE) with utils.CaptureListener(engine, capture_flow=False) as capturer: engine.run() expected = ['c.t REVERTING', 'c.t REVERTED(None)', 'b.t REVERTING', 'b.t REVERTED(None)'] self.assertItemsEqual(capturer.values[:4], expected) expected = ['test2_retry.r RETRYING', 'b.t PENDING', 'c.t PENDING', 'test2_retry.r RUNNING', 'test2_retry.r SUCCESS(2)', 'b.t RUNNING', 'b.t SUCCESS(5)', 'a.t RUNNING', 'c.t RUNNING', 'a.t SUCCESS(5)', 'c.t SUCCESS(5)'] self.assertItemsEqual(expected, capturer.values[4:]) self.assertEqual(st.SUCCESS, engine.storage.get_flow_state()) class RetryParallelExecutionTest(utils.EngineTestBase): # FIXME(harlowja): fix this class so that it doesn't use events or uses # them in a way that works with more executors... def test_when_subflow_fails_revert_running_tasks(self): waiting_task = utils.WaitForOneFromTask('task1', 'task2', [st.SUCCESS, st.FAILURE]) flow = uf.Flow('flow-1', retry.Times(3, 'r', provides='x')).add( waiting_task, utils.ConditionalTask('task2') ) engine = self._make_engine(flow) engine.atom_notifier.register('*', waiting_task.callback) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine, capture_flow=False) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2}, engine.storage.fetch_all()) expected = ['r.r RUNNING', 'r.r SUCCESS(1)', 'task1.t RUNNING', 'task2.t RUNNING', 'task2.t FAILURE(Failure: RuntimeError: Woot!)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'task1.t SUCCESS(5)', 'task1.t REVERTING', 'task1.t REVERTED(None)', 'r.r RETRYING', 'task1.t PENDING', 'task2.t PENDING', 'r.r RUNNING', 'r.r SUCCESS(2)', 'task1.t RUNNING', 'task2.t RUNNING', 'task2.t SUCCESS(None)', 'task1.t SUCCESS(5)'] self.assertItemsEqual(capturer.values, expected) def test_when_subflow_fails_revert_success_tasks(self): waiting_task = utils.WaitForOneFromTask('task2', 'task1', [st.SUCCESS, st.FAILURE]) flow = uf.Flow('flow-1', retry.Times(3, 'r', provides='x')).add( utils.ProgressingTask('task1'), lf.Flow('flow-2').add( waiting_task, utils.ConditionalTask('task3')) ) engine = self._make_engine(flow) engine.atom_notifier.register('*', waiting_task.callback) engine.storage.inject({'y': 2}) with utils.CaptureListener(engine, capture_flow=False) as capturer: engine.run() self.assertEqual({'y': 2, 'x': 2}, engine.storage.fetch_all()) expected = ['r.r RUNNING', 'r.r SUCCESS(1)', 'task1.t RUNNING', 'task2.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t SUCCESS(5)', 'task3.t RUNNING', 'task3.t FAILURE(Failure: RuntimeError: Woot!)', 'task3.t REVERTING', 'task1.t REVERTING', 'task3.t REVERTED(None)', 'task1.t REVERTED(None)', 'task2.t REVERTING', 'task2.t REVERTED(None)', 'r.r RETRYING', 'task1.t PENDING', 'task2.t PENDING', 'task3.t PENDING', 'r.r RUNNING', 'r.r SUCCESS(2)', 'task1.t RUNNING', 'task2.t RUNNING', 'task1.t SUCCESS(5)', 'task2.t SUCCESS(5)', 'task3.t RUNNING', 'task3.t SUCCESS(None)'] self.assertItemsEqual(capturer.values, expected) class SerialEngineTest(RetryTest, test.TestCase): def _make_engine(self, flow, defer_reverts=None, flow_detail=None): return taskflow.engines.load(flow, flow_detail=flow_detail, engine='serial', backend=self.backend, defer_reverts=defer_reverts) class ParallelEngineWithThreadsTest(RetryTest, RetryParallelExecutionTest, test.TestCase): _EXECUTOR_WORKERS = 2 def _make_engine(self, flow, defer_reverts=None, flow_detail=None, executor=None): if executor is None: executor = 'threads' return taskflow.engines.load(flow, flow_detail=flow_detail, engine='parallel', backend=self.backend, executor=executor, max_workers=self._EXECUTOR_WORKERS, defer_reverts=defer_reverts) @testtools.skipIf(not eu.EVENTLET_AVAILABLE, 'eventlet is not available') class ParallelEngineWithEventletTest(RetryTest, test.TestCase): def _make_engine(self, flow, defer_reverts=None, flow_detail=None, executor=None): if executor is None: executor = 'greenthreads' return taskflow.engines.load(flow, flow_detail=flow_detail, backend=self.backend, engine='parallel', executor=executor, defer_reverts=defer_reverts) class ParallelEngineWithProcessTest(RetryTest, test.TestCase): _EXECUTOR_WORKERS = 2 def _make_engine(self, flow, defer_reverts=None, flow_detail=None, executor=None): if executor is None: executor = 'processes' return taskflow.engines.load(flow, flow_detail=flow_detail, engine='parallel', backend=self.backend, executor=executor, max_workers=self._EXECUTOR_WORKERS, defer_reverts=defer_reverts)
{ "content_hash": "9551c4155db032d2e2f4c19f76fe98c7", "timestamp": "", "source": "github", "line_count": 1313, "max_line_length": 79, "avg_line_length": 42.428027418126426, "alnum_prop": 0.4711352049974869, "repo_name": "jimbobhickville/taskflow", "id": "3eb5b2085c34dc0b1ee6c8e0766244d75700dc5f", "size": "56365", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "taskflow/tests/unit/test_retries.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Mako", "bytes": "412" }, { "name": "Python", "bytes": "1650287" }, { "name": "Shell", "bytes": "11250" } ], "symlink_target": "" }
.class Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog; .super Landroid/app/AlertDialog; .source "ClippedDataPickerDialog.java" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Lcom/android/server/sec/ClippedDataPickerDialog; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x0 name = "ClearConfirmDialog" .end annotation # instance fields .field private mContext:Landroid/content/Context; .field private mListener:Landroid/content/DialogInterface$OnClickListener; .field final synthetic this$0:Lcom/android/server/sec/ClippedDataPickerDialog; # direct methods .method public constructor <init>(Lcom/android/server/sec/ClippedDataPickerDialog;Landroid/content/Context;)V .locals 1 .parameter .parameter "context" .prologue .line 229 iput-object p1, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->this$0:Lcom/android/server/sec/ClippedDataPickerDialog; .line 230 const/4 v0, 0x4 invoke-direct {p0, p2, v0}, Landroid/app/AlertDialog;-><init>(Landroid/content/Context;I)V .line 231 iput-object p2, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mContext:Landroid/content/Context; .line 232 return-void .end method .method static synthetic access$400(Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;)Landroid/content/Context; .locals 1 .parameter "x0" .prologue .line 224 iget-object v0, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mContext:Landroid/content/Context; return-object v0 .end method # virtual methods .method protected onCreate(Landroid/os/Bundle;)V .locals 5 .parameter "savedInstanceState" .prologue .line 236 new-instance v2, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog$1; invoke-direct {v2, p0}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog$1;-><init>(Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;)V iput-object v2, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mListener:Landroid/content/DialogInterface$OnClickListener; .line 298 const v2, 0x1040748 invoke-virtual {p0, v2}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->setTitle(I)V .line 299 iget-object v2, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mContext:Landroid/content/Context; const v3, 0x104074e invoke-virtual {v2, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String; move-result-object v2 invoke-virtual {p0, v2}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->setMessage(Ljava/lang/CharSequence;)V .line 301 const/4 v2, -0x1 iget-object v3, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mContext:Landroid/content/Context; const v4, 0x104000a invoke-virtual {v3, v4}, Landroid/content/Context;->getString(I)Ljava/lang/String; move-result-object v3 iget-object v4, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mListener:Landroid/content/DialogInterface$OnClickListener; invoke-virtual {p0, v2, v3, v4}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->setButton(ILjava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V .line 302 const/4 v2, -0x2 iget-object v3, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mContext:Landroid/content/Context; const/high16 v4, 0x104 invoke-virtual {v3, v4}, Landroid/content/Context;->getString(I)Ljava/lang/String; move-result-object v3 iget-object v4, p0, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->mListener:Landroid/content/DialogInterface$OnClickListener; invoke-virtual {p0, v2, v3, v4}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->setButton(ILjava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V .line 304 invoke-virtual {p0}, Lcom/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog;->getWindow()Landroid/view/Window; move-result-object v1 .line 305 .local v1, theWindow:Landroid/view/Window; invoke-virtual {v1}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams; move-result-object v0 .line 306 .local v0, lp:Landroid/view/WindowManager$LayoutParams; const/16 v2, 0x7d8 iput v2, v0, Landroid/view/WindowManager$LayoutParams;->type:I .line 307 invoke-virtual {v1, v0}, Landroid/view/Window;->setAttributes(Landroid/view/WindowManager$LayoutParams;)V .line 309 invoke-super {p0, p1}, Landroid/app/AlertDialog;->onCreate(Landroid/os/Bundle;)V .line 310 return-void .end method
{ "content_hash": "2129d038f4ea575daf1635fd8678c482", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 192, "avg_line_length": 34.41958041958042, "alnum_prop": 0.7673709874034945, "repo_name": "baidurom/devices-n7108", "id": "dd0f0b13e195856cda5dd965b9e95d783b5653e5", "size": "4922", "binary": false, "copies": "2", "ref": "refs/heads/coron-4.1", "path": "vendor/aosp/services.jar.out/smali/com/android/server/sec/ClippedDataPickerDialog$ClearConfirmDialog.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "12697" }, { "name": "Shell", "bytes": "1974" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>coalgebras: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / extra-dev</a></li> <li class="active"><a href="">8.11.dev / coalgebras - 8.9.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> coalgebras <small> 8.9.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2020-08-11 05:14:42 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-11 05:14:42 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.11.dev Formal proof management system num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.08.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.08.1 Official release 4.08.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/coalgebras&quot; license: &quot;LGPL&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Coalgebras&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.9&quot; &amp; &lt; &quot;8.10~&quot;} ] tags: [ &quot;keyword: coalgebra&quot; &quot;keyword: bisimulation&quot; &quot;keyword: weakly final&quot; &quot;keyword: coiteration&quot; &quot;keyword: coinductive&quot; &quot;category: Mathematics/Category Theory&quot; &quot;date: 2008-10&quot; ] authors: [ &quot;Milad Niqui &lt;M.Niqui@cwi.nl&gt; [http://www.cwi.nl/~milad]&quot; ] bug-reports: &quot;https://github.com/coq-contribs/coalgebras/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/coalgebras.git&quot; synopsis: &quot;Coalgebras, bisimulation and lambda-coiteration&quot; description: &quot;&quot;&quot; This contribution contains a formalisation of coalgebras, bisimulation on coalgebras, weakly final coalgebras, lambda-coiteration definition scheme (including primitive corecursion) and a version of lambda-bisimulation. The formalisation is modular. The implementation of the module types for streams and potentially infinite Peano numbers are provided using the coinductive types.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/coalgebras/archive/v8.9.0.tar.gz&quot; checksum: &quot;md5=6e0e5646c3de55b4a707bf05d5622736&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-coalgebras.8.9.0 coq.8.11.dev</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.11.dev). The following dependencies couldn&#39;t be met: - coq-coalgebras -&gt; coq &lt; 8.10~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coalgebras.8.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "e995965c72cbb43f06e87d7d136d7cb9", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 399, "avg_line_length": 42.06896551724138, "alnum_prop": 0.5579234972677596, "repo_name": "coq-bench/coq-bench.github.io", "id": "914f2c5df7bfc7f9c39bd5ac2b191dd86ce57bf9", "size": "7345", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.08.1-2.0.5/extra-dev/8.11.dev/coalgebras/8.9.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; using System.Reflection; namespace FakeThat.Engine { /// <summary> /// Encapsulates a lambda expression that is used to identify a property /// (e.g. an expression like `() => fake.Object.SomeProperty`). /// </summary> public class PropertyLambda<T> { private readonly string propertyName; /// <summary> /// Helper method to allow creating PropertyLambda{T} objects without explicitly specifying T. /// </summary> public static PropertyLambda<T> Create<TRet>(Expression<Func<TRet>> expr) { return new PropertyLambda<T>(expr); } private PropertyLambda(LambdaExpression propertyLookupExpression) { if (propertyLookupExpression.Body.NodeType != ExpressionType.MemberAccess) { throw new Exception(@"Expected an expression of the form ""o => o.[some property]"" for the second argument."); } // get the "[closure object].o.[some property]" part (i.e. drop the "() =>") var expression = (MemberExpression)propertyLookupExpression.Body; propertyName = expression.Member.Name; } /// <summary> /// Gets the MethodInfo for this property's getter. /// </summary> public MethodInfo Getter { get { return typeof(T).GetMethod("get_" + propertyName); } } /// <summary> /// Gets the MethodInfo for this property's setter. /// </summary> public MethodInfo Setter { get { return typeof(T).GetMethod("set_" + propertyName); } } } }
{ "content_hash": "23cdde892d407dd3ef10ef446f502df8", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 127, "avg_line_length": 32.68518518518518, "alnum_prop": 0.5994334277620397, "repo_name": "eteeselink/fakethat", "id": "78ff065ce5e984ac2f72d59078acc6c85b224f8e", "size": "1767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FakeThat/Engine/PropertyLambda.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "95702" }, { "name": "Shell", "bytes": "217" } ], "symlink_target": "" }
{% extends "base.html" %} {% block title %}FlaskApp - Confirm your accont{% endblock %} {% block page_content %} <div class="page-header"> <h1> Hello, {{ current_user.username }}! </h1> <h3>You have not confirmed your account yet.</h3> <p> Before you can access this site you need to confirm your account. Check your inbox, you should have received an email with a confirmation link. </p> <p> Need another confirmation email? <a href="{{ url_for('auth.resend_confirmation') }}">Click here</a> </p> </div> {% endblock %}
{ "content_hash": "de75fed2dcb77cd07aadb74eeba94626", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 85, "avg_line_length": 29.5, "alnum_prop": 0.6084745762711864, "repo_name": "jykntr/flaskapp", "id": "a06270bd35963f25dd06e4f1ce146d2a7b3136ed", "size": "590", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/templates/auth/unconfirmed.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "12787" }, { "name": "Mako", "bytes": "412" }, { "name": "Python", "bytes": "40989" } ], "symlink_target": "" }
<VerticalLayout captionMargin="0" margin="true" width="100%" height="100%" spacing="true"> <ValidationSettings withApply="true" withAttach="true" withPrint="true" /> <GuiTable title="TRANSACTION CONFIGURATION" name="WF_ASSIGNEMENT" dataPath="DATAROOT" inLineEditable="true" addEnabled="false" deleteEnabled="false" openEnabled="true" pageLength="10"> <OpenForm containerWindow="same window" /> <TableColumn name="_LINE_NUMBER" caption="#" width="50px" /> <TableColumn name="TRANSACTION" caption="Transaction" editable="true" width="100px" /> <TableColumn name="TRANS_TITLE_PREFIX" caption="Title When Proposal" editable="true" width="100px" /> <TableColumn name="TRANS_TITLE" caption="Title After Approve" editable="true" width="100px" /> <TableColumn name="LEAVE_CODE_EMPTY" caption="Code Empty" editable="true" width="100px" /> <TableColumn name="CODE_PREFIX_TRANSACTION_PREFIX" caption="Prefix" editable="true" width="100px" /> <TableColumn name="CODE_PREFIX_PROPOSAL" caption="Proposal Prefix" editable="true" width="100px" /> <TableColumn name="CODE_PREFIX_NUMBER_OF_DIGITS" caption="Code Digits (max 6)" editable="true" width="100px" /> <TableColumn name="CODE_PREFIX_USE_SITE_PREFIX" caption="Use Site Prefix" editable="true" width="100px" /> <TableColumn name="APPROVAL_METHOD" caption="Approval Method" editable="true" width="100px" /> <TableColumn name="MAP" caption="Map" captionProperty="NAME" captionProperty2="DESCRIP" editable="true" width="100px" usePopupView="true" /> <TableColumn name="WF_AREA" caption="Area" captionProperty="NAME" editable="true" width="100px" usePopupView="true" /> <TableColumn name="PROMPT_APPROVE_UPON_VALID" caption="Prompt for Aprv. Upon Save" editable="true" width="100px" /> <TableColumn name="INCLUDE_PROJECT_CODE" caption="Include Project Code" editable="true" width="100px" /> <TableColumn name="CODE_BY_SITE" caption="Code By Site" editable="true" width="-1px" /> <TableColumn name="FORBID_ANCESTOR_ACCESS" caption="Forbid Ancestor Site Access" editable="true" width="-1px" /> </GuiTable> </VerticalLayout>
{ "content_hash": "538848438a7b3673d87505a14aae4535", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 186, "avg_line_length": 93.69565217391305, "alnum_prop": 0.7183294663573085, "repo_name": "FOC-framework/framework", "id": "917de757924e74f705303d69a1e1795b14a9daea", "size": "2155", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "focWebServer/src/com/foc/web/modules/workflow/gui/WF_ASSIGNEMENT^Table.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "99" }, { "name": "Java", "bytes": "9889245" }, { "name": "SCSS", "bytes": "77175" } ], "symlink_target": "" }
ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) # Base path used to install. DESTDIR=/usr/local # Used to populate version variable in main package. VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) PROJECT_ROOT=github.com/vdemeester/docker-volume-ipfs # Race detector is only supported on amd64. RACE := $(shell test $$(go env GOARCH) != "amd64" || (echo "-race")) # Project packages. PACKAGES=$(shell go list ./... | grep -v /vendor/) INTEGRATION_PACKAGE=${PROJECT_ROOT}/integration # Project binaries. COMMANDS=docker-volume-ipfs BINARIES=$(addprefix bin/,$(COMMANDS)) GO_LDFLAGS=-ldflags "-X `go list ./version`.Version=$(VERSION)" .PHONY: clean all fmt vet lint build binaries test integration setup coverage ci check help install uninstall .DEFAULT: default all: check binaries test integration ## run fmt, vet, lint, build the binaries and run the tests check: fmt vet lint ineffassign ## run fmt, vet, lint, ineffassign ci: check binaries coverage coverage-integration ## to be used by the CI setup: ## install dependencies @echo "🐳 $@" @go get -u github.com/golang/lint/golint @go get -u github.com/golang/mock/mockgen @go get -u github.com/gordonklaus/ineffassign # Depends on binaries because vet will silently fail if it can't load compiled # imports vet: binaries ## run go vet @echo "🐳 $@" @test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)" fmt: ## run go fmt @echo "🐳 $@" @test -z "$$(gofmt -s -l . | grep -v vendor/ | tee /dev/stderr)" || \ (echo "👹 please format Go code with 'gofmt -s -w'" && false) lint: ## run go lint @echo "🐳 $@" @test -z "$$(golint ./... | grep -v vendor/ | tee /dev/stderr)" ineffassign: ## run ineffassign @echo "🐳 $@" @test -z "$$(ineffassign . | grep -v vendor/ | tee /dev/stderr)" build: ## build the go packages @echo "🐳 $@" @go build -i -tags "${BUILDTAGS}" -v ${GO_LDFLAGS} ${GO_GCFLAGS} ${PACKAGES} test: ## run tests, except integration tests @echo "🐳 $@" @go test -parallel 8 ${RACE} -tags "${BUILDTAGS}" $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}) integration: ## run integration tests @echo "🐳 $@" @go test -parallel 8 ${RACE} -tags "${BUILDTAGS}" ${INTEGRATION_PACKAGE} FORCE: # Build a binary from a cmd. bin/%: cmd/% FORCE @test $$(go list) = "${PROJECT_ROOT}" || \ (echo "👹 Please correctly set up your Go build environment. This project must be located at <GOPATH>/src/${PROJECT_ROOT}" && false) @echo "🐳 $@" @go build -i -tags "${BUILDTAGS}" -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./$< binaries: $(BINARIES) ## build binaries @echo "🐳 $@" clean: ## clean up binaries @echo "🐳 $@" @rm -f $(BINARIES) coverage: ## generate coverprofiles from the unit tests @echo "🐳 $@" @for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \ go test ${RACE} -tags "${BUILDTAGS}" -test.short -coverprofile="../../../$$pkg/coverage.txt" $${pkg} || exit 1; \ done coverage-integration: ## generate coverprofiles from the integration tests @echo "🐳 $@" go test ${RACE} -tags "${BUILDTAGS}" -test.short -coverprofile="../../../${INTEGRATION_PACKAGE}/coverage.txt" -covermode=atomic ${INTEGRATION_PACKAGE} help: ## this help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort install: $(BINARIES) ## install binaries @echo "🐳 $@" @mkdir -p $(DESTDIR)/bin @install $(BINARIES) $(DESTDIR)/bin uninstall: @echo "🐳 $@" @rm -f $(addprefix $(DESTDIR)/bin/,$(notdir $(BINARIES))) # This only needs to be generated by hand when cutting full releases. version/version.go: ./version/version.sh > $@
{ "content_hash": "817b9b7e3fae70b503e7886b54e8f8b1", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 180, "avg_line_length": 33.95454545454545, "alnum_prop": 0.6548862115127175, "repo_name": "vdemeester/docker-volume-ipfs", "id": "21217afcad1eb0ef8059eb35f8836bf7bebb920b", "size": "3835", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "6571" }, { "name": "Makefile", "bytes": "3835" }, { "name": "Nix", "bytes": "652" }, { "name": "Shell", "bytes": "815" } ], "symlink_target": "" }
using Lucene.Net.Support; using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace Lucene.Net.Util { /// <summary> /// Represents <see cref="T:char[]"/>, as a slice (offset + Length) into an existing <see cref="T:char[]"/>. /// The <see cref="Chars"/> property should never be <c>null</c>; use /// <see cref="EMPTY_CHARS"/> if necessary. /// <para/> /// @lucene.internal /// </summary> #if FEATURE_SERIALIZABLE [Serializable] #endif public sealed class CharsRef : IComparable<CharsRef>, ICharSequence #if FEATURE_CLONEABLE , System.ICloneable #endif { /// <summary> /// An empty character array for convenience </summary> public static readonly char[] EMPTY_CHARS = new char[0]; /// <summary> /// The contents of the <see cref="CharsRef"/>. Should never be <c>null</c>. /// </summary> [WritableArray] [SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")] public char[] Chars { get { return chars; } set { if (value == null) { throw new ArgumentNullException("Chars cannot be null"); } chars = value; } } private char[] chars; /// <summary> /// Offset of first valid character. </summary> public int Offset { get; internal set; } /// <summary> /// Length of used characters. </summary> public int Length { get; set; } /// <summary> /// Creates a new <see cref="CharsRef"/> initialized an empty array zero-Length /// </summary> public CharsRef() : this(EMPTY_CHARS, 0, 0) { } /// <summary> /// Creates a new <see cref="CharsRef"/> initialized with an array of the given /// <paramref name="capacity"/>. /// </summary> public CharsRef(int capacity) { chars = new char[capacity]; } /// <summary> /// Creates a new <see cref="CharsRef"/> initialized with the given <paramref name="chars"/>, /// <paramref name="offset"/> and <paramref name="length"/>. /// </summary> public CharsRef(char[] chars, int offset, int length) { this.chars = chars; this.Offset = offset; this.Length = length; Debug.Assert(IsValid()); } /// <summary> /// Creates a new <see cref="CharsRef"/> initialized with the given <see cref="string"/> character /// array. /// </summary> public CharsRef(string @string) { this.chars = @string.ToCharArray(); this.Offset = 0; this.Length = chars.Length; } /// <summary> /// Returns a shallow clone of this instance (the underlying characters are /// <b>not</b> copied and will be shared by both the returned object and this /// object. /// </summary> /// <seealso cref="DeepCopyOf(CharsRef)"/> public object Clone() { return new CharsRef(chars, Offset, Length); } public override int GetHashCode() { const int prime = 31; int result = 0; int end = Offset + Length; for (int i = Offset; i < end; i++) { result = prime * result + chars[i]; } return result; } public override bool Equals(object other) { if (other == null) { return false; } if (other is CharsRef) { return this.CharsEquals(((CharsRef)other)); } return false; } public bool CharsEquals(CharsRef other) { if (Length == other.Length) { int otherUpto = other.Offset; char[] otherChars = other.chars; int end = Offset + Length; for (int upto = Offset; upto < end; upto++, otherUpto++) { if (chars[upto] != otherChars[otherUpto]) { return false; } } return true; } else { return false; } } /// <summary> /// Signed <see cref="int"/> order comparison </summary> public int CompareTo(CharsRef other) { if (this == other) { return 0; } char[] aChars = this.chars; int aUpto = this.Offset; char[] bChars = other.chars; int bUpto = other.Offset; int aStop = aUpto + Math.Min(this.Length, other.Length); while (aUpto < aStop) { int aInt = aChars[aUpto++]; int bInt = bChars[bUpto++]; if (aInt > bInt) { return 1; } else if (aInt < bInt) { return -1; } } // One is a prefix of the other, or, they are equal: return this.Length - other.Length; } /// <summary> /// Copies the given <see cref="CharsRef"/> referenced content into this instance. /// </summary> /// <param name="other"> /// The <see cref="CharsRef"/> to copy. </param> public void CopyChars(CharsRef other) { CopyChars(other.chars, other.Offset, other.Length); } /// <summary> /// Used to grow the reference array. /// <para/> /// In general this should not be used as it does not take the offset into account. /// <para/> /// @lucene.internal /// </summary> public void Grow(int newLength) { Debug.Assert(Offset == 0); if (chars.Length < newLength) { chars = ArrayUtil.Grow(chars, newLength); } } /// <summary> /// Copies the given array into this <see cref="CharsRef"/>. /// </summary> public void CopyChars(char[] otherChars, int otherOffset, int otherLength) { if (Chars.Length - Offset < otherLength) { chars = new char[otherLength]; Offset = 0; } Array.Copy(otherChars, otherOffset, chars, Offset, otherLength); Length = otherLength; } /// <summary> /// Appends the given array to this <see cref="CharsRef"/>. /// </summary> public void Append(char[] otherChars, int otherOffset, int otherLength) { int newLen = Length + otherLength; if (chars.Length - Offset < newLen) { var newChars = new char[newLen]; Array.Copy(chars, Offset, newChars, 0, Length); Offset = 0; chars = newChars; } Array.Copy(otherChars, otherOffset, chars, Length + Offset, otherLength); Length = newLen; } public override string ToString() { return new string(chars, Offset, Length); } // LUCENENET NOTE: Length field made into property already //public char CharAt(int index) //{ // // NOTE: must do a real check here to meet the specs of CharSequence // if (index < 0 || index >= Length) // { // throw new System.IndexOutOfRangeException(); // } // return Chars[Offset + index]; //} // LUCENENET specific - added to .NETify public char this[int index] { get { // NOTE: must do a real check here to meet the specs of CharSequence if (index < 0 || index >= Length) { throw new IndexOutOfRangeException(); } return chars[Offset + index]; } } public ICharSequence SubSequence(int start, int end) { // NOTE: must do a real check here to meet the specs of CharSequence if (start < 0 || end > Length || start > end) { throw new System.IndexOutOfRangeException(); } return new CharsRef(chars, Offset + start, end - start); } /// @deprecated this comparer is only a transition mechanism [Obsolete("this comparer is only a transition mechanism")] private static readonly IComparer<CharsRef> utf16SortedAsUTF8SortOrder = new Utf16SortedAsUTF8Comparer(); /// @deprecated this comparer is only a transition mechanism [Obsolete("this comparer is only a transition mechanism")] public static IComparer<CharsRef> UTF16SortedAsUTF8Comparer { get { return utf16SortedAsUTF8SortOrder; } } /// @deprecated this comparer is only a transition mechanism [Obsolete("this comparer is only a transition mechanism")] private class Utf16SortedAsUTF8Comparer : IComparer<CharsRef> { // Only singleton internal Utf16SortedAsUTF8Comparer() { } public virtual int Compare(CharsRef a, CharsRef b) { if (a == b) { return 0; } char[] aChars = a.Chars; int aUpto = a.Offset; char[] bChars = b.Chars; int bUpto = b.Offset; int aStop = aUpto + Math.Min(a.Length, b.Length); while (aUpto < aStop) { char aChar = aChars[aUpto++]; char bChar = bChars[bUpto++]; if (aChar != bChar) { // http://icu-project.org/docs/papers/utf16_code_point_order.html /* aChar != bChar, fix up each one if they're both in or above the surrogate range, then compare them */ if (aChar >= 0xd800 && bChar >= 0xd800) {//LUCENE TO-DO possible truncation or is char 16bit? if (aChar >= 0xe000) { aChar -= (char)0x800; } else { aChar += (char)0x2000; } if (bChar >= 0xe000) { bChar -= (char)0x800; } else { bChar += (char)0x2000; } } /* now aChar and bChar are in code point order */ return (int)aChar - (int)bChar; // int must be 32 bits wide } } // One is a prefix of the other, or, they are equal: return a.Length - b.Length; } } /// <summary> /// Creates a new <see cref="CharsRef"/> that points to a copy of the chars from /// <paramref name="other"/>. /// <para/> /// The returned <see cref="CharsRef"/> will have a Length of <c>other.Length</c> /// and an offset of zero. /// </summary> public static CharsRef DeepCopyOf(CharsRef other) { CharsRef clone = new CharsRef(); clone.CopyChars(other); return clone; } /// <summary> /// Performs internal consistency checks. /// Always returns true (or throws <see cref="InvalidOperationException"/>) /// </summary> public bool IsValid() { if (Chars == null) { throw new InvalidOperationException("chars is null"); } if (Length < 0) { throw new InvalidOperationException("Length is negative: " + Length); } if (Length > Chars.Length) { throw new InvalidOperationException("Length is out of bounds: " + Length + ",chars.Length=" + Chars.Length); } if (Offset < 0) { throw new InvalidOperationException("offset is negative: " + Offset); } if (Offset > Chars.Length) { throw new InvalidOperationException("offset out of bounds: " + Offset + ",chars.Length=" + Chars.Length); } if (Offset + Length < 0) { throw new InvalidOperationException("offset+Length is negative: offset=" + Offset + ",Length=" + Length); } if (Offset + Length > Chars.Length) { throw new InvalidOperationException("offset+Length out of bounds: offset=" + Offset + ",Length=" + Length + ",chars.Length=" + Chars.Length); } return true; } } }
{ "content_hash": "644b1ed843671f7740e4673f1ccc813e", "timestamp": "", "source": "github", "line_count": 416, "max_line_length": 157, "avg_line_length": 32.875, "alnum_prop": 0.4708979233694063, "repo_name": "laimis/lucenenet", "id": "b47cb0b93878f75a3340c9b5de8012d63cf8130f", "size": "14537", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Lucene.Net/Util/CharsRef.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4805" }, { "name": "C#", "bytes": "41089688" }, { "name": "Gnuplot", "bytes": "2444" }, { "name": "HTML", "bytes": "79746" }, { "name": "PowerShell", "bytes": "73932" }, { "name": "XSLT", "bytes": "21773" } ], "symlink_target": "" }
FROM balenalib/armv7hf-debian:sid-run LABEL io.balena.device-type="artik533s" RUN apt-get update && apt-get install -y --no-install-recommends \ less \ kmod \ nano \ net-tools \ ifupdown \ iputils-ping \ i2c-tools \ usbutils \ && rm -rf /var/lib/apt/lists/* RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Sid \nVariant: run variant \nDefault variable(s): UDEV=off \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "c4f83593222559d43fc251f3c04ee53b", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 608, "avg_line_length": 54.1, "alnum_prop": 0.7005545286506469, "repo_name": "nghiant2710/base-images", "id": "72488f645519d1b05ed99f6f32963477cfd6fe88", "size": "1082", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "balena-base-images/device-base/artik533s/debian/sid/run/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
var app = require('../'); var Definition = app.models.Definition; var TestDataBuilder = require('./helpers/test-data-builder'); describe('Definition', function() { });
{ "content_hash": "c32c00a5b24a18b4614d5e2a47cdc4f1", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 61, "avg_line_length": 24.285714285714285, "alnum_prop": 0.6941176470588235, "repo_name": "tsiry95/openshift-strongloop-cartridge", "id": "c5d2f34947edb0595ce850203fbd1dafccee157f", "size": "374", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "strongloop/node_modules/loopback-workspace/test/definition.js", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2028852" }, { "name": "C++", "bytes": "569460" }, { "name": "Groff", "bytes": "4748" }, { "name": "HTML", "bytes": "690" }, { "name": "JavaScript", "bytes": "25268" }, { "name": "Shell", "bytes": "13019" } ], "symlink_target": "" }
classdef substrTest < TestCase methods function this = substrTest(methodName) this = this@TestCase(methodName); end function testEmptyString(~) s = ''; assertEqual(s(1:0), substr('', 1, 0)); assertExceptionThrown(@() substr('', 1, 1), 'MATLAB:badsubscript'); assertExceptionThrown(@() substr('', 0, 0), 'MATLAB:badsubscript'); end function testWholeString(~) assertEqual('abc', substr('abc', 1, 0)); end function testPartOfString(~) assertEqual('bc', substr('abcd', 2, 3)); end function testPartOfStringFromEnd(~) assertEqual('bc', substr('abcd', 2, -1)); end end end function result = substr(s, i, j) result = edu.stanford.covert.util.substr(s, i, j); end
{ "content_hash": "d2e1924ea588f885ce5ebb12e9e16ff4", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 79, "avg_line_length": 30.533333333333335, "alnum_prop": 0.509825327510917, "repo_name": "navoj/WholeCell", "id": "3bfe35ae0e9f87a00796ea053e7a83bd67c809fd", "size": "916", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src_test/+edu/+stanford/+covert/+util/substrTest.m", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "119" }, { "name": "C++", "bytes": "29642" }, { "name": "CSS", "bytes": "1188" }, { "name": "Groff", "bytes": "20084" }, { "name": "HTML", "bytes": "30940" }, { "name": "Java", "bytes": "468" }, { "name": "Matlab", "bytes": "7263047" }, { "name": "PHP", "bytes": "8286" }, { "name": "Perl", "bytes": "90917" }, { "name": "Shell", "bytes": "21004" }, { "name": "Smarty", "bytes": "11083" } ], "symlink_target": "" }
namespace blink { class ExecutionContext; // FetchFormDataConsumerHandle is a handle made from an EncodedFormData. It // provides drainAsFormData in the associated Reader. class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsumerHandle { WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle); public: static PassOwnPtr<FetchDataConsumerHandle> create(const String& body); static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBuffer* body); static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBufferView* body); static PassOwnPtr<FetchDataConsumerHandle> create(const void* data, size_t); static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<EncodedFormData> body); // Use FetchBlobDataConsumerHandle for blobs. ~FetchFormDataConsumerHandle() override; static PassOwnPtr<FetchDataConsumerHandle> createForTest( ExecutionContext*, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory*); private: class Context; class SimpleContext; class ComplexContext; class ReaderImpl; explicit FetchFormDataConsumerHandle(const String& body); FetchFormDataConsumerHandle(const void*, size_t); FetchFormDataConsumerHandle(ExecutionContext*, const PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory* = nullptr); Reader* obtainReaderInternal(Client*) override; const char* debugName() const override { return "FetchFormDataConsumerHandle"; } RefPtr<Context> m_context; }; } // namespace blink #endif // FetchFormDataConsumerHandle_h
{ "content_hash": "05c6d772228716a183a1415a677d217b", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 146, "avg_line_length": 38, "alnum_prop": 0.7851897184822522, "repo_name": "wuhengzhi/chromium-crosswalk", "id": "ab25ff88bd32c094ca1a00a158067270e7275622", "size": "2322", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package com.pzybrick.iote2e.stream.email; import java.io.IOException; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * The Class Email. */ public class Email { /** The Constant logger. */ private static final Logger logger = LogManager.getLogger(Email.class); /* * CRITICAL: to use SMTP w/ gmail, you have to allow less secure apps - https://myaccount.google.com/lesssecureapps */ /** * Send email bdbb. * * @param mailUser the mail user * @param mailPassword the mail password * @param from the from * @param to the to * @param salutation the salutation * @param exceededSummary the exceeded summary * @throws Exception the exception */ public static void sendEmailBdbb( String mailUser, String mailPassword, String from, String to, String salutation, String exceededSummary ) throws Exception { String content = String.format( "<html><body><b>Hello %s</b><br>Engine Metric Exceeded: %s<br>" + "Launch the <a href=\"#\">Engine Dashboard</a><br>" + "Regards,<br>Big Data Black Box" + "</body></html>", salutation, exceededSummary); String subject = String.format("Engine Metric Exceeded: %s", exceededSummary); sendEmail( mailUser, mailPassword, from, to, salutation, subject, content ); } /** * Send email omh. * * @param mailUser the mail user * @param mailPassword the mail password * @param from the from * @param to the to * @param salutation the salutation * @param exceededSummary the exceeded summary * @throws Exception the exception */ public static void sendEmailOmh( String mailUser, String mailPassword, String from, String to, String salutation, String exceededSummary ) throws Exception { String content = String.format( "<html><body><b>Hello %s</b><br>Patient Metric Exceeded: %s<br>" + "Launch the <a href=\"#\">Patient Dashboard</a><br>" + "Regards,<br>Your Personalized Medicine" + "</body></html>", salutation, exceededSummary); String subject = String.format("Patient Metric Exceeded: %s", exceededSummary); sendEmail( mailUser, mailPassword, from, to, salutation, subject, content ); } /** * Send email. * * @param mailUser the mail user * @param mailPassword the mail password * @param from the from * @param to the to * @param salutation the salutation * @param subject the subject * @param content the content * @throws Exception the exception */ public static void sendEmail( String mailUser, String mailPassword, String from, String to, String salutation, String subject, String content ) throws Exception { Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(mailUser, mailPassword); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress( from )); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse( to )); message.setSubject(subject); message.setContent(content, "text/html"); Transport.send(message); logger.info("email sent from: {}, to: {}, subject: {}", from, to, subject ); } catch (MessagingException e) { throw new RuntimeException(e); } } }
{ "content_hash": "7b6a5e0f01fc6daa202db6ba633d0501", "timestamp": "", "source": "github", "line_count": 111, "max_line_length": 164, "avg_line_length": 34.846846846846844, "alnum_prop": 0.7158738366080661, "repo_name": "petezybrick/iote2e", "id": "1c1226a5e4c720991b799dbaa4bfe105a0c2f3e5", "size": "4576", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "iote2e-stream/src/main/java/com/pzybrick/iote2e/stream/email/Email.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "22937" }, { "name": "HTML", "bytes": "167023" }, { "name": "Java", "bytes": "1352750" }, { "name": "JavaScript", "bytes": "240040" }, { "name": "Makefile", "bytes": "2479" }, { "name": "Perl", "bytes": "1637" }, { "name": "Python", "bytes": "78368" }, { "name": "Shell", "bytes": "16595" } ], "symlink_target": "" }
import { renderMathjax } from '../libs/mathjax.js'; import { default as Potmum } from '../legacy'; function newAction() { Potmum.createArtcleEditor('.js-article-editor') } function editAction() { Potmum.createArtcleEditor('.js-article-editor') } function showAction() { Potmum.createCommentForm('.js-comment-form'); Potmum.createCheckButton('.js-like-button'); Potmum.createCheckButton('.js-stock-button'); renderMathjax($('.markdown')); } export default { newAction: newAction, editAction: editAction, showAction: showAction }
{ "content_hash": "f5a83e7e5e9af8cb415904e4c22c9478", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 51, "avg_line_length": 23.708333333333332, "alnum_prop": 0.6977152899824253, "repo_name": "rutan/potmum", "id": "b2d5c2262ea6f36329d8f592b3c7c100cf6bab58", "size": "569", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frontend/pages/article.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "27441" }, { "name": "HTML", "bytes": "46455" }, { "name": "JavaScript", "bytes": "20263" }, { "name": "Ruby", "bytes": "164551" } ], "symlink_target": "" }
class SessionsController < ApplicationController skip_before_action :verify_authenticity_token def new end def create if @user = User.find_by(email: user_params[:email]) if @user.authenticate(user_params[:password]) session[:user_id] = @user.id if @user.admin? redirect_to users_path else redirect_to(@user) end else flash[:error] = "Please login again!" redirect_to root_path end else redirect_to root_path end end def destroy session[:user_id] = nil redirect_to root_path end private def user_params params.require(:user).permit(:email, :password) end end
{ "content_hash": "7984c3b8d9fe86bd763ca8e00f700c60", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 55, "avg_line_length": 19.444444444444443, "alnum_prop": 0.6157142857142858, "repo_name": "Aaron1515/WorkOutTracker", "id": "5f8616ad1578efcf01f05f4e3a900d9f1b4176a7", "size": "700", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/controllers/sessions_controller.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3205" }, { "name": "HTML", "bytes": "30826" }, { "name": "JavaScript", "bytes": "5399" }, { "name": "Ruby", "bytes": "54170" } ], "symlink_target": "" }
#include "config.h" #include "JSHTMLCollection.h" #include "HTMLAllCollection.h" #include "HTMLCollection.h" #include "HTMLFormControlsCollection.h" #include "HTMLOptionsCollection.h" #include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" #include "JSHTMLFormControlsCollection.h" #include "JSHTMLOptionsCollection.h" #include "JSNode.h" #include "JSNodeList.h" #include "JSRadioNodeList.h" #include "Node.h" #include "RadioNodeList.h" #include <wtf/Vector.h> #include <wtf/text/AtomicString.h> using namespace JSC; namespace WebCore { bool JSHTMLCollection::nameGetter(ExecState* exec, PropertyName propertyName, JSValue& value) { ASSERT_WITH_MESSAGE(wrapped().type() != FormControls, "Should call the subclass' nameGetter"); ASSERT_WITH_MESSAGE(wrapped().type() != SelectOptions, "Should call the subclass' nameGetter"); auto item = wrapped().namedItem(propertyNameToAtomicString(propertyName)); if (!item) return false; value = toJS(exec, globalObject(), *item); return true; } JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<HTMLCollection>&& collection) { switch (collection->type()) { case FormControls: return CREATE_DOM_WRAPPER(globalObject, HTMLFormControlsCollection, WTFMove(collection)); case SelectOptions: return CREATE_DOM_WRAPPER(globalObject, HTMLOptionsCollection, WTFMove(collection)); case DocAll: return CREATE_DOM_WRAPPER(globalObject, HTMLAllCollection, WTFMove(collection)); default: break; } return CREATE_DOM_WRAPPER(globalObject, HTMLCollection, WTFMove(collection)); } JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, HTMLCollection& collection) { return wrap(state, globalObject, collection); } } // namespace WebCore
{ "content_hash": "8dfbc8b066b95c2fbddcd8f9393c7393", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 103, "avg_line_length": 30, "alnum_prop": 0.7461111111111111, "repo_name": "applesrc/WebCore", "id": "acef6d8bbee1eaacf04d768fdc8bb0d401fa6ea5", "size": "2641", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bindings/js/JSHTMLCollectionCustom.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Assembly", "bytes": "1942" }, { "name": "C", "bytes": "1389023" }, { "name": "C++", "bytes": "42141769" }, { "name": "CMake", "bytes": "254371" }, { "name": "CSS", "bytes": "195888" }, { "name": "HTML", "bytes": "2042" }, { "name": "JavaScript", "bytes": "325391" }, { "name": "Makefile", "bytes": "59092" }, { "name": "Objective-C", "bytes": "927452" }, { "name": "Objective-C++", "bytes": "3488469" }, { "name": "Perl", "bytes": "646919" }, { "name": "Perl6", "bytes": "79316" }, { "name": "Python", "bytes": "37212" }, { "name": "Roff", "bytes": "26536" }, { "name": "Shell", "bytes": "356" }, { "name": "Yacc", "bytes": "11721" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_24) on Wed Apr 17 10:23:49 UTC 2013 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Package org.encog.mathutil (Encog Core 3.2.0-SNAPSHOT API) </TITLE> <META NAME="date" CONTENT="2013-04-17"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title = "Uses of Package org.encog.mathutil (Encog Core 3.2.0-SNAPSHOT API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/encog/mathutil/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if (window == top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Package<br>org.encog.mathutil</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.app.analyst.script.normalize"><B>org.encog.app.analyst.script.normalize</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.mathutil"><B>org.encog.mathutil</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.ml.data"><B>org.encog.ml.data</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.ml.data.basic"><B>org.encog.ml.data.basic</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.neural.networks.structure"><B>org.encog.neural.networks.structure</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.neural.networks.training.pso"><B>org.encog.neural.networks.training.pso</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.util.arrayutil"><B>org.encog.util.arrayutil</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.util.concurrency"><B>org.encog.util.concurrency</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.util.data"><B>org.encog.util.data</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.encog.util.normalize.output.nominal"><B>org.encog.util.normalize.output.nominal</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.app.analyst.script.normalize"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/app/analyst/script/normalize/package-summary.html">org.encog.app.analyst.script.normalize</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/Equilateral.html#org.encog.app.analyst.script.normalize"><B>Equilateral</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to produce an array of activations to classify data into groups.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.mathutil"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/ComplexNumber.html#org.encog.mathutil"><B>ComplexNumber</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A complex number class.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.ml.data"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/ml/data/package-summary.html">org.encog.ml.data</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/ComplexNumber.html#org.encog.ml.data"><B>ComplexNumber</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A complex number class.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.ml.data.basic"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/ml/data/basic/package-summary.html">org.encog.ml.data.basic</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/ComplexNumber.html#org.encog.ml.data.basic"><B>ComplexNumber</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A complex number class.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.neural.networks.structure"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/neural/networks/structure/package-summary.html">org.encog.neural.networks.structure</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/NumericRange.html#org.encog.neural.networks.structure"><B>NumericRange</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A numeric range has a high, low, mean, root-mean-square, standard deviation, and the count of how many samples it contains.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.neural.networks.training.pso"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/neural/networks/training/pso/package-summary.html">org.encog.neural.networks.training.pso</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/VectorAlgebra.html#org.encog.neural.networks.training.pso"><B>VectorAlgebra</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic vector algebra operators.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.util.arrayutil"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/util/arrayutil/package-summary.html">org.encog.util.arrayutil</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/Equilateral.html#org.encog.util.arrayutil"><B>Equilateral</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to produce an array of activations to classify data into groups.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.util.concurrency"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/util/concurrency/package-summary.html">org.encog.util.concurrency</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/IntRange.html#org.encog.util.concurrency"><B>IntRange</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A range of integers.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.util.data"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/util/data/package-summary.html">org.encog.util.data</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/EncogFunction.html#org.encog.util.data"><B>EncogFunction</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A generic single or multivariate function.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.encog.util.normalize.output.nominal"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../org/encog/mathutil/package-summary.html">org.encog.mathutil</A> used by <A HREF="../../../org/encog/util/normalize/output/nominal/package-summary.html">org.encog.util.normalize.output.nominal</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../org/encog/mathutil/class-use/Equilateral.html#org.encog.util.normalize.output.nominal"><B>Equilateral</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to produce an array of activations to classify data into groups.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/encog/mathutil/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if (window == top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2013. All Rights Reserved. </BODY> </HTML>
{ "content_hash": "6753512b49175898e55449f2a1a29ac9", "timestamp": "", "source": "github", "line_count": 343, "max_line_length": 256, "avg_line_length": 53.932944606414, "alnum_prop": 0.5331098978323152, "repo_name": "ladygagapowerbot/bachelor-thesis-implementation", "id": "e319258624e7e5fb3c5b336556483d4604a0a1ab", "size": "18499", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/Encog/apidocs/org/encog/mathutil/package-use.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
import flask import os.path import tempfile import urllib2 from npactflask import app from npactflask.views import getrelpath from pynpact import util, entrez, parsing from flask import url_for, redirect, request, flash logger = app.logger def mksavefile(prefix): """Wrapper around creating the file to save uploaded files in. Returns the (fd, abspath, relpath) """ # we're using tempfile to ensure the file we get is unique and # aren't overwriting another. fd, abspath = tempfile.mkstemp(dir=app.config['UPLOADS'], prefix=prefix) relpath = getrelpath(abspath) return (fd, abspath, relpath) def is_clean_path(path): return os.pathsep not in path and os.path.normpath(path) == path def file_upload(): fileup = request.files.get('file') args = dict(request.args.items()) if not fileup: flash('Must upload a File') return redirect(url_for('start', **args)) logger.info("Checking Uploaded file %s", fileup) if not is_clean_path(fileup.name): flash("Illegal filename") return redirect(url_for('start', **args)) fd, savepath, relpath = mksavefile("up-%s-" % fileup.filename) logger.info("Saving uploaded file to %r", savepath) fileup.save(savepath) return redirect(url_for('run_frame', path=relpath)) def fetchurl(): args = dict(request.values.items()) url = args.pop('fetchurl', None) if not url: flash('URL Required in URL Field') return redirect(url_for('start', **args)) logger.debug("Going to pull from %r", url) pull_req = urllib2.Request(url) if pull_req.get_type == "file": flash("Illegal URL") return redirect(url_for('start', **args)) try: fh = urllib2.urlopen(pull_req) fd, savepath, relpath = mksavefile("url") util.stream_to_file(fh, savepath) return redirect(url_for('run_frame', path=relpath)) except: logger.exception("Error fetching url %s", url) flash("Error fetching url") return redirect(url_for('start', **args)) def pastein(): args = dict(request.values.items()) text = args.pop('pastein', None) if not text: flash('Text Required in Pastefield') return redirect(url_for('start', **args)) (fd, savepath, relpath) = mksavefile("txt") logger.info("Saving paste to %r", relpath) with os.fdopen(fd, 'wb') as fh: fh.write(text) return redirect(url_for('run_frame', path=relpath, **args)) def search(): args = dict(request.values.items()) search = args.pop('search', None) if not search: flash('Accession Number Required') return redirect(url_for('start', **args)) sess = entrez.CachedEntrezSession(app.config['UPLOADS']) sess.search(search) logger.debug( "Search finished, found %d matches", sess.result_count) if sess.result_count == 1: relpath = getrelpath(sess.fetch()) return redirect(url_for('run_frame', path=relpath, **args)) elif sess.result_count > 1: flash( "Too many results (%d) found, need 1." " Try refining the search or searching for a RefSeq id." % (sess.result_count)) return flask.render_template('start.html', sess=sess, search=search) else: flash("No results found.") return redirect(url_for('start', **args)) @app.route('/', endpoint='start', methods=['POST', 'GET']) def view(): active = request.form.get('active') if request.method == 'POST': logger.info("Handling post active %r", active) if active == 'pastein': return pastein() elif active == 'fetchurl': return fetchurl() elif active == 'upload': return file_upload() elif active == 'search': return search() else: # not a post args = dict(request.args.items()) return flask.render_template('start.html', **args) def re_search(): if request.args.get('entrez_search_term'): return flask.render_template( 'start.html') else: return view(request) @app.route('/efetch/<int:id>') def efetch(id): logger.info("Asked to fetch Id: %s", id) searchsession = entrez.EntrezSession(app.config['UPLOADS']) abspath = searchsession.fetch_id(id) path = getrelpath(abspath) try: parsing.initial(abspath) except: flash("There was a problem loading file '%s', " "please try again or try a different record." % path) return re_search() args = dict(request.args.items()) return redirect(url_for('run_frame', path=path, **args)) @app.route('/log') def log(): logger.info("Hi there!") return flask.make_response("Hi there!")
{ "content_hash": "a352188287d72ee55d58a4223cb89e82", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 76, "avg_line_length": 30.367088607594937, "alnum_prop": 0.6192163401417258, "repo_name": "NProfileAnalysisComputationalTool/npact", "id": "a1b3d92742d1872c557da5e157c70a90b321bd6a", "size": "4798", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "npactflask/npactflask/views/start.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "239355" }, { "name": "CSS", "bytes": "10789" }, { "name": "HTML", "bytes": "41483" }, { "name": "JavaScript", "bytes": "143697" }, { "name": "Jupyter Notebook", "bytes": "7907" }, { "name": "Makefile", "bytes": "1347" }, { "name": "Python", "bytes": "219168" }, { "name": "Shell", "bytes": "2867" } ], "symlink_target": "" }
class EngineBuilder < ErrorsApi def read_base_image_from_dockerfile dockerfile = File.open("#{basedir}/Dockerfile", 'r') begin from_line = dockerfile.gets("\n", 100) from_line.gsub!(/^FROM[ ]*/, '') ensure dockerfile.close end from_line end def get_base_image base_image_name = read_base_image_from_dockerfile raise EngineBuilderException.new(error_hash('Failed to Read Image from Dockerfile')) if base_image_name.nil? log_build_output("Pull base Image: #{base_image_name}") core.pull_image(base_image_name) true rescue StandardError => e log_build_errors(e) raise e if e.is_a?(EngineBuilderException) # FIXME: # Buggy so ignore when fails true end end
{ "content_hash": "e2b3dbbbf1d84eb6284ce1a92f5c3d71", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 110, "avg_line_length": 26.807692307692307, "alnum_prop": 0.7087517934002869, "repo_name": "EnginesOS/System", "id": "6b541cb0abd09e715aee3406144a5e462eaff2e7", "size": "697", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/ruby/engine_builder/builder/base_image.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "101320" }, { "name": "HTML", "bytes": "4478768" }, { "name": "JavaScript", "bytes": "72060" }, { "name": "Makefile", "bytes": "40933" }, { "name": "Ruby", "bytes": "844890" }, { "name": "Shell", "bytes": "118832" }, { "name": "TSQL", "bytes": "3205" } ], "symlink_target": "" }
package geometry.diagram.edit.parts; import geometry.diagram.edit.policies.LineItemSemanticEditPolicy; import org.eclipse.draw2d.Connection; import org.eclipse.draw2d.PolygonDecoration; import org.eclipse.draw2d.RotatableDecoration; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.gef.EditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.gmf.runtime.notation.View; // TODO: Auto-generated Javadoc /** * The Class LineEditPart. * * @generated */ public class LineEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart { /** The Constant VISUAL_ID. @generated */ public static final int VISUAL_ID = 4001; /** * Instantiates a new line edit part. * * @param view the view * @generated */ public LineEditPart(View view) { super(view); } /** * Creates the default edit policies. * * @generated */ protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LineItemSemanticEditPolicy()); } /** * Adds the fixed child. * * @param childEditPart the child edit part * @return true, if successful * @generated */ protected boolean addFixedChild(EditPart childEditPart) { if (childEditPart instanceof LineLabelAppearanceLabelTokEditPart) { ((LineLabelAppearanceLabelTokEditPart) childEditPart) .setLabel(getPrimaryShape().getFigureName()); return true; } return false; } /** * Adds the child visual. * * @param childEditPart the child edit part * @param index the index * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, index); } /** * Removes the fixed child. * * @param childEditPart the child edit part * @return true, if successful * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { if (childEditPart instanceof LineLabelAppearanceLabelTokEditPart) { return true; } return false; } /** * Removes the child visual. * * @param childEditPart the child edit part * @generated */ protected void removeChildVisual(EditPart childEditPart) { if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); } /** * Creates figure for this edit part. * * Body of this method does not depend on settings in generation model * so you may safely remove <i>generated</i> tag and modify it. * * @return the connection * @generated */ protected Connection createConnectionFigure() { return new LineFigure(); } /** * Gets the primary shape. * * @return the primary shape * @generated */ public LineFigure getPrimaryShape() { return (LineFigure) getFigure(); } /** * The Class LineFigure. * * @generated */ public class LineFigure extends PolylineConnectionEx { /** The figure name. @generated */ private WrappingLabel fFigureName; /** * Instantiates a new line figure. * * @generated NOT * @Mikko_Tuulio */ public LineFigure() { createContents(); setTargetDecoration(createTargetDecoration()); } /** * Creates the contents. * * @generated */ private void createContents() { fFigureName = new WrappingLabel(); fFigureName.setText("<...>"); this.add(fFigureName); } /** * Creates the target decoration. * * @return the rotatable decoration * @generated NOT * @Mikko_Tuulio */ private RotatableDecoration createTargetDecoration() { PolygonDecoration df = new PolygonDecoration(); df.setFill(true); PointList pl = new PointList(); pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-1)); pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0)); pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(1)); df.setTemplate(pl); df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3)); return df; } /** * Gets the figure name. * * @return the figure name * @generated */ public WrappingLabel getFigureName() { return fFigureName; } /** * Gets the smooth points. * * @param calculateAppox the calculate appox * @return the smooth points * @generated NOT * @Mikko_Tuulio */ @Override public PointList getSmoothPoints(boolean calculateAppox) { // TODO Auto-generated method stub // Set how many smooth points there should be between each control point double smoothness = (double) 100; PointList smoothPoints = calculateCatmullromPointList( this.getPoints(), smoothness); return smoothPoints; } /** * Calculate catmullrom point list. * * @param points the points * @param smoothness the smoothness * @return the point list * @generated NOT * @Mikko_Tuulio */ private PointList calculateCatmullromPointList(PointList points, double smoothness) { PointList catmullromPoints = new PointList(); //If the point list consists of only two points, list of smooth points is the same as list of control points if (2 == points.size()) { //Add first and last points of control points list to smooth points list catmullromPoints.addPoint(points.getFirstPoint()); catmullromPoints.addPoint(points.getLastPoint()); return catmullromPoints; } //Initialize values Point newPoint = null; double tStep = 1 / smoothness; //Loop trough all the points in point list. Depending on the method this might not be needed for (int i = 0; i < points.size() - 1; i++) { //Add control points to smooth points, except the last one catmullromPoints.addPoint(points.getPoint(i)); //Loop trough steps at the length of smoothness. for (double t = tStep; t < 1; t = t + tStep) { //If the first segment of line is being calculated, new control point needs to be created before the first one if (i == 0) newPoint = calculatePoint( extrapolatePoint(points.getPoint(i + 1), points.getPoint(i)), points.getPoint(i), points.getPoint(i + 1), points.getPoint(i + 2), t); //If the last segment of line is being calculated, new control point needs to be created after the last one else if (i == points.size() - 2) newPoint = calculatePoint( points.getPoint(i - 1), points.getPoint(i), points.getPoint(i + 1), extrapolatePoint(points.getPoint(i), points.getPoint(i + 1)), t); //Calculate new point from nearby points and time step else newPoint = calculatePoint(points.getPoint(i - 1), points.getPoint(i), points.getPoint(i + 1), points.getPoint(i + 2), t); //Add new point to the list of smooth points. catmullromPoints.addPoint(newPoint); } } //Add last control point to list of smooth points. catmullromPoints.addPoint(points.getLastPoint()); return catmullromPoints; } /** * Calculate point. * * @param p0 the p0 * @param p1 the p1 * @param p2 the p2 * @param p3 the p3 * @param t the t * @return the point * @generated NOT * @Mikko_Tuulio */ private Point calculatePoint(Point p0, Point p1, Point p2, Point p3, double t) { Point point = new Point(); point.x = (int) (0.5 * (p0.x * (-t + 2 * (t * t) - (t * t * t)) + p1.x * (2 - 5 * (t * t) + 3 * (t * t * t)) + p2.x * (t + 4 * (t * t) - 3 * (t * t * t)) + p3.x * (-(t * t) + (t * t * t)))); point.y = (int) (0.5 * (p0.y * (-t + 2 * (t * t) - (t * t * t)) + p1.y * (2 - 5 * (t * t) + 3 * (t * t * t)) + p2.y * (t + 4 * (t * t) - 3 * (t * t * t)) + p3.y * (-(t * t) + (t * t * t)))); return point; } /** * Extrapolate point. * * @param p1 the p1 * @param p2 the p2 * @return the point * @generated NOT * @Mikko_Tuulio */ private Point extrapolatePoint(Point p1, Point p2) { Point point = new Point(); //This isn't correct, me thinks. point.x = (p2.x - p1.x) + p1.x; point.y = (p2.y - p1.y) + p1.y; return point; } } }
{ "content_hash": "a56992a1face7adf1b4a03af5b427f5d", "timestamp": "", "source": "github", "line_count": 326, "max_line_length": 116, "avg_line_length": 26.926380368098158, "alnum_prop": 0.6351105035315562, "repo_name": "albertfdp/petrinet", "id": "80e5c4051888abf7278117ec80174b821bf7620c", "size": "8778", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/dk.dtu.se2.geometry.diagram/src/geometry/diagram/edit/parts/LineEditPart.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
#ifndef UMM_MALLOC_H #define UMM_MALLOC_H /* ------------------------------------------------------------------------ */ #include "umm_malloc_cfg.h" /* user-dependent */ #ifdef __cplusplus extern "C" { #endif typedef struct UMM_HEAP_INFO_t { unsigned short int totalEntries; unsigned short int usedEntries; unsigned short int freeEntries; unsigned short int totalBlocks; unsigned short int usedBlocks; unsigned short int freeBlocks; unsigned short int maxFreeContiguousBlocks; } UMM_HEAP_INFO; extern UMM_HEAP_INFO ummHeapInfo; void umm_init( void ); void *umm_info( void *ptr, int force ); void *umm_malloc( size_t size ); void *umm_calloc( size_t num, size_t size ); void *umm_realloc( void *ptr, size_t size ); void umm_free( void *ptr ); size_t umm_free_heap_size( void ); #ifdef __cplusplus } #endif /* ------------------------------------------------------------------------ */ #endif /* UMM_MALLOC_H */
{ "content_hash": "b6afd8d02da555a6fcf488dedfa8dac5", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 78, "avg_line_length": 20.47826086956522, "alnum_prop": 0.5881104033970276, "repo_name": "vvzvlad/Iuppiter", "id": "0019b0ec500fbbd317ac8a28a48b38b0e823c550", "size": "1224", "binary": false, "copies": "26", "ref": "refs/heads/master", "path": "arduino_ide_boards/esp8266-2.3.0/cores/esp8266/umm_malloc/umm_malloc.h", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "210043" }, { "name": "Assembly", "bytes": "12212" }, { "name": "C", "bytes": "2294826" }, { "name": "C++", "bytes": "1243947" }, { "name": "Eagle", "bytes": "1143006" }, { "name": "HTML", "bytes": "28393" }, { "name": "Lua", "bytes": "6685" }, { "name": "Makefile", "bytes": "8102" }, { "name": "Python", "bytes": "27815" }, { "name": "Shell", "bytes": "3353" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang=sl> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Vnes-el/la sem pravilno geslo, vendar se še vedno ne morem povezati</title> <link rel="stylesheet" type="text/css" href="../vodnik_1404.css"> <script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="jquery.syntax.js"></script><script type="text/javascript" src="yelp.js"></script><link rel="shortcut icon" href="https://www.ubuntu.si/favicon.ico"> </head> <body id="home"> <div id="wrapper" class="hfeed"> <div id="header"> <div id="branding"> <div id="blog-title"><span><a rel="home" title="Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu" href="https://www.ubuntu.si">Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu</a></span></div> <h1 id="blog-description"></h1> </div> <div id="access"><div id="loco-header-menu"><ul id="primary-header-menu"><li class="widget-container widget_nav_menu" id="nav_menu-3"><div class="menu-glavni-meni-container"><ul class="menu" id="menu-glavni-meni"> <li id="menu-item-15" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-15"><a href="https://www.ubuntu.si">Novice</a></li> <li id="menu-item-16" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-16"><a href="https://www.ubuntu.si/punbb/">Forum</a></li> <li id="menu-item-19" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-19"><a href="https://www.ubuntu.si/kaj-je-ubuntu/">Kaj je Ubuntu?</a></li> <li id="menu-item-20" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20"><a href="https://www.ubuntu.si/pogosta_vprasanja/">Pogosta vprašanja</a></li> <li id="menu-item-17" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-17"><a href="https://www.ubuntu.si/skupnost/">Skupnost</a></li> <li id="menu-item-18" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18"><a href="https://www.ubuntu.si/povezave/">Povezave</a></li> </ul></div></li></ul></div></div> </div> <div id="main"><div id="cwt-content" class="clearfix content-area"><div id="page"> <div class="trails" role="navigation"><div class="trail"> » <a class="trail" href="index.html" title="Namizni vodnik Ubuntu"><span class="media"><span class="media media-image"><img src="figures/ubuntu-logo.png" height="16" width="16" class="media media-inline" alt="Pomoč"></span></span> Namizni vodnik Ubuntu</a> » <a class="trail" href="net.html" title="Omreženje, splet, pošta in klepet">Omreženje, splet, pošta in klepet</a> » <a class="trail" href="net-wireless.html" title="Brezžične povezave">Brezžične povezave</a> » </div></div> <div id="content"> <div class="hgroup"><h1 class="title"><span class="title">Vnes-el/la sem pravilno geslo, vendar se še vedno ne morem povezati</span></h1></div> <div class="region"> <div class="contents"> <p class="p">V primeru da ste prepričani, da ste vnesli pravilno <span class="link"><a href="net-wireless-wepwpa.html" title="Kaj WEP in WPA pomenita?">brezžično geslo</a></span>, a se še vedno ne morete uspešno povezati z brezžičnim omrežje, poskusite nekaj od naslednjega:</p> <div class="list"><div class="inner"><div class="region"><ul class="list"> <li class="list"> <p class="p">Dvakrat preverite, da imate pravo geslo</p> <p class="p">Gesla so občutljiva na velikost črk (pomembno je ali so črke velike ali majhne). Zato preverite, da niste napisali znakov napačne velikosti.</p> </li> <li class="list"> <p class="p">Poskusite šestnajstiški ali ASCII ključ</p> <p class="p">Geslo je lahko predstavljeno tudi na drugačen način - kot niz znakov v šestnajstiškem sistemu (števila od 0-9 in črke od a-f), ki se imenuje šifrirni ključ. V primeru da imate geslo do šifrirnega ključa in geslo/šifrirno frazo, poskusite s tipkanjem šifrirnega ključa. Prepričajte se, da izberete pravilno možnost <span class="gui">brezžična varnost</span> (če na primer vnašate 40 znakovni šifrirni ključ za z WEP šifrirano povezavo, izberite <span class="gui">WEP 40/128-biten ključ</span>).</p> </li> <li class="list"> <p class="p">Izklopite in znova vklopite brezžično kartico</p> <p class="p">Včasih brezžične kartice obtičijo ali imajo manjšo težavo, ki pomeni, da se ne bodo povezale. Kartico poskusite izklopiti in ponovno vklopiti za njeno ponastavitev. Za več podrobnosti si oglejte <span class="link"><a href="net-wireless-troubleshooting.html" title="Odpravljanje težav z brezžičnimi omrežji">Odpravljanje težav z brezžičnimi omrežji</a></span>.</p> </li> <li class="list"> <p class="p">Preverite, da uporabljate pravo vrsto brezžične varnosti</p> <p class="p">Ko ste pozvani za geslo svoje brezžične varnosti, lahko izberete katero vrsto brezžične varnosti želite uporabiti. Prepričajte se, da ste izbrali tiso, ki jo uporablja usmerjevalnik ali brezžična postaja. Privzeto bi morala biti izbrana prava možnost, vendar včasih ni. Če ne veste katera možnost je prava, poskusite vse.</p> </li> <li class="list"> <p class="p">Preverite, če je vaša brezžična kartica pravilno podprta</p> <p class="p">Nekatere brezžične kartice niso zelo dobro podprte. Pokažejo brezžična povezava, vendar se z njimi ne morejo povezati, ker gonilnikom manjka ta zmožnost. Oglejte si, če lahko dobite drug brezžični gonilnik ali če morate izvesti nekaj dodatne nastavitve (kot je namestitev drugačne <span class="em">strojne programske opreme</span>). Za več podrobnosti si oglejte <span class="link"><a href="net-wireless-troubleshooting.html" title="Odpravljanje težav z brezžičnimi omrežji">Odpravljanje težav z brezžičnimi omrežji</a></span>.</p> </li> </ul></div></div></div> </div> <div class="sect sect-links" role="navigation"> <div class="hgroup"></div> <div class="contents"> <div class="links guidelinks"><div class="inner"> <div class="title"><h2><span class="title">Več podrobnosti</span></h2></div> <div class="region"><ul><li class="links "> <a href="net-wireless.html" title="Brezžične povezave">Brezžične povezave</a><span class="desc"> — <span class="link"><a href="net-wireless-connect.html" title="Povezava z brezžičnim omrežjem">Poveži se z brezžičnim omrežjem</a></span>, <span class="link"><a href="net-wireless-hidden.html" title="Povezava s skritim brezžičnim omrežjem">Skrita omrežja</a></span>, <span class="link"><a href="net-wireless-edit-connection.html" title="Urejanje brezžične povezave">Uredi nastavitve povezave</a></span>, <span class="link"><a href="net-wireless-disconnecting.html" title="Zakaj se povezava z mojim brezžičnim omrežjem kar naprej prekinja?">Prekinjanje povezave</a></span> …</span> </li></ul></div> </div></div> <div class="links seealsolinks"><div class="inner"> <div class="title"><h2><span class="title">Pogjejte tudi</span></h2></div> <div class="region"><ul><li class="links "> <a href="net-wireless-connect.html" title="Povezava z brezžičnim omrežjem">Povezava z brezžičnim omrežjem</a><span class="desc"> — Povežite se na internet - brezžično.</span> </li></ul></div> </div></div> </div> </div> </div> <div class="clear"></div> </div> </div></div></div> <div id="footer"><img src="https://piwik-ubuntusi.rhcloud.com/piwik.php?idsite=1amp;rec=1" style="border:0"><div id="siteinfo"><p>Material v tem dokumentu je na voljo pod prosto licenco. To je prevod dokumentacije Ubuntu, ki jo je sestavila <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu dokumentacijska ekpa za Ubuntu</a>. V slovenščino jo je prevedla skupina <a href="https://wiki.lugos.si/slovenjenje:ubuntu">Ubuntu prevajalcev</a>. Za poročanje napak v prevodih v tej dokumentaciji ali Ubuntuju pošljite sporočilo na <a href="mailto:ubuntu-l10n-slv@lists.ubuntu.com?subject=Prijava%20napak%20v%20prevodih">dopisni seznam</a>.</p></div></div> </div> </body> </html>
{ "content_hash": "58c5461698c47bdc6848acb1791348d3", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 678, "avg_line_length": 97.75, "alnum_prop": 0.7347826086956522, "repo_name": "ubuntu-si/ubuntu.si", "id": "859cb2d5b4e11b3a43b44ba860ead2655c2815d3", "size": "7974", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vodnik/14.04/net-wireless-noconnection.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1814" }, { "name": "CSS", "bytes": "662090" }, { "name": "HTML", "bytes": "20513819" }, { "name": "JavaScript", "bytes": "768139" }, { "name": "PHP", "bytes": "437543" }, { "name": "Shell", "bytes": "22354" }, { "name": "Smarty", "bytes": "3767" } ], "symlink_target": "" }
/********************************************************************* ** Program Filename: Stack.cpp ** Author: Jason Goldfine-Middleton ** Date: 10/29/15 ** Description: Contains the implementation for the Stack class ** member functions. *********************************************************************/ #include <limits> // for std::numeric_limits #include <cstdlib> // for NULL #include "Stack.hpp" /********************************************************************* ** Function: Stack::Stack() ** Description: Constructs a new Stack object. ** Parameters: none ** Pre-Conditions: none ** Post-Conditions: top is a null pointer *********************************************************************/ Stack::Stack() : top(NULL) { } /********************************************************************* ** Function: Stack::~Stack() ** Description: Destructor for a Stack object. ** Parameters: none ** Pre-Conditions: top has not been deleted yet ** Post-Conditions: top and all other nodes have been deleted *********************************************************************/ Stack::~Stack() { // start at first node StackNode *cur = top; // destroy all the StackNodes until we reach NULL while (cur) { StackNode *rmv = cur; cur = cur->next; delete rmv; } } /********************************************************************* ** Function: Stack::add() ** Description: Adds a new StackNode containing "item" to the top of ** the Stack. ** Parameters: item the integer to add to the Stack ** Pre-Conditions: none ** Post-Conditions: top points to a new node containing "item", ** the new node points to the old top node, top is ** not a null pointer *********************************************************************/ void Stack::add(const int item) { // create a new node containing the item StackNode *node = new StackNode; node->item = item; // point it to the old top node node->next = top; // now it's on top top = node; } /********************************************************************* ** Function: Stack::remove() ** Description: Returns the int stored in the top node of the Stack. ** Parameters: none ** Pre-Conditions: none ** Post-Conditions: if there is no top node, returns a large negative ** int; otherwise returns the int stored in the top ** node *********************************************************************/ int Stack::remove() { // if there are no nodes, return the most negative int if (top == NULL) return std::numeric_limits<int>::min(); // store the current top StackNode *old_top = top; // top points to the node under the old top top = old_top->next; // get the item from old top int removed = old_top->item; // free the memory pointed to by old_top delete old_top; old_top = NULL; // return the item return removed; }
{ "content_hash": "656ce6c26e23505956455df8a5f4dbd3", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 71, "avg_line_length": 29.304761904761904, "alnum_prop": 0.47611309717257067, "repo_name": "jrgoldfinemiddleton/cs162", "id": "ee3667840d584510159e12e3a2f3f1d174d9196b", "size": "3077", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lab06/Stack.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C++", "bytes": "411989" }, { "name": "Makefile", "bytes": "27853" } ], "symlink_target": "" }
IF (F77_FUNC) SET(F77_BLAS_MANGLE_DEFAULT ${F77_FUNC}) ELSE() SET(F77_BLAS_MANGLE_DEFAULT "UNDEFINED") ENDIF() IF(WIN32 AND NOT CYGWIN) SET(F77_BLAS_MANGLE_DEFAULT "${F77_FUNC}") ENDIF() # Set options so that users can change these! SET(F77_BLAS_MANGLE ${F77_BLAS_MANGLE_DEFAULT} CACHE STRING "Name mangling to call functions in the provided BLAS library") MARK_AS_ADVANCED(F77_BLAS_MANGLE)
{ "content_hash": "6add76573f80b4db3991aa1417666f45", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 65, "avg_line_length": 25.1875, "alnum_prop": 0.7295285359801489, "repo_name": "wawiesel/BootsOnTheGround", "id": "7215ccf7f683322f28f680265c4c69891f97384e", "size": "2471", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "external/TriBITS/tribits/core/package_arch/TribitsBLASMangling.cmake", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "8310" }, { "name": "C++", "bytes": "19908" }, { "name": "CMake", "bytes": "68605" }, { "name": "Fortran", "bytes": "1330" }, { "name": "Shell", "bytes": "23712" } ], "symlink_target": "" }
package uk.co.baconi.secure.base.lock; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import uk.co.baconi.secure.base.BaseIntegrationTest; import uk.co.baconi.secure.base.bag.Bag; import uk.co.baconi.secure.base.password.Password; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; public class SymmetricGraphRepositoryIT extends BaseIntegrationTest { @Autowired private SymmetricLockGraphRepository symmetricLockGraphRepository; @Test public void shouldBeAbleToCreateLock() { final Password password = new Password("whereFor", "username", "password"); final Bag bag = new Bag("bag", "public key".getBytes()); final byte[] key = "key".getBytes(); final SymmetricLock lock = new SymmetricLock(password, bag, key); final SymmetricLock saved = symmetricLockGraphRepository.save(lock); assertThat(saved, is(equalTo(lock))); assertThat(saved.getId(), is(not(nullValue()))); assertThat(saved.getKey(), is(equalTo(key))); assertThat(saved.getPassword(), is(equalTo(password))); assertThat(saved.getBag(), is(equalTo(bag))); final SymmetricLock one = symmetricLockGraphRepository.findOne(lock.getId()); assertThat(one, is(equalTo(lock))); assertThat(one.getId(), is(equalTo(lock.getId()))); assertThat(one.getKey(), is(equalTo(key))); assertThat(one.getPassword(), is(equalTo(password))); assertThat(one.getBag(), is(equalTo(bag))); } }
{ "content_hash": "aa6eeb9369ed32606d123e98a520c26f", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 85, "avg_line_length": 35.68181818181818, "alnum_prop": 0.7012738853503184, "repo_name": "beercan1989/secure-my-bacon", "id": "4ed24c6ca2f0532e5d06e7cb2594c50a44e0501d", "size": "2164", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "base/src/integration/java/uk/co/baconi/secure/base/lock/SymmetricGraphRepositoryIT.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "98532" }, { "name": "Ruby", "bytes": "600" }, { "name": "Shell", "bytes": "3631" } ], "symlink_target": "" }
package org.yy.base.util; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; import org.apache.commons.lang.StringUtils; import java.text.DecimalFormat; import java.text.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This class is converts a Double to a double-digit String * (and vise-versa) by BeanUtils when copying properties. * * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a> */ public class CurrencyConverter implements Converter { private final Logger log = LoggerFactory.getLogger(CurrencyConverter.class); private DecimalFormat formatter = new DecimalFormat("###,###.00"); public void setDecimalFormatter(DecimalFormat df) { this.formatter = df; } /** * Convert a String to a Double and a Double to a String * * @param type the class type to output * @param value the object to convert * @return object the converted object (Double or String) */ public final Object convert(final Class type, final Object value) { // for a null value, return null if (value == null) { return null; } else { if (value instanceof String) { if (log.isDebugEnabled()) { log.debug("value (" + value + ") instance of String"); } try { if (StringUtils.isBlank(String.valueOf(value))) { return null; } if (log.isDebugEnabled()) { log.debug("converting '" + value + "' to a decimal"); } //formatter.setDecimalSeparatorAlwaysShown(true); Number num = formatter.parse(String.valueOf(value)); return num.doubleValue(); } catch (ParseException pe) { pe.printStackTrace(); } } else if (value instanceof Double) { if (log.isDebugEnabled()) { log.debug("value (" + value + ") instance of Double"); log.debug("returning double: " + formatter.format(value)); } return formatter.format(value); } } throw new ConversionException("Could not convert " + value + " to " + type.getName() + "!"); } }
{ "content_hash": "6e874bb5c9dd541116849629f75c2993", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 100, "avg_line_length": 34.32394366197183, "alnum_prop": 0.5662700041034058, "repo_name": "yyitsz/myjavastudio", "id": "e8482f521c17668ec73bc9a61ef64ee969d74d22", "size": "2437", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app-fw/app-base/src/main/java/org/yy/base/util/CurrencyConverter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "29361" }, { "name": "Batchfile", "bytes": "5917" }, { "name": "C#", "bytes": "1904272" }, { "name": "CSS", "bytes": "206344" }, { "name": "HTML", "bytes": "53455" }, { "name": "Java", "bytes": "3185115" }, { "name": "JavaScript", "bytes": "654297" }, { "name": "PLSQL", "bytes": "10155" }, { "name": "Roff", "bytes": "178" }, { "name": "Shell", "bytes": "418" }, { "name": "XSLT", "bytes": "12347" } ], "symlink_target": "" }
Average of Atmospheric Temperature 18.66957664489746 °C Average of Atmospheric Temperature without continents 17.746984481811523 °C Average of Atmospheric Zonal component - Uwind 0.017930543050169945 m/s Average of Atmospheric Zonal component without continents 0.40107759833335876 m/s Average of Atmospheric Meridional component - Vwind 0.40000736713409424 m/s Average of Atmospheric Meridional component without continents 0.6458993554115295 m/s Average of Specific Humidity 0.010127010755240917 kg_WATER/kg_DRYAIR Average of Specific Humidity without continents 0.010141630657017231 kg_EAU/kg_AIRSEC Average of Surface Heating 115.28447723388672 W/m² Average of Surface Heating without continents 158.9299774169922 W/m² Average of Latent Heat 81.93363189697266 W/m² Average of Latent Heat without continents 113.61536407470703 W/m² Average of Sensible Heat 10.404546737670898 W/m² Average of Sensible Heat without continents 113.61536407470703 W/m²
{ "content_hash": "fd12e8f6d8730e8b6d1518dfd9ab64bd", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 62, "avg_line_length": 23.5609756097561, "alnum_prop": 0.8405797101449275, "repo_name": "Herpinemmanuel/Oceanography", "id": "3594b809923bc4ccc5a865dbeda97a7e7f300b54", "size": "974", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Cas_1/E_Atmospheric_conditions_results.md", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "68804" } ], "symlink_target": "" }
/** * @file LPC214x/hal_spi_lld.h * @brief LPC214x low level SPI driver header. * * @addtogroup SPI * @{ */ #ifndef HAL_SPI_LLD_H #define HAL_SPI_LLD_H #if HAL_USE_SPI || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ /** * @brief Hardware FIFO depth. */ #define LPC214x_SSP_FIFO_DEPTH 8 /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** * @brief SPI1 driver enable switch. * @details If set to @p TRUE the support for SSP is included. * @note The default is @p TRUE. */ #if !defined(LPC214x_SPI_USE_SSP) || defined(__DOXYGEN__) #define LPC214x_SPI_USE_SSP TRUE #endif /** * @brief SSP interrupt priority level setting. */ #if !defined(LPC214x_SPI_SSP_IRQ_PRIORITY) || defined(__DOXYGEN__) #define LPC214x_SPI_SSP_IRQ_PRIORITY 4 #endif /** * @brief Overflow error hook. * @details The default action is to stop the system. */ #if !defined(LPC214x_SPI_SSP_ERROR_HOOK) || defined(__DOXYGEN__) #define LPC214x_SPI_SSP_ERROR_HOOK() osalSysHalt() #endif /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if !LPC214x_SPI_USE_SSP #error "SPI driver activated but no SPI peripheral assigned" #endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /** * @brief Type of a structure representing an SPI driver. */ typedef struct SPIDriver SPIDriver; /** * @brief SPI notification callback type. * * @param[in] spip pointer to the @p SPIDriver object triggering the * callback */ typedef void (*spicallback_t)(SPIDriver *spip); /** * @brief Driver configuration structure. */ typedef struct { /** * @brief Operation complete callback or @p NULL. */ spicallback_t end_cb; /* End of the mandatory fields.*/ /** * @brief The chip select line port. */ ioportid_t ssport; /** * @brief The chip select line pad number. */ uint16_t sspad; /** * @brief SSP CR0 initialization data. */ uint16_t cr0; /** * @brief SSP CPSR initialization data. */ uint32_t cpsr; } SPIConfig; /** * @brief Structure representing a SPI driver. */ struct SPIDriver { /** * @brief Driver state. */ spistate_t state; /** * @brief Current configuration data. */ const SPIConfig *config; #if SPI_USE_WAIT || defined(__DOXYGEN__) /** * @brief Waiting thread. */ Thread *thread; #endif /* SPI_USE_WAIT */ #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if CH_USE_MUTEXES || defined(__DOXYGEN__) /** * @brief Mutex protecting the bus. */ Mutex mutex; #elif CH_USE_SEMAPHORES Semaphore semaphore; #endif #endif /* SPI_USE_MUTUAL_EXCLUSION */ #if defined(SPI_DRIVER_EXT_FIELDS) SPI_DRIVER_EXT_FIELDS #endif /* End of the mandatory fields.*/ /** * @brief Pointer to the SSP registers block. */ SSP *ssp; /** * @brief Number of bytes yet to be received. */ uint32_t rxcnt; /** * @brief Receive pointer or @p NULL. */ void *rxptr; /** * @brief Number of bytes yet to be transmitted. */ uint32_t txcnt; /** * @brief Transmit pointer or @p NULL. */ const void *txptr; }; /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #if LPC214x_SPI_USE_SSP && !defined(__DOXYGEN__) extern SPIDriver SPID1; #endif #ifdef __cplusplus extern "C" { #endif void spi_lld_init(void); void spi_lld_start(SPIDriver *spip); void spi_lld_stop(SPIDriver *spip); void spi_lld_select(SPIDriver *spip); void spi_lld_unselect(SPIDriver *spip); void spi_lld_ignore(SPIDriver *spip, size_t n); void spi_lld_exchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf); void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf); void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf); uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame); #ifdef __cplusplus } #endif #endif /* HAL_USE_SPI */ #endif /* HAL_SPI_LLD_H */ /** @} */
{ "content_hash": "f9fa18caede7cb36acb2ec9fb7636ce3", "timestamp": "", "source": "github", "line_count": 193, "max_line_length": 79, "avg_line_length": 27.523316062176164, "alnum_prop": 0.46442018072289154, "repo_name": "netik/dc26_spqr_badge", "id": "05b4f8a06d7605a9109254c94dc3fbf525e4c356", "size": "5935", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sw/firmware/ChibiOS/os/hal/ports/LPC/LPC214x/hal_spi_lld.h", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "479057" }, { "name": "Batchfile", "bytes": "882" }, { "name": "C", "bytes": "109460715" }, { "name": "C++", "bytes": "12411644" }, { "name": "CSS", "bytes": "65072" }, { "name": "Emacs Lisp", "bytes": "1440" }, { "name": "FreeMarker", "bytes": "492261" }, { "name": "HTML", "bytes": "238797" }, { "name": "Makefile", "bytes": "2126450" }, { "name": "Objective-C", "bytes": "7886832" }, { "name": "Perl", "bytes": "10398" }, { "name": "Python", "bytes": "12105" }, { "name": "Roff", "bytes": "3100" }, { "name": "Shell", "bytes": "23449" }, { "name": "Smarty", "bytes": "916" } ], "symlink_target": "" }
package it.agilelab.bigdata.spark.search.impl import scala.reflect.ClassTag import it.agilelab.bigdata.spark.search._ import it.agilelab.bigdata.spark.search.dsl.DslQuery import it.agilelab.bigdata.spark.search.utils._ import org.apache.lucene.document.StoredField import org.apache.lucene.index.IndexWriter import org.apache.spark.annotation.DeveloperApi import org.apache.spark.broadcast.Broadcast import org.apache.spark.rdd.RDD import org.apache.spark.storage.StorageLevel import org.apache.spark.{OneToOneDependency, Partition, TaskContext} class BroadcastIndexLuceneRDD[T] private[search] ( val index: Broadcast[LuceneIndex], val elementsRDD: RDD[Array[T]]) (implicit ct: ClassTag[T]) extends SearchableRDD[T] ( elementsRDD.context, List(new OneToOneDependency(elementsRDD))) { import SearchableRDD._ /* =============================================================================================== =============================================================================================== SearchableRDD methods implementations =============================================================================================== =============================================================================================== */ /** Returns an `Array` of elements matching the `query` with their scores, returning at most * `maxHits` results. * * Setting `maxHitsPerIndex` limits the size of intermediate results. It must be a positive value * between `1` and `maxHits` (both inclusive). The (internally handled) default is `maxHits`. * * The resulting `Array` is produced by efficiently aggregating partial results in a tree-level * pattern. * * @note $intermediateResults * @see [[org.apache.spark.rdd.RDD#treeAggregate]] * @group Search */ override def aggregatingSearch(query: Query, maxHits: Int, maxHitsPerIndex: Int): Array[(T, Double)] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, search it val realIndex = index.value val results = realIndex.searchAny(query, maxHits) // filter elements in this partition val resultsInThisPartition = results filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition resultsInThisPartition map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (elements(elementIndex), score) } } val iteratorResults = results.mapPartitions(it => Iterator(it)) aggregateResults(iteratorResults, maxHits) } /** Like [[aggregatingSearchWithResultsTransformer(query:it\.agilelab\.bigdata\.spark\.search\.Query,maxHits:Int,maxHitsPerIndex:Int)* aggregatingSearch(Query,Int,Int)]], * but specifying a `resultsTransformer` function to be applied to the result elements. * * @group Search */ override def aggregatingSearchWithResultsTransformer[V](query: Query, maxHits: Int, resultsTransformer: (T) => V, maxHitsPerIndex: Int): Array[(V, Double)] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, search it val realIndex = index.value val results = realIndex.searchAny(query, maxHits) // filter elements in this partition val resultsInThisPartition = results filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition resultsInThisPartition map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (resultsTransformer(elements(elementIndex)), score) } } val iteratorResults = results.mapPartitions(it => Iterator(it)) aggregateResults(iteratorResults, maxHits) } /** Like [[aggregatingSearchWithResultsTransformer(query:it\.agilelab\.bigdata\.spark\.search\.Query,maxHits:Int,maxHitsPerIndex:Int)* aggregatingSearch(Query,Int,Int)]], * but returns the ids of the resulting elements. * * @note $ephemeralIDs * @group Search */ override def lightAggregatingSearch(query: Query, maxHits: Int, maxHitsPerIndex: Int): Array[(Long, Double)] = { index.value.searchAny(query, maxHits).toArray } /** Returns an `Array` built by aggregating the `Iterator`s in `result` by repetitively choosing * the top `maxHits` results in descending score order. * * The aggregation is done in a tree-level pattern. * * @see [[org.apache.spark.rdd.RDD#treeAggregate]] */ private def aggregateResults[E](results: RDD[Iterator[(E, Double)]], maxHits: Int): Array[(E, Double)] = { results.treeAggregate(Array[(E, Double)]())( { case (res1, res2) => merge(res1, res2.toArray, maxHits) }, { case (res1, res2) => merge(res1, res2, maxHits) } ) } /** Returns an `RDD` of elements matching the `query`, returning at most `maxHits` results. * * Setting `maxHitsPerIndex` limits the size of intermediate results. It must be a positive value * between `1` and `maxHits` (both inclusive). The (internally handled) default is `maxHits`. * * @note $intermediateResults * @group Search */ override def search(query: Query, maxHits: Int, maxHitsPerIndex: Int): RDD[(T, Double)] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, search it val realIndex = index.value val results = realIndex.searchAny(query, maxHits) // filter elements in this partition val resultsInThisPartition = results filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition resultsInThisPartition map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (elements(elementIndex), score) } } sortResults(results, maxHits) } /** Like [[searchWithResultsTransformer(query:it\.agilelab\.bigdata\.spark\.search\.Query,maxHits:Int,maxHitsPerIndex:Int)* search(Query,Int,Int)]], * but specifying a `resultsTransformer` function to be applied to the result elements. * * @group Search */ override def searchWithResultsTransformer[V](query: DslQuery, maxHits: Int, resultsTransformer: (T) => V, maxHitsPerIndex: Int): RDD[(V, Double)] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, search it val realIndex = index.value val results = realIndex.searchAny(query, maxHits) // filter elements in this partition val resultsInThisPartition = results filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition resultsInThisPartition map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (resultsTransformer(elements(elementIndex)), score) } } sortResults(results, maxHits) } /** Like [[searchWithResultsTransformer(query:it\.agilelab\.bigdata\.spark\.search\.Query,maxHits:Int,maxHitsPerIndex:Int)* search(Query,Int,Int)]], * but returns the ids of the resulting elements. * * @note $ephemeralIDs * @group Search */ override def lightSearch(query: Query, maxHits: Int, maxHitsPerIndex: Int): RDD[(Long, Double)] = { // FIXME this is wasteful, but it's the only easy way to obtain an RDD of element ids... val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, search it val realIndex = index.value val results = realIndex.searchAny(query, maxHits) // filter elements in this partition val resultsInThisPartition = results filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } resultsInThisPartition } sortResults(results, maxHits) } /** Returns an `RDD` of elements matching the `queries`, returning at most `maxHits` results for * each query. * * The queries must be provided with a unique id for each query, as an `Iterator` of `(id, query)` * pairs. The results of each query are returned associated with this unique id as `(id, results)` * pairs in the returned RDD; each `results` is an `Array` of `(element, score)` pairs. * * Setting `maxHitsPerIndex` limits the size of intermediate results. It must be a positive value * between `1` and `maxHits` (both inclusive). The (internally handled) default is `maxHits`. * * @note $intermediateResults * @group Search */ override def batchSearch(queries: Iterable[(Long, DslQuery)], maxHits: Int, maxHitsPerIndex: Int) : RDD[(Long, Array[(T, Double)])] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition val elementResults = resultsInThisPartition map { case (queryId, queryResults) => val queryElementResults = queryResults map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (elements(elementIndex), score) } (queryId, queryElementResults) } elementResults.iterator } aggregateResultsByKey(results, maxHits) } /** Like [[batchSearchWithResultsTransformer(queries:Iterator[(Long,it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery)],maxHits:Int,maxHitsPerIndex:Int)* batchSearch(Iterator[(Long,DslQuery)],Int,Int)]], * but specifying a `resultsTransformer` function to be applied to the result elements. * * @group Search */ override def batchSearchWithResultsTransformer[V](queries: Iterator[(Long, DslQuery)], maxHits: Int, resultsTransformer: (T) => V, maxHitsPerIndex: Int): RDD[(Long, Array[(V, Double)])] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition val elementResults = resultsInThisPartition map { case (queryId, queryResults) => val queryElementResults = queryResults map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (resultsTransformer(elements(elementIndex)), score) } (queryId, queryElementResults) } elementResults } aggregateResultsByKey(results, maxHits) } /** Like [[batchSearchWithResultsTransformer(queries:Iterator[(Long,it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery)],maxHits:Int,maxHitsPerIndex:Int)* batchSearch(Iterator[(Long,DslQuery)],Int,Int)]], * but returns the ids of the resulting elements. * * @note $ephemeralIDs * @group Search */ override def lightBatchSearch(queries: Iterator[(Long, DslQuery)], maxHits: Int, maxHitsPerIndex: Int): RDD[(Long, Array[(Long, Double)])] = { // FIXME this is wasteful, but it's the only easy way to obtain an RDD of element ids... val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } resultsInThisPartition } aggregateResultsByKey(results, maxHits) } /** Like [[batchSearchWithResultsTransformer(queries:Iterator[(Long,it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery)],maxHits:Int,maxHitsPerIndex:Int)* batchSearch(Iterator[(Long,DslQuery)],Int,Int)]], * but uses [[RawQuery]] type queries instead of [[dsl.DslQuery]]. * * @group Search */ override def batchSearchRaw(queries: Iterator[(Long, RawQuery)], maxHits: Int, maxHitsPerIndex: Int): RDD[(Long, Array[(T, Double)])] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition val elementResults = resultsInThisPartition map { case (queryId, queryResults) => val queryElementResults = queryResults map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (elements(elementIndex), score) } (queryId, queryElementResults) } elementResults } aggregateResultsByKey(results, maxHits) } /** Like [[batchSearchWithResultsTransformer[V](queries:Iterator[(Long,it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery)],maxHits:Int,resultsTransformer:T=>V,maxHitsPerIndex:Int)* batchSearch(Iterator[(Long,DslQuery)],Int,T=>V,Int)]], * but uses [[RawQuery]] type queries instead of [[dsl.DslQuery]]. * * @group Search */ override def batchSearchRawWithResultsTransformer[V](queries: Iterator[(Long, RawQuery)], maxHits: Int, resultsTransformer: (T) => V, maxHitsPerIndex: Int): RDD[(Long, Array[(V, Double)])] = { val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } // map elementIds into elements val elements = partition.next() // there's always exactly one array per partition val elementResults = resultsInThisPartition map { case (queryId, queryResults) => val queryElementResults = queryResults map { case (elementId, score) => val elementIndex = (elementId / numPartitions).toInt // cast is safe thanks to elementId's construction (resultsTransformer(elements(elementIndex)), score) } (queryId, queryElementResults) } elementResults } aggregateResultsByKey(results, maxHits) } /** Like [[lightBatchSearch(queries:Iterator[(Long,it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery)],maxHits:Int,maxHitsPerIndex:Int)* lightBatchSearch(Iterator[(Long,DslQuery)],Int,Int)]], * but uses [[RawQuery]] type queries instead of [[dsl.DslQuery]]. * * @group Search */ override def lightBatchSearchRaw(queries: Iterator[(Long, RawQuery)], maxHits: Int, maxHitsPerIndex: Int): RDD[(Long, Array[(Long, Double)])] = { // FIXME this is wasteful, but it's the only easy way to obtain an RDD of element ids... val numPartitions = elementsRDD.getNumPartitions val results = elementsRDD mapPartitionsWithIndex { case (partitionIndex, partition) => // get the index from broadcast variable, run queries against it val realIndex = index.value val results = queries map { case (queryId, query) => (queryId, realIndex.searchAny(query, maxHits)) } // filter elements in this partition val resultsInThisPartition = results map { case (queryId, queryResults) => val queryResultsInThisPartition = queryResults filter { case (elementId, score) => (elementId % numPartitions).toInt == partitionIndex // cast is safe thanks to elementId's construction } (queryId,queryResultsInThisPartition) } resultsInThisPartition } aggregateResultsByKey(results, maxHits) } /** Returns an `RDD` that contains the result of the query join between `this` and `other`. * * A query join is a join in which the predicate is a query. From each element of `other`, a query * is obtained by applying `queryGenerator`. Then each query is ran against `this`, and the * `maxHits` results produced are joined with the element originating the query. * * Queries are executed in batches, with a batch for each partition of `other`. * * @group QueryJoin */ override def queryJoin[U: ClassManifest](other: RDD[U], queryGenerator: (U) => DslQuery, maxHits: Int): RDD[(U, Array[(T, Double)])] = ??? /** Like [[queryJoinWithResultsTransformer[U](other:org\.apache\.spark\.rdd\.RDD[U],queryGenerator:U=>it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery,maxHits:Int)* queryJoin[U](RDD[U],U=>DslQuery,Int)]], * but specifying a `resultsTransformer` function to be applied to the result elements. * * @group QueryJoin */ override def queryJoinWithResultsTransformer[U: ClassManifest, V: ClassManifest](other: RDD[U], queryGenerator: (U) => DslQuery, maxHits: Int, resultsTransformer: (T) => V): RDD[(U, Array[(V, Double)])] = ??? /** Like [[queryJoinWithResultsTransformer[U](other:org\.apache\.spark\.rdd\.RDD[U],queryGenerator:U=>it\.agilelab\.bigdata\.spark\.search\.dsl\.DslQuery,maxHits:Int)* queryJoin[U](RDD[U],U=>DslQuery,Int)]], * but returns the ids of the resulting elements. * * @note $ephemeralIDs * @group QueryJoin */ override def lightQueryJoin[U : ClassManifest](other: RDD[U], queryGenerator: (U) => DslQuery, maxHits: Int): RDD[(U, Array[(Long, Double)])] = ??? /** Generates queries by applying `queryGenerator` to the elements of `elementsWithID`. Queries * are grouped in one batch for each partition. */ private def generateQueries[U](elementsWithId: RDD[(Long, U)], queryGenerator: U => DslQuery) : RDD[Iterator[(Long, DslQuery)]] = { // apply query generation function val queries = elementsWithId map { case (elementId, element) => (elementId, queryGenerator(element)) } // batch queries val queriesBatch = queries.glom() map { array => array.iterator} // set name val parentName = elementsWithId.dependencies.head.rdd.name val queriesRDDName = "Queries" + (if (parentName != null) " (from " + parentName + ")" else "") + f" [${queriesBatch.id}]" queriesBatch.setName(queriesRDDName) queriesBatch } /** Returns the `RDD` obtained by processing `results` by flattening it, then aggregating the results * for each id into a single `Array` of the top `maxHits` results in descending score order. */ private def processResults[V: ClassTag](results: RDD[Iterator[(Long, Iterator[(V, Double)])]], maxHits: Int) : RDD[(Long, Array[(V, Double)])] = { // flatten results val flatResults = results.flatMap(identity(_)) // aggregate flattened results val aggregatedResults = flatResults.aggregateByKey(Array[(V, Double)]())( { case (res1, res2) => merge(res1, res2.toArray, maxHits) }, { case (res1, res2) => merge(res1, res2, maxHits) }) // set name aggregatedResults.setName(f"Search results (aggregated) [${aggregatedResults.id}]") aggregatedResults } /** Returns the RDD produced by joining by id the results in `flatResults` with the elements * originating the queries that produced them in `elementsWithId`. */ private def joinQueriesResults[U: ClassTag, V: ClassTag](elementsWithId: RDD[(Long, U)], flatResults: RDD[(Long, Array[(V, Double)])]) : RDD[(U, Array[(V, Double)])] = { // join elements originating queries with their results via query id val joined = elementsWithId.join(flatResults) // throw id away val joinedNoId = joined map { case (_, elementWithResults) => elementWithResults } // set name joinedNoId.setName(f"Query join result [${joinedNoId.id}]") joinedNoId } /** Returns the element of this `SearchableRDD` with corresponds to the provided `id`, if it exists. */ override def getElement(id: Long): Option[T] = { // the ids are generated with zipWithUniqueIds, therefore we // can easily find out the partition to which id belongs by // calculating id modulo number of partitions val index = (id % elementsRDD.getNumPartitions).toInt // function to process a partition to get the element back val process = (iterator: Iterator[Array[T]]) => { if (iterator.hasNext) { // if there's elements in this partition, there's exactly one, so next().iterator is all we need val array = iterator.next() // get the element val elementIndex = (id / elementsRDD.getNumPartitions).toInt // cast is safe thanks to elementId's construction Some(array(elementIndex)) } else { // there's an empty partition, which should never happen; throw exception throw new NoSuchElementException("Empty partition: no IndexedPartition found in partition " + index + "while looking for id " + id + "!") } } : Option[T] // run a job against the partition containing id, return the first and only result val res = this.context.runJob[Array[T], Option[T]](elementsRDD, process, Array(index)) res(0) } /** Like [[getElement(id:Long)* getElement(Long)]], but for an `Array` of ids. */ override def getElements(ids: Array[Long]): Array[(Long, Option[T])] = { // get a set of ids for fast matching val idSet = ids.toSet // the ids are generated with zipWithUniqueIds, therefore we // can easily find out the partition to which id belongs by // calculating id modulo number of partitions val numPartitions = elementsRDD.getNumPartitions val partitionIndices = idSet.map(_ % numPartitions).toArray val results = elementsRDD.mapPartitionsWithIndex { case (partitionIndex, elements) => { // get the subset of ids that are in this partition val partitionIdSet = idSet.filter(_ % numPartitions == partitionIndex) // there's exactly one array per partition val array = elements.next() // get the elements that actually exist and the ids of those that don't val (existent, nonExistent) = partitionIdSet.partition(elementId => elementId / numPartitions < array.length) val results = existent.iterator.map(elementId => (elementId, array((elementId / numPartitions).toInt))) // toInt is safe because of how elementId is constructed // map results to some, the rest to none results.map { case (elId, el) => (elId, Some(el)) } ++ nonExistent.map((_, None)) } } results.collect() } override def getDocumentCounts: Map[String, Long] = index.value.getDocumentCounts override def getTermCounts: Map[String, Map[String, Long]] = index.value.getTermCounts override def getTermIDFs: Map[String, Map[String, Float]] = index.value.getTermIDFs override def getIndicesInfo: IndicesInfo = { val indexInfo = index.value.getIndexInfo val totDocs = indexInfo.numDocuments.toLong val totBytes = indexInfo.sizeBytes IndicesInfo(1, totDocs, totBytes, List(indexInfo)) } /* =============================================================================================== =============================================================================================== RDD methods implementations =============================================================================================== =============================================================================================== */ @DeveloperApi override def compute(split: Partition, context: TaskContext): Iterator[T] = { val splitIterator = firstParent[IndexedPartition[T]].iterator(split, context) if (splitIterator.hasNext) { // if there's elements in this partition, there's exactly one, so next().iterator is all we need splitIterator.next().iterator } else { // there's an empty partition, which should never happen; throw exception throw new NoSuchElementException("Empty partition: no IndexedPartition found in partition " + split.index + "!") } } override protected def getPartitions: Array[Partition] = elementsRDD.partitions override def persist(newLevel: StorageLevel): BroadcastIndexLuceneRDD.this.type = { elementsRDD.persist(newLevel) this } override def unpersist(blocking: Boolean = true): BroadcastIndexLuceneRDD.this.type = { elementsRDD.unpersist(blocking) index.unpersist(blocking) this } } object BroadcastIndexLuceneRDD { import LuceneIndexedPartition.indexable2LuceneDocument import LuceneIndexedPartition.buildIndexWriterConfig import PartitionsIndexLuceneRDD.ElementId def apply[T](inputRDD: RDD[T], config: LuceneConfig = LuceneConfig.defaultConfig()) (implicit ct: ClassTag[T], toIndexable: T => Indexable): BroadcastIndexLuceneRDD[T] = { val numParts = inputRDD.partitions.length // build data RDD val dataRDD = inputRDD.zipWithUniqueId() // build indices val indicesRDD = dataRDD.mapPartitions(part => Iterator(createIndex(part, config, numParts))).setName("Indices") // treeaggregate indices val redOp = (index1: BigChunksRAMDirectory, index2: BigChunksRAMDirectory) => { // prepare new index/directory val newDirectory = new BigChunksRAMDirectory() val indexWriterConfig = buildIndexWriterConfig(config) val indexWriter = new IndexWriter(newDirectory, indexWriterConfig) // add old indices indexWriter.addIndexes(index1, index2) // compact index to one segment, commit & close indexWriter.getConfig.setUseCompoundFile(true) if (config.getCompactIndex) indexWriter.forceMerge(1, true) indexWriter.close() // return new directory newDirectory } val indexDirectory = indicesRDD.treeReduce(redOp) // create index val index = LuceneIndex(indexDirectory, config) // broadcast index val sc = indicesRDD.sparkContext val broadcastIndex = sc.broadcast(index) // create elements[] RDD val elementsRDD = dataRDD.map(_._1).glom() // create new BroadcastIndexLuceneRDD[T](broadcastIndex, elementsRDD) } private def createIndex[T](zippedElements: Iterator[(T, Long)], config: LuceneConfig, numParts: Int) (implicit ct: ClassTag[T], toIndexable: T => Indexable) = { // create Lucene Directory and IndexWriter according to config val directory = new BigChunksRAMDirectory() val indexWriterConfig = buildIndexWriterConfig(config) val indexWriter = new IndexWriter(directory, indexWriterConfig) // index elements for (zippedElement <- zippedElements) { val (element, id) = zippedElement val document = indexable2LuceneDocument(element) document.add(new StoredField(ElementId, id)) indexWriter.addDocument(document) } // compact index to one segment, commit & close indexWriter.getConfig.setUseCompoundFile(true) if (config.getCompactIndex) indexWriter.forceMerge(1, true) indexWriter.close() directory } }
{ "content_hash": "41d9e04421af1958ab90e6e0a92923c7", "timestamp": "", "source": "github", "line_count": 704, "max_line_length": 238, "avg_line_length": 43.46022727272727, "alnum_prop": 0.6886194273761276, "repo_name": "agile-lab-dev/sparksearchengine", "id": "e677bbd2dbd4c1a978322313772a963a8af2d44a", "size": "30596", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/it/agilelab/bigdata/spark/search/impl/BroadcastIndexLuceneRDD.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "75317" }, { "name": "Scala", "bytes": "194178" }, { "name": "Shell", "bytes": "1242" } ], "symlink_target": "" }
#ifndef PEGR_SHORENDERER_HPP #define PEGR_SHORENDERER_HPP #ifdef PGG_OPENGL #include "pegr/video/ShoRendererOpenGL.hpp" #endif #ifdef PGG_VULKAN #include "pegr/video/ShoRendererVulkan.hpp" #endif #endif // PEGR_SHORENDERER_HPP
{ "content_hash": "edc263e2e5da6aa2b0c6f965a28fa3db", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 43, "avg_line_length": 16.571428571428573, "alnum_prop": 0.7801724137931034, "repo_name": "Naftoreiclag/PepperGrains", "id": "27fd59afcfba5c65fbece15756a3c1545262c329", "size": "835", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/pegr/video/ShoRenderer.hpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "885333" }, { "name": "Lua", "bytes": "310" } ], "symlink_target": "" }
package cn.dreampie.common.http; import cn.dreampie.common.Constant; import cn.dreampie.common.http.result.HttpStatus; import cn.dreampie.common.util.properties.Prop; import cn.dreampie.common.util.properties.Proper; import cn.dreampie.log.Logger; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * Created by Dreampie on 2016/11/9. */ public class HttpMessage { private final static Logger logger = Logger.getLogger(Constant.class); public static final String OK = "ok"; public static final String CREATED = "created"; public static final String ACCEPTED = "accepted"; public static final String NOT_MODIFIED = "notModified"; public static final String BAD_REQUEST = "badRequest"; public static final String UNAUTHORIZED = "unauthorized"; public static final String FORBIDDEN = "forbidden"; public static final String NOT_FOUND = "notFound"; public static final String API_NOT_FOUND = "apiNotFound"; public static final String NOT_ACCEPTABLE = "notAcceptable"; public static final String METHOD_NOT_ALLOWED = "methodNotAllowed"; public static final String UNSUPPORTED_MEDIA_TYPE = "unsupportedMediaType"; public static final String UNPROCESSABLE_ENTITY = "unprocessableEntity"; public static final String GONE = "gone"; public static final String INTERNAL_SERVER_ERROR = "internalServerError"; public static final String SERVICE_UNAVAILABLE = "serviceUnavailable"; public static final String TOO_MANY_REQUESTS = "tooManyRequests"; public static final String REQUEST_ENTITY_TOO_LARGE = "requestEntityTooLarge"; //logic error public static final String HEADER_NOT_MATCH = "headerNotMatch"; public static final String FILE_UPLOAD_ERROR = "fileUploadError"; public static final String FILE_DOWNLOAD_ERROR = "fileDownloadError"; public static final String CORS_FAILED = "CORSFailed"; public static final String USERNAME_NOT_FOUND = "usernameNotFound"; public static final String PASSWORD_ERROR = "passwordError"; private static final Map<String, String> messages = new HashMap<String, String>(); private static final Map<String, HttpStatus> status = new HashMap<String, HttpStatus>() {{ put(OK, HttpStatus.OK); put(CREATED, HttpStatus.CREATED); put(ACCEPTED, HttpStatus.ACCEPTED); put(NOT_MODIFIED, HttpStatus.NOT_MODIFIED); put(BAD_REQUEST, HttpStatus.BAD_REQUEST); put(UNAUTHORIZED, HttpStatus.UNAUTHORIZED); put(FORBIDDEN, HttpStatus.FORBIDDEN); put(NOT_FOUND, HttpStatus.NOT_FOUND); put(API_NOT_FOUND, HttpStatus.NOT_FOUND); put(NOT_ACCEPTABLE, HttpStatus.NOT_ACCEPTABLE); put(METHOD_NOT_ALLOWED, HttpStatus.METHOD_NOT_ALLOWED); put(UNSUPPORTED_MEDIA_TYPE, HttpStatus.UNSUPPORTED_MEDIA_TYPE); put(UNPROCESSABLE_ENTITY, HttpStatus.UNPROCESSABLE_ENTITY); put(GONE, HttpStatus.GONE); put(INTERNAL_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR); put(SERVICE_UNAVAILABLE, HttpStatus.SERVICE_UNAVAILABLE); put(TOO_MANY_REQUESTS, HttpStatus.TOO_MANY_REQUESTS); put(REQUEST_ENTITY_TOO_LARGE, HttpStatus.REQUEST_ENTITY_TOO_LARGE); //logic error put(HEADER_NOT_MATCH, HttpStatus.NOT_ACCEPTABLE); put(FILE_UPLOAD_ERROR, HttpStatus.INTERNAL_SERVER_ERROR); put(FILE_DOWNLOAD_ERROR, HttpStatus.INTERNAL_SERVER_ERROR); put(CORS_FAILED, HttpStatus.FORBIDDEN); put(USERNAME_NOT_FOUND, HttpStatus.UNPROCESSABLE_ENTITY); put(PASSWORD_ERROR, HttpStatus.UNPROCESSABLE_ENTITY); }}; static { Prop constants = null; try { constants = Proper.use("application.properties"); } catch (Exception e) { logger.warn(e.getMessage()); } messages.put(OK, "执行成功."); messages.put(CREATED, "创建成功."); messages.put(ACCEPTED, "接收并异步处理."); messages.put(NOT_MODIFIED, "没有更新."); messages.put(BAD_REQUEST, "客户端请求错误."); messages.put(UNAUTHORIZED, "未登录."); messages.put(FORBIDDEN, "拒绝访问."); messages.put(NOT_FOUND, "访问资源不存在."); messages.put(API_NOT_FOUND, "访问接口不存在."); messages.put(NOT_ACCEPTABLE, "不能接受的请求."); messages.put(METHOD_NOT_ALLOWED, "请求方法不支持."); messages.put(UNSUPPORTED_MEDIA_TYPE, "请求数据类型不支持."); messages.put(UNPROCESSABLE_ENTITY, "请求参数错误."); messages.put(GONE, "接口已经失效."); messages.put(INTERNAL_SERVER_ERROR, "服务器错误."); messages.put(SERVICE_UNAVAILABLE, "服务不可访问."); messages.put(TOO_MANY_REQUESTS, "请求次数超过限制."); messages.put(REQUEST_ENTITY_TOO_LARGE, "请求内容超过大小限制."); //logic error messages.put(HEADER_NOT_MATCH, "不支持该请求的头信息."); messages.put(FILE_UPLOAD_ERROR, "文件上传失败."); messages.put(FILE_DOWNLOAD_ERROR, "文件下载失败."); messages.put(CORS_FAILED, "跨域请求失败."); messages.put(USERNAME_NOT_FOUND, "用户名不存在."); messages.put(PASSWORD_ERROR, "密码错误."); if (constants != null) { Set<String> keys = constants.getKeys(); for (String key : keys) { if (key.startsWith("http.")) { String useKey = key.split("\\.")[2]; if (key.startsWith("http.status.")) { HttpStatus oldStatus = status.get(useKey); if (oldStatus != null) { status.put(useKey, HttpStatus.havingCode(constants.getInt(key, oldStatus.getCode()))); } else { status.put(useKey, HttpStatus.havingCode(constants.getInt(key))); } } if (key.startsWith("http.messages.")) { messages.put(useKey, constants.get(key, messages.get(key))); } } } } } public static String getMessage(String key) { return messages.get(key); } public static HttpStatus getStatus(String key) { return status.get(key); } }
{ "content_hash": "2b952b43a8c233d8c72737dacc93d3ff", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 100, "avg_line_length": 39.92198581560284, "alnum_prop": 0.7008349618049388, "repo_name": "SeaYellow/neo4j-demo", "id": "1f35ca0c22baa30033c0c6040bb1f1dbb97f33b5", "size": "5927", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/cn/dreampie/common/http/HttpMessage.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "616551" }, { "name": "HTML", "bytes": "510647" }, { "name": "Java", "bytes": "290006" }, { "name": "JavaScript", "bytes": "4853051" } ], "symlink_target": "" }
import layout from '../../../templates/components/light-table/columns/base-with-filter' import ColumnsBase from 'ember-light-table/components/columns/base' export default ColumnsBase.extend({ layout, classNames: ['lt-column', 'nowrap'] })
{ "content_hash": "5ad8bb9e871cc45c577f572129c36c82", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 87, "avg_line_length": 34.857142857142854, "alnum_prop": 0.75, "repo_name": "gte451f/ember-cli-table-pagination", "id": "18546d4f840f4021ee99a8abdf250ad6b8041f08", "size": "244", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "addon/components/light-table/columns/base-with-filter.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3350" }, { "name": "HTML", "bytes": "33751" }, { "name": "JavaScript", "bytes": "103096" } ], "symlink_target": "" }
import json from django.conf import settings from django.test import TestCase from requests import Response from mock import patch from .ripple_api import trust_set, RippleApiError sequence = 12 destination_account = u'rJobmmpNqozqY7MzwGkRs1VLEBJ7H5Pjrp' wrong_secret = "somesecret" data = { u"engine_result": u"tesSUCCESS", u"engine_result_code": 0, u"engine_result_message": (u"The transaction was applied. Only final " + u"in a validated ledger."), u"status": u"success", u"tx_blob": u"-- hexBinary data --", u"tx_json": { u"Account": settings.RIPPLE_ACCOUNT, u"Fee": u"10000", u"Flags": 262144, u"LimitAmount": { u"currency": u"USD", u"issuer": destination_account, u"value": u"1" }, u"Sequence": sequence, u"SigningPubKey": u"-- hexBinary data of SigningPubKey --", u"TransactionType": u"TrustSet", u"TxnSignature": u"-- hexBinary data of TxnSignature --", u"hash": u"-- hexBinary data of hash --" } } error_data = { u"error": "badSecret", u"error_code": 39, u"error_message": "Secret does not match account.", u"request": { u"command": u"submit", u"secret": wrong_secret, u"tx_json": { u"Account": settings.RIPPLE_ACCOUNT, u"Fee": "10000", u"Flags": 262144, u"LimitAmount": { u"currency": "USD", u"issuer": destination_account, u"value": "1" }, u"TransactionType": "TrustSet" } }, u"status": "error" } class TrustSetTestCase(TestCase): def setUp(self): pass @patch('requests.post') def test_trust_set_error(self, post_mock): """Test if RippleApiError raised in case when secret is wrong""" response = Response() response._content = json.dumps({u"result": error_data}) post_mock.return_value = response exp_msg = u'39: badSecret. Secret does not match account.' with self.assertRaisesMessage(RippleApiError, exp_msg): trust_set( settings.RIPPLE_ACCOUNT, wrong_secret, destination_account, 1, u"USD", flags={"AllowRipple": False, "Freeze": True} ) @patch('requests.post') def test_trust_set_success(self, post_mock): response = Response() response._content = json.dumps({u"result": data}) post_mock.return_value = response result = trust_set( settings.RIPPLE_ACCOUNT, settings.RIPPLE_SECRET, destination_account, 1, u"USD", flags={"AllowRipple": True} ) self.assertDictEqual(result, data)
{ "content_hash": "7b6cfaa84006b3631bc884b26c860ba0", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 76, "avg_line_length": 29.378947368421052, "alnum_prop": 0.5689716947330706, "repo_name": "nitr0man/ripple_api", "id": "40aab71c86cb50ed520f27b891296d6ff9c561b5", "size": "2815", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ripple_api/test_trust.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "92209" } ], "symlink_target": "" }
flask prose is an extension to generate various kinds of prose from a corpus of text. basically you upload a largish text file with unique text and out comes prose. from there you can explore the how composed text can be expressed as randomized prose. the extention exposes a set of endpoints that can be used to authenticate, upload, and get prose there are no web templates invoved just regular json requests there is a facility to vote for your favorite prose via grock. ## api enpoints /corpora/<uuid> - GET, POST, DELETE /prose - GET /grock - PUT ### setup pip install flask-prose ### configuration database restapi endpoints ### documention ### future * adding more types of prose with a higher level of composition. * nltk offers access to word classification for purposes of rhyming. * scraping external urls for content * admin classes for flask-admin
{ "content_hash": "94f066f59b66ab4aeffd629f3d202793", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 96, "avg_line_length": 24.47222222222222, "alnum_prop": 0.7673098751418842, "repo_name": "slippers/Flask-Prose", "id": "dcd04e97f7493c8552bba29afda1427b08344b7a", "size": "896", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "55560" }, { "name": "Shell", "bytes": "1224" } ], "symlink_target": "" }
package com.ctrip.zeus.dao.entity; import java.util.ArrayList; import java.util.Date; import java.util.List; public class SlbConfSlbVersionExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; protected Integer offset; protected Integer rows; public SlbConfSlbVersionExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public SlbConfSlbVersionExample orderBy(String orderByClause) { this.setOrderByClause(orderByClause); return this; } public SlbConfSlbVersionExample orderBy(String ... orderByClauses) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < orderByClauses.length; i++) { sb.append(orderByClauses[i]); if (i < orderByClauses.length - 1) { sb.append(" , "); } } this.setOrderByClause(sb.toString()); return this; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(this); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; rows = null; offset = null; } public void setOffset(Integer offset) { this.offset = offset; } public Integer getOffset() { return this.offset; } public void setRows(Integer rows) { this.rows = rows; } public Integer getRows() { return this.rows; } public SlbConfSlbVersionExample limit(Integer rows) { this.rows = rows; return this; } public SlbConfSlbVersionExample limit(Integer offset, Integer rows) { this.offset = offset; this.rows = rows; return this; } public SlbConfSlbVersionExample page(Integer page, Integer pageSize) { this.offset = page * pageSize; this.rows = pageSize; return this; } public static Criteria newAndCreateCriteria() { SlbConfSlbVersionExample example = new SlbConfSlbVersionExample(); return example.createCriteria(); } public SlbConfSlbVersionExample when(boolean condition, IExampleWhen then) { if (condition) { then.example(this); } return this; } public SlbConfSlbVersionExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) { if (condition) { then.example(this); } else { otherwise.example(this); } return this; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andSlbIdIsNull() { addCriterion("slb_id is null"); return (Criteria) this; } public Criteria andSlbIdIsNotNull() { addCriterion("slb_id is not null"); return (Criteria) this; } public Criteria andSlbIdEqualTo(Long value) { addCriterion("slb_id =", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdNotEqualTo(Long value) { addCriterion("slb_id <>", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdNotEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdGreaterThan(Long value) { addCriterion("slb_id >", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdGreaterThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdGreaterThanOrEqualTo(Long value) { addCriterion("slb_id >=", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdGreaterThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdLessThan(Long value) { addCriterion("slb_id <", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdLessThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdLessThanOrEqualTo(Long value) { addCriterion("slb_id <=", value, "slbId"); return (Criteria) this; } public Criteria andSlbIdLessThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("slb_id <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andSlbIdIn(List<Long> values) { addCriterion("slb_id in", values, "slbId"); return (Criteria) this; } public Criteria andSlbIdNotIn(List<Long> values) { addCriterion("slb_id not in", values, "slbId"); return (Criteria) this; } public Criteria andSlbIdBetween(Long value1, Long value2) { addCriterion("slb_id between", value1, value2, "slbId"); return (Criteria) this; } public Criteria andSlbIdNotBetween(Long value1, Long value2) { addCriterion("slb_id not between", value1, value2, "slbId"); return (Criteria) this; } public Criteria andPreviousVersionIsNull() { addCriterion("previous_version is null"); return (Criteria) this; } public Criteria andPreviousVersionIsNotNull() { addCriterion("previous_version is not null"); return (Criteria) this; } public Criteria andPreviousVersionEqualTo(Long value) { addCriterion("previous_version =", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionNotEqualTo(Long value) { addCriterion("previous_version <>", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionNotEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionGreaterThan(Long value) { addCriterion("previous_version >", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionGreaterThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionGreaterThanOrEqualTo(Long value) { addCriterion("previous_version >=", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionGreaterThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionLessThan(Long value) { addCriterion("previous_version <", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionLessThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionLessThanOrEqualTo(Long value) { addCriterion("previous_version <=", value, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionLessThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("previous_version <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPreviousVersionIn(List<Long> values) { addCriterion("previous_version in", values, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionNotIn(List<Long> values) { addCriterion("previous_version not in", values, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionBetween(Long value1, Long value2) { addCriterion("previous_version between", value1, value2, "previousVersion"); return (Criteria) this; } public Criteria andPreviousVersionNotBetween(Long value1, Long value2) { addCriterion("previous_version not between", value1, value2, "previousVersion"); return (Criteria) this; } public Criteria andCurrentVersionIsNull() { addCriterion("current_version is null"); return (Criteria) this; } public Criteria andCurrentVersionIsNotNull() { addCriterion("current_version is not null"); return (Criteria) this; } public Criteria andCurrentVersionEqualTo(Long value) { addCriterion("current_version =", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionNotEqualTo(Long value) { addCriterion("current_version <>", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionNotEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionGreaterThan(Long value) { addCriterion("current_version >", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionGreaterThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionGreaterThanOrEqualTo(Long value) { addCriterion("current_version >=", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionGreaterThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionLessThan(Long value) { addCriterion("current_version <", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionLessThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionLessThanOrEqualTo(Long value) { addCriterion("current_version <=", value, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionLessThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("current_version <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andCurrentVersionIn(List<Long> values) { addCriterion("current_version in", values, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionNotIn(List<Long> values) { addCriterion("current_version not in", values, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionBetween(Long value1, Long value2) { addCriterion("current_version between", value1, value2, "currentVersion"); return (Criteria) this; } public Criteria andCurrentVersionNotBetween(Long value1, Long value2) { addCriterion("current_version not between", value1, value2, "currentVersion"); return (Criteria) this; } public Criteria andDatachangeLasttimeIsNull() { addCriterion("DataChange_LastTime is null"); return (Criteria) this; } public Criteria andDatachangeLasttimeIsNotNull() { addCriterion("DataChange_LastTime is not null"); return (Criteria) this; } public Criteria andDatachangeLasttimeEqualTo(Date value) { addCriterion("DataChange_LastTime =", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeNotEqualTo(Date value) { addCriterion("DataChange_LastTime <>", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeNotEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeGreaterThan(Date value) { addCriterion("DataChange_LastTime >", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeGreaterThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeGreaterThanOrEqualTo(Date value) { addCriterion("DataChange_LastTime >=", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeGreaterThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeLessThan(Date value) { addCriterion("DataChange_LastTime <", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeLessThanColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeLessThanOrEqualTo(Date value) { addCriterion("DataChange_LastTime <=", value, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeLessThanOrEqualToColumn(SlbConfSlbVersion.Column column) { addCriterion(new StringBuilder("DataChange_LastTime <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andDatachangeLasttimeIn(List<Date> values) { addCriterion("DataChange_LastTime in", values, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeNotIn(List<Date> values) { addCriterion("DataChange_LastTime not in", values, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeBetween(Date value1, Date value2) { addCriterion("DataChange_LastTime between", value1, value2, "datachangeLasttime"); return (Criteria) this; } public Criteria andDatachangeLasttimeNotBetween(Date value1, Date value2) { addCriterion("DataChange_LastTime not between", value1, value2, "datachangeLasttime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { private SlbConfSlbVersionExample example; protected Criteria(SlbConfSlbVersionExample example) { super(); this.example = example; } public SlbConfSlbVersionExample example() { return this.example; } @Deprecated public Criteria andIf(boolean ifAdd, ICriteriaAdd add) { if (ifAdd) { add.add(this); } return this; } public Criteria when(boolean condition, ICriteriaWhen then) { if (condition) { then.criteria(this); } return this; } public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) { if (condition) { then.criteria(this); } else { otherwise.criteria(this); } return this; } @Deprecated public interface ICriteriaAdd { Criteria add(Criteria add); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } public interface ICriteriaWhen { void criteria(Criteria criteria); } public interface IExampleWhen { void example(com.ctrip.zeus.dao.entity.SlbConfSlbVersionExample example); } }
{ "content_hash": "2a43899d2fc79ea99761a1a55348723f", "timestamp": "", "source": "github", "line_count": 771, "max_line_length": 120, "avg_line_length": 35.42153047989624, "alnum_prop": 0.5962651043573782, "repo_name": "ctripcorp/zeus", "id": "a8b076c30e2d7a1266324ff35bc4f0e3453e734d", "size": "27310", "binary": false, "copies": "2", "ref": "refs/heads/github_dev", "path": "slb/src/main/java/com/ctrip/zeus/dao/entity/SlbConfSlbVersionExample.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "382246" }, { "name": "HTML", "bytes": "4863323" }, { "name": "Java", "bytes": "7021959" }, { "name": "JavaScript", "bytes": "16419023" }, { "name": "Shell", "bytes": "11922" }, { "name": "TSQL", "bytes": "136343" } ], "symlink_target": "" }
import crossSpawn from 'cross-spawn'; export default function spawn(command, args, std={}) { return function() { return crossSpawn.sync(command, args, Object.assign({ stdio: [std.stdin||process.stdin, std.stdout||process.stdout, std.stderr||"inherit"] }, std||{})); } }
{ "content_hash": "8ed9dd852915bf1bd2e79269966867e9", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 91, "avg_line_length": 32.333333333333336, "alnum_prop": 0.6632302405498282, "repo_name": "morulus/erector", "id": "9f3ad433fb2303e1cc7945c8396d62bc9c01323e", "size": "291", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/env/operators/spawn.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "JavaScript", "bytes": "8992" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <SAXEvents> <startDocument/> <processingInstruction> <target>_൅</target> <data>an&#x20;only&#x20;legal&#x20;per&#x20;5th&#x20;edition&#x20;char&#x20;#x0d45&#xA;&#x20;in&#x20;PITarget&#x20;</data> </processingInstruction> <startElement> <namespaceURI/> <localName>animal</localName> <qualifiedName>animal</qualifiedName> <attributes/> </startElement> <endElement> <namespaceURI/> <localName>animal</localName> <qualifiedName>animal</qualifiedName> </endElement> <endDocument/> </SAXEvents>
{ "content_hash": "88b942ecf2d75bd7755a9794dc3da14d", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 126, "avg_line_length": 29, "alnum_prop": 0.6775862068965517, "repo_name": "reznikmm/matreshka", "id": "6bb1ad5de0be0a00381f29b15758c2b7de21ea82", "size": "582", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "testsuite/xml/xmlconf-expected-sax/eduni/errata-4e/ibm87n58.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Ada", "bytes": "77822094" }, { "name": "C", "bytes": "50705" }, { "name": "CSS", "bytes": "2253" }, { "name": "HTML", "bytes": "780653" }, { "name": "JavaScript", "bytes": "24113" }, { "name": "Lex", "bytes": "117165" }, { "name": "Makefile", "bytes": "27341" }, { "name": "Perl", "bytes": "4796" }, { "name": "Python", "bytes": "10482" }, { "name": "Roff", "bytes": "13069" }, { "name": "Shell", "bytes": "3034" }, { "name": "TeX", "bytes": "116491" }, { "name": "XSLT", "bytes": "6108" }, { "name": "Yacc", "bytes": "96865" } ], "symlink_target": "" }
const arccore = require("@encapsule/arccore"); const httpIntegrationFiltersFactoryRequestSpec = require("./iospecs/http-integration-filters-factory-request-spec"); const httpIntegrationFiltersFactoryResultSpec = require("./iospecs/http-integration-filters-factory-result-spec"); const httpServerAgentResultSpec = require("./iospecs/http-server-agent-result-spec"); const httpRequestDescriptorSpec = require("./iospecs/http-service-filter-request-descriptor-spec"); var factoryResponse = arccore.filter.create({ operationID: "-vrBoPbbRYqzTbV3YdYdug", operationName: "HTTP Server Integration Filters Factory", operationDescription: "Constructs a collection of filter objects that wrap developer-defined accessor and action functions " + "required by a HTTP server and service filters.", inputFilterSpec: httpIntegrationFiltersFactoryRequestSpec, outputFilterSpec: httpIntegrationFiltersFactoryResultSpec, bodyFunction: function(request_) { var response = { error: null, result: null }; var errors = []; var inBreakScope = false; while (!inBreakScope) { inBreakScope = true; // ---------------------------------------------------------------------- // Instantiate organization metadata accessor filter // ---------------------------------------------------------------------- const getOrgMetadataFilterMoniker = "Org Metadata Accessor"; const getOrgMetadataFilterName = request_.name + "::" + getOrgMetadataFilterMoniker; const getOrgMetadataFilterDescription = "Retrieves metadata pertinent to the organization running this webserver."; const getOrgMetadataFilterID = arccore.identifier.irut.fromReference(request_.filter_id_seed + getOrgMetadataFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: getOrgMetadataFilterID, operationName: getOrgMetadataFilterName, operationDescription: getOrgMetadataFilterDescription, inputFilterSpec: { ____label: "Organization Metadata Request", ____description: "Data passed by an HTTP server filter to obtain data about the organization running this webserver.", ____types: "jsObject", appStateContext: httpIntegrationFiltersFactoryRequestSpec.appStateContext }, outputFilterSpec: request_.integrations.metadata.org.get.outputFilterSpec, bodyFunction: request_.integrations.metadata.org.get.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + getOrgMetadataFilterName + " integration filter."); break; } const getOrgMetadataFilter = innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate site metadata accessor filter // ---------------------------------------------------------------------- const getSiteMetadataFilterMoniker = "Site Metadata Accessor"; const getSiteMetadataFilterName = request_.name + "::" + getSiteMetadataFilterMoniker; const getSiteMetadataFilterDescription = "Retrieves metadata pertinent to the website being served by this webserver."; const getSiteMetadataFilterID = arccore.identifier.irut.fromReference(request_.filter_id_seed + getSiteMetadataFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: getSiteMetadataFilterID, operationName: getSiteMetadataFilterName, operationDescription: getSiteMetadataFilterDescription, inputFilterSpec: { ____label: "Site Metadata Request", ____description: "Data passed by an HTTP server filter to obtain data about the website being served by this webserver.", ____types: "jsObject", appStateContext: httpIntegrationFiltersFactoryRequestSpec.appStateContext }, outputFilterSpec: request_.integrations.metadata.site.get.outputFilterSpec, bodyFunction: request_.integrations.metadata.site.get.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + getSiteMetadataFilterName + " integration filter."); break; } const getSiteMetadataFilter = innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate page metadata accessor filter // ---------------------------------------------------------------------- const getPageMetadataFilterMoniker = "Page Metadata Accessor"; const getPageMetadataFilterName = request_.name + "::" + getPageMetadataFilterMoniker; const getPageMetadataFilterDescription = "Retrieves metadata pertinent to a specific page being served by this webserver."; const getPageMetadataFilterID = arccore.identifier.irut.fromReference(request_.filter_id_seed + getPageMetadataFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: getPageMetadataFilterID, operationName: getPageMetadataFilterName, operationDescription: getPageMetadataFilterDescription, inputFilterSpec: { ____label: "Site Metadata Request", ____description: "Request for a copy of the site's metadata descriptor.", ____types: "jsObject", http_code: { ____label: "HTTP Status Code", ____description: "HTTP response code associated with this query. Used by the app-specific filter to redirect e.g. errors.", ____accept: "jsNumber", ____defaultValue: 200 }, resource_uri: { ____label: "Page URI", ____description: "The URI of the page to retrieve metadata for. This corresponds to the pathname portion of the HTTP " + "request URL.", ____accept: "jsString" }, appStateContext: httpIntegrationFiltersFactoryRequestSpec.appStateContext }, outputFilterSpec: request_.integrations.metadata.page.get.outputFilterSpec, bodyFunction: request_.integrations.metadata.page.get.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + getPageMetadataFilterName + " integration filter."); break; } const getPageMetadataFilter = innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate user identity accessor filter // ---------------------------------------------------------------------- const getUserIdentityMetadataFilterMoniker = "User Identity Accessor"; const getUserIdentityMetadataFilterName = request_.name + "::" + getUserIdentityMetadataFilterMoniker; const getUserIdentityMetadataFilterDescription = "Retrieves unaunthenicated user identity from incoming HTTP request."; const getUserIdentityMetadataFilterID = arccore.identifier.irut.fromReference(request_.filter_id_seed + getUserIdentityMetadataFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: getUserIdentityMetadataFilterID, operationName: getUserIdentityMetadataFilterName, operationDescription: getUserIdentityMetadataFilterDescription, inputFilterSpec: { ____label: "Get User Identity Request", ____description: "Information provided about an incoming request by the HTTP server filter.", ____types: "jsObject", request_descriptor: httpRequestDescriptorSpec, appStateContext: httpIntegrationFiltersFactoryRequestSpec.appStateContext }, outputFilterSpec: request_.integrations.metadata.user.get_identity.outputFilterSpec, bodyFunction: request_.integrations.metadata.user.get_identity.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + getUserIdentityMetadataFilterName + " integration filter."); break; } const getUserIdentityMetadataFilter= innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate user session accessor filter // ---------------------------------------------------------------------- const getUserSessionMetadataFilterMoniker = "User Session Accessor"; const getUserSessionMetadataFilterName = request_.name + "::" + getUserSessionMetadataFilterMoniker; const getUserSessionMetadataFilterDescription = "Authenicates a user/session identification assertion and returns the user's current session data."; const getUserSessionMetadataFilterID = arccore.identifier.irut.fromReference( request_.filter_id_seed + getUserSessionMetadataFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: getUserSessionMetadataFilterID, operationName: getUserSessionMetadataFilterName, operationDescription: getUserSessionMetadataFilterDescription, // TODO: Tighten this up once baseline requirements are clear. inputFilterSpec: { ____label: "Get User Session Request", ____description: "Authenicate and get the user's current session profile data.", ____accept: "jsObject" }, outputFilterSpec: { ____accept: "jsUndefined" }, bodyFunction: request_.integrations.metadata.user.get_session.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + getUserSessionMetadataFilterName); break; } const getUserSessionMetadataFilter= innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate user session accessor filter::response result // ---------------------------------------------------------------------- const normalizeUserSessionResultFilterMoniker = "User Session Result"; const normalizeUserSessionResultFilterName = request_.name + "::" + normalizeUserSessionResultFilterMoniker; const normalizeUserSessionResultFilterDescription = "Verifies/normalizes the format of a user session descriptor object."; const normalizeUserSessionResultFilterID = arccore.identifier.irut.fromReference( request_.filter_id_seed + normalizeUserSessionResultFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: normalizeUserSessionResultFilterID, operationName: normalizeUserSessionResultFilterName, operationDescription: normalizeUserSessionResultFilterDescription, inputFilterSpec: { ____label: "User Session Descriptor", ____description: "User session data descriptor object.", ____types: "jsObject", ____defaultValue: {}, identity: request_.integrations.metadata.user.get_identity.outputFilterSpec, data: request_.integrations.metadata.user.get_session.response.result_spec }, bodyFunction: function(request_) { console.log("..... " + this.operationID + "::" + this.operationName); console.log(JSON.stringify(request_)); return { error: null, result: request_ }; } }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attemping to instantiate " + normalizeUserSessionResultFilterName); break; } const normalizeUserSessionResultFilter = innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate user session accessor filter:: response error // ---------------------------------------------------------------------- const normalizeUserSessionErrorFilterMoniker = "User Session Error"; const normalizeUserSessionErrorFilterName = request_.name + "::" + normalizeUserSessionErrorFilterMoniker; const normalizeUserSessionErrorFilterDescription = "Verifies/normalizes the format of a user session error report."; const normalizeUserSessionErrorFilterID = arccore.identifier.irut.fromReference( request_.filter_id_seed + normalizeUserSessionErrorFilterMoniker).result; innerFactoryResponse = arccore.filter.create({ operationID: normalizeUserSessionErrorFilterID, operationName: normalizeUserSessionErrorFilterName, operationDescription: normalizeUserSessionErrorFilterDescription, inputFilterSpec: { ____label: "User Session Error Report", ____description: "A string indicating the fatal error that occurred while obtaining the user session descriptor.", ____accept: "jsString" }, bodyFunction: function(request_) { console.log("..... " + this.operationID + "::" + this.operationName); console.error(request_); return { error: null, result: request_ }; } }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); errors.unshift("While attempting to instantiate " + normalizeUserSessionErrorFilterName); break; } const normalizeUserSessionErrorFilter = innerFactoryResponse.result; // ---------------------------------------------------------------------- // Instantiate HTML render integration filter // ---------------------------------------------------------------------- const htmlRenderFilterMoniker = "HTML Render Engine"; const htmlRenderFilterName = request_.name + "::" + htmlRenderFilterMoniker; const htmlRenderFilterDescription = "Transforms an application-specific in-memory data into a UTF8-encoded HTML string."; const htmlRenderFilterID = arccore.identifier.irut.fromReference(request_.filter_id_seed + htmlRenderFilterMoniker).result; var innerFactoryResponse = arccore.filter.create({ operationID: htmlRenderFilterID, operationName: htmlRenderFilterName, operationDescription: htmlRenderFilterDescription, inputFilterSpec: { ____label: "HTML Render Request", ____description: "Data passed into the HTML render filter to be transformed to a UTF8-encoded HTML string.", ____types: "jsObject", document: { ____label: "Document Data", ____description: "Document data and metadata to be rendered as an HTML document string.", ____types: "jsObject", content: { ____label: "Document Content Render Options", ____description: "Information used to customize the rendering of `document.data`.", ____types: "jsObject", ____defaultValue: {}, uri: { ____label: "Content Render View URI", ____description: "The URI of the view render function to be used to render `document.data`. Or, null (default) " + "to indicate that the base page URI, `document.metadata.page.uri`, should be used.", ____accept: [ "jsNull", "jsString" ], ____defaultValue: null } // uri }, // content data: { ____label: "Document Content Data", ____description: "In-memory data to render as the main body content of the generated HTML document string.", ____opaque: true // possible formats is set of HTTP server error response + all service filter results }, metadata: { ____label: "Document Metadata", ____description: "Document Metadata", ____types: "jsObject", agent: httpServerAgentResultSpec, org: request_.integrations.metadata.org.get.outputFilterSpec, site: request_.integrations.metadata.site.get.outputFilterSpec, page: request_.integrations.metadata.page.get.outputFilterSpec, session: normalizeUserSessionResultFilter.filterDescriptor.inputFilterSpec } }, appStateContext: httpIntegrationFiltersFactoryRequestSpec.appStateContext }, outputFilterSpec: { ____label: "UTF8 HTML String", ____description: "The input data object transformed into a UTF8-encoded HTML document string.", ____accept: "jsString" }, bodyFunction: request_.integrations.render.html.bodyFunction }); if (innerFactoryResponse.error) { errors.unshift(innerFactoryResponse.error); break; } const htmlRenderFilter = innerFactoryResponse.result; // Prepare the response result. Note that the output is filtered // so you must update the result spec if you decide to change this. response.result = { filter_id_seed: request_.filter_id_seed, name: request_.name, version: request_.version, description: request_.description, platform: request_.platform, document_data_model: request_.document_data_model, filters: { html_render: htmlRenderFilter, get_org_metadata: getOrgMetadataFilter, get_site_metadata: getSiteMetadataFilter, get_page_metadata: getPageMetadataFilter, get_user_identity: getUserIdentityMetadataFilter, get_user_session: getUserSessionMetadataFilter, normalize_user_session_result: normalizeUserSessionResultFilter, normalize_user_session_error: normalizeUserSessionErrorFilter }, appStateContext: request_.appStateContext }; break; } if (errors.length) { response.error = errors.join(" "); } return response; } }); if (factoryResponse.error) { throw new Error(factoryResponse.error); } module.exports = factoryResponse.result;
{ "content_hash": "d465fe8b244d60c61c889b44406db0b4", "timestamp": "", "source": "github", "line_count": 336, "max_line_length": 147, "avg_line_length": 61.73809523809524, "alnum_prop": 0.5654647126880061, "repo_name": "Encapsule/polytely", "id": "5ac20c887a6c6c3d2fbd34514bf9ff2fd30ed321", "size": "20784", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "HOLISTIC/holism/lib/http-integration-filters-factory.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2144" }, { "name": "HTML", "bytes": "4059" }, { "name": "JavaScript", "bytes": "514869" }, { "name": "Makefile", "bytes": "4263" } ], "symlink_target": "" }
package ldapauthserver import ( "encoding/json" "flag" "fmt" "io/ioutil" "net" "sync" "time" log "github.com/golang/glog" "github.com/youtube/vitess/go/mysql" "github.com/youtube/vitess/go/netutil" querypb "github.com/youtube/vitess/go/vt/proto/query" "github.com/youtube/vitess/go/vt/vttls" "gopkg.in/ldap.v2" ) var ( ldapAuthConfigFile = flag.String("mysql_ldap_auth_config_file", "", "JSON File from which to read LDAP server config.") ldapAuthConfigString = flag.String("mysql_ldap_auth_config_string", "", "JSON representation of LDAP server config.") ldapAuthMethod = flag.String("mysql_ldap_auth_method", mysql.MysqlClearPassword, "client-side authentication method to use. Supported values: mysql_clear_password, dialog.") ) // AuthServerLdap implements AuthServer with an LDAP backend type AuthServerLdap struct { Client ServerConfig Method string User string Password string GroupQuery string UserDnPattern string RefreshSeconds time.Duration } // Init is public so it can be called from plugin_auth_ldap.go (go/cmd/vtgate) func Init() { if *ldapAuthConfigFile == "" && *ldapAuthConfigString == "" { log.Infof("Not configuring AuthServerLdap because mysql_ldap_auth_config_file and mysql_ldap_auth_config_string are empty") return } if *ldapAuthConfigFile != "" && *ldapAuthConfigString != "" { log.Infof("Both mysql_ldap_auth_config_file and mysql_ldap_auth_config_string are non-empty, can only use one.") return } if *ldapAuthMethod != mysql.MysqlClearPassword && *ldapAuthMethod != mysql.MysqlDialog { log.Exitf("Invalid mysql_ldap_auth_method value: only support mysql_clear_password or dialog") } ldapAuthServer := &AuthServerLdap{ Client: &ClientImpl{}, ServerConfig: ServerConfig{}, Method: *ldapAuthMethod, } data := []byte(*ldapAuthConfigString) if *ldapAuthConfigFile != "" { var err error data, err = ioutil.ReadFile(*ldapAuthConfigFile) if err != nil { log.Exitf("Failed to read mysql_ldap_auth_config_file: %v", err) } } if err := json.Unmarshal(data, ldapAuthServer); err != nil { log.Exitf("Error parsing AuthServerLdap config: %v", err) } mysql.RegisterAuthServerImpl("ldap", ldapAuthServer) } // AuthMethod is part of the AuthServer interface. func (asl *AuthServerLdap) AuthMethod(user string) (string, error) { return asl.Method, nil } // Salt will be unused in AuthServerLdap. func (asl *AuthServerLdap) Salt() ([]byte, error) { return mysql.NewSalt() } // ValidateHash is unimplemented for AuthServerLdap. func (asl *AuthServerLdap) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (mysql.Getter, error) { panic("unimplemented") } // Negotiate is part of the AuthServer interface. func (asl *AuthServerLdap) Negotiate(c *mysql.Conn, user string, remoteAddr net.Addr) (mysql.Getter, error) { // Finish the negotiation. password, err := mysql.AuthServerNegotiateClearOrDialog(c, asl.Method) if err != nil { return nil, err } return asl.validate(user, password) } func (asl *AuthServerLdap) validate(username, password string) (mysql.Getter, error) { if err := asl.Client.Connect("tcp", &asl.ServerConfig); err != nil { return nil, err } defer asl.Client.Close() if err := asl.Client.Bind(fmt.Sprintf(asl.UserDnPattern, username), password); err != nil { return nil, err } groups, err := asl.getGroups(username) if err != nil { return nil, err } return &LdapUserData{asl: asl, groups: groups, username: username, lastUpdated: time.Now(), updating: false}, nil } //this needs to be passed an already connected client...should check for this func (asl *AuthServerLdap) getGroups(username string) ([]string, error) { err := asl.Client.Bind(asl.User, asl.Password) if err != nil { return nil, err } req := ldap.NewSearchRequest( asl.GroupQuery, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, fmt.Sprintf("(memberUid=%s)", username), []string{"cn"}, nil, ) res, err := asl.Client.Search(req) if err != nil { return nil, err } var groups []string for _, entry := range res.Entries { for _, attr := range entry.Attributes { groups = append(groups, attr.Values[0]) } } return groups, nil } // LdapUserData holds username and LDAP groups as well as enough data to // intelligently update itself. type LdapUserData struct { asl *AuthServerLdap groups []string username string lastUpdated time.Time updating bool sync.Mutex } func (lud *LdapUserData) update() { lud.Lock() if lud.updating { lud.Unlock() return } lud.updating = true lud.Unlock() err := lud.asl.Client.Connect("tcp", &lud.asl.ServerConfig) if err != nil { log.Errorf("Error updating LDAP user data: %v", err) return } defer lud.asl.Client.Close() //after the error check groups, err := lud.asl.getGroups(lud.username) if err != nil { log.Errorf("Error updating LDAP user data: %v", err) return } lud.Lock() lud.groups = groups lud.lastUpdated = time.Now() lud.updating = false lud.Unlock() } // Get returns wrapped username and LDAP groups and possibly updates the cache func (lud *LdapUserData) Get() *querypb.VTGateCallerID { if time.Since(lud.lastUpdated) > lud.asl.RefreshSeconds*time.Second { go lud.update() } return &querypb.VTGateCallerID{Username: lud.username, Groups: lud.groups} } // ServerConfig holds the config for and LDAP server // * include port in ldapServer, "ldap.example.com:386" type ServerConfig struct { LdapServer string LdapCert string LdapKey string LdapCA string } // Client provides an interface we can mock type Client interface { Connect(network string, config *ServerConfig) error Close() Bind(string, string) error Search(*ldap.SearchRequest) (*ldap.SearchResult, error) } // ClientImpl is the real implementation of LdapClient type ClientImpl struct { *ldap.Conn } // Connect calls ldap.Dial and then upgrades the connection to TLS // This must be called before any other methods func (lci *ClientImpl) Connect(network string, config *ServerConfig) error { conn, err := ldap.Dial(network, config.LdapServer) lci.Conn = conn // Reconnect with TLS ... why don't we simply DialTLS directly? serverName, _, err := netutil.SplitHostPort(config.LdapServer) if err != nil { return err } tlsConfig, err := vttls.ClientConfig(config.LdapCert, config.LdapKey, config.LdapCA, serverName) if err != nil { return err } err = conn.StartTLS(tlsConfig) if err != nil { return err } return nil }
{ "content_hash": "21e3a4fd2754879633195d73a0662886", "timestamp": "", "source": "github", "line_count": 225, "max_line_length": 180, "avg_line_length": 29.044444444444444, "alnum_prop": 0.7146136189747513, "repo_name": "sougou/vitess", "id": "01fc8c1565e13d3954bf12cb2adf0a931a319561", "size": "7091", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "go/mysql/ldapauthserver/auth_server_ldap.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "79101" }, { "name": "Go", "bytes": "7772535" }, { "name": "HTML", "bytes": "59824" }, { "name": "Java", "bytes": "1158315" }, { "name": "JavaScript", "bytes": "42815" }, { "name": "Liquid", "bytes": "7030" }, { "name": "Makefile", "bytes": "9629" }, { "name": "Python", "bytes": "1118992" }, { "name": "Ruby", "bytes": "3580" }, { "name": "Shell", "bytes": "60920" }, { "name": "Smarty", "bytes": "28688" }, { "name": "TypeScript", "bytes": "152741" }, { "name": "Yacc", "bytes": "50251" } ], "symlink_target": "" }
module ApplicationHelper def title(title) content_for(:title, title) end def gravatar_tag(email, options={}) id = Digest::MD5::hexdigest(email).downcase size = options[:size] || 128 image_tag("https://secure.gravatar.com/avatar/#{id}?s=#{size}", options) end end
{ "content_hash": "a7bd9d2e97a10e27394aa9c9e53c31a4", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 76, "avg_line_length": 26.272727272727273, "alnum_prop": 0.6643598615916955, "repo_name": "grounds/grounds.io", "id": "e93ea81bc6df6e60a8725400c1a2a2e30f5873d8", "size": "289", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "app/helpers/application_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5068" }, { "name": "HTML", "bytes": "13053" }, { "name": "JavaScript", "bytes": "10244" }, { "name": "Makefile", "bytes": "1365" }, { "name": "Ruby", "bytes": "50199" }, { "name": "Shell", "bytes": "572" } ], "symlink_target": "" }
title: Overview meta_title: Overview meta_description: description. slug: overview tags:overview publish:True --- # This chapter covers the most common end-user work flows in the usage of the Telerik's __RadScheduleView__. * [Create Appointment](6FF9911E-35C8-4ED6-910E-CB43DCE581DB) * [Edit Appointment](FBFB41F6-FD40-497B-AEAB-DB882D0763AE) * [Delete Appointment](256FEDC9-8A6E-4251-BF3E-CC1B4496F11A) * [Configurate TimeRuler](A1030DC6-E017-41C0-AB50-431B3055DED0) * [Understanding Appointments]({{slug:understanding-appointments}})
{ "content_hash": "8c17336a8be6702a93b47f8c6f40d02c", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 106, "avg_line_length": 24.818181818181817, "alnum_prop": 0.7802197802197802, "repo_name": "TsvetinaIvanova/xaml-docs", "id": "ef72b7d321df2f62d21aed7d1e05f1bde11ad557", "size": "550", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Controls/RadScheduleView/Content/radscheduleview-end-user-capabilities-overview.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
{% extends "job_base.html" %} {% set active_tab = "home" %} {% block subcontents %} <div class="row"> <div class="span12"> <center> <a href="{{url_for('.show_latest', id=id)}}" class="btn btn-large">Latest Build</a> <a href="{{url_for('.show_success', id=id)}}" class="btn btn-large">Last Success</a> <a href="{{url_for('.show_start', id = id)}}" class="btn btn-large btn-primary">Start New Build!</a> </center> </div> </div> {% endblock %}
{ "content_hash": "fd19da278d20e831fe80cb8c974a0648", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 103, "avg_line_length": 36.30769230769231, "alnum_prop": 0.576271186440678, "repo_name": "boivie/sci", "id": "09a29d1b746bbcb91ec29ff974fffd68f1df5b57", "size": "472", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "sciweb/templates/job_settings.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "53355" }, { "name": "Python", "bytes": "82467" } ], "symlink_target": "" }
export {default as run} from './run.js'
{ "content_hash": "a96449b534a45b679380a1ede4d67794", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 39, "avg_line_length": 40, "alnum_prop": 0.675, "repo_name": "vinsonchuong/create-npm", "id": "673b531ec11dfc362d1e031d0eada6ff8cbf1a1d", "size": "40", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/helpers/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "20044" } ], "symlink_target": "" }
package jgpml.covariancefunctions; import Jama.Matrix; public interface CovarianceFunction { /** * Returns the number of hyperparameters of this<code>CovarianceFunction</code> * @return number of hyperparameters */ public int numParameters(); /** * Compute covariance matrix of a dataset X * @param loghyper column <code>Matrix</code> of hyperparameters * @param X input dataset * @return K covariance <code>Matrix</code> */ public Matrix compute(Matrix loghyper, Matrix X); /** * Compute compute test set covariances * @param loghyper column <code>Matrix</code> of hyperparameters * @param X input dataset * @param Xstar test set * @return [K(Xstar,Xstar) K(X,Xstar)] */ public Matrix[] compute(Matrix loghyper, Matrix X, Matrix Xstar); /** * Coompute the derivatives of this <code>CovarianceFunction</code> with respect * to the hyperparameter with index <code>idx</code> * * @param loghyper hyperparameters * @param X input dataset * @param index hyperparameter index * @return <code>Matrix</code> of derivatives */ public Matrix computeDerivatives(Matrix loghyper, Matrix X, int index); }
{ "content_hash": "2a7c9c0bfec993d05437de15d28785e5", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 84, "avg_line_length": 28.431818181818183, "alnum_prop": 0.6650679456434853, "repo_name": "renzodenardi/jpgml", "id": "08dde1389d433f467d75cf51e80383cc47151d4f", "size": "2486", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "jgpml/covariancefunctions/CovarianceFunction.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
/* * 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.facebook.presto.operator.aggregation.arrayagg; import com.facebook.presto.bytecode.DynamicClassLoader; import com.facebook.presto.common.block.Block; import com.facebook.presto.common.block.BlockBuilder; import com.facebook.presto.common.type.ArrayType; import com.facebook.presto.common.type.Type; import com.facebook.presto.metadata.BoundVariables; import com.facebook.presto.metadata.FunctionAndTypeManager; import com.facebook.presto.metadata.SqlAggregationFunction; import com.facebook.presto.operator.aggregation.AccumulatorCompiler; import com.facebook.presto.operator.aggregation.BuiltInAggregationFunctionImplementation; import com.facebook.presto.spi.function.AccumulatorState; import com.facebook.presto.spi.function.AccumulatorStateFactory; import com.facebook.presto.spi.function.AccumulatorStateSerializer; import com.facebook.presto.spi.function.aggregation.Accumulator; import com.facebook.presto.spi.function.aggregation.AggregationMetadata; import com.facebook.presto.spi.function.aggregation.AggregationMetadata.AccumulatorStateDescriptor; import com.facebook.presto.spi.function.aggregation.AggregationMetadata.ParameterMetadata; import com.facebook.presto.spi.function.aggregation.GroupedAccumulator; import com.google.common.collect.ImmutableList; import java.lang.invoke.MethodHandle; import java.util.List; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; import static com.facebook.presto.operator.aggregation.AggregationUtils.generateAggregationName; import static com.facebook.presto.spi.function.Signature.typeVariable; import static com.facebook.presto.spi.function.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INDEX; import static com.facebook.presto.spi.function.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INPUT_CHANNEL; import static com.facebook.presto.spi.function.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.NULLABLE_BLOCK_INPUT_CHANNEL; import static com.facebook.presto.spi.function.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.STATE; import static com.facebook.presto.util.Reflection.methodHandle; import static com.google.common.collect.ImmutableList.toImmutableList; import static java.util.Objects.requireNonNull; public class ArrayAggregationFunction extends SqlAggregationFunction { private static final String NAME = "array_agg"; private static final MethodHandle INPUT_FUNCTION = methodHandle(ArrayAggregationFunction.class, "input", Type.class, ArrayAggregationState.class, Block.class, int.class); private static final MethodHandle COMBINE_FUNCTION = methodHandle(ArrayAggregationFunction.class, "combine", Type.class, ArrayAggregationState.class, ArrayAggregationState.class); private static final MethodHandle OUTPUT_FUNCTION = methodHandle(ArrayAggregationFunction.class, "output", Type.class, ArrayAggregationState.class, BlockBuilder.class); private final boolean legacyArrayAgg; private final ArrayAggGroupImplementation groupMode; public ArrayAggregationFunction(boolean legacyArrayAgg, ArrayAggGroupImplementation groupMode) { super(NAME, ImmutableList.of(typeVariable("T")), ImmutableList.of(), parseTypeSignature("array(T)"), ImmutableList.of(parseTypeSignature("T"))); this.legacyArrayAgg = legacyArrayAgg; this.groupMode = requireNonNull(groupMode, "groupMode is null"); } @Override public String getDescription() { return "return an array of values"; } @Override public BuiltInAggregationFunctionImplementation specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager) { Type type = boundVariables.getTypeVariable("T"); return generateAggregation(type, legacyArrayAgg, groupMode); } private static BuiltInAggregationFunctionImplementation generateAggregation(Type type, boolean legacyArrayAgg, ArrayAggGroupImplementation groupMode) { DynamicClassLoader classLoader = new DynamicClassLoader(ArrayAggregationFunction.class.getClassLoader()); AccumulatorStateSerializer<?> stateSerializer = new ArrayAggregationStateSerializer(type); AccumulatorStateFactory<?> stateFactory = new ArrayAggregationStateFactory(type, groupMode); List<Type> inputTypes = ImmutableList.of(type); Type outputType = new ArrayType(type); Type intermediateType = stateSerializer.getSerializedType(); List<ParameterMetadata> inputParameterMetadata = createInputParameterMetadata(type, legacyArrayAgg); MethodHandle inputFunction = INPUT_FUNCTION.bindTo(type); MethodHandle combineFunction = COMBINE_FUNCTION.bindTo(type); MethodHandle outputFunction = OUTPUT_FUNCTION.bindTo(type); Class<? extends AccumulatorState> stateInterface = ArrayAggregationState.class; AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, type.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), inputParameterMetadata, inputFunction, combineFunction, outputFunction, ImmutableList.of(new AccumulatorStateDescriptor( stateInterface, stateSerializer, stateFactory)), outputType); Class<? extends Accumulator> accumulatorClass = AccumulatorCompiler.generateAccumulatorClass( Accumulator.class, metadata, classLoader); Class<? extends GroupedAccumulator> groupedAccumulatorClass = AccumulatorCompiler.generateAccumulatorClass( GroupedAccumulator.class, metadata, classLoader); return new BuiltInAggregationFunctionImplementation(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, metadata, accumulatorClass, groupedAccumulatorClass); } private static List<ParameterMetadata> createInputParameterMetadata(Type value, boolean legacyArrayAgg) { return ImmutableList.of(new ParameterMetadata(STATE), new ParameterMetadata(legacyArrayAgg ? BLOCK_INPUT_CHANNEL : NULLABLE_BLOCK_INPUT_CHANNEL, value), new ParameterMetadata(BLOCK_INDEX)); } public static void input(Type type, ArrayAggregationState state, Block value, int position) { state.add(value, position); } public static void combine(Type type, ArrayAggregationState state, ArrayAggregationState otherState) { state.merge(otherState); } public static void output(Type elementType, ArrayAggregationState state, BlockBuilder out) { if (state.isEmpty()) { out.appendNull(); } else { BlockBuilder entryBuilder = out.beginBlockEntry(); state.forEach((block, position) -> elementType.appendTo(block, position, entryBuilder)); out.closeEntry(); } } }
{ "content_hash": "e94b6ddbdb95c093514261c0863d1854", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 197, "avg_line_length": 50.52287581699346, "alnum_prop": 0.7561448900388098, "repo_name": "prestodb/presto", "id": "438f199f09ca6af918a275cc212172e36118c932", "size": "7730", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "presto-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/ArrayAggregationFunction.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "33331" }, { "name": "Batchfile", "bytes": "795" }, { "name": "C++", "bytes": "640275" }, { "name": "CMake", "bytes": "31361" }, { "name": "CSS", "bytes": "28319" }, { "name": "Dockerfile", "bytes": "1266" }, { "name": "HTML", "bytes": "29601" }, { "name": "Java", "bytes": "52940440" }, { "name": "JavaScript", "bytes": "286864" }, { "name": "Makefile", "bytes": "16617" }, { "name": "Mustache", "bytes": "17803" }, { "name": "NASL", "bytes": "11965" }, { "name": "PLSQL", "bytes": "85" }, { "name": "Python", "bytes": "39357" }, { "name": "Roff", "bytes": "52281" }, { "name": "Shell", "bytes": "38937" }, { "name": "Thrift", "bytes": "14675" } ], "symlink_target": "" }
<?xml version="1.0"?> <package> <name>cougarbot</name> <version>0.0.0</version> <description>The cougarbot package</description> <maintainer email="gerkey@osrfoundation.org">Brian Gerkey</maintainer> <license>BSD</license> <author email="gerkey@osrfoundation.org">Brian Gerkey</author> <buildtool_depend>catkin</buildtool_depend> <build_depend>rospy</build_depend> <run_depend>rospy</run_depend> <export></export> </package>
{ "content_hash": "275225da12aad14eb07e6c2d34196a11", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 72, "avg_line_length": 34.23076923076923, "alnum_prop": 0.7280898876404495, "repo_name": "osrf/rosbook", "id": "a148c51b8ed2468d6cc4671f8494249506eac9f5", "size": "445", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "code/cougarbot/package.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "2494" }, { "name": "CMake", "bytes": "12104" }, { "name": "EmberScript", "bytes": "2804" }, { "name": "Makefile", "bytes": "295" }, { "name": "Matlab", "bytes": "2382" }, { "name": "Python", "bytes": "62413" }, { "name": "Shell", "bytes": "764" }, { "name": "TeX", "bytes": "396" } ], "symlink_target": "" }
from instagram.client import InstagramAPI import requests #http://nbviewer.ipython.org/github/katychuang/Pyladies-ImageAnalysis/blob/master/Instagram%20Image%20Analysis.ipynb #private keys given by instagram INSTAGRAM_CLIENT_ID = INSTAGRAM_CLIENT_SECRET = api = InstagramAPI(client_id = INSTAGRAM_CLIENT_ID, client_secret = INSTAGRAM_CLIENT_SECRET) popular_media = api.media_popular(count=20) photolist = [] for media in popular_media: photolist.append(media.images['standard_resolution'].url) counter = 1 #http://stackoverflow.com/questions/13137817/how-to-download-image-using-requests for link in photolist: response = requests.get(link) if response.status_code ==200: f = open("image"+str(counter)+".jpg",'wb') f.write(response.content) f.close() counter += 1
{ "content_hash": "fab3571373e1ee4e9082b2e98c805162", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 116, "avg_line_length": 28.142857142857142, "alnum_prop": 0.7626903553299492, "repo_name": "jkgiesler/571", "id": "77d813d003d0ab7a031a28e501854faacbfdbe77", "size": "788", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "code/instagram_test.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "14643" } ], "symlink_target": "" }
import Component from '@ember/component'; import { computed } from '@ember/object'; import { reads } from '@ember/object/computed'; import { typeOf } from '@ember/utils'; export default Component.extend({ selectedPlanPrice: reads('selectedPlan.price'), price: computed('totalPrice', 'selectedPlanPrice', function () { return typeOf(this.totalPrice) === 'number' && this.totalPrice >= 0 ? this.totalPrice : Math.floor(this.selectedPlanPrice / 100); }) });
{ "content_hash": "3dfc47787dd0ae740e619bfff29a60bc", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 133, "avg_line_length": 36, "alnum_prop": 0.7072649572649573, "repo_name": "travis-ci/travis-web", "id": "20342dec3b1c9f94cd4c32df9a09529b1ad3378d", "size": "468", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/components/billing/selected-plan.js", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "1292" }, { "name": "HTML", "bytes": "8195" }, { "name": "Handlebars", "bytes": "455682" }, { "name": "JavaScript", "bytes": "1558027" }, { "name": "Makefile", "bytes": "1429" }, { "name": "Procfile", "bytes": "112" }, { "name": "Ruby", "bytes": "23424" }, { "name": "SCSS", "bytes": "284765" }, { "name": "Shell", "bytes": "3610" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "1c2a7597f1cfafa4d8ebc4396d53e54c", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "9fe93cd951d24a2d23249966eb9b6ea3a6e788f0", "size": "177", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Apiales/Pittosporaceae/Cheiranthera/Cheiranthera cyanea/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion> <artifactId>aot-native</artifactId> <build> <plugins> <!-- tag::aot-native[] --> <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <!-- end::aot-native[] --> </plugins> </build> </project>
{ "content_hash": "a1938ca210f99fc3f97f57620ff6eeef", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 53, "avg_line_length": 23.142857142857142, "alnum_prop": 0.6460905349794238, "repo_name": "htynkn/spring-boot", "id": "05a1b5acabe99540e8229cd67810a3eac0c6b567", "size": "486", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/aot-native/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2138" }, { "name": "CSS", "bytes": "117" }, { "name": "Dockerfile", "bytes": "2309" }, { "name": "Groovy", "bytes": "15015" }, { "name": "HTML", "bytes": "58426" }, { "name": "Java", "bytes": "21554950" }, { "name": "JavaScript", "bytes": "33592" }, { "name": "Kotlin", "bytes": "432332" }, { "name": "Mustache", "bytes": "449" }, { "name": "Ruby", "bytes": "7867" }, { "name": "Shell", "bytes": "45437" }, { "name": "Smarty", "bytes": "2882" }, { "name": "Vim Snippet", "bytes": "135" } ], "symlink_target": "" }
const program = require('commander'); const inquirer = require('inquirer'); const fs = require('fs'); const request = require('request'); const PATHS = require('./paths'); const readFile = require('./fs/read-file'); const writeFile = require('./fs/write-file'); const prettyJSONStringify = require('./helpers/pretty-json-stringify'); const combineValidators = require('./validators/combine-validators'); const isRequired = require('./validators/is-required'); const isUrl = require('./validators/is-url'); const addBookToBooksData = require('./transforms/books/add-book'); program .version('1.0.0') .description('Adds new book') .parse(process.argv); function fetchAndSaveCover(coverUrl, filename) { request(coverUrl).pipe(fs.createWriteStream(`${PATHS.folders.covers}/${filename}`)); } Promise .all([ readFile(PATHS.files.tags).then(JSON.parse), readFile(PATHS.files.books).then(JSON.parse), ]) .then(([tagsData, booksData]) => Promise.all([ booksData, inquirer.prompt([ { type: 'input', name: 'title', message: 'Title:', validate: isRequired, }, { type: 'input', name: 'authors', message: 'Authors (separated by commas):', validate: isRequired, }, { type: 'input', name: 'url', message: 'Book URL:', validate: combineValidators(isRequired, isUrl), }, { type: 'input', name: 'coverUrl', message: 'Book cover URL:', validate: combineValidators(isRequired, isUrl), }, { type: 'checkbox', name: 'tags', message: 'Tags (choose from existing tags; you can add new tags in the next step):', choices: tagsData.ids.map((tagId) => ({ name: tagsData.dictionary[tagId], value: tagId, })), }, ]), ])) .then(([booksData, options]) => addBookToBooksData({ fetchAndSaveCover, title: options.title, authors: options.authors.split(',').map((author) => author.trim()), url: options.url, coverUrl: options.coverUrl, tags: options.tags, }, booksData)) .then(prettyJSONStringify) .then(writeFile(PATHS.files.books)) .then(() => console.log('Successfully added new book')) .catch(console.log);
{ "content_hash": "bb895c558dca868fea895fdb66dfd07b", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 88, "avg_line_length": 26.7375, "alnum_prop": 0.6587190275829827, "repo_name": "andrew--r/frontendbookshelf-data", "id": "2451e4f5f6bc19e54cdf507c482e9f03a04a9255", "size": "2160", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cms/add-book.js", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "20635" } ], "symlink_target": "" }
package org.apache.hadoop.yarn.server.timelineservice.reader.filter; import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.filter.BinaryComparator; import org.apache.hadoop.hbase.filter.BinaryPrefixComparator; import org.apache.hadoop.hbase.filter.FamilyFilter; import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.FilterList; import org.apache.hadoop.hbase.filter.FilterList.Operator; import org.apache.hadoop.yarn.server.timelineservice.storage.common.Column; import org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnFamily; import org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix; import org.apache.hadoop.hbase.filter.QualifierFilter; import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; /** * Set of utility methods used by timeline filter classes. */ public final class TimelineFilterUtils { private static final Log LOG = LogFactory.getLog(TimelineFilterUtils.class); private TimelineFilterUtils() { } /** * Returns the equivalent HBase filter list's {@link Operator}. * * @param op timeline filter list operator. * @return HBase filter list's Operator. */ private static Operator getHBaseOperator(TimelineFilterList.Operator op) { switch (op) { case AND: return Operator.MUST_PASS_ALL; case OR: return Operator.MUST_PASS_ONE; default: throw new IllegalArgumentException("Invalid operator"); } } /** * Returns the equivalent HBase compare filter's {@link CompareOp}. * * @param op timeline compare op. * @return HBase compare filter's CompareOp. */ private static CompareOp getHBaseCompareOp( TimelineCompareOp op) { switch (op) { case LESS_THAN: return CompareOp.LESS; case LESS_OR_EQUAL: return CompareOp.LESS_OR_EQUAL; case EQUAL: return CompareOp.EQUAL; case NOT_EQUAL: return CompareOp.NOT_EQUAL; case GREATER_OR_EQUAL: return CompareOp.GREATER_OR_EQUAL; case GREATER_THAN: return CompareOp.GREATER; default: throw new IllegalArgumentException("Invalid compare operator"); } } /** * Converts a {@link TimelinePrefixFilter} to an equivalent HBase * {@link QualifierFilter}. * @param colPrefix * @param filter * @return a {@link QualifierFilter} object */ private static <T> Filter createHBaseColQualPrefixFilter( ColumnPrefix<T> colPrefix, TimelinePrefixFilter filter) { return new QualifierFilter(getHBaseCompareOp(filter.getCompareOp()), new BinaryPrefixComparator( colPrefix.getColumnPrefixBytes(filter.getPrefix()))); } /** * Create a HBase {@link QualifierFilter} for the passed column prefix and * compare op. * * @param <T> Describes the type of column prefix. * @param compareOp compare op. * @param columnPrefix column prefix. * @return a column qualifier filter. */ public static <T> Filter createHBaseQualifierFilter(CompareOp compareOp, ColumnPrefix<T> columnPrefix) { return new QualifierFilter(compareOp, new BinaryPrefixComparator( columnPrefix.getColumnPrefixBytes(""))); } /** * Create filters for confs or metrics to retrieve. This list includes a * configs/metrics family filter and relevant filters for confs/metrics to * retrieve, if present. * * @param <T> Describes the type of column prefix. * @param confsOrMetricToRetrieve configs/metrics to retrieve. * @param columnFamily config or metric column family. * @param columnPrefix config or metric column prefix. * @return a filter list. * @throws IOException if any problem occurs while creating the filters. */ public static <T> Filter createFilterForConfsOrMetricsToRetrieve( TimelineFilterList confsOrMetricToRetrieve, ColumnFamily<T> columnFamily, ColumnPrefix<T> columnPrefix) throws IOException { Filter familyFilter = new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(columnFamily.getBytes())); if (confsOrMetricToRetrieve != null && !confsOrMetricToRetrieve.getFilterList().isEmpty()) { // If confsOrMetricsToRetrive are specified, create a filter list based // on it and family filter. FilterList filter = new FilterList(familyFilter); filter.addFilter( createHBaseFilterList(columnPrefix, confsOrMetricToRetrieve)); return filter; } else { // Only the family filter needs to be added. return familyFilter; } } /** * Create 2 HBase {@link SingleColumnValueFilter} filters for the specified * value range represented by start and end value and wraps them inside a * filter list. Start and end value should not be null. * * @param <T> Describes the type of column prefix. * @param column Column for which single column value filter is to be created. * @param startValue Start value. * @param endValue End value. * @return 2 single column value filters wrapped in a filter list. * @throws IOException if any problem is encountered while encoding value. */ public static <T> FilterList createSingleColValueFiltersByRange( Column<T> column, Object startValue, Object endValue) throws IOException { FilterList list = new FilterList(); Filter singleColValFilterStart = createHBaseSingleColValueFilter( column.getColumnFamilyBytes(), column.getColumnQualifierBytes(), column.getValueConverter().encodeValue(startValue), CompareOp.GREATER_OR_EQUAL, true); list.addFilter(singleColValFilterStart); Filter singleColValFilterEnd = createHBaseSingleColValueFilter( column.getColumnFamilyBytes(), column.getColumnQualifierBytes(), column.getValueConverter().encodeValue(endValue), CompareOp.LESS_OR_EQUAL, true); list.addFilter(singleColValFilterEnd); return list; } /** * Creates a HBase {@link SingleColumnValueFilter}. * * @param columnFamily Column Family represented as bytes. * @param columnQualifier Column Qualifier represented as bytes. * @param value Value. * @param compareOp Compare operator. * @param filterIfMissing This flag decides if we should filter the row if the * specified column is missing. This is based on the filter's keyMustExist * field. * @return a {@link SingleColumnValueFilter} object * @throws IOException */ private static SingleColumnValueFilter createHBaseSingleColValueFilter( byte[] columnFamily, byte[] columnQualifier, byte[] value, CompareOp compareOp, boolean filterIfMissing) throws IOException { SingleColumnValueFilter singleColValFilter = new SingleColumnValueFilter(columnFamily, columnQualifier, compareOp, new BinaryComparator(value)); singleColValFilter.setLatestVersionOnly(true); singleColValFilter.setFilterIfMissing(filterIfMissing); return singleColValFilter; } /** * Fetch columns from filter list containing exists and multivalue equality * filters. This is done to fetch only required columns from back-end and * then match event filters or relationships in reader. * * @param filterList filter list. * @return set of columns. */ public static Set<String> fetchColumnsFromFilterList( TimelineFilterList filterList) { Set<String> strSet = new HashSet<String>(); for (TimelineFilter filter : filterList.getFilterList()) { switch(filter.getFilterType()) { case LIST: strSet.addAll(fetchColumnsFromFilterList((TimelineFilterList)filter)); break; case KEY_VALUES: strSet.add(((TimelineKeyValuesFilter)filter).getKey()); break; case EXISTS: strSet.add(((TimelineExistsFilter)filter).getValue()); break; default: LOG.info("Unexpected filter type " + filter.getFilterType()); break; } } return strSet; } /** * Creates equivalent HBase {@link FilterList} from {@link TimelineFilterList} * while converting different timeline filters(of type {@link TimelineFilter}) * into their equivalent HBase filters. * * @param <T> Describes the type of column prefix. * @param colPrefix column prefix which will be used for conversion. * @param filterList timeline filter list which has to be converted. * @return A {@link FilterList} object. * @throws IOException if any problem occurs while creating the filter list. */ public static <T> FilterList createHBaseFilterList(ColumnPrefix<T> colPrefix, TimelineFilterList filterList) throws IOException { FilterList list = new FilterList(getHBaseOperator(filterList.getOperator())); for (TimelineFilter filter : filterList.getFilterList()) { switch(filter.getFilterType()) { case LIST: list.addFilter(createHBaseFilterList(colPrefix, (TimelineFilterList)filter)); break; case PREFIX: list.addFilter(createHBaseColQualPrefixFilter(colPrefix, (TimelinePrefixFilter)filter)); break; case COMPARE: TimelineCompareFilter compareFilter = (TimelineCompareFilter)filter; list.addFilter( createHBaseSingleColValueFilter( colPrefix.getColumnFamilyBytes(), colPrefix.getColumnPrefixBytes(compareFilter.getKey()), colPrefix.getValueConverter(). encodeValue(compareFilter.getValue()), getHBaseCompareOp(compareFilter.getCompareOp()), compareFilter.getKeyMustExist())); break; case KEY_VALUE: TimelineKeyValueFilter kvFilter = (TimelineKeyValueFilter)filter; list.addFilter( createHBaseSingleColValueFilter( colPrefix.getColumnFamilyBytes(), colPrefix.getColumnPrefixBytes(kvFilter.getKey()), colPrefix.getValueConverter().encodeValue(kvFilter.getValue()), getHBaseCompareOp(kvFilter.getCompareOp()), kvFilter.getKeyMustExist())); break; default: LOG.info("Unexpected filter type " + filter.getFilterType()); break; } } return list; } }
{ "content_hash": "0e7ff6451fc60be9ef4dbc843cf9fcc2", "timestamp": "", "source": "github", "line_count": 274, "max_line_length": 81, "avg_line_length": 37.97810218978102, "alnum_prop": 0.7087257351527965, "repo_name": "WIgor/hadoop", "id": "cccae267d8899ffa4d21c3585091a4035d863271", "size": "11212", "binary": false, "copies": "8", "ref": "refs/heads/trunk", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/filter/TimelineFilterUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "68758" }, { "name": "C", "bytes": "1406803" }, { "name": "C++", "bytes": "1816626" }, { "name": "CMake", "bytes": "54617" }, { "name": "CSS", "bytes": "58838" }, { "name": "HTML", "bytes": "207277" }, { "name": "Java", "bytes": "65993734" }, { "name": "JavaScript", "bytes": "628725" }, { "name": "Protocol Buffer", "bytes": "272379" }, { "name": "Python", "bytes": "23553" }, { "name": "Shell", "bytes": "388794" }, { "name": "TLA", "bytes": "14993" }, { "name": "TeX", "bytes": "19322" }, { "name": "XSLT", "bytes": "16894" } ], "symlink_target": "" }
package org.apache.camel.openapi; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import io.apicurio.datamodels.Library; import io.apicurio.datamodels.openapi.models.OasDocument; import org.apache.camel.BindToRegistry; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.engine.DefaultClassResolver; import org.apache.camel.model.rest.RestBindingMode; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.openapi.model.SampleComplexRequestType; import org.apache.camel.openapi.model.SampleComplexResponseType; import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; public class ComplexTypesTest extends CamelTestSupport { private static final Logger LOG = LoggerFactory.getLogger(ComplexTypesTest.class); @SuppressWarnings("unused") @BindToRegistry("dummy-rest") private final DummyRestConsumerFactory factory = new DummyRestConsumerFactory(); @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() { rest().securityDefinitions() .oauth2("global") .accessCode("https://AUTHORIZATION_URL", "https://TOKEN_URL") .withScope("groups", "Required scopes for Camel REST APIs"); rest().post("/complexRequest") .description("Demo complex request type") .type(SampleComplexRequestType.class) .consumes("application/json") .produces("text/plain") .bindingMode(RestBindingMode.json) .responseMessage() .code(200) .message("Receives a complex object as parameter") .endResponseMessage() .outType(SampleComplexResponseType.InnerClass.class) .route() .routeId("complex request type") .log("/complex request invoked"); rest().get("/complexResponse") .description("Demo complex response type") .type(SampleComplexRequestType.InnerClass.class) .consumes("application/json") .outType(SampleComplexResponseType.class) .produces("application/json") .bindingMode(RestBindingMode.json) .responseMessage() .code(200) .message("Returns a complex object") .endResponseMessage() .route() .routeId("complex response type") .log("/complex invoked") .setBody(constant(new SampleComplexResponseType())); } }; } @Test public void testV3SchemaForComplexTypesRequest() throws Exception { checkSchemaGeneration("/complexRequest", "3.0", "V3SchemaForComplexTypesRequest.json"); } @Test public void testV2SchemaForComplexTypesRequest() throws Exception { checkSchemaGeneration("/complexRequest", "2.0", "V2SchemaForComplexTypesRequest.json"); } @Test public void testV3SchemaForComplexTypesResponse() throws Exception { checkSchemaGeneration("/complexResponse", "3.0", "V3SchemaForComplexTypesResponse.json"); } @Test public void testV2SchemaForComplexTypesResponse() throws Exception { checkSchemaGeneration("/complexResponse", "2.0", "V2SchemaForComplexTypesResponse.json"); } private void checkSchemaGeneration(String uri, String apiVersion, String schemaResource) throws Exception { BeanConfig config = getBeanConfig(apiVersion); List<RestDefinition> rests = context.getRestDefinitions().stream() // So we get the security schema and the route schema .filter(def -> def.getVerbs().isEmpty() || def.getVerbs().get(0).getUri().equals(uri)) .collect(Collectors.toList()); RestOpenApiReader reader = new RestOpenApiReader(); OasDocument openApi = reader.read(context, rests, null, config, context.getName(), new DefaultClassResolver()); assertNotNull(openApi); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); Object dump = Library.writeNode(openApi); String json = mapper.writeValueAsString(dump); LOG.info(json); json = generify(json); InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/openapi/" + schemaResource); assertNotNull(is); String expected = new BufferedReader( new InputStreamReader(is, StandardCharsets.UTF_8)) .lines() .collect(Collectors.joining("\n")); is.close(); assertEquals(expected, json); } private BeanConfig getBeanConfig(String apiVersion) { BeanConfig config = new BeanConfig(); config.setHost("localhost:8080"); config.setSchemes(new String[] { "http" }); config.setBasePath("/api"); config.setTitle("Camel User store"); config.setLicense("Apache 2.0"); config.setLicenseUrl("https://www.apache.org/licenses/LICENSE-2.0.html"); config.setVersion(apiVersion); return config; } private String generify(String input) { input = input.replaceAll("\"openapi\" : \"3\\..*\",", "\"openapi\" : \"3.x\","); input = input.replaceAll("\"swagger\" : \"2\\..*\",", "\"swagger\" : \"2.x\","); input = input.replaceAll("\"operationId\" : \"verb.*\",", "\"operationId\" : \"verb\","); input = input.replaceAll("\"x-camelContextId\" : \"camel.*\",", "\"x-camelContextId\" : \"camel\","); return input; } }
{ "content_hash": "0e772c38a8e760fe49b9ac34e86cabbf", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 119, "avg_line_length": 42.11038961038961, "alnum_prop": 0.6377794911333847, "repo_name": "tdiesler/camel", "id": "5aeaceaae74e5f58af429003c44d78f79ab907d8", "size": "7287", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "components/camel-openapi-java/src/test/java/org/apache/camel/openapi/ComplexTypesTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Apex", "bytes": "6521" }, { "name": "Batchfile", "bytes": "2353" }, { "name": "CSS", "bytes": "5472" }, { "name": "Dockerfile", "bytes": "5675" }, { "name": "Elm", "bytes": "10852" }, { "name": "FreeMarker", "bytes": "8015" }, { "name": "Groovy", "bytes": "249715" }, { "name": "HTML", "bytes": "203529" }, { "name": "Java", "bytes": "105215396" }, { "name": "JavaScript", "bytes": "103621" }, { "name": "Jsonnet", "bytes": "1734" }, { "name": "Kotlin", "bytes": "41816" }, { "name": "Mustache", "bytes": "525" }, { "name": "RobotFramework", "bytes": "8461" }, { "name": "Ruby", "bytes": "88" }, { "name": "Shell", "bytes": "15162" }, { "name": "Tcl", "bytes": "4974" }, { "name": "Thrift", "bytes": "6979" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "276597" } ], "symlink_target": "" }
require "ebisu_connection/replica" require "ebisu_connection/load_balancer" module EbisuConnection class ConnectionManager < FreshConnection::AbstractConnectionManager class AllReplicaHasGoneError < StandardError; end def initialize(spec_name = nil) super @replicas = replica_conf.map do |conf| Replica.new(conf, spec_name) end end def replica_connection raise AllReplicaHasGoneError if @replicas.empty? load_balancer.replica.connection end def put_aside! @replicas.each(&:put_aside!) end def clear_all_connections! @replicas.each(&:disconnect!) end def recovery? dead_replicas = @replicas.select do |replica| c = replica.connection rescue nil !c || !c.active? end return false if dead_replicas.empty? dead_replicas.each do |replica| replica.disconnect! @replicas.delete(replica) end raise AllReplicaHasGoneError if @replicas.empty? @load_balancer = nil true end private def load_balancer @load_balancer ||= LoadBalancer.new(@replicas) end def replica_conf @replica_conf ||= Config.new(spec_name) end end end
{ "content_hash": "97e362507d16fbc0761343448b388539", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 70, "avg_line_length": 21.25862068965517, "alnum_prop": 0.6520681265206812, "repo_name": "tsukasaoishi/ebisu_connection", "id": "da0ed8de24a87def4a7208c205b4d0d04d90b738", "size": "1233", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "lib/ebisu_connection/connection_manager.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "13285" }, { "name": "Shell", "bytes": "267" } ], "symlink_target": "" }
//Server starten var express = require('express'); var app = express(); var server = app.listen(3000,function(){ console.log('Server wurde gestartet'); }); app.use(express.static('websites')); //Module für die Get/Post etc aufrufe var _ = require('underscore'); var players = require('./generated.json'); // // //Socket Setup////////////////////////////////////////////////// var socket = require('socket.io'); var io = socket(server); io.on('connection',function(socket){ console.log('Socket Verbindung hergestellt', socket.id); //auf chat emit reagieren, data daten die gesendet werden socket.on('chat', function(data){ //wegen bug gemacht console.log('jetzt Server.js methode chat'); //remote call io.sockets.emit('chat', data); }); }); //////////////////////////////////////////////////////////////// app.get('/api/players', function(req,res){ if(req.query.favorites && req.query.favorites == 'true'){ console.log('Favoriten werden angezeigt'); var active = 'isActive'; var filtered = _.filter(players,function(element){ return element[active] === true; }); //console.log(filtered); return res.json(filtered); } if(!req.query.favorite && !req.query.search){ console.log('Alle Spieler'); console.log(players); return res.json(players); } if(req.query.search){ var buchstabe = req.query.search; console.log('Nach '+' '+buchstabe + 'wird sortiert'); var reg = new RegExp('^' + buchstabe); var nachname = 'name'; var filter = _.filter(players,function(element){ return reg.test(element[nachname]); }); console.log('Nach Char sortiert wird gesendet'); return res.json(filter); } }); app.delete('/api/players/:id',function(req,res){ var id = req.params.id; var deletedPlayers = players; console.log('delete request für id: ' + id); var identifier = '_id'; var filtered = _.filter(deletedPlayers,function(element){ if(element[identifier] === id){ /* delete element._id; delete element.name; delete element.vorname; delete element.verein; delete element.coach; delete element.position; delete element.number; delete element.jahr; delete element.isActive; //console.log(delete element); //console.log(deletedPlayers); */ delete element; } return element; }); res.json(filtered); //res.end('gelöscht'); }); app.post('/api/players', function(req,res){ var antwort = {"message":"Spieler wurde erfolgreich gespeichert"}; console.log('POST'); res.json(antwort); }); app.put('/api/players/:id', function(req,res){ var id = req.params.id; console.log(id); var antwort = {"message":"Spieler geupdatet"}; res.json(antwort); }); //CHAT WEBSOCKETS
{ "content_hash": "1310c7cedcaa018928ba07bfca9a2fa3", "timestamp": "", "source": "github", "line_count": 111, "max_line_length": 68, "avg_line_length": 25.18018018018018, "alnum_prop": 0.6182468694096601, "repo_name": "JannisMD/HyperSexyScriptSquad", "id": "fc38a46248d90fd47aa463a7a54149b0975d0d82", "size": "2798", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BasketballSeite/server.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10573" }, { "name": "HTML", "bytes": "9251" }, { "name": "JavaScript", "bytes": "12724" } ], "symlink_target": "" }
<?php namespace RKuzovlev\GoogleAPI\Service; use RKuzovlev\GoogleAPI\Service as Google_Service; use RKuzovlev\GoogleAPI\Service\Resource as Google_Service_Resource; use RKuzovlev\GoogleAPI\Collection as Google_Collection; use RKuzovlev\GoogleAPI\Model as Google_Model; use RKuzovlev\GoogleAPI\Client as Google_Client; /** * Service definition for AdSenseHost (v4.1). * * <p> * Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities. * </p> * * <p> * For more information about this service, see the API * <a href="https://developers.google.com/adsense/host/" target="_blank">Documentation</a> * </p> * * @author Google, Inc. */ class Google_Service_AdSenseHost extends Google_Service { /** View and manage your AdSense host data and associated accounts. */ const ADSENSEHOST = "https://www.googleapis.com/auth/adsensehost"; public $accounts; public $accounts_adclients; public $accounts_adunits; public $accounts_reports; public $adclients; public $associationsessions; public $customchannels; public $reports; public $urlchannels; /** * Constructs the internal representation of the AdSenseHost service. * * @param Google_Client $client */ public function __construct(Google_Client $client) { parent::__construct($client); $this->servicePath = 'adsensehost/v4.1/'; $this->version = 'v4.1'; $this->serviceName = 'adsensehost'; $this->accounts = new Google_Service_AdSenseHost_Accounts_Resource( $this, $this->serviceName, 'accounts', array( 'methods' => array( 'get' => array( 'path' => 'accounts/{accountId}', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'accounts', 'httpMethod' => 'GET', 'parameters' => array( 'filterAdClientId' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, 'required' => true, ), ), ), ) ) ); $this->accounts_adclients = new Google_Service_AdSenseHost_AccountsAdclients_Resource( $this, $this->serviceName, 'adclients', array( 'methods' => array( 'get' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'accounts/{accountId}/adclients', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'pageToken' => array( 'location' => 'query', 'type' => 'string', ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), ), ), ) ) ); $this->accounts_adunits = new Google_Service_AdSenseHost_AccountsAdunits_Resource( $this, $this->serviceName, 'adunits', array( 'methods' => array( 'delete' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}', 'httpMethod' => 'DELETE', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adUnitId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'get' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adUnitId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'getAdCode' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adUnitId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'hostCustomChannelId' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), ), ),'insert' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits', 'httpMethod' => 'POST', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'includeInactive' => array( 'location' => 'query', 'type' => 'boolean', ), 'pageToken' => array( 'location' => 'query', 'type' => 'string', ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), ), ),'patch' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits', 'httpMethod' => 'PATCH', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adUnitId' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), ), ),'update' => array( 'path' => 'accounts/{accountId}/adclients/{adClientId}/adunits', 'httpMethod' => 'PUT', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ), ) ) ); $this->accounts_reports = new Google_Service_AdSenseHost_AccountsReports_Resource( $this, $this->serviceName, 'reports', array( 'methods' => array( 'generate' => array( 'path' => 'accounts/{accountId}/reports', 'httpMethod' => 'GET', 'parameters' => array( 'accountId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'startDate' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), 'endDate' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), 'sort' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'locale' => array( 'location' => 'query', 'type' => 'string', ), 'metric' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), 'filter' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'startIndex' => array( 'location' => 'query', 'type' => 'integer', ), 'dimension' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), ), ), ) ) ); $this->adclients = new Google_Service_AdSenseHost_Adclients_Resource( $this, $this->serviceName, 'adclients', array( 'methods' => array( 'get' => array( 'path' => 'adclients/{adClientId}', 'httpMethod' => 'GET', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'adclients', 'httpMethod' => 'GET', 'parameters' => array( 'pageToken' => array( 'location' => 'query', 'type' => 'string', ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), ), ), ) ) ); $this->associationsessions = new Google_Service_AdSenseHost_Associationsessions_Resource( $this, $this->serviceName, 'associationsessions', array( 'methods' => array( 'start' => array( 'path' => 'associationsessions/start', 'httpMethod' => 'GET', 'parameters' => array( 'productCode' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, 'required' => true, ), 'websiteUrl' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), 'websiteLocale' => array( 'location' => 'query', 'type' => 'string', ), 'userLocale' => array( 'location' => 'query', 'type' => 'string', ), ), ),'verify' => array( 'path' => 'associationsessions/verify', 'httpMethod' => 'GET', 'parameters' => array( 'token' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), ), ), ) ) ); $this->customchannels = new Google_Service_AdSenseHost_Customchannels_Resource( $this, $this->serviceName, 'customchannels', array( 'methods' => array( 'delete' => array( 'path' => 'adclients/{adClientId}/customchannels/{customChannelId}', 'httpMethod' => 'DELETE', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'customChannelId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'get' => array( 'path' => 'adclients/{adClientId}/customchannels/{customChannelId}', 'httpMethod' => 'GET', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'customChannelId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'insert' => array( 'path' => 'adclients/{adClientId}/customchannels', 'httpMethod' => 'POST', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'adclients/{adClientId}/customchannels', 'httpMethod' => 'GET', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'pageToken' => array( 'location' => 'query', 'type' => 'string', ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), ), ),'patch' => array( 'path' => 'adclients/{adClientId}/customchannels', 'httpMethod' => 'PATCH', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'customChannelId' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), ), ),'update' => array( 'path' => 'adclients/{adClientId}/customchannels', 'httpMethod' => 'PUT', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ), ) ) ); $this->reports = new Google_Service_AdSenseHost_Reports_Resource( $this, $this->serviceName, 'reports', array( 'methods' => array( 'generate' => array( 'path' => 'reports', 'httpMethod' => 'GET', 'parameters' => array( 'startDate' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), 'endDate' => array( 'location' => 'query', 'type' => 'string', 'required' => true, ), 'sort' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'locale' => array( 'location' => 'query', 'type' => 'string', ), 'metric' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), 'filter' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), 'startIndex' => array( 'location' => 'query', 'type' => 'integer', ), 'dimension' => array( 'location' => 'query', 'type' => 'string', 'repeated' => true, ), ), ), ) ) ); $this->urlchannels = new Google_Service_AdSenseHost_Urlchannels_Resource( $this, $this->serviceName, 'urlchannels', array( 'methods' => array( 'delete' => array( 'path' => 'adclients/{adClientId}/urlchannels/{urlChannelId}', 'httpMethod' => 'DELETE', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'urlChannelId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'insert' => array( 'path' => 'adclients/{adClientId}/urlchannels', 'httpMethod' => 'POST', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), ), ),'list' => array( 'path' => 'adclients/{adClientId}/urlchannels', 'httpMethod' => 'GET', 'parameters' => array( 'adClientId' => array( 'location' => 'path', 'type' => 'string', 'required' => true, ), 'pageToken' => array( 'location' => 'query', 'type' => 'string', ), 'maxResults' => array( 'location' => 'query', 'type' => 'integer', ), ), ), ) ) ); } } /** * The "accounts" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $accounts = $adsensehostService->accounts; * </code> */ class Google_Service_AdSenseHost_Accounts_Resource extends Google_Service_Resource { /** * Get information about the selected associated AdSense account. (accounts.get) * * @param string $accountId * Account to get information about. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_Account */ public function get($accountId, $optParams = array()) { $params = array('accountId' => $accountId); $params = array_merge($params, $optParams); return $this->call('get', array($params), "Google_Service_AdSenseHost_Account"); } /** * List hosted accounts associated with this AdSense account by ad client id. * (accounts.listAccounts) * * @param string $filterAdClientId * Ad clients to list accounts for. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_Accounts */ public function listAccounts($filterAdClientId, $optParams = array()) { $params = array('filterAdClientId' => $filterAdClientId); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_Accounts"); } } /** * The "adclients" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $adclients = $adsensehostService->adclients; * </code> */ class Google_Service_AdSenseHost_AccountsAdclients_Resource extends Google_Service_Resource { /** * Get information about one of the ad clients in the specified publisher's * AdSense account. (adclients.get) * * @param string $accountId * Account which contains the ad client. * @param string $adClientId * Ad client to get. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdClient */ public function get($accountId, $adClientId, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId); $params = array_merge($params, $optParams); return $this->call('get', array($params), "Google_Service_AdSenseHost_AdClient"); } /** * List all hosted ad clients in the specified hosted account. * (adclients.listAccountsAdclients) * * @param string $accountId * Account for which to list ad clients. * @param array $optParams Optional parameters. * * @opt_param string pageToken * A continuation token, used to page through ad clients. To retrieve the next page, set this * parameter to the value of "nextPageToken" from the previous response. * @opt_param string maxResults * The maximum number of ad clients to include in the response, used for paging. * @return Google_Service_AdSenseHost_AdClients */ public function listAccountsAdclients($accountId, $optParams = array()) { $params = array('accountId' => $accountId); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_AdClients"); } } /** * The "adunits" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $adunits = $adsensehostService->adunits; * </code> */ class Google_Service_AdSenseHost_AccountsAdunits_Resource extends Google_Service_Resource { /** * Delete the specified ad unit from the specified publisher AdSense account. * (adunits.delete) * * @param string $accountId * Account which contains the ad unit. * @param string $adClientId * Ad client for which to get ad unit. * @param string $adUnitId * Ad unit to delete. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdUnit */ public function delete($accountId, $adClientId, $adUnitId, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId); $params = array_merge($params, $optParams); return $this->call('delete', array($params), "Google_Service_AdSenseHost_AdUnit"); } /** * Get the specified host ad unit in this AdSense account. (adunits.get) * * @param string $accountId * Account which contains the ad unit. * @param string $adClientId * Ad client for which to get ad unit. * @param string $adUnitId * Ad unit to get. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdUnit */ public function get($accountId, $adClientId, $adUnitId, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId); $params = array_merge($params, $optParams); return $this->call('get', array($params), "Google_Service_AdSenseHost_AdUnit"); } /** * Get ad code for the specified ad unit, attaching the specified host custom * channels. (adunits.getAdCode) * * @param string $accountId * Account which contains the ad client. * @param string $adClientId * Ad client with contains the ad unit. * @param string $adUnitId * Ad unit to get the code for. * @param array $optParams Optional parameters. * * @opt_param string hostCustomChannelId * Host custom channel to attach to the ad code. * @return Google_Service_AdSenseHost_AdCode */ public function getAdCode($accountId, $adClientId, $adUnitId, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId); $params = array_merge($params, $optParams); return $this->call('getAdCode', array($params), "Google_Service_AdSenseHost_AdCode"); } /** * Insert the supplied ad unit into the specified publisher AdSense account. * (adunits.insert) * * @param string $accountId * Account which will contain the ad unit. * @param string $adClientId * Ad client into which to insert the ad unit. * @param Google_AdUnit $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdUnit */ public function insert($accountId, $adClientId, Google_Service_AdSenseHost_AdUnit $postBody, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('insert', array($params), "Google_Service_AdSenseHost_AdUnit"); } /** * List all ad units in the specified publisher's AdSense account. * (adunits.listAccountsAdunits) * * @param string $accountId * Account which contains the ad client. * @param string $adClientId * Ad client for which to list ad units. * @param array $optParams Optional parameters. * * @opt_param bool includeInactive * Whether to include inactive ad units. Default: true. * @opt_param string pageToken * A continuation token, used to page through ad units. To retrieve the next page, set this * parameter to the value of "nextPageToken" from the previous response. * @opt_param string maxResults * The maximum number of ad units to include in the response, used for paging. * @return Google_Service_AdSenseHost_AdUnits */ public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_AdUnits"); } /** * Update the supplied ad unit in the specified publisher AdSense account. This * method supports patch semantics. (adunits.patch) * * @param string $accountId * Account which contains the ad client. * @param string $adClientId * Ad client which contains the ad unit. * @param string $adUnitId * Ad unit to get. * @param Google_AdUnit $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdUnit */ public function patch($accountId, $adClientId, $adUnitId, Google_Service_AdSenseHost_AdUnit $postBody, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('patch', array($params), "Google_Service_AdSenseHost_AdUnit"); } /** * Update the supplied ad unit in the specified publisher AdSense account. * (adunits.update) * * @param string $accountId * Account which contains the ad client. * @param string $adClientId * Ad client which contains the ad unit. * @param Google_AdUnit $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdUnit */ public function update($accountId, $adClientId, Google_Service_AdSenseHost_AdUnit $postBody, $optParams = array()) { $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('update', array($params), "Google_Service_AdSenseHost_AdUnit"); } } /** * The "reports" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $reports = $adsensehostService->reports; * </code> */ class Google_Service_AdSenseHost_AccountsReports_Resource extends Google_Service_Resource { /** * Generate an AdSense report based on the report request sent in the query * parameters. Returns the result as JSON; to retrieve output in CSV format * specify "alt=csv" as a query parameter. (reports.generate) * * @param string $accountId * Hosted account upon which to report. * @param string $startDate * Start of the date range to report on in "YYYY-MM-DD" format, inclusive. * @param string $endDate * End of the date range to report on in "YYYY-MM-DD" format, inclusive. * @param array $optParams Optional parameters. * * @opt_param string sort * The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" * to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted * ascending. * @opt_param string locale * Optional locale to use for translating report output to a local language. Defaults to "en_US" if * not specified. * @opt_param string metric * Numeric columns to include in the report. * @opt_param string maxResults * The maximum number of rows of report data to return. * @opt_param string filter * Filters to be run on the report. * @opt_param string startIndex * Index of the first row of report data to return. * @opt_param string dimension * Dimensions to base the report on. * @return Google_Service_AdSenseHost_Report */ public function generate($accountId, $startDate, $endDate, $optParams = array()) { $params = array('accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate); $params = array_merge($params, $optParams); return $this->call('generate', array($params), "Google_Service_AdSenseHost_Report"); } } /** * The "adclients" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $adclients = $adsensehostService->adclients; * </code> */ class Google_Service_AdSenseHost_Adclients_Resource extends Google_Service_Resource { /** * Get information about one of the ad clients in the Host AdSense account. * (adclients.get) * * @param string $adClientId * Ad client to get. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AdClient */ public function get($adClientId, $optParams = array()) { $params = array('adClientId' => $adClientId); $params = array_merge($params, $optParams); return $this->call('get', array($params), "Google_Service_AdSenseHost_AdClient"); } /** * List all host ad clients in this AdSense account. (adclients.listAdclients) * * @param array $optParams Optional parameters. * * @opt_param string pageToken * A continuation token, used to page through ad clients. To retrieve the next page, set this * parameter to the value of "nextPageToken" from the previous response. * @opt_param string maxResults * The maximum number of ad clients to include in the response, used for paging. * @return Google_Service_AdSenseHost_AdClients */ public function listAdclients($optParams = array()) { $params = array(); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_AdClients"); } } /** * The "associationsessions" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $associationsessions = $adsensehostService->associationsessions; * </code> */ class Google_Service_AdSenseHost_Associationsessions_Resource extends Google_Service_Resource { /** * Create an association session for initiating an association with an AdSense * user. (associationsessions.start) * * @param string $productCode * Products to associate with the user. * @param string $websiteUrl * The URL of the user's hosted website. * @param array $optParams Optional parameters. * * @opt_param string websiteLocale * The locale of the user's hosted website. * @opt_param string userLocale * The preferred locale of the user. * @return Google_Service_AdSenseHost_AssociationSession */ public function start($productCode, $websiteUrl, $optParams = array()) { $params = array('productCode' => $productCode, 'websiteUrl' => $websiteUrl); $params = array_merge($params, $optParams); return $this->call('start', array($params), "Google_Service_AdSenseHost_AssociationSession"); } /** * Verify an association session after the association callback returns from * AdSense signup. (associationsessions.verify) * * @param string $token * The token returned to the association callback URL. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_AssociationSession */ public function verify($token, $optParams = array()) { $params = array('token' => $token); $params = array_merge($params, $optParams); return $this->call('verify', array($params), "Google_Service_AdSenseHost_AssociationSession"); } } /** * The "customchannels" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $customchannels = $adsensehostService->customchannels; * </code> */ class Google_Service_AdSenseHost_Customchannels_Resource extends Google_Service_Resource { /** * Delete a specific custom channel from the host AdSense account. * (customchannels.delete) * * @param string $adClientId * Ad client from which to delete the custom channel. * @param string $customChannelId * Custom channel to delete. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_CustomChannel */ public function delete($adClientId, $customChannelId, $optParams = array()) { $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId); $params = array_merge($params, $optParams); return $this->call('delete', array($params), "Google_Service_AdSenseHost_CustomChannel"); } /** * Get a specific custom channel from the host AdSense account. * (customchannels.get) * * @param string $adClientId * Ad client from which to get the custom channel. * @param string $customChannelId * Custom channel to get. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_CustomChannel */ public function get($adClientId, $customChannelId, $optParams = array()) { $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId); $params = array_merge($params, $optParams); return $this->call('get', array($params), "Google_Service_AdSenseHost_CustomChannel"); } /** * Add a new custom channel to the host AdSense account. (customchannels.insert) * * @param string $adClientId * Ad client to which the new custom channel will be added. * @param Google_CustomChannel $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_CustomChannel */ public function insert($adClientId, Google_Service_AdSenseHost_CustomChannel $postBody, $optParams = array()) { $params = array('adClientId' => $adClientId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('insert', array($params), "Google_Service_AdSenseHost_CustomChannel"); } /** * List all host custom channels in this AdSense account. * (customchannels.listCustomchannels) * * @param string $adClientId * Ad client for which to list custom channels. * @param array $optParams Optional parameters. * * @opt_param string pageToken * A continuation token, used to page through custom channels. To retrieve the next page, set this * parameter to the value of "nextPageToken" from the previous response. * @opt_param string maxResults * The maximum number of custom channels to include in the response, used for paging. * @return Google_Service_AdSenseHost_CustomChannels */ public function listCustomchannels($adClientId, $optParams = array()) { $params = array('adClientId' => $adClientId); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_CustomChannels"); } /** * Update a custom channel in the host AdSense account. This method supports * patch semantics. (customchannels.patch) * * @param string $adClientId * Ad client in which the custom channel will be updated. * @param string $customChannelId * Custom channel to get. * @param Google_CustomChannel $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_CustomChannel */ public function patch($adClientId, $customChannelId, Google_Service_AdSenseHost_CustomChannel $postBody, $optParams = array()) { $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('patch', array($params), "Google_Service_AdSenseHost_CustomChannel"); } /** * Update a custom channel in the host AdSense account. (customchannels.update) * * @param string $adClientId * Ad client in which the custom channel will be updated. * @param Google_CustomChannel $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_CustomChannel */ public function update($adClientId, Google_Service_AdSenseHost_CustomChannel $postBody, $optParams = array()) { $params = array('adClientId' => $adClientId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('update', array($params), "Google_Service_AdSenseHost_CustomChannel"); } } /** * The "reports" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $reports = $adsensehostService->reports; * </code> */ class Google_Service_AdSenseHost_Reports_Resource extends Google_Service_Resource { /** * Generate an AdSense report based on the report request sent in the query * parameters. Returns the result as JSON; to retrieve output in CSV format * specify "alt=csv" as a query parameter. (reports.generate) * * @param string $startDate * Start of the date range to report on in "YYYY-MM-DD" format, inclusive. * @param string $endDate * End of the date range to report on in "YYYY-MM-DD" format, inclusive. * @param array $optParams Optional parameters. * * @opt_param string sort * The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" * to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted * ascending. * @opt_param string locale * Optional locale to use for translating report output to a local language. Defaults to "en_US" if * not specified. * @opt_param string metric * Numeric columns to include in the report. * @opt_param string maxResults * The maximum number of rows of report data to return. * @opt_param string filter * Filters to be run on the report. * @opt_param string startIndex * Index of the first row of report data to return. * @opt_param string dimension * Dimensions to base the report on. * @return Google_Service_AdSenseHost_Report */ public function generate($startDate, $endDate, $optParams = array()) { $params = array('startDate' => $startDate, 'endDate' => $endDate); $params = array_merge($params, $optParams); return $this->call('generate', array($params), "Google_Service_AdSenseHost_Report"); } } /** * The "urlchannels" collection of methods. * Typical usage is: * <code> * $adsensehostService = new Google_Service_AdSenseHost(...); * $urlchannels = $adsensehostService->urlchannels; * </code> */ class Google_Service_AdSenseHost_Urlchannels_Resource extends Google_Service_Resource { /** * Delete a URL channel from the host AdSense account. (urlchannels.delete) * * @param string $adClientId * Ad client from which to delete the URL channel. * @param string $urlChannelId * URL channel to delete. * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_UrlChannel */ public function delete($adClientId, $urlChannelId, $optParams = array()) { $params = array('adClientId' => $adClientId, 'urlChannelId' => $urlChannelId); $params = array_merge($params, $optParams); return $this->call('delete', array($params), "Google_Service_AdSenseHost_UrlChannel"); } /** * Add a new URL channel to the host AdSense account. (urlchannels.insert) * * @param string $adClientId * Ad client to which the new URL channel will be added. * @param Google_UrlChannel $postBody * @param array $optParams Optional parameters. * @return Google_Service_AdSenseHost_UrlChannel */ public function insert($adClientId, Google_Service_AdSenseHost_UrlChannel $postBody, $optParams = array()) { $params = array('adClientId' => $adClientId, 'postBody' => $postBody); $params = array_merge($params, $optParams); return $this->call('insert', array($params), "Google_Service_AdSenseHost_UrlChannel"); } /** * List all host URL channels in the host AdSense account. * (urlchannels.listUrlchannels) * * @param string $adClientId * Ad client for which to list URL channels. * @param array $optParams Optional parameters. * * @opt_param string pageToken * A continuation token, used to page through URL channels. To retrieve the next page, set this * parameter to the value of "nextPageToken" from the previous response. * @opt_param string maxResults * The maximum number of URL channels to include in the response, used for paging. * @return Google_Service_AdSenseHost_UrlChannels */ public function listUrlchannels($adClientId, $optParams = array()) { $params = array('adClientId' => $adClientId); $params = array_merge($params, $optParams); return $this->call('list', array($params), "Google_Service_AdSenseHost_UrlChannels"); } } class Google_Service_AdSenseHost_Account extends Google_Model { public $id; public $kind; public $name; public $status; public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function setStatus($status) { $this->status = $status; } public function getStatus() { return $this->status; } } class Google_Service_AdSenseHost_Accounts extends Google_Collection { public $etag; protected $itemsType = 'Google_Service_AdSenseHost_Account'; protected $itemsDataType = 'array'; public $kind; public function setEtag($etag) { $this->etag = $etag; } public function getEtag() { return $this->etag; } public function setItems($items) { $this->items = $items; } public function getItems() { return $this->items; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } } class Google_Service_AdSenseHost_AdClient extends Google_Model { public $arcOptIn; public $id; public $kind; public $productCode; public $supportsReporting; public function setArcOptIn($arcOptIn) { $this->arcOptIn = $arcOptIn; } public function getArcOptIn() { return $this->arcOptIn; } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setProductCode($productCode) { $this->productCode = $productCode; } public function getProductCode() { return $this->productCode; } public function setSupportsReporting($supportsReporting) { $this->supportsReporting = $supportsReporting; } public function getSupportsReporting() { return $this->supportsReporting; } } class Google_Service_AdSenseHost_AdClients extends Google_Collection { public $etag; protected $itemsType = 'Google_Service_AdSenseHost_AdClient'; protected $itemsDataType = 'array'; public $kind; public $nextPageToken; public function setEtag($etag) { $this->etag = $etag; } public function getEtag() { return $this->etag; } public function setItems($items) { $this->items = $items; } public function getItems() { return $this->items; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setNextPageToken($nextPageToken) { $this->nextPageToken = $nextPageToken; } public function getNextPageToken() { return $this->nextPageToken; } } class Google_Service_AdSenseHost_AdCode extends Google_Model { public $adCode; public $kind; public function setAdCode($adCode) { $this->adCode = $adCode; } public function getAdCode() { return $this->adCode; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } } class Google_Service_AdSenseHost_AdStyle extends Google_Model { protected $colorsType = 'Google_Service_AdSenseHost_AdStyleColors'; protected $colorsDataType = ''; public $corners; protected $fontType = 'Google_Service_AdSenseHost_AdStyleFont'; protected $fontDataType = ''; public $kind; public function setColors(Google_Service_AdSenseHost_AdStyleColors $colors) { $this->colors = $colors; } public function getColors() { return $this->colors; } public function setCorners($corners) { $this->corners = $corners; } public function getCorners() { return $this->corners; } public function setFont(Google_Service_AdSenseHost_AdStyleFont $font) { $this->font = $font; } public function getFont() { return $this->font; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } } class Google_Service_AdSenseHost_AdStyleColors extends Google_Model { public $background; public $border; public $text; public $title; public $url; public function setBackground($background) { $this->background = $background; } public function getBackground() { return $this->background; } public function setBorder($border) { $this->border = $border; } public function getBorder() { return $this->border; } public function setText($text) { $this->text = $text; } public function getText() { return $this->text; } public function setTitle($title) { $this->title = $title; } public function getTitle() { return $this->title; } public function setUrl($url) { $this->url = $url; } public function getUrl() { return $this->url; } } class Google_Service_AdSenseHost_AdStyleFont extends Google_Model { public $family; public $size; public function setFamily($family) { $this->family = $family; } public function getFamily() { return $this->family; } public function setSize($size) { $this->size = $size; } public function getSize() { return $this->size; } } class Google_Service_AdSenseHost_AdUnit extends Google_Model { public $code; protected $contentAdsSettingsType = 'Google_Service_AdSenseHost_AdUnitContentAdsSettings'; protected $contentAdsSettingsDataType = ''; protected $customStyleType = 'Google_Service_AdSenseHost_AdStyle'; protected $customStyleDataType = ''; public $id; public $kind; protected $mobileContentAdsSettingsType = 'Google_Service_AdSenseHost_AdUnitMobileContentAdsSettings'; protected $mobileContentAdsSettingsDataType = ''; public $name; public $status; public function setCode($code) { $this->code = $code; } public function getCode() { return $this->code; } public function setContentAdsSettings(Google_Service_AdSenseHost_AdUnitContentAdsSettings $contentAdsSettings) { $this->contentAdsSettings = $contentAdsSettings; } public function getContentAdsSettings() { return $this->contentAdsSettings; } public function setCustomStyle(Google_Service_AdSenseHost_AdStyle $customStyle) { $this->customStyle = $customStyle; } public function getCustomStyle() { return $this->customStyle; } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setMobileContentAdsSettings(Google_Service_AdSenseHost_AdUnitMobileContentAdsSettings $mobileContentAdsSettings) { $this->mobileContentAdsSettings = $mobileContentAdsSettings; } public function getMobileContentAdsSettings() { return $this->mobileContentAdsSettings; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function setStatus($status) { $this->status = $status; } public function getStatus() { return $this->status; } } class Google_Service_AdSenseHost_AdUnitContentAdsSettings extends Google_Model { protected $backupOptionType = 'Google_Service_AdSenseHost_AdUnitContentAdsSettingsBackupOption'; protected $backupOptionDataType = ''; public $size; public $type; public function setBackupOption(Google_Service_AdSenseHost_AdUnitContentAdsSettingsBackupOption $backupOption) { $this->backupOption = $backupOption; } public function getBackupOption() { return $this->backupOption; } public function setSize($size) { $this->size = $size; } public function getSize() { return $this->size; } public function setType($type) { $this->type = $type; } public function getType() { return $this->type; } } class Google_Service_AdSenseHost_AdUnitContentAdsSettingsBackupOption extends Google_Model { public $color; public $type; public $url; public function setColor($color) { $this->color = $color; } public function getColor() { return $this->color; } public function setType($type) { $this->type = $type; } public function getType() { return $this->type; } public function setUrl($url) { $this->url = $url; } public function getUrl() { return $this->url; } } class Google_Service_AdSenseHost_AdUnitMobileContentAdsSettings extends Google_Model { public $markupLanguage; public $scriptingLanguage; public $size; public $type; public function setMarkupLanguage($markupLanguage) { $this->markupLanguage = $markupLanguage; } public function getMarkupLanguage() { return $this->markupLanguage; } public function setScriptingLanguage($scriptingLanguage) { $this->scriptingLanguage = $scriptingLanguage; } public function getScriptingLanguage() { return $this->scriptingLanguage; } public function setSize($size) { $this->size = $size; } public function getSize() { return $this->size; } public function setType($type) { $this->type = $type; } public function getType() { return $this->type; } } class Google_Service_AdSenseHost_AdUnits extends Google_Collection { public $etag; protected $itemsType = 'Google_Service_AdSenseHost_AdUnit'; protected $itemsDataType = 'array'; public $kind; public $nextPageToken; public function setEtag($etag) { $this->etag = $etag; } public function getEtag() { return $this->etag; } public function setItems($items) { $this->items = $items; } public function getItems() { return $this->items; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setNextPageToken($nextPageToken) { $this->nextPageToken = $nextPageToken; } public function getNextPageToken() { return $this->nextPageToken; } } class Google_Service_AdSenseHost_AssociationSession extends Google_Collection { public $accountId; public $id; public $kind; public $productCodes; public $redirectUrl; public $status; public $userLocale; public $websiteLocale; public $websiteUrl; public function setAccountId($accountId) { $this->accountId = $accountId; } public function getAccountId() { return $this->accountId; } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setProductCodes($productCodes) { $this->productCodes = $productCodes; } public function getProductCodes() { return $this->productCodes; } public function setRedirectUrl($redirectUrl) { $this->redirectUrl = $redirectUrl; } public function getRedirectUrl() { return $this->redirectUrl; } public function setStatus($status) { $this->status = $status; } public function getStatus() { return $this->status; } public function setUserLocale($userLocale) { $this->userLocale = $userLocale; } public function getUserLocale() { return $this->userLocale; } public function setWebsiteLocale($websiteLocale) { $this->websiteLocale = $websiteLocale; } public function getWebsiteLocale() { return $this->websiteLocale; } public function setWebsiteUrl($websiteUrl) { $this->websiteUrl = $websiteUrl; } public function getWebsiteUrl() { return $this->websiteUrl; } } class Google_Service_AdSenseHost_CustomChannel extends Google_Model { public $code; public $id; public $kind; public $name; public function setCode($code) { $this->code = $code; } public function getCode() { return $this->code; } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } } class Google_Service_AdSenseHost_CustomChannels extends Google_Collection { public $etag; protected $itemsType = 'Google_Service_AdSenseHost_CustomChannel'; protected $itemsDataType = 'array'; public $kind; public $nextPageToken; public function setEtag($etag) { $this->etag = $etag; } public function getEtag() { return $this->etag; } public function setItems($items) { $this->items = $items; } public function getItems() { return $this->items; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setNextPageToken($nextPageToken) { $this->nextPageToken = $nextPageToken; } public function getNextPageToken() { return $this->nextPageToken; } } class Google_Service_AdSenseHost_Report extends Google_Collection { public $averages; protected $headersType = 'Google_Service_AdSenseHost_ReportHeaders'; protected $headersDataType = 'array'; public $kind; public $rows; public $totalMatchedRows; public $totals; public $warnings; public function setAverages($averages) { $this->averages = $averages; } public function getAverages() { return $this->averages; } public function setHeaders($headers) { $this->headers = $headers; } public function getHeaders() { return $this->headers; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setRows($rows) { $this->rows = $rows; } public function getRows() { return $this->rows; } public function setTotalMatchedRows($totalMatchedRows) { $this->totalMatchedRows = $totalMatchedRows; } public function getTotalMatchedRows() { return $this->totalMatchedRows; } public function setTotals($totals) { $this->totals = $totals; } public function getTotals() { return $this->totals; } public function setWarnings($warnings) { $this->warnings = $warnings; } public function getWarnings() { return $this->warnings; } } class Google_Service_AdSenseHost_ReportHeaders extends Google_Model { public $currency; public $name; public $type; public function setCurrency($currency) { $this->currency = $currency; } public function getCurrency() { return $this->currency; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function setType($type) { $this->type = $type; } public function getType() { return $this->type; } } class Google_Service_AdSenseHost_UrlChannel extends Google_Model { public $id; public $kind; public $urlPattern; public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setUrlPattern($urlPattern) { $this->urlPattern = $urlPattern; } public function getUrlPattern() { return $this->urlPattern; } } class Google_Service_AdSenseHost_UrlChannels extends Google_Collection { public $etag; protected $itemsType = 'Google_Service_AdSenseHost_UrlChannel'; protected $itemsDataType = 'array'; public $kind; public $nextPageToken; public function setEtag($etag) { $this->etag = $etag; } public function getEtag() { return $this->etag; } public function setItems($items) { $this->items = $items; } public function getItems() { return $this->items; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setNextPageToken($nextPageToken) { $this->nextPageToken = $nextPageToken; } public function getNextPageToken() { return $this->nextPageToken; } }
{ "content_hash": "75367a7e561718fbba5f45320b0b3e6b", "timestamp": "", "source": "github", "line_count": 2277, "max_line_length": 130, "avg_line_length": 26.87878787878788, "alnum_prop": 0.5704132150384785, "repo_name": "rkuzovlev/google-api-php-client", "id": "866f3386cd9dbee2f8bdc76e9c9d99989dcefb8e", "size": "61793", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/RKuzovlev/GoogleAPI/Service/AdSenseHost.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "3394292" } ], "symlink_target": "" }
<div> <a href="https://www.aboutobjects.com"><img src="ao-logo.png" height=18 style="height: 18px;"/></a> </div> # Swift 4 Examples Explores a number of new capabilities in Swift 4, including: * Smart key paths * Key-Value Coding (KVC) * JSON encoding and decoding * Key-Value Observing (KVO) ## Author Jonathan Lehr, jonathan@aboutobjects.com ## License Available under the MIT license. See the LICENSE file for more info. ___ _Copyright &copy; 2017 [About Objects](https://www.aboutobjects.com). All rights reserved._
{ "content_hash": "9a4207d7423e27ed26a959ce4767e7ef", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 100, "avg_line_length": 20.5, "alnum_prop": 0.7148217636022514, "repo_name": "AboutObjectsTraining/Swift4Examples", "id": "9ef2b40c020cbca2a59d76ebf2108cb4e6593c6a", "size": "533", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "472" }, { "name": "Swift", "bytes": "43545" } ], "symlink_target": "" }
using System.Linq; using System.Web.Mvc; using Quintsys.Web.ThemeableRazorViewEngine.Annotations; namespace Quintsys.Web.ThemeableRazorViewEngine { /// <summary> /// Razor view engine with themes support. /// Caching is allowed since the structure of the FinApp project allows for only one Theme by stack. /// Currently supports C# only. Removed VB.NET support to increase perfomance on lookups. /// </summary> [UsedImplicitly] public class ThemeableRazorViewEngine : RazorViewEngine { /// <summary> /// Initializes a new instance of the <see cref="ThemeableRazorViewEngine" /> class. /// </summary> public ThemeableRazorViewEngine() : this(new[] {"cshtml", "vbhtml"}) { } /// <summary> /// Initializes a new instance of the <see cref="ThemeableRazorViewEngine" /> class. /// </summary> public ThemeableRazorViewEngine(params string[] fileExtensions) { FileExtensions = fileExtensions; string[] areaLocationFormats = CreateLocationFormats(LocationType.Area); AreaViewLocationFormats = areaLocationFormats; AreaMasterLocationFormats = areaLocationFormats; AreaPartialViewLocationFormats = areaLocationFormats; string[] defaultLocationFormats = CreateLocationFormats(LocationType.Default); ViewLocationFormats = defaultLocationFormats; MasterLocationFormats = defaultLocationFormats; PartialViewLocationFormats = defaultLocationFormats; } #region private members private string[] CreateLocationFormats(LocationType locationType) { string prefix = GetPrefixByLocationType(locationType); return FileExtensions .SelectMany(x => new[] { string.Format("{0}/Themes/%1/Views/{{1}}/{{0}}.{1}", prefix, x), string.Format("{0}/Themes/%1/Views/Shared/{{0}}.{1}", prefix, x), string.Format("{0}/Views/{{1}}/{{0}}.{1}", prefix, x), string.Format("{0}/Views/Shared/{{0}}.{1}", prefix, x) }) .ToArray(); } private static string GetPrefixByLocationType(LocationType locationType) { string prefix = null; switch (locationType) { case LocationType.Area: prefix = "~/Areas/{2}"; break; case LocationType.Default: prefix = "~"; break; } return prefix; } private enum LocationType { Default, Area } /// <summary> /// Creates a partial view using the specified controller context and partial path, including the Theme name. /// </summary> /// <param name="controllerContext">The controller context.</param> /// <param name="partialPath">The partial path.</param> /// <param name="themeName">Name of the theme.</param> /// <returns></returns> private IView CreateThemePartialView(ControllerContext controllerContext, string partialPath, string themeName) { string themePath = ThemePath(partialPath, themeName); return base.CreatePartialView(controllerContext, themePath); } /// <summary> /// Creates a view by using the specified controller context and the paths of the view and master view, including the /// Theme name. /// </summary> /// <param name="controllerContext">The controller context.</param> /// <param name="viewPath">The view path.</param> /// <param name="masterPath">The master path.</param> /// <param name="themeName">Name of the theme.</param> /// <returns></returns> private IView CreateThemeView(ControllerContext controllerContext, string viewPath, string masterPath, string themeName) { string themeViewPath = ThemePath(viewPath, themeName); string themeMasterPath = ThemePath(masterPath, themeName); return base.CreateView(controllerContext, themeViewPath, themeMasterPath); } /// <summary> /// Generates the correct theme path using a given theme name. /// </summary> /// <param name="virtualPath">The view path.</param> /// <param name="themeName">Name of the theme.</param> /// <returns></returns> private static string ThemePath(string virtualPath, string themeName) { const string themeNamePlaceholder = "%1"; return virtualPath.Replace(themeNamePlaceholder, themeName); } #endregion protected override bool FileExists(ControllerContext controllerContext, string virtualPath) { using (var themeController = controllerContext.Controller as ThemeController) { if (themeController != null) { return base.FileExists(controllerContext, ThemePath(virtualPath, themeController.CurrentTheme.Name)); } } return base.FileExists(controllerContext, virtualPath); } /// <summary> /// Creates a partial view using the specified controller context and partial path. /// </summary> /// <param name="controllerContext">The controller context.</param> /// <param name="partialPath">The path to the partial view.</param> /// <returns> /// The partial view. /// </returns> protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) { using (var themeController = controllerContext.Controller as ThemeController) { if (themeController != null) { return CreateThemePartialView(controllerContext, partialPath, themeController.CurrentTheme.Name); } } return base.CreatePartialView(controllerContext, partialPath); } /// <summary> /// Creates a view by using the specified controller context and the paths of the view and master view. /// </summary> /// <param name="controllerContext">The controller context.</param> /// <param name="viewPath">The path to the view.</param> /// <param name="masterPath">The path to the master view.</param> /// <returns> /// The view. /// </returns> protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) { using (var themeController = controllerContext.Controller as ThemeController) { if (themeController != null) { return CreateThemeView(controllerContext, viewPath, masterPath, themeController.CurrentTheme.Name); } } return base.CreateView(controllerContext, viewPath, masterPath); } } }
{ "content_hash": "ae8dc1dad25ea3ff364c77af3eba8925", "timestamp": "", "source": "github", "line_count": 180, "max_line_length": 129, "avg_line_length": 40.522222222222226, "alnum_prop": 0.5892514395393474, "repo_name": "QuintSys/ThemeableRazorViewEngine", "id": "72c1a7670a926311fc2b77677ba97585732ac7d8", "size": "7296", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ThemeableRazorViewEngine/ThemeableRazorViewEngine.MVC5/ThemeableRazorViewEngine.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "38188" }, { "name": "Pascal", "bytes": "393" } ], "symlink_target": "" }
class AccountFetcherService; class ChildAccountInfoFetcherAndroid { public: static std::unique_ptr<ChildAccountInfoFetcherAndroid> Create( AccountFetcherService* service, const CoreAccountId& account_id); ~ChildAccountInfoFetcherAndroid(); static void InitializeForTests(); private: ChildAccountInfoFetcherAndroid(AccountFetcherService* service, const CoreAccountId& account_id, const std::string& account_name); base::android::ScopedJavaGlobalRef<jobject> j_child_account_info_fetcher_; DISALLOW_COPY_AND_ASSIGN(ChildAccountInfoFetcherAndroid); }; #endif // COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_CHILD_ACCOUNT_INFO_FETCHER_ANDROID_H_
{ "content_hash": "88c1994dfaf04701dbcd9d80096c0043", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 92, "avg_line_length": 33.63636363636363, "alnum_prop": 0.727027027027027, "repo_name": "endlessm/chromium-browser", "id": "2b08d1229fb07e0ce8788efc2291ea193efd04d0", "size": "1212", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/signin/internal/identity_manager/child_account_info_fetcher_android.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<!doctype html> <html lang="en"> <head> <style>body { margin: 0; overflow: hidden; }</style> </head> <body> <script src="../../src/lib/three.js"></script> <script src="../../src/lib/Detector.js"></script> <script src="../../src/lib/TrackballControls.js"></script> <script src="../../src/lib/THREEx.FullScreen.js"></script> <script src="../../src/lib/THREEx.WindowResize.js"></script> <script src="../../src/lib/helvetiker_regular.typeface.js"></script> <script src="../../src/grow3.js"></script> <script src="../../src/grow3.Runner.js"></script> <script src="../js/{{file}}"></script> <script> document.title = (name || "") + " [grow3.js]" window.onload = function() { var runner = new grow3.Runner(document.body); runner.run(source); }; </script> </body> </html>
{ "content_hash": "2fc3ab780a8fbb148c003f3fdf2d6a56", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 76, "avg_line_length": 35.111111111111114, "alnum_prop": 0.5126582278481012, "repo_name": "filgf/grow3.js", "id": "8fe9c12b649a4614535e9651572effd918e6d911", "size": "948", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "utils/templates/example_template.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1616" }, { "name": "JavaScript", "bytes": "1081434" }, { "name": "Python", "bytes": "8755" } ], "symlink_target": "" }
package com.baomidou.mybatisplus.test.phoenix.mapper; import com.baomidou.mybatisplus.test.phoenix.PhoenixBaseMapper; import com.baomidou.mybatisplus.test.phoenix.entity.PhoenixTestInfo; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; /** * @author fly * @date 2019/5/22 17:55 * description: */ public interface PhoenixTestInfoMapper extends PhoenixBaseMapper<PhoenixTestInfo> { @Insert( "UPSERT INTO TEST_INFO " + "(ID, NAME) " + "VALUES(#{t.id},#{t.name})" ) void addTestInfo(@Param("t") PhoenixTestInfo t); }
{ "content_hash": "9da22d6c1f999a72783be6342a04e2ff", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 83, "avg_line_length": 30.095238095238095, "alnum_prop": 0.6772151898734177, "repo_name": "baomidou/mybatis-plus", "id": "552c82729b3c25e4a10f6c9cc58593fc093fb7f5", "size": "632", "binary": false, "copies": "1", "ref": "refs/heads/3.0", "path": "mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/phoenix/mapper/PhoenixTestInfoMapper.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1508446" }, { "name": "Kotlin", "bytes": "23239" } ], "symlink_target": "" }
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.googlecode.d2j</groupId> <artifactId>dex2jar</artifactId> <packaging>pom</packaging> <name>dex2jar</name> <version>2.0</version> <description>A tool for converting Android .dex format to Java .class format</description> <modules> <module>dex-reader-api</module> <module>dex-reader</module> <module>dex-writer</module> <module>dex-translator</module> <module>dex-ir</module> <module>dex-tools</module> <module>d2j-smali</module> <module>d2j-base-cmd</module> <module>d2j-jasmin</module> </modules> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.8</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8</version> <configuration> <show>public</show> </configuration> </plugin> </plugins> </reporting> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <compilerId>eclipse</compilerId> <source>1.7</source> <target>1.7</target> <optimize>true</optimize> <encoding>${project.build.sourceEncoding}</encoding> </configuration> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-eclipse</artifactId> <version>2.1</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.0.4</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4</version> <configuration> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.8</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8</version> <configuration> <show>public</show> <nohelp>true</nohelp> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <configuration> <archive> <manifest> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest> <manifestEntries> <Implementation-Build>${maven.build.timestamp}</Implementation-Build> </manifestEntries> </archive> </configuration> </plugin> </plugins> </build> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </project>
{ "content_hash": "1e840c8d72473f9a1be5658879241100", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 104, "avg_line_length": 38.739837398373986, "alnum_prop": 0.49464847848898214, "repo_name": "jslhs/dex2jar", "id": "d38f0b8dea61cdc6e6f5c0a75a2eb561d4df8445", "size": "4765", "binary": false, "copies": "2", "ref": "refs/heads/2.x", "path": "pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "326" }, { "name": "GAP", "bytes": "70332" }, { "name": "Jasmin", "bytes": "16583" }, { "name": "Java", "bytes": "1545112" }, { "name": "Shell", "bytes": "2661" } ], "symlink_target": "" }
/* jshint latedef:false */ /* jshint forin:false */ /* jshint noempty:false */ 'use strict'; var util = require('util'); var msRest = require('ms-rest'); var msRestAzure = require('ms-rest-azure'); var ServiceClient = msRestAzure.AzureServiceClient; var models = require('./models'); var operations = require('./operations'); /** * @class * Initializes a new instance of the DataLakeStoreFileSystemManagementClient class. * @constructor * * @param {credentials} credentials - Credentials needed for the client to connect to Azure. * * @param {object} [options] - The parameter options * * @param {Array} [options.filters] - Filters to be added to the request pipeline * * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * * @param {string} [options.apiVersion] - Client Api Version. * * @param {string} [options.adlsFileSystemDnsSuffix] - Gets the URI used as the base for all cloud service requests. * * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. * * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ function DataLakeStoreFileSystemManagementClient(credentials, options) { this.apiVersion = '2015-10-01-preview'; this.adlsFileSystemDnsSuffix = 'azuredatalakestore.net'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; if (credentials === null || credentials === undefined) { throw new Error('\'credentials\' cannot be null.'); } if (!options) options = {}; DataLakeStoreFileSystemManagementClient['super_'].call(this, credentials, options); this.baseUri = 'https://{accountName}.{adlsFileSystemDnsSuffix}'; this.credentials = credentials; if(options.apiVersion !== null && options.apiVersion !== undefined) { this.apiVersion = options.apiVersion; } if(options.adlsFileSystemDnsSuffix !== null && options.adlsFileSystemDnsSuffix !== undefined) { this.adlsFileSystemDnsSuffix = options.adlsFileSystemDnsSuffix; } if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { this.generateClientRequestId = options.generateClientRequestId; } this.fileSystem = new operations.FileSystem(this); this.models = models; msRest.addSerializationMixin(this); } util.inherits(DataLakeStoreFileSystemManagementClient, ServiceClient); module.exports = DataLakeStoreFileSystemManagementClient;
{ "content_hash": "d339dfeb3246d8e8abce4c212c201b99", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 170, "avg_line_length": 39.78048780487805, "alnum_prop": 0.7461679950950337, "repo_name": "smithab/azure-sdk-for-node", "id": "fd39c42d2f37d760b4d7dfe75a096afc3c0e17f0", "size": "3580", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "lib/services/dataLake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.js", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1246" }, { "name": "JavaScript", "bytes": "24385353" }, { "name": "Shell", "bytes": "437" } ], "symlink_target": "" }
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class UserFactory { private $_ci; //funcao construtora da biblioteca function __construct() { $this->_ci = & get_instance(); } //funcao que recupera todos os users do banco public function getAll (){ $query = $this->_ci->db->query("SELECT * FROM users;"); if ($query->num_rows() > 0) { $users = array(); foreach ($query->result() as $row) { $users[] = $this->createObjectFromData($row); } return $users; } return false; } //funcao que busca no banco um usuario de acordo com um email passado por parametro public function getUserByEmail ($email){ $query = $this->_ci->db->query("SELECT * FROM users WHERE email like \"%".$email."%\";"); if ($query->num_rows() > 0) { return $this->createObjectFromData($query->row()); } return false; } //funcao que persiste a model no banco public function commit ($user){ $sql = "INSERT INTO `users`(`nome`, `email`, `nascimento`, `genero`) VALUES ( \"". $user->getNome(). "\" , \"".$user->getEmail() ."\" , \"".$user->getNascimento()."\" , \"".$user->getGenero()."\");" ; //echo "<br>".$sql; $query = $this->_ci->db->query($sql); if ($query == 1) { return true; }else { return false; } } //cria um objeto apartir da consulta ao banco public function createObjectFromData($row) { //Cria um novo objeto user com os dados da consulta $user = new User(); $user->setNome($row->nome); $user->setEmail($row->email); $user->setNascimento($row->nascimento); $user->setGenero($row->genero); return $user; } }
{ "content_hash": "4fa786d9c7448dc62f52ba4b0d2c7421", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 208, "avg_line_length": 31.114754098360656, "alnum_prop": 0.5210748155953635, "repo_name": "Hendrixcosta/cadastro", "id": "bba48ec36d3abfea18dac9f3c90dc621339d4816", "size": "1898", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/libraries/UserFactory.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "366" }, { "name": "CSS", "bytes": "722" }, { "name": "HTML", "bytes": "4978" }, { "name": "JavaScript", "bytes": "3572" }, { "name": "PHP", "bytes": "1738053" } ], "symlink_target": "" }
package org.fusesource.scalate.support /** * Implements the Groovy style Elvis operator in Scala * * @version $Revision: 1.1 $ */ class Elvis(val defaultValue: Any) { def ?:(value: Any) = if (value != null) value else defaultValue } /** * A helper class useful for implicit conversions when legacy code iterates over a Map without explicitly * decomposing the iterator value to a tuple */ case class MapEntry[A,B](key: A, value: B) { def getKey = key def getValue = value }
{ "content_hash": "735ec9098495912bd24fbb728edf6842", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 105, "avg_line_length": 24.5, "alnum_prop": 0.7040816326530612, "repo_name": "janurag/scalate", "id": "75f5f319c2d33223d946492f5a04506eaf6e27e3", "size": "1228", "binary": false, "copies": "2", "ref": "refs/heads/scala_2.10", "path": "scalate-core/src/main/scala/org/fusesource/scalate/support/Elvis.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3183" }, { "name": "CSS", "bytes": "16530" }, { "name": "CoffeeScript", "bytes": "22" }, { "name": "HTML", "bytes": "34454" }, { "name": "Java", "bytes": "36894" }, { "name": "JavaScript", "bytes": "5226" }, { "name": "Ruby", "bytes": "561628" }, { "name": "Scala", "bytes": "956477" }, { "name": "Shell", "bytes": "5217" } ], "symlink_target": "" }
package com.google.errorprone.bugpatterns.time; import static com.google.errorprone.BugPattern.SeverityLevel.WARNING; import static com.google.errorprone.bugpatterns.time.NearbyCallers.containsCallToSameReceiverNearby; import static com.google.errorprone.matchers.Matchers.allOf; import static com.google.errorprone.matchers.method.MethodMatchers.instanceMethod; import com.google.errorprone.BugPattern; import com.google.errorprone.VisitorState; import com.google.errorprone.bugpatterns.BugChecker; import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher; import com.google.errorprone.matchers.Description; import com.google.errorprone.matchers.Matcher; import com.google.errorprone.matchers.Matchers; import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.MethodInvocationTree; /** * This checker warns about calls to {@code instant.getNano()} without a corresponding "nearby" call * to {@code instant.getEpochSecond()}. * * @author kak@google.com (Kurt Alfred Kluever) */ @BugPattern( name = "JavaInstantGetSecondsGetNano", summary = "instant.getNano() only accesses the underlying nanosecond adjustment from the whole " + "second.", explanation = "If you call instant.getNano(), you must also call instant.getEpochSecond() in 'nearby' " + "code. If you are trying to convert this instant to nanoseconds, you probably meant " + "to use Instants.toEpochNanos(instant) instead.", severity = WARNING) public final class JavaInstantGetSecondsGetNano extends BugChecker implements MethodInvocationTreeMatcher { private static final Matcher<ExpressionTree> GET_EPOCH_SECOND = instanceMethod().onExactClass("java.time.Instant").named("getEpochSecond"); private static final Matcher<ExpressionTree> GET_NANO = allOf( instanceMethod().onExactClass("java.time.Instant").named("getNano"), Matchers.not(Matchers.packageStartsWith("java."))); @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (GET_NANO.matches(tree, state)) { if (!containsCallToSameReceiverNearby( tree, GET_EPOCH_SECOND, state, /*checkProtoChains=*/ false)) { return describeMatch(tree); } } return Description.NO_MATCH; } }
{ "content_hash": "21dee370253d92b0f802d3e192558f9c", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 100, "avg_line_length": 42.6, "alnum_prop": 0.754588134869825, "repo_name": "cushon/error-prone", "id": "8a73148ed295fc9c1027fbc5436a68a779a404c5", "size": "2950", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/src/main/java/com/google/errorprone/bugpatterns/time/JavaInstantGetSecondsGetNano.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2061" }, { "name": "Java", "bytes": "7364383" }, { "name": "Python", "bytes": "10499" }, { "name": "Shell", "bytes": "1815" } ], "symlink_target": "" }
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:h5="urn:import:org.rest.client.ui.html5"> <g:HTMLPanel addStyleNames="layout vertical flex" ui:field="root"> <section class="Saved_View_top_bar layout horizontal flex"> <div class="Saved_View_searchContainer flex"> <h5:SearchBox ui:field="searchInput"></h5:SearchBox> </div> <div class="Saved_View_searchContainer"> <g:Button styleName="button driveButton" ui:field="openDrive" title="Open saved request from Google Drive™">Open from Google Drive™</g:Button> </div> </section> <div ui:field="loaderInfo" class="Saved_View_loadingWrapper flexCenter"> <span class="loaderImage"></span> <div class="Saved_View_loaderDotsContainer"> <div class="Saved_View_loaderDot"></div> <div class="Saved_View_loaderDot"></div> <div class="Saved_View_loaderDot"></div> </div> <span class="Saved_View_loadingInfo"> Please wait. Loading history. </span> </div> <g:HTMLPanel ui:field="list" addStyleNames="Saved_View_List_container"></g:HTMLPanel> <g:HTMLPanel ui:field="loaderContainer" styleName="Saved_View_loadNextRow"> <g:InlineLabel visible="false" ui:field="loader" styleName="loaderImage"></g:InlineLabel> </g:HTMLPanel> </g:HTMLPanel> </ui:UiBinder>
{ "content_hash": "bf70e3d639f0cc15f6bd9236ea6b0f5f", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 146, "avg_line_length": 41.294117647058826, "alnum_prop": 0.707977207977208, "repo_name": "2947721120/ChromeRestClient", "id": "a88710744424f07dcbac84196bf0cdd44fb1ba1f", "size": "1408", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "RestClient/src/org/rest/client/ui/desktop/SavedViewImpl.ui.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "363214" }, { "name": "CoffeeScript", "bytes": "90831" }, { "name": "HTML", "bytes": "4104792" }, { "name": "Java", "bytes": "1332870" }, { "name": "JavaScript", "bytes": "7100689" }, { "name": "Makefile", "bytes": "1704" }, { "name": "RAML", "bytes": "4824" }, { "name": "Shell", "bytes": "470" } ], "symlink_target": "" }
export interface OpenSpecContact { /** * The identifying name of the contact person/organization. */ name?: string; /** * The email address of the contact person/organization. MUST be in the format of an email address. */ email?: string; /** * The URL pointing to the contact information. MUST be in the format of a URL. */ url?: string; } export interface OpenSpecLicense { /** * The license name used for the API. */ name: string; /** * A URL to the license used for the API. MUST be in the format of a URL. */ url?: string; } export interface OpenSpecInfo { /** * The title of the application. */ title: string; /** * The version of the OpenAPI document (which is distinct from the [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oasVersion) version or the API implementation version). */ version: string; /** * A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. */ description?: string; /** * A URL to the Terms of Service for the API. MUST be in the format of a URL. */ termsOfService?: string; /** * The contact information for the exposed API. */ contact?: OpenSpecContact; /** * The license information for the exposed API. */ license?: OpenSpecLicense; }
{ "content_hash": "fc5dbe07a24c37f379dc5ad9f40ce0b1", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 223, "avg_line_length": 27.057692307692307, "alnum_prop": 0.6687988628287136, "repo_name": "Romakita/ts-express-decorators", "id": "fd92f7079a8a16d359418ff365a793a1f9529324", "size": "1407", "binary": false, "copies": "1", "ref": "refs/heads/production", "path": "packages/specs/openspec/src/common/OpenSpecInfo.ts", "mode": "33188", "license": "mit", "language": [ { "name": "EJS", "bytes": "24557" }, { "name": "HTML", "bytes": "3710" }, { "name": "JavaScript", "bytes": "33370" }, { "name": "Shell", "bytes": "376" }, { "name": "TypeScript", "bytes": "2723318" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="fi.harism.wallpaper.botz" android:installLocation="auto" android:versionCode="2" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <uses-feature android:glEsVersion="0x00020000" /> <uses-feature android:name="android.software.live_wallpaper" /> <application android:icon="@drawable/ic_app" android:label="@string/app_name" > <service android:name=".BotzService" android:description="@string/description" android:label="@string/app_name" android:permission="android.permission.BIND_WALLPAPER" > <intent-filter> <action android:name="android.service.wallpaper.WallpaperService" /> </intent-filter> <meta-data android:name="android.service.wallpaper" android:resource="@xml/botz" /> </service> </application> </manifest>
{ "content_hash": "a9ad2b6024ca7759949ba6ef96beeebe", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 84, "avg_line_length": 34.064516129032256, "alnum_prop": 0.6193181818181818, "repo_name": "harism/android_wallpaper_botz", "id": "9a463f4a6c37712e4ef367849d5306061231cf0d", "size": "1056", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AndroidManifest.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "32044" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in in Corner, Trans. Bot. Soc. Edinb. , 150th anniversary supplement 43: 312 (1981) #### Original name Ochrolechia tartarea var. lapuënsis Vain. ### Remarks null
{ "content_hash": "3f65db77b4f3e2c64e712bd087c52093", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 80, "avg_line_length": 17.076923076923077, "alnum_prop": 0.7207207207207207, "repo_name": "mdoering/backbone", "id": "d25fb146b82f8c8abd9a7f2b076944ffadf566f4", "size": "293", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Lecanoromycetes/Pertusariales/Ochrolechiaceae/Ochrolechia/Ochrolechia frigida/Ochrolechia frigida lapuënsis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
namespace PokerTell.Repository.NHibernate { using System; using global::NHibernate; using Infrastructure.Events; using Infrastructure.Interfaces.DatabaseSetup; using Infrastructure.Interfaces.Repository; using Microsoft.Practices.Composite.Events; /// <summary> /// Singleton class responsible for manageing the NHibernate SessionFactory /// </summary> public class SessionFactoryManager : ISessionFactoryManager { ISessionFactory _sessionFactory; public SessionFactoryManager(IEventAggregator eventAggregator) { eventAggregator .GetEvent<DatabaseInUseChangedEvent>() .Subscribe(dataProvider => Use(dataProvider)); } public ISessionFactoryManager Use(IDataProvider dataProvider) { if (dataProvider.IsConnectedToDatabase) { _sessionFactory = dataProvider.BuildSessionFactory(); } else { throw new ArgumentException("Cannot use unconnected Dataprovider. SessionFactory not recreated."); } return this; } public ISession CurrentSession { get { return _sessionFactory.GetCurrentSession(); } } public ISessionFactory SessionFactory { get { return _sessionFactory; } protected set { _sessionFactory = value; } } public ISession OpenSession() { return _sessionFactory.OpenSession(); } public IStatelessSession OpenStatelessSession() { return _sessionFactory.OpenStatelessSession(); } } }
{ "content_hash": "46c4b2073a60e04d4fa6c9c9f3937ae0", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 114, "avg_line_length": 28.580645161290324, "alnum_prop": 0.590293453724605, "repo_name": "thlorenz/pokertell", "id": "0ad07db932bb005baa884138a8179a1b3f188e1c", "size": "1772", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Src/PokerTell.Repository/NHibernate/SessionFactoryManager.cs", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.cardpay.pccredit.intopieces.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.cardpay.pccredit.intopieces.filter.AddIntoPiecesFilter; import com.cardpay.pccredit.intopieces.filter.XmNewSqFilter; import com.cardpay.pccredit.intopieces.model.LocalImage; import com.cardpay.pccredit.intopieces.web.LocalImageForm; import com.cardpay.pccredit.intopieces.web.XmNewSqUploadForm; import com.wicresoft.util.annotation.Mapper; @Mapper public interface XmNewSqUploadDao { public List<XmNewSqUploadForm> findSqUploadList(XmNewSqFilter filter); public int findSqUploadListCount(XmNewSqFilter filter); }
{ "content_hash": "a51b51590d5979be4ce6de84f8fed690", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 71, "avg_line_length": 34.78947368421053, "alnum_prop": 0.8245083207261724, "repo_name": "qkhj/PCCREDIT", "id": "db66c640fe051ffd9c4a44e73758c32627d6b356", "size": "661", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/java/com/cardpay/pccredit/intopieces/dao/XmNewSqUploadDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "105233" }, { "name": "HTML", "bytes": "2843616" }, { "name": "Java", "bytes": "3602176" }, { "name": "JavaScript", "bytes": "1047540" }, { "name": "PLSQL", "bytes": "29784" } ], "symlink_target": "" }
<?php App::uses('ReserindivistatusesController', 'Controller'); /** * ReserindivistatusesController Test Case * */ class ReserindivistatusesControllerTest extends ControllerTestCase { /** * Fixtures * * @var array */ public $fixtures = array( 'app.reserindivistatus', 'app.reserindividuale', 'app.tipocliente', 'app.cliente', 'app.tipoclientesub', 'app.tarjetacredito', 'app.tipotarjeta', 'app.tipohabitacione', 'app.habitacione', 'app.reserstatusindividuale', 'app.resermultiple', 'app.reserstatusmultiple', 'app.resermulhabitacione', 'app.conftipopagoreserva' ); /** * testIndex method * * @return void */ public function testIndex() { $this->markTestIncomplete('testIndex not implemented.'); } /** * testView method * * @return void */ public function testView() { $this->markTestIncomplete('testView not implemented.'); } /** * testAdd method * * @return void */ public function testAdd() { $this->markTestIncomplete('testAdd not implemented.'); } /** * testEdit method * * @return void */ public function testEdit() { $this->markTestIncomplete('testEdit not implemented.'); } /** * testDelete method * * @return void */ public function testDelete() { $this->markTestIncomplete('testDelete not implemented.'); } }
{ "content_hash": "1cb145faab913d076be3c62eb202cdbe", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 68, "avg_line_length": 16.92207792207792, "alnum_prop": 0.6830391404451266, "repo_name": "kster007/CUBETECH-SOLTERA", "id": "da56337a7625d76f6cef763cca2df16ab0cc97a9", "size": "1303", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/Test/Case/Controller/ReserindivistatusesControllerTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2888" }, { "name": "CSS", "bytes": "432438" }, { "name": "HTML", "bytes": "3204459" }, { "name": "JavaScript", "bytes": "2165916" }, { "name": "PHP", "bytes": "9496942" }, { "name": "Shell", "bytes": "4170" } ], "symlink_target": "" }
<?php namespace PHPixie\Tests\Security\Tokens\Storage; /** * @coversDefaultClass \PHPixie\Security\Tokens\Storage\Database */ abstract class DatabaseTest extends \PHPixie\Test\Testcase { protected $tokens; protected $connection; protected $storage; public function setUp() { $this->tokens = $this->quickMock('\PHPixie\Security\Tokens'); $this->connection = $this->connection(); $this->storage = $this->storage(); } /** * @covers \PHPixie\Security\Tokens\Storage\Database::__construct * @covers ::__construct * @covers ::<protected> */ public function testConstruct() { } /** * @covers ::insert * @covers ::<protected> */ public function testInsert() { $data = array( 'series' => 'pixie', 'userId' => 7, 'challenge' => 'trixie', 'expires' => 18 ); $token = $this->token($data); $query = $this->getQuery('insert'); $this->method($this->connection, 'insertQuery', $query, array(), 0); $this->prepareSetSource($query, 0); $this->method($query, 'data', $query, array($data), 1); $this->method($query, 'execute', null, array(), 2); $this->storage->insert($token); } /** * @covers ::get * @covers ::<protected> */ public function testGet() { $this->getTest(); $this->getTest(true); } protected function getTest($exists = false) { $query = $this->getQuery('delete'); $this->method($this->connection, 'deleteQuery', $query, array(), 0); $this->prepareSetSource($query, 0); $this->method($query, 'where', function($field, $operator, $value) use($query) { $this->assertSame('expires', $field); $this->assertSame('<', $operator); $this->assertTrue(time() - $value <= 1); return $query; }, null, 1); $this->method($query, 'execute', null, array(), 2); $query = $this->getQuery('select'); $this->method($this->connection, 'selectQuery', $query, array(), 1); $this->prepareSetSource($query, 0); $this->method($query, 'where', $query, array('series', 'pixie'), 1); $result = $this->quickMock('\PHPixie\Database\Result'); $this->method($query, 'execute', $result, array(), 2); if($exists) { $data = (object) array( 'series' => 'pixie', 'userId' => 5, 'challenge' => 'trixie', 'expires' => 17 ); $token = $this->getToken(); $this->method($this->tokens, 'token', $token, (array) $data, 0); }else { $data = null; $token = null; } $this->method($result, 'current', $data, array(), 0); $this->assertSame($token, $this->storage->get('pixie')); } /** * @covers ::update * @covers ::<protected> */ public function testUpdate() { $token = $this->token(array( 'series' => 'pixie', 'challenge' => 'trixie', 'expires' => 18 )); $query = $this->getQuery('update'); $this->method($this->connection, 'updateQuery', $query, array(), 0); $this->prepareSetSource($query, 0); $this->method($query, 'set', $query, array(array( 'challenge' => 'trixie', 'expires' => 18 )), 1); $this->method($query, 'where', $query, array('series', 'pixie'), 2); $this->method($query, 'execute', null, array(), 3); $this->storage->update($token); } /** * @covers ::remove * @covers ::<protected> */ public function testRemove() { $query = $this->getQuery('delete'); $this->method($this->connection, 'deleteQuery', $query, array(), 0); $this->prepareSetSource($query, 0); $this->method($query, 'where', $query, array('series', 'pixie'), 1); $this->method($query, 'execute', null, array(), 2); $this->storage->remove('pixie'); } protected function token($properties = array()) { $token = $this->getToken(); foreach($properties as $name => $value) { $this->method($token, $name, $value); } return $token; } protected function getToken() { return $this->quickMock('\PHPixie\Security\Tokens\Token'); } abstract protected function prepareSetSource($query, $at); abstract protected function getQuery($type); abstract protected function connection(); abstract protected function storage(); }
{ "content_hash": "7878880f8714ef274ec1e46933600f81", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 88, "avg_line_length": 28.3125, "alnum_prop": 0.4934778246036524, "repo_name": "PHPixie/Security", "id": "aaef940458557f0e43ce7daa38f225ce70504180", "size": "4983", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/PHPixie/Tests/Security/Tokens/Storage/DatabaseTest.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "38669" } ], "symlink_target": "" }
require 'spec_helper' describe ApplicationController do controller do def index render text: 'hello' end end describe "#set_locale" do it "sets locale to the one stored in cookie if it's avaialble in the app" do cookies[:locale] = :ja get :index expect(I18n.locale).to eq(:ja) end it "falls back to the default locale if the one stored in cookie is not avaialble for the app" do cookies[:locale] = :es get :index expect(I18n.locale).to eq(:en) end it "sets locale to the one extracted from header if cookie is blank" do request.headers['Accept-Language'] = 'ja-JP,fr-FR;q=0.5' get :index expect(I18n.locale).to eq(:ja) end it "stores locale to cookie" do expect { get :index }.to change { cookies.permanent[:locale] }.from(nil).to(:en) expect { get :index }.not_to change { cookies.permanent[:locale] } end end end
{ "content_hash": "4afa8fa5141480f601abecd6b0902e44", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 101, "avg_line_length": 26.885714285714286, "alnum_prop": 0.638682252922423, "repo_name": "kinopyo/quoty", "id": "e6481fbc5f172cf1f1052a5ec78d9e7b212c32c7", "size": "941", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spec/controllers/application_controller_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5068" }, { "name": "CoffeeScript", "bytes": "6784" }, { "name": "JavaScript", "bytes": "6543" }, { "name": "Ruby", "bytes": "94716" } ], "symlink_target": "" }
using System; using System.Linq; using Dnn.PersonaBar.Library.Prompt; using Dnn.PersonaBar.Library.Prompt.Attributes; using Dnn.PersonaBar.Library.Prompt.Models; using Dnn.PersonaBar.Prompt.Components.Repositories; using DotNetNuke.Instrumentation; namespace Dnn.PersonaBar.Prompt.Components.Commands.Commands { [ConsoleCommand("list-commands", Constants.GeneralCategory, "Prompt_ListCommands_Description")] public class ListCommands : ConsoleCommandBase { private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ListCommands)); public override string LocalResourceFile => Constants.LocalResourcesFile; public override ConsoleResultModel Run() { try { var lstOut = CommandRepository.Instance.GetCommands().Values.OrderBy(c => c.Name + '.' + c.Name).ToList(); return new ConsoleResultModel(string.Format(LocalizeString("Prompt_ListCommands_Found"), lstOut.Count)) { Records = lstOut.Count, Data = lstOut, FieldOrder = new[] { "Name", "Description", "Version", "Category" } }; } catch (Exception ex) { Logger.Error(ex); return new ConsoleErrorResultModel(LocalizeString("Prompt_ListCommands_Error")); } } } }
{ "content_hash": "a50e641661280e0efbae73dad1087ae0", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 122, "avg_line_length": 37.76315789473684, "alnum_prop": 0.624390243902439, "repo_name": "dnnsoftware/Dnn.AdminExperience.Extensions", "id": "34d4465b8082d5fd50b37150812c0bd623950c64", "size": "1437", "binary": false, "copies": "3", "ref": "refs/heads/development", "path": "src/Modules/Settings/Dnn.PersonaBar.Prompt/Components/Commands/Commands/ListCommands.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "362" }, { "name": "C#", "bytes": "1752728" }, { "name": "CSS", "bytes": "495897" }, { "name": "HTML", "bytes": "38779" }, { "name": "JavaScript", "bytes": "3436901" } ], "symlink_target": "" }
import { graphql } from 'gatsby'; import React from 'react'; import LinkedHeading from '../../components/LinkedHeading'; import ComponentApi from '../../components/ComponentApi'; import ReactPlayground from '../../components/ReactPlayground'; import Figure from '../../examples/Figure'; import withLayout from '../../withLayout'; export default withLayout(function FigureSection({ data }) { return ( <> <LinkedHeading h="1" id="figures"> Figures </LinkedHeading> <p> Anytime you need to display a piece of content, like an image with an{' '} optional caption, consider using a <code>Figure</code>. </p> <LinkedHeading h="2" id="figures-anchor"> Figure </LinkedHeading> <p>Displaying related images and text with the Figure component.</p> <ReactPlayground codeText={Figure} /> <LinkedHeading h="2" id="figures-props"> API </LinkedHeading> <ComponentApi metadata={data.figure} /> <ComponentApi metadata={data.image} /> <ComponentApi metadata={data.caption} /> </> ); }); export const query = graphql` query FigureQuery { figure: componentMetadata(displayName: { eq: "Figure" }) { displayName ...ComponentApi_metadata } image: componentMetadata(displayName: { eq: "FigureImage" }) { displayName ...ComponentApi_metadata } caption: componentMetadata(displayName: { eq: "FigureCaption" }) { displayName ...ComponentApi_metadata } } `;
{ "content_hash": "aa98d5ee342b32b293d62dc8a8c18e8f", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 82, "avg_line_length": 28.35185185185185, "alnum_prop": 0.6387981711299804, "repo_name": "glenjamin/react-bootstrap", "id": "3a18222e22709eb5bee50098f033ad8c5da1df25", "size": "1531", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "www/src/pages/components/figures.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "19124" }, { "name": "JavaScript", "bytes": "571814" }, { "name": "TypeScript", "bytes": "8724" } ], "symlink_target": "" }
import debounce from './debounce'; import delegateEvents from './delegate-events'; import emitter from './emitter'; import eventBus from './event-bus'; import heartbeat from './heartbeat'; export default { debounce, delegateEvents, emitter, eventBus, heartbeat };
{ "content_hash": "44ce3a25704a9bd151ec19663004559a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 47, "avg_line_length": 21.923076923076923, "alnum_prop": 0.7052631578947368, "repo_name": "ianmcgregor/usfl", "id": "622424261aad9e7ccec9fc62131787dc3d9fb3c5", "size": "285", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/events/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "167537" } ], "symlink_target": "" }
sap.ui.define([ "sap/ui/core/Control", "sap/m/RangeSlider", "sap/ui/model/base/ManagedObjectModel" ], function (Control, RangeSlider, ManagedObjectModel) { "use strict"; var CustomRangeSlider = Control.extend("sap.ui.v4demo.controls.CustomRangeSlider", { metadata: { interfaces : ["sap.ui.core.IFormContent"], properties: { min: { type: "float", group: "Data", defaultValue: 0 }, max: { type: "float", group: "Data", defaultValue: 100 }, width: { type: "sap.ui.core.CSSSize", group: "Appearance", defaultValue: "100%" }, value: { type: "string", group: "Data"} }, aggregations: { _content: { type: "sap.m.RangeSlider", multiple: false, visibility: "hidden" } }, events: { change: { parameters: { value: { type: "string" } } } } }, renderer: { apiVersion: 2, render: function (oRm, oControl) { oRm.renderControl(oControl.getContent()); } }, _oContent: null, _oManagedObjectModel: null}); CustomRangeSlider.prototype.getContent = function() { if (!this._oContent) { this._oContent = new RangeSlider(this.getId() + "-slider", { range: [this.getMin() || 0, this.getMax() || 100], showAdvancedTooltip: true, showHandleTooltip: true, progress: true, step: 1, enableTickmarks: true, width: this.getWidth() }); this._oManagedObjectModel = new ManagedObjectModel(this); this._oContent.setModel(this._oManagedObjectModel, "composite"); this._oContent.bindProperty("min", "composite>/min"); this._oContent.bindProperty("max", "composite>/max"); this._oContent.attachEvent("change", {}, this._changeListener, this); this.setAggregation("_content", this._oContent); } return this._oContent; }; CustomRangeSlider.prototype._changeListener = function (oEvent) { var sNextValue = oEvent.mParameters.range.join("..."); if (sNextValue != this.getValue()) { this.setProperty("value", sNextValue, true); this.fireChange({value: sNextValue}); } }; CustomRangeSlider.prototype.setValue = function(oValue) { this.setProperty("value", oValue); if (oValue) { var aNextValues = oValue.indexOf("...") != -1 ? oValue.split("...") : [this.getMin() || 0, this.getMax() || 100]; var iValue1 = parseInt(aNextValues[0]); var iValue2 = parseInt(aNextValues[1]); if (iValue1 !== this.getContent().getValue()) { this.getContent().setValue(iValue1); } if (iValue2 !== this.getContent().getValue2()) { this.getContent().setValue2(iValue2); } } }; CustomRangeSlider.prototype.exit = function () { if (this._oContent) { this._oContent.detachEvent("change", this._changeListener); this._oContent = undefined; } this._oManagedObjectModel.destroy(); this._oManagedObjectModel = undefined; }; CustomRangeSlider.prototype.getIdForLabel = function() { return this.getId() + "-slider"; }; CustomRangeSlider.prototype.getFocusDomRef = function() { if (this._oContent) { return this._oContent.getFocusDomRef(); } else { return this.getDomRef(); } }; CustomRangeSlider.prototype.getDomRef = function() { if (this._oContent) { return this._oContent.getDomRef(); } else { return Control.prototype.getDomRef.apply(this, arguments); } }; CustomRangeSlider.prototype.enhanceAccessibilityState = function(oElement, mAriaProps) { var oParent = this.getParent(); if (oParent && oParent.enhanceAccessibilityState) { // use CustomRangeSlider as control, but aria properties of rendered inner control. oParent.enhanceAccessibilityState(this, mAriaProps); } }; return CustomRangeSlider; });
{ "content_hash": "6a8fc8e67896a7ec773885b2465ed8e1", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 116, "avg_line_length": 29.137096774193548, "alnum_prop": 0.6667589261001937, "repo_name": "SAP/openui5", "id": "036a5005e3474750abcf490d0a435c81be1d12fc", "size": "3613", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/sap.ui.mdc/test/sap/ui/mdc/internal/TableWithFilterBarOld/controls/CustomRangeSlider.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "294216" }, { "name": "Gherkin", "bytes": "17201" }, { "name": "HTML", "bytes": "6443688" }, { "name": "Java", "bytes": "83398" }, { "name": "JavaScript", "bytes": "109546491" }, { "name": "Less", "bytes": "8741757" }, { "name": "TypeScript", "bytes": "20918" } ], "symlink_target": "" }
package com.github.itimur.utils; import com.github.itimur.downloader.Download; import java.net.MalformedURLException; import java.net.URL; import java.util.MissingFormatArgumentException; import static com.github.itimur.utils.CommonUtils.requireNonEmpty; import static java.util.Objects.requireNonNull; /** * @author Timur */ public final class ParseUtils { private static final int MIN_FILENAME_LENGTH = 2; private ParseUtils() {} public static long parseTotalDownloadsRate(String totalDownloadsRate) { requireNonNull(totalDownloadsRate, "totalDownloadsRate"); requireNonEmpty(totalDownloadsRate, "totalDownloadsRate"); int suffixPosition = totalDownloadsRate.length() - 1; ByteUnit byteUnit = ByteUnit.BYTE; switch (totalDownloadsRate.charAt(suffixPosition)) { case 'b': break; case 'k': byteUnit = ByteUnit.KILOBYTE; break; case 'm': byteUnit = ByteUnit.MEGABYTE; break; default: throw new IllegalArgumentException("Allowed unit suffixes are: " + byteUnit.allowedSuffixes()); } return Long.parseLong(totalDownloadsRate.substring(0, suffixPosition)) * byteUnit.size(); } public static Download lineToDownload(String line) { String[] parts = splitLineByUrlAndFilename(requireNonNull(line, "line")); return new Download(parseURL(parts[0]), parts[1]); } static String[] splitLineByUrlAndFilename(String line) { String[] parts = line.split("\\s"); if (parts.length < 2 || parts[1].isEmpty()) throw new MissingFormatArgumentException("<HTTP url><space><filename>"); return parts; } static URL parseURL(String httpUrl) { try { URL url = new URL(httpUrl); if (!"http".equalsIgnoreCase(url.getProtocol())) throw new MalformedURLException("Only HTTP protocol supported"); else if (url.getFile().length() < MIN_FILENAME_LENGTH) throw new IllegalArgumentException("Url doesn't contain filename"); return url; } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } }
{ "content_hash": "615dd0d7217f847e3eac71e44fd8b5aa", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 111, "avg_line_length": 34.878787878787875, "alnum_prop": 0.6403127715030409, "repo_name": "timur86/console-downloader", "id": "fc551f1f4955f5df8d806c5db0af9087edd43d79", "size": "2302", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/github/itimur/utils/ParseUtils.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "31809" } ], "symlink_target": "" }
import { AccessibilityManager, InteractionManager } from 'pixi.js'; import { CanvasRenderer, canvasUtils } from '@pixi/canvas-renderer'; import { CanvasMeshRenderer } from '@pixi/canvas-mesh'; import { CanvasGraphicsRenderer } from '@pixi/canvas-graphics'; import { CanvasSpriteRenderer } from '@pixi/canvas-sprite'; import { CanvasExtract } from '@pixi/canvas-extract'; import { CanvasPrepare } from '@pixi/canvas-prepare'; import '@pixi/canvas-sprite-tiling'; import '@pixi/canvas-particle-container'; import '@pixi/canvas-display'; import '@pixi/canvas-text'; CanvasRenderer.registerPlugin('accessibility', AccessibilityManager); CanvasRenderer.registerPlugin('extract', CanvasExtract); CanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer); CanvasRenderer.registerPlugin('interaction', InteractionManager); CanvasRenderer.registerPlugin('mesh', CanvasMeshRenderer); CanvasRenderer.registerPlugin('prepare', CanvasPrepare); CanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer); // Export ES for those importing specifically by name, // e.g., `import {autoDetectRenderer} from 'pixi.js-legacy'` export * from 'pixi.js'; export { CanvasRenderer, CanvasGraphicsRenderer, CanvasMeshRenderer, CanvasSpriteRenderer, CanvasExtract, CanvasPrepare, canvasUtils, };
{ "content_hash": "3081cfbc3236c414a0a2717ff65fe0a8", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 69, "avg_line_length": 40.9375, "alnum_prop": 0.7809160305343511, "repo_name": "pixijs/pixi.js", "id": "3da0fb39338f1f44b385fc1901235fe3c773e8b7", "size": "1310", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "bundles/pixi.js-legacy/src/index.ts", "mode": "33188", "license": "mit", "language": [ { "name": "GLSL", "bytes": "14550" }, { "name": "JavaScript", "bytes": "762409" }, { "name": "PLSQL", "bytes": "9152" }, { "name": "TypeScript", "bytes": "1063680" } ], "symlink_target": "" }