text:
package cmd

import "github.com/wheresalice/cali"
import "os/user"
import "os"
import log "github.com/Sirupsen/logrus"
import (
	_ "github.com/pkg/errors"
)

func init() {

	command := cli.NewCommand("github-release")
	command.SetShort("Run github-release")
	command.SetLong(`Starts a container and runs github-release
This is primarily an internal thing to staticli so that it can release itself, however there's no reason you can't use it yourself
Examples:
# staticli github-release "v1.0" *.tar.gz -- --github-access-token [...]
you can also export GITHUB_RELEASE_ACCESS_TOKEN
`)
	command.BindFlags()

	task := command.Task("buildkite/github-release")

	u, err := user.Current()
	if err != nil {
		log.Fatalf("Failed to find uid for user: %s", err)
	}
	task.AddEnv("HOST_USER_ID", u.Uid)
	task.AddEnv("HOST_GROUP_ID", u.Gid)
	if os.Getenv("GITHUB_RELEASE_ACCESS_TOKEN") != "" {
		task.AddEnv("GITHUB_RELEASE_ACCESS_TOKEN", os.Getenv("GITHUB_RELEASE_ACCESS_TOKEN"))
	}
	task.SetInitFunc(func(t *cali.Task, args []string) {

	})
}

repository: staticli/staticli

repo_name: staticli/staticli

gha_license_id: MIT

gha_language: Go


text:
package datadog

import (
	"net/http"

	"github.com/VictoriaMetrics/VictoriaMetrics/app/vmagent/common"
	"github.com/VictoriaMetrics/VictoriaMetrics/app/vmagent/remotewrite"
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/auth"
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
	parserCommon "github.com/VictoriaMetrics/VictoriaMetrics/lib/protoparser/common"
	parser "github.com/VictoriaMetrics/VictoriaMetrics/lib/protoparser/datadog"
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/protoparser/datadog/stream"
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/tenantmetrics"
	"github.com/VictoriaMetrics/metrics"
)

var (
	rowsInserted       = metrics.NewCounter(`vmagent_rows_inserted_total{type="datadog"}`)
	rowsTenantInserted = tenantmetrics.NewCounterMap(`vmagent_tenant_inserted_rows_total{type="datadog"}`)
	rowsPerInsert      = metrics.NewHistogram(`vmagent_rows_per_insert{type="datadog"}`)
)

// InsertHandlerForHTTP processes remote write for DataDog POST /api/v1/series request.
//
// See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics
func InsertHandlerForHTTP(at *auth.Token, req *http.Request) error {
	extraLabels, err := parserCommon.GetExtraLabels(req)
	if err != nil {
		return err
	}
	ce := req.Header.Get("Content-Encoding")
	return stream.Parse(req.Body, ce, func(series []parser.Series) error {
		return insertRows(at, series, extraLabels)
	})
}

func insertRows(at *auth.Token, series []parser.Series, extraLabels []prompbmarshal.Label) error {
	ctx := common.GetPushCtx()
	defer common.PutPushCtx(ctx)

	rowsTotal := 0
	tssDst := ctx.WriteRequest.Timeseries[:0]
	labels := ctx.Labels[:0]
	samples := ctx.Samples[:0]
	for i := range series {
		ss := &series[i]
		rowsTotal += len(ss.Points)
		labelsLen := len(labels)
		labels = append(labels, prompbmarshal.Label{
			Name:  "__name__",
			Value: ss.Metric,
		})
		if ss.Host != "" {
			labels = append(labels, prompbmarshal.Label{
				Name:  "host",
				Value: ss.Host,
			})
		}
		if ss.Device != "" {
			labels = append(labels, prompbmarshal.Label{
				Name:  "device",
				Value: ss.Device,
			})
		}
		for _, tag := range ss.Tags {
			name, value := parser.SplitTag(tag)
			if name == "host" {
				name = "exported_host"
			}
			labels = append(labels, prompbmarshal.Label{
				Name:  name,
				Value: value,
			})
		}
		labels = append(labels, extraLabels...)
		samplesLen := len(samples)
		for _, pt := range ss.Points {
			samples = append(samples, prompbmarshal.Sample{
				Timestamp: pt.Timestamp(),
				Value:     pt.Value(),
			})
		}
		tssDst = append(tssDst, prompbmarshal.TimeSeries{
			Labels:  labels[labelsLen:],
			Samples: samples[samplesLen:],
		})
	}
	ctx.WriteRequest.Timeseries = tssDst
	ctx.Labels = labels
	ctx.Samples = samples
	remotewrite.Push(at, &ctx.WriteRequest)
	rowsInserted.Add(rowsTotal)
	if at != nil {
		rowsTenantInserted.Get(at).Add(rowsTotal)
	}
	rowsPerInsert.Update(float64(rowsTotal))
	return nil
}

repository: VictoriaMetrics/VictoriaMetrics

license_type: permissive

repo_name: VictoriaMetrics/VictoriaMetrics

branch_name: refs/heads/master

extension: go


text:
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_WEBAPPS_BROWSER_ANDROID_INSTALLABLE_INSTALLABLE_AMBIENT_BADGE_INFOBAR_DELEGATE_H_
#define COMPONENTS_WEBAPPS_BROWSER_ANDROID_INSTALLABLE_INSTALLABLE_AMBIENT_BADGE_INFOBAR_DELEGATE_H_

#include <string>

#include "base/memory/weak_ptr.h"
#include "components/infobars/core/infobar_delegate.h"
#include "components/webapps/browser/android/installable/installable_ambient_badge_client.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"

namespace content {
class WebContents;
}
namespace infobars {
class ContentInfoBarManager;
}

namespace webapps {

// Delegate for a infobar shown to users when they visit a progressive web app.
// Tapping the infobar triggers the add to home screen flow.
class InstallableAmbientBadgeInfoBarDelegate
    : public infobars::InfoBarDelegate {
 public:

  InstallableAmbientBadgeInfoBarDelegate(
      const InstallableAmbientBadgeInfoBarDelegate&) = delete;
  InstallableAmbientBadgeInfoBarDelegate& operator=(
      const InstallableAmbientBadgeInfoBarDelegate&) = delete;

  ~InstallableAmbientBadgeInfoBarDelegate() override;

  // Returns a pointer to the InstallableAmbientBadgeInfoBar if it is currently
  // showing. Otherwise returns nullptr.
  static infobars::InfoBar* GetVisibleAmbientBadgeInfoBar(
      infobars::ContentInfoBarManager* infobar_manager);

  // Create and show the infobar.
  static void Create(content::WebContents* web_contents,
                     base::WeakPtr<InstallableAmbientBadgeClient> weak_client,
                     const std::u16string& app_name,
                     const SkBitmap& primary_icon,
                     const bool is_primary_icon_maskable,
                     const GURL& start_url);

  void AddToHomescreen();
  const std::u16string GetMessageText() const;
  const SkBitmap& GetPrimaryIcon() const;
  bool GetIsPrimaryIconMaskable() const;
  const GURL& GetUrl() const { return start_url_; }

 private:
  InstallableAmbientBadgeInfoBarDelegate(
      base::WeakPtr<InstallableAmbientBadgeClient> weak_client,
      const std::u16string& app_name,
      const SkBitmap& primary_icon,
      const bool is_primary_icon_maskable,
      const GURL& start_url);

  // InfoBarDelegate overrides:
  infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
  void InfoBarDismissed() override;

  base::WeakPtr<InstallableAmbientBadgeClient> weak_client_;
  const std::u16string app_name_;
  const SkBitmap primary_icon_;
  const bool is_primary_icon_maskable_;
  const GURL start_url_;
};

}  // namespace webapps

#endif  // COMPONENTS_WEBAPPS_BROWSER_ANDROID_INSTALLABLE_INSTALLABLE_AMBIENT_BADGE_INFOBAR_DELEGATE_H_

repository: chromium/chromium

repo_name: chromium/chromium

branch_name: refs/heads/main

extension: h


text:
# This maintains the links for all sources used by this superbuild.
# Simply update this file to change the revision.
# One can use different revision on different platforms.
# e.g.
# if (UNIX)
#   ..
# else (APPLE)
#   ..
# endif()

add_revision(zlib
  URL "http://www.paraview.org/files/dependencies/zlib-1.2.7.tar.gz"
  URL_MD5 60df6a37c56e7c1366cca812414f7b85)

add_revision(png
  URL "http://paraview.org/files/dependencies/libpng-1.4.8.tar.gz"
  URL_MD5 49c6e05be5fa88ed815945d7ca7d4aa9)

add_revision(freetype
  URL "http://paraview.org/files/dependencies/freetype-2.4.8.tar.gz"
  URL_MD5 "5d82aaa9a4abc0ebbd592783208d9c76")

add_revision(fontconfig
  URL "http://paraview.org/files/dependencies/fontconfig-2.8.0.tar.gz"
  URL_MD5 77e15a92006ddc2adbb06f840d591c0e)

add_revision(libxml2
  URL "http://paraview.org/files/dependencies/libxml2-2.7.8.tar.gz"
  URL_MD5 8127a65e8c3b08856093099b52599c86)

if (WIN32)
  if (64bit_build)
    add_revision(ffmpeg
      URL "http://paraview.org/files/dependencies/ffmpeg-kitware-20150514gitbc25918-win64.tar.bz2"
      URL_MD5 887217ae04ee9004e2ec121442553259)
  else ()
    add_revision(ffmpeg
      URL "http://paraview.org/files/dependencies/ffmpeg-kitware-20150514gitbc25918-win32.tar.bz2"
      URL_MD5 b8b3068699e272789ca02df5c132c05c)
  endif ()
else ()
  add_revision(ffmpeg
    URL "http://paraview.org/files/dependencies/ffmpeg-2.3.3.tar.bz2"
    URL_MD5 72361d3b8717b6db3ad2b9da8df7af5e)
endif ()

if (WIN32)
  add_revision(python
    URL "http://www.tomviz.org/files/python3.6.0.tar.gz"
    URL_MD5 "08c5a23fe5dd095d2aa363816ba25935")
else()
  add_revision(python
    URL "https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz"
    URL_MD5 "")
endif()

foreach (fftw3kind float double long quad)
  add_revision(fftw3${fftw3kind}
    URL "http://www.paraview.org/files/dependencies/fftw-3.3.4.tar.gz"
    URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3)
endforeach ()

if (WIN32)
  add_revision(pyfftw
    URL "http://www.tomviz.org/files/pyfftw-0.10.4-win64.zip"
    URL_MD5 "c9c60d3f28df1c9d545152734350f9ba")
else()
  add_revision(pyfftw
    URL "http://www.paraview.org/files/dependencies/pyFFTW-0.9.2.tar.gz"
    URL_MD5 34fcbc68afb8ebe5f040a02a8d20d565)
endif()

add_revision(qt
  URL "http://download.qt.io/official_releases/qt/5.6/5.6.0/single/qt-everywhere-opensource-src-5.6.0.tar.gz"
  URL_MD5 7a2a867bc12384f4161809136d49d4be)

# Default to build from a known ParaView revision
option(USE_PARAVIEW_MASTER "Use ParaView master instead of known ref" OFF)
if(USE_PARAVIEW_MASTER)
  set(_paraview_revision "master")
else()
  # Test the revision with OpenGL2 rendering before updating, update often!
  set(_paraview_revision "f0afbb7577a7fdcc400d4fd1067204b2932cb0f2")
endif()
add_revision(paraview
  GIT_REPOSITORY "https://gitlab.kitware.com/paraview/paraview.git"
  GIT_TAG "${_paraview_revision}")

option(tomviz_FROM_GIT "If enabled then the repository is fetched from git" ON)
cmake_dependent_option(tomviz_FROM_SOURCE_DIR OFF
  "Enable to use existing tomviz source."
  "NOT tomviz_FROM_GIT" OFF)

if (tomviz_FROM_GIT)
  # Download tomviz from GIT
  add_customizable_revision(tomviz
    GIT_REPOSITORY https://github.com/openchemistry/tomviz.git
    GIT_TAG "master")
else()
  if (tomviz_FROM_SOURCE_DIR)
    add_customizable_revision(tomviz
      SOURCE_DIR "TomvizSource")
  else()
    message(FATAL_ERROR "No stable source tarball URL")
  endif()
endif()

add_revision(lapack
  URL "http://paraview.org/files/dependencies/lapack-3.4.2.tgz"
  URL_MD5 61bf1a8a4469d4bdb7604f5897179478)

if (WIN32)
  add_revision(numpy
    URL "http://www.tomviz.org/files/numpy-1.12.1rc1-py3.6-intel-win64.zip"
    URL_MD5 "a892b14ada262e98a347161618ed74a0")
  add_revision(scipy
    URL "http://www.tomviz.org/files/scipy-0.19.0rc2-py3.6-intel-win64.zip"
    URL_MD5 "ea16b40390b91d2581ea569f3f0246c4")
  add_revision(intelredist
    URL "http://paraview.org/files/dependencies/intel-psxe2015-64-bit-redist.zip"
      URL_MD5 1920a6c593c454ce0f4258aabf5aefe5)
else()
  add_revision(numpy
    URL "http://paraview.org/files/dependencies/numpy-1.8.1+cmake+static.tar.bz2"
    URL_MD5 1974dbb4bfa1509e492791a8cd225774)

  add_revision(scipy
    URL "http://www.paraview.org/files/dependencies/scipy-0.15.1.tar.gz"
    URL_MD5 be56cd8e60591d6332aac792a5880110)
endif()

if (WIN32)
  set(_itk_sha512 "de4561f2c9865633d17c63e546800504e9d991e2fefe2a23c27bf3b7d9807a118aa02dfe128af72d7bd4c452dce1dac6fdb53e67dea93963774a59b27628173a")
  add_revision(itk
    URL "http://www.tomviz.org/files/itk-4.12.0-windows-64bit.zip"
    URL_HASH SHA512=${_itk_sha512})
  add_revision(fftw
    URL "http://www.tomviz.org/files/fftw-3.3.4-windows-64bit.zip"
    URL_MD5 "90ca2a2cd26c62bc85b11ec7f165e716")
elseif(APPLE)
  set(_itk_sha512 "e08c6626c778a6cc99c05253be41cefb04acf6bcf0f89c46cea9937966ef32d1cf2e69787cab57ac2463a1f375d9ab068d51de829f180652816796ba468127fc")
  add_revision(itk
    URL "http://www.tomviz.org/files/itk-v4.12.0-osx-64bit.tar.gz"
    URL_HASH SHA512=${_itk_sha512})
elseif(UNIX)
  set(_itk_sha512 "39aa2bd22e1e2461656abd8983df7c4487978a5e47de006e9d8d8f3eb48c2db42fb4952d1230e3064e7241c6dd811d8a206b5e16f99fd6ee4aa861d3bd4bc8e6")
  add_revision(itk
    URL "http://www.tomviz.org/files/itk-v4.12.0-linux-64bit.tar.gz"
    URL_HASH SHA512=${_itk_sha512})
endif()

set(tbb_ver "2017_20160916oss")
if (WIN32)
  set(tbb_file "tbb${tbb_ver}_win_1.zip")
  set(tbb_md5 "d23a6de9b467a89b345de142c36b8abc")
elseif (APPLE)
  set(tbb_file "tbb${tbb_ver}_osx.tgz")
  set(tbb_md5 "e96382f8dbf10e4edbdf1b64605ae891")
else ()
  set(tbb_file "tbb${tbb_ver}_lin.tgz")
  set(tbb_md5 "e668583115832dac196846c8d0fe30ec")
endif ()

add_revision(tbb
  URL "http://www.tomviz.org/files/${tbb_file}"
  URL_MD5 "${tbb_md5}")

repository: cquammen/tomviz-superbuild

repo_name: cquammen/tomviz-superbuild

extension: cmake


text:
SUMMARY = "Read MS-Word files and outputs text"
HOMEPAGE = "https://www.wagner.pp.ru/~vitus/software/catdoc/"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"

SRC_URI = "http://ftp.wagner.pp.ru/pub/catdoc/${BPN}-${PV}.tar.gz"
SRC_URI[md5sum] = "4ece2f43b140fab6a2c3a9d6436d7779"
SRC_URI[sha256sum] = "514a84180352b6bf367c1d2499819dfa82b60d8c45777432fa643a5ed7d80796"

inherit autotools-brokensep pkgconfig

EXTRA_OECONF = "--with-install-root=${D}"

do_install_prepend() {
    install -d ${D}/${datadir}/man/man1
    install -d ${D}/${datadir}/${BPN}
}

license: MIT

branch_name: refs/heads/nilrt/master/hardknott

gha_language: BitBake

extension: bb


text:
# Copyright (c) 2015, Philipp Harms
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#  list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

if(NOT DEFINED _CMAKE_C_NEEDS_LIBM)
  message(STATUS "Check whether C compiler needs to link libm")
  try_compile(_CMAKE_C_NEEDS_LIBM ${CMAKE_BINARY_DIR}
    ${CMAKE_SOURCE_DIR}/cmake/modules/TestCForNeedsLibM.c)
  if(_CMAKE_C_NEEDS_LIBM)
    message(STATUS "Check whether C compiler needs to link libm - no")
    set(CMAKE_C_NEEDS_LIBM 0 CACHE INTERNAL
      "Does the C compiler need to link libm.")
    file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
      "Determining if the C compiler needs to link libm passed with "
      "the following output:\n${OUTPUT}\n\n")
  else()
    message(STATUS "Check whether C compiler needs to link libm - yes")
    set(CMAKE_C_NEEDS_LIBM 1 CACHE INTERNAL
      "Does the C compiler need to link libm.")
    file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
      "Determining if the C compiler needs to link libm failed with "
      "the following output:\n${OUTPUT}\n\n")
  endif()
endif()

repository: philippvr/libclem

repo_name: philippvr/libclem


text:
//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors.
//go:generate ucloud-gen-go-api UDPN GetUDPNPrice

package udpn

import (
	"github.com/ucloud/ucloud-sdk-go/ucloud/request"
	"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)

// GetUDPNPriceRequest is request schema for GetUDPNPrice action
type GetUDPNPriceRequest struct {
	request.CommonBase

	// [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
	// Region *string `required:"false"`

	// 专线可用区1，支持地域：北京二：cn-bj2, 上海二：cn-sh2, 广东：cn-gd, 亚太： hk, 上海一：cn-sh1, 法兰克福：ge-fra, 新加坡：sg, 洛杉矶：us-la， 华盛顿：us-ws， 东京：jpn-tky
	Peer1 *string `required:"true"`

	// 专线可用区2，支持地域：北京二：cn-bj2, 上海二：cn-sh2, 广东：cn-gd, 亚太： hk, 上海一：cn-sh1, 法兰克福：ge-fra, 新加坡：sg, 洛杉矶：us-la， 华盛顿：us-ws， 东京：jpn-tky
	Peer2 *string `required:"true"`

	// 带宽信息
	Bandwidth *int `required:"true"`

	// 计费类型
	ChargeType *string `required:"false"`

	// 购买时长
	Quantity *int `required:"false"`
}

// GetUDPNPriceResponse is response schema for GetUDPNPrice action
type GetUDPNPriceResponse struct {
	response.CommonBase

	// 资源有效期 unix 时间戳
	PurchaseValue int

	// 专线价格
	Price float64
}

// NewGetUDPNPriceRequest will create request of GetUDPNPrice action.
func (c *UDPNClient) NewGetUDPNPriceRequest() *GetUDPNPriceRequest {
	req := &GetUDPNPriceRequest{}

	// setup request with client config
	c.Client.SetupRequest(req)

	// setup retryable with default retry policy (retry for non-create action and common error)
	req.SetRetryable(true)
	return req
}

// GetUDPNPrice - 获取 UDPN 价格
func (c *UDPNClient) GetUDPNPrice(req *GetUDPNPriceRequest) (*GetUDPNPriceResponse, error) {
	var err error
	var res GetUDPNPriceResponse

	err = c.Client.InvokeAction("GetUDPNPrice", req, &res)
	if err != nil {
		return &res, err
	}

	return &res, nil
}

repository: haowangucloud/ucloud-sdk-go

repo_name: haowangucloud/ucloud-sdk-go


text:
SUMMARY = "Creates virtual input devices from real ones."
HOMEPAGE = "https://github.com/rodrigorc/inputmap.git"
SECTION = "games"
LICENSE = "GPL-3.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d"

DEPENDS = "systemd"

SRC_URI = "git://github.com/rodrigorc/inputmap.git;protocol=https \
	   file://0001-disable-unsupported-events-by-the-old-kernels.patch \
"

SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"

inherit meson pkgconfig

repository: neutrino-hd/meta-neutrino

repo_name: neutrino-hd/meta-neutrino


text:
DESCRIPTION = "USB Webcam driver for spca5xx chipset family supporting \
over 100 models of camera""
PRIORITY = "optional"
SECTION = "kernel/modules"
MAINTAINER = "dyoung <dyoung8888@yahoo.com>"
LICENSE = "GPL"
PR = "r0"

SRC_URI = "http://mxhaard.free.fr/spca50x/Download/spca5xx-20050419.tar.gz"

S = "${WORKDIR}/spca5xx-20050419"

inherit module

do_compile () {
        unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
        oe_runmake 'KERNELDIR=${STAGING_KERNEL_DIR}' \
                   'CC=${KERNEL_CC}' \
                   'LD=${KERNEL_LD}'
}

do_install() {
        install -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/usb/media
        install -m 0644 *${KERNEL_OBJECT_SUFFIX} ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/usb/media
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
package options

import (
	"testing"
)

func Test_Yaml_With_No_Variables(t *testing.T) {
	optionSources, err := parseYaml([]byte{})
	if err != nil {
		t.Errorf("Expected no error, but received %s", err.Error())
	}
	if len(optionSources) != 0 {
		t.Errorf("Expected no option sources, but received %+v", optionSources)
	}
}

func Test_Yaml_With_Invalid_Variable(t *testing.T) {
	var data = `
	v: [A,
`
	_, err := parseYaml([]byte(data))

	if err == nil {
		t.Error("Expected an error, but received none")
	}
}

func Test_Yaml_With_Multiple_Variables(t *testing.T) {

	var data = `
host: localhost
port: 8080
`
	optionSources, err := parseYaml([]byte(data))

	if err != nil {
		t.Errorf("Expected no error, but received %s", err.Error())
	}

	if len(optionSources) != 2 {
		t.Errorf("Expected two option sources, but received %+v", len(optionSources))
	}

	optionSource := optionSources[0]

	expectedSource := ConfigYamlSource
	if optionSource.Source != expectedSource {
		t.Errorf("Expected source to be %s, but got %s", expectedSource, optionSource.Source)
	}

	expectedName := "host"
	if optionSource.Name != expectedName {
		t.Errorf("Expected name to be %s, but got %s", expectedName, optionSource.Name)
	}

	expectedValue := "localhost"
	if optionSource.Value != expectedValue {
		t.Errorf("Expected value to be %s, but got %s", expectedValue, optionSource.Value)
	}

	optionSource = optionSources[1]

	expectedSource = ConfigYamlSource
	if optionSource.Source != expectedSource {
		t.Errorf("Expected source to be %s, but got %s", expectedSource, optionSource.Source)
	}

	expectedName = "port"
	if optionSource.Name != expectedName {
		t.Errorf("Expected name to be %s, but got %s", expectedName, optionSource.Name)
	}

	expectedValue = "8080"
	if optionSource.Value != expectedValue {
		t.Errorf("Expected value to be %s, but got %s", expectedValue, optionSource.Value)
	}
}

repository: pgermishuys/gorags

repo_name: pgermishuys/gorags


text:
using System;
using System.Collections.Generic;
using Sitecore.Diagnostics;

namespace Unicorn.Configuration
{
	/// <summary>
	/// This wrapper class prevents performing dependency reconfiguration on configurations after the setup phase is complete.
	/// </summary>
	internal class ReadOnlyConfiguration : IConfiguration
	{
		private readonly IConfiguration _innerRegistry;

		public ReadOnlyConfiguration(IConfiguration innerRegistry)
		{
			Assert.ArgumentNotNull(innerRegistry, "innerRegistry");

			_innerRegistry = innerRegistry;
		}

		public string Name { get { return _innerRegistry.Name; }}

		public T Resolve<T>() where T : class
		{
			return _innerRegistry.Resolve<T>();
		}

		public object Resolve(Type type)
		{
			return _innerRegistry.Resolve(type);
		}

		public void Register(Type type, Func<object> factory, bool singleInstance)
		{
			throw new InvalidOperationException("You cannot register new dependencies on a read-only configuration.");
		}

		public object Activate(Type type, KeyValuePair<string, object>[] unmappedConstructorParameters)
		{
			return _innerRegistry.Activate(type, unmappedConstructorParameters);
		}
	}
}

repository: Igentics/Unicorn

repo_name: Igentics/Unicorn

extension: cs


text:
package building

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"runtime"
	"strings"
	"time"
)

var (
	Quiet   = flag.Bool("q", false, "quiet output")
	Verbose = flag.Bool("v", false, "verbose output")
)

func init() {
	log.SetFlags(0)
	// Manual flags parsing to disable logging before calling the target
	// functions unless -v is passed.
	*Quiet = true
	for _, arg := range os.Args {
		if arg == "-v" {
			*Verbose = true
			*Quiet = false
			return
		}
	}
}

type failure struct {
}

func CatchFailure(start time.Time) {
	if e := recover(); e != nil {
		if _, ok := e.(failure); ok {
			b.Debugf("build failed (took %s)", time.Since(start))
			os.Exit(1)
		}
		panic(e)
	}
	b.Debugf("build finished (took %s)", time.Since(start))
}

func (b *B) Helper() {
	var pc [2]uintptr
	n := runtime.Callers(2, pc[:])
	frames := runtime.CallersFrames(pc[:n])
	frame, _ := frames.Next()
	b.mutex.Lock()
	defer b.mutex.Unlock()
	if b.helpers == nil {
		b.helpers = make(map[string]bool)
	}
	b.helpers[frame.Function] = true
}

func (b *B) location(suffix string) string {
	var pc [10]uintptr
	n := runtime.Callers(1, pc[:])
	frames := runtime.CallersFrames(pc[:n])
	for {
		frame, more := frames.Next()
		if frame.Function == "runtime.main" {
			return ""
		}
		if !b.skip(frame) {
			return fmt.Sprintf("%s:%d:%s", frame.File, frame.Line, suffix)
		}
		if !more {
			return ""
		}
	}
}

func (b *B) skip(frame runtime.Frame) bool {
	if strings.Contains(frame.Function, "github.com/mat007/brique") {
		return true
	}
	if b == nil {
		return false
	}
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.helpers[frame.Function]
}

func (b *B) Fatal(v ...interface{}) {
	log.Print(append([]interface{}{b.location(" ")}, v...)...)
	panic(failure{})
}

func (b *B) Fatalf(format string, v ...interface{}) {
	log.Printf(b.location(" ")+format, v...)
	panic(failure{})
}

func (b *B) Fatalln(v ...interface{}) {
	log.Println(append([]interface{}{b.location("")}, v...)...)
	panic(failure{})
}

func (b *B) Print(v ...interface{}) {
	if isInfo() {
		log.Print(v...)
	}
}

func (b *B) Printf(format string, v ...interface{}) {
	if isInfo() {
		log.Printf(format, v...)
	}
}

func (b *B) Println(v ...interface{}) {
	if isInfo() {
		log.Println(v...)
	}
}

func (b *B) Debug(v ...interface{}) {
	if isDebug() {
		log.Print(v...)
	}
}

func (b *B) Debugf(format string, v ...interface{}) {
	if isDebug() {
		log.Printf(format, v...)
	}
}

func (b *B) Debugln(v ...interface{}) {
	if isDebug() {
		log.Println(v...)
	}
}

func (b *B) Assert(err error) {
	if err != nil {
		log.Println([]interface{}{b.location(""), err}...)
		panic(failure{})
	}
}

func (b *B) Check(err error) {
	if err != nil {
		log.Println([]interface{}{b.location(""), err}...)
	}
}

func (b *B) Close(c io.Closer) {
	err := c.Close()
	if err != nil {
		log.Println([]interface{}{b.location(""), err}...)
	}
}

func isInfo() bool {
	return !*Quiet
}

func isDebug() bool {
	return isInfo() && *Verbose
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<drawing version="7">
    <attr value="xc9500" name="DeviceFamilyName">
        <trait delete="all:0" />
        <trait editname="all:0" />
        <trait edittrait="all:0" />
    </attr>
    <netlist>
        <signal name="XLXN_150" />
        <signal name="XLXN_159" />
        <signal name="XLXN_164" />
        <signal name="XLXN_168" />
        <signal name="XLXN_169" />
        <signal name="ForwardDir" />
        <signal name="ReverseDir" />
        <signal name="RightDir" />
        <signal name="Right" />
        <signal name="Left" />
        <signal name="Reverse" />
        <signal name="XLXN_238" />
        <signal name="LeftDir" />
        <signal name="XLXN_250" />
        <signal name="XLXN_251" />
        <signal name="UserFunction0" />
        <signal name="UserFunction1" />
        <signal name="XLXN_254" />
        <signal name="XLXN_385" />
        <signal name="XLXN_386" />
        <signal name="XLXN_387" />
        <signal name="DIRSEL0" />
        <signal name="DIRSEL1" />
        <signal name="DIRSEL2" />
        <signal name="XLXN_401" />
        <signal name="XLXN_239" />
        <signal name="XLXN_240" />
        <signal name="XLXN_241" />
        <signal name="XLXN_242" />
        <signal name="TriggerSonar2" />
        <signal name="TriggerSonar3" />
        <signal name="TriggerSonar1" />
        <signal name="TriggerSonar0" />
        <signal name="EchoSonar3" />
        <signal name="EchoSonar2" />
        <signal name="EchoSonar1" />
        <signal name="EchoSonar0" />
        <signal name="XLXN_261" />
        <signal name="XLXN_260" />
        <signal name="XLXN_259" />
        <signal name="XLXN_258" />
        <signal name="XLXN_33" />
        <signal name="XLXN_322" />
        <signal name="EchoSonar" />
        <signal name="TriggerSonar" />
        <signal name="XLXN_340" />
        <signal name="XLXN_396" />
        <signal name="XLXN_398" />
        <signal name="SONARSEL0" />
        <signal name="SONARSEL1" />
        <port polarity="Output" name="ForwardDir" />
        <port polarity="Output" name="ReverseDir" />
        <port polarity="Output" name="RightDir" />
        <port polarity="Output" name="LeftDir" />
        <port polarity="Output" name="UserFunction0" />
        <port polarity="Output" name="UserFunction1" />
        <port polarity="Input" name="DIRSEL0" />
        <port polarity="Input" name="DIRSEL1" />
        <port polarity="Input" name="DIRSEL2" />
        <port polarity="Output" name="TriggerSonar2" />
        <port polarity="Output" name="TriggerSonar3" />
        <port polarity="Output" name="TriggerSonar1" />
        <port polarity="Output" name="TriggerSonar0" />
        <port polarity="Input" name="EchoSonar3" />
        <port polarity="Input" name="EchoSonar2" />
        <port polarity="Input" name="EchoSonar1" />
        <port polarity="Input" name="EchoSonar0" />
        <port polarity="Output" name="EchoSonar" />
        <port polarity="Input" name="TriggerSonar" />
        <port polarity="Input" name="SONARSEL0" />
        <port polarity="Input" name="SONARSEL1" />
        <blockdef name="m4_1e">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="96" y1="-416" y2="-416" x1="0" />
            <line x2="96" y1="-352" y2="-352" x1="0" />
            <line x2="96" y1="-288" y2="-288" x1="0" />
            <line x2="96" y1="-224" y2="-224" x1="0" />
            <line x2="96" y1="-32" y2="-32" x1="0" />
            <line x2="256" y1="-320" y2="-320" x1="320" />
            <line x2="96" y1="-160" y2="-160" x1="0" />
            <line x2="96" y1="-96" y2="-96" x1="0" />
            <line x2="96" y1="-96" y2="-96" x1="176" />
            <line x2="176" y1="-208" y2="-96" x1="176" />
            <line x2="96" y1="-32" y2="-32" x1="224" />
            <line x2="224" y1="-216" y2="-32" x1="224" />
            <line x2="96" y1="-224" y2="-192" x1="256" />
            <line x2="256" y1="-416" y2="-224" x1="256" />
            <line x2="256" y1="-448" y2="-416" x1="96" />
            <line x2="96" y1="-192" y2="-448" x1="96" />
            <line x2="96" y1="-160" y2="-160" x1="128" />
            <line x2="128" y1="-200" y2="-160" x1="128" />
        </blockdef>
        <blockdef name="vcc">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="32" y1="-64" y2="-64" x1="96" />
            <line x2="64" y1="0" y2="-32" x1="64" />
            <line x2="64" y1="-32" y2="-64" x1="64" />
        </blockdef>
        <blockdef name="d2_4e">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <rect width="256" x="64" y="-384" height="320" />
            <line x2="64" y1="-128" y2="-128" x1="0" />
            <line x2="64" y1="-256" y2="-256" x1="0" />
            <line x2="64" y1="-320" y2="-320" x1="0" />
            <line x2="320" y1="-128" y2="-128" x1="384" />
            <line x2="320" y1="-192" y2="-192" x1="384" />
            <line x2="320" y1="-256" y2="-256" x1="384" />
            <line x2="320" y1="-320" y2="-320" x1="384" />
        </blockdef>
        <blockdef name="d3_8e">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-576" y2="-576" x1="0" />
            <line x2="64" y1="-512" y2="-512" x1="0" />
            <line x2="64" y1="-448" y2="-448" x1="0" />
            <line x2="320" y1="-576" y2="-576" x1="384" />
            <line x2="320" y1="-512" y2="-512" x1="384" />
            <line x2="320" y1="-448" y2="-448" x1="384" />
            <line x2="320" y1="-384" y2="-384" x1="384" />
            <line x2="320" y1="-320" y2="-320" x1="384" />
            <line x2="320" y1="-256" y2="-256" x1="384" />
            <line x2="320" y1="-192" y2="-192" x1="384" />
            <line x2="320" y1="-128" y2="-128" x1="384" />
            <rect width="256" x="64" y="-640" height="576" />
            <line x2="64" y1="-128" y2="-128" x1="0" />
        </blockdef>
        <blockdef name="or3">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="48" y1="-64" y2="-64" x1="0" />
            <line x2="72" y1="-128" y2="-128" x1="0" />
            <line x2="48" y1="-192" y2="-192" x1="0" />
            <line x2="192" y1="-128" y2="-128" x1="256" />
            <arc ex="192" ey="-128" sx="112" sy="-80" r="88" cx="116" cy="-168" />
            <arc ex="48" ey="-176" sx="48" sy="-80" r="56" cx="16" cy="-128" />
            <line x2="48" y1="-64" y2="-80" x1="48" />
            <line x2="48" y1="-192" y2="-176" x1="48" />
            <line x2="48" y1="-80" y2="-80" x1="112" />
            <arc ex="112" ey="-176" sx="192" sy="-128" r="88" cx="116" cy="-88" />
            <line x2="48" y1="-176" y2="-176" x1="112" />
        </blockdef>
        <blockdef name="or2">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-64" y2="-64" x1="0" />
            <line x2="64" y1="-128" y2="-128" x1="0" />
            <line x2="192" y1="-96" y2="-96" x1="256" />
            <arc ex="192" ey="-96" sx="112" sy="-48" r="88" cx="116" cy="-136" />
            <arc ex="48" ey="-144" sx="48" sy="-48" r="56" cx="16" cy="-96" />
            <line x2="48" y1="-144" y2="-144" x1="112" />
            <arc ex="112" ey="-144" sx="192" sy="-96" r="88" cx="116" cy="-56" />
            <line x2="48" y1="-48" y2="-48" x1="112" />
        </blockdef>
        <blockdef name="obuf">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="0" y2="-64" x1="64" />
            <line x2="64" y1="-32" y2="0" x1="128" />
            <line x2="128" y1="-64" y2="-32" x1="64" />
            <line x2="64" y1="-32" y2="-32" x1="0" />
            <line x2="128" y1="-32" y2="-32" x1="224" />
        </blockdef>
        <blockdef name="obuf4">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="0" y2="-64" x1="64" />
            <line x2="64" y1="-32" y2="0" x1="128" />
            <line x2="128" y1="-64" y2="-32" x1="64" />
            <line x2="64" y1="-128" y2="-192" x1="64" />
            <line x2="64" y1="-160" y2="-128" x1="128" />
            <line x2="128" y1="-192" y2="-160" x1="64" />
            <line x2="64" y1="-192" y2="-256" x1="64" />
            <line x2="64" y1="-224" y2="-192" x1="128" />
            <line x2="128" y1="-256" y2="-224" x1="64" />
            <line x2="128" y1="-224" y2="-224" x1="224" />
            <line x2="128" y1="-160" y2="-160" x1="224" />
            <line x2="64" y1="-96" y2="-96" x1="0" />
            <line x2="128" y1="-96" y2="-96" x1="224" />
            <line x2="64" y1="-64" y2="-128" x1="64" />
            <line x2="64" y1="-96" y2="-64" x1="128" />
            <line x2="128" y1="-128" y2="-96" x1="64" />
            <line x2="64" y1="-160" y2="-160" x1="0" />
            <line x2="64" y1="-224" y2="-224" x1="0" />
            <line x2="64" y1="-32" y2="-32" x1="0" />
            <line x2="128" y1="-32" y2="-32" x1="224" />
        </blockdef>
        <blockdef name="ibuf4">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-224" y2="-224" x1="0" />
            <line x2="128" y1="-160" y2="-160" x1="224" />
            <line x2="64" y1="-32" y2="-32" x1="0" />
            <line x2="64" y1="-192" y2="-256" x1="64" />
            <line x2="64" y1="-224" y2="-192" x1="128" />
            <line x2="128" y1="-256" y2="-224" x1="64" />
            <line x2="64" y1="-128" y2="-192" x1="64" />
            <line x2="64" y1="-160" y2="-128" x1="128" />
            <line x2="128" y1="-192" y2="-160" x1="64" />
            <line x2="64" y1="-64" y2="-128" x1="64" />
            <line x2="64" y1="-96" y2="-64" x1="128" />
            <line x2="128" y1="-128" y2="-96" x1="64" />
            <line x2="64" y1="0" y2="-64" x1="64" />
            <line x2="64" y1="-32" y2="0" x1="128" />
            <line x2="128" y1="-64" y2="-32" x1="64" />
            <line x2="128" y1="-32" y2="-32" x1="224" />
            <line x2="64" y1="-96" y2="-96" x1="0" />
            <line x2="64" y1="-160" y2="-160" x1="0" />
            <line x2="128" y1="-224" y2="-224" x1="224" />
            <line x2="128" y1="-96" y2="-96" x1="224" />
        </blockdef>
        <blockdef name="ibuf">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="0" y2="-64" x1="64" />
            <line x2="64" y1="-32" y2="0" x1="128" />
            <line x2="128" y1="-64" y2="-32" x1="64" />
            <line x2="128" y1="-32" y2="-32" x1="224" />
            <line x2="64" y1="-32" y2="-32" x1="0" />
        </blockdef>
        <blockdef name="copy_of_title">
            <timestamp>2011-1-7T15:56:31</timestamp>
            <line x2="-1140" y1="-176" y2="-176" x1="-112" />
            <line x2="-1136" y1="-416" y2="-212" style="linewidth:W" x1="-1136" />
            <line x2="-80" y1="-416" y2="-220" style="linewidth:W" x1="-80" />
            <line x2="-80" y1="-416" y2="-416" style="linewidth:W" x1="-1136" />
            <line x2="-80" y1="-128" y2="-128" x1="-1136" />
            <line x2="-80" y1="-220" y2="-220" x1="-1132" />
            <line x2="-352" y1="-80" y2="-80" style="linewidth:W" x1="-80" />
            <line x2="-352" y1="-80" y2="-80" style="linewidth:W" x1="-1136" />
            <line x2="-1136" y1="-224" y2="-80" style="linewidth:W" x1="-1136" />
            <line x2="-152" y1="-80" y2="-80" style="linewidth:W" x1="-144" />
            <line x2="-80" y1="-224" y2="-80" style="linewidth:W" x1="-80" />
            <line x2="-780" y1="-128" y2="-80" x1="-780" />
            <line x2="-80" y1="-176" y2="-176" x1="-112" />
            <line x2="-144" y1="-128" y2="-128" x1="-176" />
            <line x2="-920" y1="-360" y2="-364" x1="-840" />
            <arc ex="-816" ey="-252" sx="-924" sy="-260" r="72" cx="-867" cy="-306" />
            <line x2="-924" y1="-264" y2="-260" x1="-844" />
            <line x2="-844" y1="-304" y2="-264" x1="-808" />
            <line x2="-840" y1="-304" y2="-360" x1="-808" />
            <line x2="-816" y1="-296" y2="-360" x1="-628" />
            <line x2="-632" y1="-252" y2="-264" x1="-816" />
            <arc ex="-976" ey="-300" sx="-936" sy="-380" r="46" cx="-944" cy="-334" />
            <arc ex="-972" ey="-264" sx="-920" sy="-396" r="70" cx="-948" cy="-331" />
            <line x2="-628" y1="-264" y2="-296" x1="-632" />
            <arc ex="-920" ey="-364" sx="-816" sy="-360" r="53" cx="-869" cy="-346" />
            <rect width="40" x="-904" y="-332" height="40" />
            <line x2="-836" y1="-328" y2="-328" x1="-860" />
            <line x2="-836" y1="-312" y2="-312" x1="-860" />
            <line x2="-836" y1="-296" y2="-296" x1="-860" />
            <line x2="-900" y1="-268" y2="-288" x1="-900" />
            <line x2="-884" y1="-268" y2="-288" x1="-884" />
            <line x2="-868" y1="-268" y2="-288" x1="-868" />
            <line x2="-904" y1="-328" y2="-328" x1="-928" />
            <line x2="-904" y1="-312" y2="-312" x1="-928" />
            <line x2="-904" y1="-296" y2="-296" x1="-928" />
            <line x2="-900" y1="-332" y2="-352" x1="-900" />
            <line x2="-884" y1="-332" y2="-352" x1="-884" />
            <line x2="-868" y1="-332" y2="-352" x1="-868" />
        </blockdef>
        <block symbolname="vcc" name="XLXI_40">
            <blockpin signalname="XLXN_150" name="P" />
        </block>
        <block symbolname="or3" name="XLXI_13">
            <blockpin signalname="XLXN_168" name="I0" />
            <blockpin signalname="XLXN_238" name="I1" />
            <blockpin signalname="XLXN_159" name="I2" />
            <blockpin signalname="XLXN_254" name="O" />
        </block>
        <block symbolname="or3" name="XLXI_14">
            <blockpin signalname="XLXN_169" name="I0" />
            <blockpin signalname="XLXN_401" name="I1" />
            <blockpin signalname="XLXN_164" name="I2" />
            <blockpin signalname="Reverse" name="O" />
        </block>
        <block symbolname="or2" name="XLXI_39">
            <blockpin signalname="XLXN_169" name="I0" />
            <blockpin signalname="XLXN_168" name="I1" />
            <blockpin signalname="Right" name="O" />
        </block>
        <block symbolname="or2" name="XLXI_38">
            <blockpin signalname="XLXN_401" name="I0" />
            <blockpin signalname="XLXN_238" name="I1" />
            <blockpin signalname="Left" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_49">
            <blockpin signalname="Reverse" name="I" />
            <blockpin signalname="ReverseDir" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_51">
            <blockpin signalname="Right" name="I" />
            <blockpin signalname="RightDir" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_44">
            <blockpin signalname="XLXN_254" name="I" />
            <blockpin signalname="ForwardDir" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_47">
            <blockpin signalname="Left" name="I" />
            <blockpin signalname="LeftDir" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_54">
            <blockpin signalname="XLXN_250" name="I" />
            <blockpin signalname="UserFunction1" name="O" />
        </block>
        <block symbolname="obuf" name="XLXI_55">
            <blockpin signalname="XLXN_251" name="I" />
            <blockpin signalname="UserFunction0" name="O" />
        </block>
        <block symbolname="d3_8e" name="XLXI_12">
            <blockpin signalname="XLXN_385" name="A0" />
            <blockpin signalname="XLXN_386" name="A1" />
            <blockpin signalname="XLXN_387" name="A2" />
            <blockpin signalname="XLXN_150" name="E" />
            <blockpin signalname="XLXN_251" name="D0" />
            <blockpin signalname="XLXN_250" name="D1" />
            <blockpin signalname="XLXN_159" name="D2" />
            <blockpin signalname="XLXN_238" name="D3" />
            <blockpin signalname="XLXN_168" name="D4" />
            <blockpin signalname="XLXN_164" name="D5" />
            <blockpin signalname="XLXN_401" name="D6" />
            <blockpin signalname="XLXN_169" name="D7" />
        </block>
        <block symbolname="ibuf" name="XLXI_102">
            <blockpin signalname="DIRSEL0" name="I" />
            <blockpin signalname="XLXN_385" name="O" />
        </block>
        <block symbolname="ibuf" name="XLXI_103">
            <blockpin signalname="DIRSEL1" name="I" />
            <blockpin signalname="XLXN_386" name="O" />
        </block>
        <block symbolname="ibuf" name="XLXI_104">
            <blockpin signalname="DIRSEL2" name="I" />
            <blockpin signalname="XLXN_387" name="O" />
        </block>
        <block symbolname="copy_of_title" name="XLXI_115" />
        <block symbolname="d2_4e" name="XLXI_9">
            <blockpin signalname="XLXN_396" name="A0" />
            <blockpin signalname="XLXN_398" name="A1" />
            <blockpin signalname="XLXN_340" name="E" />
            <blockpin signalname="XLXN_239" name="D0" />
            <blockpin signalname="XLXN_240" name="D1" />
            <blockpin signalname="XLXN_241" name="D2" />
            <blockpin signalname="XLXN_242" name="D3" />
        </block>
        <block symbolname="obuf4" name="XLXI_53">
            <blockpin signalname="XLXN_239" name="I0" />
            <blockpin signalname="XLXN_240" name="I1" />
            <blockpin signalname="XLXN_241" name="I2" />
            <blockpin signalname="XLXN_242" name="I3" />
            <blockpin signalname="TriggerSonar0" name="O0" />
            <blockpin signalname="TriggerSonar1" name="O1" />
            <blockpin signalname="TriggerSonar2" name="O2" />
            <blockpin signalname="TriggerSonar3" name="O3" />
        </block>
        <block symbolname="ibuf4" name="XLXI_59">
            <blockpin signalname="EchoSonar3" name="I0" />
            <blockpin signalname="EchoSonar2" name="I1" />
            <blockpin signalname="EchoSonar1" name="I2" />
            <blockpin signalname="EchoSonar0" name="I3" />
            <blockpin signalname="XLXN_261" name="O0" />
            <blockpin signalname="XLXN_260" name="O1" />
            <blockpin signalname="XLXN_259" name="O2" />
            <blockpin signalname="XLXN_258" name="O3" />
        </block>
        <block symbolname="vcc" name="XLXI_6">
            <blockpin signalname="XLXN_33" name="P" />
        </block>
        <block symbolname="obuf" name="XLXI_72">
            <blockpin signalname="XLXN_322" name="I" />
            <blockpin signalname="EchoSonar" name="O" />
        </block>
        <block symbolname="m4_1e" name="XLXI_2">
            <blockpin signalname="XLXN_258" name="D0" />
            <blockpin signalname="XLXN_259" name="D1" />
            <blockpin signalname="XLXN_260" name="D2" />
            <blockpin signalname="XLXN_261" name="D3" />
            <blockpin signalname="XLXN_33" name="E" />
            <blockpin signalname="XLXN_396" name="S0" />
            <blockpin signalname="XLXN_398" name="S1" />
            <blockpin signalname="XLXN_322" name="O" />
        </block>
        <block symbolname="ibuf" name="XLXI_77">
            <blockpin signalname="TriggerSonar" name="I" />
            <blockpin signalname="XLXN_340" name="O" />
        </block>
        <block symbolname="ibuf" name="XLXI_110">
            <blockpin signalname="SONARSEL0" name="I" />
            <blockpin signalname="XLXN_396" name="O" />
        </block>
        <block symbolname="ibuf" name="XLXI_111">
            <blockpin signalname="SONARSEL1" name="I" />
            <blockpin signalname="XLXN_398" name="O" />
        </block>
    </netlist>
    <sheet sheetnum="1" width="3520" height="2720">
        <branch name="XLXN_150">
            <wire x2="512" y1="2192" y2="2256" x1="512" />
            <wire x2="608" y1="2256" y2="2256" x1="512" />
            <wire x2="608" y1="2176" y2="2256" x1="608" />
            <wire x2="656" y1="2176" y2="2176" x1="608" />
        </branch>
        <branch name="XLXN_159">
            <wire x2="1104" y1="1856" y2="1856" x1="1040" />
        </branch>
        <branch name="XLXN_164">
            <wire x2="1088" y1="2048" y2="2048" x1="1040" />
        </branch>
        <branch name="XLXN_168">
            <wire x2="1072" y1="1984" y2="1984" x1="1040" />
            <wire x2="1104" y1="1984" y2="1984" x1="1072" />
            <wire x2="1072" y1="1984" y2="2240" x1="1072" />
            <wire x2="1184" y1="2240" y2="2240" x1="1072" />
        </branch>
        <branch name="XLXN_169">
            <wire x2="1056" y1="2176" y2="2176" x1="1040" />
            <wire x2="1088" y1="2176" y2="2176" x1="1056" />
            <wire x2="1056" y1="2176" y2="2304" x1="1056" />
            <wire x2="1184" y1="2304" y2="2304" x1="1056" />
        </branch>
        <branch name="ForwardDir">
            <wire x2="2176" y1="1920" y2="1920" x1="1776" />
        </branch>
        <branch name="ReverseDir">
            <wire x2="2176" y1="2112" y2="2112" x1="1808" />
        </branch>
        <branch name="RightDir">
            <wire x2="2176" y1="2272" y2="2272" x1="1904" />
        </branch>
        <branch name="Right">
            <wire x2="1680" y1="2272" y2="2272" x1="1440" />
        </branch>
        <branch name="Left">
            <wire x2="1920" y1="2000" y2="2000" x1="1760" />
        </branch>
        <branch name="Reverse">
            <wire x2="1584" y1="2112" y2="2112" x1="1344" />
        </branch>
        <branch name="XLXN_238">
            <wire x2="1056" y1="1920" y2="1920" x1="1040" />
            <wire x2="1104" y1="1920" y2="1920" x1="1056" />
            <wire x2="1056" y1="1840" y2="1920" x1="1056" />
            <wire x2="1456" y1="1840" y2="1840" x1="1056" />
            <wire x2="1456" y1="1840" y2="1968" x1="1456" />
            <wire x2="1504" y1="1968" y2="1968" x1="1456" />
        </branch>
        <branch name="LeftDir">
            <wire x2="2176" y1="2000" y2="2000" x1="2144" />
        </branch>
        <branch name="XLXN_250">
            <wire x2="1072" y1="1792" y2="1792" x1="1040" />
        </branch>
        <branch name="XLXN_251">
            <wire x2="1072" y1="1728" y2="1728" x1="1040" />
        </branch>
        <branch name="UserFunction0">
            <wire x2="2176" y1="1728" y2="1728" x1="1296" />
        </branch>
        <branch name="UserFunction1">
            <wire x2="2176" y1="1792" y2="1792" x1="1296" />
        </branch>
        <branch name="XLXN_254">
            <wire x2="1552" y1="1920" y2="1920" x1="1360" />
        </branch>
        <instance x="448" y="2192" name="XLXI_40" orien="R0" />
        <instance x="1104" y="2048" name="XLXI_13" orien="R0" />
        <instance x="1088" y="2240" name="XLXI_14" orien="R0" />
        <text style="fontsize:64;fontname:Arial" x="736" y="2468">Direction Selection</text>
        <instance x="1184" y="2368" name="XLXI_39" orien="R0" />
        <instance x="1504" y="2096" name="XLXI_38" orien="R0" />
        <instance x="1584" y="2144" name="XLXI_49" orien="R0" />
        <instance x="1680" y="2304" name="XLXI_51" orien="R0" />
        <instance x="1552" y="1952" name="XLXI_44" orien="R0" />
        <instance x="1920" y="2032" name="XLXI_47" orien="R0" />
        <instance x="1072" y="1824" name="XLXI_54" orien="R0" />
        <instance x="1072" y="1760" name="XLXI_55" orien="R0" />
        <instance x="656" y="2304" name="XLXI_12" orien="R0" />
        <iomarker fontsize="28" x="2176" y="2000" name="LeftDir" orien="R0" />
        <iomarker fontsize="28" x="2176" y="1728" name="UserFunction0" orien="R0" />
        <iomarker fontsize="28" x="2176" y="1792" name="UserFunction1" orien="R0" />
        <iomarker fontsize="28" x="2176" y="1920" name="ForwardDir" orien="R0" />
        <iomarker fontsize="28" x="2176" y="2112" name="ReverseDir" orien="R0" />
        <iomarker fontsize="28" x="2176" y="2272" name="RightDir" orien="R0" />
        <iomarker fontsize="28" x="336" y="1728" name="DIRSEL0" orien="R180" />
        <iomarker fontsize="28" x="336" y="1792" name="DIRSEL1" orien="R180" />
        <iomarker fontsize="28" x="336" y="1856" name="DIRSEL2" orien="R180" />
        <branch name="XLXN_385">
            <wire x2="656" y1="1728" y2="1728" x1="624" />
        </branch>
        <instance x="400" y="1760" name="XLXI_102" orien="R0" />
        <branch name="XLXN_386">
            <wire x2="656" y1="1792" y2="1792" x1="624" />
        </branch>
        <instance x="400" y="1824" name="XLXI_103" orien="R0" />
        <branch name="XLXN_387">
            <wire x2="656" y1="1856" y2="1856" x1="624" />
        </branch>
        <instance x="400" y="1888" name="XLXI_104" orien="R0" />
        <branch name="DIRSEL0">
            <wire x2="400" y1="1728" y2="1728" x1="336" />
        </branch>
        <branch name="DIRSEL1">
            <wire x2="400" y1="1792" y2="1792" x1="336" />
        </branch>
        <branch name="DIRSEL2">
            <wire x2="400" y1="1856" y2="1856" x1="336" />
        </branch>
        <branch name="XLXN_401">
            <wire x2="1056" y1="2112" y2="2112" x1="1040" />
            <wire x2="1088" y1="2112" y2="2112" x1="1056" />
            <wire x2="1504" y1="2032" y2="2032" x1="1056" />
            <wire x2="1056" y1="2032" y2="2112" x1="1056" />
        </branch>
        <instance x="3520" y="2672" name="XLXI_115" orien="R0">
        </instance>
        <instance x="640" y="592" name="XLXI_9" orien="R0" />
        <branch name="XLXN_239">
            <wire x2="1056" y1="272" y2="272" x1="1024" />
        </branch>
        <branch name="XLXN_240">
            <wire x2="1056" y1="336" y2="336" x1="1024" />
        </branch>
        <branch name="XLXN_241">
            <wire x2="1056" y1="400" y2="400" x1="1024" />
        </branch>
        <branch name="XLXN_242">
            <wire x2="1056" y1="464" y2="464" x1="1024" />
        </branch>
        <instance x="1056" y="496" name="XLXI_53" orien="R0" />
        <branch name="TriggerSonar2">
            <wire x2="1312" y1="400" y2="400" x1="1280" />
        </branch>
        <branch name="TriggerSonar3">
            <wire x2="1312" y1="464" y2="464" x1="1280" />
        </branch>
        <branch name="TriggerSonar1">
            <wire x2="1312" y1="336" y2="336" x1="1280" />
        </branch>
        <branch name="TriggerSonar0">
            <wire x2="1312" y1="272" y2="272" x1="1280" />
        </branch>
        <branch name="EchoSonar3">
            <wire x2="1440" y1="1104" y2="1104" x1="1360" />
        </branch>
        <branch name="EchoSonar2">
            <wire x2="1440" y1="1040" y2="1040" x1="1360" />
        </branch>
        <branch name="EchoSonar1">
            <wire x2="1440" y1="976" y2="976" x1="1360" />
        </branch>
        <branch name="EchoSonar0">
            <wire x2="1440" y1="912" y2="912" x1="1360" />
        </branch>
        <branch name="XLXN_261">
            <wire x2="1136" y1="1104" y2="1104" x1="1056" />
        </branch>
        <branch name="XLXN_260">
            <wire x2="1136" y1="1040" y2="1040" x1="1056" />
        </branch>
        <branch name="XLXN_259">
            <wire x2="1136" y1="976" y2="976" x1="1056" />
        </branch>
        <branch name="XLXN_258">
            <wire x2="1136" y1="912" y2="912" x1="1056" />
        </branch>
        <branch name="XLXN_33">
            <wire x2="1296" y1="1296" y2="1296" x1="1056" />
        </branch>
        <branch name="XLXN_322">
            <wire x2="736" y1="1008" y2="1008" x1="720" />
        </branch>
        <branch name="EchoSonar">
            <wire x2="496" y1="1008" y2="1008" x1="368" />
        </branch>
        <instance x="1360" y="880" name="XLXI_59" orien="R180" />
        <instance x="1296" y="1232" name="XLXI_6" orien="R90" />
        <instance x="720" y="976" name="XLXI_72" orien="R180" />
        <instance x="1056" y="1328" name="XLXI_2" orien="M0" />
        <branch name="TriggerSonar">
            <wire x2="384" y1="464" y2="464" x1="368" />
        </branch>
        <instance x="384" y="496" name="XLXI_77" orien="R0" />
        <branch name="XLXN_340">
            <wire x2="640" y1="464" y2="464" x1="608" />
        </branch>
        <branch name="XLXN_396">
            <wire x2="576" y1="144" y2="272" x1="576" />
            <wire x2="640" y1="272" y2="272" x1="576" />
            <wire x2="1584" y1="144" y2="144" x1="576" />
            <wire x2="1584" y1="144" y2="592" x1="1584" />
            <wire x2="880" y1="592" y2="592" x1="688" />
            <wire x2="1584" y1="592" y2="592" x1="880" />
            <wire x2="880" y1="576" y2="592" x1="880" />
            <wire x2="1120" y1="576" y2="576" x1="880" />
            <wire x2="1120" y1="576" y2="1168" x1="1120" />
            <wire x2="1120" y1="1168" y2="1168" x1="1056" />
        </branch>
        <branch name="XLXN_398">
            <wire x2="592" y1="128" y2="336" x1="592" />
            <wire x2="640" y1="336" y2="336" x1="592" />
            <wire x2="1040" y1="128" y2="128" x1="592" />
            <wire x2="1040" y1="128" y2="720" x1="1040" />
            <wire x2="1072" y1="720" y2="720" x1="1040" />
            <wire x2="1072" y1="720" y2="1232" x1="1072" />
            <wire x2="1040" y1="720" y2="720" x1="688" />
            <wire x2="1072" y1="1232" y2="1232" x1="1056" />
        </branch>
        <branch name="SONARSEL0">
            <wire x2="464" y1="592" y2="592" x1="368" />
        </branch>
        <branch name="SONARSEL1">
            <wire x2="464" y1="720" y2="720" x1="368" />
        </branch>
        <instance x="464" y="624" name="XLXI_110" orien="R0" />
        <instance x="464" y="752" name="XLXI_111" orien="R0" />
        <iomarker fontsize="28" x="1312" y="400" name="TriggerSonar2" orien="R0" />
        <iomarker fontsize="28" x="1312" y="464" name="TriggerSonar3" orien="R0" />
        <iomarker fontsize="28" x="1312" y="336" name="TriggerSonar1" orien="R0" />
        <iomarker fontsize="28" x="1312" y="272" name="TriggerSonar0" orien="R0" />
        <iomarker fontsize="28" x="1440" y="1104" name="EchoSonar3" orien="R0" />
        <iomarker fontsize="28" x="1440" y="1040" name="EchoSonar2" orien="R0" />
        <iomarker fontsize="28" x="1440" y="976" name="EchoSonar1" orien="R0" />
        <iomarker fontsize="28" x="1440" y="912" name="EchoSonar0" orien="R0" />
        <iomarker fontsize="28" x="368" y="464" name="TriggerSonar" orien="R180" />
        <iomarker fontsize="28" x="368" y="720" name="SONARSEL1" orien="R180" />
        <iomarker fontsize="28" x="368" y="1008" name="EchoSonar" orien="R180" />
        <iomarker fontsize="28" x="368" y="592" name="SONARSEL0" orien="R180" />
        <text style="fontsize:64;fontname:Arial" x="720" y="1396">Sensor Selection</text>
    </sheet>
</drawing>

repository: rngadam/ART

repo_name: rngadam/ART

extension: sch


text:
/*
* Copyright (c) 2014 Santiago Arias | Remy Jourde
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

package helpers

import (
	"strings"
)

// TrimLower returns a lower case slice of the string s, with all leading and trailing white space removed, as defined by Unicode.
//
func TrimLower(s string) string {
	return strings.TrimSpace(strings.ToLower(s))
}

// SetOfStrings returns a set of string for a given strings.
//
func SetOfStrings(s string) []string {
	slice := strings.Split(TrimLower(s), " ")
	set := ""
	for _, w := range slice {
		if !StringContains(set, w) {
			if len(set) == 0 {
				set = w
			} else {
				set = set + " " + w
			}
		}
	}
	return strings.Split(set, " ")
}

// SliceContains checks if a given string exists in a slice of strings.
//
func SliceContains(slice []string, s string) bool {
	for _, w := range slice {
		if w == s {
			return true
		}
	}
	return false
}

// StringContains checks if a given string exists in a string.
//
func StringContains(strToSplit string, s string) bool {
	slice := strings.Split(strToSplit, " ")
	for _, w := range slice {
		if w == s {
			return true
		}
	}
	return false
}

// Intersect computes the instersection of two strings.
// From two strings with format "str1 str2" and "str2 str3" in this example the result is "str2".
//
func Intersect(a string, b string) string {
	sa := SetOfStrings(a)
	sb := SetOfStrings(b)
	intersect := ""
	for _, val := range sa {
		if SliceContains(sb, val) {
			if len(intersect) == 0 {
				intersect = val
			} else {
				intersect = intersect + " " + val
			}
		}
	}
	return intersect
}

// CountTerm counts the occurrence of a word into a slice of words.
//
func CountTerm(words []string, w string) int64 {
	var c int64
	for _, wi := range words {
		if wi == w {
			c = c + 1
		}
	}
	return c
}

license: ISC