text
stringlengths
2
1.04M
meta
dict
// RobotBuilder Version: 1.5 // // This file was generated by RobotBuilder. It contains sections of // code that are automatically generated and assigned by robotbuilder. // These sections will be updated in the future when you export to // Java from RobotBuilder. Do not put any code or make any change in // the blocks indicating autogenerated code or it will be lost on an // update. Deleting the comments indicating the section will prevent // it from being updated in the future. package org.usfirst.frc692.RecycleRushSuperStructure.commands; import org.usfirst.frc692.RecycleRushSuperStructure.Robot; import edu.wpi.first.wpilibj.command.CommandGroup; /** * */ public class automatedElevator extends CommandGroup { public automatedElevator() { // Add Commands here: // e.g. addSequential(new Command1()); // addSequential(new Command2()); // these will run in order. // To run multiple commands at the same time, // use addParallel() // e.g. addParallel(new Command1()); // addSequential(new Command2()); // Command1 and Command2 will run in parallel. // A command group will require all of the subsystems that each member // would require. // e.g. if Command1 requires chassis, and Command2 requires arm, // a CommandGroup containing them would require both the chassis and the // arm. if(Robot.gatherer.toteDetector()) { addSequential(new bringInToteOnCaterpillar()); addSequential(new elevatorGoToTopLevel()); addSequential(new elevatorGoToGroundLevel()); } //caterpillar becomes activated when tote detecter is pressed //elevator goes to top level and then goes down //AC 1/24/15 } }
{ "content_hash": "2aa14986d10cdaae317b49a2eef58f3e", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 80, "avg_line_length": 37.46938775510204, "alnum_prop": 0.6699346405228758, "repo_name": "sfhsfembot/RecycledRushSuperstructure", "id": "5d2139f489c59e51c095f96b8ad5b9dcf3bd3356", "size": "1836", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/org/usfirst/frc692/RecycleRushSuperStructure/commands/automatedElevator.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "136740" } ], "symlink_target": "" }
Overview ============================= Both approaches outlined below will retrieve a minimal Ubuntu 14.04 box and provision it utilizing the bootstrap-bce.sh script. The BCE\_PROVISION environment variable serves as a hint to the bootstrap script so that different authors can create different VMs using the same build framework. Note that to create a VM for VirtualBox, you'll need a recent version of VirtualBox (in particular the default version on Ubuntu 12.04 is too old - you'll need to install the Ubuntu virtualbox-4.3 package). Creating BCE VMs with Packer ============================= For a Virtualbox VM, run: $ BCE_PROVISION=BCE packer build BCE-14.04-amd64.json This creates a virtual machine in the OVA format that can be imported into Virtualbox on Windows, Mac, or UNIX. To create an Amazon EC2 AMI, set your Amazon security credentials in 'BCE-14.04-amd64-ec2.json' and then run: $ BCE_PROVISION=BCE packer build BCE-14.04-amd64-ec2.json Note that currently when you start up a VM from the resulting AMI, you'll need to first login as the 'ubuntu' user and set up SSH keys for the 'oski' user, which is the user provisioned by BCE. Notes/TODO on provisioning ========================== I'm still having trouble using the guest additions that are already available from the VirtualBox install. Note that it should be possible to attach the bundled ISO for guest additions using something like the following in the JSON "vboxmanage" section: ```json [ "storageattach", "{{.Name}}", "--storagectl", "IDE Controller", "--port", "1", "--device", "0", "--type", "dvddrive", "--medium", "additions" ] ``` For which you should also switch "guest_additions_mode" to "disable." But for some reason, I get the complaint: VBoxManage: error: Invalid UUID or filename "additions" Strangely, this DOES work if I execute it during provisioning: vboxmanage storageattach "BCE-xubuntu-14.04-amd64" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium additions Go figure
{ "content_hash": "219511d1aba0634ccfdcf84ddaaf395e", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 293, "avg_line_length": 39.264150943396224, "alnum_prop": 0.7078327727054301, "repo_name": "rdhyee/collaboratool", "id": "e1d9e58e8b0705f949b8f6fc5d93ce6295cf6d9b", "size": "2081", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "provisioning/HOWTO.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "453" }, { "name": "Puppet", "bytes": "2252" }, { "name": "Python", "bytes": "1316" }, { "name": "Ruby", "bytes": "3351" }, { "name": "Shell", "bytes": "11453" } ], "symlink_target": "" }
package org.apache.ambari.logsearch.web.authenticate; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; public class LogsearchAuthSuccessHandler implements AuthenticationSuccessHandler { private static final Logger logger = Logger.getLogger(LogsearchAuthSuccessHandler.class); @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException { response.setStatus(HttpServletResponse.SC_OK); } }
{ "content_hash": "e9c92a86b5bedebf0990ae170c3ac9eb", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 91, "avg_line_length": 34.041666666666664, "alnum_prop": 0.8372093023255814, "repo_name": "alexryndin/ambari", "id": "cf9d2006f564870bcc4a5d364fea9dc4fbf0487c", "size": "1622", "binary": false, "copies": "2", "ref": "refs/heads/branch-adh-1.5", "path": "ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "44884" }, { "name": "C", "bytes": "331204" }, { "name": "C#", "bytes": "215907" }, { "name": "C++", "bytes": "257" }, { "name": "CSS", "bytes": "786184" }, { "name": "CoffeeScript", "bytes": "8465" }, { "name": "FreeMarker", "bytes": "2654" }, { "name": "Groovy", "bytes": "89958" }, { "name": "HTML", "bytes": "2514774" }, { "name": "Java", "bytes": "29565801" }, { "name": "JavaScript", "bytes": "19033151" }, { "name": "Makefile", "bytes": "11111" }, { "name": "PHP", "bytes": "149648" }, { "name": "PLpgSQL", "bytes": "316489" }, { "name": "PowerShell", "bytes": "2090340" }, { "name": "Python", "bytes": "17215686" }, { "name": "R", "bytes": "3943" }, { "name": "Roff", "bytes": "13935" }, { "name": "Ruby", "bytes": "33764" }, { "name": "SQLPL", "bytes": "4277" }, { "name": "Shell", "bytes": "886011" }, { "name": "Vim script", "bytes": "5813" }, { "name": "sed", "bytes": "2303" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="lang:clipboard.copy" content="Copy to clipboard"> <meta name="lang:clipboard.copied" content="Copied to clipboard"> <meta name="lang:search.language" content="en"> <meta name="lang:search.pipeline.stopwords" content="True"> <meta name="lang:search.pipeline.trimmer" content="True"> <meta name="lang:search.result.none" content="No matching documents"> <meta name="lang:search.result.one" content="1 matching document"> <meta name="lang:search.result.other" content="# matching documents"> <meta name="lang:search.tokenizer" content="[\s\-]+"> <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"> <style> body, input { font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif } code, kbd, pre { font-family: "Roboto Mono", "Courier New", Courier, monospace } </style> <link rel="stylesheet" href="../_static/stylesheets/application.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/> <link rel="stylesheet" href="../_static/fonts/material-icons.css"/> <meta name="theme-color" content="#3f51b5"> <script src="../_static/javascripts/modernizr.js"></script> <title>statsmodels.regression.process_regression.ProcessMLEResults.save &#8212; statsmodels</title> <link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png"> <link rel="manifest" href="../_static/icons/site.webmanifest"> <link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-config" content="../_static/icons/browserconfig.xml"> <link rel="stylesheet" href="../_static/stylesheets/examples.css"> <link rel="stylesheet" href="../_static/stylesheets/deprecation.css"> <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../_static/material.css" /> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> <link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" /> <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="statsmodels.regression.process_regression.ProcessMLEResults.summary" href="statsmodels.regression.process_regression.ProcessMLEResults.summary.html" /> <link rel="prev" title="statsmodels.regression.process_regression.ProcessMLEResults.remove_data" href="statsmodels.regression.process_regression.ProcessMLEResults.remove_data.html" /> </head> <body dir=ltr data-md-color-primary=indigo data-md-color-accent=blue> <svg class="md-svg"> <defs data-children-count="0"> <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> </defs> </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search"> <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> <a href="#generated/statsmodels.regression.process_regression.ProcessMLEResults.save" tabindex="1" class="md-skip"> Skip to content </a> <header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="../index.html" title="statsmodels" class="md-header-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" height="26" alt="statsmodels logo"> </a> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> </div> <div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <span class="md-header-nav__topic">statsmodels v0.13.2</span> <span class="md-header-nav__topic"> statsmodels.regression.process_regression.ProcessMLEResults.save </span> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" action="../search.html" method="get" name="search"> <input type="text" class="md-search__input" name="q" placeholder="Search" autocapitalize="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> <label class="md-icon md-search__icon" for="__search"></label> <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> &#xE5CD; </button> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="result"> <div class="md-search-result__meta"> Type to start searching </div> <ol class="md-search-result__list"></ol> </div> </div> </div> </div> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <div class="md-header-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> </div> <script src="../_static/javascripts/version_dropdown.js"></script> <script> var json_loc = "../../versions-v2.json", target_loc = "../../", text = "Versions"; $( document ).ready( add_version_dropdown(json_loc, target_loc, text)); </script> </div> </nav> </header> <div class="md-container"> <nav class="md-tabs" data-md-component="tabs"> <div class="md-tabs__inner md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li> <li class="md-tabs__item"><a href="../regression.html" class="md-tabs__link">Linear Regression</a></li> <li class="md-tabs__item"><a href="statsmodels.regression.process_regression.ProcessMLEResults.html" class="md-tabs__link">statsmodels.regression.process_regression.ProcessMLEResults</a></li> </ul> </div> </nav> <main class="md-main"> <div class="md-main__inner md-grid" data-md-component="container"> <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" data-md-level="0"> <label class="md-nav__title md-nav__title--site" for="__drawer"> <a href="../index.html" title="statsmodels" class="md-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48"> </a> <a href="../index.html" title="statsmodels">statsmodels v0.13.2</a> </label> <div class="md-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../install.html" class="md-nav__link">Installing statsmodels</a> </li> <li class="md-nav__item"> <a href="../gettingstarted.html" class="md-nav__link">Getting started</a> </li> <li class="md-nav__item"> <a href="../user-guide.html" class="md-nav__link">User Guide</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../user-guide.html#background" class="md-nav__link">Background</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../regression.html" class="md-nav__link">Linear Regression</a> </li> <li class="md-nav__item"> <a href="../glm.html" class="md-nav__link">Generalized Linear Models</a> </li> <li class="md-nav__item"> <a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a> </li> <li class="md-nav__item"> <a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a> </li> <li class="md-nav__item"> <a href="../rlm.html" class="md-nav__link">Robust Linear Models</a> </li> <li class="md-nav__item"> <a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a> </li> <li class="md-nav__item"> <a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a> </li> <li class="md-nav__item"> <a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a> </li> <li class="md-nav__item"> <a href="../anova.html" class="md-nav__link">ANOVA</a> </li> <li class="md-nav__item"> <a href="../other_models.html" class="md-nav__link">Other Models <code class="xref py py-mod docutils literal notranslate"><span class="pre">othermod</span></code></a> </li></ul> </li> <li class="md-nav__item"> <a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a> </li></ul> </li> <li class="md-nav__item"> <a href="../examples/index.html" class="md-nav__link">Examples</a> </li> <li class="md-nav__item"> <a href="../api.html" class="md-nav__link">API Reference</a> </li> <li class="md-nav__item"> <a href="../about.html" class="md-nav__link">About statsmodels</a> </li> <li class="md-nav__item"> <a href="../dev/index.html" class="md-nav__link">Developer Page</a> </li> <li class="md-nav__item"> <a href="../release/index.html" class="md-nav__link">Release Notes</a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary"> <ul class="md-nav__list" data-md-scrollfix=""> <li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.regression.process_regression.ProcessMLEResults.save.rst.txt">Show Source</a> </li> <li id="searchbox" class="md-nav__item"></li> </ul> </nav> </div> </div> </div> <div class="md-content"> <article class="md-content__inner md-typeset" role="main"> <section id="statsmodels-regression-process-regression-processmleresults-save"> <h1 id="generated-statsmodels-regression-process-regression-processmleresults-save--page-root">statsmodels.regression.process_regression.ProcessMLEResults.save<a class="headerlink" href="#generated-statsmodels-regression-process-regression-processmleresults-save--page-root" title="Permalink to this headline">¶</a></h1> <dl class="py method"> <dt class="sig sig-object py" id="statsmodels.regression.process_regression.ProcessMLEResults.save"> <span class="sig-prename descclassname"><span class="pre">ProcessMLEResults.</span></span><span class="sig-name descname"><span class="pre">save</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fname</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remove_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.regression.process_regression.ProcessMLEResults.save" title="Permalink to this definition">¶</a></dt> <dd><p>Save a pickle of this instance.</p> <dl class="field-list"> <dt class="field-odd">Parameters</dt> <dd class="field-odd"><dl> <dt><strong>fname</strong><span class="classifier">{<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="docutils literal notranslate"><span class="pre">str</span></code></a>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">handle</span></code>}</span></dt><dd><p>A string filename or a file handle.</p> </dd> <dt><strong>remove_data</strong><span class="classifier"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bltin-boolean-values" title="(in Python v3.10)"><span class="xref std std-ref">bool</span></a></span></dt><dd><p>If False (default), then the instance is pickled without changes. If True, then all arrays with length nobs are set to None before pickling. See the remove_data method. In some cases not all arrays will be set to None.</p> </dd> </dl> </dd> </dl> <p class="rubric">Notes</p> <p>If remove_data is true and the model result does not implement a remove_data method then this will raise an exception.</p> </dd></dl> </section> </article> </div> </div> </main> </div> <footer class="md-footer"> <div class="md-footer-nav"> <nav class="md-footer-nav__inner md-grid"> <a href="statsmodels.regression.process_regression.ProcessMLEResults.remove_data.html" title="statsmodels.regression.process_regression.ProcessMLEResults.remove_data" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <div class="md-flex__cell md-flex__cell--shrink"> <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> </div> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Previous </span> statsmodels.regression.process_regression.ProcessMLEResults.remove_data </span> </div> </a> <a href="statsmodels.regression.process_regression.ProcessMLEResults.summary.html" title="statsmodels.regression.process_regression.ProcessMLEResults.summary" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Next </span> statsmodels.regression.process_regression.ProcessMLEResults.summary </span> </div> <div class="md-flex__cell md-flex__cell--shrink"><i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> </div> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-footer-copyright"> <div class="md-footer-copyright__highlight"> &#169; Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. </div> Last updated on Feb 08, 2022. <br/> Created using <a href="http://www.sphinx-doc.org/">Sphinx</a> 4.4.0. and <a href="https://github.com/bashtage/sphinx-material/">Material for Sphinx</a> </div> </div> </div> </footer> <script src="../_static/javascripts/application.js"></script> <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script> </body> </html>
{ "content_hash": "18df569ae8ae609ef6ed7c5b0b0121e1", "timestamp": "", "source": "github", "line_count": 513, "max_line_length": 999, "avg_line_length": 39.28849902534113, "alnum_prop": 0.6084842470850905, "repo_name": "statsmodels/statsmodels.github.io", "id": "c605625877a3724fad07b46d73e37f81f0e5b129", "size": "20159", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "v0.13.2/generated/statsmodels.regression.process_regression.ProcessMLEResults.save.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
""" GENERATED FILE. ALL CHANGES WILL BE OVERWRITTEN! """ from django import forms from django.contrib.formtools.wizard.views import SessionWizardView from cuescience_shop.models import {% for step in wizard.steps %}{%if step.form.model%}{%if not loop.first %}, {%endif%}{{step.form.model}}{%endif%}{%endfor%} {% for step in wizard.steps %} class Step{{ step.number }}Form(forms.{%if step.form.model%}Model{%endif%}Form): {% for field in step.form.extra_fields %}{{field.name}} = forms.{{field.field_type}}(required=False, label="{{field.verbose_name}}", {% for k,v in field.kwargs.items() %}{{k}}={{v}}{% endfor %}) {% endfor %} {%if step.form.model%}class Meta: model = {{step.form.model}} {% if step.form.fields %}fields = ({% for field in step.form.fields %}{{field}},{% endfor %}) {%endif%}{%endif%} def __init__(self, *args, **kwargs): super(Step{{ step.number }}Form, self).__init__(*args, **kwargs) {%if step.form.heading%}self.heading = "{{step.form.heading}}"{%endif%} {%if step.form.grouped_fields%}self.grouped_fields = [ {%for group in step.form.grouped_fields%}({%for field in group%}self[{{field}}],{%endfor%}), {%endfor%} ]{%endif%} {% if step.condition %} def condition_step_{{step.number}}(wizard): cleaned_data = wizard.get_cleaned_data_for_step("{{step.condition.step}}") or {"{{step.condition.name}}": 'none'} return cleaned_data["{{step.condition.name}}"] == {{step.condition.value}} {%endif%} {%endfor%} class {{wizard.name}}WizardBase(SessionWizardView): form_list = [{% for step in wizard.steps %}("{{step.number}}",Step{{step.number}}Form),{%endfor%}] {%if wizard.conditions%}condition_dict = { {% for step in wizard.steps %}{% if step.condition %}"{{step.number}}": condition_step_{{step.number}},{%endif%}{% endfor %} }{% endif %}
{ "content_hash": "4f8187cc8e98ce3afe4065688ec5e380", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 198, "avg_line_length": 62.266666666666666, "alnum_prop": 0.6274089935760171, "repo_name": "cuescience/cuescience-shop", "id": "4e179d3bd5d24521aa671468a7243b106fccdd1e", "size": "1868", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "shop/specs/templates/wizard_template.py", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "6720" }, { "name": "Python", "bytes": "46728" } ], "symlink_target": "" }
package azuredb import ( "context" "crypto/x509" "encoding/pem" "fmt" "io" "io/ioutil" "net/http" "golang.org/x/net/context/ctxhttp" ) const caBundleURL = "https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem" // A CertPoolProvider returns a certificate pool that contains the Azure CA certificate. type CertPoolProvider interface { AzureCertPool(context.Context) (*x509.CertPool, error) } // CertFetcher pulls the Azure CA certificates from Digicert's servers. The zero // value will fetch certificates using the default HTTP client. type CertFetcher struct { // Client is the HTTP client used to make requests. If nil, then // http.DefaultClient is used. Client *http.Client } // AzureCertPool fetches the Azure CA certificates and places them into a pool. // It is safe to call from multiple goroutines. func (cf *CertFetcher) AzureCertPool(ctx context.Context) (*x509.CertPool, error) { certs, err := cf.Fetch(ctx) if err != nil { return nil, err } certPool := x509.NewCertPool() for _, c := range certs { certPool.AddCert(c) } return certPool, nil } // Fetch fetches the Azure CA certificates. It is safe to call from multiple goroutines. func (cf *CertFetcher) Fetch(ctx context.Context) ([]*x509.Certificate, error) { client := cf.Client if client == nil { client = http.DefaultClient } resp, err := ctxhttp.Get(ctx, client, caBundleURL) if err != nil { return nil, fmt.Errorf("fetch Azure certificates: %v", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("fetch Azure certificates: HTTP %s", resp.Status) } pemData, err := ioutil.ReadAll(&io.LimitedReader{R: resp.Body, N: 1 << 20}) // limit to 1MiB if err != nil { return nil, fmt.Errorf("fetch Azure certificates: %v", err) } var certs []*x509.Certificate for len(pemData) > 0 { var block *pem.Block block, pemData = pem.Decode(pemData) if block == nil { break } if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { continue } c, err := x509.ParseCertificate(block.Bytes) if err != nil { return nil, fmt.Errorf("fetch Azure certificates: %v", err) } certs = append(certs, c) } return certs, nil }
{ "content_hash": "1dbc1b3c29d89b76aaf847d9ae1f5c89", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 93, "avg_line_length": 27.89873417721519, "alnum_prop": 0.7023593466424682, "repo_name": "google/go-cloud", "id": "46a4cd2e265311da28d7a6c668b2e5c58a9fd41c", "size": "2901", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "azure/azuredb/azuredb.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "9988" }, { "name": "Go", "bytes": "2109743" }, { "name": "HCL", "bytes": "28764" }, { "name": "HTML", "bytes": "7688" }, { "name": "Shell", "bytes": "37944" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <bean class="com.wavemaker.runtime.service.WaveMakerService" scope="singleton" lazy-init="true" id="waveMakerService"/> <bean class="com.wavemaker.runtime.service.reflect.ReflectServiceWire" scope="singleton" lazy-init="false"> <property name="serviceId" value="waveMakerService"/> <property name="serviceType" ref="JavaService"/> </bean> </beans>
{ "content_hash": "8c17150c9f75b81b501daaba0f4025e6", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 243, "avg_line_length": 84.5, "alnum_prop": 0.7381656804733728, "repo_name": "AlfredGerke/ZABonline", "id": "2a6ca46100175d03e67fae21074e45cfac96539e", "size": "676", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "source/wavemaker/projects/ZABonline/webapproot/WEB-INF/classes/waveMakerService.spring.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1322" }, { "name": "CSS", "bytes": "651990" }, { "name": "HTML", "bytes": "9114" }, { "name": "Java", "bytes": "400639" }, { "name": "JavaScript", "bytes": "648578" }, { "name": "PLSQL", "bytes": "93404" }, { "name": "PLpgSQL", "bytes": "3646" }, { "name": "Roff", "bytes": "8229" }, { "name": "SQLPL", "bytes": "324383" } ], "symlink_target": "" }
autocommit off; create class mother ( myself mother ); create class son as subclass of mother ( myself son ); drop son, mother; rollback;
{ "content_hash": "bdd04b43c9712529e1b3bd6a164a0d6c", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 54, "avg_line_length": 27.6, "alnum_prop": 0.7536231884057971, "repo_name": "hongwoo-nam/cubrid-testcases", "id": "92674f0090af7ef87b9c65cff27cef422a7724d4", "size": "138", "binary": false, "copies": "2", "ref": "refs/heads/develop_inlineView_update", "path": "medium/_01_fixed/cases/4175.sql", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PLSQL", "bytes": "444579" }, { "name": "PLpgSQL", "bytes": "5669" }, { "name": "SQLPL", "bytes": "11049" }, { "name": "eC", "bytes": "710" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>V8 API Reference Guide for node.js v8.9.0: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">V8 API Reference Guide for node.js v8.9.0 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1AllocationProfile.html">AllocationProfile</a></li><li class="navelem"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">Node</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">v8::AllocationProfile::Node Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#a6ee0934b35ba77fb5d8b53f02d5a3068">allocations</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#a176673c0440cb1baaf7713e14da84db0">children</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#a7cf86acc298428c858673fc1f9dbe305">column_number</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#ac9773c92a3af3a9a9420337599e68bd9">line_number</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#af9f2c323d6a11e836c02e8ac88adc5a8">name</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#a4a746de878d9ad42b32fda4c365b98fb">script_id</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#acd6567ac06a0bae713390559128e9c62">script_name</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html#a6caceefbf826a0425adc74331cc7a910">start_position</a></td><td class="entry"><a class="el" href="structv8_1_1AllocationProfile_1_1Node.html">v8::AllocationProfile::Node</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
{ "content_hash": "6b296eeb6289cd8af23a397dc4e22d73", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 303, "avg_line_length": 60.6, "alnum_prop": 0.6765676567656765, "repo_name": "v8-dox/v8-dox.github.io", "id": "16cfbfe4d83bbcecc05a1e9b6faeb3bf577b6d69", "size": "6969", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bf2564d/html/structv8_1_1AllocationProfile_1_1Node-members.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package ceph import ( "bytes" "encoding/json" "fmt" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/inputs" "io/ioutil" "log" "os/exec" "path/filepath" "strings" ) const ( measurement = "ceph" typeMon = "monitor" typeOsd = "osd" osdPrefix = "ceph-osd" monPrefix = "ceph-mon" sockSuffix = "asok" ) type Ceph struct { CephBinary string OsdPrefix string MonPrefix string SocketDir string SocketSuffix string } func (c *Ceph) setDefaults() { if c.CephBinary == "" { c.CephBinary = "/usr/bin/ceph" } if c.OsdPrefix == "" { c.OsdPrefix = osdPrefix } if c.MonPrefix == "" { c.MonPrefix = monPrefix } if c.SocketDir == "" { c.SocketDir = "/var/run/ceph" } if c.SocketSuffix == "" { c.SocketSuffix = sockSuffix } } func (c *Ceph) Description() string { return "Collects performance metrics from the MON and OSD nodes in a Ceph storage cluster." } var sampleConfig = ` ## All configuration values are optional, defaults are shown below ## location of ceph binary ceph_binary = "/usr/bin/ceph" ## directory in which to look for socket files socket_dir = "/var/run/ceph" ## prefix of MON and OSD socket files, used to determine socket type mon_prefix = "ceph-mon" osd_prefix = "ceph-osd" ## suffix used to identify socket files socket_suffix = "asok" ` func (c *Ceph) SampleConfig() string { return sampleConfig } func (c *Ceph) Gather(acc telegraf.Accumulator) error { c.setDefaults() sockets, err := findSockets(c) if err != nil { return fmt.Errorf("failed to find sockets at path '%s': %v", c.SocketDir, err) } for _, s := range sockets { dump, err := perfDump(c.CephBinary, s) if err != nil { log.Printf("error reading from socket '%s': %v", s.socket, err) continue } data, err := parseDump(dump) if err != nil { log.Printf("error parsing dump from socket '%s': %v", s.socket, err) continue } for tag, metrics := range *data { acc.AddFields(measurement, map[string]interface{}(metrics), map[string]string{"type": s.sockType, "id": s.sockId, "collection": tag}) } } return nil } func init() { inputs.Add(measurement, func() telegraf.Input { return &Ceph{} }) } var perfDump = func(binary string, socket *socket) (string, error) { cmdArgs := []string{"--admin-daemon", socket.socket} if socket.sockType == typeOsd { cmdArgs = append(cmdArgs, "perf", "dump") } else if socket.sockType == typeMon { cmdArgs = append(cmdArgs, "perfcounters_dump") } else { return "", fmt.Errorf("ignoring unknown socket type: %s", socket.sockType) } cmd := exec.Command(binary, cmdArgs...) var out bytes.Buffer cmd.Stdout = &out err := cmd.Run() if err != nil { return "", fmt.Errorf("error running ceph dump: %s", err) } return out.String(), nil } var findSockets = func(c *Ceph) ([]*socket, error) { listing, err := ioutil.ReadDir(c.SocketDir) if err != nil { return []*socket{}, fmt.Errorf("Failed to read socket directory '%s': %v", c.SocketDir, err) } sockets := make([]*socket, 0, len(listing)) for _, info := range listing { f := info.Name() var sockType string var sockPrefix string if strings.HasPrefix(f, c.MonPrefix) { sockType = typeMon sockPrefix = monPrefix } if strings.HasPrefix(f, c.OsdPrefix) { sockType = typeOsd sockPrefix = osdPrefix } if sockType == typeOsd || sockType == typeMon { path := filepath.Join(c.SocketDir, f) sockets = append(sockets, &socket{parseSockId(f, sockPrefix, c.SocketSuffix), sockType, path}) } } return sockets, nil } func parseSockId(fname, prefix, suffix string) string { s := fname s = strings.TrimPrefix(s, prefix) s = strings.TrimSuffix(s, suffix) s = strings.Trim(s, ".-_") return s } type socket struct { sockId string sockType string socket string } type metric struct { pathStack []string // lifo stack of name components value float64 } // Pops names of pathStack to build the flattened name for a metric func (m *metric) name() string { buf := bytes.Buffer{} for i := len(m.pathStack) - 1; i >= 0; i-- { if buf.Len() > 0 { buf.WriteString(".") } buf.WriteString(m.pathStack[i]) } return buf.String() } type metricMap map[string]interface{} type taggedMetricMap map[string]metricMap // Parses a raw JSON string into a taggedMetricMap // Delegates the actual parsing to newTaggedMetricMap(..) func parseDump(dump string) (*taggedMetricMap, error) { data := make(map[string]interface{}) err := json.Unmarshal([]byte(dump), &data) if err != nil { return nil, fmt.Errorf("failed to parse json: '%s': %v", dump, err) } tmm := newTaggedMetricMap(data) if err != nil { return nil, fmt.Errorf("failed to tag dataset: '%v': %v", tmm, err) } return tmm, nil } // Builds a TaggedMetricMap out of a generic string map. // The top-level key is used as a tag and all sub-keys are flattened into metrics func newTaggedMetricMap(data map[string]interface{}) *taggedMetricMap { tmm := make(taggedMetricMap) for tag, datapoints := range data { mm := make(metricMap) for _, m := range flatten(datapoints) { mm[m.name()] = m.value } tmm[tag] = mm } return &tmm } // Recursively flattens any k-v hierarchy present in data. // Nested keys are flattened into ordered slices associated with a metric value. // The key slices are treated as stacks, and are expected to be reversed and concatenated // when passed as metrics to the accumulator. (see (*metric).name()) func flatten(data interface{}) []*metric { var metrics []*metric switch val := data.(type) { case float64: metrics = []*metric{&metric{make([]string, 0, 1), val}} case map[string]interface{}: metrics = make([]*metric, 0, len(val)) for k, v := range val { for _, m := range flatten(v) { m.pathStack = append(m.pathStack, k) metrics = append(metrics, m) } } default: log.Printf("Ignoring unexpected type '%T' for value %v", val, val) } return metrics }
{ "content_hash": "cd42527fc2a0c5ac0d824cf562324f01", "timestamp": "", "source": "github", "line_count": 249, "max_line_length": 97, "avg_line_length": 23.97991967871486, "alnum_prop": 0.664545302294423, "repo_name": "titilambert/telegraf", "id": "d8ebf5017233916c948250bdd87d800b4f7e89e8", "size": "5971", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "plugins/inputs/ceph/ceph.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "1885495" }, { "name": "Makefile", "bytes": "3059" }, { "name": "Python", "bytes": "38977" }, { "name": "Ruby", "bytes": "1437" }, { "name": "Shell", "bytes": "11511" } ], "symlink_target": "" }
<?php namespace LeagueWrap; use LeagueWrap\Api\AbstractApi; use LeagueWrap\Api\Staticdata; use LeagueWrap\Limit\Limit; use LeagueWrap\Limit\Collection; use LeagueWrap\Limit\FileLimit; use LeagueWrap\Exception\NoKeyException; use LeagueWrap\Exception\ApiClassNotFoundException; use LeagueWrap\Exception\NoValidLimitInterfaceException; /** * @method Api\Champion champion() * @method Api\Game game() * @method Api\League league() * @method Api\Staticdata staticData() * @method Api\Stats stats() * @method Api\Summoner summoner() * @method Api\Team team() * @method Api\CurrentGame currentGame() */ class Api { use Api\ConfigTrait; /** * The client used to connect with the riot API. * * @var ClientInterface */ protected $client; /** * This contains the cache container that we intend to use. * * @var CacheInterface */ protected $cache; /** * How long, in seconds, should we remember a query's response. * * @var int */ protected $remember = null; /** * The collection of limits to be used for all requests in this api. * * @var Collection */ protected $limits = null; /** * This is the api key, very important. * * @var string */ private $key; /** * Initiat the default client and key. * * @param string $key * @param ClientInterface $client * @throws NoKeyException */ public function __construct($key = null, ClientInterface $client = null) { if (is_null($key)) { throw new NoKeyException('We need a key... it\'s very important!'); } if (is_null($client)) { // set up the default client $client = new Client; } $this->client = $client; // add the key $this->key = $key; // set up the limit collection $this->collection = new Collection; } /** * This is the primary service locater if you utilize the api (which you should) to * load instance of the abstractApi. This is the method that is called when you attempt * to invoke "Champion()", "League()", etc. * * @param string $method * @param array $arguments * @return AbstractApi * @throws ApiClassNotFoundException */ public function __call($method, $arguments) { // we don't use the arguments at the moment. unset($arguments); $className = 'LeagueWrap\\Api\\'.ucwords(strtolower($method)); if ( ! class_exists($className)) { // This class does not exist throw new ApiClassNotFoundException('The api class "'.$className.'" was not found.'); } $api = new $className($this->client, $this->collection, $this); if ( ! $api instanceof AbstractApi) { // This is not an api class. throw new ApiClassNotFoundException('The api class "'.$className.'" was not found.'); } $api->setKey($this->key) ->setRegion($this->region) ->setTimeout($this->timeout) ->setCacheOnly($this->cacheOnly) ->setClientErrorCaching($this->cacheClientError) ->setServerErrorCaching($this->cacheServerError); if ($this->attachStaticData && ! ($api instanceof Staticdata) ) { $api->attachStaticData($this->attachStaticData, $this->staticData()); } if ($this->cache instanceof CacheInterface) { $api->remember($this->remember, $this->cache); } return $api; } /** * Sets the amount of seconds we should remember the response for. * Leave it empty (or null) if you want to use the default set for * each api request. * * @param int $seconds * @param CacheInterface $cache * @return $this */ public function remember($seconds = null, CacheInterface $cache = null) { if (is_null($cache)) { // use the built in cache interface $cache = new Cache; } $this->cache = $cache; $this->remember = $seconds; return $this; } /** * Sets a limit to be added to the collection. * * @param int $hits * @param int $seconds * @param string $region * @param LimitInterface $limit * @return $this * @throws NoValidLimitInterfaceException */ public function limit($hits, $seconds, $region = 'all', LimitInterface $limit = null) { if (is_null($limit)) { // use the built in limit interface $limit = new Limit; } if ( ! $limit->isValid()) { // fall back to the file base limit handling $limit = new FileLimit; if ( ! $limit->isValid()) { throw new NoValidLimitInterfaceException("We could not load a valid limit interface."); } } if ($region == 'all') { foreach ([ 'br', 'eune', 'euw', 'kr', 'lan', 'las', 'na', 'oce', 'ru', 'tr'] as $region) { $newLimit = $limit->newInstance(); $newLimit->setRate($hits, $seconds, $region); $this->collection->addLimit($newLimit); } } else { // lower case the region $region = strtolower($region); $limit->setRate($hits, $seconds, $region); $this->collection->addLimit($limit); } return $this; } /** * @return array of Limit */ public function getLimits() { return $this->collection->getLimits(); } }
{ "content_hash": "6d6d7e3c8e68d0db94c39d284293867a", "timestamp": "", "source": "github", "line_count": 225, "max_line_length": 91, "avg_line_length": 22.142222222222223, "alnum_prop": 0.6413087113608993, "repo_name": "Innovacionlechuga/leaguewrap", "id": "800d4e172e5be2ec3ac33d3cceb482c1f5df9421", "size": "4982", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/LeagueWrap/Api.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "255824" } ], "symlink_target": "" }
<?php /** * DOM SVG Glyph element class * * @category PAHDI * @package PAHDI-DOM */ class SVGGlyphElement extends SVGElement{}
{ "content_hash": "815f19cea7ee242d18422851d524a171", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 42, "avg_line_length": 14.3, "alnum_prop": 0.6363636363636364, "repo_name": "mck89/PAHDI", "id": "388536ef6c656d3d920d02fe9ceb41360b771050", "size": "569", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Dom/SVG/Glyph.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "869852" } ], "symlink_target": "" }
// Copyright (c) 2013 // Nathanael Fillmore (University of Wisconsin-Madison) // nathanae@cs.wisc.edu // // This file is part of REF-EVAL. // // REF-EVAL is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // REF-EVAL is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with REF-EVAL. If not, see <http://www.gnu.org/licenses/>. #pragma once #include <vector> #include <string> #include "line_stream.hh" #include "alignment_segment.hh" namespace detail { class fake_alignment_input_stream; } //////////////////////////////////////////////////////////////////////////// // fake_alignment represents a single fake alignment, used for testing. It // realizes the Alignment concept. //////////////////////////////////////////////////////////////////////////// class fake_alignment { public: // Realization of Alignment concept void parse_line(const std::string& /*line*/) { throw std::runtime_error("Not implemented."); } std::string a_name() const { return a_name_; } std::string b_name() const { return b_name_; } double frac_identity() const { return frac_identity_; } double frac_indel() const { return frac_indel_; } typedef detail::fake_alignment_input_stream input_stream_type; typedef const std::vector<alignment_segment>& segments_type; segments_type segments(const std::string& /*a*/, const std::string& /*b*/) const { return alignment_segments; } // Data std::string a_name_, b_name_; double frac_identity_, frac_indel_; std::vector<alignment_segment> alignment_segments; }; std::ostream& operator<<(std::ostream& out, const fake_alignment& al) { out << "Alignment " << al.a_name() << " -> " << al.b_name() << ", frac_identity=" << al.frac_identity() << ", frac_indel=" << al.frac_indel() << ", alignment_segments={ "; BOOST_FOREACH(const alignment_segment& seg, al.alignment_segments) out << "seg=" << seg << " "; out << "}"; return out; } namespace detail { class fake_alignment_input_stream { public: fake_alignment_input_stream(const std::vector<fake_alignment>& fake_alignments) : fake_alignments(fake_alignments), i(0), done(false) {} fake_alignment_input_stream& operator>>(fake_alignment& al) { if (i < fake_alignments.size()) al = fake_alignments[i]; else done = true; ++i; return *this; } inline operator bool() { return !done; } inline bool operator!() { return done; } std::vector<fake_alignment> fake_alignments; size_t i; bool done; }; } // namespace detail
{ "content_hash": "8ceb416585a8be71797d5e74c9ff4270", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 140, "avg_line_length": 33.355555555555554, "alnum_prop": 0.6352431712191872, "repo_name": "fmaguire/BayeHem", "id": "12596b44c672171b60a41d51ef9ecf10fa9eb0c2", "size": "3002", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bayehem/rsem/detonate-1.11/ref-eval/fake_alignment.hh", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "10914" }, { "name": "Batchfile", "bytes": "23271" }, { "name": "C", "bytes": "3837551" }, { "name": "C++", "bytes": "33218177" }, { "name": "CSS", "bytes": "1556" }, { "name": "Groff", "bytes": "59793" }, { "name": "HTML", "bytes": "365248" }, { "name": "IDL", "bytes": "14" }, { "name": "Java", "bytes": "13433" }, { "name": "Lua", "bytes": "23713" }, { "name": "M4", "bytes": "19951" }, { "name": "Makefile", "bytes": "118962" }, { "name": "Objective-C", "bytes": "8790" }, { "name": "Perl", "bytes": "272990" }, { "name": "Python", "bytes": "6200881" }, { "name": "QML", "bytes": "593" }, { "name": "R", "bytes": "4898" }, { "name": "Shell", "bytes": "270614" }, { "name": "TeX", "bytes": "8434" }, { "name": "XSLT", "bytes": "759" }, { "name": "Yacc", "bytes": "18910" } ], "symlink_target": "" }
class Api::V1::BulletinResource < JSONAPI::Resource attributes :name, :service_order, :banner_url attribute :published_at, format: :iso8601 has_one :group has_one :sermon has_many :announcements filter :latest_for_group filter :group def self.apply_filter(records, filter, value, options) case filter when :group records.where(group_id: value) when :latest_for_group records.latest.where(group_id: value).limit(1) else return super(records, filter, value, options) end end end
{ "content_hash": "d5293366436d48661741d611daf06b38", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 56, "avg_line_length": 23.347826086956523, "alnum_prop": 0.6927374301675978, "repo_name": "openmcac/basechurch", "id": "c744211ac08f86badfb31c3432eadefc2fa46dd8", "size": "537", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/resources/api/v1/bulletin_resource.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "683" }, { "name": "HTML", "bytes": "2662" }, { "name": "JavaScript", "bytes": "599" }, { "name": "Ruby", "bytes": "191002" }, { "name": "Shell", "bytes": "2351" } ], "symlink_target": "" }
{% extends "../admin.html" %} <!-- page title --> {% block page_title %} Licence serial number {{ pData.LicenceNumber }} - GOV.UK {% endblock %} {% block content %} <main id="content" role="main"> {% from "custom_inc/waterdata.html" import permits %} {% for pNumber, pData in permits %} {% if pNumber==chosenPermitID %} <!-- internal beta banner block --> {% include "../partials/feedback-banner.html" %} <!-- navigation block --> {% include "../partials/nav-view.html" %} <!-- page title --> <div class="grid-row"> <div class="column-two-thirds big-space"> <div class="banner bold-medium"> <div class="notice"> <i class="icon icon-important"> <span class="visually-hidden">Warning</span> </i> <strong class="bold-small"> This licence version expired on 3 March 2011. </strong> </div> </div> </div> </div> <div class="strike-wrapper"> <div class="strike"> </div> </div> <!-- page title --> <div class="medium-space"> <!-- page heading --> {% if pData.LicenceName %} <h1 class="heading-large">{{ pData.LicenceName }}</h1> {% else %} <h1 class="heading-large">Licence number {{ pData.LicenceSerialNo }}</h1> {% endif %} </div> <!-- <p> This licence version started on <span class="bold-small">{{ pData.EffectiveDateStart }}</span> and ends on <span class="bold-small">{{ pData.EffectiveDateEnd }}</span>. </p> --> <!-- navigation block --> <nav class="page-numbers-container page-navigation medium-space" aria-label="Pagination"> <div class="previous"> <a href="" rel="prev">Previous version</a> </div> <div class="next"> <a href="" rel="next">Following version</a> </div> </nav> <!-- Licence holder --> <div class="datatable"> <label>Licence holder</label> <div class="licenceAnswerv7"> {{ pData.HolderFirstName }} {{ pData.HolderSurname }}</br> <a href="/v18/pages/contact_details?wid={{ pNumber }}">View licence contact details</a> </div> </div> <div class="datatable"> <label>Effective start date</label> <div class="licenceAnswerv7"> {{ pData.EffectiveDateStart }} </div> </div> <div class="datatable"> <label>Expiry date</label> <div class="licenceAnswerv7"> {{ pData.EffectiveDateEnd }} </div> </div> <!-- <div class="datatable"> <label>Effective from</label> <div class="licenceAnswerv7"> {{ pData.EffectiveDateStart }} </div> </div> <div class="datatable"> <label>End date</label> <div class="licenceAnswerv7"> {{ pData.EffectiveDateEnd }} </div> </div> --> <div class="datatable"> <label>Source of supply</label> <div class="licenceAnswerv7">{{ pData.Source}}</div> </div> <div class="datatable"> <label>Purpose of abstraction</label> <div class="licenceAnswerv7"> {{ pData.Purpose1 }}</br> </div> </div> <div class="datatable"> <label>Period of abstraction</label> <div class="licenceAnswerv7">{{ pData.PeriodofAbstraction }}</div> </div> <div class="datatable"> {% if pData.Point2 %} <label>Points of abstraction</label> <div class="licenceAnswerv7"> {{ pData.Point1 }}<br> {{ pData.Point2 }}<br> {% if pData.Point3 %} {{ pData.Point3 }}<br> {% endif %} {% if pData.Point4 %} {{ pData.Point4 }}<br> {% endif %} {% if pData.Point5 %} {{ pData.Point5 }}<br> {% endif %} <a href="points/points?wid={{ query.wid }}">View details of abstraction points</a> </div> {% else %} <label>Point of abstraction</label> <div class="licenceAnswerv7"> {{ pData.Point1 }}<br> <a href="points/points?wid={{ query.wid }}">View details of abstraction point</a> {% endif %} </div> <div class="datatable"> <label>Abstraction conditions</label> <div class="licenceAnswerv7"> {{ pData.Condition1 }}</br> {% if pData.Condition2 %} {{ pData.Condition2 }}</br> {% endif %} {% if pData.Condition3 %} {{ pData.Condition3 }}</br> {% endif %} {% if pData.Condition4 %} {{ pData.Condition4 }}</br> {% endif %} {% if pData.Condition5 %} {{ pData.Condition5 }}</br> {% endif %} <a href="conditions/conditions?wid={{ query.wid }}">View details of abstraction conditions</a> </div> </div> <div class="datatable big-space"> <label>Abstraction amounts</label> <div class="licenceAnswerv7"> {{ pData.Amount1 }}</br> {% if pData.Amount2 %} {{ pData.Amount2 }}</br> {% endif %} {% if pData.Amount3 %} {{ pData.Amount3 }}</br> {% endif %} {% if pData.Amount4 %} {{ pData.Amount4 }}</br> {% endif %} {% if pData.Amount5 %} {{ pData.Amount5 }}</br> {% endif %} </div> </div> <!-- bad data block --> {% include "../partials/versions.html" %} </div> {% endif %} {% endfor %} </main> {% endblock %}
{ "content_hash": "9aa0c4df3ff0fced0c1412d422ac284e", "timestamp": "", "source": "github", "line_count": 222, "max_line_length": 172, "avg_line_length": 23.5, "alnum_prop": 0.5493578685068047, "repo_name": "christinagyles-ea/water", "id": "e90c4204bb0ea2ffb44bb73837c8bc6c7650bef0", "size": "5217", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/v6/views/v18/admin/online-licence-version.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "7565" }, { "name": "HTML", "bytes": "291991" }, { "name": "JavaScript", "bytes": "39109" }, { "name": "Shell", "bytes": "1495" } ], "symlink_target": "" }
using BEPUphysics.Constraints.TwoEntity; using BEPUphysics.Constraints.TwoEntity.JointLimits; using BEPUphysics.Constraints.TwoEntity.Joints; using BEPUphysics.Constraints.TwoEntity.Motors; using BEPUphysics.Entities; using BEPUutilities; namespace BEPUphysics.Constraints.SolverGroups { /// <summary> /// Restricts linear motion while allowing one degree of angular freedom. /// Acts like a normal door hinge. /// </summary> public class RevoluteJoint : SolverGroup { /// <summary> /// Constructs a new constraint which restricts three degrees of linear freedom and two degrees of angular freedom between two entities. /// This constructs the internal constraints, but does not configure them. Before using a constraint constructed in this manner, /// ensure that its active constituent constraints are properly configured. The entire group as well as all internal constraints are initially inactive (IsActive = false). /// </summary> public RevoluteJoint() { IsActive = false; BallSocketJoint = new BallSocketJoint(); AngularJoint = new RevoluteAngularJoint(); Limit = new RevoluteLimit(); Motor = new RevoluteMotor(); Add(BallSocketJoint); Add(AngularJoint); Add(Limit); Add(Motor); } /// <summary> /// Constructs a new constraint which restricts three degrees of linear freedom and two degrees of angular freedom between two entities. /// </summary> /// <param name="connectionA">First entity of the constraint pair.</param> /// <param name="connectionB">Second entity of the constraint pair.</param> /// <param name="anchor">Point around which both entities rotate.</param> /// <param name="freeAxis">Axis around which the hinge can rotate.</param> public RevoluteJoint(Entity connectionA, Entity connectionB, Vector3 anchor, Vector3 freeAxis) { if (connectionA == null) connectionA = TwoEntityConstraint.WorldEntity; if (connectionB == null) connectionB = TwoEntityConstraint.WorldEntity; BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor); AngularJoint = new RevoluteAngularJoint(connectionA, connectionB, freeAxis); Limit = new RevoluteLimit(connectionA, connectionB); Motor = new RevoluteMotor(connectionA, connectionB, freeAxis); Limit.IsActive = false; Motor.IsActive = false; //Ensure that the base and test direction is perpendicular to the free axis. Vector3 baseAxis = anchor - connectionA.position; if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) //anchor and connection a in same spot, so try the other way. baseAxis = connectionB.position - anchor; baseAxis -= Vector3.Dot(baseAxis, freeAxis) * freeAxis; if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) { //However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction. baseAxis = Vector3.Cross(freeAxis, Vector3.Up); if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) { baseAxis = Vector3.Cross(freeAxis, Vector3.Right); } } Limit.Basis.SetWorldAxes(freeAxis, baseAxis, connectionA.orientationMatrix); Motor.Basis.SetWorldAxes(freeAxis, baseAxis, connectionA.orientationMatrix); baseAxis = connectionB.position - anchor; baseAxis -= Vector3.Dot(baseAxis, freeAxis) * freeAxis; if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) { //However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction. baseAxis = Vector3.Cross(freeAxis, Vector3.Up); if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) { baseAxis = Vector3.Cross(freeAxis, Vector3.Right); } } Limit.TestAxis = baseAxis; Motor.TestAxis = baseAxis; Add(BallSocketJoint); Add(AngularJoint); Add(Limit); Add(Motor); } /// <summary> /// Gets the angular joint which removes two degrees of freedom. /// </summary> public RevoluteAngularJoint AngularJoint { get; private set; } /// <summary> /// Gets the ball socket joint that restricts linear degrees of freedom. /// </summary> public BallSocketJoint BallSocketJoint { get; private set; } /// <summary> /// Gets the rotational limit of the hinge. /// </summary> public RevoluteLimit Limit { get; private set; } /// <summary> /// Gets the motor of the hinge. /// </summary> public RevoluteMotor Motor { get; private set; } } }
{ "content_hash": "da9708bbb72c3cb40acf71e3882cb25a", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 180, "avg_line_length": 43.837606837606835, "alnum_prop": 0.6205888087346462, "repo_name": "karrtmomil/coms437_assignment2", "id": "b48e3d92851f26ab986a39f6c3c45dfe54cafc7a", "size": "5131", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "3DAsteroids/3DAsteroids/BEPUphysics/Constraints/SolverGroups/RevoluteJoint.cs", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
class Unidom::Certificate::ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
{ "content_hash": "736dcbc97013ada6719ae9996dbd98fc", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 65, "avg_line_length": 33, "alnum_prop": 0.797979797979798, "repo_name": "topbitdu/unidom-certificate", "id": "eb1d3faecb92917b21b3d3850d2d616b535e1ca8", "size": "167", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/unidom/certificate/application_record.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "717" }, { "name": "HTML", "bytes": "276" }, { "name": "JavaScript", "bytes": "790" }, { "name": "Ruby", "bytes": "16129" } ], "symlink_target": "" }
package io.crate.analyze.symbol; import io.crate.sql.tree.QualifiedName; import io.crate.types.DataTypes; import org.elasticsearch.common.io.stream.BytesStreamInput; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; public class RelationColumnTest { @Test public void testStreaming() throws Exception { RelationColumn rc = new RelationColumn(QualifiedName.of("a", "b"), 5, DataTypes.STRING); BytesStreamOutput out = new BytesStreamOutput(256); Symbol.toStream(rc, out); BytesStreamInput in = new BytesStreamInput(out.bytes()); RelationColumn rc2 = (RelationColumn) Symbol.fromStream(in); assertThat(rc2, is(rc)); } }
{ "content_hash": "15cbf3e981dc67ee9976c75969f5296b", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 96, "avg_line_length": 31.115384615384617, "alnum_prop": 0.7379480840543882, "repo_name": "aslanbekirov/crate", "id": "14a0eb846d5f9cf5c3f903e40548cda2eef2ba26", "size": "1806", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sql/src/test/java/io/crate/analyze/symbol/RelationColumnTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3017" }, { "name": "GAP", "bytes": "74276" }, { "name": "Java", "bytes": "8213808" }, { "name": "Python", "bytes": "2210" }, { "name": "Shell", "bytes": "11512" } ], "symlink_target": "" }
import path from 'path'; import { parse } from '../utils/cli-tools'; import { getContent } from '../utils/file'; const configNameRegex = /^(\.nycrc(\.(json|yml|yaml))?|nyc.config.js)$/; function getExtendsDependencies(extendConfig, deps) { const dependencies = []; if (Array.isArray(extendConfig)) { extendConfig.forEach((extend) => dependencies.push(...getExtendsDependencies(extend, deps)), ); } else if (!path.isAbsolute(extendConfig)) { const extendParts = extendConfig.split('/'); let depName = extendParts.shift(); if (depName.startsWith('@')) { depName += `/${extendParts.shift()}`; } if (deps.includes(depName)) { dependencies.push(depName); } } return dependencies; } export default async function parseIstanbul(filename, deps) { const basename = path.basename(filename); let config; if (configNameRegex.test(basename)) { const content = await getContent(filename); config = parse(content); } else if (basename === 'package.json') { const content = await getContent(filename); config = JSON.parse(content).nyc; } const requires = []; if (config && config.extends) { requires.push(...getExtendsDependencies(config.extends, deps)); } return requires; }
{ "content_hash": "856fda503aaf174766977340e795bfef", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 72, "avg_line_length": 29.372093023255815, "alnum_prop": 0.6634996041171813, "repo_name": "depcheck/depcheck", "id": "c9ea86ab2cc9157d5a3630c702c7efcc5794ed03", "size": "1263", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/special/istanbul.js", "mode": "33188", "license": "mit", "language": [ { "name": "CoffeeScript", "bytes": "59" }, { "name": "JavaScript", "bytes": "215174" }, { "name": "SCSS", "bytes": "486" }, { "name": "Sass", "bytes": "300" }, { "name": "Svelte", "bytes": "74" }, { "name": "TypeScript", "bytes": "995" }, { "name": "Vue", "bytes": "486" } ], "symlink_target": "" }
/* * Copyleft 2015 * and other contributors as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jam.metrics.applicationmetricsjavaseapitest; import java.util.concurrent.Callable; import org.jam.metrics.applicationmetricsapi.types.Metric; import org.jam.metrics.applicationmetricsapi.types.MetricProperties; /** * * @author Panagiotis Sotiropoulos */ public class MetricsApiSeTestClass { private Metric count; private Metric count2; private MetricProperties metricProperties; private static int i = 0; public MetricsApiSeTestClass() { metricProperties = new MetricProperties(null, "myTestGroup", null, null); count = new Metric("count", 0, metricProperties); count2 = new Metric("count2", 0, metricProperties); } public void countMethod() throws Exception { Callable<Object> applyMetricFeatures1 = new Callable<Object>() { public Object call() throws Exception { count.setMetricValue((int)count.getMetricValue()+1); return null; } }; Callable<Object> applyMetricFeatures2 = new Callable<Object>() { public Object call() throws Exception { count2.setMetricValue((int)count2.getMetricValue()+2); return null; } }; for (int j=0; j<100; j++) { count.applyMetricFeatures(applyMetricFeatures1); count2.applyMetricFeatures(applyMetricFeatures2); } } }
{ "content_hash": "3303d81f631428e1a3d73feb9795453a", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 81, "avg_line_length": 31.666666666666668, "alnum_prop": 0.6650717703349283, "repo_name": "panossot/jboss-automated-metrics", "id": "509c34dc8b9c39efd445b191c7cdc1134619b0d3", "size": "2090", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "JavaSeApplicationMetrics/ApplicationMetricsJavaSeApiTest9/src/main/java/org/jam/metrics/applicationmetricsjavaseapitest/MetricsApiSeTestClass.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "5544" }, { "name": "Java", "bytes": "494827" } ], "symlink_target": "" }
module.exports = { getPeopleByOuting: (id, client) => { return client('person_outing').where('outing_id', id).select('person_id') .then(result => { return result.map(r => r.person_id); }); }, getFullPeopleByOuting: (id, client) => { return client.from('person_outing').innerJoin('person', 'person_outing.person_id', 'person.id').where('outing_id', id).select('person.*') .then(result => { return result; }); }, getPeople: (client) => { return client('person').then(result => { return result; }); }, getPerson: (id, client) => { return client('person').where('id', id).first() .then(result => { return result; }); }, createPerson: (person, client) => { return client('person') .insert(person) .returning(['id', 'name', 'number_coffee_drank', 'number_coffee_paid', 'coffee_price', 'created_at', 'updated_at']) .then(result => { const createdPerson = result[0]; createdPerson.outingIds = []; return createdPerson; }); }, editPerson: (person, client) => { return client('person') .update({ name: person.name, number_coffee_drank: person.number_coffee_drank, number_coffee_paid: person.number_coffee_paid, coffee_price: person.coffee_price, updated_at: client.fn.now(), }) .where('id', person.id) .returning(['id', 'name', 'number_coffee_drank', 'number_coffee_paid', 'coffee_price', 'created_at', 'updated_at']) .then(result => { return result[0]; }); }, };
{ "content_hash": "efee7c7205458c6bdcf39daf4cc518db", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 141, "avg_line_length": 32.333333333333336, "alnum_prop": 0.5512431776834446, "repo_name": "jackyzhen/coffee-tracker", "id": "25124777c620e0247f66df3fa2f08dde26ac9d04", "size": "1649", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/graphql/personService.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "320" }, { "name": "HTML", "bytes": "530" }, { "name": "JavaScript", "bytes": "56284" } ], "symlink_target": "" }
package com.appdynamics.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.List; import org.exolab.castor.mapping.Mapping; import org.exolab.castor.mapping.MappingException; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.xml.sax.InputSource; import com.opensymphony.xwork2.ActionContext; import com.appdynamicspilot.model.Cart; import com.appdynamicspilot.model.Item; import com.appdynamicspilot.model.User; import com.appdynamicspilot.service.CartService; import com.appdynamicspilot.service.ItemService; import com.appdynamicspilot.util.SpringContext; public class CastorUtil { public List<Item> saveCartItems(String xml) { ItemService itemService = (ItemService) SpringContext.getBean("itemService"); CartService cartService = (CartService) SpringContext.getBean("cartService"); StringReader sr = new StringReader(xml); CartVO cartVo; Cart cart = new Cart(); try { System.out.println(">>>>>>>>>>>>>>>xml is >>>>>>>>>>>>>>>" + xml); cartVo = getCartVO(xml); if (cartVo == null) { System.out.println(">>>>>> Cart is null>>>>>>>>>>" + cartVo); } List<ItemVO> items = cartVo.getItems(); for (ItemVO item : items) { cart.addItem(itemService.getItemByName(item.getName())); User user = (User) ActionContext.getContext().getSession().get("USER"); cart.setUser(user); cartService.saveItemInCart(cart); } } catch (Exception e) { e.printStackTrace(); } return cart.getItems(); } public CartVO getCartVO(String xml) { CartVO cartVO = null; Mapping mapping = new Mapping(); String mappingRules = getMappingRule(); StringReader sr = new StringReader(mappingRules); InputSource source = new InputSource(sr); mapping.loadMapping(source); Unmarshaller um = new Unmarshaller(); try { um.setMapping(mapping); cartVO = (CartVO) um.unmarshal(CartVO.class, new StringReader(xml)); } catch (MappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MarshalException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ValidationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return cartVO; } public String getMappingRule() { return "<?xml version=\"1.0\"?><!DOCTYPE mapping PUBLIC \"-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN\" \"http://castor.exolab.org/mapping.dtd\"><mapping><description>A mapping file Cart application</description><class name=\"com.appdynamics.xml.ItemVO\"><field name=\"name\" type=\"string\"/></class><class name=\"com.appdynamics.xml.CartVO\"><field name=\"items\" type=\"com.appdynamics.xml.ItemVO\" collection=\"collection\" /></class></mapping>"; } public String getXML(CartVO cartVO) { StringWriter sw = new StringWriter(); try { Mapping mapping = new Mapping(); String mappingRules = getMappingRule(); StringReader sr = new StringReader(mappingRules); InputSource source = new InputSource(sr); mapping.loadMapping(source); Marshaller m = new Marshaller(); m.setMapping(mapping); m.marshal(cartVO, sw); } catch (MarshalException e) { e.printStackTrace(); } catch (ValidationException e) { e.printStackTrace(); } catch (MappingException e) { e.printStackTrace(); } return sw.toString(); } public static void main(String[] args) { //Marshaller.marshal(ItemVO., handler) CastorUtil cu = new CastorUtil(); CartVO cvo = new CartVO(); cvo.getItems().add(new ItemVO("asdasd")); cvo.getItems().add(new ItemVO("aaa")); String xml = cu.getXML(cvo); cu.getCartVO(xml); System.out.println(xml); } }
{ "content_hash": "96221c39f6560b5b53f6412fc4138ecb", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 466, "avg_line_length": 37.530434782608694, "alnum_prop": 0.6193234476367007, "repo_name": "udayinfy/ECommerce-Java", "id": "06d2aba850dab64b203d4984f72166762c7c5558", "size": "4916", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ECommerce-Web/src/main/java/com/appdynamics/xml/CastorUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "21333" }, { "name": "HTML", "bytes": "7210" }, { "name": "Java", "bytes": "661169" }, { "name": "Perl", "bytes": "729" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <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> <parent> <groupId>org.sonatype.oss</groupId> <artifactId>oss-parent</artifactId> <version>7</version> </parent> <groupId>com.vikingsen</groupId> <artifactId>pocketknife-parent</artifactId> <version>3.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>Pocket Knife (Parent)</name> <description>Intent and Bundle utility for Android.</description> <url>http://github.com/hansenji/butterknife/</url> <inceptionYear>2014</inceptionYear> <modules> <module>pocketknife</module> <module>pocketknife-compiler</module> <module>pocketknife-sample</module> </modules> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.6</java.version> <android.version>4.1.1.4</android.version> <android.platform>16</android.platform> <support-v4.version>r7</support-v4.version> <javapoet.version>1.0.0</javapoet.version> <guava.version>18.0</guava.version> <fest.version>2.0M10</fest.version> <junit.version>4.12</junit.version> <robolectric.version>3.0-rc2</robolectric.version> <compile-test.version>0.7</compile-test.version> <commons-lang3.version>3.4</commons-lang3.version> <surefireArgLine /> </properties> <scm> <url>http://github.com/hansenji/pocketknife/</url> <connection>scm:git:git://github.com/hansenji/pocketknife.git</connection> <developerConnection>scm:git:ssh://git@github.com/hansenji/pocketknife.git</developerConnection> <tag>HEAD</tag> </scm> <issueManagement> <system>GitHub Issues</system> <url>http://github.com/hansenji/pocketknife/issues</url> </issueManagement> <licenses> <license> <name>Apache 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> </license> </licenses> <dependencyManagement> <dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <version>${android.version}</version> </dependency> <dependency> <groupId>com.google.android</groupId> <artifactId>support-v4</artifactId> <version>${support-v4.version}</version> </dependency> <dependency> <groupId>com.squareup</groupId> <artifactId>javapoet</artifactId> <version>${javapoet.version}</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> </dependency> <dependency> <groupId>org.easytesting</groupId> <artifactId>fest-assert-core</artifactId> <version>${fest.version}</version> </dependency> <dependency> <groupId>org.robolectric</groupId> <artifactId>robolectric</artifactId> <version>${robolectric.version}</version> </dependency> <dependency> <groupId>com.google.testing.compile</groupId> <artifactId>compile-testing</artifactId> <version>${compile-test.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <showWarnings>true</showWarnings> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.9.1</version> <configuration> <failsOnError>true</failsOnError> <configLocation>checkstyle.xml</configLocation> <consoleOutput>true</consoleOutput> </configuration> <executions> <execution> <phase>verify</phase> <goals> <goal>checkstyle</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.4</version> <configuration> <autoVersionSubmodules>true</autoVersionSubmodules> </configuration> </plugin> </plugins> <pluginManagement> <plugins> <plugin> <groupId>com.simpligility.maven.plugins</groupId> <artifactId>android-maven-plugin</artifactId> <version>4.1.0</version> <configuration> <sdk> <platform>${android.platform}</platform> </sdk> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9</version> <configuration> <!--<additionalparam>-Xdoclint:none</additionalparam>--> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.2.201409121644</version> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> <distributionManagement> <snapshotRepository> <id>ossrh</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> </snapshotRepository> <repository> <id>ossrh</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> </repository> </distributionManagement> </project>
{ "content_hash": "e33f9ee5ec0cb19db2dd4ce4c9b0ebf3", "timestamp": "", "source": "github", "line_count": 209, "max_line_length": 201, "avg_line_length": 37.90909090909091, "alnum_prop": 0.5129370188060078, "repo_name": "moltak/pocketknife", "id": "037373a73efc1b60f432d9c37ffaa30cd059bdc5", "size": "7923", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "25211" }, { "name": "HTML", "bytes": "15766" }, { "name": "Java", "bytes": "203734" }, { "name": "JavaScript", "bytes": "16022" }, { "name": "Shell", "bytes": "927" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <sem:triples uri="http://www.lds.org/vrl/specific-people/artists-and-illustrators/pixton-byron" xmlns:sem="http://marklogic.com/semantics"> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/artists-and-illustrators/pixton-byron</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate> <sem:object datatype="xsd:string" xml:lang="eng">Pixton, Byron</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/artists-and-illustrators/pixton-byron</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate> <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/artists-and-illustrators/pixton-byron</sem:subject> <sem:predicate>http://www.lds.org/core#entityType</sem:predicate> <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object> </sem:triple> </sem:triples>
{ "content_hash": "1fbdfc37040ee11cee0e6b83a21d3237", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 139, "avg_line_length": 60.22222222222222, "alnum_prop": 0.7232472324723247, "repo_name": "freshie/ml-taxonomies", "id": "02c3183b864edd7934881fb5b61f4fbf3d1f69af", "size": "1084", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "roxy/data/gospel-topical-explorer-v2/taxonomies/vrl/specific-people/artists-and-illustrators/pixton-byron.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4422" }, { "name": "CSS", "bytes": "38665" }, { "name": "HTML", "bytes": "356" }, { "name": "JavaScript", "bytes": "411651" }, { "name": "Ruby", "bytes": "259121" }, { "name": "Shell", "bytes": "7329" }, { "name": "XQuery", "bytes": "857170" }, { "name": "XSLT", "bytes": "13753" } ], "symlink_target": "" }
<?php namespace Sabre\CalDAV\Schedule; use Sabre\DAV; use Sabre\CalDAV; use Sabre\DAVACL; class Outbox extends DAV\Collection implements IOutbox { /** * The principal Uri * * @var string */ protected $principalUri; /** * Constructor * * @param string $principalUri */ function __construct($principalUri) { $this->principalUri = $principalUri; } /** * Returns the name of the node. * * This is used to generate the url. * * @return string */ function getName() { return 'outbox'; } /** * Returns an array with all the child nodes * * @return \Sabre\DAV\INode[] */ function getChildren() { return []; } /** * Returns the owner principal * * This must be a url to a principal, or null if there's no owner * * @return string|null */ function getOwner() { return $this->principalUri; } /** * Returns a group principal * * This must be a url to a principal, or null if there's no owner * * @return string|null */ function getGroup() { return null; } /** * Returns a list of ACE's for this node. * * Each ACE has the following properties: * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are * currently the only supported privileges * * 'principal', a url to the principal who owns the node * * 'protected' (optional), indicating that this ACE is not allowed to * be updated. * * @return array */ function getACL() { return [ [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy', 'principal' => $this->getOwner(), 'protected' => true, ], [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent', 'principal' => $this->getOwner(), 'protected' => true, ], [ 'privilege' => '{DAV:}read', 'principal' => $this->getOwner(), 'protected' => true, ], [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy', 'principal' => $this->getOwner() . '/calendar-proxy-write', 'protected' => true, ], [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent', 'principal' => $this->getOwner() . '/calendar-proxy-write', 'protected' => true, ], [ 'privilege' => '{DAV:}read', 'principal' => $this->getOwner() . '/calendar-proxy-read', 'protected' => true, ], [ 'privilege' => '{DAV:}read', 'principal' => $this->getOwner() . '/calendar-proxy-write', 'protected' => true, ], ]; } /** * Updates the ACL * * This method will receive a list of new ACE's. * * @param array $acl * @return void */ function setACL(array $acl) { throw new DAV\Exception\MethodNotAllowed('You\'re not allowed to update the ACL'); } /** * Returns the list of supported privileges for this node. * * The returned data structure is a list of nested privileges. * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple * standard structure. * * If null is returned from this method, the default privilege set is used, * which is fine for most common usecases. * * @return array|null */ function getSupportedPrivilegeSet() { $default = DAVACL\Plugin::getDefaultSupportedPrivilegeSet(); $default['aggregates'][] = [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy', ]; $default['aggregates'][] = [ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent', ]; return $default; } }
{ "content_hash": "e935adcd0e15ed00a0cd290cca09b041", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 91, "avg_line_length": 24.488505747126435, "alnum_prop": 0.5034029570523352, "repo_name": "vmire/sabre-dav", "id": "b0a96660813676256a152046261bd3c671f8513b", "size": "4689", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "lib/CalDAV/Schedule/Outbox.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "17084" }, { "name": "PHP", "bytes": "1969212" }, { "name": "Python", "bytes": "12922" }, { "name": "Shell", "bytes": "56" } ], "symlink_target": "" }
> Include only certain items in an array ## Install ``` $ npm install arr-include ``` ## Usage ```js import arrayInclude from 'arr-include'; arrayInclude(['a', 'b', 'c'], ['b', 'x']); //=> ['b'] ``` ## Related - [arr-exclude](https://github.com/sindresorhus/arr-exclude) - Exclude certain items from an array
{ "content_hash": "07d84b3fc939004164049ac249a76de7", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 98, "avg_line_length": 15.8, "alnum_prop": 0.629746835443038, "repo_name": "sindresorhus/arr-include", "id": "d399e51c1be913666052fd614ce02aaec3cdea41", "size": "331", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "392" } ], "symlink_target": "" }
<template> <d-linear-layout id="main" style="width:100%; height: 100%" direction="vertical"> <!-- <d-view-stack id="content-view-stack" style="width: 100%; height: 100%; position: absolute !important"> </d-view-stack> --> </d-linear-layout> </template>
{ "content_hash": "dd18afd623ae2330cb02621df272cab3", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 109, "avg_line_length": 32.375, "alnum_prop": 0.6640926640926641, "repo_name": "edchat/dappSamples", "id": "faf0c35e4484772add2e7e20f01449173cc44a8d", "size": "259", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "deliteApp/main.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "19521" }, { "name": "HTML", "bytes": "288865" }, { "name": "JavaScript", "bytes": "134725" } ], "symlink_target": "" }
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('semesterpage', '0027_options_last_user_modification'), ] operations = [ migrations.AlterField( model_name='semester', name='published', field=models.BooleanField(default=False, help_text='Semesteret dukker ikke opp i navigasjonsbaren før det er publisert, men det er fortsatt mulig å besøke semesteret manuelt (URL: wikilinks.no/studieprogram/hovedprofil/semesternummer) for å teste resultatet før du publiserer.', verbose_name='publisert'), ), migrations.AlterField( model_name='studyprogram', name='has_archive', field=models.BooleanField(default=False, help_text='Huk av hvis studieprogrammet har filer i arkivet på wikilinks.no/arkiv.', verbose_name='har arkiv'), ), migrations.AlterField( model_name='studyprogram', name='published', field=models.BooleanField(default=False, help_text='Studieprogrammet dukker ikke opp i studieprogramlisten i navigasjonsbaren før det er publisert, men det er fortsatt mulig å besøke studieprogrammet manuelt (URL: wikilinks.no/visningsnavn) for å teste resultatet før du publiserer.', verbose_name='publisert'), ), ]
{ "content_hash": "2cec7fa10a4a96b1dcb7349c59b804c5", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 323, "avg_line_length": 49.285714285714285, "alnum_prop": 0.6891304347826087, "repo_name": "afriestad/WikiLinks", "id": "2da07cbe1bf7c6480ca98f557013ee5fda183801", "size": "1464", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "semesterpage/migrations/0028_auto_20170906_2226.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8075" }, { "name": "HTML", "bytes": "16335" }, { "name": "JavaScript", "bytes": "5439" }, { "name": "Python", "bytes": "197303" } ], "symlink_target": "" }
import '../amp-next-page'; import {PageState} from '../page'; import {ScrollDirection, ViewportRelativePos} from '../visibility-observer'; import {Services} from '../../../../src/services'; import {VisibilityState} from '../../../../src/visibility-state'; import {htmlFor} from '../../../../src/static-template'; import {setStyle} from '../../../../src/style'; const MOCK_NEXT_PAGE = `<header>Header</header> <div style="height:1000px"></div> <footer>Footer</footer>`; const MOCK_NEXT_PAGE_WITH_RECOMMENDATIONS = `<header>Header</header> <div style="height:1000px"></div> <amp-next-page> <script type="application/json"> [ { "image": "/examples/img/hero@1x.jpg", "title": "Title 3", "url": "./document3" }, { "image": "/examples/img/hero@1x.jpg", "title": "Title 4", "url": "./document4" }, { "image": "/examples/img/hero@1x.jpg", "title": "Title 2", "url": "./document2" } ] </script> </amp-next-page> <footer>Footer</footer>`; const VALID_CONFIG = [ { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 1', 'url': '/document1', }, { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 2', 'url': '/document2', }, ]; describes.realWin( 'amp-next-page component', { amp: { extensions: ['amp-next-page:1.0'], }, 'with script[type=text/plain][template=amp-mustache]': { templateType: 'script', }, 'with template[type=amp-mustache]': {templateType: 'template'}, }, (env) => { let win, doc, ampdoc; beforeEach(() => { win = env.win; doc = win.document; ampdoc = env.ampdoc; // Mocks ampdoc.getUrl = () => document.location.href; win.document.title = 'Host page'; }); async function getAmpNextPage(options, waitForLayout = true) { options = options || {}; const element = doc.createElement('amp-next-page'); // Ensure element is off screen when it renders. setStyle(element, 'marginTop', '10000px'); // Add inline config if specified if (options.inlineConfig) { const configElement = document.createElement('script'); configElement.setAttribute('id', 'next-page'); configElement.setAttribute('type', 'application/json'); configElement.textContent = JSON.stringify(options.inlineConfig); element.appendChild(configElement); } if (options.separator) { element.appendChild(options.separator); } if (options.src) { element.setAttribute('src', options.src); } if (options.maxPages) { element.setAttribute('max-pages', options.maxPages); } doc.body.appendChild(element); // With this the document will start fetching more ASAP. doc.scrollingElement.scrollTop = options.scrollTop != undefined ? options.scrollTop : 1; if (waitForLayout) { await element.build(); await element.layoutCallback(); } return element; } async function fetchDocuments( service, result = MOCK_NEXT_PAGE, urlOrNumber = 1 ) { const numPages = typeof urlOrNumber === 'string' ? 1 : urlOrNumber; // Set up the mock request if (typeof urlOrNumber === 'string') { env.fetchMock.get(new RegExp(urlOrNumber, 'g'), result); } else { for (let i = 1; i <= numPages; i++) { env.fetchMock.get(new RegExp(`/document${i}`, 'g'), result); } } // Ask the next page service to fetch the documents for (let i = 1; i <= numPages; i++) { await service.maybeFetchNext(); } } describe('inline config', () => { it('builds with valid inline config', async () => { await getAmpNextPage({ inlineConfig: VALID_CONFIG, }); }); it('errors on invalid inline config (object instead of array)', async () => { const element = await getAmpNextPage( { inlineConfig: { pages: [ { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 1', 'ampUrl': '/document1', }, { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 2', 'ampUrl': '/document2', }, ], }, }, false /** waitForLayout */ ); await allowConsoleError(() => element.build().catch((err) => { expect(err.message).to.include( 'amp-next-page Page list expected an array, found: object: [object Object]' ); element.parentNode.removeChild(element); }) ); }); it('errors on invalid inline config (ampUrl instead of url)', () => { expectAsyncConsoleError(/page url must be a string/, 1); getAmpNextPage({ inlineConfig: [ { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 1', 'ampUrl': '/document1', }, { 'image': '/examples/img/hero@1x.jpg', 'title': 'Title 2', 'ampUrl': '/document2', }, ], }); }); }); describe('remote config', () => { it('errors when no config specified', async () => { expectAsyncConsoleError( /amp-next-page should contain a <script> child or a URL specified/, 1 ); getAmpNextPage({}); }); it('builds with valid remote config (without inline config)', async () => { const element = await getAmpNextPage({ src: 'https://example.com/config.json', }); element.parentNode.removeChild(element); }); it('fetches remote config when specified in src', async () => { const element = await getAmpNextPage( { src: 'https://example.com/config.json', }, false /** waitForLayout */ ); const config = { pages: [ { image: '/examples/img/hero@1x.jpg', title: 'Remote config', url: '/document1', }, ], }; const fetchJsonStub = env.sandbox .stub(Services.batchedXhrFor(win), 'fetchJson') .resolves({ ok: true, json() { return Promise.resolve(config); }, }); const service = Services.nextPageServiceForDoc(doc); await element.build(); await element.layoutCallback(); expect( fetchJsonStub.calledWithExactly('https://example.com/config.json', {}) ).to.be.true; await service.readyPromise_; // Page 1 expect(service.pages_[1].title).to.equal('Remote config'); expect(service.pages_[1].url).to.include('/document1'); expect(service.pages_[1].image).to.equal('/examples/img/hero@1x.jpg'); element.parentNode.removeChild(element); }); it('errors on invalid remote config (ampUrl instead of url)', async () => { expectAsyncConsoleError(/page url must be a string/, 1); const config = { pages: [ { image: '/examples/img/hero@1x.jpg', title: 'Remote config', ampUrl: '/document1', }, ], }; env.sandbox.stub(Services.batchedXhrFor(win), 'fetchJson').resolves({ ok: true, json() { return Promise.resolve(config); }, }); const element = await getAmpNextPage({ src: 'https://example.com/config.json', }); element.parentNode.removeChild(element); }); }); describe('basic functionality', () => { let element; let service; beforeEach(async () => { element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); }); afterEach(async () => { element.parentNode.removeChild(element); }); it('should register pages from the given config', async () => { // Page 1 expect(service.pages_[1].title).to.equal('Title 1'); expect(service.pages_[1].url).to.include('/document1'); expect(service.pages_[1].image).to.equal('/examples/img/hero@1x.jpg'); // Page 2 expect(service.pages_[2].title).to.equal('Title 2'); expect(service.pages_[2].url).to.include('/document2'); expect(service.pages_[2].image).to.equal('/examples/img/hero@1x.jpg'); }); it('should internally register the host page', async () => { expect(service.pages_[0].title).to.equal('Host page'); expect(service.pages_[0].url).to.include('about:srcdoc'); expect(service.pages_[0].state_).to.equal(PageState.INSERTED); expect(service.pages_[0].visibilityState_).to.equal( VisibilityState.VISIBLE ); }); it('should not fetch the next document before scrolling', async () => { [1, 2].forEach((i) => { expect(service.pages_[i].state_).to.equal(PageState.QUEUED); expect(service.pages_[i].visibilityState_).to.equal( VisibilityState.PRERENDER ); }); }); it('fetches the next document on scroll', async () => { const firstPageFetchSpy = env.sandbox.spy(service.pages_[1], 'fetch'); const secondPageFetchSpy = env.sandbox.spy(service.pages_[2], 'fetch'); await fetchDocuments(service); expect(firstPageFetchSpy).to.be.calledOnce; expect(service.pages_[1].state_).to.equal(PageState.INSERTED); expect(service.pages_[1].visibilityState_).to.equal( VisibilityState.PRERENDER ); expect(secondPageFetchSpy).to.not.be.called; expect(service.pages_[2].state_).to.equal(PageState.QUEUED); expect(service.pages_[2].visibilityState_).to.equal( VisibilityState.PRERENDER ); }); it('fetches the second document on scroll', async () => { const firstPageFetchSpy = env.sandbox.spy(service.pages_[1], 'fetch'); const secondPageFetchSpy = env.sandbox.spy(service.pages_[2], 'fetch'); await fetchDocuments(service, MOCK_NEXT_PAGE, 2); expect(firstPageFetchSpy).to.be.calledOnce; expect(service.pages_[1].state_).to.equal(PageState.INSERTED); expect(service.pages_[1].visibilityState_).to.equal( VisibilityState.PRERENDER ); expect(secondPageFetchSpy).to.be.calledOnce; expect(service.pages_[2].state_).to.equal(PageState.INSERTED); expect(service.pages_[2].visibilityState_).to.equal( VisibilityState.PRERENDER ); }); it('blocks documents which resolve to a different origin when fetched ', async () => { expectAsyncConsoleError( /Invalid page URL supplied to amp-next-page, pages must be from the same origin as the current document/, 2 ); env.fetchMock.get(/\/document1/, { redirectUrl: 'https://othersite.com/article', body: MOCK_NEXT_PAGE, }); await service.maybeFetchNext(); expect(service.pages_[1].state_).to.equal(PageState.FAILED); expect(service.pages_[1].visibilityState_).to.equal( VisibilityState.PRERENDER ); }); it('adds the hidden class to elements that should be hidden', async () => { await fetchDocuments( service, `${MOCK_NEXT_PAGE} <div next-page-hide id="hidden" />` ); expect( service.pages_[1].document.getElementById('hidden') ).to.have.attribute('hidden'); }); it('replaces elements with their most recent instance', async () => { await fetchDocuments( service, `${MOCK_NEXT_PAGE} <div next-page-replace="replace-me" instance="1" />`, '/document1' ); service.pages_[1].setVisibility(VisibilityState.VISIBLE); await fetchDocuments( service, `${MOCK_NEXT_PAGE} <div next-page-replace="replace-me" instance="2" />`, '/document2' ); service.pages_[1].relativePos = ViewportRelativePos.INSIDE_VIEWPORT; service.updateVisibility(); service.pages_[1].relativePos = ViewportRelativePos.OUTSIDE_VIEWPORT; service.pages_[2].relativePos = ViewportRelativePos.INSIDE_VIEWPORT; service.updateVisibility(); expect(service.pages_[1].document.querySelector('[instance="1"]')).to.be .ok; expect( service.pages_[1].document.querySelector('[instance="1"]') ).to.have.attribute('hidden'); expect(service.pages_[2].document.querySelector('[instance="1"]')).to .not.be.ok; }); }); describe('initial behavior', () => { let element; let service; beforeEach(async () => { element = await getAmpNextPage( { inlineConfig: VALID_CONFIG, scrollTop: 0, }, /* no awaiting */ false ); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); }); afterEach(async () => { element.parentNode.removeChild(element); }); it('awaits first scroll', async () => { element.build(); await Promise.resolve(); expect(service.pages_.length).to.equal(1); win.dispatchEvent(new Event('scroll')); await Promise.resolve(); expect(service.pages_.length).to.equal(3); }); }); describe('infinite loading', () => { let element; let service; beforeEach(async () => { element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); }); afterEach(async () => { element.parentNode.removeChild(element); }); it('recursively parses pages and avoids loops', async () => { expect(service.pages_.length).to.equal(3); await fetchDocuments(service, MOCK_NEXT_PAGE_WITH_RECOMMENDATIONS); // Adds the two documents coming from Document 1's recommendations expect(service.pages_.length).to.equal(5); expect(service.pages_.some((page) => page.title == 'Title 3')).to.be .true; expect(service.pages_.some((page) => page.title == 'Title 4')).to.be .true; // Avoids loops (ignores previously inserted page) expect( service.pages_.filter((page) => page.title == 'Title 2').length ).to.equal(1); expect( element.querySelectorAll('.i-amphtml-next-page-document-container') .length ).to.equal(1); }); it('unloads pages and replaces them with a placeholder', async () => { const secondPagePauseSpy = env.sandbox.spy(service.pages_[2], 'pause'); await fetchDocuments(service, MOCK_NEXT_PAGE, 2); const {container} = service.pages_[2]; expect(container).to.be.ok; expect(container.querySelector('.i-amphtml-next-page-placeholder')).to .not.be.ok; expect(container.querySelector('.i-amphtml-next-page-shadow-root')).to .be.ok; service.pages_[2].visibilityState_ = VisibilityState.VISIBLE; service.visibilityObserver_.scrollDirection_ = ScrollDirection.UP; await service.hidePreviousPages_( 0 /** index */, 0 /** pausePageCountForTesting */ ); // Internally changes the state to paused expect(secondPagePauseSpy).to.be.calledOnce; expect(service.pages_[2].state_).to.equal(PageState.PAUSED); expect(service.pages_[2].visibilityState_).to.equal( VisibilityState.HIDDEN ); // Replaces the inserted shadow doc with a placeholder of equal height expect(container.querySelector('.i-amphtml-next-page-placeholder')).to .be.ok; expect(container.querySelector('.i-amphtml-next-page-shadow-root')).to .not.be.ok; expect( win.getComputedStyle( container.querySelector('.i-amphtml-next-page-placeholder') ).height ).to.equal('1036px'); }); it('reloads pages and removes the placeholder', async () => { const secondPageResumeSpy = env.sandbox.spy( service.pages_[2], 'resume' ); await fetchDocuments(service, MOCK_NEXT_PAGE, 2); const {container} = service.pages_[2]; expect(container).to.be.ok; service.pages_[2].visibilityState_ = VisibilityState.VISIBLE; service.visibilityObserver_.scrollDirection_ = ScrollDirection.UP; await service.hidePreviousPages_( 0 /** index */, 0 /** pausePageCountForTesting */ ); expect(service.pages_[2].state_).to.equal(PageState.PAUSED); expect(service.pages_[2].visibilityState_).to.equal( VisibilityState.HIDDEN ); service.visibilityObserver_.scrollDirection_ = ScrollDirection.DOWN; await service.resumePausedPages_( 1 /** index */, 0 /** pausePageCountForTesting */ ); // Replaces the inserted placeholder with the page's content expect(secondPageResumeSpy).to.be.calledOnce; expect(container.querySelector('.i-amphtml-next-page-placeholder')).to .not.be.ok; expect(container.querySelector('.i-amphtml-next-page-shadow-root')).to .be.ok; expect( win.getComputedStyle( container.querySelector('.i-amphtml-next-page-shadow-root') ).height ).to.equal('1036px'); }); }); describe('default separators & footers', () => { let element; let service; beforeEach(async () => { element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); }); afterEach(async () => { element.parentNode.removeChild(element); }); it('adds a default separator to the host page', async () => { await fetchDocuments(service, MOCK_NEXT_PAGE_WITH_RECOMMENDATIONS); expect(service.pages_[1].container.firstElementChild).to.have.class( 'amp-next-page-separator' ); }); it('adds a default separator between embedded pages', async () => { await fetchDocuments(service, MOCK_NEXT_PAGE, 2); expect(service.pages_[2].container.firstElementChild).to.have.class( 'amp-next-page-separator' ); }); it('adds a default recommendation box to the host page', async () => { await fetchDocuments(service, MOCK_NEXT_PAGE_WITH_RECOMMENDATIONS); expect(element.lastElementChild).to.have.class('amp-next-page-links'); }); }); describe('custom and templated separators & recommendation box', () => { let element; let service; let html; beforeEach(() => { html = htmlFor(doc); }); afterEach(async () => { element.parentNode.removeChild(element); }); it('renders a custom separator correctly', async () => { const separator = html` <div separator>Custom separator</div> `; element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, separator, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); await fetchDocuments(service, MOCK_NEXT_PAGE, 2); expect( service.pages_[1].container.firstElementChild.innerText ).to.equal('Custom separator'); expect( service.pages_[2].container.firstElementChild.innerText ).to.equal('Custom separator'); }); it('correctly renders a templated separator', async () => { const separator = html` <div separator> <template type="amp-mustache"> <div class="separator-content"> <span class="title">{{title}}</span> <span class="url">{{url}}</span> <span class="image">{{image}}</span> </div> </template> </div> `; element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, separator, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); const templateRenderStub = env.sandbox .stub(service.templates_, 'findAndRenderTemplate') .onFirstCall() .resolves(html` <span>Rendered 1</span> `) .onSecondCall() .resolves(html` <span>Rendered 2</span> `); await fetchDocuments(service, MOCK_NEXT_PAGE, '1'); expect(templateRenderStub).to.have.been.calledWith( env.sandbox.match.any, { title: 'Title 1', url: '', image: '/examples/img/hero@1x.jpg', } ); await fetchDocuments(service, MOCK_NEXT_PAGE, '2'); expect(templateRenderStub).to.have.been.calledWith( env.sandbox.match.any, { title: 'Title 2', url: '', image: '/examples/img/hero@1x.jpg', } ); const template1 = service.pages_[1].container.querySelector( '[separator]' ); const template2 = service.pages_[2].container.querySelector( '[separator]' ); expect(template1.innerText).to.equal('Rendered 1'); expect(template2.innerText).to.equal('Rendered 2'); }); it('correctly renders a templated recommendation-box', async () => { const separator = html` <div recommendation-box> <template type="amp-mustache"> <div class="recommendation-box-content"> {{#pages}} <span class="title">{{title}}</span> <span class="url">{{url}}</span> <span class="image">{{image}}</span> {{/pages}} </div> </template> </div> `; element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, separator, }); service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(0); const templateRenderStub = env.sandbox .stub(service.templates_, 'findAndRenderTemplate') .resolves(html` <span>Rendered</span> `); await fetchDocuments(service, MOCK_NEXT_PAGE, '1'); expect(templateRenderStub).to.have.been.calledWith( env.sandbox.match.any, { pages: [ { title: 'Title 1', url: '', image: '/examples/img/hero@1x.jpg', }, { title: 'Title 2', url: 'http://localhost:9876/document2', image: '/examples/img/hero@1x.jpg', }, ], } ); expect(element.lastElementChild.innerText).to.equal('Rendered'); }); }); describe('page suggestion limiting', () => { it('should register all pages if a limit is not specified', async () => { const element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, }); const service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); expect(service.pages_.length).to.equal(3); element.parentNode.removeChild(element); }); it('should only fetch pages up to the given limit', async () => { const element = await getAmpNextPage({ inlineConfig: VALID_CONFIG, maxPages: 1, }); const service = Services.nextPageServiceForDoc(doc); env.sandbox.stub(service, 'getViewportsAway_').returns(2); // Try to fetch more pages than necessary to make sure // pages above the maximum are not fetched await fetchDocuments(service, MOCK_NEXT_PAGE, 3); expect( service.pages_.filter((page) => !page.isLoaded()).length ).to.equal(1); element.parentNode.removeChild(element); }); }); } );
{ "content_hash": "6642b36fd050acc864076befad53123b", "timestamp": "", "source": "github", "line_count": 785, "max_line_length": 115, "avg_line_length": 31.963057324840765, "alnum_prop": 0.5574508788011637, "repo_name": "jmadler/amphtml", "id": "ef6ff080fd85cb7768111f436212c60486c0b26d", "size": "25718", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "extensions/amp-next-page/1.0/test/test-amp-next-page.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "51517" }, { "name": "Go", "bytes": "7459" }, { "name": "HTML", "bytes": "431950" }, { "name": "Java", "bytes": "30170" }, { "name": "JavaScript", "bytes": "4212326" }, { "name": "Protocol Buffer", "bytes": "24816" }, { "name": "Python", "bytes": "59361" }, { "name": "Shell", "bytes": "4589" } ], "symlink_target": "" }
package org.wso2.carbon.event.publisher.core.internal.type.xml; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.util.AXIOMUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.databridge.commons.Attribute; import org.wso2.carbon.databridge.commons.StreamDefinition; import org.wso2.carbon.event.publisher.core.config.EventPublisherConfiguration; import org.wso2.carbon.event.publisher.core.config.EventPublisherConstants; import org.wso2.carbon.event.publisher.core.config.mapping.XMLOutputMapping; import org.wso2.carbon.event.publisher.core.exception.EventPublisherConfigurationException; import org.wso2.carbon.event.publisher.core.exception.EventPublisherProcessingException; import org.wso2.carbon.event.publisher.core.exception.EventPublisherStreamValidationException; import org.wso2.carbon.event.publisher.core.internal.OutputMapper; import org.wso2.carbon.event.publisher.core.internal.ds.EventPublisherServiceValueHolder; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; public class XMLOutputMapper implements OutputMapper { private static final Log log = LogFactory.getLog(XMLOutputMapper.class); EventPublisherConfiguration eventPublisherConfiguration = null; Map<String, Integer> propertyPositionMap = null; private String outputXMLText = ""; public XMLOutputMapper(EventPublisherConfiguration eventPublisherConfiguration, Map<String, Integer> propertyPositionMap, int tenantId, StreamDefinition streamDefinition) throws EventPublisherConfigurationException { this.eventPublisherConfiguration = eventPublisherConfiguration; this.propertyPositionMap = propertyPositionMap; if (eventPublisherConfiguration.getOutputMapping().isCustomMappingEnabled()) { validateStreamDefinitionWithOutputProperties(tenantId); } else { generateTemplateXMLEvent(streamDefinition); } } private List<String> getOutputMappingPropertyList(String mappingText) { List<String> mappingTextList = new ArrayList<String>(); String text = mappingText; mappingTextList.clear(); while (text.contains(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) && text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX) > 0) { mappingTextList.add(text.substring(text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) + 2, text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX))); text = text.substring(text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX) + 2); } return mappingTextList; } private void validateStreamDefinitionWithOutputProperties(int tenantId) throws EventPublisherConfigurationException { XMLOutputMapping textOutputMapping = ((XMLOutputMapping) eventPublisherConfiguration.getOutputMapping()); String actualMappingText = textOutputMapping.getMappingXMLText(); if (textOutputMapping.isRegistryResource()) { actualMappingText = EventPublisherServiceValueHolder.getCarbonEventPublisherService().getRegistryResourceContent(textOutputMapping.getMappingXMLText()); } this.outputXMLText = actualMappingText; List<String> mappingProperties = getOutputMappingPropertyList(actualMappingText); Iterator<String> mappingTextListIterator = mappingProperties.iterator(); for (; mappingTextListIterator.hasNext(); ) { String property = mappingTextListIterator.next(); if (!propertyPositionMap.containsKey(property)) { throw new EventPublisherStreamValidationException("Property " + property + " is not in the input stream definition.", eventPublisherConfiguration.getFromStreamName() + ":" + eventPublisherConfiguration.getFromStreamVersion()); } } } private String getPropertyValue(Object obj, String mappingProperty) { Object[] inputObjArray = (Object[]) obj; if (inputObjArray.length != 0) { int position = propertyPositionMap.get(mappingProperty); Object data = inputObjArray[position]; if (data != null) { return data.toString(); } } return ""; } private OMElement buildOuputOMElement(Object event, OMElement omElement) throws EventPublisherConfigurationException { Iterator<OMElement> iterator = omElement.getChildElements(); if (iterator.hasNext()) { for (; iterator.hasNext(); ) { OMElement childElement = iterator.next(); Iterator<OMAttribute> iteratorAttr = childElement.getAllAttributes(); while (iteratorAttr.hasNext()) { OMAttribute omAttribute = iteratorAttr.next(); String text = omAttribute.getAttributeValue(); if (text != null) { if (text.contains(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) && text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX) > 0) { String propertyToReplace = text.substring(text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) + 2, text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX)); String value = getPropertyValue(event, propertyToReplace); omAttribute.setAttributeValue(value); } } } String text = childElement.getText(); if (text != null) { if (text.contains(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) && text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX) > 0) { String propertyToReplace = text.substring(text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) + 2, text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX)); String value = getPropertyValue(event, propertyToReplace); childElement.setText(value); } } buildOuputOMElement(event, childElement); } } else { String text = omElement.getText(); if (text != null) { if (text.contains(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) && text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX) > 0) { String propertyToReplace = text.substring(text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX) + 2, text.indexOf(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX)); String value = getPropertyValue(event, propertyToReplace); omElement.setText(value); } } } return omElement; } @Override public Object convertToMappedInputEvent(Object[] eventData) throws EventPublisherConfigurationException { if (eventData.length > 0) { try { return buildOuputOMElement(eventData, AXIOMUtil.stringToOM(outputXMLText)); } catch (XMLStreamException e) { throw new EventPublisherConfigurationException("XML mapping is not in XML format :" + outputXMLText, e); } } else { throw new EventPublisherProcessingException("Input Object array is empty!"); } } @Override public Object convertToTypedInputEvent(Object[] eventData) throws EventPublisherConfigurationException { return convertToMappedInputEvent(eventData); } private void generateTemplateXMLEvent(StreamDefinition streamDefinition) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement compositeEventElement = factory.createOMElement(new QName( EventPublisherConstants.MULTIPLE_EVENTS_PARENT_TAG)); OMElement templateEventElement = factory.createOMElement(new QName(EventPublisherConstants.EVENT_PARENT_TAG)); compositeEventElement.addChild(templateEventElement); List<Attribute> metaDatAttributes = streamDefinition.getMetaData(); if (metaDatAttributes != null && metaDatAttributes.size() > 0) { templateEventElement.addChild(createPropertyElement(factory, EventPublisherConstants.PROPERTY_META_PREFIX, metaDatAttributes, EventPublisherConstants.EVENT_META_TAG)); } List<Attribute> correlationAttributes = streamDefinition.getCorrelationData(); if (correlationAttributes != null && correlationAttributes.size() > 0) { templateEventElement.addChild(createPropertyElement(factory, EventPublisherConstants.PROPERTY_CORRELATION_PREFIX, correlationAttributes, EventPublisherConstants.EVENT_CORRELATION_TAG)); } List<Attribute> payloadAttributes = streamDefinition.getPayloadData(); if (payloadAttributes != null && payloadAttributes.size() > 0) { templateEventElement.addChild(createPropertyElement(factory, "", payloadAttributes, EventPublisherConstants.EVENT_PAYLOAD_TAG)); } outputXMLText = compositeEventElement.toString(); } private static OMElement createPropertyElement(OMFactory factory, String dataPrefix, List<Attribute> attributeList, String propertyTag) { OMElement parentPropertyElement = factory.createOMElement(new QName( propertyTag)); for (Attribute attribute : attributeList) { OMElement propertyElement = factory.createOMElement(new QName( attribute.getName())); propertyElement.setText(EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_PREFIX + dataPrefix + attribute.getName() + EventPublisherConstants.TEMPLATE_EVENT_ATTRIBUTE_POSTFIX); parentPropertyElement.addChild(propertyElement); } return parentPropertyElement; } }
{ "content_hash": "c7762e3ef9580835af99678ad0ec27bf", "timestamp": "", "source": "github", "line_count": 203, "max_line_length": 242, "avg_line_length": 51.95073891625616, "alnum_prop": 0.6893608951261142, "repo_name": "sacjaya/carbon-analytics-common", "id": "eb0414f096a498fd7be3c40a17a4d9602cb7c4b3", "size": "11187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/event-publisher/org.wso2.carbon.event.publisher.core/src/main/java/org/wso2/carbon/event/publisher/core/internal/type/xml/XMLOutputMapper.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "19697" }, { "name": "HTML", "bytes": "30473" }, { "name": "Java", "bytes": "3595117" }, { "name": "JavaScript", "bytes": "163726" }, { "name": "Thrift", "bytes": "6297" } ], "symlink_target": "" }
package org.apache.flink.api.connector.source; import org.apache.flink.annotation.Public; import java.io.IOException; import java.util.List; /** * A interface of a split enumerator responsible for the followings: * 1. discover the splits for the {@link SourceReader} to read. * 2. assign the splits to the source reader. */ @Public public interface SplitEnumerator<SplitT extends SourceSplit, CheckpointT> extends AutoCloseable { /** * Start the split enumerator. * * <p>The default behavior does nothing. */ void start(); /** * Handles the source event from the source reader. * * @param subtaskId the subtask id of the source reader who sent the source event. * @param sourceEvent the source event from the source reader. */ void handleSourceEvent(int subtaskId, SourceEvent sourceEvent); /** * Add a split back to the split enumerator. It will only happen when a {@link SourceReader} fails * and there are splits assigned to it after the last successful checkpoint. * * @param splits The split to add back to the enumerator for reassignment. * @param subtaskId The id of the subtask to which the returned splits belong. */ void addSplitsBack(List<SplitT> splits, int subtaskId); /** * Add a new source reader with the given subtask ID. * * @param subtaskId the subtask ID of the new source reader. */ void addReader(int subtaskId); /** * Checkpoints the state of this split enumerator. * * @return an object containing the state of the split enumerator. * @throws Exception when the snapshot cannot be taken. */ CheckpointT snapshotState() throws Exception; /** * Called to close the enumerator, in case it holds on to any resources, like threads or * network connections. */ @Override void close() throws IOException; }
{ "content_hash": "cc37604b8813f29085a40d59aa63a939", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 99, "avg_line_length": 28.666666666666668, "alnum_prop": 0.7286821705426356, "repo_name": "kaibozhou/flink", "id": "16b393893c06b5195af184a020d80b4205e5e1f3", "size": "2583", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "flink-core/src/main/java/org/apache/flink/api/connector/source/SplitEnumerator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4722" }, { "name": "CSS", "bytes": "58149" }, { "name": "Clojure", "bytes": "93247" }, { "name": "Dockerfile", "bytes": "12142" }, { "name": "FreeMarker", "bytes": "28662" }, { "name": "HTML", "bytes": "108850" }, { "name": "Java", "bytes": "53661126" }, { "name": "JavaScript", "bytes": "1829" }, { "name": "Makefile", "bytes": "5134" }, { "name": "Python", "bytes": "1129763" }, { "name": "Scala", "bytes": "13885013" }, { "name": "Shell", "bytes": "533455" }, { "name": "TSQL", "bytes": "123113" }, { "name": "TypeScript", "bytes": "249103" } ], "symlink_target": "" }
// Copyright (C) 2009-2012 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 // (see accompanying file LICENSE_1_0.txt or a copy at // http://www.boost.org/LICENSE_1_0.txt) // Home at http://www.boost.org/libs/local_function #include <boost/config.hpp> #ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else #include <boost/local_function.hpp> #include <boost/detail/lightweight_test.hpp> //[add_with_default_macro #define WITH_DEFAULT , default //] int main(void) { //[add_with_default int BOOST_LOCAL_FUNCTION(int x, int y WITH_DEFAULT 2) { // Default. return x + y; } BOOST_LOCAL_FUNCTION_NAME(add) BOOST_TEST(add(1) == 3); //] return boost::report_errors(); } #endif // VARIADIC_MACROS
{ "content_hash": "83030dd30bfba66de2cb3c35b1a9c64f", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 71, "avg_line_length": 25.5, "alnum_prop": 0.6593137254901961, "repo_name": "zjutjsj1004/third", "id": "6ee65e3ffc89f39597f5ad7b544164a3f3884f46", "size": "816", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "boost/libs/local_function/test/add_with_default.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "224158" }, { "name": "Batchfile", "bytes": "33175" }, { "name": "C", "bytes": "5576593" }, { "name": "C#", "bytes": "41850" }, { "name": "C++", "bytes": "179595990" }, { "name": "CMake", "bytes": "28348" }, { "name": "CSS", "bytes": "331303" }, { "name": "Cuda", "bytes": "26521" }, { "name": "FORTRAN", "bytes": "1856" }, { "name": "Groff", "bytes": "1305458" }, { "name": "HTML", "bytes": "159660377" }, { "name": "IDL", "bytes": "15" }, { "name": "JavaScript", "bytes": "285786" }, { "name": "Lex", "bytes": "1290" }, { "name": "Makefile", "bytes": "1202020" }, { "name": "Max", "bytes": "37424" }, { "name": "Objective-C", "bytes": "3674" }, { "name": "Objective-C++", "bytes": "651" }, { "name": "PHP", "bytes": "60249" }, { "name": "Perl", "bytes": "37297" }, { "name": "Perl6", "bytes": "2130" }, { "name": "Python", "bytes": "1833677" }, { "name": "QML", "bytes": "613" }, { "name": "QMake", "bytes": "17385" }, { "name": "Rebol", "bytes": "372" }, { "name": "Shell", "bytes": "1144162" }, { "name": "Tcl", "bytes": "1205" }, { "name": "TeX", "bytes": "38313" }, { "name": "XSLT", "bytes": "564356" }, { "name": "Yacc", "bytes": "20341" } ], "symlink_target": "" }
from storage import *
{ "content_hash": "a230ab26b1fb333866db58bf64f1ee9e", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 21, "avg_line_length": 22, "alnum_prop": 0.7727272727272727, "repo_name": "agniveshadhikari/edx-agea", "id": "02d16cd1fc18fa425edb62be922fe0c6852fd449", "size": "22", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "agea/storage/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1063" }, { "name": "HTML", "bytes": "11478" }, { "name": "JavaScript", "bytes": "19470" }, { "name": "Python", "bytes": "85247" } ], "symlink_target": "" }
var request = require('request') , cheerio = require('cheerio') , exec = require('child_process').exec; function copy_image_url(callback) { request(process.argv[2], function (err, response, body) { if (err) { console.log(err); return callback(); } var $ = cheerio.load(body) , imageURL = $('img').first().attr('src'); exec('echo "' + imageURL + '" | pbcopy', function (err) { if (err) { console.log(err); } callback(); }); }); } copy_image_url(function() { process.exit(); });
{ "content_hash": "b9f30d0b07595b68a16a3916c237303c", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 61, "avg_line_length": 21.037037037037038, "alnum_prop": 0.5369718309859155, "repo_name": "irace/climg", "id": "625832124a3bcedd97a0c832a16049e625167b7a", "size": "568", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "climg.js", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "568" } ], "symlink_target": "" }
#ifndef _HPDF_U3D_H #define _HPDF_U3D_H #include "hpdf_objects.h" #ifdef __cplusplus extern "C" { #endif HPDF_EXPORT(HPDF_JavaScript) HPDF_CreateJavaScript(HPDF_Doc pdf, const char *code); HPDF_EXPORT(HPDF_U3D) HPDF_LoadU3DFromFile (HPDF_Doc pdf, const char *filename); HPDF_EXPORT(HPDF_Dict) HPDF_Create3DView (HPDF_MMgr mmgr, const char *name); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_Add3DView(HPDF_U3D u3d, HPDF_Dict view); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_SetDefault3DView(HPDF_U3D u3d, const char *name); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_AddOnInstanciate(HPDF_U3D u3d, HPDF_JavaScript javaScript); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_AddNode(HPDF_Dict view, const char *name, HPDF_REAL opacity, HPDF_BOOL visible); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetLighting(HPDF_Dict view, const char *scheme); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetBackgroundColor(HPDF_Dict view, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetPerspectiveProjection(HPDF_Dict view, HPDF_REAL fov); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetOrthogonalProjection(HPDF_Dict view, HPDF_REAL mag); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCamera(HPDF_Dict view, HPDF_REAL coox, HPDF_REAL cooy, HPDF_REAL cooz, HPDF_REAL c2cx, HPDF_REAL c2cy, HPDF_REAL c2cz, HPDF_REAL roo, HPDF_REAL roll); HPDF_Dict HPDF_3DView_New ( HPDF_MMgr mmgr, HPDF_Xref xref, HPDF_U3D u3d, const char *name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _HPDF_U3D_H */
{ "content_hash": "86b909870408714a9a7c9c7b6a50d05d", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 190, "avg_line_length": 40.2972972972973, "alnum_prop": 0.749832327297116, "repo_name": "lixiaolong/writepdf", "id": "2cd58f4b3fa7afaa48e7da113e695232baa05a52", "size": "2092", "binary": false, "copies": "37", "ref": "refs/heads/master", "path": "2.3.0RC2/include/hpdf_u3d.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "289502" }, { "name": "C++", "bytes": "102049" } ], "symlink_target": "" }
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include "file_resume_block.h" #include "sf_types.h" #include "file_api.h" #include "snort_bounds.h" #include "ipv6_port.h" #include "sfxhash.h" #include "util.h" #include "decode.h" #include "active.h" #include "file_sha256.h" /* The hash table of expected files */ static SFXHASH *fileHash = NULL; extern Log_file_action_func log_file_action; extern File_type_callback_func file_type_cb; extern File_signature_callback_func file_signature_cb; static FileState sig_file_state = { FILE_CAPTURE_SUCCESS, FILE_SIG_DONE }; typedef struct _FileHashKey { snort_ip sip; snort_ip dip; uint32_t file_sig; } FileHashKey; typedef struct _FileNode { time_t expires; File_Verdict verdict; uint32_t file_type_id; uint8_t sha256[SHA256_HASH_SIZE]; } FileNode; #define MAX_FILES_TRACKED 16384 void file_resume_block_init(void) { fileHash = sfxhash_new(MAX_FILES_TRACKED, sizeof(FileHashKey), sizeof(FileNode), 0, 1, NULL, NULL, 1); if (!fileHash) FatalError("Failed to create the expected channel hash table.\n"); } void file_resume_block_cleanup(void) { if (fileHash) { sfxhash_delete(fileHash); fileHash = NULL; } } static inline void updateFileNode(FileNode *node, File_Verdict verdict, uint32_t file_type_id, uint8_t *signature) { node->verdict = verdict; node->file_type_id = file_type_id; if (signature) { memcpy(node->sha256, signature, SHA256_HASH_SIZE); } } /** * * @param sip - source IP address * @param dip - destination IP address * @param sport - server sport number * @param file_sig - file signature * @param expiry - session expiry in seconds. */ int file_resume_block_add_file(void *pkt, uint32_t file_sig, uint32_t timeout, File_Verdict verdict, uint32_t file_type_id, uint8_t *signature) { FileHashKey hashKey; SFXHASH_NODE *hash_node = NULL; FileNode *node; FileNode new_node; snort_ip_p srcIP; snort_ip_p dstIP; Packet *p = (Packet *)pkt; time_t now = p->pkth->ts.tv_sec; srcIP = GET_SRC_IP(p); dstIP = GET_DST_IP(p); IP_COPY_VALUE(hashKey.dip, dstIP); IP_COPY_VALUE(hashKey.sip, srcIP); hashKey.file_sig = file_sig; hash_node = sfxhash_find_node(fileHash, &hashKey); if (hash_node) { if (!(node = hash_node->data)) sfxhash_free_node(fileHash, hash_node); } else node = NULL; if (node) { node->expires = now + timeout; updateFileNode(node, verdict, file_type_id, signature); } else { DEBUG_WRAP(DebugMessage(DEBUG_FILE, "Adding file node\n");); updateFileNode(&new_node, verdict, file_type_id, signature); /* * use the time that we keep files around * since this info would effectively be invalid * after that anyway because the file that * caused this will be gone. */ new_node.expires = now + timeout; /* Add it to the table */ if (sfxhash_add(fileHash, &hashKey, &new_node) != SFXHASH_OK) { /* Uh, shouldn't get here... * There is already a node or couldn't alloc space * for key. This means bigger problems, but fail * gracefully. */ DEBUG_WRAP(DebugMessage(DEBUG_FILE, "Failed to add file node to hash table\n");); return -1; } } return 0; } static inline File_Verdict checkVerdict(Packet *p, FileNode *node, SFXHASH_NODE *hash_node) { File_Verdict verdict = FILE_VERDICT_UNKNOWN; /*Query the file policy in case verdict has been changed*/ /*Check file type first*/ if (file_type_cb) { verdict = file_type_cb(p, p->ssnptr, node->file_type_id, 0, DEFAULT_FILE_ID); } if ((verdict == FILE_VERDICT_UNKNOWN) || (verdict == FILE_VERDICT_STOP_CAPTURE)) { if (file_signature_cb) { verdict = file_signature_cb(p, p->ssnptr, node->sha256, 0, &sig_file_state, 0, DEFAULT_FILE_ID); } } if ((verdict == FILE_VERDICT_UNKNOWN) || (verdict == FILE_VERDICT_STOP_CAPTURE)) { verdict = node->verdict; } if (verdict == FILE_VERDICT_LOG) { sfxhash_free_node(fileHash, hash_node); if (log_file_action) { log_file_action(p->ssnptr, FILE_RESUME_LOG); } } else if (verdict == FILE_VERDICT_BLOCK) { Active_ForceDropPacket(); Active_DropSession(p); if (log_file_action) { log_file_action(p->ssnptr, FILE_RESUME_BLOCK); } node->verdict = verdict; } else if (verdict == FILE_VERDICT_REJECT) { Active_ForceDropPacket(); Active_DropSession(p); Active_QueueReject(); if (log_file_action) { log_file_action(p->ssnptr, FILE_RESUME_BLOCK); } node->verdict = verdict; } else if (verdict == FILE_VERDICT_PENDING) { /*Take the cached verdict*/ Active_ForceDropPacket(); Active_DropSession(p); if (FILE_VERDICT_REJECT == node->verdict) Active_QueueReject(); if (log_file_action) { log_file_action(p->ssnptr, FILE_RESUME_BLOCK); } verdict = node->verdict; } return verdict; } File_Verdict file_resume_block_check(void *pkt, uint32_t file_sig) { File_Verdict verdict = FILE_VERDICT_UNKNOWN; snort_ip_p srcIP; snort_ip_p dstIP; SFXHASH_NODE *hash_node; FileHashKey hashKey; FileNode *node; Packet *p = (Packet *)pkt; /* No hash table, or its empty? Get out of dodge. */ if ((!fileHash) || (!sfxhash_count(fileHash))) { DEBUG_WRAP(DebugMessage(DEBUG_FILE, "No expected sessions\n");); return verdict; } srcIP = GET_SRC_IP(p); dstIP = GET_DST_IP(p); IP_COPY_VALUE(hashKey.dip, dstIP); IP_COPY_VALUE(hashKey.sip, srcIP); hashKey.file_sig = file_sig; hash_node = sfxhash_find_node(fileHash, &hashKey); if (hash_node) { if (!(node = hash_node->data)) sfxhash_free_node(fileHash, hash_node); } else return verdict; if (node) { DEBUG_WRAP(DebugMessage(DEBUG_FILE, "Found resumed file\n");); if (node->expires && p->pkth->ts.tv_sec > node->expires) { DEBUG_WRAP(DebugMessage(DEBUG_FILE, "File expired\n");); sfxhash_free_node(fileHash, hash_node); return verdict; } /*Query the file policy in case verdict has been changed*/ verdict = checkVerdict(p, node, hash_node); } return verdict; }
{ "content_hash": "dbf9703cb8560aa9cec6008be78a973e", "timestamp": "", "source": "github", "line_count": 259, "max_line_length": 91, "avg_line_length": 26.37065637065637, "alnum_prop": 0.5884333821376281, "repo_name": "liuchuang/snort", "id": "2f69d53d619538b23800d5396d5b4c200639b5ca", "size": "7852", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "snort-2.9.6.0/src/file-process/file_resume_block.c", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "13492693" }, { "name": "C++", "bytes": "194474" }, { "name": "Objective-C", "bytes": "22299" }, { "name": "Perl", "bytes": "4230" }, { "name": "Python", "bytes": "115154" }, { "name": "Shell", "bytes": "1083939" }, { "name": "TeX", "bytes": "656483" } ], "symlink_target": "" }
set -e #---------------------------------------------------------------------- # Change this to whatever makes sense for your system HOME= MINICONDA=$HOME/miniconda-for-arrow LIBRARY_INSTALL_DIR=$HOME/local-libs CPP_BUILD_DIR=$HOME/arrow-cpp-build ARROW_ROOT=/arrow PYTHON=3.10 git config --global --add safe.directory $ARROW_ROOT #---------------------------------------------------------------------- # Run these only once function setup_miniconda() { MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" wget -O miniconda.sh $MINICONDA_URL bash miniconda.sh -b -p $MINICONDA rm -f miniconda.sh LOCAL_PATH=$PATH export PATH="$MINICONDA/bin:$PATH" conda update -y -q conda conda config --set auto_update_conda false conda info -a conda config --set show_channel_urls True conda config --add channels https://repo.anaconda.com/pkgs/free conda config --add channels conda-forge conda create -y -n pyarrow-$PYTHON -c conda-forge \ --file arrow/ci/conda_env_unix.txt \ --file arrow/ci/conda_env_cpp.txt \ --file arrow/ci/conda_env_python.txt \ compilers \ python=$PYTHON \ pandas export PATH=$LOCAL_PATH } setup_miniconda #---------------------------------------------------------------------- # Activate conda in bash and activate conda environment . $MINICONDA/etc/profile.d/conda.sh conda activate pyarrow-$PYTHON export ARROW_HOME=$CONDA_PREFIX #---------------------------------------------------------------------- # Build C++ library mkdir -p $CPP_BUILD_DIR pushd $CPP_BUILD_DIR cmake -GNinja \ -DCMAKE_BUILD_TYPE=DEBUG \ -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \ -DCMAKE_INSTALL_LIBDIR=lib \ -DARROW_WITH_BZ2=ON \ -DARROW_WITH_ZLIB=ON \ -DARROW_WITH_ZSTD=ON \ -DARROW_WITH_LZ4=ON \ -DARROW_WITH_SNAPPY=ON \ -DARROW_WITH_BROTLI=ON \ -DARROW_PLASMA=ON \ -DARROW_PYTHON=ON \ $ARROW_ROOT/cpp ninja install popd #---------------------------------------------------------------------- # Build and test Python library pushd $ARROW_ROOT/python rm -rf build/ # remove any pesky pre-existing build directory export CMAKE_PREFIX_PATH=${ARROW_HOME}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}} export PYARROW_BUILD_TYPE=Debug export PYARROW_CMAKE_GENERATOR=Ninja # You can run either "develop" or "build_ext --inplace". Your pick # python setup.py build_ext --inplace python setup.py develop py.test pyarrow
{ "content_hash": "2f341367e308d7d2662e21c72c73ddaa", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 87, "avg_line_length": 26.870967741935484, "alnum_prop": 0.5982392957182873, "repo_name": "apache/arrow", "id": "5e62f30b1561521fd6e0adfd53cc37262cdefeac", "size": "3305", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "python/examples/minimal_build/build_conda.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "3709" }, { "name": "Batchfile", "bytes": "30689" }, { "name": "C", "bytes": "1400442" }, { "name": "C#", "bytes": "1029129" }, { "name": "C++", "bytes": "24661612" }, { "name": "CMake", "bytes": "709915" }, { "name": "Cython", "bytes": "1554440" }, { "name": "Dockerfile", "bytes": "147322" }, { "name": "Emacs Lisp", "bytes": "1064" }, { "name": "FreeMarker", "bytes": "2312" }, { "name": "Go", "bytes": "4586449" }, { "name": "HTML", "bytes": "3430" }, { "name": "Java", "bytes": "7045674" }, { "name": "JavaScript", "bytes": "127157" }, { "name": "Jinja", "bytes": "19948" }, { "name": "Lua", "bytes": "8771" }, { "name": "MATLAB", "bytes": "40399" }, { "name": "Makefile", "bytes": "32873" }, { "name": "Meson", "bytes": "69508" }, { "name": "Objective-C++", "bytes": "11472" }, { "name": "Perl", "bytes": "3803" }, { "name": "Python", "bytes": "3055602" }, { "name": "R", "bytes": "1561613" }, { "name": "Ruby", "bytes": "1615226" }, { "name": "Shell", "bytes": "389942" }, { "name": "Thrift", "bytes": "34246" }, { "name": "TypeScript", "bytes": "1075563" }, { "name": "Vala", "bytes": "24798" } ], "symlink_target": "" }
"""Add ``root_dag_id`` to ``DAG`` Revision ID: b3b105409875 Revises: d38e04c12aa2 Create Date: 2019-09-28 23:20:01.744775 """ from __future__ import annotations import sqlalchemy as sa from alembic import op from airflow.migrations.db_types import StringID # revision identifiers, used by Alembic. revision = 'b3b105409875' down_revision = 'd38e04c12aa2' branch_labels = None depends_on = None airflow_version = '1.10.7' def upgrade(): """Apply Add ``root_dag_id`` to ``DAG``""" op.add_column('dag', sa.Column('root_dag_id', StringID(), nullable=True)) op.create_index('idx_root_dag_id', 'dag', ['root_dag_id'], unique=False) def downgrade(): """Unapply Add ``root_dag_id`` to ``DAG``""" op.drop_index('idx_root_dag_id', table_name='dag') op.drop_column('dag', 'root_dag_id')
{ "content_hash": "e5a4512de8917915ffe5f50420a795cf", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 77, "avg_line_length": 25.28125, "alnum_prop": 0.6736711990111248, "repo_name": "cfei18/incubator-airflow", "id": "571338cf85f2cb316c6c049a50bf5c3a9edf2353", "size": "1596", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "airflow/migrations/versions/0045_1_10_7_add_root_dag_id_to_dag.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "25980" }, { "name": "Dockerfile", "bytes": "72003" }, { "name": "HCL", "bytes": "3786" }, { "name": "HTML", "bytes": "173434" }, { "name": "JavaScript", "bytes": "143068" }, { "name": "Jinja", "bytes": "38808" }, { "name": "Jupyter Notebook", "bytes": "5482" }, { "name": "Mako", "bytes": "1339" }, { "name": "Python", "bytes": "22660683" }, { "name": "R", "bytes": "313" }, { "name": "Shell", "bytes": "312715" }, { "name": "TypeScript", "bytes": "472379" } ], "symlink_target": "" }
package org.openapitools.client.api import argonaut._ import argonaut.EncodeJson._ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime import ExtensionClassContainerImpl1links._ case class ExtensionClassContainerImpl1links ( self: Option[Link], `class`: Option[String]) object ExtensionClassContainerImpl1links { import DateTimeCodecs._ implicit val ExtensionClassContainerImpl1linksCodecJson: CodecJson[ExtensionClassContainerImpl1links] = CodecJson.derive[ExtensionClassContainerImpl1links] implicit val ExtensionClassContainerImpl1linksDecoder: EntityDecoder[ExtensionClassContainerImpl1links] = jsonOf[ExtensionClassContainerImpl1links] implicit val ExtensionClassContainerImpl1linksEncoder: EntityEncoder[ExtensionClassContainerImpl1links] = jsonEncoderOf[ExtensionClassContainerImpl1links] }
{ "content_hash": "952e4e624bd178d66529ac8a3f2bd14d", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 157, "avg_line_length": 37.5, "alnum_prop": 0.8611111111111112, "repo_name": "cliffano/swaggy-jenkins", "id": "223732adc5cd4d3e66a6493889c89df84af1257b", "size": "900", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "clients/scalaz/generated/src/main/scala/org/openapitools/client/api/ExtensionClassContainerImpl1links.scala", "mode": "33188", "license": "mit", "language": [ { "name": "Ada", "bytes": "569823" }, { "name": "Apex", "bytes": "741346" }, { "name": "Batchfile", "bytes": "14792" }, { "name": "C", "bytes": "971274" }, { "name": "C#", "bytes": "5131336" }, { "name": "C++", "bytes": "7799032" }, { "name": "CMake", "bytes": "20609" }, { "name": "CSS", "bytes": "4873" }, { "name": "Clojure", "bytes": "129018" }, { "name": "Crystal", "bytes": "864941" }, { "name": "Dart", "bytes": "876777" }, { "name": "Dockerfile", "bytes": "7385" }, { "name": "Eiffel", "bytes": "424642" }, { "name": "Elixir", "bytes": "139252" }, { "name": "Elm", "bytes": "187067" }, { "name": "Emacs Lisp", "bytes": "191" }, { "name": "Erlang", "bytes": "373074" }, { "name": "F#", "bytes": "556012" }, { "name": "Gherkin", "bytes": "951" }, { "name": "Go", "bytes": "345227" }, { "name": "Groovy", "bytes": "89524" }, { "name": "HTML", "bytes": "2367424" }, { "name": "Haskell", "bytes": "680841" }, { "name": "Java", "bytes": "12164874" }, { "name": "JavaScript", "bytes": "1959006" }, { "name": "Kotlin", "bytes": "1280953" }, { "name": "Lua", "bytes": "322316" }, { "name": "Makefile", "bytes": "11882" }, { "name": "Nim", "bytes": "65818" }, { "name": "OCaml", "bytes": "94665" }, { "name": "Objective-C", "bytes": "464903" }, { "name": "PHP", "bytes": "4383673" }, { "name": "Perl", "bytes": "743304" }, { "name": "PowerShell", "bytes": "678274" }, { "name": "Python", "bytes": "5529523" }, { "name": "QMake", "bytes": "6915" }, { "name": "R", "bytes": "840841" }, { "name": "Raku", "bytes": "10945" }, { "name": "Ruby", "bytes": "328360" }, { "name": "Rust", "bytes": "1735375" }, { "name": "Scala", "bytes": "1387368" }, { "name": "Shell", "bytes": "407167" }, { "name": "Swift", "bytes": "342562" }, { "name": "TypeScript", "bytes": "3060093" } ], "symlink_target": "" }
<html> <head> <title>管理图片-Lolibox</title> <script src="/static/js/jquery.min.js"></script> <script src="/static/js/clipboard.min.js"></script> <script src="/static/js/bootstrap.min.js"></script> <script src="/static/js/jquery.knob.min.js"></script> <script src="/static/js/notify.min.js"></script> <script src="/static/js/underscore.min.js"></script> <script src="/static/js/backbone.min.js"></script> <script src="/static/js/admin.js"></script> <script src="/static/js/jquery.iframe-transport.min.js"></script> <script src="/static/js/jquery.ui.widget.min.js"></script> <script src="/static/js/jquery.fileupload.min.js"></script> <link href="/static/css/bootstrap.min.css" rel="stylesheet" /> <link href="/static/css/styles.css" rel="stylesheet" /> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <div class="header"> <nav id="top" class="navbar navbar-default navbar-static-top navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand title" href="/">Lolibox</a> <p class="navbar-text">一个方便、快捷的图床程序</p> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> </ul> </div> </div> </nav> <a href="https://github.com/chocotan/lolibox" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 2; display: none" src="/static/img/github.png" alt="Fork me on GitHub" data-canonical-src="/static/img/github.png"></a> </div> <div class="main"> <div class="container"> <div class="panel panel-default"> <div class="panel-heading"> <span id="current-path">当前位置</span> </div> <table class="table table-bordered gal-list-table"> <thead> <tr> <th>文件名</th> <th>大小</th> <th>最后修改时间</th> <th>操作</th> </tr> </thead> <tbody id="file-list"> </tbody> </table> </div> </div> </div> <div class="modal" id="preview-modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title">图片预览</h4> </div> <div class="modal-body" id="preview-body"></div> <div class="modal-footer"> <button type="button" class="btn btn-default" onclick="lastImage()">Prev</button> <button type="button" class="btn btn-default" onclick="nextImage()">Next</button> <button type="button" class="btn btn-danger" onclick="deleteImage()">Delete</button> </div> </div> </div> </div> <div class="footer"> <div class="container"> <p> <a href="" data-toggle="modal" data-target="#terms">使用条款</a>&nbsp;|&nbsp;<a href="mailto:${email}" target="_blank">联系我</a> <br /> Powered by <a href="https://github.com/chocotan/lolibox" target="_blank">${project.name}-${project.version}</a> </p> </div> </div> </body> </html>
{ "content_hash": "da1d4fd6f853c0c534b189d5c52c52c2", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 152, "avg_line_length": 36.63265306122449, "alnum_prop": 0.5860724233983287, "repo_name": "xctcc/congloli", "id": "9b294b6f1135d1b1792e8c1a0a2e12c870abef7f", "size": "3678", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/resources/html/admin.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2686" }, { "name": "HTML", "bytes": "12010" }, { "name": "Java", "bytes": "39946" }, { "name": "JavaScript", "bytes": "15159" } ], "symlink_target": "" }
picketlink-authentication-jsf: PicketLink Authentication with JSF =============================== Author: Shane Bryzak Level: Beginner Technologies: CDI, PicketLink Summary: Basic example that demonstrates simple username/password authentication using PicketLink Target Product: EAP Source: <https://github.com/jboss-jdf/jboss-as-quickstart/> What is it? ----------- This example demonstrates the use of *CDI 1.0* and *PicketLink* in *JBoss Enterprise Application Platform 6* or *JBoss AS 7*. System requirements ------------------- All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven 3.0 or better. The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7. Configure Maven --------------- If you have not yet done so, you must [Configure Maven](../README.md#mavenconfiguration) before testing the quickstarts. Start JBoss Enterprise Application Platform 6 or JBoss AS 7 with the Web Profile ------------------------- 1. Open a command line and navigate to the root of the JBoss server directory. 2. The following shows the command line to start the server with the web profile: For Linux: JBOSS_HOME/bin/standalone.sh For Windows: JBOSS_HOME\bin\standalone.bat Build and Deploy the Quickstart ------------------------- _NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#buildanddeploy) for complete instructions and additional options._ 1. Make sure you have started the JBoss Server as described above. 2. Open a command line and navigate to the root directory of this quickstart. 3. Type this command to build and deploy the archive: mvn clean package jboss-as:deploy 4. This will deploy `target/jboss-as-picketlink-authentication.war` to the running instance of the server. Access the application --------------------- The application will be running at the following URL: <http://localhost:8080/jboss-as-picketlink-authentication>. Undeploy the Archive -------------------- 1. Make sure you have started the JBoss Server as described above. 2. Open a command line and navigate to the root directory of this quickstart. 3. When you are finished testing, type this command to undeploy the archive: mvn jboss-as:undeploy Run the Quickstart in JBoss Developer Studio or Eclipse ------------------------------------- You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see [Use JBoss Developer Studio or Eclipse to Run the Quickstarts](../README.md#useeclipse) Debug the Application ------------------------------------ If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them. mvn dependency:sources mvn dependency:resolve -Dclassifier=javadoc
{ "content_hash": "e9e2b697551a3ef4cf218fc86270e8f1", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 286, "avg_line_length": 38.65, "alnum_prop": 0.7179818887451488, "repo_name": "LightGuard/quickstart", "id": "b31050bcebfc02795ff02a62ff2abf3c5fae95c4", "size": "3092", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "picketlink-authentication-jsf/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7428" }, { "name": "Java", "bytes": "1616967" }, { "name": "JavaScript", "bytes": "1701979" }, { "name": "Objective-C", "bytes": "700136" }, { "name": "Perl", "bytes": "890" }, { "name": "Ruby", "bytes": "5250" }, { "name": "Shell", "bytes": "20499" } ], "symlink_target": "" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__int64_t_min_multiply_33.cpp Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-33.tmpl.cpp */ /* * @description * CWE: 191 Integer Underflow * BadSource: min Set data to the min value for int64_t * GoodSource: Set data to a small, non-zero number (negative two) * Sinks: multiply * GoodSink: Ensure there will not be an underflow before multiplying data by 2 * BadSink : If data is negative, multiply by 2, which can cause an underflow * Flow Variant: 33 Data flow: use of a C++ reference to data within the same function * * */ #include "std_testcase.h" namespace CWE191_Integer_Underflow__int64_t_min_multiply_33 { #ifndef OMITBAD void bad() { int64_t data; int64_t &dataRef = data; data = 0LL; /* POTENTIAL FLAW: Use the minimum size of the data type */ data = LLONG_MIN; { int64_t data = dataRef; if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < LLONG_MIN, this will underflow */ int64_t result = data * 2; printLongLongLine(result); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { int64_t data; int64_t &dataRef = data; data = 0LL; /* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */ data = -2; { int64_t data = dataRef; if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < LLONG_MIN, this will underflow */ int64_t result = data * 2; printLongLongLine(result); } } } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2G() { int64_t data; int64_t &dataRef = data; data = 0LL; /* POTENTIAL FLAW: Use the minimum size of the data type */ data = LLONG_MIN; { int64_t data = dataRef; if(data < 0) /* ensure we won't have an overflow */ { /* FIX: Add a check to prevent an underflow from occurring */ if (data > (LLONG_MIN/2)) { int64_t result = data * 2; printLongLongLine(result); } else { printLine("data value is too small to perform multiplication."); } } } } void good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE191_Integer_Underflow__int64_t_min_multiply_33; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
{ "content_hash": "29c7a0f6fb93420675b0d3af464788bd", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 111, "avg_line_length": 27.448818897637796, "alnum_prop": 0.5846242111302352, "repo_name": "maurer/tiamat", "id": "399b90fee2bb9a032579c9915237999bf1c0e5ca", "size": "3486", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "samples/Juliet/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__int64_t_min_multiply_33.cpp", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
"""Support for Home Assistant iOS app sensors.""" from homeassistant.components import ios from homeassistant.helpers.entity import Entity from homeassistant.helpers.icon import icon_for_battery_level DEPENDENCIES = ['ios'] SENSOR_TYPES = { 'level': ['Battery Level', '%'], 'state': ['Battery State', None] } DEFAULT_ICON_LEVEL = 'mdi:battery' DEFAULT_ICON_STATE = 'mdi:power-plug' def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the iOS sensor.""" # Leave here for if someone accidentally adds platform: ios to config async def async_setup_entry(hass, config_entry, async_add_entities): """Set up iOS from a config entry.""" dev = list() for device_name, device in ios.devices(hass).items(): for sensor_type in ('level', 'state'): dev.append(IOSSensor(sensor_type, device_name, device)) async_add_entities(dev, True) class IOSSensor(Entity): """Representation of an iOS sensor.""" def __init__(self, sensor_type, device_name, device): """Initialize the sensor.""" self._device_name = device_name self._name = "{} {}".format(device_name, SENSOR_TYPES[sensor_type][0]) self._device = device self.type = sensor_type self._state = None self._unit_of_measurement = SENSOR_TYPES[sensor_type][1] @property def device_info(self): """Return information about the device.""" return { 'identifiers': { (ios.DOMAIN, self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_PERMANENT_ID]), }, 'name': self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_NAME], 'manufacturer': 'Apple', 'model': self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_TYPE], 'sw_version': self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_SYSTEM_VERSION], } @property def name(self): """Return the name of the iOS sensor.""" device_name = self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_NAME] return "{} {}".format(device_name, SENSOR_TYPES[self.type][0]) @property def state(self): """Return the state of the sensor.""" return self._state @property def unique_id(self): """Return the unique ID of this sensor.""" device_id = self._device[ios.ATTR_DEVICE_ID] return "{}_{}".format(self.type, device_id) @property def unit_of_measurement(self): """Return the unit of measurement this sensor expresses itself in.""" return self._unit_of_measurement @property def device_state_attributes(self): """Return the device state attributes.""" device = self._device[ios.ATTR_DEVICE] device_battery = self._device[ios.ATTR_BATTERY] return { "Battery State": device_battery[ios.ATTR_BATTERY_STATE], "Battery Level": device_battery[ios.ATTR_BATTERY_LEVEL], "Device Type": device[ios.ATTR_DEVICE_TYPE], "Device Name": device[ios.ATTR_DEVICE_NAME], "Device Version": device[ios.ATTR_DEVICE_SYSTEM_VERSION], } @property def icon(self): """Return the icon to use in the frontend, if any.""" device_battery = self._device[ios.ATTR_BATTERY] battery_state = device_battery[ios.ATTR_BATTERY_STATE] battery_level = device_battery[ios.ATTR_BATTERY_LEVEL] charging = True icon_state = DEFAULT_ICON_STATE if battery_state in (ios.ATTR_BATTERY_STATE_FULL, ios.ATTR_BATTERY_STATE_UNPLUGGED): charging = False icon_state = "{}-off".format(DEFAULT_ICON_STATE) elif battery_state == ios.ATTR_BATTERY_STATE_UNKNOWN: battery_level = None charging = False icon_state = "{}-unknown".format(DEFAULT_ICON_LEVEL) if self.type == "state": return icon_state return icon_for_battery_level(battery_level=battery_level, charging=charging) def update(self): """Get the latest state of the sensor.""" self._device = ios.devices(self.hass).get(self._device_name) self._state = self._device[ios.ATTR_BATTERY][self.type]
{ "content_hash": "0d0b5a45f5a22818618dfa643da06e0a", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 78, "avg_line_length": 36.15126050420168, "alnum_prop": 0.6059972105997211, "repo_name": "HydrelioxGitHub/home-assistant", "id": "404b313368cebe42b64c97f9f66c9db6152ac9e8", "size": "4302", "binary": false, "copies": "3", "ref": "refs/heads/dev", "path": "homeassistant/components/ios/sensor.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1175" }, { "name": "Dockerfile", "bytes": "1081" }, { "name": "Python", "bytes": "14330009" }, { "name": "Ruby", "bytes": "745" }, { "name": "Shell", "bytes": "17364" } ], "symlink_target": "" }
<?php namespace AppBundle\Service; use AppBundle\Entity\EventGroup; use AppBundle\Entity\ManagerGroup; use AppBundle\Entity\User; use AppBundle\Form\Entity\Group as GroupForm; use AppBundle\Entity\Group; use AppBundle\Entity\Event; use AppBundle\Form\Entity\Event as EventForm; use Doctrine\ORM\EntityManager; /** * ManagerService class * * @author Yevgeniy Zholkevskiy <blackbullet@i.ua> */ class ManagerService { /** * @var EntityManager $entityManager Entity manager */ private $entityManager; /** * Constructor * * @param EntityManager $em Entity manager */ public function __construct(EntityManager $em) { $this->entityManager = $em; } /** * Save group to db * * @param GroupForm $groupForm GroupForm * @param User $user User */ public function saveGroupOnCreate(GroupForm $groupForm, User $user) { $group = (new Group()) ->setName($groupForm->getName()) ->setDescription($groupForm->getDescription()) ->setCountry($groupForm->getCountry()) ->setCity($groupForm->getCity()) ->setSlug($groupForm->getName()) ->setImageName($groupForm->getImageName()) ->setFoundedAt($groupForm->getFoundedAt()) ->setCreatedBy($user) ->setUpdatedBy($user); $managerGroup = (new ManagerGroup()) ->setGroup($group) ->setManager($user); $this->entityManager->persist($group); $this->entityManager->persist($managerGroup); $this->entityManager->flush(); } /** * Update group from db * * @param GroupForm $groupForm * @param Group $group * @param User $user */ public function saveGroupOnUpdate(GroupForm $groupForm, Group $group, User $user) { $group->setName($groupForm->getName()) ->setDescription($groupForm->getDescription()) ->setCountry($groupForm->getCountry()) ->setCity($groupForm->getCity()) ->setSlug($groupForm->getName()) ->setFoundedAt($groupForm->getFoundedAt()) ->setUpdatedBy($user); $managerGroup = $this->entityManager->getRepository('AppBundle:ManagerGroup')->findOneBy([ 'group' => $group, ]); $managerGroup->setGroup($group); $this->entityManager->persist($group); $this->entityManager->persist($managerGroup); $this->entityManager->flush(); } /** * Convert object AppBundle\Entity\Group to AppBundle\Form\Entity\Group * * @param Group $group Group * * @return GroupForm[] */ public function convertToGroupForm(Group $group) { return (new GroupForm()) ->setName($group->getName()) ->setDescription($group->getDescription()) ->setCountry($group->getCountry()) ->setCity($group->getCity()) ->setFoundedAt($group->getFoundedAt()->format('Y')); } /** * Save event to db * * @param EventForm $eventForm * @param User $user */ public function saveEventOnCreate(EventForm $eventForm, User $user) { $event = (new Event()) ->setName($eventForm->getName()) ->setDescription($eventForm->getDescription()) ->setCountry($eventForm->getCountry()) ->setCity($eventForm->getCity()) ->setAddress($eventForm->getAddress()) ->setBeginAt($eventForm->getBeginAt()) ->setEndAt($eventForm->getEndAt()) ->setSlug($eventForm->getName()) ->setCreatedBy($user) ->setUpdatedBy($user); $this->entityManager->persist($event); /** @var Group $groupElement */ foreach ($eventForm->getGroups() as $groupElement) { $group = $this->entityManager->getRepository('AppBundle:Group')->findOneBy([ 'slug' => $groupElement->getSlug(), ]); $eventGroups = (new EventGroup()) ->setEvent($event) ->setGroup($group); $this->entityManager->persist($eventGroups); } $this->entityManager->flush(); } /** * Update event from db * * @param EventForm $eventForm * @param Event $event * @param User $user */ public function saveEventOnUpdate(EventForm $eventForm, Event $event, User $user) { $groupRepository = $this->entityManager->getRepository('AppBundle:Group'); /** @var Event $event */ $event ->setName($eventForm->getName()) ->setDescription($eventForm->getDescription()) ->setCountry($eventForm->getCountry()) ->setCity($eventForm->getCity()) ->setAddress($eventForm->getAddress()) ->setBeginAt($eventForm->getBeginAt()) ->setEndAt($eventForm->getEndAt()) ->setSlug($eventForm->getName()) ->setUpdatedBy($user); $this->entityManager->persist($event); $groups = $groupRepository->findGroupsByEvent($event); /** @var Group $groupElement */ foreach ($eventForm->getGroups() as $groupElement) { $group = $groupRepository->findOneBy([ 'slug' => $groupElement->getSlug(), ]); if (!in_array($group, $groups)) { $eventGroups = (new EventGroup()) ->setEvent($event) ->setGroup($group); $this->entityManager->persist($eventGroups); } } $this->entityManager->flush(); } /** * Convert object AppBundle\Entity\Event to AppBundle\Form\Entity\Event * * @param Event $event Event * * @return EventForm[] */ public function convertToEventForm(Event $event) { $groups = $this->entityManager->getRepository('AppBundle:Group')->findGroupsByEvent($event); return (new EventForm()) ->setName($event->getName()) ->setDescription($event->getDescription()) ->setCountry($event->getCountry()) ->setCity($event->getCity()) ->setAddress($event->getAddress()) ->setBeginAt($event->getBeginAt()) ->setEndAt($event->getEndAt()) ->setGroups($groups); } }
{ "content_hash": "8d24c214a0f05eb731d2503d52394cc4", "timestamp": "", "source": "github", "line_count": 214, "max_line_length": 100, "avg_line_length": 30.186915887850468, "alnum_prop": 0.5597523219814241, "repo_name": "stfalcon-studio/rock-events", "id": "2bb8c773e05446df0c85acb09f33b74f8ae5c2fc", "size": "6460", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/AppBundle/Service/ManagerService.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3606" }, { "name": "CSS", "bytes": "71430" }, { "name": "HTML", "bytes": "83533" }, { "name": "JavaScript", "bytes": "27134" }, { "name": "PHP", "bytes": "367337" } ], "symlink_target": "" }
package de.umass.xml; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * <code>DomElement</code> wraps around an {@link Element} and provides convenience methods. * * @author Janni Kovacs */ public class DomElement { private Element e; /** * Creates a new wrapper around the given {@link Element}. * * @param elem An w3c Element */ public DomElement(Element elem) { this.e = elem; } /** * @return the original Element */ public Element getElement() { return e; } /** * Tests if this element has an attribute with the specified name. * * @param name Name of the attribute. * @return <code>true</code> if this element has an attribute with the specified name. */ public boolean hasAttribute(String name) { return e.hasAttribute(name); } /** * Returns the attribute value to a given attribute name or <code>null</code> if the attribute doesn't exist. * * @param name The attribute's name * @return Attribute value or <code>null</code> */ public String getAttribute(String name) { return e.hasAttribute(name) ? e.getAttribute(name) : null; } /** * @return the text content of the element */ public String getText() { // XXX e.getTextContent() doesn't exsist under Android (Lukasz Wisniewski) /// getTextContent() is now available in at least Android 2.2 if not earlier, so we'll keep using that // return e.hasChildNodes() ? e.getFirstChild().getNodeValue() : null; return e.getTextContent(); } /** * Checks if this element has a child element with the given name. * * @param name The child's name * @return <code>true</code> if this element has a child element with the given name */ public boolean hasChild(String name) { NodeList list = e.getElementsByTagName(name); for (int i = 0, j = list.getLength(); i < j; i++) { Node item = list.item(i); if (item.getParentNode() == e) return true; } return false; } /** * Returns the child element with the given name or <code>null</code> if it doesn't exist. * * @param name The child's name * @return the child element or <code>null</code> */ public DomElement getChild(String name) { NodeList list = e.getElementsByTagName(name); if (list.getLength() == 0) return null; for (int i = 0, j = list.getLength(); i < j; i++) { Node item = list.item(i); if (item.getParentNode() == e) return new DomElement((Element) item); } return null; } /** * Returns the text content of a child node with the given name. If no such child exists or the child * does not have text content, <code>null</code> is returned. * * @param name The child's name * @return the child's text content or <code>null</code> */ public String getChildText(String name) { DomElement child = getChild(name); return child != null ? child.getText() : null; } /** * @return all children of this element */ public List<DomElement> getChildren() { return getChildren("*"); } /** * Returns all children of this element with the given tag name. * * @param name The children's tag name * @return all matching children */ public List<DomElement> getChildren(String name) { List<DomElement> l = new ArrayList<DomElement>(); NodeList list = e.getElementsByTagName(name); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node.getParentNode() == e) l.add(new DomElement((Element) node)); } return l; } /** * Returns this element's tag name. * * @return the tag name */ public String getTagName() { return e.getTagName(); } }
{ "content_hash": "6863c1c16bc1dca448e6b15f6125a398", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 110, "avg_line_length": 26.594405594405593, "alnum_prop": 0.6413357875361557, "repo_name": "apmyjsc/lastfm-java", "id": "9a42cc80798ee16ed46348f3bd2d6f1c13835b6a", "size": "5240", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "src/main/java/de/umass/xml/DomElement.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Java", "bytes": "295970" } ], "symlink_target": "" }
package org.apache.harmony.jndi.tests.javax.naming.ldap; import javax.naming.NamingException; import javax.naming.ldap.ExtendedRequest; import javax.naming.ldap.ExtendedResponse; public class MockExtendedRequest implements ExtendedRequest { /** * <p></p> */ private static final long serialVersionUID = 1L; /* * (non-Javadoc) * * @see javax.naming.ldap.ExtendedRequest#getID() */ public String getID() { return null; } /* * (non-Javadoc) * * @see javax.naming.ldap.ExtendedRequest#getEncodedValue() */ public byte[] getEncodedValue() { return null; } /* * (non-Javadoc) * * @see javax.naming.ldap.ExtendedRequest#createExtendedResponse(java.lang.String, * byte[], int, int) */ public ExtendedResponse createExtendedResponse(String s, byte[] aB, int i, int i2) throws NamingException { return null; } }
{ "content_hash": "e4d84443fd7c23c61b5d2a83cd359f92", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 83, "avg_line_length": 19.57777777777778, "alnum_prop": 0.684449489216799, "repo_name": "freeVM/freeVM", "id": "171a7b477c5b7bb12853715f05768c1f4fe43cbe", "size": "1685", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "enhanced/java/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockExtendedRequest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "116828" }, { "name": "C", "bytes": "17860389" }, { "name": "C++", "bytes": "19007206" }, { "name": "CSS", "bytes": "217777" }, { "name": "Java", "bytes": "152108632" }, { "name": "Objective-C", "bytes": "106412" }, { "name": "Objective-J", "bytes": "11029421" }, { "name": "Perl", "bytes": "305690" }, { "name": "Scilab", "bytes": "34" }, { "name": "Shell", "bytes": "153821" }, { "name": "XSLT", "bytes": "152859" } ], "symlink_target": "" }
package cmd import ( "fmt" "github.com/smira/aptly/query" "github.com/smira/commander" "github.com/smira/flag" ) func aptlyMirrorEdit(cmd *commander.Command, args []string) error { var err error if len(args) != 1 { cmd.Usage() return commander.ErrCommandError } repo, err := context.CollectionFactory().RemoteRepoCollection().ByName(args[0]) if err != nil { return fmt.Errorf("unable to edit: %s", err) } err = repo.CheckLock() if err != nil { return fmt.Errorf("unable to edit: %s", err) } context.Flags().Visit(func(flag *flag.Flag) { switch flag.Name { case "filter": repo.Filter = flag.Value.String() case "filter-with-deps": repo.FilterWithDeps = flag.Value.Get().(bool) case "with-sources": repo.DownloadSources = flag.Value.Get().(bool) case "with-udebs": repo.DownloadUdebs = flag.Value.Get().(bool) } }) if repo.IsFlat() && repo.DownloadUdebs { return fmt.Errorf("unable to edit: flat mirrors don't support udebs") } if repo.Filter != "" { _, err = query.Parse(repo.Filter) if err != nil { return fmt.Errorf("unable to edit: %s", err) } } if context.GlobalFlags().Lookup("architectures").Value.String() != "" { repo.Architectures = context.ArchitecturesList() err = repo.Fetch(context.Downloader(), nil) if err != nil { return fmt.Errorf("unable to edit: %s", err) } } err = context.CollectionFactory().RemoteRepoCollection().Update(repo) if err != nil { return fmt.Errorf("unable to edit: %s", err) } fmt.Printf("Mirror %s successfully updated.\n", repo) return err } func makeCmdMirrorEdit() *commander.Command { cmd := &commander.Command{ Run: aptlyMirrorEdit, UsageLine: "edit <name>", Short: "edit mirror settings", Long: ` Command edit allows one to change settings of mirror: filters, list of architectures. Example: $ aptly mirror edit -filter=nginx -filter-with-deps some-mirror `, Flag: *flag.NewFlagSet("aptly-mirror-edit", flag.ExitOnError), } cmd.Flag.String("filter", "", "filter packages in mirror") cmd.Flag.Bool("filter-with-deps", false, "when filtering, include dependencies of matching packages as well") cmd.Flag.Bool("with-sources", false, "download source packages in addition to binary packages") cmd.Flag.Bool("with-udebs", false, "download .udeb packages (Debian installer support)") return cmd }
{ "content_hash": "9144c91b5c5ff48814a13401862fe0d1", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 110, "avg_line_length": 25.652173913043477, "alnum_prop": 0.6851694915254237, "repo_name": "neolynx/aptly", "id": "2d31d77f921ccc7613004906f3ce860925cc40b2", "size": "2360", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cmd/mirror_edit.go", "mode": "33188", "license": "mit", "language": [ { "name": "Gnuplot", "bytes": "269" }, { "name": "Go", "bytes": "756298" }, { "name": "Makefile", "bytes": "2423" }, { "name": "Python", "bytes": "377179" }, { "name": "Shell", "bytes": "22286" } ], "symlink_target": "" }
options<WebpackConfig>
{ "content_hash": "c65b9bc84640f13931e1becfb6293b3a", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 22, "avg_line_length": 23, "alnum_prop": 0.8695652173913043, "repo_name": "kaola-fed/foxman", "id": "65acfccf8df90aa9aa211ae7a4ac7cc0158159d9", "size": "87", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "packages/foxman-processor-webpack/readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7018" }, { "name": "FreeMarker", "bytes": "5288" }, { "name": "HTML", "bytes": "4687" }, { "name": "JavaScript", "bytes": "147555" }, { "name": "TypeScript", "bytes": "1765" } ], "symlink_target": "" }
var expect = require('chai').expect; var assert = require('chai').assert; var Store = require('../../src/Store'); var store = null; describe('Vanage', function() { describe('Store', function() { beforeEach(function() { store = new Store(); }); it('should create an empty store with no mutations', function() { expect(store.size).to.equal(0); expect(store.mutated).to.equal(false); expect(store.mutations).to.equal(0); expect(store.ready).to.equal(true); }); it('should create an initial store without limitations', function() { store = new Store({ data: { key: 'value', another: ['list', 1, undefined, [null]] } }); expect(store.size).to.equal(2); expect(store.mutated).to.equal(false); expect(store.ready).to.equal(true); }); it('should create an initial store with immutable keys', function() { store = new Store({ immutable: ['k1', 'k2'] }); store.set('k1', 0); // initial immutable value expect(() => store.set('k1', 1)).to.throw('Field k1 is immutable!'); expect(() => store.set('k2', 1293)).to.not.throw('Field k2 is immutable!'); expect(store.mutated).to.equal(true); expect(store.mutations).to.equal(2); }); it('should read values by key from the store', function() { store.set('test', 12); store.set('any', { key: 'z', value: [null]}); expect(store.get('test')).to.equal(12); expect(store.get('any')).to.deep.equal({key:'z',value:[null]}); }); it('should delete mutable items and skip immutable ones', function() { store.set('immu', null, true); store.set('muta', 98); expect(store.size).to.equal(2); expect(() => store.delete('immu')).to.throw('Field immu is immutable!'); expect(() => store.delete('muta')).to.not.throw('Field muta is immutable!'); expect(store.mutations).to.equal(3); // 2 create + 1 mutated (1 immutable) expect(store.mutated).to.equal(true); }); it('should flush the store and all internals', function() { store = new Store({ immutable: ['any', 57], data: { key: 'test', inner: [undefined, 'list'] } }); expect(store.size).to.equal(2); expect(store.immutables.length).to.equal(2); expect(store.mutated).to.equal(false); store.flush(); expect(store.size).to.equal(0); expect(store.immutables.length).to.equal(0); expect(store.mutated).to.equal(true); }); it('should listen to all or certain event types', function(done) { store.set('key', 0); store.on(Store.Events.CREATE_EVENT, (old, changed) => { expect(old).to.equal(0); expect(changed).to.equal(12); done(); }); store.set('key', 12); // mutate 0 to 12 }); it('should watch a single field only and notify on events', function(done) { store.set('test', null); store.set('any', [0, 1, 2, 3]); store.watch('test', (ev, old, updated) => { expect(ev).to.equal(Store.Events.UPDATE_EVENT); expect(old).to.equal(null); expect(updated).to.equal(10); }); store.watch('new', (ev, old, updated) => { expect(ev).to.equal(Store.Events.CREATE_EVENT); expect(updated).to.equal('Hey there!'); }); store.watch('any', (ev, val) => { expect(ev).to.equal(Store.Events.DELETE_EVENT); expect(val.length).to.equal(4); }); store.set('test', 10); store.set('new', 'Hey there!'); store.delete('any'); done(); }); it('all methods should be typesave and return false if something wont fit', function() { expect(store.on(10)).to.equal(false); expect(store.on(Store.Events.CREATE_EVENT)).to.equal(false); expect(store.on(0, (data) => [data])).to.equal(false); expect(store.watch(null)).to.equal(false); }); }); });
{ "content_hash": "f0d3eec4d07c3e2dafcc41d7d534b030", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 96, "avg_line_length": 35.674418604651166, "alnum_prop": 0.4943502824858757, "repo_name": "janbiasi/vanage", "id": "d8f6df074287b395c16b9065824a3049fc0206a3", "size": "4602", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/classes/StoreTest.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2661" }, { "name": "JavaScript", "bytes": "62569" } ], "symlink_target": "" }
<?php /* Prototype : array strpbrk(string haystack, string char_list) * Description: Search a string for any of a set of characters * Source code: ext/standard/string.c * Alias to functions: */ echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; $char_list = 'string_val'; $extra_arg = 10; echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; var_dump( strpbrk($haystack, $char_list, $extra_arg) ); echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); echo "\n-- Testing strpbrk() function with arrays --\n"; var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); var_dump( strpbrk(array('foo', 'bar'), 'b') ); ?> ===DONE===
{ "content_hash": "2098a01f8bb41f4293f2f91ed5e764cd", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 85, "avg_line_length": 31.642857142857142, "alnum_prop": 0.6580135440180587, "repo_name": "evnix/go-php-parser", "id": "2fa15b238048a1cfed4a04dc2e306cfbe983cc70", "size": "886", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "testdata/fuzzdir/corpus/ext_standard_tests_strings_strpbrk_error.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Go", "bytes": "176842" }, { "name": "PHP", "bytes": "9752494" }, { "name": "Shell", "bytes": "227" } ], "symlink_target": "" }
package org.elasticsearch.xpack.searchablesnapshots; import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotAction; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.support.ActionFilter; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.snapshots.SnapshotRestoreException; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; import java.util.Collection; import java.util.List; import java.util.Locale; import static java.util.Collections.singletonList; import static org.elasticsearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.containsString; @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST) public class SearchableSnapshotsUuidValidationIntegTests extends BaseFrozenSearchableSnapshotsIntegTestCase { public static class TestPlugin extends Plugin implements ActionPlugin { private final RestoreBlockingActionFilter restoreBlockingActionFilter; public TestPlugin() { restoreBlockingActionFilter = new RestoreBlockingActionFilter(); } @Override public List<ActionFilter> getActionFilters() { return singletonList(restoreBlockingActionFilter); } } public static class RestoreBlockingActionFilter extends org.elasticsearch.action.support.ActionFilter.Simple { private final PlainActionFuture<Void> executed = new PlainActionFuture<>(); private final PlainActionFuture<Void> unblocked = new PlainActionFuture<>(); @Override protected boolean apply(String action, ActionRequest request, ActionListener<?> listener) { if (RestoreSnapshotAction.NAME.equals(action)) { executed.onResponse(null); unblocked.actionGet(); } return true; } @Override public int order() { return 0; } public void unblock() { unblocked.onResponse(null); } public void awaitExecution() { executed.actionGet(); } } @Override protected Collection<Class<? extends Plugin>> nodePlugins() { return CollectionUtils.appendToCopy(super.nodePlugins(), TestPlugin.class); } public void testMountFailsIfSnapshotChanged() throws Exception { final String fsRepoName = randomAlphaOfLength(10); final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); final String restoredIndexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); final String snapshotName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); createRepository(fsRepoName, "fs"); final Settings.Builder originalIndexSettings = Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), true); createAndPopulateIndex(indexName, originalIndexSettings); createFullSnapshot(fsRepoName, snapshotName); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( restoredIndexName, fsRepoName, snapshotName, indexName, Settings.EMPTY, Strings.EMPTY_ARRAY, true, randomFrom(MountSearchableSnapshotRequest.Storage.values()) ); final ActionFuture<RestoreSnapshotResponse> responseFuture = client().execute(MountSearchableSnapshotAction.INSTANCE, req); final RestoreBlockingActionFilter restoreBlockingActionFilter = getBlockingActionFilter(); restoreBlockingActionFilter.awaitExecution(); assertAcked(client().admin().cluster().prepareDeleteSnapshot(fsRepoName, snapshotName).get()); createFullSnapshot(fsRepoName, snapshotName); assertFalse(responseFuture.isDone()); restoreBlockingActionFilter.unblock(); assertThat( expectThrows(SnapshotRestoreException.class, responseFuture::actionGet).getMessage(), containsString("snapshot UUID mismatch") ); assertAcked(client().admin().indices().prepareDelete(indexName)); } private static RestoreBlockingActionFilter getBlockingActionFilter() { for (final ActionFilter filter : internalCluster().getCurrentMasterNodeInstance(ActionFilters.class).filters()) { if (filter instanceof RestoreBlockingActionFilter) { return (RestoreBlockingActionFilter) filter; } } throw new AssertionError("did not find BlockingActionFilter"); } }
{ "content_hash": "4922ddcd2db347097ea1f9da48b319e5", "timestamp": "", "source": "github", "line_count": 133, "max_line_length": 131, "avg_line_length": 39.78195488721804, "alnum_prop": 0.7340767340767341, "repo_name": "GlenRSmith/elasticsearch", "id": "9096ed98596000040a4da73a9ef14c02b9c3cd11", "size": "5543", "binary": false, "copies": "35", "ref": "refs/heads/master", "path": "x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsUuidValidationIntegTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "11082" }, { "name": "Batchfile", "bytes": "11057" }, { "name": "Emacs Lisp", "bytes": "3341" }, { "name": "FreeMarker", "bytes": "45" }, { "name": "Groovy", "bytes": "337461" }, { "name": "HTML", "bytes": "2186" }, { "name": "Java", "bytes": "43224931" }, { "name": "Perl", "bytes": "11756" }, { "name": "Python", "bytes": "19852" }, { "name": "Shell", "bytes": "99571" } ], "symlink_target": "" }
<?php $url = TEST_MODE ? 'https://sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr'; $totalprice = $tpl['arr']['total']; // $tpl['arr']['deposit'] + $deposit = $tpl['arr']['deposit']; $actual_payment_amount = $tpl['arr']['payment_mod']; ?> <form action="<?php echo $url; ?>" method="post" style="display: inline" name="crPaypal"> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="business" value="<?php echo $tpl['option_arr']['paypal_address']; ?>" /> <input type="hidden" name="item_name" value="Deposit" /> <?php // echo !empty($tpl['arr']['extra_str']) ? htmlspecialchars($tpl['arr']['extra_str']) : 'Extras'; ?> <input type="hidden" name="invoice" value="<?php echo time() . "_" . $tpl['arr']['id']; ?>" /> <input type="hidden" name="amount" value="<?php echo number_format($actual_payment_amount, 2, '.', ''); ?>" /> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="no_note" value="1" /> <input type="hidden" name="currency_code" value="<?php echo $tpl['option_arr']['currency']; ?>" /> <input type="hidden" name="return" value="<?php echo $tpl['option_arr']['thank_you_page']; ?>" /> <input type="hidden" name="notify_url" value="<?php echo INSTALL_URL; ?>index.php?controller=Front&action=confirmPaypal" /> <input type="hidden" name="lc" value="US" /> <input type="hidden" name="rm" value="2" /> <input type="hidden" name="bn" value="PP-BuyNowBF" /> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> </form>
{ "content_hash": "3122de020d214162ef515d714a3fc77d", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 165, "avg_line_length": 62.96, "alnum_prop": 0.6232528589580686, "repo_name": "thirteen05/kidd", "id": "70b044b09e301311d11de4e37cb663bc8987f7a0", "size": "1574", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ReservationScript/app/views/Front/payments/paypal.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "39693" }, { "name": "CSS", "bytes": "790201" }, { "name": "HTML", "bytes": "1272" }, { "name": "JavaScript", "bytes": "560900" }, { "name": "PHP", "bytes": "2067089" }, { "name": "Ruby", "bytes": "410" } ], "symlink_target": "" }
package compilerutil // CancelFunction is a function that can be invoked to cancel the operation. type CancelFunction func() // CancelationHandle defines a handle for the cancelation of operations. type CancelationHandle interface { // Cancel marks the operation as canceled. Cancel() // WasCanceled returns whether the operation was canceled. WasCanceled() bool } // NewCancelationHandle returns a new handle for canceling an operation. func NewCancelationHandle() CancelationHandle { return &cancelationHandle{} } // NoopCancelationHandle returns a cancelation handle that cannot be canceled. func NoopCancelationHandle() CancelationHandle { return noopCancelationHandle{} } // GetCancelationHandle returns either the existing cancelation handle (if not nil) // or a new no-op handle. func GetCancelationHandle(existing CancelationHandle) CancelationHandle { if existing == nil { return noopCancelationHandle{} } return existing } type cancelationHandle struct { canceled bool } func (c *cancelationHandle) WasCanceled() bool { return c.canceled } func (c *cancelationHandle) Cancel() { c.canceled = true } type noopCancelationHandle struct{} func (noopCancelationHandle) WasCanceled() bool { return false } func (noopCancelationHandle) Cancel() { panic("Should never be called") }
{ "content_hash": "22ff92c6457ef29f8f8726286a3ef8ab", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 83, "avg_line_length": 23.87272727272727, "alnum_prop": 0.7821782178217822, "repo_name": "Serulian/compiler", "id": "265170d3d59c4807cbc531db0e16228857259e7e", "size": "1479", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "compilerutil/cancelationhandle.go", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Go", "bytes": "1958458" }, { "name": "JavaScript", "bytes": "332133" }, { "name": "Protocol Buffer", "bytes": "3721" }, { "name": "WebIDL", "bytes": "16376" } ], "symlink_target": "" }
package storage::oracle::zs::restapi::mode::pools; use base qw(centreon::plugins::templates::counter); use strict; use warnings; use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); sub custom_status_output { my ($self, %options) = @_; my $msg = 'status : ' . $self->{result_values}->{status}; return $msg; } sub custom_usage_output { my ($self, %options) = @_; my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total_space}); my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used_space}); my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free_space}); my $msg = sprintf('space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)', $total_size_value . " " . $total_size_unit, $total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_space}, $total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free_space} ); return $msg; } sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ { name => 'pool', type => 1, cb_prefix_output => 'prefix_pool_output', message_multiple => 'All pools are ok', skipped_code => { -10 => 1 } }, ]; $self->{maps_counters}->{pool} = [ { label => 'status', threshold => 0, set => { key_values => [ { name => 'status' }, { name => 'display' } ], closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold, } }, { label => 'usage', nlabel => 'pool.space.usage.bytes', set => { key_values => [ { name => 'used_space' }, { name => 'free_space' }, { name => 'prct_used_space' }, { name => 'prct_free_space' }, { name => 'total_space' }, { name => 'display' }, ], closure_custom_output => $self->can('custom_usage_output'), perfdatas => [ { value => 'used_space', template => '%d', min => 0, max => 'total_space', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display' }, ], } }, { label => 'usage-free', nlabel => 'pool.space.free.bytes', display_ok => 0, set => { key_values => [ { name => 'free_space' }, { name => 'used_space' }, { name => 'prct_used_space' }, { name => 'prct_free_space' }, { name => 'total_space' }, { name => 'display' }, ], closure_custom_output => $self->can('custom_usage_output'), perfdatas => [ { value => 'free_space', template => '%d', min => 0, max => 'total_space', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display' }, ], } }, { label => 'usage-prct', nlabel => 'pool.space.usage.percentage', display_ok => 0, set => { key_values => [ { name => 'prct_used_space' }, { name => 'display' } ], output_template => 'used : %.2f %%', perfdatas => [ { value => 'prct_used_space', template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }, ], } }, ]; } sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' }, 'unknown-status:s' => { name => 'unknown_status', default => '' }, 'warning-status:s' => { name => 'warning_status', default => '' }, 'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /online|exported/i' }, }); return $self; } sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); $self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']); } sub prefix_pool_output { my ($self, %options) = @_; return "Pool '" . $options{instance_value}->{display} . "' "; } sub manage_selection { my ($self, %options) = @_; my $results = $options{custom}->request_api(url_path => '/api/storage/v1/pools'); $self->{pool} = {}; foreach (@{$results->{pools}}) { if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $_->{name} !~ /$self->{option_results}->{filter_name}/) { $self->{output}->output_add(long_msg => "skipping pool '" . $_->{name} . "': no matching filter.", debug => 1); next; } $self->{pool}->{$_->{name}} = { display => $_->{name}, status => $_->{status}, total_space => $_->{usage}->{total}, used_space => $_->{usage}->{used}, free_space => $_->{usage}->{free}, prct_used_space => defined($_->{usage}->{total}) ? ($_->{usage}->{used} * 100 / $_->{usage}->{total}) : undef, prct_free_space => defined($_->{usage}->{total}) ? ($_->{usage}->{free} * 100 / $_->{usage}->{total}) : undef, }; } if (scalar(keys %{$self->{pool}}) <= 0) { $self->{output}->add_option_msg(short_msg => "No pool found"); $self->{output}->option_exit(); } } 1; __END__ =head1 MODE Check pool usages. =over 8 =item B<--filter-counters> Only display some counters (regexp can be used). Example: --filter-counters='^usage$' =item B<--filter-name> Filter pool name (can be a regexp). =item B<--unknown-status> Set unknon threshold for status (Default: ''). Can used special variables like: %{status}, %{display} =item B<--warning-status> Set warning threshold for status (Default: ''). Can used special variables like: %{status}, %{display} =item B<--critical-status> Set critical threshold for status (Default: '%{status} !~ /online|exported/i'). Can used special variables like: %{status}, %{display} =item B<--warning-*> B<--critical-*> Thresholds. Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%). =back =cut
{ "content_hash": "0502aa1bd40c1d5dd73fc54031f534ae", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 199, "avg_line_length": 37.31638418079096, "alnum_prop": 0.5191521574564724, "repo_name": "Tpo76/centreon-plugins", "id": "85f6e5a026d7af53343d156fcad9469f0378fc99", "size": "7365", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "storage/oracle/zs/restapi/mode/pools.pm", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "719" }, { "name": "Perl", "bytes": "19128067" } ], "symlink_target": "" }
@class DBTEAMLOGSharingChangeLinkPolicyType; NS_ASSUME_NONNULL_BEGIN #pragma mark - API Object /// /// The `SharingChangeLinkPolicyType` struct. /// /// This class implements the `DBSerializable` protocol (serialize and /// deserialize instance methods), which is required for all Obj-C SDK API route /// objects. /// @interface DBTEAMLOGSharingChangeLinkPolicyType : NSObject <DBSerializable, NSCopying> #pragma mark - Instance fields /// (no description). @property (nonatomic, readonly, copy) NSString *description_; #pragma mark - Constructors /// /// Full constructor for the struct (exposes all instance variables). /// /// @param description_ (no description). /// /// @return An initialized instance. /// - (instancetype)initWithDescription_:(NSString *)description_; - (instancetype)init NS_UNAVAILABLE; @end #pragma mark - Serializer Object /// /// The serialization class for the `SharingChangeLinkPolicyType` struct. /// @interface DBTEAMLOGSharingChangeLinkPolicyTypeSerializer : NSObject /// /// Serializes `DBTEAMLOGSharingChangeLinkPolicyType` instances. /// /// @param instance An instance of the `DBTEAMLOGSharingChangeLinkPolicyType` /// API object. /// /// @return A json-compatible dictionary representation of the /// `DBTEAMLOGSharingChangeLinkPolicyType` API object. /// + (nullable NSDictionary<NSString *, id> *)serialize:(DBTEAMLOGSharingChangeLinkPolicyType *)instance; /// /// Deserializes `DBTEAMLOGSharingChangeLinkPolicyType` instances. /// /// @param dict A json-compatible dictionary representation of the /// `DBTEAMLOGSharingChangeLinkPolicyType` API object. /// /// @return An instantiation of the `DBTEAMLOGSharingChangeLinkPolicyType` /// object. /// + (DBTEAMLOGSharingChangeLinkPolicyType *)deserialize:(NSDictionary<NSString *, id> *)dict; @end NS_ASSUME_NONNULL_END
{ "content_hash": "338f5d963eb37288be2ec1e7553beb39", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 102, "avg_line_length": 27.223880597014926, "alnum_prop": 0.7609649122807017, "repo_name": "dropbox/dropbox-sdk-obj-c", "id": "e4a68ae5cafcb10abcfd3f0e6c2859849d6c5721", "size": "2010", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Source/ObjectiveDropboxOfficial/Shared/Generated/ApiObjects/TeamLog/Headers/DBTEAMLOGSharingChangeLinkPolicyType.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "1288" }, { "name": "CSS", "bytes": "6608" }, { "name": "Objective-C", "bytes": "18903013" }, { "name": "Python", "bytes": "7087" }, { "name": "Ruby", "bytes": "1819" }, { "name": "Shell", "bytes": "4527" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>buchberger: 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 / released</a></li> <li class="active"><a href="">8.11.2 / buchberger - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> buchberger <small> 8.6.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2021-04-14 05:24:55 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-04-14 05:24:55 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 coq 8.11.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.1 Official release 4.11.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.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/buchberger&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Buchberger&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: Grobner basis&quot; &quot;keyword: polynomial ideal&quot; &quot;keyword: Buchberger&#39;s algorithm&quot; &quot;category: Mathematics/Algebra&quot; &quot;category: Miscellaneous/Extracted Programs/Combinatorics&quot; &quot;date: 1998&quot; ] authors: [ &quot;Laurent Théry&quot; &quot;Henrik Persson&quot; ] bug-reports: &quot;https://github.com/coq-contribs/buchberger/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/buchberger.git&quot; synopsis: &quot;Proof of Buchberger&#39;s algorithm&quot; description: &quot;&quot;&quot; A machine-checked implementation of Buchberger&#39;s. It computes the Grobner basis associated to a polynomial ideal.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/buchberger/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=0d57c963c096299f9fbd41547876742c&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-buchberger.8.6.0 coq.8.11.2</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.2). The following dependencies couldn&#39;t be met: - coq-buchberger -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) 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-buchberger.8.6.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"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </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": "aa79b50c62633d2446995c80009a9bd5", "timestamp": "", "source": "github", "line_count": 163, "max_line_length": 264, "avg_line_length": 42.0920245398773, "alnum_prop": 0.5458387990088909, "repo_name": "coq-bench/coq-bench.github.io", "id": "03574d1abc1a013127e24674f77fcf2875a3569d", "size": "6864", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.11.1-2.0.7/released/8.11.2/buchberger/8.6.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 336004 $ --> <refentry xml:id="function.mysql-drop-db" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysql_drop_db</refname> <refpurpose>Drop (delete) a MySQL database</refpurpose> </refnamediv> <refsynopsisdiv> <warning> &mysql.alternative.note.4-3-0; <simplelist role="alternatives"> <member>Execute a <literal>DROP DATABASE</literal> query</member> </simplelist> </warning> </refsynopsisdiv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>mysql_drop_db</methodname> <methodparam><type>string</type><parameter>database_name</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter><initializer>NULL</initializer></methodparam> </methodsynopsis> <para> <function>mysql_drop_db</function> attempts to drop (remove) an entire database from the server associated with the specified link identifier. This function is deprecated, it is preferable to use <function>mysql_query</function> to issue an sql <literal>DROP DATABASE</literal> statement instead. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>database_name</parameter></term> <listitem> <para> The name of the database that will be deleted. </para> </listitem> </varlistentry> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_drop_db</function> alternative example</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } $sql = 'DROP DATABASE my_db'; if (mysql_query($sql, $link)) { echo "Database my_db was successfully dropped\n"; } else { echo 'Error dropping database: ' . mysql_error() . "\n"; } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; <warning> <para> This function will not be available if the MySQL extension was built against a MySQL 4.x client library. </para> </warning> <note> <para> &info.deprecated.alias; <function>mysql_dropdb</function> </para> </note> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_query</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"~/.phpdoc/manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
{ "content_hash": "e9d32c76b031881b60906402f07ab54c", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 133, "avg_line_length": 25.023255813953487, "alnum_prop": 0.6840148698884758, "repo_name": "mziyut/.vim", "id": "de5ec3ed79827c5d020c6fed68b785047ebb8665", "size": "3228", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "dict/.neocomplete-php/phpdoc/en/reference/mysql/functions/mysql-drop-db.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2223" }, { "name": "Ruby", "bytes": "939" }, { "name": "Shell", "bytes": "582" }, { "name": "Vim script", "bytes": "22415" } ], "symlink_target": "" }
RSpec.describe ThreeScaleToolbox::Commands::ApplicationCommand::Apply::ApplySubcommand do let(:app_ref) { 'someapp' } let(:arguments) { { remote: 'https://key@destination.example.com', application: app_ref } } let(:options) { {} } let(:service_class) { class_double(ThreeScaleToolbox::Entities::Service).as_stubbed_const } let(:service_id) { 100 } let(:account_id) { 200 } let(:service) { instance_double(ThreeScaleToolbox::Entities::Service) } let(:account_class) { class_double(ThreeScaleToolbox::Entities::Account).as_stubbed_const } let(:account) { instance_double(ThreeScaleToolbox::Entities::Account) } let(:plan_class) { class_double(ThreeScaleToolbox::Entities::ApplicationPlan).as_stubbed_const } let(:plan) { instance_double(ThreeScaleToolbox::Entities::ApplicationPlan) } let(:application_class) { class_double(ThreeScaleToolbox::Entities::Application).as_stubbed_const } let(:remote) { instance_double('ThreeScale::API::Client', 'remote') } let(:application) { instance_double(ThreeScaleToolbox::Entities::Application) } let(:app_id) { 1 } let(:app_attrs) { { 'id' => app_id } } subject { described_class.new(options, arguments, nil) } before :example do allow(service).to receive(:id).and_return(service_id) allow(account).to receive(:id).and_return(account_id) allow(application).to receive(:attrs).and_return(app_attrs) end context '#run' do context 'resume and suspend passed' do let(:options) { { resume: true, suspend: true } } it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--resume and --suspend are mutually exclusive/) end end context 'application found' do before :example do expect(subject).to receive(:threescale_client).and_return(remote) expect(application_class).to receive(:find).with(remote: remote, service_id: nil, ref: app_ref) .and_return(application) end context 'no app attrs' do let(:options) { {} } it 'application not updated' do expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'resumed opt given' do let(:options) { { resume: true } } it 'application resumed' do expect(application).to receive(:resume) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'suspended opt given' do let(:options) { { suspend: true } } it 'application suspended' do expect(application).to receive(:suspend) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'name opt given' do let(:options) { { name: 'new name' } } it 'application updated with name' do expect(application).to receive(:update).with(hash_including('name' => 'new name')) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end it 'application updated with description as name' do expect(application).to receive(:update).with(hash_including('description' => 'new name')) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'description opt given' do let(:options) { { description: 'new descr' } } it 'application updated with description' do expect(application).to receive(:update).with(hash_including('description' => 'new descr')) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'user_key opt given' do let(:options) { { 'user-key': 'userKey' } } it 'application updated with user key' do expect(application).to receive(:update).with(hash_including('user_key' => 'userKey')) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end context 'redirect_url opt given' do let(:options) { { 'redirect-url': 'https://example.com/callback' } } it 'application updated with redirect url' do expect(application).to receive(:update).with(hash_including('redirect_url' => 'https://example.com/callback')) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end end context 'application not found' do before :example do expect(subject).to receive(:threescale_client).and_return(remote) expect(application_class).to receive(:find).with(remote: remote, service_id: service_id, ref: app_ref) .and_return(nil) end context 'account opt not given' do let(:options) do { service: 'myservice', plan: 'myplan', name: 'myname' } end before :example do expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--account is required/) end end context 'service opt not given' do let(:service_id) { nil } let(:options) do { account: 'myaccount', plan: 'myplan', name: 'myname' } end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--service is required/) end end context 'plan opt not given' do let(:options) do { account: 'myaccount', service: 'myservice', name: 'myname' } end before :example do expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--plan is required/) end end context 'name opt not given' do let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan' } end before :example do expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--name is required/) end end context 'user-key opt given' do let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan', name: 'myname', 'user-key': 'userKey' } end before :example do expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /--user-key option forbidden/) end end context 'account not found' do let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan', name: 'myname' } end before :example do expect(account_class).to receive(:find).with(remote: remote, ref: 'myaccount') .and_return(nil) expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /Account myaccount does not exist/) end end context 'service not found' do let(:service_id) { nil } let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan', name: 'myname' } end before :example do expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(nil) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /Service myservice does not exist/) end end context 'plan not found' do let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan', name: 'myname' } end before :example do expect(account_class).to receive(:find).with(remote: remote, ref: 'myaccount') .and_return(account) expect(account).to receive(:id).and_return(1) expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) expect(plan_class).to receive(:find).with(service: service, ref: 'myplan') .and_return(nil) end it 'error raised' do expect { subject.run }.to raise_error(ThreeScaleToolbox::Error, /Application plan myplan does not exist/) end end context 'all required params available' do let(:options) do { account: 'myaccount', service: 'myservice', plan: 'myplan', name: 'myname', description: 'mydescr', 'application-key': 'appKey', 'redirect-url': 'https://example.com/callback' } end before :example do expect(account_class).to receive(:find).with(remote: remote, ref: 'myaccount') .and_return(account) expect(service_class).to receive(:find).with(remote: remote, ref: 'myservice') .and_return(service) expect(plan_class).to receive(:find).with(service: service, ref: 'myplan') .and_return(plan) expect(plan).to receive(:id).and_return('planId') end it 'user_key set to application param' do expect(application_class).to receive(:create) .with( remote: remote, account_id: account_id, plan_id: 'planId', app_attrs: hash_including('user_key' => app_ref) ) .and_return(application) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end it 'application_id set to application param' do expect(application_class).to receive(:create) .with( remote: remote, account_id: account_id, plan_id: 'planId', app_attrs: hash_including('application_id' => app_ref) ) .and_return(application) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end it 'description is included' do expect(application_class).to receive(:create) .with( remote: remote, account_id: account_id, plan_id: 'planId', app_attrs: hash_including('description' => 'mydescr') ) .and_return(application) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end it 'application key is included' do expect(application_class).to receive(:create) .with( remote: remote, account_id: account_id, plan_id: 'planId', app_attrs: hash_including('application_key' => 'appKey') ) .and_return(application) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end it 'redirect-url is included' do expect(application_class).to receive(:create) .with( remote: remote, account_id: account_id, plan_id: 'planId', app_attrs: hash_including('redirect_url' => 'https://example.com/callback') ) .and_return(application) expect { subject.run }.to output(/Applied application id: 1/).to_stdout end end end end end
{ "content_hash": "0cd290fd25186962ce0eb1866b4437ee", "timestamp": "", "source": "github", "line_count": 364, "max_line_length": 120, "avg_line_length": 36.58791208791209, "alnum_prop": 0.5252290133653702, "repo_name": "3scale/3scale_toolbox", "id": "c4a1d09e00c34cb4c921320c3883903f939e624b", "size": "13318", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "spec/unit/commands/application_command/apply_command_spec.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "692" }, { "name": "HTML", "bytes": "430" }, { "name": "Ruby", "bytes": "1157064" }, { "name": "Shell", "bytes": "581" } ], "symlink_target": "" }
namespace CompilerActions { template< typename Rule > struct actions : pegtl::nothing< Rule > {}; template<> struct actions< Grammar::Flags::push_empty_value > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->save( "" ); } }; template<> struct actions< Grammar::Flags::push_sections_target > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->pushSectionsTarget(); } }; template<> struct actions< Grammar::Flags::push_empty_expression > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->pushEmptyExpression(); } }; template<> struct actions< Grammar::Flags::clear_last_function_definition > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->clearLastFunctionDefinition(); } }; template<> struct actions< Grammar::Flags::store_values_stack > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->store(); } }; template<> struct actions< Grammar::Flags::store_expressions_stack > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->storeExpressions(); } }; template<> struct actions< Grammar::Flags::store_conditions_stack > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->storeConditions(); } }; template<> struct actions< Grammar::Flags::build_field_from_asm > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFieldFromAsm(); } }; template<> struct actions< Grammar::identifier_saved > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->save( in.string() ); } }; template<> struct actions< Grammar::Number::integer_literal_saved > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::stringstream ss( in.string() ); I4::i32 v = 0; ss >> v; program->buildConstantInteger( v ); } }; template<> struct actions< Grammar::Number::float_literal_saved > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::stringstream ss( in.string() ); I4::f32 v = 0.0f; ss >> v; program->buildConstantFloat( v ); } }; template<> struct actions< Grammar::Number::hex_literal_saved > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::stringstream ss( in.string().substr( 2 ) ); I4::i64 v = 0; ss >> std::hex >> v; I4::i32* t = (I4::i32*)&v; program->buildConstantInteger( *t ); } }; template<> struct actions< Grammar::string > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::string v = in.string(); v = std::string_unescape( v.substr( 1, v.size() - 2 ) ); program->save( v ); } }; template<> struct actions< Grammar::string_saved > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::string v = in.string(); v = v.substr( 1, v.size() - 2 ); program->buildConstantString( v ); } }; template<> struct actions< Grammar::code_injection > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::string v = in.string(); v = std::string_trim( v.substr( 2, v.size() - 4 ) ); program->save( v ); } }; template<> struct actions< Grammar::null_keyword > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildConstantNull(); } }; template<> struct actions< Grammar::false_keyword > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildConstantBool( false ); } }; template<> struct actions< Grammar::true_keyword > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildConstantBool( true ); } }; template<> struct actions< Grammar::value > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildValue(); } }; template<> struct actions< Grammar::function_call_section > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunctionCallSection(); } }; template<> struct actions< Grammar::function_call > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunctionCall(); } }; template<> struct actions< Grammar::structure > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildStructure(); } }; template<> struct actions< Grammar::field > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildField(); } }; template<> struct actions< Grammar::function_args > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunctionArgs(); } }; template<> struct actions< Grammar::function_definition > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunction(); } }; template<> struct actions< Grammar::template_definition_body > { static void apply( const pegtl::input& in, ProgramPtr& program ) { std::string v = in.string(); v = v.substr( 0, v.size() - 2 ); program->save( v ); } }; template<> struct actions< Grammar::template_definition > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildTemplateDefinition(); } }; template<> struct actions< Grammar::template_implementation > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildTemplateImplementation(); } }; template<> struct actions< Grammar::directive_strict > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->markStrict(); } }; template<> struct actions< Grammar::directive_import > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildImport(); } }; template<> struct actions< Grammar::directive_start > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->startFunction = program->load(); } }; template<> struct actions< Grammar::directive_jaegerify > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildJaegerify(); } }; template<> struct actions< Grammar::directive_marshal_assembly_jaeger > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildMarshalFromAssembly(); } }; template<> struct actions< Grammar::directive_marshal_jaeger_assembly > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildMarshalToAssembly(); } }; template<> struct actions< Grammar::directive_let > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunctionVars(); } }; template<> struct actions< Grammar::directive_asm > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildAsm( false ); } }; template<> struct actions< Grammar::directive_asm_global > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildAsm( true ); } }; template<> struct actions< Grammar::directive_return > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->markReturnPlacement(); } }; template<> struct actions< Grammar::directive_set > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildVariableSet(); } }; template<> struct actions< Grammar::directive_if > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildIf(); } }; template<> struct actions< Grammar::directive_if_cond > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildCond(); } }; template<> struct actions< Grammar::directive_if_elif > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildElif(); } }; template<> struct actions< Grammar::directive_if_else > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildElse(); } }; template<> struct actions< Grammar::directive_while > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildWhile(); } }; template<> struct actions< Grammar::directive_yield > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildYield(); } }; template<> struct actions< Grammar::directive_attribute > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildAttribute(); } }; template<> struct actions< Grammar::grammar_function_definition > { static void apply( const pegtl::input& in, ProgramPtr& program ) { program->buildFunction(); } }; } #endif
{ "content_hash": "1932ef84106953297eb4ff6f53ba12f9", "timestamp": "", "source": "github", "line_count": 401, "max_line_length": 79, "avg_line_length": 26.723192019950126, "alnum_prop": 0.543766330720418, "repo_name": "PsichiX/Jaeger", "id": "160571f7d6603e344f016fdee8f4f31f17a622a4", "size": "10889", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Jaeger/include/compiler_actions.h", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "6485" }, { "name": "C++", "bytes": "137900" }, { "name": "GLSL", "bytes": "492" }, { "name": "Shell", "bytes": "1354" } ], "symlink_target": "" }
using System; using System.Text; using System.Text.RegularExpressions; namespace iSukces.Code { public class EndCodeEmbedder { public static string Append(string target, string codeToAppend, string end) { codeToAppend = codeToAppend?.Trim(); end = end.Trim(); var fullDelimiter = $"// {start} {end} {Limiter2}{Environment.NewLine}"; if (string.IsNullOrEmpty(target)) { if (string.IsNullOrEmpty(codeToAppend)) return string.Empty; return fullDelimiter + codeToAppend + Environment.NewLine; } const string spaces = "\\s+"; const string spacesOptional = "\\s*"; var delFilter = end.Replace(" ", spaces); var filter = $"^{spacesOptional}//{spacesOptional}{start}{spacesOptional}{delFilter}{spacesOptional}{Limiter2}"; var limiterSearch =new Regex(filter, RegexOptions.Multiline); var m = limiterSearch.Match(target); if (!m.Success) { if (string.IsNullOrEmpty(codeToAppend)) return target; return target.TrimEnd() + Environment.NewLine + fullDelimiter + codeToAppend + Environment.NewLine; } var a = target.Substring(0, m.Index); var sb = new StringBuilder(); sb.Append(a.TrimEnd()); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); sb.Append(fullDelimiter); sb.Append(codeToAppend); sb.Append(Environment.NewLine); return sb.ToString(); } private const string start = "-----====="; private const string Limiter2 = "=====-----"; } }
{ "content_hash": "4ddd4caa013e9eef2251e5e0f4892f68", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 141, "avg_line_length": 35.64150943396226, "alnum_prop": 0.5304393859184754, "repo_name": "isukces/isukces.code", "id": "40c1dc01ff1cd0401d43317e843f41a7779077f9", "size": "1891", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "isukces.code/Features/CsClasses/EndCodeEmbedder.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "52" }, { "name": "C#", "bytes": "871212" } ], "symlink_target": "" }
import assert from "assert"; import fs from "fs"; import events from "events"; import zlib from "zlib"; import url from 'url'; import util from "util"; import crypto from "crypto"; import http from "http"; import net from "net"; import dgram from "dgram"; import querystring from 'querystring'; import path from "path"; assert(1 + 1 - 2 === 0, "The universe isn't how it should."); assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); assert.equal(3, "3", "uses == comparator"); assert.notStrictEqual(2, "2", "uses === comparator"); assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); assert.doesNotThrow(() => { if (false) { throw "a hammer at your face"; } }, undefined, "What the...*crunch*"); //////////////////////////////////////////////////// /// File system tests : http://nodejs.org/api/fs.html //////////////////////////////////////////////////// fs.writeFile("thebible.txt", "Do unto others as you would have them do unto you.", assert.ifError); fs.writeFile("Harry Potter", "\"You be wizzing, Harry,\" jived Dumbledore.", { encoding: "ascii" }, assert.ifError); var content: string, buffer: Buffer; content = fs.readFileSync('testfile', 'utf8'); content = fs.readFileSync('testfile', {encoding : 'utf8'}); buffer = fs.readFileSync('testfile'); buffer = fs.readFileSync('testfile', {flag : 'r'}); fs.readFile('testfile', 'utf8', (err, data) => content = data); fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data); fs.readFile('testfile', (err, data) => buffer = data); fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data); class Networker extends events.EventEmitter { constructor() { super(); this.emit("mingling"); } } var errno: number; fs.readFile('testfile', (err, data) => { if (err && err.errno) { errno = err.errno; } }); //////////////////////////////////////////////////// /// Url tests : http://nodejs.org/api/url.html //////////////////////////////////////////////////// url.format(url.parse('http://www.example.com/xyz')); // https://google.com/search?q=you're%20a%20lizard%2C%20gary url.format({ protocol: 'https', host: "google.com", pathname: 'search', query: { q: "you're a lizard, gary" } }); var helloUrl = url.parse('http://example.com/?hello=world', true) assert.equal(helloUrl.query.hello, 'world'); // Old and new util.inspect APIs util.inspect(["This is nice"], false, 5); util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false }); //////////////////////////////////////////////////// /// Stream tests : http://nodejs.org/api/stream.html //////////////////////////////////////////////////// // http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options function stream_readable_pipe_test() { var r = fs.createReadStream('file.txt'); var z = zlib.createGzip(); var w = fs.createWriteStream('file.txt.gz'); r.pipe(z).pipe(w); r.close(); } //////////////////////////////////////////////////// /// Crypto tests : http://nodejs.org/api/crypto.html //////////////////////////////////////////////////// var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex'); function crypto_cipher_decipher_string_test() { var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); var clearText:string = "This is the clear text."; var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); var cipherText:string = cipher.update(clearText, "utf8", "hex"); cipherText += cipher.final("hex"); var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); var clearText2:string = decipher.update(cipherText, "hex", "utf8"); clearText2 += decipher.final("utf8"); assert.equal(clearText2, clearText); } function crypto_cipher_decipher_buffer_test() { var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); var clearText:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key); var cipherBuffers:Buffer[] = []; cipherBuffers.push(cipher.update(clearText)); cipherBuffers.push(cipher.final()); var cipherText:Buffer = Buffer.concat(cipherBuffers); var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); var decipherBuffers:Buffer[] = []; decipherBuffers.push(decipher.update(cipherText)); decipherBuffers.push(decipher.final()); var clearText2:Buffer = Buffer.concat(decipherBuffers); assert.deepEqual(clearText2, clearText); } //////////////////////////////////////////////////// // Make sure .listen() and .close() retuern a Server instance http.createServer().listen(0).close().address(); net.createServer().listen(0).close().address(); var request = http.request('http://0.0.0.0'); request.once('error', function () {}); request.setNoDelay(true); request.abort(); //////////////////////////////////////////////////// /// Http tests : http://nodejs.org/api/http.html //////////////////////////////////////////////////// module http_tests { // Status codes var code = 100; var codeMessage = http.STATUS_CODES['400']; var codeMessage = http.STATUS_CODES[400]; var agent: http.Agent = new http.Agent({ keepAlive: true, keepAliveMsecs: 10000, maxSockets: Infinity, maxFreeSockets: 256 }); var agent: http.Agent = http.globalAgent; } //////////////////////////////////////////////////// /// Dgram tests : http://nodejs.org/api/dgram.html //////////////////////////////////////////////////// var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => { }); var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); //////////////////////////////////////////////////// ///Querystring tests : https://gist.github.com/musubu/2202583 //////////////////////////////////////////////////// var original: string = 'http://example.com/product/abcde.html'; var escaped: string = querystring.escape(original); console.log(escaped); // http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html var unescaped: string = querystring.unescape(escaped); console.log(unescaped); // http://example.com/product/abcde.html //////////////////////////////////////////////////// /// path tests : http://nodejs.org/api/path.html //////////////////////////////////////////////////// module path_tests { path.normalize('/foo/bar//baz/asdf/quux/..'); path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); // returns //'/foo/bar/baz/asdf' try { path.join('foo', {}, 'bar'); } catch(error) { } path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile'); //Is similar to: // //cd foo/bar //cd /tmp/file/ //cd .. // cd a/../subfile //pwd path.resolve('/foo/bar', './baz') // returns // '/foo/bar/baz' path.resolve('/foo/bar', '/tmp/file/') // returns // '/tmp/file' path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') // if currently in /home/myself/node, it returns // '/home/myself/node/wwwroot/static_files/gif/image.gif' path.isAbsolute('/foo/bar') // true path.isAbsolute('/baz/..') // true path.isAbsolute('qux/') // false path.isAbsolute('.') // false path.isAbsolute('//server') // true path.isAbsolute('C:/foo/..') // true path.isAbsolute('bar\\baz') // false path.isAbsolute('.') // false path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') // returns // '..\\..\\impl\\bbb' path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') // returns // '../../impl/bbb' path.dirname('/foo/bar/baz/asdf/quux') // returns // '/foo/bar/baz/asdf' path.basename('/foo/bar/baz/asdf/quux.html') // returns // 'quux.html' path.basename('/foo/bar/baz/asdf/quux.html', '.html') // returns // 'quux' path.extname('index.html') // returns // '.html' path.extname('index.coffee.md') // returns // '.md' path.extname('index.') // returns // '.' path.extname('index') // returns // '' 'foo/bar/baz'.split(path.sep) // returns // ['foo', 'bar', 'baz'] 'foo\\bar\\baz'.split(path.sep) // returns // ['foo', 'bar', 'baz'] console.log(process.env.PATH) // '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' process.env.PATH.split(path.delimiter) // returns // ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] console.log(process.env.PATH) // 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\' process.env.PATH.split(path.delimiter) // returns // ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\'] path.parse('/home/user/dir/file.txt') // returns // { // root : "/", // dir : "/home/user/dir", // base : "file.txt", // ext : ".txt", // name : "file" // } path.parse('C:\\path\\dir\\index.html') // returns // { // root : "C:\", // dir : "C:\path\dir", // base : "index.html", // ext : ".html", // name : "index" // } path.format({ root : "/", dir : "/home/user/dir", base : "file.txt", ext : ".txt", name : "file" }); // returns // '/home/user/dir/file.txt' }
{ "content_hash": "aefcdfe9a11d8f8cb0d4c0005099f8a3", "timestamp": "", "source": "github", "line_count": 333, "max_line_length": 99, "avg_line_length": 28.47147147147147, "alnum_prop": 0.5543719016981331, "repo_name": "tarruda/DefinitelyTyped", "id": "2c6b6fbb541d90b20e6068a8802c457311fdc4e9", "size": "9517", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "node/node-tests.ts", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "4696140" }, { "name": "VimL", "bytes": "1337" } ], "symlink_target": "" }
<!doctype html> <html style="background:#000;"> <head> <title>$title</title> <meta charset="utf-8"> <link rel="stylesheet" href="skin/reset-font-min.css"> <link rel="stylesheet" href="skin/clearfix.css"> <link rel="stylesheet" href="skin/style.css"> <style></style> </head> <body> <div class="wrapper"> <div class="dropdown js-dropdown"> <a href="#" class="toggle clearfix js-toggle"> <span class="text">toggle</span> <span class="icon"></span> </a> <div class="content clearfix js-content"> <div class="anchor"></div> <ul class="menu"> <li class="item js-item"> <a href="#" target="_blank" class="clearfix"> <span class="text">Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</span> </a> </li> <li class="item js-item"> <a href="#" target="_blank" class="clearfix"> <span class="text">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span> </a> </li> <li class="item js-item"> <a href="#" target="_blank" class="clearfix"> <span class="text">Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</span> </a> </li> <li class="item js-item"> <a href="#" target="_blank" class="clearfix"> <span class="text">嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯嗯</span> </a> </li> </ul> </div> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script src="js/script.js"></script> <script src="js/prefixfree.min.js"></script> </body> </html>
{ "content_hash": "199a2a75a46c86bfe1693ef6b1be5285", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 122, "avg_line_length": 39.183673469387756, "alnum_prop": 0.5072916666666667, "repo_name": "cythilya/Code_Snippets", "id": "d149f231ec5129f5bf109544764177b5387f3d9d", "size": "1982", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ui/dropdown_201308031732/dropdown_button/dropdown.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "85480" }, { "name": "HTML", "bytes": "780415" }, { "name": "JavaScript", "bytes": "239540" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>Man page of GETLOGIN</TITLE> </HEAD><BODY> <H1>GETLOGIN</H1> Section: Linux Programmer's Manual (3)<BR>Updated: 2013-04-19<BR><A HREF="#index">Index</A> <A HREF="../index.html">Return to Main Contents</A><HR> <A NAME="lbAB">&nbsp;</A> <H2>NAME</H2> getlogin, getlogin_r, cuserid - get username <A NAME="lbAC">&nbsp;</A> <H2>SYNOPSIS</H2> <B>#include &lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</B> <P> <B>char *getlogin(void);</B> <BR> <B>int getlogin_r(char *</B><I>buf</I><B>, size_t </B><I>bufsize</I><B>);</B> <P> <B>#include &lt;<A HREF="file:///usr/include/stdio.h">stdio.h</A>&gt;</B> <P> <B>char *cuserid(char *</B><I>string</I><B>);</B> <P> Feature Test Macro Requirements for glibc (see <B><A HREF="../man7/feature_test_macros.7.html">feature_test_macros</A></B>(7)): <P> <B>getlogin_r</B>(): _REENTRANT || _POSIX_C_SOURCE&nbsp;&gt;=&nbsp;199506L <BR> <B>cuserid</B>(): _XOPEN_SOURCE <A NAME="lbAD">&nbsp;</A> <H2>DESCRIPTION</H2> <B>getlogin</B>() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a null pointer if this information cannot be determined. The string is statically allocated and might be overwritten on subsequent calls to this function or to <B>cuserid</B>(). <P> <B>getlogin_r</B>() returns this same username in the array <I>buf</I> of size <I>bufsize</I>. <P> <B>cuserid</B>() returns a pointer to a string containing a username associated with the effective user ID of the process. If <I>string</I> is not a null pointer, it should be an array that can hold at least <B>L_cuserid</B> characters; the string is returned in this array. Otherwise, a pointer to a string in a static area is returned. This string is statically allocated and might be overwritten on subsequent calls to this function or to <B>getlogin</B>(). <P> The macro <B>L_cuserid</B> is an integer constant that indicates how long an array you might need to store a username. <B>L_cuserid</B> is declared in <I>&lt;<A HREF="file:///usr/include/stdio.h">stdio.h</A>&gt;</I>. <P> These functions let your program identify positively the user who is running (<B>cuserid</B>()) or the user who logged in this session (<B>getlogin</B>()). (These can differ when set-user-ID programs are involved.) <P> For most purposes, it is more useful to use the environment variable <B>LOGNAME</B> to find out who the user is. This is more flexible precisely because the user can set <B>LOGNAME</B> arbitrarily. <A NAME="lbAE">&nbsp;</A> <H2>RETURN VALUE</H2> <B>getlogin</B>() returns a pointer to the username when successful, and NULL on failure, with <I>errno</I> set to indicate the cause of the error. <B>getlogin_r</B>() returns 0 when successful, and nonzero on failure. <A NAME="lbAF">&nbsp;</A> <H2>ERRORS</H2> POSIX specifies <DL COMPACT> <DT><B>EMFILE</B> <DD> The calling process already has the maximum allowed number of open files. <DT><B>ENFILE</B> <DD> The system already has the maximum allowed number of open files. <DT><B>ENXIO</B> <DD> The calling process has no controlling terminal. <DT><B>ERANGE</B> <DD> (getlogin_r) The length of the username, including the terminating null byte ('\0'), is larger than <I>bufsize</I>. </DL> <P> Linux/glibc also has <DL COMPACT> <DT><B>ENOENT</B> <DD> There was no corresponding entry in the utmp-file. <DT><B>ENOMEM</B> <DD> Insufficient memory to allocate passwd structure. <DT><B>ENOTTY</B> <DD> Standard input didn't refer to a terminal. (See BUGS.) </DL> <A NAME="lbAG">&nbsp;</A> <H2>FILES</H2> <DL COMPACT> <DT><I>/etc/passwd</I><DD> password database file <DT><I>/var/run/utmp</I><DD> (traditionally <I>/etc/utmp</I>; some libc versions used <I>/var/adm/utmp</I>) </DL> <A NAME="lbAH">&nbsp;</A> <H2>ATTRIBUTES</H2> <A NAME="lbAI">&nbsp;</A> <H3>Multithreading (see <A HREF="../man7/pthreads.7.html">pthreads</A>(7))</H3> The <B>getlogin</B>() function is not thread-safe. <P> The <B>getlogin_r</B>() function is thread-safe. <P> The <B>cuserid</B>() function is thread-safe with exceptions. It is not thread-safe if called with a NULL parameter. <A NAME="lbAJ">&nbsp;</A> <H2>CONFORMING TO</H2> <B>getlogin</B>() and <B>getlogin_r</B>() specified in POSIX.1-2001. <P> System V has a <B>cuserid</B>() function which uses the real user ID rather than the effective user ID. The <B>cuserid</B>() function was included in the 1988 version of POSIX, but removed from the 1990 version. It was present in SUSv2, but removed in POSIX.1-2001. <P> OpenBSD has <B>getlogin</B>() and <B>setlogin</B>(), and a username associated with a session, even if it has no controlling terminal. <A NAME="lbAK">&nbsp;</A> <H2>BUGS</H2> Unfortunately, it is often rather easy to fool <B>getlogin</B>(). Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling terminal of our program need not be the user who started it. Avoid <B>getlogin</B>() for security-related purposes. <P> Note that glibc does not follow the POSIX specification and uses <I>stdin</I> instead of <I>/dev/tty</I>. A bug. (Other recent systems, like SunOS 5.8 and HP-UX 11.11 and FreeBSD 4.8 all return the login name also when <I>stdin</I> is redirected.) <P> Nobody knows precisely what <B>cuserid</B>() does; avoid it in portable programs. Or avoid it altogether: use <I>getpwuid(geteuid())</I> instead, if that is what you meant. <B>Do not use</B> <B>cuserid</B>(). <A NAME="lbAL">&nbsp;</A> <H2>SEE ALSO</H2> <B><A HREF="../man2/geteuid.2.html">geteuid</A></B>(2), <B><A HREF="../man2/getuid.2.html">getuid</A></B>(2), <B><A HREF="../man5/utmp.5.html">utmp</A></B>(5) <P> <HR> <A NAME="index">&nbsp;</A><H2>Index</H2> <DL> <DT><A HREF="#lbAB">NAME</A><DD> <DT><A HREF="#lbAC">SYNOPSIS</A><DD> <DT><A HREF="#lbAD">DESCRIPTION</A><DD> <DT><A HREF="#lbAE">RETURN VALUE</A><DD> <DT><A HREF="#lbAF">ERRORS</A><DD> <DT><A HREF="#lbAG">FILES</A><DD> <DT><A HREF="#lbAH">ATTRIBUTES</A><DD> <DL> <DT><A HREF="#lbAI">Multithreading (see pthreads(7))</A><DD> </DL> <DT><A HREF="#lbAJ">CONFORMING TO</A><DD> <DT><A HREF="#lbAK">BUGS</A><DD> <DT><A HREF="#lbAL">SEE ALSO</A><DD> </DL> <HR> This document was created by <A HREF="/cgi-bin/man/man2html">man2html</A>, using the manual pages.<BR> Time: 02:55:11 GMT, September 18, 2014 </BODY> </HTML>
{ "content_hash": "e811a3e6d6d12dcb4bb71d0498e46ec4", "timestamp": "", "source": "github", "line_count": 305, "max_line_length": 97, "avg_line_length": 21.367213114754097, "alnum_prop": 0.6825226331133958, "repo_name": "cs-education/sysassets", "id": "7786cbef1fa287b691c7c7dafa46575b2873615d", "size": "6517", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "man_pages/html/man3/getlogin.3.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "903770" }, { "name": "C++", "bytes": "68176" }, { "name": "HTML", "bytes": "7310436" }, { "name": "Logos", "bytes": "8558" }, { "name": "M4", "bytes": "116840" }, { "name": "Makefile", "bytes": "15176" }, { "name": "Objective-C", "bytes": "387" }, { "name": "Perl", "bytes": "256223" }, { "name": "Python", "bytes": "272243" }, { "name": "Ruby", "bytes": "678737" }, { "name": "Shell", "bytes": "157747" }, { "name": "Tcl", "bytes": "18233" }, { "name": "Vim script", "bytes": "154154" }, { "name": "XC", "bytes": "8205" }, { "name": "XS", "bytes": "8065" } ], "symlink_target": "" }
//// [emitClassExpressionInDeclarationFile2.ts] export var noPrivates = class { static getTags() { } tags() { } private static ps = -1 private p = 12 } // altered repro from #15066 to add private property export class FooItem { foo(): void { } name?: string; private property = "capitalism" } export type Constructor<T> = new(...args: any[]) => T; export function WithTags<T extends Constructor<FooItem>>(Base: T) { return class extends Base { static getTags(): void { } tags(): void { } } } export class Test extends WithTags(FooItem) {} const test = new Test(); Test.getTags() test.tags(); //// [emitClassExpressionInDeclarationFile2.js] "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a; exports.__esModule = true; exports.noPrivates = (_a = /** @class */ (function () { function class_1() { this.p = 12; } class_1.getTags = function () { }; class_1.prototype.tags = function () { }; return class_1; }()), _a.ps = -1, _a); // altered repro from #15066 to add private property var FooItem = /** @class */ (function () { function FooItem() { this.property = "capitalism"; } FooItem.prototype.foo = function () { }; return FooItem; }()); exports.FooItem = FooItem; function WithTags(Base) { return /** @class */ (function (_super) { __extends(class_2, _super); function class_2() { return _super !== null && _super.apply(this, arguments) || this; } class_2.getTags = function () { }; class_2.prototype.tags = function () { }; return class_2; }(Base)); } exports.WithTags = WithTags; var Test = /** @class */ (function (_super) { __extends(Test, _super); function Test() { return _super !== null && _super.apply(this, arguments) || this; } return Test; }(WithTags(FooItem))); exports.Test = Test; var test = new Test(); Test.getTags(); test.tags();
{ "content_hash": "d0629482389b66adab019005affdde33", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 93, "avg_line_length": 28.955555555555556, "alnum_prop": 0.5495011511895626, "repo_name": "minestarks/TypeScript", "id": "fbeae9f8a4fa1b0db1ffa51d216d5ceb5e7d724c", "size": "2606", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/baselines/reference/emitClassExpressionInDeclarationFile2.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "3630" }, { "name": "JavaScript", "bytes": "175" }, { "name": "PowerShell", "bytes": "2855" }, { "name": "Shell", "bytes": "47" }, { "name": "TypeScript", "bytes": "90205277" } ], "symlink_target": "" }
/****************************************************************************** * * Module Name: utxface - External interfaces, miscellaneous utility functions * *****************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. * All rights reserved. * * 2. License * * 2.1. This is your license from Intel Corp. under its intellectual property * rights. You may have additional license terms from the party that provided * you this software, covering your right to use that party's intellectual * property rights. * * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a * copy of the source code appearing in this file ("Covered Code") an * irrevocable, perpetual, worldwide license under Intel's copyrights in the * base code distributed originally by Intel ("Original Intel Code") to copy, * make derivatives, distribute, use and display any portion of the Covered * Code in any form, with the right to sublicense such rights; and * * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; * * The above copyright and patent license is granted only if the following * conditions are met: * * 3. Conditions * * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, * and the following Disclaimer and Export Compliance provision. In addition, * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the * documentation and/or other materials provided with distribution. In * addition, Licensee may not authorize further sublicense of source of any * portion of the Covered Code, and must include terms to the effect that the * license from Licensee to its licensee is limited to the intellectual * property embodied in the software Licensee provides to its licensee, and * not to intellectual property embodied in modifications its licensee may * make. * * 3.3. Redistribution of Executable. Redistribution in executable form of any * substantial portion of the Covered Code or modification must reproduce the * above Copyright Notice, and the following Disclaimer and Export Compliance * provision in the documentation and/or other materials provided with the * distribution. * * 3.4. Intel retains all right, title, and interest in and to the Original * Intel Code. * * 3.5. Neither the name Intel nor any other trademark owned or controlled by * Intel shall be used in advertising or otherwise to promote the sale, use or * other dealings in products derived from or relating to the Covered Code * without prior written authorization from Intel. * * 4. Disclaimer and Export Compliance * * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY * LIMITED REMEDY. * * 4.3. Licensee shall not export, either directly or indirectly, any of this * software or system incorporating such software without first obtaining any * required license or other approval from the U. S. Department of Commerce or * any other agency or department of the United States Government. In the * event Licensee exports any such software from the United States or * re-exports any such software from a foreign destination, Licensee shall * ensure that the distribution and export/re-export of the software is in * compliance with all laws, regulations, orders, or other restrictions of the * U.S. Export Administration Regulations. Licensee agrees that neither it nor * any of its subsidiaries will export/re-export any technical data, process, * software, or service, directly or indirectly, to any country for which the * United States government or any agency thereof requires an export license, * other governmental approval, or letter of assurance, without first obtaining * such license, approval or letter. * *****************************************************************************/ #define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" #include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxface") /******************************************************************************* * * FUNCTION: AcpiTerminate * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. * ******************************************************************************/ ACPI_STATUS ACPI_INIT_FUNCTION AcpiTerminate ( void) { ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiTerminate); /* Shutdown and free all resources */ AcpiUtSubsystemShutdown (); /* Free the mutex objects */ AcpiUtMutexTerminate (); /* Now we can shutdown the OS-dependent layer */ Status = AcpiOsTerminate (); return_ACPI_STATUS (Status); } ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate) #ifndef ACPI_ASL_COMPILER /******************************************************************************* * * FUNCTION: AcpiSubsystemStatus * * PARAMETERS: None * * RETURN: Status of the ACPI subsystem * * DESCRIPTION: Other drivers that use the ACPI subsystem should call this * before making any other calls, to ensure the subsystem * initialized successfully. * ******************************************************************************/ ACPI_STATUS AcpiSubsystemStatus ( void) { if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) { return (AE_OK); } else { return (AE_ERROR); } } ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus) /******************************************************************************* * * FUNCTION: AcpiGetSystemInfo * * PARAMETERS: OutBuffer - A buffer to receive the resources for the * device * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get information about the current * state of the ACPI subsystem. It will return system information * in the OutBuffer. * * If the function fails an appropriate status will be returned * and the value of OutBuffer is undefined. * ******************************************************************************/ ACPI_STATUS AcpiGetSystemInfo ( ACPI_BUFFER *OutBuffer) { ACPI_SYSTEM_INFO *InfoPtr; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiGetSystemInfo); /* Parameter validation */ Status = AcpiUtValidateBuffer (OutBuffer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Validate/Allocate/Clear caller buffer */ Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * Populate the return buffer */ InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ InfoPtr->Flags = ACPI_SYS_MODE_ACPI; /* Timer resolution - 24 or 32 bits */ if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) { InfoPtr->TimerResolution = 24; } else { InfoPtr->TimerResolution = 32; } /* Clear the reserved fields */ InfoPtr->Reserved1 = 0; InfoPtr->Reserved2 = 0; /* Current debug levels */ InfoPtr->DebugLayer = AcpiDbgLayer; InfoPtr->DebugLevel = AcpiDbgLevel; return_ACPI_STATUS (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) /******************************************************************************* * * FUNCTION: AcpiGetStatistics * * PARAMETERS: Stats - Where the statistics are returned * * RETURN: Status - the status of the call * * DESCRIPTION: Get the contents of the various system counters * ******************************************************************************/ ACPI_STATUS AcpiGetStatistics ( ACPI_STATISTICS *Stats) { ACPI_FUNCTION_TRACE (AcpiGetStatistics); /* Parameter validation */ if (!Stats) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Various interrupt-based event counters */ Stats->SciCount = AcpiSciCount; Stats->GpeCount = AcpiGpeCount; memcpy (Stats->FixedEventCount, AcpiFixedEventCount, sizeof (AcpiFixedEventCount)); /* Other counters */ Stats->MethodCount = AcpiMethodCount; return_ACPI_STATUS (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiGetStatistics) /***************************************************************************** * * FUNCTION: AcpiInstallInitializationHandler * * PARAMETERS: Handler - Callback procedure * Function - Not (currently) used, see below * * RETURN: Status * * DESCRIPTION: Install an initialization handler * * TBD: When a second function is added, must save the Function also. * ****************************************************************************/ ACPI_STATUS AcpiInstallInitializationHandler ( ACPI_INIT_HANDLER Handler, UINT32 Function) { if (!Handler) { return (AE_BAD_PARAMETER); } if (AcpiGbl_InitHandler) { return (AE_ALREADY_EXISTS); } AcpiGbl_InitHandler = Handler; return (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler) /***************************************************************************** * * FUNCTION: AcpiPurgeCachedObjects * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Empty all caches (delete the cached objects) * ****************************************************************************/ ACPI_STATUS AcpiPurgeCachedObjects ( void) { ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects); (void) AcpiOsPurgeCache (AcpiGbl_StateCache); (void) AcpiOsPurgeCache (AcpiGbl_OperandCache); (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache); (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache); return_ACPI_STATUS (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) /***************************************************************************** * * FUNCTION: AcpiInstallInterface * * PARAMETERS: InterfaceName - The interface to install * * RETURN: Status * * DESCRIPTION: Install an _OSI interface to the global list * ****************************************************************************/ ACPI_STATUS AcpiInstallInterface ( ACPI_STRING InterfaceName) { ACPI_STATUS Status; ACPI_INTERFACE_INFO *InterfaceInfo; /* Parameter validation */ if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } /* Check if the interface name is already in the global list */ InterfaceInfo = AcpiUtGetInterface (InterfaceName); if (InterfaceInfo) { /* * The interface already exists in the list. This is OK if the * interface has been marked invalid -- just clear the bit. */ if (InterfaceInfo->Flags & ACPI_OSI_INVALID) { InterfaceInfo->Flags &= ~ACPI_OSI_INVALID; Status = AE_OK; } else { Status = AE_ALREADY_EXISTS; } } else { /* New interface name, install into the global list */ Status = AcpiUtInstallInterface (InterfaceName); } AcpiOsReleaseMutex (AcpiGbl_OsiMutex); return (Status); } ACPI_EXPORT_SYMBOL (AcpiInstallInterface) /***************************************************************************** * * FUNCTION: AcpiRemoveInterface * * PARAMETERS: InterfaceName - The interface to remove * * RETURN: Status * * DESCRIPTION: Remove an _OSI interface from the global list * ****************************************************************************/ ACPI_STATUS AcpiRemoveInterface ( ACPI_STRING InterfaceName) { ACPI_STATUS Status; /* Parameter validation */ if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiUtRemoveInterface (InterfaceName); AcpiOsReleaseMutex (AcpiGbl_OsiMutex); return (Status); } ACPI_EXPORT_SYMBOL (AcpiRemoveInterface) /***************************************************************************** * * FUNCTION: AcpiInstallInterfaceHandler * * PARAMETERS: Handler - The _OSI interface handler to install * NULL means "remove existing handler" * * RETURN: Status * * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. * invoked during execution of the internal implementation of * _OSI. A NULL handler simply removes any existing handler. * ****************************************************************************/ ACPI_STATUS AcpiInstallInterfaceHandler ( ACPI_INTERFACE_HANDLER Handler) { ACPI_STATUS Status; Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } if (Handler && AcpiGbl_InterfaceHandler) { Status = AE_ALREADY_EXISTS; } else { AcpiGbl_InterfaceHandler = Handler; } AcpiOsReleaseMutex (AcpiGbl_OsiMutex); return (Status); } ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler) /***************************************************************************** * * FUNCTION: AcpiUpdateInterfaces * * PARAMETERS: Action - Actions to be performed during the * update * * RETURN: Status * * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor * string or/and feature group strings. * ****************************************************************************/ ACPI_STATUS AcpiUpdateInterfaces ( UINT8 Action) { ACPI_STATUS Status; Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiUtUpdateInterfaces (Action); AcpiOsReleaseMutex (AcpiGbl_OsiMutex); return (Status); } /***************************************************************************** * * FUNCTION: AcpiCheckAddressRange * * PARAMETERS: SpaceId - Address space ID * Address - Start address * Length - Length * Warn - TRUE if warning on overlap desired * * RETURN: Count of the number of conflicts detected. * * DESCRIPTION: Check if the input address range overlaps any of the * ASL operation region address ranges. * ****************************************************************************/ UINT32 AcpiCheckAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, ACPI_SIZE Length, BOOLEAN Warn) { UINT32 Overlaps; ACPI_STATUS Status; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return (0); } Overlaps = AcpiUtCheckAddressRange (SpaceId, Address, (UINT32) Length, Warn); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Overlaps); } ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange) #endif /* !ACPI_ASL_COMPILER */ /******************************************************************************* * * FUNCTION: AcpiDecodePldBuffer * * PARAMETERS: InBuffer - Buffer returned by _PLD method * Length - Length of the InBuffer * ReturnBuffer - Where the decode buffer is returned * * RETURN: Status and the decoded _PLD buffer. User must deallocate * the buffer via ACPI_FREE. * * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into * a local struct that is much more useful to an ACPI driver. * ******************************************************************************/ ACPI_STATUS AcpiDecodePldBuffer ( UINT8 *InBuffer, ACPI_SIZE Length, ACPI_PLD_INFO **ReturnBuffer) { ACPI_PLD_INFO *PldInfo; UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer); UINT32 Dword; /* Parameter validation */ if (!InBuffer || !ReturnBuffer || (Length < ACPI_PLD_REV1_BUFFER_SIZE)) { return (AE_BAD_PARAMETER); } PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO)); if (!PldInfo) { return (AE_NO_MEMORY); } /* First 32-bit DWord */ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); PldInfo->Red = ACPI_PLD_GET_RED (&Dword); PldInfo->Green = ACPI_PLD_GET_GREEN (&Dword); PldInfo->Blue = ACPI_PLD_GET_BLUE (&Dword); /* Second 32-bit DWord */ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]); PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword); PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword); /* Third 32-bit DWord */ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]); PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword); PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword); PldInfo->Lid = ACPI_PLD_GET_LID (&Dword); PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword); PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword); PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword); PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword); PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword); PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword); PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword); PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword); /* Fourth 32-bit DWord */ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]); PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword); PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword); PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword); PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword); PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword); PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); if (Length >= ACPI_PLD_REV2_BUFFER_SIZE) { /* Fifth 32-bit DWord (Revision 2 of _PLD) */ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]); PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword); PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword); } *ReturnBuffer = PldInfo; return (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer)
{ "content_hash": "6ee8ad62801199a43c4ce2a744d045b4", "timestamp": "", "source": "github", "line_count": 715, "max_line_length": 80, "avg_line_length": 30.801398601398603, "alnum_prop": 0.5892930118512464, "repo_name": "mrtska/StarRing", "id": "a8aeef6acc5d83d122b6fe70ab573e3f52cdebb7", "size": "22023", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "acpica/utilities/utxface.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "9433" }, { "name": "C", "bytes": "4728327" }, { "name": "C++", "bytes": "327257" }, { "name": "JavaScript", "bytes": "1056" }, { "name": "Makefile", "bytes": "8014" }, { "name": "Objective-C", "bytes": "123" } ], "symlink_target": "" }
package org.wso2.carbon.core.transports.util; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisService; import org.apache.http.HttpStatus; import org.apache.http.protocol.HTTP; import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils; import org.wso2.carbon.core.transports.CarbonHttpRequest; import org.wso2.carbon.core.transports.CarbonHttpResponse; import org.wso2.carbon.core.transports.HttpGetRequestProcessor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * */ public class InfoProcessor implements HttpGetRequestProcessor { public void process(CarbonHttpRequest request, CarbonHttpResponse response, ConfigurationContext configurationContext) throws Exception { String requestURI = request.getRequestURI(); String contextPath = configurationContext.getServiceContextPath(); String serviceName = requestURI.substring(requestURI.indexOf(contextPath) + contextPath.length() + 1); AxisService axisService = configurationContext.getAxisConfiguration().getServiceForActivation(serviceName); if (axisService == null) { // Try to see whether the service is available in a tenant axisService = TenantAxisUtils.getAxisService(serviceName, configurationContext); } if (!RequestProcessorUtil.canExposeServiceMetadata(axisService)) { response.setError(HttpStatus.SC_FORBIDDEN, "Access to service metadata for service: " + serviceName + " has been forbidden"); return; } String serviceHtml = ServiceHTMLProcessor.printServiceHTML( serviceName, configurationContext); if (serviceHtml != null) { response.setStatus(HttpStatus.SC_OK); response.addHeader(HTTP.CONTENT_TYPE, "text/html"); response.getOutputStream().write(serviceHtml.getBytes()); } } }
{ "content_hash": "86c4f9fa45e5527cf63b141e3663d163", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 97, "avg_line_length": 42.59183673469388, "alnum_prop": 0.6914230953521802, "repo_name": "maheshika/carbon4-kernel", "id": "c9751d08294e647ee1694159589ed859308db401", "size": "2699", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/transports/util/InfoProcessor.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "332285" }, { "name": "Java", "bytes": "8868082" }, { "name": "JavaScript", "bytes": "1359280" }, { "name": "PHP", "bytes": "15326" }, { "name": "Shell", "bytes": "63102" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>Description of change_shallow_bathy</title> <meta name="keywords" content="change_shallow_bathy"> <meta name="description" content="Deepens shallow nodes by setting a minimum depth and making nodes that"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin"> <meta name="robots" content="index, follow"> <link type="text/css" rel="stylesheet" href="../m2html.css"> </head> <body> <a name="_top"></a> <div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_prepro</a> &gt; change_shallow_bathy.m</div> <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td> <td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--> <h1>change_shallow_bathy </h1> <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> <div class="box"><strong>Deepens shallow nodes by setting a minimum depth and making nodes that</strong></div> <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> <div class="box"><strong>function M = change_shallow_bathy(M, min_depth) </strong></div> <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> <div class="fragment"><pre class="comment"> Deepens shallow nodes by setting a minimum depth and making nodes that are too shallow the mean of the surrouding deep nodes. Loop until all nodes are deeper than the minuimum depth required. function [M]=change_shallow_bathy(M, min_depth) DESCRIPTION: INPUT: M = Mesh object min_depth = the minimum depth of nodes OUTPUT: Nested Mesh object with altered bathymetry. EXAMPLE USAGE: Author(s): Rory O'Hara Murray (Marine Scotland Science) Revision history: 2014 sometime - first version ==========================================================================</pre></div> <!-- crossreference --> <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> This function calls: <ul style="list-style-image:url(../matlabicon.gif)"> </ul> This function is called by: <ul style="list-style-image:url(../matlabicon.gif)"> </ul> <!-- crossreference --> <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function M = change_shallow_bathy(M, min_depth)</a> 0002 <span class="comment">% Deepens shallow nodes by setting a minimum depth and making nodes that</span> 0003 <span class="comment">% are too shallow the mean of the surrouding deep nodes. Loop until all</span> 0004 <span class="comment">% nodes are deeper than the minuimum depth required.</span> 0005 <span class="comment">%</span> 0006 <span class="comment">% function [M]=change_shallow_bathy(M, min_depth)</span> 0007 <span class="comment">%</span> 0008 <span class="comment">% DESCRIPTION:</span> 0009 <span class="comment">%</span> 0010 <span class="comment">% INPUT:</span> 0011 <span class="comment">% M = Mesh object</span> 0012 <span class="comment">% min_depth = the minimum depth of nodes</span> 0013 <span class="comment">%</span> 0014 <span class="comment">% OUTPUT:</span> 0015 <span class="comment">% Nested Mesh object with altered bathymetry.</span> 0016 <span class="comment">%</span> 0017 <span class="comment">% EXAMPLE USAGE:</span> 0018 <span class="comment">%</span> 0019 <span class="comment">%</span> 0020 <span class="comment">% Author(s):</span> 0021 <span class="comment">% Rory O'Hara Murray (Marine Scotland Science)</span> 0022 <span class="comment">%</span> 0023 <span class="comment">% Revision history:</span> 0024 <span class="comment">% 2014 sometime - first version</span> 0025 <span class="comment">%</span> 0026 <span class="comment">%==========================================================================</span> 0027 0028 count = 0; 0029 h=-99; <span class="comment">% just to start</span> 0030 0031 <span class="keyword">while</span> sum(h==-99)&gt;0 0032 count=count+1; 0033 disp([<span class="string">'iteration # '</span> num2str(count)]) 0034 I = M.h&lt;=min_depth; <span class="comment">% find shallow nodes as depth is +ve down.</span> 0035 If = find(I); 0036 h = []; 0037 0038 <span class="comment">% loop through all shallow nodes with depth&lt;=min_depth</span> 0039 <span class="keyword">for</span> ii=1:length(If) 0040 0041 <span class="comment">% find elements surrounding the shallow node</span> 0042 test = []; 0043 <span class="keyword">for</span> jj=1:3 0044 test = [test; find(M.tri(:,jj)==If(ii))]; 0045 <span class="keyword">end</span> 0046 <span class="comment">% find nodes for all these elements surrounding the shallow node</span> 0047 <span class="comment">% (the surrounding nodes)</span> 0048 nodes = unique(M.tri(test,:)); 0049 0050 htmp = M.h(nodes); 0051 bla = htmp&gt;min_depth; <span class="comment">% find the nodes that are deeper than min_depth</span> 0052 <span class="keyword">if</span> sum(bla)&gt;0 0053 h(ii) = mean(htmp(bla));<span class="comment">% make the shallow node the mean of the surrounding nodes deeper than min_depth</span> 0054 <span class="keyword">else</span> 0055 h(ii) = -99; <span class="comment">% id no deep surroundign nodes then make it -99 and try again.</span> 0056 <span class="keyword">end</span> 0057 <span class="keyword">end</span> 0058 M.h(I) = h; <span class="comment">% save changes to the Mobj array.</span> 0059 <span class="keyword">end</span> 0060 0061 <span class="keyword">end</span></pre></div> <hr><address>Generated on Wed 20-Feb-2019 16:06:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address> </body> </html>
{ "content_hash": "26d3e6c397c5bebfc2672094d538df92", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 197, "avg_line_length": 48.39393939393939, "alnum_prop": 0.6452723857232311, "repo_name": "pwcazenave/fvcom-toolbox", "id": "cab3b47a20fc565caff8e5d421bd83d5376f5031", "size": "6388", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/fvcom_prepro/change_shallow_bathy.html", "mode": "33188", "license": "mit", "language": [ { "name": "Fortran", "bytes": "1745" }, { "name": "MATLAB", "bytes": "1331266" }, { "name": "Shell", "bytes": "309" }, { "name": "Tcl", "bytes": "17023" } ], "symlink_target": "" }
#include "server_http.hpp" //Added for the json-example #define BOOST_SPIRIT_THREADSAFE #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace std; //Added for the json-example: using namespace boost::property_tree; typedef SimpleWeb::Server<SimpleWeb::HTTP> HttpServer; int main() { //HTTP-server at port 8080 using 1 thread //Unless you do more heavy non-threaded processing in the resources, //1 thread is usually faster than several threads HttpServer server(8080, 1); //Add resources using path-regex and method-string, and an anonymous function //POST-example for the path /string, responds the posted string server.resource["^/string$"]["POST"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) { //Retrieve string: auto content=request->content.string(); //request->content.string() is a convenience function for: //stringstream ss; //ss << request->content.rdbuf(); //string content=ss.str(); *response << "HTTP/1.1 200 OK\r\nContent-Length: " << content.length() << "\r\n\r\n" << content; }; //POST-example for the path /json, responds firstName+" "+lastName from the posted json //Responds with an appropriate error message if the posted json is not valid, or if firstName or lastName is missing //Example posted json: //{ // "firstName": "John", // "lastName": "Smith", // "age": 25 //} server.resource["^/json$"]["POST"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) { try { ptree pt; read_json(request->content, pt); string name=pt.get<string>("firstName")+" "+pt.get<string>("lastName"); *response << "HTTP/1.1 200 OK\r\n" << "Content-Type: application/json\r\n" << "Content-Length: " << name.length() << "\r\n\r\n" << name; } catch(exception& e) { *response << "HTTP/1.1 400 Bad Request\r\nContent-Length: " << strlen(e.what()) << "\r\n\r\n" << e.what(); } }; //GET-example for the path /info //Responds with request-information server.resource["^/info$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) { stringstream content_stream; content_stream << "<h1>Request from " << request->remote_endpoint_address << " (" << request->remote_endpoint_port << ")</h1>"; content_stream << request->method << " " << request->path << " HTTP/" << request->http_version << "<br>"; for(auto& header: request->header) { content_stream << header.first << ": " << header.second << "<br>"; } //find length of content_stream (length received using content_stream.tellp()) content_stream.seekp(0, ios::end); *response << "HTTP/1.1 200 OK\r\nContent-Length: " << content_stream.tellp() << "\r\n\r\n" << content_stream.rdbuf(); }; //GET-example for the path /match/[number], responds with the matched string in path (number) //For instance a request GET /match/123 will receive: 123 server.resource["^/match/([0-9]+)$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) { string number=request->path_match[1]; *response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number; }; //Get example simulating heavy work in a separate thread server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) { thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); string message="Work done"; *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; }); work_thread.detach(); }; //Default GET-example. If no other matches, this anonymous function will be called. //Can for instance be used to retrieve an HTML 5 client that uses REST-resources on this server server.default_resource["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) { std::string content= "Could not open path " + request->path; *response << "HTTP/1.1 404 Bad Request\r\nContent-Length: " << content.length() << "\r\n\r\n" << content; }; server.start(); return 0; }
{ "content_hash": "96a4b07b3a4754490976ab6cd2f743f9", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 143, "avg_line_length": 45.549019607843135, "alnum_prop": 0.6123547137322428, "repo_name": "weclaw1/aws_tsp", "id": "7dd7738cef56a842449404d6f2e78cfd9dd3773c", "size": "4646", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tsp_core/src/rest_server/http_examples.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "7397335" }, { "name": "C++", "bytes": "950179" }, { "name": "CMake", "bytes": "5334" }, { "name": "HTML", "bytes": "1597" }, { "name": "Java", "bytes": "530" }, { "name": "JavaScript", "bytes": "7930" }, { "name": "Objective-C", "bytes": "498184" } ], "symlink_target": "" }
layout: redirect title: "Google Chrome" moved_to: blog/2008/google-chrome/ ---
{ "content_hash": "184d6f9909f9ea46e7ee9ad1e5eacbc6", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 34, "avg_line_length": 19.75, "alnum_prop": 0.7341772151898734, "repo_name": "tommy-carlier/blog.tcx.be", "id": "0442e39c50072d4fa23a3aca771806bb3eccc0ca", "size": "83", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "_posts/2008-09-07-google-chrome.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "891" }, { "name": "HTML", "bytes": "11012" } ], "symlink_target": "" }
<@pp.dropOutputFile /> <#macro doError> { byte[] buf = new byte[in.end - in.start]; in.buffer.getBytes(in.start, buf, 0, in.end - in.start); throw new NumberFormatException(new String(buf, com.google.common.base.Charsets.UTF_8)); } </#macro> <#list cast.types as type> <#if type.major == "EmptyString"> <@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/gcast/CastEmptyString${type.from}To${type.to}.java" /> <#include "/@includes/license.ftl" /> package org.apache.drill.exec.expr.fn.impl.gcast; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.*; import org.apache.drill.exec.record.RecordBatch; import javax.inject.Inject; import io.netty.buffer.DrillBuf; /** * This file is generated with Freemarker using the template exec/java-exec/src/main/codegen/templates/CastEmptyStringVarTypesToNullableNumeric.java */ @SuppressWarnings("unused") @FunctionTemplate(name = "castEmptyString${type.from}To${type.to?upper_case}", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls=NullHandling.INTERNAL) public class CastEmptyString${type.from}To${type.to} implements DrillSimpleFunc{ @Param ${type.from}Holder in; @Output ${type.to}Holder out; public void setup() {} public void eval() { <#if type.to == "NullableFloat4" || type.to == "NullableFloat8"> if(<#if type.from == "NullableVarChar" || type.from == "NullableVar16Char" || type.from == "NullableVarBinary">in.isSet == 0 || </#if>in.end == in.start) { out.isSet = 0; } else{ out.isSet = 1; byte[]buf=new byte[in.end-in.start]; in.buffer.getBytes(in.start,buf,0,in.end-in.start); out.value=${type.javaType}.parse${type.parse}(new String(buf,com.google.common.base.Charsets.UTF_8)); } <#elseif type.to=="NullableInt"> if(<#if type.from == "NullableVarChar" || type.from == "NullableVar16Char" || type.from == "NullableVarBinary">in.isSet == 0 || </#if>in.end == in.start) { out.isSet = 0; } else { out.isSet = 1; out.value = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.varTypesToInt(in.start, in.end, in.buffer); } <#elseif type.to == "NullableBigInt"> if(<#if type.from == "NullableVarChar" || type.from == "NullableVar16Char" || type.from == "NullableVarBinary">in.isSet == 0 || </#if> in.end == in.start) { out.isSet = 0; } else { out.isSet = 1; out.value = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.varTypesToLong(in.start, in.end, in.buffer); } </#if> } } </#if> <#-- type.major --> </#list>
{ "content_hash": "b3119039d1b363e21d6095f8fa3fe21d", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 154, "avg_line_length": 40, "alnum_prop": 0.6424342105263158, "repo_name": "sohami/drill", "id": "e0942e9df73c0746f28d634e72b78c281cc742ad", "size": "3841", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "exec/java-exec/src/main/codegen/templates/CastEmptyStringVarTypesToNullableNumeric.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6718" }, { "name": "C", "bytes": "31425" }, { "name": "C++", "bytes": "587532" }, { "name": "CMake", "bytes": "24811" }, { "name": "CSS", "bytes": "14536" }, { "name": "Dockerfile", "bytes": "1440" }, { "name": "FreeMarker", "bytes": "141811" }, { "name": "GAP", "bytes": "16764" }, { "name": "Java", "bytes": "24085532" }, { "name": "JavaScript", "bytes": "78377" }, { "name": "PLSQL", "bytes": "6665" }, { "name": "Python", "bytes": "5388" }, { "name": "Shell", "bytes": "99816" } ], "symlink_target": "" }
/**************************************************************************//** * @file efr32bg14p_vdac_opa.h * @brief EFR32BG14P_VDAC_OPA register and bit field definitions * @version 5.4.0 ****************************************************************************** * # License * <b>Copyright 2017 Silicon Laboratories, Inc. www.silabs.com</b> ****************************************************************************** * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software.@n * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software.@n * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc. * has no obligation to support this Software. Silicon Laboratories, Inc. is * providing the Software "AS IS", with no express or implied warranties of any * kind, including, but not limited to, any implied warranties of * merchantability or fitness for any particular purpose or warranties against * infringement of any proprietary rights of a third party. * * Silicon Laboratories, Inc. will not be liable for any consequential, * incidental, or special damages, or any other relief, or for any claim by * any third party, arising from your use of this Software. * *****************************************************************************/ #ifdef __cplusplus extern "C" { #endif #if defined(__ICCARM__) #pragma system_include /* Treat file as system include file. */ #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #pragma clang system_header /* Treat file as system include file. */ #endif /**************************************************************************//** * @addtogroup Parts * @{ ******************************************************************************/ /**************************************************************************//** * @brief VDAC_OPA VDAC OPA Register * @ingroup EFR32BG14P_VDAC *****************************************************************************/ typedef struct { __IM uint32_t APORTREQ; /**< Operational Amplifier APORT Request Status Register */ __IM uint32_t APORTCONFLICT; /**< Operational Amplifier APORT Conflict Status Register */ __IOM uint32_t CTRL; /**< Operational Amplifier Control Register */ __IOM uint32_t TIMER; /**< Operational Amplifier Timer Control Register */ __IOM uint32_t MUX; /**< Operational Amplifier Mux Configuration Register */ __IOM uint32_t OUT; /**< Operational Amplifier Output Configuration Register */ __IOM uint32_t CAL; /**< Operational Amplifier Calibration Register */ uint32_t RESERVED0[1]; /**< Reserved future */ } VDAC_OPA_TypeDef; /** @} End of group Parts */ #ifdef __cplusplus } #endif
{ "content_hash": "48424efa701ce3e4c82491c0ae66f6d9", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 93, "avg_line_length": 47.3134328358209, "alnum_prop": 0.5678233438485805, "repo_name": "basilfx/EFM2Riot", "id": "0416560ce10b81ddddcfb5175314a8840453b67d", "size": "3170", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dist-development/cpu/efm32/families/efr32bg14p/include/vendor/efr32bg14p_vdac_opa.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "123091276" }, { "name": "C++", "bytes": "71845" }, { "name": "HTML", "bytes": "18340" }, { "name": "Makefile", "bytes": "14387" }, { "name": "Python", "bytes": "34071" }, { "name": "Shell", "bytes": "995" } ], "symlink_target": "" }
package ru.job4j.school; import java.util.Objects; /** * class Student. */ public class Student { /** * score. */ private int score; /** * name. */ private String name; /** * getter for name. * @return name */ public String getName() { return name; } /** * constructor for Student. * @param score score * @param name name */ public Student(int score, String name) { this.score = score; this.name = name; } /** * constructor for Stident. * @param score score */ public Student(int score) { this.score = score; } /** * @return score. */ public int getScore() { return score; } /** * Set store. * @param score score */ public void setScore(int score) { this.score = score; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Student student = (Student) o; return score == student.score && Objects.equals(name, student.name); } @Override public int hashCode() { return Objects.hash(score, name); } }
{ "content_hash": "15b0e7bb0e4554195af3d4a8c4d3129d", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 55, "avg_line_length": 17.57894736842105, "alnum_prop": 0.48877245508982037, "repo_name": "mixed2004/borisovm", "id": "e6e2537449d6433a48f18540b8c744a32341eef7", "size": "1336", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chapter_004/src/main/java/ru/job4j/school/Student.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "182123" } ], "symlink_target": "" }
A single image on a spritesheet. @class Sprite ]=] local Sprite = {} Sprite.ClassName = "Sprite" Sprite.__index = Sprite --[=[ Data used to construct a sprite. @interface SpriteData .Texture string .Size Vector2 .Position Vector2 .Name string @within Sprite ]=] --[=[ Constructs a new sprite @param data SpriteData @return Sprite ]=] function Sprite.new(data) assert(data.Texture, "Bad data") assert(data.Size, "Bad data") assert(data.Position, "Bad data") assert(data.Name, "Bad data") local self = setmetatable(data, Sprite) return self end --[=[ Applies the styling to the gui @param gui ImageLabel | ImageButton @return Instance ]=] function Sprite:Style(gui) gui.Image = self.Texture gui.ImageRectOffset = self.Position gui.ImageRectSize = self.Size return gui end --[=[ Returns a new sprite with the specified `instanceType` @param instanceType "ImageLabel" | "ImageButton" @return ImageLabel | ImageButton ]=] function Sprite:Get(instanceType) local gui = Instance.new(instanceType) gui.Size = UDim2.new(0, self.Size.X, 0, self.Size.Y) gui.Name = self.Name gui.BackgroundTransparency = 1 gui.BorderSizePixel = 1 self:Style(gui) return gui end return Sprite
{ "content_hash": "7f1dcf440c570c95dbc3aadb502db3d3", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 55, "avg_line_length": 18.6, "alnum_prop": 0.7237386269644334, "repo_name": "Quenty/NevermoreEngine", "id": "ed76c1bb69d62fa15b2358032bc42a786b04c075", "size": "1215", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/sprites/src/Shared/Sprite/Sprite.lua", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "692" }, { "name": "JavaScript", "bytes": "911" }, { "name": "Lua", "bytes": "2141833" }, { "name": "Python", "bytes": "6801" }, { "name": "TypeScript", "bytes": "7456" } ], "symlink_target": "" }
require 'commander' require 'fastlane/version' require_relative 'download_screenshots' require_relative 'options' require_relative 'module' require_relative 'generate_summary' require_relative 'runner' HighLine.track_eof = false module Deliver class CommandsGenerator include Commander::Methods def self.start self.new.run end def deliverfile_options(skip_verification: false) available_options = Deliver::Options.available_options return available_options unless skip_verification # These don't matter for downloading metadata, so verification can be skipped irrelevant_options_keys = [:ipa, :pkg, :app_rating_config_path] available_options.each do |opt| next unless irrelevant_options_keys.include?(opt.key) opt.verify_block = nil opt.conflicting_options = nil end return available_options end def self.force_overwrite_metadata?(options, path) res = options[:force] res ||= ENV["DELIVER_FORCE_OVERWRITE"] # for backward compatibility res ||= UI.confirm("Do you want to overwrite existing metadata on path '#{File.expand_path(path)}'?") if UI.interactive? res end def run program :name, 'deliver' program :version, Fastlane::VERSION program :description, Deliver::DESCRIPTION program :help, 'Author', 'Felix Krause <deliver@krausefx.com>' program :help, 'Website', 'https://fastlane.tools' program :help, 'Documentation', 'https://docs.fastlane.tools/actions/deliver/' program :help_formatter, :compact global_option('--verbose') { FastlaneCore::Globals.verbose = true } always_trace! command :run do |c| c.syntax = 'fastlane deliver' c.description = 'Upload metadata and binary to iTunes Connect' FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| options = FastlaneCore::Configuration.create(deliverfile_options, options.__hash__) loaded = options.load_configuration_file("Deliverfile") # Check if we already have a deliver setup in the current directory loaded = true if options[:description] || options[:ipa] || options[:pkg] loaded = true if File.exist?(File.join(FastlaneCore::FastlaneFolder.path || ".", "metadata")) unless loaded if UI.confirm("No deliver configuration found in the current directory. Do you want to setup deliver?") is_swift = UI.confirm("Would you like to use Swift instead of Ruby?") require 'deliver/setup' Deliver::Runner.new(options) # to login... Deliver::Setup.new.run(options, is_swift: is_swift) return 0 end end Deliver::Runner.new(options).run end end command :submit_build do |c| c.syntax = 'fastlane deliver submit_build' c.description = 'Submit a specific build-nr for review, use latest for the latest build' FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| options = FastlaneCore::Configuration.create(deliverfile_options, options.__hash__) options.load_configuration_file("Deliverfile") options[:submit_for_review] = true options[:build_number] = "latest" unless options[:build_number] Deliver::Runner.new(options).run end end command :init do |c| c.syntax = 'fastlane deliver init' c.description = 'Create the initial `deliver` configuration based on an existing app' FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| if File.exist?("Deliverfile") or File.exist?("fastlane/Deliverfile") UI.important("You already have a running deliver setup in this directory") return 0 end require 'deliver/setup' options = FastlaneCore::Configuration.create(deliverfile_options, options.__hash__) options[:run_precheck_before_submit] = false # precheck doesn't need to run during init Deliver::Runner.new(options) # to login... Deliver::Setup.new.run(options) end end command :generate_summary do |c| c.syntax = 'fastlane deliver generate_summary' c.description = 'Generate HTML Summary without uploading/downloading anything' FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| options = FastlaneCore::Configuration.create(deliverfile_options, options.__hash__) options.load_configuration_file("Deliverfile") Deliver::Runner.new(options) html_path = Deliver::GenerateSummary.new.run(options) UI.success("Successfully generated HTML report at '#{html_path}'") system("open '#{html_path}'") unless options[:force] end end command :download_screenshots do |c| c.syntax = 'fastlane deliver download_screenshots' c.description = "Downloads all existing screenshots from iTunes Connect and stores them in the screenshots folder" FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| options = FastlaneCore::Configuration.create(deliverfile_options(skip_verification: true), options.__hash__) options.load_configuration_file("Deliverfile") Deliver::Runner.new(options, skip_version: true) # to login... containing = FastlaneCore::Helper.fastlane_enabled_folder_path path = options[:screenshots_path] || File.join(containing, 'screenshots') Deliver::DownloadScreenshots.run(options, path) end end command :download_metadata do |c| c.syntax = 'fastlane deliver download_metadata' c.description = "Downloads existing metadata and stores it locally. This overwrites the local files." FastlaneCore::CommanderGenerator.new.generate(deliverfile_options, command: c) c.action do |args, options| options = FastlaneCore::Configuration.create(deliverfile_options(skip_verification: true), options.__hash__) options.load_configuration_file("Deliverfile") Deliver::Runner.new(options) # to login... containing = FastlaneCore::Helper.fastlane_enabled_folder_path path = options[:metadata_path] || File.join(containing, 'metadata') res = Deliver::CommandsGenerator.force_overwrite_metadata?(options, path) return 0 unless res require 'deliver/setup' v = options[:app].latest_version if options[:app_version].to_s.length > 0 v = options[:app].live_version if v.version != options[:app_version] if v.version != options[:app_version] raise "Neither the current nor live version match specified app_version \"#{options[:app_version]}\"" end end Deliver::Setup.new.generate_metadata_files(v, path) end end default_command(:run) run! end # rubocop:enable Metrics/PerceivedComplexity end end
{ "content_hash": "1829710394e6352a8ad94487d8ef1065", "timestamp": "", "source": "github", "line_count": 186, "max_line_length": 126, "avg_line_length": 39.456989247311824, "alnum_prop": 0.6570377435617931, "repo_name": "luongm/fastlane", "id": "b15c68a370ac5ae02b6a0ccc98deb418964f15ce", "size": "7339", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "deliver/lib/deliver/commands_generator.rb", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "45370" }, { "name": "Java", "bytes": "30810" }, { "name": "JavaScript", "bytes": "39" }, { "name": "Matlab", "bytes": "115" }, { "name": "Objective-C", "bytes": "69198" }, { "name": "Ruby", "bytes": "4031573" }, { "name": "Shell", "bytes": "45206" }, { "name": "Swift", "bytes": "441044" } ], "symlink_target": "" }
define('admin/plugins/sql-auth', ['settings'], function(Settings) { 'use strict'; /* globals $, app, socket, require */ var ACP = {}; ACP.init = function() { Settings.load('sql-auth', $('.sql-auth-settings')); $('#save').on('click', function() { Settings.save('sql-auth', $('.sql-auth-settings'), function() { app.alert({ type: 'success', alert_id: 'sql-auth-saved', title: 'Settings Saved', message: 'Please reload your NodeBB to apply these settings', clickfn: function() { socket.emit('admin.reload'); } }); }); }); }; return ACP; });
{ "content_hash": "91158b7a70621e72903cdb078cec5121", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 67, "avg_line_length": 23.192307692307693, "alnum_prop": 0.5754560530679934, "repo_name": "zetas/nodebb-plugin-sql-auth", "id": "090bca119014d91fad3199cae878cf14c096c145", "size": "603", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "static/lib/admin.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2600" }, { "name": "Smarty", "bytes": "2833" } ], "symlink_target": "" }
<script src="javascripts/lib/jquery-2.0.3.min.js"></script> <script src="javascripts/seq_page_controls.js"></script> <script src="javascripts/seq_responsive_gallery.js"></script> <script> $(function(){ new SEQ.page_controls.Menu($('header .site-menu'), $('header .site-menu-control')); }); </script>
{ "content_hash": "a1c8a83a347be7707d13570b79ab2c26", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 87, "avg_line_length": 34.333333333333336, "alnum_prop": 0.6828478964401294, "repo_name": "amster/responsive_album", "id": "9ee788d94e8aec7bf5906484e9024db48b439f29", "size": "309", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_includes/javascripts.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1750" }, { "name": "JavaScript", "bytes": "7808" }, { "name": "Ruby", "bytes": "22" } ], "symlink_target": "" }
<?php include 'init_local.php'; loadlib('wof_repo'); $rsp = db_fetch(" SELECT repo FROM boundaryissues_repo "); if (! $rsp['ok']) { echo "Could not load repos from db\n"; exit; } $db_repos = array(); foreach ($rsp['rows'] as $row) { $db_repos[] = $row['repo']; } $dh = opendir('/usr/local/data'); while ($file = readdir($dh)) { if (preg_match('/^whosonfirst-data.*/', $file)) { if (! in_array($file, $db_repos)) { // The repo is checked out, but not in the db echo "$file: initialize db\n"; wof_repo_init($file); } else { // Remove the repo from the queue to be cloned $index = array_search($repo, $db_repos); $db_repos = array_splice($db_repos, $index, 1); } } } // Remaining repos need to be cloned foreach ($db_repos as $repo) { $rsp = offline_tasks_schedule_task('clone_repo', array( 'repo' => $repo )); }
{ "content_hash": "d04828a747acb9ed8523a6738612ece6", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 56, "avg_line_length": 20.75609756097561, "alnum_prop": 0.6028202115158637, "repo_name": "whosonfirst/whosonfirst-www-boundaryissues", "id": "eee23fd01fc7f2593f604005bf90359a701c8c33", "size": "851", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bin/sync_repos.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "237169" }, { "name": "JavaScript", "bytes": "2886606" }, { "name": "Makefile", "bytes": "8889" }, { "name": "PHP", "bytes": "1031625" }, { "name": "Python", "bytes": "21491" }, { "name": "Shell", "bytes": "43551" }, { "name": "Smarty", "bytes": "3562" }, { "name": "Standard ML", "bytes": "833" } ], "symlink_target": "" }
package com.gemstone.gemfire.security; import java.util.Properties; import com.gemstone.gemfire.LogWriter; import com.gemstone.gemfire.cache.CacheCallback; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; // TODO Add example usage of this interface and configuration details /** * Specifies the mechanism to obtain credentials for a client or peer. It is * mandatory for clients and peers when running in secure mode and an * {@link Authenticator} has been configured on the server/locator side * respectively. Implementations should register name of the static creation * function (that returns an object of the class) as the * <i>security-peer-auth-init</i> system property on peers and as the * <i>security-client-auth-init</i> system property on clients. * * @author Neeraj Kumar * @since 5.5 */ public interface AuthInitialize extends CacheCallback { /** * Initialize the callback for a client/peer. This is invoked when a new * connection from a client/peer is created with the host. * * @param systemLogger * {@link LogWriter} for system logs * @param securityLogger * {@link LogWriter} for security logs * * @throws AuthenticationFailedException * if some exception occurs during the initialization */ public void init(LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException; /** * Initialize with the given set of security properties and return the * credentials for the peer/client as properties. * * This method can modify the given set of properties. For example it may * invoke external agents or even interact with the user. * * Normally it is expected that implementations will filter out <i>security-*</i> * properties that are needed for credentials and return only those. * * @param securityProps * the security properties obtained using a call to * {@link DistributedSystem#getSecurityProperties} that will be * used for obtaining the credentials * @param server * the {@link DistributedMember} object of the * server/group-coordinator to which connection is being * attempted * @param isPeer * true when this is invoked for peer initialization and false * when invoked for client initialization * * @throws AuthenticationFailedException * in case of failure to obtain the credentials * * @return the credentials to be used for the given <code>server</code> */ public Properties getCredentials(Properties securityProps, DistributedMember server, boolean isPeer) throws AuthenticationFailedException; }
{ "content_hash": "3e8a51fd97e62bbb75da52d7775554c1", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 83, "avg_line_length": 39.273972602739725, "alnum_prop": 0.699337286362051, "repo_name": "gemxd/gemfirexd-oss", "id": "5e9a752613de63b7bb0780eaf04fb99aad6d684e", "size": "3532", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/security/AuthInitialize.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AGS Script", "bytes": "90653" }, { "name": "Assembly", "bytes": "962433" }, { "name": "Batchfile", "bytes": "30248" }, { "name": "C", "bytes": "311620" }, { "name": "C#", "bytes": "1352292" }, { "name": "C++", "bytes": "2030283" }, { "name": "CSS", "bytes": "54987" }, { "name": "Gnuplot", "bytes": "3125" }, { "name": "HTML", "bytes": "8609160" }, { "name": "Java", "bytes": "118027963" }, { "name": "JavaScript", "bytes": "33027" }, { "name": "Makefile", "bytes": "18443" }, { "name": "Mathematica", "bytes": "92588" }, { "name": "Objective-C", "bytes": "1069" }, { "name": "PHP", "bytes": "581417" }, { "name": "PLSQL", "bytes": "86549" }, { "name": "PLpgSQL", "bytes": "33847" }, { "name": "Pascal", "bytes": "808" }, { "name": "Perl", "bytes": "196843" }, { "name": "Python", "bytes": "12796" }, { "name": "Ruby", "bytes": "1380" }, { "name": "SQLPL", "bytes": "219147" }, { "name": "Shell", "bytes": "533575" }, { "name": "SourcePawn", "bytes": "22351" }, { "name": "Thrift", "bytes": "33033" }, { "name": "XSLT", "bytes": "67112" } ], "symlink_target": "" }
Sequel.migration do change do create_table :queries do primary_key :id Integer :timestamp String :query String :ip_hash end end end
{ "content_hash": "9b6b4234241b99cea67a2aff3f2f9f83", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 28, "avg_line_length": 16.8, "alnum_prop": 0.625, "repo_name": "justinj/reconstruction-database", "id": "3aa6068d6b1e83afb2851a569f2b91c189382b34", "size": "168", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "db/migrations/25_add_queries_table.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "992" }, { "name": "HTML", "bytes": "20557" }, { "name": "JavaScript", "bytes": "2034" }, { "name": "Ruby", "bytes": "71635" } ], "symlink_target": "" }
package org.openqa.grid.internal; import org.openqa.grid.common.RegistrationRequest; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.HashMap; import java.util.List; import java.util.Map; @SuppressWarnings({"JavaDoc"}) public class RemoteProxyFactory { /** * Create a simple proxy with 1 capability : {"browserName=appName"} and the configuration * {"url=url"} * * @param browser * @param url * @param registry * @return */ public static RemoteProxy getNewBasicRemoteProxy(String browser, String url, Registry registry) { RegistrationRequest req = RegistrationRequest.build("-role", "webdriver","-host","localhost"); req.getCapabilities().clear(); DesiredCapabilities capability = new DesiredCapabilities(); capability.setBrowserName(browser); req.addDesiredCapability(capability); Map<String, Object> config = new HashMap<String, Object>(); config.put(RegistrationRequest.REMOTE_HOST, url); req.setConfiguration(config); return createProxy(registry, req); } /** * Create a simple proxy with the 1 capability specified as parameter and the configuration * {"url=url"} * * @param cap * @param url * @param registry * @return */ public static RemoteProxy getNewBasicRemoteProxy(Map<String, Object> cap, String url, Registry registry) { RegistrationRequest req = RegistrationRequest.build("-role", "webdriver", "-host", "localhost", "-" + RegistrationRequest.HUB_HOST, "localhost"); req.getCapabilities().clear(); req.addDesiredCapability(cap); req.getConfiguration().put(RegistrationRequest.REMOTE_HOST, url); return createProxy(registry, req); } /** * Create a simple proxy with the the list of capabilities specified as parameter and the * configuration {"url=url"} * * @param caps * @param url * @param registry * @return */ public static RemoteProxy getNewBasicRemoteProxy(List<Map<String, Object>> caps, String url, Registry registry) { RegistrationRequest req = RegistrationRequest.build("-role", "webdriver","-host","localhost", "-" + RegistrationRequest.HUB_HOST, "localhost"); req.getCapabilities().clear(); for (Map<String, Object> c : caps) { req.addDesiredCapability(c); } req.getConfiguration().put(RegistrationRequest.REMOTE_HOST, url); return createProxy(registry, req); } private static RemoteProxy createProxy(Registry registry, RegistrationRequest req) { final RemoteProxy remoteProxy = new DetachedRemoteProxy(req, registry); remoteProxy.setupTimeoutListener(); return remoteProxy; } }
{ "content_hash": "ae7be3784b3fd45ac27cba87b44a6a8f", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 99, "avg_line_length": 32.07692307692308, "alnum_prop": 0.6423432682425488, "repo_name": "cisco-open-source/selenium", "id": "c8a779ed0c25ea51f545555e7cbb2a0f344995af", "size": "3529", "binary": false, "copies": "24", "ref": "refs/heads/master", "path": "java/server/test/org/openqa/grid/internal/RemoteProxyFactory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "22395" }, { "name": "AppleScript", "bytes": "2614" }, { "name": "C", "bytes": "215680" }, { "name": "C#", "bytes": "2386242" }, { "name": "C++", "bytes": "756089" }, { "name": "CSS", "bytes": "109010" }, { "name": "Java", "bytes": "5450106" }, { "name": "JavaScript", "bytes": "5046393" }, { "name": "Objective-C", "bytes": "3729" }, { "name": "PHP", "bytes": "13253" }, { "name": "Python", "bytes": "683461" }, { "name": "Ragel in Ruby Host", "bytes": "3086" }, { "name": "Ruby", "bytes": "806031" }, { "name": "Shell", "bytes": "573" }, { "name": "XSLT", "bytes": "1047" } ], "symlink_target": "" }
echo "Password: root" ssh root@localhost -p 2222
{ "content_hash": "f0a2f07fbcc36288f1654ab6d34d3480", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 26, "avg_line_length": 24.5, "alnum_prop": 0.7551020408163265, "repo_name": "FunTimeCoding/ruby-skeleton", "id": "d54a41dedfac8ed6b68188f55fe17014a8afa90c", "size": "63", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "script/docker/development/ssh/ssh.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "17" }, { "name": "Ruby", "bytes": "3572" }, { "name": "Shell", "bytes": "15011" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "c210b0cfbcccfcf66369e9f9f5462b07", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "2634da908d1f0a28caecddbd59d45c4054336d58", "size": "183", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Trifolium/Trifolium chilense/ Syn. Trifolium ochreatum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
var App; App = function() { var catchDom, dom, events, functions, initialize, st, subscribeEvents; return dom = {}, st = { body: "body", frmParsley: ".frm-parsley" }, catchDom = function() { dom.body = $(st.body), dom.frmParsley = $(st.frmParsley); }, subscribeEvents = function() { $("#btnNext").on("click", events.showStep2), $("#lnkOpenMenu").on("click", events.toggleMenu), $("#btnCreateGame").on("click", events.tmp1); }, events = { showStep2: function() { $(".c-create-game__step1").hide(), $(".c-create-game__step2").fadeIn(); }, toggleMenu: function() { $(this).toggleClass("l-header__menu-icon--active"), $("#headerNav").slideToggle(); }, tmp1: function() { setTimeout(function() { !$("#frmSignUp").parsley().isValid() && $("#frmSignUp").parsley().isValid() || (window.location.href = "confirmar.html"); }, 3e3); } }, functions = { formValidation: function() { dom.frmParsley.parsley(); }, focusTxt: function() { $("#txtGameName").focus(); }, dates: function() { var currentYear; currentYear = new Date().getFullYear(), $(".datedropper").dateDropper({ lang: "es", minYear: currentYear, maxYear: currentYear + 1, lock: "from", lang: "es", format: "d/m/Y", dropPrimaryColor: "#F15252", dropTextColor: "#535353", dropBorder: "none", dropShadow: "0 0 10px 0 rgba(0, 0, 0, 0.2)" }); } }, initialize = function() { catchDom(), subscribeEvents(), functions.focusTxt(), functions.dates(), functions.formValidation(); }, { init: initialize }; }(), App.init();
{ "content_hash": "d23f3dfb8896307578c5aec7512ca11a", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 137, "avg_line_length": 37.17307692307692, "alnum_prop": 0.49405069839627525, "repo_name": "frontend-labs/demos.frontendlabs", "id": "c3eb60c0cbc24012c9307611c84d389ad7640cac", "size": "1933", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "freensy/js/app.js", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "170556" }, { "name": "CoffeeScript", "bytes": "6597" }, { "name": "HTML", "bytes": "231667" }, { "name": "Hack", "bytes": "61" }, { "name": "JavaScript", "bytes": "986572" }, { "name": "PHP", "bytes": "39192" }, { "name": "Roff", "bytes": "160" } ], "symlink_target": "" }
package com.wavefront.agent.histogram; import com.squareup.tape.ObjectQueue; import com.tdunning.math.stats.TDigest; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import wavefront.report.ReportPoint; /** * Dummy sender. Consumes TDigests from an ObjectQueue and sleeps for an amount of time to simulate sending * * @author Tim Schmidt (tim@wavefront.com). */ public class DroppingSender implements Runnable { private static final Logger logger = Logger.getLogger(DroppingSender.class.getCanonicalName()); private final ObjectQueue<ReportPoint> input; private final Random r; public DroppingSender(ObjectQueue<ReportPoint> input) { this.input = input; r = new Random(); } @Override public void run() { ReportPoint current; while ((current = input.peek()) != null) { input.remove(); logger.log(Level.INFO, "Sent " + current); } try { Thread.sleep(100L + (long) (r.nextDouble() * 400D)); } catch (InterruptedException e) { // eat } } }
{ "content_hash": "16f666c3ce6279e41b271f06582500a5", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 107, "avg_line_length": 24.697674418604652, "alnum_prop": 0.699623352165725, "repo_name": "moribellamy/java", "id": "6353cf84e1bf2a7c5c75d5bdfb29b464401497cf", "size": "1062", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "proxy/src/main/java/com/wavefront/agent/histogram/DroppingSender.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "1392" }, { "name": "Java", "bytes": "334918" }, { "name": "Python", "bytes": "37122" }, { "name": "Shell", "bytes": "9203" } ], "symlink_target": "" }
require 'spec_helper' describe 'template routes' do it 'routes get to the templates controller index' do expect(get: '/templates').to route_to( controller: 'templates', action: 'index' ) end it 'has a named route for the templates controller index action' do expect(get: templates_path).to route_to( controller: 'templates', action: 'index' ) end it 'routes get with an id to the templates controller show' do expect(get: '/templates/1').to route_to( controller: 'templates', action: 'show', id: '1' ) end it 'has a named route for the templates controller show action' do expect(get: template_path(1)).to route_to( controller: 'templates', action: 'show', id: '1' ) end it 'routes post with an id to the templates controller save' do expect(post: '/templates/1/save').to route_to( controller: 'templates', action: 'save', id: '1' ) end it 'has a named route for the templates controller save action' do expect(post: save_template_path(1)).to route_to( controller: 'templates', action: 'save', id: '1' ) end end
{ "content_hash": "910dd1bcc0ce0292ead7df98b32ae9f3", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 69, "avg_line_length": 38.16, "alnum_prop": 0.3862683438155136, "repo_name": "xirun/panamax-api", "id": "d00eb368d2634e5b4f17e7f71a276d5ba98cad32", "size": "1908", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "spec/routing/template_routes_spec.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "546" }, { "name": "JavaScript", "bytes": "599" }, { "name": "Ruby", "bytes": "320161" }, { "name": "Shell", "bytes": "387" } ], "symlink_target": "" }
// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ash/power/ml/adaptive_screen_brightness_manager.h" #include <memory> #include <vector> #include "base/test/test_mock_time_task_runner.h" #include "base/timer/timer.h" #include "chrome/browser/ash/accessibility/accessibility_manager.h" #include "chrome/browser/ash/accessibility/magnification_manager.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/power/ml/adaptive_screen_brightness_ukm_logger.h" #include "chrome/browser/ash/power/ml/screen_brightness_event.pb.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_activity_simulator.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/test_browser_window_aura.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/power_manager/backlight.pb.h" #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" #include "content/public/test/web_contents_tester.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/user_activity/user_activity_detector.h" #include "ui/events/base_event_utils.h" #include "ui/events/keycodes/dom/dom_code.h" #include "ui/gfx/geometry/point.h" namespace ash { namespace power { namespace ml { namespace { struct LogActivityInfo { ScreenBrightnessEvent screen_brightness_event; ukm::SourceId tab_id; bool has_form_entry; }; const int kInactivityDurationSecs = AdaptiveScreenBrightnessManager::kInactivityDuration.InSeconds(); const int kLoggingIntervalSecs = AdaptiveScreenBrightnessManager::kLoggingInterval.InSeconds(); // Testing ukm logger. class TestingAdaptiveScreenBrightnessUkmLogger : public AdaptiveScreenBrightnessUkmLogger { public: TestingAdaptiveScreenBrightnessUkmLogger() = default; TestingAdaptiveScreenBrightnessUkmLogger( const TestingAdaptiveScreenBrightnessUkmLogger&) = delete; TestingAdaptiveScreenBrightnessUkmLogger& operator=( const TestingAdaptiveScreenBrightnessUkmLogger&) = delete; ~TestingAdaptiveScreenBrightnessUkmLogger() override = default; const std::vector<LogActivityInfo>& log_activity_info() const { return log_activity_info_; } // AdaptiveScreenBrightnessUkmLogger overrides: void LogActivity(const ScreenBrightnessEvent& screen_brightness_event, ukm::SourceId tab_id, bool has_form_entry) override { log_activity_info_.push_back( LogActivityInfo{screen_brightness_event, tab_id, has_form_entry}); } private: std::vector<LogActivityInfo> log_activity_info_; }; } // namespace class AdaptiveScreenBrightnessManagerTest : public ChromeRenderViewHostTestHarness { public: AdaptiveScreenBrightnessManagerTest() : ChromeRenderViewHostTestHarness( base::test::TaskEnvironment::MainThreadType::UI, base::test::TaskEnvironment::TimeSource::MOCK_TIME, base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} AdaptiveScreenBrightnessManagerTest( const AdaptiveScreenBrightnessManagerTest&) = delete; AdaptiveScreenBrightnessManagerTest& operator=( const AdaptiveScreenBrightnessManagerTest&) = delete; ~AdaptiveScreenBrightnessManagerTest() override = default; void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); chromeos::PowerManagerClient::InitializeFake(); auto logger = std::make_unique<TestingAdaptiveScreenBrightnessUkmLogger>(); ukm_logger_ = logger.get(); mojo::PendingRemote<viz::mojom::VideoDetectorObserver> observer; auto periodic_timer = std::make_unique<base::RepeatingTimer>(); periodic_timer->SetTaskRunner( task_environment()->GetMainThreadTaskRunner()); screen_brightness_manager_ = std::make_unique<AdaptiveScreenBrightnessManager>( std::move(logger), &user_activity_detector_, chromeos::FakePowerManagerClient::Get(), nullptr, nullptr, observer.InitWithNewPipeAndPassReceiver(), std::move(periodic_timer)); } void TearDown() override { screen_brightness_manager_.reset(); chromeos::PowerManagerClient::Shutdown(); ChromeRenderViewHostTestHarness::TearDown(); } protected: TestingAdaptiveScreenBrightnessUkmLogger* ukm_logger() { return ukm_logger_; } void ReportUserActivity(const ui::Event* const event) { screen_brightness_manager_->OnUserActivity(event); } void ReportPowerChangeEvent( const power_manager::PowerSupplyProperties::ExternalPower power, const float battery_percent) { power_manager::PowerSupplyProperties proto; proto.set_external_power(power); proto.set_battery_percent(battery_percent); chromeos::FakePowerManagerClient::Get()->UpdatePowerProperties(proto); } void ReportLidEvent(const chromeos::PowerManagerClient::LidState state) { chromeos::FakePowerManagerClient::Get()->SetLidState( state, base::TimeTicks::UnixEpoch()); } void ReportTabletModeEvent( const chromeos::PowerManagerClient::TabletMode mode) { chromeos::FakePowerManagerClient::Get()->SetTabletMode( mode, base::TimeTicks::UnixEpoch()); } void ReportBrightnessChangeEvent( const double level, const power_manager::BacklightBrightnessChange_Cause cause) { power_manager::BacklightBrightnessChange change; change.set_percent(level); change.set_cause(cause); screen_brightness_manager_->ScreenBrightnessChanged(change); } void ReportVideoStart() { screen_brightness_manager_->OnVideoActivityStarted(); } void ReportVideoEnd() { screen_brightness_manager_->OnVideoActivityEnded(); } void FireTimer() { screen_brightness_manager_->OnTimerFired(); } void InitializeBrightness(const double level) { screen_brightness_manager_->OnReceiveScreenBrightnessPercent(level); } void FastForwardTimeBySecs(const int seconds) { task_environment()->FastForwardBy(base::Seconds(seconds)); } // Creates a test browser window and sets its visibility, activity and // incognito status. std::unique_ptr<Browser> CreateTestBrowser(bool is_visible, bool is_focused, bool is_incognito = false) { Profile* const original_profile = profile(); Profile* const used_profile = is_incognito ? original_profile->GetPrimaryOTRProfile(/*create_if_needed=*/true) : original_profile; Browser::CreateParams params(used_profile, true); auto dummy_window = std::make_unique<aura::Window>(nullptr); dummy_window->Init(ui::LAYER_SOLID_COLOR); root_window()->AddChild(dummy_window.get()); dummy_window->SetBounds(gfx::Rect(root_window()->bounds().size())); if (is_visible) { dummy_window->Show(); } else { dummy_window->Hide(); } std::unique_ptr<Browser> browser = chrome::CreateBrowserWithAuraTestWindowForParams( std::move(dummy_window), &params); if (is_focused) { browser->window()->Activate(); } else { browser->window()->Deactivate(); } return browser; } // Adds a tab with specified url to the tab strip model. Also optionally sets // the tab to be the active one in the tab strip model. // TODO(jiameng): there doesn't seem to be a way to set form entry (via // page importance signal). Check if there's some other way to set it. ukm::SourceId CreateTestWebContents(TabStripModel* const tab_strip_model, const GURL& url, bool is_active) { DCHECK(tab_strip_model); DCHECK(!url.is_empty()); content::WebContents* contents = tab_activity_simulator_.AddWebContentsAndNavigate(tab_strip_model, url); if (is_active) { tab_strip_model->ActivateTabAt(tab_strip_model->count() - 1); } content::WebContentsTester::For(contents)->TestSetIsLoading(false); return contents->GetPrimaryMainFrame()->GetPageUkmSourceId(); } const gfx::Point kEventLocation = gfx::Point(90, 90); const ui::MouseEvent kMouseEvent = ui::MouseEvent(ui::ET_MOUSE_MOVED, kEventLocation, kEventLocation, base::TimeTicks(), 0, 0); TabActivitySimulator tab_activity_simulator_; const GURL kUrl1 = GURL("https://example1.com/"); const GURL kUrl2 = GURL("https://example2.com/"); const GURL kUrl3 = GURL("https://example3.com/"); private: FakeChromeUserManager fake_user_manager_; ui::UserActivityDetector user_activity_detector_; std::unique_ptr<AdaptiveScreenBrightnessManager> screen_brightness_manager_; TestingAdaptiveScreenBrightnessUkmLogger* ukm_logger_; }; TEST_F(AdaptiveScreenBrightnessManagerTest, PeriodicLogging) { InitializeBrightness(75.0f); ReportPowerChangeEvent(power_manager::PowerSupplyProperties::AC, 23.0f); ReportVideoStart(); ReportLidEvent(chromeos::PowerManagerClient::LidState::OPEN); ReportTabletModeEvent(chromeos::PowerManagerClient::TabletMode::UNSUPPORTED); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_FLOAT_EQ(23.0, features.env_data().battery_percent()); EXPECT_FALSE(features.env_data().on_battery()); EXPECT_TRUE(features.activity_data().is_video_playing()); EXPECT_EQ(ScreenBrightnessEvent::Features::EnvData::LAPTOP, features.env_data().device_mode()); EXPECT_EQ(75, features.env_data().previous_brightness()); const ScreenBrightnessEvent::Event& event = info[0].screen_brightness_event.event(); EXPECT_EQ(75, event.brightness()); EXPECT_EQ(ScreenBrightnessEvent::Event::PERIODIC, event.reason()); EXPECT_FALSE(event.has_time_since_last_event_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, PeriodicLoggingBrightnessUninitialized) { ReportPowerChangeEvent(power_manager::PowerSupplyProperties::AC, 23.0f); ReportVideoStart(); ReportLidEvent(chromeos::PowerManagerClient::LidState::OPEN); ReportTabletModeEvent(chromeos::PowerManagerClient::TabletMode::UNSUPPORTED); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); EXPECT_TRUE(info.empty()); } TEST_F(AdaptiveScreenBrightnessManagerTest, PeriodicTimerTest) { ReportPowerChangeEvent(power_manager::PowerSupplyProperties::AC, 23.0f); ReportVideoStart(); ReportLidEvent(chromeos::PowerManagerClient::LidState::OPEN); ReportTabletModeEvent(chromeos::PowerManagerClient::TabletMode::UNSUPPORTED); FastForwardTimeBySecs(kLoggingIntervalSecs - 10); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); EXPECT_TRUE(info.empty()); } TEST_F(AdaptiveScreenBrightnessManagerTest, BrightnessChange) { ReportBrightnessChangeEvent( 30.0f, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); FastForwardTimeBySecs(2); ReportBrightnessChangeEvent( 40.0f, power_manager:: BacklightBrightnessChange_Cause_EXTERNAL_POWER_DISCONNECTED); FastForwardTimeBySecs(6); ReportBrightnessChangeEvent( 20.0f, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(3U, info.size()); const ScreenBrightnessEvent::Event& event = info[0].screen_brightness_event.event(); EXPECT_EQ(30, event.brightness()); EXPECT_EQ(ScreenBrightnessEvent::Event::OTHER, event.reason()); EXPECT_FALSE(event.has_time_since_last_event_sec()); // Brightness wasn't initialized so there's no previous brightness level. EXPECT_FALSE(info[0] .screen_brightness_event.features() .env_data() .has_previous_brightness()); const ScreenBrightnessEvent::Event& event1 = info[1].screen_brightness_event.event(); EXPECT_EQ(40, event1.brightness()); EXPECT_EQ(ScreenBrightnessEvent::Event::EXTERNAL_POWER_DISCONNECTED, event1.reason()); EXPECT_EQ(2, event1.time_since_last_event_sec()); EXPECT_EQ(30, info[1] .screen_brightness_event.features() .env_data() .previous_brightness()); const ScreenBrightnessEvent::Event& event2 = info[2].screen_brightness_event.event(); EXPECT_EQ(20, event2.brightness()); EXPECT_EQ(ScreenBrightnessEvent::Event::USER_DOWN, event2.reason()); EXPECT_EQ(6, event2.time_since_last_event_sec()); EXPECT_EQ(40, info[2] .screen_brightness_event.features() .env_data() .previous_brightness()); } TEST_F(AdaptiveScreenBrightnessManagerTest, NoUserEvents) { InitializeBrightness(75.0f); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_FALSE(features.activity_data().has_last_activity_time_sec()); EXPECT_FALSE(features.activity_data().has_recent_time_active_sec()); EXPECT_EQ(75, features.env_data().previous_brightness()); const ScreenBrightnessEvent::Event& event = info[0].screen_brightness_event.event(); EXPECT_EQ(75, event.brightness()); EXPECT_FALSE(event.has_time_since_last_event_sec()); EXPECT_EQ(ScreenBrightnessEvent::Event::PERIODIC, event.reason()); EXPECT_EQ(ukm::kInvalidSourceId, info[0].tab_id); } TEST_F(AdaptiveScreenBrightnessManagerTest, NullUserActivity) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(nullptr); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_FALSE(features.activity_data().has_last_activity_time_sec()); EXPECT_FALSE(features.activity_data().has_recent_time_active_sec()); EXPECT_EQ(75, features.env_data().previous_brightness()); const ScreenBrightnessEvent::Event& event = info[0].screen_brightness_event.event(); EXPECT_EQ(75, event.brightness()); EXPECT_FALSE(event.has_time_since_last_event_sec()); EXPECT_EQ(ScreenBrightnessEvent::Event::PERIODIC, event.reason()); } TEST_F(AdaptiveScreenBrightnessManagerTest, OneUserEvent) { InitializeBrightness(75.0f); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(kLoggingIntervalSecs, features.activity_data().last_activity_time_sec()); EXPECT_EQ(0, features.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, TwoUserEventsSameActivity) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(5); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); // Timer starts from the beginning, so subtract 6 seconds. EXPECT_EQ(kLoggingIntervalSecs - 6, features.activity_data().last_activity_time_sec()); EXPECT_EQ(5, features.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, TwoUserEventsDifferentActivities) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kInactivityDurationSecs + 5); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kLoggingIntervalSecs); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(kLoggingIntervalSecs - kInactivityDurationSecs - 6, features.activity_data().last_activity_time_sec()); EXPECT_EQ(0, features.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, MultipleUserEventsMultipleActivities) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(5); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kInactivityDurationSecs + 5); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(kInactivityDurationSecs + 10); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(2); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(2); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(2); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(2, features.activity_data().last_activity_time_sec()); EXPECT_EQ(4, features.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, VideoStartStop) { InitializeBrightness(75.0f); FastForwardTimeBySecs(2); ReportVideoStart(); FastForwardTimeBySecs(5); FireTimer(); FastForwardTimeBySecs(kInactivityDurationSecs + 40); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(2U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(0, features.activity_data().last_activity_time_sec()); EXPECT_EQ(5, features.activity_data().recent_time_active_sec()); const ScreenBrightnessEvent::Features& features1 = info[1].screen_brightness_event.features(); EXPECT_EQ(0, features1.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 45, features1.activity_data().recent_time_active_sec()); FastForwardTimeBySecs(10); ReportVideoEnd(); FastForwardTimeBySecs(5); FireTimer(); FastForwardTimeBySecs(kInactivityDurationSecs + 45); FireTimer(); ASSERT_EQ(4U, info.size()); const ScreenBrightnessEvent::Features& features2 = info[2].screen_brightness_event.features(); EXPECT_EQ(5, features2.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 55, features2.activity_data().recent_time_active_sec()); const ScreenBrightnessEvent::Features& features3 = info[3].screen_brightness_event.features(); EXPECT_EQ(kInactivityDurationSecs + 50, features3.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 55, features3.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, VideoStartStopWithUserEvents) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(2); ReportVideoStart(); FastForwardTimeBySecs(5); FireTimer(); FastForwardTimeBySecs(kInactivityDurationSecs + 40); FireTimer(); FastForwardTimeBySecs(4); ReportUserActivity(&kMouseEvent); FastForwardTimeBySecs(6); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(3U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(0, features.activity_data().last_activity_time_sec()); EXPECT_EQ(7, features.activity_data().recent_time_active_sec()); const ScreenBrightnessEvent::Features& features1 = info[1].screen_brightness_event.features(); EXPECT_EQ(0, features1.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 47, features1.activity_data().recent_time_active_sec()); const ScreenBrightnessEvent::Features& features2 = info[2].screen_brightness_event.features(); EXPECT_EQ(0, features2.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 57, features2.activity_data().recent_time_active_sec()); FastForwardTimeBySecs(10); ReportVideoEnd(); FastForwardTimeBySecs(5); FireTimer(); FastForwardTimeBySecs(kInactivityDurationSecs + 45); FireTimer(); ASSERT_EQ(5U, info.size()); const ScreenBrightnessEvent::Features& features3 = info[3].screen_brightness_event.features(); EXPECT_EQ(5, features3.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 67, features3.activity_data().recent_time_active_sec()); const ScreenBrightnessEvent::Features& features4 = info[4].screen_brightness_event.features(); EXPECT_EQ(kInactivityDurationSecs + 50, features4.activity_data().last_activity_time_sec()); EXPECT_EQ(kInactivityDurationSecs + 67, features4.activity_data().recent_time_active_sec()); } TEST_F(AdaptiveScreenBrightnessManagerTest, UserEventCounts) { InitializeBrightness(75.0f); FastForwardTimeBySecs(1); ReportUserActivity(&kMouseEvent); const ui::TouchEvent kTouchEvent( ui::ET_TOUCH_PRESSED, kEventLocation, base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::kTouch, 0)); ReportUserActivity(&kTouchEvent); ReportUserActivity(&kTouchEvent); const ui::KeyEvent kKeyEvent( ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, 0, ui::DomKey::FromCharacter('a'), base::TimeTicks()); ReportUserActivity(&kKeyEvent); ReportUserActivity(&kKeyEvent); ReportUserActivity(&kKeyEvent); const ui::TouchEvent kStylusEvent( ui::ET_TOUCH_MOVED, kEventLocation, base::TimeTicks(), ui::PointerDetails(ui::EventPointerType::kPen, 0), ui::EF_NONE); ReportUserActivity(&kStylusEvent); ReportUserActivity(&kStylusEvent); ReportUserActivity(&kStylusEvent); ReportUserActivity(&kStylusEvent); FastForwardTimeBySecs(2); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); const ScreenBrightnessEvent::Features& features = info[0].screen_brightness_event.features(); EXPECT_EQ(1, features.activity_data().num_recent_mouse_events()); EXPECT_EQ(2, features.activity_data().num_recent_touch_events()); EXPECT_EQ(3, features.activity_data().num_recent_key_events()); EXPECT_EQ(4, features.activity_data().num_recent_stylus_events()); } // Test is flaky. See https://crbug.com/938055. TEST_F(AdaptiveScreenBrightnessManagerTest, DISABLED_SingleBrowser) { std::unique_ptr<Browser> browser = CreateTestBrowser(true /* is_visible */, true /* is_focused */); BrowserList::GetInstance()->SetLastActive(browser.get()); TabStripModel* tab_strip_model = browser->tab_strip_model(); CreateTestWebContents(tab_strip_model, kUrl1, false /* is_active */); const ukm::SourceId source_id2 = CreateTestWebContents(tab_strip_model, kUrl2, true /* is_active */); InitializeBrightness(75.0f); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); EXPECT_EQ(source_id2, info[0].tab_id); EXPECT_EQ(false, info[0].has_form_entry); // Browser DCHECKS that all tabs have been closed at destruction. tab_strip_model->CloseAllTabs(); } // Test is flaky. See https://crbug.com/944325. TEST_F(AdaptiveScreenBrightnessManagerTest, DISABLED_MultipleBrowsersWithActive) { // Simulates three browsers: // - browser1 is the last active but minimized, so not visible. // - browser2 and browser3 are both visible but browser2 is the topmost. std::unique_ptr<Browser> browser1 = CreateTestBrowser(false /* is_visible */, false /* is_focused */); std::unique_ptr<Browser> browser2 = CreateTestBrowser(true /* is_visible */, true /* is_focused */); std::unique_ptr<Browser> browser3 = CreateTestBrowser(true /* is_visible */, false /* is_focused */); BrowserList::GetInstance()->SetLastActive(browser3.get()); BrowserList::GetInstance()->SetLastActive(browser2.get()); BrowserList::GetInstance()->SetLastActive(browser1.get()); TabStripModel* tab_strip_model1 = browser1->tab_strip_model(); CreateTestWebContents(tab_strip_model1, kUrl1, true /* is_active */); TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); const ukm::SourceId source_id2 = CreateTestWebContents(tab_strip_model2, kUrl2, true /* is_active */); TabStripModel* tab_strip_model3 = browser3->tab_strip_model(); CreateTestWebContents(tab_strip_model3, kUrl3, true /* is_active */); InitializeBrightness(75.0f); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); EXPECT_EQ(source_id2, info[0].tab_id); EXPECT_EQ(false, info[0].has_form_entry); // Browser DCHECKS that all tabs have been closed at destruction. tab_strip_model1->CloseAllTabs(); tab_strip_model2->CloseAllTabs(); tab_strip_model3->CloseAllTabs(); } TEST_F(AdaptiveScreenBrightnessManagerTest, DISABLED_MultipleBrowsersNoneActive) { // Simulates three browsers, none of which are active. // - browser1 is the last active but minimized and so not visible. // - browser2 and browser3 are both visible but not focused so not active. // - browser2 is the topmost. std::unique_ptr<Browser> browser1 = CreateTestBrowser(false /* is_visible */, false /* is_focused */); std::unique_ptr<Browser> browser2 = CreateTestBrowser(true /* is_visible */, false /* is_focused */); std::unique_ptr<Browser> browser3 = CreateTestBrowser(true /* is_visible */, false /* is_focused */); BrowserList::GetInstance()->SetLastActive(browser3.get()); BrowserList::GetInstance()->SetLastActive(browser2.get()); BrowserList::GetInstance()->SetLastActive(browser1.get()); TabStripModel* tab_strip_model1 = browser1->tab_strip_model(); CreateTestWebContents(tab_strip_model1, kUrl1, true /* is_active */); TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); const ukm::SourceId source_id2 = CreateTestWebContents(tab_strip_model2, kUrl2, true /* is_active */); TabStripModel* tab_strip_model3 = browser3->tab_strip_model(); CreateTestWebContents(tab_strip_model3, kUrl3, true /* is_active */); InitializeBrightness(75.0f); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); EXPECT_EQ(source_id2, info[0].tab_id); EXPECT_EQ(false, info[0].has_form_entry); // Browser DCHECKS that all tabs have been closed at destruction. tab_strip_model1->CloseAllTabs(); tab_strip_model2->CloseAllTabs(); tab_strip_model3->CloseAllTabs(); } TEST_F(AdaptiveScreenBrightnessManagerTest, BrowsersWithIncognito) { // Simulates three browsers: // - browser1 is the last active but minimized and so not visible. // - browser2 is visible but not focused so not active. // - browser3 is visible and focused, but incognito. std::unique_ptr<Browser> browser1 = CreateTestBrowser(false /* is_visible */, false /* is_focused */); std::unique_ptr<Browser> browser2 = CreateTestBrowser(true /* is_visible */, false /* is_focused */); std::unique_ptr<Browser> browser3 = CreateTestBrowser( true /* is_visible */, true /* is_focused */, true /* is_incognito */); BrowserList::GetInstance()->SetLastActive(browser3.get()); BrowserList::GetInstance()->SetLastActive(browser2.get()); BrowserList::GetInstance()->SetLastActive(browser1.get()); TabStripModel* tab_strip_model1 = browser1->tab_strip_model(); CreateTestWebContents(tab_strip_model1, kUrl1, true /* is_active */); TabStripModel* tab_strip_model2 = browser2->tab_strip_model(); const ukm::SourceId source_id2 = CreateTestWebContents(tab_strip_model2, kUrl2, true /* is_active */); TabStripModel* tab_strip_model3 = browser3->tab_strip_model(); CreateTestWebContents(tab_strip_model3, kUrl3, true /* is_active */); InitializeBrightness(75.0f); FireTimer(); const std::vector<LogActivityInfo>& info = ukm_logger()->log_activity_info(); ASSERT_EQ(1U, info.size()); EXPECT_EQ(source_id2, info[0].tab_id); EXPECT_EQ(false, info[0].has_form_entry); // Browser DCHECKS that all tabs have been closed at destruction. tab_strip_model1->CloseAllTabs(); tab_strip_model2->CloseAllTabs(); tab_strip_model3->CloseAllTabs(); } } // namespace ml } // namespace power } // namespace ash
{ "content_hash": "f658a656e307212500c39389a032d4a3", "timestamp": "", "source": "github", "line_count": 776, "max_line_length": 80, "avg_line_length": 38.045103092783506, "alnum_prop": 0.7164244826067812, "repo_name": "chromium/chromium", "id": "6d291f09eaf6aa99bd91c6f6de42524704f574cc", "size": "29523", "binary": false, "copies": "6", "ref": "refs/heads/main", "path": "chrome/browser/ash/power/ml/adaptive_screen_brightness_manager_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
export * from "./helpers/optionally-displayed.component"; export * from "./inputs/text-field.component"; export * from "./inputs/text-area.component"; export * from "./validators/rules"; export * from "./validators/rule-runner"; export * from "./validators/error-messages";
{ "content_hash": "f4a1558a25fe261e46b404aaa08fa4f0", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 57, "avg_line_length": 45.666666666666664, "alnum_prop": 0.7299270072992701, "repo_name": "LeSocialCompany/Roomeos", "id": "05f721736bcf2d14a224d8deefbf974030d23ada", "size": "274", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "front-end/src/components/validations/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "86184" }, { "name": "HTML", "bytes": "12911" }, { "name": "JavaScript", "bytes": "64138" }, { "name": "TypeScript", "bytes": "39395" } ], "symlink_target": "" }
var title = "Picto-Pattern"; var desc = "Add and subtract until you reach 11."; var offer = "Pop Quiz! How many Giants are there? <split butt_txt=\"Eleven!\" \/> Isn't that such a lovely prime number? Sure there are other numbers out there like 5 or 29, but nothing compares to the heavenly ring that 11 makes. <split butt_txt=\"I agree!\" \/> Well, if you are following me, I guess you can count. Want to turn some numbers into 11?"; var completion = "Whew, who knew counting numbers could be so tough. Especially counting to a number that exceeds the number of fingers you have."; var button_accept = "11 me up!"; var button_decline = "Another time."; var auto_complete = 0; var familiar_turnin = 1; var is_tracked = 0; var show_alert = 0; var silent_complete = 0; var progress = [ ]; var giver_progress = [ ]; var no_progress = "null"; var prereq_quests = []; var prerequisites = []; var end_npcs = []; var locations = { "picto_pattern" : { "dev_tsid" : "", "prod_tsid" : "LIFI3TJSFGD3MIS" } }; var requirements = { "r556" : { "type" : "flag", "name" : "solved_puzzle", "desc" : "Solved Puzzle" }, "r557" : { "type" : "flag", "name" : "leave", "desc" : "Complete the Journey" } }; function onComplete(pc){ // generated from rewards var xp=0; var currants=0; var mood=0; var energy=0; var favor=0; var multiplier = pc.buffs_has('gift_of_gab') ? 1.2 : pc.buffs_has('silvertongue') ? 1.05 : 1.0; multiplier += pc.imagination_get_quest_modifier(); currants = pc.stats_add_currants(round_to_5(1100 * multiplier), {type: 'quest_complete', quest: this.class_tsid}); mood = pc.metabolics_add_mood(round_to_5(110 * multiplier)); energy = pc.metabolics_add_energy(round_to_5(110 * multiplier)); favor = pc.stats_add_favor_points("ti", round_to_5(110 * multiplier)); apiLogAction('QUEST_REWARDS', 'pc='+pc.tsid, 'quest='+this.class_tsid, 'xp='+intval(xp), 'mood='+intval(mood), 'energy='+intval(energy), 'currants='+intval(currants), 'favor='+intval(favor)); pc.createItemFromFamiliar("cloud_11_smoothie", 11); if(pc.buffs_has('gift_of_gab')) { pc.buffs_remove('gift_of_gab'); } else if(pc.buffs_has('silvertongue')) { pc.buffs_remove('silvertongue'); } } var rewards = { "currants" : 1100, "mood" : 110, "energy" : 110, "favor" : { "0" : { "giant" : "ti", "points" : 110 } }, "items" : { "0" : { "class_tsid" : "cloud_11_smoothie", "label" : "Cloud 11 Smoothie", "count" : 11 } } }; function onExitLocation(previous_location){ var pc = this.owner; if (!pc) return; this.set_flag(pc, 'leave'); if (!this.is_complete){ pc.failQuest(this.class_tsid); pc.instances_exit(previous_location); } } function onStarted(pc){ this.questInstanceLocation(pc, 'picto_pattern', 0, 0, 5*60, {preserve_links: true}, {}, true); return {ok: 1}; } // generated ok (NO DATE)
{ "content_hash": "faeda169b4657a04240dffa1489fa08f", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 354, "avg_line_length": 28.316831683168317, "alnum_prop": 0.6465034965034965, "repo_name": "Whizy/eleven-gsjs", "id": "f1692e38b6b7026827fc362eedfc55b15b3eccd8", "size": "2860", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "quests/picto_pattern.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "30071787" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=type.c_double.html"> </head> <body> <p>Redirecting to <a href="type.c_double.html">type.c_double.html</a>...</p> <script>location.replace("type.c_double.html" + location.search + location.hash);</script> </body> </html>
{ "content_hash": "2b894db9b79d59147561def9b7797e64", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 94, "avg_line_length": 31.3, "alnum_prop": 0.65814696485623, "repo_name": "liebharc/clFFT", "id": "3de07823ff615ad7b77741b0a46a15e1daa32384", "size": "313", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "docs/bindings/libc/c_double.t.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "141098" }, { "name": "C++", "bytes": "3950190" }, { "name": "CMake", "bytes": "47058" }, { "name": "Python", "bytes": "61560" }, { "name": "Rust", "bytes": "58918" } ], "symlink_target": "" }
package org.elfwerks.sandbox.corba; import java.net.URL; import java.net.URLConnection; import java.util.Properties; import org.omg.CORBA.ORB; import org.omg.CORBA.Object; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.elfwerks.sandbox.servant.PingService; import org.elfwerks.sandbox.servant.PingServiceHelper; public class PingClient { private static final Log log = LogFactory.getLog(PingClient.class); private static final String pingIor = "http://localhost:8080/sandbox-corba/ping-ior"; public static void main(String args[]) { log.info("Starting."); try { ORB orb = initOrb(); String ior = getIor(); Object pingRef = orb.string_to_object(ior); PingService ping = PingServiceHelper.narrow(pingRef); ping.ping(); log.info("Ping successful."); } catch (Exception ex) { log.fatal("client failed.", ex); } } private static String getIor() { try { URLConnection connection = (new URL(pingIor)).openConnection(); int contentLength = connection.getContentLength(); byte[] content = new byte[contentLength]; connection.getInputStream().read(content); String ior = new String(content); return ior; } catch (Exception ex) { log.fatal(ex); } return null; } private static ORB initOrb() { Properties orbProperties = new Properties(); orbProperties.setProperty("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB"); orbProperties.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton"); String [] args = new String[0]; ORB orb = ORB.init(args, orbProperties); return orb; } }
{ "content_hash": "7e9a569205e53aeffae6c96e939f2ada", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 100, "avg_line_length": 33.87719298245614, "alnum_prop": 0.6069394096323149, "repo_name": "egustafson/sandbox", "id": "cead2194ea3ef8627af83ddf88fa5001c2ff46ea", "size": "1931", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Java/mvn/sandbox-corba/src/test/java/org/elfwerks/sandbox/corba/PingClient.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ada", "bytes": "65426" }, { "name": "Assembly", "bytes": "2103" }, { "name": "C", "bytes": "94748" }, { "name": "C++", "bytes": "52883" }, { "name": "Dockerfile", "bytes": "873" }, { "name": "FreeMarker", "bytes": "195" }, { "name": "Game Maker Language", "bytes": "24204" }, { "name": "Go", "bytes": "128092" }, { "name": "Groovy", "bytes": "584" }, { "name": "HTML", "bytes": "2491" }, { "name": "Java", "bytes": "232698" }, { "name": "JavaScript", "bytes": "278" }, { "name": "Lex", "bytes": "2806" }, { "name": "Lua", "bytes": "809" }, { "name": "M4", "bytes": "1718" }, { "name": "Makefile", "bytes": "22166" }, { "name": "Perl", "bytes": "25945" }, { "name": "Python", "bytes": "131732" }, { "name": "Roff", "bytes": "1455" }, { "name": "Ruby", "bytes": "5870" }, { "name": "Scala", "bytes": "2130" }, { "name": "Shell", "bytes": "7117" }, { "name": "Tcl", "bytes": "4561" }, { "name": "TeX", "bytes": "63201" }, { "name": "Yacc", "bytes": "924" } ], "symlink_target": "" }
package com.intellij.plugins.haxe.ide.highlight; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.options.colors.AttributesDescriptor; import com.intellij.openapi.options.colors.ColorDescriptor; import com.intellij.openapi.options.colors.ColorSettingsPage; import com.intellij.plugins.haxe.HaxeBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.util.HashMap; import java.util.Map; import static com.intellij.plugins.haxe.ide.highlight.HaxeSyntaxHighlighterColors.*; /** * Color Settings page for Haxe: Settings->Editor->Color Scheme->Haxe * * @author fedor.korotkov */ public class HaxeColorSettingsPage implements ColorSettingsPage { private static final AttributesDescriptor[] ATTRS = new AttributesDescriptor[]{ new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.line.comment"), LINE_COMMENT), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.block.comment"), BLOCK_COMMENT), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.doc.comment"), DOC_COMMENT), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.conditional.compilation"), CONDITIONALLY_NOT_COMPILED), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.unparseable.data"), UNPARSEABLE_DATA), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.conditional.compilation.defined.flag"), DEFINED_VAR), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.conditional.compilation.undefined.flag"), UNDEFINED_VAR), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.metadata"), METADATA), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.keyword"), KEYWORD), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.number"), NUMBER), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.string"), STRING), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.operator"), OPERATION_SIGN), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.parenths"), PARENTHS), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.brackets"), BRACKETS), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.braces"), BRACES), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.comma"), COMMA), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.dot"), DOT), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.semicolon"), SEMICOLON), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.bad.character"), BAD_CHARACTER), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.parameter"), PARAMETER), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.local.variable"), LOCAL_VARIABLE), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.class"), CLASS), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.interface"), INTERFACE), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.instance.member.function"), INSTANCE_MEMBER_FUNCTION), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.static.member.function"), STATIC_MEMBER_FUNCTION), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.instance.member.variable"), INSTANCE_MEMBER_VARIABLE), new AttributesDescriptor(HaxeBundle.message("haxe.color.settings.description.static.member.variable"), STATIC_MEMBER_VARIABLE) }; @NonNls private static final Map<String, TextAttributesKey> ourTags = new HashMap<String, TextAttributesKey>(); /* These strings define what token will be highlighted and selected when the code screen is focused/clicked upon in the settings dialog. */ static { ourTags.put("parameter", PARAMETER); ourTags.put("local.variable", LOCAL_VARIABLE); ourTags.put("class", CLASS); ourTags.put("compilation", CONDITIONALLY_NOT_COMPILED); ourTags.put("unparseable", UNPARSEABLE_DATA); ourTags.put("defined.flag", DEFINED_VAR); ourTags.put("undefined.flag", UNDEFINED_VAR); ourTags.put("interface", INTERFACE); ourTags.put("instance.member.function", INSTANCE_MEMBER_FUNCTION); ourTags.put("static.member.function", STATIC_MEMBER_FUNCTION); ourTags.put("instance.member.variable", INSTANCE_MEMBER_VARIABLE); ourTags.put("static.member.variable", STATIC_MEMBER_VARIABLE); ourTags.put("metadata", METADATA); } @NotNull @Override public String getDisplayName() { return HaxeBundle.message("haxe.title"); } @Override public Icon getIcon() { return icons.HaxeIcons.Haxe_16; } @NotNull @Override public ColorDescriptor[] getColorDescriptors() { return ColorDescriptor.EMPTY_ARRAY; } @NotNull @Override public SyntaxHighlighter getHighlighter() { return new HaxeSyntaxHighlighter(null); } @Override public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() { return ourTags; } @NotNull @Override public AttributesDescriptor[] getAttributeDescriptors() { return ATTRS; } @NotNull @Override public String getDemoText() { return "<compilation>#if <defined.flag>definedFlag</defined.flag> && <undefined.flag>undefinedFlag</undefined.flag>\n" + "#error \"Error!!\"\n" + "#else</compilation>\n" + "import <class>util.Date</class>;\n" + "<compilation>#end</compilation>\n" + "\n" + "/* Block comment */\n" + "/**\n" + " Document comment\n" + "**/\n" + "@author(\"Penelope\")\n" + "@:final\n" + "class <class>SomeClass</class> implements <interface>IOther</interface> { // some comment\n" + " private var <instance.member.variable>field</instance.member.variable> = null;\n" + " private var <instance.member.variable>unusedField</instance.member.variable>:<class>Number</class> = 12345.67890;\n" + " private var <instance.member.variable>anotherString</instance.member.variable>:<class>String</class> = \"Another\\nStrin\\g\";\n" + " public static var <static.member.variable>staticField</static.member.variable>:<class>Int</class> = 0;\n" + "\n" + " public static function <static.member.function>inc</static.member.function>() {\n" + " <static.member.variable>staticField</static.member.variable>++;\n" + " }\n" + " public function <instance.member.function>foo</instance.member.function>(<parameter>param</parameter>:<interface>AnInterface</interface>) {\n" + " trace(<instance.member.variable>anotherString</instance.member.variable> + <parameter>param</parameter>);\n" + " var <local.variable>reassignedValue</local.variable>:<class>Int</class> = <class>SomeClass</class>.<static.member.variable>staticField</static.member.variable>; \n" + " <local.variable>reassignedValue</local.variable> ++; \n" + " function localFunction() {\n" + " var <local.variable>a</local.variable>:<class>Int</class> = \\?;// bad character `\\` \n" + " };\n" + " }\n" + "}\n" + "/* The next line is deliberately invalid syntax to show unparsable data. */\n" + "<unparseable>var $.{}{}</unparseable>" ; } }
{ "content_hash": "03731507d3dc44b85f85c84621669cc5", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 182, "avg_line_length": 53.714285714285715, "alnum_prop": 0.7232776089159068, "repo_name": "HaxeFoundation/intellij-haxe", "id": "fc97efad4a95691af5770c9f6aa06a29ec01082c", "size": "8596", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/common/com/intellij/plugins/haxe/ide/highlight/HaxeColorSettingsPage.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "200" }, { "name": "HTML", "bytes": "3072" }, { "name": "Haxe", "bytes": "168110" }, { "name": "Java", "bytes": "3303038" }, { "name": "Lex", "bytes": "26046" }, { "name": "Makefile", "bytes": "458" }, { "name": "Shell", "bytes": "1153" } ], "symlink_target": "" }
namespace Slang { struct DllImportContext { IRModule* module; DiagnosticSink* diagnosticSink; TargetRequest* targetReq; SharedIRBuilder sharedBuilder; IRFunc* loadDllFunc = nullptr; IRFunc* loadFuncPtrFunc = nullptr; IRFunc* stringGetBufferFunc = nullptr; IRFunc* createBuiltinIntrinsicFunc(UInt paramCount, IRType** paramTypes, IRType* resultType, UnownedStringSlice targetIntrinsic) { IRBuilder builder(sharedBuilder); builder.setInsertInto(module->getModuleInst()); IRFunc* result = builder.createFunc(); builder.setInsertInto(result); auto funcType = builder.getFuncType(paramCount, paramTypes, resultType); builder.setDataType(result, funcType); builder.addTargetIntrinsicDecoration( result, CapabilitySet(CapabilityAtom::CPP), targetIntrinsic); return result; } IRFunc* getLoadDllFunc() { if (!loadDllFunc) { IRBuilder builder(sharedBuilder); builder.setInsertInto(module->getModuleInst()); IRType* stringType = builder.getStringType(); loadDllFunc = createBuiltinIntrinsicFunc( 1, &stringType, builder.getPtrType(builder.getVoidType()), UnownedStringSlice("_slang_rt_load_dll($0)")); } return loadDllFunc; } IRFunc* getLoadFuncPtrFunc() { if (!loadFuncPtrFunc) { IRBuilder builder(sharedBuilder); builder.setInsertInto(module->getModuleInst()); IRType* stringType = builder.getStringType(); IRType* uintType = builder.getUIntType(); IRType* paramTypes[] = {builder.getPtrType(builder.getVoidType()), stringType, uintType }; loadFuncPtrFunc = createBuiltinIntrinsicFunc( 3, paramTypes, builder.getPtrType(builder.getVoidType()), UnownedStringSlice("_slang_rt_load_dll_func($0, $1, $2)")); } return loadFuncPtrFunc; } IRFunc* getStringGetBufferFunc() { if (!stringGetBufferFunc) { IRBuilder builder(sharedBuilder); builder.setInsertInto(module->getModuleInst()); IRType* stringType = builder.getStringType(); IRType* paramTypes[] = {stringType}; stringGetBufferFunc = createBuiltinIntrinsicFunc( 1, paramTypes, builder.getPtrType(builder.getCharType()), UnownedStringSlice("const_cast<char*>($0.getBuffer())")); } return stringGetBufferFunc; } uint32_t getStdCallArgumentSize(IRFunc* func) { uint32_t result = 0; for (auto param : func->getParams()) { IRSizeAndAlignment sizeAndAlignment; getNaturalSizeAndAlignment(targetReq, param->getDataType(), &sizeAndAlignment); result += (uint32_t)align(sizeAndAlignment.size, 4); } return result; } void processFunc(IRFunc* func, IRDllImportDecoration* dllImportDecoration) { assert(func->getFirstBlock() == nullptr); IRBuilder builder(sharedBuilder); NativeCallMarshallingContext marshalContext; auto nativeType = marshalContext.getNativeFuncType(builder, func->getDataType()); builder.setInsertInto(module->getModuleInst()); auto funcPtr = builder.createGlobalVar(nativeType); builder.setInsertInto(funcPtr); builder.emitBlock(); builder.emitReturn(builder.getNullVoidPtrValue()); builder.setInsertInto(func); auto block = builder.emitBlock(); builder.setInsertInto(block); // Emit parameters. auto declaredFuncType = func->getDataType(); List<IRParam*> params; for (UInt i = 0; i < declaredFuncType->getParamCount(); ++i) { auto paramType = declaredFuncType->getParamType(i); params.add(builder.emitParam((IRType*)paramType)); } IRInst* cmpArgs[] = {builder.emitLoad(nativeType, funcPtr), builder.getNullVoidPtrValue() }; auto isUninitialized = builder.emitIntrinsicInst(builder.getBoolType(), kIROp_Eql, 2, cmpArgs); auto trueBlock = builder.emitBlock(); auto afterBlock = builder.emitBlock(); builder.setInsertInto(block); builder.emitIf(isUninitialized, trueBlock, afterBlock); builder.setInsertInto(trueBlock); IRInst* modulePtr; if (dllImportDecoration->getLibraryName() == "") { modulePtr = builder.getNullVoidPtrValue(); } else { modulePtr = builder.emitCallInst( builder.getPtrType(builder.getVoidType()), getLoadDllFunc(), builder.getStringValue(dllImportDecoration->getLibraryName())); } auto argumentSize = builder.getIntValue(builder.getUIntType(), getStdCallArgumentSize(func)); IRInst* loadDllFuncArgs[] = { modulePtr, builder.getStringValue(dllImportDecoration->getFunctionName()), argumentSize}; auto loadedNativeFuncPtr = builder.emitCallInst( builder.getPtrType(builder.getVoidType()), getLoadFuncPtrFunc(), 3, loadDllFuncArgs); builder.emitStore( funcPtr, builder.emitBitCast(nativeType, loadedNativeFuncPtr)); builder.emitBranch(afterBlock); builder.setInsertInto(afterBlock); marshalContext.diagnosticSink = diagnosticSink; auto callResult = marshalContext.marshalNativeCall( builder, declaredFuncType, nativeType, builder.emitLoad(funcPtr), params.getCount(), (IRInst**)params.getBuffer()); builder.emitReturn(callResult); } void processModule() { for (auto childFunc : module->getGlobalInsts()) { switch(childFunc->getOp()) { case kIROp_Func: if (auto dllImportDecoration = childFunc->findDecoration<IRDllImportDecoration>()) { processFunc(as<IRFunc>(childFunc), dllImportDecoration); } break; default: break; } } } }; void generateDllImportFuncs(TargetRequest* targetReq, IRModule* module, DiagnosticSink* sink) { DllImportContext context; context.module = module; context.targetReq = targetReq; context.diagnosticSink = sink; context.sharedBuilder.init(module); return context.processModule(); } }
{ "content_hash": "4f884caed956af2840195233e8350a7b", "timestamp": "", "source": "github", "line_count": 195, "max_line_length": 132, "avg_line_length": 34.261538461538464, "alnum_prop": 0.6166741505762611, "repo_name": "csyonghe/slang", "id": "8b611feba08df3fec718111c76365664d038bf0a", "size": "6864", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "source/slang/slang-ir-dll-import.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2330" }, { "name": "C", "bytes": "155933" }, { "name": "C++", "bytes": "10954949" }, { "name": "Cuda", "bytes": "176" }, { "name": "GLSL", "bytes": "54955" }, { "name": "HLSL", "bytes": "70167" }, { "name": "Lua", "bytes": "56675" }, { "name": "Shell", "bytes": "3616" } ], "symlink_target": "" }
package s3api import ( "encoding/xml" "time" ) // Status represents lifecycle configuration status type ruleStatus string // Supported status types const ( Enabled ruleStatus = "Enabled" Disabled ruleStatus = "Disabled" ) // Lifecycle - Configuration for bucket lifecycle. type Lifecycle struct { XMLName xml.Name `xml:"LifecycleConfiguration"` Rules []Rule `xml:"Rule"` } // Rule - a rule for lifecycle configuration. type Rule struct { XMLName xml.Name `xml:"Rule"` ID string `xml:"ID,omitempty"` Status ruleStatus `xml:"Status"` Filter Filter `xml:"Filter,omitempty"` Prefix Prefix `xml:"Prefix,omitempty"` Expiration Expiration `xml:"Expiration,omitempty"` Transition Transition `xml:"Transition,omitempty"` } // Filter - a filter for a lifecycle configuration Rule. type Filter struct { XMLName xml.Name `xml:"Filter"` set bool Prefix Prefix And And andSet bool Tag Tag tagSet bool } // Prefix holds the prefix xml tag in <Rule> and <Filter> type Prefix struct { string set bool } // MarshalXML encodes Prefix field into an XML form. func (p Prefix) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { if !p.set { return nil } return e.EncodeElement(p.string, startElement) } // MarshalXML encodes Filter field into an XML form. func (f Filter) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if err := e.EncodeToken(start); err != nil { return err } if err := e.EncodeElement(f.Prefix, xml.StartElement{Name: xml.Name{Local: "Prefix"}}); err != nil { return err } return e.EncodeToken(xml.EndElement{Name: start.Name}) } // And - a tag to combine a prefix and multiple tags for lifecycle configuration rule. type And struct { XMLName xml.Name `xml:"And"` Prefix Prefix `xml:"Prefix,omitempty"` Tags []Tag `xml:"Tag,omitempty"` } // Expiration - expiration actions for a rule in lifecycle configuration. type Expiration struct { XMLName xml.Name `xml:"Expiration"` Days int `xml:"Days,omitempty"` Date ExpirationDate `xml:"Date,omitempty"` DeleteMarker ExpireDeleteMarker `xml:"ExpiredObjectDeleteMarker"` set bool } // MarshalXML encodes expiration field into an XML form. func (e Expiration) MarshalXML(enc *xml.Encoder, startElement xml.StartElement) error { if !e.set { return nil } type expirationWrapper Expiration return enc.EncodeElement(expirationWrapper(e), startElement) } // ExpireDeleteMarker represents value of ExpiredObjectDeleteMarker field in Expiration XML element. type ExpireDeleteMarker struct { val bool set bool } // MarshalXML encodes delete marker boolean into an XML form. func (b ExpireDeleteMarker) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { if !b.set { return nil } return e.EncodeElement(b.val, startElement) } // ExpirationDate is a embedded type containing time.Time to unmarshal // Date in Expiration type ExpirationDate struct { time.Time } // MarshalXML encodes expiration date if it is non-zero and encodes // empty string otherwise func (eDate ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { if eDate.Time.IsZero() { return nil } return e.EncodeElement(eDate.Format(time.RFC3339), startElement) } // Transition - transition actions for a rule in lifecycle configuration. type Transition struct { XMLName xml.Name `xml:"Transition"` Days int `xml:"Days,omitempty"` Date time.Time `xml:"Date,omitempty"` StorageClass string `xml:"StorageClass,omitempty"` set bool } // MarshalXML encodes transition field into an XML form. func (t Transition) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { if !t.set { return nil } type transitionWrapper Transition return enc.EncodeElement(transitionWrapper(t), start) } // TransitionDays is a type alias to unmarshal Days in Transition type TransitionDays int
{ "content_hash": "75b594506a5f7a59dba47d9a2ebeb22b", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 101, "avg_line_length": 26.83783783783784, "alnum_prop": 0.7245720040281974, "repo_name": "chrislusf/seaweedfs", "id": "6e2c8cfa2c801e4d12fa644a6d60d0bc9aee41ba", "size": "3972", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "weed/s3api/s3api_policy.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "341" }, { "name": "Go", "bytes": "2846786" }, { "name": "HTML", "bytes": "25537" }, { "name": "Java", "bytes": "390343" }, { "name": "Lua", "bytes": "1515" }, { "name": "Makefile", "bytes": "7088" }, { "name": "Shell", "bytes": "5602" }, { "name": "Smarty", "bytes": "6176" } ], "symlink_target": "" }
package org.slieb.throwables; import java.lang.FunctionalInterface; import java.lang.SuppressWarnings; import java.lang.Throwable; import java.util.function.Consumer; import java.util.function.LongBinaryOperator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Generated from LongBinaryOperator * Extends java.util.function.LongBinaryOperator to allow for a checked exception. * * @param <E> The extension */ @FunctionalInterface @SuppressWarnings({"WeakerAccess"}) public interface LongBinaryOperatorWithThrowable<E extends Throwable> extends LongBinaryOperator { /** * Utility method to mark lambdas of type LongBinaryOperatorWithThrowable * * @param longbinaryoperatorwiththrowable The interface instance * @param <E> The type this interface is allowed to throw * @return the cast interface */ static <E extends Throwable> LongBinaryOperatorWithThrowable<E> castLongBinaryOperatorWithThrowable(final LongBinaryOperatorWithThrowable<E> longbinaryoperatorwiththrowable) { return longbinaryoperatorwiththrowable; } /** * Utility method to unwrap lambdas of type LongBinaryOperator and withUncheckedThrowable any Exception * * @param longbinaryoperatorwiththrowable The interface instance * @param <E> The type this interface is allowed to throw * @throws E the original Exception from longbinaryoperatorwiththrowable * @return the cast interface */ static <E extends Throwable> LongBinaryOperator aLongBinaryOperatorThatUnsafelyThrowsUnchecked(final LongBinaryOperatorWithThrowable<E> longbinaryoperatorwiththrowable) throws E { return longbinaryoperatorwiththrowable.thatUnsafelyThrowsUnchecked(); } /** * Utility method to convert LongBinaryOperatorWithThrowable * @param longbinaryoperator The interface instance * @param <E> The type this interface is allowed to throw * @return the cast interface */ static <E extends Throwable> LongBinaryOperatorWithThrowable<E> asLongBinaryOperatorWithThrowable(final LongBinaryOperator longbinaryoperator) { return longbinaryoperator::applyAsLong; } /** * Overridden method of LongBinaryOperatorWithThrowable that will call applyAsLongWithThrowable, but catching any exceptions. * * @param v1 parameter to overridden method * @param v2 parameter to overridden method * @return the value */ @Override default long applyAsLong(final long v1, final long v2) { try { return applyAsLongWithThrowable(v1, v2); } catch (final RuntimeException | Error exception) { throw exception; } catch (final Throwable throwable) { throw new SuppressedException(throwable); } } /** * Functional method that will throw exceptions. * * @param v1 parameter to overridden method * @param v2 parameter to overridden method * @return the value * @throws E some exception */ long applyAsLongWithThrowable(final long v1, final long v2) throws E; /** * @param defaultReturnValue A value to return if any throwable is caught. * @return An interface that returns a default value if any exception occurs. */ default LongBinaryOperator thatReturnsOnCatch(final long defaultReturnValue) { return (final long v1, final long v2) -> { try { return applyAsLongWithThrowable(v1, v2); } catch(final Throwable throwable) { return defaultReturnValue; } }; } /** * @throws E if an exception E has been thrown, it is rethrown by this method * @return An interface that is only returned if no exception has been thrown. */ default LongBinaryOperator thatUnsafelyThrowsUnchecked() throws E { return (final long v1, final long v2) -> { try { return applyAsLongWithThrowable(v1, v2); } catch(final Throwable throwable) { SuppressedException.throwUnsafelyAsUnchecked(throwable); return 0; } }; } /** * @param logger The logger to log exceptions on * @param message A message to use for logging exceptions * @return An interface that will log all exceptions to given logger */ @SuppressWarnings("Duplicates") default LongBinaryOperatorWithThrowable<E> withLogging(final Logger logger, final String message) { return (final long v1, final long v2) -> { try { return applyAsLongWithThrowable(v1, v2); } catch (final Throwable throwable) { logger.error(message, v1, v2, throwable); throw throwable; } }; } /** * Will log WARNING level exceptions on logger if they occur within the interface * @param logger The logger instance to log exceptions on * @return An interface that will log exceptions on given logger */ default LongBinaryOperatorWithThrowable<E> withLogging(final Logger logger) { return withLogging(logger, "Exception in LongBinaryOperatorWithThrowable with the arguments [{}, {}]"); } /** * Will log WARNING level exceptions on logger if they occur within the interface * @return An interface that will log exceptions on global logger */ default LongBinaryOperatorWithThrowable<E> withLogging() { return withLogging(LoggerFactory.getLogger(getClass())); } /** * @param consumer An exception consumer. * @return An interface that will log all exceptions to given logger */ @SuppressWarnings("Duplicates") default LongBinaryOperatorWithThrowable<E> onException(final Consumer<Throwable> consumer) { return (final long v1, final long v2) -> { try { return applyAsLongWithThrowable(v1, v2); } catch (final Throwable throwable) { consumer.accept(throwable); throw throwable; } }; } /** * @param consumer An exception consumer. * @return An interface that will log all exceptions to given logger */ @SuppressWarnings("Duplicates") default LongBinaryOperatorWithThrowable<E> onException(final java.util.function.BiConsumer<Throwable, Object[]> consumer) { return (final long v1, final long v2) -> { try { return applyAsLongWithThrowable(v1, v2); } catch (final Throwable throwable) { consumer.accept(throwable, new Object[]{v1, v2}); throw throwable; } }; } }
{ "content_hash": "7455c3282769ffce463088b136074d44", "timestamp": "", "source": "github", "line_count": 182, "max_line_length": 183, "avg_line_length": 36.56043956043956, "alnum_prop": 0.6767357980162308, "repo_name": "StefanLiebenberg/throwable-interfaces", "id": "b1bfe3bb5391483101ba5f3b338fe311f6b30d82", "size": "6654", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/org/slieb/throwables/LongBinaryOperatorWithThrowable.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "596611" } ], "symlink_target": "" }
using NMF.Collections.Generic; using NMF.Collections.ObjectModel; using NMF.Expressions; using NMF.Expressions.Linq; using NMF.Models; using NMF.Models.Collections; using NMF.Models.Expressions; using NMF.Models.Meta; using NMF.Models.Repository; using NMF.Serialization; using NMF.Utilities; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Linq; using TTC2017.SmartGrids.CIM; using TTC2017.SmartGrids.CIM.IEC61970.ControlArea; using TTC2017.SmartGrids.CIM.IEC61970.Core; using TTC2017.SmartGrids.CIM.IEC61970.Informative.MarketOperations; using TTC2017.SmartGrids.CIM.IEC61970.Wires; namespace TTC2017.SmartGrids.CIM.IEC61970.LoadModel { public class ConformLoadGroupConformLoadSchedulesCollection : ObservableOppositeOrderedSet<IConformLoadGroup, IConformLoadSchedule> { public ConformLoadGroupConformLoadSchedulesCollection(IConformLoadGroup parent) : base(parent) { } private void OnItemDeleted(object sender, System.EventArgs e) { this.Remove(((IConformLoadSchedule)(sender))); } protected override void SetOpposite(IConformLoadSchedule item, IConformLoadGroup parent) { if ((parent != null)) { item.Deleted += this.OnItemDeleted; item.ConformLoadGroup = parent; } else { item.Deleted -= this.OnItemDeleted; if ((item.ConformLoadGroup == this.Parent)) { item.ConformLoadGroup = parent; } } } } }
{ "content_hash": "09e01048c0faeba4d39d016556e44d4a", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 135, "avg_line_length": 29.55, "alnum_prop": 0.6649746192893401, "repo_name": "georghinkel/ttc2017smartGrids", "id": "5bd0732ed30e54166ad125f927784822757d254a", "size": "2208", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "generator/Schema/IEC61970/LoadModel/ConformLoadGroupConformLoadSchedulesCollection.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "79261108" }, { "name": "Java", "bytes": "38407170" }, { "name": "Python", "bytes": "6055" }, { "name": "R", "bytes": "15405" }, { "name": "Rebol", "bytes": "287" } ], "symlink_target": "" }
package org.apache.shiro.grails; import org.codehaus.groovy.grails.commons.AbstractInjectableGrailsClass; public class DefaultRealmGrailsClass extends AbstractInjectableGrailsClass implements RealmGrailsClass { public DefaultRealmGrailsClass(Class<?> wrappedClass) { super(wrappedClass, RealmArtefactHandler.TYPE); } }
{ "content_hash": "ef167561bffd700a55085877e5abd259", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 104, "avg_line_length": 33.8, "alnum_prop": 0.8136094674556213, "repo_name": "putin266/Vote", "id": "3b2146cccb5c1187ab130cfc2b9f00f734bc595f", "size": "1086", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "target/work/plugins/shiro-1.2.1/src/java/org/apache/shiro/grails/DefaultRealmGrailsClass.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package graphql.language; import com.google.common.collect.ImmutableList; import graphql.Internal; import graphql.PublicApi; import graphql.util.TraversalControl; import graphql.util.TraverserContext; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Consumer; import static graphql.Assert.assertNotNull; import static graphql.collect.ImmutableKit.emptyList; import static graphql.collect.ImmutableKit.emptyMap; import static graphql.language.NodeChildrenContainer.newNodeChildrenContainer; import static graphql.language.NodeUtil.assertNewChildrenAreEmpty; @PublicApi public class EnumValue extends AbstractNode<EnumValue> implements Value<EnumValue>, NamedNode<EnumValue> { private final String name; @Internal protected EnumValue(String name, SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData) { super(sourceLocation, comments, ignoredChars, additionalData); this.name = name; } /** * alternative to using a Builder for convenience * * @param name of the enum value */ public EnumValue(String name) { this(name, null, emptyList(), IgnoredChars.EMPTY, emptyMap()); } public static EnumValue of(String name) { return newEnumValue().name(name).build(); } @Override public String getName() { return name; } @Override public List<Node> getChildren() { return emptyList(); } @Override public NodeChildrenContainer getNamedChildren() { return newNodeChildrenContainer().build(); } @Override public EnumValue withNewChildren(NodeChildrenContainer newChildren) { assertNewChildrenAreEmpty(newChildren); return this; } @Override public boolean isEqualTo(Node o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EnumValue that = (EnumValue) o; return Objects.equals(this.name, that.name); } @Override public EnumValue deepCopy() { return new EnumValue(name, getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData()); } @Override public String toString() { return "EnumValue{" + "name='" + name + '\'' + '}'; } @Override public TraversalControl accept(TraverserContext<Node> context, NodeVisitor visitor) { return visitor.visitEnumValue(this, context); } public static Builder newEnumValue() { return new Builder(); } public static Builder newEnumValue(String name) { return new Builder().name(name); } public EnumValue transform(Consumer<Builder> builderConsumer) { Builder builder = new Builder(this); builderConsumer.accept(builder); return builder.build(); } public static final class Builder implements NodeBuilder { private SourceLocation sourceLocation; private String name; private ImmutableList<Comment> comments = emptyList(); private IgnoredChars ignoredChars = IgnoredChars.EMPTY; private Map<String, String> additionalData = new LinkedHashMap<>(); private Builder() { } private Builder(EnumValue existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = ImmutableList.copyOf(existing.getComments()); this.name = existing.getName(); this.additionalData = new LinkedHashMap<>(existing.getAdditionalData()); } public Builder sourceLocation(SourceLocation sourceLocation) { this.sourceLocation = sourceLocation; return this; } public Builder name(String name) { this.name = name; return this; } public Builder comments(List<Comment> comments) { this.comments = ImmutableList.copyOf(comments); return this; } public Builder ignoredChars(IgnoredChars ignoredChars) { this.ignoredChars = ignoredChars; return this; } public Builder additionalData(Map<String, String> additionalData) { this.additionalData = assertNotNull(additionalData); return this; } public Builder additionalData(String key, String value) { this.additionalData.put(key, value); return this; } public EnumValue build() { return new EnumValue(name, sourceLocation, comments, ignoredChars, additionalData); } } }
{ "content_hash": "b1f5e21b140a40c1c2faf787f33ab3af", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 156, "avg_line_length": 28.49700598802395, "alnum_prop": 0.6509770960285775, "repo_name": "graphql-java/graphql-java", "id": "999b58712febf41d1652656c2fb9308238237ff7", "size": "4759", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/graphql/language/EnumValue.java", "mode": "33188", "license": "mit", "language": [ { "name": "ANTLR", "bytes": "8546" }, { "name": "Groovy", "bytes": "2276282" }, { "name": "HTML", "bytes": "4949" }, { "name": "Java", "bytes": "3031418" } ], "symlink_target": "" }
#ifndef UTIL_RECORDIO_SINGLE_PROTO_H_ #define UTIL_RECORDIO_SINGLE_PROTO_H_ #include <string> #include <google/protobuf/message_lite.h> void WriteCompressedProtoToFile( const google::protobuf::MessageLite& message, const std::string& filename); #endif /* UTIL_RECORDIO_SINGLE_PROTO_H_ */
{ "content_hash": "d759eb0b70df2638b7ccd0ff0ff23bf2", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 49, "avg_line_length": 21.571428571428573, "alnum_prop": 0.7417218543046358, "repo_name": "chubbymaggie/Nice2Predict", "id": "619d61e7c0eccc94c09bd35ee826e832b18a64c4", "size": "368", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "util/recordio/single_proto.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1871" }, { "name": "C++", "bytes": "576577" }, { "name": "CSS", "bytes": "21069" }, { "name": "HTML", "bytes": "37790" }, { "name": "JavaScript", "bytes": "347884" }, { "name": "Python", "bytes": "12451" } ], "symlink_target": "" }
<!-- HTML header for doxygen 1.8.6--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.12"/> <title>OpenCV: Member List</title> <link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" /> <link href="../../tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../jquery.js"></script> <script type="text/javascript" src="../../dynsections.js"></script> <link href="../../search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../search/searchdata.js"></script> <script type="text/javascript" src="../../search/search.js"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"], jax: ["input/TeX","output/HTML-CSS"], }); //<![CDATA[ MathJax.Hub.Config( { TeX: { Macros: { matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9], fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4], forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6], vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3], vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9], hdotsfor: ["\\dots", 1], mathbbm: ["\\mathbb{#1}", 1], bordermatrix: ["\\matrix{#1}", 1] } } } ); //]]> </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> <link href="../../doxygen.css" rel="stylesheet" type="text/css" /> <link href="../../stylesheet.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <!--#include virtual="/google-search.html"--> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">OpenCV &#160;<span id="projectnumber">3.2.0</span> </div> <div id="projectbrief">Open Source Computer Vision</div> </td> </tr> </tbody> </table> </div> <script type="text/javascript"> //<![CDATA[ function getLabelName(innerHTML) { var str = innerHTML.toLowerCase(); // Replace all '+' with 'p' str = str.split('+').join('p'); // Replace all ' ' with '_' str = str.split(' ').join('_'); // Replace all '#' with 'sharp' str = str.split('#').join('sharp'); // Replace other special characters with 'ascii' + code for (var i = 0; i < str.length; i++) { var charCode = str.charCodeAt(i); if (!(charCode == 95 || (charCode > 96 && charCode < 123) || (charCode > 47 && charCode < 58))) str = str.substr(0, i) + 'ascii' + charCode + str.substr(i + 1); } return str; } function addToggle() { var $getDiv = $('div.newInnerHTML').last(); var buttonName = $getDiv.html(); var label = getLabelName(buttonName.trim()); $getDiv.attr("title", label); $getDiv.hide(); $getDiv = $getDiv.next(); $getDiv.attr("class", "toggleable_div label_" + label); $getDiv.hide(); } //]]> </script> <!-- end header part --> <!-- Generated by Doxygen 1.8.12 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "../../search",false,'Search'); </script> <script type="text/javascript" src="../../menudata.js"></script> <script type="text/javascript" src="../../menu.js"></script> <script type="text/javascript"> $(function() { initMenu('../../',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="../../d2/d75/namespacecv.html">cv</a></li><li class="navelem"><a class="el" href="../../d7/d58/namespacecv_1_1structured__light.html">structured_light</a></li><li class="navelem"><a class="el" href="../../d6/d96/classcv_1_1structured__light_1_1SinusoidalPattern.html">SinusoidalPattern</a></li><li class="navelem"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">Params</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">cv::structured_light::SinusoidalPattern::Params Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a1928f2537c463e85857acbd1fd620b29">height</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#ae7297d16cebc75ef79f227730c651cf1">horizontal</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a3ffbabeee2c5ed33fbb2464d842a2cf7">markersLocation</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#afbbc6da65b06b05e696bfa95b3326f52">methodId</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a6de65e87b137bcbef73eaf5c255f1376">nbrOfPeriods</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a16f802cb311a1bd401740755eb12fffd">nbrOfPixelsBetweenMarkers</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#ab214b6cd84af5b3e5b759e5f6f731edd">Params</a>()</td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a1b8a00a40198b20bd935d499257267c6">setMarkers</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a59e0895b9e37f8af2f9ff659697ae5d0">shiftValue</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html#a5e78febfc43f763b3902cd6360d5e1a2">width</a></td><td class="entry"><a class="el" href="../../df/d21/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params.html">cv::structured_light::SinusoidalPattern::Params</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- HTML footer for doxygen 1.8.6--> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Fri Dec 23 2016 13:00:29 for OpenCV by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="../../doxygen.png" alt="doxygen"/> </a> 1.8.12 </small></address> <script type="text/javascript"> //<![CDATA[ function addButton(label, buttonName) { var b = document.createElement("BUTTON"); b.innerHTML = buttonName; b.setAttribute('class', 'toggleable_button label_' + label); b.onclick = function() { $('.toggleable_button').css({ border: '2px outset', 'border-radius': '4px' }); $('.toggleable_button.label_' + label).css({ border: '2px inset', 'border-radius': '4px' }); $('.toggleable_div').css('display', 'none'); $('.toggleable_div.label_' + label).css('display', 'block'); }; b.style.border = '2px outset'; b.style.borderRadius = '4px'; b.style.margin = '2px'; return b; } function buttonsToAdd($elements, $heading, $type) { if ($elements.length === 0) { $elements = $("" + $type + ":contains(" + $heading.html() + ")").parent().prev("div.newInnerHTML"); } var arr = jQuery.makeArray($elements); var seen = {}; arr.forEach(function(e) { var txt = e.innerHTML; if (!seen[txt]) { $button = addButton(e.title, txt); if (Object.keys(seen).length == 0) { var linebreak1 = document.createElement("br"); var linebreak2 = document.createElement("br"); ($heading).append(linebreak1); ($heading).append(linebreak2); } ($heading).append($button); seen[txt] = true; } }); return; } $("h2").each(function() { $heading = $(this); $smallerHeadings = $(this).nextUntil("h2").filter("h3").add($(this).nextUntil("h2").find("h3")); if ($smallerHeadings.length) { $smallerHeadings.each(function() { var $elements = $(this).nextUntil("h3").filter("div.newInnerHTML"); buttonsToAdd($elements, $(this), "h3"); }); } else { var $elements = $(this).nextUntil("h2").filter("div.newInnerHTML"); buttonsToAdd($elements, $heading, "h2"); } }); $(".toggleable_button").first().click(); var $clickDefault = $('.toggleable_button.label_python').first(); if ($clickDefault.length) { $clickDefault.click(); } $clickDefault = $('.toggleable_button.label_cpp').first(); if ($clickDefault.length) { $clickDefault.click(); } //]]> </script> </body> </html>
{ "content_hash": "acb92b81d2b47b90b2e6e6d3179b3dbf", "timestamp": "", "source": "github", "line_count": 220, "max_line_length": 476, "avg_line_length": 55.404545454545456, "alnum_prop": 0.6372138813684469, "repo_name": "lucasbrsa/OpenCV-3.2", "id": "f174d8dc8aace2f059bdea31058ff0bd4488617a", "size": "12189", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/3.2/dd/d6f/structcv_1_1structured__light_1_1SinusoidalPattern_1_1Params-members.html", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "320592" }, { "name": "C#", "bytes": "12756" }, { "name": "C++", "bytes": "499322" }, { "name": "CMake", "bytes": "244871" }, { "name": "Makefile", "bytes": "344335" }, { "name": "Python", "bytes": "7735" }, { "name": "Visual Basic", "bytes": "13139" } ], "symlink_target": "" }
// // DTBaseTableViewController.h // 堆糖 // // Created by ZYZ on 16/3/16. // Copyright © 2016年 ZYZ. All rights reserved. // #import <UIKit/UIKit.h> @interface DTBaseTableViewController : UITableViewController /** */ @property(nonatomic,strong)NSMutableArray *groups; @end
{ "content_hash": "8e6ca509f4a4c9781f3b79e9cf10997b", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 60, "avg_line_length": 18.533333333333335, "alnum_prop": 0.7158273381294964, "repo_name": "MarkTangs/DuiTang", "id": "fda0d95fb6ea8dab2449190f1a1963c16dd65840", "size": "285", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "堆糖/堆糖/Classes/Setting(设置)/Controller/DTBaseTableViewController.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Objective-C", "bytes": "787383" }, { "name": "Shell", "bytes": "10795" } ], "symlink_target": "" }