text stringlengths 2 1.04M | meta dict |
|---|---|
package org.araqne.webconsole.impl;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.ServiceProperty;
import org.araqne.api.Script;
import org.araqne.api.ScriptFactory;
import org.araqne.confdb.ConfigService;
import org.araqne.webconsole.CometMonitor;
import org.araqne.webconsole.ProgramApi;
import org.araqne.webconsole.WebConsole;
@Component(name = "webconsole-script-factory")
@Provides
public class WebConsoleScriptFactory implements ScriptFactory {
@ServiceProperty(name = "alias", value = "webconsole")
private String alias;
@Requires
private ConfigService conf;
@Requires
private ProgramApi programApi;
@Requires
private CometMonitor cometMonitor;
@Requires
private WebConsole webConsole;
@Override
public Script createScript() {
return new WebConsoleScript(conf, programApi, cometMonitor, webConsole);
}
}
| {
"content_hash": "309b1a8a7345078aebed1af0402e0450",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 74,
"avg_line_length": 26.026315789473685,
"alnum_prop": 0.8109201213346815,
"repo_name": "araqne/webfx",
"id": "9d011ee17d208ff66c5b4118639d194d27bd6072",
"size": "1585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "araqne-webconsole/src/main/java/org/araqne/webconsole/impl/WebConsoleScriptFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "14833"
},
{
"name": "CSS",
"bytes": "258493"
},
{
"name": "HTML",
"bytes": "224911"
},
{
"name": "Java",
"bytes": "1343070"
},
{
"name": "JavaScript",
"bytes": "3401919"
},
{
"name": "Python",
"bytes": "2631"
}
],
"symlink_target": ""
} |
SET ROLE zalando_nakadi_data_owner;
ALTER TABLE zn_data.timeline
ADD COLUMN tl_deleted BOOLEAN DEFAULT FALSE; | {
"content_hash": "884a5060adf071dcea19494d1ff158d5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 46,
"avg_line_length": 28,
"alnum_prop": 0.8035714285714286,
"repo_name": "zalando/nakadi",
"id": "d5bb71e19de57cd6593507ccdb6091290f520f5a",
"size": "112",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "database/migration/aruha-535-cleanup-timelines.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "872"
},
{
"name": "Java",
"bytes": "2485055"
},
{
"name": "PLpgSQL",
"bytes": "1208"
},
{
"name": "Shell",
"bytes": "1956"
}
],
"symlink_target": ""
} |

Easy patching for python unittests.
The plan is to make it so that you just add a list of functions you want to patch to `self` during `setUp()` and then the library will patch them and set them on `self`. This means no more decorator piles or long lists of arguments into test functions.
Currently this has only been tested for mocking functions, classes are next!
| {
"content_hash": "e3012f08e95a68634191137a1df2390f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 252,
"avg_line_length": 72,
"alnum_prop": 0.7837301587301587,
"repo_name": "nicksamps/nadine",
"id": "2b70e8595109c5be2dc1da73e303a9d1c06671dd",
"size": "514",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "4422"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Mon Mar 03 10:44:38 EST 2014 -->
<title>Uses of Class org.hibernate.dialect.function.SQLFunctionTemplate (Hibernate JavaDocs)</title>
<meta name="date" content="2014-03-03">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.hibernate.dialect.function.SQLFunctionTemplate (Hibernate JavaDocs)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/hibernate/dialect/function/SQLFunctionTemplate.html" title="class in org.hibernate.dialect.function">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/hibernate/dialect/function/class-use/SQLFunctionTemplate.html" target="_top">Frames</a></li>
<li><a href="SQLFunctionTemplate.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.hibernate.dialect.function.SQLFunctionTemplate" class="title">Uses of Class<br>org.hibernate.dialect.function.SQLFunctionTemplate</h2>
</div>
<div class="classUseContainer">No usage of org.hibernate.dialect.function.SQLFunctionTemplate</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/hibernate/dialect/function/SQLFunctionTemplate.html" title="class in org.hibernate.dialect.function">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/hibernate/dialect/function/class-use/SQLFunctionTemplate.html" target="_top">Frames</a></li>
<li><a href="SQLFunctionTemplate.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2001-2014 <a href="http://redhat.com">Red Hat, Inc.</a> All Rights Reserved.</small></p>
</body>
</html>
| {
"content_hash": "9432865560b7aa4e87a028e75609446d",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 163,
"avg_line_length": 38.60344827586207,
"alnum_prop": 0.6250558284948637,
"repo_name": "serious6/HibernateSimpleProject",
"id": "496f3b729d26e35dfbe76b6a5e01cf6792a95be5",
"size": "4478",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "javadoc/hibernate_Doc/org/hibernate/dialect/function/class-use/SQLFunctionTemplate.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "12560"
},
{
"name": "Java",
"bytes": "15329"
}
],
"symlink_target": ""
} |
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Internals\Options
*/
/**
* Overal Option Management class.
*
* Instantiates all the options and offers a number of utility methods to work with the options.
*/
class WPSEO_Options {
/**
* Options this class uses.
*
* @var array Array format: (string) option_name => (string) name of concrete class for the option.
* @static
*/
public static $options = array(
'wpseo' => 'WPSEO_Option_Wpseo',
'wpseo_titles' => 'WPSEO_Option_Titles',
'wpseo_social' => 'WPSEO_Option_Social',
'wpseo_ms' => 'WPSEO_Option_MS',
'wpseo_taxonomy_meta' => 'WPSEO_Taxonomy_Meta',
);
/**
* Array of instantiated option objects.
*
* @var array
*/
protected static $option_instances = array();
/**
* Instance of this class.
*
* @var object
*/
protected static $instance;
/**
* Backfill instance.
*
* @var WPSEO_Options_Backfill
*/
protected static $backfill;
/**
* Instantiate all the WPSEO option management classes.
*/
protected function __construct() {
// Backfill option values after transferring them to another base.
self::$backfill = new WPSEO_Options_Backfill();
self::$backfill->register_hooks();
$is_multisite = is_multisite();
foreach ( self::$options as $option_name => $option_class ) {
$instance = call_user_func( array( $option_class, 'get_instance' ) );
if ( ! $instance->multisite_only || $is_multisite ) {
self::$option_instances[ $option_name ] = $instance;
}
else {
unset( self::$options[ $option_name ] );
}
}
}
/**
* Get the singleton instance of this class.
*
* @return object
*/
public static function get_instance() {
if ( ! ( self::$instance instanceof self ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Get the group name of an option for use in the settings form.
*
* @param string $option_name The option for which you want to retrieve the option group name.
*
* @return string|bool
*/
public static function get_group_name( $option_name ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
return self::$option_instances[ $option_name ]->group_name;
}
return false;
}
/**
* Get a specific default value for an option.
*
* @param string $option_name The option for which you want to retrieve a default.
* @param string $key The key within the option who's default you want.
*
* @return mixed
*/
public static function get_default( $option_name, $key ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
$defaults = self::$option_instances[ $option_name ]->get_defaults();
if ( isset( $defaults[ $key ] ) ) {
return $defaults[ $key ];
}
}
return null;
}
/**
* Update a site_option.
*
* @param string $option_name The option name of the option to save.
* @param mixed $value The new value for the option.
*
* @return bool
*/
public static function update_site_option( $option_name, $value ) {
if ( is_multisite() && isset( self::$option_instances[ $option_name ] ) ) {
return self::$option_instances[ $option_name ]->update_site_option( $value );
}
return false;
}
/**
* Get the instantiated option instance.
*
* @param string $option_name The option for which you want to retrieve the instance.
*
* @return object|bool
*/
public static function get_option_instance( $option_name ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
return self::$option_instances[ $option_name ];
}
return false;
}
/**
* Retrieve an array of the options which should be included in get_all() and reset().
*
* @static
* @return array Array of option names
*/
public static function get_option_names() {
static $option_names = array();
if ( $option_names === array() ) {
foreach ( self::$option_instances as $option_name => $option_object ) {
if ( $option_object->include_in_all === true ) {
$option_names[] = $option_name;
}
}
$option_names = apply_filters( 'wpseo_options', $option_names );
}
return $option_names;
}
/**
* Retrieve all the options for the SEO plugin in one go.
*
* @todo [JRF] see if we can get some extra efficiency for this one, though probably not as options may
* well change between calls (enriched defaults and such)
*
* @static
* @return array Array combining the values of all the options
*/
public static function get_all() {
return self::get_options( self::get_option_names() );
}
/**
* Retrieve one or more options for the SEO plugin.
*
* @static
*
* @param array $option_names An array of option names of the options you want to get.
*
* @return array Array combining the values of the requested options
*/
public static function get_options( array $option_names ) {
$options = array();
$option_names = array_filter( $option_names, 'is_string' );
foreach ( $option_names as $option_name ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
$option = self::get_option( $option_name );
$options = array_merge( $options, $option );
}
}
return $options;
}
/**
* Retrieve a single option for the SEO plugin.
*
* @static
*
* @param string $option_name The name of the option you want to get.
*
* @return array Array containing the requested option.
*/
public static function get_option( $option_name ) {
$option = null;
if ( is_string( $option_name ) && ! empty( $option_name ) ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
if ( self::$option_instances[ $option_name ]->multisite_only !== true ) {
$option = get_option( $option_name );
}
else {
$option = get_site_option( $option_name );
}
}
}
return $option;
}
/**
* Retrieve a single field from any option for the SEO plugin. Keys are always unique.
*
* @param string $key The key it should return.
* @param mixed $default The default value that should be returned if the key isn't set.
*
* @return mixed|null Returns value if found, $default if not.
*/
public static function get( $key, $default = null ) {
self::$backfill->remove_hooks();
$option = self::get_all();
$option = self::add_ms_option( $option );
self::$backfill->register_hooks();
if ( isset( $option[ $key ] ) ) {
return $option[ $key ];
}
return $default;
}
/**
* Retrieve a single field from an option for the SEO plugin.
*
* @param string $key The key to set.
* @param mixed $value The value to set.
*
* @return mixed|null Returns value if found, $default if not.
*/
public static function set( $key, $value ) {
$lookup_table = self::get_lookup_table();
if ( isset( $lookup_table[ $key ] ) ) {
return self::save_option( $lookup_table[ $key ], $key, $value );
}
$patterns = self::get_pattern_table();
foreach ( $patterns as $pattern => $option ) {
if ( strpos( $key, $pattern ) === 0 ) {
return self::save_option( $option, $key, $value );
}
}
}
/**
* Get an option only if it's been auto-loaded.
*
* @static
*
* @param string $option The option to retrieve.
* @param bool|mixed $default A default value to return.
*
* @return bool|mixed
*/
public static function get_autoloaded_option( $option, $default = false ) {
$value = wp_cache_get( $option, 'options' );
if ( false === $value ) {
$passed_default = func_num_args() > 1;
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option );
}
/**
* Run the clean up routine for one or all options.
*
* @param array|string $option_name Optional. the option you want to clean or an array of
* option names for the options you want to clean.
* If not set, all options will be cleaned.
* @param string $current_version Optional. Version from which to upgrade, if not set,
* version specific upgrades will be disregarded.
*
* @return void
*/
public static function clean_up( $option_name = null, $current_version = null ) {
if ( isset( $option_name ) && is_string( $option_name ) && $option_name !== '' ) {
if ( isset( self::$option_instances[ $option_name ] ) ) {
self::$option_instances[ $option_name ]->clean( $current_version );
}
}
elseif ( isset( $option_name ) && is_array( $option_name ) && $option_name !== array() ) {
foreach ( $option_name as $option ) {
if ( isset( self::$option_instances[ $option ] ) ) {
self::$option_instances[ $option ]->clean( $current_version );
}
}
unset( $option );
}
else {
foreach ( self::$option_instances as $instance ) {
$instance->clean( $current_version );
}
unset( $instance );
// If we've done a full clean-up, we can safely remove this really old option.
delete_option( 'wpseo_indexation' );
}
}
/**
* Check that all options exist in the database and add any which don't.
*
* @return void
*/
public static function ensure_options_exist() {
foreach ( self::$option_instances as $instance ) {
$instance->maybe_add_option();
}
}
/**
* Initialize some options on first install/activate/reset.
*
* @static
* @return void
*/
public static function initialize() {
/* Force WooThemes to use Yoast SEO data. */
if ( function_exists( 'woo_version_init' ) ) {
update_option( 'seo_woo_use_third_party_data', 'true' );
}
}
/**
* Reset all options to their default values and rerun some tests.
*
* @static
* @return void
*/
public static function reset() {
if ( ! is_multisite() ) {
$option_names = self::get_option_names();
if ( is_array( $option_names ) && $option_names !== array() ) {
foreach ( $option_names as $option_name ) {
delete_option( $option_name );
update_option( $option_name, get_option( $option_name ) );
}
}
unset( $option_names );
}
else {
// Reset MS blog based on network default blog setting.
self::reset_ms_blog( get_current_blog_id() );
}
self::initialize();
}
/**
* Initialize default values for a new multisite blog.
*
* @static
*
* @param bool $force_init Whether to always do the initialization routine (title/desc test).
*
* @return void
*/
public static function maybe_set_multisite_defaults( $force_init = false ) {
$option = get_option( 'wpseo' );
if ( is_multisite() ) {
if ( $option['ms_defaults_set'] === false ) {
self::reset_ms_blog( get_current_blog_id() );
self::initialize();
}
elseif ( $force_init === true ) {
self::initialize();
}
}
}
/**
* Reset all options for a specific multisite blog to their default values based upon a
* specified default blog if one was chosen on the network page or the plugin defaults if it was not.
*
* @static
*
* @param int|string $blog_id Blog id of the blog for which to reset the options.
*
* @return void
*/
public static function reset_ms_blog( $blog_id ) {
if ( is_multisite() ) {
$options = get_site_option( 'wpseo_ms' );
$option_names = self::get_option_names();
if ( is_array( $option_names ) && $option_names !== array() ) {
$base_blog_id = $blog_id;
if ( $options['defaultblog'] !== '' && $options['defaultblog'] !== 0 ) {
$base_blog_id = $options['defaultblog'];
}
foreach ( $option_names as $option_name ) {
delete_blog_option( $blog_id, $option_name );
$new_option = get_blog_option( $base_blog_id, $option_name );
/* Remove sensitive, theme dependent and site dependent info. */
if ( isset( self::$option_instances[ $option_name ] ) && self::$option_instances[ $option_name ]->ms_exclude !== array() ) {
foreach ( self::$option_instances[ $option_name ]->ms_exclude as $key ) {
unset( $new_option[ $key ] );
}
}
if ( $option_name === 'wpseo' ) {
$new_option['ms_defaults_set'] = true;
}
update_blog_option( $blog_id, $option_name, $new_option );
}
}
}
}
/**
* Saves the option to the database.
*
* @param string $wpseo_options_group_name The name for the wpseo option group in the database.
* @param string $option_name The name for the option to set.
* @param * $option_value The value for the option.
*
* @return boolean Returns true if the option is successfully saved in the database.
*/
public static function save_option( $wpseo_options_group_name, $option_name, $option_value ) {
$options = self::get_option( $wpseo_options_group_name );
$options[ $option_name ] = $option_value;
if ( isset( self::$option_instances[ $wpseo_options_group_name ] ) && self::$option_instances[ $wpseo_options_group_name ]->multisite_only === true ) {
self::update_site_option( $wpseo_options_group_name, $options );
}
else {
update_option( $wpseo_options_group_name, $options );
}
// Check if everything got saved properly.
$saved_option = self::get_option( $wpseo_options_group_name );
return $saved_option[ $option_name ] === $options[ $option_name ];
}
/**
* Adds the multisite options to the option stack if relevant.
*
* @param array $option The currently present options settings.
*
* @return array Options possibly including multisite.
*/
protected static function add_ms_option( $option ) {
if ( ! is_multisite() ) {
return $option;
}
$ms_option = self::get_option( 'wpseo_ms' );
return array_merge( $option, $ms_option );
}
/**
* Retrieves a lookup table to find in which option_group a key is stored.
*
* @return array The lookup table.
*/
private static function get_lookup_table() {
$lookup_table = array();
self::$backfill->remove_hooks();
foreach ( array_keys( self::$options ) as $option_name ) {
$full_option = self::get_option( $option_name );
foreach ( $full_option as $key => $value ) {
$lookup_table[ $key ] = $option_name;
}
}
self::$backfill->register_hooks();
return $lookup_table;
}
/**
* Retrieves a lookup table to find in which option_group a key is stored.
*
* @return array The lookup table.
*/
private static function get_pattern_table() {
$pattern_table = array();
foreach ( self::$options as $option_name => $option_class ) {
/** @var WPSEO_Option $instance */
$instance = call_user_func( array( $option_class, 'get_instance' ) );
foreach ( $instance->get_patterns() as $key ) {
$pattern_table[ $key ] = $option_name;
}
}
return $pattern_table;
}
/* ********************* DEPRECATED METHODS ********************* */
/**
* Correct the inadvertent removal of the fallback to default values from the breadcrumbs.
*
* @since 1.5.2.3
*
* @deprecated 7.0
* @codeCoverageIgnore
*/
public static function bring_back_breadcrumb_defaults() {
_deprecated_function( __METHOD__, 'WPSEO 7.0' );
}
}
| {
"content_hash": "f27b0ffc3c01518a3f60b0ae45b927b5",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 153,
"avg_line_length": 27.710091743119268,
"alnum_prop": 0.6178651834194147,
"repo_name": "agencja-acclaim/gulp-bower-webapp",
"id": "877fb5198098570c667720e40858d26f2948a3d9",
"size": "15102",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "290204"
},
{
"name": "JavaScript",
"bytes": "455702"
},
{
"name": "PHP",
"bytes": "159275"
}
],
"symlink_target": ""
} |
'use strict';
module.exports = {};
[
require("./lib/walk.js"),
require("./lib/tokens.js"),
require("./lib/io.js"),
require("./lib/query.js"),
require("./lib/manipulations.js"),
require("./lib/transformations.js"),
require("./lib/array.js")
].forEach(function (sub_module) {
Object.keys(sub_module).forEach(function (k) {
module.exports[k] = sub_module[k];
});
});
| {
"content_hash": "4bf2b956da26d7cd0ac0f5a353d22258",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 24.1875,
"alnum_prop": 0.6175710594315246,
"repo_name": "RomulusAndRemus/romejs-app",
"id": "29baa9939ce3be5fa77a5232c0b0795ea9abbfbe",
"size": "387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/componentParser/esprima-ast-utils/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "116182"
},
{
"name": "HTML",
"bytes": "1733"
},
{
"name": "JavaScript",
"bytes": "3109214"
}
],
"symlink_target": ""
} |
using System;
namespace GSoft.Dynamite.Binding.Converters
{
/// <summary>
/// A base class for SharePoint list item value conversions.
/// </summary>
public abstract class DataRowValueConverter : IConverter
{
/// <summary>
/// Converts the specified value.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="arguments">The arguments.</param>
/// <returns>
/// The converted value.
/// </returns>
object IConverter.Convert(object value, ConversionArguments arguments)
{
var dataRowArguments = arguments as DataRowConversionArguments;
if (dataRowArguments == null)
{
throw new ArgumentException("A DataRowValueConverter can only be used with a Data Row.");
}
return this.Convert(value, dataRowArguments);
}
/// <summary>
/// Converts the specified value back.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="arguments">The arguments.</param>
/// <returns>
/// The converted value.
/// </returns>
object IConverter.ConvertBack(object value, ConversionArguments arguments)
{
var sharePointArguments = arguments as DataRowConversionArguments;
if (sharePointArguments == null)
{
throw new ArgumentException("A SharePointValueConverter can only be used with a SharePoint list item.");
}
return this.ConvertBack(value, sharePointArguments);
}
/// <summary>
/// Converts the specified value.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="arguments">The arguments.</param>
/// <returns>
/// The converted value.
/// </returns>
public abstract object Convert(object value, DataRowConversionArguments arguments);
/// <summary>
/// Converts the specified value back.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="arguments">The arguments.</param>
/// <returns>
/// The converted value.
/// </returns>
public abstract object ConvertBack(object value, DataRowConversionArguments arguments);
}
}
| {
"content_hash": "cc9701190aee75b0ca659e0124cab3fd",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 120,
"avg_line_length": 35.1764705882353,
"alnum_prop": 0.5760869565217391,
"repo_name": "GSoft-SharePoint/Dynamite-2010",
"id": "4cdb59443a5da372249dffcdfbb16534883dc961",
"size": "2394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/GSoft.Dynamite/Binding/Converters/DataRowValueConverter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "11084"
},
{
"name": "C#",
"bytes": "1017271"
},
{
"name": "CSS",
"bytes": "4284"
},
{
"name": "JavaScript",
"bytes": "24317"
},
{
"name": "PowerShell",
"bytes": "116844"
}
],
"symlink_target": ""
} |
from flask_app.flask_app import db
class Quality(db.Model):
__tablename__ = 'quality'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(50), unique=True)
definition = db.Column(db.String(500))
def __init__(self, name=None, definition=None):
self.name = name
self.definition = definition
def __repr__(self):
return "<Quality Name {} : Definition : {}> ".format(self.name, self.definition)
| {
"content_hash": "1beb0a331a6d7664cc37e669b61b58b8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 88,
"avg_line_length": 32.13333333333333,
"alnum_prop": 0.6410788381742739,
"repo_name": "MaximeGir/StarTrekCorpora",
"id": "33f727c48a4359eba96c421294fdf478fcc9a1e8",
"size": "482",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "database/models/Quality.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "420"
},
{
"name": "HTML",
"bytes": "511674"
},
{
"name": "PLSQL",
"bytes": "24586224"
},
{
"name": "Python",
"bytes": "93971"
}
],
"symlink_target": ""
} |
namespace mcts
{
ostream& operator<<(ostream & ostr, const GameMove & move)
{
return move.ToString(ostr);
}
GameMove::~GameMove()
{
}
}
| {
"content_hash": "fc72c4d08b72bb9b8183f098b26049a0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 13.181818181818182,
"alnum_prop": 0.6482758620689655,
"repo_name": "steve3003/mcts-cpp",
"id": "6194eff868b2efb1adb4911edfda7dc4025f3209",
"size": "168",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mcts-cpp/Src/GameMove.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "34"
},
{
"name": "C++",
"bytes": "36955"
},
{
"name": "Python",
"bytes": "2530"
}
],
"symlink_target": ""
} |
package jadx.tests.integration.variables;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.junit.jupiter.api.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
@SuppressWarnings("checkstyle:printstacktrace")
public class TestVariables4 extends IntegrationTest {
public static class TestCls {
public static boolean runTest(String clsName) {
try {
boolean pass = false;
String msg = null;
Throwable exc = null;
Class<?> cls = Class.forName(clsName);
if (cls.getSuperclass() == AbstractTest.class) {
Method mth = cls.getMethod("testRun");
try {
AbstractTest test = (AbstractTest) cls.getConstructor().newInstance();
pass = (Boolean) mth.invoke(test);
} catch (InvocationTargetException e) {
pass = false;
exc = e.getCause();
} catch (Throwable e) {
pass = false;
exc = e;
}
} else {
msg = "not extends AbstractTest";
}
System.err.println(">> "
+ (pass ? "PASS" : "FAIL") + '\t'
+ clsName
+ (msg == null ? "" : "\t - " + msg));
if (exc != null) {
exc.printStackTrace();
}
return pass;
} catch (ClassNotFoundException e) {
System.err.println("Class '" + clsName + "' not found");
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private static class AbstractTest {
}
}
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsString("} catch (InvocationTargetException e) {"));
assertThat(code, containsString("pass = false;"));
assertThat(code, containsString("exc = e.getCause();"));
assertThat(code, containsString("System.err.println(\"Class '\" + clsName + \"' not found\");"));
assertThat(code, containsString("return pass;"));
}
@Test
public void test2() {
noDebugInfo();
getClassNode(TestCls.class);
}
}
| {
"content_hash": "c56024eda8f1819d643b48a9b57e4caa",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 99,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.6559808612440191,
"repo_name": "jpstotz/jadx",
"id": "6c37c09be1f65fbbf2f805f9a8924fb66c003cf6",
"size": "2090",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "jadx-core/src/test/java/jadx/tests/integration/variables/TestVariables4.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3510958"
},
{
"name": "Lex",
"bytes": "15158"
},
{
"name": "Smali",
"bytes": "199213"
}
],
"symlink_target": ""
} |
SCRIPTPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Find the right hidraw device
HIDDEVICE=$(dmesg | grep Apple | grep Keyboard | grep input0 | tail -1 | sed -e 's/.*hidraw\([[:digit:]]\+\).*/\/dev\/hidraw\1/')
# Send a "Report Feature" to the device
$SCRIPTPATH/disable-capslock-delay $HIDDEVICE
| {
"content_hash": "4703fd6123ead6eb67b0e66f5e61492c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 129,
"avg_line_length": 44,
"alnum_prop": 0.6525974025974026,
"repo_name": "OmeGak/dotfiles",
"id": "9bc645c2daab5b005288ef01ce0b60e12ebe7393",
"size": "666",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "system/keyboard/disable-capslock-delay.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "AppleScript",
"bytes": "1932"
},
{
"name": "C",
"bytes": "2400"
},
{
"name": "Makefile",
"bytes": "995"
},
{
"name": "Perl",
"bytes": "23098"
},
{
"name": "Python",
"bytes": "153400"
},
{
"name": "Ruby",
"bytes": "12418"
},
{
"name": "Shell",
"bytes": "103377"
}
],
"symlink_target": ""
} |
.class public final Landroid/print/PrintAttributes$MediaSize;
.super Ljava/lang/Object;
.source "PrintAttributes.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroid/print/PrintAttributes;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = "MediaSize"
.end annotation
# static fields
.field public static final ISO_A0:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A1:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A10:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A2:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A3:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A4:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A5:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A6:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A7:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A8:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_A9:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B0:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B1:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B10:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B2:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B3:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B4:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B5:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B6:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B7:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B8:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_B9:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C0:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C1:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C10:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C2:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C3:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C4:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C5:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C6:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C7:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C8:Landroid/print/PrintAttributes$MediaSize;
.field public static final ISO_C9:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B0:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B1:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B10:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B2:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B3:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B4:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B5:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B6:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B7:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B8:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_B9:Landroid/print/PrintAttributes$MediaSize;
.field public static final JIS_EXEC:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_CHOU2:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_CHOU3:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_CHOU4:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_HAGAKI:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_KAHU:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_KAKU2:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_OUFUKU:Landroid/print/PrintAttributes$MediaSize;
.field public static final JPN_YOU4:Landroid/print/PrintAttributes$MediaSize;
.field private static final LOG_TAG:Ljava/lang/String; = "MediaSize"
.field public static final NA_FOOLSCAP:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_GOVT_LETTER:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_INDEX_3X5:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_INDEX_4X6:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_INDEX_5X8:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_JUNIOR_LEGAL:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_LEDGER:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_LEGAL:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_LETTER:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_MONARCH:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_QUARTO:Landroid/print/PrintAttributes$MediaSize;
.field public static final NA_TABLOID:Landroid/print/PrintAttributes$MediaSize;
.field public static final OM_DAI_PA_KAI:Landroid/print/PrintAttributes$MediaSize;
.field public static final OM_JUURO_KU_KAI:Landroid/print/PrintAttributes$MediaSize;
.field public static final OM_PA_KAI:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_1:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_10:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_16K:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_2:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_3:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_4:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_5:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_6:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_7:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_8:Landroid/print/PrintAttributes$MediaSize;
.field public static final PRC_9:Landroid/print/PrintAttributes$MediaSize;
.field public static final ROC_16K:Landroid/print/PrintAttributes$MediaSize;
.field public static final ROC_8K:Landroid/print/PrintAttributes$MediaSize;
.field public static final UNKNOWN_LANDSCAPE:Landroid/print/PrintAttributes$MediaSize;
.field public static final UNKNOWN_PORTRAIT:Landroid/print/PrintAttributes$MediaSize;
.field private static final sIdToMediaSizeMap:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Landroid/print/PrintAttributes$MediaSize;",
">;"
}
.end annotation
.end field
# instance fields
.field private final mHeightMils:I
.field private final mId:Ljava/lang/String;
.field public final mLabel:Ljava/lang/String;
.field public final mLabelResId:I
.field public final mPackageName:Ljava/lang/String;
.field private final mWidthMils:I
# direct methods
.method static constructor <clinit>()V
.registers 15
.prologue
const/4 v4, 0x1
const/16 v14, 0x2af8
const/16 v13, 0x1388
const/16 v12, 0x1274
const/16 v11, 0x1f40
.line 430
new-instance v0, Landroid/util/ArrayMap;
invoke-direct {v0}, Landroid/util/ArrayMap;-><init>()V
.line 429
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->sIdToMediaSizeMap:Ljava/util/Map;
.line 440
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "UNKNOWN_PORTRAIT"
const-string/jumbo v2, "android"
.line 441
const v3, 0x1040541
const v5, 0x7fffffff
.line 440
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 439
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->UNKNOWN_PORTRAIT:Landroid/print/PrintAttributes$MediaSize;
.line 451
new-instance v5, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v6, "UNKNOWN_LANDSCAPE"
const-string/jumbo v7, "android"
.line 452
const v8, 0x1040542
const v9, 0x7fffffff
move v10, v4
.line 451
invoke-direct/range {v5 .. v10}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 450
sput-object v5, Landroid/print/PrintAttributes$MediaSize;->UNKNOWN_LANDSCAPE:Landroid/print/PrintAttributes$MediaSize;
.line 458
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A0"
const-string/jumbo v2, "android"
const v3, 0x10404f0
const v4, 0x8156
const v5, 0xb6da
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 457
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A0:Landroid/print/PrintAttributes$MediaSize;
.line 461
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A1"
const-string/jumbo v2, "android"
const v3, 0x10404f1
const/16 v4, 0x5b5e
const v5, 0x8156
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 460
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A1:Landroid/print/PrintAttributes$MediaSize;
.line 464
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A2"
const-string/jumbo v2, "android"
const v3, 0x10404f2
const/16 v4, 0x409c
const/16 v5, 0x5b5e
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 463
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A2:Landroid/print/PrintAttributes$MediaSize;
.line 467
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A3"
const-string/jumbo v2, "android"
const v3, 0x10404f3
const/16 v4, 0x2daa
const/16 v5, 0x409c
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 466
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A3:Landroid/print/PrintAttributes$MediaSize;
.line 470
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A4"
const-string/jumbo v2, "android"
const v3, 0x10404f4
const/16 v4, 0x204e
const/16 v5, 0x2daa
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 469
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A4:Landroid/print/PrintAttributes$MediaSize;
.line 473
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A5"
const-string/jumbo v2, "android"
const v3, 0x10404f5
const/16 v4, 0x16c6
const/16 v5, 0x204e
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 472
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A5:Landroid/print/PrintAttributes$MediaSize;
.line 476
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A6"
const-string/jumbo v2, "android"
const v3, 0x10404f6
const/16 v4, 0x1022
const/16 v5, 0x16c6
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 475
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A6:Landroid/print/PrintAttributes$MediaSize;
.line 479
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A7"
const-string/jumbo v2, "android"
const v3, 0x10404f7
const/16 v4, 0xb5e
const/16 v5, 0x1022
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 478
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A7:Landroid/print/PrintAttributes$MediaSize;
.line 482
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A8"
const-string/jumbo v2, "android"
const v3, 0x10404f8
const/16 v4, 0x802
const/16 v5, 0xb5e
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 481
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A8:Landroid/print/PrintAttributes$MediaSize;
.line 485
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A9"
const-string/jumbo v2, "android"
const v3, 0x10404f9
const/16 v4, 0x5b4
const/16 v5, 0x802
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 484
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A9:Landroid/print/PrintAttributes$MediaSize;
.line 488
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_A10"
const-string/jumbo v2, "android"
const v3, 0x10404fa
const/16 v4, 0x3fc
const/16 v5, 0x5b4
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 487
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_A10:Landroid/print/PrintAttributes$MediaSize;
.line 492
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B0"
const-string/jumbo v2, "android"
const v3, 0x10404fb
const v4, 0x99ca
const v5, 0xd976
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 491
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B0:Landroid/print/PrintAttributes$MediaSize;
.line 495
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B1"
const-string/jumbo v2, "android"
const v3, 0x10404fc
const/16 v4, 0x6cb6
const v5, 0x99ca
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 494
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B1:Landroid/print/PrintAttributes$MediaSize;
.line 498
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B2"
const-string/jumbo v2, "android"
const v3, 0x10404fd
const/16 v4, 0x4cea
const/16 v5, 0x6cb6
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 497
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B2:Landroid/print/PrintAttributes$MediaSize;
.line 501
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B3"
const-string/jumbo v2, "android"
const v3, 0x10404fe
const/16 v4, 0x364c
const/16 v5, 0x4cea
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 500
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B3:Landroid/print/PrintAttributes$MediaSize;
.line 504
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B4"
const-string/jumbo v2, "android"
const v3, 0x10404ff
const/16 v4, 0x2670
const/16 v5, 0x364c
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 503
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B4:Landroid/print/PrintAttributes$MediaSize;
.line 507
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B5"
const-string/jumbo v2, "android"
const v3, 0x1040500
const/16 v4, 0x1b12
const/16 v5, 0x2670
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 506
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B5:Landroid/print/PrintAttributes$MediaSize;
.line 510
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B6"
const-string/jumbo v2, "android"
const v3, 0x1040501
const/16 v4, 0x1338
const/16 v5, 0x1b12
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 509
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B6:Landroid/print/PrintAttributes$MediaSize;
.line 513
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B7"
const-string/jumbo v2, "android"
const v3, 0x1040502
const/16 v4, 0xd84
const/16 v5, 0x1338
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 512
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B7:Landroid/print/PrintAttributes$MediaSize;
.line 516
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B8"
const-string/jumbo v2, "android"
const v3, 0x1040503
const/16 v4, 0x988
const/16 v5, 0xd84
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 515
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B8:Landroid/print/PrintAttributes$MediaSize;
.line 519
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B9"
const-string/jumbo v2, "android"
const v3, 0x1040504
const/16 v4, 0x6c2
const/16 v5, 0x988
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 518
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B9:Landroid/print/PrintAttributes$MediaSize;
.line 522
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_B10"
const-string/jumbo v2, "android"
const v3, 0x1040505
const/16 v4, 0x4c4
const/16 v5, 0x6c2
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 521
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_B10:Landroid/print/PrintAttributes$MediaSize;
.line 526
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C0"
const-string/jumbo v2, "android"
const v3, 0x1040506
const v4, 0x8d04
const v5, 0xc774
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 525
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C0:Landroid/print/PrintAttributes$MediaSize;
.line 529
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C1"
const-string/jumbo v2, "android"
const v3, 0x1040507
const/16 v4, 0x63a6
const v5, 0x8d04
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 528
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C1:Landroid/print/PrintAttributes$MediaSize;
.line 532
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C2"
const-string/jumbo v2, "android"
const v3, 0x1040508
const/16 v4, 0x466e
const/16 v5, 0x63a6
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 531
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C2:Landroid/print/PrintAttributes$MediaSize;
.line 535
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C3"
const-string/jumbo v2, "android"
const v3, 0x1040509
const/16 v4, 0x31d8
const/16 v5, 0x466e
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 534
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C3:Landroid/print/PrintAttributes$MediaSize;
.line 538
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C4"
const-string/jumbo v2, "android"
const v3, 0x104050a
const/16 v4, 0x233c
const/16 v5, 0x31d8
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 537
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C4:Landroid/print/PrintAttributes$MediaSize;
.line 541
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C5"
const-string/jumbo v2, "android"
const v3, 0x104050b
const/16 v4, 0x18ec
const/16 v5, 0x233c
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 540
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C5:Landroid/print/PrintAttributes$MediaSize;
.line 544
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C6"
const-string/jumbo v2, "android"
const v3, 0x104050c
const/16 v4, 0x118a
const/16 v5, 0x18ec
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 543
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C6:Landroid/print/PrintAttributes$MediaSize;
.line 547
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C7"
const-string/jumbo v2, "android"
const v3, 0x104050d
const/16 v4, 0xc76
const/16 v5, 0x118a
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 546
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C7:Landroid/print/PrintAttributes$MediaSize;
.line 550
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C8"
const-string/jumbo v2, "android"
const v3, 0x104050e
const/16 v4, 0x8c0
const/16 v5, 0xc76
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 549
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C8:Landroid/print/PrintAttributes$MediaSize;
.line 553
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C9"
const-string/jumbo v2, "android"
const v3, 0x104050f
const/16 v4, 0x622
const/16 v5, 0x8c0
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 552
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C9:Landroid/print/PrintAttributes$MediaSize;
.line 556
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ISO_C10"
const-string/jumbo v2, "android"
const v3, 0x1040510
const/16 v4, 0x44c
const/16 v5, 0x622
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 555
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ISO_C10:Landroid/print/PrintAttributes$MediaSize;
.line 562
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_LETTER"
const-string/jumbo v2, "android"
const v3, 0x1040511
const/16 v4, 0x2134
move v5, v14
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 561
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_LETTER:Landroid/print/PrintAttributes$MediaSize;
.line 565
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_GOVT_LETTER"
const-string/jumbo v2, "android"
.line 566
const v3, 0x1040512
const/16 v5, 0x2904
move v4, v11
.line 565
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 564
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_GOVT_LETTER:Landroid/print/PrintAttributes$MediaSize;
.line 569
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_LEGAL"
const-string/jumbo v2, "android"
const v3, 0x1040513
const/16 v4, 0x2134
const/16 v5, 0x36b0
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 568
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_LEGAL:Landroid/print/PrintAttributes$MediaSize;
.line 572
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_JUNIOR_LEGAL"
const-string/jumbo v2, "android"
.line 573
const v3, 0x1040514
move v4, v11
move v5, v13
.line 572
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 571
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_JUNIOR_LEGAL:Landroid/print/PrintAttributes$MediaSize;
.line 576
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_LEDGER"
const-string/jumbo v2, "android"
const v3, 0x1040515
const/16 v4, 0x4268
move v5, v14
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 575
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_LEDGER:Landroid/print/PrintAttributes$MediaSize;
.line 579
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_TABLOID"
const-string/jumbo v2, "android"
.line 580
const v3, 0x1040516
const/16 v5, 0x4268
move v4, v14
.line 579
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 578
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_TABLOID:Landroid/print/PrintAttributes$MediaSize;
.line 583
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_INDEX_3X5"
const-string/jumbo v2, "android"
.line 584
const v3, 0x1040517
const/16 v4, 0xbb8
move v5, v13
.line 583
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 582
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_INDEX_3X5:Landroid/print/PrintAttributes$MediaSize;
.line 587
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_INDEX_4X6"
const-string/jumbo v2, "android"
.line 588
const v3, 0x1040518
const/16 v4, 0xfa0
const/16 v5, 0x1770
.line 587
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 586
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_INDEX_4X6:Landroid/print/PrintAttributes$MediaSize;
.line 591
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_INDEX_5X8"
const-string/jumbo v2, "android"
.line 592
const v3, 0x1040519
move v4, v13
move v5, v11
.line 591
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 590
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_INDEX_5X8:Landroid/print/PrintAttributes$MediaSize;
.line 595
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_MONARCH"
const-string/jumbo v2, "android"
.line 596
const v3, 0x104051a
const/16 v4, 0x1c52
const/16 v5, 0x2904
.line 595
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 594
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_MONARCH:Landroid/print/PrintAttributes$MediaSize;
.line 599
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_QUARTO"
const-string/jumbo v2, "android"
.line 600
const v3, 0x104051b
const/16 v5, 0x2710
move v4, v11
.line 599
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 598
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_QUARTO:Landroid/print/PrintAttributes$MediaSize;
.line 603
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "NA_FOOLSCAP"
const-string/jumbo v2, "android"
.line 604
const v3, 0x104051c
const/16 v5, 0x32c8
move v4, v11
.line 603
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 602
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->NA_FOOLSCAP:Landroid/print/PrintAttributes$MediaSize;
.line 610
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ROC_8K"
const-string/jumbo v2, "android"
.line 611
const v3, 0x104051d
const/16 v4, 0x2985
const/16 v5, 0x3bfa
.line 610
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 609
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ROC_8K:Landroid/print/PrintAttributes$MediaSize;
.line 614
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "ROC_16K"
const-string/jumbo v2, "android"
.line 615
const v3, 0x104051e
const/16 v4, 0x1dfd
const/16 v5, 0x2985
.line 614
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 613
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->ROC_16K:Landroid/print/PrintAttributes$MediaSize;
.line 619
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_1"
const-string/jumbo v2, "android"
.line 620
const v3, 0x104051f
const/16 v4, 0xfaf
const/16 v5, 0x1960
.line 619
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 618
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_1:Landroid/print/PrintAttributes$MediaSize;
.line 623
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_2"
const-string/jumbo v2, "android"
.line 624
const v3, 0x1040520
const/16 v4, 0xfaf
const/16 v5, 0x1b11
.line 623
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 622
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_2:Landroid/print/PrintAttributes$MediaSize;
.line 627
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_3"
const-string/jumbo v2, "android"
.line 628
const v3, 0x1040521
const/16 v4, 0x1339
const/16 v5, 0x1b11
.line 627
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 626
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_3:Landroid/print/PrintAttributes$MediaSize;
.line 631
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_4"
const-string/jumbo v2, "android"
.line 632
const v3, 0x1040522
const/16 v4, 0x10ea
const/16 v5, 0x1ffd
.line 631
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 630
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_4:Landroid/print/PrintAttributes$MediaSize;
.line 635
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_5"
const-string/jumbo v2, "android"
.line 636
const v3, 0x1040523
const/16 v4, 0x10ea
const/16 v5, 0x21d5
.line 635
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 634
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_5:Landroid/print/PrintAttributes$MediaSize;
.line 639
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_6"
const-string/jumbo v2, "android"
.line 640
const v3, 0x1040524
const/16 v5, 0x3137
move v4, v12
.line 639
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 638
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_6:Landroid/print/PrintAttributes$MediaSize;
.line 643
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_7"
const-string/jumbo v2, "android"
.line 644
const v3, 0x1040525
const/16 v4, 0x189b
const/16 v5, 0x235f
.line 643
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 642
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_7:Landroid/print/PrintAttributes$MediaSize;
.line 647
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_8"
const-string/jumbo v2, "android"
.line 648
const v3, 0x1040526
const/16 v5, 0x2f85
move v4, v12
.line 647
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 646
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_8:Landroid/print/PrintAttributes$MediaSize;
.line 651
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_9"
const-string/jumbo v2, "android"
.line 652
const v3, 0x1040527
const/16 v4, 0x2338
const/16 v5, 0x31d4
.line 651
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 650
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_9:Landroid/print/PrintAttributes$MediaSize;
.line 655
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_10"
const-string/jumbo v2, "android"
.line 656
const v3, 0x1040528
const/16 v4, 0x31d4
const/16 v5, 0x4670
.line 655
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 654
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_10:Landroid/print/PrintAttributes$MediaSize;
.line 660
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "PRC_16K"
const-string/jumbo v2, "android"
.line 661
const v3, 0x1040529
const/16 v4, 0x1675
const/16 v5, 0x2111
.line 660
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 659
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->PRC_16K:Landroid/print/PrintAttributes$MediaSize;
.line 664
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "OM_PA_KAI"
const-string/jumbo v2, "android"
.line 665
const v3, 0x104052a
const/16 v4, 0x2910
const/16 v5, 0x3bd3
.line 664
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 663
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->OM_PA_KAI:Landroid/print/PrintAttributes$MediaSize;
.line 668
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "OM_DAI_PA_KAI"
const-string/jumbo v2, "android"
.line 669
const v3, 0x104052b
const/16 v4, 0x2a4b
const/16 v5, 0x3cbf
.line 668
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 667
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->OM_DAI_PA_KAI:Landroid/print/PrintAttributes$MediaSize;
.line 672
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "OM_JUURO_KU_KAI"
const-string/jumbo v2, "android"
.line 673
const v3, 0x104052c
const/16 v4, 0x1e74
const/16 v5, 0x2a4b
.line 672
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 671
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->OM_JUURO_KU_KAI:Landroid/print/PrintAttributes$MediaSize;
.line 679
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B10"
const-string/jumbo v2, "android"
.line 680
const v3, 0x104052d
const/16 v4, 0x4eb
const/16 v5, 0x6ec
.line 679
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 678
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B10:Landroid/print/PrintAttributes$MediaSize;
.line 683
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B9"
const-string/jumbo v2, "android"
.line 684
const v3, 0x104052e
const/16 v4, 0x6ec
const/16 v5, 0x9d8
.line 683
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 682
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B9:Landroid/print/PrintAttributes$MediaSize;
.line 687
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B8"
const-string/jumbo v2, "android"
.line 688
const v3, 0x104052f
const/16 v4, 0x9d8
const/16 v5, 0xdff
.line 687
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 686
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B8:Landroid/print/PrintAttributes$MediaSize;
.line 691
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B7"
const-string/jumbo v2, "android"
.line 692
const v3, 0x1040530
const/16 v4, 0xdff
const/16 v5, 0x13b9
.line 691
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 690
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B7:Landroid/print/PrintAttributes$MediaSize;
.line 695
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B6"
const-string/jumbo v2, "android"
.line 696
const v3, 0x1040531
const/16 v4, 0x13b9
const/16 v5, 0x1bfd
.line 695
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 694
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B6:Landroid/print/PrintAttributes$MediaSize;
.line 699
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B5"
const-string/jumbo v2, "android"
.line 700
const v3, 0x1040532
const/16 v4, 0x1bfd
const/16 v5, 0x2786
.line 699
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 698
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B5:Landroid/print/PrintAttributes$MediaSize;
.line 703
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B4"
const-string/jumbo v2, "android"
.line 704
const v3, 0x1040533
const/16 v4, 0x2786
const/16 v5, 0x37fb
.line 703
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 702
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B4:Landroid/print/PrintAttributes$MediaSize;
.line 707
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B3"
const-string/jumbo v2, "android"
.line 708
const v3, 0x1040534
const/16 v4, 0x37fb
const/16 v5, 0x4f34
.line 707
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 706
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B3:Landroid/print/PrintAttributes$MediaSize;
.line 711
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B2"
const-string/jumbo v2, "android"
.line 712
const v3, 0x1040535
const/16 v4, 0x4f34
const/16 v5, 0x6ff5
.line 711
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 710
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B2:Landroid/print/PrintAttributes$MediaSize;
.line 715
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B1"
const-string/jumbo v2, "android"
.line 716
const v3, 0x1040536
const/16 v4, 0x6ff5
const v5, 0x9e67
.line 715
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 714
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B1:Landroid/print/PrintAttributes$MediaSize;
.line 719
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_B0"
const-string/jumbo v2, "android"
.line 720
const v3, 0x1040537
const v4, 0x9e67
const v5, 0xdfeb
.line 719
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 718
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_B0:Landroid/print/PrintAttributes$MediaSize;
.line 724
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JIS_EXEC"
const-string/jumbo v2, "android"
.line 725
const v3, 0x1040538
const/16 v4, 0x2138
const/16 v5, 0x32c0
.line 724
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 723
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JIS_EXEC:Landroid/print/PrintAttributes$MediaSize;
.line 729
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_CHOU4"
const-string/jumbo v2, "android"
.line 730
const v3, 0x1040539
const/16 v4, 0xdd7
const/16 v5, 0x1f87
.line 729
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 728
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_CHOU4:Landroid/print/PrintAttributes$MediaSize;
.line 733
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_CHOU3"
const-string/jumbo v2, "android"
.line 734
const v3, 0x104053a
const/16 v5, 0x2424
move v4, v12
.line 733
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 732
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_CHOU3:Landroid/print/PrintAttributes$MediaSize;
.line 737
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_CHOU2"
const-string/jumbo v2, "android"
.line 738
const v3, 0x104053b
const/16 v4, 0x1116
const/16 v5, 0x1674
.line 737
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 736
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_CHOU2:Landroid/print/PrintAttributes$MediaSize;
.line 742
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_HAGAKI"
const-string/jumbo v2, "android"
.line 743
const v3, 0x104053c
const/16 v4, 0xf61
const/16 v5, 0x16c3
.line 742
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 741
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_HAGAKI:Landroid/print/PrintAttributes$MediaSize;
.line 746
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_OUFUKU"
const-string/jumbo v2, "android"
.line 747
const v3, 0x104053d
const/16 v4, 0x16c3
const/16 v5, 0x1ec2
.line 746
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 745
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_OUFUKU:Landroid/print/PrintAttributes$MediaSize;
.line 751
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_KAHU"
const-string/jumbo v2, "android"
.line 752
const v3, 0x104053e
const/16 v4, 0x24e9
const/16 v5, 0x3189
.line 751
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 750
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_KAHU:Landroid/print/PrintAttributes$MediaSize;
.line 755
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_KAKU2"
const-string/jumbo v2, "android"
.line 756
const v3, 0x104053f
const/16 v4, 0x24e9
const/16 v5, 0x330f
.line 755
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 754
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_KAKU2:Landroid/print/PrintAttributes$MediaSize;
.line 760
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
const-string/jumbo v1, "JPN_YOU4"
const-string/jumbo v2, "android"
.line 761
const v3, 0x1040540
const/16 v4, 0x1026
const/16 v5, 0x2424
.line 760
invoke-direct/range {v0 .. v5}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;III)V
.line 759
sput-object v0, Landroid/print/PrintAttributes$MediaSize;->JPN_YOU4:Landroid/print/PrintAttributes$MediaSize;
.line 426
return-void
.end method
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;II)V
.registers 7
.param p1, "id" # Ljava/lang/String;
.param p2, "label" # Ljava/lang/String;
.param p3, "widthMils" # I
.param p4, "heightMils" # I
.prologue
const/4 v1, 0x0
.line 831
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 832
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_13
.line 833
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "id cannot be empty."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 835
:cond_13
invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_22
.line 836
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "label cannot be empty."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 838
:cond_22
if-gtz p3, :cond_2d
.line 839
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "widthMils cannot be less than or equal to zero."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 842
:cond_2d
if-gtz p4, :cond_38
.line 843
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "heightMils cannot be less than or euqual to zero."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 846
:cond_38
iput-object p1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
.line 847
iput-object p2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
.line 848
iput p3, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
.line 849
iput p4, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
.line 850
iput v1, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 851
const/4 v0, 0x0
iput-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 831
return-void
.end method
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;III)V
.registers 8
.param p1, "id" # Ljava/lang/String;
.param p2, "packageName" # Ljava/lang/String;
.param p3, "labelResId" # I
.param p4, "widthMils" # I
.param p5, "heightMils" # I
.prologue
.line 788
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 790
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_12
.line 791
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "id cannot be empty."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 793
:cond_12
invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_21
.line 794
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "packageName cannot be empty."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 796
:cond_21
if-gtz p3, :cond_2c
.line 797
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "labelResId must be greater than zero."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 799
:cond_2c
if-gtz p4, :cond_37
.line 800
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "widthMils cannot be less than or equal to zero."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 803
:cond_37
if-gtz p5, :cond_42
.line 804
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string/jumbo v1, "heightMils cannot be less than or euqual to zero."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 807
:cond_42
iput-object p2, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 808
iput-object p1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
.line 809
iput p3, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 810
iput p4, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
.line 811
iput p5, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
.line 812
const/4 v0, 0x0
iput-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
.line 815
sget-object v0, Landroid/print/PrintAttributes$MediaSize;->sIdToMediaSizeMap:Ljava/util/Map;
iget-object v1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
invoke-interface {v0, v1, p0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 789
return-void
.end method
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III)V
.registers 7
.param p1, "id" # Ljava/lang/String;
.param p2, "label" # Ljava/lang/String;
.param p3, "packageName" # Ljava/lang/String;
.param p4, "widthMils" # I
.param p5, "heightMils" # I
.param p6, "labelResId" # I
.prologue
.line 855
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 857
iput-object p3, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 858
iput-object p1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
.line 859
iput p6, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 860
iput p4, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
.line 861
iput p5, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
.line 862
iput-object p2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
.line 856
return-void
.end method
.method static createFromParcel(Landroid/os/Parcel;)Landroid/print/PrintAttributes$MediaSize;
.registers 8
.param p0, "parcel" # Landroid/os/Parcel;
.prologue
.line 974
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
.line 975
invoke-virtual {p0}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v1
.line 976
invoke-virtual {p0}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v2
.line 977
invoke-virtual {p0}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v3
.line 978
invoke-virtual {p0}, Landroid/os/Parcel;->readInt()I
move-result v4
.line 979
invoke-virtual {p0}, Landroid/os/Parcel;->readInt()I
move-result v5
.line 980
invoke-virtual {p0}, Landroid/os/Parcel;->readInt()I
move-result v6
.line 974
invoke-direct/range {v0 .. v6}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III)V
return-object v0
.end method
.method public static getStandardMediaSizeById(Ljava/lang/String;)Landroid/print/PrintAttributes$MediaSize;
.registers 2
.param p0, "id" # Ljava/lang/String;
.prologue
.line 1036
sget-object v0, Landroid/print/PrintAttributes$MediaSize;->sIdToMediaSizeMap:Ljava/util/Map;
invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/print/PrintAttributes$MediaSize;
return-object v0
.end method
# virtual methods
.method public asLandscape()Landroid/print/PrintAttributes$MediaSize;
.registers 8
.prologue
.line 955
invoke-virtual {p0}, Landroid/print/PrintAttributes$MediaSize;->isPortrait()Z
move-result v0
if-nez v0, :cond_7
.line 956
return-object p0
.line 958
:cond_7
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
iget-object v1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
iget-object v3, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 959
iget v4, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
iget v5, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-static {v4, v5}, Ljava/lang/Math;->max(II)I
move-result v4
.line 960
iget v5, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
iget v6, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-static {v5, v6}, Ljava/lang/Math;->min(II)I
move-result v5
.line 961
iget v6, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 958
invoke-direct/range {v0 .. v6}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III)V
return-object v0
.end method
.method public asPortrait()Landroid/print/PrintAttributes$MediaSize;
.registers 8
.prologue
.line 938
invoke-virtual {p0}, Landroid/print/PrintAttributes$MediaSize;->isPortrait()Z
move-result v0
if-eqz v0, :cond_7
.line 939
return-object p0
.line 941
:cond_7
new-instance v0, Landroid/print/PrintAttributes$MediaSize;
iget-object v1, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
iget-object v3, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 942
iget v4, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
iget v5, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-static {v4, v5}, Ljava/lang/Math;->min(II)I
move-result v4
.line 943
iget v5, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
iget v6, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-static {v5, v6}, Ljava/lang/Math;->max(II)I
move-result v5
.line 944
iget v6, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 941
invoke-direct/range {v0 .. v6}, Landroid/print/PrintAttributes$MediaSize;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III)V
return-object v0
.end method
.method public equals(Ljava/lang/Object;)Z
.registers 7
.param p1, "obj" # Ljava/lang/Object;
.prologue
const/4 v4, 0x1
const/4 v3, 0x0
.line 994
if-ne p0, p1, :cond_5
.line 995
return v4
.line 997
:cond_5
if-nez p1, :cond_8
.line 998
return v3
.line 1000
:cond_8
invoke-virtual {p0}, Landroid/print/PrintAttributes$MediaSize;->getClass()Ljava/lang/Class;
move-result-object v1
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v2
if-eq v1, v2, :cond_13
.line 1001
return v3
:cond_13
move-object v0, p1
.line 1003
check-cast v0, Landroid/print/PrintAttributes$MediaSize;
.line 1004
.local v0, "other":Landroid/print/PrintAttributes$MediaSize;
iget v1, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
iget v2, v0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
if-eq v1, v2, :cond_1d
.line 1005
return v3
.line 1007
:cond_1d
iget v1, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
iget v2, v0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
if-eq v1, v2, :cond_24
.line 1008
return v3
.line 1010
:cond_24
return v4
.end method
.method public getHeightMils()I
.registers 2
.prologue
.line 916
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
return v0
.end method
.method public getId()Ljava/lang/String;
.registers 2
.prologue
.line 876
iget-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
return-object v0
.end method
.method public getLabel(Landroid/content/pm/PackageManager;)Ljava/lang/String;
.registers 7
.param p1, "packageManager" # Landroid/content/pm/PackageManager;
.prologue
.line 886
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_43
iget v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
if-lez v2, :cond_43
.line 889
:try_start_c
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 888
invoke-virtual {p1, v2}, Landroid/content/pm/PackageManager;->getResourcesForApplication(Ljava/lang/String;)Landroid/content/res/Resources;
move-result-object v2
.line 889
iget v3, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
.line 888
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
:try_end_17
.catch Landroid/content/res/Resources$NotFoundException; {:try_start_c .. :try_end_17} :catch_46
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_c .. :try_end_17} :catch_19
move-result-object v2
return-object v2
.line 893
:catch_19
move-exception v1
.line 894
.local v1, "nnfee":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string/jumbo v2, "MediaSize"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string/jumbo v4, "Could not load resouce"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
iget v4, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
.line 895
const-string/jumbo v4, " from package "
.line 894
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
.line 895
iget-object v4, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 894
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
.line 898
.end local v1 # "nnfee":Landroid/content/pm/PackageManager$NameNotFoundException;
:cond_43
:goto_43
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
return-object v2
.line 890
:catch_46
move-exception v0
.line 891
.local v0, "nfe":Landroid/content/res/Resources$NotFoundException;
const-string/jumbo v2, "MediaSize"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string/jumbo v4, "Could not load resouce"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
iget v4, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
.line 892
const-string/jumbo v4, " from package "
.line 891
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
.line 892
iget-object v4, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
.line 891
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_43
.end method
.method public getWidthMils()I
.registers 2
.prologue
.line 907
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
return v0
.end method
.method public hashCode()I
.registers 5
.prologue
.line 985
const/16 v0, 0x1f
.line 987
.local v0, "prime":I
iget v2, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
add-int/lit8 v1, v2, 0x1f
.line 988
.local v1, "result":I
mul-int/lit8 v2, v1, 0x1f
iget v3, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
add-int v1, v2, v3
.line 989
return v1
.end method
.method public isPortrait()Z
.registers 3
.prologue
.line 927
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
iget v1, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
if-lt v0, v1, :cond_8
const/4 v0, 0x1
:goto_7
return v0
:cond_8
const/4 v0, 0x0
goto :goto_7
.end method
.method public toString()Ljava/lang/String;
.registers 4
.prologue
.line 1015
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
.line 1016
.local v0, "builder":Ljava/lang/StringBuilder;
const-string/jumbo v1, "MediaSize{"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1017
const-string/jumbo v1, "id: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1018
const-string/jumbo v1, ", label: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1019
const-string/jumbo v1, ", packageName: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1020
const-string/jumbo v1, ", heightMils: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget v2, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
.line 1021
const-string/jumbo v1, ", widthMils: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget v2, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
.line 1022
const-string/jumbo v1, ", labelResId: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget v2, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
.line 1023
const-string/jumbo v1, "}"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1024
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
return-object v1
.end method
.method writeToParcel(Landroid/os/Parcel;)V
.registers 3
.param p1, "parcel" # Landroid/os/Parcel;
.prologue
.line 965
iget-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mId:Ljava/lang/String;
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 966
iget-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mLabel:Ljava/lang/String;
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 967
iget-object v0, p0, Landroid/print/PrintAttributes$MediaSize;->mPackageName:Ljava/lang/String;
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 968
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mWidthMils:I
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V
.line 969
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mHeightMils:I
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V
.line 970
iget v0, p0, Landroid/print/PrintAttributes$MediaSize;->mLabelResId:I
invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V
.line 964
return-void
.end method
| {
"content_hash": "e2fd9ecd3cfa057deb8cc1e0bbcd0833",
"timestamp": "",
"source": "github",
"line_count": 2660,
"max_line_length": 145,
"avg_line_length": 26.988345864661653,
"alnum_prop": 0.7143712825084623,
"repo_name": "ddki/my_study_project",
"id": "101db75aec6a77d4c1ceac61bc901a33bd7455dd",
"size": "71789",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/android/demos/ODEX/test/framework/android/print/PrintAttributes$MediaSize.smali",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AspectJ",
"bytes": "3520"
},
{
"name": "Batchfile",
"bytes": "10160"
},
{
"name": "C",
"bytes": "43156"
},
{
"name": "C++",
"bytes": "16295"
},
{
"name": "CSS",
"bytes": "54735"
},
{
"name": "Dockerfile",
"bytes": "538"
},
{
"name": "Elixir",
"bytes": "7538"
},
{
"name": "GAP",
"bytes": "133251"
},
{
"name": "Go",
"bytes": "23393"
},
{
"name": "HTML",
"bytes": "183017"
},
{
"name": "Haskell",
"bytes": "18024"
},
{
"name": "Java",
"bytes": "3890824"
},
{
"name": "JavaScript",
"bytes": "1150724"
},
{
"name": "Lex",
"bytes": "22606"
},
{
"name": "Makefile",
"bytes": "1772"
},
{
"name": "Objective-C",
"bytes": "9224"
},
{
"name": "PHP",
"bytes": "31"
},
{
"name": "Python",
"bytes": "2968992"
},
{
"name": "Ragel",
"bytes": "16770"
},
{
"name": "Ruby",
"bytes": "95237"
},
{
"name": "Scala",
"bytes": "23930"
},
{
"name": "Shell",
"bytes": "47348"
},
{
"name": "Smali",
"bytes": "71959175"
},
{
"name": "Swift",
"bytes": "211292"
},
{
"name": "XSLT",
"bytes": "104965"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
<version>2.7.1</version>
<relativePath>../../../parent</relativePath>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
<artifactId>camel-archetype-web</artifactId>
<name>Camel :: Archetypes :: Camel Routes WAR</name>
<description>Creates a new Camel web project that deploys the Camel routes as a WAR</description>
<packaging>maven-archetype</packaging>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
</extension>
</extensions>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/archetype-metadata.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
| {
"content_hash": "6d29f37c42e4f0f89ad487f9f47c2755",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 201,
"avg_line_length": 36.52542372881356,
"alnum_prop": 0.691415313225058,
"repo_name": "everttigchelaar/camel-svn",
"id": "c0782984d6b54a9f871e5cbf37f695d814358e5d",
"size": "2155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tooling/archetypes/camel-archetype-web/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "20202"
},
{
"name": "Groovy",
"bytes": "4271"
},
{
"name": "Java",
"bytes": "20966503"
},
{
"name": "JavaScript",
"bytes": "4320924"
},
{
"name": "PHP",
"bytes": "90746"
},
{
"name": "Ruby",
"bytes": "4977"
},
{
"name": "Scala",
"bytes": "189152"
},
{
"name": "Shell",
"bytes": "1204"
},
{
"name": "XQuery",
"bytes": "469"
}
],
"symlink_target": ""
} |
package alluxio.security.authentication;
import alluxio.Configuration;
import alluxio.ConfigurationTestUtils;
import alluxio.PropertyKey;
import alluxio.util.network.NetworkAddressUtils;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.apache.thrift.transport.TTransportFactory;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.net.InetSocketAddress;
import javax.security.sasl.AuthenticationException;
import javax.security.sasl.SaslException;
/**
* Unit test for methods of {@link TransportProvider}.
*
* In order to test methods that return kinds of TTransport for connection in different mode, we
* build Thrift servers and clients with specific TTransport, and let them connect.
*/
public final class TransportProviderTest {
private TThreadPoolServer mServer;
private InetSocketAddress mServerAddress;
private TServerSocket mServerTSocket;
private TransportProvider mTransportProvider;
/**
* The exception expected to be thrown.
*/
@Rule
public ExpectedException mThrown = ExpectedException.none();
/**
* Sets up the server before running a test.
*/
@Before
public void before() throws Exception {
// Use port 0 to assign each test case an available port (possibly different)
String localhost = NetworkAddressUtils.getLocalHostName();
mServerTSocket = new TServerSocket(new InetSocketAddress(localhost, 0));
int port = NetworkAddressUtils.getThriftPort(mServerTSocket);
mServerAddress = new InetSocketAddress(localhost, port);
}
@After
public void after() {
ConfigurationTestUtils.resetConfiguration();
}
/**
* In NOSASL mode, the TTransport used should be the same as Alluxio original code.
*/
@Test
public void nosaslAuthentrication() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.NOSASL.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// create client and connect to server
TTransport client = mTransportProvider.getClientTransport(mServerAddress);
client.open();
Assert.assertTrue(client.isOpen());
// clean up
client.close();
mServer.stop();
}
/**
* In SIMPLE mode, the TTransport mechanism is PLAIN. When server authenticate the connected
* client user, it use {@link SimpleAuthenticationProvider}.
*/
@Test
public void simpleAuthentication() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// when connecting, authentication happens. It is a no-op in Simple mode.
TTransport client = mTransportProvider.getClientTransport(mServerAddress);
client.open();
Assert.assertTrue(client.isOpen());
// clean up
client.close();
mServer.stop();
}
/**
* In SIMPLE mode, if client's username is null, an exception should be thrown in client side.
*/
@Test
public void simpleAuthenticationNullUser() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// check case that user is null
mThrown.expect(SaslException.class);
mThrown.expectMessage("PLAIN: authorization ID and password must be specified");
((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(null, "whatever", mServerAddress);
}
/**
* In SIMPLE mode, if client's password is null, an exception should be thrown in client side.
*/
@Test
public void simpleAuthenticationNullPassword() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// check case that password is null
mThrown.expect(SaslException.class);
mThrown.expectMessage("PLAIN: authorization ID and password must be specified");
((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport("anyone", null, mServerAddress);
}
/**
* In SIMPLE mode, if client's username is empty, an exception should be thrown in server side.
*/
@Test
public void simpleAuthenticationEmptyUser() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that user is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage("Peer indicated failure: Plain authentication failed: No authentication"
+ " identity provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport("", "whatever", mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
/**
* In SIMPLE mode, if client's password is empty, an exception should be thrown in server side.
* Although password is actually not used and we do not really authenticate the user in SIMPLE
* mode, we need the Plain SASL server has ability to check empty password.
*/
@Test
public void simpleAuthenticationEmptyPassword() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that password is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage(
"Peer indicated failure: Plain authentication failed: No password " + "provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport("anyone", "", mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
/**
* In CUSTOM mode, the TTransport mechanism is PLAIN. When server authenticate the connected
* client user, it use configured AuthenticationProvider. If the username:password pair matches, a
* connection should be built.
*/
@Test
public void customAuthenticationExactNamePasswordMatch() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// when connecting, authentication happens. User's name:pwd pair matches and auth pass.
TTransport client = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(ExactlyMatchAuthenticationProvider.USERNAME,
ExactlyMatchAuthenticationProvider.PASSWORD, mServerAddress);
client.open();
Assert.assertTrue(client.isOpen());
// clean up
client.close();
mServer.stop();
}
/**
* In CUSTOM mode, If the username:password pair does not match based on the configured
* AuthenticationProvider, an exception should be thrown in server side.
*/
@Test
public void customAuthenticationExactNamePasswordNotMatch() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// User with wrong password can not pass auth, and throw exception.
TTransport wrongClient = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(ExactlyMatchAuthenticationProvider.USERNAME, "wrong-password",
mServerAddress);
mThrown.expect(TTransportException.class);
mThrown.expectMessage(
"Peer indicated failure: Plain authentication failed: " + "User authentication fails");
try {
wrongClient.open();
} finally {
mServer.stop();
}
}
/**
* In CUSTOM mode, if client's username is null, an exception should be thrown in client side.
*/
@Test
public void customAuthenticationNullUser() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// check case that user is null
mThrown.expect(SaslException.class);
mThrown.expectMessage("PLAIN: authorization ID and password must be specified");
((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(null, ExactlyMatchAuthenticationProvider.PASSWORD, mServerAddress);
}
/**
* In CUSTOM mode, if client's password is null, an exception should be thrown in client side.
*/
@Test
public void customAuthenticationNullPassword() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// check case that password is null
mThrown.expect(SaslException.class);
mThrown.expectMessage("PLAIN: authorization ID and password must be specified");
((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(ExactlyMatchAuthenticationProvider.USERNAME, null, mServerAddress);
}
/**
* In CUSTOM mode, if client's username is empty, an exception should be thrown in server side.
*/
@Test
public void customAuthenticationEmptyUser() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that user is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage("Peer indicated failure: Plain authentication failed: No authentication"
+ " identity provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport("", ExactlyMatchAuthenticationProvider.PASSWORD, mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
/**
* In CUSTOM mode, if client's password is empty, an exception should be thrown in server side.
*/
@Test
public void customAuthenticationEmptyPassword() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS,
ExactlyMatchAuthenticationProvider.class.getName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that password is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage(
"Peer indicated failure: Plain authentication failed: No password provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider)
.getClientTransport(ExactlyMatchAuthenticationProvider.USERNAME, "", mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
/**
* TODO(dong): In KERBEROS mode, ...
* Tests that an exception is thrown when trying to use KERBEROS mode.
*/
@Test
public void kerberosAuthentication() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.KERBEROS.getAuthName());
// throw unsupported exception currently
mThrown.expect(UnsupportedOperationException.class);
mThrown.expectMessage("Kerberos is not supported currently.");
mTransportProvider = TransportProvider.Factory.create();
}
private void startServerThread() throws Exception {
// create args and use them to build a Thrift TServer
TTransportFactory tTransportFactory = mTransportProvider.getServerTransportFactory();
mServer = new TThreadPoolServer(
new TThreadPoolServer.Args(mServerTSocket).maxWorkerThreads(2).minWorkerThreads(1)
.processor(null).transportFactory(tTransportFactory)
.protocolFactory(new TBinaryProtocol.Factory(true, true)));
// start the server in a new thread
Thread serverThread = new Thread(new Runnable() {
@Override
public void run() {
mServer.serve();
}
});
serverThread.start();
// ensure server is running, and break if it does not start serving in 2 seconds.
int count = 40;
while (!mServer.isServing() && serverThread.isAlive()) {
if (count <= 0) {
throw new RuntimeException("TThreadPoolServer does not start serving");
}
Thread.sleep(50);
count--;
}
}
/**
* This customized authentication provider is used in CUSTOM mode. It authenticates the user by
* verifying the specific username:password pair.
*/
public static class ExactlyMatchAuthenticationProvider implements AuthenticationProvider {
static final String USERNAME = "alluxio";
static final String PASSWORD = "correct-password";
@Override
public void authenticate(String user, String password) throws AuthenticationException {
if (!user.equals(USERNAME) || !password.equals(PASSWORD)) {
throw new AuthenticationException("User authentication fails");
}
}
}
}
| {
"content_hash": "69301cc441d67119841a79ef4a398d6a",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 100,
"avg_line_length": 36.466145833333336,
"alnum_prop": 0.7346997072055989,
"repo_name": "yuluo-ding/alluxio",
"id": "c7b93ab277da548bd6dcb6cbd61bb038778ba3c3",
"size": "14515",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "core/common/src/test/java/alluxio/security/authentication/TransportProviderTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "599"
},
{
"name": "Java",
"bytes": "5846202"
},
{
"name": "JavaScript",
"bytes": "1079"
},
{
"name": "Protocol Buffer",
"bytes": "9229"
},
{
"name": "Python",
"bytes": "11471"
},
{
"name": "Roff",
"bytes": "5796"
},
{
"name": "Ruby",
"bytes": "23034"
},
{
"name": "Shell",
"bytes": "102910"
},
{
"name": "Thrift",
"bytes": "27552"
}
],
"symlink_target": ""
} |
a minimalistic chat webapp written in go
| {
"content_hash": "511707dddab733f2297e6c55261a30fa",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.8292682926829268,
"repo_name": "jcuga/micro-chat",
"id": "93d04b166df821db0d2085a03fa044dde24b9f0f",
"size": "54",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "31759"
}
],
"symlink_target": ""
} |
'use strict';
let requestAuthKey = null;
function request(body, timeout = 5000) {
let xhr = new XMLHttpRequest();
xhr.open('POST', `http://${location.hostname}:8774/socket`);
return new Promise(function (resolve, reject) {
xhr.onload = function (e) {
if (xhr.status === 200) {
resolve(xhr.responseText);
} else if ([400, 403, 500].includes(xhr.status)) {
reject(`${xhr.statusText}: ${xhr.responseText}`);
} else {
reject(`Unknown response: ${xhr.status} ${xhr.statusText} (${xhr.responseText})`)
}
};
xhr.ontimeout = (e) => reject('Request timed out!');
xhr.onerror = (e) => reject('Error communicating with bttn!');
xhr.timeout = timeout;
if (requestAuthKey) {
body = 'auth = ' + requestAuthKey + '\n' + body;
}
xhr.send(body);
});
}
function setRequestAuthKey(key) {
requestAuthKey = key;
}
window.request = request;
window.setRequestAuthKey = setRequestAuthKey;
| {
"content_hash": "1e83a21f3f2c6ea1f3b821c2a2aff5bc",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 85,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.6478260869565218,
"repo_name": "mafredri/openbttn",
"id": "c0f54d3e1262c3f4aa0a988de5c10b2e78dcdf21",
"size": "920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/openbttn/request.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "105466"
},
{
"name": "CSS",
"bytes": "536"
},
{
"name": "Go",
"bytes": "4945"
},
{
"name": "HTML",
"bytes": "3981"
},
{
"name": "JavaScript",
"bytes": "5562"
},
{
"name": "Makefile",
"bytes": "2022"
},
{
"name": "Shell",
"bytes": "1122"
}
],
"symlink_target": ""
} |
<?php
namespace DavidBarratt\CustomInstaller\Tests;
use DavidBarratt\CustomInstaller\CustomInstaller;
use Composer\Config;
use Composer\Composer;
use Composer\Package\Package;
use Composer\Package\RootPackage;
use PHPUnit_Framework_TestCase;
class CustomInstallerTest extends PHPUnit_Framework_TestCase
{
/**
* Tests installation path for given package/spec combination.
*
* @param string $name Full package name (including vendor)
* @param string $type Composer package type
* @param array $spec Custom-Installer configuration
* @param string $expected Expected path
*
* @dataProvider dataForInstallPath
*/
public function testInstallPath($name, $type, $spec, $expected)
{
$composer = new Composer();
$config = new Config(false, realpath('.'));
$composer->setConfig($config);
$repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
$io = $this->getMock('Composer\IO\IOInterface');
$installer = new CustomInstaller($io, $composer);
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
$composer->setPackage($consumerPackage);
$consumerPackage->setExtra(array(
'custom-installer' => $spec,
));
$result = $installer->getInstallPath($package);
$this->assertEquals($expected, $result);
}
/**
* Data provider for testing multiple install paths.
*
* @return array
*/
public function dataForInstallPath()
{
return array(
array(
'davidbarratt/davidwbarratt',
'drupal-site',
array('drupal-site' => 'sites/{$name}/'),
'sites/davidwbarratt/',
),
array(
'awesome/package',
'custom-type',
array('custom-type' => 'custom/{$vendor}/{$name}/'),
'custom/awesome/package/',
),
array(
'drupal/core',
'drupal-core',
array('drupal-core' => 'web/'),
'web/',
),
// Without spec.
array(
'package/without-spec',
'library',
array(),
realpath('.') . '/vendor/package/without-spec',
),
// New format
array(
'config/with-new-format',
'custom-type',
array(
'custom/{$type}/{$vendor}/{$name}/' => array('type:custom-type'),
),
'custom/custom-type/config/with-new-format/',
),
// Per package
array(
'config/per-package',
'custom-type',
array(
'custom/{$vendor}/{$name}/' => array('config/per-package'),
),
'custom/config/per-package/',
),
// Package over type
array(
'config/package-over-type',
'custom-type',
array(
'type-folder/{$vendor}/{$name}/' => array('type:custom-type'),
'package-folder/{$vendor}/{$name}/' => array('config/package-over-type'),
),
'package-folder/config/package-over-type/',
),
);
}
}
| {
"content_hash": "23eb92b28e31a3e7d34e170b483de28f",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 89,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.5267857142857143,
"repo_name": "davidbarratt/custom-installer",
"id": "df0c3d7b05810df144d0496c690118785e3c8b3c",
"size": "3495",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tests/CustomInstallerTest.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "9834"
}
],
"symlink_target": ""
} |
#ifndef ZEPHIR_KERNEL_OBJECT_H
#define ZEPHIR_KERNEL_OBJECT_H
/** Class Retrieving/Checking */
int zephir_class_exists(const zval *class_name, int autoload TSRMLS_DC);
int zephir_interface_exists(const zval *interface_name, int autoload TSRMLS_DC);
void zephir_get_class(zval *result, zval *object, int lower TSRMLS_DC);
void zephir_get_class_ns(zval *result, zval *object, int lower TSRMLS_DC);
void zephir_get_ns_class(zval *result, zval *object, int lower TSRMLS_DC);
void zephir_get_called_class(zval *return_value TSRMLS_DC);
zend_class_entry *zephir_fetch_class(const zval *class_name TSRMLS_DC);
zend_class_entry* zephir_fetch_self_class(TSRMLS_D);
zend_class_entry* zephir_fetch_parent_class(TSRMLS_D);
zend_class_entry* zephir_fetch_static_class(TSRMLS_D);
#define ZEPHIR_GET_CLASS_CONSTANT(return_value, ce, const_name) \
do { \
if (FAILURE == zephir_get_class_constant(return_value, ce, const_name, strlen(const_name)+1 TSRMLS_CC)) { \
ZEPHIR_MM_RESTORE(); \
return; \
} \
} while (0)
/** Class constants */
int zephir_get_class_constant(zval *return_value, zend_class_entry *ce, char *constant_name, unsigned int constant_length TSRMLS_DC);
/** Cloning/Instance of*/
int zephir_clone(zval *destiny, zval *obj TSRMLS_DC);
int zephir_instance_of(zval *result, const zval *object, const zend_class_entry *ce TSRMLS_DC);
int zephir_is_instance_of(zval *object, const char *class_name, unsigned int class_length TSRMLS_DC);
int zephir_instance_of_ev(const zval *object, const zend_class_entry *ce TSRMLS_DC);
int zephir_zval_is_traversable(zval *object TSRMLS_DC);
/** Method exists */
int zephir_method_exists(const zval *object, const zval *method_name TSRMLS_DC);
int zephir_method_exists_ex(const zval *object, const char *method_name, unsigned int method_len TSRMLS_DC);
int zephir_method_quick_exists_ex(const zval *object, const char *method_name, unsigned int method_len, unsigned long hash TSRMLS_DC);
/** Isset properties */
int zephir_isset_property(zval *object, const char *property_name, unsigned int property_length TSRMLS_DC);
int zephir_isset_property_quick(zval *object, const char *property_name, unsigned int property_length, unsigned long hash TSRMLS_DC);
int zephir_isset_property_zval(zval *object, const zval *property TSRMLS_DC);
/** Reading properties */
zval* zephir_fetch_property_this_quick(zval *object, const char *property_name, zend_uint property_length, ulong key, int silent TSRMLS_DC);
int zephir_read_property(zval **result, zval *object, const char *property_name, zend_uint property_length, int silent TSRMLS_DC);
int zephir_read_property_zval(zval **result, zval *object, zval *property, int silent TSRMLS_DC);
int zephir_return_property(zval *return_value, zval **return_value_ptr, zval *object, char *property_name, unsigned int property_length TSRMLS_DC);
int zephir_return_property_quick(zval *return_value, zval **return_value_ptr, zval *object, char *property_name, unsigned int property_length, unsigned long key TSRMLS_DC);
int zephir_fetch_property(zval **result, zval *object, const char *property_name, zend_uint property_length, int silent TSRMLS_DC);
int zephir_fetch_property_zval(zval **result, zval *object, zval *property, int silent TSRMLS_DC);
/** Updating properties */
int zephir_update_property_this(zval *object, char *property_name, unsigned int property_length, zval *value TSRMLS_DC);
int zephir_update_property_long(zval *obj, char *property_name, unsigned int property_length, long value TSRMLS_DC);
int zephir_update_property_string(zval *object, char *property_name, unsigned int property_length, char *str, unsigned int str_length TSRMLS_DC);
int zephir_update_property_bool(zval *obj, char *property_name, unsigned int property_length, int value TSRMLS_DC);
int zephir_update_property_null(zval *obj, char *property_name, unsigned int property_length TSRMLS_DC);
int zephir_update_property_zval(zval *obj, const char *property_name, unsigned int property_length, zval *value TSRMLS_DC);
int zephir_update_property_zval_zval(zval *obj, zval *property, zval *value TSRMLS_DC);
int zephir_update_property_empty_array(zend_class_entry *ce, zval *object, char *property, unsigned int property_length TSRMLS_DC);
/** Updating array properties */
int zephir_update_property_array(zval *object, const char *property, zend_uint property_length, const zval *index, zval *value TSRMLS_DC);
int zephir_update_property_array_string(zval *object, char *property, unsigned int property_length, char *index, unsigned int index_length, zval *value TSRMLS_DC);
int zephir_update_property_array_append(zval *object, char *property, unsigned int property_length, zval *value TSRMLS_DC);
int zephir_update_property_array_multi(zval *object, const char *property, zend_uint property_length, zval **value TSRMLS_DC, const char *types, int types_length, int types_count, ...);
/** Increment/Decrement properties */
int zephir_property_incr(zval *object, char *property_name, unsigned int property_length TSRMLS_DC);
int zephir_property_decr(zval *object, char *property_name, unsigned int property_length TSRMLS_DC);
/** Unset properties */
int zephir_unset_property(zval* object, const char* name TSRMLS_DC);
int zephir_unset_property_array(zval *object, char *property, unsigned int property_length, zval *index TSRMLS_DC);
/** Static properties */
int zephir_read_static_property(zval **result, const char *class_name, unsigned int class_length, char *property_name, unsigned int property_length TSRMLS_DC);
int zephir_update_static_property_ce(zend_class_entry *ce, const char *name, int len, zval **value TSRMLS_DC);
int zephir_update_static_property_ce_cache(zend_class_entry *ce, const char *name, int len, zval **value, zend_property_info **property_info TSRMLS_DC);
int zephir_update_static_property(const char *class_name, unsigned int class_length, char *name, unsigned int name_length, zval **value TSRMLS_DC);
int zephir_read_static_property_ce(zval **result, zend_class_entry *ce, const char *property, int len TSRMLS_DC);
int zephir_read_class_property(zval **result, int type, const char *property, int len TSRMLS_DC);
zval* zephir_fetch_static_property_ce(zend_class_entry *ce, const char *property, int len TSRMLS_DC);
int zephir_update_static_property_array_multi_ce(zend_class_entry *ce, const char *property, zend_uint property_length, zval **value TSRMLS_DC, const char *types, int types_length, int types_count, ...);
/** Create instances */
int zephir_create_instance(zval *return_value, const zval *class_name TSRMLS_DC);
int zephir_create_instance_params(zval *return_value, const zval *class_name, zval *params TSRMLS_DC);
/** Create closures */
int zephir_create_closure_ex(zval *return_value, zval *this_ptr, zend_class_entry *ce, const char *method_name, zend_uint method_length TSRMLS_DC);
/**
* Reads a property from this_ptr (with pre-calculated key)
* Variables must be defined in the class definition. This function ignores magic methods or dynamic properties
*/
ZEPHIR_ATTR_NONNULL static inline int zephir_read_property_this_quick(zval **result, zval *object, const char *property_name, zend_uint property_length, ulong key, int silent TSRMLS_DC)
{
zval *tmp = zephir_fetch_property_this_quick(object, property_name, property_length, key, silent TSRMLS_CC);
if (EXPECTED(tmp != NULL)) {
*result = tmp;
Z_ADDREF_PP(result);
return SUCCESS;
}
ALLOC_INIT_ZVAL(*result);
return FAILURE;
}
/**
* Reads a property from this_ptr
* Variables must be defined in the class definition. This function ignores magic methods or dynamic properties
*/
ZEPHIR_ATTR_NONNULL static inline int zephir_read_property_this(zval **result, zval *object, const char *property_name, zend_uint property_length, int silent TSRMLS_DC)
{
#ifdef __GNUC__
if (__builtin_constant_p(property_name) && __builtin_constant_p(property_length)) {
return zephir_read_property_this_quick(result, object, property_name, property_length, zend_inline_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
#endif
return zephir_read_property_this_quick(result, object, property_name, property_length, zend_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
ZEPHIR_ATTR_NONNULL static inline zval* zephir_fetch_nproperty_this_quick(zval *object, const char *property_name, zend_uint property_length, ulong key, int silent TSRMLS_DC)
{
#ifdef __GNUC__
if (__builtin_constant_p(property_name) && __builtin_constant_p(property_length)) {
zval *result = zephir_fetch_property_this_quick(object, property_name, property_length, key, silent TSRMLS_CC);
return result ? result : EG(uninitialized_zval_ptr);
}
#endif
zval *result = zephir_fetch_property_this_quick(object, property_name, property_length, key, silent TSRMLS_CC);
return result ? result : EG(uninitialized_zval_ptr);
}
ZEPHIR_ATTR_NONNULL static inline zval* zephir_fetch_nproperty_this(zval *object, const char *property_name, zend_uint property_length, int silent TSRMLS_DC)
{
#ifdef __GNUC__
if (__builtin_constant_p(property_name) && __builtin_constant_p(property_length)) {
return zephir_fetch_nproperty_this_quick(object, property_name, property_length, zend_inline_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
#endif
return zephir_fetch_nproperty_this_quick(object, property_name, property_length, zend_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
ZEPHIR_ATTR_NONNULL static inline zval* zephir_fetch_property_this(zval *object, const char *property_name, zend_uint property_length, int silent TSRMLS_DC)
{
#ifdef __GNUC__
if (__builtin_constant_p(property_name) && __builtin_constant_p(property_length)) {
return zephir_fetch_property_this_quick(object, property_name, property_length, zend_inline_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
#endif
return zephir_fetch_property_this_quick(object, property_name, property_length, zend_hash_func(property_name, property_length + 1), silent TSRMLS_CC);
}
#endif
#define zephir_fetch_safe_class(destination, var) \
{ \
if (Z_TYPE_P(var) == IS_STRING) { \
ZEPHIR_CPY_WRT(destination, var); \
} else { \
ZEPHIR_INIT_NVAR(destination); \
ZVAL_STRING(destination, "<undefined class>", 1); \
} \
}
| {
"content_hash": "abba1760624b4fa4373de76c8367ee47",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 203,
"avg_line_length": 58.95977011494253,
"alnum_prop": 0.7540695974266498,
"repo_name": "karakurihiden/zephir",
"id": "0582d7a52c53c25def7d22e1b227b3d6f5a04967",
"size": "11496",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ext/kernel/object.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1506206"
},
{
"name": "C++",
"bytes": "5130"
},
{
"name": "CSS",
"bytes": "6203"
},
{
"name": "HTML",
"bytes": "13682"
},
{
"name": "JavaScript",
"bytes": "4556"
},
{
"name": "Objective-C",
"bytes": "2021"
},
{
"name": "PHP",
"bytes": "2130401"
},
{
"name": "Shell",
"bytes": "4731"
},
{
"name": "Zephir",
"bytes": "175656"
}
],
"symlink_target": ""
} |
package gphoto
// #cgo LDFLAGS: -L/usr/lib/x86_64-linux-gnu -lgphoto2 -lgphoto2_port
// #cgo CFLAGS: -I/usr/include
// #include <gphoto2/gphoto2.h>
// #include <stdlib.h>
import "C"
import (
"fmt"
"io"
"reflect"
"unsafe"
)
type cameraFilePathInternal struct {
Name [128]uint8
Folder [1024]uint8
}
//DownloadImage saves image pointed by path to the provided buffer. If leave on camera is set to false,the file will be deleted from the camera internal storage
func (file *CameraFilePath) DownloadImage(buffer io.Writer, leaveOnCamera bool) error {
gpFile, err := newGpFile()
if err != nil {
return err
}
defer C.gp_file_free(gpFile)
fileDir := C.CString(file.Folder)
defer C.free(unsafe.Pointer(fileDir))
fileName := C.CString(file.Name)
defer C.free(unsafe.Pointer(fileName))
if retval := C.gp_camera_file_get(file.camera.gpCamera, fileDir, fileName, FileTypeNormal, gpFile, file.camera.gpContext); retval != gpOk {
return fmt.Errorf("Cannot download photo file, error code :%v", retval)
}
err = getFileBytes(gpFile, buffer)
if err != nil && leaveOnCamera == false {
C.gp_camera_file_delete(file.camera.gpCamera, fileDir, fileName, file.camera.gpContext)
}
return err
}
//CaptureImage captures image with current setings into camera's internal storage
func (camera *Camera) CaptureImage() (*CameraFilePath, error) {
photoPath := cameraFilePathInternal{}
if retval := C.gp_camera_capture(camera.gpCamera, 0, (*C.CameraFilePath)(unsafe.Pointer(&photoPath)), camera.gpContext); retval != gpOk {
return nil, fmt.Errorf("Cannot capture photo, error code :%v", retval)
}
return newCameraFilePathFromInternalImpl(&photoPath, camera), nil
}
//CapturePreview captures image preview and saves it in provided buffer
func (camera *Camera) CapturePreview(buffer io.Writer) error {
gpFile, err := newGpFile()
if err != nil {
return err
}
if retval := C.gp_camera_capture_preview(camera.gpCamera, gpFile, camera.gpContext); retval != gpOk {
return fmt.Errorf("Cannot capture preview, error code : %d", retval)
}
return getFileBytes(gpFile, buffer)
}
//DeleteFile tries to delete file from the camera, and returns error if it fails
func (camera *Camera) DeleteFile(path *CameraFilePath) error {
fileDir := C.CString(path.Folder)
defer C.free(unsafe.Pointer(fileDir))
fileName := C.CString(path.Name)
defer C.free(unsafe.Pointer(fileName))
retval := C.gp_camera_file_delete(camera.gpCamera, fileDir, fileName, camera.gpContext)
if retval != gpOk {
return fmt.Errorf("Cannot delete fine on camera, error code :%v", retval)
}
return nil
}
//ListFiles returns a lits of files and folders on the camera
func (camera *Camera) ListFiles() ([]CameraStorageInfo, error) {
var gpCameraStorageInformation *C.CameraStorageInformation
var storageCount C.int
storageCount = 0
returnedStorageInfo := []CameraStorageInfo{}
retval := C.gp_camera_get_storageinfo(camera.gpCamera, (**C.CameraStorageInformation)(unsafe.Pointer(&gpCameraStorageInformation)), &storageCount, camera.gpContext)
if retval != gpOk {
return nil, fmt.Errorf("Cannot get camera storage info, error code %d", retval)
}
defer C.free(unsafe.Pointer(gpCameraStorageInformation))
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(gpCameraStorageInformation)),
Len: int(storageCount),
Cap: int(storageCount),
}
nativeCameraFileSystemInfo := *(*[]C.CameraStorageInformation)(unsafe.Pointer(&hdr))
for i := 0; i < int(storageCount); i++ {
cameraStorage := CameraStorageInfo{
Description: C.GoString((*C.char)(&nativeCameraFileSystemInfo[i].description[0])),
Capacity: uint64(nativeCameraFileSystemInfo[i].capacitykbytes),
Free: uint64(nativeCameraFileSystemInfo[i].freekbytes),
FreeImages: uint64(nativeCameraFileSystemInfo[i].freeimages),
Children: []CameraFilePath{},
basedir: C.GoString((*C.char)(&nativeCameraFileSystemInfo[i].basedir[0])),
camera: camera,
}
if err := camera.recursiveListAllFiles(&cameraStorage.basedir, &cameraStorage.Children); err != nil {
return nil, err
}
returnedStorageInfo = append(returnedStorageInfo, cameraStorage)
}
return returnedStorageInfo, nil
}
func (camera *Camera) recursiveListAllFiles(basedir *string, children *[]CameraFilePath) error {
items, err := camera.findAllChildDirectories(basedir)
if err != nil {
return err
}
for _, dirName := range items {
dirItem := CameraFilePath{
Name: dirName,
Folder: *basedir,
Isdir: true,
Children: []CameraFilePath{},
camera: camera,
}
childPath := *basedir + "/" + dirName
if err := camera.recursiveListAllFiles(&childPath, &dirItem.Children); err != nil {
return err
}
*children = append(*children, dirItem)
}
items, err = camera.findAllFilesInDir(basedir)
if err != nil {
return err
}
for _, fileName := range items {
fileItem := CameraFilePath{
Name: fileName,
Folder: *basedir,
Isdir: false,
Children: nil,
camera: camera,
}
*children = append(*children, fileItem)
}
fmt.Println("Dir ", *basedir, " has ", len(*children), " children")
return nil
}
//Hmm, this could be reduced to one func, and a lambda passed as an arg
func (camera *Camera) findAllChildDirectories(basedirPath *string) ([]string, error) {
var gpFileList *C.CameraList
var err error
returnedSlice := []string{}
gpDirPath := C.CString(*basedirPath)
defer C.free(unsafe.Pointer(gpDirPath))
if gpFileList, err = newGphotoList(); err != nil {
return nil, err
}
defer C.gp_list_free(gpFileList)
if retval := C.gp_camera_folder_list_folders(camera.gpCamera, gpDirPath, gpFileList, camera.gpContext); retval != gpOk {
return nil, fmt.Errorf("Cannot get folder list from dir %s, error code %v", *basedirPath, retval)
}
listSize := int(C.gp_list_count(gpFileList))
for i := 0; i < listSize; i++ {
var gpListElementName *C.char
C.gp_list_get_name(gpFileList, (C.int)(i), (**C.char)(&gpListElementName))
returnedSlice = append(returnedSlice, C.GoString(gpListElementName))
}
return returnedSlice, nil
}
func (camera *Camera) findAllFilesInDir(basedirPath *string) ([]string, error) {
var err error
returnedSlice := []string{}
gpDirPath := C.CString(*basedirPath)
defer C.free(unsafe.Pointer(gpDirPath))
gpFileList, err := newGphotoList()
if err != nil {
return nil, err
}
defer C.gp_list_free(gpFileList)
if retval := C.gp_camera_folder_list_files(camera.gpCamera, gpDirPath, gpFileList, camera.gpContext); retval != gpOk {
return nil, fmt.Errorf("Cannot get file list from dir %s, error code %v", *basedirPath, retval)
}
listSize := int(C.gp_list_count(gpFileList))
for i := 0; i < listSize; i++ {
var gpListElementName *C.char
C.gp_list_get_name(gpFileList, (C.int)(i), (**C.char)(&gpListElementName))
returnedSlice = append(returnedSlice, C.GoString(gpListElementName))
}
return returnedSlice, nil
}
| {
"content_hash": "de1cfa5f65c08e56a6787f55010e9e12",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 165,
"avg_line_length": 32.45283018867924,
"alnum_prop": 0.7190406976744186,
"repo_name": "szank/gphoto",
"id": "44a69d5f21b7efd945c0298f2305d31ff589eb73",
"size": "6880",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "photos.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "801"
},
{
"name": "Go",
"bytes": "25569"
}
],
"symlink_target": ""
} |
from datetime import datetime, timedelta
import subprocess
import sys
from threading import Thread
import time
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty # python 3.x
from .logger import logger
from .utils import time_duration_pretty, format_with_colors
class CIRunner(object):
def __init__(self):
self.command_steps = []
self.cleanup_steps = []
def add_serial_command_step(self, command, timeout=None, suppress_stdout=False, stdout_callback=None):
""" Add a command to run.
A command is a function that takes in process number and returns a
string to be executed as a subcommand in a shell.
"""
cmd = Command(command, suppress_stdout=suppress_stdout, stdout_callback=stdout_callback)
self.command_steps.append((1, [cmd], timeout))
def add_parallel_command_step(self, commands_list, timeout=None, suppress_stdout=False, stdout_callback=None):
cmd_list = [Command(c, suppress_stdout=suppress_stdout, stdout_callback=stdout_callback) for c in commands_list]
self.command_steps.append((len(cmd_list), cmd_list, timeout))
def add_serial_cleanup_step(self, command, timeout=None, suppress_stdout=False, stdout_callback=None):
cmd = Command(command, suppress_stdout=suppress_stdout, stdout_callback=stdout_callback)
self.cleanup_steps.append((1, [cmd], timeout))
def add_parallel_cleanup_step(self, commands_list, timeout=None, suppress_stdout=False, stdout_callback=None):
cmd_list = [Command(c, suppress_stdout=suppress_stdout, stdout_callback=stdout_callback) for c in commands_list]
self.cleanup_steps.append((len(cmd_list), cmd_list, timeout))
def _run_single(self, cmd_string):
return subprocess.Popen(
cmd_string,
shell=True,
stdout=subprocess.PIPE,
)
def _run_command_step(self, command_step, step_num, num_steps, timeout,
is_cleanup):
self.log_step(step_num, num_steps, len(command_step), is_cleanup)
procs = []
tick_seconds = 1
log_status_every_seconds = 30
started_at = datetime.now()
next_log_status_at = started_at + timedelta(seconds=log_status_every_seconds)
# launch commands
for i, command in enumerate(command_step):
proc_num = i + 1
cmd_string = command.command_fn(proc_num)
proc = Process.create(proc_num, cmd_string, timeout, command.suppress_stdout, command.stdout_callback)
procs.append(proc)
pending_procs = procs
# poll til completion or timeout
while True:
for proc in pending_procs:
proc.update_status()
# log results of any that have completed
newly_complete_procs = [proc for proc in pending_procs if proc.is_complete()]
for proc in newly_complete_procs:
if proc.started_reading_output:
proc.log_latest_output()
proc.log_result()
proc.process_callback()
# kill & log results for any procs past timeout
timed_out_procs = [proc for proc in pending_procs if proc.is_timed_out()]
for proc in timed_out_procs:
if proc.started_reading_output:
proc.log_latest_output()
proc.kill()
proc.log_result()
# update pending_procs list for next loop tick
pending_procs = [proc for proc in procs if proc.is_pending()]
# exit if all proccesses have finished
if len(pending_procs) == 0:
return procs
# if only 1 proc still running, start logging its output in real time
if len(pending_procs) == 1:
pending_procs[0].log_latest_output()
# Log time running if necessary, then sleep til next tick
now = datetime.now()
if now > next_log_status_at:
diff = next_log_status_at - started_at
logger.info("Running for " + time_duration_pretty(diff.seconds))
next_log_status_at += timedelta(seconds=log_status_every_seconds)
time.sleep(tick_seconds)
def run(self):
num_steps = len(self.command_steps)
for i, command_step_tuple in enumerate(self.command_steps):
_, command_step, timeout = command_step_tuple
procs = self._run_command_step(
command_step, i + 1, num_steps, timeout, False)
if not self.all_succeeded(procs):
logger.info("")
logger.info(format_with_colors(
"{red}Exiting due to 1 or more commands failed{end}"))
logger.info("")
self._run_cleanup()
sys.exit(1)
self._run_cleanup()
def _run_cleanup(self):
num_steps = len(self.cleanup_steps)
for i, command_step_tuple in enumerate(self.cleanup_steps):
_, command_step, timeout = command_step_tuple
# in cleanup, run all steps regardless of if any previous ones fail
self._run_command_step(command_step, i + 1, num_steps, timeout, True)
@classmethod
def all_succeeded(cls, procs):
return all(p.status == 0 for p in procs)
@classmethod
def log_step(cls, step_num, num_steps, num_commands, is_cleanup):
cleanup_str = "Cleanup " if is_cleanup else "Running "
info = "{0}step {1} of {2}".format(cleanup_str, step_num, num_steps)
if num_commands == 1:
info += " (single command)"
else:
info += " ({0} commands in parallel)".format(num_commands)
desired_len = 100
pre_len = (desired_len - len(info)) // 2 - 1
pre_str = "=" * pre_len
post_len = desired_len - len(info) - pre_len - 2
post_str = "=" * post_len
info = format_with_colors("{0} {1} {2}", pre_str, info, post_str)
logger.info(info)
class Command(object):
def __init__(self, command, suppress_stdout=False, stdout_callback=None):
if hasattr(command, '__call__'):
self.command_fn = command
else:
def wrapped_command(i):
return command
self.command_fn = wrapped_command
self.suppress_stdout = suppress_stdout
self.stdout_callback = stdout_callback
class Process(object):
@classmethod
def create(cls, number, cmd_string, timeout, suppress_stdout, stdout_callback):
""" Run the given command string in a shell as a new process,
initializing a Process object wrapper for it.
"""
p = subprocess.Popen(
cmd_string,
shell=True,
stdout=subprocess.PIPE,
)
obj = cls(number, cmd_string, p, datetime.now(), timeout, suppress_stdout, stdout_callback)
obj.start_output_listener()
return obj
def __init__(self, number, cmd_string, popen_process,
started_at, timeout, suppress_stdout, stdout_callback):
self.number = number
self.cmd_string = cmd_string
self.popen_process = popen_process
self.started_at = started_at
self.timeout = timeout
self.status = None
self.suppress_stdout = suppress_stdout
self.stdout_callback = stdout_callback
self.stdout_lines = []
self.started_reading_output = False
def update_status(self):
self.status = self.popen_process.poll()
timeout_diff = datetime.now() - self.started_at
if self.timeout is not None and self.is_pending() and timeout_diff >= self.timeout:
self.status = -1
def start_output_listener(self):
def enqueue_output(out, queue):
for line in iter(out.readline, b''):
queue.put(line)
out.close()
self.stdout_q = Queue()
self.stdout_reader_t = Thread(
target=enqueue_output, args=(self.popen_process.stdout, self.stdout_q))
self.stdout_reader_t.daemon = True # make sure thread exits when program does
self.stdout_reader_t.start()
def latest_output(self):
self.started_reading_output = True
while True:
try:
line = self.stdout_q.get_nowait()
parsed_line = line.rstrip(b'\n').rstrip(b'\r').decode('utf-8')
if self.stdout_callback:
self.stdout_lines.append(parsed_line)
yield parsed_line
except Empty:
raise StopIteration()
def log_latest_output(self):
if not self.started_reading_output:
first_word = "(Not showing output)" if self.suppress_stdout else "Output"
logger.info("{0} for {1}:".format(first_word, self.number))
for line in self.latest_output():
if not self.suppress_stdout:
logger.info(line)
# Process can be either: pending, complete, or timed_out.
# Complete processes can be successful or failed
def is_pending(self):
return self.status is None
def is_complete(self):
return self.status is not None and self.status >= 0
def is_completed_successful(self):
return self.status is not None and self.status == 0
def is_completed_failed(self):
return self.status is not None and self.status > 0
def _failure_code_explanation(self, code):
if code == 1000:
return "succeeded, but with unexpected output passed to the stdout callback"
return "failed with exit code {0}".format(code)
def is_timed_out(self):
return self.status is not None and self.status == -1
def kill(self):
self.popen_process.kill() # kill -9 the process
def process_callback(self):
if not self.stdout_callback:
return
# if command failed, don't call the stdout callback with the output
if not self.is_completed_successful():
return
cb_status = self.stdout_callback(self.stdout_lines)
if not cb_status:
self.status = 1000
def log_result(self):
if self.started_reading_output: # output is above, log blank line before status
logger.info("")
if self.is_pending():
col = "{yellow}"
exit_phrase = "still running"
elif self.is_completed_successful():
col = "{green}"
exit_phrase = "exited successfully"
elif self.is_completed_failed():
col = "{red}"
exit_phrase = self._failure_code_explanation(self.status)
elif self.is_timed_out():
col = "{red}"
exit_phrase = "timed out after {0}".format(time_duration_pretty(self.timeout))
logger.info(format_with_colors(
col + "Command {0} {1}{end}", self.number, exit_phrase))
# Since we're using format() to add in colors, can't have any raw { and } chars in text
printable_cmd_str = self.cmd_string.replace('{', '{{').replace('}', '}}')
logger.info(format_with_colors(col + printable_cmd_str + "{end}"))
if not self.started_reading_output:
# at this point, process is finished so the non-blocking
# latest_output already has all output and we don't have to block.
# And output is below, log blank line after status
logger.info("")
self.log_latest_output()
logger.info("-" * 100)
| {
"content_hash": "6dc58d75ca843b4796668542a18cec4b",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 120,
"avg_line_length": 40.41463414634146,
"alnum_prop": 0.5963445124579705,
"repo_name": "dcosson/parallel-ci-runner",
"id": "ca2efba52e33131c7f226c15818c707c9c6df996",
"size": "11599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "parallel_ci_runner/runner.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "25862"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>paradoxes: 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.9.0 / paradoxes - 8.5.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
paradoxes
<small>
8.5.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-19 20:23:50 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-19 20:23:50 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.0 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "matej.kosik@inria.fr"
homepage: "https://github.com/coq-contribs/paradoxes"
license: "LGPL 2"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Paradoxes"]
depends: [
"ocaml"
"coq" {>= "8.5" & < "8.6~"}
]
tags: [ "keyword:reynolds paradox" "keyword:burali forti paradox" "keyword:diaconescu paradox" "keyword:set theory" "keyword:system u" "keyword:inconsistency" "keyword:hurkens paradox" "category:Mathematics/Logic/Foundations" ]
authors: [ "Bruno Barras <>" "Benjamin Werner <>" "Hugo Herbelin <>" "Thierry Coquand <>" ]
bug-reports: "https://github.com/coq-contribs/paradoxes/issues"
dev-repo: "git+https://github.com/coq-contribs/paradoxes.git"
synopsis: "Paradoxes in Set Theory and Type Theory"
description: """
A formalisation of Burali-Forti paradox in system U (the
existence of an ordinal of ordinals is inconsistent), of Diaconescu
paradox (axiom of choice implies excluded-middle), of Reynolds paradox
(there is no set-theoretic model of system F) and Hurkens paradox in
system U (adapted by H. Geuvers to show the inconsistency of
Excluded-Middle in impredicative-Set Calculus of Inductive Constructions)."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/paradoxes/archive/v8.5.0.tar.gz"
checksum: "md5=09cae5a778b3cee470f9dc71b5baface"
}
</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-paradoxes.8.5.0 coq.8.9.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.9.0).
The following dependencies couldn't be met:
- coq-paradoxes -> coq < 8.6~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' 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-paradoxes.8.5.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "c0b128b21cb6bd301c3ae8adee9e8e50",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 307,
"avg_line_length": 44.01190476190476,
"alnum_prop": 0.5576142818501487,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "da6583bf828194b3067512e5293fc01ebe59f2e7",
"size": "7419",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.9.0/paradoxes/8.5.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#ifndef _CCSIP_PUBLISH_H_
#define _CCSIP_PUBLISH_H_
#include "publish_int.h"
#include "ccsip_common_cb.h"
#include "ccsip_subsmanager.h"
/* the following is to take advantage of SUB/NOT periodic timer */
#define TMR_PERIODIC_PUBLISH_INTERVAL TMR_PERIODIC_SUBNOT_INTERVAL
#define PUBLISH_FAILED_START (1000)
#define PUBLISH_FAILED_NOCONTEXT (PUBLISH_FAILED_START + 1)
#define PUBLISH_FAILED_NORESOURCE (PUBLISH_FAILED_START + 2)
#define PUBLISH_FAILED_SEND (PUBLISH_FAILED_START + 3)
#define PUBLISH_FAILED_RESET (PUBLISH_FAILED_START + 4)
typedef struct {
ccsip_common_cb_t hb; /* this MUST be the first member */
cc_srcs_t callback_task; // CallBack Task ID
int resp_msg_id; //Response Msg ID
char *entity_tag;
pub_handle_t pub_handle;
pub_handle_t app_handle;
char ruri[MAX_URI_LENGTH]; // Address of the resource
char full_ruri[MAX_SIP_URL_LENGTH];
char esc[MAX_URI_LENGTH]; // Event State Compositor
boolean outstanding_trxn;
sipPlatformUITimer_t retry_timer;
sll_handle_t pending_reqs; //holds pending requests
} ccsip_publish_cb_t; //PUBLISH Control Block data structure
extern int publish_handle_ev_app_publish(cprBuffer_t buf);
extern int publish_handle_retry_timer_expire(uint32_t handle);
extern void publish_handle_periodic_timer_expire(void);
extern int publish_handle_ev_sip_response(sipMessage_t *pSipMessage);
extern void publish_reset(void);
extern cc_int32_t show_publish_stats(cc_int32_t argc, const char *argv[]);
#endif // _CCSIP_PUBLISH_H_
| {
"content_hash": "3c015fc59254d8cf56645588ccc35da2",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 40.95238095238095,
"alnum_prop": 0.6529069767441861,
"repo_name": "wilebeast/FireFox-OS",
"id": "e138fd3328906dd58d28911eaa85058c098a5916",
"size": "3527",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "B2G/gecko/media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_publish.h",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.google.devtools.moe.client.codebase;
import com.google.devtools.moe.client.Ui;
import com.google.devtools.moe.client.Ui.Task;
import com.google.devtools.moe.client.codebase.expressions.EditExpression;
import com.google.devtools.moe.client.project.ProjectContext;
import com.google.devtools.moe.client.translation.editors.Editor;
import javax.inject.Inject;
import javax.inject.Singleton;
/** Peforms the codebase transformation for an EditExpression. */
@Singleton
public class EditedCodebaseProcessor implements CodebaseProcessor<EditExpression> {
private final Ui ui;
private final ExpressionEngine expressionEngine;
@Inject
EditedCodebaseProcessor(Ui ui, ExpressionEngine expressionEngine) {
this.ui = ui;
this.expressionEngine = expressionEngine;
}
@Override
public Codebase createCodebase(EditExpression expression, ProjectContext context)
throws CodebaseCreationError {
Codebase codebaseToEdit = expressionEngine.createCodebase(expression.getOperand(), context);
String editorName = expression.getOperation().getTerm().getIdentifier();
Editor editor = context.editors().get(editorName);
if (editor == null) {
throw new CodebaseCreationError("no editor %s", editorName);
}
try (Task task =
ui.newTask(
"edit", "Editing %s with editor %s", codebaseToEdit.path(), editor.getDescription())) {
return task.keep(
editor.edit(codebaseToEdit, expression.getOperation().getTerm().getOptions()))
.copyWithExpression(expression);
}
}
}
| {
"content_hash": "2b88342b4bcfc9ffc35b5619eb7d821d",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 99,
"avg_line_length": 37.214285714285715,
"alnum_prop": 0.7485604606525912,
"repo_name": "google/MOE",
"id": "a831984427f8fc555952f9d6cd234261d4014a75",
"size": "1563",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/src/main/java/com/google/devtools/moe/client/codebase/EditedCodebaseProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "910468"
},
{
"name": "Kotlin",
"bytes": "16661"
},
{
"name": "Shell",
"bytes": "3141"
}
],
"symlink_target": ""
} |
package exception;
public class FechaSistemaException extends Exception {
private static final long serialVersionUID = -1827444736093755471L;
public FechaSistemaException() {
super("Nao foi possivel fechar o sistema. Um usuarix ainda esta logadx.");
}
}
| {
"content_hash": "17b20d6d87a15be2772f7d022ec3695e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 76,
"avg_line_length": 27.2,
"alnum_prop": 0.7573529411764706,
"repo_name": "erijonhson/pluspop",
"id": "518d0c524d41d521972720c39d0a75d284820119",
"size": "272",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PlusPop/src/exception/FechaSistemaException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "91987"
}
],
"symlink_target": ""
} |
package com.glezo.timeMeasuring;
public class TimeMeasuringEventExecution
{
private TimeMeasuringEvent event;
private long time_elapsed;
public TimeMeasuringEventExecution(TimeMeasuringEvent event,long time_elapsed)
{
this.event =event;
this.time_elapsed =time_elapsed;
}
public TimeMeasuringEvent getEvent() { return this.event; }
public long getTimeElapsed() { return this.time_elapsed; }
public void addTimeElapsed(long l) { this.time_elapsed+=l; }
}
| {
"content_hash": "91d3795cab382e4a90ec2ca47854a636",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 30.6875,
"alnum_prop": 0.745417515274949,
"repo_name": "glezo1/commonlibs",
"id": "be3aab7e02103760037531367a60ab76372babd9",
"size": "491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "com/glezo/timeMeasuring/TimeMeasuringEventExecution.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "311716"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_06) on Fri Dec 12 14:01:54 MST 2008 -->
<TITLE>
Uses of Class cellularAutomata.rules.PistonPrime
</TITLE>
<META NAME="date" CONTENT="2008-12-12">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class cellularAutomata.rules.PistonPrime";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../cellularAutomata/rules/PistonPrime.html" title="class in cellularAutomata.rules"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?cellularAutomata/rules/\class-usePistonPrime.html" target="_top"><B>FRAMES</B></A>
<A HREF="PistonPrime.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>cellularAutomata.rules.PistonPrime</B></H2>
</CENTER>
No usage of cellularAutomata.rules.PistonPrime
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../cellularAutomata/rules/PistonPrime.html" title="class in cellularAutomata.rules"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?cellularAutomata/rules/\class-usePistonPrime.html" target="_top"><B>FRAMES</B></A>
<A HREF="PistonPrime.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"content_hash": "502dfef21d6ad7db51a6e328c57e2674",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 207,
"avg_line_length": 41.15277777777778,
"alnum_prop": 0.6113736078299021,
"repo_name": "KEOpenSource/CAExplorer",
"id": "9b8bf6dc0d9eb4c081d06141372519af3201f8f9",
"size": "5926",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/cellularAutomata/rules/class-use/PistonPrime.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1420"
},
{
"name": "Java",
"bytes": "5802939"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "7387e919b99c85d3aa3c2a9067eba9a1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "0a9175d3d8061c1f3b75169c921f1b46c5558cb3",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Senecio/Senecio volckmannii/ Syn. Senecio donae-annae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/*
* STEPReader.hpp
*
* Created on: Oct 6, 2015
* Author: saumitra
*/
#ifndef _VOXELIZER_
#define _VOXELIZER_
#include <stdlib.h>
#include <TopoDS_Shape.hxx>
#include "VoxelShape.hpp"
#include "VoxelIndexCalculator.hpp"
#include "../DataWrappers/ListOfShape.hpp"
/**
* class Voxelizer, voxelizes a given TopoDS_Shape with the help of OpenCascade
*/
class Voxelizer {
public:
Voxelizer() {};
~Voxelizer() {};
/**
* Calls voxelize() for each shape in ListOfShape and stores it in voxelShapeVector
* @param refinementLevel
* @param listOfShapes
* @param voxelShapeVector
* @param counter
*/
void voxelizeWholeVector(const int refinementLevel, const ListOfShape& listOfShapes, std::vector<VoxelShape>& voxelShapeVector);
/**
* Voxelizes topoDSShape with given refinementLevel and saves VoxelBoolDS in voxelShape
* @param topoDSShape
* @param refinementLevel
* @param voxelShape
*/
void voxelize(const TopoDS_Shape topoDSShape,const int refinementLevel, VoxelShape& voxelShape);
/**
* Fill Volume of voxelShape, since OpenCascade only voxelizes the outer faces and the inside is empty
* @param voxelShape
*/
void fillVolume(VoxelShape& voxelShape);
/**
* Calculate passiveVoxels by inverting all values in bodyVoxelShape._voxelShape
* @param bodyVoxelShape
* @param passiveVoxelShape
*/
void getPassiveVoxels(const VoxelShape bodyVoxelShape, VoxelShape& passiveVoxelShape);
private:
/**
* Computes BoundingBox for the given topoDSShape and stores quantities of interest in origin and shapeDimensions
* @param topoDSShape
* @param origin
* @param shapeDimensions
*/
void getBoundingBox(const TopoDS_Shape topoDSShape, std::vector<double>& origin, std::vector<double>& shapeDimensions);
};
#endif // _VOXELIZER_
| {
"content_hash": "2a2f88c5fc67d65f9f88d76bafb0b953",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 132,
"avg_line_length": 27.83823529411765,
"alnum_prop": 0.6999471737982039,
"repo_name": "BGCECSE2015/CADO",
"id": "0b66c9363adee3dbae7c1b7eafe14d81ca0614e4",
"size": "1893",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CPP/Code/src/Voxelizer/Voxelizer.hpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "92113"
},
{
"name": "CMake",
"bytes": "1257"
},
{
"name": "Makefile",
"bytes": "554"
},
{
"name": "Python",
"bytes": "208324"
},
{
"name": "QMake",
"bytes": "514"
},
{
"name": "Shell",
"bytes": "479"
}
],
"symlink_target": ""
} |
package storage
import (
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/client_golang/prometheus"
)
var (
rangeCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "range_total",
Help: "Total number of ranges seen by this member.",
})
putCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "put_total",
Help: "Total number of puts seen by this member.",
})
deleteCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "delete_total",
Help: "Total number of deletes seen by this member.",
})
txnCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "txn_total",
Help: "Total number of txns seen by this member.",
})
keysGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "keys_total",
Help: "Total number of keys.",
})
watchStreamGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "watch_stream_total",
Help: "Total number of watch streams.",
})
watcherGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "watcher_total",
Help: "Total number of watchers.",
})
slowWatcherGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "slow_watcher_total",
Help: "Total number of unsynced slow watchers.",
})
totalEventsCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "events_total",
Help: "Total number of events sent by this member.",
})
pendingEventsGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "pending_events_total",
Help: "Total number of pending events to be sent.",
})
indexCompactionPauseDurations = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "index_compaction_pause_duration_milliseconds",
Help: "Bucketed histogram of index compaction puase duration.",
// 0.5ms -> 1second
Buckets: prometheus.ExponentialBuckets(0.5, 2, 12),
})
dbCompactionPauseDurations = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "db_compaction_pause_duration_milliseconds",
Help: "Bucketed histogram of db compaction puase duration.",
// 1ms -> 4second
Buckets: prometheus.ExponentialBuckets(1, 2, 13),
})
dbCompactionTotalDurations = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "db_compaction_total_duration_milliseconds",
Help: "Bucketed histogram of db compaction total duration.",
// 100ms -> 800second
Buckets: prometheus.ExponentialBuckets(100, 2, 14),
})
dbTotalSize = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "storage",
Name: "db_total_size_in_bytes",
Help: "Total size of the underlying database in bytes.",
})
)
func init() {
prometheus.MustRegister(rangeCounter)
prometheus.MustRegister(putCounter)
prometheus.MustRegister(deleteCounter)
prometheus.MustRegister(txnCounter)
prometheus.MustRegister(keysGauge)
prometheus.MustRegister(watchStreamGauge)
prometheus.MustRegister(watcherGauge)
prometheus.MustRegister(slowWatcherGauge)
prometheus.MustRegister(totalEventsCounter)
prometheus.MustRegister(pendingEventsGauge)
prometheus.MustRegister(indexCompactionPauseDurations)
prometheus.MustRegister(dbCompactionPauseDurations)
prometheus.MustRegister(dbCompactionTotalDurations)
prometheus.MustRegister(dbTotalSize)
}
// ReportEventReceived reports that an event is received.
// This function should be called when the external systems received an
// event from storage.Watcher.
func ReportEventReceived() {
pendingEventsGauge.Dec()
totalEventsCounter.Inc()
}
| {
"content_hash": "e6c98ebd3571efdef6a71bc39e4fce1c",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 94,
"avg_line_length": 28.691275167785236,
"alnum_prop": 0.7073684210526315,
"repo_name": "cchamplin/etcd",
"id": "8f01a732feef6a946ce7ade2cd716016879beec5",
"size": "4865",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "storage/metrics.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "941"
},
{
"name": "Go",
"bytes": "1732997"
},
{
"name": "Makefile",
"bytes": "1019"
},
{
"name": "Protocol Buffer",
"bytes": "15758"
},
{
"name": "Scheme",
"bytes": "9281"
},
{
"name": "Shell",
"bytes": "16163"
}
],
"symlink_target": ""
} |
/*
* eXist Open Source Native XML Database
* Copyright (C) 2001-07 The eXist Project
* http://exist-db.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* $Id$
*/
package org.exist.backup;
import org.exist.collections.Collection;
import org.exist.dom.BinaryDocument;
import org.exist.dom.DocumentImpl;
import org.exist.dom.ElementImpl;
import org.exist.dom.StoredNode;
import org.exist.numbering.NodeId;
import org.exist.security.User;
import org.exist.stax.EmbeddedXMLStreamReader;
import org.exist.storage.DBBroker;
import org.exist.storage.NativeBroker;
import org.exist.storage.btree.BTreeCallback;
import org.exist.storage.btree.Value;
import org.exist.storage.dom.DOMFile;
import org.exist.storage.index.CollectionStore;
import org.exist.storage.io.VariableByteInput;
import org.exist.xmldb.XmldbURI;
import org.exist.xquery.TerminatedException;
import org.w3c.dom.Node;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Stack;
public class ConsistencyCheck {
private Stack elementStack = new Stack();
private static class ElementNode {
ElementImpl elem;
int childCount = 0;
NodeId prevSibling = null;
ElementNode(ElementImpl element) {
this.elem = element;
}
}
private DBBroker broker;
private int defaultIndexDepth;
public ConsistencyCheck(DBBroker broker) {
this.broker = broker;
this.defaultIndexDepth = ((NativeBroker) broker).getDefaultIndexDepth();
}
/**
* Combines {@link #checkCollectionTree(ConsistencyCheck.ProgressCallback)} and
* {@link #checkDocuments(ConsistencyCheck.ProgressCallback)}.
*
* @param callback the callback object to report to
* @return a list of {@link ErrorReport} objects or
* an empty list if no errors were found
*/
public List checkAll(ProgressCallback callback) {
List errors = checkCollectionTree(callback);
checkDocuments(callback, errors);
return errors;
}
/**
* Run some tests on the collection hierarchy, starting at
* the root collection /db.
*
* @param callback callback object
* @return a list of {@link ErrorReport} instances describing the errors found
*/
public List checkCollectionTree(ProgressCallback callback) {
User.enablePasswordChecks(false);
try {
List errors = new ArrayList();
Collection root = broker.getCollection(XmldbURI.ROOT_COLLECTION_URI);
checkCollection(root, errors, callback);
return errors;
} finally {
User.enablePasswordChecks(true);
}
}
private void checkCollection(Collection collection, List errors, ProgressCallback callback) {
XmldbURI uri = collection.getURI();
callback.startCollection(uri.toString());
for (Iterator i = collection.collectionIterator(); i.hasNext(); ) {
XmldbURI childUri = (XmldbURI) i.next();
try {
Collection child = broker.getCollection(uri.append(childUri));
if (child == null) {
ErrorReport.CollectionError error = new org.exist.backup.ErrorReport.CollectionError(org.exist.backup.ErrorReport.CHILD_COLLECTION,
"Child collection not found: " + childUri + ", parent is " + uri);
error.setCollectionId(collection.getId());
error.setCollectionURI(childUri);
errors.add(error);
callback.error(error);
continue;
}
checkCollection(child, errors, callback);
} catch (Exception e) {
ErrorReport.CollectionError error = new ErrorReport.CollectionError(org.exist.backup.ErrorReport.CHILD_COLLECTION,
"Error while loading child collection: " + childUri + ", parent is " + uri);
error.setCollectionId(collection.getId());
error.setCollectionURI(childUri);
errors.add(error);
callback.error(error);
}
}
}
public int getDocumentCount() {
User.enablePasswordChecks(false);
try {
DocumentCallback cb = new DocumentCallback(null, null, false);
broker.getResourcesFailsafe(cb);
return cb.docCount;
} finally {
User.enablePasswordChecks(true);
}
}
/**
* Run some tests on all documents stored in the database. The method
* checks if a document is readable and if its DOM representation is
* consistent.
*
* @param progress progress callback
* @return a list of {@link ErrorReport} instances describing the errors found
*/
public List checkDocuments(ProgressCallback progress) {
List errors = new ArrayList();
checkDocuments(progress, errors);
return errors;
}
/**
* Run some tests on all documents stored in the database. The method
* checks if a document is readable and if its DOM representation is
* consistent.
*
* @param progress progress callback
* @param errorList error reports will be added to this list, using instances
* of class {@link ErrorReport}.
*/
public void checkDocuments(ProgressCallback progress, List errorList) {
User.enablePasswordChecks(false);
try {
DocumentCallback cb = new DocumentCallback(errorList, progress, true);
broker.getResourcesFailsafe(cb);
} finally {
User.enablePasswordChecks(true);
}
}
/**
* Check the persistent DOM of a document. The method traverses the entire node
* tree and checks it for consistency, including node relationships, child and
* attribute counts etc.
*
* @param doc the document to check
* @return null if the document is consistent, an error report otherwise.
*/
public org.exist.backup.ErrorReport checkXMLTree(DocumentImpl doc) {
DOMFile domDb = ((NativeBroker)doc.getBroker()).getDOMFile();
try {
ElementImpl root = (ElementImpl) doc.getDocumentElement();
EmbeddedXMLStreamReader reader = doc.getBroker().getXMLStreamReader(root, true);
NodeId nodeId;
boolean attribsAllowed = false;
int expectedAttribs = 0;
int attributeCount = 0;
while (reader.hasNext()) {
int status = reader.next();
nodeId = (NodeId) reader.getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
ElementNode parent = null;
if (status != XMLStreamReader.END_ELEMENT && !elementStack.isEmpty()) {
parent = (ElementNode) elementStack.peek();
parent.childCount++;
// test parent-child relation
if (!nodeId.isChildOf(parent.elem.getNodeId()))
return new ErrorReport.ResourceError(ErrorReport.NODE_HIERARCHY, "Node " + nodeId + " is not a child of " +
parent.elem.getNodeId());
// test sibling relation
if (parent.prevSibling != null && !(
nodeId.isSiblingOf(parent.prevSibling) &&
nodeId.compareTo(parent.prevSibling) > 0
)) {
return new ErrorReport.ResourceError(ErrorReport.INCORRECT_NODE_ID, "Node " + nodeId + " is not a sibling of " +
parent.prevSibling);
}
parent.prevSibling = nodeId;
}
switch (status) {
case XMLStreamReader.ATTRIBUTE :
attributeCount++;
break;
case XMLStreamReader.END_ELEMENT :
if (elementStack.isEmpty())
return new org.exist.backup.ErrorReport.ResourceError(ErrorReport.NODE_HIERARCHY, "Error in node hierarchy: received END_ELEMENT event " +
"but stack was empty!");
ElementNode lastElem = (ElementNode) elementStack.pop();
if (lastElem.childCount != lastElem.elem.getChildCount())
return new ErrorReport.ResourceError(org.exist.backup.ErrorReport.NODE_HIERARCHY, "Element reports incorrect child count: expected " +
lastElem.elem.getChildCount() + " but found " + lastElem.childCount);
break;
case XMLStreamReader.START_ELEMENT :
if (nodeId.getTreeLevel() <= defaultIndexDepth) {
// check dom.dbx btree, which maps the node id to the node's storage address
// look up the node id and check if the returned storage address is correct
NativeBroker.NodeRef nodeRef = new NativeBroker.NodeRef(doc.getDocId(), nodeId);
try {
long p = domDb.findValue(nodeRef);
if (p != reader.getCurrentPosition())
return new ErrorReport.IndexError(ErrorReport.DOM_INDEX, "Failed to access node " + nodeId +
" through dom.dbx index.", doc.getDocId());
} catch (Exception e) {
e.printStackTrace();
return new ErrorReport.IndexError(ErrorReport.DOM_INDEX, "Failed to access node " + nodeId +
" through dom.dbx index.", e, doc.getDocId());
}
}
StoredNode node = reader.getNode();
if (node.getNodeType() != Node.ELEMENT_NODE)
return new org.exist.backup.ErrorReport.ResourceError(ErrorReport.INCORRECT_NODE_TYPE,
"Expected an element node, received node of type " +
node.getNodeType());
elementStack.push(new ElementNode((ElementImpl) node));
attribsAllowed = true;
attributeCount = 0;
expectedAttribs = reader.getAttributeCount();
break;
default :
if (attribsAllowed) {
if (attributeCount != expectedAttribs)
return new org.exist.backup.ErrorReport.ResourceError(ErrorReport.INCORRECT_NODE_TYPE,
"Wrong number of attributes. Expected: " +
expectedAttribs + "; found: " + attributeCount);
}
attribsAllowed = false;
break;
}
}
if (!elementStack.isEmpty()) {
return new org.exist.backup.ErrorReport.ResourceError(ErrorReport.NODE_HIERARCHY, "Error in node hierarchy: reached end of tree but " +
"stack was not empty!");
}
return null;
} catch (IOException e) {
e.printStackTrace();
return new org.exist.backup.ErrorReport.ResourceError(ErrorReport.RESOURCE_ACCESS_FAILED, e.getMessage(), e);
} catch (XMLStreamException e) {
e.printStackTrace();
return new ErrorReport.ResourceError(org.exist.backup.ErrorReport.RESOURCE_ACCESS_FAILED, e.getMessage(), e);
} finally {
elementStack.clear();
}
}
private class DocumentCallback implements BTreeCallback {
private List errors;
private ProgressCallback progress;
private int docCount = 0;
private boolean checkDocs;
private DocumentCallback(List errors, ProgressCallback progress, boolean checkDocs) {
this.errors = errors;
this.progress = progress;
this.checkDocs = checkDocs;
}
public boolean indexInfo(Value key, long pointer) throws TerminatedException {
CollectionStore store = (CollectionStore) ((NativeBroker)broker).getStorage(NativeBroker.COLLECTIONS_DBX_ID);
int collectionId = CollectionStore.DocumentKey.getCollectionId(key);
int docId = CollectionStore.DocumentKey.getDocumentId(key);
try {
byte type = key.data()[key.start() + Collection.LENGTH_COLLECTION_ID + DocumentImpl.LENGTH_DOCUMENT_TYPE];
VariableByteInput istream = store.getAsStream(pointer);
DocumentImpl doc = null;
if (type == DocumentImpl.BINARY_FILE)
doc = new BinaryDocument(broker);
else
doc = new DocumentImpl(broker);
doc.read(istream);
docCount++;
if (checkDocs) {
if (progress != null)
progress.startDocument(doc.getFileURI().toString());
if (type == DocumentImpl.XML_FILE) {
ErrorReport report = checkXMLTree(doc);
if (report != null) {
if (report instanceof ErrorReport.ResourceError)
((ErrorReport.ResourceError)report).setDocumentId(docId);
if (errors != null)
errors.add(report);
if (progress != null)
progress.error(report);
}
}
}
} catch (Exception e) {
e.printStackTrace();
org.exist.backup.ErrorReport.ResourceError error =
new org.exist.backup.ErrorReport.ResourceError(org.exist.backup.ErrorReport.RESOURCE_ACCESS_FAILED, e.getMessage(), e);
error.setDocumentId(docId);
if (errors != null)
errors.add(error);
if (progress != null)
progress.error(error);
}
return true;
}
}
public interface ProgressCallback {
public void startDocument(String path);
public void startCollection(String path);
public void error(org.exist.backup.ErrorReport error);
}
} | {
"content_hash": "9f43bd35d227b10f193138ba5bc09c82",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 166,
"avg_line_length": 44.45142857142857,
"alnum_prop": 0.5721815143334619,
"repo_name": "NCIP/cadsr-cgmdr-nci-uk",
"id": "8c104b0304e169c9116ac50b11ea488a6b4ffe13",
"size": "15726",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/exist/backup/ConsistencyCheck.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "291811"
},
{
"name": "CSS",
"bytes": "46374"
},
{
"name": "Emacs Lisp",
"bytes": "1302"
},
{
"name": "Java",
"bytes": "12447025"
},
{
"name": "JavaScript",
"bytes": "659235"
},
{
"name": "Perl",
"bytes": "14339"
},
{
"name": "Python",
"bytes": "8079"
},
{
"name": "Shell",
"bytes": "47723"
},
{
"name": "XQuery",
"bytes": "592174"
},
{
"name": "XSLT",
"bytes": "441742"
}
],
"symlink_target": ""
} |
<div class="password_form">
<div class="form_row">
<label>Password</label>
<input type="password" name="password" value="">
</div>
<div class="form_row">
<label>Confirm Password</label>
<input type="password" name="password_confirmation">
</div>
</div>
| {
"content_hash": "6c074ffa248a01e1fcb97d16d1d5a5e5",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 24.181818181818183,
"alnum_prop": 0.6654135338345865,
"repo_name": "codeforkansascity/Safe-Assist",
"id": "1e1f4d2fe70193fb2aee5ee45794ab7621c76b8f",
"size": "266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "laravel-src/resources/views/model/form/change_password.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "CSS",
"bytes": "29321"
},
{
"name": "HTML",
"bytes": "33583"
},
{
"name": "JavaScript",
"bytes": "5068"
},
{
"name": "PHP",
"bytes": "99800"
}
],
"symlink_target": ""
} |
require 'test_helper'
class Chelsy::TranslatorTest < Minitest::Test
include Chelsy
attr_reader :translator
def setup
@translator = Translator.new
end
def test_indent
b = Block.new << EmptyStmt.new
translator.indent_string = ' '
translator.indent_level = 1
assert_equal <<PROG, translator.translate(b) + "\n"
{
;
}
PROG
b = Block.new << (Block.new << :x)
translator.indent_string = " "
translator.indent_level = 0
assert_equal <<PROG, translator.translate(b) + "\n"
{
{
x;
}
}
PROG
end
def test_integer
i = Constant::Int.new(1)
assert_equal "1", translator.translate(i)
i = Constant::Int.new(2, unsigned: true)
assert_equal "2u", translator.translate(i)
# Hexadecimal
i = Constant::Int.new(3, unsigned: false, base: 16)
assert_equal "0x3", translator.translate(i)
i = Constant::Long.new(1_000, unsigned: true, base: 16)
assert_equal "0x3e8lu", translator.translate(i)
# Octadecimal
i = Constant::Int.new(3, unsigned: false, base: 8)
assert_equal "03", translator.translate(i)
i = Constant::Long.new(1_000, unsigned: true, base: 8)
assert_equal "01750lu", translator.translate(i)
# Unsupported radix
i = Constant::Long.new(1, base: 7)
assert_raises(ArgumentError) do
translator.translate(i)
end
end
def test_string
s = Constant::String.new("")
assert_equal %q{""}, translator.translate(s)
s = Constant::String.new("Hello, World!\n")
assert_equal %q{"Hello, World!\n"}, translator.translate(s)
s = Constant::String.new(%q{"''"})
assert_equal %q{"\"''\""}, translator.translate(s)
s = Constant::String.new(%q{Wide string literal}, wide: true)
assert_equal %q{L"Wide string literal"}, translator.translate(s)
end
# = Types
def test_types
ty = Type::Int.new
assert_equal 'int', translator.translate(ty)
ty = Type::Int.new(unsigned: true)
assert_equal 'unsigned int', translator.translate(ty)
ty = Type::Int.new(unsigned: true, const: true)
assert_equal 'const unsigned int', translator.translate(ty)
ty = Type::Int.new(unsigned: true, const: true, volatile: true)
assert_equal 'volatile const unsigned int', translator.translate(ty)
end
def test_pointer_types
ty = Type::Pointer.new(Type::Int.new)
assert_equal 'int *', translator.translate(ty)
ty = Type::Pointer.new(Type::Int.new, const: true)
assert_equal 'int *const', translator.translate(ty)
ty = Type::Pointer.new(Type::Int.new(const: true), const: true)
assert_equal 'const int *const', translator.translate(ty)
ty = Type::Pointer.new(Type::Int.new, const: true, volatile: true, restrict: true)
assert_equal 'int *const volatile restrict', translator.translate(ty)
ty = Type::Pointer.new(Type::Pointer.new(Type::Int.new))
assert_equal 'int **', translator.translate(ty)
ty = Type::Pointer.new(Type::Pointer.new(Type::Int.new, const: true))
assert_equal 'int *const *', translator.translate(ty)
end
def test_struct_types
# int member
ty = Type::Struct.new(:tnode)
assert_equal 'struct tnode', translator.translate(ty)
ty = Type::Struct.new(:s, [
Declaration.new(:n, Type::Int.new),
])
assert_equal <<PROG, translator.translate(ty) + "\n"
struct s {
int n;
}
PROG
# typedef
ty = Typedef.new(:t, ty)
assert_equal <<PROG, translator.translate(ty) + "\n"
typedef struct s {
int n;
} t
PROG
# int, double[] member
ty = Type::Struct.new(:s, [
Declaration.new(:n, Type::Int.new),
Declaration.new(:d, Type::Array.new(Type::Double.new)),
])
assert_equal <<PROG, translator.translate(ty) + "\n"
struct s {
int n;
double d[];
}
PROG
# bit-field
ty = Type::Struct.new(:s, [
BitField.new(
Constant::Int.new(3),
Declaration.new(:b1, Type::Char.new(unsigned: true))),
BitField.new(
Constant::Int.new(2)),
BitField.new(
Constant::Int.new(6),
Declaration.new(:b2, Type::Char.new(unsigned: true))),
])
assert_equal <<PROG, translator.translate(ty) + "\n"
struct s {
unsigned char b1 : 3;
: 2;
unsigned char b2 : 6;
}
PROG
end
def test_union_types
ty = Type::Union.new(:U)
assert_equal 'union U', translator.translate(ty)
ty = Type::Union.new(:U, [
Declaration.new(:i, Type::Int.new),
BitField.new(
Constant::Int.new(3),
Declaration.new(:c, Type::Char.new(unsigned: true))),
Declaration.new(:s, Type::Struct.new(:S)),
])
assert_equal <<PROG, translator.translate(ty) + "\n"
union U {
int i;
unsigned char c : 3;
struct S s;
}
PROG
end
def test_enum_types
ty = Type::Enum.new(:E)
assert_equal 'enum E', translator.translate(ty)
ty = Type::Enum.new(:hue, [
:chartreuse,
:burgundy,
EnumMember.new(:claret, Constant::Int.new(20)),
:winedark,
])
assert_equal <<PROG, translator.translate(ty) + "\n"
enum hue {
chartreuse,
burgundy,
claret = 20,
winedark
}
PROG
end
# = Expressions
def test_array_subscption
sub = Operator::Subscription.new(:x, Constant::Int.new(3))
assert_equal 'x[3]', translator.translate(sub)
sub = Operator::Subscription.new(sub, Constant::Int.new(5))
assert_equal 'x[3][5]', translator.translate(sub)
end
def test_function_call
# identifier ( args )
fc = Operator::Call.new(:abort, [])
assert_equal %q{abort()}, translator.translate(fc)
fc = Operator::Call.new(:printf, [Constant::String.new("Hello, World!\n")])
assert_equal %q{printf("Hello, World!\n")}, translator.translate(fc)
fc = Operator::Call.new(:exit, [Constant::Int.new(0)])
assert_equal %q{exit(0)}, translator.translate(fc)
# postfix-expr ( args )
f1 = Operator::Call.new(:f1, [])
f2 = Operator::Call.new(:f2, [])
f3 = Operator::Call.new(:f3, [])
fc = Operator::Call.new(f1, [f2, f3])
assert_equal %q{f1()(f2(), f3())}, translator.translate(fc)
end
def test_member_access
ma = Operator::Access.new(:s, :i)
assert_equal 's.i', translator.translate(ma)
ma = Operator::IndirectAccess.new(:s, :i)
assert_equal 's->i', translator.translate(ma)
ma = Operator::Access.new(:u, :nf)
ma = Operator::Access.new(ma, :type)
assert_equal 'u.nf.type', translator.translate(ma)
end
def test_postfix_incr_decr
node = Operator::PostfixIncrement.new(:x)
assert_equal 'x++', translator.translate(node)
node = Operator::PostfixDecrement.new(:x)
assert_equal 'x--', translator.translate(node)
node = Operator::PostfixIncrement.new(Operator::Dereference.new(:p))
assert_equal '(*p)++', translator.translate(node)
end
def test_prefix_incr_decr
node = Operator::PrefixIncrement.new(:x)
assert_equal '++x', translator.translate(node)
node = Operator::PrefixDecrement.new(:x)
assert_equal '--x', translator.translate(node)
node = Operator::Sub.new(
Operator::PostfixDecrement.new(:x),
Operator::PrefixDecrement.new(:x))
assert_equal 'x-- - --x', translator.translate(node)
end
def test_type_cast
node = Operator::Cast.new(:x, Type::Pointer.new(Type::Int.new()))
assert_equal '(int *)x', translator.translate(node)
end
def test_sizeof
node = Operator::SizeOf.new(Type::Int.new())
assert_equal 'sizeof(int)', translator.translate(node)
node = Operator::SizeOf.new(Operator::Subscription.new(:x, Constant::Int.new(0)))
assert_equal 'sizeof(x[0])', translator.translate(node)
node = Operator::SizeOf.new(Operator::Add.new(:x, :y))
assert_equal 'sizeof(x + y)', translator.translate(node)
end
def test_binary_ops
node = Operator::Mul.new(:x, :y)
assert_equal 'x * y', translator.translate(node)
node = Operator::Add.new(node, :z)
assert_equal 'x * y + z', translator.translate(node)
node = Operator::Add.new(:x, :y)
node = Operator::Mul.new(node, :z)
assert_equal '(x + y) * z', translator.translate(node)
node = Operator::Comma.new(
Operator::Add.new(:x, :y),
Operator::Mul.new(:x, :y))
assert_equal 'x + y, x * y', translator.translate(node)
end
def test_ternary_conditional
node = Operator::Conditional.new(
Operator::Not.new(Operator::Not.new(:b)),
Operator::BitwiseAnd.new(:x, Constant::Int.new(7, base: 16)),
:x)
assert_equal '!!b ? (x & 0x7) : x', translator.translate(node)
end
def test_macro
node = Macro.new(:F, [Constant::Int.new(1), Constant::Int.new(2)])
assert_equal 'F(1, 2)', translator.translate(node)
node = Macro.new(:in_between, [Raw.new('c hash_hash d')])
assert_equal 'in_between(c hash_hash d)', translator.translate(node)
node = Macro.new(:UPPER)
assert_equal 'UPPER', translator.translate(node)
end
# = Statements and blocks
def test_null_stmt
stmt = EmptyStmt.new
assert_equal '', translator.translate(stmt)
end
def test_if_stmt
stmt = If.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Return.new(Constant::Int.new(1)))
assert_equal <<PROG, translator.translate(stmt) + "\n"
if (x < 0) return 1
PROG
stmt = If.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Block.new([Return.new(Constant::Int.new(1))])
)
assert_equal <<PROG, translator.translate(stmt) + "\n"
if (x < 0) {
return 1;
}
PROG
stmt = If.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Block.new([Return.new(Constant::Int.new(1))]),
Block.new([Return.new(Constant::Int.new(2))])
)
assert_equal <<PROG, translator.translate(stmt) + "\n"
if (x < 0) {
return 1;
} else {
return 2;
}
PROG
end
def test_switch_stmt
stmt = Switch.new(
:x,
Block.new([
Case.new(Constant::Int.new(1), Operator::PostfixIncrement.new(:x)),
Break.new,
Labeled.new(:default, Operator::PostfixDecrement.new(:x)),
Break.new,
])
)
assert_equal <<PROG, translator.translate(stmt) + "\n"
switch (x) {
case 1:
x++;
break;
default:
x--;
break;
}
PROG
end
def test_goto
stmt = While.new(:loop1, Block.new([
While.new(:loop2, Block.new([
If.new(:want_out, Goto.new(:end_loop1))
])),
Labeled.new(:end_loop1, EmptyStmt.new),
]))
assert_equal <<PROG, translator.translate(stmt) + "\n"
while (loop1) {
while (loop2) {
if (want_out) goto end_loop1;
}
end_loop1:
;
}
PROG
end
def test_while_stmt
stmt = While.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Operator::AssignAdd.new(:x, Constant::Int.new(1)))
assert_equal <<PROG, translator.translate(stmt) + "\n"
while (x < 0) x += 1
PROG
stmt = While.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Block.new([Operator::AssignAdd.new(:x, Constant::Int.new(1))])
)
assert_equal <<PROG, translator.translate(stmt) + "\n"
while (x < 0) {
x += 1;
}
PROG
end
def test_do_while_stmt
stmt = DoWhile.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Operator::AssignAdd.new(:x, Constant::Int.new(1)))
assert_equal <<PROG, translator.translate(stmt) + "\n"
do x += 1 while (x < 0)
PROG
stmt = DoWhile.new(
Operator::LessThan.new(:x, Constant::Int.new(0)),
Block.new([Operator::AssignAdd.new(:x, Constant::Int.new(1))])
)
assert_equal <<PROG, translator.translate(stmt) + "\n"
do {
x += 1;
} while (x < 0)
PROG
end
def test_for_stmt
stmt = For.new do |b|
b << Break.new
b << Continue.new
end
assert_equal <<PROG, translator.translate(stmt) + "\n"
for (;;) {
break;
continue;
}
PROG
stmt = For.new(
Declaration.new(:i, Type::Int.new, Constant::Int.new(0)),
Operator::LessThan.new(:i, Constant::Int.new(10)),
Operator::PostfixIncrement.new(:i),
Block.new([Operator::AssignAdd.new(:x, Constant::Int.new(1))]))
assert_equal <<PROG, translator.translate(stmt) + "\n"
for (int i = 0; i < 10; i++) {
x += 1;
}
PROG
end
# = Declaration
def test_initializer
d = Declaration.new(:a, Type::Int.new, Constant::Int.new(3))
assert_equal 'int a = 3', translator.translate(d)
d = Declaration.new(:m, Type::Array.new(Type::Int.new), [
Constant::Int.new(1),
Constant::Int.new(2),
Constant::Int.new(3),
])
assert_equal 'int m[] = { 1, 2, 3 }', translator.translate(d)
d = Declaration.new(:m, Type::Array.new(Type::Int.new), [
Initializer.new(Constant::Int.new(1)),
Initializer.new(Constant::Int.new(2), IndexDesignator.new(:member_two))
])
assert_equal 'int m[] = { 1, [member_two] = 2 }', translator.translate(d)
d = Declaration.new(:w, Type::Struct.new(:s), [
Initializer.new(Constant::Int.new(1), MemberDesignator.new(:a))
])
assert_equal 'struct s w = { .a = 1 }', translator.translate(d)
end
def test_declaration
d = Declaration.new(:a, Type::Int.new)
assert_equal 'int a', translator.translate(d)
d = Declaration.new(:b, Type::Int.new(unsigned: true, const: true), storage: :static)
assert_equal 'static const unsigned int b', translator.translate(d)
d = Declaration.new(:C, Type::Array.new(Type::Array.new(Type::Int.new, :m), :m))
assert_equal 'int C[m][m]', translator.translate(d)
t = Typedef.new(:cui, Type::Int.new(unsigned: true, const: true))
assert_equal 'typedef const unsigned int cui', translator.translate(t)
end
def test_array_type_declaration
ty = Type::Array.new(Type::Int.new)
d = Declaration.new(:x, ty)
assert_equal 'int x[]', translator.translate(d)
# variable length array type of unspecified size
ty = Type::Array.new(Type::Int.new, :*)
d = Declaration.new(:x, ty)
assert_equal 'int x[*]', translator.translate(d)
ty = Type::Array.new(Type::Int.new, Constant::Int.new(5))
d = Declaration.new(:x, ty)
assert_equal 'int x[5]', translator.translate(d)
# `static` in parameter array declarator
ty = Type::Array.new(Type::Int.new, Constant::Int.new(5), static: true)
d = Declaration.new(:x, ty)
assert_equal 'int x[static 5]', translator.translate(d)
# type qualifiers in parameter array declarator
ty = Type::Array.new(Type::Int.new, Constant::Int.new(5), const: true, static: true)
d = Declaration.new(:x, ty)
assert_equal 'int x[const static 5]', translator.translate(d)
end
def test_function_declaration
d = Declaration.new(:f, Type::Function.new(Type::Int.new, [:void]))
assert_equal 'int f(void)', translator.translate(d)
d = Declaration.new(:f, Type::Function.new(Type::Pointer.new(Type::Int.new), [:void]))
assert_equal 'int *f(void)', translator.translate(d)
d = Declaration.new(:pfi, Type::Pointer.new(Type::Function.new(Type::Int.new, [])))
assert_equal 'int (*pfi)()', translator.translate(d)
# Function pointers
ty = Type::Function.new(Type::Int.new, [:void])
f = Type::Function.new(:void, [ty])
d = Declaration.new(:f, f)
assert_equal 'void f(int (*)(void))', translator.translate(d)
f = Type::Function.new(Type::Int.new, [
Param.new(:x, Type::Int.new),
Param.new(:y, Type::Int.new),
])
d = Declaration.new(:apfi, Type::Array.new(f, Constant::Int.new(3)))
assert_equal 'int (*apfi[3])(int x, int y)', translator.translate(d)
f = Type::Function.new(Type::Int.new, [
Type::Int.new(),
:"...",
])
f = Type::Function.new(Type::Pointer.new(f), [
Type::Function.new(Type::Int.new, [Type::Long.new]),
Type::Int.new,
])
d = Declaration.new(:fpfi, f)
assert_equal 'int (*fpfi(int (*)(long), int))(int, ...)', translator.translate(d)
f = Type::Function.new(Type::Int.new, [:void])
fp = Type::Pointer.new(Type::Pointer.new(f))
f = Type::Function.new(fp, [Type::Int.new])
d = Declaration.new(:fpp, f)
assert_equal 'int (**fpp(int))(void)', translator.translate(d)
# atexit
f = Type::Function.new(Type::Int.new, [
Param.new(:func, Type::Function.new(:void, [:void])),
])
d = Declaration.new(:atexit, f)
assert_equal 'int atexit(void (*func)(void))', translator.translate(d)
# x is function returning pointer to array[] of pointer to function returning char
a = Type::Function.new(Type::Char.new, [])
a = Type::Array.new(Type::Pointer.new(a))
f = Type::Function.new(Type::Pointer.new(a), [])
d = Declaration.new(:x, f)
assert_equal 'char (*(*x())[])()', translator.translate(d)
end
# = Function definition
def test_function_definitions
f = Function.new(:main, Type::Int.new, [:void]) do |b|
b << Operator::Call.new(:printf, [Constant::String.new("Hello, World!\n")])
b << Return.new(Constant::Int.new(0))
end
assert_equal <<PROG, translator.translate(f) + "\n"
int main(void) {
printf("Hello, World!\\n");
return 0;
}
PROG
end
# = Source file inclusion
def test_source_file_inclusion
doc = Document.new
doc.fragments << Directive::Include.new("stdio.h", system: true)
assert_equal <<PROG, translator.translate(doc)
#include <stdio.h>
PROG
end
def test_define
doc = Document.new
doc.fragments << Directive::Define.new(:hash_hash, Raw.new('# ## #'))
doc.fragments << Directive::Define.new(:mkstr, [:a], Raw.new('# a'))
doc.fragments << Directive::Define.new(:in_between, [:a], Raw.new('mkstr(a)'))
doc.fragments << Directive::Define.new(:join, [:c, :d], Raw.new('in_between(c hash_hash d)'))
assert_equal <<PROG, translator.translate(doc)
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
PROG
end
def test_if_directive
doc = Document.new
doc.fragments << Directive::If.new(Operator::Equal.new(:VERSION, Constant::Int.new(1)))
doc.fragments << Directive::Define.new(:INCFILE, Constant::String.new("vers1.h"))
doc.fragments << Directive::ElseIf.new(Operator::Equal.new(:VERSION, Constant::Int.new(2)))
doc.fragments << Directive::Define.new(:INCFILE, Constant::String.new("vers2.h"))
doc.fragments << Directive::EndIf.new()
assert_equal <<PROG, translator.translate(doc)
#if VERSION == 1
#define INCFILE "vers1.h"
#elif VERSION == 2
#define INCFILE "vers2.h"
#endif
PROG
doc = Document.new
doc.fragments << Directive::If.new(Operator::Defined.new(:VERSION))
assert_equal <<PROG, translator.translate(doc)
#if defined VERSION
PROG
end
def test_undef
doc = Document.new
doc.fragments << Directive::Undef.new(:INCFILE)
assert_equal <<PROG, translator.translate(doc)
#undef INCFILE
PROG
end
def test_line
doc = Document.new
doc.fragments << Directive::Line.new(14)
doc.fragments << Directive::Line.new(15, "copy.c")
assert_equal <<PROG, translator.translate(doc)
#line 14
#line 15 "copy.c"
PROG
end
def test_pragma
doc = Document.new
doc.fragments << Directive::Pragma.new("GCC poison printf sprintf fprintf")
doc.fragments << Directive::StdcPragma.new(:FP_CONTRACT, :ON)
assert_equal <<PROG, translator.translate(doc)
#pragma GCC poison printf sprintf fprintf
#pragma STDC FP_CONTRACT ON
PROG
end
def test_comment
# single line comment
f = Function.new(:foo, Type::Int.new, []) do |b|
b << Return.new(Constant::Int.new(0))
end
f.fragments << Comment::Single.new("comment")
assert_equal <<PROG, translator.translate(f) + "\n"
// comment
int foo() {
return 0;
}
PROG
# multi comment with single line
f = Function.new(:foo, Type::Int.new, []) do |b|
b << Return.new(Constant::Int.new(0))
end
f.fragments << Comment::Multi.new("Line 1")
assert_equal <<PROG, translator.translate(f) + "\n"
/* Line 1 */
int foo() {
return 0;
}
PROG
# multiline
f = Function.new(:foo, Type::Int.new, []) do |b|
b << Return.new(Constant::Int.new(0))
end
f.fragments << Comment::Multi.new("Line 1\nLine 2")
assert_equal <<PROG, translator.translate(f) + "\n"
/*
* Line 1
* Line 2
*/
int foo() {
return 0;
}
PROG
end
# document
def test_document
# empty
doc = Document.new
assert_equal '', translator.translate(doc)
# stmts
doc = Document.new
doc.fragments << Directive::Include.new("stdio.h", system: true)
doc << Function.new(:f1, Type::Int.new, [:void]) do |b|
b << Return.new(Constant::Int.new(1))
end
doc << Function.new(:f2, Type::Int.new, [:void]) do |b|
b << Return.new(Constant::Int.new(2))
end
assert_equal <<PROG, translator.translate(doc) + "\n"
#include <stdio.h>
int f1(void) {
return 1;
}
int f2(void) {
return 2;
}
PROG
end
def test_document_with_declaration
doc = Document.new
doc << Declaration.new(:N, Type::Int.new, 1, storage: :static)
assert_equal <<PROG, translator.translate(doc) + "\n"
static int N = 1;
PROG
end
## Coerces Ruby objects to Node objects
def test_coerce_integer
# expression
expr = Operator::Add.new(:x, 1)
assert_equal 'x + 1', translator.translate(expr)
# bit-field
ty = Type::Struct.new(:s, [
BitField.new(3, Declaration.new(:b1, Type::Char.new(unsigned: true))),
])
assert_equal <<PROG, translator.translate(ty) + "\n"
struct s {
unsigned char b1 : 3;
}
PROG
end
def test_coerce_string
# declaration
d = Declaration.new(:greeting, Type::Pointer.new(Type::Char.new), "Hi")
assert_equal 'char *greeting = "Hi"', translator.translate(d)
end
def test_coerce_function_param
f = Type::Function.new(Type::Int.new, [
[:x, Type::Int.new],
[:y, Type::Int.new],
])
d = Declaration.new(:apfi, Type::Array.new(f, 3))
assert_equal 'int (*apfi[3])(int x, int y)', translator.translate(d)
end
def test_coerce_compound_stmt
stmt = If.new(
Operator::LessThan.new(:x, 0),
[Return.new(1)],
[Return.new(2)])
assert_equal <<PROG, translator.translate(stmt) + "\n"
if (x < 0) {
return 1;
} else {
return 2;
}
PROG
end
def test_coerce_compound_stmt_in_switch_stmt
stmt = Switch.new(:x) do |b|
b << Case.new(1, Operator::PostfixIncrement.new(:x))
b << Break.new
b << Labeled.new(:default, Break.new)
end
assert_equal <<PROG, translator.translate(stmt) + "\n"
switch (x) {
case 1:
x++;
break;
default:
break;
}
PROG
end
end
| {
"content_hash": "f6d95b79e93e63e4b1ec114fe76b0fb8",
"timestamp": "",
"source": "github",
"line_count": 820,
"max_line_length": 97,
"avg_line_length": 27.548780487804876,
"alnum_prop": 0.619743249225321,
"repo_name": "ishikawa/chelsy",
"id": "6ce93fc9abae832a0f55974b2220783d2243716d",
"size": "22590",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/translator_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "420"
},
{
"name": "Ruby",
"bytes": "81474"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
class Game{
Game(int i){
System.out.println("Game Constructor");
}
}
class BroadGame extends Game{
public BroadGame(int i) {
// TODO Auto-generated constructor stub
//Implicit super constructor Game() is undefined. Must explicitly invoke another constructor
System.out.println("BroadGame constructor");
}
}
public class Test06 extends BroadGame{
Test06(){
super(11);
System.out.println("Chess constructor");
}
public static void main(String args[]){
Test06 c=new Test06();
}
} | {
"content_hash": "c0f7f6bba3dfd1797136ebb09caac47d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 94,
"avg_line_length": 23.636363636363637,
"alnum_prop": 0.6942307692307692,
"repo_name": "WuSicheng54321/Thinking-in-Java-4th",
"id": "15c906639dcf2a1c674aa1f9d527e22533c30711",
"size": "520",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ThinkingInJava07/src/Test06.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "4498"
},
{
"name": "Java",
"bytes": "413696"
},
{
"name": "JavaScript",
"bytes": "238700"
}
],
"symlink_target": ""
} |
package api
import (
"fmt"
"koding/db/mongodb/modelhelper"
"socialapi/config"
"socialapi/workers/common/mux"
"socialapi/workers/common/tests"
"socialapi/workers/payment"
"testing"
"github.com/koding/runner"
"github.com/stripe/stripe-go"
)
// TODO(cihangir): make generalized "withTestServer"
func withTestServer(t *testing.T, f func(url string)) {
const workerName = "paymentwebhook"
r := runner.New(workerName)
if err := r.Init(); err != nil {
t.Fatal(err)
}
if r.Conf.Debug {
stripe.LogLevel = 3
}
c := config.MustRead(r.Conf.Path)
// init mongo connection
modelhelper.Initialize(c.Mongo)
defer modelhelper.Close()
payment.Initialize(c)
port := tests.GetFreePort()
mc := mux.NewConfig(workerName, "localhost", port)
mc.Debug = r.Conf.Debug
m := mux.New(mc, r.Log, r.Metrics)
AddHandlers(m)
m.Listen()
go r.Listen()
f(fmt.Sprintf("http://localhost:%s", port))
if err := r.Close(); err != nil {
t.Fatalf("server close errored: %s", err.Error())
}
// shutdown server
m.Close()
}
| {
"content_hash": "c2b9020597355b301c766bec07515670",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 55,
"avg_line_length": 18.727272727272727,
"alnum_prop": 0.6805825242718446,
"repo_name": "andrewjcasal/koding",
"id": "f0d572bf7ffbe2ccae18916ae9487be810110117",
"size": "1030",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "go/src/socialapi/workers/payment/api/server_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "593895"
},
{
"name": "CoffeeScript",
"bytes": "3988625"
},
{
"name": "Go",
"bytes": "6760994"
},
{
"name": "HTML",
"bytes": "107319"
},
{
"name": "JavaScript",
"bytes": "2204965"
},
{
"name": "Makefile",
"bytes": "5994"
},
{
"name": "PHP",
"bytes": "1570"
},
{
"name": "PLSQL",
"bytes": "370"
},
{
"name": "PLpgSQL",
"bytes": "16704"
},
{
"name": "Perl",
"bytes": "1612"
},
{
"name": "Python",
"bytes": "27895"
},
{
"name": "Ruby",
"bytes": "1763"
},
{
"name": "SQLPL",
"bytes": "6868"
},
{
"name": "Shell",
"bytes": "112388"
}
],
"symlink_target": ""
} |
"""
SQLAlchemy models for heat data.
"""
import uuid
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
import six
import sqlalchemy
from sqlalchemy.ext import declarative
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship
from sqlalchemy.orm import session as orm_session
from heat.db.sqlalchemy import types
BASE = declarative.declarative_base()
def get_session():
from heat.db.sqlalchemy import api as db_api
return db_api.get_session()
class HeatBase(models.ModelBase, models.TimestampMixin):
"""Base class for Heat Models."""
__table_args__ = {'mysql_engine': 'InnoDB'}
def expire(self, session=None, attrs=None):
"""Expire this object ()."""
if not session:
session = orm_session.Session.object_session(self)
if not session:
session = get_session()
session.expire(self, attrs)
def refresh(self, session=None, attrs=None):
"""Refresh this object."""
if not session:
session = orm_session.Session.object_session(self)
if not session:
session = get_session()
session.refresh(self, attrs)
def delete(self, session=None):
"""Delete this object."""
if not session:
session = orm_session.Session.object_session(self)
if not session:
session = get_session()
session.begin()
session.delete(self)
session.commit()
def update_and_save(self, values, session=None):
if not session:
session = orm_session.Session.object_session(self)
if not session:
session = get_session()
session.begin()
for k, v in six.iteritems(values):
setattr(self, k, v)
session.commit()
class SoftDelete(object):
deleted_at = sqlalchemy.Column(sqlalchemy.DateTime)
def soft_delete(self, session=None):
"""Mark this object as deleted."""
self.update_and_save({'deleted_at': timeutils.utcnow()},
session=session)
class StateAware(object):
action = sqlalchemy.Column('action', sqlalchemy.String(255))
status = sqlalchemy.Column('status', sqlalchemy.String(255))
status_reason = sqlalchemy.Column('status_reason', sqlalchemy.Text)
class RawTemplate(BASE, HeatBase):
"""Represents an unparsed template which should be in JSON format."""
__tablename__ = 'raw_template'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
template = sqlalchemy.Column(types.Json)
files = sqlalchemy.Column(types.Json)
environment = sqlalchemy.Column('environment', types.Json)
class StackTag(BASE, HeatBase):
"""Key/value store of arbitrary stack tags."""
__tablename__ = 'stack_tag'
id = sqlalchemy.Column('id',
sqlalchemy.Integer,
primary_key=True,
nullable=False)
tag = sqlalchemy.Column('tag', sqlalchemy.Unicode(80))
stack_id = sqlalchemy.Column('stack_id',
sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False)
class SyncPoint(BASE, HeatBase):
"""Represents an syncpoint for an stack that is being worked on."""
__tablename__ = 'sync_point'
__table_args__ = (
sqlalchemy.PrimaryKeyConstraint('entity_id',
'traversal_id',
'is_update'),
sqlalchemy.ForeignKeyConstraint(['stack_id'], ['stack.id'])
)
entity_id = sqlalchemy.Column(sqlalchemy.String(36))
traversal_id = sqlalchemy.Column(sqlalchemy.String(36))
is_update = sqlalchemy.Column(sqlalchemy.Boolean)
# integer field for atomic update operations
atomic_key = sqlalchemy.Column(sqlalchemy.Integer, nullable=False)
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
nullable=False)
input_data = sqlalchemy.Column(types.Json)
class Stack(BASE, HeatBase, SoftDelete, StateAware):
"""Represents a stack created by the heat engine."""
__tablename__ = 'stack'
__table_args__ = (
sqlalchemy.Index('ix_stack_name', 'name', mysql_length=255),
sqlalchemy.Index('ix_stack_tenant', 'tenant', mysql_length=255),
)
id = sqlalchemy.Column(sqlalchemy.String(36), primary_key=True,
default=lambda: str(uuid.uuid4()))
name = sqlalchemy.Column(sqlalchemy.String(255))
raw_template_id = sqlalchemy.Column(
sqlalchemy.Integer,
sqlalchemy.ForeignKey('raw_template.id'),
nullable=False)
raw_template = relationship(RawTemplate, backref=backref('stack'),
foreign_keys=[raw_template_id])
prev_raw_template_id = sqlalchemy.Column(
'prev_raw_template_id',
sqlalchemy.Integer,
sqlalchemy.ForeignKey('raw_template.id'))
prev_raw_template = relationship(RawTemplate,
foreign_keys=[prev_raw_template_id])
username = sqlalchemy.Column(sqlalchemy.String(256))
tenant = sqlalchemy.Column(sqlalchemy.String(256))
user_creds_id = sqlalchemy.Column(
sqlalchemy.Integer,
sqlalchemy.ForeignKey('user_creds.id'))
owner_id = sqlalchemy.Column(sqlalchemy.String(36))
parent_resource_name = sqlalchemy.Column(sqlalchemy.String(255))
timeout = sqlalchemy.Column(sqlalchemy.Integer)
disable_rollback = sqlalchemy.Column(sqlalchemy.Boolean, nullable=False)
stack_user_project_id = sqlalchemy.Column(sqlalchemy.String(64))
backup = sqlalchemy.Column('backup', sqlalchemy.Boolean)
nested_depth = sqlalchemy.Column('nested_depth', sqlalchemy.Integer)
convergence = sqlalchemy.Column('convergence', sqlalchemy.Boolean)
tags = relationship(StackTag, cascade="all,delete",
backref=backref('stack'))
current_traversal = sqlalchemy.Column('current_traversal',
sqlalchemy.String(36))
current_deps = sqlalchemy.Column('current_deps', types.Json)
# Override timestamp column to store the correct value: it should be the
# time the create/update call was issued, not the time the DB entry is
# created/modified. (bug #1193269)
updated_at = sqlalchemy.Column(sqlalchemy.DateTime)
class StackLock(BASE, HeatBase):
"""Store stack locks for deployments with multiple-engines."""
__tablename__ = 'stack_lock'
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
primary_key=True)
engine_id = sqlalchemy.Column(sqlalchemy.String(36))
class UserCreds(BASE, HeatBase):
"""
Represents user credentials and mirrors the 'context'
handed in by wsgi.
"""
__tablename__ = 'user_creds'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
username = sqlalchemy.Column(sqlalchemy.String(255))
password = sqlalchemy.Column(sqlalchemy.String(255))
region_name = sqlalchemy.Column(sqlalchemy.String(255))
decrypt_method = sqlalchemy.Column(sqlalchemy.String(64))
tenant = sqlalchemy.Column(sqlalchemy.String(1024))
auth_url = sqlalchemy.Column(sqlalchemy.Text)
tenant_id = sqlalchemy.Column(sqlalchemy.String(256))
trust_id = sqlalchemy.Column(sqlalchemy.String(255))
trustor_user_id = sqlalchemy.Column(sqlalchemy.String(64))
stack = relationship(Stack, backref=backref('user_creds'))
class Event(BASE, HeatBase):
"""Represents an event generated by the heat engine."""
__tablename__ = 'event'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False)
stack = relationship(Stack, backref=backref('events'))
uuid = sqlalchemy.Column(sqlalchemy.String(36),
default=lambda: str(uuid.uuid4()),
unique=True)
resource_action = sqlalchemy.Column(sqlalchemy.String(255))
resource_status = sqlalchemy.Column(sqlalchemy.String(255))
resource_name = sqlalchemy.Column(sqlalchemy.String(255))
physical_resource_id = sqlalchemy.Column(sqlalchemy.String(255))
_resource_status_reason = sqlalchemy.Column(
'resource_status_reason', sqlalchemy.String(255))
resource_type = sqlalchemy.Column(sqlalchemy.String(255))
resource_properties = sqlalchemy.Column(sqlalchemy.PickleType)
@property
def resource_status_reason(self):
return self._resource_status_reason
@resource_status_reason.setter
def resource_status_reason(self, reason):
self._resource_status_reason = reason and reason[:255] or ''
class ResourceData(BASE, HeatBase):
"""Key/value store of arbitrary, resource-specific data."""
__tablename__ = 'resource_data'
id = sqlalchemy.Column('id',
sqlalchemy.Integer,
primary_key=True,
nullable=False)
key = sqlalchemy.Column('key', sqlalchemy.String(255))
value = sqlalchemy.Column('value', sqlalchemy.Text)
redact = sqlalchemy.Column('redact', sqlalchemy.Boolean)
decrypt_method = sqlalchemy.Column(sqlalchemy.String(64))
resource_id = sqlalchemy.Column('resource_id',
sqlalchemy.Integer,
sqlalchemy.ForeignKey('resource.id'),
nullable=False)
class Resource(BASE, HeatBase, StateAware):
"""Represents a resource created by the heat engine."""
__tablename__ = 'resource'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
uuid = sqlalchemy.Column(sqlalchemy.String(36),
default=lambda: str(uuid.uuid4()),
unique=True)
name = sqlalchemy.Column('name', sqlalchemy.String(255))
nova_instance = sqlalchemy.Column('nova_instance', sqlalchemy.String(255))
# odd name as "metadata" is reserved
rsrc_metadata = sqlalchemy.Column('rsrc_metadata', types.Json)
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False)
stack = relationship(Stack, backref=backref('resources'))
data = relationship(ResourceData,
cascade="all,delete",
backref=backref('resource'))
# Override timestamp column to store the correct value: it should be the
# time the create/update call was issued, not the time the DB entry is
# created/modified. (bug #1193269)
updated_at = sqlalchemy.Column(sqlalchemy.DateTime)
properties_data = sqlalchemy.Column('properties_data', types.Json)
properties_data_encrypted = sqlalchemy.Column('properties_data_encrypted',
sqlalchemy.Boolean)
engine_id = sqlalchemy.Column(sqlalchemy.String(36))
atomic_key = sqlalchemy.Column(sqlalchemy.Integer)
needed_by = sqlalchemy.Column('needed_by', types.List)
requires = sqlalchemy.Column('requires', types.List)
replaces = sqlalchemy.Column('replaces', sqlalchemy.Integer,
default=None)
replaced_by = sqlalchemy.Column('replaced_by', sqlalchemy.Integer,
default=None)
current_template_id = sqlalchemy.Column(
'current_template_id',
sqlalchemy.Integer,
sqlalchemy.ForeignKey('raw_template.id'))
class WatchRule(BASE, HeatBase):
"""Represents a watch_rule created by the heat engine."""
__tablename__ = 'watch_rule'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
name = sqlalchemy.Column('name', sqlalchemy.String(255))
rule = sqlalchemy.Column('rule', types.Json)
state = sqlalchemy.Column('state', sqlalchemy.String(255))
last_evaluated = sqlalchemy.Column(sqlalchemy.DateTime,
default=timeutils.utcnow)
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False)
stack = relationship(Stack, backref=backref('watch_rule'))
class WatchData(BASE, HeatBase):
"""Represents a watch_data created by the heat engine."""
__tablename__ = 'watch_data'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
data = sqlalchemy.Column('data', types.Json)
watch_rule_id = sqlalchemy.Column(
sqlalchemy.Integer,
sqlalchemy.ForeignKey('watch_rule.id'),
nullable=False)
watch_rule = relationship(WatchRule, backref=backref('watch_data'))
class SoftwareConfig(BASE, HeatBase):
"""
Represents a software configuration resource to be applied to
one or more servers.
"""
__tablename__ = 'software_config'
id = sqlalchemy.Column('id', sqlalchemy.String(36), primary_key=True,
default=lambda: str(uuid.uuid4()))
name = sqlalchemy.Column('name', sqlalchemy.String(255))
group = sqlalchemy.Column('group', sqlalchemy.String(255))
config = sqlalchemy.Column('config', types.Json)
tenant = sqlalchemy.Column(
'tenant', sqlalchemy.String(64), nullable=False, index=True)
class SoftwareDeployment(BASE, HeatBase, StateAware):
"""
Represents applying a software configuration resource to a
single server resource.
"""
__tablename__ = 'software_deployment'
__table_args__ = (
sqlalchemy.Index('ix_software_deployment_created_at', 'created_at'),)
id = sqlalchemy.Column('id', sqlalchemy.String(36), primary_key=True,
default=lambda: str(uuid.uuid4()))
config_id = sqlalchemy.Column(
'config_id',
sqlalchemy.String(36),
sqlalchemy.ForeignKey('software_config.id'),
nullable=False)
config = relationship(SoftwareConfig, backref=backref('deployments'))
server_id = sqlalchemy.Column('server_id', sqlalchemy.String(36),
nullable=False, index=True)
input_values = sqlalchemy.Column('input_values', types.Json)
output_values = sqlalchemy.Column('output_values', types.Json)
tenant = sqlalchemy.Column(
'tenant', sqlalchemy.String(64), nullable=False, index=True)
stack_user_project_id = sqlalchemy.Column(sqlalchemy.String(64))
updated_at = sqlalchemy.Column(sqlalchemy.DateTime)
class Snapshot(BASE, HeatBase):
__tablename__ = 'snapshot'
id = sqlalchemy.Column('id', sqlalchemy.String(36), primary_key=True,
default=lambda: str(uuid.uuid4()))
stack_id = sqlalchemy.Column(sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False)
name = sqlalchemy.Column('name', sqlalchemy.String(255))
data = sqlalchemy.Column('data', types.Json)
tenant = sqlalchemy.Column(
'tenant', sqlalchemy.String(64), nullable=False, index=True)
status = sqlalchemy.Column('status', sqlalchemy.String(255))
status_reason = sqlalchemy.Column('status_reason', sqlalchemy.String(255))
stack = relationship(Stack, backref=backref('snapshot'))
class Service(BASE, HeatBase, SoftDelete):
__tablename__ = 'service'
id = sqlalchemy.Column('id',
sqlalchemy.String(36),
primary_key=True,
default=lambda: str(uuid.uuid4()))
engine_id = sqlalchemy.Column('engine_id',
sqlalchemy.String(36),
nullable=False)
host = sqlalchemy.Column('host',
sqlalchemy.String(255),
nullable=False)
hostname = sqlalchemy.Column('hostname',
sqlalchemy.String(255),
nullable=False)
binary = sqlalchemy.Column('binary',
sqlalchemy.String(255),
nullable=False)
topic = sqlalchemy.Column('topic',
sqlalchemy.String(255),
nullable=False)
report_interval = sqlalchemy.Column('report_interval',
sqlalchemy.Integer,
nullable=False)
| {
"content_hash": "0c5b201f11ee6ef8e5035d948a6edae9",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 78,
"avg_line_length": 39.385882352941174,
"alnum_prop": 0.6200489873947069,
"repo_name": "takeshineshiro/heat",
"id": "287bf4b2b2e4c428c9b00b4cab60e6c53d535f87",
"size": "17313",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "heat/db/sqlalchemy/models.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "6735948"
},
{
"name": "Shell",
"bytes": "33316"
}
],
"symlink_target": ""
} |
import React from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { Router, browserHistory } from 'react-router';
import promise from 'redux-promise';
import reducers from 'reducers';
import routes from 'routes';
import 'scss/app.scss';
const createStoreWithMiddleware = applyMiddleware(promise)(createStore);
ReactDom.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<Router history={browserHistory} routes={routes} />
</Provider>
, document.querySelector('.root')
);
| {
"content_hash": "8d238c604d8ab40c71e8355619988130",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 33.388888888888886,
"alnum_prop": 0.740432612312812,
"repo_name": "iredjee/react-redux-starter",
"id": "14c16e283a0031a97ca226e76afc09a85c822b8f",
"size": "601",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/web/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "329"
},
{
"name": "JavaScript",
"bytes": "3180"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- image Format InMemory Loader -->
<service id="synapse.image_format.in_memory_loader" parent="majora.loader.abstract" public="false" lazy="true"
class="Synapse\Cmf\Framework\Media\Format\Loader\InMemory\InMemoryLoader"
>
<argument>Synapse\Cmf\Framework\Media\Format\Entity\FormatCollection</argument>
<argument type="service" id="majora.normalizer" />
</service>
<service id="synapse.image_format.loader" alias="synapse.image_format.in_memory_loader" />
</services>
</container>
| {
"content_hash": "7e12a0d111c35964f1cb7f202a56d7ae",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 120,
"avg_line_length": 42.15,
"alnum_prop": 0.6773428232502966,
"repo_name": "Synapse-Cmf/synapse-cmf",
"id": "8e85e98a397536ed119046dc5df641359ca70c8f",
"size": "843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Synapse/Cmf/Bundle/Resources/config/services/image_format.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3605"
},
{
"name": "CSS",
"bytes": "4518"
},
{
"name": "HTML",
"bytes": "34283"
},
{
"name": "JavaScript",
"bytes": "12664"
},
{
"name": "Makefile",
"bytes": "4478"
},
{
"name": "PHP",
"bytes": "644363"
}
],
"symlink_target": ""
} |
module Modis
module Finder
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def find(*ids)
models = find_all(ids)
ids.count == 1 ? models.first : models
end
def all
records = Modis.with_connection do |redis|
ids = redis.smembers(key_for(:all))
redis.pipelined do
ids.map { |id| record_for(redis, id) }
end
end
records_to_models(records)
end
def attributes_for(redis, id)
raise RecordNotFound, "Couldn't find #{name} without an ID" if id.nil?
attributes = deserialize(record_for(redis, id))
unless attributes['id'].present?
raise RecordNotFound, "Couldn't find #{name} with id=#{id}"
end
attributes
end
def find_all(ids)
raise RecordNotFound, "Couldn't find #{name} without an ID" if ids.empty?
records = Modis.with_connection do |redis|
blk = proc { |id| record_for(redis, id) }
ids.count == 1 ? ids.map(&blk) : redis.pipelined { ids.map(&blk) }
end
models = records_to_models(records)
#if models.count < ids.count
# missing = ids - models.map(&:id)
# raise RecordNotFound, "Couldn't find #{name} with id=#{missing.first}"
#end
models
end
private
def records_to_models(records)
records.map do |record|
model_for(deserialize(record)) unless record.blank?
end.compact
end
def model_for(attributes)
model_class(attributes).new(attributes, new_record: false)
end
def record_for(redis, id)
redis.hgetall(key_for(id))
end
def model_class(record)
return self if record["type"].blank?
record["type"].constantize
end
end
end
end
| {
"content_hash": "ab34f93b3ae6ab416d370c5d75699455",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 81,
"avg_line_length": 24.644736842105264,
"alnum_prop": 0.5718099305926322,
"repo_name": "gdeglin/modis",
"id": "16221329188b62b435d7765e12d800a8b2ae713c",
"size": "1873",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/modis/finder.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "50657"
}
],
"symlink_target": ""
} |
<?php
require_once(get_template_directory() . '/libraries/setup.php');
require_once(get_template_directory() . '/libraries/customizer.php');
require_once(get_template_directory() . '/libraries/tags.php');
require_once(get_template_directory() . '/libraries/filters.php');
require_once(get_template_directory() . '/libraries/util.php');
?>
| {
"content_hash": "3d688dff980a780b95a778842f3f1f39",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 69,
"avg_line_length": 34.2,
"alnum_prop": 0.7251461988304093,
"repo_name": "giacomomarciani/mr-lite",
"id": "70862f2eed1dfd0164eeaad32aadb4642124dd11",
"size": "342",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "functions.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "362111"
},
{
"name": "JavaScript",
"bytes": "7979"
},
{
"name": "PHP",
"bytes": "159881"
},
{
"name": "Ruby",
"bytes": "389"
}
],
"symlink_target": ""
} |
package org.peekmoon.database.walker;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.stream.Collectors;
import org.peekmoon.database.walker.schema.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DatabaseTaskDelete extends DeleteOrderDatabaseTask {
private final static Logger log = LoggerFactory.getLogger(DatabaseTaskDelete.class);
public void process(Connection conn, Row row) throws SQLException {
String sql = getSqlDelete(row.getTable());
// TODO : mutualize preparedStatement
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
log.debug(sql);
int i=1;
for (Object value : row.getPrimaryKeyValue().list()) {
stmt.setObject(i++, value);
}
int result = stmt.executeUpdate();
if (result != 1) {
conn.rollback();
throw new IllegalStateException(sql + " had deleted " + result + " row(s)");
}
}
}
public String getSqlDelete(Table table) {
String whereClause;
if (table.getPrimaryKey() != null) {
whereClause = table.getPrimaryKey().getSqlWhere();
} else {
whereClause = table.getColumnNames().stream().map(columnName->columnName+"=?").collect(Collectors.joining(" AND ", " WHERE ", ""));
}
return "DELETE FROM " + table.getName() + whereClause;
}
}
| {
"content_hash": "4bd4b1aa4ecf70c8a1ee4094ba530738",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 134,
"avg_line_length": 29.361702127659573,
"alnum_prop": 0.6855072463768116,
"repo_name": "arsou33/database-walker",
"id": "c10c7b2e88f7c1105f540f417b73b83b58bf0ee6",
"size": "1380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/peekmoon/database/walker/DatabaseTaskDelete.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "33118"
}
],
"symlink_target": ""
} |
'''
Copyright 2013 Zynga Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in 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.
'''
#
# python configChangeCaller.py -g <game> -e <env> -s <env>
# This script will update the apache config for the new game and environment
# It will also restart apache after the change
#
import pexpect, getopt, sys, commands, os
SSH_NEWKEY = '(?i)are you sure you want to continue connecting'
COMMAND_PROMPT = '[#$] '
TERMINAL_PROMPT = '(?i)terminal type\?'
TERMINAL_TYPE = 'vt100'
USER = 'zops'
PASSWORD = 'h1ghr1se'
# Get the current dirname instead of hard coding it
CURR_DIR = os.path.dirname(os.path.abspath(__file__));
print CURR_DIR
sys.exit();
DUMMYCHANGECONFIGFILE = CURR_DIR + '/dummyConfigChange_php.txt'
CHANGECONFIGFILE = '/var/zruntime/vhost-config/configChange.php'
try:
optlist, args = getopt.getopt(sys.argv[1:], 's:g:e:')
except Exception, e:
print str(e)
exit_with_usage()
options = dict(optlist)
server = options['-s']
game = options['-g']
env = options['-e']
if ( server == 'prod' ):
server = 'zruntime-tool-01'
elif ( server == 'stage' ):
server = 'zruntime-staging-tool-01'
elif ( server == 'dev' or server == 'auto' ):
server = 'zruntime-hudson'
elif ( server == 'seg-dev' ):
server = 'zruntime-tool-seg-01'
else :
print "Unknown Server. Exiting..."
sys.exit()
DUMMYCONFFILE = CURR_DIR + '/dummyConfig' + '-' + env + '.txt'
CONFFILE = '/var/zruntime/vhost-config/dummyConfig.txt'
child = pexpect.spawn('ssh -l ' + USER + ' ' + server )
i = child.expect([pexpect.TIMEOUT, SSH_NEWKEY, COMMAND_PROMPT, '(?i)password'])
if i == 0: # Timeout
print 'ERROR! could not login with SSH. Here is what SSH said:'
print child.before, child.after
print str(child)
sys.exit ()
if i == 1: # In this case SSH does not have the public key cached.
child.sendline ('yes')
child.expect ('(?i)password')
if i == 2:
# This may happen if a public key was setup to automatically login.
# But beware, the COMMAND_PROMPT at this point is very trivial and
# could be fooled by some output in the MOTD or login message.
pass
if i == 3:
child.sendline(PASSWORD)
# Now we are either at the command prompt or
# the login process is asking for our terminal type.
i = child.expect ([COMMAND_PROMPT, TERMINAL_PROMPT])
if i == 1:
child.sendline (TERMINAL_TYPE)
child.expect (COMMAND_PROMPT)
dummyConfig = open(DUMMYCONFFILE, 'r') .read()
child.sendline('sudo echo "' + dummyConfig + '" > ' + CONFFILE)
i = child.expect ([COMMAND_PROMPT, 'error', 'Error'])
if(i!=0):
print child.before, child.after
print '0'
sys.exit()
dummyConfig = open(DUMMYCHANGECONFIGFILE, 'r') .read()
child.sendline('sudo echo """' + dummyConfig + '""" > ' + CHANGECONFIGFILE)
i = child.expect ([COMMAND_PROMPT, 'error'])
if(i!=0):
print child.before, child.after
print '0'
sys.exit()
child.sendline ('sudo php ' + CHANGECONFIGFILE + ' -g ' + game + ' -e ' + env )
i = child.expect ([COMMAND_PROMPT, 'error', 'Error'])
if(i!=0):
print child.before, child.after
print '0'
sys.exit()
print('1')
child.sendline ('exit')
index = child.expect([pexpect.EOF, "(?i)there are stopped jobs"])
if index==1:
child.sendline("exit")
child.expect(EOF)
| {
"content_hash": "59c31970f159a8c5c46f59060db410f7",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 31.43548387096774,
"alnum_prop": 0.6444330425859415,
"repo_name": "zbase/zruntime",
"id": "4d727a1b41f1e0136e0c3a5e44ebcd32bb078381",
"size": "3899",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/scripts/configChangeCaller.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "73475"
},
{
"name": "JavaScript",
"bytes": "273344"
},
{
"name": "PHP",
"bytes": "1225734"
},
{
"name": "Python",
"bytes": "22326"
},
{
"name": "Shell",
"bytes": "6172"
}
],
"symlink_target": ""
} |
layout: master
title: "O Jardim"
categories: winter
author: António Ramos Rosa
contributor: Filipa
imgs: 2
year: 1986
---
Consideremos o jardim, mundo de pequenas coisas,
calhaus, pétalas, folhas, dedos, línguas, sementes.
Sequências de convergências e divergências,
ordem e dispersões, transparência de estruturas,
pausas de areia e de água, fábulas minúsculas.
Geometria que respira errante e ritmada,
varandas verdes, direcções de primavera,
ramos em que se regressa ao espaço azul,
curvas vagarosas, pulsações de uma ordem
composta pelo vento em sinuosas palmas.
Um murmúrio de omissões, um cântico do ócio.
Eu vou contigo, voz silenciosa, voz serena.
Sou uma pequena folha na felicidade do ar.
Durmo desperto, sigo estes meandros volúveis.
É aqui, é aqui que se renova a luz.
| {
"content_hash": "8ab6ee916a2bfa5bd383713982b62717",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 54,
"avg_line_length": 31,
"alnum_prop": 0.7419354838709677,
"repo_name": "mentes-desertas/mentes-desertas.github.io",
"id": "b7b93d7608886fabe0f5d835a8f112815b6d7f9a",
"size": "879",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/winter/2011-05-6-1.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "200236"
},
{
"name": "HTML",
"bytes": "115377"
},
{
"name": "JavaScript",
"bytes": "24355"
},
{
"name": "Ruby",
"bytes": "2137"
}
],
"symlink_target": ""
} |
using System;
namespace Elmah.Io.QuickFixes.Fixes
{
public class ImATeapotDocumentationQuickFix : QuickFixBase
{
public ImATeapotDocumentationQuickFix()
{
Icon = "fa-coffee";
Url = new Uri("https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol");
Text = "One does not simply brew a cup of tea";
}
public override bool CanFix(Message message)
{
return message.StatusCode.HasValue && message.StatusCode.Value == 418;
}
}
} | {
"content_hash": "424f9faaf5018977b796a43aef72a78e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 98,
"avg_line_length": 28.736842105263158,
"alnum_prop": 0.6135531135531136,
"repo_name": "elmahio/Elmah.Io.QuickFixes",
"id": "7110f592fa4e2a1a162b92ebd84893cf5d7d15cc",
"size": "548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Elmah.Io.QuickFixes/Fixes/ImATeapotDocumentationQuickFix.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "58833"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StudentSystem.WebApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StudentSystem.WebApi")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d24ca8c0-9271-4a22-9083-d18bd4614b1b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "61057b9bee21fb4184dfde6be014387e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 84,
"avg_line_length": 39.08571428571429,
"alnum_prop": 0.7529239766081871,
"repo_name": "g-yonchev/TelerikAcademy",
"id": "247018626d817df2c16184380f109d9374efad3e",
"size": "1371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Homeworks/Web-Services-and-Clouds/02. ASP.NET-Web-API/StudentSystem/Server/StudentSystem.WebApi/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "227"
},
{
"name": "Batchfile",
"bytes": "326"
},
{
"name": "C#",
"bytes": "1857534"
},
{
"name": "CSS",
"bytes": "246579"
},
{
"name": "CoffeeScript",
"bytes": "2149"
},
{
"name": "HTML",
"bytes": "371407"
},
{
"name": "JavaScript",
"bytes": "225124"
},
{
"name": "Smalltalk",
"bytes": "1729"
},
{
"name": "XSLT",
"bytes": "1997"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "9a2c2c656d95fa596f42ea45ba37c716",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "0b56dee9dd13c00f8e04a58554c3916975d1d2c8",
"size": "206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Lens/Lens ervoides/ Syn. Lens nigricans ervoides/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// The Open Trading Project - open-trading.org
//
// Copyright (c) 2011 Martin Tapia - martin.tapia@open-trading.org
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Report.hpp"
#include "Logger.hpp"
#include "tools/ToString.hpp"
#include "Conf.hpp"
#define CLASS "[Backtester/Report] "
namespace Backtester
{
Report::Report(Logger const& logger) :
_logger(logger), _params(logger), _failed(false), _score(0)
{
}
void Report::SetScore(float score)
{
this->_score = score;
}
float Report::GetScore() const
{
return this->_score;
}
void Report::CopyParamsFrom(StratParamsMap const& params)
{
this->_params.GetDataFrom(params);
}
void Report::CopyDataFrom(Report const& report)
{
this->_params.GetDataFrom(report.GetParams());
this->_failed = report.HasFailed();
this->_trades = report.GetTrades();
}
StratParamsMap const& Report::GetParams() const
{
return this->_params;
}
void Report::DumpParams(bool oneLine /* = false */) const
{
this->_params.Dump(oneLine);
}
void Report::SetFailed()
{
this->_failed = true;
}
bool Report::HasFailed() const
{
return this->_failed;
}
void Report::AddTrade(Trade const& trade)
{
this->_trades.push_back(trade);
}
std::list<Report::Trade> const& Report::GetTrades() const
{
return this->_trades;
}
void Report::ShowTradeDetails(Conf const& conf)
{
if (!this->_trades.size())
{
this->_logger.Log(CLASS "No trades to show.", ::Logger::Warning);
return;
}
this->_logger.Log(CLASS "=== Begin trade report ===");
unsigned int i = 0;
std::list<Trade>::const_iterator it = this->_trades.begin();
std::list<Trade>::const_iterator itEnd = this->_trades.end();
for (; it != itEnd; ++it)
{
++i;
this->_logger.Log(CLASS " - Trade " + Tools::ToString(i) + " "
+ (it->type == Core::Controller::StatusBuy ? " (buy)" : "(sell)") + ": "
+ "open " + Tools::ToString(it->open, conf.digits) + ", "
+ "close " + Tools::ToString(it->close, conf.digits) + ", "
+ "lots " + Tools::ToString(it->lots, 2) + ", "
+ "SL (at finish) " + Tools::ToString(it->sl, conf.digits) + ", "
+ "TP (at finish) " + Tools::ToString(it->tp, conf.digits) + ", "
+ "profit " + conf.baseCurrency + " " + Tools::ToString(it->baseCurrencyProfit, 2) + ", "
+ "profit " + conf.counterCurrency + " " + Tools::ToString(it->counterCurrencyProfit, 2) + ".");
}
this->_logger.Log(CLASS "=== End trade report ===");
}
}
| {
"content_hash": "283f5031217d62a48a10fc0aaeb35f33",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 116,
"avg_line_length": 34.01639344262295,
"alnum_prop": 0.6079518072289156,
"repo_name": "paps/Open-Trading",
"id": "2c02a21521c7b1c46f503f029ec00e12a57b3473",
"size": "4150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/backtester/Report.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C++",
"bytes": "402152"
},
{
"name": "CMake",
"bytes": "17081"
},
{
"name": "Lua",
"bytes": "3746"
},
{
"name": "MQL5",
"bytes": "17488"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Set this to TRUE if you want to use different cache files depending on the
| URL query string. Please be aware this might result in numerous cache files.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| http://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependant.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'dbx_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurences with the PHP_EOL value.
|
| This is particularly useful for portability between UNIX-based OSes,
| (usually \n) and Windows (\r\n).
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
| {
"content_hash": "d803212ce9277838eabcf25adfc85cce",
"timestamp": "",
"source": "github",
"line_count": 500,
"max_line_length": 83,
"avg_line_length": 34.954,
"alnum_prop": 0.54053899410654,
"repo_name": "BensonDu/New-Homepage",
"id": "f2bd27c0eed856cc19a6ac2de2451a1cc80dc374",
"size": "17477",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/admin/config/config.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "PHP",
"bytes": "1811343"
}
],
"symlink_target": ""
} |
<?php
namespace Sheadawson\Linkable\Models;
use Embed\Adapters\Adapter;
use Embed\Embed;
use SilverStripe\ORM\DataObject;
/**
* Class EmbeddedObject
* @license BSD License http://www.silverstripe.org/bsd-license
* @author <marcus@silverstripe.com.au>
* @property string Title
* @property string Type
* @property string SourceURL
* @property string Width
* @property string Height
* @property string Description
* @property string ThumbURL
* @property string ExtraClass
* @property string EmbedHTML
* @package Sheadawson\Linkable\Models
*/
class EmbeddedObject extends DataObject
{
/**
* @var array
*/
private static $db = [
'Title' => 'Varchar(255)',
'Type' => 'Varchar',
'SourceURL' => 'Varchar(255)',
'Width' => 'Varchar',
'Height' => 'Varchar',
'Description' => 'HTMLText',
'ThumbURL' => 'Varchar(255)',
'ExtraClass' => 'Varchar(64)',
'EmbedHTML' => 'Text',
];
/**
* @var string
*/
private static $table_name = 'LinkableEmbed';
/**
* @return $this
*/
public function Embed()
{
$this->setFromURL($this->SourceURL);
return $this;
}
public function onBeforeWrite()
{
$changes = $this->getChangedFields();
if (isset($changes['SourceURL']) && $changes['SourceURL']['after']) {
$this->updateEmbedHTML();
}
parent::onBeforeWrite();
}
public function updateEmbedHTML()
{
$this->setFromURL($this->SourceURL);
}
/**
* @param $url
*/
public function setFromURL($url)
{
if ($url) {
// array('image' => array('minImageWidth' => $this->Width, 'minImageHeight' => $this->Height)));
$info = Embed::create($url);
$this->setFromEmbed($info);
}
}
/**
* @param Adapter $info
*/
public function setFromEmbed(Adapter $info)
{
$this->Title = $info->getTitle();
$this->SourceURL = $info->getUrl();
$this->Width = $info->getWidth();
$this->Height = $info->getHeight();
$this->ThumbURL = $info->getImage();
$this->Description = $info->getDescription() ? $info->getDescription() : $info->getTitle();
$this->Type = $info->getType();
$embed = $info->getCode();
$this->EmbedHTML = $embed ? $embed : $this->EmbedHTML;
}
/**
* @return string
*/
public function forTemplate()
{
switch ($this->Type) {
case 'video':
case 'rich':
if ($this->ExtraClass) {
return "<div class='$this->ExtraClass'>$this->EmbedHTML</div>";
} else {
return $this->EmbedHTML;
}
break;
case 'link':
return '<a class="' . $this->ExtraClass . '" href="' . $this->SourceURL . '">' . $this->Title . '</a>';
break;
case 'photo':
return "<img src='$this->SourceURL' width='$this->Width' height='$this->Height' class='$this->ExtraClass' />";
break;
}
return '';
}
}
| {
"content_hash": "8991eba817e72af93aa55dcd46f44e19",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 126,
"avg_line_length": 25.830645161290324,
"alnum_prop": 0.522947236965345,
"repo_name": "sheadawson/silverstripe-linkable",
"id": "73c6cbf3b2789ea96dcdcd7cf6864e99360967aa",
"size": "3203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Models/EmbeddedObject.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "5424"
},
{
"name": "PHP",
"bytes": "33035"
},
{
"name": "SCSS",
"bytes": "641"
},
{
"name": "Scheme",
"bytes": "1572"
}
],
"symlink_target": ""
} |
require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
require 'listable_collections'
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
end
end
| {
"content_hash": "99886007da649042cfd651b201583fa4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 82,
"avg_line_length": 29.941176470588236,
"alnum_prop": 0.768172888015717,
"repo_name": "mmontossi/listable_collections",
"id": "f095162976c1e55c0ec2a0062dbb7fb795248261",
"size": "509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/dummy/config/application.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "736"
},
{
"name": "HTML",
"bytes": "5652"
},
{
"name": "JavaScript",
"bytes": "1136"
},
{
"name": "Ruby",
"bytes": "28352"
}
],
"symlink_target": ""
} |
namespace Tests
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class Match
{
[TestMethod]
public void Some()
{
var maybe = Maybe.Some(42);
var result = maybe.Match(
withSome: v => "yes",
withNone: () => "no");
Assert.AreEqual("yes", result);
}
[TestMethod]
public void None()
{
var maybe = Maybe.None<int>();
var result = maybe.Match(
withSome: v => "yes",
withNone: () => "no");
Assert.AreEqual("no", result);
}
[TestMethod]
public void SomeWithoutReturn()
{
var wasWithSomeExecuted = false;
var maybe = Maybe.Some(42);
maybe.Match(
withSome: v => { wasWithSomeExecuted = true; },
withNone: Assert.Fail);
Assert.IsTrue(wasWithSomeExecuted);
}
[TestMethod]
public void NoneWithoutReturn()
{
var wasWithNoneExecuted = false;
var maybe = Maybe.None<int>();
maybe.Match(
withSome: v => Assert.Fail(),
withNone: () => wasWithNoneExecuted = true);
Assert.IsTrue(wasWithNoneExecuted);
}
}
}
| {
"content_hash": "b945749f7ddc30ff9cb0ab54ac638327",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 63,
"avg_line_length": 26.51923076923077,
"alnum_prop": 0.47788252356780275,
"repo_name": "danielrbradley/yam",
"id": "58da8e473c3dacd4e78346a8c91c5cc1f8ae7925",
"size": "1381",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tests/Match.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "54373"
}
],
"symlink_target": ""
} |
Rails.application.configure do
GA.tracker = Rails.application.secrets.google_analytics_code
config.action_mailer.default_url_options = { host: Rails.application.secrets.host }
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
| {
"content_hash": "4d761809bc0951640effd1c5e6ed5f7b",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 102,
"avg_line_length": 42.617283950617285,
"alnum_prop": 0.753476245654693,
"repo_name": "nigelfloe/our-checkered-past",
"id": "2b4c6a967811f736715fef2bd36734ac35522ba7",
"size": "3452",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "config/environments/production.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "39781"
},
{
"name": "HTML",
"bytes": "265841"
},
{
"name": "JavaScript",
"bytes": "187705"
},
{
"name": "PHP",
"bytes": "2111"
},
{
"name": "Ruby",
"bytes": "68590"
}
],
"symlink_target": ""
} |
using Microsoft.CodeAnalysis;
using Rocks.Builders.Shim;
using Rocks.Extensions;
using System.CodeDom.Compiler;
using System.Collections.Immutable;
namespace Rocks.Builders.Create;
internal static class MockConstructorBuilder
{
internal static void Build(IndentedTextWriter writer, MockedType typeToMock, Compilation compilation,
ImmutableArray<IParameterSymbol> parameters, ImmutableArray<ITypeSymbol> shims)
{
var typeToMockName = typeToMock.ReferenceableName;
var namingContext = new VariableNamingContext(parameters);
var requiredInitPropertiesAndIndexers = typeToMock.Type.GetMembers().OfType<IPropertySymbol>()
.Where(_ => (_.IsRequired || _.GetAccessors() == PropertyAccessor.Init || _.GetAccessors() == PropertyAccessor.GetAndInit) &&
_.CanBeSeenByContainingAssembly(compilation.Assembly)).ToArray();
var hasRequiredProperties = requiredInitPropertiesAndIndexers.Any(_ => _.IsRequired);
var contextParameters = requiredInitPropertiesAndIndexers.Length == 0 ?
$"global::Rocks.Expectations.Expectations<{typeToMockName}> @{namingContext["expectations"]}" :
$"global::Rocks.Expectations.Expectations<{typeToMockName}> @{namingContext["expectations"]}, ConstructorProperties{(!hasRequiredProperties ? "?" : string.Empty)} @{namingContext["constructorProperties"]}";
var instanceParameters = parameters.Length == 0 ?
contextParameters :
string.Join(", ", contextParameters,
string.Join(", ", parameters.Select(_ =>
{
var requiresNullable = _.RequiresForcedNullableAnnotation() ? "?" : string.Empty;
var direction = _.RefKind switch
{
RefKind.Ref => "ref ",
RefKind.Out => "out ",
RefKind.In => "in ",
_ => string.Empty
};
return $"{direction}{(_.IsParams ? "params " : string.Empty)}{_.Type.GetFullyQualifiedName()}{requiresNullable} @{_.Name}";
})));
var mockTypeName = $"Rock{typeToMock.FlattenedName}";
if (hasRequiredProperties)
{
writer.WriteLine("[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]");
}
if (parameters.Length > 0)
{
var passedParameter = string.Join(", ", parameters.Select(_ =>
{
var requiresNullable = _.RequiresForcedNullableAnnotation() ? "!" : string.Empty;
var direction = _.RefKind switch
{
RefKind.Ref => "ref ",
RefKind.Out => "out ",
RefKind.In => "in ",
_ => string.Empty
};
return $"{direction}@{_.Name}{requiresNullable}";
}));
var isUnsafe = parameters.Any(_ => _.Type.IsPointer()) ? "unsafe " : string.Empty;
writer.WriteLine($"public {isUnsafe}{mockTypeName}({instanceParameters})");
writer.Indent++;
writer.WriteLine($": base({passedParameter})");
writer.Indent--;
writer.WriteLine("{");
writer.Indent++;
MockConstructorBuilder.BuildFieldSetters(writer, compilation, namingContext, shims, requiredInitPropertiesAndIndexers, hasRequiredProperties);
writer.Indent--;
writer.WriteLine("}");
}
else
{
writer.WriteLine($"public {mockTypeName}({instanceParameters})");
writer.WriteLine("{");
writer.Indent++;
MockConstructorBuilder.BuildFieldSetters(writer, compilation, namingContext, shims, requiredInitPropertiesAndIndexers, hasRequiredProperties);
writer.Indent--;
writer.WriteLine("}");
}
}
private static void BuildFieldSetters(IndentedTextWriter writer, Compilation compilation,
VariableNamingContext namingContext, ImmutableArray<ITypeSymbol> shims,
IPropertySymbol[] requiredInitPropertiesAndIndexers, bool hasRequiredProperties)
{
if (shims.Length == 0)
{
writer.WriteLine($"this.handlers = @{namingContext["expectations"]}.Handlers;");
}
else
{
var shimFields = string.Join(", ", shims.Select(_ => $"this.shimFor{_.GetName(TypeNameOption.Flatten)}"));
var shimConstructors = string.Join(", ", shims.Select(_ => $"new {ShimBuilder.GetShimName(_)}(this)"));
writer.WriteLine($"(this.handlers, {shimFields}) = (@{namingContext["expectations"]}.Handlers, {shimConstructors});");
}
if(requiredInitPropertiesAndIndexers.Length > 0)
{
var initIndexers = requiredInitPropertiesAndIndexers.Where(
_ => _.IsIndexer && (_.GetAccessors() == PropertyAccessor.Init || _.GetAccessors() == PropertyAccessor.GetAndInit) &&
_.CanBeSeenByContainingAssembly(compilation.Assembly)).ToArray();
var enumerableTypes = initIndexers.Select(_ =>
_.Parameters.Length == 1 ?
_.Parameters[0].Type.GetFullyQualifiedName() :
$"({string.Join(", ", _.Parameters.Select(p => p.Type.GetFullyQualifiedName()))})").ToArray();
var forEachTypes = initIndexers.Select(_ =>
_.Parameters.Length == 1 ?
$"var {_.Parameters[0].Name}" :
$"({string.Join(", ", _.Parameters.Select(p => $"var {p.Name}"))})").ToArray();
var indexerNames = initIndexers.Select(_ => string.Join(", ", _.Parameters.Select(p => p.Name))).ToArray();
if(!hasRequiredProperties)
{
writer.WriteLine($"if (@{namingContext["constructorProperties"]} is not null)");
writer.WriteLine("{");
writer.Indent++;
}
foreach (var requiredInitProperty in requiredInitPropertiesAndIndexers.Where(_ => !_.IsIndexer))
{
var propertyAssignment = (requiredInitProperty.NullableAnnotation == NullableAnnotation.None ||
requiredInitProperty.NullableAnnotation == NullableAnnotation.NotAnnotated) && requiredInitProperty.Type.IsReferenceType ?
"!" : string.Empty;
writer.WriteLine($"this.{requiredInitProperty.Name} = @{namingContext["constructorProperties"]}.{requiredInitProperty.Name}{propertyAssignment};");
}
for (var i = 0; i < initIndexers.Length; i++)
{
var initIndexer = initIndexers[i];
var enumerableType = enumerableTypes[i];
var forEachType = forEachTypes[i];
var indexerName = indexerNames[i];
writer.WriteLines(
$$"""
foreach({{forEachType}} in global::System.Runtime.CompilerServices.Unsafe.As<global::System.Collections.Generic.IEnumerable<{{enumerableType}}>>(@{{namingContext["constructorProperties"]}}))
{
this[{{indexerName}}] = constructorProperties[{{indexerName}}];
}
""");
}
if (!hasRequiredProperties)
{
writer.Indent--;
writer.WriteLine("}");
}
}
}
} | {
"content_hash": "a8b264700264e3fd1bb69d31f13d3df7",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 209,
"avg_line_length": 40.42483660130719,
"alnum_prop": 0.6976556184316896,
"repo_name": "JasonBock/Rocks",
"id": "69ce243a9cb585ccbbe3d76c3d57a5754ef8e4e9",
"size": "6187",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/Rocks/Builders/Create/MockConstructorBuilder.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1386390"
},
{
"name": "Smalltalk",
"bytes": "3"
}
],
"symlink_target": ""
} |
register "Announce away status when away users are highlighted."
@@pending = {}
# Chop up an incoming message and see if it contains a nick that is
# in the channel. If it does, check for away status.
event :PRIVMSG do
next if query? or not get_data([@connection.name, @msg.destination], false)
# TODO: This is going to fail for nicks that end with punctuation. Do it a
# different way.
@msg.text.split(" ").each do |word|
word.sub!(/[[:punct:]]*\Z/, '')
if channel.users.key? word
check_away word
end
end
end
# We got a 301 (away status in WHOIS reply). Announce it if we
# should.
event :"301" do
next unless @@pending.key? msg.raw_arr[3]
dat = @@pending[@msg.raw_arr[3]]
@@pending.delete @msg.raw_arr[3] # Delete it immediately so we never end up
# with duplicate reports (that can happen
# due to an unrelated bug).
send_privmsg dat[1], "\02#{@msg.raw_arr[3]} is away:\02 #{@msg.text}"
end
# End of WHOIS! If we have a pending request for this nick, remove it.
event :"318" do
@@pending.delete @msg.raw_arr[3] if @@pending.key? @msg.raw_arr[3]
end
command 'away', 'Enable or disable away status announcements for the current channel. Parameters: ON|OFF' do
half_op! and channel! and argc! 1
case @params.first.downcase
when "on"
store_data [@connection.name, @msg.destination], true
reply "Away status announcement enabled for \02#{@msg.destination}\02."
when "off"
store_data [@connection.name, @msg.destination], false
reply "Away status announcement disabled for \02#{@msg.destination}\02."
end
end
helpers do
# Send a WHOIS if we haven't in the last 30 seconds, and add the
# request to our pending list.
def check_away nick
now = Time.now.to_i
if @@pending.key? nick
return if now - @@pending[nick][0] < 30
end
@@pending[nick] = [now, @msg.destination]
send_whois nick
end
end
# vim: set tabstop=2 expandtab:
| {
"content_hash": "5b987e2569708343bdc110ffdba21395",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 108,
"avg_line_length": 26.051948051948052,
"alnum_prop": 0.6520438683948155,
"repo_name": "Terminus-Project/Terminus-Bot",
"id": "57e0c44b131e3df3f8d09f1f4684f6bcda128f20",
"size": "3249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/away.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "392022"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>monae: Black list 🏴☠️</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.5.2 / monae - 0.2.2</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
monae
<small>
0.2.2
<span class="label label-default">Black list 🏴☠️</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-09-23 10:47:11 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-23 10:47:11 UTC)</em><p>
<div class="alert alert-info" role="alert">
<p>This result is black-listed as it is considered as too hard to reproduce / to solve. If you find a way to fix this package, please make a pull-request to <a class="alert-link" href="https://github.com/coq/opam-coq-archive">github.com/coq/opam-coq-archive</a>. The list of black-listed packages is in <a class="alert-link" href="https://github.com/coq-bench/make-html/blob/master/black_list.rb">black_list.rb</a>.</p>
</div>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.2 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "Reynald Affeldt <reynald.affeldt@aist.go.jp>"
homepage: "https://github.com/affeldt-aist/monae"
dev-repo: "git+https://github.com/affeldt-aist/monae.git"
bug-reports: "https://github.com/affeldt-aist/monae/issues"
license: "LGPL-2.1-or-later"
synopsis: "Monads and equational reasoning in Coq"
description: """
This Coq library contains a hierarchy of monads with their laws used
in several examples of monadic equational reasoning."""
build: [
[make "-j%{jobs}%"]
[make "sect5"]
[make "-C" "impredicative_set"]
]
install: [make "install"]
depends: [
"coq" { (>= "8.11" & < "8.13~") | (= "dev") }
"coq-mathcomp-ssreflect" { (>= "1.11.0" & < "1.13~") }
"coq-mathcomp-fingroup" { (>= "1.11.0" & < "1.13~") }
"coq-mathcomp-algebra" { (>= "1.11.0" & < "1.13~") }
"coq-mathcomp-solvable" { (>= "1.11.0" & < "1.13~") }
"coq-mathcomp-field" { (>= "1.11.0" & < "1.13~") }
"coq-mathcomp-analysis" { (>= "0.3.4" & < "0.3.6~") }
"coq-infotheo" { >= "0.2.1" & < "0.3~"}
"coq-paramcoq" { >= "1.1.2" & < "1.2~" }
]
tags: [
"keyword:monae"
"keyword:effects"
"keyword:probability"
"keyword:nondeterminism"
"logpath:monae"
]
authors: [
"Reynald Affeldt"
"David Nowak"
"Takafumi Saikawa"
"Jacques Garrigue"
"Celestine Sauvage"
"Kazunari Tanaka"
]
url {
http: "https://github.com/affeldt-aist/monae/archive/0.2.2.tar.gz"
checksum: "sha512=a752aa916752306c3ce5231e118d96154633976bcd1062174496c9f74b7d5f216c6d70552f1abcc1ea1b0706708938e6d6ffc8c05b276eec779c80ec90b70660"
}
</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-monae.0.2.2 coq.8.5.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.5.2).
The following dependencies couldn't be met:
- coq-monae -> coq >= dev -> ocaml >= 4.09.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-monae.0.2.2</code></dd>
<dt>Return code</dt>
<dd>15360</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- remove coq 8.5.2
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[WARNING] While removing coq.8.5.2: not removing files that changed since:
- bin/coqtop.byte
-> removed coq.8.5.2
Done.
# Run eval $(opam env) to update the current shell environment
[ERROR] Sorry, resolution of the request timed out.
Try to specify a simpler request, use a different solver, or increase the allowed time by setting OPAMSOLVERTIMEOUT to a bigger value (currently, it is set to 600.0 seconds).
</pre></dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "79b76ef8351719b7b9514bac856ff12f",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 433,
"avg_line_length": 45.70935960591133,
"alnum_prop": 0.5664403491755577,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "72bb07aabbf66f0c71020427c0a0d364eeaeecec",
"size": "9316",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.2/monae/0.2.2.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "tools/gn/c_include_iterator.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "tools/gn/input_file.h"
#include "tools/gn/location.h"
namespace {
enum IncludeType {
INCLUDE_NONE,
INCLUDE_SYSTEM, // #include <...>
INCLUDE_USER // #include "..."
};
// Returns true if str starts with the prefix.
bool StartsWith(const base::StringPiece& str, const base::StringPiece& prefix) {
base::StringPiece extracted = str.substr(0, prefix.size());
return extracted == prefix;
}
// Returns a new string piece referencing the same buffer as the argument, but
// with leading space trimmed. This only checks for space and tab characters
// since we're dealing with lines in C source files.
base::StringPiece TrimLeadingWhitespace(const base::StringPiece& str) {
size_t new_begin = 0;
while (new_begin < str.size() &&
(str[new_begin] == ' ' || str[new_begin] == '\t'))
new_begin++;
return str.substr(new_begin);
}
// We don't want to count comment lines and preprocessor lines toward our
// "max lines to look at before giving up" since the beginnings of some files
// may have a lot of comments.
//
// We only handle C-style "//" comments since this is the normal commenting
// style used in Chrome, and do so pretty stupidly. We don't want to write a
// full C++ parser here, we're just trying to get a good heuristic for checking
// the file.
//
// We assume the line has leading whitespace trimmed. We also assume that empty
// lines have already been filtered out.
bool ShouldCountTowardNonIncludeLines(const base::StringPiece& line) {
if (StartsWith(line, "//"))
return false; // Don't count comments.
if (StartsWith(line, "/*") || StartsWith(line, " *"))
return false; // C-style comment blocks with stars along the left side.
if (StartsWith(line, "#"))
return false; // Don't count preprocessor.
if (base::ContainsOnlyChars(line, base::kWhitespaceASCII))
return false; // Don't count whitespace lines.
return true; // Count everything else.
}
// Given a line, checks to see if it looks like an include or import and
// extract the path. The type of include is returned. Returns INCLUDE_NONE on
// error or if this is not an include line.
//
// The 1-based character number on the line that the include was found at
// will be filled into *begin_char.
IncludeType ExtractInclude(const base::StringPiece& line,
base::StringPiece* path,
int* begin_char) {
static const char kInclude[] = "#include";
static const size_t kIncludeLen = arraysize(kInclude) - 1; // No null.
static const char kImport[] = "#import";
static const size_t kImportLen = arraysize(kImport) - 1; // No null.
base::StringPiece trimmed = TrimLeadingWhitespace(line);
if (trimmed.empty())
return INCLUDE_NONE;
base::StringPiece contents;
if (StartsWith(trimmed, base::StringPiece(kInclude, kIncludeLen)))
contents = TrimLeadingWhitespace(trimmed.substr(kIncludeLen));
else if (StartsWith(trimmed, base::StringPiece(kImport, kImportLen)))
contents = TrimLeadingWhitespace(trimmed.substr(kImportLen));
if (contents.empty())
return INCLUDE_NONE;
IncludeType type = INCLUDE_NONE;
char terminating_char = 0;
if (contents[0] == '"') {
type = INCLUDE_USER;
terminating_char = '"';
} else if (contents[0] == '<') {
type = INCLUDE_SYSTEM;
terminating_char = '>';
} else {
return INCLUDE_NONE;
}
// Count everything to next "/> as the contents.
size_t terminator_index = contents.find(terminating_char, 1);
if (terminator_index == base::StringPiece::npos)
return INCLUDE_NONE;
*path = contents.substr(1, terminator_index - 1);
// Note: one based so we do "+ 1".
*begin_char = static_cast<int>(path->data() - line.data()) + 1;
return type;
}
// Returns true if this line has a "nogncheck" comment associated with it.
bool HasNoCheckAnnotation(const base::StringPiece& line) {
return line.find("nogncheck") != base::StringPiece::npos;
}
} // namespace
const int CIncludeIterator::kMaxNonIncludeLines = 10;
CIncludeIterator::CIncludeIterator(const InputFile* input)
: input_file_(input),
file_(input->contents()),
offset_(0),
line_number_(0),
lines_since_last_include_(0) {
}
CIncludeIterator::~CIncludeIterator() {
}
bool CIncludeIterator::GetNextIncludeString(base::StringPiece* out,
LocationRange* location) {
base::StringPiece line;
int cur_line_number = 0;
while (lines_since_last_include_ <= kMaxNonIncludeLines &&
GetNextLine(&line, &cur_line_number)) {
base::StringPiece include_contents;
int begin_char;
IncludeType type = ExtractInclude(line, &include_contents, &begin_char);
if (type == INCLUDE_USER && !HasNoCheckAnnotation(line)) {
// Only count user includes for now.
*out = include_contents;
*location = LocationRange(
Location(input_file_,
cur_line_number,
begin_char,
-1 /* TODO(scottmg): Is this important? */),
Location(input_file_,
cur_line_number,
begin_char + static_cast<int>(include_contents.size()),
-1 /* TODO(scottmg): Is this important? */));
lines_since_last_include_ = 0;
return true;
}
if (ShouldCountTowardNonIncludeLines(line))
lines_since_last_include_++;
}
return false;
}
bool CIncludeIterator::GetNextLine(base::StringPiece* line, int* line_number) {
if (offset_ == file_.size())
return false;
size_t begin = offset_;
while (offset_ < file_.size() && file_[offset_] != '\n')
offset_++;
line_number_++;
*line = file_.substr(begin, offset_ - begin);
*line_number = line_number_;
// If we didn't hit EOF, skip past the newline for the next one.
if (offset_ < file_.size())
offset_++;
return true;
}
| {
"content_hash": "cac87d3fc5d1c48f2da013d3693b2e1e",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 80,
"avg_line_length": 34.42696629213483,
"alnum_prop": 0.6613903394255874,
"repo_name": "Bysmyyr/chromium-crosswalk",
"id": "120295ea41650c04fe7edef6363bebc4f74b771a",
"size": "6128",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/gn/c_include_iterator.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?php
?><?php $this->template('header'); ?>
<p><a href="./?a=sendtoaddress">sendtoaddress</a></p>
<table>
<form>
<input type="hidden" name="a" value="sendtoaddress">
<tr>
<td>to Address</td>
<td><input type="text" name="address" value="<?php print $this->address; ?>" size="45"></td>
</tr>
<tr>
<td>Amount</td>
<td><input type="text" name="amount" value="<?php print $this->amount; ?>" size="20"></td>
</tr>
<tr>
<td> </td>
<?php
if( isset($_GET['preview']) && $this->address && $this->amount ) {
print '<td><input type="submit" value=" Send Coins To Address "></td>
<input type="hidden" name="ok" value="1">';
} else {
print '<td><input type="submit" value=" Preview "></td>
<input type="hidden" name="preview" value="1">';
}
?>
</form>
</table>
<?php
if( !$this->ok ) {
?>
<pre>
PREVIEW:
Validating Address: <?php print $this->address; ?>
<?php print_r(@$this->validateaddress); ?>
Amount: <?php print @$this->num( $this->amount ); ?> Coins
</pre>
<?php
}
if( isset( $this->sendtoaddress ) ) {
print '<pre>Send Result:<br />';
print_r($this->sendtoaddress);
print '<p><a href="./?a=gettransaction&txid=' . urlencode($this->sendtoaddress)
. '">gettransaction( ' . $this->sendtoaddress . ' )</a>';
print '</pre>';
}
?>
<?php $this->template('footer'); ?>
| {
"content_hash": "80b072bd9c7485872956100043996c7e",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 96,
"avg_line_length": 23.3,
"alnum_prop": 0.5493562231759657,
"repo_name": "habibmasuro/bitcoin-webskin",
"id": "9d6db777a5d4bd1f09ad7019a6bc7b8c76ed295e",
"size": "1522",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "skins/simple/sendtoaddress.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "123384"
}
],
"symlink_target": ""
} |
package com.jborchardt.imagefeed.domain.feed;
import java.io.IOException;
import java.util.List;
/**
* Created by johannesborchardt on 21.03.17.
*/
public interface FeedRepository {
List<? extends FeedItemModel> fetchFeed(int page) throws IOException;
boolean isFetching();
}
| {
"content_hash": "729e0413af54f9107d8d17ffcbeae8df",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 73,
"avg_line_length": 20.714285714285715,
"alnum_prop": 0.7482758620689656,
"repo_name": "jborchardt/imagefeed",
"id": "cbd58e07c3ecfe86562c9f50a91029117f930d27",
"size": "290",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "domain/src/main/java/com/jborchardt/imagefeed/domain/feed/FeedRepository.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "54570"
}
],
"symlink_target": ""
} |
package org.lambda4j.function.tri.conversion;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class ThrowableTriShortToIntFunctionTest {
@Test
void of_givenExpression_returnsFunctionalInterface() {
ThrowableTriShortToIntFunction<Throwable> function =
ThrowableTriShortToIntFunction.of((value1, value2, value3) -> 0);
Assertions.assertNotNull(function);
}
@Test
void of_givenNull_returnsNull() {
ThrowableTriShortToIntFunction<Throwable> function = ThrowableTriShortToIntFunction.of(null);
Assertions.assertNull(function);
}
}
| {
"content_hash": "f4127a01e427a1fe57f01b36f78778a0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 101,
"avg_line_length": 28.727272727272727,
"alnum_prop": 0.7294303797468354,
"repo_name": "Gridtec/lambda4j",
"id": "5804563d39dc9b5b447208893613d9906c968b3f",
"size": "1240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lambda4j/src/test/java/org/lambda4j/function/tri/conversion/ThrowableTriShortToIntFunctionTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "7381033"
}
],
"symlink_target": ""
} |
function printMetricsExt(metrics, metricsInfo, dispHeader,dispMetrics,padChar)
% print metrics
%
% ...
%
% default names
if nargin==1
metricsInfo.names.long = {'IDF1', 'IDP', 'IDR', 'Recall','Precision','False Alarm Rate', ...
'GT Tracks','Mostly Tracked','Partially Tracked','Mostly Lost', ...
'False Positives', 'False Negatives', 'ID Switches', 'Fragmentations', ...
'MOTA','MOTP', 'MOTA Log'};
metricsInfo.names.short = {'IDF1', 'IDP', 'IDR', 'Rcll','Prcn','FAR', ...
'GT','MT','PT','ML', ...
'FP', 'FN', 'IDs', 'FM', ...
'MOTA','MOTP', 'MOTAL'};
metricsInfo.widths.long = [5 4 4 6 9 16 9 14 17 11 15 15 11 14 5 5 8];
metricsInfo.widths.short = [5 4 4 5 5 5 4 4 4 4 6 6 5 5 5 5 5];
metricsInfo.format.long = {'.1f','.1f','.1f', ...
'.1f','.1f','.2f', ...
'i','i','i','i', ...
'i','i','i','i', ...
'.1f','.1f','.1f'};
metricsInfo.format.short=metricsInfo.format.long;
end
namesToDisplay=metricsInfo.names.long;
widthsToDisplay=metricsInfo.widths.long;
formatToDisplay=metricsInfo.format.long;
namesToDisplay=metricsInfo.names.short;
widthsToDisplay=metricsInfo.widths.short;
formatToDisplay=metricsInfo.format.short;
if nargin<3, dispHeader=1; end
if nargin<4
dispMetrics=1:length(metrics);
end
if nargin<5
padChar={' ',' ','|',' ',' ','| ','',' ',' ','|','',' ',' ','| ',' ',' ',' ',' '};
end
if dispHeader
for m=dispMetrics
printString=sprintf('fprintf(''%%%is%s'',char(namesToDisplay(m)))',widthsToDisplay(m),char(padChar(m)));
eval(printString)
end
fprintf('\n');
end
for m=dispMetrics
printString=sprintf('fprintf(''%%%i%s%s'',metrics(m))',widthsToDisplay(m),char(formatToDisplay(m)),char(padChar(m)));
eval(printString)
end
% if standard, new line
if nargin<4
fprintf('\n');
end | {
"content_hash": "05e5d6d344963c7bd68a3d384cca7510",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 121,
"avg_line_length": 29.58730158730159,
"alnum_prop": 0.592274678111588,
"repo_name": "abhineet123/MDP_Tracking",
"id": "cce24f5866807c3accf75bdb71009ae13c069391",
"size": "1864",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "utils/printMetricsExt.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "14075"
},
{
"name": "C++",
"bytes": "513161"
},
{
"name": "Limbo",
"bytes": "276"
},
{
"name": "Makefile",
"bytes": "1642"
},
{
"name": "Mathematica",
"bytes": "2255"
},
{
"name": "Matlab",
"bytes": "1015318"
},
{
"name": "Python",
"bytes": "61603"
},
{
"name": "Shell",
"bytes": "542"
}
],
"symlink_target": ""
} |
using JetBrains.Annotations;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
namespace JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp
{
public sealed class CSharpPostfixExpressionContext : PostfixExpressionContext
{
public CSharpPostfixExpressionContext([NotNull] CSharpPostfixTemplateContext postfixContext, [NotNull] ICSharpExpression expression)
: base(postfixContext, expression)
{
CanBeStatement = GetContainingStatement() != null;
var brokenType = IsBrokenAsExpressionCase(expression, postfixContext.Reference)
?? IsBrokenByAwaitCase(expression, postfixContext.Reference);
ExpressionType = brokenType ?? expression.GetExpressionType();
Type = brokenType ?? expression.Type();
var referenceExpression = expression as IReferenceExpression;
if (referenceExpression != null)
{
var resolveResult = referenceExpression.Reference.Resolve().Result;
ReferencedElement = resolveResult.DeclaredElement;
var element = ReferencedElement as ITypeElement;
if (element != null)
ReferencedType = TypeFactory.CreateType(element, resolveResult.Substitution);
}
var predefinedTypeExpression = expression as IPredefinedTypeExpression;
if (predefinedTypeExpression != null)
{
var typeName = predefinedTypeExpression.PredefinedTypeName;
if (typeName != null)
{
var resolveResult = typeName.Reference.Resolve().Result;
ReferencedElement = resolveResult.DeclaredElement;
var element = ReferencedElement as ITypeElement;
if (element != null)
ReferencedType = TypeFactory.CreateType(element, resolveResult.Substitution);
}
}
}
[CanBeNull] public ICSharpStatement GetContainingStatement()
{
var expression = PostfixContext.GetOuterExpression(Expression);
var statement = ExpressionStatementNavigator.GetByExpression(expression);
if (statement != null) return statement;
return RazorUtil.CanBeStatement(expression);
}
[NotNull] public new CSharpPostfixTemplateContext PostfixContext
{
get { return (CSharpPostfixTemplateContext) base.PostfixContext; }
}
// "lines.Any()" : Boolean
[NotNull] public new ICSharpExpression Expression
{
get { return (ICSharpExpression) base.Expression; }
}
[NotNull] public IExpressionType ExpressionType { get; private set; }
[NotNull] public IType Type { get; private set; }
[CanBeNull] public IDeclaredElement ReferencedElement { get; private set; }
[CanBeNull] public IDeclaredType ReferencedType { get; private set; }
public bool CanBeStatement { get; private set; }
[CanBeNull] public IReferenceExpression ExpressionWithReference
{
get
{
var reference = ReferenceExpressionNavigator.GetByQualifierExpression(Expression);
return (reference == PostfixContext.Reference) ? reference : null;
}
}
// A M(object o) { o as A.re| } - postfix reference breaks as-expression type
[CanBeNull]
private static IDeclaredType IsBrokenAsExpressionCase([NotNull] ICSharpExpression expression, [NotNull] ITreeNode reference)
{
var asExpression = expression as IAsExpression;
if (asExpression == null) return null;
var userTypeUsage = asExpression.TypeOperand as IUserTypeUsage;
if (userTypeUsage == null) return null;
var referenceName = userTypeUsage.ScalarTypeName;
if (referenceName != userTypeUsage.LastChild || referenceName != reference)
return null;
var qualifier = referenceName.Qualifier;
if (qualifier == null) return null;
var resolveResult = qualifier.Reference.Resolve().Result;
var typeElement = resolveResult.DeclaredElement as ITypeElement;
if (typeElement != null)
{
return TypeFactory.CreateType(typeElement, resolveResult.Substitution);
}
return null;
}
// await taskOfBoolean.if - postfix reference await-expression type
[CanBeNull]
private static IType IsBrokenByAwaitCase([NotNull] ICSharpExpression expression, [NotNull] ITreeNode reference)
{
var awaitExpression = expression as IAwaitExpression;
if (awaitExpression == null) return null;
var taskExpression = awaitExpression.Task as IReferenceExpression;
if (taskExpression == null || taskExpression != reference) return null;
var taskQualifier = taskExpression.QualifierExpression;
if (taskQualifier == null) return null;
var expressionType = taskQualifier.Type();
if (expressionType.IsTask() || expressionType.IsConfigurableAwaitable())
{
return taskExpression.GetPredefinedType().Void;
}
if (expressionType.IsGenericTask() || expressionType.IsGenericConfigurableAwaitable())
{
var declaredType = expressionType as IDeclaredType;
if (declaredType == null) return null;
var typeElement = declaredType.GetTypeElement();
if (typeElement == null) return null;
var typeParameters = typeElement.TypeParameters;
if (typeParameters.Count != 1) return null;
return declaredType.GetSubstitution().Apply(typeParameters[0]);
}
return null;
}
}
} | {
"content_hash": "abff8b55255adffc2550ac5827b33b2c",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 136,
"avg_line_length": 36.08724832214765,
"alnum_prop": 0.7041100985679747,
"repo_name": "controlflow/resharper-postfix",
"id": "ca3b19a6961188586d4ccf1dae7abb32a5b99d7f",
"size": "5379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PostfixTemplates/Infrastructure/Contexts/CSharp/CSharpPostfixExpressionContext.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "330572"
},
{
"name": "PowerShell",
"bytes": "440"
}
],
"symlink_target": ""
} |
package org.adligo.i.ldap.models;
public class AdligoOrgAttributes {
public static final I_LdapAttribute BINARY = new LdapAttribute((new byte [0]).getClass(), "bn", "binary");
public static final I_LdapAttribute CHECKED_ON_SERVER = new LdapAttribute("ck", "checkedOnServer");
public static final I_LdapAttribute DELETING = new LdapAttribute(Long.class, "del", "deleting");
public static final I_LdapAttribute FILE_NAME = new LdapAttribute("fn", "fileName");
public static final I_LdapAttribute SIZE = new LdapAttribute(Long.class, "size");
public static final I_LdapAttribute SEQUENCED_NUMBER = new LdapAttribute(Integer.class, "nbr", "sequencednumber");
public static final I_LdapAttribute WRITING = new LdapAttribute(Boolean.class, "wt", "writing");
}
| {
"content_hash": "bffa79b4f808b5a2a312b3c03c4906af",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 115,
"avg_line_length": 58.84615384615385,
"alnum_prop": 0.7633986928104575,
"repo_name": "adligo/i_ldap.adligo.org",
"id": "b6763e778a82d422f3dacae088dc905d4ece71b9",
"size": "765",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/adligo/i/ldap/models/AdligoOrgAttributes.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "70766"
}
],
"symlink_target": ""
} |
<div class="attributesKit">
<div style="padding-bottom:10px;" data-radium="true">
<h1 style="font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:18px;color:#5D6470;" data-radium="true">My Array</h1>
</div>
<style>
.attributesKit p {
margin-bottom: 4px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 14px;
color: #8A93A3;
line-height: 21px;
font-weight: regular;
}
.attributesKit p:last-child {
margin-bottom: 0px;
}
.attributesKit ul {
margin-left: 20px;
}
.attributesKit a {
color: #747E8E;
text-decoration: none;
border-bottom: 1px solid #DCE0E8;
}
.attributesKit a:hover {
border-bottom: none;
}
</style>
<div style="width:100%;height:auto;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;">
<div style="-ms-flex-wrap:no-wrap;-webkit-box-align:start;-ms-flex-align:start;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-box-lines:no-wrap;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;-webkit-flex-wrap:no-wrap;-webkit-box-orient:vertical;-webkit-justify-content:flex-start;-webkit-align-items:flex-start;width:100%;align-items:flex-start;justify-content:flex-start;flex-wrap:no-wrap;flex-direction:column;display:-moz-box;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;height:auto;"
data-radium="true">
<div style="width:100%;height:5px;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;border:1px solid #E8EBEE;border-bottom:none;background-color:#E8EBEE;"></div>
<div style="width:100%;height:auto;border:1px solid #E8EBEE;" data-radium="true">
<div style="width:100%;height:auto;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;border-bottom:none;padding-top:8px;padding-bottom:8px;"><span style="position:absolute;top:8px;right:8px;font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace;font-size:13px;color:#8A93A3;opacity:0.56;" data-radium="true">0</span>
<div style="-webkit-flex-wrap:no-wrap;-webkit-box-align:start;-ms-flex-align:start;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-box-lines:no-wrap;-webkit-box-direction:normal;-webkit-box-orient:vertical;-webkit-align-items:flex-start;-webkit-flex-direction:column;-ms-flex-direction:column;-webkit-justify-content:flex-start;-ms-flex-wrap:no-wrap;width:100%;padding-right:10px;padding-left:10px;align-items:flex-start;justify-content:flex-start;flex-wrap:no-wrap;flex-direction:column;display:-moz-box;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;height:auto;"
data-radium="true">
<div style="width:100%;height:auto;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;">
<div style="width:100%;height:auto;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;">
<div style="-ms-flex-wrap:no-wrap;-webkit-box-align:start;-ms-flex-align:start;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-box-lines:no-wrap;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;-webkit-flex-wrap:no-wrap;-webkit-box-orient:vertical;-webkit-justify-content:flex-start;-webkit-align-items:flex-start;width:100%;align-items:flex-start;justify-content:flex-start;flex-wrap:no-wrap;flex-direction:column;display:-moz-box;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;height:auto;"
data-radium="true">
<div style="width:100%;height:5px;display:flex;flex-direction:row;flex-wrap:no-wrap;justify-content:flex-start;align-items:stretch;position:relative;border:1px solid #E8EBEE;border-bottom:none;background-color:#E8EBEE;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> | {
"content_hash": "8f43e69a1a042722a32ed7f4b36459b5",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 615,
"avg_line_length": 88.44444444444444,
"alnum_prop": 0.666038525963149,
"repo_name": "apiaryio/attributes-kit",
"id": "5801d66a7f6d948a0aeef66a911dfe85d275d3af",
"size": "4776",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "fixtures/0043-array-of-enum-without-values.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "270"
},
{
"name": "JavaScript",
"bytes": "198406"
},
{
"name": "Shell",
"bytes": "518"
}
],
"symlink_target": ""
} |
layout: microblog
date: 2020-03-31 22:25:01 -0500
link:
collection: microblog
---
I updated my [Reading Now page](https://brianlundin.com/reading.html) on my site with several recently completed books. | {
"content_hash": "fda45d1855653d77f60b1cd9bf344d6a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 119,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.7673267326732673,
"repo_name": "blundin/brianlundin.com",
"id": "9bb49f31ebdcf716eea3df9131aba7669526c97d",
"size": "206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/_microblog/2020-03-31-22-24-56.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "16995"
},
{
"name": "JavaScript",
"bytes": "6070"
},
{
"name": "Ruby",
"bytes": "1586"
},
{
"name": "SCSS",
"bytes": "6111"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.camera.example"
android:versionCode="1"
android:versionName="1.0.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:hardwareAccelerated="false">
<activity
android:name="com.android.camera.example.CameraActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name="com.android.camera.example.MainActivity" >
</activity>
<!-- Declare the bundled CropImage Activity -->
<activity android:name="com.android.camera.CropImage"/>
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera"></uses-feature>
</manifest>
| {
"content_hash": "b52e97ec092b2c496b64e59c456bd7bd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 79,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.6288343558282209,
"repo_name": "danielfred1129/android-cropping-two-finger",
"id": "a7700d9c9ad1d9bf4f55b5cf592bc21ec18e4d34",
"size": "1304",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CropImageExample/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "349943"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-16" http-equiv="Content-Type" />
<title _locid="PortabilityAnalysis0">.NET Portability Report</title>
<style>
/* Body style, for the entire document */
body {
background: #F3F3F4;
color: #1E1E1F;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
padding: 0;
margin: 0;
}
/* Header1 style, used for the main title */
h1 {
padding: 10px 0px 10px 10px;
font-size: 21pt;
background-color: #E2E2E2;
border-bottom: 1px #C1C1C2 solid;
color: #201F20;
margin: 0;
font-weight: normal;
}
/* Header2 style, used for "Overview" and other sections */
h2 {
font-size: 18pt;
font-weight: normal;
padding: 15px 0 5px 0;
margin: 0;
}
/* Header3 style, used for sub-sections, such as project name */
h3 {
font-weight: normal;
font-size: 15pt;
margin: 0;
padding: 15px 0 5px 0;
background-color: transparent;
}
h4 {
font-weight: normal;
font-size: 12pt;
margin: 0;
padding: 0 0 0 0;
background-color: transparent;
}
/* Color all hyperlinks one color */
a {
color: #1382CE;
}
/* Paragraph text (for longer informational messages) */
p {
font-size: 10pt;
}
/* Table styles */
table {
border-spacing: 0 0;
border-collapse: collapse;
font-size: 10pt;
}
table th {
background: #E7E7E8;
text-align: left;
text-decoration: none;
font-weight: normal;
padding: 3px 6px 3px 6px;
}
table td {
vertical-align: top;
padding: 3px 6px 5px 5px;
margin: 0px;
border: 1px solid #E7E7E8;
background: #F7F7F8;
}
.NoBreakingChanges {
color: darkgreen;
font-weight:bold;
}
.FewBreakingChanges {
color: orange;
font-weight:bold;
}
.ManyBreakingChanges {
color: red;
font-weight:bold;
}
.BreakDetails {
margin-left: 30px;
}
.CompatMessage {
font-style: italic;
font-size: 10pt;
}
.GoodMessage {
color: darkgreen;
}
/* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */
.localLink {
color: #1E1E1F;
background: #EEEEED;
text-decoration: none;
}
.localLink:hover {
color: #1382CE;
background: #FFFF99;
text-decoration: none;
}
/* Center text, used in the over views cells that contain message level counts */
.textCentered {
text-align: center;
}
/* The message cells in message tables should take up all avaliable space */
.messageCell {
width: 100%;
}
/* Padding around the content after the h1 */
#content {
padding: 0px 12px 12px 12px;
}
/* The overview table expands to width, with a max width of 97% */
#overview table {
width: auto;
max-width: 75%;
}
/* The messages tables are always 97% width */
#messages table {
width: 97%;
}
/* All Icons */
.IconSuccessEncoded, .IconInfoEncoded, .IconWarningEncoded, .IconErrorEncoded {
min-width: 18px;
min-height: 18px;
background-repeat: no-repeat;
background-position: center;
}
/* Success icon encoded */
.IconSuccessEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconSuccess#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABPElEQVR4Xp1Tv0vDUBi8FqeA4NpBcBLcWnQSApncOnTo4FSnjP0DsnXpH5CxiwbHDg4Zuj4oOEXiJgiC4FDcCkLWmIMc1Pfw+eMgQ77v3Xf3Pe51YKGqqisAEwCR1TIAsiAIblSo6xrdHeJR85Xle3mdmCQKb0PsfqyxxzM8K15HZADl/H5+sHpZwYfxyRjTs+kWwKBx8yoHd2mRiuzF8mkJniWH/13u3Fjrs/EdhsdDFHGB/DLXEJBDLh1MWPAhPo1BLB4WX5yQywHR+m3tVe/t97D52CB/ziG0nIgD/qDuYg8WuCcVZ2YGwlJ3YDugkpR/VNcAEx6GEKhERSr71FuO4YCM4XBdwKvecjIlkSnsO0Hyp/GxSeJAdzBKzpOtnPwyyiPdAZhpZptT04tU+zk7s8czeges//s5C5+CwqrR4/gw+AAAAABJRU5ErkJggg==);
}
/* Information icon encoded */
.IconInfoEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconInformation#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHElEQVR4Xs2TsUoDQRRF7wwoziokjZUKadInhdhukR9YP8DMX1hYW+QvdsXa/QHBbcXC7W0CamWTQnclFutceIQJwwaWNLlwm5k5d94M76mmaeCrrmsLYOocY12FcxZFUeozCqKqqgYA8uevv1H6VuPxcwlfk5N92KHBxfFeCSAxxswlYAW/Xr989x/mv9gkhtyMDhcAxgzRsp7flj8B/HF1RsMXq+NZMkopaHe7lbKxQUEIGbKsYNoGn969060hZBkQex/W8oRQwsQaW2o3Ago2SVcJUzAgY3N0lTCZZm+zPS8HB51gMmS1DEYyOz9acKO1D8JWTlafKIMxdhvlfdyT94Vv5h7P8Ky7nQzACmhvKq3zk3PjW9asz9D/1oigecsioooAAAAASUVORK5CYII=);
}
/* Warning icon encoded */
.IconWarningEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconWarning#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAx0lEQVR4XpWSMQ7CMAxFf4xAyBMLCxMrO8dhaBcuwdCJS3RJBw7SA/QGTCxdWJgiQYWKXJWKIXHIlyw5lqr34tQgEOdcBsCOx5yZK3hCCKdYXneQkh4pEfqzLfu+wVDSyyzFoJjfz9NB+pAF+eizx2Vruts0k15mPgvS6GYvpVtQhB61IB/dk6AF6fS4Ben0uIX5odtFe8Q/eW1KvFeH4e8khT6+gm5B+t3juyDt7n0jpe+CANTd+oTUjN/U3yVaABnSUjFz/gFq44JaVSCXeQAAAABJRU5ErkJggg==);
}
/* Error icon encoded */
.IconErrorEncoded {
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */
/* [---XsltValidateInternal-Base64EncodedImage:IconError#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABQElEQVR4XqWTvUoEQRCE6wYPZUA80AfwAQz23uCMjA7MDRQEIzPBVEyNTQUFIw00vcQTTMzuAh/AxEQQT8HF/3G/oGGnEUGuoNnd6qoZuqltyKEsyzVJq5I6rnUp6SjGeGhESikzzlc1eL7opfuVbrqbU1Zw9NCgtQMaZpY0eNnaaL2fHusvTK5vKu7sjSS1Y4y3QUA6K3e3Mau5UFDyMP7tYF9o8cAHZv68vipoIJg971PZIZ5HiwdvYGGvFVFHmGmZ2MxwmQYPXubPl9Up0tfoMQGetXd6mRbvhBw+boZ6WF7Mbv1+GsHRk0fQmPAH1GfmZirbCfDJ61tw3Px8/8pZsPAG4jlVhcPgZ7adwNWBB68lkRQWFiTgFlbnLY3DGGM7izIJIyT/jjIvEJw6fdJTc6krDzh6aMwMP9bvDH4ADSsa9uSWVJkAAAAASUVORK5CYII=);
}
</style>
</head>
<body>
<h1 _locid="PortabilityReport">.NET Portability Report</h1>
<div id="content">
<div id="submissionId" style="font-size:8pt;">
<p>
<i>
Submission Id
f916f0bf-0dba-4030-9414-e85c22bb768b
</i>
</p>
</div>
<h2 _locid="SummaryTitle">
<a name="Portability Summary"></a>Portability Summary
</h2>
<div id="summary">
<table>
<tbody>
<tr>
<th>Assembly</th>
<th>ASP.NET 5,Version=v1.0</th>
<th>Windows,Version=v8.1</th>
<th>.NET Framework,Version=v4.6</th>
<th>Windows Phone,Version=v8.1</th>
</tr>
<tr>
<td><strong><a href="#ArcGIS.ServiceModel">ArcGIS.ServiceModel</a></strong></td>
<td class="text-center">100.00 %</td>
<td class="text-center">100.00 %</td>
<td class="text-center">99.75 %</td>
<td class="text-center">100.00 %</td>
</tr>
</tbody>
</table>
</div>
<div id="details">
<a name="ArcGIS.ServiceModel"><h3>ArcGIS.ServiceModel</h3></a>
<table>
<tbody>
<tr>
<th>Target type</th>
<th>ASP.NET 5,Version=v1.0</th>
<th>Windows,Version=v8.1</th>
<th>.NET Framework,Version=v4.6</th>
<th>Windows Phone,Version=v8.1</th>
<th>Recommended changes</th>
</tr>
<tr>
<td>System.Reflection.TypeInfo</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td></td>
</tr>
<tr>
<td style="padding-left:2em">get_Assembly</td>
<td class="IconSuccessEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td class="IconErrorEncoded"></td>
<td class="IconSuccessEncoded"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p>
<a href="#Portability Summary">Back to Summary</a>
</p>
</div>
</div>
</body>
</html> | {
"content_hash": "8ab542545deb0ae59cb3b87828d03a3f",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 562,
"avg_line_length": 40.88070175438597,
"alnum_prop": 0.525190970732126,
"repo_name": "kuhlenh/port-to-core",
"id": "c39d80c840e4343055af05b579ef60f98e93bd2a",
"size": "11651",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "Reports/ar/arcgis.pcl.5.1.0/ArcGIS.ServiceModel-Xamarin.iOS10.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2323514650"
}
],
"symlink_target": ""
} |
<?php
namespace Etu\Module\ArgentiqueBundle\Twig;
use Etu\Module\ArgentiqueBundle\Glide\UrlBuilder;
/**
* Twig extension to compare privacies and to fetch them.
*/
class UrlBuilderExtension extends \Twig_Extension
{
/**
* @var UrlBuilder
*/
protected $builder;
public function __construct(UrlBuilder $builder)
{
$this->builder = $builder;
}
/**
* @return array
*/
public function getFunctions()
{
return [
new \Twig_SimpleFunction('argentique_photo', [$this, 'generatePhotoUrl']),
new \Twig_SimpleFunction('argentique_collection', [$this, 'generateCollectionUrl']),
];
}
/**
* @param string $path
* @param array $options
*
* @return string
*/
public function generatePhotoUrl($path, $options = [])
{
return $this->builder->generate($path, $options);
}
/**
* @param $path
*
* @return string
*/
public function generateCollectionUrl($path)
{
return $this->builder->getWebPath().'/argentique/directory/'.$path;
}
}
| {
"content_hash": "9efdd206ecd46be6f82a472dff166f47",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 96,
"avg_line_length": 21.11320754716981,
"alnum_prop": 0.5862377122430742,
"repo_name": "ungdev/EtuUTT",
"id": "499c8a30170330cf7c92fc6ffc5bcc12a1c9d4c2",
"size": "1119",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Etu/Module/ArgentiqueBundle/Twig/UrlBuilderExtension.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "147"
},
{
"name": "HTML",
"bytes": "5835"
},
{
"name": "JavaScript",
"bytes": "57041"
},
{
"name": "PHP",
"bytes": "1490743"
},
{
"name": "SCSS",
"bytes": "66021"
},
{
"name": "Shell",
"bytes": "4455"
},
{
"name": "Smarty",
"bytes": "2918"
},
{
"name": "Twig",
"bytes": "652714"
}
],
"symlink_target": ""
} |
ModuleInput::ModuleInput(Application* app, bool start_enabled) : Module(app,"Input", start_enabled)
{
keyboard = new KEY_STATE[MAX_KEYS];
memset(keyboard, KEY_IDLE, sizeof(KEY_STATE) * MAX_KEYS);
memset(mouse_buttons, KEY_IDLE, sizeof(KEY_STATE) * MAX_MOUSE_BUTTONS);
}
// Destructor
ModuleInput::~ModuleInput()
{
delete[] keyboard;
}
// Called before render is available
bool ModuleInput::Init()
{
LOGC("Init SDL input event system");
bool ret = true;
SDL_Init(0);
if(SDL_InitSubSystem(SDL_INIT_EVENTS) < 0)
{
LOGC("SDL_EVENTS could not initialize! SDL_Error: %s\n", SDL_GetError());
ret = false;
}
return ret;
}
// Called every draw update
update_status ModuleInput::PreUpdate(float dt)
{
SDL_PumpEvents();
const Uint8* keys = SDL_GetKeyboardState(NULL);
for(int i = 0; i < MAX_KEYS; ++i)
{
if(keys[i] == 1)
{
if(keyboard[i] == KEY_IDLE)
keyboard[i] = KEY_DOWN;
else
keyboard[i] = KEY_REPEAT;
}
else
{
if(keyboard[i] == KEY_REPEAT || keyboard[i] == KEY_DOWN)
keyboard[i] = KEY_UP;
else
keyboard[i] = KEY_IDLE;
}
}
Uint32 buttons = SDL_GetMouseState(&mouse_x, &mouse_y);
mouse_x /= SCREEN_SIZE;
mouse_y /= SCREEN_SIZE;
mouse_z = 0;
for(int i = 0; i < 5; ++i)
{
if(buttons & SDL_BUTTON(i))
{
if(mouse_buttons[i] == KEY_IDLE)
mouse_buttons[i] = KEY_DOWN;
else
mouse_buttons[i] = KEY_REPEAT;
}
else
{
if(mouse_buttons[i] == KEY_REPEAT || mouse_buttons[i] == KEY_DOWN)
mouse_buttons[i] = KEY_UP;
else
mouse_buttons[i] = KEY_IDLE;
}
}
mouse_x_motion = mouse_y_motion = 0;
bool quit = false;
SDL_Event e;
while(SDL_PollEvent(&e))
{
ImGui_ImplSdlGL3_ProcessEvent(&e);
switch(e.type)
{
case SDL_MOUSEWHEEL:
mouse_z = e.wheel.y;
break;
case SDL_MOUSEMOTION:
mouse_x = e.motion.x / SCREEN_SIZE;
mouse_y = e.motion.y / SCREEN_SIZE;
mouse_x_motion = e.motion.xrel / SCREEN_SIZE;
mouse_y_motion = e.motion.yrel / SCREEN_SIZE;
break;
case SDL_QUIT:
quit = true;
break;
case SDL_DROPFILE:
{
// In case if dropped file
// jope_importer.Import(e.drop.file);
App->resources->HandleDropEvent(e.drop);
SDL_free(e.drop.file);
break;
}
case SDL_WINDOWEVENT:
{
if(e.window.event == SDL_WINDOWEVENT_RESIZED)
App->renderer3D->OnResize(e.window.data1, e.window.data2);
if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
App->resources->GotFocus(true);
}
}
}
if(quit == true || keyboard[SDL_SCANCODE_ESCAPE] == KEY_UP)
return UPDATE_STOP;
return UPDATE_CONTINUE;
}
// Called before quitting
bool ModuleInput::CleanUp()
{
LOGC("Quitting SDL input event subsystem");
SDL_QuitSubSystem(SDL_INIT_EVENTS);
return true;
}
bool ModuleInput::IsImGuiUsingInput()
{
ImGuiIO& io = ImGui::GetIO();
bool ret = false;
if (io.WantCaptureKeyboard) ret = true;
if (io.WantCaptureMouse) ret = true;
if (io.WantTextInput) ret = true;
return ret;
} | {
"content_hash": "c6cf5602d375b156a98e692f83841d7e",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 99,
"avg_line_length": 20.30821917808219,
"alnum_prop": 0.6384485666104553,
"repo_name": "PatatesIDracs/3DGameEngine",
"id": "7c275e5c4918a2c1aa5d55d39ea625689609b747",
"size": "3130",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "3DEngine/Source/ModuleInput.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3642936"
},
{
"name": "C++",
"bytes": "6677263"
},
{
"name": "CMake",
"bytes": "18475"
},
{
"name": "JavaScript",
"bytes": "2933"
},
{
"name": "Objective-C",
"bytes": "11156"
}
],
"symlink_target": ""
} |
package sc_zap
import (
"crypto/sha256"
"encoding/base32"
"errors"
"github.com/watermint/toolbox/essentials/log/esl"
"github.com/watermint/toolbox/infra/app"
"github.com/watermint/toolbox/infra/control/app_control"
"github.com/watermint/toolbox/infra/control/app_resource"
"github.com/watermint/toolbox/infra/security/sc_obfuscate"
"os"
"path/filepath"
"strconv"
"strings"
"time"
)
func Unzap(ctl app_control.Control) (b []byte, err error) {
tas, err := app_resource.Bundle().Keys().Bytes("toolbox.appkeys.secret")
if err != nil {
return nil, err
}
return sc_obfuscate.Deobfuscate(ctl.Log(), sc_obfuscate.ZapKey(), tas)
}
var (
keyEnvNames = []string{
"HOME",
"HOSTNAME",
"CI_BUILD_REF",
"CI_JOB_ID",
"CIRCLE_WORKFLOW_ID",
"CIRCLE_NODE_INDEX",
}
)
var (
ErrorObfuscateFailure = errors.New("obfuscation failure")
ErrorCantFileWrite = errors.New("cant write file")
)
func NewZap(extraSeed string) string {
seeds := make([]byte, 0)
seeds = strconv.AppendInt(seeds, time.Now().Unix(), 16)
seeds = append(seeds, app.BuildId...)
seeds = append(seeds, extraSeed...)
for _, k := range keyEnvNames {
if v, ok := os.LookupEnv(k); ok {
seeds = append(seeds, k...)
seeds = append(seeds, v...)
}
}
hash := make([]byte, 32)
sha2 := sha256.Sum256(seeds)
copy(hash[:], sha2[:])
b32 := base32.StdEncoding.WithPadding('_').EncodeToString(hash)
return strings.ReplaceAll(b32, "_", "")
}
func Zap(zap string, prjRoot string, data []byte) error {
secretPath := filepath.Join(prjRoot, "resources/keys/toolbox.appkeys.secret")
l := esl.Default()
b, err := sc_obfuscate.Obfuscate(l, []byte(zap), data)
if err != nil {
return ErrorObfuscateFailure
}
if err := os.WriteFile(secretPath, b, 0600); err != nil {
return ErrorCantFileWrite
}
return nil
}
| {
"content_hash": "9fa72e6eeabf740ce165e6fdfdf12ab8",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 24.053333333333335,
"alnum_prop": 0.6790465631929047,
"repo_name": "watermint/toolbox",
"id": "f1e536334d3677fc5a1bb51ea92c929ba864483d",
"size": "1804",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "infra/security/sc_zap/zap.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "215"
},
{
"name": "Go",
"bytes": "3090492"
},
{
"name": "HTML",
"bytes": "14475"
},
{
"name": "Shell",
"bytes": "1731"
}
],
"symlink_target": ""
} |
package types
import (
"fmt"
"reflect"
pb "go.chromium.org/luci/common/tsmon/ts_mon_proto"
)
// A Target knows how to put information about itself in a MetricsData message.
type Target interface {
// TODO(1026140): the hash and proto of a Target object should be created
// at the time of the object creation.
PopulateProto(d *pb.MetricsCollection)
Hash() uint64
Clone() Target
Type() TargetType
}
// TargetType represents the type of a Target, which identifies a metric
// with the name.
//
// A metric is identified by (metric.info.name, metric.info.target_type).
type TargetType struct {
// Name is the name of the TargeType that can be given to --target-type
// command line option.
Name string
// Type is the reflect.Type of the Target struct.
Type reflect.Type
}
func (tt TargetType) String() string {
return fmt.Sprintf("%s:%s", tt.Name, tt.Type)
}
| {
"content_hash": "37931a32895589e4017d5f515475acee",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 25.764705882352942,
"alnum_prop": 0.726027397260274,
"repo_name": "luci/luci-go",
"id": "a8cc0257c949a59563493e642f8cb285243fd83f",
"size": "1472",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "common/tsmon/types/target.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25460"
},
{
"name": "Go",
"bytes": "10674259"
},
{
"name": "HTML",
"bytes": "658081"
},
{
"name": "JavaScript",
"bytes": "18433"
},
{
"name": "Makefile",
"bytes": "2862"
},
{
"name": "Python",
"bytes": "49205"
},
{
"name": "Shell",
"bytes": "20986"
},
{
"name": "TypeScript",
"bytes": "110221"
}
],
"symlink_target": ""
} |
using DragonSpark.Commands;
using DragonSpark.Diagnostics.Configurations;
using DragonSpark.Sources;
using Serilog.Events;
namespace DragonSpark.Testing.Framework.Application.Setup
{
public class MinimumLevel : CommandAttributeBase
{
public MinimumLevel( LogEventLevel level ) : base( MinimumLevelConfiguration.Default.Configured( level ).Adapt<AutoData>().WithPriority( Priority.BeforeNormal ) ) {}
}
} | {
"content_hash": "645f6365ab2f5bea458f98bb90fa8ca6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 167,
"avg_line_length": 34.083333333333336,
"alnum_prop": 0.8141809290953546,
"repo_name": "DevelopersWin/VoteReporter",
"id": "3461b8abb7d99d55bb5a011cb25692a214c3a890",
"size": "409",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Framework/DragonSpark.Testing.Framework/Application/Setup/MinimumLevel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "875916"
},
{
"name": "Smalltalk",
"bytes": "65144"
},
{
"name": "XSLT",
"bytes": "3508"
}
],
"symlink_target": ""
} |
package info.cmlubinski.newslearning.classify
import scala.collection.JavaConverters._
import unfiltered.filter.Plan
import unfiltered.request._
import unfiltered.response._
import info.cmlubinski.newslearning.models.{DB, TrainingSet}
import info.cmlubinski.newslearning.web.Jade
object Classify extends Plan {
import DB.imports._
object ArticleParam extends Params.Extract("article_id",
Params.first ~> Params.int)
def intent = TSGuard {
case req@GET(Path("/classify")) & TS(tset) =>
unseenArticle(tset) match {
case Some(article) => DB.withTransaction {
implicit session =>
val mtXp = (for (modelData <- DB.modelData;
modelType <- DB.modelTypes
if modelData.training_set_id === tset.id
&& modelData.model_type === modelType.id)
yield (modelData, modelType)).list.map{
case (modelData, modelType) =>
val classifier = modelData.featurizer
val prediction:Double = classifier.evalRaw(article)(1)
(modelType, "%.2f".format(prediction * 100))
}
Jade(req, "classify.jade",
"article" -> article, "tset" -> tset, "mtXp" -> mtXp.asJava)
}
case None =>
Jade(req, "classify-no-articles.jade")
}
case req@POST(Path("/classify") & TS(tset)
& Params(params@ArticleParam(article_id))) =>
val value = params("classify-yes").length > 0
classifyArticle(article_id, tset, value)
Redirect("/classify")
}
def unseenArticle(tset:TrainingSet) = DB.withTransaction {
implicit session =>
val query = for (
(a, d) <-
DB.articles
leftJoin DB.trainingData on((a, d) =>
a.id === d.article_id
&& d.training_set_id === tset.id)
if d.article_id.isNull
) yield a
query.take(1).list.headOption
}
def classifyArticle(article_id:Int, tset:TrainingSet, value:Boolean) {
DB.withTransaction {
implicit session =>
val previous = for (d <- DB.trainingData
if d.training_set_id === tset.id
&& d.article_id === article_id) yield d.value
if (previous.exists.run) {
previous.update(value)
} else {
DB.trainingData += (tset.id, article_id, value)
}
}
}
}
| {
"content_hash": "790a5ef541b5c61d48ccc18d8b521901",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 75,
"avg_line_length": 32.5,
"alnum_prop": 0.5672064777327935,
"repo_name": "cmc333333/news-learning",
"id": "0ff58790e5e294fd0ae385f75274086f568540c2",
"size": "2470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/classify/Classify.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1293"
},
{
"name": "Scala",
"bytes": "25067"
},
{
"name": "Shell",
"bytes": "2350"
}
],
"symlink_target": ""
} |
package bp.model.text;
import bp.text.model.BasicTextBlock;
public class LineComment extends BasicTextBlock {
private final String startSign = "//";
private final String endSign = "\n";
}
| {
"content_hash": "a9818f3d3efc77b61a89f58da36a6cb6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 22.11111111111111,
"alnum_prop": 0.7286432160804021,
"repo_name": "VladimirRadojcic/Master",
"id": "d0a82ff50fcf1291d57c90443fedddc16eda0a74",
"size": "199",
"binary": false,
"copies": "1",
"ref": "refs/heads/VladimirRadojcic",
"path": "BusinessProcessModelingTool/src/bp/model/text/LineComment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AspectJ",
"bytes": "46124"
},
{
"name": "CSS",
"bytes": "14198"
},
{
"name": "FreeMarker",
"bytes": "9550"
},
{
"name": "HTML",
"bytes": "13107"
},
{
"name": "Java",
"bytes": "2618620"
},
{
"name": "JavaScript",
"bytes": "25579"
}
],
"symlink_target": ""
} |
\hypertarget{namespacegft_1_1RegionCloud3}{\section{gft\-:\-:Region\-Cloud3 Namespace Reference}
\label{namespacegft_1_1RegionCloud3}\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}}
}
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item
struct \hyperlink{structgft_1_1RegionCloud3_1_1__regionCloud3}{\-\_\-region\-Cloud3}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item
typedef struct \\*
\hyperlink{structgft_1_1RegionCloud3_1_1__regionCloud3}{gft\-::\-Region\-Cloud3\-::\-\_\-region\-Cloud3} \hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_aefa1ec9c08d352b7bb8487409e7c891e}{By\-Label\-List} (\hyperlink{namespacegft_1_1FileList_a3a0ba3f59376d46215f21160690c6be1}{File\-List\-::\-File\-List} $\ast$L)
\item
void \hyperlink{namespacegft_1_1RegionCloud3_a7e10254e9e4ed6b3fa964be54193cad5}{Destroy} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$$\ast$rcloud)
\item
void \hyperlink{namespacegft_1_1RegionCloud3_a013ccdee3c85d5742cd274d119868de5}{Get\-Voxel\-Size} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud, float $\ast$dx, float $\ast$dy, float $\ast$dz)
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_ad1b53e79eaf686055ccf0151b81c9867}{Subsampling} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud)
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_ad7ba9e9a3b4a5cc73d98ec7be8beb267}{Linear\-Interp} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud, float dx, float dy, float dz)
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_aea52f2a023a202709be9f6f6a02dd00d}{Gaussian\-Blur} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud)
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_a53b90d68aeda078ea5802693f304c761}{Change\-Orientation\-To\-L\-P\-S} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud, char $\ast$ori)
\item
\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$ \hyperlink{namespacegft_1_1RegionCloud3_aa24667c4f95e57c72d5a2df6a17280fa}{Read} (char $\ast$filename)
\item
void \hyperlink{namespacegft_1_1RegionCloud3_a8e20a9336391f0712e729b4391bf1a87}{Write} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud, char $\ast$filename)
\item
void \hyperlink{namespacegft_1_1RegionCloud3_a5929dc2d63a1ae47a120ed2d6e2a177d}{Remove\-Elem} (\hyperlink{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{Region\-Cloud3} $\ast$rcloud, \hyperlink{namespacegft_1_1Scene32_ae492ac529c9149889605a7bebd647c46}{Scene32\-::\-Scene32} $\ast$label)
\end{DoxyCompactItemize}
\subsection{Typedef Documentation}
\hypertarget{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Region\-Cloud3@{Region\-Cloud3}}
\index{Region\-Cloud3@{Region\-Cloud3}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Region\-Cloud3}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf gft\-::\-Region\-Cloud3\-::\-\_\-region\-Cloud3} {\bf gft\-::\-Region\-Cloud3\-::\-Region\-Cloud3}}}\label{namespacegft_1_1RegionCloud3_ae97ab7136c2a2a97ccc56e60025d0a1a}
\subsection{Function Documentation}
\hypertarget{namespacegft_1_1RegionCloud3_aefa1ec9c08d352b7bb8487409e7c891e}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!By\-Label\-List@{By\-Label\-List}}
\index{By\-Label\-List@{By\-Label\-List}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{By\-Label\-List}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-By\-Label\-List (
\begin{DoxyParamCaption}
\item[{File\-List\-::\-File\-List $\ast$}]{L}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_aefa1ec9c08d352b7bb8487409e7c891e}
\hypertarget{namespacegft_1_1RegionCloud3_a53b90d68aeda078ea5802693f304c761}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Change\-Orientation\-To\-L\-P\-S@{Change\-Orientation\-To\-L\-P\-S}}
\index{Change\-Orientation\-To\-L\-P\-S@{Change\-Orientation\-To\-L\-P\-S}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Change\-Orientation\-To\-L\-P\-S}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-Change\-Orientation\-To\-L\-P\-S (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud, }
\item[{char $\ast$}]{ori}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_a53b90d68aeda078ea5802693f304c761}
\hypertarget{namespacegft_1_1RegionCloud3_a7e10254e9e4ed6b3fa964be54193cad5}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Destroy@{Destroy}}
\index{Destroy@{Destroy}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Destroy}]{\setlength{\rightskip}{0pt plus 5cm}void gft\-::\-Region\-Cloud3\-::\-Destroy (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$$\ast$}]{rcloud}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_a7e10254e9e4ed6b3fa964be54193cad5}
\hypertarget{namespacegft_1_1RegionCloud3_aea52f2a023a202709be9f6f6a02dd00d}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Gaussian\-Blur@{Gaussian\-Blur}}
\index{Gaussian\-Blur@{Gaussian\-Blur}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Gaussian\-Blur}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-Gaussian\-Blur (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_aea52f2a023a202709be9f6f6a02dd00d}
\hypertarget{namespacegft_1_1RegionCloud3_a013ccdee3c85d5742cd274d119868de5}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Get\-Voxel\-Size@{Get\-Voxel\-Size}}
\index{Get\-Voxel\-Size@{Get\-Voxel\-Size}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Get\-Voxel\-Size}]{\setlength{\rightskip}{0pt plus 5cm}void gft\-::\-Region\-Cloud3\-::\-Get\-Voxel\-Size (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud, }
\item[{float $\ast$}]{dx, }
\item[{float $\ast$}]{dy, }
\item[{float $\ast$}]{dz}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_a013ccdee3c85d5742cd274d119868de5}
\hypertarget{namespacegft_1_1RegionCloud3_ad7ba9e9a3b4a5cc73d98ec7be8beb267}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Linear\-Interp@{Linear\-Interp}}
\index{Linear\-Interp@{Linear\-Interp}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Linear\-Interp}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-Linear\-Interp (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud, }
\item[{float}]{dx, }
\item[{float}]{dy, }
\item[{float}]{dz}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_ad7ba9e9a3b4a5cc73d98ec7be8beb267}
\hypertarget{namespacegft_1_1RegionCloud3_aa24667c4f95e57c72d5a2df6a17280fa}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Read@{Read}}
\index{Read@{Read}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Read}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-Read (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{filename}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_aa24667c4f95e57c72d5a2df6a17280fa}
\hypertarget{namespacegft_1_1RegionCloud3_a5929dc2d63a1ae47a120ed2d6e2a177d}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Remove\-Elem@{Remove\-Elem}}
\index{Remove\-Elem@{Remove\-Elem}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Remove\-Elem}]{\setlength{\rightskip}{0pt plus 5cm}void gft\-::\-Region\-Cloud3\-::\-Remove\-Elem (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud, }
\item[{Scene32\-::\-Scene32 $\ast$}]{label}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_a5929dc2d63a1ae47a120ed2d6e2a177d}
\hypertarget{namespacegft_1_1RegionCloud3_ad1b53e79eaf686055ccf0151b81c9867}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Subsampling@{Subsampling}}
\index{Subsampling@{Subsampling}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Subsampling}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Region\-Cloud3} $\ast$ gft\-::\-Region\-Cloud3\-::\-Subsampling (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_ad1b53e79eaf686055ccf0151b81c9867}
\hypertarget{namespacegft_1_1RegionCloud3_a8e20a9336391f0712e729b4391bf1a87}{\index{gft\-::\-Region\-Cloud3@{gft\-::\-Region\-Cloud3}!Write@{Write}}
\index{Write@{Write}!gft::RegionCloud3@{gft\-::\-Region\-Cloud3}}
\subsubsection[{Write}]{\setlength{\rightskip}{0pt plus 5cm}void gft\-::\-Region\-Cloud3\-::\-Write (
\begin{DoxyParamCaption}
\item[{Region\-Cloud3 $\ast$}]{rcloud, }
\item[{char $\ast$}]{filename}
\end{DoxyParamCaption}
)}}\label{namespacegft_1_1RegionCloud3_a8e20a9336391f0712e729b4391bf1a87}
| {
"content_hash": "45065b3ef3b9de04571de1a76860518f",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 328,
"avg_line_length": 78.072,
"alnum_prop": 0.763705297673942,
"repo_name": "ademirtc/bandeirantes",
"id": "e9cf96da92cc41f1ebac8cbc8b8ed049c86a38bb",
"size": "9759",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/gft/doc/latex/namespacegft_1_1RegionCloud3.tex",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "547046"
},
{
"name": "C++",
"bytes": "681294"
},
{
"name": "CMake",
"bytes": "35613"
},
{
"name": "CSS",
"bytes": "25098"
},
{
"name": "HTML",
"bytes": "4553648"
},
{
"name": "JavaScript",
"bytes": "2983"
},
{
"name": "Makefile",
"bytes": "43040"
},
{
"name": "TeX",
"bytes": "1189325"
}
],
"symlink_target": ""
} |
package org.apache.commons.pool2.impl;
import java.text.SimpleDateFormat;
import java.util.Set;
import org.apache.commons.pool2.impl.DefaultPooledObject.AbandonedObjectCreatedException;
import org.apache.commons.pool2.impl.TestGenericObjectPool.SimpleFactory;
import org.junit.Assert;
import org.junit.Test;
public class TestDefaultPooledObjectInfo {
@Test
public void testTiming() throws Exception {
GenericObjectPool<String> pool =
new GenericObjectPool<String>(new SimpleFactory());
long t1 = System.currentTimeMillis();
Thread.sleep(50);
String s1 = pool.borrowObject();
Thread.sleep(50);
long t2 = System.currentTimeMillis();
Thread.sleep(50);
pool.returnObject(s1);
Thread.sleep(50);
long t3 = System.currentTimeMillis();
Thread.sleep(50);
pool.borrowObject();
Thread.sleep(50);
long t4 = System.currentTimeMillis();
Set<DefaultPooledObjectInfo> strings = pool.listAllObjects();
Assert.assertEquals(1, strings.size());
DefaultPooledObjectInfo s1Info = strings.iterator().next();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
Assert.assertTrue(s1Info.getCreateTime() > t1);
Assert.assertEquals(sdf.format(Long.valueOf(s1Info.getCreateTime())),
s1Info.getCreateTimeFormatted());
Assert.assertTrue(s1Info.getCreateTime() < t2);
Assert.assertTrue(s1Info.getLastReturnTime() > t2);
Assert.assertEquals(sdf.format(Long.valueOf(s1Info.getLastReturnTime())),
s1Info.getLastReturnTimeFormatted());
Assert.assertTrue(s1Info.getLastReturnTime() < t3);
Assert.assertTrue(s1Info.getLastBorrowTime() > t3);
Assert.assertEquals(sdf.format(Long.valueOf(s1Info.getLastBorrowTime())),
s1Info.getLastBorrowTimeFormatted());
Assert.assertTrue(s1Info.getLastBorrowTime() < t4);
}
@Test
public void testGetPooledObjectType() throws Exception {
GenericObjectPool<String> pool =
new GenericObjectPool<String>(new SimpleFactory());
pool.borrowObject();
Set<DefaultPooledObjectInfo> strings = pool.listAllObjects();
Assert.assertEquals(1, strings.size());
DefaultPooledObjectInfo s1Info = strings.iterator().next();
Assert.assertEquals(String.class.getName(),
s1Info.getPooledObjectType());
}
@Test
public void testGetPooledObjectToString() throws Exception {
GenericObjectPool<String> pool =
new GenericObjectPool<String>(new SimpleFactory());
String s1 = pool.borrowObject();
Set<DefaultPooledObjectInfo> strings = pool.listAllObjects();
Assert.assertEquals(1, strings.size());
DefaultPooledObjectInfo s1Info = strings.iterator().next();
Assert.assertEquals(s1, s1Info.getPooledObjectToString());
}
@Test
public void testGetLastBorrowTrace() throws Exception {
AbandonedConfig abandonedConfig = new AbandonedConfig();
abandonedConfig.setRemoveAbandonedOnBorrow(true);
abandonedConfig.setRemoveAbandonedTimeout(1);
abandonedConfig.setLogAbandoned(true);
GenericObjectPool<String> pool = new GenericObjectPool<String>(
new SimpleFactory(),
new GenericObjectPoolConfig(),
abandonedConfig);
try {
pool.borrowObject();
//pool.returnObject(s1); // Object not returned, causes abandoned object created exception
} catch (AbandonedObjectCreatedException e) {
// do nothing. We will print the stack trace later
}
Set<DefaultPooledObjectInfo> strings = pool.listAllObjects();
DefaultPooledObjectInfo s1Info = strings.iterator().next();
String lastBorrowTrace = s1Info.getLastBorrowTrace();
Assert.assertTrue(lastBorrowTrace.startsWith(AbandonedObjectCreatedException.class.getName()));
}
} | {
"content_hash": "d0a6fda97c19e2ab067cde36276aba00",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 103,
"avg_line_length": 33.66115702479339,
"alnum_prop": 0.6700220967345937,
"repo_name": "kmiku7/apache-commons-pool-annotated",
"id": "66d224af9b18c7668e86c3f334f84a40ddbb4796",
"size": "4875",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/apache/commons/pool2/impl/TestDefaultPooledObjectInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "8297"
},
{
"name": "Java",
"bytes": "828209"
},
{
"name": "Shell",
"bytes": "1100"
}
],
"symlink_target": ""
} |
module Scalar
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
attr_reader :amount, :units
cattr_reader :conversion_table
cattr_reader :formats
end
end
module ClassMethods
def units
conversion_table.keys
end
end
def initialize(amount, units = self.base_units)
@amount, @units = amount.to_d, units.to_s
end
def > (other)
amount > other.to_units(units).to_d
end
def < (other)
amount < other.to_units(units).to_d
end
def >= (other)
amount >= other.to_units(units).to_d
end
def <= (other)
amount <= other.to_units(units).to_d
end
def <=> (other)
amount <=> other.to_units(units).to_d
end
def == (other)
amount == other.to_units(units).to_d
end
def === (other)
amount == other.to_units(units).to_d
end
def + (other)
raise ArgumentError, "Only similar scalar types can be added together" unless other.is_a?(self.class)
self.class.new(amount + other.to_units(units).amount, units)
end
def - (other)
raise ArgumentError, "Only similar scalar types can be subtracted" unless other.is_a?(self.class)
self.class.new(amount - other.to_units(units).amount, units)
end
def * (other)
if other.is_a?(Numeric)
self.class.new(amount * other.to_d, units)
elsif self.is_a?(Length) && other.is_a?(Length)
case units
when 'millimetres' then (amount * other.millimetres.to_d).to_area(:square_millimetres)
when 'centimetres' then (amount * other.centimetres.to_d).to_area(:square_centimetres)
when 'metres' then (amount * other.metres.to_d).to_area(:square_metres)
when 'kilometres' then (amount * other.kilometres.to_d).to_area(:square_kilometres)
when 'inches' then (amount * other.inches.to_d).to_area(:square_inches)
when 'feet' then (amount * other.feet.to_d).to_area(:square_feet)
when 'yards' then (amount * other.yards.to_d).to_area(:square_yards)
when 'miles' then (amount * other.miles.to_d).to_area(:square_miles)
else (self.metres.to_d * other.metres.to_d).to_area(:square_metres)
end
elsif self.is_a?(Length) && other.is_a?(Area)
case units
when 'millimetres' then (amount * other.square_millimetres.to_d).to_volume(:cubic_millimetres)
when 'centimetres' then (amount * other.square_centimetres.to_d).to_volume(:cubic_centimetres)
when 'metres' then (amount * other.square_metres.to_d).to_volume(:cubic_metres)
when 'kilometres' then (amount * other.square_kilometres.to_d).to_volume(:cubic_kilometres)
when 'inches' then (amount * other.square_inches.to_d).to_volume(:cubic_inches)
when 'feet' then (amount * other.square_feet.to_d).to_volume(:cubic_feet)
when 'yards' then (amount * other.square_yards.to_d).to_volume(:cubic_yards)
when 'miles' then (amount * other.square_miles.to_d).to_volume(:cubic_miles)
else (self.metres.to_d * other.square_metres.to_d).to_volume(:cubic_metres)
end
elsif self.is_a?(Area) && other.is_a?(Length)
case units
when 'square_millimetres' then (amount * other.millimetres.to_d).to_volume(:cubic_millimetres)
when 'square_centimetres' then (amount * other.centimetres.to_d).to_volume(:cubic_centimetres)
when 'square_metres' then (amount * other.metres.to_d).to_volume(:cubic_metres)
when 'square_kilometres' then (amount * other.kilometres.to_d).to_volume(:cubic_kilometres)
when 'square_inches' then (amount * other.inches.to_d).to_volume(:cubic_inches)
when 'square_feet' then (amount * other.feet.to_d).to_volume(:cubic_feet)
when 'square_yards' then (amount * other.yards.to_d).to_volume(:cubic_yards)
when 'square_miles' then (amount * other.miles.to_d).to_volume(:cubic_miles)
else (self.square_metres.to_d * other.metres.to_d).to_volume(:cubic_metres)
end
else
raise ArgumentError, "Invalid multiplier type"
end
end
def / (other)
if other.is_a?(Numeric)
self.class.new(amount / other.to_d, units)
elsif other.is_a?(self.class)
amount / other.to_units(units).to_d
else
raise ArgumentError, "Invalid divisor type"
end
end
def zero?
amount.zero?
end
def round(n = 0, mode = BigDecimal.mode(BigDecimal::ROUND_MODE))
self.class.new(amount.round(n, mode), units)
end
def to_s(precision = nil)
if precision
sprintf("%0.#{precision}f", amount)
else
amount.frac.zero? ? amount.to_i.to_s : amount.to_s
end
end
def to_formatted_s(precision = nil)
sprintf(self.class.formats[units], to_s(precision))
end
def to_d
amount
end
def to_i
amount.round(0).to_i
end
def to_f
amount.to_f
end
def to_r
amount.to_r
end
def to_units(new_units)
units == new_units.to_s ? self : self.class.new(amount * conversion_rate(new_units.to_s), new_units)
end
def inspect
to_formatted_s
end
def method_missing(method, *args)
if conversion_table.key?(method.to_s)
to_units(method)
else
super
end
end
protected
def conversion_table
self.class.conversion_table
end
def conversion_rate(new_units)
conversion_table[units] / conversion_table[new_units]
end
def base_units
self.class.conversion_table.index(1.0)
end
end
| {
"content_hash": "7a2a2a6d62b58217aee65ab97712fb2f",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 105,
"avg_line_length": 29.50537634408602,
"alnum_prop": 0.6384839650145773,
"repo_name": "pixeltrix/scalar_types",
"id": "b391460ba90ae02a0adb2628e432c48e0b34f7ab",
"size": "5488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/scalar.rb",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package com.bkav.training.week2.session8;
import java.math.BigInteger;
public class TestBigInteger {
public static void main(String[] args) {
BigInteger num1 = new BigInteger("111111111111111111111111111111111111111111111111111111111111");
BigInteger num2 = new BigInteger("511111111111222222222222222222222222222222222222222222222222222222222");
System.out.println(num1.add(num2));
System.out.println(num1.multiply(num2));
System.out.println(num2.divide(num1));
}
}
| {
"content_hash": "94c9e7b8bfa7c890889f6ec613fe4913",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 108,
"avg_line_length": 37,
"alnum_prop": 0.8024948024948025,
"repo_name": "anhtrungbk55/JavaTraining",
"id": "ac54434d54de8a8e05ddfdabac0c09e70bda6847",
"size": "481",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Documents/workspace/JavaTraining/src/com/bkav/training/week2/session8/TestBigInteger.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "103925"
}
],
"symlink_target": ""
} |
#pragma once
#include "type.hpp"
namespace processwarp {
/** Buffer size of working for stack. */
static const int STACK_BUFFER_SIZE = 2;
/** Value of nullptr in virtual-machine. */
static const vaddr_t VADDR_NULL = 0x0;
/** Value of true in virtual-machine. */
static const uint8_t I8_TRUE = 0x1;
/** Value of false in virtual-machine. */
static const uint8_t I8_FALSE = 0x0;
/** Threshold of access count for change owner or occasion to copy. */
static const int MEMORY_REFERRAL_LIMIT = 5;
/** Interval time of send require packet (sec). */
static const int MEMORY_REQUIRE_INTERVAL = 5;
/** Heartbeat interval.(sec) */
static const int HEARTBEAT_INTERVAL = 3;
/** Interval to call Scheduler::execute.(sec) */
static const int SCHEDULER_EXECUTE_INTERVAL = HEARTBEAT_INTERVAL;
/** Deadline time for unresponsive module.(sec) */
static const int HEARTBEAT_DEADLINE = 10;
/**
* Virtual address types that is able to distinguish by using AND operation with MASK.
*/
namespace AddressRegion {
typedef vaddr_t Type;
static const Type META = 0x0000000000000000; ///< Meta data (possible changeing).
static const Type VALUE_08 = 0x1000000000000000; ///< Address for 0~255Byte sized space.
static const Type VALUE_16 = 0x2000000000000000; ///< Address for 256〜65KByte sized space.
static const Type VALUE_24 = 0x3000000000000000; ///< Address for 65K〜16MByte sized space.
static const Type VALUE_32 = 0x4000000000000000; ///< Address for 16M〜4GByte sized space.
static const Type VALUE_40 = 0x5000000000000000; ///< Address for 4G〜1TByte sized space.
static const Type VALUE_48 = 0x6000000000000000; ///< Address for 1T〜256TByte sized space.
static const Type PROGRAM = 0xF000000000000000; ///< Address for Function, Type.
static const Type MASK = 0xF000000000000000; ///< Mask for clip AddrType area.
} // namespace AddressRegion
/**
* Addresses that is assigned for primitive types and pointer, function.
*/
namespace BasicTypeAddress {
static const vaddr_t VOID = 0xF000000000000001; ///< void.
static const vaddr_t POINTER = 0xF000000000000002; ///< pointer, address.
static const vaddr_t FUNCTION = 0xF000000000000003; ///< function.
static const vaddr_t UI8 = 0xF000000000000011; ///< 8bit unsigned int.
static const vaddr_t UI16 = 0xF000000000000012; ///< 16bit unsigned int.
static const vaddr_t UI32 = 0xF000000000000013; ///< 32bit unsigned int.
static const vaddr_t UI64 = 0xF000000000000014; ///< 64bit unsigned int.
static const vaddr_t UI128 = 0xF000000000000015; ///< 128bit unsigned int.
static const vaddr_t UI256 = 0xF000000000000016; ///< 256bit unsigned int.
static const vaddr_t UI512 = 0xF000000000000017; ///< 512bit unsigned int.
static const vaddr_t SI8 = 0xF000000000000021; ///< 8bit signed int.
static const vaddr_t SI16 = 0xF000000000000022; ///< 16bit signed int.
static const vaddr_t SI32 = 0xF000000000000023; ///< 32bit signed int.
static const vaddr_t SI64 = 0xF000000000000024; ///< 64bit signed int.
static const vaddr_t SI128 = 0xF000000000000025; ///< 128bit signed int.
static const vaddr_t SI256 = 0xF000000000000026; ///< 256bit signed int.
static const vaddr_t SI512 = 0xF000000000000027; ///< 512bit signed int.
// F16
static const vaddr_t F32 = 0xF000000000000032; ///< Single-precision floating point.
static const vaddr_t F64 = 0xF000000000000033; ///< Double-precision floating point.
// F80
static const vaddr_t F128 = 0xF000000000000035; ///< Quadruple-precision floating point.
static const vaddr_t MAX = 0xF0000000000000FF; ///< Max address for PrimitiveTypeAddress.
static const vaddr_t MASK = 0x0FFFFFFFFFFFFFFF;
} // namespace BasicTypeAddress
/**
* Post process type of builtin function.
*/
namespace BuiltinPostProc {
typedef int Type;
static const Type NORMAL = 0; ///< Normally run next instruction.
static const Type RE_ENTRY = 1; ///< Re-entry by stack deciding.
static const Type RETRY_LATER = 2; ///< Retry the same instruction later other thread.
} // namespace BuiltinPostProc
/**
* Function types of executable in VM.
*/
namespace FunctionType {
typedef uint8_t Type;
static const Type NORMAL = 0x01; ///< Normal function type.
static const Type BUILTIN = 0x02; ///< VM built-in function type.
static const Type NATIVE = 0x03; ///< Native funcion type that is execute by FFI.
} // namespace FunctionType
namespace JoinWaitStatus {
typedef vtid_t Type;
static const Type NONE = 0x0;
static const Type ROOT = 0x1;
static const Type DETACHED = 0x2;
} // namespace JoinWaitStatus
/**
* Opcode of custom VM.
*/
namespace Opcode {
typedef uint8_t Type;
static const Type NOP = 0;
static const Type EXTRA = 1;
static const Type CALL = 2;
static const Type TAILCALL = 3;
static const Type RETURN = 4;
static const Type SET_TYPE = 5;
static const Type SET_OUTPUT = 6;
static const Type SET_VALUE = 7;
static const Type SET_OV_PTR = 8;
static const Type ADD = 9;
static const Type SUB = 10;
static const Type MUL = 11;
static const Type DIV = 12;
static const Type REM = 13;
static const Type SHL = 14;
static const Type SHR = 15;
static const Type AND = 16;
static const Type NAND = 17;
static const Type OR = 18;
static const Type XOR = 19;
static const Type MAX = 20;
static const Type MIN = 21;
static const Type SET = 22;
static const Type SET_PTR = 23;
static const Type SET_ADR = 24;
static const Type SET_ALIGN = 25;
static const Type ADD_ADR = 26;
static const Type MUL_ADR = 27;
static const Type GET_ADR = 28;
static const Type LOAD = 29;
static const Type STORE = 30;
static const Type CMPXCHG = 31;
static const Type ALLOCA = 32;
static const Type TEST = 33;
static const Type TEST_EQ = 34;
static const Type JUMP = 35;
static const Type INDIRECT_JUMP = 36;
static const Type PHI = 37;
static const Type TYPE_CAST = 38;
static const Type BIT_CAST = 39;
static const Type EQUAL = 40;
static const Type NOT_EQUAL = 41;
static const Type GREATER = 42;
static const Type GREATER_EQUAL = 43;
static const Type NOT_NANS = 44;
static const Type OR_NANS = 45;
static const Type SELECT = 46;
static const Type SHUFFLE = 47;
static const Type VA_ARG = 48;
} // namespace Opcode
namespace OperandMask {
static const instruction_t FILL = 0x03FFFFFF; ///< Max value.
static const instruction_t HEAD = 0x02000000;
} // namespace OperandMask
/**
* ID of data allocated in program area.
*/
namespace ProgramType {
typedef uint8_t Type;
static const Type NORMAL = 0x01; ///< Normal function data.
static const Type EXTERNAL = 0x02; ///< Built-in/Native function data.
static const Type TYPE = 0xFF; ///< Type data.
} // namespace ProgramType
/**
* Kind of primitive and structure types.
*/
namespace TypeKind {
typedef uint8_t Type;
static const Type BASIC = 0x01; ///< Primitive type, pointer, function.
static const Type STRUCT = 0x02; ///< Struct type like the C struct type.
static const Type ARRAY = 0x03; ///< Array type like the C array type.
static const Type VECTOR = 0x04; ///< Vector type that is used by vector operations.
} // namespace TypeKind
namespace VMemoryReserve {
static const unsigned int MIN = 8;
static const unsigned int BASE = 16;
static const unsigned int MAX = 64;
} // namespace VMemoryReserve
} // namespace processwarp
| {
"content_hash": "ceb9f42ce9bc4e8ca87caba71e3aad09",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 97,
"avg_line_length": 40.752631578947366,
"alnum_prop": 0.6793232597184554,
"repo_name": "processwarp/processwarp",
"id": "6a7c7a569e05ee96451174f903d90e872ed993bc",
"size": "7753",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/core/constant_vm.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "543919"
},
{
"name": "C",
"bytes": "1271195"
},
{
"name": "C++",
"bytes": "860407"
},
{
"name": "CMake",
"bytes": "13655"
},
{
"name": "CSS",
"bytes": "1145"
},
{
"name": "Groff",
"bytes": "216187"
},
{
"name": "HTML",
"bytes": "18874"
},
{
"name": "Java",
"bytes": "72969"
},
{
"name": "JavaScript",
"bytes": "13800"
},
{
"name": "LLVM",
"bytes": "2736348"
},
{
"name": "M4",
"bytes": "72318"
},
{
"name": "Makefile",
"bytes": "157147"
},
{
"name": "Objective-C",
"bytes": "36"
},
{
"name": "Python",
"bytes": "16586"
},
{
"name": "Ruby",
"bytes": "2297"
},
{
"name": "Shell",
"bytes": "362889"
},
{
"name": "TeX",
"bytes": "323102"
}
],
"symlink_target": ""
} |
namespace download {
// The parameters describing when to run a download. This allows the caller to
// specify restrictions on what impact this download will have on the device
// (battery, network conditions, priority, etc.). On iOS, the network and
// battery requirements are mapped to NSURLSessionConfiguration.discretionary.
struct SchedulingParams {
public:
enum class NetworkRequirements {
// The download can occur under all network conditions.
NONE = 0,
// The download should occur when the network isn't metered. However if the
// device does not provide that opportunity over a long period of time, the
// DownloadService may start allowing these downloads to run on metered
// networks as well.
OPTIMISTIC = 1,
// The download can occur only if the network isn't metered.
UNMETERED = 2,
// Last value of the enum.
COUNT = 3,
};
enum class BatteryRequirements {
// The download can occur under all battery scenarios.
BATTERY_INSENSITIVE = 0,
// The download can only occur when device is charging or above optimal
// battery percentage.
BATTERY_SENSITIVE = 1,
// Download can only occur when the device is charging.
BATTERY_CHARGING = 2,
// Last value of the enum.
COUNT = 3,
};
enum class Priority {
// The lowest priority. Requires that the device is idle or Chrome is
// running. Gets paused or postponed during on-going navigation.
LOW = 0,
// The normal priority. Requires that the device is idle or Chrome is
// running. Gets paused or postponed during on-going navigation.
NORMAL = 1,
// The highest background priority. Does not require the device to be idle.
HIGH = 2,
// The highest priority. This will act (scheduling requirements aside) as a
// user-initiated download.
UI = 3,
// The default priority for all tasks unless overridden.
DEFAULT = NORMAL,
// Last value of the enum.
COUNT = 4,
};
SchedulingParams();
SchedulingParams(const SchedulingParams& other) = default;
~SchedulingParams() = default;
bool operator==(const SchedulingParams& rhs) const;
// Cancel the download after this time. Will cancel in-progress downloads.
// base::Time::Max() if not specified. Not supported on iOS.
base::Time cancel_time;
// The suggested priority. Non-UI priorities may not be honored by the
// DownloadService based on internal criteria and settings.
Priority priority;
NetworkRequirements network_requirements;
BatteryRequirements battery_requirements;
};
// The parameters describing how to build the request when starting a download.
struct RequestParams {
public:
RequestParams();
RequestParams(const RequestParams& other);
~RequestParams();
GURL url;
// The request method ("GET" is the default value).
std::string method;
net::HttpRequestHeaders request_headers;
// If the request will fetch HTTP error response body and treat them as
// a successful download. Not supported on iOS.
bool fetch_error_body;
// Whether the download is not trustworthy and requires safe browsing checks.
// Not supported on iOS.
bool require_safety_checks;
// The credentials mode of the request. Not supported on iOS.
::network::mojom::CredentialsMode credentials_mode;
// The isolation info of the request, this won't be persisted to db and will
// be invalidate during download resumption in new browser session. Not
// supported on iOS.
absl::optional<net::IsolationInfo> isolation_info;
// First-party URL redirect policy: During server redirects, whether the
// first-party URL for cookies will need to be changed. Download is normally
// considered a main frame navigation. However, this is not true for
// background fetch.
bool update_first_party_url_on_redirect = true;
};
// The parameters that describe a download request made to the DownloadService.
// The |client| needs to be properly created and registered for this service for
// the download to be accepted.
struct DownloadParams {
using CustomData = std::map<std::string, std::string>;
enum StartResult {
// The download is accepted and persisted.
ACCEPTED,
// The DownloadService has too many downloads. Backoff and retry.
BACKOFF,
// The DownloadService has no knowledge of the DownloadClient associated
// with this request.
UNEXPECTED_CLIENT,
// Failed to create the download. The guid is already in use.
UNEXPECTED_GUID,
// The download was cancelled by the Client while it was being persisted.
CLIENT_CANCELLED,
// The DownloadService was unable to accept and persist this download due to
// an internal error like the underlying DB store failing to write to disk.
INTERNAL_ERROR,
// TODO(dtrainor): Add more error codes.
// The count of entries for the enum.
COUNT,
};
using StartCallback =
base::OnceCallback<void(const std::string&, StartResult)>;
DownloadParams();
~DownloadParams();
DownloadParams(DownloadParams&& other);
DownloadParams& operator=(DownloadParams&& other);
// The feature that is requesting this download.
DownloadClient client;
// A unique GUID that represents this download. See |base::GenerateGUID()|.
std::string guid;
// A callback that will be notified if this download has been accepted and
// persisted by the DownloadService.
StartCallback callback;
// Custom key value pair to store custom data for various purposes. Has a 1024
// bytes size limit for each key or value. Will be sent back to clients when
// download is completed or failed. Not supported on iOS.
CustomData custom_data;
// The parameters that determine under what device conditions this download
// will occur.
SchedulingParams scheduling_params;
// The parameters that define the actual download request to make.
RequestParams request_params;
// Traffic annotation for the network request.
net::MutableNetworkTrafficAnnotationTag traffic_annotation;
};
} // namespace download
#endif // COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_DOWNLOAD_PARAMS_H_
| {
"content_hash": "fe1b515ee7bf7c035a683835de28b737",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 80,
"avg_line_length": 33.03225806451613,
"alnum_prop": 0.7234700520833334,
"repo_name": "chromium/chromium",
"id": "b5de2b4040f1dc8e77ceb0b7d60c1c5b453c8110",
"size": "6879",
"binary": false,
"copies": "6",
"ref": "refs/heads/main",
"path": "components/download/public/background_service/download_params.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
Libraries are hard. Libraries can be needed for user code, but also to run compilers.
For CE we use a lot of different compilers and environments that need to be separated from the OS's installation, and that makes things more complicated than just building with your standard OS's compiler.
Including header files or equivalent is usually the easy part. If there are binaries involved, things get complicated.
We have a couple of seperate stages where we use and mix different techniques to be able to produce the right assembly or executables.
* Compilation without linking
* The `LD_LIBRARY_PATH` environment variable is used here to enable the compiler to find the `.so` files that they need to run.
* If you're running a local installation, this is usually your own systems' `LD_LIBRARY_PATH` plus extra things that CE adds through properties.
* On godbolt.org we always start with an empty `LD_LIBRARY_PATH` and add what is set in the properties.
* Building an executable or binary
* We use `-Wl,-rpath=` (or equivalent `rpathFlag`) to force library paths into the executable so that they will always find the same `.so` files no matter where they are run. Usually this also includes lib64 and lib folders that the compiler offers for standard libraries that the toolchain offers.
* Library paths supplied through `-Wl,-rpath=` for shared libraries will be able to dynamically link to the right architecture's `.so` even if multiple paths are given that contain the same `.so` file.
* We use `-L` (or equivalent `libpathFlag`) to enable the compiler to find both static (`.a`) and shared (`.so`) libraries.
* We always add '.' as a path as well because that's where we put libraries that are downloaded from our Conan server.
* We use `-l` (or equivalent `linkFlag`) to say we want to statically or dynamically link to a named library binary (the compiler and linker decide if it's gonna be static or dynamic).
* Running the executable
* We use `LD_LIBRARY_PATH` just in case these are dependencies inherited from the compiler - and for the libraries that are used (also just in case).
## Specific properties that are used in certain situations
* Compiler .ldPath
* is used for `LD_LIBRARY_PATH` to support running the compiler
* is used for linking (`-Wl,-rpath=` and/or `-L`) during building binaries
* is used for `LD_LIBRARY_PATH` to enable the users's executable to find `.so` files
* Compiler .libPath
* is used for linking (`-Wl,-rpath=` and/or `-L`) during building binaries
* is used for `LD_LIBRARY_PATH` to enable the users's executable to find `.so` files
* Library .libPath
* is used for linking (`-Wl,-rpath=` and/or `-L`) during building binaries
* is used for `LD_LIBRARY_PATH` to enable the users's executable to find `.so` files (just in case)
## Example
Say we have the following things in a `c++.local.properties` file:
```
compilers=mycl
compiler.mycl.exe=/home/ubuntu/mycl/bin
compiler.mycl.ldPath=/home/ubuntu/mycl/lib/lib64
compiler.mycl.libPath=/home/ubuntu/mycl/lib/lib64:/home/ubuntu/mycl/lib/lib32
compiler.mycl.options=--gcc-toolchain=/home/ubuntu/gcc10
compiler.mycl.includeFlag=-I
libs=mylib
libs.mylib.name=My library
libs.mylib.path=/home/ubuntu/mylib/include
libs.mylib.libpath=/home/ubuntu/mylib/lib
libs.mylib.staticliblink=mylib
```
This will result in the following situations if we want to compile some code with both the mycl compiler and the mylib library:
* Compilation without linking
* `LD_LIBRARY_PATH` is set to `/home/ubuntu/mycl/lib/lib64`
* `-I/home/ubuntu/mylib/include` is added to the compilation arguments
* Building an executable or binary
* `LD_LIBRARY_PATH` is set to `/home/ubuntu/mycl/lib/lib64`
* The following are added to the compilation arguments
* `-I/home/ubuntu/mylib/include` (library include path)
* `-Wl,-rpath=/home/ubuntu/mycl/lib/lib64` (compiler library paths)
* `-Wl,-rpath=/home/ubuntu/mycl/lib/lib32`
* `-Wl,-rpath=.` (conan library path)
* `-L.`
* `-Wl,-rpath=/home/ubuntu/gcc10/lib/lib` (gcc toolchain library paths)
* `-Wl,-rpath=/home/ubuntu/gcc10/lib/lib32`
* `-Wl,-rpath=/home/ubuntu/gcc10/lib/lib64`
* `-Wl,-rpath=/home/ubuntu/mylib/lib` (mylib library path - just in case there are `.so` files used)
* `-L/home/ubuntu/mylib/lib` (mylib library path used to find `libmylib.a`)
* `-lmylib` (mylib library name)
* Running the executable
* `LD_LIBRARY_PATH` is set to `/home/ubuntu/mycl/lib/lib64:/home/ubuntu/mycl/lib/lib32:/home/ubuntu/mylib/lib`
| {
"content_hash": "1c15d2657d8b1cea6c6bb223e78a8f70",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 300,
"avg_line_length": 59.6578947368421,
"alnum_prop": 0.7412880458756065,
"repo_name": "mattgodbolt/compiler-explorer",
"id": "4e3d076348bdabb76fc0862d13ca80de9ef115f4",
"size": "4592",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "docs/AboutLibraryPaths.md",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "690848"
},
{
"name": "Batchfile",
"bytes": "2758"
},
{
"name": "C++",
"bytes": "237"
},
{
"name": "CSS",
"bytes": "26253"
},
{
"name": "Go",
"bytes": "280"
},
{
"name": "HTML",
"bytes": "62121"
},
{
"name": "Java",
"bytes": "300"
},
{
"name": "JavaScript",
"bytes": "1281944"
},
{
"name": "Makefile",
"bytes": "4593"
},
{
"name": "PHP",
"bytes": "601"
},
{
"name": "Python",
"bytes": "29840"
},
{
"name": "Shell",
"bytes": "1978"
}
],
"symlink_target": ""
} |
class Foo {
private final Object objectToSet;
private Foo(Foo.Builder builder) {
objectToSet = builder.getObjectToSet();
}
public static class Builder {
private Object objectToSet;
public Builder() { }
private Object getObjectToSet() {
return objectToSet;
}
public Builder objectToSet(Object objectToSet) {
this.objectToSet = objectToSet;
return this;
}
public Foo build() {
return new Foo(this);
}
}
} | {
"content_hash": "19351dd915986b12b3da8db69d4ddcac",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 57,
"avg_line_length": 21.346153846153847,
"alnum_prop": 0.554954954954955,
"repo_name": "jdphenix/MyCode",
"id": "0a5276c1b1fb627de34a4ef015591cf99e4f3d9d",
"size": "599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/builder.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "7225"
},
{
"name": "CSS",
"bytes": "324"
},
{
"name": "HTML",
"bytes": "794"
},
{
"name": "Java",
"bytes": "4995"
},
{
"name": "JavaScript",
"bytes": "12228"
},
{
"name": "Scala",
"bytes": "688"
}
],
"symlink_target": ""
} |
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.widget.bottomsheet;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
/**
* A specialized FrameLayout that is capable of ignoring all user input based on the state of
* the bottom sheet.
*/
class TouchRestrictingFrameLayout extends FrameLayout {
/** A handle to the bottom sheet. */
private BottomSheet mBottomSheet;
public TouchRestrictingFrameLayout(Context context, AttributeSet atts) {
super(context, atts);
}
/**
* @param sheet The bottom sheet.
*/
public void setBottomSheet(BottomSheet sheet) {
mBottomSheet = sheet;
}
/**
* @return Whether touch is enabled.
*/
private boolean isTouchDisabled() {
return mBottomSheet == null
|| mBottomSheet.getSheetState() == BottomSheetController.SheetState.SCROLLING;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (isTouchDisabled()) return false;
return super.onInterceptTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (isTouchDisabled()) return false;
return super.onTouchEvent(event);
}
}
| {
"content_hash": "ba21ab867af9b77cbf98c30fab44cd61",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 94,
"avg_line_length": 29,
"alnum_prop": 0.696551724137931,
"repo_name": "endlessm/chromium-browser",
"id": "154e04429831110b52679620cd5b61f8bf88cfe8",
"size": "1450",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/TouchRestrictingFrameLayout.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<query id="getSiteInfoByDomain" action="select">
<tables>
<table name="sites" />
<table name="modules" />
</tables>
<columns>
<column name="sites.site_srl" alias="site_srl" />
<column name="sites.domain" alias="domain" />
<column name="sites.index_module_srl" alias="index_module_srl" />
<column name="sites.default_language" alias="default_language" />
<column name="modules.*" />
</columns>
<conditions>
<condition operation="equal" column="sites.domain" var="domain" notnull="notnull" />
<condition operation="equal" column="modules.module_srl" default="sites.index_module_srl" notnull="notnull" pipe="and" />
</conditions>
</query>
| {
"content_hash": "1a9451d86776dfa53438212ce6e4cb7a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 129,
"avg_line_length": 43.05882352941177,
"alnum_prop": 0.6215846994535519,
"repo_name": "talkwithraon/XE4KAIST",
"id": "9b3a3332e0e2fd06b1a704dd0993a6bc75ddd610",
"size": "732",
"binary": false,
"copies": "51",
"ref": "refs/heads/master",
"path": "xe4kaist/modules/module/queries/getSiteInfoByDomain.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "2358"
},
{
"name": "CSS",
"bytes": "728319"
},
{
"name": "HTML",
"bytes": "1286170"
},
{
"name": "JavaScript",
"bytes": "2354460"
},
{
"name": "PHP",
"bytes": "4750065"
}
],
"symlink_target": ""
} |
class QueueMultiActions {
public:
QueueMultiActions(const char* name, int count);
virtual ~QueueMultiActions();
void AddAction(Action* );
//BEFORE CALLING CurrentAction, you MUST Lock() the Queue!
Action* CurrentAction(int index);
int32 CountActions();
int CountThreads() { return fCount; }
Action* ActionAt(int32 pos);
void RemoveActionAt(int32 pos);
void SetDownloadCount(int count);
bool Lock();
void Unlock();
bool IsLocked();
protected:
static int32 ManageTheQueue(void*);
virtual void ActionReadyToPerform(Action*) = 0;
virtual void ActionPerformed(Action*,status_t,BMessage*) = 0;
virtual void SuppressAction(Action*) = 0;
private:
struct token
{
int index;
QueueMultiActions* qa;
};
void SetCurrentAction(Action*,int index);
void KIllThread(int id);
Action* fCurrentAction[MAX_MULTI];
thread_id fID[MAX_MULTI];
sem_id fLock;
BObjectList<Action> fList;
bool fLocked;
int fCount;
BString fName;
};
#endif
| {
"content_hash": "3fe9c8f43141c577fb19169ce1c1575b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 64,
"avg_line_length": 21.327272727272728,
"alnum_prop": 0.597612958226769,
"repo_name": "HaikuArchives/BePodder",
"id": "399b95a71541633b53bd766ef744432cffce34ad",
"size": "1338",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sources-experimental/QueueMultiActions.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "63114"
},
{
"name": "C++",
"bytes": "782388"
},
{
"name": "HTML",
"bytes": "13857"
},
{
"name": "Makefile",
"bytes": "18761"
},
{
"name": "Shell",
"bytes": "1131"
}
],
"symlink_target": ""
} |
// ----------------------------------------------------------------------------
// Copyright 2006-2010, GeoTelematic Solutions, Inc.
// All rights reserved
// ----------------------------------------------------------------------------
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable 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.
//
// ----------------------------------------------------------------------------
// Change History:
// 2008/06/20 Martin D. Flynn
// -Initial release
// ----------------------------------------------------------------------------
package org.opengts.db;
import java.util.*;
import java.io.*;
public class RuleParseException
extends Exception
{
/**
*** Constructor
*** @param msg The message associated with this exception
**/
public RuleParseException(String msg)
{
super(msg);
}
/**
*** Constructor
*** @param msg The message associated with this exception
*** @param cause The cause of this exception
**/
public RuleParseException(String msg, Throwable cause)
{
super(msg, cause);
}
}
| {
"content_hash": "a259fd377767cf987a72423a3731ea3a",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 31.92156862745098,
"alnum_prop": 0.5264127764127764,
"repo_name": "neeph/OpenGTSFull",
"id": "0e46945a14919bdadbba32503b8e3139997dd9a3",
"size": "1628",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/org/opengts/db/RuleParseException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "13754"
},
{
"name": "CSS",
"bytes": "57398"
},
{
"name": "Java",
"bytes": "7705340"
},
{
"name": "JavaScript",
"bytes": "598031"
},
{
"name": "Perl",
"bytes": "53060"
},
{
"name": "Shell",
"bytes": "37282"
}
],
"symlink_target": ""
} |
import {Tensor} from './tensor';
import {NamedTensorMap} from './tensor_types';
import * as util from './util';
export interface TapeNode {
id: number;
name: string;
outputs: Tensor[];
inputs: NamedTensorMap;
// Optional params, defined only for ops with gradient impl.
gradient?: (dy: Tensor|Tensor[]) => NamedGradientMap;
saved?: Tensor[];
}
export type NamedGradientMap = {
[inputName: string]: () => Tensor;
};
/**
* Computes a list of TapeNodes that connect x to y, filtering everything else
* out and preserving the order of the original tape elements.
*
* @param tape The tape elements to filter.
* @param xs The input Tensors.
* @param y The output Tensor.
*/
export function getFilteredNodesXToY(
tape: TapeNode[], xs: Tensor[], y: Tensor): TapeNode[] {
// Forward pass to compute all the nodes and Tensors that are transitively a
// function of x.
const tensorsFromX: {[tensorId: number]: boolean} = {};
const nodesFromX: {[nodeId: number]: boolean} = {};
for (let i = 0; i < xs.length; i++) {
tensorsFromX[xs[i].id] = true;
}
for (let i = 0; i < tape.length; i++) {
const node = tape[i];
const nodeInputs = node.inputs;
for (const inputName in nodeInputs) {
const input = nodeInputs[inputName];
let anyInputFromX = false;
for (let j = 0; j < xs.length; j++) {
if (tensorsFromX[input.id]) {
node.outputs.forEach(output => tensorsFromX[output.id] = true);
anyInputFromX = true;
nodesFromX[node.id] = true;
break;
}
}
if (anyInputFromX) {
break;
}
}
}
// Backward pass to find all of the nodes and Tensors that lead to y.
const tensorsLeadToY: {[tensorId: number]: boolean} = {};
tensorsLeadToY[y.id] = true;
const nodesToY: {[nodeId: number]: boolean} = {};
for (let i = tape.length - 1; i >= 0; i--) {
const node = tape[i];
const nodeInputs = node.inputs;
// If any of the outputs lead to y, mark all of the inputs as leading to y.
for (let j = 0; j < node.outputs.length; j++) {
if (tensorsLeadToY[node.outputs[j].id]) {
for (const inputName in nodeInputs) {
tensorsLeadToY[nodeInputs[inputName].id] = true;
nodesToY[node.id] = true;
}
break;
}
}
}
// Return the paths that come from x and lead to y.
const filteredTape: TapeNode[] = [];
for (let i = 0; i < tape.length; i++) {
const node = tape[i];
if (nodesFromX[node.id] && nodesToY[node.id]) {
// Prune the inputs from the node that aren't a function of x.
const prunedInputs: {[inputName: string]: Tensor} = {};
for (const inputName in node.inputs) {
const nodeInput = node.inputs[inputName];
if (tensorsFromX[nodeInput.id]) {
prunedInputs[inputName] = nodeInput;
}
}
// Copy the node and overwrite inputsAndArgs to the pruned version.
const prunedNode = Object.assign({}, node) as TapeNode;
prunedNode.inputs = prunedInputs;
prunedNode.outputs = node.outputs;
filteredTape.push(prunedNode);
}
}
return filteredTape;
}
/**
* Backpropagate gradients through the filtered TapeNodes.
*
* @param tensorAccumulatedGradientMap A map of Tensor to its gradient. This map
* is mutated by this method.
* @param filteredTape The filtered TapeNodes to backprop through.
*/
export function backpropagateGradients(
tensorAccumulatedGradientMap: {[tensorId: number]: Tensor},
filteredTape: TapeNode[], tidy: (f: Function) => Tensor) {
// Walk the tape backward and keep a map of Tensor to its gradient.
for (let i = filteredTape.length - 1; i >= 0; i--) {
const node = filteredTape[i];
const dys: Tensor[] = [];
node.outputs.forEach(o => {
const gradTensor = tensorAccumulatedGradientMap[o.id];
if (gradTensor != null) {
dys.push(gradTensor);
} else {
// This particular output is not in the back-propagation subgraph, so it
// does not affect the final output, thus we put zeros for its dy.
const dy = Tensor.make(
o.shape, {values: util.makeZerosTypedArray(o.size, o.dtype)},
o.dtype);
dys.push(dy);
}
});
if (node.gradient == null) {
throw new Error(
`Cannot compute gradient: gradient function not found ` +
`for ${node.name}.`);
}
// Backprop dy through this node and accumulate gradients over the inputs.
const inputGradients =
// Grad functions of ops with single outputs expect a dy, while ops
// with multiple outputs expect dys (array of dy).
node.gradient(node.outputs.length === 1 ? dys[0] : dys);
for (const inputName in node.inputs) {
if (!(inputName in inputGradients)) {
throw new Error(
`Cannot backprop through input ${inputName}. ` +
`Available gradients found: ${Object.keys(inputGradients)}.`);
}
// Call the gradient function.
const dx = tidy(() => inputGradients[inputName]());
if (dx.dtype !== 'float32') {
throw new Error(
`Error in gradient for op ${node.name}. The gradient of input ` +
`${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);
}
const x = node.inputs[inputName];
if (!util.arraysEqual(dx.shape, x.shape)) {
throw new Error(
`Error in gradient for op ${node.name}. The gradient of input ` +
`'${inputName}' has shape '${dx.shape}', which does not match ` +
`the shape of the input '${x.shape}'`);
}
if (tensorAccumulatedGradientMap[x.id] == null) {
tensorAccumulatedGradientMap[x.id] = dx;
} else {
const curGradient = tensorAccumulatedGradientMap[x.id];
tensorAccumulatedGradientMap[x.id] = curGradient.add(dx);
curGradient.dispose();
}
}
}
}
| {
"content_hash": "d31558c9d31aa83f0500a9f806bde3b4",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 80,
"avg_line_length": 33,
"alnum_prop": 0.6138047138047138,
"repo_name": "tensorflow/tfjs-core",
"id": "2195aada5d77eb3599ef58c5b37c704912dbb305",
"size": "6642",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tfjs-core/src/tape.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "8700"
},
{
"name": "HTML",
"bytes": "18822"
},
{
"name": "JavaScript",
"bytes": "47350"
},
{
"name": "Python",
"bytes": "1065"
},
{
"name": "Shell",
"bytes": "11363"
},
{
"name": "TypeScript",
"bytes": "3469230"
}
],
"symlink_target": ""
} |
package io.fundrequest.core.request.claim.domain;
public enum ClaimRequestStatus {
PENDING,
APPROVED,
TRANSACTION_FAILED,
DECLINED,
PROCESSED
}
| {
"content_hash": "078c4cd99b872bea302f62d176d1dd62",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.7212121212121212,
"repo_name": "FundRequest/platform",
"id": "1ca8fdb873d32c0f21d0fdea21f2bf73f954db2f",
"size": "165",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "core/src/main/java/io/fundrequest/core/request/claim/domain/ClaimRequestStatus.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "256"
},
{
"name": "CSS",
"bytes": "136035"
},
{
"name": "Dockerfile",
"bytes": "730"
},
{
"name": "HTML",
"bytes": "142456"
},
{
"name": "Java",
"bytes": "1191313"
},
{
"name": "JavaScript",
"bytes": "14329"
},
{
"name": "SCSS",
"bytes": "115452"
},
{
"name": "Shell",
"bytes": "830"
},
{
"name": "TypeScript",
"bytes": "1156268"
},
{
"name": "Vue",
"bytes": "54843"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace CJia.PIVAS.Models.Label
{
/// <summary>
/// 瓶贴预览Model层
/// </summary>
public class LabelScenningModel : CJia.PIVAS.Tools.Model
{
/// <summary>
/// 查询瓶贴的扣费次数
/// </summary>
/// <param name="labelId"></param>
/// <returns></returns>
public string QueryLabelTimes(string labelId)
{
object[] paramers = new object[] { labelId };
string result = CJia.DefaultOleDb.QueryScalar(CJia.PIVAS.Models.Label.SqlTools.SqlLabelTimes, paramers);
if(string.IsNullOrEmpty(result))
{
result = "0";
}
return result;
}
/// <summary>
/// 查询所有病区
/// </summary>
/// <returns></returns>
public DataTable QueryAllIffield()
{
DataTable result = CJia.DefaultOleDb.Query(CJia.PIVAS.Models.Label.SqlTools.SqlQueryAllIffield);
return result;
}
/// <summary>
/// 查询所有批次
/// </summary>
/// <returns></returns>
public DataTable QueryAllBatch()
{
DataTable result = CJia.DefaultOleDb.Query(CJia.PIVAS.Models.Label.SqlTools.SqlQueryAllBacthLabel);
return result;
}
/// <summary>
/// 查询瓶贴列表
/// </summary>
/// <returns></returns>
public DataTable QueryLabelList(string grOrDr,string date, string scenningType, string iffieldID, string bacthID, string labelType, string longTemporary)
{
StringBuilder format = new StringBuilder("");
format.Append(" and spl.pharm_time between to_date('" + date + "','yyyy/mm/dd') and to_date('" + date + "','yyyy/mm/dd') + 1");
if(grOrDr == "0")
{
format.Append(" and spl.list_doctor_date between to_date('" + date + "','yyyy/mm/dd') and to_date('" + date + "','yyyy/mm/dd') + 1 ");
}
else
{
format.Append(" and spl.list_doctor_date < to_date('" + date + "','yyyy/mm/dd') ");
}
if(scenningType == "1000601")
{
format.Append(" and gb.status in (1000501,1000601,1000602,1000605) ");
}
else if(scenningType == "1000602")
{
format.Append(" and gb.status in (1000601,1000602,1000605) ");
}
else if(scenningType == "1000605")
{
format.Append(" and gb.status in (1000602,1000605) ");
}
format.Append(" and spl.illfield_id in (" + iffieldID + ") ");
format.Append(" and spl.batch_id in (" + bacthID + ") ");
string labelTypeStr = "";
if(labelType == "10")
{
labelTypeStr = " and 1 = 1 ";
}
else
{
labelTypeStr = " and fn_is_group(spl.group_index) = '" + labelType + "'";
}
object[] parms = new object[] { scenningType, longTemporary };
string sql = string.Format(CJia.PIVAS.Models.Label.SqlTools.SqlQueryPrintLableList, format.ToString(), labelTypeStr);
DataTable result = CJia.DefaultOleDb.Query(sql, parms);
return result;
}
/// <summary>
/// 根据条形码号 返回瓶贴信息
/// </summary>
/// <param name="barCode"></param>
/// <returns></returns>
public DataTable QueryBarCodeLabel(string barCode)
{
object[] paramers = new object[] { barCode };
DataTable result = CJia.DefaultOleDb.Query(CJia.PIVAS.Models.Label.SqlTools.SqlQueryBarCodeLable, paramers);
return result;
}
/// <summary>
/// 修改瓶贴状态
/// </summary>
/// <param name="barCode"></param>
/// <param name="status"></param>
public void UpdateBarCodeStatus(string barCode, string status, string userId, DateTime updateTime)
{
object[] paramers = new object[] { status, userId, updateTime, barCode };
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlUpdateBarCodeStatus, paramers);
if(status != "1000603")
{
paramers = new object[] { status, updateTime, userId, CJia.PIVAS.User.UserName, barCode };
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlUpdateBarCodeScanning, paramers);
}
}
/// <summary>
/// 从新打印瓶贴
/// </summary>
/// <param name="barCode"></param>
/// <returns></returns>
public DataTable AnewPrintLabel(string barCode, string userid)
{
string BarcodeSeq = CJia.DefaultOleDb.QueryScalar(CJia.PIVAS.Models.Label.SqlTools.SqlQueryBarcodeSeq);
object[] paramers = new object[] { BarcodeSeq, userid, CJia.PIVAS.Tools.Helper.Sysdate, barCode };
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlCopeBarCode, paramers);
this.UpdateBarCodeStatus(barCode, "1000603", userid, CJia.PIVAS.Tools.Helper.Sysdate);
paramers = new object[] { BarcodeSeq, barCode };
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlUpdateScanningBarID, paramers);
return this.QueryBarCodeLabel(BarcodeSeq);
}
/// <summary>
/// 确定瓶贴对应医嘱的有效状态
/// </summary>
/// <param name="barCode"></param>
/// <returns></returns>
public bool QueryLabelGroupIndex(string barCode)
{
object[] paramers = new object[] { barCode };
if(CJia.DefaultOleDb.QueryScalar(CJia.PIVAS.Models.Label.SqlTools.SqlQueryLabelGroupIndex, paramers) == "1")
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 拼贴作废
/// </summary>
/// <param name="barCode"></param>
/// <param name="userid"></param>
public void DelectPrintedLabel(string barCode, string userid)
{
object[] paramers = new object[] { userid, barCode };
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlDelectPrintedLabelByDarCode, paramers);
CJia.DefaultOleDb.Execute(CJia.PIVAS.Models.Label.SqlTools.SqlDelectLabelByDarCode, paramers);
}
/// <summary>
/// 打印瓶贴明细
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public DataTable QueryPrintLabelDetail(DateTime date, string labelType, string longTemporary,string grOrDr, string illfieldId, string bacthID)
{
string longTemporaryStr = "";
if(longTemporary == "10")
{
longTemporaryStr = " and 1 = 1 ";
}
else
{
longTemporaryStr = " and spl.LONG_TIME_STATUS = '" + longTemporary + "'";
}
string labelTypeStr = "";
if(labelType == "10")
{
labelTypeStr = " and 1 = 1 ";
}
else
{
labelTypeStr = " and fn_is_group(spl.group_index) = '" + labelType + "'";
}
string batchStr = "";
if(bacthID != "0")
{
batchStr = " and spl.batch_id = '" + bacthID + "' ";
}
else
{
batchStr = " and 1 = 1 ";
}
string strDrGr = "";
if(grOrDr == "0")
{
strDrGr = " and spl.list_doctor_date between to_date('" + date.ToString("yyyy/MM/dd") + "','yyyy/mm/dd') and to_date('" + date.ToString("yyyy/MM/dd") + "','yyyy/mm/dd') + 1 ";
}
else
{
strDrGr = " and spl.list_doctor_date < to_date('" + date.ToString("yyyy/MM/dd") + "','yyyy/mm/dd') ";
}
string sql = string.Format(CJia.PIVAS.Models.Label.SqlTools.QueryPrintLabelDetail, longTemporaryStr, labelTypeStr, batchStr, strDrGr);
object[] parames = new object[] { date, date.AddDays(1), illfieldId };
DataTable result = CJia.DefaultOleDb.Query(sql, parames);
return result;
}
}
}
| {
"content_hash": "1d6a6a425575b30ca69247fdbcc96c4b",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 191,
"avg_line_length": 37.742222222222225,
"alnum_prop": 0.5231983042863871,
"repo_name": "leborety/CJia",
"id": "1fa3f755bd56d519aa10b7933f216655a6c78e69",
"size": "8652",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CJia.PIVAS.JiuJiang/CJia.PIVAS/Models/Label/LabelScenningModel.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "654035"
},
{
"name": "C#",
"bytes": "11123595"
},
{
"name": "CSS",
"bytes": "142368"
},
{
"name": "JavaScript",
"bytes": "542484"
},
{
"name": "PHP",
"bytes": "2199"
},
{
"name": "Shell",
"bytes": "390"
}
],
"symlink_target": ""
} |
<?php
namespace App\Http\Controllers;
use App\Job;
use Illuminate\Http\Request;
use Response;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class JobController extends Controller {
public function __construct() {
$this->middleware('auth', [
'except' => [
'index',
'show',
],
]);
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index() {
$jobs = Job::all()->sortBy('name');
return response()->json($jobs);
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create() {
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request) {
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id) {
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id) {
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id) {
//
}
}
| {
"content_hash": "57ec5c4b2e05e161b8216a723351a887",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 56,
"avg_line_length": 17.881720430107528,
"alnum_prop": 0.5051112447384245,
"repo_name": "soywod/MAD",
"id": "c805ea8947c09043f6d490df41d96e2a31afd0cf",
"size": "1663",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Http/Controllers/JobController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "412"
},
{
"name": "HTML",
"bytes": "280999"
},
{
"name": "JavaScript",
"bytes": "24002"
},
{
"name": "PHP",
"bytes": "704426"
},
{
"name": "Shell",
"bytes": "511"
}
],
"symlink_target": ""
} |
import React from 'react';
import PrismFormatted from './prism-formatted';
import './challenge-description.css';
type Challenge = {
block?: string;
description?: string;
instructions?: string;
};
function ChallengeDescription(challenge: Challenge): JSX.Element {
return (
<div
className={`challenge-instructions${
challenge.block ? ' ' + challenge.block : ''
}`}
>
{challenge.description && <PrismFormatted text={challenge.description} />}
{challenge.instructions && (
<>
<hr />
<PrismFormatted text={challenge.instructions} />
</>
)}
<hr />
</div>
);
}
ChallengeDescription.displayName = 'ChallengeDescription';
export default ChallengeDescription;
| {
"content_hash": "2993bb07b2eea260c0cfc15a369a7443",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 22.939393939393938,
"alnum_prop": 0.631439894319683,
"repo_name": "FreeCodeCamp/FreeCodeCamp",
"id": "6f07d7f5668045a6c78878884e1a6bc01e1df2dc",
"size": "757",
"binary": false,
"copies": "2",
"ref": "refs/heads/i18n-sync-client",
"path": "client/src/templates/Challenges/components/Challenge-Description.tsx",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "190263"
},
{
"name": "HTML",
"bytes": "160430"
},
{
"name": "JavaScript",
"bytes": "546299"
}
],
"symlink_target": ""
} |
using System.Text;
using global::NLog.Targets;
using global::NLog.Layouts;
using global::NLog.Common;
using global::NLog;
using System.Net;
using System.Net.Sockets;
using global::NLog.LayoutRenderers;
namespace Tact.NLog.Targets
{
[Target("Log4JUdp")]
public class Log4JUdpTarget : TargetWithLayout
{
private readonly Socket _socket;
private readonly Log4JXmlEventLayoutRenderer _render;
private IPEndPoint _remoteEndPoint;
public Log4JUdpTarget()
{
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint localEP = new IPEndPoint(IPAddress.Any, 0);
_socket.Bind(localEP);
_render = new Log4JXmlEventLayoutRenderer();
}
public string Ip { get; set; } = "127.0.0.1";
public int Port { get; set; } = 7071;
protected override void Dispose(bool disposing)
{
_socket.Dispose();
base.Dispose(disposing);
}
protected override void InitializeTarget()
{
var ipAddress = IPAddress.Parse(Ip);
_remoteEndPoint = new IPEndPoint(ipAddress, Port);
base.InitializeTarget();
}
protected override void Write(AsyncLogEventInfo asyncLogEvent)
{
var logEvent = asyncLogEvent.LogEvent;
LogEventInfo renderedEvent;
if (Layout != null)
{
var message = Layout.Render(logEvent);
renderedEvent = new LogEventInfo(
logEvent.Level,
logEvent.LoggerName,
message);
}
else
renderedEvent = logEvent;
var renderedMessage = _render.Render(renderedEvent);
var bytes = Encoding.UTF8.GetBytes(renderedMessage);
_socket.SendTo(bytes, SocketFlags.None, _remoteEndPoint);
}
}
} | {
"content_hash": "e775002db49ff6fe102426c5f269dc4d",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 97,
"avg_line_length": 28.3,
"alnum_prop": 0.5840484603735487,
"repo_name": "tdupont750/tact.net",
"id": "15f6e5fcc66145b2649bd56390536a700ce51d20",
"size": "1983",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "framework/src/Tact.NLog/NLog/Targets/Log4JUdpTarget.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "114"
},
{
"name": "C#",
"bytes": "358753"
}
],
"symlink_target": ""
} |
namespace Google.Apis.Storagetransfer.v1
{
/// <summary>The Storagetransfer Service.</summary>
public class StoragetransferService : Google.Apis.Services.BaseClientService
{
/// <summary>The API version.</summary>
public const string Version = "v1";
/// <summary>The discovery version used to generate this service.</summary>
public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_1_0;
/// <summary>Constructs a new service.</summary>
public StoragetransferService() : this(new Google.Apis.Services.BaseClientService.Initializer())
{
}
/// <summary>Constructs a new service.</summary>
/// <param name="initializer">The service initializer.</param>
public StoragetransferService(Google.Apis.Services.BaseClientService.Initializer initializer) : base(initializer)
{
GoogleServiceAccounts = new GoogleServiceAccountsResource(this);
Projects = new ProjectsResource(this);
TransferJobs = new TransferJobsResource(this);
TransferOperations = new TransferOperationsResource(this);
}
/// <summary>Gets the service supported features.</summary>
public override System.Collections.Generic.IList<string> Features => new string[0];
/// <summary>Gets the service name.</summary>
public override string Name => "storagetransfer";
/// <summary>Gets the service base URI.</summary>
public override string BaseUri =>
#if NETSTANDARD1_3 || NETSTANDARD2_0 || NET45
BaseUriOverride ?? "https://storagetransfer.googleapis.com/";
#else
"https://storagetransfer.googleapis.com/";
#endif
/// <summary>Gets the service base path.</summary>
public override string BasePath => "";
#if !NET40
/// <summary>Gets the batch base URI; <c>null</c> if unspecified.</summary>
public override string BatchUri => "https://storagetransfer.googleapis.com/batch";
/// <summary>Gets the batch base path; <c>null</c> if unspecified.</summary>
public override string BatchPath => "batch";
#endif
/// <summary>Available OAuth 2.0 scopes for use with the Storage Transfer API.</summary>
public class Scope
{
/// <summary>
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google
/// Account.
/// </summary>
public static string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
}
/// <summary>Available OAuth 2.0 scope constants for use with the Storage Transfer API.</summary>
public static class ScopeConstants
{
/// <summary>
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google
/// Account.
/// </summary>
public const string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
}
/// <summary>Gets the GoogleServiceAccounts resource.</summary>
public virtual GoogleServiceAccountsResource GoogleServiceAccounts { get; }
/// <summary>Gets the Projects resource.</summary>
public virtual ProjectsResource Projects { get; }
/// <summary>Gets the TransferJobs resource.</summary>
public virtual TransferJobsResource TransferJobs { get; }
/// <summary>Gets the TransferOperations resource.</summary>
public virtual TransferOperationsResource TransferOperations { get; }
}
/// <summary>A base abstract class for Storagetransfer requests.</summary>
public abstract class StoragetransferBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse>
{
/// <summary>Constructs a new StoragetransferBaseServiceRequest instance.</summary>
protected StoragetransferBaseServiceRequest(Google.Apis.Services.IClientService service) : base(service)
{
}
/// <summary>V1 error format.</summary>
[Google.Apis.Util.RequestParameterAttribute("$.xgafv", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<XgafvEnum> Xgafv { get; set; }
/// <summary>V1 error format.</summary>
public enum XgafvEnum
{
/// <summary>v1 error format</summary>
[Google.Apis.Util.StringValueAttribute("1")]
Value1 = 0,
/// <summary>v2 error format</summary>
[Google.Apis.Util.StringValueAttribute("2")]
Value2 = 1,
}
/// <summary>OAuth access token.</summary>
[Google.Apis.Util.RequestParameterAttribute("access_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string AccessToken { get; set; }
/// <summary>Data format for response.</summary>
[Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<AltEnum> Alt { get; set; }
/// <summary>Data format for response.</summary>
public enum AltEnum
{
/// <summary>Responses with Content-Type of application/json</summary>
[Google.Apis.Util.StringValueAttribute("json")]
Json = 0,
/// <summary>Media download with context-dependent Content-Type</summary>
[Google.Apis.Util.StringValueAttribute("media")]
Media = 1,
/// <summary>Responses with Content-Type of application/x-protobuf</summary>
[Google.Apis.Util.StringValueAttribute("proto")]
Proto = 2,
}
/// <summary>JSONP</summary>
[Google.Apis.Util.RequestParameterAttribute("callback", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Callback { get; set; }
/// <summary>Selector specifying which fields to include in a partial response.</summary>
[Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Fields { get; set; }
/// <summary>
/// API key. Your API key identifies your project and provides you with API access, quota, and reports. Required
/// unless you provide an OAuth 2.0 token.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Key { get; set; }
/// <summary>OAuth 2.0 token for the current user.</summary>
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string OauthToken { get; set; }
/// <summary>Returns response with indentations and line breaks.</summary>
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<bool> PrettyPrint { get; set; }
/// <summary>
/// Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a
/// user, but should not exceed 40 characters.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
public virtual string QuotaUser { get; set; }
/// <summary>Legacy upload protocol for media (e.g. "media", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("uploadType", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadType { get; set; }
/// <summary>Upload protocol for media (e.g. "raw", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("upload_protocol", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadProtocol { get; set; }
/// <summary>Initializes Storagetransfer parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("$.xgafv", new Google.Apis.Discovery.Parameter
{
Name = "$.xgafv",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("access_token", new Google.Apis.Discovery.Parameter
{
Name = "access_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("alt", new Google.Apis.Discovery.Parameter
{
Name = "alt",
IsRequired = false,
ParameterType = "query",
DefaultValue = "json",
Pattern = null,
});
RequestParameters.Add("callback", new Google.Apis.Discovery.Parameter
{
Name = "callback",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("fields", new Google.Apis.Discovery.Parameter
{
Name = "fields",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("key", new Google.Apis.Discovery.Parameter
{
Name = "key",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("oauth_token", new Google.Apis.Discovery.Parameter
{
Name = "oauth_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("prettyPrint", new Google.Apis.Discovery.Parameter
{
Name = "prettyPrint",
IsRequired = false,
ParameterType = "query",
DefaultValue = "true",
Pattern = null,
});
RequestParameters.Add("quotaUser", new Google.Apis.Discovery.Parameter
{
Name = "quotaUser",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("uploadType", new Google.Apis.Discovery.Parameter
{
Name = "uploadType",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("upload_protocol", new Google.Apis.Discovery.Parameter
{
Name = "upload_protocol",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>The "googleServiceAccounts" collection of methods.</summary>
public class GoogleServiceAccountsResource
{
private const string Resource = "googleServiceAccounts";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public GoogleServiceAccountsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Returns the Google service account that is used by Storage Transfer Service to access buckets in the project
/// where transfers run or in other projects. Each Google service account is associated with one Google Cloud
/// project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to
/// Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only
/// be used by Storage Transfer Service.
/// </summary>
/// <param name="projectId">
/// Required. The ID of the Google Cloud project that the Google service account is associated with.
/// </param>
public virtual GetRequest Get(string projectId)
{
return new GetRequest(service, projectId);
}
/// <summary>
/// Returns the Google service account that is used by Storage Transfer Service to access buckets in the project
/// where transfers run or in other projects. Each Google service account is associated with one Google Cloud
/// project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to
/// Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only
/// be used by Storage Transfer Service.
/// </summary>
public class GetRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.GoogleServiceAccount>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string projectId) : base(service)
{
ProjectId = projectId;
InitParameters();
}
/// <summary>
/// Required. The ID of the Google Cloud project that the Google service account is associated with.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("projectId", Google.Apis.Util.RequestParameterType.Path)]
public virtual string ProjectId { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/googleServiceAccounts/{projectId}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("projectId", new Google.Apis.Discovery.Parameter
{
Name = "projectId",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>The "projects" collection of methods.</summary>
public class ProjectsResource
{
private const string Resource = "projects";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ProjectsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
AgentPools = new AgentPoolsResource(service);
}
/// <summary>Gets the AgentPools resource.</summary>
public virtual AgentPoolsResource AgentPools { get; }
/// <summary>The "agentPools" collection of methods.</summary>
public class AgentPoolsResource
{
private const string Resource = "agentPools";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public AgentPoolsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Creates an agent pool resource.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="projectId">Required. The ID of the Google Cloud project that owns the agent pool.</param>
public virtual CreateRequest Create(Google.Apis.Storagetransfer.v1.Data.AgentPool body, string projectId)
{
return new CreateRequest(service, body, projectId);
}
/// <summary>Creates an agent pool resource.</summary>
public class CreateRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.AgentPool>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.AgentPool body, string projectId) : base(service)
{
ProjectId = projectId;
Body = body;
InitParameters();
}
/// <summary>Required. The ID of the Google Cloud project that owns the agent pool.</summary>
[Google.Apis.Util.RequestParameterAttribute("projectId", Google.Apis.Util.RequestParameterType.Path)]
public virtual string ProjectId { get; private set; }
/// <summary>
/// Required. The ID of the agent pool to create. The `agent_pool_id` must meet the following
/// requirements: * Length of 128 characters or less. * Not start with the string `goog`. * Start with a
/// lowercase ASCII character, followed by: * Zero or more: lowercase Latin alphabet characters,
/// numerals, hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). * One or more numerals
/// or lowercase ASCII characters. As expressed by the regular expression:
/// `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("agentPoolId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string AgentPoolId { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.AgentPool Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/projects/{+projectId}/agentPools";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("projectId", new Google.Apis.Discovery.Parameter
{
Name = "projectId",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^[^/]+$",
});
RequestParameters.Add("agentPoolId", new Google.Apis.Discovery.Parameter
{
Name = "agentPoolId",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Deletes an agent pool.</summary>
/// <param name="name">Required. The name of the agent pool to delete.</param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes an agent pool.</summary>
public class DeleteRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the agent pool to delete.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/agentPools/[^/]+$",
});
}
}
/// <summary>Gets an agent pool.</summary>
/// <param name="name">Required. The name of the agent pool to get.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>Gets an agent pool.</summary>
public class GetRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.AgentPool>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the agent pool to get.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/agentPools/[^/]+$",
});
}
}
/// <summary>Lists agent pools.</summary>
/// <param name="projectId">Required. The ID of the Google Cloud project that owns the job.</param>
public virtual ListRequest List(string projectId)
{
return new ListRequest(service, projectId);
}
/// <summary>Lists agent pools.</summary>
public class ListRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.ListAgentPoolsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string projectId) : base(service)
{
ProjectId = projectId;
InitParameters();
}
/// <summary>Required. The ID of the Google Cloud project that owns the job.</summary>
[Google.Apis.Util.RequestParameterAttribute("projectId", Google.Apis.Util.RequestParameterType.Path)]
public virtual string ProjectId { get; private set; }
/// <summary>
/// An optional list of query parameters specified as JSON text in the form of:
/// `{"agentPoolNames":["agentpool1","agentpool2",...]}` Since `agentPoolNames` support multiple values,
/// its values must be specified with array notation. When the filter is either empty or not provided,
/// the list returns all agent pools for the project.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("filter", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Filter { get; set; }
/// <summary>The list page size. The max allowed value is `256`.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The list page token.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/projects/{+projectId}/agentPools";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("projectId", new Google.Apis.Discovery.Parameter
{
Name = "projectId",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^[^/]+$",
});
RequestParameters.Add("filter", new Google.Apis.Discovery.Parameter
{
Name = "filter",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Updates an existing agent pool resource.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// Required. Specifies a unique string that identifies the agent pool. Format:
/// `projects/{project_id}/agentPools/{agent_pool_id}`
/// </param>
public virtual PatchRequest Patch(Google.Apis.Storagetransfer.v1.Data.AgentPool body, string name)
{
return new PatchRequest(service, body, name);
}
/// <summary>Updates an existing agent pool resource.</summary>
public class PatchRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.AgentPool>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.AgentPool body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// Required. Specifies a unique string that identifies the agent pool. Format:
/// `projects/{project_id}/agentPools/{agent_pool_id}`
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// The [field mask] (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) of
/// the fields in `agentPool` to update in this request. The following `agentPool` fields can be
/// updated: * display_name * bandwidth_limit
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.AgentPool Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/agentPools/[^/]+$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
}
/// <summary>The "transferJobs" collection of methods.</summary>
public class TransferJobsResource
{
private const string Resource = "transferJobs";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public TransferJobsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Creates a transfer job that runs periodically.</summary>
/// <param name="body">The body of the request.</param>
public virtual CreateRequest Create(Google.Apis.Storagetransfer.v1.Data.TransferJob body)
{
return new CreateRequest(service, body);
}
/// <summary>Creates a transfer job that runs periodically.</summary>
public class CreateRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.TransferJob>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.TransferJob body) : base(service)
{
Body = body;
InitParameters();
}
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.TransferJob Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/transferJobs";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
}
}
/// <summary>Gets a transfer job.</summary>
/// <param name="jobName">Required. The job to get.</param>
/// <param name="projectId">Required. The ID of the Google Cloud project that owns the job.</param>
public virtual GetRequest Get(string jobName, string projectId)
{
return new GetRequest(service, jobName, projectId);
}
/// <summary>Gets a transfer job.</summary>
public class GetRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.TransferJob>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string jobName, string projectId) : base(service)
{
JobName = jobName;
ProjectId = projectId;
InitParameters();
}
/// <summary>Required. The job to get.</summary>
[Google.Apis.Util.RequestParameterAttribute("jobName", Google.Apis.Util.RequestParameterType.Path)]
public virtual string JobName { get; private set; }
/// <summary>Required. The ID of the Google Cloud project that owns the job.</summary>
[Google.Apis.Util.RequestParameterAttribute("projectId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string ProjectId { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+jobName}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("jobName", new Google.Apis.Discovery.Parameter
{
Name = "jobName",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferJobs/.*$",
});
RequestParameters.Add("projectId", new Google.Apis.Discovery.Parameter
{
Name = "projectId",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Lists transfer jobs.</summary>
/// <param name="filter">
/// Required. A list of query parameters specified as JSON text in the form of: `{"projectId":"my_project_id",
/// "jobNames":["jobid1","jobid2",...], "jobStatuses":["status1","status2",...]}` Since `jobNames` and
/// `jobStatuses` support multiple values, their values must be specified with array notation. `projectId` is
/// required. `jobNames` and `jobStatuses` are optional. The valid values for `jobStatuses` are
/// case-insensitive: ENABLED, DISABLED, and DELETED.
/// </param>
public virtual ListRequest List(string filter)
{
return new ListRequest(service, filter);
}
/// <summary>Lists transfer jobs.</summary>
public class ListRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.ListTransferJobsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string filter) : base(service)
{
Filter = filter;
InitParameters();
}
/// <summary>
/// Required. A list of query parameters specified as JSON text in the form of:
/// `{"projectId":"my_project_id", "jobNames":["jobid1","jobid2",...],
/// "jobStatuses":["status1","status2",...]}` Since `jobNames` and `jobStatuses` support multiple values,
/// their values must be specified with array notation. `projectId` is required. `jobNames` and
/// `jobStatuses` are optional. The valid values for `jobStatuses` are case-insensitive: ENABLED, DISABLED,
/// and DELETED.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("filter", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Filter { get; private set; }
/// <summary>The list page size. The max allowed value is 256.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The list page token.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/transferJobs";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("filter", new Google.Apis.Discovery.Parameter
{
Name = "filter",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running
/// already. **Note:** The job's status field can be modified using this RPC (for example, to set a job's status
/// to DELETED, DISABLED, or ENABLED).
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="jobName">Required. The name of job to update.</param>
public virtual PatchRequest Patch(Google.Apis.Storagetransfer.v1.Data.UpdateTransferJobRequest body, string jobName)
{
return new PatchRequest(service, body, jobName);
}
/// <summary>
/// Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running
/// already. **Note:** The job's status field can be modified using this RPC (for example, to set a job's status
/// to DELETED, DISABLED, or ENABLED).
/// </summary>
public class PatchRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.TransferJob>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.UpdateTransferJobRequest body, string jobName) : base(service)
{
JobName = jobName;
Body = body;
InitParameters();
}
/// <summary>Required. The name of job to update.</summary>
[Google.Apis.Util.RequestParameterAttribute("jobName", Google.Apis.Util.RequestParameterType.Path)]
public virtual string JobName { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.UpdateTransferJobRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+jobName}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("jobName", new Google.Apis.Discovery.Parameter
{
Name = "jobName",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferJobs/.*$",
});
}
}
/// <summary>
/// Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one
/// active TransferOperation. If this method is called while a TransferOperation is active, an error will be
/// returned.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="jobName">Required. The name of the transfer job.</param>
public virtual RunRequest Run(Google.Apis.Storagetransfer.v1.Data.RunTransferJobRequest body, string jobName)
{
return new RunRequest(service, body, jobName);
}
/// <summary>
/// Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one
/// active TransferOperation. If this method is called while a TransferOperation is active, an error will be
/// returned.
/// </summary>
public class RunRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Operation>
{
/// <summary>Constructs a new Run request.</summary>
public RunRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.RunTransferJobRequest body, string jobName) : base(service)
{
JobName = jobName;
Body = body;
InitParameters();
}
/// <summary>Required. The name of the transfer job.</summary>
[Google.Apis.Util.RequestParameterAttribute("jobName", Google.Apis.Util.RequestParameterType.Path)]
public virtual string JobName { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.RunTransferJobRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "run";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+jobName}:run";
/// <summary>Initializes Run parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("jobName", new Google.Apis.Discovery.Parameter
{
Name = "jobName",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferJobs/.*$",
});
}
}
}
/// <summary>The "transferOperations" collection of methods.</summary>
public class TransferOperationsResource
{
private const string Resource = "transferOperations";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public TransferOperationsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Cancels a transfer. Use the transferOperations.get method to check if the cancellation succeeded or if the
/// operation completed despite the `cancel` request. When you cancel an operation, the currently running
/// transfer is interrupted. For recurring transfer jobs, the next instance of the transfer job will still run.
/// For example, if your job is configured to run every day at 1pm and you cancel Monday's operation at 1:05pm,
/// Monday's transfer will stop. However, a transfer job will still be attempted on Tuesday. This applies only
/// to currently running operations. If an operation is not currently running, `cancel` does nothing. *Caution:*
/// Canceling a transfer job can leave your data in an unknown state. We recommend that you restore the state at
/// both the destination and the source after the `cancel` request completes so that your data is in a
/// consistent state. When you cancel a job, the next job computes a delta of files and may repair any
/// inconsistent state. For instance, if you run a job every day, and today's job found 10 new files and
/// transferred five files before you canceled the job, tomorrow's transfer operation will compute a new delta
/// with the five files that were not copied today plus any new files discovered tomorrow.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">The name of the operation resource to be cancelled.</param>
public virtual CancelRequest Cancel(Google.Apis.Storagetransfer.v1.Data.CancelOperationRequest body, string name)
{
return new CancelRequest(service, body, name);
}
/// <summary>
/// Cancels a transfer. Use the transferOperations.get method to check if the cancellation succeeded or if the
/// operation completed despite the `cancel` request. When you cancel an operation, the currently running
/// transfer is interrupted. For recurring transfer jobs, the next instance of the transfer job will still run.
/// For example, if your job is configured to run every day at 1pm and you cancel Monday's operation at 1:05pm,
/// Monday's transfer will stop. However, a transfer job will still be attempted on Tuesday. This applies only
/// to currently running operations. If an operation is not currently running, `cancel` does nothing. *Caution:*
/// Canceling a transfer job can leave your data in an unknown state. We recommend that you restore the state at
/// both the destination and the source after the `cancel` request completes so that your data is in a
/// consistent state. When you cancel a job, the next job computes a delta of files and may repair any
/// inconsistent state. For instance, if you run a job every day, and today's job found 10 new files and
/// transferred five files before you canceled the job, tomorrow's transfer operation will compute a new delta
/// with the five files that were not copied today plus any new files discovered tomorrow.
/// </summary>
public class CancelRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Empty>
{
/// <summary>Constructs a new Cancel request.</summary>
public CancelRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.CancelOperationRequest body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>The name of the operation resource to be cancelled.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.CancelOperationRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "cancel";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}:cancel";
/// <summary>Initializes Cancel parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferOperations/.*$",
});
}
}
/// <summary>
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result
/// at intervals as recommended by the API service.
/// </summary>
/// <param name="name">The name of the operation resource.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result
/// at intervals as recommended by the API service.
/// </summary>
public class GetRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Operation>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>The name of the operation resource.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferOperations/.*$",
});
}
}
/// <summary>
/// Lists transfer operations. Operations are ordered by their creation time in reverse chronological order.
/// </summary>
/// <param name="name">Required. The name of the type being listed; must be `transferOperations`.</param>
/// <param name="filter">
/// Required. A list of query parameters specified as JSON text in the form of: `{"projectId":"my_project_id",
/// "jobNames":["jobid1","jobid2",...], "operationNames":["opid1","opid2",...],
/// "transferStatuses":["status1","status2",...]}` Since `jobNames`, `operationNames`, and `transferStatuses`
/// support multiple values, they must be specified with array notation. `projectId` is required. `jobNames`,
/// `operationNames`, and `transferStatuses` are optional. The valid values for `transferStatuses` are
/// case-insensitive: IN_PROGRESS, PAUSED, SUCCESS, FAILED, and ABORTED.
/// </param>
public virtual ListRequest List(string name, string filter)
{
return new ListRequest(service, name, filter);
}
/// <summary>
/// Lists transfer operations. Operations are ordered by their creation time in reverse chronological order.
/// </summary>
public class ListRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.ListOperationsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string name, string filter) : base(service)
{
Name = name;
Filter = filter;
InitParameters();
}
/// <summary>Required. The name of the type being listed; must be `transferOperations`.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// Required. A list of query parameters specified as JSON text in the form of:
/// `{"projectId":"my_project_id", "jobNames":["jobid1","jobid2",...],
/// "operationNames":["opid1","opid2",...], "transferStatuses":["status1","status2",...]}` Since `jobNames`,
/// `operationNames`, and `transferStatuses` support multiple values, they must be specified with array
/// notation. `projectId` is required. `jobNames`, `operationNames`, and `transferStatuses` are optional.
/// The valid values for `transferStatuses` are case-insensitive: IN_PROGRESS, PAUSED, SUCCESS, FAILED, and
/// ABORTED.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("filter", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Filter { get; private set; }
/// <summary>The list page size. The max allowed value is 256.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The list page token.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferOperations$",
});
RequestParameters.Add("filter", new Google.Apis.Discovery.Parameter
{
Name = "filter",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Pauses a transfer operation.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">Required. The name of the transfer operation.</param>
public virtual PauseRequest Pause(Google.Apis.Storagetransfer.v1.Data.PauseTransferOperationRequest body, string name)
{
return new PauseRequest(service, body, name);
}
/// <summary>Pauses a transfer operation.</summary>
public class PauseRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Empty>
{
/// <summary>Constructs a new Pause request.</summary>
public PauseRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.PauseTransferOperationRequest body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>Required. The name of the transfer operation.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.PauseTransferOperationRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "pause";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}:pause";
/// <summary>Initializes Pause parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferOperations/.*$",
});
}
}
/// <summary>Resumes a transfer operation that is paused.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">Required. The name of the transfer operation.</param>
public virtual ResumeRequest Resume(Google.Apis.Storagetransfer.v1.Data.ResumeTransferOperationRequest body, string name)
{
return new ResumeRequest(service, body, name);
}
/// <summary>Resumes a transfer operation that is paused.</summary>
public class ResumeRequest : StoragetransferBaseServiceRequest<Google.Apis.Storagetransfer.v1.Data.Empty>
{
/// <summary>Constructs a new Resume request.</summary>
public ResumeRequest(Google.Apis.Services.IClientService service, Google.Apis.Storagetransfer.v1.Data.ResumeTransferOperationRequest body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>Required. The name of the transfer operation.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Storagetransfer.v1.Data.ResumeTransferOperationRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "resume";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1/{+name}:resume";
/// <summary>Initializes Resume parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^transferOperations/.*$",
});
}
}
}
}
namespace Google.Apis.Storagetransfer.v1.Data
{
/// <summary>Represents an On-Premises Agent pool.</summary>
public class AgentPool : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Specifies the bandwidth limit details. If this field is unspecified, the default value is set as 'No Limit'.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bandwidthLimit")]
public virtual BandwidthLimit BandwidthLimit { get; set; }
/// <summary>Specifies the client-specified AgentPool description.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("displayName")]
public virtual string DisplayName { get; set; }
/// <summary>
/// Required. Specifies a unique string that identifies the agent pool. Format:
/// `projects/{project_id}/agentPools/{agent_pool_id}`
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>Output only. Specifies the state of the AgentPool.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("state")]
public virtual string State { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// AWS access key (see [AWS Security
/// Credentials](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). For information on
/// our data retention policy for user credentials, see [User
/// credentials](/storage-transfer/docs/data-retention#user-credentials).
/// </summary>
public class AwsAccessKey : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required. AWS access key ID.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("accessKeyId")]
public virtual string AccessKeyId { get; set; }
/// <summary>Required. AWS secret access key. This field is not returned in RPC responses.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("secretAccessKey")]
public virtual string SecretAccessKey { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// An AwsS3Data resource can be a data source, but not a data sink. In an AwsS3Data resource, an object's name is
/// the S3 object's key name.
/// </summary>
public class AwsS3Data : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Input only. AWS access key used to sign the API requests to the AWS S3 bucket. Permissions on the bucket
/// must be granted to the access ID of the AWS access key. For information on our data retention policy for
/// user credentials, see [User credentials](/storage-transfer/docs/data-retention#user-credentials).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("awsAccessKey")]
public virtual AwsAccessKey AwsAccessKey { get; set; }
/// <summary>
/// Required. S3 Bucket name (see [Creating a
/// bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bucketName")]
public virtual string BucketName { get; set; }
/// <summary>
/// Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is
/// treated as an object prefix. As such, it should generally not begin with a '/'.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>
/// The Amazon Resource Name (ARN) of the role to support temporary credentials via `AssumeRoleWithWebIdentity`.
/// For more information about ARNs, see [IAM
/// ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). When a
/// role ARN is provided, Transfer Service fetches temporary credentials for the session using a
/// `AssumeRoleWithWebIdentity` call for the provided role using the GoogleServiceAccount for this project.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("roleArn")]
public virtual string RoleArn { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// An AzureBlobStorageData resource can be a data source, but not a data sink. An AzureBlobStorageData resource
/// represents one Azure container. The storage account determines the [Azure
/// endpoint](https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account#storage-account-endpoints).
/// In an AzureBlobStorageData resource, a blobs's name is the [Azure Blob Storage blob's key
/// name](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names).
/// </summary>
public class AzureBlobStorageData : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Required. Input only. Credentials used to authenticate API requests to Azure. For information on our data
/// retention policy for user credentials, see [User
/// credentials](/storage-transfer/docs/data-retention#user-credentials).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("azureCredentials")]
public virtual AzureCredentials AzureCredentials { get; set; }
/// <summary>Required. The container to transfer from the Azure Storage account.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("container")]
public virtual string Container { get; set; }
/// <summary>
/// Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is
/// treated as an object prefix. As such, it should generally not begin with a '/'.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>Required. The name of the Azure Storage account.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("storageAccount")]
public virtual string StorageAccount { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Azure credentials For information on our data retention policy for user credentials, see [User
/// credentials](/storage-transfer/docs/data-retention#user-credentials).
/// </summary>
public class AzureCredentials : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Required. Azure shared access signature (SAS). For more information about SAS, see [Grant limited access to
/// Azure Storage resources using shared access signatures
/// (SAS)](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("sasToken")]
public virtual string SasToken { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Specifies a bandwidth limit for an agent pool.</summary>
public class BandwidthLimit : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Bandwidth rate in megabytes per second, distributed across all the agents in the pool.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("limitMbps")]
public virtual System.Nullable<long> LimitMbps { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The request message for Operations.CancelOperation.</summary>
public class CancelOperationRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either
/// specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one
/// of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year
/// (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a
/// zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay *
/// google.type.DateTime * google.protobuf.Timestamp
/// </summary>
public class Date : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a
/// year and month where the day isn't significant.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("day")]
public virtual System.Nullable<int> Day { get; set; }
/// <summary>Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("month")]
public virtual System.Nullable<int> Month { get; set; }
/// <summary>Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("year")]
public virtual System.Nullable<int> Year { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical
/// example is to use it as the request or the response type of an API method. For instance: service Foo { rpc
/// Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
/// </summary>
public class Empty : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>An entry describing an error that has occurred.</summary>
public class ErrorLogEntry : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>A list of messages that carry the error details.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("errorDetails")]
public virtual System.Collections.Generic.IList<string> ErrorDetails { get; set; }
/// <summary>
/// Required. A URL that refers to the target (a data source, a data sink, or an object) with which the error is
/// associated.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("url")]
public virtual string Url { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A summary of errors by error code, plus a count and sample error log entries.</summary>
public class ErrorSummary : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("errorCode")]
public virtual string ErrorCode { get; set; }
/// <summary>Required. Count of this type of error.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("errorCount")]
public virtual System.Nullable<long> ErrorCount { get; set; }
/// <summary>
/// Error samples. At most 5 error log entries are recorded for a given error code for a single transfer
/// operation.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("errorLogEntries")]
public virtual System.Collections.Generic.IList<ErrorLogEntry> ErrorLogEntries { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// In a GcsData resource, an object's name is the Cloud Storage object's name and its "last modification time"
/// refers to the object's `updated` property of Cloud Storage objects, which changes when the content or the
/// metadata of the object is updated.
/// </summary>
public class GcsData : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Required. Cloud Storage bucket name. Must meet [Bucket Name
/// Requirements](/storage/docs/naming#requirements).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bucketName")]
public virtual string BucketName { get; set; }
/// <summary>
/// Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is
/// treated as an object prefix. As such, it should generally not begin with a '/'. The root path value must
/// meet [Object Name Requirements](/storage/docs/naming#objectnames).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Google service account</summary>
public class GoogleServiceAccount : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Email address of the service account.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("accountEmail")]
public virtual string AccountEmail { get; set; }
/// <summary>Unique identifier for the service account.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("subjectId")]
public virtual string SubjectId { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// An HttpData resource specifies a list of objects on the web to be transferred over HTTP. The information of the
/// objects to be transferred is contained in a file referenced by a URL. The first line in the file must be
/// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent lines specify the information of the
/// list of objects, one object per list entry. Each entry has the following tab-delimited fields: * **HTTP URL** —
/// The location of the object. * **Length** — The size of the object in bytes. * **MD5** — The base64-encoded MD5
/// hash of the object. For an example of a valid TSV file, see [Transferring data from
/// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). When transferring data based on a URL
/// list, keep the following in mind: * When an object located at `http(s)://hostname:port/` is transferred to a
/// data sink, the name of the object at the data sink is `/`. * If the specified size of an object does not match
/// the actual size of the object fetched, the object is not transferred. * If the specified MD5 does not match the
/// MD5 computed from the transferred bytes, the object transfer fails. * Ensure that each URL you specify is
/// publicly accessible. For example, in Cloud Storage you can [share an object publicly]
/// (/storage/docs/cloud-console#_sharingdata) and get a link to it. * Storage Transfer Service obeys `robots.txt`
/// rules and requires the source HTTP server to support `Range` requests and to return a `Content-Length` header in
/// each response. * ObjectConditions have no effect when filtering objects to transfer.
/// </summary>
public class HttpData : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Required. The URL that points to the file that stores the object list entries. This file must allow public
/// access. Currently, only URLs with HTTP and HTTPS schemes are supported.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("listUrl")]
public virtual string ListUrl { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Response from ListAgentPools.</summary>
public class ListAgentPoolsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>A list of agent pools.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("agentPools")]
public virtual System.Collections.Generic.IList<AgentPool> AgentPools { get; set; }
/// <summary>The list next page token.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The response message for Operations.ListOperations.</summary>
public class ListOperationsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The standard List next-page token.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>A list of operations that matches the specified filter in the request.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("operations")]
public virtual System.Collections.Generic.IList<Operation> Operations { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Response from ListTransferJobs.</summary>
public class ListTransferJobsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The list next page token.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>A list of transfer jobs.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferJobs")]
public virtual System.Collections.Generic.IList<TransferJob> TransferJobs { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Specifies the logging behavior for transfer operations. For cloud-to-cloud transfers, logs are sent to Cloud
/// Logging. See [Read transfer logs](https://cloud.google.com/storage-transfer/docs/read-transfer-logs) for
/// details. For transfers to or from a POSIX file system, logs are stored in the Cloud Storage bucket that is the
/// source or sink of the transfer. See [Managing Transfer for on-premises jobs]
/// (https://cloud.google.com/storage-transfer/docs/managing-on-prem-jobs#viewing-logs) for details.
/// </summary>
public class LoggingConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// For transfers with a PosixFilesystem source, this option enables the Cloud Storage transfer logs for this
/// transfer.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("enableOnpremGcsTransferLogs")]
public virtual System.Nullable<bool> EnableOnpremGcsTransferLogs { get; set; }
/// <summary>
/// States in which `log_actions` are logged. If empty, no logs are generated. Not supported for transfers with
/// PosixFilesystem data sources; use enable_onprem_gcs_transfer_logs instead.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("logActionStates")]
public virtual System.Collections.Generic.IList<string> LogActionStates { get; set; }
/// <summary>
/// Specifies the actions to be logged. If empty, no logs are generated. Not supported for transfers with
/// PosixFilesystem data sources; use enable_onprem_gcs_transfer_logs instead.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("logActions")]
public virtual System.Collections.Generic.IList<string> LogActions { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Specifies the metadata options for running a transfer.</summary>
public class MetadataOptions : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Specifies how each object's ACLs should be preserved for transfers between Google Cloud Storage buckets. If
/// unspecified, the default behavior is the same as ACL_DESTINATION_BUCKET_DEFAULT.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("acl")]
public virtual string Acl { get; set; }
/// <summary>
/// Specifies how each file's POSIX group ID (GID) attribute should be handled by the transfer. By default, GID
/// is not preserved. Only applicable to transfers involving POSIX file systems, and ignored for other
/// transfers.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("gid")]
public virtual string Gid { get; set; }
/// <summary>
/// Specifies how each object's Cloud KMS customer-managed encryption key (CMEK) is preserved for transfers
/// between Google Cloud Storage buckets. If unspecified, the default behavior is the same as
/// KMS_KEY_DESTINATION_BUCKET_DEFAULT.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("kmsKey")]
public virtual string KmsKey { get; set; }
/// <summary>
/// Specifies how each file's mode attribute should be handled by the transfer. By default, mode is not
/// preserved. Only applicable to transfers involving POSIX file systems, and ignored for other transfers.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("mode")]
public virtual string Mode { get; set; }
/// <summary>
/// Specifies the storage class to set on objects being transferred to Google Cloud Storage buckets. If
/// unspecified, the default behavior is the same as STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("storageClass")]
public virtual string StorageClass { get; set; }
/// <summary>
/// Specifies how symlinks should be handled by the transfer. By default, symlinks are not preserved. Only
/// applicable to transfers involving POSIX file systems, and ignored for other transfers.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("symlink")]
public virtual string Symlink { get; set; }
/// <summary>
/// Specifies how each object's temporary hold status should be preserved for transfers between Google Cloud
/// Storage buckets. If unspecified, the default behavior is the same as TEMPORARY_HOLD_PRESERVE.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("temporaryHold")]
public virtual string TemporaryHold { get; set; }
/// <summary>
/// Specifies how each object's `timeCreated` metadata is preserved for transfers between Google Cloud Storage
/// buckets. If unspecified, the default behavior is the same as TIME_CREATED_SKIP.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("timeCreated")]
public virtual string TimeCreated { get; set; }
/// <summary>
/// Specifies how each file's POSIX user ID (UID) attribute should be handled by the transfer. By default, UID
/// is not preserved. Only applicable to transfers involving POSIX file systems, and ignored for other
/// transfers.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("uid")]
public virtual string Uid { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Specification to configure notifications published to Pub/Sub. Notifications are published to the
/// customer-provided topic using the following `PubsubMessage.attributes`: * `"eventType"`: one of the EventType
/// values * `"payloadFormat"`: one of the PayloadFormat values * `"projectId"`: the project_id of the
/// `TransferOperation` * `"transferJobName"`: the transfer_job_name of the `TransferOperation` *
/// `"transferOperationName"`: the name of the `TransferOperation` The `PubsubMessage.data` contains a
/// TransferOperation resource formatted according to the specified `PayloadFormat`.
/// </summary>
public class NotificationConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Event types for which a notification is desired. If empty, send notifications for all event types.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("eventTypes")]
public virtual System.Collections.Generic.IList<string> EventTypes { get; set; }
/// <summary>Required. The desired format of the notification message payloads.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("payloadFormat")]
public virtual string PayloadFormat { get; set; }
/// <summary>
/// Required. The `Topic.name` of the Pub/Sub topic to which to publish notifications. Must be of the format:
/// `projects/{project}/topics/{topic}`. Not matching this format results in an INVALID_ARGUMENT error.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("pubsubTopic")]
public virtual string PubsubTopic { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Conditions that determine which objects are transferred. Applies only to Cloud Data Sources such as S3, Azure,
/// and Cloud Storage. The "last modification time" refers to the time of the last change to the object's content or
/// metadata — specifically, this is the `updated` property of Cloud Storage objects, the `LastModified` field of S3
/// objects, and the `Last-Modified` header of Azure blobs. Transfers with a PosixFilesystem source or destination
/// don't support `ObjectConditions`.
/// </summary>
public class ObjectConditions : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// If you specify `exclude_prefixes`, Storage Transfer Service uses the items in the `exclude_prefixes` array
/// to determine which objects to exclude from a transfer. Objects must not start with one of the matching
/// `exclude_prefixes` for inclusion in a transfer. The following are requirements of `exclude_prefixes`: * Each
/// exclude-prefix can contain any sequence of Unicode characters, to a max length of 1024 bytes when
/// UTF8-encoded, and must not contain Carriage Return or Line Feed characters. Wildcard matching and regular
/// expression matching are not supported. * Each exclude-prefix must omit the leading slash. For example, to
/// exclude the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, specify the exclude-prefix as
/// `logs/y=2015/requests.gz`. * None of the exclude-prefix values can be empty, if specified. * Each
/// exclude-prefix must exclude a distinct portion of the object namespace. No exclude-prefix may be a prefix of
/// another exclude-prefix. * If include_prefixes is specified, then each exclude-prefix must start with the
/// value of a path explicitly included by `include_prefixes`. The max size of `exclude_prefixes` is 1000. For
/// more information, see [Filtering objects from
/// transfers](/storage-transfer/docs/filtering-objects-from-transfers).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("excludePrefixes")]
public virtual System.Collections.Generic.IList<string> ExcludePrefixes { get; set; }
/// <summary>
/// If you specify `include_prefixes`, Storage Transfer Service uses the items in the `include_prefixes` array
/// to determine which objects to include in a transfer. Objects must start with one of the matching
/// `include_prefixes` for inclusion in the transfer. If exclude_prefixes is specified, objects must not start
/// with any of the `exclude_prefixes` specified for inclusion in the transfer. The following are requirements
/// of `include_prefixes`: * Each include-prefix can contain any sequence of Unicode characters, to a max length
/// of 1024 bytes when UTF8-encoded, and must not contain Carriage Return or Line Feed characters. Wildcard
/// matching and regular expression matching are not supported. * Each include-prefix must omit the leading
/// slash. For example, to include the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, specify the
/// include-prefix as `logs/y=2015/requests.gz`. * None of the include-prefix values can be empty, if specified.
/// * Each include-prefix must include a distinct portion of the object namespace. No include-prefix may be a
/// prefix of another include-prefix. The max size of `include_prefixes` is 1000. For more information, see
/// [Filtering objects from transfers](/storage-transfer/docs/filtering-objects-from-transfers).
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("includePrefixes")]
public virtual System.Collections.Generic.IList<string> IncludePrefixes { get; set; }
/// <summary>
/// If specified, only objects with a "last modification time" before this timestamp and objects that don't have
/// a "last modification time" are transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("lastModifiedBefore")]
public virtual object LastModifiedBefore { get; set; }
/// <summary>
/// If specified, only objects with a "last modification time" on or after this timestamp and objects that don't
/// have a "last modification time" are transferred. The `last_modified_since` and `last_modified_before` fields
/// can be used together for chunked data processing. For example, consider a script that processes each day's
/// worth of data at a time. For that you'd set each of the fields as follows: * `last_modified_since` to the
/// start of the day * `last_modified_before` to the end of the day
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("lastModifiedSince")]
public virtual object LastModifiedSince { get; set; }
/// <summary>
/// Ensures that objects are not transferred if a specific maximum time has elapsed since the "last modification
/// time". When a TransferOperation begins, objects with a "last modification time" are transferred only if the
/// elapsed time between the start_time of the `TransferOperation`and the "last modification time" of the object
/// is less than the value of max_time_elapsed_since_last_modification`. Objects that do not have a "last
/// modification time" are also transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("maxTimeElapsedSinceLastModification")]
public virtual object MaxTimeElapsedSinceLastModification { get; set; }
/// <summary>
/// Ensures that objects are not transferred until a specific minimum time has elapsed after the "last
/// modification time". When a TransferOperation begins, objects with a "last modification time" are transferred
/// only if the elapsed time between the start_time of the `TransferOperation` and the "last modification time"
/// of the object is equal to or greater than the value of min_time_elapsed_since_last_modification`. Objects
/// that do not have a "last modification time" are also transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("minTimeElapsedSinceLastModification")]
public virtual object MinTimeElapsedSinceLastModification { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>This resource represents a long-running operation that is the result of a network API call.</summary>
public class Operation : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed,
/// and either `error` or `response` is available.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("done")]
public virtual System.Nullable<bool> Done { get; set; }
/// <summary>The error result of the operation in case of failure or cancellation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("error")]
public virtual Status Error { get; set; }
/// <summary>
/// Represents the transfer operation object. To request a TransferOperation object, use transferOperations.get.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("metadata")]
public virtual System.Collections.Generic.IDictionary<string, object> Metadata { get; set; }
/// <summary>
/// The server-assigned unique name. The format of `name` is `transferOperations/some/unique/name`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>
/// The normal response of the operation in case of success. If the original method returns no data on success,
/// such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard
/// `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have
/// the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is
/// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("response")]
public virtual System.Collections.Generic.IDictionary<string, object> Response { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Request passed to PauseTransferOperation.</summary>
public class PauseTransferOperationRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A POSIX filesystem resource.</summary>
public class PosixFilesystem : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Root directory path to the filesystem.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("rootDirectory")]
public virtual string RootDirectory { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Request passed to ResumeTransferOperation.</summary>
public class ResumeTransferOperationRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Request passed to RunTransferJob.</summary>
public class RunTransferJobRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required. The ID of the Google Cloud project that owns the transfer job.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("projectId")]
public virtual string ProjectId { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Transfers can be scheduled to recur or to run just once.</summary>
public class Schedule : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The time in UTC that no further transfer operations are scheduled. Combined with schedule_end_date,
/// `end_time_of_day` specifies the end date and time for starting new transfer operations. This field must be
/// greater than or equal to the timestamp corresponding to the combintation of schedule_start_date and
/// start_time_of_day, and is subject to the following: * If `end_time_of_day` is not set and
/// `schedule_end_date` is set, then a default value of `23:59:59` is used for `end_time_of_day`. * If
/// `end_time_of_day` is set and `schedule_end_date` is not set, then INVALID_ARGUMENT is returned.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("endTimeOfDay")]
public virtual TimeOfDay EndTimeOfDay { get; set; }
/// <summary>
/// Interval between the start of each scheduled TransferOperation. If unspecified, the default value is 24
/// hours. This value may not be less than 1 hour.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("repeatInterval")]
public virtual object RepeatInterval { get; set; }
/// <summary>
/// The last day a transfer runs. Date boundaries are determined relative to UTC time. A job runs once per 24
/// hours within the following guidelines: * If `schedule_end_date` and schedule_start_date are the same and in
/// the future relative to UTC, the transfer is executed only one time. * If `schedule_end_date` is later than
/// `schedule_start_date` and `schedule_end_date` is in the future relative to UTC, the job runs each day at
/// start_time_of_day through `schedule_end_date`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("scheduleEndDate")]
public virtual Date ScheduleEndDate { get; set; }
/// <summary>
/// Required. The start date of a transfer. Date boundaries are determined relative to UTC time. If
/// `schedule_start_date` and start_time_of_day are in the past relative to the job's creation time, the
/// transfer starts the day after you schedule the transfer request. **Note:** When starting jobs at or near
/// midnight UTC it is possible that a job starts later than expected. For example, if you send an outbound
/// request on June 1 one millisecond prior to midnight UTC and the Storage Transfer Service server receives the
/// request on June 2, then it creates a TransferJob with `schedule_start_date` set to June 2 and a
/// `start_time_of_day` set to midnight UTC. The first scheduled TransferOperation takes place on June 3 at
/// midnight UTC.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("scheduleStartDate")]
public virtual Date ScheduleStartDate { get; set; }
/// <summary>
/// The time in UTC that a transfer job is scheduled to run. Transfers may start later than this time. If
/// `start_time_of_day` is not specified: * One-time transfers run immediately. * Recurring transfers run
/// immediately, and each day at midnight UTC, through schedule_end_date. If `start_time_of_day` is specified: *
/// One-time transfers run at the specified time. * Recurring transfers run at the specified time each day,
/// through `schedule_end_date`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("startTimeOfDay")]
public virtual TimeOfDay StartTimeOfDay { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// The `Status` type defines a logical error model that is suitable for different programming environments,
/// including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains
/// three pieces of data: error code, error message, and error details. You can find out more about this error model
/// and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
/// </summary>
public class Status : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The status code, which should be an enum value of google.rpc.Code.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("code")]
public virtual System.Nullable<int> Code { get; set; }
/// <summary>
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("details")]
public virtual System.Collections.Generic.IList<System.Collections.Generic.IDictionary<string, object>> Details { get; set; }
/// <summary>
/// A developer-facing error message, which should be in English. Any user-facing error message should be
/// localized and sent in the google.rpc.Status.details field, or localized by the client.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("message")]
public virtual string Message { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API
/// may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
/// </summary>
public class TimeOfDay : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value "24:00:00" for
/// scenarios like business closing time.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("hours")]
public virtual System.Nullable<int> Hours { get; set; }
/// <summary>Minutes of hour of day. Must be from 0 to 59.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("minutes")]
public virtual System.Nullable<int> Minutes { get; set; }
/// <summary>Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nanos")]
public virtual System.Nullable<int> Nanos { get; set; }
/// <summary>
/// Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows
/// leap-seconds.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("seconds")]
public virtual System.Nullable<int> Seconds { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A collection of counters that report the progress of a transfer operation.</summary>
public class TransferCounters : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Bytes that are copied to the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesCopiedToSink")]
public virtual System.Nullable<long> BytesCopiedToSink { get; set; }
/// <summary>Bytes that are deleted from the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesDeletedFromSink")]
public virtual System.Nullable<long> BytesDeletedFromSink { get; set; }
/// <summary>Bytes that are deleted from the data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesDeletedFromSource")]
public virtual System.Nullable<long> BytesDeletedFromSource { get; set; }
/// <summary>Bytes that failed to be deleted from the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesFailedToDeleteFromSink")]
public virtual System.Nullable<long> BytesFailedToDeleteFromSink { get; set; }
/// <summary>
/// Bytes found in the data source that are scheduled to be transferred, excluding any that are filtered based
/// on object conditions or skipped due to sync.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesFoundFromSource")]
public virtual System.Nullable<long> BytesFoundFromSource { get; set; }
/// <summary>Bytes found only in the data sink that are scheduled to be deleted.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesFoundOnlyFromSink")]
public virtual System.Nullable<long> BytesFoundOnlyFromSink { get; set; }
/// <summary>
/// Bytes in the data source that failed to be transferred or that failed to be deleted after being transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesFromSourceFailed")]
public virtual System.Nullable<long> BytesFromSourceFailed { get; set; }
/// <summary>
/// Bytes in the data source that are not transferred because they already exist in the data sink.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("bytesFromSourceSkippedBySync")]
public virtual System.Nullable<long> BytesFromSourceSkippedBySync { get; set; }
/// <summary>
/// For transfers involving PosixFilesystem only. Number of listing failures for each directory found at the
/// source. Potential failures when listing a directory include permission failure or block failure. If listing
/// a directory fails, no files in the directory are transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("directoriesFailedToListFromSource")]
public virtual System.Nullable<long> DirectoriesFailedToListFromSource { get; set; }
/// <summary>
/// For transfers involving PosixFilesystem only. Number of directories found while listing. For example, if the
/// root directory of the transfer is `base/` and there are two other directories, `a/` and `b/` under this
/// directory, the count after listing `base/`, `base/a/` and `base/b/` is 3.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("directoriesFoundFromSource")]
public virtual System.Nullable<long> DirectoriesFoundFromSource { get; set; }
/// <summary>
/// For transfers involving PosixFilesystem only. Number of successful listings for each directory found at the
/// source.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("directoriesSuccessfullyListedFromSource")]
public virtual System.Nullable<long> DirectoriesSuccessfullyListedFromSource { get; set; }
/// <summary>Number of successfully cleaned up intermediate objects.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("intermediateObjectsCleanedUp")]
public virtual System.Nullable<long> IntermediateObjectsCleanedUp { get; set; }
/// <summary>Number of intermediate objects failed cleaned up.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("intermediateObjectsFailedCleanedUp")]
public virtual System.Nullable<long> IntermediateObjectsFailedCleanedUp { get; set; }
/// <summary>Objects that are copied to the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsCopiedToSink")]
public virtual System.Nullable<long> ObjectsCopiedToSink { get; set; }
/// <summary>Objects that are deleted from the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsDeletedFromSink")]
public virtual System.Nullable<long> ObjectsDeletedFromSink { get; set; }
/// <summary>Objects that are deleted from the data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsDeletedFromSource")]
public virtual System.Nullable<long> ObjectsDeletedFromSource { get; set; }
/// <summary>Objects that failed to be deleted from the data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsFailedToDeleteFromSink")]
public virtual System.Nullable<long> ObjectsFailedToDeleteFromSink { get; set; }
/// <summary>
/// Objects found in the data source that are scheduled to be transferred, excluding any that are filtered based
/// on object conditions or skipped due to sync.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsFoundFromSource")]
public virtual System.Nullable<long> ObjectsFoundFromSource { get; set; }
/// <summary>Objects found only in the data sink that are scheduled to be deleted.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsFoundOnlyFromSink")]
public virtual System.Nullable<long> ObjectsFoundOnlyFromSink { get; set; }
/// <summary>
/// Objects in the data source that failed to be transferred or that failed to be deleted after being
/// transferred.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsFromSourceFailed")]
public virtual System.Nullable<long> ObjectsFromSourceFailed { get; set; }
/// <summary>
/// Objects in the data source that are not transferred because they already exist in the data sink.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectsFromSourceSkippedBySync")]
public virtual System.Nullable<long> ObjectsFromSourceSkippedBySync { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>This resource represents the configuration of a transfer job that runs periodically.</summary>
public class TransferJob : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Output only. The time that the transfer job was created.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("creationTime")]
public virtual object CreationTime { get; set; }
/// <summary>Output only. The time that the transfer job was deleted.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("deletionTime")]
public virtual object DeletionTime { get; set; }
/// <summary>
/// A description provided by the user for the job. Its max length is 1024 bytes when Unicode-encoded.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("description")]
public virtual string Description { get; set; }
/// <summary>Output only. The time that the transfer job was last modified.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("lastModificationTime")]
public virtual object LastModificationTime { get; set; }
/// <summary>
/// The name of the most recently started TransferOperation of this JobConfig. Present if a TransferOperation
/// has been created for this JobConfig.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("latestOperationName")]
public virtual string LatestOperationName { get; set; }
/// <summary>Logging configuration.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("loggingConfig")]
public virtual LoggingConfig LoggingConfig { get; set; }
/// <summary>
/// A unique name (within the transfer project) assigned when the job is created. If this field is empty in a
/// CreateTransferJobRequest, Storage Transfer Service assigns a unique name. Otherwise, the specified name is
/// used as the unique name for this job. If the specified name is in use by a job, the creation request fails
/// with an ALREADY_EXISTS error. This name must start with `"transferJobs/"` prefix and end with a letter or a
/// number, and should be no more than 128 characters. For transfers involving PosixFilesystem, this name must
/// start with `transferJobs/OPI` specifically. For all other transfer types, this name must not start with
/// `transferJobs/OPI`. Non-PosixFilesystem example: `"transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$"`
/// PosixFilesystem example: `"transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$"` Applications must not rely on the
/// enforcement of naming requirements involving OPI. Invalid job names fail with an INVALID_ARGUMENT error.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>
/// Notification configuration. This is not supported for transfers involving PosixFilesystem.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("notificationConfig")]
public virtual NotificationConfig NotificationConfig { get; set; }
/// <summary>The ID of the Google Cloud project that owns the job.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("projectId")]
public virtual string ProjectId { get; set; }
/// <summary>
/// Specifies schedule for the transfer job. This is an optional field. When the field is not set, the job never
/// executes a transfer, unless you invoke RunTransferJob or update the job to have a non-empty schedule.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("schedule")]
public virtual Schedule Schedule { get; set; }
/// <summary>
/// Status of the job. This value MUST be specified for `CreateTransferJobRequests`. **Note:** The effect of the
/// new job status takes place during a subsequent job run. For example, if you change the job status from
/// ENABLED to DISABLED, and an operation spawned by the transfer is running, the status change would not affect
/// the current operation.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("status")]
public virtual string Status { get; set; }
/// <summary>Transfer specification.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferSpec")]
public virtual TransferSpec TransferSpec { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Specifies where the manifest is located.</summary>
public class TransferManifest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Specifies the path to the manifest in Cloud Storage. The Google-managed service account for the transfer
/// must have `storage.objects.get` permission for this object. An example path is
/// `gs://bucket_name/path/manifest.csv`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("location")]
public virtual string Location { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A description of the execution of a transfer.</summary>
public class TransferOperation : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Information about the progress of the transfer operation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("counters")]
public virtual TransferCounters Counters { get; set; }
/// <summary>End time of this transfer execution.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("endTime")]
public virtual object EndTime { get; set; }
/// <summary>Summarizes errors encountered with sample error log entries.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("errorBreakdowns")]
public virtual System.Collections.Generic.IList<ErrorSummary> ErrorBreakdowns { get; set; }
/// <summary>A globally unique ID assigned by the system.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>Notification configuration.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("notificationConfig")]
public virtual NotificationConfig NotificationConfig { get; set; }
/// <summary>The ID of the Google Cloud project that owns the operation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("projectId")]
public virtual string ProjectId { get; set; }
/// <summary>Start time of this transfer execution.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("startTime")]
public virtual object StartTime { get; set; }
/// <summary>Status of the transfer operation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("status")]
public virtual string Status { get; set; }
/// <summary>The name of the transfer job that triggers this transfer operation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferJobName")]
public virtual string TransferJobName { get; set; }
/// <summary>Transfer specification.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferSpec")]
public virtual TransferSpec TransferSpec { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>TransferOptions define the actions to be performed on objects in a transfer.</summary>
public class TransferOptions : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Whether objects should be deleted from the source after they are transferred to the sink. **Note:** This
/// option and delete_objects_unique_in_sink are mutually exclusive.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("deleteObjectsFromSourceAfterTransfer")]
public virtual System.Nullable<bool> DeleteObjectsFromSourceAfterTransfer { get; set; }
/// <summary>
/// Whether objects that exist only in the sink should be deleted. **Note:** This option and
/// delete_objects_from_source_after_transfer are mutually exclusive.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("deleteObjectsUniqueInSink")]
public virtual System.Nullable<bool> DeleteObjectsUniqueInSink { get; set; }
/// <summary>Represents the selected metadata options for a transfer job. This feature is in Preview.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("metadataOptions")]
public virtual MetadataOptions MetadataOptions { get; set; }
/// <summary>
/// When to overwrite objects that already exist in the sink. The default is that only objects that are
/// different from the source are ovewritten. If true, all objects in the sink whose name matches an object in
/// the source are overwritten with the source object.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("overwriteObjectsAlreadyExistingInSink")]
public virtual System.Nullable<bool> OverwriteObjectsAlreadyExistingInSink { get; set; }
/// <summary>
/// When to overwrite objects that already exist in the sink. If not set, overwrite behavior is determined by
/// overwrite_objects_already_existing_in_sink.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("overwriteWhen")]
public virtual string OverwriteWhen { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Configuration for running a transfer.</summary>
public class TransferSpec : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>An AWS S3 data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("awsS3DataSource")]
public virtual AwsS3Data AwsS3DataSource { get; set; }
/// <summary>An Azure Blob Storage data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("azureBlobStorageDataSource")]
public virtual AzureBlobStorageData AzureBlobStorageDataSource { get; set; }
/// <summary>A Cloud Storage data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("gcsDataSink")]
public virtual GcsData GcsDataSink { get; set; }
/// <summary>A Cloud Storage data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("gcsDataSource")]
public virtual GcsData GcsDataSource { get; set; }
/// <summary>Cloud Storage intermediate data location.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("gcsIntermediateDataLocation")]
public virtual GcsData GcsIntermediateDataLocation { get; set; }
/// <summary>An HTTP URL data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("httpDataSource")]
public virtual HttpData HttpDataSource { get; set; }
/// <summary>
/// Only objects that satisfy these object conditions are included in the set of data source and data sink
/// objects. Object conditions based on objects' "last modification time" do not exclude objects in a data sink.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("objectConditions")]
public virtual ObjectConditions ObjectConditions { get; set; }
/// <summary>A POSIX Filesystem data sink.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("posixDataSink")]
public virtual PosixFilesystem PosixDataSink { get; set; }
/// <summary>A POSIX Filesystem data source.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("posixDataSource")]
public virtual PosixFilesystem PosixDataSource { get; set; }
/// <summary>
/// Specifies the agent pool name associated with the posix data sink. When unspecified, the default name is
/// used.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("sinkAgentPoolName")]
public virtual string SinkAgentPoolName { get; set; }
/// <summary>
/// Specifies the agent pool name associated with the posix data source. When unspecified, the default name is
/// used.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("sourceAgentPoolName")]
public virtual string SourceAgentPoolName { get; set; }
/// <summary>
/// A manifest file provides a list of objects to be transferred from the data source. This field points to the
/// location of the manifest file. Otherwise, the entire source bucket is used. ObjectConditions still apply.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferManifest")]
public virtual TransferManifest TransferManifest { get; set; }
/// <summary>
/// If the option delete_objects_unique_in_sink is `true` and time-based object conditions such as 'last
/// modification time' are specified, the request fails with an INVALID_ARGUMENT error.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferOptions")]
public virtual TransferOptions TransferOptions { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Request passed to UpdateTransferJob.</summary>
public class UpdateTransferJobRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required. The ID of the Google Cloud project that owns the job.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("projectId")]
public virtual string ProjectId { get; set; }
/// <summary>
/// Required. The job to update. `transferJob` is expected to specify one or more of five fields: description,
/// transfer_spec, notification_config, logging_config, and status. An `UpdateTransferJobRequest` that specifies
/// other fields are rejected with the error INVALID_ARGUMENT. Updating a job status to DELETED requires
/// `storagetransfer.jobs.delete` permissions.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("transferJob")]
public virtual TransferJob TransferJob { get; set; }
/// <summary>
/// The field mask of the fields in `transferJob` that are to be updated in this request. Fields in
/// `transferJob` that can be updated are: description, transfer_spec, notification_config, logging_config, and
/// status. To update the `transfer_spec` of the job, a complete transfer specification must be provided. An
/// incomplete specification missing any required fields is rejected with the error INVALID_ARGUMENT.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("updateTransferJobFieldMask")]
public virtual object UpdateTransferJobFieldMask { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
}
| {
"content_hash": "9346373724f3187d9f7a1e0cc78cf5ad",
"timestamp": "",
"source": "github",
"line_count": 2548,
"max_line_length": 179,
"avg_line_length": 50.98822605965463,
"alnum_prop": 0.6253790852691697,
"repo_name": "jskeet/google-api-dotnet-client",
"id": "19336840263b90487a515d1ef5a9a8dd486011d4",
"size": "130548",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "Src/Generated/Google.Apis.Storagetransfer.v1/Google.Apis.Storagetransfer.v1.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "154"
},
{
"name": "C#",
"bytes": "93201662"
},
{
"name": "HTML",
"bytes": "16925"
},
{
"name": "Shell",
"bytes": "17135"
}
],
"symlink_target": ""
} |
#if defined(USE_TI_UIIOSTOOLBAR) || defined(USE_TI_UITOOLBAR)
#import "TiUIiOSToolbar.h"
#import "TiViewProxy.h"
#import "TiUtils.h"
#import "TiColor.h"
#import "TiToolbarButton.h"
#import "TiToolbar.h"
#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_4_0
@interface TiUIiOSToolbar (laterMethods)
@property(nonatomic) CGFloat contentScaleFactor;
@end
#endif
@implementation TiUIiOSToolbar
-(void)dealloc
{
[self performSelector:@selector(setItems_:) withObject:nil];
RELEASE_TO_NIL(toolBar);
[super dealloc];
}
-(UIToolbar *)toolBar
{
if (toolBar == nil)
{
toolBar = [[UIToolbar alloc] initWithFrame:[self bounds]];
[toolBar setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin];
[self addSubview:toolBar];
[self setClipsToBounds:YES];
}
return toolBar;
}
-(void)layoutSubviews
{
CGRect ourBounds = [self bounds];
CGFloat height = ourBounds.size.height;
if (height != [self verifyHeight:height])
{
[(TiViewProxy *)[self proxy] willChangeSize];
return;
}
CGRect toolBounds;
toolBounds.size = [[self toolBar] sizeThatFits:ourBounds.size];
toolBounds.origin.x = 0.0;
toolBounds.origin.y = hideTopBorder?-1.0:0.0;
[toolBar setFrame:toolBounds];
}
-(void)drawRect:(CGRect)rect
{
[super drawRect:rect];
if (!showBottomBorder)
{
return;
}
CGRect toolFrame = [self bounds];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetGrayStrokeColor(context, 0.0, 1.0);
CGContextSetLineWidth(context, 1.0);
CGContextSetShouldAntialias(context,false);
CGPoint bottomBorder[2];
CGFloat x = toolFrame.origin.x;
CGFloat y = toolFrame.origin.y+toolFrame.size.height;
if ([self respondsToSelector:@selector(contentScaleFactor)] && [self contentScaleFactor] > 1.0)
{ //Yes, this seems very hackish. Very low priority would be to use something more elegant.
y -= 0.5;
}
bottomBorder[0]=CGPointMake(x,y);
x += toolFrame.size.width;
bottomBorder[1]=CGPointMake(x,y);
CGContextStrokeLineSegments(context,bottomBorder,2);
}
-(void)setItems_:(id)value
{
ENSURE_TYPE_OR_NIL(value,NSArray);
if (value!=nil)
{
NSMutableArray * result = [NSMutableArray arrayWithCapacity:[value count]];
Class proxyClass = [TiViewProxy class];
for (TiViewProxy * thisProxy in value) {
ENSURE_CLASS(thisProxy,proxyClass);
if (![thisProxy supportsNavBarPositioning])
{
//TODO: This is an exception that should have been raised long ago.
NSLog(@"[ERROR] %@ does not support being in a toolbar!",thisProxy);
//continue;
}
if ([thisProxy conformsToProtocol:@protocol(TiToolbarButton)])
{
[(id<TiToolbarButton>)thisProxy setToolbar:(TiToolbar*)self.proxy];
}
[thisProxy windowWillOpen];
[result addObject:[thisProxy barButtonItem]];
[thisProxy windowDidOpen];
}
[[self toolBar] setItems:result];
}
else
{
UIToolbar *toolbar = [self toolBar];
if (toolbar!=nil)
{
for (id thisProxy in [toolbar items])
{
if ([thisProxy conformsToProtocol:@protocol(TiToolbarButton)])
{
[(id<TiToolbarButton>)thisProxy setToolbar:nil];
}
}
}
[toolbar setItems:nil];
}
}
-(void)setBorderTop_:(id)value
{
hideTopBorder = ![TiUtils boolValue:value def:YES];
[(TiViewProxy *)[self proxy] willChangeSize];
//The default is that a top border exists.
}
-(void)setBorderBottom_:(id)value
{
showBottomBorder = [TiUtils boolValue:value def:NO];
[(TiViewProxy *)[self proxy] willChangeSize];
//The default is that there is no bottom border.
}
-(void)setBarColor_:(id)value
{
TiColor * newBarColor = [TiUtils colorValue:value];
[[self toolBar] setBarStyle:[TiUtils barStyleForColor:newBarColor]];
[toolBar setTintColor:[TiUtils barColorForColor:newBarColor]];
[toolBar setTranslucent:[TiUtils barTranslucencyForColor:newBarColor]];
}
-(void)setTranslucent_:(id)value
{
[toolBar setTranslucent:[TiUtils boolValue:value]];
}
-(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
[super frameSizeChanged:frame bounds:bounds];
CGFloat height = bounds.size.height;
if (height != [self verifyHeight:height])
{
[(TiViewProxy *)[self proxy] willChangeSize];
}
}
-(CGFloat)verifyHeight:(CGFloat)suggestedHeight
{
CGFloat result = [[self toolBar] sizeThatFits:CGSizeZero].height;
if (hideTopBorder)
{
result -= 1.0;
}
if (showBottomBorder)
{
result += 1.0;
}
return result;
}
@end
#endif
| {
"content_hash": "97e538829c9e5cd21f05d54bdbb65e36",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 103,
"avg_line_length": 23.518716577540108,
"alnum_prop": 0.7164620281946339,
"repo_name": "QGao/toolbarStyle",
"id": "f3f92db4a7a52bb40e5f1d6ae97849e186c147f5",
"size": "4720",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "build/iphone/Classes/TiUIiOSToolbar.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "176465"
},
{
"name": "C++",
"bytes": "47528"
},
{
"name": "D",
"bytes": "711299"
},
{
"name": "JavaScript",
"bytes": "2061"
},
{
"name": "Objective-C",
"bytes": "2964859"
},
{
"name": "Shell",
"bytes": "148"
}
],
"symlink_target": ""
} |
import logging
import random
from base64 import b64encode
from typing import Dict, Union
import src.messages.messages_pb2 as pb
from src.utils import Replay, Handled, dictionary_hash
from .bracha import Bracha
from .mo14 import Mo14
class ACS(object):
def __init__(self, factory):
self._factory = factory
self._round = -1 # type: int
self._done = False
# the following are initialised at start
self._brachas = {} # type: Dict[str, Bracha]
self._mo14s = {} # type: Dict[str, Mo14]
self._bracha_results = {} # type: Dict[str, str]
self._mo14_results = {} # type: Dict[str, int]
self._mo14_provided = {} # type: Dict[str, int]
def reset(self):
"""
:return:
"""
logging.debug("ACS: resetting...")
self._done = False
self._brachas = {} # type: Dict[str, Bracha]
self._mo14s = {} # type: Dict[str, Mo14]
self._bracha_results = {} # type: Dict[str, str]
self._mo14_results = {} # type: Dict[str, int]
self._mo14_provided = {} # type: Dict[str, int]
def stop(self, r):
"""
Calling this will ignore messages on or before round r
:param r:
:return:
"""
logging.debug("ACS: stopping...")
self.reset()
self._round = r
self._done = True
def start(self, msg, r):
"""
initialise our RBC and BA instances
assume all the promoters are connected
:param msg: the message to propose
:param r: the consensus round
:return:
"""
assert len(self._factory.promoters) == self._factory.config.n
self._round = r
for promoter in self._factory.promoters:
logging.debug("ACS: adding promoter {}".format(b64encode(promoter)))
def msg_wrapper_f_factory(_instance, _round):
def f(_msg):
if isinstance(_msg, pb.Bracha):
return pb.ACS(instance=_instance, round=_round, bracha=_msg)
elif isinstance(_msg, pb.Mo14):
return pb.ACS(instance=_instance, round=_round, mo14=_msg)
else:
raise AssertionError("Invalid wrapper input")
return f
self._brachas[promoter] = Bracha(self._factory, msg_wrapper_f_factory(promoter, self._round))
self._mo14s[promoter] = Mo14(self._factory, msg_wrapper_f_factory(promoter, self._round))
my_vk = self._factory.vk
assert my_vk in self._brachas
assert my_vk in self._mo14s
# send the first RBC, assume all nodes have connected, log useful info only when testing
logging.info("ACS: initiating vk {}, msg {}"
.format(b64encode(my_vk), random.random() if self._factory.config.from_instruction else b64encode(msg)))
self._brachas[my_vk].bcast_init(msg)
def reset_then_start(self, msg, r):
self.reset()
self.start(msg, r)
def handle(self, msg, sender_vk):
# type: (pb.ACS, str) -> Union[Handled, Replay]
"""
Msg {
instance: String // vk
ty: u32
round: u32 // this is not the same as the Mo14 'r'
body: Bracha | Mo14 // defined by ty
}
:param msg: acs header with vk followed by either a 'bracha' message or a 'mo14' message
:param sender_vk: the vk of the sender
:return: the agreed subset on completion otherwise None
"""
logging.debug("ACS: got msg (instance: {}, round: {}) from {}".format(b64encode(msg.instance),
msg.round, b64encode(sender_vk)))
if msg.round < self._round:
logging.debug("ACS: round already over, curr: {}, required: {}".format(self._round, msg.round))
return Handled()
if msg.round > self._round:
logging.debug("ACS: round is not ready, curr: {}, required: {}".format(self._round, msg.round))
return Replay()
if self._done:
logging.debug("ACS: we're done, doing nothing")
return Handled()
instance = msg.instance
round = msg.round
assert round == self._round
t = self._factory.config.t
n = self._factory.config.n
body_type = msg.WhichOneof('body')
if body_type == 'bracha':
if instance not in self._brachas:
logging.debug("instance {} not in self.brachas".format(b64encode(instance)))
return Replay()
res = self._brachas[instance].handle(msg.bracha, sender_vk)
if isinstance(res, Handled) and res.m is not None:
logging.debug("ACS: Bracha delivered for {}, {}".format(b64encode(instance), res.m))
self._bracha_results[instance] = res.m
if instance not in self._mo14_provided:
logging.debug("ACS: initiating BA for {}, {}".format(b64encode(instance), 1))
self._mo14_provided[instance] = 1
self._mo14s[instance].start(1)
elif body_type == 'mo14':
if instance in self._mo14_provided:
logging.debug("ACS: forwarding Mo14")
res = self._mo14s[instance].handle(msg.mo14, sender_vk)
if isinstance(res, Handled) and res.m is not None:
logging.debug("ACS: delivered Mo14 for {}, {}".format(b64encode(instance), res.m))
self._mo14_results[instance] = res.m
elif isinstance(res, Replay):
# raise AssertionError("Impossible, our Mo14 instance already instantiated")
return Replay()
ones = [v for k, v in self._mo14_results.iteritems() if v == 1]
if len(ones) >= n - t:
difference = set(self._mo14s.keys()) - set(self._mo14_provided.keys())
logging.debug("ACS: got n - t 1s")
logging.debug("difference = {}".format(difference))
for d in list(difference):
logging.debug("ACS: initiating BA for {}, v {}".format(b64encode(d), 0))
self._mo14_provided[d] = 0
self._mo14s[d].start(0)
if instance not in self._mo14_provided:
logging.debug("ACS: got BA before RBC...")
# if we got a BA instance, but we haven't deliver its corresponding RBC,
# we instruct the caller to replay the message
return Replay()
else:
raise AssertionError("ACS: invalid payload type")
if len(self._mo14_results) >= n:
# return the result if we're done, otherwise return None
assert n == len(self._mo14_results)
res = self._collate_results()
if not res[0]:
return Handled()
self._done = True
# NOTE we just print the hash of the results and compare, the actual output is too much...
# NOTE we also use a random value to trip up tests, since it shouldn't be used
logging.info("ACS: DONE \"{}\""
.format(random.random() if self._factory.config.from_instruction else b64encode(dictionary_hash(res[0]))))
return Handled(res)
return Handled()
def _collate_results(self):
key_of_ones = [k for k, v in self._mo14_results.iteritems() if v == 1]
if all(map(lambda _k: _k in self._bracha_results, key_of_ones)):
res = {k: self._bracha_results[k] for k in key_of_ones}
return res, self._round
else:
return None, self._round
| {
"content_hash": "8b766e45a23e3f801d30f434747cd5c0",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 131,
"avg_line_length": 40.47150259067357,
"alnum_prop": 0.5467929842529766,
"repo_name": "kc1212/consensus-thesis-code",
"id": "4bf19629642ea626086e876907ff8377492f9040",
"size": "7811",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/consensus/acs.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Protocol Buffer",
"bytes": "2246"
},
{
"name": "Python",
"bytes": "143564"
},
{
"name": "Shell",
"bytes": "58"
}
],
"symlink_target": ""
} |
'use strict';
angular.module('elen7046ServerAndAdminApp')
.controller('AdminCtrl', function ($scope, $http, Auth, User) {
// Use the User $resource to fetch all users
$scope.users = User.query();
$scope.delete = function(user) {
User.remove({ id: user._id });
angular.forEach($scope.users, function(u, i) {
if (u === user) {
$scope.users.splice(i, 1);
}
});
};
});
| {
"content_hash": "92549002f256fe21a50b55ddb80c2c36",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 25.41176470588235,
"alnum_prop": 0.5625,
"repo_name": "ReddragonLR/ELEN7046ServerAndAdmin",
"id": "ab5cb4911d975fdf0a9455eef473e1031aff7c05",
"size": "432",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UsingMEAN/client/app/admin/admin.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "2545"
},
{
"name": "HTML",
"bytes": "31964"
},
{
"name": "JavaScript",
"bytes": "133426"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package poyectoredsocial0.pkg1;
import java.io.Serializable;
import javax.swing.Icon;
/**
*
* @author jeansoto
*/
public class Post implements Serializable{
paneles k = new paneles();
Usuario u;
Icon imagen;
Icon video;
String texto;
private static final long SerialVersionUID = 001L;
public Post() {
}
public Post(Icon imagen, Icon video, String texto, Usuario u) {
this.imagen = imagen;
this.video = video;
this.texto = texto;
paneles.ta_estado.setText(texto);
paneles.lb_imagen.setIcon(imagen);
paneles.lb_video.setIcon(video);
paneles.nombre_sujeto.setText(u.getNickname());
paneles.foto_sujeto.setIcon(u.getFotografia());
}
public paneles getK() {
return k;
}
public void setK(paneles k) {
this.k = k;
}
public Usuario getU() {
return u;
}
public void setU(Usuario u) {
this.u = u;
}
public Icon getImagen() {
return imagen;
}
public void setImagen(Icon imagen) {
this.imagen = imagen;
}
public Icon getVideo() {
return video;
}
public void setVideo(Icon video) {
this.video = video;
}
public String getTexto() {
return texto;
}
public void setTexto(String texto) {
this.texto = texto;
}
}
| {
"content_hash": "c0530e10890aadd0ab431632b7eb4386",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 18.376470588235293,
"alnum_prop": 0.6024327784891165,
"repo_name": "Jeancasoto/ProyectoRedSocial",
"id": "1ed364589f74975012e0ab8b5b9413439f84388b",
"size": "1562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/poyectoredsocial0/pkg1/Post.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "233916"
}
],
"symlink_target": ""
} |
from django import forms
from django.contrib.auth.models import User
class UserForm(forms.ModelForm):
POSITIONS = (
('student', 'Студент'),
('professor', 'Преподаватель'),
('cooperator', 'Сотрудник'),
('scientific_director', 'Научный руководитель'),
)
username = forms.CharField(max_length=50, label="Имя пользователя")
last_name = forms.CharField(max_length=50, required=True, label="Фамилия")
first_name = forms.CharField(max_length=50, required=True, label="Имя")
position = forms.MultipleChoiceField(required=True, choices=POSITIONS, widget=forms.CheckboxSelectMultiple())
email = forms.EmailField(widget=forms.EmailInput, label="Электронная почта")
password = forms.CharField(widget=forms.PasswordInput, label="Пароль")
pass2 = forms.CharField(widget=forms.PasswordInput, label="Повторите пароль")
class Meta:
model = User
fields = ['username', 'email', 'password', 'first_name', 'last_name']
| {
"content_hash": "ecd0742f38ecb88ace6be032f1c0f46f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 113,
"avg_line_length": 45.95454545454545,
"alnum_prop": 0.6795252225519288,
"repo_name": "Roomanidzee/DistribSystem",
"id": "b7c91de832b502e2a451e35c62ce4d5d02bd430d",
"size": "1121",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "distrib_system/userroles/forms.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3200"
},
{
"name": "HTML",
"bytes": "22136"
},
{
"name": "JavaScript",
"bytes": "484"
},
{
"name": "Python",
"bytes": "32861"
}
],
"symlink_target": ""
} |
Sphere::Sphere() : Sphere(glm::vec3(0,0,0), 1) {
// stub
}
Sphere::Sphere(glm::vec3 center, double radius) : m_center(center), m_radius(radius){
// stub
}
bool Sphere::getIntersection(const glm::vec3 &rayStart, const glm::vec3 &rayDir, HitRecord &record) {
auto near_t = 0;
// TODO from slide 56 of the 07_Raytracing slide deck
return true;
}
double Sphere::getRadius() {
return m_radius;
}
glm::vec3 Sphere::getCenter() {
return m_center;
}
void Sphere::read(std::string data) {
std::stringstream ss(data);
ss.ignore(std::numeric_limits<std::streamsize>::max(), ' ');
ss >> m_center.x >> m_center.y >> m_center.z >> m_radius;
}
std::string Sphere::toString() {
using std::to_string;
std::stringstream ss;
ss << "s " << to_string(m_center.x) << " " << to_string(m_center.y)
<< " " << to_string(m_center.z) << " " << to_string(m_radius);
return ss.str();
}
int Sphere::getMaterialIndex() {
return m_material;
}
void Sphere::setMaterialIndex(int mi) {
m_material = mi;
}
| {
"content_hash": "af2ede6a35aba093be357d23acb75d1c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 101,
"avg_line_length": 22.869565217391305,
"alnum_prop": 0.6121673003802282,
"repo_name": "tmiller1996/cs450",
"id": "ab6aa269ce9c2e0d7d688741c52d132c2a1dc77a",
"size": "1111",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "assign04/Sphere.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "260"
},
{
"name": "C++",
"bytes": "100240"
},
{
"name": "CMake",
"bytes": "26803"
},
{
"name": "PostScript",
"bytes": "1145"
},
{
"name": "Shell",
"bytes": "705"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package it.av.fac.webserver;
/**
* TODO: Change this into configuration files.
* @author Diogo Regateiro <diogoregateiro@ua.pt>
*/
public class WebserverConfig {
public static final String MODULE_KEY = "webserver";
}
| {
"content_hash": "5fa1da84654ef314aa02b7471b8680a2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.7341463414634146,
"repo_name": "Regateiro/FuzzyAC",
"id": "90febb77a38bafb1f2fb98579c4a644568299dd3",
"size": "410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/FuzzyAC/FAC_Webserver/src/main/java/it/av/fac/webserver/WebserverConfig.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "227"
},
{
"name": "Java",
"bytes": "482200"
}
],
"symlink_target": ""
} |
package androidx.media3.exoplayer.source.mediaparser;
import android.media.MediaFormat;
import android.media.MediaParser;
import android.media.metrics.LogSessionId;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
import androidx.media3.common.Format;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.analytics.PlayerId;
/**
* Miscellaneous constants and utility methods related to the {@link MediaParser} integration.
*
* <p>For documentation on constants, please see the {@link MediaParser} documentation.
*/
@UnstableApi
public final class MediaParserUtil {
public static final String PARAMETER_IN_BAND_CRYPTO_INFO =
"android.media.mediaparser.inBandCryptoInfo";
public static final String PARAMETER_INCLUDE_SUPPLEMENTAL_DATA =
"android.media.mediaparser.includeSupplementalData";
public static final String PARAMETER_EAGERLY_EXPOSE_TRACK_TYPE =
"android.media.mediaparser.eagerlyExposeTrackType";
public static final String PARAMETER_EXPOSE_DUMMY_SEEK_MAP =
"android.media.mediaparser.exposeDummySeekMap";
public static final String PARAMETER_EXPOSE_CHUNK_INDEX_AS_MEDIA_FORMAT =
"android.media.mediaParser.exposeChunkIndexAsMediaFormat";
public static final String PARAMETER_OVERRIDE_IN_BAND_CAPTION_DECLARATIONS =
"android.media.mediaParser.overrideInBandCaptionDeclarations";
public static final String PARAMETER_EXPOSE_CAPTION_FORMATS =
"android.media.mediaParser.exposeCaptionFormats";
public static final String PARAMETER_IGNORE_TIMESTAMP_OFFSET =
"android.media.mediaparser.ignoreTimestampOffset";
private MediaParserUtil() {}
/**
* Returns a {@link MediaFormat} with equivalent {@link MediaFormat#KEY_MIME} and {@link
* MediaFormat#KEY_CAPTION_SERVICE_NUMBER} to the given {@link Format}.
*/
public static MediaFormat toCaptionsMediaFormat(Format format) {
MediaFormat mediaFormat = new MediaFormat();
mediaFormat.setString(MediaFormat.KEY_MIME, format.sampleMimeType);
if (format.accessibilityChannel != Format.NO_VALUE) {
mediaFormat.setInteger(MediaFormat.KEY_CAPTION_SERVICE_NUMBER, format.accessibilityChannel);
}
return mediaFormat;
}
/**
* Calls {@link MediaParser#setLogSessionId(LogSessionId)}.
*
* @param mediaParser The {@link MediaParser} to call the method on.
* @param playerId The {@link PlayerId} to obtain the {@link LogSessionId} from.
*/
@RequiresApi(31)
public static void setLogSessionIdOnMediaParser(MediaParser mediaParser, PlayerId playerId) {
Api31.setLogSessionIdOnMediaParser(mediaParser, playerId);
}
@RequiresApi(31)
private static final class Api31 {
private Api31() {}
@DoNotInline
public static void setLogSessionIdOnMediaParser(MediaParser mediaParser, PlayerId playerId) {
LogSessionId logSessionId = playerId.getLogSessionId();
if (!logSessionId.equals(LogSessionId.LOG_SESSION_ID_NONE)) {
mediaParser.setLogSessionId(logSessionId);
}
}
}
}
| {
"content_hash": "9dad1d82add678212b304f9238f7c7fb",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 98,
"avg_line_length": 40.078947368421055,
"alnum_prop": 0.7669074195666448,
"repo_name": "androidx/media",
"id": "6f1db58141d4b7de5f0c2225bbf32c1fbead5259",
"size": "3661",
"binary": false,
"copies": "1",
"ref": "refs/heads/release",
"path": "libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/mediaparser/MediaParserUtil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AIDL",
"bytes": "27206"
},
{
"name": "C++",
"bytes": "112467"
},
{
"name": "CMake",
"bytes": "3728"
},
{
"name": "GLSL",
"bytes": "24923"
},
{
"name": "Java",
"bytes": "17624240"
},
{
"name": "Makefile",
"bytes": "11496"
},
{
"name": "Shell",
"bytes": "24988"
}
],
"symlink_target": ""
} |
* Infected Wars, an open source Garry's Mod game-mode.
*
* Infected Wars is the work of multiple authors,
* a full list can be found in CONTRIBUTORS.md.
* For more information, visit https://github.com/JarnoVgr/InfectedWars
*
* Infected Wars is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* A full copy of the MIT License can be found in LICENSE.txt.
-----------------------------------------------------------------------------]]
function EFFECT:Init(data)
self.WeaponEnt = data:GetEntity()
self.Attachment = data:GetAttachment()
self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment)
self.Forward = data:GetNormal()
self.Angle = self.Forward:Angle()
self.Right = self.Angle:Right()
self.Up = self.Angle:Up()
local AddVel = self.WeaponEnt:GetOwner():GetVelocity()
local emitter = ParticleEmitter(self.Position)
local particle = emitter:Add("sprites/heatwave", self.Position - self.Forward*4)
particle:SetVelocity(80*self.Forward + 20*VectorRand() + 1.05*AddVel)
particle:SetDieTime(math.Rand(0.2,0.25))
particle:SetStartSize(math.random(15,20))
particle:SetEndSize(3)
particle:SetRoll(math.Rand(180,480))
particle:SetRollDelta(math.Rand(-1,1))
particle:SetGravity(Vector(0,0,100))
particle:SetAirResistance(160)
for i=1,3 do
local particle = emitter:Add("particle/particle_smokegrenade", self.Position)
particle:SetVelocity(30*i*self.Forward + 10*VectorRand() + 1.1*AddVel)
particle:SetDieTime(math.Rand(0.36,0.38))
particle:SetStartAlpha(math.Rand(60,70))
particle:SetStartSize(math.random(1,2)*i)
particle:SetEndSize(math.Rand(5,7)*i)
particle:SetRoll(math.Rand(180,480))
particle:SetRollDelta(math.Rand(-1,1))
particle:SetColor(245,245,245)
particle:SetLighting(true)
particle:SetAirResistance(140)
end
for i=1,4 do
local particle = emitter:Add("particle/particle_smokegrenade", self.Position)
particle:SetVelocity(math.Rand(20,30)*self.Forward + 40*VectorRand() + 1.1*AddVel)
particle:SetDieTime(math.Rand(0.36,0.38))
particle:SetStartAlpha(math.Rand(50,60))
particle:SetStartSize(math.random(2,3))
particle:SetEndSize(math.Rand(12,14))
particle:SetRoll(math.Rand(180,480))
particle:SetRollDelta(math.Rand(-1,1))
particle:SetColor(245,245,245)
particle:SetLighting(true)
particle:SetAirResistance(160)
end
for i=1,2 do
local particle = emitter:Add("effects/muzzleflash"..math.random(1,4), self.Position + 8*self.Forward)
particle:SetVelocity(350*self.Forward + 1.1*AddVel)
particle:SetDieTime(0.18)
particle:SetStartAlpha(160)
particle:SetEndAlpha(0)
particle:SetStartSize(12*i)
particle:SetEndSize(8*i)
particle:SetRoll(math.Rand(180,480))
particle:SetRollDelta(math.Rand(-1,1))
particle:SetColor(255,255,255)
particle:SetAirResistance(160)
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end
| {
"content_hash": "cd8df3e027daee04cae36252fbce30a6",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 103,
"avg_line_length": 30.397959183673468,
"alnum_prop": 0.7203759650889561,
"repo_name": "JarnoVgr/InfectedWars",
"id": "ac36823fe4608c34ba190da72d6e6e15d7023fb2",
"size": "3061",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "entities/effects/rg_muzzle_highcal/init.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "926008"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.