text:
package componentconfigs

import (
	"strings"
	"testing"
	"time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
	kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
	kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
	kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
	utilpointer "k8s.io/utils/pointer"
)

func TestValidateKubeProxyConfiguration(t *testing.T) {
	var tests = []struct {
		name          string
		clusterConfig *kubeadm.ClusterConfiguration
		msg           string
		expectErr     bool
	}{
		{
			name: "valid config",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress:        "192.168.59.103",
						HealthzBindAddress: "0.0.0.0:10256",
						MetricsBindAddress: "127.0.0.1:10249",
						ClusterCIDR:        "192.168.59.0/24",
						UDPIdleTimeout:     metav1.Duration{Duration: 1 * time.Second},
						ConfigSyncPeriod:   metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			expectErr: false,
		},
		{
			name: "invalid BindAddress",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						// only BindAddress is invalid
						BindAddress:        "10.10.12.11:2000",
						HealthzBindAddress: "0.0.0.0:10256",
						MetricsBindAddress: "127.0.0.1:10249",
						ClusterCIDR:        "192.168.59.0/24",
						UDPIdleTimeout:     metav1.Duration{Duration: 1 * time.Second},
						ConfigSyncPeriod:   metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "not a valid textual representation of an IP address",
			expectErr: true,
		},
		{
			name: "invalid HealthzBindAddress",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress: "10.10.12.11",
						// only HealthzBindAddress is invalid
						HealthzBindAddress: "0.0.0.0",
						MetricsBindAddress: "127.0.0.1:10249",
						ClusterCIDR:        "192.168.59.0/24",
						UDPIdleTimeout:     metav1.Duration{Duration: 1 * time.Second},
						ConfigSyncPeriod:   metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "must be IP:port",
			expectErr: true,
		},
		{
			name: "invalid MetricsBindAddress",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress:        "10.10.12.11",
						HealthzBindAddress: "0.0.0.0:12345",
						// only MetricsBindAddress is invalid
						MetricsBindAddress: "127.0.0.1",
						ClusterCIDR:        "192.168.59.0/24",
						UDPIdleTimeout:     metav1.Duration{Duration: 1 * time.Second},
						ConfigSyncPeriod:   metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "must be IP:port",
			expectErr: true,
		},
		{
			name: "invalid ClusterCIDR",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress:        "10.10.12.11",
						HealthzBindAddress: "0.0.0.0:12345",
						MetricsBindAddress: "127.0.0.1:10249",
						// only ClusterCIDR is invalid
						ClusterCIDR:      "192.168.59.0",
						UDPIdleTimeout:   metav1.Duration{Duration: 1 * time.Second},
						ConfigSyncPeriod: metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "must be a valid CIDR block (e.g. 10.100.0.0/16)",
			expectErr: true,
		},
		{
			name: "invalid UDPIdleTimeout",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress:        "10.10.12.11",
						HealthzBindAddress: "0.0.0.0:12345",
						MetricsBindAddress: "127.0.0.1:10249",
						ClusterCIDR:        "192.168.59.0/24",
						// only UDPIdleTimeout is invalid
						UDPIdleTimeout:   metav1.Duration{Duration: -1 * time.Second},
						ConfigSyncPeriod: metav1.Duration{Duration: 1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "must be greater than 0",
			expectErr: true,
		},
		{
			name: "invalid ConfigSyncPeriod",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					KubeProxy: &kubeproxyconfig.KubeProxyConfiguration{
						BindAddress:        "10.10.12.11",
						HealthzBindAddress: "0.0.0.0:12345",
						MetricsBindAddress: "127.0.0.1:10249",
						ClusterCIDR:        "192.168.59.0/24",
						UDPIdleTimeout:     metav1.Duration{Duration: 1 * time.Second},
						// only ConfigSyncPeriod is invalid
						ConfigSyncPeriod: metav1.Duration{Duration: -1 * time.Second},
						IPTables: kubeproxyconfig.KubeProxyIPTablesConfiguration{
							MasqueradeAll: true,
							SyncPeriod:    metav1.Duration{Duration: 5 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 2 * time.Second},
						},
						IPVS: kubeproxyconfig.KubeProxyIPVSConfiguration{
							SyncPeriod:    metav1.Duration{Duration: 10 * time.Second},
							MinSyncPeriod: metav1.Duration{Duration: 5 * time.Second},
						},
						Conntrack: kubeproxyconfig.KubeProxyConntrackConfiguration{
							Max:                   utilpointer.Int32Ptr(2),
							MaxPerCore:            utilpointer.Int32Ptr(1),
							Min:                   utilpointer.Int32Ptr(1),
							TCPEstablishedTimeout: &metav1.Duration{Duration: 5 * time.Second},
							TCPCloseWaitTimeout:   &metav1.Duration{Duration: 5 * time.Second},
						},
					},
				},
			},
			msg:       "must be greater than 0",
			expectErr: true,
		},
	}
	for i, rt := range tests {
		t.Run(rt.name, func(t *testing.T) {
			err := ValidateKubeProxyConfiguration(rt.clusterConfig, nil).ToAggregate()
			if (err != nil) != rt.expectErr {
				t.Errorf("%d failed ValidateKubeProxyConfiguration: expected error %t, got error %t", i, rt.expectErr, err != nil)
			}
			if err != nil && !strings.Contains(err.Error(), rt.msg) {
				t.Errorf("%d failed ValidateKubeProxyConfiguration: unexpected error: %v, expected: %s", i, err, rt.msg)
			}
		})
	}
}

func TestValidateKubeletConfiguration(t *testing.T) {
	var tests = []struct {
		name          string
		clusterConfig *kubeadm.ClusterConfiguration
		expectErr     bool
	}{
		{
			name: "valid configuration",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					Kubelet: &kubeletconfig.KubeletConfiguration{
						CgroupsPerQOS:               true,
						EnforceNodeAllocatable:      []string{"pods", "system-reserved", "kube-reserved"},
						SystemReservedCgroup:        "/system.slice",
						KubeReservedCgroup:          "/kubelet.service",
						SystemCgroups:               "",
						CgroupRoot:                  "",
						EventBurst:                  10,
						EventRecordQPS:              5,
						HealthzPort:                 kubeadmconstants.KubeletHealthzPort,
						ImageGCHighThresholdPercent: 85,
						ImageGCLowThresholdPercent:  80,
						IPTablesDropBit:             15,
						IPTablesMasqueradeBit:       14,
						KubeAPIBurst:                10,
						KubeAPIQPS:                  5,
						MaxOpenFiles:                1000000,
						MaxPods:                     110,
						OOMScoreAdj:                 -999,
						PodsPerCore:                 100,
						Port:                        65535,
						ReadOnlyPort:                0,
						RegistryBurst:               10,
						RegistryPullQPS:             5,
						HairpinMode:                 "promiscuous-bridge",
						NodeLeaseDurationSeconds:    40,
					},
				},
			},
			expectErr: false,
		},
		{
			name: "invalid configuration",
			clusterConfig: &kubeadm.ClusterConfiguration{
				ComponentConfigs: kubeadm.ComponentConfigs{
					Kubelet: &kubeletconfig.KubeletConfiguration{
						CgroupsPerQOS:               false,
						EnforceNodeAllocatable:      []string{"pods", "system-reserved", "kube-reserved", "illegal-key"},
						SystemCgroups:               "/",
						CgroupRoot:                  "",
						EventBurst:                  -10,
						EventRecordQPS:              -10,
						HealthzPort:                 -10,
						ImageGCHighThresholdPercent: 101,
						ImageGCLowThresholdPercent:  101,
						IPTablesDropBit:             -10,
						IPTablesMasqueradeBit:       -10,
						KubeAPIBurst:                -10,
						KubeAPIQPS:                  -10,
						MaxOpenFiles:                -10,
						MaxPods:                     -10,
						OOMScoreAdj:                 -1001,
						PodsPerCore:                 -10,
						Port:                        0,
						ReadOnlyPort:                -10,
						RegistryBurst:               -10,
						RegistryPullQPS:             -10,
					},
				},
			},
			expectErr: true,
		},
	}
	for i, rt := range tests {
		t.Run(rt.name, func(t *testing.T) {
			err := ValidateKubeletConfiguration(rt.clusterConfig, nil).ToAggregate()
			if (err != nil) != rt.expectErr {
				t.Errorf("%d failed ValidateKubeletConfiguration: expected error %t, got error %t", i, rt.expectErr, err != nil)
			}
		})
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>SBT Compiler Maven Plugin - Project Dependencies</title>

    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta name="Date-Revision-yyyymmdd" content="20131129" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        Last Published: 29 Nov 2013
                   | Version: 1.0.0-beta2

            Maven 2

Project Documentation

                  Project Information

                  About

                  Plugin Management

                  Distribution Management

                  Dependency Information

                  Source Repository

                  Mailing Lists

                  Issue Tracking

                  Continuous Integration

                  Project Plugins

                  Project License

                  Project Team

                  Project Summary

            Dependencies

                  Project Reports

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId
ArtifactId
Version
Type
License

com.typesafe.zinc
zinc
0.3.0
jar
Apache 2

org.apache.maven
maven-artifact
2.2.1
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-model
2.2.1
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-plugin-api
2.2.1
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-project
2.2.1
jar
The Apache Software License, Version 2.0

org.codehaus.plexus
plexus-utils
3.0.15
jar
The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId
ArtifactId
Version
Type
License

org.apache.maven.plugin-tools
maven-plugin-annotations
3.2
jar
The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId
ArtifactId
Version
Classifier
Type
License

backport-util-concurrent
backport-util-concurrent
3.1
-
jar
Public Domain

classworlds
classworlds
1.1-alpha-2
-
jar
-

com.typesafe.sbt
compiler-interface
0.13.0
sources
jar
BSD-style

com.typesafe.sbt
incremental-compiler
0.13.0
-
jar
BSD-style

com.typesafe.sbt
sbt-interface
0.13.0
-
jar
BSD-style

junit
junit
3.8.1
-
jar
Common Public License Version 1.0

org.apache.maven
maven-artifact-manager
2.2.1
-
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-plugin-registry
2.2.1
-
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-profile
2.2.1
-
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-repository-metadata
2.2.1
-
jar
The Apache Software License, Version 2.0

org.apache.maven
maven-settings
2.2.1
-
jar
The Apache Software License, Version 2.0

org.apache.maven.wagon
wagon-provider-api
1.0-beta-6
-
jar
The Apache Software License, Version 2.0

org.codehaus.plexus
plexus-container-default
1.0-alpha-9-stable-1
-
jar
-

org.codehaus.plexus
plexus-interpolation
1.11
-
jar
The Apache Software License, Version 2.0

org.scala-lang
scala-compiler
2.10.2
-
jar
BSD-like

org.scala-lang
scala-library
2.10.2
-
jar
BSD-like

org.scala-lang
scala-reflect
2.10.2
-
jar
BSD-like

Project Dependency Graph

Dependency Tree

com.google.code.sbt-compiler-maven-plugin:sbt-compiler-maven-plugin:maven-plugin:1.0.0-beta2

SBT Compiler Maven Plugin

Description: SBT Compiler Maven Plugin

URL: https://sbt-compiler-maven-plugin.googlecode.com/svn/mavensite/1.0.0-beta2/

Project License: The Apache Software License, Version 2.0

com.typesafe.zinc:zinc:jar:0.3.0 (compile)

zinc

Description: zinc

URL: https://github.com/typesafehub/zinc

Project License: Apache 2

org.scala-lang:scala-library:jar:2.10.2 (compile)

Scala Library

Description: Standard library for the Scala Programming Language

URL: http://www.scala-lang.org/

Project License: BSD-like

com.typesafe.sbt:incremental-compiler:jar:0.13.0 (compile)

incremental-compiler

Description: incremental-compiler

URL: https://github.com/sbt/sbt

Project License: BSD-style

com.typesafe.sbt:sbt-interface:jar:0.13.0 (compile)

sbt-interface

Description: sbt-interface

URL: https://github.com/sbt/sbt

Project License: BSD-style

org.scala-lang:scala-compiler:jar:2.10.2 (compile)

Scala Compiler

Description: Compiler for the Scala Programming Language

URL: http://www.scala-lang.org/

Project License: BSD-like

org.scala-lang:scala-reflect:jar:2.10.2 (compile)

Scala Compiler

Description: Compiler for the Scala Programming Language

URL: http://www.scala-lang.org/

Project License: BSD-like

com.typesafe.sbt:compiler-interface:jar:sources:0.13.0 (compile)

compiler-interface

Description: compiler-interface

URL: https://github.com/sbt/sbt

Project License: BSD-style

org.apache.maven:maven-artifact:jar:2.2.1 (compile)

Maven Artifact

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-artifact

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-model:jar:2.2.1 (compile)

Maven Model

Description: Maven Model

URL: http://maven.apache.org/maven-model

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-plugin-api:jar:2.2.1 (compile)

Maven Plugin API

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-plugin-api

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-project:jar:2.2.1 (compile)

Maven Project Builder

Description: This library is used to not only read Maven project object model files, but to assemble inheritence
    and to retrieve remote models as required.

URL: http://maven.apache.org/maven-project

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-settings:jar:2.2.1 (compile)

Maven Local Settings Model

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-settings

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-profile:jar:2.2.1 (compile)

Maven Profile Model

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-profile

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-artifact-manager:jar:2.2.1 (compile)

Maven Artifact Manager

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-artifact-manager

Project License: The Apache Software License, Version 2.0

org.apache.maven:maven-repository-metadata:jar:2.2.1 (compile)

Maven Repository Metadata Model

Description: Per-directory repository metadata.

URL: http://maven.apache.org/maven-repository-metadata

Project License: The Apache Software License, Version 2.0

org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6 (compile)

Maven Wagon API

Description: Maven Wagon API that defines the contract between different Wagon implementations

URL: http://maven.apache.org/wagon/wagon-provider-api

Project License: The Apache Software License, Version 2.0

backport-util-concurrent:backport-util-concurrent:jar:3.1 (compile)

Backport of JSR 166

Description: Dawid Kurzyniec's backport of JSR 166

URL: http://backport-jsr166.sourceforge.net/

Project License: Public Domain

org.apache.maven:maven-plugin-registry:jar:2.2.1 (compile)

Maven Plugin Registry Model

Description: Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

URL: http://maven.apache.org/maven-plugin-registry

Project License: The Apache Software License, Version 2.0

org.codehaus.plexus:plexus-interpolation:jar:1.11 (compile)

Plexus Interpolation API

Description: There is currently no description associated with this project.

URL: http://plexus.codehaus.org/plexus-components/plexus-interpolation

Project License: The Apache Software License, Version 2.0

org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile)

Default Plexus Container

Description: There is currently no description associated with this project.

Project License: No license is defined for this project.

junit:junit:jar:3.8.1 (compile)

JUnit

Description: JUnit is a regression testing framework written by Erich Gamma and Kent Beck. It is used by the developer who implements unit tests in Java.

URL: http://junit.org

Project License: Common Public License Version 1.0

classworlds:classworlds:jar:1.1-alpha-2 (compile)

classworlds

Description: There is currently no description associated with this project.

URL: http://classworlds.codehaus.org/

Project License: No license is defined for this project.

org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 (provided)

Maven Plugin Java 5 Annotations

Description: Java 5 annotations to use in Mojos.

URL: http://maven.apache.org/plugin-tools/maven-plugin-annotations/

Project License: The Apache Software License, Version 2.0

org.codehaus.plexus:plexus-utils:jar:3.0.15 (compile)

Plexus Common Utilities

Description: A collection of various utility classes to ease working with strings, files, command lines, XML and
    more.

URL: http://plexus.codehaus.org/plexus-utils

Project License: The Apache Software License, Version 2.0

Licenses

Public Domain: Backport of JSR 166

Apache 2: zinc

Unknown: Default Plexus Container, classworlds

BSD-style: compiler-interface, incremental-compiler, sbt-interface

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Maven Artifact, Maven Artifact Manager, Maven Local Settings Model, Maven Model, Maven Plugin API, Maven Plugin Java 5 Annotations, Maven Plugin Registry Model, Maven Profile Model, Maven Project Builder, Maven Repository Metadata Model, Maven Wagon API, Plexus Common Utilities, Plexus Interpolation API, SBT Compiler Maven Plugin

BSD-like: Scala Compiler, Scala Library

Dependency File Details

Filename
Size
Entries
Classes
Packages
JDK Rev
Debug

backport-util-concurrent-3.1.jar
323.94 kB
251
239
5
1.4
debug

classworlds-1.1-alpha-2.jar
36.64 kB
32
22
3
1.1
debug

compiler-interface-0.13.0-sources.jar
22.35 kB
17
0
0
-
release

incremental-compiler-0.13.0.jar
1.85 MB
1,610
1,558
18
1.6
debug

sbt-interface-0.13.0.jar
44.25 kB
90
85
3
1.6
debug

zinc-0.3.0.jar
362.24 kB
232
227
1
1.6
debug

junit-3.8.1.jar
118.23 kB
119
100
6
1.1
debug

maven-artifact-2.2.1.jar
78.44 kB
94
64
15
1.5
debug

maven-artifact-manager-2.2.1.jar
65.99 kB
52
29
7
1.5
debug

maven-model-2.2.1.jar
85.54 kB
61
45
2
1.5
debug

maven-plugin-api-2.2.1.jar
12.08 kB
23
8
2
1.5
debug

maven-plugin-registry-2.2.1.jar
29.01 kB
28
9
2
1.5
debug

maven-profile-2.2.1.jar
34.53 kB
33
15
2
1.5
debug

maven-project-2.2.1.jar
152.62 kB
98
72
10
1.5
debug

maven-repository-metadata-2.2.1.jar
25.05 kB
24
6
2
1.5
debug

maven-settings-2.2.1.jar
47.89 kB
38
20
2
1.5
debug

maven-plugin-annotations-3.2.jar
14.73 kB
23
8
1
1.5
debug

wagon-provider-api-1.0-beta-6.jar
51.94 kB
62
41
8
1.4
debug

plexus-container-default-1.0-alpha-9-stable-1.jar
189.63 kB
215
175
28
1.1
debug

plexus-interpolation-1.11.jar
49.74 kB
55
40
5
1.4
debug

plexus-utils-3.0.15.jar
233.35 kB
128
103
9
1.5
debug

scala-compiler-2.10.2.jar
13.74 MB
8,709
8,560
60
1.6
debug

scala-library-2.10.2.jar
6.79 MB
4,958
4,894
59
1.6
debug

scala-reflect-2.10.2.jar
3.02 MB
2,039
2,025
10
1.6
debug

Total
Size
Entries
Classes
Packages
JDK Rev
Debug

24
27.34 MB
18,991
18,345
260
1.6
23

compile: 23
compile: 27.33 MB
compile: 18,968
compile: 18,337
compile: 259
-
compile: 22

provided: 1
provided: 14.73 kB
provided: 23
provided: 8
provided: 1
-
provided: 1

Dependency Repository Locations

Repo ID
URL
Release
Snapshot
Blacklisted

apache.snapshots
http://repository.apache.org/snapshots
-
Yes
-

sonatype-nexus-snapshots
https://oss.sonatype.org/content/repositories/snapshots
-
Yes
-

snapshots
http://snapshots.maven.codehaus.org/maven2
-
Yes
Yes

central
http://repo.maven.apache.org/maven2
Yes
-
-

Repository locations for each of the Dependencies.

Artifact
apache.snapshots
sonatype-nexus-snapshots
central

backport-util-concurrent:backport-util-concurrent:jar:3.1
-
-

classworlds:classworlds:jar:1.1-alpha-2
-
-

com.typesafe.sbt:compiler-interface:jar:sources:0.13.0
-
-

com.typesafe.sbt:incremental-compiler:jar:0.13.0
-
-

com.typesafe.sbt:sbt-interface:jar:0.13.0
-
-

com.typesafe.zinc:zinc:jar:0.3.0
-
-

junit:junit:jar:3.8.1
-
-

org.apache.maven:maven-artifact:jar:2.2.1
-
-

org.apache.maven:maven-artifact-manager:jar:2.2.1
-
-

org.apache.maven:maven-model:jar:2.2.1
-
-

org.apache.maven:maven-plugin-api:jar:2.2.1
-
-

org.apache.maven:maven-plugin-registry:jar:2.2.1
-
-

org.apache.maven:maven-profile:jar:2.2.1
-
-

org.apache.maven:maven-project:jar:2.2.1
-
-

org.apache.maven:maven-repository-metadata:jar:2.2.1
-
-

org.apache.maven:maven-settings:jar:2.2.1
-
-

org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2
-
-

org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6
-
-

org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
-
-

org.codehaus.plexus:plexus-interpolation:jar:1.11
-
-

org.codehaus.plexus:plexus-utils:jar:3.0.15
-
-

org.scala-lang:scala-compiler:jar:2.10.2
-
-
-

org.scala-lang:scala-library:jar:2.10.2
-
-
-

org.scala-lang:scala-reflect:jar:2.10.2
-
-
-

Total
apache.snapshots
sonatype-nexus-snapshots
central

24 (compile: 23, provided: 1)
0
0
21

        ©            2013

                          - Privacy Policy.
        Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.

redpajama_set_name: RedPajamaGithub


text:
/***************************************************************************/
/*                                                                         */
/*  fthash.h                                                               */
/*                                                                         */
/*    Hashing functions (specification).                                   */
/*                                                                         */
/***************************************************************************/

/*
 * Copyright 2000 Computing Research Labs, New Mexico State University
 * Copyright 2001-2015
 *   Francesco Zappa Nardelli
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

  /*************************************************************************/
  /*                                                                       */
  /*  This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50     */
  /*                                                                       */
  /*  taken from Mark Leisher's xmbdfed package                            */
  /*                                                                       */
  /*************************************************************************/

#ifndef FTHASH_H_
#define FTHASH_H_

#include <ft2build.h>
#include FT_FREETYPE_H

FT_BEGIN_HEADER

  typedef union  FT_Hashkey_
  {
    FT_Int       num;
    const char*  str;

  } FT_Hashkey;

  typedef struct  FT_HashnodeRec_
  {
    FT_Hashkey  key;
    size_t      data;

  } FT_HashnodeRec;

  typedef struct FT_HashnodeRec_  *FT_Hashnode;

  typedef FT_ULong
  (*FT_Hash_LookupFunc)( FT_Hashkey*  key );

  typedef FT_Bool
  (*FT_Hash_CompareFunc)( FT_Hashkey*  a,
                          FT_Hashkey*  b );

  typedef struct  FT_HashRec_
  {
    FT_UInt  limit;
    FT_UInt  size;
    FT_UInt  used;

    FT_Hash_LookupFunc   lookup;
    FT_Hash_CompareFunc  compare;

    FT_Hashnode*  table;

  } FT_HashRec;

  typedef struct FT_HashRec_  *FT_Hash;

  FT_Error
  ft_hash_str_init( FT_Hash    hash,
                    FT_Memory  memory );

  FT_Error
  ft_hash_num_init( FT_Hash    hash,
                    FT_Memory  memory );

  void
  ft_hash_str_free( FT_Hash    hash,
                    FT_Memory  memory );

#define ft_hash_num_free  ft_hash_str_free

  FT_Error
  ft_hash_str_insert( const char*  key,
                      size_t       data,
                      FT_Hash      hash,
                      FT_Memory    memory );

  FT_Error
  ft_hash_num_insert( FT_Int     num,
                      size_t     data,
                      FT_Hash    hash,
                      FT_Memory  memory );

  size_t*
  ft_hash_str_lookup( const char*  key,
                      FT_Hash      hash );

  size_t*
  ft_hash_num_lookup( FT_Int   num,
                      FT_Hash  hash );

FT_END_HEADER

#endif /* FTHASH_H_ */

/* END */


text:
using System;
using System.Collections;
using System.Windows.Forms;
using NUnit.Framework;
using NUnit.Util;

namespace NUnit.UiKit.Tests
{
	[TestFixture]
	public class RecentFileMenuHandlerTests
	{
		private MenuItem menu;
		private RecentFiles files;
		private RecentFileMenuHandler handler;

		[SetUp]
		public void SetUp()
		{
			menu = new MenuItem();
			files = new FakeRecentFiles();
			handler = new RecentFileMenuHandler( menu, files );
            handler.ShowMissingFiles = true;
        }

		[Test]
		public void DisableOnLoadWhenEmpty()
		{
			handler.Load();
			Assert.IsFalse( menu.Enabled );
		}

		[Test]
		public void EnableOnLoadWhenNotEmpty()
		{
			files.SetMostRecent( "Test" );
			handler.Load();
			Assert.IsTrue( menu.Enabled );
		}
		[Test]
		public void LoadMenuItems()
		{
			files.SetMostRecent( "Third" );
			files.SetMostRecent( "Second" );
			files.SetMostRecent( "First" );
			handler.Load();
			Assert.AreEqual( 3, menu.MenuItems.Count );
			Assert.AreEqual( "1 First", menu.MenuItems[0].Text );
		}

		private class FakeRecentFiles : RecentFiles
		{
			private RecentFilesCollection files = new RecentFilesCollection();
			private int maxFiles = 24;

			public int Count
			{
				get { return files.Count; }
			}

			public int MaxFiles
			{
				get { return maxFiles; }
				set { maxFiles = value; }
			}

			public void SetMostRecent( string fileName )
			{
				SetMostRecent( new RecentFileEntry( fileName ) );
			}

			public void SetMostRecent( RecentFileEntry entry )
			{
				files.Insert( 0, entry );
			}

			public RecentFilesCollection Entries
			{
				get { return files; }
			}

			public void Clear()
			{
				files.Clear();
			}

			public void Remove( string fileName )
			{
				files.Remove( fileName );
			}
		}

		// TODO: Need mock loader to test clicking
	}
}


text:
namespace safe_browsing {

class FileAnalysisRequest;
class FileOpeningJob;

}  // namespace safe_browsing

namespace enterprise_connectors {

// Handles deep scanning requests for multiple files which are specified by
// `paths_`. Files are scanned in parallel and piped to the BinaryUploadService
// `upload_service_`. On completion of the scan, `callback_` is called with the
// scanning results. After the scanning is complete, ReportWarningBypass can be
// called to report a warning bypass of all warned files.
class FilesRequestHandler : public RequestHandlerBase {
 public:
  // File information used as an input to event report functions.
  struct FileInfo {
    FileInfo();
    FileInfo(FileInfo&& other);
    ~FileInfo();

    // Hex-encoded SHA256 hash for the given file.
    std::string sha256;

    // File size in bytes. -1 represents an unknown size.
    uint64_t size = 0;

    // File mime type.
    std::string mime_type;
  };

  // Callback that informs caller of scanning verdicts for each file.
  using CompletionCallback =
      base::OnceCallback<void(std::vector<RequestHandlerResult>)>;

  // A factory function used in tests to create fake FilesRequestHandler
  // instances.
  using Factory = base::RepeatingCallback<std::unique_ptr<FilesRequestHandler>(
      safe_browsing::BinaryUploadService* upload_service,
      Profile* profile,
      const enterprise_connectors::AnalysisSettings& analysis_settings,
      GURL url,
      const std::string& source,
      const std::string& destination,
      safe_browsing::DeepScanAccessPoint access_point,
      const std::vector<base::FilePath>& paths,
      CompletionCallback callback)>;

  // Create an instance of FilesRequestHandler. If a factory is set, it will be
  // used instead.
  // Note that `analysis_settings` is saved as const reference and not copied.
  // The calling side is responsible that `analysis_settings` is not destroyed
  // before scanning is completed.
  static std::unique_ptr<FilesRequestHandler> Create(
      safe_browsing::BinaryUploadService* upload_service,
      Profile* profile,
      const enterprise_connectors::AnalysisSettings& analysis_settings,
      GURL url,
      const std::string& source,
      const std::string& destination,
      safe_browsing::DeepScanAccessPoint access_point,
      const std::vector<base::FilePath>& paths,
      CompletionCallback callback);

  // In tests, sets a factory function for creating fake FilesRequestHandlers.
  static void SetFactoryForTesting(Factory factory);
  static void ResetFactoryForTesting();

  ~FilesRequestHandler() override;

  void ReportWarningBypass(
      absl::optional<std::u16string> user_justification) override;

 protected:
  FilesRequestHandler(
      safe_browsing::BinaryUploadService* upload_service,
      Profile* profile,
      const enterprise_connectors::AnalysisSettings& analysis_settings,
      GURL url,
      const std::string& source,
      const std::string& destination,
      safe_browsing::DeepScanAccessPoint access_point,
      const std::vector<base::FilePath>& paths,
      CompletionCallback callback);

  bool UploadDataImpl() override;

  void FileRequestCallbackForTesting(
      base::FilePath path,
      safe_browsing::BinaryUploadService::Result result,
      enterprise_connectors::ContentAnalysisResponse response);

 private:
  // Prepares an upload request for the file at `path`.  If the file
  // cannot be uploaded it will have a failure verdict added to `result_`.
  safe_browsing::FileAnalysisRequest* PrepareFileRequest(size_t index);

  // Called when the file info for `path` has been fetched. Also begins the
  // upload process.
  void OnGotFileInfo(
      std::unique_ptr<safe_browsing::BinaryUploadService::Request> request,
      size_t index,
      safe_browsing::BinaryUploadService::Result result,
      safe_browsing::BinaryUploadService::Request::Data data);

  // Called when a request is finished early without uploading it.
  // This is, e.g., called for encrypted files and responsible for posting the
  // required data to safe-browsing ui.
  void FinishRequestEarly(
      std::unique_ptr<safe_browsing::BinaryUploadService::Request> request,
      safe_browsing::BinaryUploadService::Result result);

  // Upload the request for deep scanning using the binary upload service.
  // These methods exist so they can be overridden in tests as needed.
  // The `result` argument exists as an optimization to finish the request early
  // when the result is known in advance to avoid using the upload service.
  virtual void UploadFileForDeepScanning(
      safe_browsing::BinaryUploadService::Result result,
      const base::FilePath& path,
      std::unique_ptr<safe_browsing::BinaryUploadService::Request> request);

  void FileRequestCallback(
      size_t index,
      safe_browsing::BinaryUploadService::Result result,
      enterprise_connectors::ContentAnalysisResponse response);

  void MaybeCompleteScanRequest();

  // Owner of the FileOpeningJob responsible for opening files on parallel
  // threads. Always nullptr for non-file content scanning.
  std::unique_ptr<safe_browsing::FileOpeningJob> file_opening_job_;

  std::vector<base::FilePath> paths_;
  std::vector<FileInfo> file_info_;

  // The number of file scans that have completed. If more than one file is
  // requested for scanning in `data_`, each is scanned in parallel with
  // separate requests.
  size_t file_result_count_ = 0;

  std::vector<RequestHandlerResult> results_;

  // Scanning responses of files that got DLP warning verdicts.
  std::map<size_t, enterprise_connectors::ContentAnalysisResponse>
      file_warnings_;

  // This is set to true as soon as a TOO_MANY_REQUESTS response is obtained. No
  // more data should be upload for `this` at that point.
  bool throttled_ = false;

  CompletionCallback callback_;

  base::WeakPtrFactory<FilesRequestHandler> weak_ptr_factory_{this};
};

}  // namespace enterprise_connectors

#endif  // CHROME_BROWSER_ENTERPRISE_CONNECTORS_ANALYSIS_FILES_REQUEST_HANDLER_H_


text:
<!DOCTYPE html>

    <title>daily_work_log_list</title>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="shortcut icon" href="favicon.ico" th:href="@{/favicon.ico}" />
    <link href="../../css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet" media="screen"/>
    <link rel="stylesheet" th:href="@{/css/bootstrap-responsive.min.css}" href="../../css/bootstrap-responsive.min.css" media="screen"/>
    <link rel="stylesheet" th:href="@{/css/plugins/prettify.css}" href="../../css/plugins/prettify.css" media="screen"/>
    <link rel="stylesheet" th:href="@{/css/self-main.css}" href="../../css/self-main.css" media="screen"/>

Home /

Daily /

Work Log

      <form class="form-inline form-search" action="#" th:action="@{/daily/work/log}" enctype="application/x-www-form-urlencoded" method="get">
         Add New Work Log
        <button type="button" class="btn btn-hide-content" data-toggle="button"> Hide Content</button>
        <input type="hidden" name="start" th:value="${condition == null ? '0' : condition.start}"/>
        <input type="hidden" name="limit" th:value="${(condition == null or condition.limit == 0) ? '10' : condition.limit}"/>

          <input type="text" name="key" class="input-large" th:value="${condition == null ? '' : condition.key}" placeholder="key word or date"/>
          <input type="text" name="tag" class="input-small" th:value="${condition == null ? '' : condition.tag}" placeholder="tag"/>
          <button type="submit" class="btn">Search</button>

      </form>

Work Name

        Work Comment

            <div class="btn-group">
              <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                Action
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <!-- dropdown menu links -->
              </ul>
            </div>

2012-12-10

          edit
          <button class="btn btn-delete-div btn-mini btn-danger" id="1" th:id="${tpl.id}">delete</button>

Work Name

        Work Comment

            <div class="btn-group">
              <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                Action
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <!-- dropdown menu links -->
              </ul>
            </div>

            edit
            <button class="btn btn-delete-div btn-mini btn-danger" id="1" th:id="${tpl.id}">delete</button>

        未找到相关数据

<<

1/10

>>


text:
import logging
import discord.utils
from discord import Embed, Color
from tabulate import tabulate
from libs.echoes import ee_libs

logger = logging.getLogger('gradiusbot')

logger.info("[Public Plugin] <echoes_pi_target.py> Tracking for PI mining targets.")

help_str = """**Available Commands:**
```
!pp help - this command
!pp list - list all available Planetary Production items
!pp update <ITEM_LIST> - update the target Planetary Production list. Separate each item in <ITEM_LIST> with a comma.
```

**Example Update Command:**
```
!pp update nanites,dark compound,plasmoids
```
"""

product_strings = [
    "base metals",
    "condensates",
    "heavy water",
    "fiber composite",
    "smartfab units",
    "lustering alloy",
    "toxic metals",
    "coolant",
    "noble gas",
    "opulent compound",
    "silicate glass",
    "motley compound",
    "heavy metals",
    "reactive gas",
    "noble metals",
    "condensed alloy",
    "sheen compound",
    "supertensile plastics",
    "suspended plasma",
    "industrial fibers",
    "lucent compound",
    "liquid ozone",
    "polyaramids",
    "construction blocks",
    "reactive metals",
    "plasmoids",
    "gleaming alloy",
    "crystal compound",
    "glossy compound",
    "ionic solutions",
    "dark compound",
    "precious alloy",
    "oxygen isotopes",
    "nanites"
]

async def action(**kwargs):
    """
    :param kwargs:
    :return:
    """
    message = kwargs['message']
    config = kwargs['config']
    client = kwargs['client']

    required_user_role = config.get('echoes', 'industry_role')
    in_industry_role = discord.utils.get(message.author.roles, name=required_user_role)

    split_content = message.content.split()

    if split_content[0] == '!pp' and in_industry_role:
        if split_content[1] == 'update':
            if len(split_content) >= 3:
                pi_targets = ' '.join(split_content[2:]).split(',')

                invalid_items = []
                valid_items = []
                for target_item in pi_targets:
                    target_item = target_item.lower().strip()

                    if target_item not in product_strings:
                        invalid_items.append(target_item)
                    else:
                        valid_items.append(target_item)

                if len(invalid_items) > 0:
                    status_embed = Embed(title="Planetary Production Corp Target - Update Failed", color=Color.red(),
                                         description="Some invalid items were found. List valid item names with `!pp list`")
                    status_embed.add_field(name="Valid Items", value="\n".join(valid_items), inline=False)
                    status_embed.add_field(name="Invalid Items", value="\n".join(invalid_items), inline=False)
                    await message.channel.send(embed=status_embed)

                else:
                    status_embed = Embed(title="Planetary Production Corp Target - Update", color=Color.green(),
                                         description="These are the Planetary Production items you should produce for the corporation")
                    status_embed.add_field(name="Needed Items", value="\n".join(valid_items), inline=False)

                    with open('echoes_pp_target_msg_id', 'r') as id_file:
                        old_id = id_file.read()
                        if old_id != '':
                            try:
                                old_message = await message.channel.fetch_message(int(old_id))
                                if old_message:
                                    await old_message.unpin()
                            except:
                                await message.channel.send("Unable to unpin old message. Please unpin manually.")

                    new_message = await message.channel.send(embed=status_embed)

                    for t_item in valid_items:
                        out_msg_list = []
                        best_locations = ee_libs.get_best_planets(t_item, max_locations=5)
                        for location in best_locations:
                            out_msg_list.append([location.jumps, location.planet, location.richness, location.output])
                        location_table = tabulate(out_msg_list, headers=["Jumps", "Planet", "Richness", "Output"])
                        await message.channel.send(f"**{t_item}**\n```\n{location_table}\n```")

                    await new_message.pin()
                    with open('echoes_pp_target_msg_id', 'w') as id_file:
                        id_file.write(str(new_message.id))

        if split_content[1] == 'list':
            item_embed = Embed(title="Planetary Production Corp Target - Item List", color=Color.green(),
                               description="This are the valid item names to include in your command. Separate each item with a comma.")
            item_embed.add_field(name="Valid Items", value="\n".join(product_strings), inline=False)
            await message.channel.send(embed=item_embed)

        if split_content[1] == 'help':
            await message.channel.send(help_str)


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;

using Facepunch;
using Network;
using Rust;
using UnityEngine;

using Oxide.Core;
using Oxide.Core.Configuration;
using Oxide.Core.Extensions;

using Oxide.Game.Rust.Libraries;

namespace Oxide.Game.Rust
{
    /// <summary>
    /// The extension class that represents this extension
    /// </summary>
    public class RustExtension : Extension
    {
        /// <summary>
        /// Gets the name of this extension
        /// </summary>
        public override string Name => "Rust";

        /// <summary>
        /// Gets the version of this extension
        /// </summary>
        public override VersionNumber Version => new VersionNumber(1, 0, 0);

        /// <summary>
        /// Gets the author of this extension
        /// </summary>
        public override string Author => "Oxide Team";

        public override string[] WhitelistAssemblies => new[] { "Assembly-CSharp", "Assembly-CSharp-firstpass", "DestMath", "mscorlib", "Oxide.Core", "Oxide.Game.Rust", "protobuf-net", "RustBuild", "System", "System.Core", "UnityEngine" };
        public override string[] WhitelistNamespaces => new[] { "ConVar", "Dest", "Facepunch", "Network", "Oxide.Game.Rust.Cui", "ProtoBuf", "PVT", "Rust", "Steamworks", "System.Collections", "System.Security.Cryptography", "System.Text", "UnityEngine" };

        private static readonly string[] Filter =
        {
            "AngryAnt Behave version",
            "HDR RenderTexture format is not supported on this platform.",
            "Image Effects are not supported on this platform.",
            "The image effect Main Camera",
            "The image effect effect -",
            "Unable to find shaders",
            "Unsupported encoding: 'utf8'",
            "[SpawnHandler] populationCounts"
        };

        /// <summary>
        /// Caches the OxideMod.rootconfig field
        /// </summary>
        readonly FieldInfo rootconfig = typeof(OxideMod).GetField("rootconfig", BindingFlags.NonPublic | BindingFlags.Instance);

        public class Folders
        {
            public string Source { get; }
            public string Target { get; }

            public Folders(string source, string target)
            {
                Source = source;
                Target = target;
            }
        }

        /// <summary>
        /// Initializes a new instance of the RustExtension class
        /// </summary>
        /// <param name="manager"></param>
        public RustExtension(ExtensionManager manager)
            : base(manager)
        {

        }

        /// <summary>
        /// Loads this extension
        /// </summary>
        public override void Load()
        {
            // Register our loader
            Manager.RegisterPluginLoader(new RustPluginLoader());

            // Register our libraries
            Manager.RegisterLibrary("Command", new Command());
            Manager.RegisterLibrary("Rust", new Libraries.Rust());

            // Check if folder migration is needed
            var config = (OxideConfig)rootconfig.GetValue(Interface.Oxide);
            string rootDirectory = Interface.Oxide.RootDirectory;
            string currentDirectory = Interface.Oxide.InstanceDirectory;
            string fallbackDirectory = Path.Combine(rootDirectory, config.InstanceCommandLines[config.InstanceCommandLines.Length - 1]);
            string oldFallbackDirectory = Path.Combine(rootDirectory, "server");

            if (!Directory.Exists(oldFallbackDirectory)) return;
            if (currentDirectory == oldFallbackDirectory) return;

            // Migrate existing oxide folders from the old fallback directory to the new one
            string[] oxideDirectories = { config.PluginDirectory, config.ConfigDirectory, config.DataDirectory, config.LogDirectory };
            foreach (var dir in oxideDirectories)
            {
                string source = Path.Combine(oldFallbackDirectory, dir);
                string target = Path.Combine(currentDirectory, dir);

                if (Directory.Exists(source))
                {
                    var stack = new Stack<Folders>();
                    stack.Push(new Folders(source, target));

                    while (stack.Count > 0)
                    {
                        var folders = stack.Pop();
                        Directory.CreateDirectory(folders.Target);
                        foreach (var file in Directory.GetFiles(folders.Source, "*"))
                        {
                            string targetFile = Path.Combine(folders.Target, Path.GetFileName(file));
                            if (File.Exists(targetFile) && File.Exists(file))
                            {
                                int i = 1;
                                string newTargetFile = targetFile + ".old";
                                while (File.Exists(newTargetFile)) {
                                    newTargetFile = targetFile + ".old" + i;
                                    i++;
                                }
                                File.Move(file, newTargetFile);
                            }
                            else
                                File.Move(file, targetFile);
                        }

                        foreach (var folder in Directory.GetDirectories(folders.Source))
                            stack.Push(new Folders(folder, Path.Combine(folders.Target, Path.GetFileName(folder))));
                    }

                    Directory.Delete(source, true);
                }
            }
        }

        /// <summary>
        /// Loads plugin watchers used by this extension
        /// </summary>
        /// <param name="plugindir"></param>
        public override void LoadPluginWatchers(string plugindir)
        {

        }

        /// <summary>
        /// Called when all other extensions have been loaded
        /// </summary>
        public override void OnModLoad()
        {

        }

        internal static void EnableConsole()
        {
            if (!Interface.Oxide.CheckConsole(true) || !Interface.Oxide.EnableConsole()) return;

            Output.OnMessage += HandleLog;
            Interface.Oxide.ServerConsole.Input += ServerConsoleOnInput;

            Interface.Oxide.ServerConsole.Title = () =>
            {
                var players = BasePlayer.activePlayerList.Count;
                var hostname = ConVar.Server.hostname;
                return string.Concat(players, " | ", hostname);
            };

            Interface.Oxide.ServerConsole.Status1Left = () =>
            {
                var hostname = ConVar.Server.hostname;
                return string.Concat(" ", hostname);
            };
            Interface.Oxide.ServerConsole.Status1Right = () =>
            {
                var fps = Performance.frameRate;
                var uptime = Number.FormatSeconds((int)Time.realtimeSinceStartup);
                return string.Concat(fps, "fps, ", uptime);
            };

            Interface.Oxide.ServerConsole.Status2Left = () =>
            {
                var players = BasePlayer.activePlayerList.Count;
                var playerLimit = (Net.sv == null ? 0 : Net.sv.maxConnections);
                var sleeperCount = BasePlayer.sleepingPlayerList.Count;
                var sleepers = sleeperCount + (sleeperCount.Equals(1) ? " sleeper" : " sleepers");
                var entitiesCount = BaseNetworkable.serverEntities.Count;
                var entities = entitiesCount + (entitiesCount.Equals(1) ? " entity" : " entities");
                return string.Concat(" ", players, "/", playerLimit, " players, ", sleepers, ", ", entities);
            };
            Interface.Oxide.ServerConsole.Status2Right = () =>
            {
                if (Net.sv == null || !Net.sv.IsConnected()) return "not connected";
                var inbound = Number.FormatMemoryShort(Net.sv.GetStat(null, NetworkPeer.StatTypeLong.BytesReceived_LastSecond));
                var outbound = Number.FormatMemoryShort(Net.sv.GetStat(null, NetworkPeer.StatTypeLong.BytesSent_LastSecond));
                return string.Concat(inbound, "/s in, ", outbound, "/s out");
            };

            Interface.Oxide.ServerConsole.Status3Left = () =>
            {
                var gameTime = (!TOD_Sky.Instance ? DateTime.Now : TOD_Sky.Instance.Cycle.DateTime).ToString("h:mm tt").ToLower();
                return string.Concat(" ", gameTime, ", ", ConVar.Server.level, " [", ConVar.Server.worldsize, ", ", ConVar.Server.seed, "]");
            };
            Interface.Oxide.ServerConsole.Status3Right = () =>
            {
                var gameVersion = typeof(Protocol).GetField("network").GetValue(null).ToString();
                var oxideVersion = OxideMod.Version.ToString();
                return string.Concat("Oxide ", oxideVersion, " for Protocol ", gameVersion);
            };
            Interface.Oxide.ServerConsole.Status3RightColor = ConsoleColor.Yellow;

            Interface.Oxide.ServerConsole.Completion = input =>
            {
                if (string.IsNullOrEmpty(input)) return null;
                if (!input.Contains(".")) input = string.Concat("global.", input);
                return ConsoleSystem.Index.GetAll().Where(c => c.namefull.StartsWith(input.ToLower())).ToList().ConvertAll(c => c.namefull).ToArray();
            };
        }

        private static void ServerConsoleOnInput(string input)
        {
            ConsoleSystem.Run.Server.Normal(input);
        }

        private static void HandleLog(string message, string stackTrace, LogType type)
        {
            if (string.IsNullOrEmpty(message) || Filter.Any(message.Contains)) return;
            var color = ConsoleColor.Gray;
            if (type == LogType.Warning)
            {
                color = ConsoleColor.Yellow;
                ConVar.Server.Log("Log.Warning.txt", message);
            }
            else if (type == LogType.Error)
            {
                color = ConsoleColor.Red;
                ConVar.Server.Log("Log.Error.txt", message);
            }
            else if (!message.StartsWith("[CHAT]"))
                ConVar.Server.Log("Log.Log.txt", message);
            Interface.Oxide.ServerConsole.AddMessage(message, color);
        }
    }
}


text:
Dir[File.join(__dir__, 'concerns', '*.rb')].each { |f| require_dependency f }
Dir[File.join(__dir__, 'queries', '*.rb')].each { |f| require_dependency f }

module Stats
  module ManagementInformation
    class DailyReportQuery
      include JourneyQueryable
      include ClaimTypeFilterable

      def self.call(...)
        new(...).call
      end

      def initialize(**kwargs)
        self.scheme = kwargs[:scheme]
        raise ArgumentError, 'scheme must be "agfs" or "lgfs"' if @scheme.present? && %w[AGFS LGFS].exclude?(@scheme)
      end

      def call
        prepare
        transform(journeys)
      end

      private

      def journeys
        ActiveRecord::Base.connection.execute(journeys_query)
      end

      def transform(result)
        result.to_a.map(&:deep_symbolize_keys).map do |el|
          el.each_with_object({}) do |(k, v), h|
            h[k] = k.eql?(:journey) ? JSON.parse(v, symbolize_names: true) : v
          end
        end
      end
    end
  end
end


text:
class UnitId(object):
    def __init__(self, playerId, unitSubId):
        assert playerId  >= 0
        assert unitSubId >= 0
        self.playerId = playerId
        self.subId    = unitSubId

    def __cmp__(self, other):
        if self.playerId != other.playerId:
            return self.playerId - other.playerId
        return self.subId - other.subId

    def __hash__(self):
        return hash((self.playerId, self.subId))

    def __repr__(self):
        return repr((self.playerId, self.subId))

# TODO: These names sound like they're for coordinate conversions. Need to put
# an actual noun somewhere in the name.
def unitToPlayer(unitId):
    return unitId.playerId

def getUnitSubId(unitId):
    return unitId.subId

# For using UnitIds in messages
def encodeUnitId(unitId):
    return (str(unitId.playerId), str(unitId.subId))

def parseUnitId(words):
    # TODO: Somewhere higher up, handle all exceptions in parsing functions and
    # turn them into InvalidMessageErrors. Do we do this already?
    playerId, subId = map(int, words)
    return UnitId(playerId, subId)


text:
// flowlint ambiguous-object-type:error

'use strict';

const SchemaUtils = require('../../core/SchemaUtils');

const {createUserError} = require('../../core/CompilerError');
const {
  buildFragmentSpread,
  buildOperationArgumentDefinitions,
} = require('./utils');

import type {Fragment} from '../../core/IR';
import type {Schema} from '../../core/Schema';
import type {QueryGenerator, RefetchRoot} from '.';

const NODE_TYPE_NAME = 'Node';
const NODE_FIELD_NAME = 'node';

function buildRefetchOperation(
  schema: Schema,
  fragment: Fragment,
  queryName: string,
): ?RefetchRoot {
  const eligible =
    schema.getTypeString(fragment.type) === NODE_TYPE_NAME ||
    (schema.isObject(fragment.type) &&
      schema
        .getInterfaces(schema.assertCompositeType(fragment.type))
        .some(interfaceType =>
          schema.areEqualTypes(
            interfaceType,
            schema.expectTypeFromString(NODE_TYPE_NAME),
          ),
        )) ||
    (schema.isAbstractType(fragment.type) &&
      Array.from(
        schema.getPossibleTypes(schema.assertAbstractType(fragment.type)),
      ).every(possibleType =>
        schema.implementsInterface(
          schema.assertCompositeType(possibleType),
          schema.assertInterfaceType(
            schema.expectTypeFromString(NODE_TYPE_NAME),
          ),
        ),
      ));
  if (!eligible) {
    return null;
  }

  const queryType = schema.expectQueryType();
  const nodeType = schema.getTypeFromString(NODE_TYPE_NAME);
  const nodeField = schema.getFieldConfig(
    schema.expectField(queryType, NODE_FIELD_NAME),
  );
  if (
    !(
      nodeType &&
      schema.isInterface(nodeType) &&
      schema.isInterface(nodeField.type) &&
      schema.areEqualTypes(nodeField.type, nodeType) &&
      nodeField.args.length === 1 &&
      schema.areEqualTypes(
        schema.getNullableType(nodeField.args[0].type),
        schema.expectIdType(),
      ) &&
      // the fragment must be on Node or on a type that implements Node
      ((schema.isObject(fragment.type) &&
        schema
          .getInterfaces(schema.assertCompositeType(fragment.type))
          .some(interfaceType =>
            schema.areEqualTypes(interfaceType, nodeType),
          )) ||
        (schema.isAbstractType(fragment.type) &&
          Array.from(
            schema.getPossibleTypes(schema.assertAbstractType(fragment.type)),
          ).every(possibleType =>
            schema
              .getInterfaces(schema.assertCompositeType(possibleType))
              .some(interfaceType =>
                schema.areEqualTypes(interfaceType, nodeType),
              ),
          )))
    )
  ) {
    throw createUserError(
      `Invalid use of @refetchable on fragment '${fragment.name}', check ` +
        'that your schema defines a `Node { id: ID }` interface and has a ' +
        '`node(id: ID): Node` field on the query type (the id argument may ' +
        'also be non-null).',
      [fragment.loc],
    );
  }

  // name and type of the node(_: ID) field parameter
  const idArgName = nodeField.args[0].name;
  const idArgType = nodeField.args[0].type;
  // name and type of the query variable
  const idVariableType = SchemaUtils.getNonNullIdInput(schema);
  const idVariableName = 'id';

  const argumentDefinitions = buildOperationArgumentDefinitions(
    fragment.argumentDefinitions,
  );
  const idArgument = argumentDefinitions.find(
    argDef => argDef.name === idVariableName,
  );
  if (idArgument != null) {
    throw createUserError(
      `Invalid use of @refetchable on fragment \`${fragment.name}\`, this ` +
        'fragment already has an `$id` variable in scope.',
      [idArgument.loc],
    );
  }
  const argumentDefinitionsWithId = [
    ...argumentDefinitions,
    {
      defaultValue: null,
      kind: 'LocalArgumentDefinition',
      loc: {kind: 'Derived', source: fragment.loc},
      name: idVariableName,
      type: idVariableType,
    },
  ];
  return {
    identifierField: 'id',
    path: [NODE_FIELD_NAME],
    node: {
      argumentDefinitions: argumentDefinitionsWithId,
      directives: [],
      kind: 'Root',
      loc: {kind: 'Derived', source: fragment.loc},
      metadata: null,
      name: queryName,
      operation: 'query',
      selections: [
        {
          alias: NODE_FIELD_NAME,
          args: [
            {
              kind: 'Argument',
              loc: {kind: 'Derived', source: fragment.loc},
              name: idArgName,
              type: schema.assertInputType(idArgType),
              value: {
                kind: 'Variable',
                loc: {kind: 'Derived', source: fragment.loc},
                variableName: idVariableName,
                type: idVariableType,
              },
            },
          ],
          connection: false,
          directives: [],
          handles: null,
          kind: 'LinkedField',
          loc: {kind: 'Derived', source: fragment.loc},
          metadata: null,
          name: NODE_FIELD_NAME,
          selections: [buildFragmentSpread(fragment)],
          type: schema.assertLinkedFieldType(nodeType),
        },
      ],
      type: queryType,
    },
    transformedFragment: enforceIDField(schema, fragment),
  };
}

function enforceIDField(schema: Schema, fragment: Fragment): Fragment {
  const idSelection = fragment.selections.find(
    selection =>
      selection.kind === 'ScalarField' &&
      selection.name === 'id' &&
      selection.alias === 'id' &&
      schema.areEqualTypes(
        schema.getNullableType(selection.type),
        schema.expectIdType(),
      ),
  );
  if (idSelection) {
    return fragment;
  }
  return {
    ...fragment,
    selections: [
      ...fragment.selections,
      SchemaUtils.generateIDField(schema.expectIdType()),
    ],
  };
}

module.exports = ({
  description: 'the Node interface or types implementing the Node interface',
  buildRefetchOperation,
}: QueryGenerator);


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28877_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans356.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Page 2 ' SFN 2468 (04-2010)
GEOLOGICAL MARKERS PLUG BACK INFORMATION
MD (Ft) TVD (Ft) Well Bore Type of Plug Top (Ft) Bottom (Ft) Sacks Cement Tops below from CBL _—
Mowry

Drill Pipe Recovery

Sample Chamber Recovery
Test Date op(Ft) B (Ft) BH Te) CL p H23 Shut-in1(PSlG)
Drill Pipe Recovery
Sample Chamber Recovery Test Date Top (Ft) Bottom (Ft) BH Temp (°F) CL ppm H28 ppm Shut-int (PSlG) Shut-in 2 (PSlG)
Drill Pipe Recovery

Sample Chamber Recovery

Test Date Formation Top (Ft) Bottom (Ft) BH Temp (°F) CL ppm H28 ppm Shut-in 1 (PSlG) Shut-in 2 (PSlG)

Drill Pipe Recovery

Sample Chamber Recovery


text:
/**
 * @overview Default states
 */
import { homedir } from "os";
import { join } from "path";

export const dir = {
  // Controls the default dir to open
  // Should be config.user.openTo
  dir: "C:\\", // homedir()
  past: [],
  future: [],
};

export const selectedFiles = [];


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Novitates Mycologicae 179 (1939)

#### Original name
Tapesia corni Velen.

### Remarks
null


text:
<form class="form-horizontal" role="form">

      <input type="text" id="id_user" hidden>

            Rut:

              <input type="text" class="form-control" id="rut" placeholder="11111111-1" maxlength="10">

            Nombres:

              <input type="text" class="form-control" id="Nombres" placeholder="Juan Andres">

            Apellidos:

              <input type="text" class="form-control" id="Apellidos" placeholder="Soto Soto">

            Tipo Usuario:

                <select id="Tipo_user" class="form-control">
                </select>

            Estado:

                <select id="estado_user" class="form-control">
                <option value="SELECCIONE">SELECCIONE</option>
                <option value="ACTIVO" selected>Activo</option>
                <option value="INACTIVO">Inactivo</option>
                </select>

      <button id="actualizar_user" class="btn btn-warning" disabled>Actualizar</button>

      <button id="guardar_user" class="btn btn-success">Guardar</button>

  </form>


text:
require 'spec_helper'

describe ComposerParser do
  let(:parser){ ComposerParser.new }
  let(:test_file_url ){ "https://s3.amazonaws.com/veye_test_env/composer.json" }

  let(:product_01){ ProductFactory.create_for_composer("symfony/symfony", "2.0.7") }
  let(:product_23){ ProductFactory.create_for_bower("bootstrap", "3.3") }
  let(:product_24){ ProductFactory.create_for_npm("request", "1.0.0") }

  let(:dep1){
    Projectdependency.new(
      language: Product::A_LANGUAGE_PHP,
      prod_key: 'symfony/symfony',
      name: 'symfony/symfony'
    )
  }

  describe 'parse_requested_version' do
    before do
      product_01.versions << Version.new(version: '0.1.2')
      product_01.versions << Version.new(version: '0.9')
      product_01.versions << Version.new(version: '1.0.0')
      product_01.versions << Version.new(version: '2.0.7')
      product_01.versions << Version.new(version: '2.2.9')
      product_01.versions << Version.new(version: '3.0.0')
      product_01.versions << Version.new(version: '3.0.1')
      product_01.save
    end

    it 'resolves correctly caret version `^0.1`' do
      parser.parse_requested_version('^0.1', dep1, product_01)
      expect(dep1[:comperator]).to eq('^')
      expect(dep1[:version_label]).to eq('^0.1')
      expect(dep1[:version_requested]).to eq('0.1.2')
    end

    it 'resolves correctly caret version `^0.1.0`' do
      parser.parse_requested_version('^0.1.0', dep1, product_01)
      expect(dep1[:comperator]).to eq('^')
      expect(dep1[:version_label]).to eq('^0.1.0')
      expect(dep1[:version_requested]).to eq('0.1.2')
    end

    it 'resolves correctly caret version `^2.0.7`' do
      parser.parse_requested_version('^2.0.7', dep1, product_01)

      expect(dep1[:comperator]).to eq('^')
      expect(dep1[:version_label]).to eq('^2.0.7')
      expect(dep1[:version_requested]).to eq('2.2.9')
    end
  end

  describe 'fetch_product_for' do
    before do
      product_01.save
      product_23.save
      product_24.save
    end

    it "returns correct Composer product" do
      prod = parser.fetch_product_for 'symfony/symfony'

      expect( prod ).not_to be_nil
      expect( prod[:language] ).to  eq(product_01[:language])
      expect( prod[:prod_key] ).to  eq(product_01[:prod_key])
      expect( prod[:name] ).to      eq(product_01[:name])
    end

    it "returns correct Bower product" do
      prod = parser.fetch_product_for 'bower-asset/bootstrap'

      expect( prod ).not_to be_nil
      expect( prod[:language] ).to  eq(product_23[:language])
      expect( prod[:prod_key] ).to  eq(product_23[:prod_key])
      expect( prod[:name] ).to      eq(product_23[:name])
    end

    it "returns correct NPM product" do
      prod = parser.fetch_product_for 'npm-asset/request'

      expect( prod ).not_to be_nil
      expect( prod[:language] ).to  eq(product_24[:language])
      expect( prod[:prod_key] ).to  eq(product_24[:prod_key])
      expect( prod[:name] ).to      eq(product_24[:name])
    end

  end

  describe 'parse_content' do

    it 'parses the content' do
      cp = CommonParser.new
      response = cp.fetch_response test_file_url
      project = parser.parse_content response.body

      expect( project ).not_to be_nil
    end

  end

  describe "parse" do

    def fetch_by_name(dependencies, name)
      dependencies.each do |dep|
        return dep if dep.name.eql? name
      end
    end

    it "parse from https the file correctly" do
      parser  = ComposerParser.new
      project = parser.parse(test_file_url)
      expect( project ).not_to be_nil
    end

    it "parse from http the file correctly" do
      product_01.versions << Version.new({ :version => "2.0.7-dev" })
      product_01.save

      product_02 = ProductFactory.create_for_composer("symfony/doctrine-bundle", "2.0.7")
      product_02.save

      product_03 = ProductFactory.create_for_composer("symfony/process", "2.0.7")
      product_03.versions.push( Version.new({ :version => "2.0.6" }) )
      product_03.versions.push( Version.new({ :version => "dev-master" }) )
      product_03.save

      product_04 = ProductFactory.create_for_composer("symfony/browser-kit", "2.0.7")
      product_04.versions.push( Version.new({ :version => "2.0.6" }) )
      product_04.save

      product_05 = ProductFactory.create_for_composer("symfony/security-bundle", "2.0.7")
      product_05.versions.push( Version.new({ :version => "2.0.6" }) )
      product_05.save

      product_06 = ProductFactory.create_for_composer("symfony/locale", "2.0.7")
      product_06.versions.push( Version.new({ :version => "2.0.8" }) )
      product_06.save

      product_07 = ProductFactory.create_for_composer("symfony/yaml", "2.0.8")
      product_07.versions.push( Version.new({ :version => "2.0.7" }) )
      product_07.save

      product_08 = ProductFactory.create_for_composer("symfony/http-kernel", "2.0.7")
      product_08.versions.push( Version.new({ :version => "2.0.6" }) )
      product_08.save

      product_09 = ProductFactory.create_for_composer("twig/twig", "2.0.0")
      product_09.versions.push( Version.new({ :version => "1.9.0" }) )
      product_09.versions.push( Version.new({ :version => "1.9.1" }) )
      product_09.versions.push( Version.new({ :version => "1.9.9" }) )
      product_09.save

      product_10 = ProductFactory.create_for_composer("doctrine/common", "2.4")
      product_10.versions.push( Version.new({ :version => "2.2" }) )
      product_10.versions.push( Version.new({ :version => "2.3" }) )
      product_10.versions.push( Version.new({ :version => "2.1" }) )
      product_10.save

      product_11 = ProductFactory.create_for_composer("symfony/console", "2.0.10")
      product_11.versions.push( Version.new({ :version => "2.0.0"       }) )
      product_11.versions.push( Version.new({ :version => "2.0.6"       }) )
      product_11.versions.push( Version.new({ :version => "2.0.7"       }) )
      product_11.versions.push( Version.new({ :version => "2.2.0-BETA2" }) )
      product_11.save

      product_12 = ProductFactory.create_for_composer("symfony/translation", "2.2.x-dev")
      product_12.versions.push( Version.new({ :version => "2.0.0"       }) )
      product_12.versions.push( Version.new({ :version => "2.2.1"       }) )
      product_12.versions.push( Version.new({ :version => "2.2.0-alpha" }) )
      product_12.versions.push( Version.new({ :version => "2.2.0-BETA2" }) )
      product_12.save

      product_13 = ProductFactory.create_for_composer("symfony/filesystem", "2.2.x-dev")
      product_13.versions.push( Version.new({ :version => "2.2.1"       }) )
      product_13.versions.push( Version.new({ :version => "2.2.0-BETA2" }) )
      product_13.save

      product_14 = ProductFactory.create_for_composer("symfony/stopwatch", "2.2.x-dev")
      product_14.versions.push( Version.new({ :version => "2.2.1"       }) )
      product_14.save

      product_16 = ProductFactory.create_for_composer("symfony/finder", "2.2.1")
      product_16.versions.push( Version.new({ :version => "2.2.0"       }) )
      product_16.save

      product_17 = ProductFactory.create_for_composer("symfony/config", "3.0.0")
      product_17.versions.push( Version.new({ :version => "2.2.1"       }) )
      product_17.versions.push( Version.new({ :version => "2.2.2"       }) )
      product_17.versions.push( Version.new({ :version => "2.2.4"       }) )
      product_17.versions.push( Version.new({ :version => "2.3.1"       }) )
      product_17.versions.push( Version.new({ :version => "3.0.0"       }) )
      product_17.save

      product_18 = ProductFactory.create_for_composer("symfony/http-foundation", "1.0.0")
      product_18.versions.push( Version.new({ :version => "2.0.0"       }) )
      product_18.versions.push( Version.new({ :version => "2.1.0"       }) )
      product_18.versions.push( Version.new({ :version => "2.2.0"       }) )
      product_18.versions.push( Version.new({ :version => "2.3.x-dev"   }) )
      product_18.versions.push( Version.new({ :version => "dev-master"  }) )
      product_18.save

      product_19 = ProductFactory.create_for_composer("symfony/http-kernel_2", "1.0.0")
      product_19.versions.push( Version.new({ :version => "2.0.0"       }) )
      product_19.versions.push( Version.new({ :version => "2.1.0"       }) )
      product_19.versions.push( Version.new({ :version => "2.2.0"       }) )
      product_19.versions.push( Version.new({ :version => "2.3-dev"     }) )
      product_19.versions.push( Version.new({ :version => "2.4-dev"     }) )
      product_19.versions.push( Version.new({ :version => "dev-master"  }) )
      product_19.save

      product_20 = ProductFactory.create_for_composer("phpunit/phpunit", "3.7.29")
      product_20.versions.push( Version.new({ :version => "3.7.29"      }) )
      product_20.versions.push( Version.new({ :version => "3.1.0"       }) )
      product_20.versions.push( Version.new({ :version => "3.0.0"       }) )
      product_20.versions.push( Version.new({ :version => "2.3.0"       }) )
      product_20.versions.push( Version.new({ :version => "2.4-dev"     }) )
      product_20.versions.push( Version.new({ :version => "dev-master"  }) )
      product_20.save

      product_21 = ProductFactory.create_for_composer("yiisoft/jquery", "2.1.0")
      product_21.versions.push( Version.new({ :version => "2.0.0"      }) )
      product_21.versions.push( Version.new({ :version => "1.1.0"       }) )
      product_21.save

      product_22 = ProductFactory.create_for_composer("phpuno/phpuno", "4.5.0")
      product_22.versions.push( Version.new({ :version => "4.3.0"       }) )
      product_22.versions.push( Version.new({ :version => "4.4.0"       }) )
      product_22.versions.push( Version.new({ :version => "4.5.0"       }) )
      product_22.versions.push( Version.new({ :version => "dev-master"  }) )
      product_22.save

      product_23.versions << Version.new({ :version => "3.3"       })
      product_23.versions << Version.new({ :version => "1.4.0"       })
      product_23.save

      product_24.versions.push( Version.new({ :version => "1.0.0"       }) )
      product_24.versions.push( Version.new({ :version => "0.1.0"       }) )
      product_24.save

      product_25 = ProductFactory.create_for_composer("satooshi/php-coveralls", "1.0.1")
      product_25.versions.push( Version.new({ :version => "1.0.0"        }) )
      product_25.versions.push( Version.new({ :version => "dev-master"   }) )
      product_25.versions.push( Version.new({ :version => "dev-gh-pages" }) )
      product_25.version = '1.0.1'
      product_25.save

      project = parser.parse("https://s3.amazonaws.com/veye_test_env/composer.json")
      expect( project ).not_to be_nil
      expect(project.dependencies.size).to eql(25)

      dep_01 = fetch_by_name(project.dependencies, product_01[:name])
      expect( dep_01.name ).to              eql(product_01[:name])
      expect( dep_01.version_requested ).to eql("2.0.7")
      expect( dep_01.version_current ).to   eql("2.0.7")
      expect( dep_01.stability ).to         eql("stable")
      expect( dep_01.comperator ).to        eql("=")

      dep_02 = fetch_by_name(project.dependencies, product_02[:name])
      expect( dep_02.name ).to              eql(product_02[:name])
      expect( dep_02.version_requested ).to eql("2.0.7")
      expect( dep_02.version_current ).to   eql("2.0.7")
      expect( dep_02.comperator ).to        eql("=")

      dep_03 = fetch_by_name(project.dependencies, product_03[:name])
      expect( dep_03.name ).to              eql(product_03[:name])
      expect( dep_03.version_requested ).to eql("2.0.7")
      expect( dep_03.version_current ).to   eql("2.0.7")
      expect( dep_03.comperator ).to        eql("=")

      dep_04 = fetch_by_name(project.dependencies, product_04[:name])
      expect( dep_04.name ).to              eql(product_04[:name])
      expect( dep_04.version_requested ).to eql("2.0.7")
      expect( dep_04.version_current ).to   eql("2.0.7")
      expect( dep_04.comperator ).to        eql("!=")

      dep_05 = fetch_by_name(project.dependencies, product_05[:name])
      expect( dep_05.name ).to              eql(product_05[:name])
      expect( dep_05.version_requested ).to eql("2.0.7")
      expect( dep_05.version_current ).to   eql("2.0.7")
      expect( dep_05.comperator ).to        eql(">=")

      dep_06 = fetch_by_name(project.dependencies, product_06[:name])
      expect( dep_06.name ).to              eql(product_06[:name])
      expect( dep_06.version_requested ).to eql("2.0.7")
      expect( dep_06.version_current ).to   eql("2.0.8")
      expect( dep_06.comperator ).to        eql("<=")

      dep_07 = fetch_by_name(project.dependencies, product_07[:name])
      expect( dep_07.name ).to              eql(product_07[:name])
      expect( dep_07.version_requested ).to eql("2.0.7")
      expect( dep_07.version_current ).to   eql("2.0.8")
      expect( dep_07.comperator ).to        eql("<")

      dep_08 = fetch_by_name(project.dependencies, product_08[:name])
      expect( dep_08.name ).to              eql(product_08[:name])
      expect( dep_08.version_requested ).to eql("2.0.7")
      expect( dep_08.version_current ).to   eql("2.0.7")
      expect( dep_08.comperator ).to        eql(">")

      dep_09 = fetch_by_name(project.dependencies, product_09[:name])
      expect( dep_09.name ).to              eql(product_09[:name])
      expect( dep_09.version_requested ).to eql("1.9.9")
      expect( dep_09.version_current ).to   eql("2.0.0")
      expect( dep_09.version_label ).to     eql(">=1.9.1,<2.0.0")
      expect( dep_09.comperator ).to        eql("=")

      dep_10 = fetch_by_name(project.dependencies, product_10[:name])
      expect( dep_10.name ).to              eql(product_10[:name])
      expect( dep_10.version_requested ).to eql("2.3")
      expect( dep_10.version_current ).to   eql("2.4")
      expect( dep_10.comperator ).to        eql("=")

      dep_11 = fetch_by_name(project.dependencies, product_11[:name])
      expect( dep_11.name ).to              eql(product_11[:name])
      expect( dep_11.version_requested ).to eql("2.0.7")
      expect( dep_11.version_current ).to   eql("2.0.10")
      expect( dep_11.comperator ).to        eql("=")
      expect( dep_11.stability ).to         eql("stable")

      dep_12 = fetch_by_name(project.dependencies, product_12[:name])
      expect( dep_12.name ).to              eql(product_12[:name])
      expect( dep_12.version_requested ).to eql("2.2.x-dev")
      expect( dep_12.version_current ).to   eql("2.2.x-dev")
      expect( dep_12.comperator ).to        eql("=")
      expect( dep_12.outdated ).to          be_falsey
      expect( dep_12.stability ).to         eql("dev")

      dep_13 = fetch_by_name(project.dependencies, product_13[:name])
      expect( dep_13.name ).to              eql(product_13[:name])
      expect( dep_13.version_label ).to     eql("2.2.*@dev")
      expect( dep_13.version_requested ).to eql("2.2.x-dev")
      expect( dep_13.version_current ).to   eql("2.2.x-dev")
      expect( dep_13.outdated ).to          be_falsey
      expect( dep_13.comperator ).to        eql("=")

      dep_14 = fetch_by_name(project.dependencies, product_14[:name])
      expect( dep_14.name ).to              eql(product_14[:name])
      expect( dep_14.version_label ).to     eql("2.2.*@stable")
      expect( dep_14.version_requested ).to eql("2.2.1")
      expect( dep_14.version_current ).to   eql("2.2.1")
      expect( dep_14.outdated ).to          be_falsey
      expect( dep_14.comperator ).to        eql("=")
      expect( dep_14.stability ).to         eql("stable")

      dep_16 = fetch_by_name(project.dependencies, product_16[:name])
      expect( dep_16.name ).to              eql(product_16[:name])
      expect( dep_16.version_label ).to     eql("@dev")
      expect( dep_16.version_requested ).to eql("2.2.1")
      expect( dep_16.version_current ).to   eql("2.2.1")
      expect( dep_16.comperator ).to        eql("=")

      dep_17 = fetch_by_name(project.dependencies, product_17[:name])
      expect( dep_17.name ).to              eql(product_17[:name])
      expect( dep_17.version_label ).to     eql("~2.2")
      expect( dep_17.version_requested ).to eql("2.3.1")
      expect( dep_17.version_current ).to   eql("3.0.0")
      expect( dep_17.comperator ).to        eql("~")

      dep_18 = fetch_by_name(project.dependencies, product_18[:name])
      expect( dep_18.name ).to              eql(product_18[:name])
      expect( dep_18.version_label ).to     eql(">=2.1,<2.4-dev")
      expect( dep_18.version_requested ).to eql("2.3.x-dev")
      expect( dep_18.version_current ).to   eql("2.3.x-dev")
      expect( dep_18.comperator ).to        eql("=")

      dep_19 = fetch_by_name(project.dependencies, product_19[:name])
      expect( dep_19.name ).to              eql(product_19[:name])
      expect( dep_19.version_label ).to     eql(">=2.1,<2.4-dev")
      expect( dep_19.version_requested ).to eql("2.3-dev")
      expect( dep_19.version_current ).to   eql("2.4-dev")
      expect( dep_19.comperator ).to        eql("=")

      dep_20 = fetch_by_name(project.dependencies, product_20[:name])
      expect( dep_20.name ).to              eql(product_20[:name])
      expect( dep_20.version_label ).to     eql('~3')
      expect( dep_20.version_requested ).to eql('3.7.29')
      expect( dep_20.version_current ).to   eql('3.7.29')
      expect( dep_20.comperator ).to        eql('~')

      dep_21 = fetch_by_name(project.dependencies, product_21[:name])
      expect( dep_21.name ).to              eql(product_21[:name])
      expect( dep_21.version_label ).to     eql('~2.0 | ~1.10')
      expect( dep_21.version_requested ).to eql('2.1.0')
      expect( dep_21.version_current ).to   eql('2.1.0')
      expect( dep_21.comperator ).to        eql('=')

      dep_22 = fetch_by_name(project.dependencies, product_22[:name])
      expect( dep_22.name ).to              eql(product_22[:name])
      expect( dep_22.version_label ).to     eql('^4.3.0')
      expect( dep_22.version_requested ).to eql('4.5.0')
      expect( dep_22.version_current ).to   eql('4.5.0')
      expect( dep_22.comperator ).to        eql('^')

      dep_23 = fetch_by_name(project.dependencies, product_23[:name])
      expect( dep_23.name ).to              eql(product_23[:name])
      expect( dep_23.version_label ).to     eql('3.3')
      expect( dep_23.version_requested ).to eql('3.3')
      expect( dep_23.version_current ).to   eql('3.3')
      expect( dep_23.comperator ).to        eql('=')
      expect( dep_23.language ).to          eql(Product::A_LANGUAGE_JAVASCRIPT)

      dep_24 = fetch_by_name(project.dependencies, product_24[:name])
      expect( dep_24.name ).to              eql(product_24[:name])
      expect( dep_24.version_label ).to     eql('1.0.0')
      expect( dep_24.version_requested ).to eql('1.0.0')
      expect( dep_24.version_current ).to   eql('1.0.0')
      expect( dep_24.comperator ).to        eql('=')
      expect( dep_24.language ).to          eql(Product::A_LANGUAGE_NODEJS)

      dep_25 = fetch_by_name(project.dependencies, "satooshi/php-coveralls")
      expect( dep_25.name ).to              eql('satooshi/php-coveralls')
      expect( dep_25.version_label ).to     eql('dev-master|^1.0')
      expect( dep_25.version_requested ).to eql('1.0.1')
      expect( dep_25.version_current ).to   eql('1.0.1')
      expect( dep_25.comperator ).to        eql('=')
      expect( dep_25.language ).to          eql(Product::A_LANGUAGE_PHP)
    end

  end

  describe "dependency_in_repositories?" do

    it "returns false because of nil parameters" do
      parser = ComposerParser.new
      expect( parser.dependency_in_repositories?(nil, nil) ).to be_falsey
    end

  end

end


text:
import numpy as np
import theano
from theano.tensor.shared_randomstreams import RandomStreams
import theano.tensor as T
import random

theano_rng = RandomStreams(np.random.RandomState(1234).randint(2**30))
np.random.seed(1234)
random.seed(1234)

def initial_weights(*argv):
    return np.asarray(
        np.random.uniform(
            low=-np.sqrt(6. / sum(argv)),
            high=np.sqrt(6. / sum(argv)),
            size=argv
        ),
        dtype=theano.config.floatX
    )
#	return 0.1 * np.random.randn(*argv)
#	return 2 * (np.random.rand(*argv) - 0.5)

def create_shared(array, dtype=theano.config.floatX, name=None):
    return theano.shared(
        value=np.asarray(
            array,
            dtype=dtype
        ),
        name=name,
    )

def vector_softmax(vec):
    return T.nnet.softmax(vec.reshape((1, vec.shape[0])))[0]


text:
package com.common.android.utils.extensions;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.io.UnsupportedEncodingException;

import okio.ByteString;

import static android.text.TextUtils.isEmpty;
import static com.common.android.utils.extensions.ByteExtensions.validUTF8;
import static okio.ByteString.encodeUtf8;

/**
 * Created by Jan Rabe on 14/10/15.
 */
final public class StringExtensions {

    private StringExtensions() throws IllegalAccessException {
        throw new IllegalAccessException();
    }

    @NonNull
    public static String clamp(@Nullable final String s, final int maxLength) {
        if (isEmpty(s))
            return "";

        return s.substring(0, (int) MathExtensions.clamp(s.length(), 0, maxLength));
    }

    /**
     * http://stackoverflow.com/a/1447720
     */
    public static String fixEncoding(String latin1) {
        try {
            byte[] bytes = latin1.getBytes("ISO-8859-1");
            if (!validUTF8(bytes))
                return latin1;
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            // Impossible, throw unchecked
            throw new IllegalStateException("No Latin1 or UTF-8: " + e.getMessage());
        }
    }

    @NonNull
    public static String capitalize(final String line) {
        return isEmpty(line)
                ? ""
                : Character.toUpperCase(line.charAt(0)) + line.substring(1);
    }

    public static String surroundWithQuotes(String msg) {
        return String.format("\"%s\"", "" + msg);
    }

    private static String escape(String s) {
        return isEmpty(s)
                ? ""
                : s.replace("\n", "\\n").replace("\r", "\\r");
    }

    public static int length(@Nullable final String string) {
        return isEmpty(string) ? 0 : string.length();
    }

    @NonNull
    public static String encodeBase64(String utf8String) {
        if (isEmpty(utf8String))
            return "";

        String utf8 = encodeUtf8(utf8String).base64();
        return isEmpty(utf8)
                ? "INVALID_UTF-8"
                : utf8;
    }

    @NonNull
    public static String decodeBase64(String utf8String) {
        if (isEmpty(utf8String))
            return "";

        ByteString byteString = ByteString.decodeBase64(utf8String);
        if (byteString == null)
            return "INVALID_UTF-8";

        final String utf8 = byteString.utf8();
        return isEmpty(utf8)
                ? "INVALID_UTF-8"
                : utf8;
    }
}