text stringlengths 2 1.04M | meta dict |
|---|---|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>upnp</artifactId>
<groupId>org.cybergarage.upnp</groupId>
<version>2.1.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.cybergarage.upnp</groupId>
<artifactId>std</artifactId>
<name>cybergarage-upnp standard</name>
<description>A pure Java open source implementation of UPnP standard specifications</description>
<packaging>jar</packaging>
<properties>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.cybergarage.upnp</groupId>
<artifactId>core</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<additionalOptions>-Xdoclint:none</additionalOptions>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "ed65f5a020d6477ac0267d42e80757ef",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 152,
"avg_line_length": 29.150537634408604,
"alnum_prop": 0.5964588712652158,
"repo_name": "cybergarage/cybergarage-upnp",
"id": "d92dec8288a8066e4f21f533bb569be47a26d55d",
"size": "2711",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "std/pom.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "794609"
}
],
"symlink_target": ""
} |
<?php
namespace test\o\o;
class h { } | {
"content_hash": "6f286ee91ada5b4bd767bb6c9e58eb3e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 19,
"avg_line_length": 12.333333333333334,
"alnum_prop": 0.6486486486486487,
"repo_name": "darrelljefferson/themcset.com",
"id": "580d2eac9d3aa9dd191d779c4eaeecf6bb8efe3f",
"size": "37",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "bin/test/o/o/h.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "1099"
},
{
"name": "Batchfile",
"bytes": "21"
},
{
"name": "CSS",
"bytes": "889639"
},
{
"name": "HTML",
"bytes": "17830980"
},
{
"name": "Java",
"bytes": "58853"
},
{
"name": "JavaScript",
"bytes": "2251931"
},
{
"name": "PHP",
"bytes": "13665910"
},
{
"name": "Shell",
"bytes": "7918"
},
{
"name": "Smarty",
"bytes": "2149"
}
],
"symlink_target": ""
} |
namespace Restival.ApiTests.OpenRasta {
public class OpenRastaWhoAmITests : WhoAmIApiTestsBase<OpenRastaApi> { }
} | {
"content_hash": "18f7f132feb7b0abc7bb2534c3d75243",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 76,
"avg_line_length": 39.333333333333336,
"alnum_prop": 0.8050847457627118,
"repo_name": "dylanbeattie/Restival",
"id": "1b376c793278ae40441951ad8e8c3bc59e2efedc",
"size": "118",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Restival.ApiTests/OpenRasta/OpenRastaWhoAmITests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "API Blueprint",
"bytes": "2858"
},
{
"name": "ASP",
"bytes": "339"
},
{
"name": "C#",
"bytes": "368079"
},
{
"name": "CSS",
"bytes": "560"
},
{
"name": "HTML",
"bytes": "1383"
},
{
"name": "PowerShell",
"bytes": "1538"
}
],
"symlink_target": ""
} |
/*
* This file is generated by jOOQ.
*/
package com.franckyi.modcenter.api.jooq;
import com.franckyi.modcenter.api.jooq.tables.Categories;
import com.franckyi.modcenter.api.jooq.tables.Files;
import com.franckyi.modcenter.api.jooq.tables.Optionallibraries;
import com.franckyi.modcenter.api.jooq.tables.Projects;
import com.franckyi.modcenter.api.jooq.tables.Requiredlibraries;
import com.franckyi.modcenter.api.jooq.tables.Versions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Generated;
import org.jooq.Catalog;
import org.jooq.Table;
import org.jooq.impl.SchemaImpl;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.9.3"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class FranckyiModcenter extends SchemaImpl {
private static final long serialVersionUID = -1854663479;
/**
* The reference instance of <code>franckyi_modcenter</code>
*/
public static final FranckyiModcenter FRANCKYI_MODCENTER = new FranckyiModcenter();
/**
* The table <code>franckyi_modcenter.categories</code>.
*/
public final Categories CATEGORIES = com.franckyi.modcenter.api.jooq.tables.Categories.CATEGORIES;
/**
* The table <code>franckyi_modcenter.files</code>.
*/
public final Files FILES = com.franckyi.modcenter.api.jooq.tables.Files.FILES;
/**
* The table <code>franckyi_modcenter.optionalLibraries</code>.
*/
public final Optionallibraries OPTIONALLIBRARIES = com.franckyi.modcenter.api.jooq.tables.Optionallibraries.OPTIONALLIBRARIES;
/**
* The table <code>franckyi_modcenter.projects</code>.
*/
public final Projects PROJECTS = com.franckyi.modcenter.api.jooq.tables.Projects.PROJECTS;
/**
* The table <code>franckyi_modcenter.requiredLibraries</code>.
*/
public final Requiredlibraries REQUIREDLIBRARIES = com.franckyi.modcenter.api.jooq.tables.Requiredlibraries.REQUIREDLIBRARIES;
/**
* The table <code>franckyi_modcenter.versions</code>.
*/
public final Versions VERSIONS = com.franckyi.modcenter.api.jooq.tables.Versions.VERSIONS;
/**
* No further instances allowed
*/
private FranckyiModcenter() {
super("franckyi_modcenter", null);
}
/**
* {@inheritDoc}
*/
@Override
public Catalog getCatalog() {
return DefaultCatalog.DEFAULT_CATALOG;
}
@Override
public final List<Table<?>> getTables() {
List result = new ArrayList();
result.addAll(getTables0());
return result;
}
private final List<Table<?>> getTables0() {
return Arrays.<Table<?>>asList(
Categories.CATEGORIES,
Files.FILES,
Optionallibraries.OPTIONALLIBRARIES,
Projects.PROJECTS,
Requiredlibraries.REQUIREDLIBRARIES,
Versions.VERSIONS);
}
}
| {
"content_hash": "73449d7090946e1c1b8e2c563da57cf8",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 130,
"avg_line_length": 28.33644859813084,
"alnum_prop": 0.6850263852242744,
"repo_name": "Franckyi/Mod-Center-API",
"id": "819f54f6f71ed59eb8d1511079eb093b8658034f",
"size": "3032",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/franckyi/modcenter/api/jooq/FranckyiModcenter.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "120881"
}
],
"symlink_target": ""
} |
package org.javacs.example;
class MissingImport {
void test() {
ArrayList foo;
}
} | {
"content_hash": "fc321bf9d914306114e9812a27d0685f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 27,
"avg_line_length": 14.142857142857142,
"alnum_prop": 0.6161616161616161,
"repo_name": "georgewfraser/vscode-javac",
"id": "84233beb65276a176a5e33e554974a537b22fc5c",
"size": "99",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/examples/maven-project/src/org/javacs/example/MissingImport.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "359138"
},
{
"name": "Shell",
"bytes": "4903"
},
{
"name": "TypeScript",
"bytes": "9471"
}
],
"symlink_target": ""
} |
package ch.piratenpartei.pivote.serialize.handlers;
import java.io.IOException;
import ch.piratenpartei.pivote.serialize.DataIO;
import ch.piratenpartei.pivote.serialize.DataInput;
import ch.piratenpartei.pivote.serialize.DataOutput;
import ch.piratenpartei.pivote.serialize.Handler;
/**
* @author <a href="mailto:herzog@raffael.ch">Raffael Herzog</a>
*/
public class FloatHandler implements Handler {
@Override
public Object read(DataInput input) throws IOException {
return input.readFloat();
}
@Override
public void write(DataOutput output, Object value) throws IOException {
output.writeFloat(DataIO.check(Float.class, value));
}
}
| {
"content_hash": "481dc3b62f33ba9e39e4b3799433b41d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 26.346153846153847,
"alnum_prop": 0.7503649635036497,
"repo_name": "Abnaxos/pivote-java",
"id": "2ff6cd22eb60fe6f5ee90ccc3f8d3079254c7557",
"size": "1289",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "protocol/src/main/java/ch/piratenpartei/pivote/serialize/handlers/FloatHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "8978"
},
{
"name": "Java",
"bytes": "208695"
}
],
"symlink_target": ""
} |

## Details
| Item | Description |
|-------------------|------------------------------------------------------------------------------|
| Purpose | A wrapper around the [JFrog CLI](https://jfrog.com/getcli/) |
| Usage | Executes commands against [JFrog Artifactory](https://jfrog.com/artifactory) |
| Limitations | Only supports JFrog Artifactory, not any of the other JFrog products |
| Base container | [golang:alpine](https://hub.docker.com/_/golang?tab=description) |
| Language runtimes | [Go 1.12.6](https://golang.org/doc/go1.12) |
| Additional tools | git, curl, wget |
## Usage
The action can be used in a workflow to execute actions against JFrog Artifactory. The actions must be supplied as the `args` parameter and will be prefixed with `jfrog rt` by the [script](./entrypoint.sh). This action supports three mechanisms to authenticate to Artifactory and based on which type you choose the variable `CRED` (which determines the credential type) has to be set as well.
| Authentication type | Variables to set | Set `CRED` to |
|---------------------|-------------------|---------------|
| Login Credentials | USER and PASSWORD | username |
| API Key | APIKEY | apikey |
| Access Token | ACCESSTOKEN | accesstoken |
As you're setting these, _please make sure you set them as "secrets"_
There are two other environment variables that are required
| Variable | Description |
|----------|----------------------------------------------------------------------------------|
| `URL` | The Artifactory URL |
| `args` | The command to execute, but without `jfrog rt` (like `build-publish my-build 1`) |
```hcl
action "JFrog CLI for GitHub Actions" {
uses = "retgits/actions/jfrog-cli-go@master"
secrets = ["USER", "PASSWORD", "URL"]
args = ["cmd"]
env = {
CRED = "username"
}
}
```
| {
"content_hash": "2a463067ff1e87cd34ba3b792fe4d1d0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 392,
"avg_line_length": 53.88095238095238,
"alnum_prop": 0.4962439239946973,
"repo_name": "retgits/dockerfiles",
"id": "c136de4c8e2a99e734334d9888161342564272d0",
"size": "2288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "actions/jfrog-cli-go/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "6810"
},
{
"name": "Go",
"bytes": "4057"
},
{
"name": "Makefile",
"bytes": "6778"
},
{
"name": "Shell",
"bytes": "4059"
}
],
"symlink_target": ""
} |
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/Welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>
| {
"content_hash": "e9cbbee8dd921cf224b6b17798802834",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 192,
"avg_line_length": 47.333333333333336,
"alnum_prop": 0.7084507042253522,
"repo_name": "Donbaka/e-market",
"id": "6137f069af5a2a57b0a9c2ec6d04e9c946da9a67",
"size": "711",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/application/views/front/v_welcome.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "12332"
},
{
"name": "HTML",
"bytes": "5459559"
},
{
"name": "JavaScript",
"bytes": "51459"
},
{
"name": "PHP",
"bytes": "1731145"
}
],
"symlink_target": ""
} |
package com.ocdsoft.bacta.swg.precu.message.knowledgebase;
/**
* Created by crush on 8/13/2014.
*/
public class CancelTicketMessage {
//unsigned int ticketID
//unicodestring comment
//unsigned int stationId
}
| {
"content_hash": "7e6b053ff478a77559563167cb777634",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 22.4,
"alnum_prop": 0.7232142857142857,
"repo_name": "bacta/pre-cu",
"id": "d0f7bf30d4d5bbf051d91ef32cd58c33fc5cb346",
"size": "224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/old/message/knowledgebase/CancelTicketMessage.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "468654"
}
],
"symlink_target": ""
} |
package israce
// RaceEnabled checks if race is enabled.
const RaceEnabled = true
| {
"content_hash": "feaa41954a53cfd2bb2b87c92914b7b0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 41,
"avg_line_length": 20.75,
"alnum_prop": 0.7831325301204819,
"repo_name": "tiancaiamao/tidb",
"id": "b85e49b2597ff7656535b8e3260f193ac69d683c",
"size": "614",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "util/israce/israce.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "359"
},
{
"name": "Go",
"bytes": "7405246"
},
{
"name": "Makefile",
"bytes": "5662"
},
{
"name": "Shell",
"bytes": "11048"
}
],
"symlink_target": ""
} |
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Code that generates a test runner to run all the tests in a crate
#![allow(dead_code)]
#![allow(unused_imports)]
use self::HasTestSignature::*;
use std::iter;
use std::slice;
use std::mem;
use std::vec;
use attr::{self, HasAttrs};
use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos};
use std::rc::Rc;
use codemap::{self, CodeMap, ExpnInfo, NameAndSpan, MacroAttribute, dummy_spanned};
use errors;
use errors::snippet::{SnippetData};
use config;
use entry::{self, EntryPointType};
use ext::base::{ExtCtxt, Resolver};
use ext::build::AstBuilder;
use ext::expand::ExpansionConfig;
use ext::hygiene::{Mark, SyntaxContext};
use fold::Folder;
use util::move_map::MoveMap;
use fold;
use parse::{token, ParseSess};
use print::pprust;
use ast::{self, Ident};
use ptr::P;
use symbol::{self, Symbol, keywords};
use util::small_vector::SmallVector;
enum ShouldPanic {
No,
Yes(Option<Symbol>),
}
struct Test {
span: Span,
path: Vec<Ident> ,
bench: bool,
ignore: bool,
should_panic: ShouldPanic
}
struct TestCtxt<'a> {
sess: &'a ParseSess,
span_diagnostic: &'a errors::Handler,
path: Vec<Ident>,
ext_cx: ExtCtxt<'a>,
testfns: Vec<Test>,
reexport_test_harness_main: Option<Symbol>,
is_test_crate: bool,
ctxt: SyntaxContext,
// top-level re-export submodule, filled out after folding is finished
toplevel_reexport: Option<Ident>,
}
// Traverse the crate, collecting all the test functions, eliding any
// existing main functions, and synthesizing a main test harness
pub fn modify_for_testing(sess: &ParseSess,
resolver: &mut Resolver,
should_test: bool,
krate: ast::Crate,
span_diagnostic: &errors::Handler) -> ast::Crate {
// Check for #[reexport_test_harness_main = "some_name"] which
// creates a `use some_name = __test::main;`. This needs to be
// unconditional, so that the attribute is still marked as used in
// non-test builds.
let reexport_test_harness_main =
attr::first_attr_value_str_by_name(&krate.attrs,
"reexport_test_harness_main");
if should_test {
generate_test_harness(sess, resolver, reexport_test_harness_main, krate, span_diagnostic)
} else {
krate
}
}
struct TestHarnessGenerator<'a> {
cx: TestCtxt<'a>,
tests: Vec<Ident>,
// submodule name, gensym'd identifier for re-exports
tested_submods: Vec<(Ident, Ident)>,
}
impl<'a> fold::Folder for TestHarnessGenerator<'a> {
fn fold_crate(&mut self, c: ast::Crate) -> ast::Crate {
let mut folded = fold::noop_fold_crate(c, self);
// Add a special __test module to the crate that will contain code
// generated for the test harness
let (mod_, reexport) = mk_test_module(&mut self.cx);
if let Some(re) = reexport {
folded.module.items.push(re)
}
folded.module.items.push(mod_);
folded
}
fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
let ident = i.ident;
if ident.name != keywords::Invalid.name() {
self.cx.path.push(ident);
}
debug!("current path: {}", path_name_i(&self.cx.path));
if is_test_fn(&self.cx, &i) || is_bench_fn(&self.cx, &i) {
match i.node {
ast::ItemKind::Fn(_, ast::Unsafety::Unsafe, _, _, _, _) => {
let diag = self.cx.span_diagnostic;
panic!(diag.span_fatal(i.span, "unsafe functions cannot be used for tests"));
}
_ => {
debug!("this is a test function");
let test = Test {
span: i.span,
path: self.cx.path.clone(),
bench: is_bench_fn(&self.cx, &i),
ignore: is_ignored(&i),
should_panic: should_panic(&i, &self.cx)
};
self.cx.testfns.push(test);
self.tests.push(i.ident);
}
}
}
let mut item = i.unwrap();
// We don't want to recurse into anything other than mods, since
// mods or tests inside of functions will break things
if let ast::ItemKind::Mod(module) = item.node {
let tests = mem::replace(&mut self.tests, Vec::new());
let tested_submods = mem::replace(&mut self.tested_submods, Vec::new());
let mut mod_folded = fold::noop_fold_mod(module, self);
let tests = mem::replace(&mut self.tests, tests);
let tested_submods = mem::replace(&mut self.tested_submods, tested_submods);
if !tests.is_empty() || !tested_submods.is_empty() {
let (it, sym) = mk_reexport_mod(&mut self.cx, item.id, tests, tested_submods);
mod_folded.items.push(it);
if !self.cx.path.is_empty() {
self.tested_submods.push((self.cx.path[self.cx.path.len()-1], sym));
} else {
debug!("pushing nothing, sym: {:?}", sym);
self.cx.toplevel_reexport = Some(sym);
}
}
item.node = ast::ItemKind::Mod(mod_folded);
}
if ident.name != keywords::Invalid.name() {
self.cx.path.pop();
}
SmallVector::one(P(item))
}
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac }
}
struct EntryPointCleaner {
// Current depth in the ast
depth: usize,
}
impl fold::Folder for EntryPointCleaner {
fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
self.depth += 1;
let folded = fold::noop_fold_item(i, self).expect_one("noop did something");
self.depth -= 1;
// Remove any #[main] or #[start] from the AST so it doesn't
// clash with the one we're going to add, but mark it as
// #[allow(dead_code)] to avoid printing warnings.
let folded = match entry::entry_point_type(&folded, self.depth) {
EntryPointType::MainNamed |
EntryPointType::MainAttr |
EntryPointType::Start =>
folded.map(|ast::Item {id, ident, attrs, node, vis, span}| {
let allow_str = Symbol::intern("allow");
let dead_code_str = Symbol::intern("dead_code");
let word_vec = vec![attr::mk_list_word_item(dead_code_str)];
let allow_dead_code_item = attr::mk_list_item(allow_str, word_vec);
let allow_dead_code = attr::mk_attr_outer(DUMMY_SP,
attr::mk_attr_id(),
allow_dead_code_item);
ast::Item {
id: id,
ident: ident,
attrs: attrs.into_iter()
.filter(|attr| {
!attr.check_name("main") && !attr.check_name("start")
})
.chain(iter::once(allow_dead_code))
.collect(),
node: node,
vis: vis,
span: span
}
}),
EntryPointType::None |
EntryPointType::OtherMain => folded,
};
SmallVector::one(folded)
}
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac }
}
fn mk_reexport_mod(cx: &mut TestCtxt,
parent: ast::NodeId,
tests: Vec<Ident>,
tested_submods: Vec<(Ident, Ident)>)
-> (P<ast::Item>, Ident) {
let super_ = Ident::from_str("super");
let items = tests.into_iter().map(|r| {
cx.ext_cx.item_use_simple(DUMMY_SP, ast::Visibility::Public,
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
}).chain(tested_submods.into_iter().map(|(r, sym)| {
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Visibility::Public, r, path)
})).collect();
let reexport_mod = ast::Mod {
inner: DUMMY_SP,
items: items,
};
let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports"));
let parent = if parent == ast::DUMMY_NODE_ID { ast::CRATE_NODE_ID } else { parent };
cx.ext_cx.current_expansion.mark = cx.ext_cx.resolver.get_module_scope(parent);
let it = cx.ext_cx.monotonic_expander().fold_item(P(ast::Item {
ident: sym,
attrs: Vec::new(),
id: ast::DUMMY_NODE_ID,
node: ast::ItemKind::Mod(reexport_mod),
vis: ast::Visibility::Public,
span: DUMMY_SP,
})).pop().unwrap();
(it, sym)
}
fn generate_test_harness(sess: &ParseSess,
resolver: &mut Resolver,
reexport_test_harness_main: Option<Symbol>,
krate: ast::Crate,
sd: &errors::Handler) -> ast::Crate {
// Remove the entry points
let mut cleaner = EntryPointCleaner { depth: 0 };
let krate = cleaner.fold_crate(krate);
let mark = Mark::fresh(Mark::root());
let mut cx: TestCtxt = TestCtxt {
sess: sess,
span_diagnostic: sd,
ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver),
path: Vec::new(),
testfns: Vec::new(),
reexport_test_harness_main: reexport_test_harness_main,
is_test_crate: is_test_crate(&krate),
toplevel_reexport: None,
ctxt: SyntaxContext::empty().apply_mark(mark),
};
cx.ext_cx.crate_root = Some("std");
mark.set_expn_info(ExpnInfo {
call_site: DUMMY_SP,
callee: NameAndSpan {
format: MacroAttribute(Symbol::intern("test")),
span: None,
allow_internal_unstable: true,
}
});
TestHarnessGenerator {
cx: cx,
tests: Vec::new(),
tested_submods: Vec::new(),
}.fold_crate(krate)
}
/// Craft a span that will be ignored by the stability lint's
/// call to codemap's `is_internal` check.
/// The expanded code calls some unstable functions in the test crate.
fn ignored_span(cx: &TestCtxt, sp: Span) -> Span {
Span { ctxt: cx.ctxt, ..sp }
}
#[derive(PartialEq)]
enum HasTestSignature {
Yes,
No,
NotEvenAFunction,
}
fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
let has_test_attr = attr::contains_name(&i.attrs, "test");
fn has_test_signature(i: &ast::Item) -> HasTestSignature {
match i.node {
ast::ItemKind::Fn(ref decl, _, _, _, ref generics, _) => {
let no_output = match decl.output {
ast::FunctionRetTy::Default(..) => true,
ast::FunctionRetTy::Ty(ref t) if t.node == ast::TyKind::Tup(vec![]) => true,
_ => false
};
if decl.inputs.is_empty()
&& no_output
&& !generics.is_parameterized() {
Yes
} else {
No
}
}
_ => NotEvenAFunction,
}
}
if has_test_attr {
let diag = cx.span_diagnostic;
match has_test_signature(i) {
Yes => {},
No => diag.span_err(i.span, "functions used as tests must have signature fn() -> ()"),
NotEvenAFunction => diag.span_err(i.span,
"only functions may be used as tests"),
}
}
has_test_attr && has_test_signature(i) == Yes
}
fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
let has_bench_attr = attr::contains_name(&i.attrs, "bench");
fn has_test_signature(i: &ast::Item) -> bool {
match i.node {
ast::ItemKind::Fn(ref decl, _, _, _, ref generics, _) => {
let input_cnt = decl.inputs.len();
let no_output = match decl.output {
ast::FunctionRetTy::Default(..) => true,
ast::FunctionRetTy::Ty(ref t) if t.node == ast::TyKind::Tup(vec![]) => true,
_ => false
};
let tparm_cnt = generics.ty_params.len();
// NB: inadequate check, but we're running
// well before resolve, can't get too deep.
input_cnt == 1
&& no_output && tparm_cnt == 0
}
_ => false
}
}
if has_bench_attr && !has_test_signature(i) {
let diag = cx.span_diagnostic;
diag.span_err(i.span, "functions used as benches must have signature \
`fn(&mut Bencher) -> ()`");
}
has_bench_attr && has_test_signature(i)
}
fn is_ignored(i: &ast::Item) -> bool {
i.attrs.iter().any(|attr| attr.check_name("ignore"))
}
fn should_panic(i: &ast::Item, cx: &TestCtxt) -> ShouldPanic {
match i.attrs.iter().find(|attr| attr.check_name("should_panic")) {
Some(attr) => {
let sd = cx.span_diagnostic;
if attr.is_value_str() {
sd.struct_span_warn(
attr.span(),
"attribute must be of the form: \
`#[should_panic]` or \
`#[should_panic(expected = \"error message\")]`"
).note("Errors in this attribute were erroneously allowed \
and will become a hard error in a future release.")
.emit();
return ShouldPanic::Yes(None);
}
match attr.meta_item_list() {
// Handle #[should_panic]
None => ShouldPanic::Yes(None),
// Handle #[should_panic(expected = "foo")]
Some(list) => {
let msg = list.iter()
.find(|mi| mi.check_name("expected"))
.and_then(|mi| mi.meta_item())
.and_then(|mi| mi.value_str());
if list.len() != 1 || msg.is_none() {
sd.struct_span_warn(
attr.span(),
"argument must be of the form: \
`expected = \"error message\"`"
).note("Errors in this attribute were erroneously \
allowed and will become a hard error in a \
future release.").emit();
ShouldPanic::Yes(None)
} else {
ShouldPanic::Yes(msg)
}
},
}
}
None => ShouldPanic::No,
}
}
/*
We're going to be building a module that looks more or less like:
mod __test {
extern crate test (name = "test", vers = "...");
fn main() {
test::test_main_static(&::os::args()[], tests, test::Options::new())
}
static tests : &'static [test::TestDescAndFn] = &[
... the list of tests in the crate ...
];
}
*/
fn mk_std(cx: &TestCtxt) -> P<ast::Item> {
let id_test = Ident::from_str("test");
let sp = ignored_span(cx, DUMMY_SP);
let (vi, vis, ident) = if cx.is_test_crate {
(ast::ItemKind::Use(
P(nospan(ast::ViewPathSimple(id_test,
path_node(vec![id_test]))))),
ast::Visibility::Public, keywords::Invalid.ident())
} else {
(ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test)
};
P(ast::Item {
id: ast::DUMMY_NODE_ID,
ident: ident,
node: vi,
attrs: vec![],
vis: vis,
span: sp
})
}
fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
// Writing this out by hand with 'ignored_span':
// pub fn main() {
// #![main]
// use std::slice::AsSlice;
// test::test_main_static(::std::os::args().as_slice(), TESTS, test::Options::new());
// }
let sp = ignored_span(cx, DUMMY_SP);
let ecx = &cx.ext_cx;
// test::test_main_static
let test_main_path =
ecx.path(sp, vec![Ident::from_str("test"), Ident::from_str("test_main_static")]);
// test::test_main_static(...)
let test_main_path_expr = ecx.expr_path(test_main_path);
let tests_ident_expr = ecx.expr_ident(sp, Ident::from_str("TESTS"));
let call_test_main = ecx.expr_call(sp, test_main_path_expr,
vec![tests_ident_expr]);
let call_test_main = ecx.stmt_expr(call_test_main);
// #![main]
let main_meta = ecx.meta_word(sp, Symbol::intern("main"));
let main_attr = ecx.attribute(sp, main_meta);
// pub fn main() { ... }
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(vec![]));
let main_body = ecx.block(sp, vec![call_test_main]);
let main = ast::ItemKind::Fn(ecx.fn_decl(vec![], main_ret_ty),
ast::Unsafety::Normal,
dummy_spanned(ast::Constness::NotConst),
::abi::Abi::Rust, ast::Generics::default(), main_body);
P(ast::Item {
ident: Ident::from_str("main"),
attrs: vec![main_attr],
id: ast::DUMMY_NODE_ID,
node: main,
vis: ast::Visibility::Public,
span: sp
})
}
fn mk_test_module(cx: &mut TestCtxt) -> (P<ast::Item>, Option<P<ast::Item>>) {
// Link to test crate
let import = mk_std(cx);
// A constant vector of test descriptors.
let tests = mk_tests(cx);
// The synthesized main function which will call the console test runner
// with our list of tests
let mainfn = mk_main(cx);
let testmod = ast::Mod {
inner: DUMMY_SP,
items: vec![import, mainfn, tests],
};
let item_ = ast::ItemKind::Mod(testmod);
let mod_ident = Ident::with_empty_ctxt(Symbol::gensym("__test"));
let mut expander = cx.ext_cx.monotonic_expander();
let item = expander.fold_item(P(ast::Item {
id: ast::DUMMY_NODE_ID,
ident: mod_ident,
attrs: vec![],
node: item_,
vis: ast::Visibility::Public,
span: DUMMY_SP,
})).pop().unwrap();
let reexport = cx.reexport_test_harness_main.map(|s| {
// building `use <ident> = __test::main`
let reexport_ident = Ident::with_empty_ctxt(s);
let use_path =
nospan(ast::ViewPathSimple(reexport_ident,
path_node(vec![mod_ident, Ident::from_str("main")])));
expander.fold_item(P(ast::Item {
id: ast::DUMMY_NODE_ID,
ident: keywords::Invalid.ident(),
attrs: vec![],
node: ast::ItemKind::Use(P(use_path)),
vis: ast::Visibility::Inherited,
span: DUMMY_SP
})).pop().unwrap()
});
debug!("Synthetic test module:\n{}\n", pprust::item_to_string(&item));
(item, reexport)
}
fn nospan<T>(t: T) -> codemap::Spanned<T> {
codemap::Spanned { node: t, span: DUMMY_SP }
}
fn path_node(ids: Vec<Ident>) -> ast::Path {
ast::Path {
span: DUMMY_SP,
segments: ids.into_iter().map(|id| ast::PathSegment::from_ident(id, DUMMY_SP)).collect(),
}
}
fn path_name_i(idents: &[Ident]) -> String {
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
idents.iter().map(|i| i.to_string()).collect::<Vec<String>>().join("::")
}
fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
// The vector of test_descs for this crate
let test_descs = mk_test_descs(cx);
// FIXME #15962: should be using quote_item, but that stringifies
// __test_reexports, causing it to be reinterned, losing the
// gensym information.
let sp = ignored_span(cx, DUMMY_SP);
let ecx = &cx.ext_cx;
let struct_type = ecx.ty_path(ecx.path(sp, vec![ecx.ident_of("self"),
ecx.ident_of("test"),
ecx.ident_of("TestDescAndFn")]));
let static_lt = ecx.lifetime(sp, keywords::StaticLifetime.ident());
// &'static [self::test::TestDescAndFn]
let static_type = ecx.ty_rptr(sp,
ecx.ty(sp, ast::TyKind::Slice(struct_type)),
Some(static_lt),
ast::Mutability::Immutable);
// static TESTS: $static_type = &[...];
ecx.item_const(sp,
ecx.ident_of("TESTS"),
static_type,
test_descs)
}
fn is_test_crate(krate: &ast::Crate) -> bool {
match attr::find_crate_name(&krate.attrs) {
Some(s) if "test" == s.as_str() => true,
_ => false
}
}
fn mk_test_descs(cx: &TestCtxt) -> P<ast::Expr> {
debug!("building test vector from {} tests", cx.testfns.len());
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::AddrOf(ast::Mutability::Immutable,
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Array(cx.testfns.iter().map(|test| {
mk_test_desc_and_fn_rec(cx, test)
}).collect()),
span: DUMMY_SP,
attrs: ast::ThinVec::new(),
})),
span: DUMMY_SP,
attrs: ast::ThinVec::new(),
})
}
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
// FIXME #15962: should be using quote_expr, but that stringifies
// __test_reexports, causing it to be reinterned, losing the
// gensym information.
let span = ignored_span(cx, test.span);
let path = test.path.clone();
let ecx = &cx.ext_cx;
let self_id = ecx.ident_of("self");
let test_id = ecx.ident_of("test");
// creates self::test::$name
let test_path = |name| {
ecx.path(span, vec![self_id, test_id, ecx.ident_of(name)])
};
// creates $name: $expr
let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr);
debug!("encoding {}", path_name_i(&path[..]));
// path to the #[test] function: "foo::bar::baz"
let path_string = path_name_i(&path[..]);
let name_expr = ecx.expr_str(span, Symbol::intern(&path_string));
// self::test::StaticTestName($name_expr)
let name_expr = ecx.expr_call(span,
ecx.expr_path(test_path("StaticTestName")),
vec![name_expr]);
let ignore_expr = ecx.expr_bool(span, test.ignore);
let should_panic_path = |name| {
ecx.path(span, vec![self_id, test_id, ecx.ident_of("ShouldPanic"), ecx.ident_of(name)])
};
let fail_expr = match test.should_panic {
ShouldPanic::No => ecx.expr_path(should_panic_path("No")),
ShouldPanic::Yes(msg) => {
match msg {
Some(msg) => {
let msg = ecx.expr_str(span, msg);
let path = should_panic_path("YesWithMessage");
ecx.expr_call(span, ecx.expr_path(path), vec![msg])
}
None => ecx.expr_path(should_panic_path("Yes")),
}
}
};
// self::test::TestDesc { ... }
let desc_expr = ecx.expr_struct(
span,
test_path("TestDesc"),
vec![field("name", name_expr),
field("ignore", ignore_expr),
field("should_panic", fail_expr)]);
let mut visible_path = match cx.toplevel_reexport {
Some(id) => vec![id],
None => {
let diag = cx.span_diagnostic;
diag.bug("expected to find top-level re-export name, but found None");
}
};
visible_path.extend(path);
let fn_expr = ecx.expr_path(ecx.path_global(span, visible_path));
let variant_name = if test.bench { "StaticBenchFn" } else { "StaticTestFn" };
// self::test::$variant_name($fn_expr)
let testfn_expr = ecx.expr_call(span, ecx.expr_path(test_path(variant_name)), vec![fn_expr]);
// self::test::TestDescAndFn { ... }
ecx.expr_struct(span,
test_path("TestDescAndFn"),
vec![field("desc", desc_expr),
field("testfn", testfn_expr)])
}
| {
"content_hash": "9ecb39239600e8795fbc83e4ab93eb86",
"timestamp": "",
"source": "github",
"line_count": 701,
"max_line_length": 100,
"avg_line_length": 35.52924393723252,
"alnum_prop": 0.5221231831687143,
"repo_name": "erickt/rust-syntex",
"id": "a0d1785c6ff14a45f5d0d7e479200f63740a5259",
"size": "24906",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "syntex_syntax/src/test.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Rust",
"bytes": "1372734"
}
],
"symlink_target": ""
} |
Data persistence using MongoDB.
| {
"content_hash": "f28fdeac4eff5b2c35c9281dc702f675",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.84375,
"repo_name": "rliu054/simpletask",
"id": "f2892dfc6047b372ec69a915a5cc00f63fc567e6",
"size": "39",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "26484"
}
],
"symlink_target": ""
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Bunashibu.Kikan {
public class QuadraticEaseInOut {
public QuadraticEaseInOut(Vector3 start, Vector3 dest, float duration) {
_start = start;
_distance = dest - start;
_duration = duration;
_curTime = 0;
}
public Vector3 GetNextPosition() {
_curTime += Time.deltaTime;
float x = Calculate(_curTime, _start.x, _distance.x, _duration);
float y = Calculate(_curTime, _start.y, _distance.y, _duration);
float z = Calculate(_curTime, _start.z, _distance.z, _duration);
return new Vector3(x, y, z);
}
/* t: current time *
* b: start value *
* c: dest - start value (e.g. dest:100, start:10, c is 90) *
* d: duration */
private float Calculate(float t, float b, float c, float d) {
t /= d/2;
if (t < 1)
return c/2*t*t + b;
--t;
return -c/2 * (t*(t-2) - 1) + b;
}
private float _curTime;
private float _duration;
private Vector3 _start;
private Vector3 _distance;
}
}
| {
"content_hash": "aa0ca2e15b67628fb021c351d8612b76",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 76,
"avg_line_length": 30.048780487804876,
"alnum_prop": 0.5332792207792207,
"repo_name": "bunashibu/kikan",
"id": "d48700c0841f2ebaf851d5f178388248adb2d224",
"size": "1234",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Scripts/QuadraticEaseInOut.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "340641"
},
{
"name": "HLSL",
"bytes": "13994"
},
{
"name": "ShaderLab",
"bytes": "80492"
}
],
"symlink_target": ""
} |
reserved=12582912
availableMemory=$((1024 * $( (grep MemAvailable /proc/meminfo || grep MemTotal /proc/meminfo) | sed 's/[^0-9]//g' ) ))
if [ $availableMemory -le $(($reserved * 2)) ]; then
echo "Not enough memory" >&2
exit 1
fi
availableMemory=$(($availableMemory - $reserved))
rr_cache_size=$(($availableMemory / 3))
# Use roughly twice as much rrset cache memory as msg cache memory
msg_cache_size=$(($rr_cache_size / 2))
nproc=$(nproc)
export nproc
if [ "$nproc" -gt 1 ]; then
threads=$((nproc - 1))
# Calculate base 2 log of the number of processors
nproc_log=$(perl -e 'printf "%5.5f\n", log($ENV{nproc})/log(2);')
# Round the logarithm to an integer
rounded_nproc_log="$(printf '%.*f\n' 0 "$nproc_log")"
# Set *-slabs to a power of 2 close to the num-threads value.
# This reduces lock contention.
slabs=$(( 2 ** rounded_nproc_log ))
else
threads=1
slabs=4
fi
if [ ! -f /opt/unbound/etc/unbound/unbound.conf ]; then
sed \
-e "s/@MSG_CACHE_SIZE@/${msg_cache_size}/" \
-e "s/@RR_CACHE_SIZE@/${rr_cache_size}/" \
-e "s/@THREADS@/${threads}/" \
-e "s/@SLABS@/${slabs}/" \
> /opt/unbound/etc/unbound/unbound.conf << EOT
server:
###########################################################################
# BASIC SETTINGS
###########################################################################
# Time to live maximum for RRsets and messages in the cache. If the maximum
# kicks in, responses to clients still get decrementing TTLs based on the
# original (larger) values. When the internal TTL expires, the cache item
# has expired. Can be set lower to force the resolver to query for data
# often, and not trust (very large) TTL values.
cache-max-ttl: 86400
# Time to live minimum for RRsets and messages in the cache. If the minimum
# kicks in, the data is cached for longer than the domain owner intended,
# and thus less queries are made to look up the data. Zero makes sure the
# data in the cache is as the domain owner intended, higher values,
# especially more than an hour or so, can lead to trouble as the data in
# the cache does not match up with the actual data any more.
cache-min-ttl: 300
# Set the working directory for the program.
directory: "/opt/unbound/etc/unbound"
# RFC 6891. Number of bytes size to advertise as the EDNS reassembly buffer
# size. This is the value put into datagrams over UDP towards peers.
# 4096 is RFC recommended. 1472 has a reasonable chance to fit within a
# single Ethernet frame, thus lessing the chance of fragmentation
# reassembly problems (usually seen as timeouts). Setting to 512 bypasses
# even the most stringent path MTU problems, but is not recommended since
# the amount of TCP fallback generated is excessive.
edns-buffer-size: 1472
# Listen to for queries from clients and answer from this network interface
# and port.
interface: 0.0.0.0@53
# Rotates RRSet order in response (the pseudo-random number is taken from
# the query ID, for speed and thread safety).
rrset-roundrobin: yes
# Drop user privileges after binding the port.
username: "_unbound"
###########################################################################
# LOGGING
###########################################################################
# Do not print log lines to inform about local zone actions
log-local-actions: no
# Do not print one line per query to the log
log-queries: no
# Do not print one line per reply to the log
log-replies: no
# Do not print log lines that say why queries return SERVFAIL to clients
log-servfail: no
# Further limit logging
logfile: /dev/null
# Only log errors
verbosity: 0
###########################################################################
# PRIVACY SETTINGS
###########################################################################
# RFC 8198. Use the DNSSEC NSEC chain to synthesize NXDO-MAIN and other
# denials, using information from previous NXDO-MAINs answers. In other
# words, use cached NSEC records to generate negative answers within a
# range and positive answers from wildcards. This increases performance,
# decreases latency and resource utilization on both authoritative and
# recursive servers, and increases privacy. Also, it may help increase
# resilience to certain DoS attacks in some circumstances.
aggressive-nsec: yes
# Extra delay for timeouted UDP ports before they are closed, in msec.
# This prevents very delayed answer packets from the upstream (recursive)
# servers from bouncing against closed ports and setting off all sort of
# close-port counters, with eg. 1500 msec. When timeouts happen you need
# extra sockets, it checks the ID and remote IP of packets, and unwanted
# packets are added to the unwanted packet counter.
delay-close: 10000
# Prevent the unbound server from forking into the background as a daemon
do-daemonize: no
# Add localhost to the do-not-query-address list.
do-not-query-localhost: no
# Number of bytes size of the aggressive negative cache.
neg-cache-size: 4M
# Send minimum amount of information to upstream servers to enhance
# privacy (best privacy).
qname-minimisation: yes
###########################################################################
# SECURITY SETTINGS
###########################################################################
# Only give access to recursion clients from LAN IPs
access-control: 127.0.0.1/32 allow
access-control: 192.168.0.0/16 allow
access-control: 172.16.0.0/12 allow
access-control: 10.0.0.0/8 allow
# access-control: fc00::/7 allow
# access-control: ::1/128 allow
# File with trust anchor for one zone, which is tracked with RFC5011
# probes.
auto-trust-anchor-file: "var/root.key"
# Enable chroot (i.e, change apparent root directory for the current
# running process and its children)
chroot: "/opt/unbound/etc/unbound"
# Deny queries of type ANY with an empty response.
deny-any: yes
# Harden against algorithm downgrade when multiple algorithms are
# advertised in the DS record.
harden-algo-downgrade: yes
# RFC 8020. returns nxdomain to queries for a name below another name that
# is already known to be nxdomain.
harden-below-nxdomain: yes
# Require DNSSEC data for trust-anchored zones, if such data is absent, the
# zone becomes bogus. If turned off you run the risk of a downgrade attack
# that disables security for a zone.
harden-dnssec-stripped: yes
# Only trust glue if it is within the servers authority.
harden-glue: yes
# Ignore very large queries.
harden-large-queries: yes
# Perform additional queries for infrastructure data to harden the referral
# path. Validates the replies if trust anchors are configured and the zones
# are signed. This enforces DNSSEC validation on nameserver NS sets and the
# nameserver addresses that are encountered on the referral path to the
# answer. Experimental option.
harden-referral-path: no
# Ignore very small EDNS buffer sizes from queries.
harden-short-bufsize: yes
# Refuse id.server and hostname.bind queries
hide-identity: yes
# Refuse version.server and version.bind queries
hide-version: yes
# Report this identity rather than the hostname of the server.
identity: "DNS"
# These private network addresses are not allowed to be returned for public
# internet names. Any occurrence of such addresses are removed from DNS
# answers. Additionally, the DNSSEC validator may mark the answers bogus.
# This protects against DNS Rebinding
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
# private-address: fd00::/8
# private-address: fe80::/10
# private-address: ::ffff:0:0/96
# Enable ratelimiting of queries (per second) sent to nameserver for
# performing recursion. More queries are turned away with an error
# (servfail). This stops recursive floods (e.g., random query names), but
# not spoofed reflection floods. Cached responses are not rate limited by
# this setting. Experimental option.
ratelimit: 1000
# Use this certificate bundle for authenticating connections made to
# outside peers (e.g., auth-zone urls, DNS over TLS connections).
tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
# Set the total number of unwanted replies to eep track of in every thread.
# When it reaches the threshold, a defensive action of clearing the rrset
# and message caches is taken, hopefully flushing away any poison.
# Unbound suggests a value of 10 million.
unwanted-reply-threshold: 10000
# Use 0x20-encoded random bits in the query to foil spoof attempts. This
# perturbs the lowercase and uppercase of query names sent to authority
# servers and checks if the reply still has the correct casing.
# This feature is an experimental implementation of draft dns-0x20.
# Experimental option.
use-caps-for-id: yes
# Help protect users that rely on this validator for authentication from
# potentially bad data in the additional section. Instruct the validator to
# remove data from the additional section of secure messages that are not
# signed properly. Messages that are insecure, bogus, indeterminate or
# unchecked are not affected.
val-clean-additional: yes
###########################################################################
# PERFORMANCE SETTINGS
###########################################################################
# https://nlnetlabs.nl/documentation/unbound/howto-optimise/
# https://nlnetlabs.nl/news/2019/Feb/05/unbound-1.9.0-released/
# Number of slabs in the infrastructure cache. Slabs reduce lock contention
# by threads. Must be set to a power of 2.
infra-cache-slabs: @SLABS@
# Number of incoming TCP buffers to allocate per thread. Default
# is 10. If set to 0, or if do-tcp is "no", no TCP queries from
# clients are accepted. For larger installations increasing this
# value is a good idea.
incoming-num-tcp: 10
# Number of slabs in the key cache. Slabs reduce lock contention by
# threads. Must be set to a power of 2. Setting (close) to the number
# of cpus is a reasonable guess.
key-cache-slabs: @SLABS@
# Number of bytes size of the message cache.
# Unbound recommendation is to Use roughly twice as much rrset cache memory
# as you use msg cache memory.
msg-cache-size: @MSG_CACHE_SIZE@
# Number of slabs in the message cache. Slabs reduce lock contention by
# threads. Must be set to a power of 2. Setting (close) to the number of
# cpus is a reasonable guess.
msg-cache-slabs: @SLABS@
# The number of queries that every thread will service simultaneously. If
# more queries arrive that need servicing, and no queries can be jostled
# out (see jostle-timeout), then the queries are dropped.
# This is best set at half the number of the outgoing-range.
# This Unbound instance was compiled with libevent so it can efficiently
# use more than 1024 file descriptors.
num-queries-per-thread: 4096
# The number of threads to create to serve clients.
# This is set dynamically at run time to effectively use available CPUs
# resources
num-threads: @THREADS@
# Number of ports to open. This number of file descriptors can be opened
# per thread.
# This Unbound instance was compiled with libevent so it can efficiently
# use more than 1024 file descriptors.
outgoing-range: 8192
# Number of bytes size of the RRset cache.
# Use roughly twice as much rrset cache memory as msg cache memory
rrset-cache-size: @RR_CACHE_SIZE@
# Number of slabs in the RRset cache. Slabs reduce lock contention by
# threads. Must be set to a power of 2.
rrset-cache-slabs: @SLABS@
# Do no insert authority/additional sections into response messages when
# those sections are not required. This reduces response size
# significantly, and may avoid TCP fallback for some responses. This may
# cause a slight speedup.
minimal-responses: yes
# # Fetch the DNSKEYs earlier in the validation process, when a DS record
# is encountered. This lowers the latency of requests at the expense of
# little more CPU usage.
prefetch: yes
# Fetch the DNSKEYs earlier in the validation process, when a DS record is
# encountered. This lowers the latency of requests at the expense of little
# more CPU usage.
prefetch-key: yes
# Have unbound attempt to serve old responses from cache with a TTL of 0 in
# the response without waiting for the actual resolution to finish. The
# actual resolution answer ends up in the cache later on.
serve-expired: yes
# Open dedicated listening sockets for incoming queries for each thread and
# try to set the SO_REUSEPORT socket option on each socket. May distribute
# incoming queries to threads more evenly.
so-reuseport: yes
###########################################################################
# LOCAL ZONE
###########################################################################
# Include file for local-data and local-data-ptr
include: /opt/unbound/etc/unbound/a-records.conf
include: /opt/unbound/etc/unbound/srv-records.conf
###########################################################################
# FORWARD ZONE
###########################################################################
include: /opt/unbound/etc/unbound/forward-records.conf
remote-control:
control-enable: no
EOT
fi
mkdir -p /opt/unbound/etc/unbound/dev && \
cp -a /dev/random /dev/urandom /dev/null /opt/unbound/etc/unbound/dev/
mkdir -p -m 700 /opt/unbound/etc/unbound/var && \
chown _unbound:_unbound /opt/unbound/etc/unbound/var && \
/opt/unbound/sbin/unbound-anchor -a /opt/unbound/etc/unbound/var/root.key
exec /opt/unbound/sbin/unbound -d -c /opt/unbound/etc/unbound/unbound.conf
| {
"content_hash": "98428af454a50800460bc86980247981",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 118,
"avg_line_length": 41.5919540229885,
"alnum_prop": 0.6508221638800608,
"repo_name": "MatthewVance/unbound-docker",
"id": "ed25a6fa8eb5405e84d085d034a55ee068caafc1",
"size": "14487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "1.11.0/unbound.sh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "113940"
},
{
"name": "Shell",
"bytes": "358394"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="88f54fac-c463-4910-ab2b-48a0707f3189" name="Default" comment="" />
<ignored path="Huffman-Encoding.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path="$PROJECT_DIR$/out/" />
<ignored path=".idea/dataSources.local.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/Huffman-Encoding$HuffmanManagerTest.coverage" NAME="HuffmanManagerTest Coverage Results" MODIFIED="1490774261780" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
<FILTER>com.functionalTests.*</FILTER>
</SUITE>
<SUITE FILE_PATH="coverage/Huffman-Encoding$Main.coverage" NAME="Main Coverage Results" MODIFIED="1488204216000" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/Huffman-Encoding$HuffmanOperationsTest.coverage" NAME="HuffmanOperationsTest Coverage Results" MODIFIED="1490182227148" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
<FILTER>com.functionalTests.*</FILTER>
</SUITE>
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="Huffman-Encoding" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="5" column="23" selection-start-line="5" selection-start-column="23" selection-end-line="5" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffmanOperations.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="626">
<caret line="151" column="13" selection-start-line="151" selection-start-column="13" selection-end-line="151" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffmanManager.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="814">
<caret line="61" column="31" selection-start-line="61" selection-start-column="31" selection-end-line="61" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffmanManagerTest.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/functionalTests/HuffmanManagerTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="352">
<caret line="27" column="9" selection-start-line="27" selection-start-column="9" selection-end-line="27" selection-end-column="9" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffNode.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="14" column="34" selection-start-line="14" selection-start-column="34" selection-end-line="14" selection-end-column="34" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffmanOperationsTest.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/functionalTests/HuffmanOperationsTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1034">
<caret line="47" column="35" selection-start-line="47" selection-start-column="35" selection-end-line="47" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HuffmanOperationsPerformanceTest.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2296">
<caret line="127" column="5" selection-start-line="127" selection-start-column="5" selection-end-line="127" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
<option value="JUnit4 Test Class" />
</list>
</option>
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/com/company/CharInString.java" />
<option value="$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsTest.java" />
<option value="$PROJECT_DIR$/src/com/company/HuffmanOperationsTest.java" />
<option value="$PROJECT_DIR$/src/com/company/HuffmanManagerTest.java" />
<option value="$PROJECT_DIR$/src/com/company/HuffNode.java" />
<option value="$PROJECT_DIR$/src/com/functionalTests/HuffmanOperationsTest.java" />
<option value="$PROJECT_DIR$/src/com/functionalTests/HuffmanManagerTest.java" />
<option value="$PROJECT_DIR$/src/com/company/HuffmanManager.java" />
<option value="$PROJECT_DIR$/src/com/company/Main.java" />
<option value="$PROJECT_DIR$/src/com/company/HuffmanOperations.java" />
<option value="$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-9" />
<option name="y" value="-9" />
<option name="width" value="1938" />
<option name="height" value="1048" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="com" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="performanceTest" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="com" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="functionalTests" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Huffman-Encoding" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="com" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="company" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="aspect.path.notification.shown" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
</component>
<component name="RecentsManager">
<key name="CreateTestDialog.RecentsKey">
<recent name="com.company" />
</key>
<key name="CreateTestDialog.Recents.Supers">
<recent name="" />
</key>
</component>
<component name="RunManager" selected="JUnit.HuffmanOperationsPerformanceTest">
<configuration default="false" name="Main" type="Application" factoryName="Application" temporary="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.company.Main" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="Huffman-Encoding" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
<configuration default="false" name="com.performanceTest in Huffman-Encoding" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="com.performanceTest.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="Huffman-Encoding" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="com.performanceTest" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="false" name="HuffmanOperationsTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="com.functionalTests.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="Huffman-Encoding" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="com.functionalTests" />
<option name="MAIN_CLASS_NAME" value="com.functionalTests.HuffmanOperationsTest" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="false" name="HuffmanOperationsPerformanceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="com.performanceTest.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="Huffman-Encoding" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="com.performanceTest" />
<option name="MAIN_CLASS_NAME" value="com.performanceTest.HuffmanOperationsPerformanceTest" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="false" name="HuffmanManagerTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="com.functionalTests.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="Huffman-Encoding" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="com.functionalTests" />
<option name="MAIN_CLASS_NAME" value="com.functionalTests.HuffmanManagerTest" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="ArquillianJUnit" factoryName="">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="ArquillianTestNG" factoryName="">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="Cold Fusion runner description" factoryName="Cold Fusion" custom_browser="" web_path="">
<method />
</configuration>
<configuration default="true" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="myFilePath" />
<option name="GLUE" />
<option name="myNameFilter" />
<option name="myGeneratedName" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="FlashRunConfigurationType" factoryName="Flash App">
<option name="BCName" value="" />
<option name="IOSSimulatorSdkPath" value="" />
<option name="adlOptions" value="" />
<option name="airProgramParameters" value="" />
<option name="appDescriptorForEmulator" value="Android" />
<option name="debugTransport" value="USB" />
<option name="debuggerSdkRaw" value="BC SDK" />
<option name="emulator" value="NexusOne" />
<option name="emulatorAdlOptions" value="" />
<option name="fastPackaging" value="true" />
<option name="fullScreenHeight" value="0" />
<option name="fullScreenWidth" value="0" />
<option name="launchUrl" value="false" />
<option name="launcherParameters">
<LauncherParameters>
<option name="browser" value="a7bb68e0-33c0-4d6f-a81a-aac1fdb870c8" />
<option name="launcherType" value="OSDefault" />
<option name="newPlayerInstance" value="false" />
<option name="playerPath" value="FlashPlayerDebugger.exe" />
</LauncherParameters>
</option>
<option name="mobileRunTarget" value="Emulator" />
<option name="moduleName" value="" />
<option name="overriddenMainClass" value="" />
<option name="overriddenOutputFileName" value="" />
<option name="overrideMainClass" value="false" />
<option name="runTrusted" value="true" />
<option name="screenDpi" value="0" />
<option name="screenHeight" value="0" />
<option name="screenWidth" value="0" />
<option name="url" value="http://" />
<option name="usbDebugPort" value="7936" />
<method />
</configuration>
<configuration default="true" type="FlexUnitRunConfigurationType" factoryName="FlexUnit" appDescriptorForEmulator="Android" class_name="" emulatorAdlOptions="" method_name="" package_name="" scope="Class">
<option name="BCName" value="" />
<option name="launcherParameters">
<LauncherParameters>
<option name="browser" value="a7bb68e0-33c0-4d6f-a81a-aac1fdb870c8" />
<option name="launcherType" value="OSDefault" />
<option name="newPlayerInstance" value="false" />
<option name="playerPath" value="FlashPlayerDebugger.exe" />
</LauncherParameters>
</option>
<option name="moduleName" value="" />
<option name="trusted" value="true" />
<method />
</configuration>
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="GrailsRunConfigurationType" factoryName="Grails">
<setting name="vmparams" value="" />
<setting name="cmdLine" value="run-app" />
<setting name="passParentEnv" value="true" />
<setting name="launchBrowser" value="true" />
<setting name="depsClasspath" value="false" />
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="JUnitTestDiscovery" factoryName="JUnit Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<envs />
<method />
</configuration>
<configuration default="true" type="Java Scratch" factoryName="Java Scratch">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="SCRATCH_FILE_ID" value="0" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
<method />
</configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="Huffman-Encoding" />
<envs />
<method />
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<envs />
<method />
</configuration>
<configuration default="true" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="TestNGTestDiscovery" factoryName="TestNG Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<node-interpreter>project</node-interpreter>
<node-options />
<gulpfile />
<tasks />
<arguments />
<envs />
<method />
</configuration>
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
<command value="run-script" />
<scripts />
<node-interpreter value="project" />
<envs />
<method />
</configuration>
<configuration default="true" type="osgi.bnd.run" factoryName="Run Launcher">
<method />
</configuration>
<configuration default="true" type="osgi.bnd.run" factoryName="Test Launcher (JUnit)">
<method />
</configuration>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="Application.Main" />
<item index="1" class="java.lang.String" itemvalue="JUnit.com.performanceTest in Huffman-Encoding" />
<item index="2" class="java.lang.String" itemvalue="JUnit.HuffmanOperationsTest" />
<item index="3" class="java.lang.String" itemvalue="JUnit.HuffmanOperationsPerformanceTest" />
<item index="4" class="java.lang.String" itemvalue="JUnit.HuffmanManagerTest" />
</list>
<recent_temporary>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="JUnit.HuffmanOperationsPerformanceTest" />
<item index="1" class="java.lang.String" itemvalue="JUnit.HuffmanOperationsTest" />
<item index="2" class="java.lang.String" itemvalue="JUnit.HuffmanManagerTest" />
<item index="3" class="java.lang.String" itemvalue="Application.Main" />
<item index="4" class="java.lang.String" itemvalue="JUnit.com.performanceTest in Huffman-Encoding" />
</list>
</recent_temporary>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="88f54fac-c463-4910-ab2b-48a0707f3189" name="Default" comment="" />
<created>1488128819886</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1488128819886</updated>
<workItem from="1488128821464" duration="7000" />
<workItem from="1488128906805" duration="57000" />
<workItem from="1488129075852" duration="522000" />
<workItem from="1488134141896" duration="1110000" />
<workItem from="1488135374384" duration="3376000" />
<workItem from="1488150739177" duration="9453000" />
<workItem from="1488191380006" duration="8300000" />
<workItem from="1488199846617" duration="7934000" />
<workItem from="1488208709752" duration="1007000" />
<workItem from="1488209748593" duration="28000" />
<workItem from="1488209966124" duration="10000" />
<workItem from="1488210016336" duration="21000" />
<workItem from="1488210065657" duration="299000" />
<workItem from="1488210394608" duration="1558000" />
<workItem from="1488478008119" duration="87000" />
<workItem from="1490172651180" duration="11251000" />
<workItem from="1490188007955" duration="4363000" />
<workItem from="1490601312923" duration="445000" />
<workItem from="1490641714567" duration="6192000" />
<workItem from="1490695853095" duration="48000" />
<workItem from="1490697991678" duration="1501000" />
<workItem from="1490770974809" duration="5275000" />
<workItem from="1490779782835" duration="3214000" />
<workItem from="1491154112344" duration="629000" />
<workItem from="1491383065264" duration="865000" />
<workItem from="1491384766154" duration="55000" />
<workItem from="1491388304855" duration="302000" />
<workItem from="1491388868413" duration="658000" />
</task>
<servers />
</component>
<component name="TestHistory">
<history-entry file="HuffmanManagerTest - 2017.04.05 at 12h 45m 35s.xml">
<configuration name="HuffmanManagerTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsPerformanceTest - 2017.04.05 at 11h 09m 39s.xml">
<configuration name="HuffmanOperationsPerformanceTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsPerformanceTest - 2017.04.05 at 11h 10m 29s.xml">
<configuration name="HuffmanOperationsPerformanceTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsPerformanceTest - 2017.04.05 at 11h 11m 46s.xml">
<configuration name="HuffmanOperationsPerformanceTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsPerformanceTest - 2017.04.05 at 12h 32m 38s.xml">
<configuration name="HuffmanOperationsPerformanceTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsPerformanceTest - 2017.04.05 at 12h 45m 50s.xml">
<configuration name="HuffmanOperationsPerformanceTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsTest - 2017.03.29 at 11h 34m 11s.xml">
<configuration name="HuffmanOperationsTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsTest - 2017.04.05 at 11h 08m 38s.xml">
<configuration name="HuffmanOperationsTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsTest - 2017.04.05 at 12h 45m 29s.xml">
<configuration name="HuffmanOperationsTest" configurationId="JUnit" />
</history-entry>
<history-entry file="HuffmanOperationsTest - 2017.04.05 at 12h 45m 41s.xml">
<configuration name="HuffmanOperationsTest" configurationId="JUnit" />
</history-entry>
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="68567000" />
</component>
<component name="ToolWindowManager">
<frame x="-9" y="-9" width="1938" height="1048" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32930845" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26783755" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.196875" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.30076838" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3296875" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32930845" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="148" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="836">
<caret line="42" column="31" selection-start-line="42" selection-start-column="31" selection-end-line="42" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="24" column="11" selection-start-line="24" selection-start-column="11" selection-end-line="24" selection-end-column="11" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="132">
<caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="924">
<caret line="42" column="31" selection-start-line="42" selection-start-column="31" selection-end-line="42" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="24" column="11" selection-start-line="24" selection-start-column="11" selection-end-line="24" selection-end-column="11" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="132">
<caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="836">
<caret line="42" column="31" selection-start-line="42" selection-start-column="31" selection-end-line="42" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="24" column="11" selection-start-line="24" selection-start-column="11" selection-end-line="24" selection-end-column="11" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="132">
<caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2750">
<caret line="125" column="23" selection-start-line="125" selection-start-column="23" selection-end-line="125" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="24" column="11" selection-start-line="24" selection-start-column="11" selection-end-line="24" selection-end-column="11" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="132">
<caret line="6" column="2" selection-start-line="6" selection-start-column="2" selection-end-line="6" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1100">
<caret line="64" column="25" selection-start-line="64" selection-start-column="25" selection-end-line="64" selection-end-column="25" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="946">
<caret line="43" column="52" selection-start-line="43" selection-start-column="52" selection-end-line="43" selection-end-column="52" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="6" column="2" selection-start-line="6" selection-start-column="2" selection-end-line="6" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="748">
<caret line="37" column="16" selection-start-line="37" selection-start-column="0" selection-end-line="38" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="8" column="26" selection-start-line="8" selection-start-column="26" selection-end-line="8" selection-end-column="26" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="352">
<caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="792">
<caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
<caret line="10" column="44" selection-start-line="10" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="12" column="17" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_101/src.zip!/java/util/Queue.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="94">
<caret line="134" column="35" selection-start-line="134" selection-start-column="35" selection-end-line="134" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_101/src.zip!/java/io/PrintWriter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="206">
<caret line="129" column="11" selection-start-line="129" selection-start-column="11" selection-end-line="129" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/encodedMessage.txt" />
<entry file="file://$PROJECT_DIR$/Huffman-Encoding.iml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/org/junit/runners/model/FrameworkMethod.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="33" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/org/junit/internal/runners/model/ReflectiveCallable.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../../happy-news/crawler/src/main/java/nl/fhict/happynews/crawler/crawler/TwitterCrawler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="21" column="0" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="5" column="23" selection-start-line="5" selection-start-column="23" selection-end-line="5" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanOperations.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="626">
<caret line="151" column="13" selection-start-line="151" selection-start-column="13" selection-end-line="151" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffmanManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="814">
<caret line="61" column="31" selection-start-line="61" selection-start-column="31" selection-end-line="61" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/functionalTests/HuffmanOperationsTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1034">
<caret line="47" column="35" selection-start-line="47" selection-start-column="35" selection-end-line="47" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/functionalTests/HuffmanManagerTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="352">
<caret line="27" column="9" selection-start-line="27" selection-start-column="9" selection-end-line="27" selection-end-column="9" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/company/HuffNode.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="14" column="34" selection-start-line="14" selection-start-column="34" selection-end-line="14" selection-end-column="34" />
<folding>
<element signature="e#666#667#0" expanded="true" />
<element signature="e#693#694#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/performanceTest/HuffmanOperationsPerformanceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2296">
<caret line="127" column="5" selection-start-line="127" selection-start-column="5" selection-end-line="127" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project> | {
"content_hash": "de35b632cd97ff1c3328e3790b08fbf7",
"timestamp": "",
"source": "github",
"line_count": 1414,
"max_line_length": 299,
"avg_line_length": 51.301980198019805,
"alnum_prop": 0.6319598571842131,
"repo_name": "SanderVanAndel/JCF41",
"id": "d6bce80a19427b0f70f76ec54ab160007a115c46",
"size": "72541",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Huffman-Encoding/.idea/workspace.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "285"
},
{
"name": "Java",
"bytes": "34911"
}
],
"symlink_target": ""
} |
/**
* This class is the main view for the application. It is specified in app.js as the
* "mainView" property. That setting causes an instance of this class to be created and
* added to the Viewport container.
*
* TODO - Replace this content of this view to suite the needs of your application.
*/
Ext.define('MyApp.view.main.Main', {
extend: 'Ext.tab.Panel',
xtype: 'app-main',
requires: [
'Ext.MessageBox',
'MyApp.view.main.MainController',
'MyApp.view.main.MainModel',
'MyApp.view.main.List'
],
controller: 'main',
viewModel: 'main',
defaults: {
tab: {
iconAlign: 'top'
},
styleHtmlContent: true
},
tabBarPosition: 'bottom',
items: [
{
title: 'Home',
iconCls: 'x-fa fa-home',
layout: 'fit',
// The following grid shares a store with the classic version's grid as well!
items: [{
xtype: 'mainlist'
}]
},{
title: 'Users',
iconCls: 'x-fa fa-user',
bind: {
html: '{loremIpsum}'
}
},{
title: 'Groups',
iconCls: 'x-fa fa-users',
bind: {
html: '{loremIpsum}'
}
},{
title: 'Settings',
iconCls: 'x-fa fa-cog',
bind: {
html: '{loremIpsum}'
}
}
]
});
| {
"content_hash": "4c25a8a4093d66f82f9729268229bbd8",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 89,
"avg_line_length": 24.37704918032787,
"alnum_prop": 0.4761264290517821,
"repo_name": "okiloco/electic",
"id": "c7840d55f5803e846bfa4b7f7d173be5a582dfde",
"size": "1487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyApp/modern/src/view/main/Main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "4431328"
},
{
"name": "HTML",
"bytes": "5557108"
},
{
"name": "JavaScript",
"bytes": "73682497"
},
{
"name": "PHP",
"bytes": "1719940"
},
{
"name": "Ruby",
"bytes": "9277"
}
],
"symlink_target": ""
} |
package com.hazelcast.internal.nio.ascii;
import static com.hazelcast.test.HazelcastTestSupport.assertTrueEventually;
import static com.hazelcast.test.Accessors.getAddress;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import com.hazelcast.config.Config;
import com.hazelcast.config.MemcacheProtocolConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.annotation.QuickTest;
/**
* Tests enabling Memcache text protocol by {@link MemcacheProtocolConfig}.
*/
@RunWith(HazelcastParallelClassRunner.class)
@Category(QuickTest.class)
public class MemcacheProtocolFilterTest extends AbstractTextProtocolsTestBase {
/**
* <pre>
* Given: Memcache protocol is explicitly disabled
* When: version commad prefix (ver) is used by client
* Then: connection is terminated after reading the first 3 bytes (protocol header)
* </pre>
*/
@Test
public void testRestApiDisabled() throws Exception {
Config config = new Config();
config.getNetworkConfig().setMemcacheProtocolConfig(new MemcacheProtocolConfig().setEnabled(false));
HazelcastInstance hz = factory.newHazelcastInstance(config);
TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress());
try {
client.connect();
client.sendData("ver");
client.waitUntilClosed();
assertEquals(3, client.getSentBytesCount());
assertEquals(0, client.getReceivedBytes().length);
assertTrue(client.isConnectionClosed());
} finally {
client.close();
}
}
/**
* <pre>
* Given: Memcache protocol config is not provided (default is used)
* When: version commad prefix (ver) is used by client
* Then: connection is terminated after reading the first 3 bytes (protocol header)
* </pre>
*/
@Test
public void testMemcacheDisabledByDefault() throws Exception {
HazelcastInstance hz = factory.newHazelcastInstance(null);
TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress());
try {
client.connect();
client.sendData("ver");
client.waitUntilClosed();
assertEquals(3, client.getSentBytesCount());
assertEquals(0, client.getReceivedBytes().length);
assertTrue(client.isConnectionClosed());
} finally {
client.close();
}
}
/**
* <pre>
* Given: Memcache protocol is explicitly enabled
* When: HTTP GET command prefix is used by client
* Then: connection is terminated after reading the first 3 bytes (protocol header)
* </pre>
*/
@Test
public void testRestApiWhenMemcacheEnabled() throws Exception {
Config config = new Config();
config.getNetworkConfig().setMemcacheProtocolConfig(new MemcacheProtocolConfig().setEnabled(true));
HazelcastInstance hz = factory.newHazelcastInstance(config);
TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress());
try {
client.connect();
client.sendData("GET");
client.waitUntilClosed();
assertEquals(3, client.getSentBytesCount());
assertEquals(0, client.getReceivedBytes().length);
assertTrue(client.isConnectionClosed());
} finally {
client.close();
}
}
/**
* <pre>
* Given: Memcache protocol is explicitly enabled
* When: version command is used
* Then: correct response is provided
* </pre>
*/
@Test
public void testVersionCommandWithMemcacheEnabled() throws Exception {
Config config = new Config();
config.getNetworkConfig().setMemcacheProtocolConfig(new MemcacheProtocolConfig().setEnabled(true));
HazelcastInstance hz = factory.newHazelcastInstance(config);
TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress());
try {
client.connect();
client.sendData("version\n");
assertTrueEventually(createResponseAssertTask("Version expected", client, "VERSION Hazelcast"), 10);
} finally {
client.close();
}
}
}
| {
"content_hash": "474a7b41bc0489b93fcd6e8cfdea4bca",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 112,
"avg_line_length": 37.37190082644628,
"alnum_prop": 0.6716054842989827,
"repo_name": "mesutcelik/hazelcast",
"id": "8bdd0b9812a2f922191ab5fe69ef9b4efc4a700e",
"size": "5147",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "hazelcast/src/test/java/com/hazelcast/internal/nio/ascii/MemcacheProtocolFilterTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1261"
},
{
"name": "C",
"bytes": "353"
},
{
"name": "Java",
"bytes": "39634706"
},
{
"name": "Shell",
"bytes": "29479"
}
],
"symlink_target": ""
} |
<?php
namespace BlackRook\TaskBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ActivityControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/activity/');
$this->assertTrue(200 === $client->getResponse()->getStatusCode());
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'activity[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertTrue($crawler->filter('td:contains("Test")')->count() > 0);
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Edit')->form(array(
'activity[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertTrue($crawler->filter('[value="Foo"]')->count() > 0);
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
} | {
"content_hash": "ddaf38fbb2709b8f2209d84031019782",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 86,
"avg_line_length": 32.81481481481482,
"alnum_prop": 0.5857787810383747,
"repo_name": "cordoval/BlackRookTasks",
"id": "157d2ba4e9e1465899bba437738772a62844fb27",
"size": "1772",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/BlackRook/TaskBundle/Tests/Controller/ActivityControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
//=====================================================================
//
//File: $RCSfile: DeleteDatatypesTestGenerics.java,v $
//Version: $Revision: 1.7 $
//Modified: $Date: 2013/05/10 04:30:25 $
//
//(c) Copyright 2008-2014 by Mentor Graphics Corp. 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.
//=====================================================================
package org.xtuml.bp.core.test;
import org.eclipse.core.runtime.CoreException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xtuml.bp.core.DataType_c;
import org.xtuml.bp.core.Ooaofooa;
import org.xtuml.bp.core.OperationParameter_c;
import org.xtuml.bp.core.Operation_c;
import org.xtuml.bp.core.Package_c;
import org.xtuml.bp.core.PackageableElement_c;
import org.xtuml.bp.core.UserDataType_c;
import org.xtuml.bp.core.common.ClassQueryInterface_c;
import org.xtuml.bp.core.common.ModelElement;
import org.xtuml.bp.core.common.Transaction;
import org.xtuml.bp.core.common.TransactionException;
import org.xtuml.bp.core.common.TransactionManager;
import org.xtuml.bp.core.ui.DeleteAction;
import org.xtuml.bp.core.ui.Selection;
import org.xtuml.bp.core.util.WorkspaceUtil;
import org.xtuml.bp.test.common.OrderedRunner;
import org.xtuml.bp.test.common.TestingUtilities;
import org.xtuml.bp.ui.canvas.Cl_c;
import org.xtuml.bp.ui.canvas.Ooaofgraphics;
import org.xtuml.bp.ui.canvas.test.CanvasTest;
/**
* Performs tests that involve deleting datatypes defined in system-level
* packages and verifying the places that use these datatypes are reverted back
* to integer and void appropriately.
*/
@RunWith(OrderedRunner.class)
public class DeleteDatatypesTestGenerics extends CanvasTest {
private static Selection selection = Selection.getInstance();
private static String projectName = "DatatypeTest";
private String test_id;
private static Ooaofooa testRoot;
public DeleteDatatypesTestGenerics(){
super(null, null);
}
@Override
protected String getResultName() {
return "DeleteDatatypesTest" + "_" + test_id;
}
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
*
* Since we are deleting elements out of the model with each test, we
* reload the model for each test and delete it after each test.
*/
@Before
public void setUp() throws Exception {
super.setUp();
// Turn off autobuild to stop MC-3020 builders from running
WorkspaceUtil.setAutobuilding(false);
// Create the project contents
loadProject("DatatypeTest");
m_sys = getSystemModel("DatatypeTest");
testRoot = modelRoot;
TransactionManager.getSingleton().disableDialog = true;
}
@After
public void tearDown() throws Exception {
try {
TestingUtilities.deleteProject(projectName);
TransactionManager.getSingleton().disableDialog = false;
} catch (CoreException e) {
fail(e.getMessage());
}
super.tearDown();
}
/**
* This test suite deletes a UDT that is assigned to a function parameter
* and return value and verifies the datatype is set back to integer and
* void respectively. The datatype is buried deep in a package tree and the
* following tests delete at various points in the tree. This function then
* checks that the param and return value dt's are reverted appropriately.
*/
private void checkDatatypesReverted() {
Operation_c op = Operation_c.OperationInstance(modelRoot,
new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Operation_c) candidate).getName()
.equals("op1");
}
});
assertNotNull(op);
OperationParameter_c param = OperationParameter_c
.getOneO_TPARMOnR117(op);
assertNotNull(param);
assertTrue("Did not find the expected parameter.", param.getName()
.equals("p"));
DataType_c op_dt = DataType_c.getOneS_DTOnR116(op);
assertNotNull(op_dt);
assertTrue("Return value datatype not reverted to \"void\".", op_dt
.getName().equals("void"));
DataType_c param_dt = DataType_c.getOneS_DTOnR118(param);
assertNotNull(param_dt);
assertTrue("Parameter datatype not reverted to \"integer\".", param_dt
.getName().equals("integer"));
}
/**
* Here is the tree to the UDT:
* System Model
* "p" - Generic package
* "q" - Generic package
* "dtp1" - Datatype package
* "dtp2" - Datatype package
* "udt1" - UDT
*
* The following group of tests deletes at the various points in the
* heirarchy.
*/
@Test
public void testDeletionOfUDT1() {
test_id = "1";
// We have to get the dtp2 package to force some loading to happen.
// If we skip this, we can't find the udt in the next step.
Package_c dtp2 = Package_c.PackageInstance(
testRoot, new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Package_c) candidate).getName()
.equals("dtp2");
}
});
assertNotNull(dtp2);
UserDataType_c udt = UserDataType_c.UserDataTypeInstance(testRoot,
new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((UserDataType_c) candidate).getName().equals(
"udt1");
}
});
assertNotNull(udt);
Cl_c.Clearselection();
selection.addToSelection(udt);
new DeleteAction(null).run();
checkDatatypesReverted();
}
@Test
public void testDeletionOfUDT1ByDeletingDtp2() {
test_id = "2";
Package_c dtp2 = Package_c.PackageInstance(
testRoot, new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Package_c) candidate).getName()
.equals("dtp2");
}
});
assertNotNull(dtp2);
Cl_c.Clearselection();
selection.addToSelection(dtp2);
new DeleteAction(null).run();
checkDatatypesReverted();
}
@Test
public void testDeletionOfUDTByDeletingDtp1() {
test_id = "3";
Package_c dtp1 = Package_c.PackageInstance(
testRoot, new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Package_c) candidate).getName()
.equals("dtp1");
}
});
assertNotNull(dtp1);
Cl_c.Clearselection();
selection.addToSelection(dtp1);
new DeleteAction(null).run();
checkDatatypesReverted();
}
@Test
public void testDeletionOfUDTByDeletingPkgQ() {
test_id = "4";
Package_c q = Package_c.PackageInstance(testRoot,
new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Package_c) candidate).getName().equals("q");
}
});
assertNotNull(q);
Cl_c.Clearselection();
selection.addToSelection(q);
new DeleteAction(null).run();
checkDatatypesReverted();
}
@Test
public void testDeletionOfUDTByDeletingPkgP() {
test_id = "5";
Package_c p = Package_c.PackageInstance(testRoot,
new ClassQueryInterface_c() {
public boolean evaluate(Object candidate) {
return ((Package_c) candidate).getName().equals("p");
}
});
assertNotNull(p);
Cl_c.Clearselection();
selection.addToSelection(p);
new DeleteAction(null).run();
checkDatatypesReverted();
}
@Test
public void testDeletionOfUDTAssignedToUDT() {
Transaction transaction = null;
try {
transaction = TransactionManager.getSingleton().startTransaction(
"Create test elements",
new ModelElement[] { Ooaofooa.getDefaultInstance(),
Ooaofgraphics.getDefaultInstance() });
m_sys.Newpackage();
Package_c[] pkgs = Package_c.getManyEP_PKGsOnR1401(m_sys);
Package_c testPkg = pkgs[pkgs.length - 1];
testPkg.Newdatatype();
DataType_c[] dts = DataType_c
.getManyS_DTsOnR8001(PackageableElement_c
.getManyPE_PEsOnR8000(testPkg));
DataType_c toDelete = dts[dts.length - 1];
testPkg.Newdatatype();
dts = DataType_c.getManyS_DTsOnR8001(PackageableElement_c
.getManyPE_PEsOnR8000(testPkg));
DataType_c assignedTo = dts[dts.length - 1];
UserDataType_c udt = UserDataType_c.getOneS_UDTOnR17(assignedTo);
udt.relateAcrossR18To(toDelete);
toDelete.Dispose();
DataType_c assignedType = DataType_c.getOneS_DTOnR18(udt);
assertTrue(
"User data type was not reverted to default on deletion of base type.",
assignedType.getName().equals("integer"));
TransactionManager.getSingleton().disableDialog = true;
TransactionManager.getSingleton().endTransaction(transaction);
TransactionManager.getSingleton().disableDialog = false;
} catch (TransactionException e) {
if (transaction != null) {
TransactionManager.getSingleton().cancelTransaction(
transaction, e);
}
TransactionManager.getSingleton().disableDialog = false;
fail(e.getMessage());
}
}
}
| {
"content_hash": "372fb16bbb41a231ddf756b7860136c3",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 80,
"avg_line_length": 33.282828282828284,
"alnum_prop": 0.6485584218512899,
"repo_name": "rmulvey/bptest",
"id": "83cdd04fde0676f15abc5c44d3f9bb9e359becbf",
"size": "9885",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/org.xtuml.bp.core.test/src/org/xtuml/bp/core/test/DeleteDatatypesTestGenerics.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Arc",
"bytes": "305800"
},
{
"name": "HTML",
"bytes": "98111"
},
{
"name": "Java",
"bytes": "8457508"
},
{
"name": "PLpgSQL",
"bytes": "977715"
},
{
"name": "Perl",
"bytes": "41856"
},
{
"name": "TSQL",
"bytes": "16094547"
}
],
"symlink_target": ""
} |
@interface TMValidatorRuleNumericBetween : TMValidatorRule
@property (nonatomic) NSNumber * _Nonnull numericMin;
@property (nonatomic) NSNumber * _Nonnull numericMax;
+ (instancetype _Nonnull)ruleWithErrorMessage:(NSString * _Nullable)errorMessage UNAVAILABLE_ATTRIBUTE;
+ (instancetype _Nonnull)ruleWithNumericMin:(NSNumber * _Nonnull)numericMin andNumericMax:(NSNumber * _Nonnull)numericMax;
+ (instancetype _Nonnull)ruleWithNumericMin:(NSNumber * _Nonnull)numericMin andNumericMax:(NSNumber * _Nonnull)numericMax andErrorMessagae:(NSString * _Nullable)errorMessage;
+ (BOOL)run:(NSString * _Nullable)string UNAVAILABLE_ATTRIBUTE;
+ (BOOL)run:(NSString * _Nullable)string withNumericMin:(NSNumber * _Nonnull)numericMin andNumericMax:(NSNumber * _Nonnull)numericMax;
@end
| {
"content_hash": "a55dc342d681955a5881da67397525c8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 174,
"avg_line_length": 64.66666666666667,
"alnum_prop": 0.8067010309278351,
"repo_name": "fromkk/TMValidator",
"id": "37f214e75d43b4e72aa5d6c1ae3dc60e04cc75f0",
"size": "968",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Sources/TMValidatorRuleNumericBetween.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "865"
},
{
"name": "Objective-C",
"bytes": "89061"
},
{
"name": "Ruby",
"bytes": "6233"
}
],
"symlink_target": ""
} |
<!-- Be sure to use the path starting from the parent path.
It seems it is mandatory that all custom elements sources the same
polymer.html in terms of the path representation. -->
<link rel="import" href="../packages/polymer/polymer.html">
<meta charset="utf-8">
<polymer-element name="kcaa-fleet-mission-dialog">
<template>
<link rel="stylesheet" href="packages/bootjack/css/bootstrap.min.css">
<link rel="stylesheet" href="../kcaa.css">
<link rel="stylesheet" href="dialog.css">
<div class="modal-header">
<button class="close" on-click="{{close}}">×</button>
<h3 class="modal-title">遠征選択 - 第{{fleet.id}}艦隊 ({{fleet.name}})</h3>
</div>
<div class="modal-body">
<div class="table">
<div class="trow thead">
<div class="wide">海域</div>
<div class="description">説明</div>
<div>燃料</div>
<div>弾薬</div>
<div>鋼材</div>
<div>ボーキ</div>
<div>時間</div>
</div>
<template repeat="{{evaled_mission in evaled_missions}}">
<div class="trow">
<div class="wide labelColumn">
<div>{{evaled_mission.mission.maparea}}</div>
<div>{{evaled_mission.mission.difficulty}}</div>
</div>
<div class="description">
<div class="title">
<a href="#"
on-click="{{goOnMission}}"
data-mission-id="{{evaled_mission.mission.id}}">
{{evaled_mission.mission.name}}
</a>
</div>
</div>
<div class="numberColumn">{{evaled_mission.fuelProfit}}</div>
<div class="numberColumn">{{evaled_mission.ammoProfit}}</div>
<div class="numberColumn">{{evaled_mission.mission.steel}}</div>
<div class="numberColumn">{{evaled_mission.mission.bauxite}}</div>
<div class="numberColumn">{{evaled_mission.mission.time}}分</div>
</div>
</template>
</div>
</div>
<div class="modal-footer">
<button class="cancel" on-click="{{close}}">Cancel</button>
</div>
</template>
<script type="application/dart" src="fleet_mission_dialog.dart"></script>
</polymer-element> | {
"content_hash": "f7981c164cfbbcfc814d8e24bbb40fbc",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 41.03636363636364,
"alnum_prop": 0.5582631812140009,
"repo_name": "kcaa/kcaa",
"id": "8a9bafa33c9dc591c41589b6cd01daded4c4344e",
"size": "2303",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/web/dialog/fleet_mission_dialog.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4405"
},
{
"name": "CSS",
"bytes": "11351"
},
{
"name": "Dart",
"bytes": "150682"
},
{
"name": "HTML",
"bytes": "91257"
},
{
"name": "Python",
"bytes": "722656"
},
{
"name": "Shell",
"bytes": "7795"
}
],
"symlink_target": ""
} |
package nl.uva.larissa.repository;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
import javax.validation.ValidationException;
import javax.ws.rs.core.MultivaluedMap;
import nl.uva.larissa.UUIDUtil;
import nl.uva.larissa.json.ISO8601VerboseDateFormat;
import nl.uva.larissa.json.ParseException;
import nl.uva.larissa.json.StatementParser;
import nl.uva.larissa.json.StatementParserImpl;
import nl.uva.larissa.json.StatementPrinter;
import nl.uva.larissa.json.StatementPrinterImpl;
import nl.uva.larissa.json.model.Agent;
import org.apache.abdera.i18n.iri.IRI;
import org.apache.abdera.i18n.iri.IRISyntaxException;
public class StatementFilterUtil {
static enum Parameter {
VERB("verb") {
@Override
public void setValue(StatementFilter result, String value) {
try {
result.setVerb(new IRI(value));
} catch (IRISyntaxException e) {
throw new IllegalArgumentException(String.format(
"'%s' is not a valid IRI", value), e);
}
}
@Override
public String getValueAsString(StatementFilter filter) {
IRI iri = filter.getVerb();
return iri == null ? null : iri.toString();
}
},
ACTIVITY("activity") {
@Override
public void setValue(StatementFilter result, String value) {
try {
result.setActivity(new IRI(value));
} catch (IRISyntaxException e) {
throw new IllegalArgumentException(String.format(
"'%s' is not a valid IRI", value), e);
}
}
@Override
public String getValueAsString(StatementFilter filter) {
IRI iri = filter.getActivity();
return iri == null ? null : iri.toString();
}
},
AGENT("agent") {
@Override
public void setValue(StatementFilter result, String value) {
try {
result.setAgent(getParser().parse(Agent.class, value));
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
}
@Override
public String getValueAsString(StatementFilter filter) {
Agent agent = filter.getAgent();
try {
return agent == null ? null : getPrinter().printCompact(
agent);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
},
SINCE("since") {
@Override
public void setValue(StatementFilter result, String value) {
try {
result.setSince(new ISO8601VerboseDateFormat().parse(value));
} catch (java.text.ParseException e) {
throw new IllegalArgumentException(e);
}
}
@Override
public String getValueAsString(StatementFilter filter) {
Date since = filter.getSince();
return since == null ? null : new ISO8601VerboseDateFormat()
.format(since);
}
},
UNTIL("until") {
@Override
public void setValue(StatementFilter result, String value) {
try {
result.setUntil(new ISO8601VerboseDateFormat().parse(value));
} catch (java.text.ParseException e) {
throw new IllegalArgumentException(e);
}
}
@Override
public String getValueAsString(StatementFilter filter) {
Date until = filter.getUntil();
return until == null ? null : new ISO8601VerboseDateFormat()
.format(until);
}
},
LIMIT("limit") {
@Override
public void setValue(StatementFilter result, String value) {
result.setLimit(Integer.parseInt(value));
}
@Override
public String getValueAsString(StatementFilter filter) {
Integer limit = filter.getLimit();
return limit == null ? null : limit.toString();
}
},
FORMAT("format") {
@Override
public void setValue(StatementFilter result, String value) {
result.setFormat(value);
}
@Override
public String getValueAsString(StatementFilter filter) {
return filter.getFormat();
}
},
REGISTRATION("registration") {
@Override
public void setValue(StatementFilter result, String value) {
if (value != null && !UUIDUtil.isUUID(value)) {
throw new IllegalArgumentException("'" + value
+ "' is not a valid UUID");
}
result.setRegistration(value);
}
@Override
public String getValueAsString(StatementFilter filter) {
return filter.getRegistration();
}
},
RELATED_ACTIVITIES("related_activities") {
@Override
public void setValue(StatementFilter result, String value) {
result.setRelatedActivities(Boolean.valueOf(value));
}
@Override
public String getValueAsString(StatementFilter filter) {
Boolean result = filter.getRelatedActivities();
return result == null ? null : Boolean.toString(result);
}
},
RELATED_AGENTS("related_agents") {
@Override
public void setValue(StatementFilter result, String value) {
result.setRelatedAgents(Boolean.valueOf(value));
}
@Override
public String getValueAsString(StatementFilter filter) {
Boolean result = filter.getRelatedAgents();
return result == null ? null : Boolean.toString(result);
}
},
ASCENDING("ascending") {
@Override
public void setValue(StatementFilter result, String value) {
result.setAscending(Boolean.valueOf(value));
}
@Override
public String getValueAsString(StatementFilter filter) {
Boolean result = filter.getAscending();
return result == null ? null : Boolean.toString(result);
}
},
STARTID("startId") {
// FIXME validate
@Override
public void setValue(StatementFilter result, String value) {
result.setStartId(value);
}
@Override
public String getValueAsString(StatementFilter filter) {
return filter.getStartId();
}
};
private final String name;
// FIXME should be injected but can't with non-injected constructor
private StatementParser parser = new StatementParserImpl();
private StatementPrinter printer = new StatementPrinterImpl();
@Inject
private Parameter(String name) {
this.name = name;
}
public abstract void setValue(StatementFilter result, String value);
public String getName() {
return name;
}
public abstract String getValueAsString(StatementFilter filter);
public StatementParser getParser() {
return parser;
}
public StatementPrinter getPrinter() {
return printer;
}
}
private static Map<String, Parameter> PARAMETERS;
static {
PARAMETERS = new HashMap<>(Parameter.values().length);
for (Parameter arg : Parameter.values()) {
PARAMETERS.put(arg.getName(), arg);
}
}
public static StatementFilter fromParameters(
MultivaluedMap<String, String> map) throws ValidationException {
StatementFilter result = new StatementFilter();
for (Entry<String, List<String>> entry : map.entrySet()) {
List<String> entryValues = entry.getValue();
String entryKey = entry.getKey();
if (entryValues.size() != 1) {
throw new ValidationException(
String.format(
"Parameter '%s' must have exactly 1 value, but has %s values.",
entryKey, entryValues.size()));
}
String entryValue = entryValues.get(0);
Parameter parameter = PARAMETERS.get(entryKey);
if (parameter == null) {
throw new ValidationException(String.format(
"Unsupported parameter '%s'; must be one of %s.",
entryKey, PARAMETERS.keySet()));
}
parameter.setValue(result, entryValue);
}
return result;
}
public static StatementFilter fromMoreUrl(String more)
throws IllegalArgumentException {
try {
more = URLDecoder.decode(more, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
Pattern patt = Pattern.compile("(?:([a-zA-Z_]+)=([^&]+))+");
Matcher matcher = patt.matcher(more);
StatementFilter result = new StatementFilter();
while (matcher.find()) {
String key = matcher.group(1);
String value = matcher.group(2);
Parameter arg = PARAMETERS.get(key);
if (arg == null) {
throw new IllegalArgumentException("unknown parameter: " + key);
}
arg.setValue(result, value);
}
return result;
}
public static String toMoreUrl(StatementFilter filter) {
// FIXME hardcoded path
StringBuilder result = new StringBuilder("/larissa/xAPI/statements?");
for (Parameter arg : Parameter.values()) {
String value = arg.getValueAsString(filter);
if (value != null) {
try {
result.append(arg.getName()).append('=')
.append(URLEncoder.encode(value, "UTF-8"))
.append('&');
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
}
int lastIndex = result.length() - 1;
if (result.charAt(lastIndex) == '&') {
result.deleteCharAt(lastIndex);
}
return result.toString();
}
}
| {
"content_hash": "2329c4b04ec167c156bae32e18d04cee",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 72,
"avg_line_length": 26.901840490797547,
"alnum_prop": 0.6898517673888256,
"repo_name": "Apereo-Learning-Analytics-Initiative/Larissa",
"id": "efa95be1eb8807d0cd2ce16b9ef1ece6e531fc10",
"size": "8770",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/nl/uva/larissa/repository/StatementFilterUtil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "134"
},
{
"name": "Java",
"bytes": "180497"
},
{
"name": "JavaScript",
"bytes": "19533"
}
],
"symlink_target": ""
} |
from typing import TYPE_CHECKING
from azure.core.credentials import AccessToken, AzureKeyCredential
from azure.core.paging import ItemPaged
from azure.core.pipeline.policies import BearerTokenCredentialPolicy
from azure.core.polling import LROPoller
from azure.core.tracing.decorator import distributed_trace
from ._api_version import RemoteRenderingApiVersion, validate_api_version
from ._generated import RemoteRenderingRestClient
from ._generated.models import (AssetConversion, AssetConversionInputSettings,
AssetConversionOutputSettings,
AssetConversionSettings,
CreateAssetConversionSettings,
CreateRenderingSessionSettings,
RenderingSession, RenderingSessionSize,
UpdateSessionSettings)
from ._polling import ConversionPolling, SessionPolling
from ._shared.authentication_endpoint import construct_endpoint_url
from ._shared.mixed_reality_token_credential import get_mixedreality_credential
from ._shared.mixedreality_account_key_credential import \
MixedRealityAccountKeyCredential
from ._shared.static_access_token_credential import StaticAccessTokenCredential
from ._version import SDK_MONIKER
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Union
from azure.core.credentials import TokenCredential
class RemoteRenderingClient(object):
"""A client for the Azure Remote Rendering Service.
This client offers functionality to convert assets to the format expected by the runtime, and also to manage the
lifetime of remote rendering sessions.
:param str endpoint:
The rendering service endpoint. This determines the region in which the rendering session is created and
asset conversions are performed.
:param str account_id: The Azure Remote Rendering account identifier.
:param str account_domain:
The Azure Remote Rendering account domain. For example, for an account created in the eastus region, this
will have the form "eastus.mixedreality.azure.com"
:param credential: Authentication for the Azure Remote
Rendering account. Can be of the form of an AzureKeyCredential, TokenCredential or an AccessToken acquired
from the Mixed Reality Secure Token Service (STS).
:type credential: Union[TokenCredential, AzureKeyCredential, AccessToken]
:keyword api_version:
The API version of the service to use for requests. It defaults to the latest service version.
Setting to an older version may result in reduced feature compatibility.
:paramtype api_version: str or ~azure.mixedreality.remoterenderings.RemoteRenderingApiVersion
"""
def __init__(self, endpoint, account_id, account_domain, credential, **kwargs):
# type: (str, str, str, Union[TokenCredential, AccessToken], Any) -> None
self._api_version = kwargs.pop(
"api_version", RemoteRenderingApiVersion.V2021_01_01
)
validate_api_version(self._api_version)
if not endpoint:
raise ValueError("endpoint cannot be None")
if not account_id:
raise ValueError("account_id cannot be None")
if not account_domain:
raise ValueError("account_domain cannot be None")
if not credential:
raise ValueError("credential cannot be None")
if isinstance(credential, AccessToken):
cred = StaticAccessTokenCredential(credential) # type: TokenCredential
elif isinstance(credential, AzureKeyCredential):
cred = MixedRealityAccountKeyCredential(
account_id=account_id, account_key=credential)
else:
cred = credential
self.polling_interval = kwargs.pop("polling_interval", 5)
endpoint_url = kwargs.pop(
'authentication_endpoint_url', construct_endpoint_url(account_domain))
# otherwise assume it is a TokenCredential and simply pass it through
pipeline_credential = get_mixedreality_credential(
account_id=account_id, account_domain=account_domain, credential=cred, endpoint_url=endpoint_url)
if pipeline_credential is None:
raise ValueError("credential is not of type TokenCredential, AzureKeyCredential or AccessToken")
authentication_policy = BearerTokenCredentialPolicy(
pipeline_credential, endpoint_url + '/.default')
self._account_id = account_id
self._client = RemoteRenderingRestClient(
endpoint=endpoint,
authentication_policy=authentication_policy,
sdk_moniker=SDK_MONIKER,
api_version=self._api_version,
**kwargs)
@distributed_trace
def begin_asset_conversion(self, conversion_id, input_settings, output_settings, **kwargs):
# type: (str, AssetConversionInputSettings, AssetConversionOutputSettings, Any) -> LROPoller[AssetConversion]
"""
Start a new asset conversion with the given options.
:param str conversion_id:
An ID uniquely identifying the conversion for the remote rendering account. The ID is case sensitive, can
contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain
more than 256 characters.
:param ~azure.mixedreality.remoterendering.AssetConversionInputSettings input_settings: Options for the
input of the conversion.
:param ~azure.mixedreality.remoterendering.AssetConversionOutputSettings output_settings: Options for the
output of the conversion.
:return: A poller for the created asset conversion
:rtype: ~azure.core.polling.LROPoller[AssetConversion]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling_interval = kwargs.pop("polling_interval", self.polling_interval)
initial_state = self._client.remote_rendering.create_conversion(
account_id=self._account_id,
conversion_id=conversion_id,
body=CreateAssetConversionSettings(settings=AssetConversionSettings(
input_settings=input_settings, output_settings=output_settings)),
**kwargs)
polling_method = ConversionPolling(account_id=self._account_id, polling_interval=polling_interval)
return LROPoller(client=self._client,
initial_response=initial_state,
deserialization_callback=lambda: None,
polling_method=polling_method)
@distributed_trace
def get_asset_conversion(self, conversion_id, **kwargs):
# type: (str, Any) -> AssetConversion
"""
Retrieve the state of a previously created conversion.
:param str conversion_id:
The identifier of the conversion to retrieve.
:return: Information about the ongoing conversion process.
:rtype: ~azure.mixedreality.remoterendering.models.AssetConversion
:raises ~azure.core.exceptions.HttpResponseError:
"""
return self._client.remote_rendering.get_conversion(
account_id=self._account_id, conversion_id=conversion_id, **kwargs)
@distributed_trace
def get_asset_conversion_poller(self, **kwargs):
# type: (Any) -> LROPoller[AssetConversion]
"""
Returns a poller for an existing conversion by conversion id or a continuation token retrieved from a previous
poller.
:keyword conversion_id: The conversion id of a previously created conversion.
:paramtype conversion_id: str
:keyword continuation_token:
A continuation token retrieved from a poller of a conversion.
:paramtype continuation_token: str
:return: A poller for the created asset conversion
:rtype: ~azure.core.polling.LROPoller[AssetConversion]
:raises ~azure.core.exceptions.HttpResponseError:
"""
conversion_id = kwargs.pop("conversion_id", None) # type: Union[str,None]
continuation_token = kwargs.pop("continuation_token", None) # type: Union[str,None]
if conversion_id is None and continuation_token is None:
raise ValueError(
"Either conversion_id or continuation_token needs to be supplied.")
if conversion_id is not None and continuation_token is not None:
raise ValueError(
"Parameters conversion_id and continuation_token are mutual exclusive. Supply only one of the two.")
polling_interval = kwargs.pop("polling_interval", self.polling_interval)
polling_method = ConversionPolling(account_id=self._account_id, polling_interval=polling_interval)
if continuation_token is not None:
return LROPoller.from_continuation_token(continuation_token=continuation_token,
polling_method=polling_method,
client=self._client)
if conversion_id is not None:
initial_state = self._client.remote_rendering.get_conversion(
account_id=self._account_id,
conversion_id=conversion_id,
**kwargs)
return LROPoller(client=self._client,
initial_response=initial_state,
deserialization_callback=lambda: None,
polling_method=polling_method)
@distributed_trace
def list_asset_conversions(self, **kwargs):
# type: (...) -> ItemPaged[AssetConversion]
""" Gets conversions for the remote rendering account.
:rtype: ItemPaged[AssetConversion]
:raises ~azure.core.exceptions.HttpResponseError:
"""
return self._client.remote_rendering.list_conversions(account_id=self._account_id, **kwargs) # type: ignore
@distributed_trace
def begin_rendering_session(self, session_id, size, lease_time_minutes, **kwargs):
# type: (str, Union[str, RenderingSessionSize], int, Any) -> LROPoller[RenderingSession]
"""
:param str session_id: An ID uniquely identifying the rendering session for the given account. The ID is case
sensitive, can contain any combination of alphanumeric characters including hyphens and underscores, and
cannot contain more than 256 characters.
:param size: Size of the server used for the rendering session. Remote Rendering with Standard size server has
a maximum scene size of 20 million polygons. Remote Rendering with Premium size does not enforce a hard
maximum, but performance may be degraded if your content exceeds the rendering capabilities of the service.
:param int lease_time_minutes: The time in minutes the session will run after reaching the 'Ready' state.
:type size: str or ~azure.mixedreality.remoterendering.RenderingSessionSize
:return: A poller for the created rendering session
:rtype: LROPoller[RenderingSession]
:raises ~azure.core.exceptions.HttpResponseError:
"""
settings = CreateRenderingSessionSettings(
size=size, lease_time_minutes=lease_time_minutes)
initial_state = self._client.remote_rendering.create_session(
account_id=self._account_id,
session_id=session_id,
body=settings,
**kwargs)
polling_interval = kwargs.pop("polling_interval", self.polling_interval)
polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval)
return LROPoller(client=self._client,
initial_response=initial_state,
deserialization_callback=lambda: None,
polling_method=polling_method)
@distributed_trace
def get_rendering_session(self, session_id, **kwargs):
# type: (str, Any) -> RenderingSession
'''
Returns the properties of a previously generated rendering session.
:param str session_id: The identifier of the rendering session.
:return: Properties of the rendering session
:rtype: ~azure.mixedreality.remoterendering.models.RenderingSession
:raises ~azure.core.exceptions.HttpResponseError:
'''
return self._client.remote_rendering.get_session(
account_id=self._account_id,
session_id=session_id,
**kwargs)
def get_rendering_session_poller(self, **kwargs):
# type: (Any) -> LROPoller[RenderingSession]
"""
Returns a poller for an existing rendering session by session id or a continuation token retrieved from a
previous poller.
:keyword session_id: The conversion id of a previously created conversion.
:paramtype session_id: str
:keyword continuation_token:
A continuation token retrieved from a poller of a session.
:paramtype continuation_token: str
:raises ~azure.core.exceptions.HttpResponseError:
"""
session_id = kwargs.pop("session_id", None) # type: Union[str,None]
continuation_token = kwargs.pop("continuation_token", None) # type: Union[str,None]
if session_id is None and continuation_token is None:
raise ValueError(
"Either session_id or continuation_token needs to be supplied.")
if session_id is not None and continuation_token is not None:
raise ValueError(
"Parameters session_id and continuation_token are mutual exclusive. Supply only one of the two.")
polling_interval = kwargs.pop("polling_interval", self.polling_interval)
if continuation_token is not None:
polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval)
return LROPoller.from_continuation_token(continuation_token=continuation_token,
polling_method=polling_method,
client=self._client)
if session_id is not None:
initial_state = self._client.remote_rendering.get_session(
account_id=self._account_id,
session_id=session_id,
**kwargs)
polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval)
return LROPoller(client=self._client,
initial_response=initial_state,
deserialization_callback=lambda: None,
polling_method=polling_method)
@distributed_trace
def stop_rendering_session(self, session_id, **kwargs):
# type: (str, Any) -> None
"""
:param str session_id: The identifier of the session to be stopped.
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
self._client.remote_rendering.stop_session(
account_id=self._account_id, session_id=session_id, **kwargs)
@distributed_trace
def update_rendering_session(self, session_id, **kwargs):
# type: (str, Any) -> RenderingSession
"""
Updates an already existing rendering session.
:param str session_id: The identifier of the session to be updated.
:keyword lease_time_minutes: The new lease time of the rendering session. Has to be strictly larger than
the previous lease time.
:paramtype lease_time_minutes: int
:return: The properties of the updated session
:rtype: ~azure.mixedreality.remoterendering.models.RenderingSession
:raises ~azure.core.exceptions.HttpResponseError:
"""
lease_time_minutes = kwargs.pop("lease_time_minutes", None) # type: Union[int,None]
if lease_time_minutes is not None:
return self._client.remote_rendering.update_session(account_id=self._account_id,
session_id=session_id,
body=UpdateSessionSettings(
lease_time_minutes=lease_time_minutes),
**kwargs)
# if no param to update has been provided the unchanged session is returned
return self._client.remote_rendering.get_session(account_id=self._account_id,
session_id=session_id,
**kwargs)
@distributed_trace
def list_rendering_sessions(self, **kwargs):
# type: (...) -> ItemPaged[RenderingSession]
"""
List rendering sessions in the 'Ready' or 'Starting' state. Does not return stopped or failed rendering
sessions.
:rtype: ItemPaged[RenderingSession]
:raises ~azure.core.exceptions.HttpResponseError:
"""
return self._client.remote_rendering.list_sessions(account_id=self._account_id, **kwargs) # type: ignore
def close(self):
# type: () -> None
self._client.close()
def __enter__(self):
# type: () -> RemoteRenderingClient
self._client.__enter__() # pylint:disable=no-member
return self
def __exit__(self, *args):
# type: (*Any) -> None
self._client.__exit__(*args) # pylint:disable=no-member
| {
"content_hash": "8614f0de8f5ed4848140bbf01563a768",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 119,
"avg_line_length": 49.68539325842696,
"alnum_prop": 0.6490841248303935,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e1ef95afca493be7d266ca072915f8b490376df1",
"size": "18012",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_remote_rendering_client.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1224"
},
{
"name": "Bicep",
"bytes": "24196"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "4892"
},
{
"name": "HTML",
"bytes": "12058"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "Jinja",
"bytes": "10377"
},
{
"name": "Jupyter Notebook",
"bytes": "272022"
},
{
"name": "PowerShell",
"bytes": "518535"
},
{
"name": "Python",
"bytes": "715484989"
},
{
"name": "Shell",
"bytes": "3631"
}
],
"symlink_target": ""
} |
package org.elasticsearch.xpack.core.ml.inference.trainedmodel;
import org.elasticsearch.test.ESTestCase;
import java.util.HashMap;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
public class InferenceHelpersTests extends ESTestCase {
public void testToDoubleFromNumbers() {
assertThat(InferenceHelpers.toDouble(0.5), equalTo(0.5));
assertThat(InferenceHelpers.toDouble(5L), equalTo(5.0));
assertThat(InferenceHelpers.toDouble(5), equalTo(5.0));
assertThat(InferenceHelpers.toDouble(0.5f), equalTo(0.5));
}
public void testToDoubleFromString() {
assertThat(InferenceHelpers.toDouble(""), is(nullValue()));
assertThat(InferenceHelpers.toDouble("0.5"), equalTo(0.5));
assertThat(InferenceHelpers.toDouble("-0.5"), equalTo(-0.5));
assertThat(InferenceHelpers.toDouble("5"), equalTo(5.0));
assertThat(InferenceHelpers.toDouble("-5"), equalTo(-5.0));
// if ae are turned off, then we should get a null value
// otherwise, we should expect an assertion failure telling us that the string is improperly formatted
try {
assertThat(InferenceHelpers.toDouble(""), is(nullValue()));
} catch (AssertionError ae) {
assertThat(ae.getMessage(), equalTo("value is not properly formatted double []"));
}
try {
assertThat(InferenceHelpers.toDouble("notADouble"), is(nullValue()));
} catch (AssertionError ae) {
assertThat(ae.getMessage(), equalTo("value is not properly formatted double [notADouble]"));
}
}
public void testToDoubleFromNull() {
assertThat(InferenceHelpers.toDouble(null), is(nullValue()));
}
public void testDoubleFromUnknownObj() {
assertThat(InferenceHelpers.toDouble(new HashMap<>()), is(nullValue()));
}
}
| {
"content_hash": "bb771493c4aa6e3c0bed54dee761b655",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 110,
"avg_line_length": 38,
"alnum_prop": 0.6785345717234262,
"repo_name": "gingerwizard/elasticsearch",
"id": "bffa174b0c7e33c79a7bd450df5a0ec9644bd7ec",
"size": "2179",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/InferenceHelpersTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "10862"
},
{
"name": "Groovy",
"bytes": "510"
},
{
"name": "HTML",
"bytes": "1502"
},
{
"name": "Java",
"bytes": "29923429"
},
{
"name": "Perl",
"bytes": "264378"
},
{
"name": "Perl6",
"bytes": "103207"
},
{
"name": "Python",
"bytes": "91186"
},
{
"name": "Ruby",
"bytes": "17776"
},
{
"name": "Shell",
"bytes": "85779"
}
],
"symlink_target": ""
} |
<?php
/**
* Flat sales order shipment tracks collection
*
* @category Mage
* @package Mage_Sales
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection
extends Mage_Sales_Model_Resource_Order_Shipment_Track_Collection
{
}
| {
"content_hash": "15bfba76a3d76585e9dfc431ad954e5e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 20.8,
"alnum_prop": 0.7115384615384616,
"repo_name": "5452/durex",
"id": "220e005bd537fe9f76cd02a8a7bd7c0749861c48",
"size": "1266",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "includes/src/Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ActionScript",
"bytes": "19946"
},
{
"name": "CSS",
"bytes": "2190550"
},
{
"name": "JavaScript",
"bytes": "1290492"
},
{
"name": "PHP",
"bytes": "102689019"
},
{
"name": "Shell",
"bytes": "642"
},
{
"name": "XSLT",
"bytes": "2066"
}
],
"symlink_target": ""
} |
require 'twitter/core_ext/hash'
require 'twitter/cursor'
require 'twitter/relationship'
require 'twitter/user'
module Twitter
class Client
# Defines methods related to friends and followers
module FriendsAndFollowers
# @see https://dev.twitter.com/docs/api/1/get/followers/ids
# @rate_limited Yes
# @requires_authentication No unless requesting it from a protected user
#
# If getting this data of a protected user, you must authenticate (and be allowed to see that user).
# @overload follower_ids(options={})
# Returns an array of numeric IDs for every user following the authenticated user
#
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @example Return the authenticated user's followers' IDs
# Twitter.follower_ids
# @overload follower_ids(user, options={})
# Returns an array of numeric IDs for every user following the specified user
#
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @example Return @sferik's followers' IDs
# Twitter.follower_ids("sferik")
# Twitter.follower_ids(7505382) # Same as above
def follower_ids(*args)
options = {:cursor => -1}
options.merge!(args.last.is_a?(Hash) ? args.pop : {})
user = args.first
options.merge_user!(user)
cursor = get("/1/followers/ids.json", options)
Twitter::Cursor.new(cursor, 'ids')
end
# @see https://dev.twitter.com/docs/api/1/get/friends/ids
# @rate_limited Yes
# @requires_authentication No unless requesting it from a protected user
#
# If getting this data of a protected user, you must authenticate (and be allowed to see that user).
# @overload friend_ids(options={})
# Returns an array of numeric IDs for every user the authenticated user is following
#
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @example Return the authenticated user's friends' IDs
# Twitter.friend_ids
# @overload friend_ids(user, options={})
# Returns an array of numeric IDs for every user the specified user is following
#
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @example Return @sferik's friends' IDs
# Twitter.friend_ids("sferik")
# Twitter.friend_ids(7505382) # Same as above
def friend_ids(*args)
options = {:cursor => -1}
options.merge!(args.last.is_a?(Hash) ? args.pop : {})
user = args.first
options.merge_user!(user)
cursor = get("/1/friends/ids.json", options)
Twitter::Cursor.new(cursor, 'ids')
end
# Test for the existence of friendship between two users
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/exists
# @note Consider using {Twitter::Client::FriendsAndFollowers#friendship} instead of this method.
# @rate_limited Yes
# @requires_authentication No unless user_a or user_b is protected
# @param user_a [Integer, String] The ID or screen_name of the subject user.
# @param user_b [Integer, String] The ID or screen_name of the user to test for following.
# @param options [Hash] A customizable set of options.
# @return [Boolean] true if user_a follows user_b, otherwise false.
# @example Return true if @sferik follows @pengwynn
# Twitter.friendship?("sferik", "pengwynn")
def friendship?(user_a, user_b, options={})
get("/1/friendships/exists.json", options.merge(:user_a => user_a, :user_b => user_b))
end
# Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/incoming
# @rate_limited Yes
# @requires_authentication Yes
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Return an array of numeric IDs for every user who has a pending request to follow the authenticating user
# Twitter.friendships_incoming
def friendships_incoming(options={})
options = {:cursor => -1}.merge(options)
cursor = get("/1/friendships/incoming.json", options)
Twitter::Cursor.new(cursor, 'ids')
end
# Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/outgoing
# @rate_limited Yes
# @requires_authentication Yes
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
# @return [Twitter::Cursor]
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Return an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
# Twitter.friendships_outgoing
def friendships_outgoing(options={})
options = {:cursor => -1}.merge(options)
cursor = get("/1/friendships/outgoing.json", options)
Twitter::Cursor.new(cursor, 'ids')
end
# Returns detailed information about the relationship between two users
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/show
# @rate_limited Yes
# @requires_authentication No
# @param options [Hash] A customizable set of options.
# @return [Twitter::Relationship]
# @example Return the relationship between @sferik and @pengwynn
# Twitter.friendship("sferik", "pengwynn")
# Twitter.friendship(7505382, 14100886)
def friendship(source, target, options={})
case source
when Integer
options[:source_id] = source
when String
options[:source_screen_name] = source
end
case target
when Integer
options[:target_id] = target
when String
options[:target_screen_name] = target
end
relationship = get("/1/friendships/show.json", options)['relationship']
Twitter::Relationship.new(relationship)
end
alias :friendship_show :friendship
alias :relationship :friendship
# Allows the authenticating user to follow the specified user
#
# @see https://dev.twitter.com/docs/api/1/post/friendships/create
# @rate_limited No
# @requires_authentication Yes
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :follow (false) Enable notifications for the target user.
# @option options [Boolean, String, Integer] :include_entities Include {https://dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, 't' or 1.
# @return [Twitter::User] The followed user.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Follow @sferik
# Twitter.follow("sferik")
def follow(user, options={})
options.merge_user!(user)
# Twitter always turns on notifications if the "follow" option is present, even if it's set to false
# so only send follow if it's true
options.merge!(:follow => true) if options.delete(:follow)
user = post("/1/friendships/create.json", options)
Twitter::User.new(user)
end
alias :friendship_create :follow
# Allows the authenticating user to unfollow the specified user
#
# @see https://dev.twitter.com/docs/api/1/post/friendships/destroy
# @rate_limited No
# @requires_authentication Yes
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :include_entities Include {https://dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, 't' or 1.
# @return [Twitter::User] The unfollowed user.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Unfollow @sferik
# Twitter.unfollow("sferik")
def unfollow(user, options={})
options.merge_user!(user)
user = delete("/1/friendships/destroy.json", options)
Twitter::User.new(user)
end
alias :friendship_destroy :unfollow
# Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none.
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/lookup
# @rate_limited Yes
# @requires_authentication Yes
# @param options [Hash] A customizable set of options.
# @return [Twitter::Relationship]
# @overload friendships(*users, options={})
# @param users [Integer, String] Twitter users ID or screen names.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :include_entities Include {https://dev.twitter.com/docs/tweet-entities Tweet
# @return [Array<Twitter::User>] The requested users.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Return extended information for @sferik and @pengwynn
# Twitter.friendships("sferik", "pengwynn")
# Twitter.friendships("sferik", 14100886) # Same as above
# Twitter.friendships(7505382, 14100886) # Same as above
def friendships(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
users = args
options.merge_users!(Array(users))
get("/1/friendships/lookup.json", options).map do |user|
Twitter::User.new(user)
end
end
# Allows one to enable or disable retweets and device notifications from the specified user.
#
# @see https://dev.twitter.com/docs/api/1/post/friendships/update
# @rate_limited No
# @requires_authentication Yes
# @param user [Integer, String] Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :device Enable/disable device notifications from the target user.
# @option options [Boolean] :retweets Enable/disable retweets from the target user.
# @return [Twitter::Relationship]
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Enable rewteets and devise notifications for @sferik
# Twitter.friendship_update("sferik", :device => true, :retweets => true)
def friendship_update(user, options={})
options.merge_user!(user)
relationship = post("/1/friendships/update.json", options)['relationship']
Twitter::Relationship.new(relationship)
end
# Returns an array of user_ids that the currently authenticated user does not want to see retweets from.
#
# @see https://dev.twitter.com/docs/api/1/get/friendships/no_retweet_ids
# @rate_limited Yes
# @requires_authentication Yes
# @param user [Integer, String] Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :stringify_ids Many programming environments will not consume our ids due to their size. Provide this option to have ids returned as strings instead. Read more about Twitter IDs, JSON and Snowflake.
# @return [Array<Integer>]
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Enable rewteets and devise notifications for @sferik
# Twitter.no_retweet_ids
def no_retweet_ids(options={})
get("/1/friendships/no_retweet_ids.json", options, :phoenix => true)
end
# Allows the authenticating user to accept the specified user's follow request
#
# @note Undocumented
# @rate_limited No
# @requires_authentication Yes
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @return [Twitter::User] The accepted user.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Accept @sferik's follow request
# Twitter.accept("sferik")
def accept(user, options={})
options.merge_user!(user)
user = post("/1/friendships/accept.json", options)
Twitter::User.new(user)
end
# Allows the authenticating user to deny the specified user's follow request
#
# @note Undocumented
# @rate_limited No
# @requires_authentication Yes
# @param user [Integer, String] A Twitter user ID or screen name.
# @param options [Hash] A customizable set of options.
# @return [Twitter::User] The denied user.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Deny @sferik's follow request
# Twitter.deny("sferik")
def deny(user, options={})
options.merge_user!(user)
user = post("/1/friendships/deny.json", options)
Twitter::User.new(user)
end
end
end
end
| {
"content_hash": "5f152b1bd8006a339eaf068f164de429",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 307,
"avg_line_length": 52.44709897610922,
"alnum_prop": 0.6668185071907334,
"repo_name": "joshcrews/twitter-2.0.2",
"id": "2b5341a76b0b9797722b5a3616a1ad5680b15006",
"size": "15367",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/twitter/client/friends_and_followers.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "377017"
}
],
"symlink_target": ""
} |
FROM balenalib/iot-gate-imx8-alpine:edge-run
# remove several traces of python
RUN apk del python*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apk add --no-cache ca-certificates libffi \
&& apk add --no-cache libssl1.0 || apk add --no-cache libssl1.1
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
# point Python at a system-provided certificate database. Otherwise, we might hit CERTIFICATE_VERIFY_FAILED.
# https://www.python.org/dev/peps/pep-0476/#trust-database
ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV PYTHON_VERSION 3.9.4
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& buildDeps=' \
curl \
gnupg \
' \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-alpine-aarch64-openssl1.1.tar.gz" \
&& echo "9c0e613b98c1adab757b0443f27a698f1e00cedf1b9e2e4dce05dff7d7ec52cb Python-$PYTHON_VERSION.linux-alpine-aarch64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-alpine-aarch64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-alpine-aarch64-openssl1.1.tar.gz" \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Alpine Linux edge \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.4, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | {
"content_hash": "bb139199371868555b90335bc9db000b",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 713,
"avg_line_length": 53.4025974025974,
"alnum_prop": 0.7123054474708171,
"repo_name": "nghiant2710/base-images",
"id": "cb8dd3d753491d2de966ca828b1d1ee6a47723ba",
"size": "4133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/iot-gate-imx8/alpine/edge/3.9.4/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
author: veronicab
comments: true
layout: page
slug: hymnbooks
title: Hymnbooks
wordpress_id: 142
---
[](http://repleatur.net/hymnbooks/homemadebooks/)
### Printed Books
* Westminster Hymnal 1912, R R Terry, 431pp:
[more info, incl pdf download](http://www.ccwatershed.org/blog/2014/sep/6/richard-terrys-hymnal/),
[coil bound](http://www.lulu.com/shop/richard-terry/old-westminster-hymnal-coil-bound/paperback/product-21785083.html),
[paperback via lulu](http://www.lulu.com/shop/richard-terry/old-westminster-hymnal/paperback/product-21787994.html),
[paperback via createspace](https://www.createspace.com/4910514)
* Arundel Hymns 1905, Henry Duke of Norfolk and Charles Gatty, 553pp:
[more info](http://www.ccwatershed.org/blog/2013/apr/26/arundel-hymns/),
[paperback](http://www.lulu.com/shop/henry-duke-of-norfolk-and-charles-gatty/arundel-hymns/paperback/product-18749247.html)
* A Treasury of Catholic Song 1915, Sidney Hurlbut, 311pp:
[paperback](http://www.lulu.com/shop/sidney-hurlbut/treasury-of-catholic-song/paperback/product-18866942.html)
* St Basil's Hymnal 1918, 351pp:
[paperback](http://www.lulu.com/shop/sidney-hurlbut/treasury-of-catholic-song/paperback/product-18866942.html)
* A New Book of Old Hymns, 2001-2013, V Brandt (that's me) 92pp:
[paperback](http://www.lulu.com/shop/veronica-brandt/a-new-book-of-old-hymns/paperback/product-22569619.html),
[coil bound](http://www.lulu.com/shop/veronica-brandt/a-new-book-of-old-hymns-spiral-bound/paperback/product-22569618.html),
[large print](http://www.lulu.com/shop/veronica-brandt/a-new-book-of-old-hymns-large-print/paperback/product-22569622.html),
[more info](http://www.brandt.id.au/music/hymnbook/)
### Sheet music pdfs
Adapted from [Nova Organi Harmonia](http://chabanelpsalms.org/introductory_material/Gregorian_organ_accomp/) using [Lilypond](http://lilypond.org) and transposed down for the people who say they can't sing that high. The little lilypad icon indicates lilypond source files.
* [Adoro Te](http://hymni.files.wordpress.com/2011/10/adorote.pdf) or in English [Godhead here in hiding](http://hymni.files.wordpress.com/2011/10/godhead.pdf)
* [Sing my tongue](http://hymni.files.wordpress.com/2011/10/singmy.pdf) with people's chant version: [Sing my tongue](http://hymni.files.wordpress.com/2011/10/singmytongue.pdf)
* [O salutaris](http://hymni.files.wordpress.com/2011/10/osalutarisnoh.pdf) [OSalutarisNOH.ly](http://repleatur.net/wp-content/uploads/2011/10/OSalutarisNOH.ly)
* [Conditor alme](http://hymni.files.wordpress.com/2011/10/conditoralme.pdf) [ConditorAlme.ly](http://repleatur.net/wp-content/uploads/2011/10/ConditorAlme.ly)
* [VeniCreator](http://repleatur.net/wp-content/uploads/2011/10/VeniCreator.pdf) [VeniCreator.ly](http://repleatur.net/wp-content/uploads/2011/10/VeniCreator.ly)
Other:
* [Soul of my Saviour](http://hymni.files.wordpress.com/2011/10/soul1.pdf)
* [Firmly I believe](http://hymni.files.wordpress.com/2011/10/properfirmly.pdf) to the tune Omni Die. Usually in Australia it is sung to a tune by Edward Elgar, but this alternative was heard at [Maternal Heart](http://www.maternalheart.org) church, Lewisham. I think it is from the New Westminster Hymnal as there is a similar setting in the Old Westminster Hymnal.
* [O salutaris](http://hymni.files.wordpress.com/2011/10/osalutariswebbe.pdf) the metric tune by Samuel Webbe.
* [Firmly I believe](http://hymni.files.wordpress.com/2011/10/firmlychords.pdf) same tune as above but with a simplified left hand with verses alternating between chords and the bass voice. If that sounds confusing, see for yourself.
* [Praise to the Lord](http://hymni.files.wordpress.com/2011/10/praisetothelord.pdf)
* [Hail Queen of Heaven](http://hymni.files.wordpress.com/2011/10/hailqueen.pdf)
* [Glory be to Jesus](http://hymni.files.wordpress.com/2011/10/glorybeme.pdf) the left hand had some spans of over an octave so I've transposed the bass line from the original to make it easier to play.
The lilypond source files can be downloaded from [Draft Traditional Hymnbook](https://sourceforge.net/projects/dthymnbook/) at Sourceforge.
| {
"content_hash": "a8618c080ec2772f051a48cc511cfc68",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 368,
"avg_line_length": 79.9622641509434,
"alnum_prop": 0.7687588485134498,
"repo_name": "veromary/repleatur",
"id": "2c46d288e6f9d81bac6e6c14af07c0c21b381be6",
"size": "4242",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "hymnbooks/index.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "16831"
},
{
"name": "LilyPond",
"bytes": "282481"
},
{
"name": "Ruby",
"bytes": "220"
},
{
"name": "SCSS",
"bytes": "52621"
},
{
"name": "TeX",
"bytes": "18552"
}
],
"symlink_target": ""
} |
/**
* @constructor
* @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
* @param {function(string)} itemSelectedCallback
* @param {!WebInspector.SoftContextMenu=} parentMenu
*/
WebInspector.SoftContextMenu = function(items, itemSelectedCallback, parentMenu)
{
this._items = items;
this._itemSelectedCallback = itemSelectedCallback;
this._parentMenu = parentMenu;
}
WebInspector.SoftContextMenu.prototype = {
/**
* @param {!Document} document
* @param {number} x
* @param {number} y
*/
show: function(document, x, y)
{
if (!this._items.length)
return;
this._document = document;
this._x = x;
this._y = y;
this._time = new Date().getTime();
// Create context menu.
this.element = createElementWithClass("div", "soft-context-menu");
var root = WebInspector.createShadowRootWithCoreStyles(this.element, "ui/softContextMenu.css");
this._contextMenuElement = root.createChild("div");
this.element.style.top = y + "px";
var subMenuOverlap = 3;
this.element.style.left = (this._parentMenu ? x - subMenuOverlap : x) + "px";
this._contextMenuElement.tabIndex = 0;
this._contextMenuElement.addEventListener("mouseup", consumeEvent, false);
this._contextMenuElement.addEventListener("keydown", this._menuKeyDown.bind(this), false);
for (var i = 0; i < this._items.length; ++i)
this._contextMenuElement.appendChild(this._createMenuItem(this._items[i]));
// Install glass pane capturing events.
if (!this._parentMenu) {
this._glassPaneElement = createElementWithClass("div", "soft-context-menu-glass-pane fill");
this._glassPaneElement.tabIndex = 0;
this._glassPaneElement.addEventListener("mouseup", this._glassPaneMouseUp.bind(this), false);
this._glassPaneElement.appendChild(this.element);
document.body.appendChild(this._glassPaneElement);
this._discardMenuOnResizeListener = this._discardMenu.bind(this, true);
document.defaultView.addEventListener("resize", this._discardMenuOnResizeListener, false);
} else {
this._parentMenu._parentGlassPaneElement().appendChild(this.element);
}
// Re-position menu in case it does not fit.
if (document.body.offsetWidth < this.element.offsetLeft + this.element.offsetWidth) {
this.element.style.left = Math.max(WebInspector.Dialog.modalHostView().element.totalOffsetLeft(), this._parentMenu
? this._parentMenu.element.offsetLeft - this.element.offsetWidth + subMenuOverlap
: document.body.offsetWidth - this.element.offsetWidth) + "px";
}
// Move submenus upwards if it does not fit.
if (this._parentMenu && document.body.offsetHeight < this.element.offsetTop + this.element.offsetHeight) {
y = Math.max(WebInspector.Dialog.modalHostView().element.totalOffsetTop(), document.body.offsetHeight - this.element.offsetHeight);
this.element.style.top = y + "px";
}
var maxHeight = WebInspector.Dialog.modalHostView().element.offsetHeight;
maxHeight -= y - WebInspector.Dialog.modalHostView().element.totalOffsetTop();
this.element.style.maxHeight = maxHeight + "px";
this._focus();
},
discard: function()
{
this._discardMenu(true);
},
_parentGlassPaneElement: function()
{
if (this._glassPaneElement)
return this._glassPaneElement;
if (this._parentMenu)
return this._parentMenu._parentGlassPaneElement();
return null;
},
_createMenuItem: function(item)
{
if (item.type === "separator")
return this._createSeparator();
if (item.type === "subMenu")
return this._createSubMenu(item);
var menuItemElement = createElementWithClass("div", "soft-context-menu-item");
var checkMarkElement = menuItemElement.createChild("div", "checkmark");
if (!item.checked)
checkMarkElement.style.opacity = "0";
if (item.element) {
var wrapper = menuItemElement.createChild("div", "soft-context-menu-custom-item");
wrapper.appendChild(item.element);
menuItemElement._isCustom = true;
return menuItemElement;
}
if (!item.enabled)
menuItemElement.classList.add("soft-context-menu-disabled");
menuItemElement.createTextChild(item.label);
menuItemElement.createChild("span", "soft-context-menu-shortcut").textContent = item.shortcut;
menuItemElement.addEventListener("mousedown", this._menuItemMouseDown.bind(this), false);
menuItemElement.addEventListener("mouseup", this._menuItemMouseUp.bind(this), false);
// Manually manage hover highlight since :hover does not work in case of click-and-hold menu invocation.
menuItemElement.addEventListener("mouseover", this._menuItemMouseOver.bind(this), false);
menuItemElement.addEventListener("mouseleave", this._menuItemMouseLeave.bind(this), false);
menuItemElement._actionId = item.id;
return menuItemElement;
},
_createSubMenu: function(item)
{
var menuItemElement = createElementWithClass("div", "soft-context-menu-item");
menuItemElement._subItems = item.subItems;
// Occupy the same space on the left in all items.
var checkMarkElement = menuItemElement.createChild("span", "soft-context-menu-item-checkmark checkmark");
checkMarkElement.textContent = "\u2713 "; // Checkmark Unicode symbol
checkMarkElement.style.opacity = "0";
menuItemElement.createTextChild(item.label);
var subMenuArrowElement = menuItemElement.createChild("span", "soft-context-menu-item-submenu-arrow");
subMenuArrowElement.textContent = "\u25B6"; // BLACK RIGHT-POINTING TRIANGLE
menuItemElement.addEventListener("mousedown", this._menuItemMouseDown.bind(this), false);
menuItemElement.addEventListener("mouseup", this._menuItemMouseUp.bind(this), false);
// Manually manage hover highlight since :hover does not work in case of click-and-hold menu invocation.
menuItemElement.addEventListener("mouseover", this._menuItemMouseOver.bind(this), false);
menuItemElement.addEventListener("mouseleave", this._menuItemMouseLeave.bind(this), false);
return menuItemElement;
},
_createSeparator: function()
{
var separatorElement = createElementWithClass("div", "soft-context-menu-separator");
separatorElement._isSeparator = true;
separatorElement.createChild("div", "separator-line");
return separatorElement;
},
_menuItemMouseDown: function(event)
{
// Do not let separator's mouse down hit menu's handler - we need to receive mouse up!
event.consume(true);
},
_menuItemMouseUp: function(event)
{
this._triggerAction(event.target, event);
event.consume();
},
_focus: function()
{
this._contextMenuElement.focus();
},
_triggerAction: function(menuItemElement, event)
{
if (!menuItemElement._subItems) {
this._discardMenu(true, event);
if (typeof menuItemElement._actionId !== "undefined") {
this._itemSelectedCallback(menuItemElement._actionId);
delete menuItemElement._actionId;
}
return;
}
this._showSubMenu(menuItemElement);
event.consume();
},
_showSubMenu: function(menuItemElement)
{
if (menuItemElement._subMenuTimer) {
clearTimeout(menuItemElement._subMenuTimer);
delete menuItemElement._subMenuTimer;
}
if (this._subMenu)
return;
this._subMenu = new WebInspector.SoftContextMenu(menuItemElement._subItems, this._itemSelectedCallback, this);
var topPadding = 4;
this._subMenu.show(this._document, menuItemElement.totalOffsetLeft() + menuItemElement.offsetWidth, menuItemElement.totalOffsetTop() - 1 - topPadding);
},
_hideSubMenu: function()
{
if (!this._subMenu)
return;
this._subMenu._discardSubMenus();
this._focus();
},
_menuItemMouseOver: function(event)
{
this._highlightMenuItem(event.target, true);
},
_menuItemMouseLeave: function(event)
{
if (!this._subMenu || !event.relatedTarget) {
this._highlightMenuItem(null, true);
return;
}
var relatedTarget = event.relatedTarget;
if (relatedTarget.classList.contains("soft-context-menu-glass-pane"))
this._highlightMenuItem(null, true);
},
/**
* @param {?Element} menuItemElement
* @param {boolean} scheduleSubMenu
*/
_highlightMenuItem: function(menuItemElement, scheduleSubMenu)
{
if (this._highlightedMenuItemElement === menuItemElement)
return;
this._hideSubMenu();
if (this._highlightedMenuItemElement) {
this._highlightedMenuItemElement.classList.remove("soft-context-menu-item-mouse-over");
if (this._highlightedMenuItemElement._subItems && this._highlightedMenuItemElement._subMenuTimer) {
clearTimeout(this._highlightedMenuItemElement._subMenuTimer);
delete this._highlightedMenuItemElement._subMenuTimer;
}
}
this._highlightedMenuItemElement = menuItemElement;
if (this._highlightedMenuItemElement) {
this._highlightedMenuItemElement.classList.add("soft-context-menu-item-mouse-over");
this._contextMenuElement.focus();
if (scheduleSubMenu && this._highlightedMenuItemElement._subItems && !this._highlightedMenuItemElement._subMenuTimer)
this._highlightedMenuItemElement._subMenuTimer = setTimeout(this._showSubMenu.bind(this, this._highlightedMenuItemElement), 150);
}
},
_highlightPrevious: function()
{
var menuItemElement = this._highlightedMenuItemElement ? this._highlightedMenuItemElement.previousSibling : this._contextMenuElement.lastChild;
while (menuItemElement && (menuItemElement._isSeparator || menuItemElement._isCustom))
menuItemElement = menuItemElement.previousSibling;
if (menuItemElement)
this._highlightMenuItem(menuItemElement, false);
},
_highlightNext: function()
{
var menuItemElement = this._highlightedMenuItemElement ? this._highlightedMenuItemElement.nextSibling : this._contextMenuElement.firstChild;
while (menuItemElement && (menuItemElement._isSeparator || menuItemElement._isCustom))
menuItemElement = menuItemElement.nextSibling;
if (menuItemElement)
this._highlightMenuItem(menuItemElement, false);
},
_menuKeyDown: function(event)
{
switch (event.keyIdentifier) {
case "Up":
this._highlightPrevious(); break;
case "Down":
this._highlightNext(); break;
case "Left":
if (this._parentMenu) {
this._highlightMenuItem(null, false);
this._parentMenu._hideSubMenu();
}
break;
case "Right":
if (!this._highlightedMenuItemElement)
break;
if (this._highlightedMenuItemElement._subItems) {
this._showSubMenu(this._highlightedMenuItemElement);
this._subMenu._focus();
this._subMenu._highlightNext();
}
break;
case "U+001B": // Escape
this._discardMenu(false, event); break;
case "Enter":
if (!isEnterKey(event))
break;
// Fall through
case "U+0020": // Space
if (this._highlightedMenuItemElement)
this._triggerAction(this._highlightedMenuItemElement, event);
if (this._highlightedMenuItemElement._subItems) {
this._subMenu._focus();
this._subMenu._highlightNext();
}
break;
}
event.consume(true);
},
_glassPaneMouseUp: function(event)
{
// Return if this is simple 'click', since dispatched on glass pane, can't use 'click' event.
if (new Date().getTime() - this._time < 300)
return;
if (event.target === this.element)
return;
this._discardMenu(true, event);
event.consume();
},
/**
* @param {boolean} closeParentMenus
* @param {!Event=} event
*/
_discardMenu: function(closeParentMenus, event)
{
if (this._subMenu && !closeParentMenus)
return;
if (this._glassPaneElement) {
var glassPane = this._glassPaneElement;
delete this._glassPaneElement;
// This can re-enter discardMenu due to blur.
this._document.body.removeChild(glassPane);
if (this._parentMenu) {
delete this._parentMenu._subMenu;
if (closeParentMenus)
this._parentMenu._discardMenu(closeParentMenus, event);
else
this._parentMenu._focus();
}
if (event)
event.consume(true);
} else if (this._parentMenu && this._contextMenuElement.parentElementOrShadowHost()) {
this._discardSubMenus();
if (closeParentMenus)
this._parentMenu._discardMenu(closeParentMenus, event);
else
this._parentMenu._focus();
if (event)
event.consume(true);
}
if (this._discardMenuOnResizeListener) {
this._document.defaultView.removeEventListener("resize", this._discardMenuOnResizeListener, false);
delete this._discardMenuOnResizeListener;
}
},
_discardSubMenus: function()
{
if (this._subMenu)
this._subMenu._discardSubMenus();
this.element.remove();
if (this._parentMenu)
delete this._parentMenu._subMenu;
}
}
| {
"content_hash": "8a950c170ac7679687172852f0409272",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 159,
"avg_line_length": 38.34133333333333,
"alnum_prop": 0.625330365836695,
"repo_name": "XiaosongWei/chromium-crosswalk",
"id": "33f8545aac8ab70c8d2a099526877f0125454058",
"size": "15709",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
This repository contains all the tests to verify the platform.
Tests are written in cucumber.
- Cucumber
- cucumber-tests-core: A project with some basic stuff, not directly related to OSGP, but needed in order to run the tests.
- cucumber-tests-execution: A project which contains some common classes to be used to make an executable jar, needed when we start the tests on a testsystem itself during a build.
- cucumber-tests-platform: The core test project with basic OSGP steps
- cucumber-tests-platform-common, The test project where all common related platform tests are put.
- cucumber-tests-platform-publiclighting, The test project where all publiclighting related platform tests are put.
- cucumber-tests-platform-microgrids, The test project where all microgrids related platform tests are put.
- cucumber-tests-platform-smartmetering, The test project where all smartmetering related platform tests are put.
- Shared, Platform and Protocol-Adapter-*, The components under test
##### Running Cucumber integration tests
First make sure that you have OSGP running. Note that you don't need to run the web-device-simulator (OSLP simulator) because it will use the same port as the mockserver used within the test projects.
You can run the automatic tests by running
`mvn verify -DskipITs=false`
from the commandline.
## Open smart grid platform information and news
High-level project information and news can be found on the open smart grid platform website:
* [www.opensmartgridplatform.org](http://opensmartgridplatform.org/)
Open smart grid platform detailed documentation:
* [documentation.opensmartgridplatform.org/](http://documentation.opensmartgridplatform.org/)
Open smart grid platform issue tracker:
* [Open smart grid platform Jira](https://smartsocietyservices.atlassian.net/projects/OC/issues/)
## How to create and use the automatic tests.
### Why
Automatic tests are created in order to garantee that the software doesn't break with new functionality or corrected bugs.
At the time of writing this readme it is not yet in place, but it is meant to have a nightly build on the development branch, which will also startup a test server during the build, deploy the latest software on it and run the automatic tests against it. Via this way, each morning it is visible if the development branch is functionally working.
Alternatively each developer/tester can run the automatic tests on his own environment.
### How to implement.
There are a few rules on how to implement the automatic tests.
* When writing the feature files, always meantion the Feature on top and add a little description like "As a ..., I want to ..., In order to". Via this way you think a little more about what you are going to do.
* When writing the scenarios, keep in mind that each scenario should stand on its one. Don't ever make a scenario dependent on another.
* When writing the scenarios, please try to write functional scenarios. A person with less technical background should be able to read those scenarios as well. Also have a look at the already created scenarios for reference.
* When writing the scenario steps, please try to create the steps as generic and reusable as possible. e.g. use tables for parameterizing the steps.
* Before the test run, the databases are cleared (not complete yet, but please add the necessary commands to the ScenarioHooks.java) and filled with the default data like a test organization which is used for sending the automatic test requests.
* Before each test scenario the database is cleared as well except for the default data (provisioned in the ScenarioHooks.java).
* Each time you implement new functionality or solve bugs, make sure you execute the automatic tests.
## Additional recommendations
* use ```mvn tidy:pom```
* use ```mvn versions:display-dependency-updates```
* use ```mvn versions:display-plugin-updates```
* use ```mvn dependency:tree -DignoreNonCompile```
| {
"content_hash": "b739a809d7932d915c48adf77600332a",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 346,
"avg_line_length": 68.12068965517241,
"alnum_prop": 0.7886610984560871,
"repo_name": "OSGP/Integration-Tests",
"id": "51c12f3cb5d4be63b22f52f74a37e38b677a4902",
"size": "4043",
"binary": false,
"copies": "1",
"ref": "refs/heads/development",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Gherkin",
"bytes": "703524"
},
{
"name": "Groovy",
"bytes": "19406"
},
{
"name": "Java",
"bytes": "1678316"
},
{
"name": "Shell",
"bytes": "6380"
}
],
"symlink_target": ""
} |
"""
=========================================================
SVM Tie Breaking Example
=========================================================
Tie breaking is costly if ``decision_function_shape='ovr'``, and therefore it
is not enabled by default. This example illustrates the effect of the
``break_ties`` parameter for a multiclass classification problem and
``decision_function_shape='ovr'``.
The two plots differ only in the area in the middle where the classes are
tied. If ``break_ties=False``, all input in that area would be classified as
one class, whereas if ``break_ties=True``, the tie-breaking mechanism will
create a non-convex decision boundary in that area.
"""
# Code source: Andreas Mueller, Adrin Jalali
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.datasets import make_blobs
X, y = make_blobs(random_state=27)
fig, sub = plt.subplots(2, 1, figsize=(5, 8))
titles = ("break_ties = False", "break_ties = True")
for break_ties, title, ax in zip((False, True), titles, sub.flatten()):
svm = SVC(
kernel="linear", C=1, break_ties=break_ties, decision_function_shape="ovr"
).fit(X, y)
xlim = [X[:, 0].min(), X[:, 0].max()]
ylim = [X[:, 1].min(), X[:, 1].max()]
xs = np.linspace(xlim[0], xlim[1], 1000)
ys = np.linspace(ylim[0], ylim[1], 1000)
xx, yy = np.meshgrid(xs, ys)
pred = svm.predict(np.c_[xx.ravel(), yy.ravel()])
colors = [plt.cm.Accent(i) for i in [0, 4, 7]]
points = ax.scatter(X[:, 0], X[:, 1], c=y, cmap="Accent")
classes = [(0, 1), (0, 2), (1, 2)]
line = np.linspace(X[:, 1].min() - 5, X[:, 1].max() + 5)
ax.imshow(
-pred.reshape(xx.shape),
cmap="Accent",
alpha=0.2,
extent=(xlim[0], xlim[1], ylim[1], ylim[0]),
)
for coef, intercept, col in zip(svm.coef_, svm.intercept_, classes):
line2 = -(line * coef[1] + intercept) / coef[0]
ax.plot(line2, line, "-", c=colors[col[0]])
ax.plot(line2, line, "--", c=colors[col[1]])
ax.set_xlim(xlim)
ax.set_ylim(ylim)
ax.set_title(title)
ax.set_aspect("equal")
plt.show()
| {
"content_hash": "b820184659f66c01d879e67bace01140",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 82,
"avg_line_length": 32.803030303030305,
"alnum_prop": 0.5879907621247114,
"repo_name": "vinayak-mehta/scikit-learn",
"id": "e12460b494c024e0a1d7643a1f49552d0a63d693",
"size": "2165",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "examples/svm/plot_svm_tie_breaking.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "42335"
},
{
"name": "C++",
"bytes": "147316"
},
{
"name": "Cython",
"bytes": "668672"
},
{
"name": "Makefile",
"bytes": "1644"
},
{
"name": "Python",
"bytes": "10468304"
},
{
"name": "Shell",
"bytes": "41758"
}
],
"symlink_target": ""
} |
"""Keep track of geo-located stations."""
from astropy.time import Time
from sqlalchemy import Column, Float, String, BigInteger, ForeignKey, func
from . import MCDeclarativeBase, NotNull
from . import mc, cm_utils
class StationType(MCDeclarativeBase):
"""
Table to track/denote station type data categories in various ways.
Attributes
----------
station_type_name : String Column
Name of type class, Primary_key
prefix : String Column
String prefix to station type, elements of which are typically
characterized by <prefix><int>. Comma-delimit list if more than one.
Note that prefix is not in the primary_key, so there can be multiple
prefixes per type_name.
description : String Column
hort description of station type.
plot_marker : String Column
matplotlib marker type to use
"""
__tablename__ = 'station_type'
station_type_name = Column(String(64), primary_key=True)
prefix = NotNull(String(64))
description = Column(String(64))
plot_marker = Column(String(64))
def __repr__(self):
"""Define representation."""
return ('<subarray {self.station_type_name}: prefix={self.prefix} '
'description={self.description} marker={self.plot_marker}>'
.format(self=self))
class GeoLocation(MCDeclarativeBase):
"""
A table logging stations within HERA.
Attributes
----------
station_name : String Column
Colloquial name of station (which is a unique location on the ground).
This one shouldn't change. Primary_key
station_type_name : String Column
Name of station type of which it is a member.
Should match prefix per station_type table.
datum : String Column
Datum of the geoid.
tile : String Column
UTM tile
northing : Float Column
Northing coordinate in m
easting : Float Column
Easting coordinate in m
elevation : Float Column
Elevation in m
created_gpstime : BigInteger Column
The date when the station assigned by project.
"""
__tablename__ = 'geo_location'
station_name = Column(String(64), primary_key=True)
station_type_name = Column(String(64), ForeignKey(StationType.station_type_name),
nullable=False)
datum = Column(String(64))
tile = Column(String(64))
northing = Column(Float(precision='53'))
easting = Column(Float(precision='53'))
elevation = Column(Float)
created_gpstime = NotNull(BigInteger)
def gps2Time(self):
"""Add a created_date attribute -- an astropy Time object based on created_gpstime."""
self.created_date = Time(self.created_gpstime, format='gps')
def geo(self, **kwargs):
"""Add arbitrary attributes to object based on dict."""
for key, value in kwargs.items():
if key == 'station_name':
value = value.upper()
setattr(self, key, value)
def __repr__(self):
"""Define representation."""
return '<station_name={self.station_name} station_type={self.station_type_name} \
northing={self.northing} easting={self.easting} \
elevation={self.elevation}>'.format(self=self)
def update(session=None, data=None, add_new_geo=False):
"""
Update the geo_location table with some data.
Use with caution -- should usually use in a script which will do datetime
primary key etc.
Parameters
----------
session : session
session on current database. If session is None, a new session
on the default database is created and used.
data : str or list
[[station_name0,column0,value0],[...]]
where
station_nameN: station_name (starts with char)
values: corresponding list of values
add_new_geo : bool
allow a new entry to be made.
Returns
-------
bool
Flag if successful
"""
data_dict = format_check_update_request(data)
if data_dict is None:
print('No update - doing nothing.')
return False
close_session_when_done = False
if session is None: # pragma: no cover
db = mc.connect_mc_db()
session = db.sessionmaker()
close_session_when_done = True
for station_name in data_dict.keys():
geo_rec = session.query(GeoLocation).filter(
func.upper(GeoLocation.station_name) == station_name.upper())
num_rec = geo_rec.count()
make_update = False
if num_rec == 0:
if add_new_geo:
gr = GeoLocation()
make_update = True
else:
raise ValueError("{} does not exist and add_new_geo not enabled."
.format(station_name))
elif num_rec == 1:
if add_new_geo:
raise ValueError("{} exists and and_new_geo is enabled."
.format(station_name))
else:
gr = geo_rec.first()
make_update = True
if make_update:
for d in data_dict[station_name]:
setattr(gr, d[1], d[2])
session.add(gr)
session.commit()
cm_utils.log('geo_location update', data_dict=data_dict)
if close_session_when_done: # pragma: no cover
session.close()
return True
def format_check_update_request(request):
"""
Parse the update request for use in the update function.
Parameters
----------
request : str or list
station_name0:column0:value0, [station_name1:]column1:value1, [...] or list
station_nameN: first entry must have the station_name,
if it does not then propagate first station_name but
can't restart 3 then 2
columnN: name of geo_location column
valueN: corresponding new value
Returns
-------
dict
Parsed request for update
"""
if request is None:
return None
data = {}
if type(request) == str:
tmp = request.split(',')
data_to_proc = []
for d in tmp:
data_to_proc.append(d.split(':'))
else:
data_to_proc = request
if len(data_to_proc[0]) == 3:
station_name0 = data_to_proc[0][0]
for d in data_to_proc:
if len(d) == 2:
d.insert(0, station_name0)
elif len(d) != 3:
raise ValueError('Invalid format for update request.')
if d[0] in data.keys():
data[d[0]].append(d)
else:
data[d[0]] = [d]
else:
raise ValueError('Invalid parse request - need 3 parameters for at least first one.')
return data
| {
"content_hash": "40559002ddef9a51553c10e70188a762",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 94,
"avg_line_length": 32.2122641509434,
"alnum_prop": 0.5889588519548983,
"repo_name": "HERA-Team/Monitor_and_Control",
"id": "d64be11cb13bbc061df8e3712f494a4f3446c98b",
"size": "6951",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hera_mc/geo_location.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "19948"
}
],
"symlink_target": ""
} |
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
line-height: 0;
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.searchautocomplete {
position: absolute;
top: -5px;
right: 0px;
height: 34px;
width: 436px;
padding: 4px 10px;
-webkit-border-radius: 0px 0px 0px 5px;
-moz-border-radius: 0px 0px 0px 5px;
border-radius: 0px 0px 0px 5px;
background: #fff;
display: block;
}
.searchautocomplete .sprite {
background: url('../../../images/mirasvit/sprite.png');
}
.searchautocomplete > label {
float: left;
margin-right: 10px;
color: #333;
font-weight: bold;
margin-top: 8px;
}
.searchautocomplete .nav {
background: url('../../../images/mirasvit/sprite.png');
float: left;
height: 34px;
position: relative;
width: 340px;
}
.searchautocomplete .nav .nav-search-in {
position: absolute;
top: 0px;
left: 0px;
z-index: 15;
}
.searchautocomplete .nav .nav-search-in .category {
opacity: 0;
filter: alpha(opacity=0);
background: white;
border: 1px solid #DDD;
color: black;
cursor: pointer;
height: 29px;
left: 5px;
margin: 0;
outline: 0;
padding: 0;
position: absolute;
top: 5px;
visibility: visible;
width: auto;
}
.searchautocomplete .nav .nav-search-in .category-fake {
-webkit-border-radius: 5px 0px 0px 5px;
-moz-border-radius: 5px 0px 0px 5px;
border-radius: 5px 0px 0px 5px;
background-color: #fcfcfc;
background-image: -moz-linear-gradient(top, #ffffff, #f7f7f7);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f7f7f7));
background-image: -webkit-linear-gradient(top, #ffffff, #f7f7f7);
background-image: -o-linear-gradient(top, #ffffff, #f7f7f7);
background-image: linear-gradient(to bottom, #ffffff, #f7f7f7);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff7f7f7', GradientType=0);
border-right: 1px solid #dddddd;
color: #777;
cursor: pointer;
float: left;
font-size: 11px;
height: 27px;
line-height: 27px;
margin: 4px 0px 0px 2px;
padding: 0px 25px 0px 10px;
text-align: center;
white-space: nowrap;
}
.searchautocomplete .nav .nav-search-in .nav-down-arrow {
background: url('../../../images/mirasvit/sprite.png');
width: 9px;
height: 5px;
background-position: -26px -34px;
display: block;
right: 10px;
top: 16px;
position: absolute;
}
.searchautocomplete .nav .nav-search-in:hover .category-fake {
background-color: #eeeeee;
background-image: -moz-linear-gradient(top, #f7f7f7, #e1e1e1);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f7f7f7), to(#e1e1e1));
background-image: -webkit-linear-gradient(top, #f7f7f7, #e1e1e1);
background-image: -o-linear-gradient(top, #f7f7f7, #e1e1e1);
background-image: linear-gradient(to bottom, #f7f7f7, #e1e1e1);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff7f7f7', endColorstr='#ffe1e1e1', GradientType=0);
}
.searchautocomplete .nav .nav-search-in:hover .nav-down-arrow {
background-position: -6px -34px;
}
.searchautocomplete .nav .nav-input {
*zoom: 1;
margin: 6px 0px 0px 10px;
padding: 0px 5px 0px 5px;
z-index: 12;
position: relative;
}
.searchautocomplete .nav .nav-input:before,
.searchautocomplete .nav .nav-input:after {
display: table;
content: "";
line-height: 0;
}
.searchautocomplete .nav .nav-input:after {
clear: both;
}
.searchautocomplete .nav .nav-input input {
z-index: 10;
padding: 0px;
height: 23px;
border: 0px;
font-family: arial, sans-serif;
font-size: 12px;
background: transparent;
color: black;
outline: 0px;
margin-left: 5px;
width: 100%;
}
.searchautocomplete .nav .nav-input input.suggest {
display: none;
color: #999;
z-index: 9;
}
.searchautocomplete .nav-submit-button {
background: url('../../../images/mirasvit/sprite.png');
background-position: 0px -34px;
background-repeat: no-repeat;
float: left;
height: 34px;
padding-left: 5px;
}
.searchautocomplete .nav-submit-button .button {
width: 39px;
height: 34px;
padding: 0px 9px;
margin: 0px;
cursor: pointer;
font-weight: bold;
color: white;
line-height: 12px;
font-size: 13px;
background-color: #3c454e;
background-image: -moz-linear-gradient(top, #444c55, #313a44);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444c55), to(#313a44));
background-image: -webkit-linear-gradient(top, #444c55, #313a44);
background-image: -o-linear-gradient(top, #444c55, #313a44);
background-image: linear-gradient(to bottom, #444c55, #313a44);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444c55', endColorstr='#ff313a44', GradientType=0);
border: 1px solid #313a44;
-webkit-border-radius: 0px 5px 5px 0px;
-moz-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
z-index: 14;
}
.searchautocomplete .nav-submit-button .button:hover {
background-color: #39414b;
background-image: -moz-linear-gradient(top, #313a44, #444c55);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#313a44), to(#444c55));
background-image: -webkit-linear-gradient(top, #313a44, #444c55);
background-image: -o-linear-gradient(top, #313a44, #444c55);
background-image: linear-gradient(to bottom, #313a44, #444c55);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff313a44', endColorstr='#ff444c55', GradientType=0);
}
.searchautocomplete .searchautocomplete-placeholder {
-webkit-border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #FFF;
border: 1px solid #ccc;
padding: 15px 10px 5px 10px;
position: absolute;
right: 48px;
top: 42px;
width: 318px;
z-index: 102;
}
.searchautocomplete .searchautocomplete-placeholder:before {
border-color: transparent transparent #CCC transparent;
content: "";
position: absolute;
border-style: solid;
border-width: 5px;
height: 0;
width: 0;
top: -11px;
left: 30px;
}
.searchautocomplete .searchautocomplete-placeholder ul {
list-style: none;
padding: 0;
margin: 0;
}
.searchautocomplete .searchautocomplete-placeholder ul li {
*zoom: 1;
text-align: left;
padding: 5px 5px;
margin-bottom: 5px;
border: 1px solid #ccc;
}
.searchautocomplete .searchautocomplete-placeholder ul li:before,
.searchautocomplete .searchautocomplete-placeholder ul li:after {
display: table;
content: "";
line-height: 0;
}
.searchautocomplete .searchautocomplete-placeholder ul li:after {
clear: both;
}
.searchautocomplete .searchautocomplete-placeholder ul li a {
text-decoration: none;
}
.searchautocomplete .searchautocomplete-placeholder ul li a.name {
color: #444;
font-weight: bold;
display: block;
margin-bottom: 3px;
}
.searchautocomplete .searchautocomplete-placeholder ul li a .pull-right {
float: right;
}
.searchautocomplete .searchautocomplete-placeholder ul li.active {
background-color: #eeffee;
cursor: pointer;
}
.searchautocomplete .searchautocomplete-placeholder ul li.active a {
text-decoration: none;
}
.searchautocomplete .searchautocomplete-placeholder ul li .searchautocomlete-image {
float: left;
margin: 0px 10px 5px 0px;
}
.searchautocomplete .searchautocomplete-placeholder ul li .price-box {
font-weight: bold;
font-size: 13px;
color: #C76200;
float: right;
}
.searchautocomplete .searchautocomplete-placeholder ul li .price-box .regular-price .price-label,
.searchautocomplete .searchautocomplete-placeholder ul li .price-box .old-price .price-label,
.searchautocomplete .searchautocomplete-placeholder ul li .price-box .special-price .price-label {
display: none;
}
.searchautocomplete .searchautocomplete-placeholder ul li .price-box .price-label {
font-weight: normal;
color: #999;
}
.searchautocomplete .searchautocomplete-placeholder ul li .price-box .old-price .price {
font-size: 0.9em;
color: #999;
}
.searchautocomplete .searchautocomplete-placeholder ul li .highlight strong {
color: #f00;
}
.searchautocomplete .searchautocomplete-placeholder .index-title {
text-align: right;
color: #0A263C;
border-bottom: 1px solid #CCC;
padding: 2px 5px;
}
.searchautocomplete .searchautocomplete-placeholder .index-title span {
color: #666;
font-size: 0.9em;
}
.searchautocomplete .searchautocomplete-placeholder .all {
text-align: right;
margin: 10px 4px 5px 10px;
}
.searchautocomplete .searchautocomplete-loader {
position: absolute;
top: 11px;
right: 10px;
width: 16px;
height: 16px;
background: url('../../../images/mirasvit/loader.gif');
}
.searchautocomplete-widget {
position: relative;
top: auto;
left: auto;
bottom: auto;
right: auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
| {
"content_hash": "ee1a514de44adce164da593b020e20cd",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 121,
"avg_line_length": 28.21846153846154,
"alnum_prop": 0.7126812779413368,
"repo_name": "mikrotikAhmet/mbe-cpdev",
"id": "53493cb49d5f8b65311c9acae190e042af2e4c35",
"size": "9171",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "skin/frontend/base/default/css/mirasvit/searchautocomplete/amazon.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "19946"
},
{
"name": "ApacheConf",
"bytes": "1148"
},
{
"name": "Batchfile",
"bytes": "1036"
},
{
"name": "C",
"bytes": "653"
},
{
"name": "CSS",
"bytes": "2469504"
},
{
"name": "HTML",
"bytes": "6706314"
},
{
"name": "JavaScript",
"bytes": "1271689"
},
{
"name": "PHP",
"bytes": "50903014"
},
{
"name": "Perl",
"bytes": "30260"
},
{
"name": "PowerShell",
"bytes": "1028"
},
{
"name": "Ruby",
"bytes": "288"
},
{
"name": "Shell",
"bytes": "11651"
},
{
"name": "XSLT",
"bytes": "2135"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Windows.Data;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.LanguageServices.Implementation.Options;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
{
/// <summary>
/// This is the view model for CodeStyle options page.
/// </summary>
/// <remarks>
/// The codestyle options page is defined in <see cref="CodeStylePage"/>
/// </remarks>
internal class StyleViewModel : AbstractOptionPreviewViewModel
{
#region "Preview Text"
private const string s_fieldDeclarationPreviewTrue = @"
class C{
int capacity;
void Method()
{
//[
this.capacity = 0;
//]
}
}";
private const string s_fieldDeclarationPreviewFalse = @"
class C{
int capacity;
void Method()
{
//[
capacity = 0;
//]
}
}";
private const string s_propertyDeclarationPreviewTrue = @"
class C{
public int Id { get; set; }
void Method()
{
//[
this.Id = 0;
//]
}
}";
private const string s_propertyDeclarationPreviewFalse = @"
class C{
public int Id { get; set; }
void Method()
{
//[
Id = 0;
//]
}
}";
private const string s_eventDeclarationPreviewTrue = @"
using System;
class C{
event EventHandler Elapsed;
void Handler(object sender, EventArgs args)
{
//[
this.Elapsed += Handler;
//]
}
}";
private const string s_eventDeclarationPreviewFalse = @"
using System;
class C{
event EventHandler Elapsed;
void Handler(object sender, EventArgs args)
{
//[
Elapsed += Handler;
//]
}
}";
private const string s_methodDeclarationPreviewTrue = @"
using System;
class C{
void Display()
{
//[
this.Display();
//]
}
}";
private const string s_methodDeclarationPreviewFalse = @"
using System;
class C{
void Display()
{
//[
Display();
//]
}
}";
private const string s_intrinsicPreviewDeclarationTrue = @"
class Program
{
//[
private int _member;
static void M(int argument)
{
int local;
}
//]
}";
private const string s_intrinsicPreviewDeclarationFalse = @"
using System;
class Program
{
//[
private Int32 _member;
static void M(Int32 argument)
{
Int32 local;
}
//]
}";
private const string s_intrinsicPreviewMemberAccessTrue = @"
class Program
{
//[
static void M()
{
var local = int.MaxValue;
}
//]
}";
private const string s_intrinsicPreviewMemberAccessFalse = @"
using System;
class Program
{
//[
static void M()
{
var local = Int32.MaxValue;
}
//]
}";
private static readonly string s_varForIntrinsicsPreviewFalse = $@"
using System;
class C{{
void Method()
{{
//[
int x = 5; // {ServicesVSResources.built_in_types}
//]
}}
}}";
private static readonly string s_varForIntrinsicsPreviewTrue = $@"
using System;
class C{{
void Method()
{{
//[
var x = 5; // {ServicesVSResources.built_in_types}
//]
}}
}}";
private static readonly string s_varWhereApparentPreviewFalse = $@"
using System;
class C{{
void Method()
{{
//[
C cobj = new C(); // {ServicesVSResources.type_is_apparent_from_assignment_expression}
//]
}}
}}";
private static readonly string s_varWhereApparentPreviewTrue = $@"
using System;
class C{{
void Method()
{{
//[
var cobj = new C(); // {ServicesVSResources.type_is_apparent_from_assignment_expression}
//]
}}
}}";
private static readonly string s_varWherePossiblePreviewFalse = $@"
using System;
class C{{
void Init()
{{
//[
Action f = this.Init(); // {ServicesVSResources.everywhere_else}
//]
}}
}}";
private static readonly string s_varWherePossiblePreviewTrue = $@"
using System;
class C{{
void Init()
{{
//[
var f = this.Init(); // {ServicesVSResources.everywhere_else}
//]
}}
}}";
private static readonly string s_preferThrowExpression = $@"
using System;
class C
{{
private string s;
public C(string s)
{{
//[
// {ServicesVSResources.Prefer_colon}
this.s = s ?? throw new ArgumentNullException(nameof(s));
// {ServicesVSResources.Over_colon}
if (s == null)
{{
throw new ArgumentNullException(nameof(s));
}}
this.s = s;
//]
}}
}}
";
private static readonly string s_preferCoalesceExpression = $@"
using System;
class C
{{
private string s;
public C(string s)
{{
//[
// {ServicesVSResources.Prefer_colon}
var v = x ?? y;
// {ServicesVSResources.Over_colon}
var v = x != null ? x : y; // {ServicesVSResources.or}
var v = x == null ? y : x;
//]
}}
}}
";
private static readonly string s_preferConditionalDelegateCall = $@"
using System;
class C
{{
private string s;
public C(string s)
{{
//[
// {ServicesVSResources.Prefer_colon}
func?.Invoke(args);
// {ServicesVSResources.Over_colon}
if (func != null)
{{
func(args);
}}
//]
}}
}}
";
private static readonly string s_preferNullPropagation = $@"
using System;
class C
{{
public C(object o)
{{
//[
// {ServicesVSResources.Prefer_colon}
var v = o?.ToString();
// {ServicesVSResources.Over_colon}
var v = o == null ? null : o.ToString(); // {ServicesVSResources.or}
var v = o != null ? o.ToString() : null;
//]
}}
}}
";
private static readonly string s_preferPatternMatchingOverAsWithNullCheck = $@"
class C
{{
void M()
{{
//[
// {ServicesVSResources.Prefer_colon}
if (o is string s)
{{
}}
// {ServicesVSResources.Over_colon}
var s = o as string;
if (s != null)
{{
}}
//]
}}
}}
";
private static readonly string s_preferPatternMatchingOverIsWithCastCheck = $@"
class C
{{
void M()
{{
//[
// {ServicesVSResources.Prefer_colon}
if (o is int i)
{{
}}
// {ServicesVSResources.Over_colon}
if (o is int)
{{
var i = (int)o;
}}
//]
}}
}}
";
private static readonly string s_preferObjectInitializer = $@"
using System;
class Customer
{{
private int Age;
public Customer()
{{
//[
// {ServicesVSResources.Prefer_colon}
var c = new Customer()
{{
Age = 21
}};
// {ServicesVSResources.Over_colon}
var c = new Customer();
c.Age = 21;
//]
}}
}}
";
private static readonly string s_preferCollectionInitializer = $@"
using System.Collections.Generic;
class Customer
{{
private int Age;
public Customer()
{{
//[
// {ServicesVSResources.Prefer_colon}
var list = new List<int>
{{
1,
2,
3
}};
// {ServicesVSResources.Over_colon}
var list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
//]
}}
}}
";
private static readonly string s_preferExplicitTupleName = $@"
class Customer
{{
public Customer()
{{
//[
// {ServicesVSResources.Prefer_colon}
(string name, int age) customer = GetCustomer();
var name = customer.name;
var age = customer.age;
// {ServicesVSResources.Over_colon}
(string name, int age) customer = GetCustomer();
var name = customer.Item1;
var age = customer.Item2;
//]
}}
}}
";
private static readonly string s_preferSimpleDefaultExpression = $@"
using System.Threading;
class Customer
{{
//[
// {ServicesVSResources.Prefer_colon}
void DoWork(CancellationToken cancellationToken = default) {{ }}
// {ServicesVSResources.Over_colon}
void DoWork(CancellationToken cancellationToken = default(CancellationToken)) {{ }}
//]
}}
";
private static readonly string s_preferInferredTupleName = $@"
using System.Threading;
class Customer
{{
public Customer(int age, string name)
{{
//[
// {ServicesVSResources.Prefer_colon}
var tuple = (age, name);
// {ServicesVSResources.Over_colon}
var tuple = (age: age, name: name);
//]
}}
}}
";
private static readonly string s_preferInferredAnonymousTypeMemberName = $@"
using System.Threading;
class Customer
{{
public Customer(int age, string name)
{{
//[
// {ServicesVSResources.Prefer_colon}
var anon = new {{ age, name }};
// {ServicesVSResources.Over_colon}
var anon = new {{ age = age, name = name }};
//]
}}
}}
";
private static readonly string s_preferInlinedVariableDeclaration = $@"
using System;
class Customer
{{
public Customer(string value)
{{
//[
// {ServicesVSResources.Prefer_colon}
if (int.TryParse(value, out int i))
{{
}}
// {ServicesVSResources.Over_colon}
int i;
if (int.TryParse(value, out i))
{{
}}
//]
}}
}}
";
private static readonly string s_preferDeconstructedVariableDeclaration = $@"
using System;
class Customer
{{
public Customer(string value)
{{
//[
// {ServicesVSResources.Prefer_colon}
var (name, age) = GetPersonTuple();
Console.WriteLine($""{{name}} {{age}}"");
(int x, int y) = GetPointTuple();
Console.WriteLine($""{{x}} {{y}}"");
// {ServicesVSResources.Over_colon}
var person = GetPersonTuple();
Console.WriteLine($""{{person.name}} {{person.age}}"");
(int x, int y) point = GetPointTuple();
Console.WriteLine($""{{point.x}} {{point.y}}"");
//]
}}
}}
";
private static readonly string s_preferBraces = $@"
using System;
class Customer
{{
private int Age;
public int GetAge()
{{
//[
// {ServicesVSResources.Prefer_colon}
if (test)
{{
this.Display();
}}
// {ServicesVSResources.Over_colon}
if (test)
this.Display();
//]
}}
}}
";
private static readonly string s_preferLocalFunctionOverAnonymousFunction = $@"
using System;
class Customer
{{
public Customer(string value)
{{
//[
// {ServicesVSResources.Prefer_colon}
int fibonacci(int n)
{{
return n <= 1 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
}}
// {ServicesVSResources.Over_colon}
Func<int, int> fibonacci = null;
fibonacci = (int n) =>
{{
return n <= 1 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
}};
//]
}}
}}
";
private static readonly string s_preferIsNullOverReferenceEquals = $@"
using System;
class Customer
{{
public Customer(string value)
{{
//[
// {ServicesVSResources.Prefer_colon}
if (value is null)
return;
// {ServicesVSResources.Over_colon}
if (object.ReferenceEquals(value, null))
return;
//]
}}
}}
";
private const string s_preferExpressionBodyForMethods = @"
using System;
//[
class Customer
{
private int Age;
public int GetAge() => this.Age;
}
//]
";
private const string s_preferBlockBodyForMethods = @"
using System;
//[
class Customer
{
private int Age;
public int GetAge()
{
return this.Age;
}
}
//]
";
private const string s_preferExpressionBodyForConstructors = @"
using System;
//[
class Customer
{
private int Age;
public Customer(int age) => Age = age;
}
//]
";
private const string s_preferBlockBodyForConstructors = @"
using System;
//[
class Customer
{
private int Age;
public Customer(int age)
{
Age = age;
}
}
//]
";
private const string s_preferExpressionBodyForOperators = @"
using System;
struct ComplexNumber
{
//[
public static ComplexNumber operator +(ComplexNumber c1, ComplexNumber c2)
=> new ComplexNumber(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary);
//]
}
";
private const string s_preferBlockBodyForOperators = @"
using System;
struct ComplexNumber
{
//[
public static ComplexNumber operator +(ComplexNumber c1, ComplexNumber c2)
{
return new ComplexNumber(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary);
}
//]
}
";
private const string s_preferExpressionBodyForProperties = @"
using System;
//[
class Customer
{
private int _age;
public int Age => _age;
}
//]
";
private const string s_preferBlockBodyForProperties = @"
using System;
//[
class Customer
{
private int _age;
public int Age { get { return _age; } }
}
//]
";
private const string s_preferExpressionBodyForAccessors = @"
using System;
//[
class Customer
{
private int _age;
public int Age
{
get => _age;
set => _age = value;
}
}
//]
";
private const string s_preferBlockBodyForAccessors = @"
using System;
//[
class Customer
{
private int _age;
public int Age
{
get { return _age; }
set { _age = value; }
}
}
//]
";
private const string s_preferExpressionBodyForIndexers = @"
using System;
//[
class List<T>
{
private T[] _values;
public T this[int i] => _values[i];
}
//]
";
private const string s_preferBlockBodyForIndexers = @"
using System;
//[
class List<T>
{
private T[] _values;
public T this[int i] { get { return _values[i]; } }
}
//]
";
#endregion
internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) : base(optionSet, serviceProvider, LanguageNames.CSharp)
{
var collectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(CodeStyleItems);
collectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AbstractCodeStyleOptionViewModel.GroupName)));
var qualifyGroupTitle = CSharpVSResources.this_preferences_colon;
var predefinedTypesGroupTitle = CSharpVSResources.predefined_type_preferences_colon;
var varGroupTitle = CSharpVSResources.var_preferences_colon;
var nullCheckingGroupTitle = CSharpVSResources.null_checking_colon;
var codeBlockPreferencesGroupTitle = ServicesVSResources.Code_block_preferences_colon;
var expressionPreferencesGroupTitle = ServicesVSResources.Expression_preferences_colon;
var variablePreferencesGroupTitle = ServicesVSResources.Variable_preferences_colon;
var qualifyMemberAccessPreferences = new List<CodeStylePreference>
{
new CodeStylePreference(CSharpVSResources.Prefer_this, isChecked: true),
new CodeStylePreference(CSharpVSResources.Do_not_prefer_this, isChecked: false),
};
var predefinedTypesPreferences = new List<CodeStylePreference>
{
new CodeStylePreference(ServicesVSResources.Prefer_predefined_type, isChecked: true),
new CodeStylePreference(ServicesVSResources.Prefer_framework_type, isChecked: false),
};
var typeStylePreferences = new List<CodeStylePreference>
{
new CodeStylePreference(CSharpVSResources.Prefer_var, isChecked: true),
new CodeStylePreference(CSharpVSResources.Prefer_explicit_type, isChecked: false),
};
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyFieldAccess, CSharpVSResources.Qualify_field_access_with_this, s_fieldDeclarationPreviewTrue, s_fieldDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyPropertyAccess, CSharpVSResources.Qualify_property_access_with_this, s_propertyDeclarationPreviewTrue, s_propertyDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyMethodAccess, CSharpVSResources.Qualify_method_access_with_this, s_methodDeclarationPreviewTrue, s_methodDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyEventAccess, CSharpVSResources.Qualify_event_access_with_this, s_eventDeclarationPreviewTrue, s_eventDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration, ServicesVSResources.For_locals_parameters_and_members, s_intrinsicPreviewDeclarationTrue, s_intrinsicPreviewDeclarationFalse, this, optionSet, predefinedTypesGroupTitle, predefinedTypesPreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, ServicesVSResources.For_member_access_expressions, s_intrinsicPreviewMemberAccessTrue, s_intrinsicPreviewMemberAccessFalse, this, optionSet, predefinedTypesGroupTitle, predefinedTypesPreferences));
// Use var
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, CSharpVSResources.For_built_in_types, s_varForIntrinsicsPreviewTrue, s_varForIntrinsicsPreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, CSharpVSResources.When_variable_type_is_apparent, s_varWhereApparentPreviewTrue, s_varWhereApparentPreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, CSharpVSResources.Elsewhere, s_varWherePossiblePreviewTrue, s_varWherePossiblePreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
// Code block
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferBraces, ServicesVSResources.Prefer_braces, s_preferBraces, s_preferBraces, this, optionSet, codeBlockPreferencesGroupTitle));
// Expression preferences
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferObjectInitializer, ServicesVSResources.Prefer_object_initializer, s_preferObjectInitializer, s_preferObjectInitializer, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferCollectionInitializer, ServicesVSResources.Prefer_collection_initializer, s_preferCollectionInitializer, s_preferCollectionInitializer, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferPatternMatchingOverIsWithCastCheck, CSharpVSResources.Prefer_pattern_matching_over_is_with_cast_check, s_preferPatternMatchingOverIsWithCastCheck, s_preferPatternMatchingOverIsWithCastCheck, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck, CSharpVSResources.Prefer_pattern_matching_over_as_with_null_check, s_preferPatternMatchingOverAsWithNullCheck, s_preferPatternMatchingOverAsWithNullCheck, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferExplicitTupleNames, ServicesVSResources.Prefer_explicit_tuple_name, s_preferExplicitTupleName, s_preferExplicitTupleName, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferSimpleDefaultExpression, ServicesVSResources.Prefer_simple_default_expression, s_preferSimpleDefaultExpression, s_preferSimpleDefaultExpression, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferInferredTupleNames, ServicesVSResources.Prefer_inferred_tuple_names, s_preferInferredTupleName, s_preferInferredTupleName, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferInferredAnonymousTypeMemberNames, ServicesVSResources.Prefer_inferred_anonymous_type_member_names, s_preferInferredAnonymousTypeMemberName, s_preferInferredAnonymousTypeMemberName, this, optionSet, expressionPreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferLocalOverAnonymousFunction, ServicesVSResources.Prefer_local_function_over_anonymous_function, s_preferLocalFunctionOverAnonymousFunction, s_preferLocalFunctionOverAnonymousFunction, this, optionSet, expressionPreferencesGroupTitle));
AddExpressionBodyOptions(optionSet, expressionPreferencesGroupTitle);
// Variable preferences
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferInlinedVariableDeclaration, ServicesVSResources.Prefer_inlined_variable_declaration, s_preferInlinedVariableDeclaration, s_preferInlinedVariableDeclaration, this, optionSet, variablePreferencesGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferDeconstructedVariableDeclaration, ServicesVSResources.Prefer_deconstructed_variable_declaration, s_preferDeconstructedVariableDeclaration, s_preferDeconstructedVariableDeclaration, this, optionSet, variablePreferencesGroupTitle));
// Null preferences.
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferThrowExpression, CSharpVSResources.Prefer_throw_expression, s_preferThrowExpression, s_preferThrowExpression, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferConditionalDelegateCall, CSharpVSResources.Prefer_conditional_delegate_call, s_preferConditionalDelegateCall, s_preferConditionalDelegateCall, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferCoalesceExpression, ServicesVSResources.Prefer_coalesce_expression, s_preferCoalesceExpression, s_preferCoalesceExpression, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferNullPropagation, ServicesVSResources.Prefer_null_propagation, s_preferNullPropagation, s_preferNullPropagation, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIsNullCheckOverReferenceEqualityMethod, CSharpVSResources.Prefer_is_null_over_ReferenceEquals, s_preferIsNullOverReferenceEquals, s_preferIsNullOverReferenceEquals, this, optionSet, nullCheckingGroupTitle));
}
private void AddExpressionBodyOptions(OptionSet optionSet, string expressionPreferencesGroupTitle)
{
var expressionBodyPreferences = new List<CodeStylePreference>
{
new CodeStylePreference(CSharpVSResources.Never, isChecked: false),
new CodeStylePreference(CSharpVSResources.When_possible, isChecked: false),
new CodeStylePreference(CSharpVSResources.When_on_single_line, isChecked: false),
};
var enumValues = new[] { ExpressionBodyPreference.Never, ExpressionBodyPreference.WhenPossible, ExpressionBodyPreference.WhenOnSingleLine };
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedMethods,
ServicesVSResources.Use_expression_body_for_methods,
enumValues,
new[] { s_preferBlockBodyForMethods, s_preferExpressionBodyForMethods, s_preferExpressionBodyForMethods },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedConstructors,
ServicesVSResources.Use_expression_body_for_constructors,
enumValues,
new[] { s_preferBlockBodyForConstructors, s_preferExpressionBodyForConstructors, s_preferExpressionBodyForConstructors },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedOperators,
ServicesVSResources.Use_expression_body_for_operators,
enumValues,
new[] { s_preferBlockBodyForOperators, s_preferExpressionBodyForOperators, s_preferExpressionBodyForOperators },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedProperties,
ServicesVSResources.Use_expression_body_for_properties,
enumValues,
new[] { s_preferBlockBodyForProperties, s_preferExpressionBodyForProperties, s_preferExpressionBodyForProperties },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedIndexers,
ServicesVSResources.Use_expression_body_for_indexers,
enumValues,
new[] { s_preferBlockBodyForIndexers, s_preferExpressionBodyForIndexers, s_preferExpressionBodyForIndexers },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
CodeStyleItems.Add(new EnumCodeStyleOptionViewModel<ExpressionBodyPreference>(
CSharpCodeStyleOptions.PreferExpressionBodiedAccessors,
ServicesVSResources.Use_expression_body_for_accessors,
enumValues,
new[] { s_preferBlockBodyForAccessors, s_preferExpressionBodyForAccessors, s_preferExpressionBodyForAccessors },
this, optionSet, expressionPreferencesGroupTitle, expressionBodyPreferences));
}
}
}
| {
"content_hash": "f72d589ed461e276ce9302fd4b362806",
"timestamp": "",
"source": "github",
"line_count": 891,
"max_line_length": 338,
"avg_line_length": 30.617283950617285,
"alnum_prop": 0.6825879765395895,
"repo_name": "srivatsn/roslyn",
"id": "d510f7b1898087aba169104be978dc76d02fab96",
"size": "27282",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/VisualStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "1C Enterprise",
"bytes": "289100"
},
{
"name": "Batchfile",
"bytes": "9670"
},
{
"name": "C#",
"bytes": "99578295"
},
{
"name": "C++",
"bytes": "5392"
},
{
"name": "F#",
"bytes": "3632"
},
{
"name": "Groovy",
"bytes": "11323"
},
{
"name": "PowerShell",
"bytes": "126820"
},
{
"name": "Shell",
"bytes": "13912"
},
{
"name": "Visual Basic",
"bytes": "75248765"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Azure.Analytics.Purview.Tests;
using Azure.Core.Pipeline;
using Azure.Core.TestFramework;
using Azure.Identity;
using Castle.DynamicProxy;
namespace Azure.Analytics.Purview.Administration.Tests
{
public class MetadataRolesClientTestBase : RecordedTestBase<PurviewCollectionTestEnvironment>
{
public MetadataRolesClientTestBase(bool isAsync, RecordedTestMode? mode = default) : base(isAsync, mode)
{
this.AddPurviewSanitizers();
}
public PurviewMetadataRolesClient GetMetadataPolicyClient()
{
var httpHandler = new HttpClientHandler();
httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) =>
{
return true;
};
var options = new PurviewMetadataClientOptions { Transport = new HttpClientTransport(httpHandler) };
var client = InstrumentClient(
new PurviewMetadataRolesClient(TestEnvironment.Endpoint, TestEnvironment.Credential, InstrumentClientOptions(options)));
return client;
}
}
}
| {
"content_hash": "0af3b8f9ed59577e38b1d1ea50add860",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 136,
"avg_line_length": 35.972972972972975,
"alnum_prop": 0.6987227648384673,
"repo_name": "Azure/azure-sdk-for-net",
"id": "3ff6ceb68d0087b8002d09ebe752f04b0398d0f5",
"size": "1333",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/purview/Azure.Analytics.Purview.Administration/tests/MetadataRolesClientTestBase.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import * as request from 'supertest';
import { Application } from '../application';
import { Errors, Round } from '../models';
import { ValidationErrorCode } from '../validation';
import * as utils from './testutils';
describe('/rounds integration tests', () => {
let app: Application;
async function setupDummyRounds() {
await app.db.execSql([
'INSERT OR REPLACE INTO rounds(round_number, winner_name) VALUES (1, "Provium");',
'DELETE FROM rounds WHERE round_number = 2;',
]);
}
beforeAll(async () => {
app = await utils.getTestServer({ api: { authBypass: true } });
});
afterAll(async () => {
app && await app.teardown();
});
describe('#GET /rounds/:roundNumber', () => {
beforeAll(setupDummyRounds);
it('should return 400 if roundNumber is not a number', async () => {
const res = await request(app.app).get('/rounds/a').expect(400);
expect(res.body.errors
.filter((e: ValidationErrorCode) => e === ValidationErrorCode.RoundNumberMustBePositiveInteger)
.length).toBe(1);
});
it('should return 400 if roundNumber is negative', async () => {
const res = await request(app.app).get('/rounds/-1').expect(400);
expect(res.body.errors
.filter((e: ValidationErrorCode) => e === ValidationErrorCode.RoundNumberMustBePositiveInteger)
.length).toBe(1);
});
it('should return 400 if roundNumber is a float', async () => {
const res = await request(app.app).get('/rounds/1.5').expect(400);
expect(res.body.errors
.filter((e: ValidationErrorCode) => e === ValidationErrorCode.RoundNumberMustBePositiveInteger)
.length).toBe(1);
});
it('should return 200 if the round is found', async () => {
const res = await request(app.app).get('/rounds/1').expect(200);
expect(res.body.roundNumber).toBe(1);
});
it('should return 404 if the round is not found', async () => {
const res = await request(app.app).get('/rounds/2').expect(Errors.RoundNotFoundError.statusCode);
expect(res.body.message).toBe(Errors.RoundNotFoundError.message);
});
});
describe('#POST /rounds', () => {
beforeEach(setupDummyRounds);
it('should return a 400 if the body is empty', async () => {
const res = await request(app.app).post('/rounds').send({}).expect(Errors.EmptyBodyError.statusCode);
expect(res.body.message).toBe(Errors.EmptyBodyError.message);
});
it('should return a 400 for validation errors', async () => {
const res = await request(app.app).post('/rounds').send({ roundNumber: 'a' }).expect(400);
expect(Array.isArray(res.body.errors)).toBe(true);
expect(res.body.errors).not.toHaveLength(0);
});
it('should return a 400 if the round already exists', async () => {
const res = await request(app.app).post('/rounds')
.send({ roundNumber: 1 })
.expect(Errors.RoundAlreadyExistsError.statusCode);
expect(res.body.message).toBe(Errors.RoundAlreadyExistsError.message);
});
it('should create rounds in the database', async () => {
const round: Round = { roundNumber: 2 };
await request(app.app).post('/rounds').send(round);
const res = await request(app.app).get(`/rounds/${round.roundNumber}`).expect(200);
expect(res.body).toEqual(round);
});
it('should return the inserted round and the winner\'s win list', async () => {
const round: Round = {
roundNumber: 2,
winTime: 123,
};
const res = await request(app.app).post('/rounds').send(round).expect(201);
expect(res.body.round).toEqual(round);
expect(res.body.newWinner).toBeUndefined();
});
it('should return the winner\'s win list', async () => {
const round: Round = {
roundNumber: 2,
winnerName: 'Provium',
};
const res = await request(app.app).post('/rounds').send(round).expect(201);
expect(res.body.newWinner).toBeDefined();
expect(res.body.newWinner.username).toBe(round.winnerName);
expect(res.body.newWinner.roundList).toEqual(expect.arrayContaining([round.roundNumber]));
});
});
describe('#PATCH /rounds', () => {
beforeEach(setupDummyRounds);
it('should return a 400 if the body is empty', async () => {
const res = await request(app.app).patch('/rounds/1').send({}).expect(Errors.EmptyBodyError.statusCode);
expect(res.body.message).toBe(Errors.EmptyBodyError.message);
});
it('should return 400 if the round number is invalid', async () => {
const res = await request(app.app).patch('/rounds/a').send({ a: 1 }).expect(400);
expect(res.body.errors).toEqual(
expect.arrayContaining([ValidationErrorCode.RoundNumberMustBePositiveInteger]));
});
it('should update rounds in the database', async () => {
await request(app.app).patch('/rounds/1').send({ hostName: 'Provium2' });
const res = await request(app.app).get('/rounds/1').expect(200);
expect(res.body.hostName).toBe('Provium2');
});
it('should validate the merged round', async () => {
const res = await request(app.app).patch('/rounds/1').send({ hostName: 'Provium' }).expect(400);
expect(res.body.errors).toEqual(expect.arrayContaining([ValidationErrorCode.RoundCannotBeWonByHost]));
});
it('should return the updated round', async () => {
const res = await request(app.app).patch('/rounds/1').send({ winnerName: 'Provium2' }).expect(200);
expect(res.body.round).toBeDefined();
expect(res.body.round.roundNumber).toBe(1);
expect(res.body.round.winnerName).toBe('Provium2');
});
it('should return the old winner\'s stats', async () => {
const res = await request(app.app).patch('/rounds/1').send({ winnerName: 'Provium2' }).expect(200);
expect(res.body.oldWinner).toBeDefined();
expect(res.body.oldWinner.username).toBe('Provium');
expect(Array.isArray(res.body.oldWinner.roundList)).toBe(true);
expect(res.body.oldWinner.roundList).not.toEqual(expect.arrayContaining([1]));
});
it('should return the new winner\'s stats', async () => {
const res = await request(app.app).patch('/rounds/1').send({ winnerName: 'Provium2' }).expect(200);
expect(res.body.newWinner).toBeDefined();
expect(res.body.newWinner.username).toBe('Provium2');
expect(Array.isArray(res.body.newWinner.roundList)).toBe(true);
expect(res.body.newWinner.roundList).toEqual(expect.arrayContaining([1]));
});
});
describe('#DELETE /rounds', () => {
beforeEach(setupDummyRounds);
it('should return 400 if the round number is invalid', async () => {
const res = await request(app.app).delete('/rounds/a').expect(400);
expect(Array.isArray(res.body.errors)).toBe(true);
expect(res.body.errors).toEqual(
expect.arrayContaining([ValidationErrorCode.RoundNumberMustBePositiveInteger]));
});
it('should return 404 if the round doesn\'t exist', async () => {
const res = await request(app.app).delete('/rounds/2').expect(Errors.RoundNotFoundError.statusCode);
expect(res.body.message).toBe(Errors.RoundNotFoundError.message);
});
it('should return the deleted round and the old winner\'s stats', async () => {
const res = await request(app.app).delete('/rounds/1').expect(200);
expect(res.body.round).toBeDefined();
expect(res.body.oldWinner).toBeDefined();
expect(res.body.round.roundNumber).toBe(1);
expect(res.body.oldWinner.username).toBe('Provium');
expect(Array.isArray(res.body.oldWinner.roundList)).toBe(true);
expect(res.body.oldWinner.roundList).not.toEqual(expect.arrayContaining([2]));
});
});
});
| {
"content_hash": "a64e2054095175d45e4ab87978383597",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 116,
"avg_line_length": 41.56585365853658,
"alnum_prop": 0.5876070883699096,
"repo_name": "hswhite33/picturegame-api",
"id": "7d672cf2520c765e2bbdb81276e5424881ceb85b",
"size": "8521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tests/rounds.test.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "1312"
},
{
"name": "TypeScript",
"bytes": "77279"
}
],
"symlink_target": ""
} |
<?php
namespace Google\AdsApi\Dfp\v201705;
/**
* This file was generated from WSDL. DO NOT EDIT.
*/
class CompanySettings
{
/**
* @var string $billingCap
*/
protected $billingCap = null;
/**
* @var string $billingSchedule
*/
protected $billingSchedule = null;
/**
* @var string $billingSource
*/
protected $billingSource = null;
/**
* @var int $advertiserDiscount
*/
protected $advertiserDiscount = null;
/**
* @var int $valueAddedTax
*/
protected $valueAddedTax = null;
/**
* @var int $agencyCommission
*/
protected $agencyCommission = null;
/**
* @param string $billingCap
* @param string $billingSchedule
* @param string $billingSource
* @param int $advertiserDiscount
* @param int $valueAddedTax
* @param int $agencyCommission
*/
public function __construct($billingCap = null, $billingSchedule = null, $billingSource = null, $advertiserDiscount = null, $valueAddedTax = null, $agencyCommission = null)
{
$this->billingCap = $billingCap;
$this->billingSchedule = $billingSchedule;
$this->billingSource = $billingSource;
$this->advertiserDiscount = $advertiserDiscount;
$this->valueAddedTax = $valueAddedTax;
$this->agencyCommission = $agencyCommission;
}
/**
* @return string
*/
public function getBillingCap()
{
return $this->billingCap;
}
/**
* @param string $billingCap
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setBillingCap($billingCap)
{
$this->billingCap = $billingCap;
return $this;
}
/**
* @return string
*/
public function getBillingSchedule()
{
return $this->billingSchedule;
}
/**
* @param string $billingSchedule
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setBillingSchedule($billingSchedule)
{
$this->billingSchedule = $billingSchedule;
return $this;
}
/**
* @return string
*/
public function getBillingSource()
{
return $this->billingSource;
}
/**
* @param string $billingSource
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setBillingSource($billingSource)
{
$this->billingSource = $billingSource;
return $this;
}
/**
* @return int
*/
public function getAdvertiserDiscount()
{
return $this->advertiserDiscount;
}
/**
* @param int $advertiserDiscount
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setAdvertiserDiscount($advertiserDiscount)
{
$this->advertiserDiscount = $advertiserDiscount;
return $this;
}
/**
* @return int
*/
public function getValueAddedTax()
{
return $this->valueAddedTax;
}
/**
* @param int $valueAddedTax
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setValueAddedTax($valueAddedTax)
{
$this->valueAddedTax = $valueAddedTax;
return $this;
}
/**
* @return int
*/
public function getAgencyCommission()
{
return $this->agencyCommission;
}
/**
* @param int $agencyCommission
* @return \Google\AdsApi\Dfp\v201705\CompanySettings
*/
public function setAgencyCommission($agencyCommission)
{
$this->agencyCommission = $agencyCommission;
return $this;
}
}
| {
"content_hash": "1d730c2508d5c82e7b427f3c68b32d4b",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 176,
"avg_line_length": 21.404761904761905,
"alnum_prop": 0.6042825361512792,
"repo_name": "jeraldfeller/jbenterprises",
"id": "4b5719a5609c4302610c89fe1d01a8ba59720403",
"size": "3596",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "google-adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Dfp/v201705/CompanySettings.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "137"
},
{
"name": "CSS",
"bytes": "4465774"
},
{
"name": "CoffeeScript",
"bytes": "83631"
},
{
"name": "HTML",
"bytes": "2549782"
},
{
"name": "JavaScript",
"bytes": "17552996"
},
{
"name": "PHP",
"bytes": "3092947"
},
{
"name": "Shell",
"bytes": "444"
}
],
"symlink_target": ""
} |
class CBC_DataMatrix : public CBC_CodeBase {
public:
CBC_DataMatrix();
~CBC_DataMatrix() override;
// CBC_OneCode:
bool Encode(const CFX_WideStringC& contents,
bool isDevice,
int32_t& e) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
};
#endif // XFA_FXBARCODE_CBC_DATAMATRIX_H_
| {
"content_hash": "2e1e275e816e27653ac71ccbbef0f722",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 30.294117647058822,
"alnum_prop": 0.6310679611650486,
"repo_name": "DrAlexx/pdfium",
"id": "661b48d744f07e82c1ef432470734b1e8ca869ce",
"size": "977",
"binary": false,
"copies": "3",
"ref": "refs/heads/light_version",
"path": "xfa/fxbarcode/cbc_datamatrix.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "294931"
},
{
"name": "C++",
"bytes": "17923467"
},
{
"name": "CMake",
"bytes": "43227"
},
{
"name": "Objective-C",
"bytes": "3510"
},
{
"name": "Objective-C++",
"bytes": "4498"
},
{
"name": "Python",
"bytes": "124288"
},
{
"name": "Shell",
"bytes": "545"
}
],
"symlink_target": ""
} |
import { Collection, Snowflake } from "discord.js";
import { handleMessage } from "../src/message-handler";
import { Message, Channel, TextChannel, DMChannel, User, Guild, GuildMember, Role } from "../src/discord-mock";
import { roleNames } from "../src/permissions";
class MockUser implements User {
bot: false;
id: Snowflake;
dmChannel: MockDMChannel;
constructor(name: string) {
this.id = name;
this.dmChannel = new MockDMChannel(this);
}
async createDM() {
return this.dmChannel;
}
}
class MockGuildMember implements GuildMember {
id: Snowflake;
roles: Collection<Snowflake, Role>;
user: User;
constructor(user: User, roles: Role[]) {
this.id = user.id;
this.roles = new Collection(roles.map<[Snowflake, Role]>(role => [role.name, role]));
this.user = user;
}
}
class MockTextChannel implements TextChannel {
id: Snowflake;
name: string;
type: "text";
responses: string[];
constructor(id: string, name: string) {
this.id = id;
this.name = name;
this.type = "text";
}
async send(content: string) {
this.responses.push(content);
}
reset() {
this.responses = [];
}
}
class MockDMChannel implements DMChannel {
id: Snowflake;
type: "dm";
responses: string[];
constructor(user: User) {
this.id = user.id + "_dm";
this.type = "dm";
}
async send(content: string) {
this.responses.push(content);
}
reset() {
this.responses = [];
}
}
export const teahouse = new MockTextChannel("public1", "Teahouse");
export const battlefield = new MockTextChannel("public2", "Battlefield");
export const admin = new MockUser("admin");
export const storyteller = new MockUser("storyteller");
export const player = new MockUser("player");
const setRoles = (user: User, roles: Role[]): [Snowflake, GuildMember] => [user.id, new MockGuildMember(user, roles)];
const adminRole: Role = { name: roleNames.admin };
const placeholderRole: Role = { name: "placeholder" };
export const guild: Guild = {
members: new Collection<Snowflake, GuildMember>([
setRoles(admin, [adminRole]),
setRoles(storyteller, [placeholderRole]),
setRoles(player, [placeholderRole])
])
};
export function reset() {
teahouse.reset();
battlefield.reset();
admin.dmChannel.reset();
storyteller.dmChannel.reset();
player.dmChannel.reset();
} | {
"content_hash": "67a568ac8891bf7ec914a3e33b640839",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 118,
"avg_line_length": 22.78,
"alnum_prop": 0.6927129060579456,
"repo_name": "AlexGodofsky/exalted-discord-mush",
"id": "ba52c83fa830bf6457b76235a1b8abac0ba51b75",
"size": "2278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/mock.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "TypeScript",
"bytes": "41258"
}
],
"symlink_target": ""
} |
namespace dart {
class ThreadSignalBlocker {
public:
explicit ThreadSignalBlocker(int sig) {
sigset_t signal_mask;
sigemptyset(&signal_mask);
sigaddset(&signal_mask, sig);
// Add sig to signal mask.
int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old);
USE(r);
ASSERT(r == 0);
}
ThreadSignalBlocker(int sigs_count, const int sigs[]) {
sigset_t signal_mask;
sigemptyset(&signal_mask);
for (int i = 0; i < sigs_count; i++) {
sigaddset(&signal_mask, sigs[i]);
}
// Add sig to signal mask.
int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old);
USE(r);
ASSERT(r == 0);
}
~ThreadSignalBlocker() {
// Restore signal mask.
int r = pthread_sigmask(SIG_SETMASK, &old, NULL);
USE(r);
ASSERT(r == 0);
}
private:
sigset_t old;
};
// The definition below is copied from Linux and adapted to avoid lint
// errors (type long int changed to intptr_t and do/while split on
// separate lines with body in {}s) and to also block signals.
#define TEMP_FAILURE_RETRY(expression) \
({ \
ThreadSignalBlocker tsb(SIGPROF); \
intptr_t __result; \
do { \
__result = (expression); \
} while ((__result == -1L) && (errno == EINTR)); \
__result; \
})
// This is a version of TEMP_FAILURE_RETRY which does not use the value
// returned from the expression.
#define VOID_TEMP_FAILURE_RETRY(expression) \
(static_cast<void>(TEMP_FAILURE_RETRY(expression)))
// This macro can be used to insert checks that a call is made, that
// was expected to not return EINTR, but did it anyway.
#define NO_RETRY_EXPECTED(expression) \
({ \
intptr_t __result = (expression); \
if (__result == -1L && errno == EINTR) { \
FATAL("Unexpected EINTR errno"); \
} \
__result; \
})
#define VOID_NO_RETRY_EXPECTED(expression) \
(static_cast<void>(NO_RETRY_EXPECTED(expression)))
// Define to check in debug mode, if a signal is currently being blocked.
#define CHECK_IS_BLOCKING(signal) \
({ \
sigset_t signal_mask; \
int __r = pthread_sigmask(SIG_BLOCK, NULL, &signal_mask); \
USE(__r); \
ASSERT(__r == 0); \
sigismember(&signal_mask, signal); \
})
// Versions of the above, that does not enter a signal blocking scope. Use only
// when a signal blocking scope is entered manually.
#define TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \
({ \
intptr_t __result; \
ASSERT(CHECK_IS_BLOCKING(SIGPROF)); \
do { \
__result = (expression); \
} while ((__result == -1L) && (errno == EINTR)); \
__result; \
})
#define VOID_TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \
(static_cast<void>(TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression)))
} // namespace dart
#endif // RUNTIME_PLATFORM_SIGNAL_BLOCKER_H_
| {
"content_hash": "2525a2b99328fc087edb540c4ad7da57",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 80,
"avg_line_length": 45.45360824742268,
"alnum_prop": 0.40054434112043547,
"repo_name": "dart-lang/sdk",
"id": "e47ac60f940665be4de75c9373f4022df03fda2d",
"size": "4912",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "runtime/platform/signal_blocker.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "7081"
},
{
"name": "Batchfile",
"bytes": "4407"
},
{
"name": "C",
"bytes": "1393784"
},
{
"name": "C++",
"bytes": "22197561"
},
{
"name": "CMake",
"bytes": "1598"
},
{
"name": "CSS",
"bytes": "142589"
},
{
"name": "Dart",
"bytes": "142185469"
},
{
"name": "Dockerfile",
"bytes": "495"
},
{
"name": "GAP",
"bytes": "43658"
},
{
"name": "HTML",
"bytes": "746243"
},
{
"name": "Java",
"bytes": "637086"
},
{
"name": "JavaScript",
"bytes": "238808"
},
{
"name": "Makefile",
"bytes": "9320"
},
{
"name": "Objective-C++",
"bytes": "854"
},
{
"name": "Python",
"bytes": "1227015"
},
{
"name": "SCSS",
"bytes": "23561"
},
{
"name": "Shell",
"bytes": "139201"
},
{
"name": "TeX",
"bytes": "75730"
}
],
"symlink_target": ""
} |
package metadslx.compiler;
public class SymbolTypeAnnotation {
private String name;
private boolean hasName;
private Class<?> symbolType;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
this.hasName = true;
}
public boolean hasName() {
return hasName;
}
public void setHasName(boolean hasName) {
this.hasName = hasName;
}
public Class<?> getSymbolType() {
return symbolType;
}
public void setSymbolType(Class<?> symbolType) {
this.symbolType = symbolType;
}
}
| {
"content_hash": "141a6687d3e1ac907e61a508f2d38388",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 49,
"avg_line_length": 18.09375,
"alnum_prop": 0.6701208981001727,
"repo_name": "balazssimon/meta-java",
"id": "9c06be609fb2e7291cf943d188a5fa41f53b86c0",
"size": "579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/metadslx.compiler/src/main/java/metadslx/compiler/SymbolTypeAnnotation.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "76629"
},
{
"name": "Java",
"bytes": "3826524"
},
{
"name": "Objective-C++",
"bytes": "38845"
}
],
"symlink_target": ""
} |
/* This file implements an OCSP client including a toy HTTP/1.0
* client. Once httpd depends on a real HTTP client library, most of
* this can be thrown away. */
#include "ssl_private.h"
#ifndef OPENSSL_NO_OCSP
#include "apr_buckets.h"
#include "apr_uri.h"
/* Serialize an OCSP request which will be sent to the responder at
* given URI to a memory BIO object, which is returned. */
static BIO *serialize_request(OCSP_REQUEST *req, const apr_uri_t *uri)
{
BIO *bio;
int len;
len = i2d_OCSP_REQUEST(req, NULL);
bio = BIO_new(BIO_s_mem());
BIO_printf(bio, "POST %s%s%s HTTP/1.0\r\n"
"Host: %s:%d\r\n"
"Content-Type: application/ocsp-request\r\n"
"Content-Length: %d\r\n"
"\r\n",
uri->path ? uri->path : "/",
uri->query ? "?" : "", uri->query ? uri->query : "",
uri->hostname, uri->port, len);
if (i2d_OCSP_REQUEST_bio(bio, req) != 1) {
BIO_free(bio);
return NULL;
}
return bio;
}
/* Send the OCSP request serialized into BIO 'request' to the
* responder at given server given by URI. Returns socket object or
* NULL on error. */
static apr_socket_t *send_request(BIO *request, const apr_uri_t *uri,
apr_interval_time_t timeout,
conn_rec *c, apr_pool_t *p)
{
apr_status_t rv;
apr_sockaddr_t *sa;
apr_socket_t *sd;
char buf[HUGE_STRING_LEN];
int len;
rv = apr_sockaddr_info_get(&sa, uri->hostname, APR_UNSPEC, uri->port, 0, p);
if (rv) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01972)
"could not resolve address of OCSP responder %s",
uri->hostinfo);
return NULL;
}
/* establish a connection to the OCSP responder */
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01973)
"connecting to OCSP responder '%s'", uri->hostinfo);
/* Cycle through address until a connect() succeeds. */
for (; sa; sa = sa->next) {
rv = apr_socket_create(&sd, sa->family, SOCK_STREAM, APR_PROTO_TCP, p);
if (rv == APR_SUCCESS) {
apr_socket_timeout_set(sd, timeout);
rv = apr_socket_connect(sd, sa);
if (rv == APR_SUCCESS) {
break;
}
apr_socket_close(sd);
}
}
if (sa == NULL) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01974)
"could not connect to OCSP responder '%s'",
uri->hostinfo);
apr_socket_close(sd);
return NULL;
}
/* send the request and get a response */
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01975)
"sending request to OCSP responder");
while ((len = BIO_read(request, buf, sizeof buf)) > 0) {
char *wbuf = buf;
apr_size_t remain = len;
do {
apr_size_t wlen = remain;
rv = apr_socket_send(sd, wbuf, &wlen);
wbuf += remain;
remain -= wlen;
} while (rv == APR_SUCCESS && remain > 0);
if (rv) {
apr_socket_close(sd);
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01976)
"failed to send request to OCSP responder '%s'",
uri->hostinfo);
return NULL;
}
}
return sd;
}
/* Return a pool-allocated NUL-terminated line, with CRLF stripped,
* read from brigade 'bbin' using 'bbout' as temporary storage. */
static char *get_line(apr_bucket_brigade *bbout, apr_bucket_brigade *bbin,
conn_rec *c, apr_pool_t *p)
{
apr_status_t rv;
apr_size_t len;
char *line;
apr_brigade_cleanup(bbout);
rv = apr_brigade_split_line(bbout, bbin, APR_BLOCK_READ, 8192);
if (rv) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01977)
"failed reading line from OCSP server");
return NULL;
}
rv = apr_brigade_pflatten(bbout, &line, &len, p);
if (rv) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01978)
"failed reading line from OCSP server");
return NULL;
}
if (len == 0) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(02321)
"empty response from OCSP server");
return NULL;
}
if (line[len-1] != APR_ASCII_LF) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01979)
"response header line too long from OCSP server");
return NULL;
}
line[len-1] = '\0';
if (len > 1 && line[len-2] == APR_ASCII_CR) {
line[len-2] = '\0';
}
return line;
}
/* Maximum values to prevent eating RAM forever. */
#define MAX_HEADERS (256)
#define MAX_CONTENT (2048 * 1024)
/* Read the OCSP response from the socket 'sd', using temporary memory
* BIO 'bio', and return the decoded OCSP response object, or NULL on
* error. */
static OCSP_RESPONSE *read_response(apr_socket_t *sd, BIO *bio, conn_rec *c,
apr_pool_t *p)
{
apr_bucket_brigade *bb, *tmpbb;
OCSP_RESPONSE *response;
char *line;
apr_size_t count;
apr_int64_t code;
/* Using brigades for response parsing is much simpler than using
* apr_socket_* directly. */
bb = apr_brigade_create(p, c->bucket_alloc);
tmpbb = apr_brigade_create(p, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_socket_create(sd, c->bucket_alloc));
line = get_line(tmpbb, bb, c, p);
if (!line || strncmp(line, "HTTP/", 5)
|| (line = ap_strchr(line, ' ')) == NULL
|| (code = apr_atoi64(++line)) < 200 || code > 299) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01980)
"bad response from OCSP server: %s",
line ? line : "(none)");
return NULL;
}
/* Read till end of headers; don't have to even bother parsing the
* Content-Length since the server is obliged to close the
* connection after the response anyway for HTTP/1.0. */
count = 0;
while ((line = get_line(tmpbb, bb, c, p)) != NULL && line[0]
&& ++count < MAX_HEADERS) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01981)
"OCSP response header: %s", line);
}
if (count == MAX_HEADERS) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01982)
"could not read response headers from OCSP server, "
"exceeded maximum count (%u)", MAX_HEADERS);
return NULL;
}
else if (!line) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01983)
"could not read response header from OCSP server");
return NULL;
}
/* Read the response body into the memory BIO. */
count = 0;
while (!APR_BRIGADE_EMPTY(bb)) {
const char *data;
apr_size_t len;
apr_status_t rv;
apr_bucket *e = APR_BRIGADE_FIRST(bb);
rv = apr_bucket_read(e, &data, &len, APR_BLOCK_READ);
if (rv == APR_EOF) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01984)
"OCSP response: got EOF");
break;
}
if (rv != APR_SUCCESS) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01985)
"error reading response from OCSP server");
return NULL;
}
if (len == 0) {
/* Ignore zero-length buckets (possible side-effect of
* line splitting). */
apr_bucket_delete(e);
continue;
}
count += len;
if (count > MAX_CONTENT) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01986)
"OCSP response size exceeds %u byte limit",
MAX_CONTENT);
return NULL;
}
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01987)
"OCSP response: got %" APR_SIZE_T_FMT
" bytes, %" APR_SIZE_T_FMT " total", len, count);
BIO_write(bio, data, (int)len);
apr_bucket_delete(e);
}
apr_brigade_destroy(bb);
apr_brigade_destroy(tmpbb);
/* Finally decode the OCSP response from what's stored in the
* bio. */
response = d2i_OCSP_RESPONSE_bio(bio, NULL);
if (response == NULL) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01988)
"failed to decode OCSP response data");
ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, mySrvFromConn(c));
}
return response;
}
OCSP_RESPONSE *modssl_dispatch_ocsp_request(const apr_uri_t *uri,
apr_interval_time_t timeout,
OCSP_REQUEST *request,
conn_rec *c, apr_pool_t *p)
{
OCSP_RESPONSE *response = NULL;
apr_socket_t *sd;
BIO *bio;
bio = serialize_request(request, uri);
if (bio == NULL) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01989)
"could not serialize OCSP request");
ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, mySrvFromConn(c));
return NULL;
}
sd = send_request(bio, uri, timeout, c, p);
if (sd == NULL) {
/* Errors already logged. */
BIO_free(bio);
return NULL;
}
/* Clear the BIO contents, ready for the response. */
(void)BIO_reset(bio);
response = read_response(sd, bio, c, p);
apr_socket_close(sd);
BIO_free(bio);
return response;
}
#endif /* HAVE_OCSP */
| {
"content_hash": "81fbfbe17d152f366e1bdb9ca99cbdf4",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 80,
"avg_line_length": 32.029411764705884,
"alnum_prop": 0.5357616569737782,
"repo_name": "bkuebler/openshift-apache-http-cartridge",
"id": "757df05f4095447379a32504dac2b8f7cab6cb72",
"size": "10599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/httpd-2.4.6/modules/ssl/ssl_util_ocsp.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "34826"
},
{
"name": "C",
"bytes": "7519273"
},
{
"name": "C++",
"bytes": "3116"
},
{
"name": "CSS",
"bytes": "41229"
},
{
"name": "D",
"bytes": "12419"
},
{
"name": "JavaScript",
"bytes": "72107"
},
{
"name": "Lua",
"bytes": "13797"
},
{
"name": "Perl",
"bytes": "17960"
},
{
"name": "Prolog",
"bytes": "11284"
},
{
"name": "Shell",
"bytes": "339783"
},
{
"name": "Visual Basic",
"bytes": "1074"
}
],
"symlink_target": ""
} |
package org.openqa.selenium.server.security;
import com.google.common.base.Preconditions;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
public class KeyAndCert {
private final PrivateKey privateKey;
private final X509Certificate[] certificates;
public KeyAndCert(PrivateKey privateKey, X509Certificate... certificates) {
this.privateKey = Preconditions.checkNotNull(privateKey);
this.certificates = certificates;
}
public PrivateKey getPrivateKey() {
return privateKey;
}
public X509Certificate getCertificate() {
return certificates[0];
}
}
| {
"content_hash": "1060d4d63c59ce426e28fc19033edeaf",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 77,
"avg_line_length": 23.53846153846154,
"alnum_prop": 0.7712418300653595,
"repo_name": "SeleniumGridRefactor/selenium.server",
"id": "848ca20120a1a31046e3a0e6cf47ea1468558085",
"size": "1222",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "src/main/java/org/openqa/selenium/server/security/KeyAndCert.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "193"
},
{
"name": "Java",
"bytes": "576186"
},
{
"name": "Ruby",
"bytes": "2107"
}
],
"symlink_target": ""
} |
#include "ignite/impl/binary/binary_type_handler.h"
using namespace ignite::common::concurrent;
namespace ignite
{
namespace impl
{
namespace binary
{
BinaryTypeHandler::BinaryTypeHandler(SPSnap snap) :
origin(snap),
updated()
{
// No-op.
}
void BinaryTypeHandler::OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId)
{
if (!origin.Get() || !origin.Get()->ContainsFieldId(fieldId))
{
if (!updated.Get())
updated = SPSnap(new Snap(*origin.Get()));
updated.Get()->AddField(fieldId, fieldName, fieldTypeId);
}
}
}
}
}
| {
"content_hash": "b93388c8ff631839739d6073bfbdc0ff",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 111,
"avg_line_length": 25.5,
"alnum_prop": 0.4852941176470588,
"repo_name": "NSAmelchev/ignite",
"id": "0b3328a6a83dd0ff10655b9c77c84efe05f09b87",
"size": "1618",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "modules/platforms/cpp/binary/src/impl/binary/binary_type_handler.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "54788"
},
{
"name": "C",
"bytes": "7601"
},
{
"name": "C#",
"bytes": "7740054"
},
{
"name": "C++",
"bytes": "4487801"
},
{
"name": "CMake",
"bytes": "54473"
},
{
"name": "Dockerfile",
"bytes": "11909"
},
{
"name": "FreeMarker",
"bytes": "15591"
},
{
"name": "HTML",
"bytes": "14341"
},
{
"name": "Java",
"bytes": "50117357"
},
{
"name": "JavaScript",
"bytes": "1085"
},
{
"name": "Jinja",
"bytes": "32958"
},
{
"name": "Makefile",
"bytes": "932"
},
{
"name": "PHP",
"bytes": "11079"
},
{
"name": "PowerShell",
"bytes": "9247"
},
{
"name": "Python",
"bytes": "330115"
},
{
"name": "Scala",
"bytes": "425434"
},
{
"name": "Shell",
"bytes": "311510"
}
],
"symlink_target": ""
} |
package stat
import "sort"
// ROC returns paired false positive rate (FPR) and true positive rate
// (TPR) values corresponding to n cutoffs spanning the relative
// (or receiver) operator characteristic (ROC) curve obtained when y is
// treated as a binary classifier for classes with weights.
//
// Cutoffs are equally spaced from eps less than the minimum value of y
// to the maximum value of y, including both endpoints meaning that the
// resulting ROC curve will always begin at (0,0) and end at (1,1).
//
// The input y must be sorted, and SortWeightedLabeled can be used in
// order to sort y together with classes and weights.
//
// For a given cutoff value, observations corresponding to entries in y
// greater than the cutoff value are classified as false, while those
// below (or equal to) the cutoff value are classified as true. These
// assigned class labels are compared with the true values in the classes
// slice and used to calculate the FPR and TPR.
//
// If weights is nil, all weights are treated as 1.
//
// When n is zero all possible cutoffs are calculated, resulting
// in fpr and tpr having length one greater than the number of unique
// values in y. When n is greater than one fpr and tpr will be returned
// with length n. ROC will panic if n is equal to one or less than 0.
//
// More details about ROC curves are available at
// https://en.wikipedia.org/wiki/Receiver_operating_characteristic
func ROC(n int, y []float64, classes []bool, weights []float64) (tpr, fpr []float64) {
if len(y) != len(classes) {
panic("stat: slice length mismatch")
}
if weights != nil && len(y) != len(weights) {
panic("stat: slice length mismatch")
}
if !sort.Float64sAreSorted(y) {
panic("stat: input must be sorted")
}
var incWidth, tol float64
if n == 0 {
if len(y) == 0 {
return nil, nil
}
tpr = make([]float64, len(y)+1)
fpr = make([]float64, len(y)+1)
} else {
if n < 2 {
panic("stat: cannot calculate fewer than 2 points on a ROC curve")
}
if len(y) == 0 {
return nil, nil
}
tpr = make([]float64, n)
fpr = make([]float64, n)
incWidth = (y[len(y)-1] - y[0]) / float64(n-1)
tol = y[0] + incWidth
if incWidth == 0 {
tpr[n-1] = 1
fpr[n-1] = 1
return
}
}
bin := 1 // the initial bin is known to have 0 fpr and 0 tpr
var nPos, nNeg float64
for i, u := range classes {
var posWeight, negWeight float64 = 0, 1
if weights != nil {
negWeight = weights[i]
}
if u {
posWeight, negWeight = negWeight, posWeight
}
nPos += posWeight
nNeg += negWeight
tpr[bin] += posWeight
fpr[bin] += negWeight
// Assess if the bin needs to be updated. If n is zero,
// the bin is always updated, unless consecutive y values
// are equal. Otherwise, the bin must be updated until it
// matches the next y value (skipping empty bins).
if n == 0 {
if i != (len(y)-1) && y[i] != y[i+1] {
bin++
tpr[bin] = tpr[bin-1]
fpr[bin] = fpr[bin-1]
}
} else {
for i != (len(y)-1) && y[i+1] > tol {
tol += incWidth
bin++
tpr[bin] = tpr[bin-1]
fpr[bin] = fpr[bin-1]
}
}
}
if n == 0 {
tpr = tpr[:(bin + 1)]
fpr = fpr[:(bin + 1)]
}
var invNeg, invPos float64
if nNeg != 0 {
invNeg = 1 / nNeg
}
if nPos != 0 {
invPos = 1 / nPos
}
for i := range tpr {
tpr[i] *= invPos
fpr[i] *= invNeg
}
tpr[len(tpr)-1] = 1
fpr[len(fpr)-1] = 1
return tpr, fpr
}
| {
"content_hash": "934e39d6da6fbb0de93912a1678f285e",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 86,
"avg_line_length": 27.81967213114754,
"alnum_prop": 0.64407778432528,
"repo_name": "sdminonne/origin",
"id": "3605c8f9a6427fe21524ad51ae4a19364c3e2396",
"size": "3559",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "vendor/gonum.org/v1/gonum/stat/roc.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "921"
},
{
"name": "Dockerfile",
"bytes": "1668"
},
{
"name": "Go",
"bytes": "2136606"
},
{
"name": "Makefile",
"bytes": "6549"
},
{
"name": "Python",
"bytes": "14374"
},
{
"name": "Shell",
"bytes": "315233"
}
],
"symlink_target": ""
} |
package com.xqbase.tuna.mux;
import com.xqbase.tuna.ConnectionHandler;
import com.xqbase.tuna.packet.PacketException;
import com.xqbase.tuna.packet.PacketParser;
import com.xqbase.tuna.util.Bytes;
class MuxPacket {
private static final int HEAD_TAG = 0x2095;
// Client Commands
static final int CLIENT_PING = 0x101;
static final int CLIENT_AUTH = 0x111;
static final int CLIENT_LISTEN = 0x121;
// Server Commands
static final int SERVER_PONG = 0x201;
static final int SERVER_AUTH_NEED = 0x212;
static final int SERVER_AUTH_OK = 0x218;
static final int SERVER_AUTH_ERROR = 0x219;
static final int SERVER_LISTEN_OK = 0x228;
static final int SERVER_LISTEN_ERROR = 0x229;
// Connection Commands
static final int CONNECTION_RECV = 0x301;
static final int CONNECTION_QUEUE = 0x312;
/**
* sessionTag[1] + localAddr[4/16] + localPort[2] + remoteAddr[4/16] + remotePort[2] +<br>
* (Optional) sslSessionIDLen[1] + peerHostLen[1] + peerCertsLen[2] + localCertsLen[2] +<br>
* SSL-Session-ID[sslSessionIDLen] + SSL-Cipher[2] + SSL-Protocol[2] + Peer-Host[peerHostLen] +<br>
* Peer-Port[2] + Peer-Certificates[peerCertsLen] + Local-Certificates[localCertsLen]
*/
static final int CONNECTION_CONNECT = 0x315;
static final int CONNECTION_DISCONNECT = 0x318;
// Handler Commands
static final int HANDLER_SEND = 0x401;
/**
* numConns[2] + Conn-IDs[numConns * 2] + Data
*/
static final int HANDLER_MULTICAST = 0x402;
static final int HANDLER_BUFFER = 0x413;
static final int HANDLER_DISCONNECT = 0x418;
static final int HANDLER_CLOSE = 0x419;
// Session Bits
static final int SESSION_LOCAL_IPV6 = 1;
static final int SESSION_REMOTE_IPV6 = 2;
static final int SESSION_SSL = 4;
static final int HEAD_SIZE = 8;
static PacketParser PARSER = (b, off, len) -> {
if (len < HEAD_SIZE) {
return 0;
}
if (Bytes.toShort(b, off) != HEAD_TAG) {
throw new PacketException("Wrong Packet Head");
}
return HEAD_SIZE + (Bytes.toShort(b, off + 2) & 0xFFFF);
};
int size, cmd, cid;
MuxPacket(byte[] b, int off) {
size = Bytes.toShort(b, off + 2) & 0xFFFF;
cmd = Bytes.toShort(b, off + 4);
cid = Bytes.toShort(b, off + 6) & 0xFFFF;
}
static void send(ConnectionHandler handler, int cmd, int cid) {
byte[] head = new byte[8];
Bytes.setShort(HEAD_TAG, head, 0);
Bytes.setShort(0, head, 2);
Bytes.setShort(cmd, head, 4);
Bytes.setShort(cid, head, 6);
handler.send(head);
}
static void send(ConnectionHandler handler, byte[] b, int cmd, int cid) {
Bytes.setShort(HEAD_TAG, b, 0);
Bytes.setShort(b.length - HEAD_SIZE, b, 2);
Bytes.setShort(cmd, b, 4);
Bytes.setShort(cid, b, 6);
handler.send(b);
}
} | {
"content_hash": "88bb3eec70183be70bb2ef263bb7aee9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 100,
"avg_line_length": 31.71264367816092,
"alnum_prop": 0.6723450525552737,
"repo_name": "xqbase/tuna",
"id": "7724b8266eff9c13874a40f6c7d19dd7606da626",
"size": "2759",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mux/src/main/java/com/xqbase/tuna/mux/MuxPacket.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "3982"
},
{
"name": "Batchfile",
"bytes": "1903"
},
{
"name": "HTML",
"bytes": "3715"
},
{
"name": "Java",
"bytes": "281811"
},
{
"name": "Shell",
"bytes": "1812"
}
],
"symlink_target": ""
} |
FROM balenalib/nanopc-t4-fedora:35-build
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
RUN dnf install -y \
python3-pip \
python3-dbus \
&& dnf clean all
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install -U --no-cache-dir --ignore-installed pip setuptools \
&& pip3 install --no-cache-dir virtualenv
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/python-deprecation-warning
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Fedora 35 \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.6.15, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "5f08f869876a131d3c2412caeb66a0eb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 708,
"avg_line_length": 77.93548387096774,
"alnum_prop": 0.7334437086092715,
"repo_name": "resin-io-library/base-images",
"id": "ea38f9f85f7cd4c2b36dc157d5930c9123726bee",
"size": "2437",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/nanopc-t4/fedora/35/3.6.15/build/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/datacatalog/v1beta1/common.proto
package com.google.cloud.datacatalog.v1beta1;
public final class Common {
private Common() {}
public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {}
public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
}
public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
static {
java.lang.String[] descriptorData = {
"\n-google/cloud/datacatalog/v1beta1/commo"
+ "n.proto\022 google.cloud.datacatalog.v1beta"
+ "1*U\n\020IntegratedSystem\022!\n\035INTEGRATED_SYST"
+ "EM_UNSPECIFIED\020\000\022\014\n\010BIGQUERY\020\001\022\020\n\014CLOUD_"
+ "PUBSUB\020\002B\344\001\n$com.google.cloud.datacatalo"
+ "g.v1beta1P\001ZKgoogle.golang.org/genproto/"
+ "googleapis/cloud/datacatalog/v1beta1;dat"
+ "acatalog\370\001\001\252\002 Google.Cloud.DataCatalog.V"
+ "1Beta1\312\002 Google\\Cloud\\DataCatalog\\V1beta"
+ "1\352\002#Google::Cloud::DataCatalog::V1beta1b"
+ "\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {});
}
// @@protoc_insertion_point(outer_class_scope)
}
| {
"content_hash": "d28382566f192d2213ea0dc9363b4d19",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 97,
"avg_line_length": 39.26190476190476,
"alnum_prop": 0.7119466343238327,
"repo_name": "googleapis/java-datacatalog",
"id": "a13b18e78ef434cc0d9fa1359c8563a9a704a956",
"size": "2243",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "proto-google-cloud-datacatalog-v1beta1/src/main/java/com/google/cloud/datacatalog/v1beta1/Common.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Java",
"bytes": "10281928"
},
{
"name": "Python",
"bytes": "788"
},
{
"name": "Shell",
"bytes": "22865"
}
],
"symlink_target": ""
} |
"""Utility to compile possibly incomplete Python source code."""
import sys
import string
import traceback
def compile_command(source, filename="<input>", symbol="single"):
r"""Compile a command and determine whether it is incomplete.
Arguments:
source -- the source string; may contain \n characters
filename -- optional filename from which source was read; default "<input>"
symbol -- optional grammar start symbol; "single" (default) or "eval"
Return value / exceptions raised:
- Return a code object if the command is complete and valid
- Return None if the command is incomplete
- Raise SyntaxError or OverflowError if the command is a syntax error
(OverflowError if the error is in a numeric constant)
Approach:
First, check if the source consists entirely of blank lines and
comments; if so, replace it with 'pass', because the built-in
parser doesn't always do the right thing for these.
Compile three times: as is, with \n, and with \n\n appended. If
it compiles as is, it's complete. If it compiles with one \n
appended, we expect more. If it doesn't compile either way, we
compare the error we get when compiling with \n or \n\n appended.
If the errors are the same, the code is broken. But if the errors
are different, we expect more. Not intuitive; not even guaranteed
to hold in future releases; but this matches the compiler's
behavior from Python 1.4 through 1.5.2, at least.
Caveat:
It is possible (but not likely) that the parser stops parsing
with a successful outcome before reaching the end of the source;
in this case, trailing symbols may be ignored instead of causing an
error. For example, a backslash followed by two newlines may be
followed by arbitrary garbage. This will be fixed once the API
for the parser is better.
"""
# Check for source consisting of only blank lines and comments
for line in string.split(source, "\n"):
line = string.strip(line)
if line and line[0] != '#':
break # Leave it alone
else:
source = "pass" # Replace it with a 'pass' statement
err = err1 = err2 = None
code = code1 = code2 = None
try:
code = compile(source, filename, symbol)
except SyntaxError, err:
pass
try:
code1 = compile(source + "\n", filename, symbol)
except SyntaxError, err1:
pass
try:
code2 = compile(source + "\n\n", filename, symbol)
except SyntaxError, err2:
pass
if code:
return code
try:
e1 = err1.__dict__
except AttributeError:
e1 = err1
try:
e2 = err2.__dict__
except AttributeError:
e2 = err2
if not code1 and e1 == e2:
raise SyntaxError, err1
| {
"content_hash": "3f8c700a79ca70ba4e08276986a47e59",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 33.104651162790695,
"alnum_prop": 0.6578854935019318,
"repo_name": "MalloyPower/parsing-python",
"id": "080e00b87ebc1674c7df83e06a84370ac1026613",
"size": "2847",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "front-end/testsuite-python-lib/Python-2.0/Lib/codeop.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1963"
},
{
"name": "Lex",
"bytes": "238458"
},
{
"name": "Makefile",
"bytes": "4513"
},
{
"name": "OCaml",
"bytes": "412695"
},
{
"name": "Python",
"bytes": "17319"
},
{
"name": "Rascal",
"bytes": "523063"
},
{
"name": "Yacc",
"bytes": "429659"
}
],
"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_60) on Tue Aug 26 20:49:58 PDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.client.solrj.impl.CloudSolrServer.RouteException (Solr 4.10.0 API)</title>
<meta name="date" content="2014-08-26">
<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.apache.solr.client.solrj.impl.CloudSolrServer.RouteException (Solr 4.10.0 API)";
}
//-->
</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/apache/solr/client/solrj/impl/CloudSolrServer.RouteException.html" title="class in org.apache.solr.client.solrj.impl">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</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/apache/solr/client/solrj/impl/class-use/CloudSolrServer.RouteException.html" target="_top">Frames</a></li>
<li><a href="CloudSolrServer.RouteException.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.apache.solr.client.solrj.impl.CloudSolrServer.RouteException" class="title">Uses of Class<br>org.apache.solr.client.solrj.impl.CloudSolrServer.RouteException</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.client.solrj.impl.CloudSolrServer.RouteException</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/apache/solr/client/solrj/impl/CloudSolrServer.RouteException.html" title="class in org.apache.solr.client.solrj.impl">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</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/apache/solr/client/solrj/impl/class-use/CloudSolrServer.RouteException.html" target="_top">Frames</a></li>
<li><a href="CloudSolrServer.RouteException.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>
<i>Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
| {
"content_hash": "c1750844efcdcc053ebcc975eda84b64",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 191,
"avg_line_length": 39.2442748091603,
"alnum_prop": 0.6024119821046489,
"repo_name": "jamesvanmil/solr_config",
"id": "13ca55b9a5aaef780e132aeec99e08a14e2f3f2d",
"size": "5141",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/solr-solrj/org/apache/solr/client/solrj/impl/class-use/CloudSolrServer.RouteException.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "310805"
},
{
"name": "JavaScript",
"bytes": "1019096"
},
{
"name": "Shell",
"bytes": "70598"
},
{
"name": "XSLT",
"bytes": "124615"
}
],
"symlink_target": ""
} |
package org.dawnsci.prototype.e4.nano.handlers;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
public class QuitHandler {
@Execute
public void execute(IWorkbench workbench, Shell shell){
if (MessageDialog.openConfirm(shell, "Confirmation",
"Do you want to exit?")) {
workbench.close();
}
}
}
| {
"content_hash": "befdd71fc2a0ceef49bf050a3e2976e6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 56,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.7606263982102909,
"repo_name": "jacobfilik/nano-prototype",
"id": "7908bf74a4969225505268950c13f9fc8d06b838",
"size": "1042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "org.dawnsci.prototype.e4.nano/src/org/dawnsci/prototype/e4/nano/handlers/QuitHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "225362"
}
],
"symlink_target": ""
} |
<?php
/* @var $this HistoryContactController */
/* @var $model HistoryContact */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'history-contact-form',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// There is a call to performAjaxValidation() commented in generated controller code.
// See class documentation of CActiveForm for details on this.
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_id'); ?>
<?php echo $form->textField($model,'history_contact_id'); ?>
<?php echo $form->error($model,'history_contact_id'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'contact_id'); ?>
<?php echo $form->textField($model,'contact_id'); ?>
<?php echo $form->error($model,'contact_id'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_hoten'); ?>
<?php echo $form->textField($model,'history_contact_hoten',array('size'=>50,'maxlength'=>50)); ?>
<?php echo $form->error($model,'history_contact_hoten'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_phone'); ?>
<?php echo $form->textField($model,'history_contact_phone'); ?>
<?php echo $form->error($model,'history_contact_phone'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_birthday'); ?>
<?php echo $form->textField($model,'history_contact_birthday'); ?>
<?php echo $form->error($model,'history_contact_birthday'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_gender'); ?>
<?php echo $form->textField($model,'history_contact_gender'); ?>
<?php echo $form->error($model,'history_contact_gender'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_address'); ?>
<?php echo $form->textField($model,'history_contact_address',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'history_contact_address'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_email'); ?>
<?php echo $form->textField($model,'history_contact_email',array('size'=>60,'maxlength'=>100)); ?>
<?php echo $form->error($model,'history_contact_email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_company'); ?>
<?php echo $form->textField($model,'history_contact_company',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'history_contact_company'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_notes'); ?>
<?php echo $form->textField($model,'history_contact_notes',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'history_contact_notes'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'history_contact_status'); ?>
<?php echo $form->textField($model,'history_contact_status'); ?>
<?php echo $form->error($model,'history_contact_status'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form --> | {
"content_hash": "31a8f57dde6e1029009049df472b7457",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 102,
"avg_line_length": 36.329787234042556,
"alnum_prop": 0.6486090775988287,
"repo_name": "thongnv90/bluesms",
"id": "e1bbbec9ebe776ef27874c2a04fdff6a9ee574cc",
"size": "3415",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "protected/views/historyContact/_form.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "458"
},
{
"name": "Batchfile",
"bytes": "1715"
},
{
"name": "CSS",
"bytes": "260125"
},
{
"name": "HTML",
"bytes": "9957"
},
{
"name": "JavaScript",
"bytes": "2674295"
},
{
"name": "PHP",
"bytes": "20620730"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
World Register of Marine Species
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "c4dbe700342600b30850313e6eb01edc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 32,
"avg_line_length": 9.76923076923077,
"alnum_prop": 0.7007874015748031,
"repo_name": "mdoering/backbone",
"id": "583e3358e5a815b50d004e22e947f7b6c595bb56",
"size": "160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/incertae sedis/Picnostroma/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/**
*
*/
package org.openntf.domino.ext;
import org.openntf.domino.ViewEntry;
/**
* @author withersp
*
* OpenNTF extension to ViewNavigator
*/
public interface ViewNavigator {
public ViewEntry getNthDocument(final int nth);
}
| {
"content_hash": "c11c30a1749bfb61337e135c2fc22a6b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 15.375,
"alnum_prop": 0.6910569105691057,
"repo_name": "mariusj/org.openntf.domino",
"id": "93a174e210f696183ab517170beafa533bf3ab09",
"size": "865",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "domino/core/src/main/java/org/openntf/domino/ext/ViewNavigator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11139"
},
{
"name": "HTML",
"bytes": "2643162"
},
{
"name": "Java",
"bytes": "16665599"
},
{
"name": "Ragel",
"bytes": "2783"
},
{
"name": "Shell",
"bytes": "1792"
},
{
"name": "XPages",
"bytes": "20096"
},
{
"name": "XSLT",
"bytes": "4288"
}
],
"symlink_target": ""
} |
package org.optaplanner.benchmark.impl.ranking;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.optaplanner.benchmark.impl.report.BenchmarkReport;
import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
public class WorstScoreSolverRankingComparatorTest extends AbstractSolverRankingComparatorTest {
@Test
public void normal() {
BenchmarkReport benchmarkReport = mock(BenchmarkReport.class);
WorstScoreSolverRankingComparator comparator = new WorstScoreSolverRankingComparator();
SolverBenchmarkResult a = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> aSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmark(aSingleBenchmarkResultList, -100, -30, -2001);
addSingleBenchmark(aSingleBenchmarkResultList, -2001, -30, -2001);
addSingleBenchmark(aSingleBenchmarkResultList, -30, -30, -2001);
a.setSingleBenchmarkResultList(aSingleBenchmarkResultList);
a.accumulateResults(benchmarkReport);
SolverBenchmarkResult b = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> bSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmark(bSingleBenchmarkResultList, -900, -30, -2000);
addSingleBenchmark(bSingleBenchmarkResultList, -2000, -30, -2000);
addSingleBenchmark(bSingleBenchmarkResultList, -30, -30, -2000);
b.setSingleBenchmarkResultList(bSingleBenchmarkResultList);
b.accumulateResults(benchmarkReport);
assertEquals(-1, comparator.compare(a, b));
assertEquals(1, comparator.compare(b, a));
}
@Test
public void worstIsEqual() {
BenchmarkReport benchmarkReport = mock(BenchmarkReport.class);
WorstScoreSolverRankingComparator comparator = new WorstScoreSolverRankingComparator();
SolverBenchmarkResult a = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> aSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmark(aSingleBenchmarkResultList, -101, -30, -2000);
addSingleBenchmark(aSingleBenchmarkResultList, -2000, -30, -2000);
addSingleBenchmark(aSingleBenchmarkResultList, -30, -30, -2000);
a.setSingleBenchmarkResultList(aSingleBenchmarkResultList);
a.accumulateResults(benchmarkReport);
SolverBenchmarkResult b = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> bSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmark(bSingleBenchmarkResultList, -100, -40, -2000);
addSingleBenchmark(bSingleBenchmarkResultList, -2000, -40, -2000);
addSingleBenchmark(bSingleBenchmarkResultList, -40, -40, -2000);
b.setSingleBenchmarkResultList(bSingleBenchmarkResultList);
b.accumulateResults(benchmarkReport);
assertEquals(-1, comparator.compare(a, b));
assertEquals(1, comparator.compare(b, a));
}
@Test
public void differentScoreDefinitions() {
BenchmarkReport benchmarkReport = mock(BenchmarkReport.class);
WorstScoreSolverRankingComparator comparator = new WorstScoreSolverRankingComparator();
SolverBenchmarkResult a = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> aSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmark(aSingleBenchmarkResultList, -1000, -30, -1000);
addSingleBenchmark(aSingleBenchmarkResultList, -400, -30, -1000);
addSingleBenchmark(aSingleBenchmarkResultList, -30, -30, -1000);
a.setSingleBenchmarkResultList(aSingleBenchmarkResultList);
a.accumulateResults(benchmarkReport);
SolverBenchmarkResult b = new SolverBenchmarkResult(null);
List<SingleBenchmarkResult> bSingleBenchmarkResultList = new ArrayList<SingleBenchmarkResult>();
addSingleBenchmarkWithHardSoftLongScore(bSingleBenchmarkResultList, 0, -1000, 0, -50, -10, -1000);
addSingleBenchmarkWithHardSoftLongScore(bSingleBenchmarkResultList, 0, -200, 0, -50, -10, -1000);
addSingleBenchmarkWithHardSoftLongScore(bSingleBenchmarkResultList, -7, -50, 0, -50, -10, -1000);
b.setSingleBenchmarkResultList(bSingleBenchmarkResultList);
b.accumulateResults(benchmarkReport);
assertEquals(-1, comparator.compare(a, b));
assertEquals(1, comparator.compare(b, a));
}
}
| {
"content_hash": "3c06cd61bebf11be513db2fb4e1a3a18",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 106,
"avg_line_length": 54.86904761904762,
"alnum_prop": 0.7498372748969407,
"repo_name": "gurhann/AutoTimeTable",
"id": "8799f78c2609b45a36b396497a425f6cb09a8820",
"size": "5202",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "optaplanner-benchmark/src/test/java/org/optaplanner/benchmark/impl/ranking/WorstScoreSolverRankingComparatorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2559"
},
{
"name": "CSS",
"bytes": "3631"
},
{
"name": "FreeMarker",
"bytes": "64124"
},
{
"name": "Java",
"bytes": "3256819"
},
{
"name": "JavaScript",
"bytes": "126240"
},
{
"name": "Objective-C++",
"bytes": "7535732"
},
{
"name": "Shell",
"bytes": "1488"
}
],
"symlink_target": ""
} |
package netpol
import (
"context"
"encoding/json"
"fmt"
"net"
"regexp"
"strconv"
"strings"
"time"
"k8s.io/kubernetes/test/e2e/storage/utils"
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/kubernetes/test/e2e/framework"
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"k8s.io/kubernetes/test/e2e/network/common"
imageutils "k8s.io/kubernetes/test/utils/image"
netutils "k8s.io/utils/net"
)
/*
The following Network Policy tests verify that policy object definitions
are correctly enforced by a networking plugin. It accomplishes this by launching
a simple netcat server, and two clients with different
attributes. Each test case creates a network policy which should only allow
connections from one of the clients. The test then asserts that the clients
failed or successfully connected as expected.
*/
type protocolPort struct {
port int
protocol v1.Protocol
}
var _ = common.SIGDescribe("NetworkPolicyLegacy [LinuxOnly]", func() {
var service *v1.Service
var podServer *v1.Pod
var podServerLabelSelector string
f := framework.NewDefaultFramework("network-policy")
ginkgo.BeforeEach(func() {
// Windows does not support network policies.
e2eskipper.SkipIfNodeOSDistroIs("windows")
})
ginkgo.Context("NetworkPolicy between server and client", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("Creating a simple server that serves on port 80 and 81.")
podServer, service = createServerPodAndService(f, f.Namespace, "server", []protocolPort{{80, v1.ProtocolTCP}, {81, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podServer.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err)
})
// podServerLabelSelector holds the value for the podServer's label "pod-name".
podServerLabelSelector = podServer.ObjectMeta.Labels["pod-name"]
// Create pods, which should be able to communicate with the server on port 80 and 81.
ginkgo.By("Testing pods can connect to both ports when no policy is present.")
testCanConnect(f, f.Namespace, "client-can-connect-80", service, 80)
testCanConnect(f, f.Namespace, "client-can-connect-81", service, 81)
})
ginkgo.AfterEach(func() {
cleanupServerPodAndService(f, podServer, service)
})
ginkgo.It("should support a 'default-deny-ingress' policy [Feature:NetworkPolicy]", func() {
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "deny-ingress",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{},
Ingress: []networkingv1.NetworkPolicyIngressRule{},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
// Create a pod with name 'client-cannot-connect', which will attempt to communicate with the server,
// but should not be able to now that isolation is on.
testCannotConnect(f, f.Namespace, "client-cannot-connect", service, 80)
})
ginkgo.It("should support a 'default-deny-all' policy [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
ginkgo.By("Creating a simple server in another namespace that serves on port 80 and 81.")
podB, serviceB := createServerPodAndService(f, nsB, "pod-b", []protocolPort{{80, v1.ProtocolTCP}, {81, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podB.Name, nsB.Name, framework.PodStartTimeout)
framework.ExpectNoError(err)
})
ginkgo.By("Creating client-a, which should be able to contact the server in another namespace.", func() {
testCanConnect(f, nsA, "client-a", serviceB, 80)
})
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "default-deny-all",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress, networkingv1.PolicyTypeIngress},
Ingress: []networkingv1.NetworkPolicyIngressRule{},
Egress: []networkingv1.NetworkPolicyEgressRule{},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-to-a, which should not be able to contact the server in the same namespace, Ingress check.", func() {
testCannotConnect(f, nsA, "client-to-a", service, 80)
})
ginkgo.By("Creating client-to-b, which should not be able to contact the server in another namespace, Egress check.", func() {
testCannotConnect(f, nsA, "client-to-b", serviceB, 80)
})
})
ginkgo.It("should enforce policy to allow traffic from pods within server namespace based on PodSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
// All communication should be possible before applying the policy.
ginkgo.By("Creating client-a, in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsA, "client-a", service, 80)
})
ginkgo.By("Creating client-b, in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsA, "client-b", service, 80)
})
ginkgo.By("Creating client-a, not in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsB, "client-a", service, 80)
})
ginkgo.By("Creating a network policy for the server which allows traffic from the pod 'client-a' in same namespace.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-a-via-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only from client-a
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a, in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsA, "client-a", service, 80)
})
ginkgo.By("Creating client-b, in server's namespace, which should not be able to contact the server.", func() {
testCannotConnect(f, nsA, "client-b", service, 80)
})
ginkgo.By("Creating client-a, not in server's namespace, which should not be able to contact the server.", func() {
testCannotConnect(f, nsB, "client-a", service, 80)
})
})
ginkgo.It("should enforce policy to allow traffic only from a different namespace, based on NamespaceSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err)
// Create Server with Service in NS-B
framework.Logf("Waiting for server to come up.")
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, podServer)
framework.ExpectNoError(err)
// Create Policy for that service that allows traffic only via namespace B
ginkgo.By("Creating a network policy for the server which allows traffic from namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ns-b-via-namespace-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only from NS-B
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(nsA.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, nsA, "client-a", service, 80)
testCanConnect(f, nsB, "client-b", service, 80)
})
ginkgo.It("should enforce policy based on PodSelector with MatchExpressions[Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the server which allows traffic from the pod 'client-a'.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-a-via-pod-selector-with-match-expressions",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{{
Key: "pod-name",
Operator: metav1.LabelSelectorOpIn,
Values: []string{"client-a"},
}},
},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating client-b which should not be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-b", service, 80)
})
})
ginkgo.It("should enforce policy based on NamespaceSelector with MatchExpressions[Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsBName, err)
nsCName := f.BaseName + "-c"
nsC, err := f.CreateNamespace(nsCName, map[string]string{
"ns-name": nsCName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsCName, err)
// Create Policy for the server that allows traffic from namespace different than namespace-a
ginkgo.By("Creating a network policy for the server which allows traffic from ns different than namespace-a.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-any-ns-different-than-ns-a-via-ns-selector-with-match-expressions",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{{
Key: "ns-name",
Operator: metav1.LabelSelectorOpNotIn,
Values: []string{nsCName},
}},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(nsA.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, nsC, "client-a", service, 80)
testCanConnect(f, nsB, "client-a", service, 80)
})
ginkgo.It("should enforce policy based on PodSelector or NamespaceSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsBName, err)
// Create Policy for the server that allows traffic only via client B or namespace B
ginkgo.By("Creating a network policy for the server which allows traffic from client-b or namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ns-b-via-namespace-selector-or-client-b-via-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-b",
},
},
}, {
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(nsA.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCanConnect(f, nsB, "client-a", service, 80)
testCanConnect(f, nsA, "client-b", service, 80)
testCannotConnect(f, nsA, "client-c", service, 80)
})
ginkgo.It("should enforce policy based on PodSelector and NamespaceSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsBName, err)
// Create Policy for the server that allows traffic only via client-b in namespace B
ginkgo.By("Creating a network policy for the server which allows traffic from client-b in namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-b-in-ns-b-via-ns-selector-and-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-b",
},
},
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(nsA.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, nsB, "client-a", service, 80)
testCannotConnect(f, nsA, "client-b", service, 80)
testCanConnect(f, nsB, "client-b", service, 80)
})
ginkgo.It("should enforce policy to allow traffic only from a pod in a different namespace based on PodSelector and NamespaceSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
// Wait for Server in namespaces-a to be ready
framework.Logf("Waiting for server to come up.")
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, podServer)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Running.")
// Before application of the policy, all communication should be successful.
ginkgo.By("Creating client-a, in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsA, "client-a", service, 80)
})
ginkgo.By("Creating client-b, in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsA, "client-b", service, 80)
})
ginkgo.By("Creating client-a, not in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsB, "client-a", service, 80)
})
ginkgo.By("Creating client-b, not in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsB, "client-b", service, 80)
})
ginkgo.By("Creating a network policy for the server which allows traffic only from client-a in namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: nsA.Name,
Name: "allow-ns-b-client-a-via-namespace-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only from client-a in namespace-b
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policy.")
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a, in server's namespace, which should not be able to contact the server.", func() {
testCannotConnect(f, nsA, "client-a", service, 80)
})
ginkgo.By("Creating client-b, in server's namespace, which should not be able to contact the server.", func() {
testCannotConnect(f, nsA, "client-b", service, 80)
})
ginkgo.By("Creating client-a, not in server's namespace, which should be able to contact the server.", func() {
testCanConnect(f, nsB, "client-a", service, 80)
})
ginkgo.By("Creating client-b, not in server's namespace, which should not be able to contact the server.", func() {
testCannotConnect(f, nsB, "client-b", service, 80)
})
})
ginkgo.It("should enforce policy based on Ports [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the Service which allows traffic only to one port.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress-on-port-81",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: 81},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Testing pods can connect only to the port allowed by the policy.")
testCannotConnect(f, f.Namespace, "client-a", service, 80)
testCanConnect(f, f.Namespace, "client-b", service, 81)
})
ginkgo.It("should enforce multiple, stacked policies with overlapping podSelectors [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the Service which allows traffic only to one port.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress-on-port-80",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: 80},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating a network policy for the Service which allows traffic only to another port.")
policy2 := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress-on-port-81",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: 81},
}},
}},
},
}
policy2, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy2, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy2)
ginkgo.By("Testing pods can connect to both ports when both policies are present.")
testCanConnect(f, f.Namespace, "client-a", service, 80)
testCanConnect(f, f.Namespace, "client-b", service, 81)
})
ginkgo.It("should support allow-all policy [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy which allows all traffic.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-all",
},
Spec: networkingv1.NetworkPolicySpec{
// Allow all traffic
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Testing pods can connect to both ports when an 'allow-all' policy is present.")
testCanConnect(f, f.Namespace, "client-a", service, 80)
testCanConnect(f, f.Namespace, "client-b", service, 81)
})
ginkgo.It("should allow ingress access on one named port [Feature:NetworkPolicy]", func() {
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-a-via-named-port-ingress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic to only one named port: "serve-80".
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{Type: intstr.String, StrVal: "serve-80"},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating client-b which should not be able to contact the server on port 81.", func() {
testCannotConnect(f, f.Namespace, "client-b", service, 81)
})
})
ginkgo.It("should allow ingress access from namespace on one named port [Feature:NetworkPolicy]", func() {
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsBName, err)
const allowedPort = 80
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-in-ns-b-via-named-port-ingress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic to only one named port: "serve-80" from namespace-b.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
}},
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{Type: intstr.String, StrVal: "serve-80"},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, f.Namespace, "client-a", service, allowedPort)
testCanConnect(f, nsB, "client-b", service, allowedPort)
})
ginkgo.It("should allow egress access on one named port [Feature:NetworkPolicy]", func() {
clientPodName := "client-a"
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-client-a-via-named-port-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to client-a
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": clientPodName,
},
},
// Allow traffic to only one named port: "serve-80".
Egress: []networkingv1.NetworkPolicyEgressRule{{
Ports: []networkingv1.NetworkPolicyPort{
{
Port: &intstr.IntOrString{Type: intstr.String, StrVal: "serve-80"},
},
},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, clientPodName, service, 80)
})
ginkgo.By("Creating client-a which should not be able to contact the server on port 81.", func() {
testCannotConnect(f, f.Namespace, clientPodName, service, 81)
})
})
ginkgo.It("should enforce updated policy [Feature:NetworkPolicy]", func() {
const (
clientAAllowedPort = 80
clientANotAllowedPort = 81
)
ginkgo.By("Creating a network policy for the Service which allows traffic from pod at a port")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: clientAAllowedPort},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
testCanConnect(f, f.Namespace, "client-a", service, clientAAllowedPort)
e2epod.WaitForPodNotFoundInNamespace(f.ClientSet, "client-a", f.Namespace.Name, framework.PodDeleteTimeout)
framework.ExpectNoError(err, "Expected pod to be not found.")
testCannotConnect(f, f.Namespace, "client-b", service, clientAAllowedPort)
e2epod.WaitForPodNotFoundInNamespace(f.ClientSet, "client-b", f.Namespace.Name, framework.PodDeleteTimeout)
framework.ExpectNoError(err, "Expected pod to be not found.")
testCannotConnect(f, f.Namespace, "client-a", service, clientANotAllowedPort)
e2epod.WaitForPodNotFoundInNamespace(f.ClientSet, "client-a", f.Namespace.Name, framework.PodDeleteTimeout)
framework.ExpectNoError(err, "Expected pod to be not found.")
const (
clientBAllowedPort = 81
clientBNotAllowedPort = 80
)
ginkgo.By("Updating a network policy for the Service which allows traffic from another pod at another port.")
policy = &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-b",
},
},
}},
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: clientBAllowedPort},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Update(context.TODO(), policy, metav1.UpdateOptions{})
framework.ExpectNoError(err, "Error updating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, f.Namespace, "client-b", service, clientBNotAllowedPort)
e2epod.WaitForPodNotFoundInNamespace(f.ClientSet, "client-b", f.Namespace.Name, framework.PodDeleteTimeout)
framework.ExpectNoError(err, "Expected pod to be not found.")
testCannotConnect(f, f.Namespace, "client-a", service, clientBNotAllowedPort)
testCanConnect(f, f.Namespace, "client-b", service, clientBAllowedPort)
})
ginkgo.It("should allow ingress access from updated namespace [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
newNsBName := nsBName + "-updated"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error creating namespace %v: %v", nsBName, err)
const allowedPort = 80
// Create Policy for that service that allows traffic only via namespace B
ginkgo.By("Creating a network policy for the server which allows traffic from namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ns-b-via-namespace-selector",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": newNsBName,
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(nsA.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
testCannotConnect(f, nsB, "client-a", service, allowedPort)
nsB, err = f.ClientSet.CoreV1().Namespaces().Get(context.TODO(), nsB.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "Error getting Namespace %v: %v", nsB.ObjectMeta.Name, err)
nsB.ObjectMeta.Labels["ns-name"] = newNsBName
nsB, err = f.ClientSet.CoreV1().Namespaces().Update(context.TODO(), nsB, metav1.UpdateOptions{})
framework.ExpectNoError(err, "Error updating Namespace %v: %v", nsB.ObjectMeta.Name, err)
testCanConnect(f, nsB, "client-b", service, allowedPort)
})
ginkgo.It("should allow ingress access from updated pod [Feature:NetworkPolicy]", func() {
const allowedPort = 80
ginkgo.By("Creating a network policy for the server which allows traffic from client-a-updated.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-pod-b-via-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{{
Key: "pod-name",
Operator: metav1.LabelSelectorOpDoesNotExist,
}},
},
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By(fmt.Sprintf("Creating client pod %s that should not be able to connect to %s.", "client-a", service.Name))
// Specify RestartPolicy to OnFailure so we can check the client pod fails in the beginning and succeeds
// after updating its label, otherwise it would not restart after the first failure.
podClient := createNetworkClientPodWithRestartPolicy(f, f.Namespace, "client-a", service, allowedPort, v1.ProtocolTCP, v1.RestartPolicyOnFailure)
defer func() {
ginkgo.By(fmt.Sprintf("Cleaning up the pod %s", podClient.Name))
if err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), podClient.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup pod %v: %v", podClient.Name, err)
}
}()
// Check Container exit code as restartable Pod's Phase will be Running even when container fails.
checkNoConnectivityByExitCode(f, f.Namespace, podClient, service)
ginkgo.By(fmt.Sprintf("Updating client pod %s that should successfully connect to %s.", podClient.Name, service.Name))
podClient = updatePodLabel(f, f.Namespace, podClient.Name, "replace", "/metadata/labels", map[string]string{})
checkConnectivity(f, f.Namespace, podClient, service)
})
ginkgo.It("should deny ingress access to updated pod [Feature:NetworkPolicy]", func() {
const allowedPort = 80
ginkgo.By("Creating a network policy for the server which denies all traffic.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "deny-ingress-via-isolated-label-selector",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
MatchExpressions: []metav1.LabelSelectorRequirement{{
Key: "isolated",
Operator: metav1.LabelSelectorOpExists,
}},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
Ingress: []networkingv1.NetworkPolicyIngressRule{},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
// Client can connect to service when the network policy doesn't apply to the server pod.
testCanConnect(f, f.Namespace, "client-a", service, allowedPort)
// Client cannot connect to service after updating the server pod's labels to match the network policy's selector.
ginkgo.By(fmt.Sprintf("Updating server pod %s to be selected by network policy %s.", podServer.Name, policy.Name))
updatePodLabel(f, f.Namespace, podServer.Name, "add", "/metadata/labels/isolated", nil)
testCannotConnect(f, f.Namespace, "client-a", service, allowedPort)
})
ginkgo.It("should work with Ingress,Egress specified together [Feature:NetworkPolicy]", func() {
const allowedPort = 80
const notAllowedPort = 81
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
podB, serviceB := createServerPodAndService(f, nsB, "pod-b", []protocolPort{{allowedPort, v1.ProtocolTCP}, {notAllowedPort, v1.ProtocolTCP}})
defer cleanupServerPodAndService(f, podB, serviceB)
// Wait for Server with Service in NS-B to be ready
framework.Logf("Waiting for servers to be ready.")
err = e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podB.Name, nsB.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Ready.")
ginkgo.By("Create a network policy for the server which denies both Ingress and Egress traffic.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "ingress-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkingv1.PolicyTypeEgress},
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
}},
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: allowedPort},
}},
}},
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
},
},
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: allowedPort},
}},
},
},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error creating Network Policy %v: %v", policy.ObjectMeta.Name, err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("client-a should be able to communicate with server port 80 in namespace-b", func() {
testCanConnect(f, f.Namespace, "client-a", serviceB, allowedPort)
})
ginkgo.By("client-b should be able to communicate with server port 80 in namespace-a", func() {
testCanConnect(f, nsB, "client-b", service, allowedPort)
})
ginkgo.By("client-a should not be able to communicate with server port 81 in namespace-b", func() {
testCannotConnect(f, f.Namespace, "client-a", serviceB, notAllowedPort)
})
ginkgo.By("client-b should not be able to communicate with server port 81 in namespace-a", func() {
testCannotConnect(f, nsB, "client-b", service, notAllowedPort)
})
})
ginkgo.It("should enforce egress policy allowing traffic to a server in a different namespace based on PodSelector and NamespaceSelector [Feature:NetworkPolicy]", func() {
var nsBserviceA, nsBserviceB *v1.Service
var nsBpodServerA, nsBpodServerB *v1.Pod
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
// Creating pods and services in namespace-b
nsBpodServerA, nsBserviceA = createServerPodAndService(f, nsB, "ns-b-server-a", []protocolPort{{80, v1.ProtocolTCP}})
defer cleanupServerPodAndService(f, nsBpodServerA, nsBserviceA)
nsBpodServerB, nsBserviceB = createServerPodAndService(f, nsB, "ns-b-server-b", []protocolPort{{80, v1.ProtocolTCP}})
defer cleanupServerPodAndService(f, nsBpodServerB, nsBserviceB)
// Wait for Server with Service in NS-A to be ready
framework.Logf("Waiting for servers to be ready.")
err = e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podServer.Name, podServer.Namespace, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Ready.")
// Wait for Servers with Services in NS-B to be ready
err = e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, nsBpodServerA.Name, nsBpodServerA.Namespace, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Ready.")
err = e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, nsBpodServerB.Name, nsBpodServerB.Namespace, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Ready.")
ginkgo.By("Creating a network policy for the server which allows traffic only to a server in different namespace.")
policyAllowToServerInNSB := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: nsA.Name,
Name: "allow-to-ns-b-server-a-via-namespace-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the client
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic only to server-a in namespace-b
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": nsBpodServerA.ObjectMeta.Labels["pod-name"],
},
},
},
},
},
},
},
}
policyAllowToServerInNSB, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowToServerInNSB, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowToServerInNSB.")
defer cleanupNetworkPolicy(f, policyAllowToServerInNSB)
ginkgo.By("Creating client-a, in 'namespace-a', which should be able to contact the server-a in namespace-b.", func() {
testCanConnect(f, nsA, "client-a", nsBserviceA, 80)
})
ginkgo.By("Creating client-a, in 'namespace-a', which should not be able to contact the server-b in namespace-b.", func() {
testCannotConnect(f, nsA, "client-a", nsBserviceB, 80)
})
ginkgo.By("Creating client-a, in 'namespace-a', which should not be able to contact the server in namespace-a.", func() {
testCannotConnect(f, nsA, "client-a", service, 80)
})
})
ginkgo.It("should enforce multiple ingress policies with ingress allow-all policy taking precedence [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the server which allows traffic only from client-b.")
policyAllowOnlyFromClientB := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-from-client-b-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
// Allow traffic only from "client-b"
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-b",
},
},
}},
}},
},
}
policyAllowOnlyFromClientB, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowOnlyFromClientB, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowOnlyFromClientB.")
defer cleanupNetworkPolicy(f, policyAllowOnlyFromClientB)
ginkgo.By("Creating client-a which should not be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating client-b which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-b", service, 80)
})
ginkgo.By("Creating a network policy for the server which allows traffic from all clients.")
policyIngressAllowAll := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
// Namespace: f.Namespace.Name,
Name: "allow-all",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to all pods
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
Ingress: []networkingv1.NetworkPolicyIngressRule{{}},
},
}
policyIngressAllowAll, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyIngressAllowAll, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyIngressAllowAll.")
defer cleanupNetworkPolicy(f, policyIngressAllowAll)
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating client-b which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-b", service, 80)
})
})
ginkgo.It("should enforce multiple egress policies with egress allow-all policy taking precedence [Feature:NetworkPolicy]", func() {
podServerB, serviceB := createServerPodAndService(f, f.Namespace, "server-b", []protocolPort{{80, v1.ProtocolTCP}})
defer cleanupServerPodAndService(f, podServerB, serviceB)
ginkgo.By("Waiting for pod ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podServerB.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod type: Ready.")
})
ginkgo.By("Creating client-a which should be able to contact the server before applying policy.", func() {
testCanConnect(f, f.Namespace, "client-a", serviceB, 80)
})
ginkgo.By("Creating a network policy for the server which allows traffic only to server-a.")
policyAllowOnlyToServerA := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-to-server-a-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the "client-a"
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic only to "server-a"
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
},
},
},
},
},
}
policyAllowOnlyToServerA, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowOnlyToServerA, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowOnlyToServerA.")
defer cleanupNetworkPolicy(f, policyAllowOnlyToServerA)
ginkgo.By("Creating client-a which should not be able to contact the server-b.", func() {
testCannotConnect(f, f.Namespace, "client-a", serviceB, 80)
})
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating a network policy which allows traffic to all pods.")
policyEgressAllowAll := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-all",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to all pods
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
Egress: []networkingv1.NetworkPolicyEgressRule{{}},
},
}
policyEgressAllowAll, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyEgressAllowAll, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyEgressAllowAll.")
defer cleanupNetworkPolicy(f, policyEgressAllowAll)
ginkgo.By("Creating client-a which should be able to contact the server-b.", func() {
testCanConnect(f, f.Namespace, "client-a", serviceB, 80)
})
ginkgo.By("Creating client-a which should be able to contact the server-a.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
})
ginkgo.It("should stop enforcing policies after they are deleted [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the server which denies all traffic.")
policyDenyAll := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "deny-all",
},
Spec: networkingv1.NetworkPolicySpec{
// Deny all traffic
PodSelector: metav1.LabelSelector{},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
Ingress: []networkingv1.NetworkPolicyIngressRule{},
},
}
policyDenyAll, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyDenyAll, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyDenyAll.")
ginkgo.By("Creating client-a which should not be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Creating a network policy for the server which allows traffic only from client-a.")
policyAllowFromClientA := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-from-client-a-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
// Allow traffic from "client-a"
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
}},
},
}
policyAllowFromClientA, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowFromClientA, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowFromClientA.")
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Deleting the network policy allowing traffic from client-a")
cleanupNetworkPolicy(f, policyAllowFromClientA)
ginkgo.By("Creating client-a which should not be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Deleting the network policy denying all traffic.")
cleanupNetworkPolicy(f, policyDenyAll)
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
})
ginkgo.It("should allow egress access to server in CIDR block [Feature:NetworkPolicy]", func() {
var serviceB *v1.Service
var podServerB *v1.Pod
// Getting podServer's status to get podServer's IP, to create the CIDR
podServerStatus, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), podServer.Name, metav1.GetOptions{})
if err != nil {
framework.ExpectNoError(err, "Error occurred while getting pod status.")
}
hostMask := 32
if netutils.IsIPv6String(podServerStatus.Status.PodIP) {
hostMask = 128
}
podServerCIDR := fmt.Sprintf("%s/%d", podServerStatus.Status.PodIP, hostMask)
// Creating pod-b and service-b
podServerB, serviceB = createServerPodAndService(f, f.Namespace, "pod-b", []protocolPort{{80, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod-b to be ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podServerB.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod type: Ready.")
})
defer cleanupServerPodAndService(f, podServerB, serviceB)
// Wait for podServerB with serviceB to be ready
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, podServerB)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Running.")
ginkgo.By("Creating client-a which should be able to contact the server-b.", func() {
testCanConnect(f, f.Namespace, "client-a", serviceB, 80)
})
policyAllowCIDR := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-client-a-via-cidr-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic to only one CIDR block.
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: podServerCIDR,
},
},
},
},
},
},
}
policyAllowCIDR, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowCIDR, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowCIDR.")
defer cleanupNetworkPolicy(f, policyAllowCIDR)
ginkgo.By("Creating client-a which should not be able to contact the server-b.", func() {
testCannotConnect(f, f.Namespace, "client-a", serviceB, 80)
})
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
})
ginkgo.It("should enforce except clause while egress access to server in CIDR block [Feature:NetworkPolicy]", func() {
// Getting podServer's status to get podServer's IP, to create the CIDR with except clause
podServerStatus, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), podServer.Name, metav1.GetOptions{})
if err != nil {
framework.ExpectNoError(err, "Error occurred while getting pod status.")
}
allowMask := 24
hostMask := 32
if netutils.IsIPv6String(podServerStatus.Status.PodIP) {
allowMask = 64
hostMask = 128
}
_, podServerAllowSubnet, err := netutils.ParseCIDRSloppy(fmt.Sprintf("%s/%d", podServerStatus.Status.PodIP, allowMask))
framework.ExpectNoError(err, "could not parse allow subnet")
podServerAllowCIDR := podServerAllowSubnet.String()
// Exclude podServer's IP with an Except clause
podServerExceptList := []string{fmt.Sprintf("%s/%d", podServerStatus.Status.PodIP, hostMask)}
// client-a can connect to server prior to applying the NetworkPolicy
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
policyAllowCIDRWithExcept := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "deny-client-a-via-except-cidr-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the client.
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic to only one CIDR block except subnet which includes Server.
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: podServerAllowCIDR,
Except: podServerExceptList,
},
},
},
},
},
},
}
policyAllowCIDRWithExcept, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowCIDRWithExcept, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowCIDRWithExcept.")
defer cleanupNetworkPolicy(f, policyAllowCIDRWithExcept)
ginkgo.By("Creating client-a which should no longer be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-a", service, 80)
})
})
ginkgo.It("should ensure an IP overlapping both IPBlock.CIDR and IPBlock.Except is allowed [Feature:NetworkPolicy]", func() {
// Getting podServer's status to get podServer's IP, to create the CIDR with except clause
podServerStatus, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), podServer.Name, metav1.GetOptions{})
if err != nil {
framework.ExpectNoError(err, "Error occurred while getting pod status.")
}
allowMask := 24
hostMask := 32
if netutils.IsIPv6String(podServerStatus.Status.PodIP) {
allowMask = 64
hostMask = 128
}
_, podServerAllowSubnet, err := netutils.ParseCIDRSloppy(fmt.Sprintf("%s/%d", podServerStatus.Status.PodIP, allowMask))
framework.ExpectNoError(err, "could not parse allow subnet")
podServerAllowCIDR := podServerAllowSubnet.String()
// Exclude podServer's IP with an Except clause
podServerCIDR := fmt.Sprintf("%s/%d", podServerStatus.Status.PodIP, hostMask)
podServerExceptList := []string{podServerCIDR}
// Create NetworkPolicy which blocks access to podServer with except clause.
policyAllowCIDRWithExceptServerPod := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "deny-client-a-via-except-cidr-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the client.
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic to only one CIDR block except subnet which includes Server.
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: podServerAllowCIDR,
Except: podServerExceptList,
},
},
},
},
},
},
}
policyAllowCIDRWithExceptServerPodObj, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowCIDRWithExceptServerPod, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowCIDRWithExceptServerPod.")
ginkgo.By("Creating client-a which should not be able to contact the server.", func() {
testCannotConnect(f, f.Namespace, "client-a", service, 80)
})
// Create NetworkPolicy which allows access to the podServer using podServer's IP in allow CIDR.
policyAllowCIDRServerPod := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-client-a-via-cidr-egress-rule",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the client.
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic to only one CIDR block which includes Server.
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
IPBlock: &networkingv1.IPBlock{
CIDR: podServerCIDR,
},
},
},
},
},
},
}
policyAllowCIDRServerPod, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowCIDRServerPod, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowCIDRServerPod.")
defer cleanupNetworkPolicy(f, policyAllowCIDRServerPod)
ginkgo.By("Creating client-a which should now be able to contact the server.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
ginkgo.By("Deleting the network policy with except podServer IP which disallows access to podServer.")
cleanupNetworkPolicy(f, policyAllowCIDRWithExceptServerPodObj)
ginkgo.By("Creating client-a which should still be able to contact the server after deleting the network policy with except clause.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
// Recreate the NetworkPolicy which contains the podServer's IP in the except list.
policyAllowCIDRWithExceptServerPod, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowCIDRWithExceptServerPod, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowCIDRWithExceptServerPod.")
defer cleanupNetworkPolicy(f, policyAllowCIDRWithExceptServerPod)
ginkgo.By("Creating client-a which should still be able to contact the server after recreating the network policy with except clause.", func() {
testCanConnect(f, f.Namespace, "client-a", service, 80)
})
})
ginkgo.It("should enforce policies to check ingress and egress policies can be controlled independently based on PodSelector [Feature:NetworkPolicy]", func() {
var serviceA, serviceB *v1.Service
var podA, podB *v1.Pod
var err error
// Before applying policy, communication should be successful between pod-a and pod-b
podA, serviceA = createServerPodAndService(f, f.Namespace, "pod-a", []protocolPort{{80, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod-a to be ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podA.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod type: Ready.")
})
ginkgo.By("Creating client pod-b which should be able to contact the server pod-a.", func() {
testCanConnect(f, f.Namespace, "pod-b", serviceA, 80)
})
cleanupServerPodAndService(f, podA, serviceA)
podB, serviceB = createServerPodAndService(f, f.Namespace, "pod-b", []protocolPort{{80, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod-b to be ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podB.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod type: Ready.")
})
ginkgo.By("Creating client pod-a which should be able to contact the server pod-b.", func() {
testCanConnect(f, f.Namespace, "pod-a", serviceB, 80)
})
ginkgo.By("Creating a network policy for pod-a which allows Egress traffic to pod-b.")
policyAllowToPodB := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "allow-pod-a-to-pod-b-using-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy on pod-a
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "pod-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeEgress},
// Allow traffic to server on pod-b
Egress: []networkingv1.NetworkPolicyEgressRule{
{
To: []networkingv1.NetworkPolicyPeer{
{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "pod-b",
},
},
},
},
},
},
},
}
policyAllowToPodB, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyAllowToPodB, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyAllowToPodB.")
defer cleanupNetworkPolicy(f, policyAllowToPodB)
ginkgo.By("Creating a network policy for pod-a that denies traffic from pod-b.")
policyDenyFromPodB := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: f.Namespace.Name,
Name: "deny-pod-b-to-pod-a-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy on the server on pod-a
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "pod-a",
},
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress},
// Deny traffic from all pods, including pod-b
Ingress: []networkingv1.NetworkPolicyIngressRule{},
},
}
policyDenyFromPodB, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policyDenyFromPodB, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policyDenyFromPodB.")
defer cleanupNetworkPolicy(f, policyDenyFromPodB)
ginkgo.By("Creating client pod-a which should be able to contact the server pod-b.", func() {
testCanConnect(f, f.Namespace, "pod-a", serviceB, 80)
})
cleanupServerPodAndService(f, podB, serviceB)
// Creating server pod with label "pod-name": "pod-a" to deny traffic from client pod with label "pod-name": "pod-b"
podA, serviceA = createServerPodAndService(f, f.Namespace, "pod-a", []protocolPort{{80, v1.ProtocolTCP}})
ginkgo.By("Waiting for pod-a to be ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podA.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err, "Error occurred while waiting for pod type: Ready.")
})
ginkgo.By("Creating client pod-b which should be able to contact the server pod-a.", func() {
testCannotConnect(f, f.Namespace, "pod-b", serviceA, 80)
})
cleanupServerPodAndService(f, podA, serviceA)
})
ginkgo.It("should not allow access by TCP when a policy specifies only SCTP [Feature:NetworkPolicy]", func() {
ginkgo.By("getting the state of the sctp module on nodes")
nodes, err := e2enode.GetReadySchedulableNodes(f.ClientSet)
framework.ExpectNoError(err)
sctpLoadedAtStart := CheckSCTPModuleLoadedOnNodes(f, nodes)
ginkgo.By("Creating a network policy for the server which allows traffic only via SCTP on port 80.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-only-sctp-ingress-on-port-80",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only via SCTP on port 80 .
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: 80},
Protocol: &protocolSCTP,
}},
}},
},
}
appliedPolicy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, appliedPolicy)
ginkgo.By("Testing pods cannot connect on port 80 anymore when not using SCTP as protocol.")
testCannotConnect(f, f.Namespace, "client-a", service, 80)
ginkgo.By("validating sctp module is still not loaded")
sctpLoadedAtEnd := CheckSCTPModuleLoadedOnNodes(f, nodes)
if !sctpLoadedAtStart && sctpLoadedAtEnd {
framework.Failf("The state of the sctp module has changed due to the test case")
}
})
})
})
var _ = common.SIGDescribe("NetworkPolicy [Feature:SCTPConnectivity][LinuxOnly][Disruptive]", func() {
var service *v1.Service
var podServer *v1.Pod
var podServerLabelSelector string
f := framework.NewDefaultFramework("sctp-network-policy")
ginkgo.BeforeEach(func() {
// Windows does not support network policies.
e2eskipper.SkipIfNodeOSDistroIs("windows")
})
ginkgo.Context("NetworkPolicy between server and client using SCTP", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("Creating a simple server that serves on port 80 and 81.")
podServer, service = createServerPodAndService(f, f.Namespace, "server", []protocolPort{{80, v1.ProtocolSCTP}, {81, v1.ProtocolSCTP}})
ginkgo.By("Waiting for pod ready", func() {
err := e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, podServer.Name, f.Namespace.Name, framework.PodStartTimeout)
framework.ExpectNoError(err)
})
// podServerLabelSelector holds the value for the podServer's label "pod-name".
podServerLabelSelector = podServer.ObjectMeta.Labels["pod-name"]
// Create pods, which should be able to communicate with the server on port 80 and 81.
ginkgo.By("Testing pods can connect to both ports when no policy is present.")
testCanConnectProtocol(f, f.Namespace, "client-can-connect-80", service, 80, v1.ProtocolSCTP)
testCanConnectProtocol(f, f.Namespace, "client-can-connect-81", service, 81, v1.ProtocolSCTP)
})
ginkgo.AfterEach(func() {
cleanupServerPodAndService(f, podServer, service)
})
ginkgo.It("should support a 'default-deny' policy [Feature:NetworkPolicy]", func() {
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "deny-all",
},
Spec: networkingv1.NetworkPolicySpec{
PodSelector: metav1.LabelSelector{},
Ingress: []networkingv1.NetworkPolicyIngressRule{},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
// Create a pod with name 'client-cannot-connect', which will attempt to communicate with the server,
// but should not be able to now that isolation is on.
testCannotConnect(f, f.Namespace, "client-cannot-connect", service, 80)
})
ginkgo.It("should enforce policy based on Ports [Feature:NetworkPolicy]", func() {
ginkgo.By("Creating a network policy for the Service which allows traffic only to one port.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: "allow-ingress-on-port-81",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply to server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only to one port.
Ingress: []networkingv1.NetworkPolicyIngressRule{{
Ports: []networkingv1.NetworkPolicyPort{{
Port: &intstr.IntOrString{IntVal: 81},
Protocol: &protocolSCTP,
}},
}},
},
}
policy, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Testing pods can connect only to the port allowed by the policy.")
testCannotConnectProtocol(f, f.Namespace, "client-a", service, 80, v1.ProtocolSCTP)
testCanConnectProtocol(f, f.Namespace, "client-b", service, 81, v1.ProtocolSCTP)
})
ginkgo.It("should enforce policy to allow traffic only from a pod in a different namespace based on PodSelector and NamespaceSelector [Feature:NetworkPolicy]", func() {
nsA := f.Namespace
nsBName := f.BaseName + "-b"
nsB, err := f.CreateNamespace(nsBName, map[string]string{
"ns-name": nsBName,
})
framework.ExpectNoError(err, "Error occurred while creating namespace-b.")
// Wait for Server in namespaces-a to be ready
framework.Logf("Waiting for server to come up.")
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, podServer)
framework.ExpectNoError(err, "Error occurred while waiting for pod status in namespace: Running.")
// Before application of the policy, all communication should be successful.
ginkgo.By("Creating client-a, in server's namespace, which should be able to contact the server.", func() {
testCanConnectProtocol(f, nsA, "client-a", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-b, in server's namespace, which should be able to contact the server.", func() {
testCanConnectProtocol(f, nsA, "client-b", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-a, not in server's namespace, which should be able to contact the server.", func() {
testCanConnectProtocol(f, nsB, "client-a", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-b, not in server's namespace, which should be able to contact the server.", func() {
testCanConnectProtocol(f, nsB, "client-b", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating a network policy for the server which allows traffic only from client-a in namespace-b.")
policy := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Namespace: nsA.Name,
Name: "allow-ns-b-client-a-via-namespace-pod-selector",
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": podServerLabelSelector,
},
},
// Allow traffic only from client-a in namespace-b
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": nsBName,
},
},
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
}},
},
}
policy, err = f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).Create(context.TODO(), policy, metav1.CreateOptions{})
framework.ExpectNoError(err, "Error occurred while creating policy: policy.")
defer cleanupNetworkPolicy(f, policy)
ginkgo.By("Creating client-a, in server's namespace, which should not be able to contact the server.", func() {
testCannotConnectProtocol(f, nsA, "client-a", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-b, in server's namespace, which should not be able to contact the server.", func() {
testCannotConnectProtocol(f, nsA, "client-b", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-a, not in server's namespace, which should be able to contact the server.", func() {
testCanConnectProtocol(f, nsB, "client-a", service, 80, v1.ProtocolSCTP)
})
ginkgo.By("Creating client-b, not in server's namespace, which should not be able to contact the server.", func() {
testCannotConnectProtocol(f, nsB, "client-b", service, 80, v1.ProtocolSCTP)
})
})
})
})
func testCanConnect(f *framework.Framework, ns *v1.Namespace, podName string, service *v1.Service, targetPort int) {
testCanConnectProtocol(f, ns, podName, service, targetPort, v1.ProtocolTCP)
}
func testCannotConnect(f *framework.Framework, ns *v1.Namespace, podName string, service *v1.Service, targetPort int) {
testCannotConnectProtocol(f, ns, podName, service, targetPort, v1.ProtocolTCP)
}
func testCanConnectProtocol(f *framework.Framework, ns *v1.Namespace, podName string, service *v1.Service, targetPort int, protocol v1.Protocol) {
ginkgo.By(fmt.Sprintf("Creating client pod %s that should successfully connect to %s.", podName, service.Name))
podClient := createNetworkClientPod(f, ns, podName, service, targetPort, protocol)
defer func() {
ginkgo.By(fmt.Sprintf("Cleaning up the pod %s", podClient.Name))
if err := f.ClientSet.CoreV1().Pods(ns.Name).Delete(context.TODO(), podClient.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup pod %v: %v", podClient.Name, err)
}
}()
checkConnectivity(f, ns, podClient, service)
}
func testCannotConnectProtocol(f *framework.Framework, ns *v1.Namespace, podName string, service *v1.Service, targetPort int, protocol v1.Protocol) {
ginkgo.By(fmt.Sprintf("Creating client pod %s that should not be able to connect to %s.", podName, service.Name))
podClient := createNetworkClientPod(f, ns, podName, service, targetPort, protocol)
defer func() {
ginkgo.By(fmt.Sprintf("Cleaning up the pod %s", podClient.Name))
if err := f.ClientSet.CoreV1().Pods(ns.Name).Delete(context.TODO(), podClient.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup pod %v: %v", podClient.Name, err)
}
}()
checkNoConnectivity(f, ns, podClient, service)
}
func checkConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1.Pod, service *v1.Service) {
framework.Logf("Waiting for %s to complete.", podClient.Name)
err := e2epod.WaitForPodNoLongerRunningInNamespace(f.ClientSet, podClient.Name, ns.Name)
framework.ExpectNoError(err, "Pod did not finish as expected.")
framework.Logf("Waiting for %s to complete.", podClient.Name)
err = e2epod.WaitForPodSuccessInNamespace(f.ClientSet, podClient.Name, ns.Name)
if err != nil {
// Dump debug information for the test namespace.
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient)
framework.Failf("Pod %s should be able to connect to service %s, but was not able to connect.\nPod logs:\n%s\n\n Current NetworkPolicies:\n\t%v\n\n Pods:\n\t%v\n\n", podClient.Name, service.Name, logs, policies.Items, pods)
}
}
func checkNoConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1.Pod, service *v1.Service) {
framework.Logf("Waiting for %s to complete.", podClient.Name)
err := e2epod.WaitForPodSuccessInNamespace(f.ClientSet, podClient.Name, ns.Name)
// We expect an error here since it's a cannot connect test.
// Dump debug information if the error was nil.
if err == nil {
// Dump debug information for the test namespace.
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient)
framework.Failf("Pod %s should not be able to connect to service %s, but was able to connect.\nPod logs:\n%s\n\n Current NetworkPolicies:\n\t%v\n\n Pods:\n\t %v\n\n", podClient.Name, service.Name, logs, policies.Items, pods)
}
}
func checkNoConnectivityByExitCode(f *framework.Framework, ns *v1.Namespace, podClient *v1.Pod, service *v1.Service) {
err := e2epod.WaitForPodCondition(f.ClientSet, ns.Name, podClient.Name, "terminated", framework.PodStartTimeout, func(pod *v1.Pod) (bool, error) {
statuses := pod.Status.ContainerStatuses
if len(statuses) == 0 || statuses[0].State.Terminated == nil {
return false, nil
}
if statuses[0].State.Terminated.ExitCode != 0 {
return true, fmt.Errorf("pod %q container exited with code: %d", podClient.Name, statuses[0].State.Terminated.ExitCode)
}
return true, nil
})
// We expect an error here since it's a cannot connect test.
// Dump debug information if the error was nil.
if err == nil {
pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient)
framework.Failf("Pod %s should not be able to connect to service %s, but was able to connect.\nPod logs:\n%s\n\n Current NetworkPolicies:\n\t%v\n\n Pods:\n\t%v\n\n", podClient.Name, service.Name, logs, policies.Items, pods)
// Dump debug information for the test namespace.
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
}
}
func collectPodsAndNetworkPolicies(f *framework.Framework, podClient *v1.Pod) ([]string, *networkingv1.NetworkPolicyList, string) {
// Collect pod logs when we see a failure.
logs, logErr := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podClient.Name, "client")
if logErr != nil && apierrors.IsNotFound(logErr) {
// Pod may have already been removed; try to get previous pod logs
logs, logErr = e2epod.GetPreviousPodLogs(f.ClientSet, f.Namespace.Name, podClient.Name, fmt.Sprintf("%s-container", podClient.Name))
}
if logErr != nil {
framework.Logf("Error getting container logs: %s", logErr)
}
// Collect current NetworkPolicies applied in the test namespace.
policies, err := f.ClientSet.NetworkingV1().NetworkPolicies(f.Namespace.Name).List(context.TODO(), metav1.ListOptions{})
if err != nil {
framework.Logf("error getting current NetworkPolicies for %s namespace: %s", f.Namespace.Name, err)
}
// Collect the list of pods running in the test namespace.
podsInNS, err := e2epod.GetPodsInNamespace(f.ClientSet, f.Namespace.Name, map[string]string{})
if err != nil {
framework.Logf("error getting pods for %s namespace: %s", f.Namespace.Name, err)
}
pods := []string{}
for _, p := range podsInNS {
pods = append(pods, fmt.Sprintf("Pod: %s, Status: %s\n", p.Name, p.Status.String()))
}
return pods, policies, logs
}
// Create a server pod with a listening container for each port in ports[].
// Will also assign a pod label with key: "pod-name" and label set to the given podName for later use by the network
// policy.
func createServerPodAndService(f *framework.Framework, namespace *v1.Namespace, podName string, ports []protocolPort) (*v1.Pod, *v1.Service) {
// Because we have a variable amount of ports, we'll first loop through and generate our Containers for our pod,
// and ServicePorts.for our Service.
containers := []v1.Container{}
servicePorts := []v1.ServicePort{}
for _, portProtocol := range ports {
var porterPort string
var connectProtocol string
switch portProtocol.protocol {
case v1.ProtocolTCP:
porterPort = fmt.Sprintf("SERVE_PORT_%d", portProtocol.port)
connectProtocol = "tcp"
case v1.ProtocolSCTP:
porterPort = fmt.Sprintf("SERVE_SCTP_PORT_%d", portProtocol.port)
connectProtocol = "sctp"
default:
framework.Failf("createServerPodAndService, unexpected protocol %v", portProtocol.protocol)
}
containers = append(containers, v1.Container{
Name: fmt.Sprintf("%s-container-%d", podName, portProtocol.port),
Image: imageutils.GetE2EImage(imageutils.Agnhost),
Args: []string{"porter"},
Env: []v1.EnvVar{
{
Name: porterPort,
Value: "foo",
},
},
Ports: []v1.ContainerPort{
{
ContainerPort: int32(portProtocol.port),
Name: fmt.Sprintf("serve-%d", portProtocol.port),
Protocol: portProtocol.protocol,
},
},
ReadinessProbe: &v1.Probe{
Handler: v1.Handler{
Exec: &v1.ExecAction{
Command: []string{"/agnhost", "connect", fmt.Sprintf("--protocol=%s", connectProtocol), "--timeout=1s", fmt.Sprintf("127.0.0.1:%d", portProtocol.port)},
},
},
},
})
// Build the Service Ports for the service.
servicePorts = append(servicePorts, v1.ServicePort{
Name: fmt.Sprintf("%s-%d", podName, portProtocol.port),
Port: int32(portProtocol.port),
TargetPort: intstr.FromInt(portProtocol.port),
Protocol: portProtocol.protocol,
})
}
ginkgo.By(fmt.Sprintf("Creating a server pod %s in namespace %s", podName, namespace.Name))
pod, err := f.ClientSet.CoreV1().Pods(namespace.Name).Create(context.TODO(), &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: podName + "-",
Labels: map[string]string{
"pod-name": podName,
},
},
Spec: v1.PodSpec{
Containers: containers,
RestartPolicy: v1.RestartPolicyNever,
},
}, metav1.CreateOptions{})
framework.ExpectNoError(err)
framework.Logf("Created pod %v", pod.ObjectMeta.Name)
svcName := fmt.Sprintf("svc-%s", podName)
ginkgo.By(fmt.Sprintf("Creating a service %s for pod %s in namespace %s", svcName, podName, namespace.Name))
svc, err := f.ClientSet.CoreV1().Services(namespace.Name).Create(context.TODO(), &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: svcName,
},
Spec: v1.ServiceSpec{
Ports: servicePorts,
Selector: map[string]string{
"pod-name": podName,
},
},
}, metav1.CreateOptions{})
framework.ExpectNoError(err)
framework.Logf("Created service %s", svc.Name)
return pod, svc
}
func cleanupServerPodAndService(f *framework.Framework, pod *v1.Pod, service *v1.Service) {
ginkgo.By("Cleaning up the server.")
if err := f.ClientSet.CoreV1().Pods(pod.Namespace).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup pod %v: %v", pod.Name, err)
}
ginkgo.By("Cleaning up the server's service.")
if err := f.ClientSet.CoreV1().Services(service.Namespace).Delete(context.TODO(), service.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup svc %v: %v", service.Name, err)
}
}
// Create a client pod which will attempt a netcat to the provided service, on the specified port.
// This client will attempt a one-shot connection, then die, without restarting the pod.
// Test can then be asserted based on whether the pod quit with an error or not.
func createNetworkClientPod(f *framework.Framework, namespace *v1.Namespace, podName string, targetService *v1.Service, targetPort int, protocol v1.Protocol) *v1.Pod {
return createNetworkClientPodWithRestartPolicy(f, namespace, podName, targetService, targetPort, protocol, v1.RestartPolicyNever)
}
// Create a client pod which will attempt a netcat to the provided service, on the specified port.
// It is similar to createNetworkClientPod but supports specifying RestartPolicy.
func createNetworkClientPodWithRestartPolicy(f *framework.Framework, namespace *v1.Namespace, podName string, targetService *v1.Service, targetPort int, protocol v1.Protocol, restartPolicy v1.RestartPolicy) *v1.Pod {
var connectProtocol string
switch protocol {
case v1.ProtocolTCP:
connectProtocol = "tcp"
case v1.ProtocolSCTP:
connectProtocol = "sctp"
default:
framework.Failf("createNetworkClientPodWithRestartPolicy, unexpected protocol %v", protocol)
}
pod, err := f.ClientSet.CoreV1().Pods(namespace.Name).Create(context.TODO(), &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: podName + "-",
Labels: map[string]string{
"pod-name": podName,
},
},
Spec: v1.PodSpec{
RestartPolicy: restartPolicy,
Containers: []v1.Container{
{
Name: "client",
Image: imageutils.GetE2EImage(imageutils.Agnhost),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
fmt.Sprintf("for i in $(seq 1 5); do /agnhost connect %s --protocol %s --timeout 8s && exit 0 || sleep 1; done; exit 1", net.JoinHostPort(targetService.Spec.ClusterIP, strconv.Itoa(targetPort)), connectProtocol),
},
},
},
},
}, metav1.CreateOptions{})
framework.ExpectNoError(err)
return pod
}
// Patch pod with a map value
func updatePodLabel(f *framework.Framework, namespace *v1.Namespace, podName string, patchOperation string, patchPath string, patchValue map[string]string) *v1.Pod {
type patchMapValue struct {
Op string `json:"op"`
Path string `json:"path"`
Value map[string]string `json:"value,omitempty"`
}
payload := []patchMapValue{{
Op: patchOperation,
Path: patchPath,
Value: patchValue,
}}
payloadBytes, err := json.Marshal(payload)
framework.ExpectNoError(err)
pod, err := f.ClientSet.CoreV1().Pods(namespace.Name).Patch(context.TODO(), podName, types.JSONPatchType, payloadBytes, metav1.PatchOptions{})
framework.ExpectNoError(err)
return pod
}
func cleanupNetworkPolicy(f *framework.Framework, policy *networkingv1.NetworkPolicy) {
ginkgo.By("Cleaning up the policy.")
if err := f.ClientSet.NetworkingV1().NetworkPolicies(policy.Namespace).Delete(context.TODO(), policy.Name, metav1.DeleteOptions{}); err != nil {
framework.Failf("unable to cleanup policy %v: %v", policy.Name, err)
}
}
var _ = common.SIGDescribe("NetworkPolicy API", func() {
f := framework.NewDefaultFramework("networkpolicies")
/*
Release: v1.20
Testname: NetworkPolicies API
Description:
- The networking.k8s.io API group MUST exist in the /apis discovery document.
- The networking.k8s.io/v1 API group/version MUST exist in the /apis/networking.k8s.io discovery document.
- The NetworkPolicies resources MUST exist in the /apis/networking.k8s.io/v1 discovery document.
- The NetworkPolicies resource must support create, get, list, watch, update, patch, delete, and deletecollection.
*/
ginkgo.It("should support creating NetworkPolicy API operations", func() {
// Setup
ns := f.Namespace.Name
npVersion := "v1"
npClient := f.ClientSet.NetworkingV1().NetworkPolicies(ns)
npTemplate := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "e2e-example-netpol",
Labels: map[string]string{
"special-label": f.UniqueName,
},
},
Spec: networkingv1.NetworkPolicySpec{
// Apply this policy to the Server
PodSelector: metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "test-pod",
},
},
// Allow traffic only from client-a in namespace-b
Ingress: []networkingv1.NetworkPolicyIngressRule{{
From: []networkingv1.NetworkPolicyPeer{{
NamespaceSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"ns-name": "pod-b",
},
},
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"pod-name": "client-a",
},
},
}},
}},
},
}
// Discovery
ginkgo.By("getting /apis")
{
discoveryGroups, err := f.ClientSet.Discovery().ServerGroups()
framework.ExpectNoError(err)
found := false
for _, group := range discoveryGroups.Groups {
if group.Name == networkingv1.GroupName {
for _, version := range group.Versions {
if version.Version == npVersion {
found = true
break
}
}
}
}
framework.ExpectEqual(found, true, fmt.Sprintf("expected networking API group/version, got %#v", discoveryGroups.Groups))
}
ginkgo.By("getting /apis/networking.k8s.io")
{
group := &metav1.APIGroup{}
err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/networking.k8s.io").Do(context.TODO()).Into(group)
framework.ExpectNoError(err)
found := false
for _, version := range group.Versions {
if version.Version == npVersion {
found = true
break
}
}
framework.ExpectEqual(found, true, fmt.Sprintf("expected networking API version, got %#v", group.Versions))
}
ginkgo.By("getting /apis/networking.k8s.io" + npVersion)
{
resources, err := f.ClientSet.Discovery().ServerResourcesForGroupVersion(networkingv1.SchemeGroupVersion.String())
framework.ExpectNoError(err)
foundNetPol := false
for _, resource := range resources.APIResources {
switch resource.Name {
case "networkpolicies":
foundNetPol = true
}
}
framework.ExpectEqual(foundNetPol, true, fmt.Sprintf("expected networkpolicies, got %#v", resources.APIResources))
}
// NetPol resource create/read/update/watch verbs
ginkgo.By("creating")
_, err := npClient.Create(context.TODO(), npTemplate, metav1.CreateOptions{})
framework.ExpectNoError(err)
_, err = npClient.Create(context.TODO(), npTemplate, metav1.CreateOptions{})
framework.ExpectNoError(err)
createdNetPol, err := npClient.Create(context.TODO(), npTemplate, metav1.CreateOptions{})
framework.ExpectNoError(err)
ginkgo.By("getting")
gottenNetPol, err := npClient.Get(context.TODO(), createdNetPol.Name, metav1.GetOptions{})
framework.ExpectNoError(err)
framework.ExpectEqual(gottenNetPol.UID, createdNetPol.UID)
ginkgo.By("listing")
nps, err := npClient.List(context.TODO(), metav1.ListOptions{LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
framework.ExpectEqual(len(nps.Items), 3, "filtered list should have 3 items")
ginkgo.By("watching")
framework.Logf("starting watch")
npWatch, err := npClient.Watch(context.TODO(), metav1.ListOptions{ResourceVersion: nps.ResourceVersion, LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
// Test cluster-wide list and watch
clusterNPClient := f.ClientSet.NetworkingV1().NetworkPolicies("")
ginkgo.By("cluster-wide listing")
clusterNPs, err := clusterNPClient.List(context.TODO(), metav1.ListOptions{LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
framework.ExpectEqual(len(clusterNPs.Items), 3, "filtered list should have 3 items")
ginkgo.By("cluster-wide watching")
framework.Logf("starting watch")
_, err = clusterNPClient.Watch(context.TODO(), metav1.ListOptions{ResourceVersion: nps.ResourceVersion, LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
ginkgo.By("patching")
patchedNetPols, err := npClient.Patch(context.TODO(), createdNetPol.Name, types.MergePatchType, []byte(`{"metadata":{"annotations":{"patched":"true"}}}`), metav1.PatchOptions{})
framework.ExpectNoError(err)
framework.ExpectEqual(patchedNetPols.Annotations["patched"], "true", "patched object should have the applied annotation")
ginkgo.By("updating")
npToUpdate := patchedNetPols.DeepCopy()
npToUpdate.Annotations["updated"] = "true"
updatedNetPols, err := npClient.Update(context.TODO(), npToUpdate, metav1.UpdateOptions{})
framework.ExpectNoError(err)
framework.ExpectEqual(updatedNetPols.Annotations["updated"], "true", "updated object should have the applied annotation")
framework.Logf("waiting for watch events with expected annotations")
for sawAnnotations := false; !sawAnnotations; {
select {
case evt, ok := <-npWatch.ResultChan():
framework.ExpectEqual(ok, true, "watch channel should not close")
framework.ExpectEqual(evt.Type, watch.Modified)
watchedNetPol, isNetPol := evt.Object.(*networkingv1.NetworkPolicy)
framework.ExpectEqual(isNetPol, true, fmt.Sprintf("expected NetworkPolicy, got %T", evt.Object))
if watchedNetPol.Annotations["patched"] == "true" && watchedNetPol.Annotations["updated"] == "true" {
framework.Logf("saw patched and updated annotations")
sawAnnotations = true
npWatch.Stop()
} else {
framework.Logf("missing expected annotations, waiting: %#v", watchedNetPol.Annotations)
}
case <-time.After(wait.ForeverTestTimeout):
framework.Fail("timed out waiting for watch event")
}
}
// NetPol resource delete operations
ginkgo.By("deleting")
err = npClient.Delete(context.TODO(), createdNetPol.Name, metav1.DeleteOptions{})
framework.ExpectNoError(err)
_, err = npClient.Get(context.TODO(), createdNetPol.Name, metav1.GetOptions{})
framework.ExpectEqual(apierrors.IsNotFound(err), true, fmt.Sprintf("expected 404, got %#v", err))
nps, err = npClient.List(context.TODO(), metav1.ListOptions{LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
framework.ExpectEqual(len(nps.Items), 2, "filtered list should have 2 items")
ginkgo.By("deleting a collection")
err = npClient.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
nps, err = npClient.List(context.TODO(), metav1.ListOptions{LabelSelector: "special-label=" + f.UniqueName})
framework.ExpectNoError(err)
framework.ExpectEqual(len(nps.Items), 0, "filtered list should have 0 items")
})
})
// CheckSCTPModuleLoadedOnNodes checks whether any node on the list has the
// sctp.ko module loaded
// For security reasons, and also to allow clusters to use userspace SCTP implementations,
// we require that just creating an SCTP Pod/Service/NetworkPolicy must not do anything
// that would cause the sctp kernel module to be loaded.
func CheckSCTPModuleLoadedOnNodes(f *framework.Framework, nodes *v1.NodeList) bool {
hostExec := utils.NewHostExec(f)
defer hostExec.Cleanup()
re := regexp.MustCompile(`^\s*sctp\s+`)
cmd := "lsmod | grep sctp"
for _, node := range nodes.Items {
framework.Logf("Executing cmd %q on node %v", cmd, node.Name)
result, err := hostExec.IssueCommandWithResult(cmd, &node)
if err != nil {
framework.Logf("sctp module is not loaded or error occurred while executing command %s on node: %v", cmd, err)
}
for _, line := range strings.Split(result, "\n") {
if found := re.Find([]byte(line)); found != nil {
framework.Logf("the sctp module is loaded on node: %v", node.Name)
return true
}
}
framework.Logf("the sctp module is not loaded on node: %v", node.Name)
}
return false
}
| {
"content_hash": "5704c62db599e23e1c4d16851a6a6806",
"timestamp": "",
"source": "github",
"line_count": 2374,
"max_line_length": 226,
"avg_line_length": 41.73336141533277,
"alnum_prop": 0.7012667171334848,
"repo_name": "cofyc/kubernetes",
"id": "2956e3da8763203ac7bd4f4f6a7ae2ad3f7683c4",
"size": "99644",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "test/e2e/network/netpol/network_legacy.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2840"
},
{
"name": "Dockerfile",
"bytes": "49820"
},
{
"name": "Go",
"bytes": "54418234"
},
{
"name": "HTML",
"bytes": "38"
},
{
"name": "Lua",
"bytes": "17200"
},
{
"name": "Makefile",
"bytes": "65498"
},
{
"name": "PowerShell",
"bytes": "118255"
},
{
"name": "Python",
"bytes": "23490"
},
{
"name": "Ruby",
"bytes": "413"
},
{
"name": "Shell",
"bytes": "1609293"
},
{
"name": "Starlark",
"bytes": "3797344"
},
{
"name": "sed",
"bytes": "1390"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1bbeaccc4f362633860dea7aee4fa74f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "b6afa0ec3c843e59c4d02baf17c78387df5a1b38",
"size": "181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Phymaspermum schroeteri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
export interface Settings {
readonly baseUrl: string;
readonly application: {
readonly name: string;
readonly password: string;
};
readonly nesting?: boolean | undefined;
readonly sessionTimeout?: number | undefined;
readonly debug?: boolean | undefined;
readonly attributesParser?: ((json: string) => any) | undefined;
readonly attributesEncoder?: ((obj: any) => string) | undefined;
}
| {
"content_hash": "f531d0fa0a9f35a3b37eb7b620e626e8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 36.25,
"alnum_prop": 0.671264367816092,
"repo_name": "markogresak/DefinitelyTyped",
"id": "ba1ad69d4ecdf7cfee63544ff1c1fc11e3e1d1ca",
"size": "435",
"binary": false,
"copies": "24",
"ref": "refs/heads/master",
"path": "types/atlassian-crowd-client/settings.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "15"
},
{
"name": "Protocol Buffer",
"bytes": "678"
},
{
"name": "TypeScript",
"bytes": "17426898"
}
],
"symlink_target": ""
} |
title: Monday 15th May
layout: post
author: joseph.kerridge
permalink: /monday-15th-may/
source-id: 1voNEVRPGujUviYDpcSxVjWaEEG_0z9i8UQOvoIC17z8
published: true
---
<table>
<tr>
<td>Title</td>
<td>The second week of code academy</td>
<td>Date</td>
<td>15/5/17
</td>
</tr>
</table>
<table>
<tr>
<td>Starting point:</td>
<td>I started of this lesson well, I got through a few sections really quickly and then I completely forgot everything and it really set me behind as couldn't remember a thing.</td>
</tr>
<tr>
<td>Target for this lesson?</td>
<td>My target for this lesson was to get through it all really quickly and get to a further stage than anyone else.</td>
</tr>
<tr>
<td>Did I reach my target?
(add details to "Lesson Review")</td>
<td>No, not at. I rushed and REALLY messed up. Lesson for next week don’t rush. </td>
</tr>
</table>
<table>
<tr>
<td>Lesson Review</td>
</tr>
<tr>
<td>How did I learn? What strategies were effective?</td>
</tr>
<tr>
<td>I learnt from my mistakes and reflecting on it I shouldn't have rushed as it really impacted my learning because I then didn’t fully understand what I needed to do, but in the end I persevered and it meant that I could finally finish it, which felt really really good. Here I have used two techniques which were perseverance and learning from my mistakes.</td>
</tr>
<tr>
<td>What limited my learning? Which habits do I need to work on?</td>
</tr>
<tr>
<td>As I mentioned previously and in last weeks blog I talked about rushing and it happened again, I rushed and therefore delayed the time that I had on the easier ones and prolonged the time I had on the harder ones, that sounds good doesn’t it, well...it is not and this is because it meant that I had forgotten the aspects that i needed to improve.</td>
</tr>
<tr>
<td>What will I change for next time? How will I improve my learning?</td>
</tr>
<tr>
<td>Next week I will make sure that I don’t rush, this will mean that I will have more time to get all the things done a I understand it ALL and not just parts of it and then waste my time on unnecessary things that I could fix if I had not been rushing.</td>
</tr>
</table>
| {
"content_hash": "608837ebefb799ab57756c58f9bdfa01",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 368,
"avg_line_length": 36.564516129032256,
"alnum_prop": 0.6951918835465373,
"repo_name": "joesworld/joesworld.github.io",
"id": "f0784280b19485b0d375c75ef52a2cff56e0ca52",
"size": "2279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2017-06-12-Monday-15th-May.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "64017"
},
{
"name": "HTML",
"bytes": "6266"
}
],
"symlink_target": ""
} |
class CLightingSet : public CDialog
{
DECLARE_DYNAMIC(CLightingSet)
public:
CLightingSet(CWnd* pParent = NULL); // standard constructor
virtual ~CLightingSet();
// Dialog Data
enum { IDD = IDD_DIALOG_LightCSeting };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
CListBox m_List_Box;
int m_outputboardsum;
afx_msg void OnBnClickedButton1();
virtual BOOL OnInitDialog();
afx_msg void OnBnClickedButton2();
afx_msg void OnBnClickedButtonmodify();
afx_msg void OnLbnSelchangeListLcset();
typedef std::map<int,CString> MAP_OUTPUTADDRESS;
MAP_OUTPUTADDRESS m_mapoutputaddress;
int m_intaddress;
};
| {
"content_hash": "5daabf29abeb1c3e34fa99a8813e4bbb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 71,
"avg_line_length": 23.032258064516128,
"alnum_prop": 0.7549019607843137,
"repo_name": "temcocontrols/T3000_Building_Automation_System",
"id": "743e81bb9619702acfd8672db610b701673d4479",
"size": "866",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "T3000/LightingController/LightingSet.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "555"
},
{
"name": "C",
"bytes": "4704332"
},
{
"name": "C#",
"bytes": "9337521"
},
{
"name": "C++",
"bytes": "15665753"
},
{
"name": "CMake",
"bytes": "169395"
},
{
"name": "CSS",
"bytes": "111688"
},
{
"name": "Dockerfile",
"bytes": "210"
},
{
"name": "HTML",
"bytes": "125316"
},
{
"name": "Inno Setup",
"bytes": "5879"
},
{
"name": "JavaScript",
"bytes": "1789138"
},
{
"name": "Makefile",
"bytes": "6851"
},
{
"name": "Meson",
"bytes": "7623"
},
{
"name": "NASL",
"bytes": "14427"
},
{
"name": "Objective-C",
"bytes": "7094"
},
{
"name": "Perl",
"bytes": "40922"
},
{
"name": "PowerShell",
"bytes": "4726"
},
{
"name": "Python",
"bytes": "1992"
},
{
"name": "Shell",
"bytes": "143"
}
],
"symlink_target": ""
} |
package org.hisp.dhis.dxf2.metadata.objectbundle.hooks;
import com.google.common.collect.Sets;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundle;
import org.hisp.dhis.program.notification.NotificationRecipient;
import org.hisp.dhis.program.notification.ProgramNotificationTemplate;
/**
* @author Halvdan Hoem Grelland
*/
public class ProgramNotificationTemplateObjectBundleHook
extends AbstractObjectBundleHook
{
@Override
public <T extends IdentifiableObject> void preCreate( T object, ObjectBundle bundle )
{
if ( !ProgramNotificationTemplate.class.isInstance( object ) ) return;
ProgramNotificationTemplate template = (ProgramNotificationTemplate) object;
preProcess( template );
}
@Override
public <T extends IdentifiableObject> void preUpdate( T object, T persistedObject, ObjectBundle bundle )
{
if ( !ProgramNotificationTemplate.class.isInstance( object ) ) return;
ProgramNotificationTemplate template = (ProgramNotificationTemplate) object;
preProcess( template );
}
/**
* Removes any non-valid combinations of properties on the template object.
*/
private void preProcess( ProgramNotificationTemplate template )
{
if ( template.getNotificationTrigger().isImmediate() )
{
template.setRelativeScheduledDays( null );
}
if ( NotificationRecipient.USER_GROUP != template.getNotificationRecipient() )
{
template.setRecipientUserGroup( null );
}
if ( ! ( template.getNotificationRecipient().isExternalRecipient() ) )
{
template.setDeliveryChannels( Sets.newHashSet() );
}
}
}
| {
"content_hash": "b417283992e65b648f37485df9b3d1b3",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 108,
"avg_line_length": 32.14545454545455,
"alnum_prop": 0.7047511312217195,
"repo_name": "uonafya/jphes-core",
"id": "c46d8cebbd9fbaed4eac28008596650da5d335a0",
"size": "3324",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramNotificationTemplateObjectBundleHook.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "290775"
},
{
"name": "HTML",
"bytes": "76142"
},
{
"name": "Java",
"bytes": "16409512"
},
{
"name": "JavaScript",
"bytes": "3255823"
},
{
"name": "Ruby",
"bytes": "1011"
},
{
"name": "SCSS",
"bytes": "4229"
},
{
"name": "Shell",
"bytes": "394"
},
{
"name": "XSLT",
"bytes": "8281"
}
],
"symlink_target": ""
} |
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { Exercise, ExercisePlan} from "../../../services/model";
import { WorkoutBuilderService } from "../builder-services/workout-builder-service";
import { WorkoutService } from "../../../services/workout-service";
@Component({
selector: 'left-nav-exercises',
templateUrl: '/src/components/workout-builder/navigation/left-nav-exercises.component.html'
})
export class LeftNavExercisesComponent implements OnInit{
exerciseList:Observable<Exercise[]>;
constructor(
public workoutService:WorkoutService,
public workoutBuilderService:WorkoutBuilderService) {}
ngOnInit() {
this.exerciseList = this.workoutService.getExercises();
}
addExercise(exercise:Exercise) {
this.workoutBuilderService.addExercise(new ExercisePlan(exercise, 30));
}
} | {
"content_hash": "2eb85b4df44b95065a889faaf29623f9",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 95,
"avg_line_length": 34.46153846153846,
"alnum_prop": 0.7198660714285714,
"repo_name": "chandermani/angular2byexample",
"id": "2d4a9dcba6088bfd4ac1bef7c45dd05a0ff2680b",
"size": "896",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trainer/src/components/workout-builder/navigation/left-nav-exercises.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8833"
},
{
"name": "HTML",
"bytes": "24193"
},
{
"name": "JavaScript",
"bytes": "11787"
},
{
"name": "TypeScript",
"bytes": "80133"
}
],
"symlink_target": ""
} |
<?php
$config = get_config('auth_shibboleth');
if ($show_instructions) {
$columns = 'twocolumns';
} else {
$columns = 'onecolumn';
}
?>
<div class="loginbox clearfix <?php echo $columns ?>">
<div class="loginpanel">
<!--<h2><?php print_string("returningtosite") ?></h2>-->
<h2><?php
if (isset($config->login_name) && !empty($config->login_name)){
echo $config->login_name;
} else {
print_string("auth_shibboleth_login_long", "auth_shibboleth");
}
?></h2>
<div class="subcontent loginsub">
<div class="desc">
<?php
if (!empty($errormsg)) {
echo '<div class="loginerrors">';
echo $OUTPUT->error_text($errormsg);
echo '</div>';
}
?>
<div class="guestsub">
<p><label for="idp"><?php print_string("auth_shibboleth_select_organization", "auth_shibboleth"); ?></label></p>
<form action="login.php" method="post" id="guestlogin">
<select id="idp" name="idp">
<option value="-" ><?php print_string("auth_shibboleth_select_member", "auth_shibboleth"); ?></option>
<?php
print_idp_list();
?>
</select><p><input type="submit" value="<?php print_string("select"); ?>" accesskey="s" /></p>
</form>
<p>
<?php
print_string("auth_shib_contact_administrator", "auth_shibboleth", get_admin()->email);
?>
</p>
</div>
</div>
</div>
<?php if ($CFG->guestloginbutton) { ?>
<div class="subcontent guestsub">
<div class="desc">
<?php print_string("someallowguest") ?>
</div>
<form action="../../login/index.php" method="post" id="guestlogin">
<div class="guestform">
<input type="hidden" name="username" value="guest" />
<input type="hidden" name="password" value="guest" />
<input type="submit" value="<?php print_string("loginguest") ?>" />
</div>
</form>
</div>
<?php } ?>
</div>
<?php if ($show_instructions) { ?>
<div class="signuppanel">
<h2><?php print_string("firsttime") ?></h2>
<div class="subcontent">
<?php if (is_enabled_auth('none')) { // instructions override the rest for security reasons
print_string("loginstepsnone");
} else if ($CFG->registerauth == 'email') {
if (!empty($CFG->auth_instructions)) {
echo format_text($CFG->auth_instructions);
} else {
print_string("loginsteps", "", "signup.php");
} ?>
<div class="signupform">
<form action="../../login/signup.php" method="get" id="signup">
<div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
</form>
</div>
<?php } else if (!empty($CFG->registerauth)) {
echo format_text($CFG->auth_instructions); ?>
<div class="signupform">
<form action="../../login/signup.php" method="get" id="signup">
<div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
</form>
</div>
<?php } else {
echo format_text($CFG->auth_instructions);
} ?>
</div>
</div>
<?php } ?>
</div>
| {
"content_hash": "a2e8a2b4bf38c0e1a425971df64cdd19",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 122,
"avg_line_length": 36.16494845360825,
"alnum_prop": 0.4908779931584949,
"repo_name": "aymswick/chimehack-teacher",
"id": "4d7e7df518c92fb550f333a744ec373007543b8e",
"size": "3508",
"binary": false,
"copies": "38",
"ref": "refs/heads/master",
"path": "auth/shibboleth/index_form.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1581673"
},
{
"name": "Gherkin",
"bytes": "2630000"
},
{
"name": "HTML",
"bytes": "1191631"
},
{
"name": "JavaScript",
"bytes": "15235505"
},
{
"name": "PHP",
"bytes": "77874531"
},
{
"name": "PLSQL",
"bytes": "4867"
},
{
"name": "Perl",
"bytes": "20769"
},
{
"name": "XSLT",
"bytes": "33489"
}
],
"symlink_target": ""
} |
package org.auraframework.def;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.auraframework.def.DefDescriptor.DefType;
import org.auraframework.util.AuraTextUtil;
import org.auraframework.util.text.GlobMatcher;
import com.google.common.collect.Lists;
public class DescriptorFilter implements Comparable<DescriptorFilter> {
private static final List<DefType> componentType = Collections.unmodifiableList(Arrays
.asList(new DefType[] { DefType.COMPONENT }));
private final List<DefType> defTypes;
private final GlobMatcher prefixMatch;
private final GlobMatcher namespaceMatch;
private final GlobMatcher nameMatch;
public DescriptorFilter(String matcher) {
this(matcher, "*");
}
public DescriptorFilter(String matcher, String typeStr) {
String prefix = "*", namespace = "*", name = "*";
String remainder = matcher;
if (remainder.indexOf("://") != -1) {
List<String> split = AuraTextUtil.splitSimpleLimit(remainder, "://", 2);
prefix = split.get(0);
remainder = split.get(1);
}
if (remainder.indexOf(":") != -1) {
List<String> split = AuraTextUtil.splitSimpleLimit(remainder, ":", 2);
namespace = split.get(0);
name = split.get(1);
} else if (remainder.length() > 0) {
namespace = remainder;
}
try {
this.prefixMatch = new GlobMatcher(prefix);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException("Illegal prefix in " + matcher);
}
try {
this.namespaceMatch = new GlobMatcher(namespace);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException("Illegal namespace in " + matcher);
}
try {
this.nameMatch = new GlobMatcher(name);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException("Illegal name in " + matcher);
}
if ("*".equals(typeStr)) {
this.defTypes = null;
} else if (typeStr != null) {
List<String> types = AuraTextUtil.splitSimpleAndTrim(typeStr, ",", 0);
List<DefType> accum = Lists.newArrayList();
for (String t : types) {
accum.add(DefType.valueOf(t));
}
this.defTypes = Collections.unmodifiableList(accum);
} else {
this.defTypes = componentType;
}
}
public boolean matchPrefix(String prefix) {
return this.prefixMatch.match(prefix);
}
public boolean matchNamespace(String namespace) {
return this.namespaceMatch.match(namespace);
}
public boolean matchName(String name) {
return this.nameMatch.match(name);
}
public boolean matchType(DefType type) {
return this.defTypes == null || this.defTypes.contains(type);
}
public boolean matchDescriptor(DefDescriptor<?> dd) {
return matchType(dd.getDefType()) && matchName(dd.getName()) && matchPrefix(dd.getPrefix())
&& matchNamespace(dd.getNamespace());
}
public boolean matchDescriptorNoNS(DefDescriptor<?> dd) {
return matchType(dd.getDefType()) && matchName(dd.getName()) && matchPrefix(dd.getPrefix());
}
@Override
public String toString() {
return this.prefixMatch + "://" + this.namespaceMatch + ":" + this.nameMatch
+ ((this.defTypes == null) ? "(any)" : this.defTypes.toString());
}
/**
* Gets the prefix match for this instance.
*
* @return The prefix matcher.
*/
public GlobMatcher getPrefixMatch() {
return this.prefixMatch;
}
/**
* Gets the namespace matcher for this instance.
*
* @return The namespace matcher.
*/
public GlobMatcher getNamespaceMatch() {
return this.namespaceMatch;
}
/**
* Gets the name matcher for this instance.
*
* @return The name matcher.
*/
public GlobMatcher getNameMatch() {
return this.nameMatch;
}
@Override
public int compareTo(DescriptorFilter o) {
if (this == o) {
return 0;
}
if (o == null)
return -1;
return this.toString().compareTo(o.toString());
}
@Override
public int hashCode() {
return this.toString().hashCode();
}
@Override
public boolean equals(Object arg0) {
if(arg0 == null) return false;
if (this == arg0) return true;
if (!(arg0 instanceof DescriptorFilter)) { // tests null also
return false;
}
return compareTo((DescriptorFilter) arg0) == 0;
}
}
| {
"content_hash": "84d47b18298a9edb6df24494a6f21aef",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 100,
"avg_line_length": 30.50955414012739,
"alnum_prop": 0.6,
"repo_name": "lhong375/aura",
"id": "277f6118e0b1263d0b7abaf529dcb2ccc98804e5",
"size": "5401",
"binary": false,
"copies": "1",
"ref": "refs/heads/load-test-without-testjar",
"path": "aura/src/main/java/org/auraframework/def/DescriptorFilter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "633422"
},
{
"name": "GAP",
"bytes": "9236"
},
{
"name": "Java",
"bytes": "6205033"
},
{
"name": "JavaScript",
"bytes": "9903940"
},
{
"name": "Python",
"bytes": "7342"
},
{
"name": "Shell",
"bytes": "12892"
},
{
"name": "XSLT",
"bytes": "1140"
}
],
"symlink_target": ""
} |
class GURL;
namespace net {
class BoundNetLog;
class IOBuffer;
class URLRequestContext;
//------------------------------------------------------------------------------
// Define an interface class that allows access to contextual information
// supplied by the owner of this filter. In the case where there are a chain of
// filters, there is only one owner of all the chained filters, and that context
// is passed to the constructor of all those filters. To be clear, the context
// does NOT reflect the position in a chain, or the fact that there are prior
// or later filters in a chain.
//
// TODO(rdsmith): FilterContext is a grab-bag of methods which may or may
// not be relevant for any particular filter, and it's getting worse over
// time. In addition, it only supports two filters, SDCH and gzip.
// It would make more sense to implement FilterContext as a
// base::SupportsUserData structure to which filter-specific information
// could be added by whatever the ultimate consumer of the filter chain is,
// and a particular filter (if included) could access that information.
class NET_EXPORT_PRIVATE FilterContext {
public:
// Enum to control what histograms are emitted near end-of-life of this
// instance.
enum StatisticSelector {
SDCH_DECODE,
SDCH_PASSTHROUGH,
SDCH_EXPERIMENT_DECODE,
SDCH_EXPERIMENT_HOLDBACK,
};
virtual ~FilterContext();
// What mime type was specified in the header for this data?
// Only makes senses for some types of contexts, and returns false
// when not applicable.
virtual bool GetMimeType(std::string* mime_type) const = 0;
// What URL was used to access this data?
// Return false if gurl is not present.
virtual bool GetURL(GURL* gurl) const = 0;
// When was this data requested from a server?
virtual base::Time GetRequestTime() const = 0;
// Is data supplied from cache, or fresh across the net?
virtual bool IsCachedContent() const = 0;
// Was this data flagged as a response to a request with an SDCH dictionary?
virtual SdchManager::DictionarySet* SdchDictionariesAdvertised() const = 0;
// How many bytes were read from the net or cache so far (and potentially
// pushed into a filter for processing)?
virtual int64_t GetByteReadCount() const = 0;
// What response code was received with the associated network transaction?
// For example: 200 is ok. 4xx are error codes. etc.
virtual int GetResponseCode() const = 0;
// The URLRequestContext associated with the request.
virtual const URLRequestContext* GetURLRequestContext() const = 0;
// The following method forces the context to emit a specific set of
// statistics as selected by the argument.
virtual void RecordPacketStats(StatisticSelector statistic) const = 0;
// The BoundNetLog of the associated request.
virtual const BoundNetLog& GetNetLog() const = 0;
};
//------------------------------------------------------------------------------
class NET_EXPORT_PRIVATE Filter {
public:
// Return values of function ReadFilteredData.
enum FilterStatus {
// Read filtered data successfully
FILTER_OK,
// Read filtered data successfully, and the data in the buffer has been
// consumed by the filter, but more data is needed in order to continue
// filtering. At this point, the caller is free to reuse the filter
// buffer to provide more data.
FILTER_NEED_MORE_DATA,
// Read filtered data successfully, and filter reaches the end of the data
// stream.
FILTER_DONE,
// There is an error during filtering.
FILTER_ERROR
};
// Specifies type of filters that can be created. Do not change the values
// of this enum; it is preserved in a histogram.
enum FilterType {
FILTER_TYPE_BROTLI,
FILTER_TYPE_DEFLATE,
FILTER_TYPE_GZIP,
FILTER_TYPE_GZIP_HELPING_SDCH, // Gzip possible, but pass through allowed.
FILTER_TYPE_SDCH,
FILTER_TYPE_SDCH_POSSIBLE, // Sdch possible, but pass through allowed.
FILTER_TYPE_UNSUPPORTED,
FILTER_TYPE_MAX
};
virtual ~Filter();
// Creates a Filter object.
// Parameters: Filter_types specifies the type of filter created;
// filter_context allows filters to acquire additional details needed for
// construction and operation, such as a specification of requisite input
// buffer size.
// If success, the function returns the pointer to the Filter object created.
// If failed or a filter is not needed, the function returns NULL.
//
// Note: filter_types is an array of filter types (content encoding types as
// provided in an HTTP header), which will be chained together serially to do
// successive filtering of data. The types in the vector are ordered based on
// encoding order, and the filters are chained to operate in the reverse
// (decoding) order. For example, types[0] = FILTER_TYPE_SDCH,
// types[1] = FILTER_TYPE_GZIP will cause data to first be gunzip filtered,
// and the resulting output from that filter will be sdch decoded.
static std::unique_ptr<Filter> Factory(
const std::vector<FilterType>& filter_types,
const FilterContext& filter_context);
// A simpler version of Factory() which creates a single, unchained
// Filter of type FILTER_TYPE_GZIP, or NULL if the filter could not be
// initialized.
static std::unique_ptr<Filter> GZipFactory();
// External call to obtain data from this filter chain. If ther is no
// next_filter_, then it obtains data from this specific filter.
FilterStatus ReadData(char* dest_buffer, int* dest_len);
// Returns a pointer to the stream_buffer_.
IOBuffer* stream_buffer() const { return stream_buffer_.get(); }
// Returns the maximum size of stream_buffer_ in number of chars.
int stream_buffer_size() const { return stream_buffer_size_; }
// Returns the total number of chars remaining in stream_buffer_ to be
// filtered.
//
// If the function returns 0 then all data has been filtered, and the caller
// is safe to copy new data into stream_buffer_.
int stream_data_len() const { return stream_data_len_; }
// Flushes stream_buffer_ for next round of filtering. After copying data to
// stream_buffer_, the caller should call this function to notify Filter to
// start filtering. Then after this function is called, the caller can get
// post-filtered data using ReadFilteredData. The caller must not write to
// stream_buffer_ and call this function again before stream_buffer_ is
// emptied out by ReadFilteredData.
//
// The input stream_data_len is the length (in number of chars) of valid
// data in stream_buffer_. It can not be greater than stream_buffer_size_.
// The function returns true if success, and false otherwise.
bool FlushStreamBuffer(int stream_data_len);
// Translate the text of a filter name (from Content-Encoding header) into a
// FilterType.
static FilterType ConvertEncodingToType(const std::string& filter_type);
// Given a array of encoding_types, try to do some error recovery adjustment
// to the list. This includes handling known bugs in the Apache server (where
// redundant gzip encoding is specified), as well as issues regarding SDCH
// encoding, where various proxies and anti-virus products modify or strip the
// encodings. These fixups require context, which includes whether this
// response was made to an SDCH request (i.e., an available dictionary was
// advertised in the GET), as well as the mime type of the content.
static void FixupEncodingTypes(const FilterContext& filter_context,
std::vector<FilterType>* encoding_types);
// Returns a string describing the FilterTypes implemented by this filter.
std::string OrderedFilterList() const;
FilterType type() const { return type_id_; }
protected:
friend class BrotliUnitTest;
friend class GZipUnitTest;
friend class SdchFilterChainingTest;
FRIEND_TEST_ALL_PREFIXES(FilterTest, ThreeFilterChain);
explicit Filter(FilterType type_id);
// Filters the data stored in stream_buffer_ and writes the output into the
// dest_buffer passed in.
//
// Upon entry, *dest_len is the total size (in number of chars) of the
// destination buffer. Upon exit, *dest_len is the actual number of chars
// written into the destination buffer.
//
// This function will fail if there is no pre-filter data in the
// stream_buffer_. On the other hand, *dest_len can be 0 upon successful
// return. For example, a decoding filter may process some pre-filter data
// but not produce output yet.
virtual FilterStatus ReadFilteredData(char* dest_buffer, int* dest_len) = 0;
// Copy pre-filter data directly to destination buffer without decoding.
FilterStatus CopyOut(char* dest_buffer, int* dest_len);
FilterStatus last_status() const { return last_status_; }
// Buffer to hold the data to be filtered (the input queue).
scoped_refptr<IOBuffer> stream_buffer_;
// Maximum size of stream_buffer_ in number of chars.
int stream_buffer_size_;
// Pointer to the next data in stream_buffer_ to be filtered.
char* next_stream_data_;
// Total number of remaining chars in stream_buffer_ to be filtered.
int stream_data_len_;
private:
// Allocates and initializes stream_buffer_ and stream_buffer_size_.
void InitBuffer(int size);
// A factory helper for creating filters for within a chain of potentially
// multiple encodings. If a chain of filters is created, then this may be
// called multiple times during the filter creation process. In most simple
// cases, this is only called once. Returns NULL and cleans up (deleting
// filter_list) if a new filter can't be constructed.
static std::unique_ptr<Filter> PrependNewFilter(
FilterType type_id,
const FilterContext& filter_context,
int buffer_size,
std::unique_ptr<Filter> filter_list);
// Helper methods for PrependNewFilter. If initialization is successful,
// they return a fully initialized Filter. Otherwise, return NULL.
static std::unique_ptr<Filter> InitBrotliFilter(FilterType type_id,
int buffer_size);
static std::unique_ptr<Filter> InitGZipFilter(FilterType type_id,
int buffer_size);
static std::unique_ptr<Filter> InitSdchFilter(
FilterType type_id,
const FilterContext& filter_context,
int buffer_size);
// Helper function to empty our output into the next filter's input.
void PushDataIntoNextFilter();
// Constructs a filter with an internal buffer of the given size.
// Only meant to be called by unit tests that need to control the buffer size.
static std::unique_ptr<Filter> FactoryForTests(
const std::vector<FilterType>& filter_types,
const FilterContext& filter_context,
int buffer_size);
// An optional filter to process output from this filter.
std::unique_ptr<Filter> next_filter_;
// Remember what status or local filter last returned so we can better handle
// chained filters.
FilterStatus last_status_;
// The filter type this filter was constructed from.
FilterType type_id_;
DISALLOW_COPY_AND_ASSIGN(Filter);
};
} // namespace net
#endif // NET_FILTER_FILTER_H__
| {
"content_hash": "ff14213918a983e5a9db4e8edbaf375d",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 80,
"avg_line_length": 41.75555555555555,
"alnum_prop": 0.7129678907220153,
"repo_name": "danakj/chromium",
"id": "78b8c34b02e3a8abbc6d624fca3b71ff66cfd9c9",
"size": "13826",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "net/filter/filter.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<!-- The Statistics Tool -->
<h3 class="help-section-title">The Statistics Tool</h3>
<h3 class="help-section-paragraph">
The Lexos Statistics tool provides a basic overview of statistical content
in your collection as an addition to the specific term counts/proportions
available in the Document-Term Matrix (DTM) provided in
<a href="/tokenize"><u>Tokenizer</u></a>.
</h3>
<!-- Options -->
<h3 class="help-section-title">Options</h3>
<ul class="help-section-list" style="list-style-type: none">
<li><b>Generate</b></li>
<h3 class="help-section-paragraph">
The Statistics tool generates data based on all active documents. If you
wish to only analyze specific documents, visit the <a href="/manage"><u>Manage</u></a>
page. If you make changes to any of the following options, be sure to click
the "Generate" button again to see your changes reflected in the results.
</h3>
<li><b>Tokenize</b></li>
<h3 class="help-section-paragraph">
By default Lexos tokenizes by tokens, meaning it splits strings of text
into tokens every time it encounters a space character. For Western languages,
this means that each token generally corresponds to a word. To tokenize
by multiple words, you can increase the n-gram size.
</h3>
<h3 class="help-section-paragraph">
For example given the text: "the dog ran" tokenizing by 1-gram tokens
would produce tokens "the", "dog", "ran". Tokenizing by 2-grams would
count the instances of bi-grams or pairs of words, thus producing tokens
"the dog", "dog ran", and so on.
</h3>
<h3 class="help-section-paragraph">
If you wish to tokenize by characters, Lexos will treat every character
(letters, whitespace, punctuation, etc.) as a separate token. Tokenizing
by 2-gram characters would produce tokens "th","he","e ", and so on.
Tokenizing by characters is best used for non-western languages that don't
have whitespace between tokens such as classical Chinese.
</h3>
<li><b>Cull</b></li>
<h3 class="help-section-paragraph">
"Culling" is a generic term we use for methods of decreasing the number
of terms used to generate the DTM based on statistical criteria (as
opposed to something like applying a stop-word list in Scrubber). Culling
is optional to use in Lexos. Lexos offers two different methods:
</h3>
<h3 class="help-section-paragraph">
"Use the top ___ words": This method takes a slice of the DTM
containing only the top N most frequently occurring terms in the
set of active documents. The default setting is 100, meaning
Tokenizer will generate the DTM using only the top 100 most
frequent terms.
</h3>
<h3 class="help-section-paragraph">
"Must be in ___ documents": This method build the DTM using only
terms that occur in at least N documents. The default setting is
1. If you have 10 active documents and you want to generate the
DTM using only terms that appear in all your active documents,
set the value to 10. <em><b>Note:</b> You can quickly determine
the number of active documents in your workspace as indicated by
the counter in the bottom right corner.</em>
</h3>
</ul>
<!-- Results -->
<h3 class="help-section-title">Results</h3>
<ul class="help-section-list" style="list-style-type: none">
<li><b>Document Sizes</b></li>
<h3 class="help-section-paragraph">
Lexos first shows a box plot visualization that highlights potential
outliers of document size in the collection of active documents.
</h3>
<li><b>Plotly Menu</b></li>
<h3 class="help-section-paragraph">
If you pan over the box plot, you'll notice that a menu appears in the top
right corner.
<ul class="help-section-list">
<li>Zoom: This option allows you to click and drag to zoom in to a
specific part of the graph.</li>
<li>Pan: This option will change the click and drag function to
panning across the graph.</li>
<li>Zoom in and Zoom out: These will automatically zoom to the center
of the graph.</li>
<li>Auto-scale and Reset Axis: These options will zoom all the way out
with the axis reset to fit the window</li>
<li>Toggle spike lines: This option allows you to hover your mouse
over data points and see where they are aligned on the x-axis and
y-axis</li>
<li>Show closest data on hover: If you hover over a data point,
this option will show you the value of the data point (the average
or ratio at that point in the window).</li>
<li>Compare data on hover: If you hover over a data point, this
option will show you the value of the data point and it's corresponding
x-axis value (the location of the term in the token sequence
(starting from 0), along with the average or ratio at that point in the window).</li>
</ul>
</h3>
<li><b>Document Statistics</b></li>
<h3 class="help-section-paragraph">
Statistics generates a table containing the file name, the total term count,
number of distinct terms, the vocabulary density (the distinct terms/the
total terms), and the number of terms occurring once <i>(hapax legomena)</i> for
each document (row). You may generate statistics on all of your active
files or you may select a subset of your active documents by using the
<a href="/manage"><u>Manage</u></a> page.
</h3>
<h3 class="help-section-paragraph">
To sort the table, click on a column header, and either "Ascending" or
"Descending" at the top next to "Order". These results will display
immediately, thus clicking "Generate" is not necessary to reflect these
changes.
</h3>
<li><b>Corpus Statistics</b></li>
<h3 class="help-section-paragraph">
Lexos calculates the average, median, standard deviation, and interquartile
range (IQR) of your documents' sizes (based on term counts). This
information is used to determine if any of the document sizes are anomalously
large or small, that is if any of your document sizes are outliers.
</h3>
<li><b>Standard Error Test</b></li>
<h3 class="help-section-paragraph">
If a value is a certain number of standard deviations away from the mean,
that data point is identified as an outlier. Thus using the standard
error test, Lexos provides a anomaly warning for any document
with a size that is particularly large or small compared to the rest of
your corpus.
</h3>
<li><b>Inquartile Range Test</b></li>
<h3 class="help-section-paragraph">
Using the calculated IQR, Lexos provides a anomaly warning for any document
with a size that is particularly large or small compared to the rest of
your corpus. Outliers are those document sizes that fall below Q1 - 1.5(IQR)
or above Q3 + 1.5(IQR).
</h3>
<h3 class="help-section-paragraph">
You should consider removing outlier documents from subsequent
analyses and/or consider additional cutting of some documents to make
term counts more uniform.provides a anomaly warning for any document with
a size that is particularly large or small compared to the rest of your
corpus. You should consider removing outlier documents from subsequent
analyses and/or consider additional cutting of some documents to make
term counts more uniform.
</h3>
<li><b>Download</b></li>
<h3 class="help-section-paragraph">
The Document Sizes box plot is downloadable in either <code>.svg</code> or
<code>.png</code> format. SVG images are very useful because they scale
well in web browsers.
</h3>
<h3 class="help-section-paragraph">
To download the Document Statistics as a data file, click the "Download"
button and you will get a results <code>.csv</code> file. “CSV” is short
for Comma-Separated Values. In your downloaded file, a comma will serve
as the column delimiter and these files can be opened by other programs
later, e.g., Excel.
</h3>
</ul>
<!-- Examples -->
<h3 class="help-section-title">Examples</h3>
<h3 class="help-section-paragraph">
Visit our GitHub repository for
<a target="_blank" href="https://github.com/WheatonCS/Lexos/tree/master/test/test_suite/Statistics"><u>examples of how to use Statistics</u></a>
as well as other tools.
</h3>
| {
"content_hash": "3da4a9fb254c9d0e84ab498fe1de996e",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 148,
"avg_line_length": 45.45360824742268,
"alnum_prop": 0.6688591517350874,
"repo_name": "WheatonCS/Lexos",
"id": "bafbddc73ca38547334e517edad677ac6fe247fd",
"size": "8822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lexos/frontend/help/statistics-help.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "50151"
},
{
"name": "HTML",
"bytes": "204190"
},
{
"name": "JavaScript",
"bytes": "204167"
},
{
"name": "Python",
"bytes": "855625"
}
],
"symlink_target": ""
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Since when call is used for Function constructor themself new function instance creates
* and then first argument(thisArg) should be ignored
*
* @path ch15/15.3/S15.3_A3_T1.js
* @description First argument is object
*/
//CHECK#1 - does not throw
var f = Function.call(mars, "return name;");
var mars={name:"mars", color:"red", number:4};
var f = Function.call(mars, "this.godname=\"ares\"; return this.color;");
var about_mars = f();
//CHECK#2
if (about_mars !== undefined) {
$ERROR('#2: When applied to the Function object itself, thisArg should be ignored');
}
//CHECK#3
if (this.godname !== "ares" && mars.godname===undefined) {
$ERROR('#3: When applied to the Function object itself, thisArg should be ignored');
}
| {
"content_hash": "f123e7f40a6803f42e66af577cb3b612",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 90,
"avg_line_length": 30.137931034482758,
"alnum_prop": 0.6967963386727689,
"repo_name": "mbrowne/typescript-dci",
"id": "ad10b97e4421c918d2a919a928ca876b1e8f21a0",
"size": "874",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "tests/Fidelity/test262/suite/ch15/15.3/S15.3_A3_T1.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Elixir",
"bytes": "3294"
},
{
"name": "HTML",
"bytes": "7930"
},
{
"name": "JavaScript",
"bytes": "23053088"
},
{
"name": "Shell",
"bytes": "386"
},
{
"name": "TypeScript",
"bytes": "16490923"
}
],
"symlink_target": ""
} |
package org.apache.rocketmq.client.impl.consumer;
import org.apache.rocketmq.client.impl.factory.MQClientInstance;
import org.apache.rocketmq.client.log.ClientLogger;
import org.apache.rocketmq.common.ServiceThread;
import org.slf4j.Logger;
/**
* Rebalance Service
*/
public class RebalanceService extends ServiceThread {
private static long waitInterval =
Long.parseLong(System.getProperty(
"rocketmq.client.rebalance.waitInterval", "20000"));
private final Logger log = ClientLogger.getLog();
private final MQClientInstance mqClientFactory;
public RebalanceService(MQClientInstance mqClientFactory) {
this.mqClientFactory = mqClientFactory;
}
@Override
public void run() {
log.info(this.getServiceName() + " service started");
while (!this.isStopped()) {
this.waitForRunning(waitInterval);
this.mqClientFactory.doRebalance();
}
log.info(this.getServiceName() + " service end");
}
@Override
public String getServiceName() {
return RebalanceService.class.getSimpleName();
}
}
| {
"content_hash": "1061c6ebca743a811bbf635213a09a62",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 64,
"avg_line_length": 28.76923076923077,
"alnum_prop": 0.696969696969697,
"repo_name": "dongeforever/incubator-rocketmq",
"id": "c4d2951aba8bce0669d006382046ff3b77695d76",
"size": "1923",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2884228"
},
{
"name": "Shell",
"bytes": "33607"
}
],
"symlink_target": ""
} |
package com.jimulabs.motionkit;
import android.content.Context;
/**
* Wrap an arbitrary object to use {@link com.jimulabs.motionkit.MirrorAnimator}
*
* Created by lintonye on 2014-12-21.
*/
public class MirrorWrap {
private final Object mWrapped;
private final Context mContext;
public MirrorWrap(Context context, Object obj) {
mContext = context;
mWrapped = obj;
}
public MirrorAnimator animator(String property, int... values) {
return MotionKit.animator(mWrapped, property, values);
}
public MirrorAnimator animator(String property, float... values) {
return MotionKit.animator(mWrapped, property, values);
}
}
| {
"content_hash": "b4237cdabbf4753b956724885dc1365c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 80,
"avg_line_length": 25.48148148148148,
"alnum_prop": 0.6947674418604651,
"repo_name": "jimulabs/motion-kit",
"id": "e668091172ef124ff63d223f3d16893cab05fc83",
"size": "688",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/src/main/java/com/jimulabs/motionkit/MirrorWrap.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "23705"
}
],
"symlink_target": ""
} |
#ifndef RECODEX_WORKER_INTERNAL_EXTRACT_TASK_H
#define RECODEX_WORKER_INTERNAL_EXTRACT_TASK_H
#include "tasks/task_base.h"
/**
* Extract archive using @ref archivator. Requires 2 arguments - archive name and directory to extract to.
*/
class extract_task : public task_base
{
public:
/**
* Constructor with initialization.
* @param id Unique identificator of load order of tasks.
* @param task_meta Variable containing further info about task. It's required that
* @a cmd_args entry has just 2 arguments - archive name and directory to extract to.
* For more info about archivation see @ref archivator class.
* @throws task_exception on invalid number of arguments.
*/
extract_task(std::size_t id, std::shared_ptr<task_metadata> task_meta);
/**
* Destructor.
*/
~extract_task() override = default;
/**
* Run the action.
* @return Evaluation results to be pushed back to frontend.
*/
std::shared_ptr<task_results> run() override;
};
#endif // RECODEX_WORKER_INTERNAL_EXTRACT_TASK_H
| {
"content_hash": "38187e5b3930f15fc84dca0ce971966b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 106,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.7227138643067846,
"repo_name": "ReCodEx/worker",
"id": "7030ed6759a62ac5c145c83117741e0f6a2e4923",
"size": "1017",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tasks/internal/extract_task.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5689"
},
{
"name": "C",
"bytes": "18812"
},
{
"name": "C++",
"bytes": "517607"
},
{
"name": "CMake",
"bytes": "19150"
},
{
"name": "Shell",
"bytes": "5972"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Scaled Units</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Units 1.1.0">
<link rel="up" href="../Units.html" title="Units">
<link rel="prev" href="scaled_base_units.html" title="Scaled Base Units">
<link rel="next" href="../Quantities.html" title="Quantities">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="scaled_base_units.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../Units.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../Quantities.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_units.Units.scaled_units"></a><a class="link" href="scaled_units.html" title="Scaled Units">Scaled Units</a>
</h3></div></div></div>
<p>
We can also scale a <span class="underline"><code class="computeroutput"><a class="link" href="../../boost/units/unit.html" title="Class template unit">unit</a></code></span>
as a whole, rather than scaling the individual base units which comprise
it. For this purpose, we use the metafunction <span class="underline"><code class="computeroutput"><a class="link" href="../../boost/units/make_scaled_unit.html" title="Struct template make_scaled_unit">make_scaled_unit</a></code></span>.
The main motivation for this feature is the metric prefixes defined in <code class="computeroutput"><a class="link" href="../../header/boost/units/systems/si/prefixes_hpp.html" title="Header <boost/units/systems/si/prefixes.hpp>">boost/units/systems/si/prefixes.hpp</a></code>.
</p>
<p>
A simple example of its usage would be.
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">make_scaled_unit</span><span class="special"><</span><span class="identifier">si</span><span class="special">::</span><span class="identifier">time</span><span class="special">,</span> <span class="identifier">scale</span><span class="special"><</span><span class="number">10</span><span class="special">,</span> <span class="identifier">static_rational</span><span class="special"><-</span><span class="number">9</span><span class="special">></span> <span class="special">></span> <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">nanosecond</span><span class="special">;</span>
</pre>
<p>
nanosecond is a specialization of <span class="underline"><code class="computeroutput"><a class="link" href="../../boost/units/unit.html" title="Class template unit">unit</a></code></span>,
and can be used in a quantity normally.
</p>
<pre class="programlisting"><span class="identifier">quantity</span><span class="special"><</span><span class="identifier">nanosecond</span><span class="special">></span> <span class="identifier">t</span><span class="special">(</span><span class="number">1.0</span> <span class="special">*</span> <span class="identifier">si</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1e9 ns</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2008 Matthias Christian Schabel<br>Copyright © 2007-2010 Steven
Watanabe<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="scaled_base_units.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../Units.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../Quantities.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "ddb4680bb31f86a0455573a894e4cc07",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 731,
"avg_line_length": 91.12903225806451,
"alnum_prop": 0.6504424778761062,
"repo_name": "hsu1994/Terminator",
"id": "583823342fa95298c04ddf22eb1c7817f7cfaeb7",
"size": "5650",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Server/RelyON/boost_1_61_0/libs/units/doc/html/boost_units/Units/scaled_units.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "223360"
},
{
"name": "Batchfile",
"bytes": "43670"
},
{
"name": "C",
"bytes": "3717232"
},
{
"name": "C#",
"bytes": "12172138"
},
{
"name": "C++",
"bytes": "188465965"
},
{
"name": "CMake",
"bytes": "119765"
},
{
"name": "CSS",
"bytes": "430770"
},
{
"name": "Cuda",
"bytes": "52444"
},
{
"name": "DIGITAL Command Language",
"bytes": "6246"
},
{
"name": "FORTRAN",
"bytes": "1856"
},
{
"name": "GLSL",
"bytes": "143058"
},
{
"name": "Groff",
"bytes": "5189"
},
{
"name": "HTML",
"bytes": "234253948"
},
{
"name": "IDL",
"bytes": "14"
},
{
"name": "JavaScript",
"bytes": "694216"
},
{
"name": "Lex",
"bytes": "1231"
},
{
"name": "M4",
"bytes": "29689"
},
{
"name": "Makefile",
"bytes": "1459789"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "Objective-C",
"bytes": "15456"
},
{
"name": "Objective-C++",
"bytes": "630"
},
{
"name": "PHP",
"bytes": "59030"
},
{
"name": "Perl",
"bytes": "38649"
},
{
"name": "Perl6",
"bytes": "2053"
},
{
"name": "Protocol Buffer",
"bytes": "409987"
},
{
"name": "Python",
"bytes": "1764372"
},
{
"name": "QML",
"bytes": "593"
},
{
"name": "QMake",
"bytes": "16692"
},
{
"name": "Rebol",
"bytes": "354"
},
{
"name": "Ruby",
"bytes": "5532"
},
{
"name": "Shell",
"bytes": "362208"
},
{
"name": "Smalltalk",
"bytes": "2796"
},
{
"name": "Tcl",
"bytes": "1172"
},
{
"name": "TeX",
"bytes": "32117"
},
{
"name": "XSLT",
"bytes": "265714"
},
{
"name": "Yacc",
"bytes": "19623"
}
],
"symlink_target": ""
} |
<?php
require_once(__DIR__."/Skill.php");
final class God {
public $_id = 0;
public $_name = "";
public $_title = "";
public $_pantheon = "";
public $_picture = "";
public $_skills = Array();
// Constructs God from a dataset loaded from official SMITE API
public function __construct($data) {
$this->_id = $data["id"];
$this->_name = $data["Name"];
$this->_title = $data["Title"];
$this->_pantheon = $data["Pantheon"];
// Skills
for($i = 1; $i <= 5; ++$i) {
$newSkill = new Skill($data['AbilityId'.$i], $data['Ability'.$i], $data['abilityDescription'.$i]['itemDescription']['description'], $i);
$this->_skills[$newSkill->_type] = $newSkill;
}
}
// Generates an array that can be easily JSON-encoded
public function json($small = false) {
if($small !== true)
$small = false;
// Small JSON object
if($small)
return Array(
"id" => $this->_id,
"name" => $this->_name,
"title" => $this->_title,
"picture" => $this->_picture,
);
// Complete JSON object
return Array(
"id" => $this->_id,
"name" => $this->_name,
"title" => $this->_title,
"pantheon" => $this->_pantheon,
"picture" => $this->_picture,
"skills" => $this->skillsJson(),
);
}
private function skillsJson() {
$result = Array();
$skills = $this->_skills;
foreach($skills as $key => $value)
$result[$key] = $value->json();
return $result;
}
} | {
"content_hash": "697915a827f4e1ef1285cda89ecbf132",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 139,
"avg_line_length": 23.234375,
"alnum_prop": 0.5366509751176867,
"repo_name": "Chorizorro/Smitroll",
"id": "67daf54d93c69e854de80624e0ef6aa5153b1f20",
"size": "1487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "App/Models/God.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "23101"
},
{
"name": "JavaScript",
"bytes": "39103"
},
{
"name": "PHP",
"bytes": "144804"
}
],
"symlink_target": ""
} |
/*
* Desarrollador por: Diego Hernández
*
*
*/
jQuery(document).ready(function(){
jQuery("#BtnIngresar").click(function(event)
{
ValidarIngreso();
});
});
function ValidarIngreso(){
jQuery.ajax({
dataType: 'html',
cache: false,
data: jQuery("#frmlogin").serialize(),
url: '../includes/login.php',
type: 'post',
beforeSend: function () {
jQuery('#MensajeNotificar').fadeIn(1000);
},
success: function (response) {
if (jQuery.trim(response)=="OK"){
//window.location.href = "Paginas/FrmCapacitacion.php";
window.location.href = "prmReporte.php";
}else{
jQuery('#msn').text(response);
}
}
});
}
| {
"content_hash": "8e894f7987b8e58b6554ec11f37d65d7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 24.358974358974358,
"alnum_prop": 0.42947368421052634,
"repo_name": "crianbluff-programming/ciudadplacer",
"id": "12e3413058653e193437a5cd4a946ba1b3d5cb11",
"size": "951",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dist/js/Diego/login.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "CSS",
"bytes": "208534"
},
{
"name": "HTML",
"bytes": "296354"
},
{
"name": "JavaScript",
"bytes": "576793"
},
{
"name": "PHP",
"bytes": "4272124"
},
{
"name": "Shell",
"bytes": "149"
}
],
"symlink_target": ""
} |
import React, { Component } from 'react';
import logo from './img/logo.svg';
import './AppHeader.css';
class AppHeader extends Component {
render() {
return (
<div className="App-header">
<img src={ logo } className="App-logo" alt="logo" />
<h2>React Chat</h2>
</div>
);
}
}
export default AppHeader;
| {
"content_hash": "6fe46193d9b1e9deb3171b828f6e00e6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 68,
"avg_line_length": 21.38888888888889,
"alnum_prop": 0.5324675324675324,
"repo_name": "renesansz/presentations",
"id": "30fb560a6a6f835fb6556cbf47bfd07275bdc6d1",
"size": "385",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "react-chat/src/components/AppHeader/AppHeader.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3247"
},
{
"name": "HTML",
"bytes": "7321"
},
{
"name": "JavaScript",
"bytes": "17587"
},
{
"name": "SCSS",
"bytes": "4809"
}
],
"symlink_target": ""
} |
using System.Text.Json;
using Azure.Core;
namespace Azure.ResourceManager.Cdn.Models
{
public partial class FrontDoorPurgeContent : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
writer.WriteStartObject();
writer.WritePropertyName("contentPaths");
writer.WriteStartArray();
foreach (var item in ContentPaths)
{
writer.WriteStringValue(item);
}
writer.WriteEndArray();
if (Optional.IsCollectionDefined(Domains))
{
writer.WritePropertyName("domains");
writer.WriteStartArray();
foreach (var item in Domains)
{
writer.WriteStringValue(item);
}
writer.WriteEndArray();
}
writer.WriteEndObject();
}
}
}
| {
"content_hash": "f06de40a21fb546be352945d541b62c2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 30.129032258064516,
"alnum_prop": 0.5428265524625268,
"repo_name": "Azure/azure-sdk-for-net",
"id": "d79dec149bb81d36066d8b317ebdde2a3bd585d4",
"size": "1072",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.Serialization.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20170712_1744'),
]
operations = [
migrations.RemoveField(
model_name='userinfo',
name='integer_id',
),
migrations.AddField(
model_name='userinfo',
name='int_id',
field=models.CharField(blank=True, default='', max_length=8),
),
]
| {
"content_hash": "e201919370c43993a3d0233da40dd1d1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 23,
"alnum_prop": 0.5612648221343873,
"repo_name": "wangjinyu/api_server",
"id": "e5a6622784052846eba58c1f84895d24bd519592",
"size": "579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/migrations/0003_auto_20170712_1752.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "46518"
},
{
"name": "JavaScript",
"bytes": "97398"
},
{
"name": "Python",
"bytes": "11310"
},
{
"name": "Shell",
"bytes": "1370"
}
],
"symlink_target": ""
} |
package com.utabitwallet.presenter.fragments;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.utabitwallet.R;
import com.utabitwallet.wallet.BRWalletManager;
public class IntroWarningFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
// The last two arguments ensure LayoutParams are inflated
// properly.
View rootView = inflater.inflate(
R.layout.intro_fragment_warning, container, false);
Button show = (Button) rootView.findViewById(R.id.intro_warning_show_button);
show.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BRWalletManager.getInstance(getActivity()).animateSavePhraseFlow();
getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
return rootView;
}
}
| {
"content_hash": "67f85304f6fa10edb8d99b0732be52b6",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 89,
"avg_line_length": 32.8,
"alnum_prop": 0.681184668989547,
"repo_name": "mmmce1994/wallet98",
"id": "850fd15ea5c73ff2523435ecfd3e6468fcebbb9e",
"size": "2366",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/utabitwallet/presenter/fragments/IntroWarningFragment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "28457"
},
{
"name": "C",
"bytes": "1380468"
},
{
"name": "C++",
"bytes": "75086"
},
{
"name": "Java",
"bytes": "2404598"
},
{
"name": "M4",
"bytes": "25931"
},
{
"name": "Makefile",
"bytes": "5545"
},
{
"name": "Objective-C",
"bytes": "7332"
},
{
"name": "Python",
"bytes": "30191"
},
{
"name": "Shell",
"bytes": "47"
}
],
"symlink_target": ""
} |
package org.jenkinsci.plugins.ghprb.manager.impl.downstreambuilds;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkinsci.plugins.ghprb.manager.impl.GhprbBaseBuildManager;
import org.jenkinsci.plugins.ghprb.manager.configuration.JobConfiguration;
import org.jgrapht.DirectedGraph;
import com.cloudbees.plugins.flow.FlowRun;
import com.cloudbees.plugins.flow.JobInvocation;
import hudson.model.AbstractBuild;
import hudson.tasks.test.AggregatedTestResultAction;
/**
* @author mdelapenya (Manuel de la Peña)
*/
public class BuildFlowBuildManager extends GhprbBaseBuildManager {
private static final Logger logger = Logger.getLogger(BuildFlowBuildManager.class.getName());
public BuildFlowBuildManager(AbstractBuild build) {
super(build);
}
public BuildFlowBuildManager(AbstractBuild build, JobConfiguration jobConfiguration) {
super(build, jobConfiguration);
}
/**
* Calculate the build URL of a build of BuildFlow type, traversing its
* downstream builds graph
*
* @return the build URL of a BuildFlow build, with all its downstream builds
*/
@Override
public String calculateBuildUrl() {
Iterator<JobInvocation> iterator = downstreamProjects();
StringBuilder sb = new StringBuilder();
while (iterator.hasNext()) {
JobInvocation jobInvocation = iterator.next();
sb.append("\n");
sb.append("<a href='");
sb.append(jobInvocation.getBuildUrl());
sb.append("'>");
sb.append(jobInvocation.getBuildUrl());
sb.append("</a>");
}
return sb.toString();
}
/**
* Return a downstream iterator of a build of default type. This will be overriden
* by specific build types.
*
* @return the downstream builds as an iterator
*/
@Override
public Iterator downstreamProjects() {
FlowRun flowRun = (FlowRun) build;
DirectedGraph directedGraph = flowRun.getJobsGraph();
return directedGraph.vertexSet().iterator();
}
/**
* Return the tests results of a build of default type. This will be overriden
* by specific build types.
*
* @return the tests result of a build of default type
*/
@Override
public String getTestResults() {
Iterator<JobInvocation> iterator = downstreamProjects();
StringBuilder sb = new StringBuilder();
while (iterator.hasNext()) {
JobInvocation jobInvocation = iterator.next();
try {
AbstractBuild build = (AbstractBuild)jobInvocation.getBuild();
AggregatedTestResultAction testResultAction =
build.getAction(AggregatedTestResultAction.class);
if (testResultAction != null) {
sb.append("\n");
sb.append(jobInvocation.getBuildUrl());
sb.append("\n");
sb.append(getAggregatedTestResults(build));
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Job execution has failed", e);
}
}
return sb.toString();
}
}
| {
"content_hash": "a9b57f502b49ac489676bae30d66a46b",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 94,
"avg_line_length": 26.137614678899084,
"alnum_prop": 0.7318357318357318,
"repo_name": "arduino/ghprb-plugin",
"id": "682c3bfe51a88a6003da685d7c28d8d584be7c42",
"size": "2850",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/main/java/org/jenkinsci/plugins/ghprb/manager/impl/downstreambuilds/BuildFlowBuildManager.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3613"
},
{
"name": "Java",
"bytes": "168649"
}
],
"symlink_target": ""
} |
create table person(
name VARCHAR(30),
age INT
);
create table address(
person VARCHAR(30),
/* test */
street VARCHAR(30)
);
// data
insert into person(name,age) values('fredde',44);
insert into person(name,age) values('fredde;kivi',44); | {
"content_hash": "99c529051d8eb55a1061198c58ffc061",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 17.428571428571427,
"alnum_prop": 0.6967213114754098,
"repo_name": "ugli/habanero-java",
"id": "a6ec6420586a18553776ee58ac54f3fe23c5bd83",
"size": "244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/resources/scripttest.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "118346"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>simple-io: 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.7.0 / simple-io - 1.3.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
simple-io
<small>
1.3.0
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-07-31 07:04:33 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-07-31 07:04:33 UTC)</em><p>
<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.12 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.7.0 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
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Li-yao Xia <lysxia@gmail.com>"
authors: "Li-yao Xia"
homepage: "https://github.com/Lysxia/coq-simple-io"
bug-reports: "https://github.com/Lysxia/coq-simple-io/issues"
license: "MIT"
dev-repo: "git+https://github.com/Lysxia/coq-simple-io.git"
build: [make "build"]
run-test: [make "test"]
install: [make "install"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.12~"}
"coq-ext-lib"
"ocamlbuild" {with-test}
]
tags: [
"date:2020-03-08"
"logpath:SimpleIO"
"keyword:extraction"
"keyword:effects"
]
synopsis: "IO monad for Coq"
description: """
This library provides tools to implement IO programs directly in Coq, in a
similar style to Haskell. Facilities for formal verification are not included.
IO is defined as a parameter with a purely functional interface in Coq,
to be extracted to OCaml. Some wrappers for the basic types and functions in
the OCaml Pervasives module are provided. Users are free to define their own
APIs on top of this IO type."""
url {
src: "https://github.com/Lysxia/coq-simple-io/archive/1.3.0.tar.gz"
checksum: "sha512=bcf7746e7877c4672e509e8c80db28b93cffbb064e114cf4df4465d9be3d55274c84a7406b38eaf510deda8a2574e42f3b40c8f716841bd92557e7b59d86e7cb"
}
</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-simple-io.1.3.0 coq.8.7.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.7.0).
The following dependencies couldn't be met:
- coq-simple-io -> coq >= 8.8
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-simple-io.1.3.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "f591edbec7fd8e358c96d8981ab9dafd",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 159,
"avg_line_length": 41.19318181818182,
"alnum_prop": 0.5550344827586207,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "6352d0148e751cbea74202c3a8697ee3db46970a",
"size": "7252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.6/released/8.7.0/simple-io/1.3.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
/**
* Class cache_warmup_generator_pages.
*/
class cache_warmup_generator_pages extends cache_warmup_generator
{
/**
* Generate cache for given items.
*
* @return array
*/
public function generateCache(array $items)
{
if (rex_addon::get('structure')->isAvailable()) {
foreach ($items as $item) {
[$article_id, $clang] = $item;
// generate content
$article = new rex_article_content($article_id, $clang);
$article->getArticleTemplate();
// generate meta
rex_article_cache::generateMeta($article_id, $clang);
// generate lists
rex_article_cache::generateLists($article_id);
}
}
return $items;
}
}
| {
"content_hash": "14fb17f1f952b9de1cab4b08bc44061f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 72,
"avg_line_length": 25.59375,
"alnum_prop": 0.5225885225885226,
"repo_name": "FriendsOfREDAXO/cache-warmup",
"id": "263e0ec2cd7fa96e431f139fa4ff058f7241ec9b",
"size": "819",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "lib/generator_pages.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "137"
},
{
"name": "JavaScript",
"bytes": "1554"
},
{
"name": "PHP",
"bytes": "19433"
}
],
"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 Tue Feb 18 20:36:05 PST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.spdx.tools Class Hierarchy (SPDX tools 1.2.5 API)</title>
<meta name="date" content="2014-02-18">
<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="org.spdx.tools Class Hierarchy (SPDX tools 1.2.5 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/spdx/tag/package-tree.html">Prev</a></li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/spdx/tools/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">Hierarchy For Package org.spdx.tools</h1>
<span class="strong">Package Hierarchies:</span>
<ul class="horizontal">
<li><a href="../../../overview-tree.html">All Packages</a></li>
</ul>
</div>
<div class="contentContainer">
<h2 title="Class Hierarchy">Class Hierarchy</h2>
<ul>
<li type="circle">java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><span class="strong">Object</span></a>
<ul>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/CompareMultpleSpdxDocs.html" title="class in org.spdx.tools"><span class="strong">CompareMultpleSpdxDocs</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/CompareSpdxDocs.html" title="class in org.spdx.tools"><span class="strong">CompareSpdxDocs</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/GenerateVerificationCode.html" title="class in org.spdx.tools"><span class="strong">GenerateVerificationCode</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/LicenseRDFAGenerator.html" title="class in org.spdx.tools"><span class="strong">LicenseRDFAGenerator</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/Main.html" title="class in org.spdx.tools"><span class="strong">Main</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/PrettyPrinter.html" title="class in org.spdx.tools"><span class="strong">PrettyPrinter</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/RdfToHtml.html" title="class in org.spdx.tools"><span class="strong">RdfToHtml</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/RdfToSpreadsheet.html" title="class in org.spdx.tools"><span class="strong">RdfToSpreadsheet</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/RdfToTag.html" title="class in org.spdx.tools"><span class="strong">RdfToTag</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/SpdxViewer.html" title="class in org.spdx.tools"><span class="strong">SpdxViewer</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/SpreadsheetToRDF.html" title="class in org.spdx.tools"><span class="strong">SpreadsheetToRDF</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/SpreadsheetToTag.html" title="class in org.spdx.tools"><span class="strong">SpreadsheetToTag</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/TagToRDF.html" title="class in org.spdx.tools"><span class="strong">TagToRDF</span></a></li>
<li type="circle">org.spdx.tools.<a href="../../../org/spdx/tools/TagToSpreadsheet.html" title="class in org.spdx.tools"><span class="strong">TagToSpreadsheet</span></a></li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/spdx/tag/package-tree.html">Prev</a></li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/spdx/tools/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014 <a href="http://www.linuxfoundation.org">Linux Foundation</a>. All Rights Reserved.</small></p>
</body>
</html>
| {
"content_hash": "5e62d2ba34673621bb17617b9c412c34",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 196,
"avg_line_length": 47.01398601398601,
"alnum_prop": 0.6474788041053101,
"repo_name": "spdx/tools",
"id": "38e1c0df5a9543a6b9b6127b96c4c81c09e51336",
"size": "6723",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "doc/org/spdx/tools/package-tree.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GAP",
"bytes": "2056"
},
{
"name": "HTML",
"bytes": "24821"
},
{
"name": "Java",
"bytes": "3412310"
}
],
"symlink_target": ""
} |
@interface AHKActionSheetViewController ()
@property (nonatomic) BOOL viewAlreadyAppear;
@end
@implementation AHKActionSheetViewController
#pragma mark - UIViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:self.actionSheet];
self.actionSheet.frame = self.view.bounds;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.viewAlreadyAppear = YES;
}
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
self.actionSheet.frame = self.view.bounds;
}
- (BOOL)shouldAutorotate
{
// doesn't allow autorotation after the view did appear (rotation messes up a blurred background)
return !self.viewAlreadyAppear;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
UIWindow *window = self.actionSheet.previousKeyWindow;
if (!window) {
window = [[UIApplication sharedApplication].windows firstObject];
}
return [[window ahk_viewControllerForStatusBarStyle] preferredStatusBarStyle];
}
- (BOOL)prefersStatusBarHidden
{
UIWindow *window = self.actionSheet.previousKeyWindow;
if (!window) {
window = [[UIApplication sharedApplication].windows firstObject];
}
return [[window ahk_viewControllerForStatusBarHidden] prefersStatusBarHidden];
}
@end
| {
"content_hash": "72b3204ad10321afc75f1dec9c36b63f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 101,
"avg_line_length": 23.3,
"alnum_prop": 0.7496423462088698,
"repo_name": "Jasonette/JASONETTE-iOS",
"id": "b39959ef4598820ac6325c2f9389fd13abf1c483",
"size": "1671",
"binary": false,
"copies": "5",
"ref": "refs/heads/develop",
"path": "app/Pods/AHKActionSheet/Classes/AHKActionSheetViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "202"
},
{
"name": "JavaScript",
"bytes": "2161845"
},
{
"name": "Objective-C",
"bytes": "628099"
},
{
"name": "Ruby",
"bytes": "1491"
},
{
"name": "Shell",
"bytes": "22209"
}
],
"symlink_target": ""
} |
.. _lab12:
Lab 12: Thursday May 8, 2014
=============================
Programming problem
---------------------------
Work on this in groups!
#. In Lab 11 you worked on a program to compute the mean of n random
numbers. A sample solution can be found at `$UWHPSC/labs/lab11/mean.f90`.
Write a Fortran program that runs over different values of `n`,
and for each `n` generates a vector `x` containing `n` random numbers
and then computes the mean of these. Also compute the fraction of the
numbers that lie in the first quartile (the fraction of `x(i)` values
that are between 0 and 0.25) and the fraction that lie in the fourth
quartile (between 0.75 and 1.0). Since the `random_number` routine
returns numbers uniformly distributed between 0 and 1, we expect each of
these fractions to be about 0.25.
Use OpenMP to make the loop on `i` from 1 to `n` into a parallel do loop.
Running this code should give something like this if you take as the `n`
values :math:`n = 10^k` for :math:`k=2,3,\ldots,8`::
Number of threads: 2
input seed
12345
seed1 for random number generator: 12345
n mean quartile 1 quartile 4
100 0.51902466 0.22000000 0.24000000
1000 0.47476778 0.27800000 0.22500000
10000 0.49606601 0.25670000 0.25190000
100000 0.50121669 0.24815000 0.25130000
1000000 0.50001034 0.24986300 0.24979800
10000000 0.49998532 0.24994350 0.24992770
100000000 0.49995944 0.25003764 0.24995608
#. If you haven't already, study the code in
`$UWHPSC/codes/openmp/pisum2.f90`
and make sure you understand how this coarse grain parallelism works.
Discuss with your neighbors.
#. If you have time, try to follow this model to make your code that
computes the mean and quartiles work in a similar manner, where you
break up the different values of `n` to be tested between different
threads, e.g. in the above example one thread would take the
first three values of `n` and the second thread would take the final
two values of `n`.
#. Discuss with your neighbors whether this is a sensible way to try
to use two threads on this problem.
#. There is a quiz for this lab.
#. Sample solutions can now be found in `$UWHPSC/labs/lab12`.
| {
"content_hash": "d6cad36012f354ae2de43e57764c7ac1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 77,
"avg_line_length": 39.693548387096776,
"alnum_prop": 0.6452661519707436,
"repo_name": "philipwangdk/HPC",
"id": "4ff25b24bded05628b506480b1ebee0d40c29236",
"size": "2463",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "HPC_bitbucket/uwhpsc/notes/labs/lab12.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "32896"
},
{
"name": "FORTRAN",
"bytes": "487910"
},
{
"name": "HTML",
"bytes": "650446"
},
{
"name": "Jupyter Notebook",
"bytes": "2457572"
},
{
"name": "Makefile",
"bytes": "35506"
},
{
"name": "Python",
"bytes": "163282"
},
{
"name": "Shell",
"bytes": "7140"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: xuansw
* Date: 2017/10/21
* Time: 16:27
*/
namespace Camunda\Entity\Request;
class DecisionDefinitionRequest extends BasicRequest
{
protected $fields = [
'decisionDefinitionId',
'decisionDefinitionIdIn',
'name',
'nameLike',
'deploymentId',
'key',
'keyLike',
'category',
'categoryLike',
'version',
'latestVersion',
'resourceName',
'resourceNameLike',
'decisionRequirementsDefinitionId',
'decisionRequirementsDefinitionKey',
'withoutDecisionRequirementsDefinition',
'tenantIdIn',
'withoutTenantId',
'includeDecisionDefinitionsWithoutTenantId',
'sortBy',
'sortOrder',
'firstResult',
'maxResults',
'variables',
'historyTimeToLive'
];
} | {
"content_hash": "e2f124641fc928ebc83f06a7f156317d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 52,
"avg_line_length": 22.175,
"alnum_prop": 0.5828635851183765,
"repo_name": "endpot/camunda-rest-client",
"id": "528035591d2c0d47e92f7a3c604703582cef7f23",
"size": "887",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Entity/Request/DecisionDefinitionRequest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "134665"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Régner Henrique"/>
<meta name="contact" content="regnerhenrique@hotmail.com"/>
<meta name="description" content="Cascading Dropdownlist Javascript JQuery"/>
<meta name="keywords" content="Cascading, Dropdownlist, Javascript, JQuery"/>
<meta http-equiv="content-language" content="pt-br" />
<title>Cascading Dropdownlist</title>
<script type="text/javascript" src="Script/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="Script/cascadingDropdownlist.js"></script>
</head>
<body>
<div id="estado">
<label>Estados: </label>
<select></select>
</div>
<div id="cidade">
<label>Cidades: </label>
<select></select>
</div>
</body>
</html> | {
"content_hash": "419ea8e20d958fe644338a9685085a05",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 82,
"avg_line_length": 32.03846153846154,
"alnum_prop": 0.617046818727491,
"repo_name": "regnerhenrique/CascadingDropdownlist",
"id": "add94f8138999fa8ccf4fcffc3cccaa29ba9bcd4",
"size": "834",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CascadingDropdownlist/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "834"
},
{
"name": "JavaScript",
"bytes": "1114"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Deck
{
public enum CardSuit
{
Club,
Diamond,
Heart,
Spade,
}
} | {
"content_hash": "5c665a836251421a4e31092d15ef83a3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 33,
"avg_line_length": 14.625,
"alnum_prop": 0.6282051282051282,
"repo_name": "TeeeeeC/TelerikAcademy2015-2016",
"id": "e0e9d9e3d7b325246bcab6fdbaa627e61f1d9921",
"size": "236",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "08. High Quality Code/10. Unit Testing/Deck/CardSuit.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "232682"
},
{
"name": "Batchfile",
"bytes": "37"
},
{
"name": "C#",
"bytes": "2815743"
},
{
"name": "CSS",
"bytes": "130421"
},
{
"name": "CoffeeScript",
"bytes": "273"
},
{
"name": "HTML",
"bytes": "418767"
},
{
"name": "JavaScript",
"bytes": "2667613"
},
{
"name": "Smalltalk",
"bytes": "3"
},
{
"name": "XSLT",
"bytes": "5026"
}
],
"symlink_target": ""
} |
<?php
/**
* @see Zend_Tool_Project_Context_Filesystem_Directory
*/
require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php';
/**
* This class is the front most class for utilizing Zend_Tool_Project
*
* A profile is a hierarchical set of resources that keep track of
* items within a specific project.
*
* @category Zend
* @package Zend_Tool
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Project_Context_Zf_TestApplicationControllerDirectory extends Zend_Tool_Project_Context_Filesystem_Directory
{
/**
* @var string
*/
protected $_filesystemName = 'controllers';
/**
* getName()
*
* @return string
*/
public function getName()
{
return 'TestApplicationControllerDirectory';
}
} | {
"content_hash": "58d33696454a2e764b13765d960a52a6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 124,
"avg_line_length": 23.86842105263158,
"alnum_prop": 0.6758544652701213,
"repo_name": "sandsmedia/zf",
"id": "c6e04757d6da05447f1c06a242e69adeb1e112c4",
"size": "1622",
"binary": false,
"copies": "9",
"ref": "refs/heads/trunk",
"path": "library/Zend/Tool/Project/Context/Zf/TestApplicationControllerDirectory.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "30072"
},
{
"name": "PHP",
"bytes": "30457193"
},
{
"name": "Shell",
"bytes": "6541"
}
],
"symlink_target": ""
} |
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**start** | **string** | | [optional]
**end** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
| {
"content_hash": "3142440b09c3f13510925a068fbd5fde",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 161,
"avg_line_length": 42.25,
"alnum_prop": 0.514792899408284,
"repo_name": "chrishemmings/electio",
"id": "cc906015314c80429bbcbbd3bc0d4f286532e128",
"size": "370",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/Model/DeliveryWindow.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "714333"
},
{
"name": "Shell",
"bytes": "358"
}
],
"symlink_target": ""
} |
#region Apache Notice
#endregion
using System;
namespace IBatisNet.DataAccess.Interfaces
{
/// <summary>
/// Mark a class as a Dao object.
/// </summary>
public interface IDao
{
}
}
| {
"content_hash": "3864b21af54c7030ef9247ec93345b34",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 41,
"avg_line_length": 11.470588235294118,
"alnum_prop": 0.6717948717948717,
"repo_name": "cavajtennis/ibatis",
"id": "300285afb65c506a700297347e5e95ecb93ca8c8",
"size": "1036",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cs/mapper/IBatisNet.DataAccess/Interfaces/IDao.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "115781"
},
{
"name": "C#",
"bytes": "1658192"
},
{
"name": "Java",
"bytes": "1071471"
},
{
"name": "JavaScript",
"bytes": "10071"
},
{
"name": "Shell",
"bytes": "334"
},
{
"name": "XML",
"bytes": "91927"
}
],
"symlink_target": ""
} |
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "status_models_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace apache { namespace airavata { namespace model { namespace status {
int _kExperimentStateValues[] = {
ExperimentState::CREATED,
ExperimentState::VALIDATED,
ExperimentState::SCHEDULED,
ExperimentState::LAUNCHED,
ExperimentState::EXECUTING,
ExperimentState::CANCELING,
ExperimentState::CANCELED,
ExperimentState::COMPLETED,
ExperimentState::FAILED
};
const char* _kExperimentStateNames[] = {
"CREATED",
"VALIDATED",
"SCHEDULED",
"LAUNCHED",
"EXECUTING",
"CANCELING",
"CANCELED",
"COMPLETED",
"FAILED"
};
const std::map<int, const char*> _ExperimentState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(9, _kExperimentStateValues, _kExperimentStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kTaskStateValues[] = {
TaskState::CREATED,
TaskState::EXECUTING,
TaskState::COMPLETED,
TaskState::FAILED,
TaskState::CANCELED
};
const char* _kTaskStateNames[] = {
"CREATED",
"EXECUTING",
"COMPLETED",
"FAILED",
"CANCELED"
};
const std::map<int, const char*> _TaskState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTaskStateValues, _kTaskStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kProcessStateValues[] = {
ProcessState::CREATED,
ProcessState::VALIDATED,
ProcessState::STARTED,
ProcessState::PRE_PROCESSING,
ProcessState::CONFIGURING_WORKSPACE,
ProcessState::INPUT_DATA_STAGING,
ProcessState::EXECUTING,
ProcessState::MONITORING,
ProcessState::OUTPUT_DATA_STAGING,
ProcessState::POST_PROCESSING,
ProcessState::COMPLETED,
ProcessState::FAILED,
ProcessState::CANCELLING,
ProcessState::CANCELED
};
const char* _kProcessStateNames[] = {
"CREATED",
"VALIDATED",
"STARTED",
"PRE_PROCESSING",
"CONFIGURING_WORKSPACE",
"INPUT_DATA_STAGING",
"EXECUTING",
"MONITORING",
"OUTPUT_DATA_STAGING",
"POST_PROCESSING",
"COMPLETED",
"FAILED",
"CANCELLING",
"CANCELED"
};
const std::map<int, const char*> _ProcessState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(14, _kProcessStateValues, _kProcessStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kJobStateValues[] = {
JobState::SUBMITTED,
JobState::QUEUED,
JobState::ACTIVE,
JobState::COMPLETE,
JobState::CANCELED,
JobState::FAILED,
JobState::SUSPENDED,
JobState::UNKNOWN
};
const char* _kJobStateNames[] = {
"SUBMITTED",
"QUEUED",
"ACTIVE",
"COMPLETE",
"CANCELED",
"FAILED",
"SUSPENDED",
"UNKNOWN"
};
const std::map<int, const char*> _JobState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kJobStateValues, _kJobStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
ExperimentStatus::~ExperimentStatus() throw() {
}
void ExperimentStatus::__set_state(const ExperimentState::type val) {
this->state = val;
}
void ExperimentStatus::__set_timeOfStateChange(const int64_t val) {
this->timeOfStateChange = val;
__isset.timeOfStateChange = true;
}
void ExperimentStatus::__set_reason(const std::string& val) {
this->reason = val;
__isset.reason = true;
}
const char* ExperimentStatus::ascii_fingerprint = "CDBB2A55999EF5954D567AC5CF6F0786";
const uint8_t ExperimentStatus::binary_fingerprint[16] = {0xCD,0xBB,0x2A,0x55,0x99,0x9E,0xF5,0x95,0x4D,0x56,0x7A,0xC5,0xCF,0x6F,0x07,0x86};
uint32_t ExperimentStatus::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_state = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast0;
xfer += iprot->readI32(ecast0);
this->state = (ExperimentState::type)ecast0;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->timeOfStateChange);
this->__isset.timeOfStateChange = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->reason);
this->__isset.reason = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ExperimentStatus::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
oprot->incrementRecursionDepth();
xfer += oprot->writeStructBegin("ExperimentStatus");
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
if (this->__isset.timeOfStateChange) {
xfer += oprot->writeFieldBegin("timeOfStateChange", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->timeOfStateChange);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.reason) {
xfer += oprot->writeFieldBegin("reason", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->reason);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
oprot->decrementRecursionDepth();
return xfer;
}
void swap(ExperimentStatus &a, ExperimentStatus &b) {
using ::std::swap;
swap(a.state, b.state);
swap(a.timeOfStateChange, b.timeOfStateChange);
swap(a.reason, b.reason);
swap(a.__isset, b.__isset);
}
ExperimentStatus::ExperimentStatus(const ExperimentStatus& other1) {
state = other1.state;
timeOfStateChange = other1.timeOfStateChange;
reason = other1.reason;
__isset = other1.__isset;
}
ExperimentStatus& ExperimentStatus::operator=(const ExperimentStatus& other2) {
state = other2.state;
timeOfStateChange = other2.timeOfStateChange;
reason = other2.reason;
__isset = other2.__isset;
return *this;
}
std::ostream& operator<<(std::ostream& out, const ExperimentStatus& obj) {
using apache::thrift::to_string;
out << "ExperimentStatus(";
out << "state=" << to_string(obj.state);
out << ", " << "timeOfStateChange="; (obj.__isset.timeOfStateChange ? (out << to_string(obj.timeOfStateChange)) : (out << "<null>"));
out << ", " << "reason="; (obj.__isset.reason ? (out << to_string(obj.reason)) : (out << "<null>"));
out << ")";
return out;
}
ProcessStatus::~ProcessStatus() throw() {
}
void ProcessStatus::__set_state(const ProcessState::type val) {
this->state = val;
}
void ProcessStatus::__set_timeOfStateChange(const int64_t val) {
this->timeOfStateChange = val;
__isset.timeOfStateChange = true;
}
void ProcessStatus::__set_reason(const std::string& val) {
this->reason = val;
__isset.reason = true;
}
const char* ProcessStatus::ascii_fingerprint = "CDBB2A55999EF5954D567AC5CF6F0786";
const uint8_t ProcessStatus::binary_fingerprint[16] = {0xCD,0xBB,0x2A,0x55,0x99,0x9E,0xF5,0x95,0x4D,0x56,0x7A,0xC5,0xCF,0x6F,0x07,0x86};
uint32_t ProcessStatus::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_state = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast3;
xfer += iprot->readI32(ecast3);
this->state = (ProcessState::type)ecast3;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->timeOfStateChange);
this->__isset.timeOfStateChange = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->reason);
this->__isset.reason = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ProcessStatus::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
oprot->incrementRecursionDepth();
xfer += oprot->writeStructBegin("ProcessStatus");
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
if (this->__isset.timeOfStateChange) {
xfer += oprot->writeFieldBegin("timeOfStateChange", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->timeOfStateChange);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.reason) {
xfer += oprot->writeFieldBegin("reason", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->reason);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
oprot->decrementRecursionDepth();
return xfer;
}
void swap(ProcessStatus &a, ProcessStatus &b) {
using ::std::swap;
swap(a.state, b.state);
swap(a.timeOfStateChange, b.timeOfStateChange);
swap(a.reason, b.reason);
swap(a.__isset, b.__isset);
}
ProcessStatus::ProcessStatus(const ProcessStatus& other4) {
state = other4.state;
timeOfStateChange = other4.timeOfStateChange;
reason = other4.reason;
__isset = other4.__isset;
}
ProcessStatus& ProcessStatus::operator=(const ProcessStatus& other5) {
state = other5.state;
timeOfStateChange = other5.timeOfStateChange;
reason = other5.reason;
__isset = other5.__isset;
return *this;
}
std::ostream& operator<<(std::ostream& out, const ProcessStatus& obj) {
using apache::thrift::to_string;
out << "ProcessStatus(";
out << "state=" << to_string(obj.state);
out << ", " << "timeOfStateChange="; (obj.__isset.timeOfStateChange ? (out << to_string(obj.timeOfStateChange)) : (out << "<null>"));
out << ", " << "reason="; (obj.__isset.reason ? (out << to_string(obj.reason)) : (out << "<null>"));
out << ")";
return out;
}
TaskStatus::~TaskStatus() throw() {
}
void TaskStatus::__set_state(const TaskState::type val) {
this->state = val;
}
void TaskStatus::__set_timeOfStateChange(const int64_t val) {
this->timeOfStateChange = val;
__isset.timeOfStateChange = true;
}
void TaskStatus::__set_reason(const std::string& val) {
this->reason = val;
__isset.reason = true;
}
const char* TaskStatus::ascii_fingerprint = "CDBB2A55999EF5954D567AC5CF6F0786";
const uint8_t TaskStatus::binary_fingerprint[16] = {0xCD,0xBB,0x2A,0x55,0x99,0x9E,0xF5,0x95,0x4D,0x56,0x7A,0xC5,0xCF,0x6F,0x07,0x86};
uint32_t TaskStatus::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_state = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast6;
xfer += iprot->readI32(ecast6);
this->state = (TaskState::type)ecast6;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->timeOfStateChange);
this->__isset.timeOfStateChange = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->reason);
this->__isset.reason = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TaskStatus::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
oprot->incrementRecursionDepth();
xfer += oprot->writeStructBegin("TaskStatus");
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
if (this->__isset.timeOfStateChange) {
xfer += oprot->writeFieldBegin("timeOfStateChange", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->timeOfStateChange);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.reason) {
xfer += oprot->writeFieldBegin("reason", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->reason);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
oprot->decrementRecursionDepth();
return xfer;
}
void swap(TaskStatus &a, TaskStatus &b) {
using ::std::swap;
swap(a.state, b.state);
swap(a.timeOfStateChange, b.timeOfStateChange);
swap(a.reason, b.reason);
swap(a.__isset, b.__isset);
}
TaskStatus::TaskStatus(const TaskStatus& other7) {
state = other7.state;
timeOfStateChange = other7.timeOfStateChange;
reason = other7.reason;
__isset = other7.__isset;
}
TaskStatus& TaskStatus::operator=(const TaskStatus& other8) {
state = other8.state;
timeOfStateChange = other8.timeOfStateChange;
reason = other8.reason;
__isset = other8.__isset;
return *this;
}
std::ostream& operator<<(std::ostream& out, const TaskStatus& obj) {
using apache::thrift::to_string;
out << "TaskStatus(";
out << "state=" << to_string(obj.state);
out << ", " << "timeOfStateChange="; (obj.__isset.timeOfStateChange ? (out << to_string(obj.timeOfStateChange)) : (out << "<null>"));
out << ", " << "reason="; (obj.__isset.reason ? (out << to_string(obj.reason)) : (out << "<null>"));
out << ")";
return out;
}
JobStatus::~JobStatus() throw() {
}
void JobStatus::__set_jobState(const JobState::type val) {
this->jobState = val;
}
void JobStatus::__set_timeOfStateChange(const int64_t val) {
this->timeOfStateChange = val;
__isset.timeOfStateChange = true;
}
void JobStatus::__set_reason(const std::string& val) {
this->reason = val;
__isset.reason = true;
}
const char* JobStatus::ascii_fingerprint = "CDBB2A55999EF5954D567AC5CF6F0786";
const uint8_t JobStatus::binary_fingerprint[16] = {0xCD,0xBB,0x2A,0x55,0x99,0x9E,0xF5,0x95,0x4D,0x56,0x7A,0xC5,0xCF,0x6F,0x07,0x86};
uint32_t JobStatus::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_jobState = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast9;
xfer += iprot->readI32(ecast9);
this->jobState = (JobState::type)ecast9;
isset_jobState = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->timeOfStateChange);
this->__isset.timeOfStateChange = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->reason);
this->__isset.reason = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_jobState)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t JobStatus::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
oprot->incrementRecursionDepth();
xfer += oprot->writeStructBegin("JobStatus");
xfer += oprot->writeFieldBegin("jobState", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->jobState);
xfer += oprot->writeFieldEnd();
if (this->__isset.timeOfStateChange) {
xfer += oprot->writeFieldBegin("timeOfStateChange", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->timeOfStateChange);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.reason) {
xfer += oprot->writeFieldBegin("reason", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->reason);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
oprot->decrementRecursionDepth();
return xfer;
}
void swap(JobStatus &a, JobStatus &b) {
using ::std::swap;
swap(a.jobState, b.jobState);
swap(a.timeOfStateChange, b.timeOfStateChange);
swap(a.reason, b.reason);
swap(a.__isset, b.__isset);
}
JobStatus::JobStatus(const JobStatus& other10) {
jobState = other10.jobState;
timeOfStateChange = other10.timeOfStateChange;
reason = other10.reason;
__isset = other10.__isset;
}
JobStatus& JobStatus::operator=(const JobStatus& other11) {
jobState = other11.jobState;
timeOfStateChange = other11.timeOfStateChange;
reason = other11.reason;
__isset = other11.__isset;
return *this;
}
std::ostream& operator<<(std::ostream& out, const JobStatus& obj) {
using apache::thrift::to_string;
out << "JobStatus(";
out << "jobState=" << to_string(obj.jobState);
out << ", " << "timeOfStateChange="; (obj.__isset.timeOfStateChange ? (out << to_string(obj.timeOfStateChange)) : (out << "<null>"));
out << ", " << "reason="; (obj.__isset.reason ? (out << to_string(obj.reason)) : (out << "<null>"));
out << ")";
return out;
}
}}}} // namespace
| {
"content_hash": "3cce8145d89ad465d14d2230ba5f0423",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 200,
"avg_line_length": 28.78358208955224,
"alnum_prop": 0.6430386310604096,
"repo_name": "jjj117/airavata",
"id": "534219550d8974d89418e1854d87925ece0059ed",
"size": "20087",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/status_models_types.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6134"
},
{
"name": "C",
"bytes": "55273"
},
{
"name": "C++",
"bytes": "4936352"
},
{
"name": "Java",
"bytes": "17021276"
},
{
"name": "PHP",
"bytes": "2080459"
},
{
"name": "Python",
"bytes": "182750"
},
{
"name": "Shell",
"bytes": "68622"
},
{
"name": "Thrift",
"bytes": "168265"
},
{
"name": "XSLT",
"bytes": "51124"
}
],
"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 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface com.cloudera.oryx.app.classreg.example.Feature (Oryx 2.8.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.cloudera.oryx.app.classreg.example.Feature (Oryx 2.8.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-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?com/cloudera/oryx/app/classreg/example/class-use/Feature.html" target="_top">Frames</a></li>
<li><a href="Feature.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 Interface com.cloudera.oryx.app.classreg.example.Feature" class="title">Uses of Interface<br>com.cloudera.oryx.app.classreg.example.Feature</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.cloudera.oryx.app.classreg.example">com.cloudera.oryx.app.classreg.example</a></td>
<td class="colLast">
<div class="block">Representations of features and training / test examples that are used inside a
classification or regression process.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.cloudera.oryx.app.classreg.example">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a> in <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/package-summary.html">com.cloudera.oryx.app.classreg.example</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/package-summary.html">com.cloudera.oryx.app.classreg.example</a> that implement <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/CategoricalFeature.html" title="class in com.cloudera.oryx.app.classreg.example">CategoricalFeature</a></span></code>
<div class="block">Represents a value of a categorical feature -- one that takes on discrete, unordered values like
<code>{male,female}</code> rather than a continuous or discrete numeric value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/NumericFeature.html" title="class in com.cloudera.oryx.app.classreg.example">NumericFeature</a></span></code>
<div class="block">Represents the value of a numeric feature -- one that takes on a real value, whether conceptually discrete or
continuous.</div>
</td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/package-summary.html">com.cloudera.oryx.app.classreg.example</a> that return <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></code></td>
<td class="colLast"><span class="typeNameLabel">Example.</span><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Example.html#getFeature-int-">getFeature</a></span>(int i)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></code></td>
<td class="colLast"><span class="typeNameLabel">Example.</span><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Example.html#getTarget--">getTarget</a></span>()</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/package-summary.html">com.cloudera.oryx.app.classreg.example</a> with parameters of type <a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Example.html#Example-com.cloudera.oryx.app.classreg.example.Feature-com.cloudera.oryx.app.classreg.example.Feature...-">Example</a></span>(<a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a> target,
<a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a>... features)</code> </td>
</tr>
<tr class="rowColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Example.html#Example-com.cloudera.oryx.app.classreg.example.Feature-com.cloudera.oryx.app.classreg.example.Feature...-">Example</a></span>(<a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a> target,
<a href="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Feature</a>... features)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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="../../../../../../../com/cloudera/oryx/app/classreg/example/Feature.html" title="interface in com.cloudera.oryx.app.classreg.example">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-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?com/cloudera/oryx/app/classreg/example/class-use/Feature.html" target="_top">Frames</a></li>
<li><a href="Feature.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 © 2014–2018. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "014672ef0b63f2a089bc05ec6bc3d843",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 430,
"avg_line_length": 52.90521327014218,
"alnum_prop": 0.6555585416106782,
"repo_name": "srowen/oryx",
"id": "6044d01b3d0b674e1d4b2f07afb1e6b5dbc2aefe",
"size": "11163",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/apidocs/com/cloudera/oryx/app/classreg/example/class-use/Feature.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1204068"
},
{
"name": "Scala",
"bytes": "17286"
},
{
"name": "Shell",
"bytes": "15828"
}
],
"symlink_target": ""
} |
package patterns.struct.coffee;
/**
* Created by dovbysh on 24.02.2015.
*/
public abstract class CoffeeDecorator implements Beverage {
private Beverage beverage;
protected Double decoratorCost;
protected String decoratorDescription;
protected CoffeeDecorator(Beverage beverage){
this.beverage = beverage;
decoratorCost = 0.0d;
decoratorDescription = "unknown";
}
public Beverage getBeverage(){
return beverage;
}
@Override
public Double getCost(){
return beverage.getCost() + decoratorCost;
}
public String getDescription(){
return beverage.getDescription() + ", " + decoratorDescription;
}
}
| {
"content_hash": "b3a26c6350db7bec90374673c9c168ac",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 21.875,
"alnum_prop": 0.6685714285714286,
"repo_name": "bdovbysh/design-patterns",
"id": "e9b443bdc8d780871e810c3afd349644bf7a4720",
"size": "700",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/patterns/struct/coffee/CoffeeDecorator.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "26406"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Cutlass: cutlass::gemm::GemmSharedStoreTileDTraits< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ > Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" async src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Cutlass
</div>
<div id="projectbrief">CUDA Templates for Linear Algebra Subroutines and Solvers</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacecutlass.html">cutlass</a></li><li class="navelem"><a class="el" href="namespacecutlass_1_1gemm.html">gemm</a></li><li class="navelem"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">GemmSharedStoreTileDTraits</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-types">Public Types</a> |
<a href="#pub-static-attribs">Static Public Attributes</a> |
<a href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">cutlass::gemm::GemmSharedStoreTileDTraits< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ > Struct Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="gemm__shared__tile_8h_source.html">gemm_shared_tile.h</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits_1_1ThreadOffset.html">ThreadOffset</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Computes the thread offset in (H, W) based on thread ID. <a href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits_1_1ThreadOffset.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a9a2218b570dada2f1e3ccd8004c47856"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structcutlass_1_1platform_1_1remove__const.html">platform::remove_const</a>< Scalar_ >::type </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9a2218b570dada2f1e3ccd8004c47856">Scalar</a></td></tr>
<tr class="memdesc:a9a2218b570dada2f1e3ccd8004c47856"><td class="mdescLeft"> </td><td class="mdescRight">The scalar. <a href="#a9a2218b570dada2f1e3ccd8004c47856">More...</a><br /></td></tr>
<tr class="separator:a9a2218b570dada2f1e3ccd8004c47856"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a20471c2f569c28538dad8a220ab25624"><td class="memItemLeft" align="right" valign="top">typedef Scalar_ * </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a20471c2f569c28538dad8a220ab25624">Pointer</a></td></tr>
<tr class="memdesc:a20471c2f569c28538dad8a220ab25624"><td class="mdescLeft"> </td><td class="mdescRight">The pointer. <a href="#a20471c2f569c28538dad8a220ab25624">More...</a><br /></td></tr>
<tr class="separator:a20471c2f569c28538dad8a220ab25624"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad52b81080731ee1f0d3c2c7eaba6f60d"><td class="memItemLeft" align="right" valign="top">typedef OutputTile_ </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ad52b81080731ee1f0d3c2c7eaba6f60d">OutputTile</a></td></tr>
<tr class="memdesc:ad52b81080731ee1f0d3c2c7eaba6f60d"><td class="mdescLeft"> </td><td class="mdescRight">The dimension of the output tile. <a href="#ad52b81080731ee1f0d3c2c7eaba6f60d">More...</a><br /></td></tr>
<tr class="separator:ad52b81080731ee1f0d3c2c7eaba6f60d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af4597927405d8bb1ad2c464fad064703"><td class="memItemLeft" align="right" valign="top">typedef Warps_ </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af4597927405d8bb1ad2c464fad064703">Warps</a></td></tr>
<tr class="memdesc:af4597927405d8bb1ad2c464fad064703"><td class="mdescLeft"> </td><td class="mdescRight">The warps in the tile. <a href="#af4597927405d8bb1ad2c464fad064703">More...</a><br /></td></tr>
<tr class="separator:af4597927405d8bb1ad2c464fad064703"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adf72ea773b8d4d3eb184f59c8cdf9543"><td class="memItemLeft" align="right" valign="top">typedef ThreadsPerWarp_ </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#adf72ea773b8d4d3eb184f59c8cdf9543">ThreadsPerWarp</a></td></tr>
<tr class="memdesc:adf72ea773b8d4d3eb184f59c8cdf9543"><td class="mdescLeft"> </td><td class="mdescRight">The threads in the warps. <a href="#adf72ea773b8d4d3eb184f59c8cdf9543">More...</a><br /></td></tr>
<tr class="separator:adf72ea773b8d4d3eb184f59c8cdf9543"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2bc41b907417b47f3dca9c3dd358f8bc"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a>< 1, 2, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af1c981ec89a9cabaf5d34231d51a029c">kScalarsPerRow</a>/<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a2bc41b907417b47f3dca9c3dd358f8bc">Tile</a></td></tr>
<tr class="memdesc:a2bc41b907417b47f3dca9c3dd358f8bc"><td class="mdescLeft"> </td><td class="mdescRight">The tile. <a href="#a2bc41b907417b47f3dca9c3dd358f8bc">More...</a><br /></td></tr>
<tr class="separator:a2bc41b907417b47f3dca9c3dd358f8bc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6bacc866485330f80596f634e6d14336"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a>< 1, 1, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ae0b53d76096f9d34df6e16280565c7b1">kScalarsPerThread</a>/<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a6bacc866485330f80596f634e6d14336">Iterations</a></td></tr>
<tr class="memdesc:a6bacc866485330f80596f634e6d14336"><td class="mdescLeft"> </td><td class="mdescRight">The number of iterations needed to store the tile. <a href="#a6bacc866485330f80596f634e6d14336">More...</a><br /></td></tr>
<tr class="separator:a6bacc866485330f80596f634e6d14336"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5587ef22f419ab9a7c6117917cc99c57"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a>< 0, 0, Warps::kW *ThreadsPerWarp::kW *<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a5587ef22f419ab9a7c6117917cc99c57">Delta</a></td></tr>
<tr class="memdesc:a5587ef22f419ab9a7c6117917cc99c57"><td class="mdescLeft"> </td><td class="mdescRight">The strides in each dimension between different loads/stores. <a href="#a5587ef22f419ab9a7c6117917cc99c57">More...</a><br /></td></tr>
<tr class="separator:a5587ef22f419ab9a7c6117917cc99c57"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac585815d08290d9a5a9cdbd611ffdac4"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a>< 0, 0, Warps::kW *ThreadsPerWarp::kW *<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ac585815d08290d9a5a9cdbd611ffdac4">ImmediateOffsetStrides</a></td></tr>
<tr class="memdesc:ac585815d08290d9a5a9cdbd611ffdac4"><td class="mdescLeft"> </td><td class="mdescRight">The strides in each dimension between different loads/stores. <a href="#ac585815d08290d9a5a9cdbd611ffdac4">More...</a><br /></td></tr>
<tr class="separator:ac585815d08290d9a5a9cdbd611ffdac4"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:a9521c4017e227b2511891a7fb18513e1"><td class="memItemLeft" align="right" valign="top">static int const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a> = kScalarsPerSts_</td></tr>
<tr class="memdesc:a9521c4017e227b2511891a7fb18513e1"><td class="mdescLeft"> </td><td class="mdescRight">The number of scalars per LDG/STG. <a href="#a9521c4017e227b2511891a7fb18513e1">More...</a><br /></td></tr>
<tr class="separator:a9521c4017e227b2511891a7fb18513e1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a48baee6541e6359753f1bae5bd864029"><td class="memItemLeft" align="right" valign="top">static int const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a48baee6541e6359753f1bae5bd864029">kSkew</a> = kSkew_</td></tr>
<tr class="memdesc:a48baee6541e6359753f1bae5bd864029"><td class="mdescLeft"> </td><td class="mdescRight">The skew. <a href="#a48baee6541e6359753f1bae5bd864029">More...</a><br /></td></tr>
<tr class="separator:a48baee6541e6359753f1bae5bd864029"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8914bc5154f21fa5fd182b0009c44c39"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="structcutlass_1_1MemorySpace.html#a1e031ec41668015a8fe4ba2c1145d03c">MemorySpace::Kind</a> const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a8914bc5154f21fa5fd182b0009c44c39">kMemorySpace</a> = <a class="el" href="structcutlass_1_1MemorySpace.html#a1e031ec41668015a8fe4ba2c1145d03ca2804339b2be64ff68ae3042073aaa7cc">MemorySpace::kShared</a></td></tr>
<tr class="memdesc:a8914bc5154f21fa5fd182b0009c44c39"><td class="mdescLeft"> </td><td class="mdescRight">The memory space. <a href="#a8914bc5154f21fa5fd182b0009c44c39">More...</a><br /></td></tr>
<tr class="separator:a8914bc5154f21fa5fd182b0009c44c39"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae0b53d76096f9d34df6e16280565c7b1"><td class="memItemLeft" align="right" valign="top">static int const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ae0b53d76096f9d34df6e16280565c7b1">kScalarsPerThread</a> = OutputTile_::kW / Warps::kW / ThreadsPerWarp::kW</td></tr>
<tr class="memdesc:ae0b53d76096f9d34df6e16280565c7b1"><td class="mdescLeft"> </td><td class="mdescRight">The number of scalars per thread. <a href="#ae0b53d76096f9d34df6e16280565c7b1">More...</a><br /></td></tr>
<tr class="separator:ae0b53d76096f9d34df6e16280565c7b1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a05039ba8b7d9890903064b1a834dcd3e"><td class="memItemLeft" align="right" valign="top">static int const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a05039ba8b7d9890903064b1a834dcd3e">kThreads</a> = <a class="el" href="structcutlass_1_1ShapeCount.html">ShapeCount</a><<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af4597927405d8bb1ad2c464fad064703">Warps</a>>::kCount * kWarpSize</td></tr>
<tr class="memdesc:a05039ba8b7d9890903064b1a834dcd3e"><td class="mdescLeft"> </td><td class="mdescRight">The number of threads. <a href="#a05039ba8b7d9890903064b1a834dcd3e">More...</a><br /></td></tr>
<tr class="separator:a05039ba8b7d9890903064b1a834dcd3e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af1c981ec89a9cabaf5d34231d51a029c"><td class="memItemLeft" align="right" valign="top">static int const </td><td class="memItemRight" valign="bottom"><a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af1c981ec89a9cabaf5d34231d51a029c">kScalarsPerRow</a> = <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a05039ba8b7d9890903064b1a834dcd3e">kThreads</a> / 2 * <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ae0b53d76096f9d34df6e16280565c7b1">kScalarsPerThread</a> + <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a48baee6541e6359753f1bae5bd864029">kSkew</a></td></tr>
<tr class="memdesc:af1c981ec89a9cabaf5d34231d51a029c"><td class="mdescLeft"> </td><td class="mdescRight">The number of scalars per row. We build a tile with 2 rows (to avoid bank conflicts). <a href="#af1c981ec89a9cabaf5d34231d51a029c">More...</a><br /></td></tr>
<tr class="separator:af1c981ec89a9cabaf5d34231d51a029c"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a5587ef22f419ab9a7c6117917cc99c57"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5587ef22f419ab9a7c6117917cc99c57">◆ </a></span>Delta</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a><0, 0, Warps::kW * ThreadsPerWarp::kW * <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>> <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a5587ef22f419ab9a7c6117917cc99c57">Delta</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="ac585815d08290d9a5a9cdbd611ffdac4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac585815d08290d9a5a9cdbd611ffdac4">◆ </a></span>ImmediateOffsetStrides</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a><0, 0, Warps::kW * ThreadsPerWarp::kW * <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>> <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ac585815d08290d9a5a9cdbd611ffdac4">ImmediateOffsetStrides</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a6bacc866485330f80596f634e6d14336"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6bacc866485330f80596f634e6d14336">◆ </a></span>Iterations</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a><1, 1, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ae0b53d76096f9d34df6e16280565c7b1">kScalarsPerThread</a> / <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>> <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a6bacc866485330f80596f634e6d14336">Iterations</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="ad52b81080731ee1f0d3c2c7eaba6f60d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad52b81080731ee1f0d3c2c7eaba6f60d">◆ </a></span>OutputTile</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef OutputTile_ <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ad52b81080731ee1f0d3c2c7eaba6f60d">OutputTile</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a20471c2f569c28538dad8a220ab25624"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20471c2f569c28538dad8a220ab25624">◆ </a></span>Pointer</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef Scalar_* <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a20471c2f569c28538dad8a220ab25624">Pointer</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a9a2218b570dada2f1e3ccd8004c47856"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a2218b570dada2f1e3ccd8004c47856">◆ </a></span>Scalar</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structcutlass_1_1platform_1_1remove__const.html">platform::remove_const</a><Scalar_>::type <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9a2218b570dada2f1e3ccd8004c47856">Scalar</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="adf72ea773b8d4d3eb184f59c8cdf9543"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adf72ea773b8d4d3eb184f59c8cdf9543">◆ </a></span>ThreadsPerWarp</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef ThreadsPerWarp_ <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#adf72ea773b8d4d3eb184f59c8cdf9543">ThreadsPerWarp</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a2bc41b907417b47f3dca9c3dd358f8bc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2bc41b907417b47f3dca9c3dd358f8bc">◆ </a></span>Tile</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structcutlass_1_1Shape.html">Shape</a><1, 2, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af1c981ec89a9cabaf5d34231d51a029c">kScalarsPerRow</a> / <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>, <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a9521c4017e227b2511891a7fb18513e1">kAccessSize</a>> <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a2bc41b907417b47f3dca9c3dd358f8bc">Tile</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="af4597927405d8bb1ad2c464fad064703"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af4597927405d8bb1ad2c464fad064703">◆ </a></span>Warps</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="memname">
<tr>
<td class="memname">typedef Warps_ <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af4597927405d8bb1ad2c464fad064703">Warps</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a9521c4017e227b2511891a7fb18513e1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9521c4017e227b2511891a7fb18513e1">◆ </a></span>kAccessSize</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kAccessSize = kScalarsPerSts_</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a8914bc5154f21fa5fd182b0009c44c39"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8914bc5154f21fa5fd182b0009c44c39">◆ </a></span>kMemorySpace</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcutlass_1_1MemorySpace.html#a1e031ec41668015a8fe4ba2c1145d03c">MemorySpace::Kind</a> const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kMemorySpace = <a class="el" href="structcutlass_1_1MemorySpace.html#a1e031ec41668015a8fe4ba2c1145d03ca2804339b2be64ff68ae3042073aaa7cc">MemorySpace::kShared</a></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="af1c981ec89a9cabaf5d34231d51a029c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af1c981ec89a9cabaf5d34231d51a029c">◆ </a></span>kScalarsPerRow</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kScalarsPerRow = <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a05039ba8b7d9890903064b1a834dcd3e">kThreads</a> / 2 * <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#ae0b53d76096f9d34df6e16280565c7b1">kScalarsPerThread</a> + <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#a48baee6541e6359753f1bae5bd864029">kSkew</a></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="ae0b53d76096f9d34df6e16280565c7b1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae0b53d76096f9d34df6e16280565c7b1">◆ </a></span>kScalarsPerThread</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kScalarsPerThread = OutputTile_::kW / Warps::kW / ThreadsPerWarp::kW</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a48baee6541e6359753f1bae5bd864029"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a48baee6541e6359753f1bae5bd864029">◆ </a></span>kSkew</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kSkew = kSkew_</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a05039ba8b7d9890903064b1a834dcd3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a05039ba8b7d9890903064b1a834dcd3e">◆ </a></span>kThreads</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename Scalar_ , typename OutputTile_ , typename Warps_ , typename ThreadsPerWarp_ , int kScalarsPerSts_, int kSkew_ = 0> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int const <a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html">cutlass::gemm::GemmSharedStoreTileDTraits</a>< Scalar_, OutputTile_, Warps_, ThreadsPerWarp_, kScalarsPerSts_, kSkew_ >::kThreads = <a class="el" href="structcutlass_1_1ShapeCount.html">ShapeCount</a><<a class="el" href="structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html#af4597927405d8bb1ad2c464fad064703">Warps</a>>::kCount * kWarpSize</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="gemm__shared__tile_8h_source.html">gemm_shared_tile.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Oct 26 2018 14:53:39 for Cutlass by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
| {
"content_hash": "b7a5b6502b840b19017110cfd1145c79",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 830,
"avg_line_length": 75.20449438202247,
"alnum_prop": 0.7308014103866611,
"repo_name": "mlperf/training_results_v0.5",
"id": "08afd2be7a35e15b3557f03fe99a0ef0d8e6b1a7",
"size": "33466",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "v0.5.0/nvidia/submission/code/translation/pytorch/cutlass/docs/structcutlass_1_1gemm_1_1GemmSharedStoreTileDTraits.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "5720"
},
{
"name": "C++",
"bytes": "1288180"
},
{
"name": "CMake",
"bytes": "40880"
},
{
"name": "CSS",
"bytes": "32420"
},
{
"name": "Cuda",
"bytes": "1362093"
},
{
"name": "Dockerfile",
"bytes": "19488"
},
{
"name": "Go",
"bytes": "1088660"
},
{
"name": "HTML",
"bytes": "19756888"
},
{
"name": "Java",
"bytes": "45405"
},
{
"name": "JavaScript",
"bytes": "302838"
},
{
"name": "Jupyter Notebook",
"bytes": "9104667"
},
{
"name": "Lua",
"bytes": "4430"
},
{
"name": "Makefile",
"bytes": "3652"
},
{
"name": "Python",
"bytes": "31508548"
},
{
"name": "Scala",
"bytes": "106211"
},
{
"name": "Shell",
"bytes": "409745"
}
],
"symlink_target": ""
} |
<?php
/**
* @author @jenschude <jens.schulze@commercetools.de>
*/
namespace Commercetools\Core\Request\Categories\Command;
use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Request\CustomField\Command\SetCustomFieldAction;
/**
* @package Commercetools\Core\Request\Categories\Command
* @link https://docs.commercetools.com/http-api-projects-products.html#set-asset-customfield
*
* @method string getAction()
* @method CategorySetAssetCustomFieldAction setAction(string $action = null)
* @method string getAssetId()
* @method CategorySetAssetCustomFieldAction setAssetId(string $assetId = null)
* @method string getName()
* @method CategorySetAssetCustomFieldAction setName(string $name = null)
* @method mixed getValue()
* @method CategorySetAssetCustomFieldAction setValue($value = null)
* @method string getAssetKey()
* @method CategorySetAssetCustomFieldAction setAssetKey(string $assetKey = null)
*/
class CategorySetAssetCustomFieldAction extends SetCustomFieldAction
{
public function fieldDefinitions()
{
return [
'action' => [static::TYPE => 'string'],
'assetId' => [static::TYPE => 'string'],
'assetKey' => [static::TYPE => 'string'],
'name' => [static::TYPE => 'string'],
'value' => [static::TYPE => null],
];
}
/**
* @param array $data
* @param Context|callable $context
*/
public function __construct(array $data = [], $context = null)
{
parent::__construct($data, $context);
$this->setAction('setAssetCustomField');
}
/**
* @param string $assetId
* @param string $name
* @param Context|callable $context
* @return CategorySetAssetCustomFieldAction
*/
public static function ofAssetIdAndName($assetId, $name, $context = null)
{
return static::of($context)->setAssetId($assetId)->setName($name);
}
/**
* @param string $assetKey
* @param string $name
* @param Context|callable $context
* @return CategorySetAssetCustomFieldAction
*/
public static function ofAssetKeyAndName($assetKey, $name, $context = null)
{
return static::of($context)->setAssetKey($assetKey)->setName($name);
}
}
| {
"content_hash": "8b0891b132f4b7e24941122389f27b8e",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 93,
"avg_line_length": 32.385714285714286,
"alnum_prop": 0.6643140714600794,
"repo_name": "sphereio/sphere-php-sdk",
"id": "8c6e585b3e1c816bed48493d5df28721c3167ef2",
"size": "2267",
"binary": false,
"copies": "2",
"ref": "refs/heads/renovate/all",
"path": "src/Core/Request/Categories/Command/CategorySetAssetCustomFieldAction.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "288"
},
{
"name": "CSS",
"bytes": "7510"
},
{
"name": "Cucumber",
"bytes": "205537"
},
{
"name": "HTML",
"bytes": "49434"
},
{
"name": "JavaScript",
"bytes": "35176"
},
{
"name": "PHP",
"bytes": "1743251"
},
{
"name": "Shell",
"bytes": "1990"
}
],
"symlink_target": ""
} |
package com.anthill.channels
import akka.actor.ActorSystem
import akka.actor.Actor
import akka.actor.Props
import akka.testkit.TestKit
import org.scalatest.WordSpecLike
import org.scalatest.Matchers
import org.scalatest.BeforeAndAfterAll
import akka.testkit.ImplicitSender
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
import akka.actor.ActorRef
import akka.actor.ActorSelection
import cc.mewa.channels.ChannelManagerActor;
import cc.mewa.channels.ChannelManagerActor._
@RunWith(classOf[JUnitRunner])
class ChannelManagerSpec(_system: ActorSystem) extends TestKit(_system) with ImplicitSender
with WordSpecLike with Matchers with BeforeAndAfterAll {
def this() = this(ActorSystem("ChannelManagerActorSpec"))
override def beforeAll {
val channelManager = system.actorOf(ChannelManagerActor.props(None), "channel-manager")
}
override def afterAll {
TestKit.shutdownActorSystem(system)
}
"ChannelManager" should {
"refuse connection with invalid channel name" in {
val manager = system.actorSelection("/user/channel-manager")
manager ! GetChannel("", "", "")
expectMsg(AuthorizationError)
}
"return new channel" in {
val manager = system.actorSelection("/user/channel-manager")
manager ! GetChannel("test1", "dev1", "pass1")
expectMsgType[ChannelFound]
}
}
} | {
"content_hash": "32663011da6105e3e1b1b84bee97656c",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 91,
"avg_line_length": 26.169811320754718,
"alnum_prop": 0.7498197548666186,
"repo_name": "AnthillTech/mewa",
"id": "90623df2f08c9f58445279bcc636d454709c23d6",
"size": "1387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/com/anthill/channels/ChannelManagerSpec.scala",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "448"
},
{
"name": "JavaScript",
"bytes": "4023"
},
{
"name": "Scala",
"bytes": "50366"
},
{
"name": "Shell",
"bytes": "9593"
}
],
"symlink_target": ""
} |
import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
# Get paths we might need
config_path = os.path.dirname(os.path.abspath(__file__))
config_root = os.path.dirname(config_path)
addToPath(config_root+'/configs/common')
addToPath(config_root+'/configs/ruby')
addToPath(config_root+'/configs/topologies')
import Ruby
import Options
parser = optparse.OptionParser()
Options.addCommonOptions(parser)
# Add the ruby specific and protocol specific options
Ruby.define_options(parser)
(options, args) = parser.parse_args()
#
# Set the default cache size and associativity to be very small to encourage
# races between requests and writebacks.
#
options.l1d_size="256B"
options.l1i_size="256B"
options.l2_size="512B"
options.l3_size="1kB"
options.l1d_assoc=2
options.l1i_assoc=2
options.l2_assoc=2
options.l3_assoc=2
# this is a uniprocessor only test
options.num_cpus = 1
cpu = TimingSimpleCPU(cpu_id=0)
system = System(cpu = cpu, physmem = SimpleMemory(null = True),
clk_domain = SrcClockDomain(clock = '1GHz'))
# Create a seperate clock domain for components that should run at
# CPUs frequency
system.cpu.clk_domain = SrcClockDomain(clock = '2GHz')
Ruby.create_system(options, system)
# Create a separate clock for Ruby
system.ruby.clk_domain = SrcClockDomain(clock = options.ruby_clock)
assert(len(system.ruby._cpu_ruby_ports) == 1)
# create the interrupt controller
cpu.createInterruptController()
#
# Tie the cpu cache ports to the ruby cpu ports and
# physmem, respectively
#
cpu.connectAllPorts(system.ruby._cpu_ruby_ports[0])
# -----------------------
# run simulation
# -----------------------
root = Root(full_system = False, system = system)
root.system.mem_mode = 'timing'
# Not much point in this being higher than the L1 latency
m5.ticks.setGlobalFrequency('1ns')
| {
"content_hash": "deb759ebb564fccd5f2c1e8890ccfc09",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 76,
"avg_line_length": 25.684931506849313,
"alnum_prop": 0.7344,
"repo_name": "samueldotj/TeeRISC-Simulator",
"id": "27d56a31da756a7339ef6890a3d0b09755aeb432",
"size": "3457",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tests/configs/simple-timing-ruby.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "230559"
},
{
"name": "C",
"bytes": "930004"
},
{
"name": "C++",
"bytes": "9066852"
},
{
"name": "Emacs Lisp",
"bytes": "1969"
},
{
"name": "Java",
"bytes": "3096"
},
{
"name": "Perl",
"bytes": "1603541"
},
{
"name": "Python",
"bytes": "3151838"
},
{
"name": "Ruby",
"bytes": "19410"
},
{
"name": "Shell",
"bytes": "2193"
},
{
"name": "Visual Basic",
"bytes": "2884"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>unit_test::suite::expect (3 of 4 overloads)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Beast">
<link rel="up" href="../expect.html" title="unit_test::suite::expect">
<link rel="prev" href="overload2.html" title="unit_test::suite::expect (2 of 4 overloads)">
<link rel="next" href="overload4.html" title="unit_test::suite::expect (4 of 4 overloads)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload2.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../expect.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload4.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h6 class="title">
<a name="beast.ref.boost__beast__unit_test__suite.expect.overload3"></a><a class="link" href="overload3.html" title="unit_test::suite::expect (3 of 4 overloads)">unit_test::suite::expect
(3 of 4 overloads)</a>
</h6></div></div></div>
<p>
Evaluate a test condition.
</p>
<h7><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.h0"></a>
<span class="phrase"><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.synopsis"></a></span><a class="link" href="overload3.html#beast.ref.boost__beast__unit_test__suite.expect.overload3.synopsis">Synopsis</a>
</h7><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
<span class="keyword">class</span> <span class="identifier">Condition</span><span class="special">></span>
<span class="keyword">bool</span>
<span class="identifier">expect</span><span class="special">(</span>
<span class="identifier">Condition</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">shouldBeTrue</span><span class="special">,</span>
<span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">file</span><span class="special">,</span>
<span class="keyword">int</span> <span class="identifier">line</span><span class="special">);</span>
</pre>
<h7><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.h1"></a>
<span class="phrase"><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.description"></a></span><a class="link" href="overload3.html#beast.ref.boost__beast__unit_test__suite.expect.overload3.description">Description</a>
</h7><p>
This function provides improved logging by incorporating the file name
and line number into the reported output on failure, as well as additional
text specified by the caller.
</p>
<h7><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.h2"></a>
<span class="phrase"><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.parameters"></a></span><a class="link" href="overload3.html#beast.ref.boost__beast__unit_test__suite.expect.overload3.parameters">Parameters</a>
</h7><div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">shouldBeTrue</span></code>
</p>
</td>
<td>
<p>
The condition to test. The condition is evaluated in a boolean
context.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">reason</span></code>
</p>
</td>
<td>
<p>
Optional added text to output on a failure.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">file</span></code>
</p>
</td>
<td>
<p>
The source code file where the test failed.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">line</span></code>
</p>
</td>
<td>
<p>
The source code line number where the test failed.
</p>
</td>
</tr>
</tbody>
</table></div>
<h7><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.h3"></a>
<span class="phrase"><a name="beast.ref.boost__beast__unit_test__suite.expect.overload3.return_value"></a></span><a class="link" href="overload3.html#beast.ref.boost__beast__unit_test__suite.expect.overload3.return_value">Return
Value</a>
</h7><p>
<code class="computeroutput"><span class="keyword">true</span></code> if the test condition
indicates success.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
Falco<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload2.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../expect.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload4.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "fdcc197eb586fc9de006bed313be0562",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 456,
"avg_line_length": 52.13986013986014,
"alnum_prop": 0.5582081545064378,
"repo_name": "davehorton/drachtio-server",
"id": "1c056cc983490542102eb27bcd829916b15b2512",
"size": "7459",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "deps/boost_1_77_0/libs/beast/doc/html/beast/ref/boost__beast__unit_test__suite/expect/overload3.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "662596"
},
{
"name": "Dockerfile",
"bytes": "1330"
},
{
"name": "JavaScript",
"bytes": "60639"
},
{
"name": "M4",
"bytes": "35273"
},
{
"name": "Makefile",
"bytes": "5960"
},
{
"name": "Shell",
"bytes": "47298"
}
],
"symlink_target": ""
} |
<?php
/********************************************
GetAccessToken.php
Calls GetAccessTokenReceipt.php,and APIError.php.
********************************************/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Permissions - Get Access Token</title>
</head>
<body>
<img src="https://devtools-paypal.com/image/bdg_payments_by_pp_2line.png"/>
<center>
<form action="GetAccessTokenReceipt.php" method="post">
<h3>Permissions - Get Access Token</h3>
<table>
<tr><td>
Verifier<input type="text" name="Verifier" size="50"
value="<?php if(isset($_REQUEST['verification_code'])) echo $_REQUEST['verification_code']?>" /><br></br>
</td></tr>
<tr><td>Request Token<input type="text" name="Requesttoken" size="50"
value="<?php if(isset($_REQUEST['request_token'])) echo $_REQUEST['request_token']?>" /><br></br></td></tr>
<tr><td><input type="submit" value="GetAccessToken" /></td></tr>
</table>
</form>
<a href="index.php" >Home</a>
</center>
</body>
</html>
| {
"content_hash": "ebe17a22aadef3f9cb6307cae2256b94",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 121,
"avg_line_length": 31.91176470588235,
"alnum_prop": 0.6110599078341014,
"repo_name": "HollenMok/pandoraf_v1.0",
"id": "97699ea6f5c94f888a88ab5bb589fafbfe0918a5",
"size": "1085",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "applications/pandoraf/components/com_shopcart/modules/vendor/paypal/paypal-permissions-sdk-php-eef386c/samples/GetAccessToken.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "12499"
},
{
"name": "CSS",
"bytes": "494971"
},
{
"name": "HTML",
"bytes": "64347"
},
{
"name": "JavaScript",
"bytes": "117935"
},
{
"name": "PHP",
"bytes": "1082741"
},
{
"name": "Smarty",
"bytes": "7202"
},
{
"name": "Yacc",
"bytes": "44984"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples xmlns:sem="http://marklogic.com/semantics">
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</sem:predicate>
<sem:object datatype="sem:iri">http://www.w3.org/2004/02/skos/core#Concept</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
<sem:object xml:lang="eng" datatype="xsd:string">Eve</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
<sem:object datatype="sem:iri">http://www.schema.org/Person</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#gender</sem:predicate>
<sem:object xml:lang="eng" datatype="xsd:string">female</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#partOfSpeech</sem:predicate>
<sem:object xml:lang="eng" datatype="xsd:string">proper noun</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#instanceOf</sem:predicate>
<sem:object datatype="xsd:anyURI">http://www.lds.org/scriptures/gs/eve</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#definition</sem:predicate>
<sem:object xml:lang="eng" datatype="xsd:string">The first woman to live on this earth (; ). She was Adam’s wife. In Hebrew the name means “life” and implies that Eve was the first mother on earth (). She and Adam, the first man, will share eternal glory for their role in making possible the eternal progress of all mankind.</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#instanceOf</sem:predicate>
<sem:object datatype="xsd:anyURI">http://eom.byu.edu/index.php/Eve</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#instanceOf</sem:predicate>
<sem:object datatype="xsd:anyURI">http://www.lds.org/scriptures/bd/eve?lang=eng</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#instanceOf</sem:predicate>
<sem:object datatype="xsd:anyURI">http://www.lds.org/scriptures/triple-index/eve?lang=eng</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#related</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept/gs/adam</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#related</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept/gs/eden</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#related</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept/gs/fall-of-adam-and-eve</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#related</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept/gs/woman</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/guide-to-the-scriptures</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#pronunciation</sem:predicate>
<sem:object xml:lang="eng" datatype="xsd:string">ēv</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/concept/gs/eve</sem:subject>
<sem:predicate>http://www.lds.org/core#relCount</sem:predicate>
<sem:object datatype="xsd:integer">4</sem:object>
</sem:triple>
</sem:triples>
| {
"content_hash": "d32084f4190e162d982908baf30905c5",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 342,
"avg_line_length": 53.42045454545455,
"alnum_prop": 0.6968730057434588,
"repo_name": "freshie/ml-taxonomies",
"id": "dcaaffff9a0afd28bdabea0dd572cc8d66d0633b",
"size": "4708",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "roxy/data/gospel-topical-explorer-v2/taxonomies/doctrine/gs/eve.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4422"
},
{
"name": "CSS",
"bytes": "38665"
},
{
"name": "HTML",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "411651"
},
{
"name": "Ruby",
"bytes": "259121"
},
{
"name": "Shell",
"bytes": "7329"
},
{
"name": "XQuery",
"bytes": "857170"
},
{
"name": "XSLT",
"bytes": "13753"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.