text
stringlengths
27
775k
#r "System.Runtime" using System; using System.Net; using System.Text; using Newtonsoft.Json; using Twilio.TwiML; public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); var data = await req.Content.ReadAsStringAsync(); var formValues = data.Split('&') .Select(value => value.Split('=')) .ToDictionary(pair => Uri.UnescapeDataString(pair[0]).Replace("+", " "), pair => Uri.UnescapeDataString(pair[1]).Replace("+", " ")); // Perform calculations, API lookups, etc. here log.Info($"Message from {formValues["From"]} in {formValues["FromCity"]} said '{formValues["Body"]}'."); // What am I sending back to caller var response = new MessagingResponse() .Message($"You said: {formValues["Body"]}"); var twiml = response.ToString(); twiml = twiml.Replace("utf-16", "utf-8"); return new HttpResponseMessage { Content = new StringContent(twiml, Encoding.UTF8, "application/xml") }; }
<?php /** * @see https://github.com/dotkernel/dot-queue/ for the canonical source repository * @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) * @license https://github.com/dotkernel/dot-queue/blob/master/LICENSE.md MIT License */ declare(strict_types=1); namespace Dot\Queue; use Zend\Stdlib\AbstractOptions; /** * Class WorkerOptions * @package Dot\Queue */ class ConsumerOptions extends AbstractOptions { const QUEUES_ALL = 'QUEUES_ALL'; /** @var int */ protected $sleep = 1; /** @var int */ protected $maxRuntime = 0; /** @var int */ protected $maxJobs = 0; /** @var int */ protected $memoryLimit = 128; /** @var array */ protected $queues; /** @var bool */ protected $stopOnError = false; /** @var bool */ protected $stopOnEmpty = false; /** * WorkerOptions constructor. * @param null $options */ public function __construct($options = null) { $this->__strictMode__ = false; parent::__construct($options); } /** * @return array|string */ public function getQueues() { return $this->queues ?? []; } /** * @param array|string $queues * @return ConsumerOptions */ public function setQueues($queues): ConsumerOptions { $this->queues = $queues; return $this; } /** * @return int */ public function getSleep(): int { return $this->sleep; } /** * @param int $sleep * @return ConsumerOptions */ public function setSleep(int $sleep): ConsumerOptions { $this->sleep = $sleep; return $this; } /** * @return int */ public function getMaxRuntime(): int { return $this->maxRuntime; } /** * @param int $maxRuntime * @return ConsumerOptions */ public function setMaxRuntime(int $maxRuntime): ConsumerOptions { $this->maxRuntime = $maxRuntime; return $this; } /** * @return int */ public function getMaxJobs(): int { return $this->maxJobs; } /** * @param int $maxJobs * @return ConsumerOptions */ public function setMaxJobs(int $maxJobs): ConsumerOptions { $this->maxJobs = $maxJobs; return $this; } /** * @return int */ public function getMemoryLimit(): int { return $this->memoryLimit; } /** * @param int $memoryLimit * @return ConsumerOptions */ public function setMemoryLimit(int $memoryLimit): ConsumerOptions { $this->memoryLimit = $memoryLimit; return $this; } /** * @return bool */ public function isStopOnError(): bool { return $this->stopOnError; } /** * @param bool $stopOnError * @return ConsumerOptions */ public function setStopOnError(bool $stopOnError): ConsumerOptions { $this->stopOnError = $stopOnError; return $this; } /** * @return bool */ public function isStopOnEmpty(): bool { return $this->stopOnEmpty; } /** * @param bool $stopOnEmpty * @return ConsumerOptions */ public function setStopOnEmpty(bool $stopOnEmpty): ConsumerOptions { $this->stopOnEmpty = $stopOnEmpty; return $this; } }
(ns rate-limit-scheduler.core (:require [clojure.java.io :as io] [org.httpkit.server :as server] [cheshire.core :as cheshire] [rate-limit-scheduler [split-queue :as sq]]) (:import [java.lang System Thread Runtime])) (defn handle-get [channel] (server/send! channel {:status 200 :body "Running"})) (defn handle-post [system req channel] (let [reqs (->> req :body io/reader cheshire/parse-stream (map #(identity {::request % ::channel channel}))) status (dosync (if (::collecting? @system) (if (sq/able? (::collecting-queue @system)) (do (alter system update ::collecting-queue sq/put reqs) false) ; Too Many Requests 429) ; Service Unavailable 503))] (when status (server/send! channel {:status status})))) (defn route [system {:keys [request-method] :as req} channel] (case request-method :get (handle-get channel) :post (handle-post system req channel) (server/send! channel {:status 405 :headers {"Allow" "GET, POST"}}))) (defn server-handler [system req] (server/with-channel req channel (route system req channel))) (defn run-server [server-options system] (server/run-server ((::middleware @system) (partial server-handler system)) server-options)) (defn reset-collecting-queue [system] (dosync (let [{:keys [::collecting-queue]} @system {:keys [::sq/limit ::sq/last-taken]} collecting-queue] (alter system assoc ::collecting-queue (sq/make limit last-taken)) collecting-queue))) (defn collect [system] (let [draining-queue (reset-collecting-queue system) {:keys [::poll-size ::request-state ::request-batch ::log-fn]} @system [winners loser-queue] (sq/poll draining-queue (poll-size request-state)) [losers _] (sq/drain loser-queue) [new-request-state winner-resps] (request-batch winners) winner-groups (group-by ::channel winner-resps) loser-groups (group-by ::channel losers) channels (set (concat (keys winner-groups) (keys loser-groups)))] (dosync (alter system update ::request-state merge new-request-state)) (doseq [channel channels] (server/send! channel {:status 200 :headers {"Content-Type" "application/json"} :body (cheshire/generate-string [(map #(dissoc % ::channel) (get winner-groups channel)) (map #(dissoc % ::channel) (get loser-groups channel))])})) (log-fn (merge (sq/stats draining-queue) (select-keys @system [::request-state]))))) (defn sleep [fn] (let [start-time (System/currentTimeMillis)] (fn) (let [end-time (System/currentTimeMillis) diff (- end-time start-time)] (when (< diff 2000) (Thread/sleep (- 2000 diff)))))) (defn request-loop [system] (while (::collecting? @system) (sleep #(try (collect system) (catch Exception e ((::error-fn @system) e)))))) (defn start-thread [name fn] (doto (Thread. ^Runnable fn) (.setName name) (.start))) (defn make-system " Options: ::limit ; Number of simultaneous requestors allowed before ; 429 Too Many Requests returned ::server-options ; Options passed to httpkit server ::middleware ; (fn [handler]) => (fn [req]) ::poll-size ; Calculates number of requests to make ; (fn [request-state]) ; => int ::request-batch ; Makes the actual request ; (fn [(seq {::request ::channel})]) ; => [request-state (seq {::request ::response ::channel})] ::log-fn ; Called ever cycle with stats to log ; (fn [{}]) => nil ::error-fn ; Called when an error occurs ; (fn [exception]) => nil " [{limit ::limit :as options}] (let [limit (or limit 2000)] (ref (merge ; Defaults {::server-options {:port 8080 :queue-size limit} ::middleware (fn [handler] (fn [req] (handler req))) ::poll-size (constantly 10) ::request-batch (fn [x] [{} x]) ::log-fn prn ::error-fn prn} ; Override defaults with options passed in (dissoc options ::limit) ; Internal state {::collecting? false ::running? false ::collecting-queue (sq/make limit) ; Typically holds information like: ; {x-rate-limit-limit int ; x-rate-limit-reset int ; x-rate-limit-remaining int} ::request-state {}})))) (defn stop [system] (when (::running? @system) ((::log-fn @system) "Shutting down.") (dosync (alter system assoc ::collecting? false)) (let [{:keys [::server ::request-loop-thread ::shutdown-hook ::shutting-down?]} @system] (.join ^Thread request-loop-thread) (server :timeout 60) (when (not shutting-down?) (.removeShutdownHook (Runtime/getRuntime) shutdown-hook)) (dosync (alter system dissoc ::server ::request-loop-thread ::shutdown-hook) (alter system assoc ::running? false)) ((::log-fn @system) "Done shutting down.")))) (defn shutdown-hook [system] (Thread. ^Runnable (fn [] ((::log-fn @system) "Received shutdown hook.") (dosync (alter system assoc ::shutting-down? true)) (stop system)))) (defn start [system] (when (not (::running? @system)) (dosync (alter system assoc ::collecting? true ::running? true)) (let [server (run-server (::server-options @system) system) thread (start-thread "request-loop" (partial request-loop system)) shutdown-hook (shutdown-hook system)] (.addShutdownHook (Runtime/getRuntime) shutdown-hook) (dosync (alter system assoc ::server server ::request-loop-thread thread ::shutdown-hook shutdown-hook)))))
package cmwell.analytics.util import akka.actor.ActorSystem import akka.http.scaladsl.model.HttpMethods.GET import akka.http.scaladsl.model.{HttpRequest, Uri} import akka.stream.ActorMaterializer import com.fasterxml.jackson.databind.JsonNode import scala.collection.JavaConverters._ import scala.concurrent.ExecutionContextExecutor import scala.util.Try // TODO: These s/b `Uri`s? case class ContactPoints(cassandra: String, es: String) object FindContactPoints { /** Given a CM-Well URL, find Elasticsearch contact point. * This will be in the form: host:port. * Uses the first accessible master, which should expose ES on port 9200 (clustered) or 9201 (single). * * Using jackson included with Spark for parsing JSON (to avoid version conflicts). */ def es(url: String) (implicit system: ActorSystem, executionContext: ExecutionContextExecutor, actorMaterializer: ActorMaterializer): String = { val uri = Uri(url) val request = HttpRequest( method = GET, uri = s"http://${uri.authority.host}:${uri.authority.port}/proc/health?format=json") val json: JsonNode = HttpUtil.jsonResult(request, "fetch /proc/health") val masterIpAddresses: Seq[String] = json.get("fields").findValue("masters").elements.asScala.map(_.textValue).toSeq if (masterIpAddresses.isEmpty) throw new RuntimeException("No master node addresses found.") // For Elasticsearch, the port is 9201 for a single node, and 9200 for clustered. val esPort = if (masterIpAddresses.lengthCompare(1) > 0) "9200" else "9201" // All the masters should be accessible, but verify that. // A better implementation would keep all the endpoints in the list, and we could fall back to the others // if the one we are using disappears. val firstAccessibleESEndpoint = masterIpAddresses.find { ipAddress => val request = HttpRequest( method = GET, uri = s"http://$ipAddress:$esPort") Try(HttpUtil.result(request, "probe for accessible es endpoint")).isSuccess } if (firstAccessibleESEndpoint.isEmpty) throw new RuntimeException("No accessible ES endpoint was found.") s"${firstAccessibleESEndpoint.get}:$esPort" } }
// Copyright (c) 2021 Red Hat, Inc. // Copyright Contributors to the Open Cluster Management project package transforms import ( "testing" ) func TestTransformPolicyReport(t *testing.T) { var pr PolicyReport UnmarshalFile("policyreport.json", &pr, t) node := PolicyReportResourceBuilder(&pr).BuildNode() // Test unique fields that exist in policy report and are shown in UI - the common test will test the other bits AssertEqual("message", node.Properties["message"], "policyreport testing risk 1", t) AssertDeepEqual("category", node.Properties["category"], []string{"category", "category1", "category2"}, t) AssertEqual("risk", node.Properties["risk"], "1", t) AssertEqual("result", node.Properties["result"], "error", t) } func TestPolicyReportBuildEdges(t *testing.T) { // Build a fake NodeStore with nodes needed to generate edges. nodes := make([]Node, 0) nodeStore := BuildFakeNodeStore(nodes) // Build edges from mock resource policyreport.json var pr PolicyReport UnmarshalFile("policyreport.json", &pr, t) edges := PolicyReportResourceBuilder(&pr).BuildEdges(nodeStore) // Validate results AssertEqual("PolicyReport has no edges:", len(edges), 0, t) }
<?php namespace App\Models; use CodeIgniter\Model; class Model_cie10 extends Model { protected $table = 'hcv_cie10'; protected $primaryKey = 'ID'; protected $allowedFields = ['LETRA', 'CATALOG_KEY', 'NOMBRE', 'CODIGOX', 'LSEX', 'LINF', 'LSUP', 'TRIVIAL', 'ERRADICADO', 'N_INTER', 'NIN', 'NINMTOBS', 'COD_SIT_LESION', 'NO_CBD', 'CBD', 'NO_APH', 'AF_PRIN', 'DIA_SIS', 'CLAVE_PROGRAMA_SIS', 'COD_COMPLEMEN_MORBI', 'DIA_FETAL', 'DEF_FETAL_CM', 'DEF_FETAL_CBD', 'CLAVE_CAPITULO', 'CAPITULO', 'LISTA1', 'GRUPO1', 'LISTA5', 'RUBRICA_TYPE', 'YEAR_MODIFI', 'YEAR_APLICACION', 'VALID', 'PRINMORTA', 'PRINMORBI', 'LM_MORBI', 'LM_MORTA', 'LGBD165', 'LOMSBECK', 'LGBD190', 'NOTDIARIA', 'NOTSEMANAL', 'SISTEMA_ESPECIAL', 'BIRMM', 'CVE_CAUSA_TYPE', 'EPI_MORTA', 'EDAS_E_IRAS_EN_M5', 'CVE_MATERNAS-SEED-EPID', 'EPI_MORTA_M5', 'EPI_MORBI', 'DEF_MATERNAS', 'ES_CAUSES', 'NUM_CAUSES', 'ES_SUIVE_MORTA', 'ES_SUIVE_MORB', 'EPI_CLAVE', 'EPI_CLAVE_DESC', 'ES_SUIVE_NOTIN', 'ES_SUIVE_EST_EPI', 'ES_SUIVE_EST_BROTE', 'SINAC', 'PRIN_SINAC', 'PRIN_SINAC_GRUPO', 'DESCRIPCION_SINAC_GRUPO', 'PRIN_SINAC_SUBGRUPO', 'DESCRIPCION_SINAC_SUBGRUPO', 'DAGA', 'ASTERISCO', 'PRIN_MM', 'PRIN_MM_GRUPO', 'DESCRIPCION_MM_GRUPO', 'PRIN_MM_SUBGRUPO', 'DESCRIPCION_MM_SUBGRUPO']; public function insert_bulk($array){ $db = \Config\Database::connect(); $builder = $db->table('hcv_cie10'); return $builder->insertBatch($array); } }
require "rubygems" require "json" require 'restclient' require 'crack' require 'io/console' parse="" ch="" done=false t2 =Thread.new do loop do temp=STDIN.getch if temp=="\n" done=true break end parse+=temp end end t=Thread.new do loop do if done==true break end if parse!=ch sleep 1 url="http://en.wikipedia.org/w/api.php?action=opensearch&search=#{parse}&namespace=0" data = Crack::JSON.parse(RestClient.get(url)) #puts parse puts data[1] ch=parse end end end t.join t2.join puts "Thanks!" gets
package com.ruoyi.iot.model.ThingsModelItem; import java.math.BigDecimal; import java.util.List; public class ReadOnlyModelOutput extends ThingsModelItemBase { private BigDecimal min; private BigDecimal max; private BigDecimal step; private String unit; private String arrayType; private String falseText; private String trueText; private int maxLength; private List<EnumItemOutput> enumList; public List<EnumItemOutput> getEnumList() { return enumList; } public void setEnumList(List<EnumItemOutput> enumList) { this.enumList = enumList; } public int getMaxLength() { return maxLength; } public void setMaxLength(int maxLength) { this.maxLength = maxLength; } public String getFalseText() { return falseText; } public void setFalseText(String falseText) { this.falseText = falseText; } public String getTrueText() { return trueText; } public void setTrueText(String trueText) { this.trueText = trueText; } public String getArrayType() { return arrayType; } public void setArrayType(String arrayType) { this.arrayType = arrayType; } public BigDecimal getMin() { return min; } public void setMin(BigDecimal min) { this.min = min; } public BigDecimal getMax() { return max; } public void setMax(BigDecimal max) { this.max = max; } public BigDecimal getStep() { return step; } public void setStep(BigDecimal step) { this.step = step; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } }
class UserActivator attr_reader :user, :request, :session, :cookies, :message def initialize(user, request, session, cookies) @user = user @session = session @cookies = cookies @request = request @message = nil end def start end def finish @message = activator.activate end private def activator factory.new(user, request, session, cookies) end def factory LoginActivator end end class LoginActivator < UserActivator include CurrentUser def activate log_on_user(user) #schedule.defer #I18n.t("login.active") end end
package com.kryszak.gwatlin.api.gamemechanics.model.profession import com.google.gson.annotations.SerializedName /** * Training track type values */ enum class TrainingTrackType { @SerializedName("Trait") TRAIT, @SerializedName("Skill") SKILL }
import * as fs from 'fs'; import * as path from 'path'; import * as rimraf from 'rimraf'; interface Options { /** * Current cache directory * @defaultValue ./ */ cacheRecordPath?: string; /** * cache hash * @defaultValue node_modules/.cache */ cacheHash?: string; /** * cache max age * @defaultValue 1 * 24 * 60 * 60 * 1000 */ maxAge?: number, /** * need to manage cache directory * @defaultValue [] */ dependencyCachePaths?: string[], } interface Record { [hash: string]: number, } class CacheManagePlugin { options: Options; recordPath: string; constructor(options: Options) { this.options = options || {}; this.options.cacheRecordPath = this.options.cacheRecordPath || 'node_modules/.cache'; this.options.maxAge = this.options.maxAge || (1 * 24 * 60 * 60 * 1000) this.options.cacheHash = this.options.cacheHash; this.options.dependencyCachePaths = this.options.dependencyCachePaths || []; this.recordPath = this.options.cacheRecordPath + 'cacheRecord.json'; this.apply = this.apply.bind(this); } getCacheRecord() { let record: Record = {}; if (fs.existsSync(path.resolve(this.recordPath))) { record = JSON.parse(fs.readFileSync(path.resolve(this.recordPath), { encoding: 'utf8' })) as Record; } return record; } removeOutTimeCache(record: Record) { const now = Date.now(); const needRemoveHashList: string[] = []; Object.entries(record).forEach(([hash, time]) => { if (now - time > this.options.maxAge) { needRemoveHashList.push(hash); } }) needRemoveHashList.forEach((hash) => { this.options.dependencyCachePaths.forEach((_path) => { const fullPath = `${_path}/${hash}`; console.log('remove overdue cache', fullPath) // 清除无效的record delete record[hash]; if (fs.existsSync(path.resolve(fullPath))) { rimraf.sync(path.resolve(fullPath)); } }) }) return record; } updateRecord(hash: string, record: Record) { record[hash] = Date.now(); if (!fs.existsSync(this.options.cacheRecordPath)) { fs.mkdirSync(this.options.cacheRecordPath); } fs.writeFileSync(path.resolve(this.recordPath), JSON.stringify(record), { encoding: 'utf8' }); } apply(compiler: any) { compiler.plugin('entryOption', () => { let record = this.getCacheRecord(); record = this.removeOutTimeCache(record); this.updateRecord(this.options.cacheHash ,record); }); } } export = CacheManagePlugin;
package com.handstandsam.shoppingapp.mockaccount import android.os.StrictMode import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.MappingBuilder import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig import com.github.tomakehurst.wiremock.stubbing.StubMapping import com.handstandsam.shoppingapp.mockdata.MockAccount import com.handstandsam.shoppingapp.models.User import com.squareup.moshi.Moshi import timber.log.Timber class Stubberator(val useLocalServer: Boolean) { private var moshi = Moshi.Builder().build() private lateinit var wireMockServer: WireMockServer init { val policy = StrictMode.ThreadPolicy.Builder().permitAll().build() StrictMode.setThreadPolicy(policy) if (useLocalServer) { wireMockServer = WireMockServer(wireMockConfig().port(NetworkConstants.LOCALHOST_PORT)) wireMockServer.start() wireMockServer.resetMappings() } else { WireMock.configureFor( NetworkConstants.REMOTE_EMULATOR_ENDPOINT_HOST, NetworkConstants.REMOTE_PORT ) WireMock.reset() } Timber.d("new Stubberator()") } fun stubFor(mappingBuilder: MappingBuilder): StubMapping { return if (NetworkConstants.USE_LOCAL_SERVER) { wireMockServer.stubFor(mappingBuilder) } else { WireMock.stubFor(mappingBuilder) } } fun stubItAll(mockAccount: MockAccount) { stubCategories(mockAccount) stubLogin(mockAccount) stubItems(mockAccount) } fun stubCategories(mockAccount: MockAccount) { val json = moshi.adapter(List::class.java).toJson(mockAccount.getCategories()) stubFor( StubMappings.categories.willReturn( WireMock.aResponse().withStatus(200).withBody( json ) ) ) } fun stubItems(mockAccount: MockAccount) { mockAccount.itemsByCategory.keys.forEach { categoryId -> val items = mockAccount.itemsByCategory[categoryId] val json = moshi.adapter(List::class.java).toJson(items) stubFor( StubMappings.getItemsForCategory(categoryId).willReturn( WireMock.aResponse().withStatus( 200 ).withBody(json) ) ) } } fun stubLogin(mockAccount: MockAccount) { val json = moshi.adapter(User::class.java).toJson(mockAccount.getUser()) stubFor( StubMappings.login().willReturn( WireMock.aResponse() .withStatus(200).withBody(json) ) ) } } private object NetworkConstants { var LOCALHOST_PORT = 8080 val LOCALHOST_ENDPOINT = "http://localhost:" + LOCALHOST_PORT val S3_ENDPOINT = "https://shopping-app.s3.amazonaws.com" var USE_LOCAL_SERVER = true val REMOTE_PORT = 8080 val REMOTE_EMULATOR_ENDPOINT_HOST = "10.0.2.2" var LAPTOP_FROM_EMULATOR_ENDPOINT = "http://$REMOTE_EMULATOR_ENDPOINT_HOST:$REMOTE_PORT" }
const path = require('path') const isEnvProduction = process.env.NODE_ENV === 'production' const isEnvDevelopment = process.env.NODE_ENV === 'development' const config = target => ({ mode: isEnvProduction ? 'production' : 'development', // Stop compilation early in production bail: isEnvProduction, entry: ['./index.js'], performance: { hints: false, }, context: path.join(__dirname, 'src'), devtool: isEnvDevelopment ? 'inline-source-map' : false, module: { rules: [ // Disable require.ensure as it's not a standard language feature. { parser: { requireEnsure: false } }, { oneOf: [ { test: /\.mjs$/, include: /node_modules/, type: 'javascript/auto', }, // Process application JS with Babel. { test: /\.(js|mjs|jsx|ts|tsx)$/, include: /src/, loader: require.resolve('babel-loader'), options: { // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. cacheDirectory: true, cacheCompression: false, compact: isEnvProduction, }, }, // Process any JS outside of the app with Babel. { test: /\.(js|mjs)$/, exclude: /@babel(?:\/|\\{1,2})runtime/, loader: require.resolve('babel-loader'), }, { test: /\.css$/, use: ['style-loader', 'css-loader'], }, { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], }, ], }, ], }, resolve: { alias: { src: path.resolve(__dirname, 'src/'), crossfilter: 'crossfilter2', }, extensions: ['.css', '.js', '.jsx', '.mjs'], }, output: { path: path.join(__dirname, 'dist/'), filename: `react-dc.${target}.js`, library: 'ReactDc', libraryTarget: target, }, optimization: { minimize: isEnvProduction, }, externals: { react: { root: 'React', commonjs: 'react', commonjs2: 'react', amd: 'react', }, dc: 'dc', }, }) // noinspection WebpackConfigHighlighting module.exports = [config('umd')]
{-# LANGUAGE NoImplicitPrelude #-} module Mismi.ELB ( ) where
library angular2.src.forms.directives.shared; import "package:angular2/src/facade/collection.dart" show ListWrapper, StringMapWrapper; import "package:angular2/src/facade/lang.dart" show isBlank, BaseException, looseIdentical; import "control_container.dart" show ControlContainer; import "ng_control.dart" show NgControl; import "validators.dart" show NgValidator; import "../model.dart" show Control; import "../validators.dart" show Validators; import "package:angular2/render.dart" show Renderer; import "package:angular2/core.dart" show ElementRef, QueryList; List<String> controlPath(String name, ControlContainer parent) { var p = ListWrapper.clone(parent.path); p.add(name); return p; } setUpControl(Control c, NgControl dir) { if (isBlank(c)) _throwError(dir, "Cannot find control"); if (isBlank(dir.valueAccessor)) _throwError(dir, "No value accessor for"); c.validator = Validators.compose([c.validator, dir.validator]); dir.valueAccessor.writeValue(c.value); // view -> model dir.valueAccessor.registerOnChange((newValue) { dir.viewToModelUpdate(newValue); c.updateValue(newValue, emitModelToViewChange: false); c.markAsDirty(); }); // model -> view c.registerOnChange((newValue) => dir.valueAccessor.writeValue(newValue)); // touched dir.valueAccessor.registerOnTouched(() => c.markAsTouched()); } Function composeNgValidator(QueryList<NgValidator> ngValidators) { if (isBlank(ngValidators)) return Validators.nullValidator; return Validators.compose(ngValidators.map((v) => v.validator)); } void _throwError(NgControl dir, String message) { var path = ListWrapper.join(dir.path, " -> "); throw new BaseException('''${ message} \'${ path}\''''); } setProperty(Renderer renderer, ElementRef elementRef, String propName, dynamic propValue) { renderer.setElementProperty(elementRef, propName, propValue); } bool isPropertyUpdated(Map<String, dynamic> changes, dynamic viewModel) { if (!StringMapWrapper.contains(changes, "model")) return false; var change = changes["model"]; if (change.isFirstChange()) return true; return !looseIdentical(viewModel, change.currentValue); }
#include "../../include/editor/CEditorActionsManager.h" #include "../../include/editor/EditorActions.h" #include "../../include/utils/Utils.h" #include "../../include/utils/CFileLogger.h" #include "stringUtils.hpp" #if TDE2_EDITORS_ENABLED namespace TDEngine2 { CEditorActionsManager::CEditorActionsManager(): CBaseObject() { } E_RESULT_CODE CEditorActionsManager::Init() { if (mIsInitialized) { return RC_OK; } mCurrActionPointer = 0; mIsInitialized = true; return RC_OK; } E_RESULT_CODE CEditorActionsManager::Free() { if (!mIsInitialized) { return RC_FAIL; } --mRefCounter; if (!mRefCounter) { mIsInitialized = false; delete this; } return RC_OK; } E_RESULT_CODE CEditorActionsManager::PushAndExecuteAction(IEditorAction* pAction) { if (!pAction) { return RC_INVALID_ARGS; } mpActionsHistory.emplace(mpActionsHistory.begin() + mCurrActionPointer, pAction); ++mCurrActionPointer; return pAction->Execute(); } TResult<CScopedPtr<IEditorAction>> CEditorActionsManager::PopAction() { if (mpActionsHistory.empty()) { return Wrench::TErrValue<E_RESULT_CODE>(RC_FAIL); } CScopedPtr<IEditorAction> pAction = mpActionsHistory.back(); mpActionsHistory.pop_back(); return Wrench::TOkValue<CScopedPtr<IEditorAction>>(pAction); } E_RESULT_CODE CEditorActionsManager::ExecuteUndo() { if (mpActionsHistory.empty() || (static_cast<I32>(mCurrActionPointer) - 1 < 0)) { return RC_FAIL; } E_RESULT_CODE result = mpActionsHistory[mCurrActionPointer - 1]->Restore(); if (mCurrActionPointer >= 1) { --mCurrActionPointer; } return result; } E_RESULT_CODE CEditorActionsManager::ExecuteRedo() { if (mpActionsHistory.empty() || (mCurrActionPointer >= mpActionsHistory.size())) { return RC_FAIL; } ++mCurrActionPointer; E_RESULT_CODE result = mpActionsHistory[mCurrActionPointer - 1]->Execute(); return result; } void CEditorActionsManager::Dump() const { LOG_MESSAGE(Wrench::StringUtils::Format("[CEditorActionsManager] Current log size: {0}", mpActionsHistory.size())); for (auto iter = mpActionsHistory.rbegin(); iter != mpActionsHistory.rend(); ++iter) { LOG_MESSAGE(Wrench::StringUtils::Format("- {0}", (*iter)->ToString())); } } TDE2_API IEditorActionsHistory* CreateEditorActionsManager(E_RESULT_CODE& result) { return CREATE_IMPL(IEditorActionsHistory, CEditorActionsManager, result); } } #endif
using Grumpy.DacpacMerge.Core.Interfaces; namespace Grumpy.DacpacMerge.Core { public class PackageFactory : IPackageFactory { private readonly IModelFactory _modelFactory; public PackageFactory(IModelFactory modelFactory) { _modelFactory = modelFactory; } public IPackage Create(string fileName) { return new Package(_modelFactory, fileName); } } }
require "spec_helper" module Xronor class DSL describe Default do let(:default) do described_class.new do prefix "scheduler-" timezone "Asia/Tokyo" cron_timezone "UTC" end end describe "#result" do it "should parse Default DSL" do result = default.result expect(result.prefix).to eq "scheduler-" expect(result.timezone).to eq "Asia/Tokyo" expect(result.cron_timezone).to eq "UTC" end end end end end
import math import matplotlib.pyplot as plt import funmath import itertools import collections import numpy as np from scipy.stats import gamma def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) def Prob(N,L): s = range( int((N-L)/2), int((N+L)/2+1), 1) #range doesnt include end point p = range( int((N-L)/2+1), int((N+L)/2), 1) #print([s,p]) sum1 = 0 for i in s: for j in s: sum1 += nCr(N,i)*nCr(N,j) sum2 = 0 for i in p: for j in p: sum2 += nCr(N,i)*nCr(N,j) sum3 = 0 for i in range(N+1): for j in range(N+1): sum3 += nCr(N,i)*nCr(N,j) return(1.0*(sum1-sum2)/sum3) if __name__ == '__main__': #L = 4 marker = itertools.cycle((',', '+', '.', 'o', '*')) funmath.tic() # N = 32 # # rawdata = np.loadtxt('manhat_pythag_data.txt' , delimiter=',', skiprows=0, unpack=False) # manhat_data = rawdata[:,0] # datadict = collections.defaultdict(float) # for i in manhat_data: # datadict[i] += 1 # print(datadict) # yvals = [] # for i in range(len(datadict)): # dicval = datadict[2*i]/len(manhat_data) # yvals.append(dicval) # print(dicval) # xvals = range(0,len(yvals)*2,2) ########################################################################### #for N in [4,8,16,32,64]: for N in [32]: x = range(0,N+2,2) y = [Prob(N,L) for L in x] plt.plot(x,y, '.--', label = 'Calculated Exact values') pdf_data = open('PDF_data_N'+str(N)+'.txt', 'w') for i in range(len(x)): pdf_data.write(str(x[i])+', ') pdf_data.write('\n') for i in range(len(x)): pdf_data.write(str(y[i])+', ') pdf_data.write('\n') ########################################################################### # plt.plot(xvals, yvals, '_', label = 'Actual Walk Data' ) # n = 1000*1000 # z = 1.96 # yerr = [1.0*z*np.sqrt((1.0/n)*p*(1.0-p)) for p in yvals] # #plt.errorbar(xvals, yvals, yerr=yerr) plt.legend() plt.xlabel('Distance walked (L)') plt.ylabel('Probability density (1/L)') plt.suptitle('Probabiltiy of walk lengths') plt.title('N = 32') plt.savefig('figs/exactPDF.pdf') funmath.toc() sum2 = 0 # for i,j in zip(yvals,y[:len(yvals)]): # sum2 += np.sqrt(i*i + j*j) # print(sum2) plt.show() # print(sum(y)) ###########################################################################
/* * (C) ActiveViam 2020 * ALL RIGHTS RESERVED. This material is the CONFIDENTIAL and PROPRIETARY * property of ActiveViam. Any unauthorized use, * reproduction or transfer of this material is strictly prohibited */ package com.activeviam.mac.statistic.memory; import com.activeviam.mac.cfg.impl.ManagerDescriptionConfig; import com.activeviam.mac.entities.ChunkOwner; import com.activeviam.mac.entities.CubeOwner; import com.activeviam.mac.memory.DatastoreConstants; import com.activeviam.mac.statistic.memory.visitor.impl.EpochView; import com.activeviam.pivot.builders.StartBuilding; import com.qfs.condition.impl.BaseConditions; import com.qfs.monitoring.statistic.memory.IMemoryStatistic; import com.qfs.pivot.impl.MultiVersionDistributedActivePivot; import com.qfs.service.monitoring.IMemoryAnalysisService; import com.qfs.store.IDatastore; import com.qfs.store.IDatastoreVersion; import com.qfs.store.query.ICursor; import com.qfs.store.query.impl.DatastoreQueryHelper; import com.qfs.store.record.IRecordReader; import com.qfs.store.transaction.DatastoreTransactionException; import com.qfs.store.transaction.ITransactionManager; import com.quartetfs.biz.pivot.IActivePivotManager; import com.quartetfs.fwk.AgentException; import com.quartetfs.fwk.Registry; import com.quartetfs.fwk.contributions.impl.ClasspathContributionProvider; import com.quartetfs.fwk.impl.Pair; import gnu.trove.set.TLongSet; import gnu.trove.set.hash.TLongHashSet; import java.nio.file.Path; import java.util.Collections; import java.util.List; import java.util.function.BiFunction; import java.util.stream.IntStream; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class TestAnalysisDatastoreFeeder extends ATestMemoryStatistic { private Pair<IDatastore, IActivePivotManager> monitoredApp; private Pair<IDatastore, IActivePivotManager> monitoringApp; private Pair<IDatastore, IActivePivotManager> distributedMonitoredApp; private IMemoryStatistic appStatistics; private IMemoryStatistic distributedAppStatistics; @BeforeAll public static void setupRegistry() { Registry.setContributionProvider(new ClasspathContributionProvider()); } @BeforeEach public void setup() throws DatastoreTransactionException, AgentException { initializeApplication(); Path exportPath = generateMemoryStatistics( monitoredApp.getLeft(), monitoredApp.getRight(), IMemoryAnalysisService::exportApplication); appStatistics = loadMemoryStatFromFolder(exportPath); initializeMonitoredApplication(); exportPath = generateMemoryStatistics( distributedMonitoredApp.getLeft(), distributedMonitoredApp.getRight(), IMemoryAnalysisService::exportMostRecentVersion); distributedAppStatistics = loadMemoryStatFromFolder(exportPath); initializeMonitoringApplication(); } @Test public void testDifferentDumps() { final IDatastore monitoringDatastore = monitoringApp.getLeft(); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(appStatistics), "app"); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(appStatistics), "app2"); Assertions.assertThat( DatastoreQueryHelper.selectDistinct( monitoringDatastore.getMostRecentVersion(), DatastoreConstants.APPLICATION_STORE, DatastoreConstants.APPLICATION__DUMP_NAME)) .containsExactlyInAnyOrder("app", "app2"); } @Test public void testEpochReplicationForAlreadyExistingChunks() { final IDatastore monitoringDatastore = monitoringApp.getLeft(); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(distributedAppStatistics), "app"); TLongSet epochs = collectEpochViewsForOwner( monitoringDatastore.getMostRecentVersion(), new CubeOwner("Data")); Assertions.assertThat(epochs.toArray()).containsExactlyInAnyOrder(1L); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(appStatistics), "app"); epochs = collectEpochViewsForOwner( monitoringDatastore.getMostRecentVersion(), new CubeOwner("Data")); // within its statistic, the Data cube only has epoch 1 // upon the second feedDatastore call, its chunks should be mapped to the new incoming datastore // epochs Assertions.assertThat(epochs.toArray()).containsExactlyInAnyOrder(1L, 2L, 3L, 4L); } @Test public void testEpochReplicationForAlreadyExistingEpochs() { final IDatastore monitoringDatastore = monitoringApp.getLeft(); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(appStatistics), "app"); ATestMemoryStatistic.feedMonitoringApplication( monitoringDatastore, List.of(distributedAppStatistics), "app"); TLongSet epochs = collectEpochViewsForOwner( monitoringDatastore.getMostRecentVersion(), new CubeOwner("Data")); // within its statistic, the Data cube only has epoch 1 // it should be mapped to the epochs 1, 2, 3 and 4 of the first feedDatastore call Assertions.assertThat(epochs.toArray()).containsExactlyInAnyOrder(1L, 2L, 3L, 4L); } private TLongSet collectEpochViewsForOwner( final IDatastoreVersion monitoringDatastore, final ChunkOwner owner) { final ICursor queryResult = monitoringDatastore .getQueryRunner() .forStore(DatastoreConstants.EPOCH_VIEW_STORE) .withCondition(BaseConditions.Equal(DatastoreConstants.EPOCH_VIEW__OWNER, owner)) .selecting(DatastoreConstants.EPOCH_VIEW__VIEW_EPOCH_ID) .onCurrentThread() .run(); final TLongSet epochs = new TLongHashSet(); for (final IRecordReader recordReader : queryResult) { epochs.add(((EpochView) recordReader.read(0)).getEpochId()); } return epochs; } private void initializeApplication() throws DatastoreTransactionException { monitoredApp = createMicroApplicationWithIsolatedStoreAndKeepAllEpochPolicy(); resources.register(monitoredApp.getRight()::stop); resources.register(monitoredApp.getLeft()::stop); final ITransactionManager transactionManager = monitoredApp.getLeft().getTransactionManager(); fillMicroApplication(transactionManager); } private void fillMicroApplication(final ITransactionManager transactionManager) throws DatastoreTransactionException { // epoch 1 -> store A + cube transactionManager.startTransaction("A"); IntStream.range(0, 10).forEach(i -> transactionManager.add("A", i, 0.)); transactionManager.commitTransaction(); // epoch 2 -> store B transactionManager.startTransaction("B"); IntStream.range(0, 10).forEach(i -> transactionManager.add("B", i, 0.)); transactionManager.commitTransaction(); // epoch 3 -> store A + cube transactionManager.startTransaction("A"); IntStream.range(10, 20).forEach(i -> transactionManager.add("A", i, 1.)); transactionManager.commitTransaction(); // epoch 4 -> store B transactionManager.startTransaction("B"); IntStream.range(10, 20).forEach(i -> transactionManager.add("B", i, 1.)); transactionManager.commitTransaction(); } private void initializeMonitoredApplication() { distributedMonitoredApp = createDistributedApplicationWithKeepAllEpochPolicy("analysis-feeder"); resources.register(distributedMonitoredApp.getLeft()::stop); resources.register(distributedMonitoredApp.getRight()::stop); fillDistributedApplication(); } private void fillDistributedApplication() { // epoch 1 distributedMonitoredApp .getLeft() .edit( transactionManager -> IntStream.range(0, 10).forEach(i -> transactionManager.add("A", i, 0.))); // emulate commits on the query cubes at a greater epoch that does not exist in the datastore MultiVersionDistributedActivePivot queryCubeA = ((MultiVersionDistributedActivePivot) distributedMonitoredApp.getRight().getActivePivots().get("QueryCubeA")); // produces distributed epochs 1 to 5 for (int i = 0; i < 5; ++i) { queryCubeA.removeMembersFromCube(Collections.emptySet(), 0, false); } MultiVersionDistributedActivePivot queryCubeB = ((MultiVersionDistributedActivePivot) distributedMonitoredApp.getRight().getActivePivots().get("QueryCubeB")); // produces distributed epoch 1 queryCubeB.removeMembersFromCube(Collections.emptySet(), 0, false); } private Path generateMemoryStatistics( final IDatastore datastore, final IActivePivotManager manager, final BiFunction<IMemoryAnalysisService, String, Path> exportMethod) { datastore.getEpochManager().forceDiscardEpochs(node -> true); performGC(); final IMemoryAnalysisService analysisService = createService(datastore, manager); return exportMethod.apply(analysisService, "testEpochs"); } private void initializeMonitoringApplication() throws AgentException { final ManagerDescriptionConfig config = new ManagerDescriptionConfig(); final IDatastore monitoringDatastore = resources.create( StartBuilding.datastore().setSchemaDescription(config.schemaDescription())::build); final IActivePivotManager manager = StartBuilding.manager() .setDescription(config.managerDescription()) .setDatastoreAndPermissions(monitoringDatastore) .buildAndStart(); resources.register(manager::stop); monitoringApp = new Pair<>(monitoringDatastore, manager); } }
# Header 1 ## Header 2 Show a table | # | Make | Model | Year | | --- | --- | --- | --- | | 1 | Honda | Accord | 2009 | | 2 | Toyota | Camry | 2012 | | 3 | Hyundai | Elantra | 2010 | A bullet list - One - Two - Three A numbered list 1. foo 2. bar 3. wat **Bold** ~~strike~~ _woow_ ```js function log (...args) { console.log(args) } ```
import { CommandInteraction, DMChannel, Role } from 'discord.js'; import { NotifyCommand } from '../../../interactions/notify'; import { ArgumentsOf } from '../../../types/ArgumentsOf'; import i18next from 'i18next'; import { replyWithError } from '../../../utils/responses'; import { EMOJI_ID_SHIELD_GREEN_SMALL, LIST_BULLET } from '../../../utils/constants'; import { emojiOrFallback } from '../../../utils'; import { formatSeverity } from '../../../utils/formatting'; import { Notification, NotificationTargets } from '../../../types/DataTypes'; import { formatEmoji, userMention, roleMention } from '@discordjs/builders'; export async function handleNotifyCommand( interaction: CommandInteraction, args: ArgumentsOf<typeof NotifyCommand>, locale: string, ) { const { client: { sql }, guild, channel, } = interaction; if (!channel || channel.partial) { return; } if (!guild || channel instanceof DMChannel) { return replyWithError(interaction, i18next.t('common.errors.not_in_dm', { lng: locale })); } const successEmoji = emojiOrFallback(channel, formatEmoji(EMOJI_ID_SHIELD_GREEN_SMALL), LIST_BULLET); const messageParts = []; const action = Object.keys(args)[0] as keyof ArgumentsOf<typeof NotifyCommand>; switch (action) { case 'add': { const entity = args.add.entity; const level = args.add.level; const newData = { guild: guild.id, entity: entity instanceof Role ? entity.id : entity.user.id, type: entity instanceof Role ? NotificationTargets.ROLE : NotificationTargets.USER, level, }; await sql` insert into notifications ${sql(newData)} on conflict (guild, entity) do update set ${sql(newData)} `; messageParts.push( `${successEmoji}${i18next.t('command.notify.notification_change', { entity: entity instanceof Role ? roleMention(entity.id) : userMention(entity.user.id), level: formatSeverity(channel, level), lng: locale, })}`, ); } break; case 'remove': { const entity = args.remove.entity; await sql` delete from notifications where guild = ${guild.id} and entity = ${ entity instanceof Role ? entity.id : entity.user.id }`; messageParts.push( `${successEmoji}${i18next.t('command.notify.notification_remove', { entity: entity instanceof Role ? roleMention(entity.id) : userMention(entity.user.id), lng: locale, })}`, ); } break; case 'show': { const notifications = await sql<Notification[]>` select * from notifications where guild = ${guild.id} `; if (!notifications.length) { return replyWithError(interaction, i18next.t('command.notify.notification_none', { lng: locale })); } for (const notification of notifications) { messageParts.push( notification.subjects.includes('SPAM') ? `${LIST_BULLET} ${i18next.t('command.notify.notification_show_antispam', { entity: notification.type === 'ROLE' ? roleMention(notification.entity) : userMention(notification.entity), level: formatSeverity(channel, notification.level), lng: locale, })}` : `${LIST_BULLET} ${i18next.t('command.notify.notification_show', { entity: notification.type === 'ROLE' ? roleMention(notification.entity) : userMention(notification.entity), level: formatSeverity(channel, notification.level), lng: locale, })}`, ); } } break; } return interaction.reply({ content: messageParts.join('\n'), ephemeral: true, allowedMentions: { parse: [] }, }); }
use 5.006; # our use strict; use warnings; package Git::PurePerl::Walker; our $VERSION = '0.004002'; # ABSTRACT: Walk over a sequence of commits in a Git::PurePerl repo # AUTHORITY use Moose qw( has ); use Path::Tiny qw(); use Module::Runtime qw( ); use Git::PurePerl::Walker::Types qw( GPPW_Repository GPPW_Methodish GPPW_Method GPPW_OnCommitish GPPW_OnCommit); use namespace::autoclean; =carg repo B<Mandatory:> An instance of L<< C<Git::PurePerl>|Git::PurePerl >> representing the repository to work with. =attr repo =attrmethod repo # Getter my $repo = $walker->repo(); =cut has repo => ( isa => GPPW_Repository, is => 'ro', lazy_build => 1, ); =carg method B<Mandatory:> either a C<Str> describing a Class Name Suffix, or an C<Object> that C<does> L<< C<Git::PurePerl::B<Walker::Role::Method>>|Git::PurePerl::Walker::Role::Method >>. If its a C<Str>, the C<Str> will be expanded as follows: ->new( ... method => 'Foo', ... ); $className = 'Git::PurePerl::Walker::Method::Foo' And the resulting class will be loaded, and instantiated for you. ( Assuming of course, you don't need to pass any fancy args ). If you need fancy args, or a class outside the C<Git::PurePerl::B<Walker::Method::>> namespace, constructing the object will have to be your responsibility. ->new( ... method => Foo::Class->new(), ... ) =p_attr _method =p_attrmethod _method # Getter my $methodish = $walker->_method(); =cut has _method => ( init_arg => 'method', is => 'ro', isa => GPPW_Methodish, required => 1, ); =attr method =attrmethod method # Getter my $method_object = $walker->method(); =cut has 'method' => ( init_arg => undef, is => 'ro', isa => GPPW_Method, lazy_build => 1, ); =carg on_commit B<Mandatory:> either a C<Str> that can be expanded in a way similar to that by L<< C<I<method>>|/method >>, a C<CodeRef>, or an object that C<does> L<< C<Git::PurePerl::B<Walker::Role::OnCommit>>|Git::PurePerl::Walker::Role::OnCommit >>. If passed a C<Str> it will be expanded like so: ->new( ... on_commit => $str, ... ); $class = 'Git::PurePerl::Walker::OnCommit::' . $str; And the resulting class loaded and instantiated. If passed a C<CodeRef>, L<< C<Git::PurePerl::B<Walker::OnCommit::CallBack>>|Git::PurePerl::Walker::OnCommit::CallBack >> will be loaded and your C<CodeRef> will be passed as an argument. ->new( ... on_commit => sub { my ( $commit ) = @_; }, ... ); If you need anything fancier, or requiring an unusual namespace, you'll want to construct the object yourself. ->new( ... on_commit => Foo::Package->new() ... ); =p_attr _on_commit =p_attrmethod _on_commit # Getter my $on_commitish => $walker->_on_commit(); =cut has '_on_commit' => ( init_arg => 'on_commit', required => 1, is => 'ro', isa => GPPW_OnCommitish, ); =attr on_commit =attrmethod on_commit # Getter my $on_commit_object = $walker->on_commit(); =cut has 'on_commit' => ( init_arg => undef, isa => GPPW_OnCommit, is => 'ro', lazy_build => 1, ); =begin Pod::Coverage BUILD =end Pod::Coverage =cut sub BUILD { my ( $self, ) = @_; $self->reset; return $self; } =p_method _build_repo =cut sub _build_repo { require Git::PurePerl; return Git::PurePerl->new( directory => Path::Tiny->cwd->stringify ); } =p_method _build_method =cut sub _build_method { my ($self) = shift; my ($method) = $self->_method; if ( not ref $method ) { my $method_name = Module::Runtime::compose_module_name( 'Git::PurePerl::Walker::Method', $method ); Module::Runtime::require_module($method_name); $method = $method_name->new(); } return $method->for_repository( $self->repo ); } =p_method _build_on_commit =cut sub _build_on_commit { my ($self) = shift; my ($on_commit) = $self->_on_commit; if ( ref $on_commit and 'CODE' eq ref $on_commit ) { my $on_commit_name = 'Git::PurePerl::Walker::OnCommit::CallBack'; my $callback = $on_commit; Module::Runtime::require_module($on_commit_name); $on_commit = $on_commit_name->new( callback => $callback, ); } elsif ( not ref $on_commit ) { my $on_commit_name = 'Git::PurePerl::Walker::OnCommit::' . $on_commit; Module::Runtime::require_module($on_commit_name); $on_commit = $on_commit_name->new(); } return $on_commit->for_repository( $self->repo ); } =method reset $walker->reset(); Reset the walk routine back to the state it was before you walked. =cut ## no critic (Subroutines::ProhibitBuiltinHomonyms) sub reset { my $self = shift; $self->method->reset; $self->on_commit->reset; return $self; } =method step Increments one step forward in the git history, and dispatches the object to the C<OnCommit> handlers. If there are more possible steps to take, it will return a true value. while ( $walker->step ) { /* Code to execute if walker has more items */ } This code is almost identical to: while(1) { $walker->on_commit->handle( $walker->method->current ); last if not $walker->method->has_next; $walker->method->next; /* Code to execute if walker has more items */ } =cut sub step { my $self = shift; $self->on_commit->handle( $self->method->current ); if ( not $self->method->has_next ) { return; } $self->method->next; return 1; } =method step_all my $steps = $walker->step_all; Mostly a convenience method to iterate until it can iterate no more, but without you needing to wrap it in a while() block. Returns the number of steps executed. =cut sub step_all { my $self = shift; my $steps = 1; while ( $self->step ) { $steps++; } return $steps; } __PACKAGE__->meta->make_immutable; no Moose; 1; =head1 SYNOPSIS use Git::PurePerl::Walker; use Git::PurePerl::Walker::Method::FirstParent; my $repo = Git::PurePerl->new( ... ); my $walker = Git::PurePerl::Walker->new( repo => $repo, method => Git::PurePerl::Walker::Method::FirstParent->new( start => $repo->ref_sha1('refs/heads/master'), ), on_commit => sub { my ( $commit ) = @_; print $commit->sha1; }, ); $walker->step_all; =cut
package com.github.damianreeves.ticketbroker.akka.server.web import akka.http.scaladsl.model.StatusCodes import akka.http.scaladsl.server.{Directives, Route} trait SwaggerUISite extends Directives { val route: Route = (get & pathPrefix("swagger")){ (pathEndOrSingleSlash & redirectToTrailingSlashIfMissing(StatusCodes.TemporaryRedirect)) { getFromResource("swagger/index.html") } ~ { getFromResourceDirectory("swagger") } } } object SwaggerUISite extends SwaggerUISite
import { useState } from "react"; /** * A custom hook for storing and handling the state for an array of selected categories * @param defaultValue An array to be initialized as the default value */ const useFilterHook = (defaultValue: string[]) => { const [selectedCategories, setSelectedCategories] = useState(defaultValue); return { selectedCategories, setSelectedCategories }; }; export default useFilterHook;
# Runtime Concept Idiom example This project implements the Runtime Concept Idiom, described by Sean Parent in [this talk](https://www.youtube.com/watch?v=QGcVXgEVMJg), in the context of the Command design pattern. ## Build The project was tested with Visual Studio 2022 in Windows, and gcc-9.3 in Linux. It has no dependencies except for gtest/gmock, which it attempts to download by itself. ## Running the tests Running the `RuntimeConceptIdiomTest` target will run all the tests.
package qt import ( "log" "os" "runtime" "strings" "sync" "unsafe" ) var ( Logger = log.New(os.Stderr, "", log.Ltime) signals = make(map[unsafe.Pointer]map[string]unsafe.Pointer) signalsJNI = make(map[string]map[string]unsafe.Pointer) signalsMutex sync.Mutex objects = make(map[unsafe.Pointer]interface{}) objectsMutex sync.Mutex objectsTemp = make(map[unsafe.Pointer]unsafe.Pointer) objectsTempMutex sync.Mutex connectionTypes = make(map[unsafe.Pointer]map[string]int64) connectionTypesMutex sync.Mutex finalizerMap = make(map[unsafe.Pointer]struct{}) finalizerMapMutex sync.Mutex // FuncMap = make(map[string]interface{}) FuncMapMutex sync.Mutex ItfMap = make(map[string]interface{}) itfMapMutex sync.Mutex EnumMap = make(map[string]int64) EnumMapMutex sync.Mutex ) func init() { runtime.LockOSThread() } func ExistsSignal(cPtr unsafe.Pointer, signal string) (exists bool) { signalsMutex.Lock() _, exists = signals[cPtr][signal] signalsMutex.Unlock() return } func LendSignal(cPtr unsafe.Pointer, signal string) (s unsafe.Pointer) { signalsMutex.Lock() s = signals[cPtr][signal] signalsMutex.Unlock() return } func lendSignalJNI(cPtr, signal string) (s unsafe.Pointer) { signalsMutex.Lock() s = signalsJNI[cPtr][signal] signalsMutex.Unlock() return } func GetSignal(cPtr interface{}, signal string) unsafe.Pointer { if dcPtr, ok := cPtr.(unsafe.Pointer); ok { if signal == "destroyed" || strings.HasPrefix(signal, "~") { defer DisconnectAllSignals(dcPtr, signal) } return LendSignal(dcPtr, signal) } return lendSignalJNI(cPtr.(string), signal) } func ConnectSignal(cPtr interface{}, signal string, function unsafe.Pointer) { if dcPtr, ok := cPtr.(unsafe.Pointer); ok { signalsMutex.Lock() if s, exists := signals[dcPtr]; !exists { signals[dcPtr] = map[string]unsafe.Pointer{signal: function} } else { s[signal] = function } signalsMutex.Unlock() } else { connectSignalJNI(cPtr.(string), signal, function) } } func connectSignalJNI(cPtr, signal string, function unsafe.Pointer) { signalsMutex.Lock() if s, exists := signalsJNI[cPtr]; !exists { signalsJNI[cPtr] = map[string]unsafe.Pointer{signal: function} } else { s[signal] = function } signalsMutex.Unlock() } func DisconnectSignal(cPtr interface{}, signal string) { if dcPtr, ok := cPtr.(unsafe.Pointer); ok { signalsMutex.Lock() delete(signals[dcPtr], signal) if len(signals[dcPtr]) == 0 { delete(signals, dcPtr) } signalsMutex.Unlock() } else { disconnectSignalJNI(cPtr.(string), signal) } } func disconnectSignalJNI(cPtr, signal string) { signalsMutex.Lock() delete(signalsJNI[cPtr], signal) if len(signalsJNI[cPtr]) == 0 { delete(signalsJNI, cPtr) } signalsMutex.Unlock() } func DisconnectAllSignals(cPtr unsafe.Pointer, signal string) { signalsMutex.Lock() if s, exists := signals[cPtr]["destroyed"]; signal != "destroyed" && exists { signals[cPtr] = map[string]unsafe.Pointer{"destroyed": s} } else { delete(signals, cPtr) } signalsMutex.Unlock() } func DumpSignals() { Debug("##############################\tSIGNALS_TABLE_START\t##############################") signalsMutex.Lock() for cPtr, entry := range signals { Debug(cPtr, entry) } signalsMutex.Unlock() Debug("##############################\tSIGNALS_TABLE_END\t##############################") } func DumpObjects() { Debug("##############################\tOBJECTS_TABLE_START\t##############################") objectsMutex.Lock() for cPtr, entry := range objects { Debug(cPtr, entry) } objectsMutex.Unlock() Debug("##############################\tOBJECTS_TABLE_END\t##############################") } func DumpTempObjects() { Debug("##############################\tTMP_OBJECTS_TABLE_START\t##############################") objectsTempMutex.Lock() for cPtr, entry := range objectsTemp { Debug(cPtr, entry) } objectsTempMutex.Unlock() Debug("##############################\tTMP_OBJECTS_TABLE_END\t##############################") } func DumpConnectionTypes() { Debug("##############################\tCON_MODES_TABLE_START\t##############################") connectionTypesMutex.Lock() for cPtr, entry := range connectionTypes { Debug(cPtr, entry) } connectionTypesMutex.Unlock() Debug("##############################\tCON_MODES_TABLE_END\t##############################") } func CountSignals() (c int) { signalsMutex.Lock() c = len(signals) signalsMutex.Unlock() return } func GoBoolToInt(b bool) int8 { if b { return 1 } return 0 } func Recover(fn string) { if recover() != nil { Debug("RECOVERED:", fn) } } func Debug(fn ...interface{}) { if strings.ToLower(os.Getenv("QT_DEBUG")) == "true" || runtime.GOARCH == "js" || runtime.GOARCH == "wasm" { Logger.Println(fn...) } } func ClearSignals() { signalsMutex.Lock() signals = make(map[unsafe.Pointer]map[string]unsafe.Pointer) signalsMutex.Unlock() } func Register(cPtr unsafe.Pointer, gPtr interface{}) { objectsMutex.Lock() objects[cPtr] = gPtr objectsMutex.Unlock() } func Receive(cPtr unsafe.Pointer) (o interface{}, ok bool) { objectsMutex.Lock() o, ok = objects[cPtr] objectsMutex.Unlock() return } func Unregister(cPtr unsafe.Pointer) { objectsMutex.Lock() delete(objects, cPtr) objectsMutex.Unlock() } func RegisterTemp(cPtr unsafe.Pointer, gPtr unsafe.Pointer) { objectsTempMutex.Lock() objectsTemp[cPtr] = gPtr objectsTempMutex.Unlock() } func ReceiveTemp(cPtr unsafe.Pointer) (o unsafe.Pointer, ok bool) { objectsTempMutex.Lock() o, ok = objectsTemp[cPtr] objectsTempMutex.Unlock() return } func UnregisterTemp(cPtr unsafe.Pointer) { objectsTempMutex.Lock() delete(objectsTemp, cPtr) objectsTempMutex.Unlock() } func RegisterConnectionType(cPtr unsafe.Pointer, signal string, mode int64) { connectionTypesMutex.Lock() if s, exists := connectionTypes[cPtr]; !exists { connectionTypes[cPtr] = map[string]int64{signal: mode} } else { s[signal] = mode } connectionTypesMutex.Unlock() } func ConnectionType(cPtr unsafe.Pointer, signal string) (m int64) { connectionTypesMutex.Lock() if s, exists := connectionTypes[cPtr]; exists { if lm, ok := s[signal]; ok { delete(s, signal) if len(s) == 0 { delete(connectionTypes, cPtr) } m = lm } } connectionTypesMutex.Unlock() return } func GetFuncMap(n string) (o interface{}, ok bool) { FuncMapMutex.Lock() o, ok = FuncMap[n] FuncMapMutex.Unlock() return } func SetFuncMap(n string, v interface{}) { FuncMapMutex.Lock() FuncMap[n] = v FuncMapMutex.Unlock() } func GetItfMap(n string) (o interface{}, ok bool) { itfMapMutex.Lock() o, ok = ItfMap[n] itfMapMutex.Unlock() return } func SetItfMap(n string, v interface{}) { itfMapMutex.Lock() ItfMap[n] = v itfMapMutex.Unlock() } func GetEnumMap(n string) (o int64, ok bool) { EnumMapMutex.Lock() o, ok = EnumMap[n] EnumMapMutex.Unlock() return } func SetEnumMap(n string, v int64) { EnumMapMutex.Lock() EnumMap[n] = v EnumMapMutex.Unlock() } type ptr_itf interface { Pointer() unsafe.Pointer SetPointer(p unsafe.Pointer) } func SetFinalizer(ptr interface{}, f interface{}) { finalizerMapMutex.Lock() cPtr := ptr.(ptr_itf).Pointer() if _, ok := finalizerMap[cPtr]; !ok || f == nil || cPtr == nil { if cPtr != nil || (cPtr == nil && f == nil) { runtime.SetFinalizer(ptr, f) } if f == nil { delete(finalizerMap, cPtr) } else if cPtr != nil { finalizerMap[cPtr] = struct{}{} } } else { runtime.SetFinalizer(ptr, func(p ptr_itf) { p.SetPointer(nil) }) } finalizerMapMutex.Unlock() } func HasFinalizer(ptr interface{}) (ok bool) { finalizerMapMutex.Lock() _, ok = finalizerMap[ptr.(ptr_itf).Pointer()] finalizerMapMutex.Unlock() return }
# Deserialization Error with MessagePack JavaScript Libraries https://github.com/msgpack/msgpack-perl/issues/48
import { SnapshotOut, types } from 'mobx-state-tree' import qs from 'qs' import useSWR from 'swr' import { ArtistDesc } from '@/models/Platform/Netease' import { fetcher } from '../fetcher' export function useArtistDesc(id: string) { const { data, error } = useSWR<ArtistDescResponseSnapshot>( `/artist/desc?${qs.stringify({ id })}`, fetcher, ) return { loading: !data && !error, data, error, } } type ArtistDescResponseSnapshot = SnapshotOut<typeof ArtistDescResponse> const ArtistDescResponse = types.compose( 'ArtistDescResponse', ArtistDesc, types.model({ code: types.number, }), )
/** * Tests for the 'view/view.js' file. */ // Do not warn if these variables were not defined before. /* global module, test, equal, ok */ module("view"); test("Test listeners.", function() { // create an image var size0 = 4; var imgSize0 = new dwv.image.Size(size0, size0, 1); var imgSpacing0 = new dwv.image.Spacing(1, 1, 1); var buffer0 = []; for(var i=0; i<size0*size0; ++i) { buffer0[i] = i; } var image0 = new dwv.image.Image(imgSize0, imgSpacing0, buffer0); // create a view var view0 = new dwv.image.View(image0); // listeners var listener1 = function(event){ equal( event.wc, 0, "Expected call to listener1."); }; var listener2 = function(event){ equal( event.ww, 1, "Expected call to listener2."); }; // with two listeners view0.addEventListener("wlchange", listener1 ); view0.addEventListener("wlchange", listener2 ); view0.setWindowLevel(0,1); // without listener2 view0.removeEventListener("wlchange", listener2 ); view0.setWindowLevel(0,2); // without listener1 view0.removeEventListener("wlchange", listener1 ); view0.setWindowLevel(1,1); }); test("Test generate data.", function() { // create an image var size0 = 128; var imgSize0 = new dwv.image.Size(size0, size0, 1); var imgSpacing0 = new dwv.image.Spacing(1, 1, 1); var buffer0 = []; for(var i=0; i<size0*size0; ++i) { buffer0[i] = i; } var image0 = new dwv.image.Image(imgSize0, imgSpacing0, buffer0); // create a view var view0 = new dwv.image.View(image0); // create the image data // TODO Uint8ClampedArray not in phantom?? var imageData = {"width": size0, "height": size0, "data": new Uint8Array(size0*size0) }; // default window level view0.setWindowLevelMinMax(); // start time // TODO window.performance.now() not in phantom?? var start0 = (new Date()).getMilliseconds(); // call generate data view0.generateImageData(imageData); // time taken var time0 = (new Date()).getMilliseconds() - start0; // check time taken ok( time0 < 90, "First generateImageData: "+time0+"ms."); // Change the window level view0.setWindowLevel(4000, 200); // start time var start1 = (new Date()).getMilliseconds(); // call generate data view0.generateImageData(imageData); // time taken var time1 = (new Date()).getMilliseconds() - start1; // check time taken ok( time1 < 90, "Second generateImageData: "+time1+"ms."); });
--- title: "Christmas Card Dash: Locate Your Nearest Postbox with Node.js and the Messages API" description: So you’ve built a database for this year’s Christmas Card list, printed the cards with custom xkcd cartoons based on each recipient’s profession and mail-merged the lot. That’s a boring job automated and taken care of, with hopefully some fun technical challenges along the way. Except you have now had a backpack full of Christmas […] thumbnail: https://www.nexmo.com/wp-content/uploads/2018/12/christmas-card-dash.png author: marklewin published: true published_at: 2018-12-06T17:29:19 comments: true category: tutorial tags: [] canonical: https://www.nexmo.com/blog/2018/12/06/nearest-postbox-with-node-js-nexmo-messages-api-dr redirect: https://www.nexmo.com/blog/2018/12/06/nearest-postbox-with-node-js-nexmo-messages-api-dr --- Content to be migrated...
# frozen_string_literal: true # Copyright 2019 Matthew B. Gray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # encoding : utf-8 MoneyRails.configure do |config| # Needs to be configured as a symbol config.default_currency = Rails.configuration.default_currency # Set default bank object # # Example: # config.default_bank = EuCentralBank.new # Add exchange rates to current money bank object. # (The conversion rate refers to one direction only) # # Example: # config.add_rate "USD", "CAD", 1.24515 # config.add_rate "CAD", "USD", 0.803115 # To handle the inclusion of validations for monetized fields # The default value is true # # config.include_validations = true # Default ActiveRecord migration configuration values for columns: # # config.amount_column = { prefix: '', # column name prefix # postfix: '_cents', # column name postfix # column_name: nil, # full column name (overrides prefix, postfix and accessor name) # type: :integer, # column type # present: true, # column will be created # null: false, # other options will be treated as column options # default: 0 # } # # config.currency_column = { prefix: '', # postfix: '_currency', # column_name: nil, # type: :string, # present: true, # null: false, # default: 'USD' # } # Register a custom currency # # Example: # config.register_currency = { # priority: 1, # iso_code: "EU4", # name: "Euro with subunit of 4 digits", # symbol: "€", # symbol_first: true, # subunit: "Subcent", # subunit_to_unit: 10000, # thousands_separator: ".", # decimal_mark: "," # } # Specify a rounding mode # Any one of: # # BigDecimal::ROUND_UP, # BigDecimal::ROUND_DOWN, # BigDecimal::ROUND_HALF_UP, # BigDecimal::ROUND_HALF_DOWN, # BigDecimal::ROUND_HALF_EVEN, # BigDecimal::ROUND_CEILING, # BigDecimal::ROUND_FLOOR # # set to BigDecimal::ROUND_HALF_EVEN by default # This is set to match Stripe's rounding defaults. # see https://stripe.com/docs/billing/subscriptions/decimal-amounts#rounding config.rounding_mode = BigDecimal::ROUND_HALF_UP # Set default money format globally. # Default value is nil meaning "ignore this option". # Example: # # config.default_format = { # no_cents_if_whole: nil, # symbol: nil, # sign_before_symbol: nil # } # Set default raise_error_on_money_parsing option # It will be raise error if assigned different currency # The default value is false # # Example: # config.raise_error_on_money_parsing = false # Look up formatting in i18n files # see https://github.com/RubyMoney/money#localization Money.locale_backend = :i18n end
-- Deploy conduit:create-favorites to pg -- requires: create-articles -- requires: create-users BEGIN; CREATE TABLE IF NOT EXISTS favorites ( user__id INT REFERENCES users(id) ON DELETE CASCADE, article__id INT REFERENCES articles(id) ON DELETE CASCADE ); COMMIT;
// See LICENSE.Berkeley for license details. // See LICENSE.SiFive for license details. package freechips.rocketchip.tile import Chisel.{defaultCompileOptions => _, _} import freechips.rocketchip.util.CompileOptions.NotStrictInferReset import Chisel.ImplicitConversions._ import chisel3.{DontCare, WireInit, withClock, withReset} import chisel3.internal.sourceinfo.SourceInfo import chisel3.experimental.{chiselName, NoChiselNamePrefix} import freechips.rocketchip.config.Parameters import freechips.rocketchip.rocket._ import freechips.rocketchip.rocket.Instructions._ import freechips.rocketchip.util._ import freechips.rocketchip.util.property._ case class FPUParams( minFLen: Int = 32, fLen: Int = 64, divSqrt: Boolean = true, sfmaLatency: Int = 3, dfmaLatency: Int = 4 ) object FPConstants { val RM_SZ = 3 val FLAGS_SZ = 5 } trait HasFPUCtrlSigs { val ldst = Bool() val wen = Bool() val ren1 = Bool() val ren2 = Bool() val ren3 = Bool() val swap12 = Bool() val swap23 = Bool() val typeTagIn = UInt(2.W) val typeTagOut = UInt(2.W) val fromint = Bool() val toint = Bool() val fastpipe = Bool() val fma = Bool() val div = Bool() val sqrt = Bool() val wflags = Bool() } class FPUCtrlSigs extends Bundle with HasFPUCtrlSigs class FPUDecoder(implicit p: Parameters) extends FPUModule()(p) { val io = new Bundle { val inst = Bits(INPUT, 32) val sigs = new FPUCtrlSigs().asOutput } val default = List(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X) val h: Array[(BitPat, List[BitPat])] = Array(FLH -> List(Y,Y,N,N,N,X,X,X,X,N,N,N,N,N,N,N), FSH -> List(Y,N,N,Y,N,Y,X,I,H,N,Y,N,N,N,N,N), FMV_H_X -> List(N,Y,N,N,N,X,X,H,I,Y,N,N,N,N,N,N), FCVT_H_W -> List(N,Y,N,N,N,X,X,H,H,Y,N,N,N,N,N,Y), FCVT_H_WU-> List(N,Y,N,N,N,X,X,H,H,Y,N,N,N,N,N,Y), FCVT_H_L -> List(N,Y,N,N,N,X,X,H,H,Y,N,N,N,N,N,Y), FCVT_H_LU-> List(N,Y,N,N,N,X,X,H,H,Y,N,N,N,N,N,Y), FMV_X_H -> List(N,N,Y,N,N,N,X,I,H,N,Y,N,N,N,N,N), FCLASS_H -> List(N,N,Y,N,N,N,X,H,H,N,Y,N,N,N,N,N), FCVT_W_H -> List(N,N,Y,N,N,N,X,H,X,N,Y,N,N,N,N,Y), FCVT_WU_H-> List(N,N,Y,N,N,N,X,H,X,N,Y,N,N,N,N,Y), FCVT_L_H -> List(N,N,Y,N,N,N,X,H,X,N,Y,N,N,N,N,Y), FCVT_LU_H-> List(N,N,Y,N,N,N,X,H,X,N,Y,N,N,N,N,Y), FCVT_S_H -> List(N,Y,Y,N,N,N,X,H,S,N,N,Y,N,N,N,Y), FCVT_H_S -> List(N,Y,Y,N,N,N,X,S,H,N,N,Y,N,N,N,Y), FEQ_H -> List(N,N,Y,Y,N,N,N,H,H,N,Y,N,N,N,N,Y), FLT_H -> List(N,N,Y,Y,N,N,N,H,H,N,Y,N,N,N,N,Y), FLE_H -> List(N,N,Y,Y,N,N,N,H,H,N,Y,N,N,N,N,Y), FSGNJ_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,Y,N,N,N,N), FSGNJN_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,Y,N,N,N,N), FSGNJX_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,Y,N,N,N,N), FMIN_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,Y,N,N,N,Y), FMAX_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,Y,N,N,N,Y), FADD_H -> List(N,Y,Y,Y,N,N,Y,H,H,N,N,N,Y,N,N,Y), FSUB_H -> List(N,Y,Y,Y,N,N,Y,H,H,N,N,N,Y,N,N,Y), FMUL_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,N,Y,N,N,Y), FMADD_H -> List(N,Y,Y,Y,Y,N,N,H,H,N,N,N,Y,N,N,Y), FMSUB_H -> List(N,Y,Y,Y,Y,N,N,H,H,N,N,N,Y,N,N,Y), FNMADD_H -> List(N,Y,Y,Y,Y,N,N,H,H,N,N,N,Y,N,N,Y), FNMSUB_H -> List(N,Y,Y,Y,Y,N,N,H,H,N,N,N,Y,N,N,Y), FDIV_H -> List(N,Y,Y,Y,N,N,N,H,H,N,N,N,N,Y,N,Y), FSQRT_H -> List(N,Y,Y,N,N,N,X,H,H,N,N,N,N,N,Y,Y)) val f: Array[(BitPat, List[BitPat])] = Array(FLW -> List(Y,Y,N,N,N,X,X,X,X,N,N,N,N,N,N,N), FSW -> List(Y,N,N,Y,N,Y,X,I,S,N,Y,N,N,N,N,N), FMV_S_X -> List(N,Y,N,N,N,X,X,S,I,Y,N,N,N,N,N,N), FCVT_S_W -> List(N,Y,N,N,N,X,X,S,S,Y,N,N,N,N,N,Y), FCVT_S_WU-> List(N,Y,N,N,N,X,X,S,S,Y,N,N,N,N,N,Y), FCVT_S_L -> List(N,Y,N,N,N,X,X,S,S,Y,N,N,N,N,N,Y), FCVT_S_LU-> List(N,Y,N,N,N,X,X,S,S,Y,N,N,N,N,N,Y), FMV_X_S -> List(N,N,Y,N,N,N,X,I,S,N,Y,N,N,N,N,N), FCLASS_S -> List(N,N,Y,N,N,N,X,S,S,N,Y,N,N,N,N,N), FCVT_W_S -> List(N,N,Y,N,N,N,X,S,X,N,Y,N,N,N,N,Y), FCVT_WU_S-> List(N,N,Y,N,N,N,X,S,X,N,Y,N,N,N,N,Y), FCVT_L_S -> List(N,N,Y,N,N,N,X,S,X,N,Y,N,N,N,N,Y), FCVT_LU_S-> List(N,N,Y,N,N,N,X,S,X,N,Y,N,N,N,N,Y), FEQ_S -> List(N,N,Y,Y,N,N,N,S,S,N,Y,N,N,N,N,Y), FLT_S -> List(N,N,Y,Y,N,N,N,S,S,N,Y,N,N,N,N,Y), FLE_S -> List(N,N,Y,Y,N,N,N,S,S,N,Y,N,N,N,N,Y), FSGNJ_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,Y,N,N,N,N), FSGNJN_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,Y,N,N,N,N), FSGNJX_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,Y,N,N,N,N), FMIN_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,Y,N,N,N,Y), FMAX_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,Y,N,N,N,Y), FADD_S -> List(N,Y,Y,Y,N,N,Y,S,S,N,N,N,Y,N,N,Y), FSUB_S -> List(N,Y,Y,Y,N,N,Y,S,S,N,N,N,Y,N,N,Y), FMUL_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,N,Y,N,N,Y), FMADD_S -> List(N,Y,Y,Y,Y,N,N,S,S,N,N,N,Y,N,N,Y), FMSUB_S -> List(N,Y,Y,Y,Y,N,N,S,S,N,N,N,Y,N,N,Y), FNMADD_S -> List(N,Y,Y,Y,Y,N,N,S,S,N,N,N,Y,N,N,Y), FNMSUB_S -> List(N,Y,Y,Y,Y,N,N,S,S,N,N,N,Y,N,N,Y), FDIV_S -> List(N,Y,Y,Y,N,N,N,S,S,N,N,N,N,Y,N,Y), FSQRT_S -> List(N,Y,Y,N,N,N,X,S,S,N,N,N,N,N,Y,Y)) val d: Array[(BitPat, List[BitPat])] = Array(FLD -> List(Y,Y,N,N,N,X,X,X,X,N,N,N,N,N,N,N), FSD -> List(Y,N,N,Y,N,Y,X,I,D,N,Y,N,N,N,N,N), FMV_D_X -> List(N,Y,N,N,N,X,X,D,I,Y,N,N,N,N,N,N), FCVT_D_W -> List(N,Y,N,N,N,X,X,D,D,Y,N,N,N,N,N,Y), FCVT_D_WU-> List(N,Y,N,N,N,X,X,D,D,Y,N,N,N,N,N,Y), FCVT_D_L -> List(N,Y,N,N,N,X,X,D,D,Y,N,N,N,N,N,Y), FCVT_D_LU-> List(N,Y,N,N,N,X,X,D,D,Y,N,N,N,N,N,Y), FMV_X_D -> List(N,N,Y,N,N,N,X,I,D,N,Y,N,N,N,N,N), FCLASS_D -> List(N,N,Y,N,N,N,X,D,D,N,Y,N,N,N,N,N), FCVT_W_D -> List(N,N,Y,N,N,N,X,D,X,N,Y,N,N,N,N,Y), FCVT_WU_D-> List(N,N,Y,N,N,N,X,D,X,N,Y,N,N,N,N,Y), FCVT_L_D -> List(N,N,Y,N,N,N,X,D,X,N,Y,N,N,N,N,Y), FCVT_LU_D-> List(N,N,Y,N,N,N,X,D,X,N,Y,N,N,N,N,Y), FCVT_S_D -> List(N,Y,Y,N,N,N,X,D,S,N,N,Y,N,N,N,Y), FCVT_D_S -> List(N,Y,Y,N,N,N,X,S,D,N,N,Y,N,N,N,Y), FEQ_D -> List(N,N,Y,Y,N,N,N,D,D,N,Y,N,N,N,N,Y), FLT_D -> List(N,N,Y,Y,N,N,N,D,D,N,Y,N,N,N,N,Y), FLE_D -> List(N,N,Y,Y,N,N,N,D,D,N,Y,N,N,N,N,Y), FSGNJ_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,Y,N,N,N,N), FSGNJN_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,Y,N,N,N,N), FSGNJX_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,Y,N,N,N,N), FMIN_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,Y,N,N,N,Y), FMAX_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,Y,N,N,N,Y), FADD_D -> List(N,Y,Y,Y,N,N,Y,D,D,N,N,N,Y,N,N,Y), FSUB_D -> List(N,Y,Y,Y,N,N,Y,D,D,N,N,N,Y,N,N,Y), FMUL_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,N,Y,N,N,Y), FMADD_D -> List(N,Y,Y,Y,Y,N,N,D,D,N,N,N,Y,N,N,Y), FMSUB_D -> List(N,Y,Y,Y,Y,N,N,D,D,N,N,N,Y,N,N,Y), FNMADD_D -> List(N,Y,Y,Y,Y,N,N,D,D,N,N,N,Y,N,N,Y), FNMSUB_D -> List(N,Y,Y,Y,Y,N,N,D,D,N,N,N,Y,N,N,Y), FDIV_D -> List(N,Y,Y,Y,N,N,N,D,D,N,N,N,N,Y,N,Y), FSQRT_D -> List(N,Y,Y,N,N,N,X,D,D,N,N,N,N,N,Y,Y)) val fcvt_hd: Array[(BitPat, List[BitPat])] = Array(FCVT_H_D -> List(N,Y,Y,N,N,N,X,D,H,N,N,Y,N,N,N,Y), FCVT_D_H -> List(N,Y,Y,N,N,N,X,H,D,N,N,Y,N,N,N,Y)) val insns = (minFLen, fLen) match { case (32, 32) => f case (16, 32) => h ++ f case (32, 64) => f ++ d case (16, 64) => h ++ f ++ d ++ fcvt_hd case other => throw new Exception(s"minFLen = ${minFLen} & fLen = ${fLen} is an unsupported configuration") } val decoder = DecodeLogic(io.inst, default, insns) val s = io.sigs val sigs = Seq(s.ldst, s.wen, s.ren1, s.ren2, s.ren3, s.swap12, s.swap23, s.typeTagIn, s.typeTagOut, s.fromint, s.toint, s.fastpipe, s.fma, s.div, s.sqrt, s.wflags) sigs zip decoder map {case(s,d) => s := d} } class FPUCoreIO(implicit p: Parameters) extends CoreBundle()(p) { val hartid = Input(UInt(hartIdLen.W)) val time = Input(UInt(xLen.W)) val inst = Bits(INPUT, 32) val fromint_data = Bits(INPUT, xLen) val fcsr_rm = Bits(INPUT, FPConstants.RM_SZ) val fcsr_flags = Valid(Bits(width = FPConstants.FLAGS_SZ)) val store_data = Bits(OUTPUT, fLen) val toint_data = Bits(OUTPUT, xLen) val dmem_resp_val = Bool(INPUT) val dmem_resp_type = Bits(INPUT, 3) val dmem_resp_tag = UInt(INPUT, 5) val dmem_resp_data = Bits(INPUT, fLen) val valid = Bool(INPUT) val fcsr_rdy = Bool(OUTPUT) val nack_mem = Bool(OUTPUT) val illegal_rm = Bool(OUTPUT) val killx = Bool(INPUT) val killm = Bool(INPUT) val dec = new FPUCtrlSigs().asOutput val sboard_set = Bool(OUTPUT) val sboard_clr = Bool(OUTPUT) val sboard_clra = UInt(OUTPUT, 5) val keep_clock_enabled = Bool(INPUT) } class FPUIO(implicit p: Parameters) extends FPUCoreIO ()(p) { val cp_req = Decoupled(new FPInput()).flip //cp doesn't pay attn to kill sigs val cp_resp = Decoupled(new FPResult()) } class FPResult(implicit p: Parameters) extends CoreBundle()(p) { val data = Bits(width = fLen+1) val exc = Bits(width = FPConstants.FLAGS_SZ) } class IntToFPInput(implicit p: Parameters) extends CoreBundle()(p) with HasFPUCtrlSigs { val rm = Bits(width = FPConstants.RM_SZ) val typ = Bits(width = 2) val in1 = Bits(width = xLen) } class FPInput(implicit p: Parameters) extends CoreBundle()(p) with HasFPUCtrlSigs { val rm = Bits(width = FPConstants.RM_SZ) val fmaCmd = Bits(width = 2) val typ = Bits(width = 2) val fmt = Bits(width = 2) val in1 = Bits(width = fLen+1) val in2 = Bits(width = fLen+1) val in3 = Bits(width = fLen+1) override def cloneType = new FPInput().asInstanceOf[this.type] } case class FType(exp: Int, sig: Int) { def ieeeWidth = exp + sig def recodedWidth = ieeeWidth + 1 def ieeeQNaN = UInt((BigInt(1) << (ieeeWidth - 1)) - (BigInt(1) << (sig - 2)), ieeeWidth) def qNaN = UInt((BigInt(7) << (exp + sig - 3)) + (BigInt(1) << (sig - 2)), recodedWidth) def isNaN(x: UInt) = x(sig + exp - 1, sig + exp - 3).andR def isSNaN(x: UInt) = isNaN(x) && !x(sig - 2) def classify(x: UInt) = { val sign = x(sig + exp) val code = x(exp + sig - 1, exp + sig - 3) val codeHi = code(2, 1) val isSpecial = codeHi === UInt(3) val isHighSubnormalIn = x(exp + sig - 3, sig - 1) < UInt(2) val isSubnormal = code === UInt(1) || codeHi === UInt(1) && isHighSubnormalIn val isNormal = codeHi === UInt(1) && !isHighSubnormalIn || codeHi === UInt(2) val isZero = code === UInt(0) val isInf = isSpecial && !code(0) val isNaN = code.andR val isSNaN = isNaN && !x(sig-2) val isQNaN = isNaN && x(sig-2) Cat(isQNaN, isSNaN, isInf && !sign, isNormal && !sign, isSubnormal && !sign, isZero && !sign, isZero && sign, isSubnormal && sign, isNormal && sign, isInf && sign) } // convert between formats, ignoring rounding, range, NaN def unsafeConvert(x: UInt, to: FType) = if (this == to) x else { val sign = x(sig + exp) val fractIn = x(sig - 2, 0) val expIn = x(sig + exp - 1, sig - 1) val fractOut = fractIn << to.sig >> sig val expOut = { val expCode = expIn(exp, exp - 2) val commonCase = (expIn + (1 << to.exp)) - (1 << exp) Mux(expCode === 0 || expCode >= 6, Cat(expCode, commonCase(to.exp - 3, 0)), commonCase(to.exp, 0)) } Cat(sign, expOut, fractOut) } private def ieeeBundle = { val expWidth = exp class IEEEBundle extends Bundle { val sign = Bool() val exp = UInt(expWidth.W) val sig = UInt((ieeeWidth-expWidth-1).W) override def cloneType = new IEEEBundle().asInstanceOf[this.type] } new IEEEBundle } def unpackIEEE(x: UInt) = x.asTypeOf(ieeeBundle) def recode(x: UInt) = hardfloat.recFNFromFN(exp, sig, x) def ieee(x: UInt) = hardfloat.fNFromRecFN(exp, sig, x) } object FType { val H = new FType(5, 11) val S = new FType(8, 24) val D = new FType(11, 53) val all = List(H, S, D) } trait HasFPUParameters { require(fLen == 0 || FType.all.exists(_.ieeeWidth == fLen)) val minFLen: Int val fLen: Int def xLen: Int val minXLen = 32 val nIntTypes = log2Ceil(xLen/minXLen) + 1 val floatTypes = FType.all.filter(t => minFLen <= t.ieeeWidth && t.ieeeWidth <= fLen) def minType = floatTypes.head def maxType = floatTypes.last def prevType(t: FType) = floatTypes(typeTag(t) - 1) def maxExpWidth = maxType.exp def maxSigWidth = maxType.sig def typeTag(t: FType) = floatTypes.indexOf(t) def typeTagWbOffset = UInt(FType.all.indexOf(minType) + 1) def typeTagGroup(t: FType) = UInt(if (floatTypes.contains(t)) typeTag(t) else typeTag(maxType)) // typeTag def H = typeTagGroup(FType.H) def S = typeTagGroup(FType.S) def D = typeTagGroup(FType.D) def I = UInt(typeTag(maxType)) private def isBox(x: UInt, t: FType): Bool = x(t.sig + t.exp, t.sig + t.exp - 4).andR private def box(x: UInt, xt: FType, y: UInt, yt: FType): UInt = { require(xt.ieeeWidth == 2 * yt.ieeeWidth) val swizzledNaN = Cat( x(xt.sig + xt.exp, xt.sig + xt.exp - 3), x(xt.sig - 2, yt.recodedWidth - 1).andR, x(xt.sig + xt.exp - 5, xt.sig), y(yt.recodedWidth - 2), x(xt.sig - 2, yt.recodedWidth - 1), y(yt.recodedWidth - 1), y(yt.recodedWidth - 3, 0)) Mux(xt.isNaN(x), swizzledNaN, x) } // implement NaN unboxing for FU inputs def unbox(x: UInt, tag: UInt, exactType: Option[FType]): UInt = { val outType = exactType.getOrElse(maxType) def helper(x: UInt, t: FType): Seq[(Bool, UInt)] = { val prev = if (t == minType) { Seq() } else { val prevT = prevType(t) val unswizzled = Cat( x(prevT.sig + prevT.exp - 1), x(t.sig - 1), x(prevT.sig + prevT.exp - 2, 0)) val prev = helper(unswizzled, prevT) val isbox = isBox(x, t) prev.map(p => (isbox && p._1, p._2)) } prev :+ (true.B, t.unsafeConvert(x, outType)) } val (oks, floats) = helper(x, maxType).unzip if (exactType.isEmpty || floatTypes.size == 1) { Mux(oks(tag), floats(tag), maxType.qNaN) } else { val t = exactType.get floats(typeTag(t)) | Mux(oks(typeTag(t)), 0.U, t.qNaN) } } // make sure that the redundant bits in the NaN-boxed encoding are consistent def consistent(x: UInt): Bool = { def helper(x: UInt, t: FType): Bool = if (typeTag(t) == 0) true.B else { val prevT = prevType(t) val unswizzled = Cat( x(prevT.sig + prevT.exp - 1), x(t.sig - 1), x(prevT.sig + prevT.exp - 2, 0)) val prevOK = !isBox(x, t) || helper(unswizzled, prevT) val curOK = !t.isNaN(x) || x(t.sig + t.exp - 4) === x(t.sig - 2, prevT.recodedWidth - 1).andR prevOK && curOK } helper(x, maxType) } // generate a NaN box from an FU result def box(x: UInt, t: FType): UInt = { if (t == maxType) { x } else { val nt = floatTypes(typeTag(t) + 1) val bigger = box(UInt((BigInt(1) << nt.recodedWidth)-1), nt, x, t) bigger | UInt((BigInt(1) << maxType.recodedWidth) - (BigInt(1) << nt.recodedWidth)) } } // generate a NaN box from an FU result def box(x: UInt, tag: UInt): UInt = { val opts = floatTypes.map(t => box(x, t)) opts(tag) } // zap bits that hardfloat thinks are don't-cares, but we do care about def sanitizeNaN(x: UInt, t: FType): UInt = { if (typeTag(t) == 0) { x } else { val maskedNaN = x & ~UInt((BigInt(1) << (t.sig-1)) | (BigInt(1) << (t.sig+t.exp-4)), t.recodedWidth) Mux(t.isNaN(x), maskedNaN, x) } } // implement NaN boxing and recoding for FL*/fmv.*.x def recode(x: UInt, tag: UInt): UInt = { def helper(x: UInt, t: FType): UInt = { if (typeTag(t) == 0) { t.recode(x) } else { val prevT = prevType(t) box(t.recode(x), t, helper(x, prevT), prevT) } } // fill MSBs of subword loads to emulate a wider load of a NaN-boxed value val boxes = floatTypes.map(t => UInt((BigInt(1) << maxType.ieeeWidth) - (BigInt(1) << t.ieeeWidth))) helper(boxes(tag) | x, maxType) } // implement NaN unboxing and un-recoding for FS*/fmv.x.* def ieee(x: UInt, t: FType = maxType): UInt = { if (typeTag(t) == 0) { t.ieee(x) } else { val unrecoded = t.ieee(x) val prevT = prevType(t) val prevRecoded = Cat( x(prevT.recodedWidth-2), x(t.sig-1), x(prevT.recodedWidth-3, 0)) val prevUnrecoded = ieee(prevRecoded, prevT) Cat(unrecoded >> prevT.ieeeWidth, Mux(t.isNaN(x), prevUnrecoded, unrecoded(prevT.ieeeWidth-1, 0))) } } } abstract class FPUModule(implicit val p: Parameters) extends Module with HasCoreParameters with HasFPUParameters class FPToInt(implicit p: Parameters) extends FPUModule()(p) with ShouldBeRetimed { class Output extends Bundle { val in = new FPInput val lt = Bool() val store = Bits(width = fLen) val toint = Bits(width = xLen) val exc = Bits(width = FPConstants.FLAGS_SZ) override def cloneType = new Output().asInstanceOf[this.type] } val io = new Bundle { val in = Valid(new FPInput).flip val out = Valid(new Output) } val in = RegEnable(io.in.bits, io.in.valid) val valid = Reg(next=io.in.valid) val dcmp = Module(new hardfloat.CompareRecFN(maxExpWidth, maxSigWidth)) dcmp.io.a := in.in1 dcmp.io.b := in.in2 dcmp.io.signaling := !in.rm(1) val tag = in.typeTagOut val store = (floatTypes.map(t => if (t == FType.H) Fill(maxType.ieeeWidth / minXLen, ieee(in.in1)(15, 0).sextTo(minXLen)) else Fill(maxType.ieeeWidth / t.ieeeWidth, ieee(in.in1)(t.ieeeWidth - 1, 0))): Seq[UInt])(tag) val toint = Wire(init = store) val intType = Wire(init = in.fmt(0)) io.out.bits.store := store io.out.bits.toint := ((0 until nIntTypes).map(i => toint((minXLen << i) - 1, 0).sextTo(xLen)): Seq[UInt])(intType) io.out.bits.exc := Bits(0) when (in.rm(0)) { val classify_out = (floatTypes.map(t => t.classify(maxType.unsafeConvert(in.in1, t))): Seq[UInt])(tag) toint := classify_out | (store >> minXLen << minXLen) intType := 0 } when (in.wflags) { // feq/flt/fle, fcvt toint := (~in.rm & Cat(dcmp.io.lt, dcmp.io.eq)).orR | (store >> minXLen << minXLen) io.out.bits.exc := dcmp.io.exceptionFlags intType := 0 when (!in.ren2) { // fcvt val cvtType = in.typ.extract(log2Ceil(nIntTypes), 1) intType := cvtType val conv = Module(new hardfloat.RecFNToIN(maxExpWidth, maxSigWidth, xLen)) conv.io.in := in.in1 conv.io.roundingMode := in.rm conv.io.signedOut := ~in.typ(0) toint := conv.io.out io.out.bits.exc := Cat(conv.io.intExceptionFlags(2, 1).orR, UInt(0, 3), conv.io.intExceptionFlags(0)) for (i <- 0 until nIntTypes-1) { val w = minXLen << i when (cvtType === i) { val narrow = Module(new hardfloat.RecFNToIN(maxExpWidth, maxSigWidth, w)) narrow.io.in := in.in1 narrow.io.roundingMode := in.rm narrow.io.signedOut := ~in.typ(0) val excSign = in.in1(maxExpWidth + maxSigWidth) && !maxType.isNaN(in.in1) val excOut = Cat(conv.io.signedOut === excSign, Fill(w-1, !excSign)) val invalid = conv.io.intExceptionFlags(2) || narrow.io.intExceptionFlags(1) when (invalid) { toint := Cat(conv.io.out >> w, excOut) } io.out.bits.exc := Cat(invalid, UInt(0, 3), !invalid && conv.io.intExceptionFlags(0)) } } } } io.out.valid := valid io.out.bits.lt := dcmp.io.lt || (dcmp.io.a.asSInt < 0.S && dcmp.io.b.asSInt >= 0.S) io.out.bits.in := in } class IntToFP(val latency: Int)(implicit p: Parameters) extends FPUModule()(p) with ShouldBeRetimed { val io = new Bundle { val in = Valid(new IntToFPInput).flip val out = Valid(new FPResult) } val in = Pipe(io.in) val tag = in.bits.typeTagIn val mux = Wire(new FPResult) mux.exc := Bits(0) mux.data := recode(in.bits.in1, tag) val intValue = { val res = Wire(init = in.bits.in1.asSInt) for (i <- 0 until nIntTypes-1) { val smallInt = in.bits.in1((minXLen << i) - 1, 0) when (in.bits.typ.extract(log2Ceil(nIntTypes), 1) === i) { res := Mux(in.bits.typ(0), smallInt.zext, smallInt.asSInt) } } res.asUInt } when (in.bits.wflags) { // fcvt // could be improved for RVD/RVQ with a single variable-position rounding // unit, rather than N fixed-position ones val i2fResults = for (t <- floatTypes) yield { val i2f = Module(new hardfloat.INToRecFN(xLen, t.exp, t.sig)) i2f.io.signedIn := ~in.bits.typ(0) i2f.io.in := intValue i2f.io.roundingMode := in.bits.rm i2f.io.detectTininess := hardfloat.consts.tininess_afterRounding (sanitizeNaN(i2f.io.out, t), i2f.io.exceptionFlags) } val (data, exc) = i2fResults.unzip val dataPadded = data.init.map(d => Cat(data.last >> d.getWidth, d)) :+ data.last mux.data := dataPadded(tag) mux.exc := exc(tag) } io.out <> Pipe(in.valid, mux, latency-1) } class FPToFP(val latency: Int)(implicit p: Parameters) extends FPUModule()(p) with ShouldBeRetimed { val io = new Bundle { val in = Valid(new FPInput).flip val out = Valid(new FPResult) val lt = Bool(INPUT) // from FPToInt } val in = Pipe(io.in) val signNum = Mux(in.bits.rm(1), in.bits.in1 ^ in.bits.in2, Mux(in.bits.rm(0), ~in.bits.in2, in.bits.in2)) val fsgnj = Cat(signNum(fLen), in.bits.in1(fLen-1, 0)) val fsgnjMux = Wire(new FPResult) fsgnjMux.exc := UInt(0) fsgnjMux.data := fsgnj when (in.bits.wflags) { // fmin/fmax val isnan1 = maxType.isNaN(in.bits.in1) val isnan2 = maxType.isNaN(in.bits.in2) val isInvalid = maxType.isSNaN(in.bits.in1) || maxType.isSNaN(in.bits.in2) val isNaNOut = isnan1 && isnan2 val isLHS = isnan2 || in.bits.rm(0) =/= io.lt && !isnan1 fsgnjMux.exc := isInvalid << 4 fsgnjMux.data := Mux(isNaNOut, maxType.qNaN, Mux(isLHS, in.bits.in1, in.bits.in2)) } val inTag = in.bits.typeTagIn val outTag = in.bits.typeTagOut val mux = Wire(init = fsgnjMux) for (t <- floatTypes.init) { when (outTag === typeTag(t)) { mux.data := Cat(fsgnjMux.data >> t.recodedWidth, maxType.unsafeConvert(fsgnjMux.data, t)) } } when (in.bits.wflags && !in.bits.ren2) { // fcvt if (floatTypes.size > 1) { // widening conversions simply canonicalize NaN operands val widened = Mux(maxType.isNaN(in.bits.in1), maxType.qNaN, in.bits.in1) fsgnjMux.data := widened fsgnjMux.exc := maxType.isSNaN(in.bits.in1) << 4 // narrowing conversions require rounding (for RVQ, this could be // optimized to use a single variable-position rounding unit, rather // than two fixed-position ones) for (outType <- floatTypes.init) when (outTag === typeTag(outType) && (typeTag(outType) == 0 || outTag < inTag)) { val narrower = Module(new hardfloat.RecFNToRecFN(maxType.exp, maxType.sig, outType.exp, outType.sig)) narrower.io.in := in.bits.in1 narrower.io.roundingMode := in.bits.rm narrower.io.detectTininess := hardfloat.consts.tininess_afterRounding val narrowed = sanitizeNaN(narrower.io.out, outType) mux.data := Cat(fsgnjMux.data >> narrowed.getWidth, narrowed) mux.exc := narrower.io.exceptionFlags } } } io.out <> Pipe(in.valid, mux, latency-1) } class MulAddRecFNPipe(latency: Int, expWidth: Int, sigWidth: Int) extends Module { require(latency<=2) val io = new Bundle { val validin = Bool(INPUT) val op = Bits(INPUT, 2) val a = Bits(INPUT, expWidth + sigWidth + 1) val b = Bits(INPUT, expWidth + sigWidth + 1) val c = Bits(INPUT, expWidth + sigWidth + 1) val roundingMode = UInt(INPUT, 3) val detectTininess = UInt(INPUT, 1) val out = Bits(OUTPUT, expWidth + sigWidth + 1) val exceptionFlags = Bits(OUTPUT, 5) val validout = Bool(OUTPUT) } //------------------------------------------------------------------------ //------------------------------------------------------------------------ val mulAddRecFNToRaw_preMul = Module(new hardfloat.MulAddRecFNToRaw_preMul(expWidth, sigWidth)) val mulAddRecFNToRaw_postMul = Module(new hardfloat.MulAddRecFNToRaw_postMul(expWidth, sigWidth)) mulAddRecFNToRaw_preMul.io.op := io.op mulAddRecFNToRaw_preMul.io.a := io.a mulAddRecFNToRaw_preMul.io.b := io.b mulAddRecFNToRaw_preMul.io.c := io.c val mulAddResult = (mulAddRecFNToRaw_preMul.io.mulAddA * mulAddRecFNToRaw_preMul.io.mulAddB) +& mulAddRecFNToRaw_preMul.io.mulAddC val valid_stage0 = Wire(Bool()) val roundingMode_stage0 = Wire(UInt(width=3)) val detectTininess_stage0 = Wire(UInt(width=1)) val postmul_regs = if(latency>0) 1 else 0 mulAddRecFNToRaw_postMul.io.fromPreMul := Pipe(io.validin, mulAddRecFNToRaw_preMul.io.toPostMul, postmul_regs).bits mulAddRecFNToRaw_postMul.io.mulAddResult := Pipe(io.validin, mulAddResult, postmul_regs).bits mulAddRecFNToRaw_postMul.io.roundingMode := Pipe(io.validin, io.roundingMode, postmul_regs).bits roundingMode_stage0 := Pipe(io.validin, io.roundingMode, postmul_regs).bits detectTininess_stage0 := Pipe(io.validin, io.detectTininess, postmul_regs).bits valid_stage0 := Pipe(io.validin, false.B, postmul_regs).valid //------------------------------------------------------------------------ //------------------------------------------------------------------------ val roundRawFNToRecFN = Module(new hardfloat.RoundRawFNToRecFN(expWidth, sigWidth, 0)) val round_regs = if(latency==2) 1 else 0 roundRawFNToRecFN.io.invalidExc := Pipe(valid_stage0, mulAddRecFNToRaw_postMul.io.invalidExc, round_regs).bits roundRawFNToRecFN.io.in := Pipe(valid_stage0, mulAddRecFNToRaw_postMul.io.rawOut, round_regs).bits roundRawFNToRecFN.io.roundingMode := Pipe(valid_stage0, roundingMode_stage0, round_regs).bits roundRawFNToRecFN.io.detectTininess := Pipe(valid_stage0, detectTininess_stage0, round_regs).bits io.validout := Pipe(valid_stage0, false.B, round_regs).valid roundRawFNToRecFN.io.infiniteExc := Bool(false) io.out := roundRawFNToRecFN.io.out io.exceptionFlags := roundRawFNToRecFN.io.exceptionFlags } class FPUFMAPipe(val latency: Int, val t: FType) (implicit p: Parameters) extends FPUModule()(p) with ShouldBeRetimed { require(latency>0) val io = new Bundle { val in = Valid(new FPInput).flip val out = Valid(new FPResult) } val valid = Reg(next=io.in.valid) val in = Reg(new FPInput) when (io.in.valid) { val one = UInt(1) << (t.sig + t.exp - 1) val zero = (io.in.bits.in1 ^ io.in.bits.in2) & (UInt(1) << (t.sig + t.exp)) val cmd_fma = io.in.bits.ren3 val cmd_addsub = io.in.bits.swap23 in := io.in.bits when (cmd_addsub) { in.in2 := one } when (!(cmd_fma || cmd_addsub)) { in.in3 := zero } } val fma = Module(new MulAddRecFNPipe((latency-1) min 2, t.exp, t.sig)) fma.io.validin := valid fma.io.op := in.fmaCmd fma.io.roundingMode := in.rm fma.io.detectTininess := hardfloat.consts.tininess_afterRounding fma.io.a := in.in1 fma.io.b := in.in2 fma.io.c := in.in3 val res = Wire(new FPResult) res.data := sanitizeNaN(fma.io.out, t) res.exc := fma.io.exceptionFlags io.out := Pipe(fma.io.validout, res, (latency-3) max 0) } @chiselName class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) { val io = new FPUIO val useClockGating = coreParams match { case r: RocketCoreParams => r.clockGate case _ => false } val clock_en_reg = Reg(Bool()) val clock_en = clock_en_reg || io.cp_req.valid val gated_clock = if (!useClockGating) clock else ClockGate(clock, clock_en, "fpu_clock_gate") val fp_decoder = Module(new FPUDecoder) fp_decoder.io.inst := io.inst val id_ctrl = fp_decoder.io.sigs val ex_reg_valid = Reg(next=io.valid, init=Bool(false)) val ex_reg_inst = RegEnable(io.inst, io.valid) val ex_reg_ctrl = RegEnable(id_ctrl, io.valid) val ex_ra = List.fill(3)(Reg(UInt())) // load response val load_wb = Reg(next=io.dmem_resp_val) val load_wb_typeTag = RegEnable(io.dmem_resp_type(1,0) - typeTagWbOffset, io.dmem_resp_val) val load_wb_data = RegEnable(io.dmem_resp_data, io.dmem_resp_val) val load_wb_tag = RegEnable(io.dmem_resp_tag, io.dmem_resp_val) @chiselName class FPUImpl extends NoChiselNamePrefix { // entering gated-clock domain val req_valid = ex_reg_valid || io.cp_req.valid val ex_cp_valid = io.cp_req.fire() val mem_cp_valid = Reg(next=ex_cp_valid, init=Bool(false)) val wb_cp_valid = Reg(next=mem_cp_valid, init=Bool(false)) val mem_reg_valid = RegInit(false.B) val killm = (io.killm || io.nack_mem) && !mem_cp_valid // Kill X-stage instruction if M-stage is killed. This prevents it from // speculatively being sent to the div-sqrt unit, which can cause priority // inversion for two back-to-back divides, the first of which is killed. val killx = io.killx || mem_reg_valid && killm mem_reg_valid := ex_reg_valid && !killx || ex_cp_valid val mem_reg_inst = RegEnable(ex_reg_inst, ex_reg_valid) val wb_reg_valid = Reg(next=mem_reg_valid && (!killm || mem_cp_valid), init=Bool(false)) val cp_ctrl = Wire(new FPUCtrlSigs) cp_ctrl <> io.cp_req.bits io.cp_resp.valid := Bool(false) io.cp_resp.bits.data := UInt(0) val ex_ctrl = Mux(ex_cp_valid, cp_ctrl, ex_reg_ctrl) val mem_ctrl = RegEnable(ex_ctrl, req_valid) val wb_ctrl = RegEnable(mem_ctrl, mem_reg_valid) // CoreMonitorBundle to monitor fp register file writes val frfWriteBundle = Seq.fill(2)(WireInit(new CoreMonitorBundle(xLen, fLen), DontCare)) frfWriteBundle.foreach { i => i.clock := clock i.reset := reset i.hartid := io.hartid i.timer := io.time(31,0) i.valid := false.B i.wrenx := false.B i.wrenf := false.B i.excpt := false.B } // regfile val regfile = Mem(32, Bits(width = fLen+1)) when (load_wb) { val wdata = recode(load_wb_data, load_wb_typeTag) regfile(load_wb_tag) := wdata assert(consistent(wdata)) if (enableCommitLog) printf("f%d p%d 0x%x\n", load_wb_tag, load_wb_tag + 32, load_wb_data) frfWriteBundle(0).wrdst := load_wb_tag frfWriteBundle(0).wrenf := true.B frfWriteBundle(0).wrdata := ieee(wdata) } val ex_rs = ex_ra.map(a => regfile(a)) when (io.valid) { when (id_ctrl.ren1) { when (!id_ctrl.swap12) { ex_ra(0) := io.inst(19,15) } when (id_ctrl.swap12) { ex_ra(1) := io.inst(19,15) } } when (id_ctrl.ren2) { when (id_ctrl.swap12) { ex_ra(0) := io.inst(24,20) } when (id_ctrl.swap23) { ex_ra(2) := io.inst(24,20) } when (!id_ctrl.swap12 && !id_ctrl.swap23) { ex_ra(1) := io.inst(24,20) } } when (id_ctrl.ren3) { ex_ra(2) := io.inst(31,27) } } val ex_rm = Mux(ex_reg_inst(14,12) === Bits(7), io.fcsr_rm, ex_reg_inst(14,12)) def fuInput(minT: Option[FType]): FPInput = { val req = Wire(new FPInput) val tag = ex_ctrl.typeTagIn req := ex_ctrl req.rm := ex_rm req.in1 := unbox(ex_rs(0), tag, minT) req.in2 := unbox(ex_rs(1), tag, minT) req.in3 := unbox(ex_rs(2), tag, minT) req.typ := ex_reg_inst(21,20) req.fmt := ex_reg_inst(26,25) req.fmaCmd := ex_reg_inst(3,2) | (!ex_ctrl.ren3 && ex_reg_inst(27)) when (ex_cp_valid) { req := io.cp_req.bits when (io.cp_req.bits.swap23) { req.in2 := io.cp_req.bits.in3 req.in3 := io.cp_req.bits.in2 } } req } val sfma = Module(new FPUFMAPipe(cfg.sfmaLatency, FType.S)) sfma.io.in.valid := req_valid && ex_ctrl.fma && ex_ctrl.typeTagOut === S sfma.io.in.bits := fuInput(Some(sfma.t)) val fpiu = Module(new FPToInt) fpiu.io.in.valid := req_valid && (ex_ctrl.toint || ex_ctrl.div || ex_ctrl.sqrt || (ex_ctrl.fastpipe && ex_ctrl.wflags)) fpiu.io.in.bits := fuInput(None) io.store_data := fpiu.io.out.bits.store io.toint_data := fpiu.io.out.bits.toint when(fpiu.io.out.valid && mem_cp_valid && mem_ctrl.toint){ io.cp_resp.bits.data := fpiu.io.out.bits.toint io.cp_resp.valid := Bool(true) } val ifpu = Module(new IntToFP(2)) ifpu.io.in.valid := req_valid && ex_ctrl.fromint ifpu.io.in.bits := fpiu.io.in.bits ifpu.io.in.bits.in1 := Mux(ex_cp_valid, io.cp_req.bits.in1, io.fromint_data) val fpmu = Module(new FPToFP(2)) fpmu.io.in.valid := req_valid && ex_ctrl.fastpipe fpmu.io.in.bits := fpiu.io.in.bits fpmu.io.lt := fpiu.io.out.bits.lt val divSqrt_wen = Wire(init = false.B) val divSqrt_inFlight = Wire(init = false.B) val divSqrt_waddr = Reg(UInt(width = 5)) val divSqrt_typeTag = Wire(UInt(width = log2Up(floatTypes.size))) val divSqrt_wdata = Wire(UInt(width = fLen+1)) val divSqrt_flags = Wire(UInt(width = FPConstants.FLAGS_SZ)) // writeback arbitration case class Pipe(p: Module, lat: Int, cond: (FPUCtrlSigs) => Bool, res: FPResult) val pipes = List( Pipe(fpmu, fpmu.latency, (c: FPUCtrlSigs) => c.fastpipe, fpmu.io.out.bits), Pipe(ifpu, ifpu.latency, (c: FPUCtrlSigs) => c.fromint, ifpu.io.out.bits), Pipe(sfma, sfma.latency, (c: FPUCtrlSigs) => c.fma && c.typeTagOut === S, sfma.io.out.bits)) ++ (fLen > 32).option({ val dfma = Module(new FPUFMAPipe(cfg.dfmaLatency, FType.D)) dfma.io.in.valid := req_valid && ex_ctrl.fma && ex_ctrl.typeTagOut === D dfma.io.in.bits := fuInput(Some(dfma.t)) Pipe(dfma, dfma.latency, (c: FPUCtrlSigs) => c.fma && c.typeTagOut === D, dfma.io.out.bits) }) ++ (minFLen == 16).option({ val hfma = Module(new FPUFMAPipe(cfg.sfmaLatency, FType.H)) hfma.io.in.valid := req_valid && ex_ctrl.fma && ex_ctrl.typeTagOut === H hfma.io.in.bits := fuInput(Some(hfma.t)) Pipe(hfma, hfma.latency, (c: FPUCtrlSigs) => c.fma && c.typeTagOut === H, hfma.io.out.bits) }) def latencyMask(c: FPUCtrlSigs, offset: Int) = { require(pipes.forall(_.lat >= offset)) pipes.map(p => Mux(p.cond(c), UInt(1 << p.lat-offset), UInt(0))).reduce(_|_) } def pipeid(c: FPUCtrlSigs) = pipes.zipWithIndex.map(p => Mux(p._1.cond(c), UInt(p._2), UInt(0))).reduce(_|_) val maxLatency = pipes.map(_.lat).max val memLatencyMask = latencyMask(mem_ctrl, 2) class WBInfo extends Bundle { val rd = UInt(width = 5) val typeTag = UInt(width = log2Up(floatTypes.size)) val cp = Bool() val pipeid = UInt(width = log2Ceil(pipes.size)) override def cloneType: this.type = new WBInfo().asInstanceOf[this.type] } val wen = Reg(init=Bits(0, maxLatency-1)) val wbInfo = Reg(Vec(maxLatency-1, new WBInfo)) val mem_wen = mem_reg_valid && (mem_ctrl.fma || mem_ctrl.fastpipe || mem_ctrl.fromint) val write_port_busy = RegEnable(mem_wen && (memLatencyMask & latencyMask(ex_ctrl, 1)).orR || (wen & latencyMask(ex_ctrl, 0)).orR, req_valid) ccover(mem_reg_valid && write_port_busy, "WB_STRUCTURAL", "structural hazard on writeback") for (i <- 0 until maxLatency-2) { when (wen(i+1)) { wbInfo(i) := wbInfo(i+1) } } wen := wen >> 1 when (mem_wen) { when (!killm) { wen := wen >> 1 | memLatencyMask } for (i <- 0 until maxLatency-1) { when (!write_port_busy && memLatencyMask(i)) { wbInfo(i).cp := mem_cp_valid wbInfo(i).typeTag := mem_ctrl.typeTagOut wbInfo(i).pipeid := pipeid(mem_ctrl) wbInfo(i).rd := mem_reg_inst(11,7) } } } val waddr = Mux(divSqrt_wen, divSqrt_waddr, wbInfo(0).rd) val wtypeTag = Mux(divSqrt_wen, divSqrt_typeTag, wbInfo(0).typeTag) val wdata = box(Mux(divSqrt_wen, divSqrt_wdata, (pipes.map(_.res.data): Seq[UInt])(wbInfo(0).pipeid)), wtypeTag) val wexc = (pipes.map(_.res.exc): Seq[UInt])(wbInfo(0).pipeid) when ((!wbInfo(0).cp && wen(0)) || divSqrt_wen) { assert(consistent(wdata)) regfile(waddr) := wdata if (enableCommitLog) { printf("f%d p%d 0x%x\n", waddr, waddr + 32, ieee(wdata)) } frfWriteBundle(1).wrdst := waddr frfWriteBundle(1).wrenf := true.B frfWriteBundle(1).wrdata := ieee(wdata) } when (wbInfo(0).cp && wen(0)) { io.cp_resp.bits.data := wdata io.cp_resp.valid := Bool(true) } io.cp_req.ready := !ex_reg_valid val wb_toint_valid = wb_reg_valid && wb_ctrl.toint val wb_toint_exc = RegEnable(fpiu.io.out.bits.exc, mem_ctrl.toint) io.fcsr_flags.valid := wb_toint_valid || divSqrt_wen || wen(0) io.fcsr_flags.bits := Mux(wb_toint_valid, wb_toint_exc, UInt(0)) | Mux(divSqrt_wen, divSqrt_flags, UInt(0)) | Mux(wen(0), wexc, UInt(0)) val divSqrt_write_port_busy = (mem_ctrl.div || mem_ctrl.sqrt) && wen.orR io.fcsr_rdy := !(ex_reg_valid && ex_ctrl.wflags || mem_reg_valid && mem_ctrl.wflags || wb_reg_valid && wb_ctrl.toint || wen.orR || divSqrt_inFlight) io.nack_mem := write_port_busy || divSqrt_write_port_busy || divSqrt_inFlight io.dec <> fp_decoder.io.sigs def useScoreboard(f: ((Pipe, Int)) => Bool) = pipes.zipWithIndex.filter(_._1.lat > 3).map(x => f(x)).fold(Bool(false))(_||_) io.sboard_set := wb_reg_valid && !wb_cp_valid && Reg(next=useScoreboard(_._1.cond(mem_ctrl)) || mem_ctrl.div || mem_ctrl.sqrt) io.sboard_clr := !wb_cp_valid && (divSqrt_wen || (wen(0) && useScoreboard(x => wbInfo(0).pipeid === UInt(x._2)))) io.sboard_clra := waddr ccover(io.sboard_clr && load_wb, "DUAL_WRITEBACK", "load and FMA writeback on same cycle") // we don't currently support round-max-magnitude (rm=4) io.illegal_rm := io.inst(14,12).isOneOf(5, 6) || io.inst(14,12) === 7 && io.fcsr_rm >= 5 if (cfg.divSqrt) { val divSqrt_inValid = mem_reg_valid && (mem_ctrl.div || mem_ctrl.sqrt) && !divSqrt_inFlight val divSqrt_killed = RegNext(divSqrt_inValid && killm, true.B) when (divSqrt_inValid) { divSqrt_waddr := mem_reg_inst(11,7) } ccover(divSqrt_inFlight && divSqrt_killed, "DIV_KILLED", "divide killed after issued to divider") ccover(divSqrt_inFlight && mem_reg_valid && (mem_ctrl.div || mem_ctrl.sqrt), "DIV_BUSY", "divider structural hazard") ccover(mem_reg_valid && divSqrt_write_port_busy, "DIV_WB_STRUCTURAL", "structural hazard on division writeback") for (t <- floatTypes) { val tag = mem_ctrl.typeTagOut val divSqrt = withReset(divSqrt_killed) { Module(new hardfloat.DivSqrtRecFN_small(t.exp, t.sig, 0)) } divSqrt.io.inValid := divSqrt_inValid && tag === typeTag(t) divSqrt.io.sqrtOp := mem_ctrl.sqrt divSqrt.io.a := maxType.unsafeConvert(fpiu.io.out.bits.in.in1, t) divSqrt.io.b := maxType.unsafeConvert(fpiu.io.out.bits.in.in2, t) divSqrt.io.roundingMode := fpiu.io.out.bits.in.rm divSqrt.io.detectTininess := hardfloat.consts.tininess_afterRounding when (!divSqrt.io.inReady) { divSqrt_inFlight := true } // only 1 in flight when (divSqrt.io.outValid_div || divSqrt.io.outValid_sqrt) { divSqrt_wen := !divSqrt_killed divSqrt_wdata := sanitizeNaN(divSqrt.io.out, t) divSqrt_flags := divSqrt.io.exceptionFlags divSqrt_typeTag := typeTag(t) } } when (divSqrt_killed) { divSqrt_inFlight := false } } else { when (id_ctrl.div || id_ctrl.sqrt) { io.illegal_rm := true } } // gate the clock clock_en_reg := !useClockGating || io.keep_clock_enabled || // chicken bit io.valid || // ID stage req_valid || // EX stage mem_reg_valid || mem_cp_valid || // MEM stage wb_reg_valid || wb_cp_valid || // WB stage wen.orR || divSqrt_inFlight || // post-WB stage io.dmem_resp_val // load writeback } // leaving gated-clock domain val fpuImpl = withClock (gated_clock) { new FPUImpl } def ccover(cond: Bool, label: String, desc: String)(implicit sourceInfo: SourceInfo) = cover(cond, s"FPU_$label", "Core;;" + desc) }
namespace NServiceBus.Hosting.Windows.LoggingHandlers { using NServiceBus.Hosting.Profiles; /// <summary> /// Handles logging configuration for the <see cref="Integration"/> profile. /// </summary> class IntegrationLoggingHandler : IConfigureLoggingForProfile<Integration> { public void Configure(IConfigureThisEndpoint specifier) { } } }
// Copyright 2020 GC (2012 ETC) Nabute and Nahom. All rights reserved. // Use of this source code is governed by MIT license, which can be found // in the LICENSE file. part of abushakir; /// /// The Ethiopian calendar is one of the the calendars which uses the solar /// system to reckon years, months and days, even time. Ethiopian single year /// consists of 365.25 days which will be 366 days with in 4 years period which /// causes the leap year. Ethiopian calendar has 13 months from which 12 months /// are full 30 days each and the 13th month will be 5 days or 6 days during /// leap year. /// /// /// Create [ETC] object instances which are days of certain month in a certain /// year, using one of the constructors. /// /// ``` /// ETC etc = ETC(year: 2012, month: 7, day: 4); /// ``` /// /// or /// /// ``` /// ETC today = ETC.today(); /// ``` /// /// After creating instance of [ETC], you can navigate to the future or past /// of the given date. /// /// ``` /// ETC _nextMonth = today.nextMonth; /// ETC _prevMonth = today.prevMonth; /// ``` /// /// you can also get the same month of different year (the next year or /// prev one) /// /// ``` /// ETC _nextYear = today.nextYear; /// ETC _prevYear = today.prevYear; /// ``` /// /// All the available days within a single month can be found using /// /// ``` /// var monthDaysIter = today.monthDays(); /// ``` /// /// or just all of the days available in the given year can also be found using /// ``` /// var yearDaysIter = today.yearDays(); /// ``` /// /// class ETC implements Calendar { final EtDatetime _date; /// /// Construct an [ETC] instance. /// /// For example. to create a new [ETC] object representing the 1st of ጷጉሜን 2011, /// /// /// ``` /// var etc = ETC(year: 2011, month: 13, day: 1); /// ``` /// /// /// Month and day are optional, if not provided ETC will assume the first /// day of the first month of the given year. /// /// ETC({int year, int month = 1, int day = 1}) : _date = EtDatetime(year: year, month: month, day: day); /// /// Construct an [ETC] instance of the day the object is created. /// /// ``` /// var today = ETC.today(); /// ``` /// ETC.today() : _date = EtDatetime.now(); /// /// Getter property that return year of the current [ETC] instance. /// int get year => _date.year; /// /// Getter property that return month of the current [ETC] instance. /// int get month => _date.month; /// /// Getter property that return day of the current [ETC] instance. /// int get day => _date.day; /// /// All Month names ["መስከረም", "ጥቅምት", ... ,"ጷጉሜን"] /// List get allMonths => _months; /// /// All Days number in Ge'ez ["፩", "፪", ... , "፴"] /// List get dayNumbers => _dayNumbers; /// /// All Day names ["ሰኞ", "ማግሰኞ", ... , "እሁድ"] /// List get weekdays => _weekdays; /// /// Getter property that return the month name for the current [ETC] /// instance. /// String get monthName => _date.monthGeez; /// /// Returning [ETC] instance of same year with a month next to this. /// ETC get nextMonth => ETC(year: _date.year, month: _date.month + 1); /// /// Returning [ETC] instance of same year with a month previous to this. /// ETC get prevMonth => ETC( year: _date.month == 1 ? _date.year - 1 : _date.year, month: _date.month - 1 == 0 ? 13 : _date.month - 1); /// /// Returning [ETC] instance of same month with a year next to this. /// ETC get nextYear => ETC(year: _date.year + 1, month: _date.month); /// /// Returning [ETC] instance of same month with a year previous to this. /// ETC get prevYear => ETC(year: _date.year - 1, month: _date.month); /// /// Returns month range and monthStartDay as an array. /// List<int> _monthRange() { if (_date.month <= 1 && _date.month >= 13) throw MonthNumberException; return [_date.weekday, _date.month == 13 ? _date.isLeap ? 6 : 5 : 30]; } /// /// Returns [Iterable] object of [List] which looks like: /// /// ``` /// [year, month, day, weekday] /// ``` /// /// Where: all are integer values representing [year], [month], [day] and /// weekday respectively. The weekday can be returned in day name or just /// index of the day, assuming ሰኞ as the first day of the week with index of 0. /// /// ``` /// // const List<String> _weekdays = ["ሰኞ", "ማግሰኞ", "ረቡዕ", "ሐሙስ", "አርብ", "ቅዳሜ", "እሁድ"]; /// /// etc.monthDays(weekDayName: true); // => [2011, 13, 1, አርብ] /// /// ``` /// /// The day number in Geez can also be returned by passing geezDay parameter. /// /// ``` /// // Days of ጷጉሜን in 2011 /// // ["፩", "፪", "፫", "፬", "፭", "፮"] /// // [2011, 13, ፮, ረቡዕ] /// /// etc.monthDays(geezDay: true, weekDayName: true); // => [2011, 13, ፮, ረቡዕ] /// /// ``` /// Iterable<List<dynamic>> monthDays( {bool geezDay = false, bool weekDayName = false}) sync* { int monthBeginning = _monthRange()[0]; int daysInMonth = _monthRange()[1]; for (int i = 0; i < daysInMonth; i++) { if (geezDay) { yield [ _date.year, _date.month, _dayNumbers[i], weekDayName ? _weekdays[monthBeginning] : monthBeginning ]; } else yield [ _date.year, _date.month, i + 1, weekDayName ? _weekdays[monthBeginning] : monthBeginning ]; monthBeginning = (monthBeginning + 1) % 7; } } /// /// Similar method as monthDays but the difference is this one will take /// year and month as a parameter and then generate all available days of /// the given month of the year. /// /// This method is used by yearDays for generating all available days /// for the whole year. /// Iterable<List<dynamic>> _monthDays(int year, int month, {bool geezDay: false, bool weekDayName: false}) sync* { EtDatetime yr = EtDatetime(year: year, month: month); int monthBeginning = yr.weekday; int daysInMonth = yr.month == 13 ? yr.isLeap ? 6 : 5 : 30; for (int i = 0; i < daysInMonth; i++) { if (geezDay) { yield [ year, month, _dayNumbers[i], weekDayName ? _weekdays[monthBeginning] : monthBeginning ]; } else yield [ year, month, i + 1, weekDayName ? _weekdays[monthBeginning] : monthBeginning ]; monthBeginning = (monthBeginning + 1) % 7; } } /// /// Method that can be used to generate all the available days of the [year]. /// /// The weekday can be returned in day name or just index of the day, /// assuming ሰኞ as the first day of the week with index of 0. /// /// ``` /// // const List<String> _weekdays = ["ሰኞ", "ማግሰኞ", "ረቡዕ", "ሐሙስ", "አርብ", "ቅዳሜ", "እሁድ"]; /// /// etc.yearDays(weekDayName: true); // => [2011, 13, 1, አርብ] /// /// ``` /// /// The day number in Geez can also be returned by passing geezDay parameter. /// /// ``` /// // Days of ጷጉሜን in 2011 /// // ["፩", "፪", "፫", "፬", "፭", "፮"] /// // [2011, 13, ፮, ረቡዕ] /// /// etc.monthDays(geezDay: true, weekDayName: true); // => [2011, 13, ፮, ረቡዕ] /// /// ``` /// /// Iterable<Iterable<List<dynamic>>> yearDays( {bool geezDay: false, bool weekDayName: false}) sync* { for (int i = 0; i < _months.length; i++) { yield _monthDays(_date.year, i + 1, geezDay: geezDay, weekDayName: weekDayName); } } @override List<Object> get props => [year, month, day]; @override bool get stringify => true; }
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. // Layers export * from './layers/Layer.js'; export * from './layers/Marker.js'; export * from './layers/Icon.js'; export * from './layers/AwesomeIcon.js'; export * from './layers/Popup.js'; export * from './layers/RasterLayer.js'; export * from './layers/TileLayer.js'; export * from './layers/VectorTileLayer.js'; export * from './layers/LocalTileLayer.js'; export * from './layers/WMSLayer.js'; export * from './layers/MagnifyingGlass.js'; export * from './layers/ImageOverlay.js'; export * from './layers/VideoOverlay.js'; export * from './layers/Velocity.js'; export * from './layers/Heatmap.js'; export * from './layers/VectorLayer.js'; export * from './layers/Path.js'; export * from './layers/AntPath.js'; export * from './layers/Polyline.js'; export * from './layers/Polygon.js'; export * from './layers/Rectangle.js'; export * from './layers/CircleMarker.js'; export * from './layers/Circle.js'; export * from './layers/MarkerCluster.js'; export * from './layers/LayerGroup.js'; export * from './layers/FeatureGroup.js'; export * from './layers/GeoJSON.js'; export * from './layers/DivIcon.js'; //Controls export * from './controls/AttributionControl.js'; export * from './controls/Control.js'; export * from './controls/SplitMapControl.js'; export * from './controls/LayersControl.js'; export * from './controls/MeasureControl.js'; export * from './controls/DrawControl.js'; export * from './controls/FullScreenControl.js'; export * from './controls/WidgetControl.js'; export * from './controls/ZoomControl.js'; export * from './controls/ScaleControl.js'; export * from './controls/LegendControl.js'; export * from './controls/SearchControl.js'; //Map export * from './Map.js'; // Load css require('leaflet/dist/leaflet.css'); require('leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css'); // Re-uses images from ~leaflet package require('leaflet-draw/dist/leaflet.draw.css'); require('leaflet.markercluster/dist/MarkerCluster.css'); require('leaflet.markercluster/dist/MarkerCluster.Default.css'); require('leaflet-measure/dist/leaflet-measure.css'); require('leaflet-fullscreen/dist/leaflet.fullscreen.css'); require('leaflet.awesome-markers/dist/leaflet.awesome-markers.css'); require('spin.js/spin.css'); require('./jupyter-leaflet.css'); require('leaflet-search/dist/leaflet-search.src.css');
import React from 'react'; import NavbarQuery from '../query/navbarquery'; function Layout(){ return ( <NavbarQuery/> ) } export {Layout};
#include "fy.h" #include "typy.h" #include <assert.h> y_Class::y_Class(void) { RodzajWej = 'B'; RodzajWyj = 'M'; OtherProcess = NULL; } void y_Class::LocalDestructor(void) { if(NextProcess != NULL) { NextProcess->LocalDestructor(); delete NextProcess; NextProcess = NULL; } if(OtherProcess != NULL) { OtherProcess->LocalDestructor(); delete OtherProcess; OtherProcess = NULL; } } int y_Class::Init(int, char *[]) { /* Zużywamy tylko jeden argument, a nie potrzebujemy się specjalnie * inicjalizować */ return 1; } int y_Class::Work(int kmn, Byte * poczatek, int ile) { int status; status = RESULT_EOF; switch(kmn) { case SAND_OFF: { status = Obsluga_SAND_OFF(kmn, poczatek, ile); break; } case SAND_EOF: { status = Obsluga_SAND_EOF(kmn, poczatek, ile); break; } case SAND_SR: { status = Obsluga_SAND_SR(kmn, poczatek, ile); break; } default: { SygErrorParm("Nieznany typ komunikatu: %d", kmn); ZmienStan(STATE_OFF, KIER_INNY); status = RESULT_OFF; break; } } return status; } ProcessClass * y_Class::FindUnusedPointer(void) { ProcessClass * tmp; tmp = NULL; if(NextProcess != NULL) { tmp = NextProcess->FindUnusedPointer(); if(tmp == NULL) { if(OtherProcess != NULL) { tmp = OtherProcess->FindUnusedPointer(); } else { if(RodzajWyj == 'M' || RodzajWyj == 'B') { tmp = this; } } } } else { if(RodzajWyj == 'M' || RodzajWyj == 'B') { tmp = this; } } return tmp; } /* Podłącza w wolne miejsce wskaźnik następnego procesu. Wartość zwracana: 1 - OK, 0 - błąd */ int y_Class::ConnectPointer(ProcessClass * proc) { int status; status = 0; if(NextProcess == NULL) { NextProcess = proc; proc->PrevProcess = this; status = 1; } else { if(OtherProcess == NULL) { OtherProcess = proc; proc->PrevProcess = this; status = 1; } else { SygError("Proces twierdził, że ma miejsce na podłączenie następnego?"); } } return status; } /* Zmienia stan obiektu na podany. Jeśli to jest zmiana na STATE_OFF, to od razu powiadamia sąsiadów z obu stron. */ void y_Class::ZmienStan(int nowy, int kier) { assert(nowy == STATE_OFF || nowy == STATE_EOF); assert(kier == KIER_PROSTO || kier == KIER_WSTECZ || kier == KIER_INNY); if(nowy == STATE_OFF) { if(State != nowy) { State = nowy; if(kier != KIER_WSTECZ) { if(NextProcess != NULL) { NextProcess->Work(SAND_OFF, NULL, KIER_PROSTO); } if(OtherProcess != NULL) { OtherProcess->Work(SAND_OFF, NULL, KIER_PROSTO); } } } } else { State = nowy; } } int y_Class::Obsluga_SAND_OFF(int kmn, Byte * poczatek, int ile) { ZmienStan(STATE_OFF, ile); return RESULT_OFF; } int y_Class::Obsluga_SAND_EOF(int kmn, Byte * poczatek, int ile) { ZmienStan(STATE_EOF, KIER_PROSTO); assert(poczatek == NULL); assert(ile == KIER_PROSTO); NextProcess->Work(kmn, poczatek, ile); OtherProcess->Work(kmn, poczatek, ile); return RESULT_EOF; /* To chyba nie jest istotne, bo na to nikt nie czeka */ } int y_Class::Obsluga_SAND_SR(int kmn, Byte * poczatek, int ile) { int status; int r1, r2, suma; assert(poczatek != NULL); assert(ile > 0); status = RESULT_OFF; /* Jeśli coś nie wyjdzie, to od razu zrywamy łańcuch */ if(State != STATE_OFF) { r1 = NextProcess->Work(kmn, poczatek, ile); if(r1 != RESULT_OFF) { assert(r1 >= 0); if(r1 != 0) { suma = 0; status = r1; /* Wstępnie zwracamy liczbę przetworzonych bajtów */ do { r2 = OtherProcess->Work(kmn, poczatek, r1 - suma); if(r2 != RESULT_OFF) { assert(r2 >= 0); assert(r2 > 0); /* Dwie asercje, żeby wykryć przypadek zera */ suma += r2; assert(suma <= r1); } else { SygError("Drugi proces zawiódł"); ZmienStan(STATE_OFF, KIER_INNY); status = RESULT_OFF; break; /* Wyjście z pętli do {} while (); */ } } while(suma < r1); } else { /* Nie zjadł ani bajta - dlaczego? */ SygError("Nie zostały pobrane żadne dane"); ZmienStan(STATE_OFF, KIER_INNY); } } else { ZmienStan(STATE_OFF, KIER_INNY); } } return status; } /* Tworzenie nowych wątków dla obsługi systemu i budzenie ich. Wartość zwrotna: 1 - OK (udało się pomyślnie utworzyć nowe wątki), 0 - błąd (możemy kończyć pracę systemu, bo się nie udał przydział wątków */ int y_Class::Rozszczepianie(void) { int status; status = 1; /* Tak ogólnie niczego nie trzeba rozszczepiać */ if(NextProcess != NULL) { status = NextProcess->Rozszczepianie(); if(status == 1) { if(OtherProcess != NULL) { status = OtherProcess->Rozszczepianie(); } } } return status; }
// Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 package com.digitalasset.app.bot import com.daml.ledger.rxjava.components.LedgerViewFlowable import com.daml.ledger.javaapi.data._ import com.digitalasset.app.LedgerClient import com.digitalasset.app.utils.Cdm import com.digitalasset.app.utils.Record._ import scala.collection.JavaConverters._ // Bot which cleans up old derived events class DerivedEvents(party: String, ledgerClient: LedgerClient) extends Bot(party, ledgerClient) { def name: String = "Bot - DerivedEvents " + party def templateFilter = Set("ContractInstance", "DerivedEvent") def run(getTid: String => Identifier, ledgerView: LedgerViewFlowable.LedgerView[Record]): List[Command] = { val ciTid = getTid("ContractInstance") val edTid = getTid("DerivedEvent") val cis = ledgerView.getContracts(ciTid).asScala.toList val contractIdt2eds = ledgerView.getContracts(edTid).asScala.toList.groupBy(_._2.get[Record]("contractIdentifier")) val ciCid2contractIdt = cis.flatMap { ci => val parties = ci._2.getList[Record]("ps") val idts = ci._2.get[Record]("d").getList[Record]("contractIdentifier") Cdm.getIdentifierByParty(party, parties, idts).map(x => (ci._1, x)) }.toMap // Remove results if corresponding contract does not exist anymore val cmds = contractIdt2eds.flatMap{ case (contractIdt, edsGrouped) if !ciCid2contractIdt.values.toList.contains(contractIdt) => logger.info("Cleaning up result ...") edsGrouped.map(ed => new ExerciseCommand(edTid, ed._1, "Archive", Cdm.archiveArg)) case _ => List() }.toList cmds } }
namespace DynamicDecorator { public class Circle : IShape { private float radius; public Circle(float radius) { this.radius = radius; } public void Resize(float factor) { radius *= factor; } public string Display() { return $"A circle with radius {radius}"; } } }
package middleware import ( "context" "net/http" "strings" "github.com/dgrijalva/jwt-go" log "github.com/sirupsen/logrus" ) const ( // Store this as environment variable in the future Secret = "the-todanni-secret" // This isn't used anywhere... yet Issuer = "todanni-user-servers" // Encryption cost Cost = 14 ) type ToDanniClaims struct { jwt.StandardClaims UserInfo UserClaims `json:"user_info"` } type UserClaims struct { UserID int `json:"user_id"` Email string `json:"email"` } type HTTPReqInfo struct { // GET etc. method string uri string referer string userAgent string body string } func LoggingMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { reqInfo := &HTTPReqInfo{ method: r.Method, uri: r.URL.String(), referer: r.Header.Get("Referer"), userAgent: r.Header.Get("User-Agent"), } log.Println("Testing logging") log.Println(reqInfo) next.ServeHTTP(w, r) }) } // Middleware function, which will be called for each request func Middleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { tkn := r.Header.Get("Authorization") splitToken := strings.Split(tkn, "Bearer ") if len(splitToken) < 2 { http.Error(w, "Missing Auth Token", http.StatusUnauthorized) return } tkn = splitToken[1] if ctx, ok := IsValid(tkn, r.Context()); !ok { // Write an error and stop the handler chain http.Error(w, "Forbidden", http.StatusForbidden) return } else { // We found the token in our map log.Printf("Authenticated token %s", tkn) // TODO: Instead of the whole token, just send the user ID req := r.WithContext(ctx) next.ServeHTTP(w, req) } }) } func IsValid(tokenString string, ctx context.Context) (context.Context, bool) { token, err := jwt.ParseWithClaims(tokenString, &ToDanniClaims{}, keyFunc) if err != nil { log.Error(err) return ctx, false } if clms, ok := token.Claims.(*ToDanniClaims); ok && token.Valid { return context.WithValue(ctx, "user_id", clms.UserInfo.UserID), true } log.Error(err) return ctx, false } func keyFunc(token *jwt.Token) (interface{}, error) { // TODO: later the "kid" can be used to check the version of the key used to sign the JWT // This will come in handy when key rotation is implemented. return []byte(Secret), nil }
package com.fsh.common.widget.mpchart.render import com.fsh.common.widget.mpchart.CombinedChartView import com.github.mikephil.charting.animation.ChartAnimator import com.github.mikephil.charting.charts.CombinedChart import com.github.mikephil.charting.renderer.BubbleChartRenderer import com.github.mikephil.charting.renderer.CombinedChartRenderer import com.github.mikephil.charting.renderer.ScatterChartRenderer import com.github.mikephil.charting.utils.ViewPortHandler class CombinedChartViewRender( chart: CombinedChart?, animator: ChartAnimator?, viewPortHandler: ViewPortHandler? ) : CombinedChartRenderer(chart, animator, viewPortHandler) { var mCandleStickChartRenderer: CandleStickChartViewRender? = null override fun createRenderers() { mRenderers.clear() val chart = mChart.get() ?: return val drawerOrders = (chart as CombinedChartView).drawOrder for (order in drawerOrders) { when (order) { CombinedChart.DrawOrder.BAR -> { if (chart.barData != null) { mRenderers.add(BarChartViewRender(chart, mAnimator, mViewPortHandler)) } } CombinedChart.DrawOrder.BUBBLE -> { if (chart.bubbleData != null) mRenderers.add(BubbleChartRenderer(chart, mAnimator, mViewPortHandler)) } CombinedChart.DrawOrder.LINE -> { if (chart.lineData != null) mRenderers.add(LineChartViewRender(chart, mAnimator, mViewPortHandler)) } CombinedChart.DrawOrder.CANDLE -> { if (chart.candleData != null) { mCandleStickChartRenderer = CandleStickChartViewRender(chart, mAnimator, mViewPortHandler) mRenderers.add(mCandleStickChartRenderer) } } CombinedChart.DrawOrder.SCATTER -> { if (chart.scatterData != null) mRenderers.add(ScatterChartRenderer(chart, mAnimator, mViewPortHandler)) } } } } }
package de.qhun.declaration_provider.generator.typescript import de.qhun.declaration_provider.domain.Declaration import de.qhun.declaration_provider.domain.Documentation data class NamespacedDeclaration( override val name: String, override val score: Int, override val documentation: Documentation?, override val deprecated: Boolean?, override val namespace: String?, val declarations: List<Declaration> ) : Declaration
import { NgModule } from '@angular/core'; import { NbActionsModule, NbButtonModule, NbCardModule, NbCheckboxModule, NbDatepickerModule, NbIconModule, NbInputModule, NbRadioModule, NbSelectModule, NbUserModule, NbSpinnerModule, NbListModule } from '@nebular/theme'; import { ThemeModule } from '../../@theme/theme.module'; import { RestauranteRoutingModule } from './restaurante-routing.module'; import { RestauranteComponent } from './restaurante.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AgregarRestauranteComponent } from './agregar-restaurante/agregar-restaurante.component'; import { EditarClasificacionComponent } from './editar-clasificacion/editar-clasificacion.component'; import { EditarCategoriaComponent } from './editar-categoria/editar-categoria.component'; import { ListaRestaurantesComponent } from './lista-restaurantes/lista-restaurantes.component'; import { RestauranteDetalleComponent } from './restaurante-detalle/restaurante-detalle.component'; @NgModule({ imports: [ ThemeModule, NbInputModule, NbCardModule, NbButtonModule, NbActionsModule, NbUserModule, NbCheckboxModule, NbRadioModule, NbDatepickerModule, NbListModule, RestauranteRoutingModule, NbSelectModule, NbIconModule, NbSpinnerModule, FormsModule, ReactiveFormsModule ], declarations: [ RestauranteComponent, AgregarRestauranteComponent, EditarClasificacionComponent, EditarCategoriaComponent, ListaRestaurantesComponent, RestauranteDetalleComponent ], }) export class RestauranteModule { }
package org.kie.server.services.api; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.kie.server.api.commands.CommandScript; import org.kie.server.api.model.KieContainerResource; import org.kie.server.api.model.KieScannerResource; import org.kie.server.api.model.ReleaseId; @Path("/server") public interface KieServer { @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getInfo(); @POST @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response execute( CommandScript command ); @GET @Path("containers") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response listContainers(); @GET @Path("containers/{id}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getContainerInfo( @PathParam("id") String id ); @PUT @Path("containers/{id}") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createContainer( @PathParam("id") String id, KieContainerResource container ); @DELETE @Path("containers/{id}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response disposeContainer( @PathParam("id") String id ); @POST @Path("containers/{id}") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response execute( @PathParam("id") String id, String cmdPayload ); @GET @Path("containers/{id}/release-id") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getReleaseId( @PathParam("id") String id); @POST @Path("containers/{id}/release-id") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateReleaseId( @PathParam("id") String id, ReleaseId releaseId ); @GET @Path("containers/{id}/scanner") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getScannerInfo( @PathParam("id") String id ); @POST @Path("containers/{id}/scanner") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateScanner( @PathParam("id") String id, KieScannerResource resource ); }
{-@ LIQUID "--reflection" @-} {-@ LIQUID "--ple" @-} {-@ LIQUID "--fuel=4" @-} module PleSum where {-@ reflect sumTo @-} sumTo :: Int -> Int sumTo n = if n <= 0 then 0 else n + sumTo (n-1) {-@ test :: () -> { sumTo 5 == 15 } @-} test :: () -> () test _ = ()
-- test connectionproperty() function -- invalid property name, should return NULL select connectionproperty('invalid property'); GO select connectionproperty(NULL); GO -- valid supported properties select connectionproperty('net_transport'),connectionproperty('protocol_type'), connectionproperty('auth_scheme'), connectionproperty('local_tcp_port'); GO select @@MICROSOFTVERSION; GO
use super::*; /// An item /// /// The name might be a dummy name in case of anonymous items #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Item { pub ident: Ident, pub vis: Visibility, pub attrs: Vec<Attribute>, pub node: ItemKind, } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum ItemKind { /// An`extern crate` item, with optional original crate name. /// /// E.g. `extern crate foo` or `extern crate foo_bar as foo` ExternCrate(Option<Ident>), /// A use declaration (`use` or `pub use`) item. /// /// E.g. `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;` Use(Box<ViewPath>), /// A static item (`static` or `pub static`). /// /// E.g. `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";` Static(Box<Ty>, Mutability, Box<Expr>), /// A constant item (`const` or `pub const`). /// /// E.g. `const FOO: i32 = 42;` Const(Box<Ty>, Box<Expr>), /// A function declaration (`fn` or `pub fn`). /// /// E.g. `fn foo(bar: usize) -> usize { .. }` Fn(Box<FnDecl>, Unsafety, Constness, Option<Abi>, Generics, Box<Block>), /// A module declaration (`mod` or `pub mod`). /// /// E.g. `mod foo;` or `mod foo { .. }` Mod(Option<Vec<Item>>), /// An external module (`extern` or `pub extern`). /// /// E.g. `extern {}` or `extern "C" {}` ForeignMod(ForeignMod), /// A type alias (`type` or `pub type`). /// /// E.g. `type Foo = Bar<u8>;` Ty(Box<Ty>, Generics), /// An enum definition (`enum` or `pub enum`). /// /// E.g. `enum Foo<A, B> { C<A>, D<B> }` Enum(Vec<Variant>, Generics), /// A struct definition (`struct` or `pub struct`). /// /// E.g. `struct Foo<A> { x: A }` Struct(VariantData, Generics), /// A union definition (`union` or `pub union`). /// /// E.g. `union Foo<A, B> { x: A, y: B }` Union(VariantData, Generics), /// A Trait declaration (`trait` or `pub trait`). /// /// E.g. `trait Foo { .. }` or `trait Foo<T> { .. }` Trait(Unsafety, Generics, Vec<TyParamBound>, Vec<TraitItem>), /// Default trait implementation. /// /// E.g. `impl Trait for .. {}` or `impl<T> Trait<T> for .. {}` DefaultImpl(Unsafety, Path), /// An implementation. /// /// E.g. `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }` Impl(Unsafety, ImplPolarity, Generics, Option<Path>, // (optional) trait this impl implements Box<Ty>, // self Vec<ImplItem>), /// A macro invocation (which includes macro definition). /// /// E.g. `macro_rules! foo { .. }` or `foo!(..)` Mac(Mac), } impl From<DeriveInput> for Item { fn from(input: DeriveInput) -> Item { Item { ident: input.ident, vis: input.vis, attrs: input.attrs, node: match input.body { Body::Enum(variants) => ItemKind::Enum(variants, input.generics), Body::Struct(variant_data) => ItemKind::Struct(variant_data, input.generics), }, } } } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum ViewPath { /// `foo::bar::baz as quux` /// /// or just /// /// `foo::bar::baz` (with `as baz` implicitly on the right) Simple(Path, Option<Ident>), /// `foo::bar::*` Glob(Path), /// `foo::bar::{a, b, c}` List(Path, Vec<PathListItem>), } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct PathListItem { pub name: Ident, /// renamed in list, e.g. `use foo::{bar as baz};` pub rename: Option<Ident>, } #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum Constness { Const, NotConst, } #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum Defaultness { Default, Final, } /// Foreign module declaration. /// /// E.g. `extern { .. }` or `extern "C" { .. }` #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct ForeignMod { pub abi: Abi, pub items: Vec<ForeignItem>, } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct ForeignItem { pub ident: Ident, pub attrs: Vec<Attribute>, pub node: ForeignItemKind, pub vis: Visibility, } /// An item within an `extern` block #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum ForeignItemKind { /// A foreign function Fn(Box<FnDecl>, Generics), /// A foreign static item (`static ext: u8`) Static(Box<Ty>, Mutability), } /// Represents an item declaration within a trait declaration, /// possibly including a default implementation. A trait item is /// either required (meaning it doesn't have an implementation, just a /// signature) or provided (meaning it has a default implementation). #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct TraitItem { pub ident: Ident, pub attrs: Vec<Attribute>, pub node: TraitItemKind, } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum TraitItemKind { Const(Ty, Option<Expr>), Method(MethodSig, Option<Block>), Type(Vec<TyParamBound>, Option<Ty>), Macro(Mac), } #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum ImplPolarity { /// `impl Trait for Type` Positive, /// `impl !Trait for Type` Negative, } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct ImplItem { pub ident: Ident, pub vis: Visibility, pub defaultness: Defaultness, pub attrs: Vec<Attribute>, pub node: ImplItemKind, } #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum ImplItemKind { Const(Ty, Expr), Method(MethodSig, Block), Type(Ty), Macro(Mac), } /// Represents a method's signature in a trait declaration, /// or in an implementation. #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct MethodSig { pub unsafety: Unsafety, pub constness: Constness, pub abi: Option<Abi>, pub decl: FnDecl, pub generics: Generics, } /// Header (not the body) of a function declaration. /// /// E.g. `fn foo(bar: baz)` #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct FnDecl { pub inputs: Vec<FnArg>, pub output: FunctionRetTy, pub variadic: bool, } /// An argument in a function header. /// /// E.g. `bar: usize` as in `fn foo(bar: usize)` #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum FnArg { SelfRef(Option<Lifetime>, Mutability), SelfValue(Mutability), Captured(Pat, Ty), Ignored(Ty), } #[cfg(feature = "parsing")] pub mod parsing { use super::*; use {Block, DelimToken, FunctionRetTy, Generics, Ident, Mac, Path, TokenTree, VariantData, Visibility}; use attr::parsing::{inner_attr, outer_attr}; use data::parsing::{struct_like_body, visibility}; use expr::parsing::{expr, pat, within_block}; use generics::parsing::{generics, lifetime, ty_param_bound, where_clause}; use ident::parsing::ident; use mac::parsing::delimited; use derive::{Body, DeriveInput}; use derive::parsing::derive_input; use ty::parsing::{abi, mutability, path, ty, unsafety}; named!(pub item -> Item, alt!( item_extern_crate | item_use | item_static | item_const | item_fn | item_mod | item_foreign_mod | item_ty | item_struct_or_enum | item_union | item_trait | item_default_impl | item_impl | item_mac )); named!(pub items -> Vec<Item>, many0!(item)); named!(item_mac -> Item, do_parse!( attrs: many0!(outer_attr) >> what: path >> punct!("!") >> name: option!(ident) >> body: delimited >> cond!(match body.delim { DelimToken::Paren | DelimToken::Bracket => true, DelimToken::Brace => false, }, punct!(";")) >> (Item { ident: name.unwrap_or_else(|| Ident::new("")), vis: Visibility::Inherited, attrs: attrs, node: ItemKind::Mac(Mac { path: what, tts: vec![TokenTree::Delimited(body)], }), }) )); named!(item_extern_crate -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("extern") >> keyword!("crate") >> id: ident >> rename: option!(preceded!( keyword!("as"), ident )) >> punct!(";") >> ({ let (name, original_name) = match rename { Some(rename) => (rename, Some(id)), None => (id, None), }; Item { ident: name, vis: vis, attrs: attrs, node: ItemKind::ExternCrate(original_name), } }) )); named!(item_use -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("use") >> what: view_path >> punct!(";") >> (Item { ident: "".into(), vis: vis, attrs: attrs, node: ItemKind::Use(Box::new(what)), }) )); named!(view_path -> ViewPath, alt!( view_path_glob | view_path_list | view_path_list_root | view_path_simple // must be last )); named!(view_path_simple -> ViewPath, do_parse!( path: path >> rename: option!(preceded!(keyword!("as"), ident)) >> (ViewPath::Simple(path, rename)) )); named!(view_path_glob -> ViewPath, do_parse!( path: path >> punct!("::") >> punct!("*") >> (ViewPath::Glob(path)) )); named!(view_path_list -> ViewPath, do_parse!( path: path >> punct!("::") >> punct!("{") >> items: terminated_list!(punct!(","), path_list_item) >> punct!("}") >> (ViewPath::List(path, items)) )); named!(view_path_list_root -> ViewPath, do_parse!( global: option!(punct!("::")) >> punct!("{") >> items: terminated_list!(punct!(","), path_list_item) >> punct!("}") >> (ViewPath::List(Path { global: global.is_some(), segments: Vec::new(), }, items)) )); named!(path_list_item -> PathListItem, do_parse!( name: alt!( ident | map!(keyword!("self"), Into::into) ) >> rename: option!(preceded!(keyword!("as"), ident)) >> (PathListItem { name: name, rename: rename, }) )); named!(item_static -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("static") >> mutability: mutability >> id: ident >> punct!(":") >> ty: ty >> punct!("=") >> value: expr >> punct!(";") >> (Item { ident: id, vis: vis, attrs: attrs, node: ItemKind::Static(Box::new(ty), mutability, Box::new(value)), }) )); named!(item_const -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("const") >> id: ident >> punct!(":") >> ty: ty >> punct!("=") >> value: expr >> punct!(";") >> (Item { ident: id, vis: vis, attrs: attrs, node: ItemKind::Const(Box::new(ty), Box::new(value)), }) )); named!(item_fn -> Item, do_parse!( outer_attrs: many0!(outer_attr) >> vis: visibility >> constness: constness >> unsafety: unsafety >> abi: option!(abi) >> keyword!("fn") >> name: ident >> generics: generics >> punct!("(") >> inputs: terminated_list!(punct!(","), fn_arg) >> punct!(")") >> ret: option!(preceded!(punct!("->"), ty)) >> where_clause: where_clause >> punct!("{") >> inner_attrs: many0!(inner_attr) >> stmts: within_block >> punct!("}") >> (Item { ident: name, vis: vis, attrs: { let mut attrs = outer_attrs; attrs.extend(inner_attrs); attrs }, node: ItemKind::Fn( Box::new(FnDecl { inputs: inputs, output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), variadic: false, }), unsafety, constness, abi, Generics { where_clause: where_clause, .. generics }, Box::new(Block { stmts: stmts, }), ), }) )); named!(fn_arg -> FnArg, alt!( do_parse!( punct!("&") >> lt: option!(lifetime) >> mutability: mutability >> keyword!("self") >> not!(punct!(":")) >> (FnArg::SelfRef(lt, mutability)) ) | do_parse!( mutability: mutability >> keyword!("self") >> not!(punct!(":")) >> (FnArg::SelfValue(mutability)) ) | do_parse!( pat: pat >> punct!(":") >> ty: ty >> (FnArg::Captured(pat, ty)) ) | ty => { FnArg::Ignored } )); named!(item_mod -> Item, do_parse!( outer_attrs: many0!(outer_attr) >> vis: visibility >> keyword!("mod") >> id: ident >> content: alt!( punct!(";") => { |_| None } | delimited!( punct!("{"), tuple!( many0!(inner_attr), items ), punct!("}") ) => { Some } ) >> (match content { Some((inner_attrs, items)) => Item { ident: id, vis: vis, attrs: { let mut attrs = outer_attrs; attrs.extend(inner_attrs); attrs }, node: ItemKind::Mod(Some(items)), }, None => Item { ident: id, vis: vis, attrs: outer_attrs, node: ItemKind::Mod(None), }, }) )); named!(item_foreign_mod -> Item, do_parse!( attrs: many0!(outer_attr) >> abi: abi >> punct!("{") >> items: many0!(foreign_item) >> punct!("}") >> (Item { ident: "".into(), vis: Visibility::Inherited, attrs: attrs, node: ItemKind::ForeignMod(ForeignMod { abi: abi, items: items, }), }) )); named!(foreign_item -> ForeignItem, alt!( foreign_fn | foreign_static )); named!(foreign_fn -> ForeignItem, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("fn") >> name: ident >> generics: generics >> punct!("(") >> inputs: separated_list!(punct!(","), fn_arg) >> trailing_comma: option!(punct!(",")) >> variadic: option!(cond_reduce!(trailing_comma.is_some(), punct!("..."))) >> punct!(")") >> ret: option!(preceded!(punct!("->"), ty)) >> where_clause: where_clause >> punct!(";") >> (ForeignItem { ident: name, attrs: attrs, node: ForeignItemKind::Fn( Box::new(FnDecl { inputs: inputs, output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), variadic: variadic.is_some(), }), Generics { where_clause: where_clause, .. generics }, ), vis: vis, }) )); named!(foreign_static -> ForeignItem, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("static") >> mutability: mutability >> id: ident >> punct!(":") >> ty: ty >> punct!(";") >> (ForeignItem { ident: id, attrs: attrs, node: ForeignItemKind::Static(Box::new(ty), mutability), vis: vis, }) )); named!(item_ty -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("type") >> id: ident >> generics: generics >> where_clause: where_clause >> punct!("=") >> ty: ty >> punct!(";") >> (Item { ident: id, vis: vis, attrs: attrs, node: ItemKind::Ty( Box::new(ty), Generics { where_clause: where_clause, ..generics }, ), }) )); named!(item_struct_or_enum -> Item, map!( derive_input, |def: DeriveInput| Item { ident: def.ident, vis: def.vis, attrs: def.attrs, node: match def.body { Body::Enum(variants) => { ItemKind::Enum(variants, def.generics) } Body::Struct(variant_data) => { ItemKind::Struct(variant_data, def.generics) } } } )); named!(item_union -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> keyword!("union") >> id: ident >> generics: generics >> where_clause: where_clause >> fields: struct_like_body >> (Item { ident: id, vis: vis, attrs: attrs, node: ItemKind::Union( VariantData::Struct(fields), Generics { where_clause: where_clause, .. generics }, ), }) )); named!(item_trait -> Item, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> unsafety: unsafety >> keyword!("trait") >> id: ident >> generics: generics >> bounds: opt_vec!(preceded!( punct!(":"), separated_nonempty_list!(punct!("+"), ty_param_bound) )) >> where_clause: where_clause >> punct!("{") >> body: many0!(trait_item) >> punct!("}") >> (Item { ident: id, vis: vis, attrs: attrs, node: ItemKind::Trait( unsafety, Generics { where_clause: where_clause, .. generics }, bounds, body, ), }) )); named!(item_default_impl -> Item, do_parse!( attrs: many0!(outer_attr) >> unsafety: unsafety >> keyword!("impl") >> path: path >> keyword!("for") >> punct!("..") >> punct!("{") >> punct!("}") >> (Item { ident: "".into(), vis: Visibility::Inherited, attrs: attrs, node: ItemKind::DefaultImpl(unsafety, path), }) )); named!(trait_item -> TraitItem, alt!( trait_item_const | trait_item_method | trait_item_type | trait_item_mac )); named!(trait_item_const -> TraitItem, do_parse!( attrs: many0!(outer_attr) >> keyword!("const") >> id: ident >> punct!(":") >> ty: ty >> value: option!(preceded!(punct!("="), expr)) >> punct!(";") >> (TraitItem { ident: id, attrs: attrs, node: TraitItemKind::Const(ty, value), }) )); named!(trait_item_method -> TraitItem, do_parse!( outer_attrs: many0!(outer_attr) >> constness: constness >> unsafety: unsafety >> abi: option!(abi) >> keyword!("fn") >> name: ident >> generics: generics >> punct!("(") >> inputs: terminated_list!(punct!(","), fn_arg) >> punct!(")") >> ret: option!(preceded!(punct!("->"), ty)) >> where_clause: where_clause >> body: option!(delimited!( punct!("{"), tuple!(many0!(inner_attr), within_block), punct!("}") )) >> cond!(body.is_none(), punct!(";")) >> ({ let (inner_attrs, stmts) = match body { Some((inner_attrs, stmts)) => (inner_attrs, Some(stmts)), None => (Vec::new(), None), }; TraitItem { ident: name, attrs: { let mut attrs = outer_attrs; attrs.extend(inner_attrs); attrs }, node: TraitItemKind::Method( MethodSig { unsafety: unsafety, constness: constness, abi: abi, decl: FnDecl { inputs: inputs, output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), variadic: false, }, generics: Generics { where_clause: where_clause, .. generics }, }, stmts.map(|stmts| Block { stmts: stmts }), ), } }) )); named!(trait_item_type -> TraitItem, do_parse!( attrs: many0!(outer_attr) >> keyword!("type") >> id: ident >> bounds: opt_vec!(preceded!( punct!(":"), separated_nonempty_list!(punct!("+"), ty_param_bound) )) >> default: option!(preceded!(punct!("="), ty)) >> punct!(";") >> (TraitItem { ident: id, attrs: attrs, node: TraitItemKind::Type(bounds, default), }) )); named!(trait_item_mac -> TraitItem, do_parse!( attrs: many0!(outer_attr) >> what: path >> punct!("!") >> body: delimited >> cond!(match body.delim { DelimToken::Paren | DelimToken::Bracket => true, DelimToken::Brace => false, }, punct!(";")) >> (TraitItem { ident: Ident::new(""), attrs: attrs, node: TraitItemKind::Macro(Mac { path: what, tts: vec![TokenTree::Delimited(body)], }), }) )); named!(item_impl -> Item, do_parse!( attrs: many0!(outer_attr) >> unsafety: unsafety >> keyword!("impl") >> generics: generics >> polarity_path: alt!( do_parse!( polarity: impl_polarity >> path: path >> keyword!("for") >> (polarity, Some(path)) ) | epsilon!() => { |_| (ImplPolarity::Positive, None) } ) >> self_ty: ty >> where_clause: where_clause >> punct!("{") >> body: many0!(impl_item) >> punct!("}") >> (Item { ident: "".into(), vis: Visibility::Inherited, attrs: attrs, node: ItemKind::Impl( unsafety, polarity_path.0, Generics { where_clause: where_clause, .. generics }, polarity_path.1, Box::new(self_ty), body, ), }) )); named!(impl_item -> ImplItem, alt!( impl_item_const | impl_item_method | impl_item_type | impl_item_macro )); named!(impl_item_const -> ImplItem, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> defaultness: defaultness >> keyword!("const") >> id: ident >> punct!(":") >> ty: ty >> punct!("=") >> value: expr >> punct!(";") >> (ImplItem { ident: id, vis: vis, defaultness: defaultness, attrs: attrs, node: ImplItemKind::Const(ty, value), }) )); named!(impl_item_method -> ImplItem, do_parse!( outer_attrs: many0!(outer_attr) >> vis: visibility >> defaultness: defaultness >> constness: constness >> unsafety: unsafety >> abi: option!(abi) >> keyword!("fn") >> name: ident >> generics: generics >> punct!("(") >> inputs: terminated_list!(punct!(","), fn_arg) >> punct!(")") >> ret: option!(preceded!(punct!("->"), ty)) >> where_clause: where_clause >> punct!("{") >> inner_attrs: many0!(inner_attr) >> stmts: within_block >> punct!("}") >> (ImplItem { ident: name, vis: vis, defaultness: defaultness, attrs: { let mut attrs = outer_attrs; attrs.extend(inner_attrs); attrs }, node: ImplItemKind::Method( MethodSig { unsafety: unsafety, constness: constness, abi: abi, decl: FnDecl { inputs: inputs, output: ret.map(FunctionRetTy::Ty).unwrap_or(FunctionRetTy::Default), variadic: false, }, generics: Generics { where_clause: where_clause, .. generics }, }, Block { stmts: stmts, }, ), }) )); named!(impl_item_type -> ImplItem, do_parse!( attrs: many0!(outer_attr) >> vis: visibility >> defaultness: defaultness >> keyword!("type") >> id: ident >> punct!("=") >> ty: ty >> punct!(";") >> (ImplItem { ident: id, vis: vis, defaultness: defaultness, attrs: attrs, node: ImplItemKind::Type(ty), }) )); named!(impl_item_macro -> ImplItem, do_parse!( attrs: many0!(outer_attr) >> what: path >> punct!("!") >> body: delimited >> cond!(match body.delim { DelimToken::Paren | DelimToken::Bracket => true, DelimToken::Brace => false, }, punct!(";")) >> (ImplItem { ident: Ident::new(""), vis: Visibility::Inherited, defaultness: Defaultness::Final, attrs: attrs, node: ImplItemKind::Macro(Mac { path: what, tts: vec![TokenTree::Delimited(body)], }), }) )); named!(impl_polarity -> ImplPolarity, alt!( punct!("!") => { |_| ImplPolarity::Negative } | epsilon!() => { |_| ImplPolarity::Positive } )); named!(constness -> Constness, alt!( keyword!("const") => { |_| Constness::Const } | epsilon!() => { |_| Constness::NotConst } )); named!(defaultness -> Defaultness, alt!( keyword!("default") => { |_| Defaultness::Default } | epsilon!() => { |_| Defaultness::Final } )); } #[cfg(feature = "printing")] mod printing { use super::*; use {Delimited, DelimToken, FunctionRetTy, TokenTree}; use attr::FilterAttrs; use data::VariantData; use quote::{Tokens, ToTokens}; impl ToTokens for Item { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append_all(self.attrs.outer()); match self.node { ItemKind::ExternCrate(ref original) => { self.vis.to_tokens(tokens); tokens.append("extern"); tokens.append("crate"); if let Some(ref original) = *original { original.to_tokens(tokens); tokens.append("as"); } self.ident.to_tokens(tokens); tokens.append(";"); } ItemKind::Use(ref view_path) => { self.vis.to_tokens(tokens); tokens.append("use"); view_path.to_tokens(tokens); tokens.append(";"); } ItemKind::Static(ref ty, ref mutability, ref expr) => { self.vis.to_tokens(tokens); tokens.append("static"); mutability.to_tokens(tokens); self.ident.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); tokens.append("="); expr.to_tokens(tokens); tokens.append(";"); } ItemKind::Const(ref ty, ref expr) => { self.vis.to_tokens(tokens); tokens.append("const"); self.ident.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); tokens.append("="); expr.to_tokens(tokens); tokens.append(";"); } ItemKind::Fn(ref decl, unsafety, constness, ref abi, ref generics, ref block) => { self.vis.to_tokens(tokens); constness.to_tokens(tokens); unsafety.to_tokens(tokens); abi.to_tokens(tokens); tokens.append("fn"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); tokens.append("("); tokens.append_separated(&decl.inputs, ","); tokens.append(")"); if let FunctionRetTy::Ty(ref ty) = decl.output { tokens.append("->"); ty.to_tokens(tokens); } generics.where_clause.to_tokens(tokens); tokens.append("{"); tokens.append_all(self.attrs.inner()); tokens.append_all(&block.stmts); tokens.append("}"); } ItemKind::Mod(ref items) => { self.vis.to_tokens(tokens); tokens.append("mod"); self.ident.to_tokens(tokens); match *items { Some(ref items) => { tokens.append("{"); tokens.append_all(self.attrs.inner()); tokens.append_all(items); tokens.append("}"); } None => tokens.append(";"), } } ItemKind::ForeignMod(ref foreign_mod) => { self.vis.to_tokens(tokens); foreign_mod.abi.to_tokens(tokens); tokens.append("{"); tokens.append_all(&foreign_mod.items); tokens.append("}"); } ItemKind::Ty(ref ty, ref generics) => { self.vis.to_tokens(tokens); tokens.append("type"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); generics.where_clause.to_tokens(tokens); tokens.append("="); ty.to_tokens(tokens); tokens.append(";"); } ItemKind::Enum(ref variants, ref generics) => { self.vis.to_tokens(tokens); tokens.append("enum"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); generics.where_clause.to_tokens(tokens); tokens.append("{"); for variant in variants { variant.to_tokens(tokens); tokens.append(","); } tokens.append("}"); } ItemKind::Struct(ref variant_data, ref generics) => { self.vis.to_tokens(tokens); tokens.append("struct"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); match *variant_data { VariantData::Struct(_) => { generics.where_clause.to_tokens(tokens); variant_data.to_tokens(tokens); // no semicolon } VariantData::Tuple(_) => { variant_data.to_tokens(tokens); generics.where_clause.to_tokens(tokens); tokens.append(";"); } VariantData::Unit => { generics.where_clause.to_tokens(tokens); tokens.append(";"); } } } ItemKind::Union(ref variant_data, ref generics) => { self.vis.to_tokens(tokens); tokens.append("union"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); generics.where_clause.to_tokens(tokens); variant_data.to_tokens(tokens); } ItemKind::Trait(unsafety, ref generics, ref bound, ref items) => { self.vis.to_tokens(tokens); unsafety.to_tokens(tokens); tokens.append("trait"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); if !bound.is_empty() { tokens.append(":"); tokens.append_separated(bound, "+"); } generics.where_clause.to_tokens(tokens); tokens.append("{"); tokens.append_all(items); tokens.append("}"); } ItemKind::DefaultImpl(unsafety, ref path) => { unsafety.to_tokens(tokens); tokens.append("impl"); path.to_tokens(tokens); tokens.append("for"); tokens.append(".."); tokens.append("{"); tokens.append("}"); } ItemKind::Impl(unsafety, polarity, ref generics, ref path, ref ty, ref items) => { unsafety.to_tokens(tokens); tokens.append("impl"); generics.to_tokens(tokens); if let Some(ref path) = *path { polarity.to_tokens(tokens); path.to_tokens(tokens); tokens.append("for"); } ty.to_tokens(tokens); generics.where_clause.to_tokens(tokens); tokens.append("{"); tokens.append_all(items); tokens.append("}"); } ItemKind::Mac(ref mac) => { mac.path.to_tokens(tokens); tokens.append("!"); self.ident.to_tokens(tokens); for tt in &mac.tts { tt.to_tokens(tokens); } match mac.tts.last() { Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { // no semicolon } _ => tokens.append(";"), } } } } } impl ToTokens for ViewPath { fn to_tokens(&self, tokens: &mut Tokens) { match *self { ViewPath::Simple(ref path, ref rename) => { path.to_tokens(tokens); if let Some(ref rename) = *rename { tokens.append("as"); rename.to_tokens(tokens); } } ViewPath::Glob(ref path) => { path.to_tokens(tokens); tokens.append("::"); tokens.append("*"); } ViewPath::List(ref path, ref items) => { path.to_tokens(tokens); if path.global || !path.segments.is_empty() { tokens.append("::"); } tokens.append("{"); tokens.append_separated(items, ","); tokens.append("}"); } } } } impl ToTokens for PathListItem { fn to_tokens(&self, tokens: &mut Tokens) { self.name.to_tokens(tokens); if let Some(ref rename) = self.rename { tokens.append("as"); rename.to_tokens(tokens); } } } impl ToTokens for TraitItem { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append_all(self.attrs.outer()); match self.node { TraitItemKind::Const(ref ty, ref expr) => { tokens.append("const"); self.ident.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); if let Some(ref expr) = *expr { tokens.append("="); expr.to_tokens(tokens); } tokens.append(";"); } TraitItemKind::Method(ref sig, ref block) => { sig.constness.to_tokens(tokens); sig.unsafety.to_tokens(tokens); sig.abi.to_tokens(tokens); tokens.append("fn"); self.ident.to_tokens(tokens); sig.generics.to_tokens(tokens); tokens.append("("); tokens.append_separated(&sig.decl.inputs, ","); tokens.append(")"); if let FunctionRetTy::Ty(ref ty) = sig.decl.output { tokens.append("->"); ty.to_tokens(tokens); } sig.generics.where_clause.to_tokens(tokens); match *block { Some(ref block) => { tokens.append("{"); tokens.append_all(self.attrs.inner()); tokens.append_all(&block.stmts); tokens.append("}"); } None => tokens.append(";"), } } TraitItemKind::Type(ref bound, ref default) => { tokens.append("type"); self.ident.to_tokens(tokens); if !bound.is_empty() { tokens.append(":"); tokens.append_separated(bound, "+"); } if let Some(ref default) = *default { tokens.append("="); default.to_tokens(tokens); } tokens.append(";"); } TraitItemKind::Macro(ref mac) => { mac.to_tokens(tokens); match mac.tts.last() { Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { // no semicolon } _ => tokens.append(";"), } } } } } impl ToTokens for ImplItem { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append_all(self.attrs.outer()); match self.node { ImplItemKind::Const(ref ty, ref expr) => { self.vis.to_tokens(tokens); self.defaultness.to_tokens(tokens); tokens.append("const"); self.ident.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); tokens.append("="); expr.to_tokens(tokens); tokens.append(";"); } ImplItemKind::Method(ref sig, ref block) => { self.vis.to_tokens(tokens); self.defaultness.to_tokens(tokens); sig.constness.to_tokens(tokens); sig.unsafety.to_tokens(tokens); sig.abi.to_tokens(tokens); tokens.append("fn"); self.ident.to_tokens(tokens); sig.generics.to_tokens(tokens); tokens.append("("); tokens.append_separated(&sig.decl.inputs, ","); tokens.append(")"); if let FunctionRetTy::Ty(ref ty) = sig.decl.output { tokens.append("->"); ty.to_tokens(tokens); } sig.generics.where_clause.to_tokens(tokens); tokens.append("{"); tokens.append_all(self.attrs.inner()); tokens.append_all(&block.stmts); tokens.append("}"); } ImplItemKind::Type(ref ty) => { self.vis.to_tokens(tokens); self.defaultness.to_tokens(tokens); tokens.append("type"); self.ident.to_tokens(tokens); tokens.append("="); ty.to_tokens(tokens); tokens.append(";"); } ImplItemKind::Macro(ref mac) => { mac.to_tokens(tokens); match mac.tts.last() { Some(&TokenTree::Delimited(Delimited { delim: DelimToken::Brace, .. })) => { // no semicolon } _ => tokens.append(";"), } } } } } impl ToTokens for ForeignItem { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append_all(self.attrs.outer()); match self.node { ForeignItemKind::Fn(ref decl, ref generics) => { self.vis.to_tokens(tokens); tokens.append("fn"); self.ident.to_tokens(tokens); generics.to_tokens(tokens); tokens.append("("); tokens.append_separated(&decl.inputs, ","); if decl.variadic { if !decl.inputs.is_empty() { tokens.append(","); } tokens.append("..."); } tokens.append(")"); if let FunctionRetTy::Ty(ref ty) = decl.output { tokens.append("->"); ty.to_tokens(tokens); } generics.where_clause.to_tokens(tokens); tokens.append(";"); } ForeignItemKind::Static(ref ty, mutability) => { self.vis.to_tokens(tokens); tokens.append("static"); mutability.to_tokens(tokens); self.ident.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); tokens.append(";"); } } } } impl ToTokens for FnArg { fn to_tokens(&self, tokens: &mut Tokens) { match *self { FnArg::SelfRef(ref lifetime, mutability) => { tokens.append("&"); lifetime.to_tokens(tokens); mutability.to_tokens(tokens); tokens.append("self"); } FnArg::SelfValue(mutability) => { mutability.to_tokens(tokens); tokens.append("self"); } FnArg::Captured(ref pat, ref ty) => { pat.to_tokens(tokens); tokens.append(":"); ty.to_tokens(tokens); } FnArg::Ignored(ref ty) => { ty.to_tokens(tokens); } } } } impl ToTokens for Constness { fn to_tokens(&self, tokens: &mut Tokens) { match *self { Constness::Const => tokens.append("const"), Constness::NotConst => { // nothing } } } } impl ToTokens for Defaultness { fn to_tokens(&self, tokens: &mut Tokens) { match *self { Defaultness::Default => tokens.append("default"), Defaultness::Final => { // nothing } } } } impl ToTokens for ImplPolarity { fn to_tokens(&self, tokens: &mut Tokens) { match *self { ImplPolarity::Negative => tokens.append("!"), ImplPolarity::Positive => { // nothing } } } } }
package com.github.ferum_bot.bookreuse.di.components import com.github.ferum_bot.bookreuse.di.modules.CreatingNewStuffActivityViewModelsModule import com.github.ferum_bot.bookreuse.di.scopes.ViewModelsScope import com.github.ferum_bot.bookreuse.ui.activity.CreatingNewStuffActivity import com.github.ferum_bot.bookreuse.viewmodels.factory.ViewModelFactory import dagger.Subcomponent /** * Created by Matvey Popov. * Date: 27.02.2021 * Time: 23:09 * Project: BookReuse */ @ViewModelsScope @Subcomponent(modules = [ CreatingNewStuffActivityViewModelsModule::class ]) interface CreatingNewStuffActivityComponent { fun inject(activity: CreatingNewStuffActivity) fun viewModelFactory(): ViewModelFactory @Subcomponent.Builder interface Builder { fun build(): CreatingNewStuffActivityComponent } }
<?php namespace Erfans\MaintenanceBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class ErfansMaintenanceBundle extends Bundle { }
import { arrayBufferToBase64, decryptStringWithPrivateKey, encryptStringWithPublicKey, exportPublicKeyAsSpki, generateKeyPair, publicKeyToCryptoKey, } from "ezzy-web-crypto"; import { combineLatest, Observable, of } from "rxjs"; import { catchError, map, switchMap, tap } from "rxjs/operators"; import { ApiService } from "../api/api.service"; import { TestResult } from "../models/test.interface"; import { addName, error, failure, success } from "./test-helper"; // testApiPublicKey tries to import the api's public key. export function testApiPublicKey(api: ApiService): Observable<TestResult> { return api.getPublicKey().pipe( switchMap((pub: string) => publicKeyToCryptoKey(pub)), map(() => success()), catchError((err) => error(err)), map(addName("TestApiPublicKey")) ); } // testEncrypWithApiPublicKey tests if api can decrypt a publickey-encrypted // message export function testEncryptWithApiPublicKey( api: ApiService ): Observable<TestResult> { const testMessage = "/ery s3cr³t mess@ge to @pi $er/ice!"; return api.getPublicKey().pipe( switchMap((pub: string) => encryptStringWithPublicKey(pub, testMessage)), switchMap((encMessage: string) => api.decryptMessageWithRsa(encMessage)), map((res: { message: string }) => res.message), map((message: string) => { if (message != testMessage) { return failure( "encrypted message not equal to testMessage", message, testMessage ); } return success(); }), catchError((err) => error(err)), map(addName("TestEncryptWithApiPublicKey")) ); } export function testEncryptWithLibPublicKey( api: ApiService ): Observable<TestResult> { const testMessage = "/ery s3cr³t mess@ge fr()m @pi $er/ice!"; return generateKeyPair().pipe( switchMap((kp: CryptoKeyPair) => combineLatest([ of(kp), exportPublicKeyAsSpki(kp.publicKey as CryptoKey).pipe( map((buf: ArrayBuffer) => arrayBufferToBase64(buf)) ), ]) ), switchMap(([kp, pubBase64]) => combineLatest([of(kp), api.encryptMessageWithRsa(pubBase64, testMessage)]) ), switchMap(([kp, encMessage]) => decryptStringWithPrivateKey(kp.privateKey ?? "", encMessage) ), map((message: string) => { if (message != testMessage) { return failure( "decrypted message not equal to testmessage", message, testMessage ); } return success(); }), catchError((err) => error(err)), map(addName("TestEncryptWithLibPublicKey")) ); }
package com.desertkun.brainout.common.msg.server; import com.desertkun.brainout.data.Map; public class BlockAddMsg { public int x; public int y; public int layer; public String data; public int d; public BlockAddMsg() {} public BlockAddMsg(int x, int y, int layer, String data, String dimension) { this.x = x; this.y = y; this.layer = layer; this.data = data; this.d = Map.GetDimensionId(dimension); } }
require 'rails_helper' # require 'jwt' RSpec.describe Api::V1::PostsController, type: :controller do describe 'any action' do context 'when user not authorised' do it 'should return error message' do request.headers["Authorization"] = nil resp = post :create # p resp.body expect(JSON.parse(resp.body)['error']).to eq('Not Authorized') end end end before (:all) do @user = create(:user) @token = JsonWebToken.encode(user_id: @user.id) end before (:each) do request.env["HTTP_ACCEPT"] = 'application/json' request.headers["Authorization"] = @token end let(:correct_create_post) { {params: {title: 'example title', body: 'example body', published_at: Time.now }}} let(:incorrect_create_post) { {params: {title: 'example title'}}} describe 'post create' do context 'when user authorised' do it 'should return error message with body' do resp = post :create, incorrect_create_post expect(JSON.parse(resp.body)['errors']).to include('body') end it 'should return created post' do # request.headers["Authorization"] = @token resp = post :create, correct_create_post expect(JSON.parse(resp.body)['id']).to_not be_nil expect(JSON.parse(resp.body)['title']).to eq('example title') expect(JSON.parse(resp.body)['body']).to eq('example body') expect(JSON.parse(resp.body)['author_nickname']).to eq(@user.nickname) end end end before (:all) do @posts = create_list(:post,10) end let(:correct_show_post) { {params: {id: @posts.last.id}}} let(:incorrect_show_post) { {params: {id: @posts.last.id+1}}} let(:correct_index_post) { {params: {page: 1, per_page: 10}}} let(:incorrect_index_post) { {params: {page: 100, per_page: 10}}} #if posts < 990 let(:blank_index_post) { {params: {}}} describe 'post show' do context 'when user authorised' do it 'should return error message' do # request.headers["Authorization"] = @token resp = get :show, incorrect_show_post expect(JSON.parse(resp.body)['errors']).to_not be_nil end it 'should return post' do # request.headers["Authorization"] = @token resp = get :show, correct_show_post expect(JSON.parse(resp.body)['title']).to eq(@posts.last.title) end end end describe 'posts index' do it 'should return empty list of posts' do # request.headers["Authorization"] = @token resp = get :index, incorrect_index_post expect(JSON.parse(resp.body).count).to eq(0) end it 'should return empty list of posts' do # request.headers["Authorization"] = @token resp = get :index, blank_index_post expect(JSON.parse(resp.body).count).to_not eq(0) end it 'should return correct list of posts' do # request.headers["Authorization"] = @token resp = get :index, correct_index_post expect(JSON.parse(resp.body).count).to eq(10) end end end
// Copyright (C) 2019 European Spallation Source ERIC #include <algorithm> #include <cmath> #include <cstdio> #include <fmt/format.h> #include <gdgem/tests/HitGenerator.h> #include <vector> #include <cassert> /// \todo Should not belong to gdgem but to common, reduction? namespace Gem { // void HitGenerator::printHits() { for (auto & Hit : Hits) { fmt::print("t {}, p {}, c {}, w {}\n", uint64_t(Hit.time), int(Hit.plane), int(Hit.coordinate), int(Hit.weight)); } } // void HitGenerator::printEvents() { fmt::print("t (x, y)\n"); for (auto & Event : Events) { fmt::print("{} ({}, {})\n", Event.TimeNs, Event.XPos, Event.YPos); } } // std::vector<NeutronEvent> & HitGenerator::randomEvents(int NumEvents, int MinCoord, int MaxCoord) { auto TimeNs = T0; std::uniform_int_distribution<int> coords(MinCoord, MaxCoord); for (int i = 0; i < NumEvents; i++) { auto XPos = coords(RandGen); auto YPos = coords(RandGen); //fmt::print("Event: ({}, {}), t={}\n", XPos, YPos, Time); Events.push_back({XPos, YPos, TimeNs}); TimeNs += TGap; } return Events; } // std::vector<Hit> & HitGenerator::randomHits(int MaxHits, int Gaps, int DeadTimeNs, bool Shuffle) { std::uniform_int_distribution<int> angle(0, 360); for (auto & Event : Events) { auto Degrees = angle(RandGen); //fmt::print("({},{}) @ {}\n", Event.XPos, Event.YPos, Degrees); makeHitsForSinglePlane(0, MaxHits, Event.XPos, Event.YPos, Degrees, Gaps, DeadTimeNs, Shuffle); makeHitsForSinglePlane(1, MaxHits, Event.XPos, Event.YPos, Degrees, Gaps, DeadTimeNs, Shuffle); advanceTime(TGap); } return Hits; } // std::vector<Hit> & HitGenerator::makeHitsForSinglePlane(int Plane, int MaxHits, float X0, float Y0, float Angle, int Gaps, int DeadTimeNs, bool Shuffle) { int64_t TimeNs = T0; int32_t OldTime = TimeNs; float TmpCoord{0}; int Coord{32767}, OldCoord{32767}; uint16_t ADC{2345}; std::vector<Hit> TmpHits; if ((Plane != PlaneX) and (Plane != PlaneY)) { return Hits; } for (int hit = 0; hit < MaxHits; hit++) { if (Plane == PlaneX) { TmpCoord = X0 + hit * 1.0 * cos(D2R(Angle)); //fmt::print("X0 {}, RO {}, Angle {}, cos(angle) {}, TmpCoord {}\n", X0, hit, Angle, cosa, TmpCoord); } else { TmpCoord = Y0 + hit * 1.0 * sin(D2R(Angle)); } Coord = (int)TmpCoord; if ((Coord > CoordMax) or (Coord < CoordMin)) { continue; } // Same coordinate - time gap is critical if (Coord == OldCoord) { //fmt::print("Same coordinate, OldTime {}, Time {}\n", OldTime, Time); if ((OldTime != TimeNs) and (TimeNs - OldTime < DeadTimeNs) ) { // Not the first Hit but within deadtime //fmt::print(" dT {} shorter than deadtime - skipping\n", Time - OldTime); TimeNs += DeltaT; continue; } } Hit CurrHit{(uint64_t)TimeNs, (uint16_t)Coord, ADC, (uint8_t)Plane}; TmpHits.push_back(CurrHit); OldTime = TimeNs; TimeNs += DeltaT; OldCoord = Coord; } // Handle gaps TmpHits = makeGaps(TmpHits, Gaps); if (Shuffle) { std::shuffle(TmpHits.begin(), TmpHits.end(), RandGen); } for (auto &Hit : TmpHits) { Hits.push_back(Hit); } return Hits; } // std::vector<Hit> & HitGenerator::makeGaps(std::vector<Hit> & Hits, uint8_t Gaps) { if (Gaps == 0) { return Hits; } std::vector<Hit> GapHits; if (Gaps > Hits.size() - 2) { //fmt::print("Gaps requestes {}, available {}\n", Gaps, TmpHits.size() - 2); Hits.clear(); } for (unsigned int i = 0; i < Hits.size(); i ++) { if ((i == 0) or (i > Gaps)) { GapHits.push_back(Hits[i]); } } Hits = GapHits; return Hits; } } // namespace
/* Copyright 2021 KubeCube Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package main import ( "context" "fmt" logger "github.com/astaxie/beego/logs" "github.com/golang/glog" "github.com/kubecube-io/kubecube/pkg/clients" "github.com/kubecube-io/kubecube/pkg/clog" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" "kubecube-webconsole/handler" "net/http" _ "net/http/pprof" "os" ctrl "sigs.k8s.io/controller-runtime" "time" ) func init() { clients.InitCubeClientSetWithOpts(nil) } func main() { clog.InitCubeLoggerWithOpts(&clog.Config{LogLevel: "info", StacktraceLevel: "error"}) // hostname is the key to select the master, so it must be terminated if it fails hostname, err := os.Hostname() if err != nil { glog.Fatalf("failed to get hostname: %v", err) } client, err := kubernetes.NewForConfig(ctrl.GetConfigOrDie()) if err != nil { logger.Error("problem new raw k8s clientSet: %v", err) return } rl, err := resourcelock.New(resourcelock.ConfigMapsResourceLock, handler.LeaderElectionNamespace, handler.LeaderElectionKey, client.CoreV1(), nil, resourcelock.ResourceLockConfig{ Identity: hostname, }) if err != nil { glog.Errorf("error creating lock: %v", err) } le, err := leaderelection.NewLeaderElector(leaderelection.LeaderElectionConfig{ Lock: rl, LeaseDuration: 15 * time.Second, RenewDeadline: 10 * time.Second, RetryPeriod: 2 * time.Second, Callbacks: leaderelection.LeaderCallbacks{ OnStartedLeading: func(ctx context.Context) { run() }, OnStoppedLeading: func() { glog.Infoln("leader election lost") }, }, }) if err != nil { glog.Errorf("leader election fail, be member") } le.Run(context.Background()) } func run() { http.Handle("/api/", handler.CreateHTTPAPIHandler()) http.Handle("/api/sockjs/", handler.CreateAttachHandler("/api/sockjs")) http.HandleFunc("/healthz", func(response http.ResponseWriter, request *http.Request) { logger.Debug("Health check") response.WriteHeader(http.StatusOK) }) http.HandleFunc("/leader", func(response http.ResponseWriter, request *http.Request) { logger.Debug("This is leader") response.WriteHeader(http.StatusOK) }) err := http.ListenAndServe(fmt.Sprintf(":%d", *handler.ServerPort), nil) if err != nil { logger.Critical("ListenAndServe failed,error msg: %s", err.Error()) } }
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace AntChain.SDK.BLOCKCHAIN.Models { // 蚂蚁链最新交易信息 public class BlockchainBrowserLatestTransaction : TeaModel { // create_time [NameInMap("create_time")] [Validation(Required=true)] public long? CreateTime { get; set; } // from [NameInMap("from")] [Validation(Required=true)] public string From { get; set; } // to [NameInMap("to")] [Validation(Required=true)] public string To { get; set; } // hash [NameInMap("hash")] [Validation(Required=true)] public string Hash { get; set; } // transactionV10Type [NameInMap("transaction_type")] [Validation(Required=true)] public string TransactionType { get; set; } } }
const path = require('path') const webpack = require('webpack') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const WebpackMerge = require('webpack-merge') const webpackConfig = require('./webpack.config') module.exports = WebpackMerge(webpackConfig, { devtool: '#source-map', mode: 'development', output: { // eslint-disable-next-line no-undef path: path.join(__dirname, '../output/debug/dist'), publicPath: '/dist/', filename: '[name].js', chunkFilename: '[name].chunk.js' }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader' }, { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] }, { test: /\.less$/, use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'] } ] }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css' }), new webpack.HotModuleReplacementPlugin() ], externals: { vue: 'Vue' }, devServer: { contentBase: './output/debug/', compress: true, port: 30020, host: '0.0.0.0', disableHostCheck: true, hot: true, inline: true, historyApiFallback: true } })
#Subject: Configure Network and restart SQL Server instance #Author: Harry Archibald #Date: 27/04/2016 #v1.0 Initial release param( [Parameter(Mandatory=$True)] [string]$HostName, [Parameter(Mandatory=$True)] [string]$InstanceName, [Parameter(Mandatory=$True)] [string]$Port ) .\ChangeNetworkProtocols.ps1 $InstanceName .\ChangePort.ps1 $InstanceName $Port .\Add_SQLServer.AliasMgmt_V1.0.ps1 $HostName $InstanceName $Port .\RestartSQL.ps1 $InstanceName
// Copyright 2019 Fullstop000 <[email protected]>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // See the License for the specific language governing permissions and // limitations under the License. use crate::record::reader::Reporter; use crate::util::status::{Result, Status, WickErr}; use std::cell::RefCell; use std::rc::Rc; #[derive(Clone)] pub struct LogReporter { inner: Rc<RefCell<LogReporterInner>>, } struct LogReporterInner { ok: bool, reason: String, } impl LogReporter { pub fn new() -> Self { Self { inner: Rc::new(RefCell::new(LogReporterInner { ok: true, reason: "".to_owned(), })), } } pub fn result(&self) -> Result<()> { let inner = self.inner.borrow(); let static_reasons: &'static str = Box::leak(Box::new(inner.reason.clone())); if inner.ok { Ok(()) } else { Err(WickErr::new(Status::Corruption, Some(static_reasons))) } } } impl Reporter for LogReporter { fn corruption(&mut self, _bytes: u64, reason: &str) { self.inner.borrow_mut().ok = false; self.inner.borrow_mut().reason = reason.to_owned(); } }
package francisco.visintini.mercadolibre.test.search import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration.VERTICAL import androidx.recyclerview.widget.LinearLayoutManager import com.xwray.groupie.GroupAdapter import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder import dagger.android.support.AndroidSupportInjection import francisco.visintini.mercadolibre.test.R import francisco.visintini.mercadolibre.test.di.withFactory import francisco.visintini.mercadolibre.test.extensions.setVisible import francisco.visintini.mercadolibre.test.messages.ErrorMessage import francisco.visintini.mercadolibre.test.messages.MessageManager import francisco.visintini.mercadolibre.test.search.ContentState.Content import francisco.visintini.mercadolibre.test.search.ContentState.Empty import francisco.visintini.mercadolibre.test.search.ContentState.Error import francisco.visintini.mercadolibre.test.search.ContentState.Initial import francisco.visintini.mercadolibre.test.search.ContentState.Loading import francisco.visintini.mercadolibre.test.search.SearchIntent.ClearSearch import francisco.visintini.mercadolibre.test.search.SearchIntent.Search import francisco.visintini.mercadolibre.test.search.SearchIntent.SearchBarBackPressed import francisco.visintini.mercadolibre.test.search.SearchIntent.SearchFocus import francisco.visintini.mercadolibre.test.search.SearchIntent.TextChanged import francisco.visintini.mercadolibre.test.search.SearchNavigation.ToError import francisco.visintini.mercadolibre.test.search.SearchNavigation.ToProduct import francisco.visintini.mercadolibre.test.search.bar.SearchBar.SearchBarIntent import francisco.visintini.mercadolibre.test.search.result.SearchResultItem import francisco.visintini.mercadolibre.test.search.result.SearchResultItemPlaceholder import io.reactivex.disposables.CompositeDisposable import io.reactivex.rxkotlin.addTo import javax.inject.Inject import kotlinx.android.synthetic.main.fragment_search.* class SearchFragment : Fragment(R.layout.fragment_search) { @Inject lateinit var searchViewModelFactory: SearchViewModel.Factory @Inject lateinit var messageManager: MessageManager private val disposable = CompositeDisposable() private val adapter = GroupAdapter<GroupieViewHolder>() private val searchViewModel: SearchViewModel by viewModels { withFactory(searchViewModelFactory) } private var currentViewState: SearchViewState? = null override fun onCreate(savedInstanceState: Bundle?) { AndroidSupportInjection.inject(this) super.onCreate(savedInstanceState) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) view_search_list.layoutManager = LinearLayoutManager(context) view_search_list.addItemDecoration(DividerItemDecoration(context, VERTICAL)) view_search_list.adapter = adapter } override fun onStart() { super.onStart() searchViewModel.viewState.observe(this, Observer { this.render(it) }) searchViewModel.navigator.observe(this, Observer { this.navigate(it) }) subscribeToSearchBarIntents() subscribeToSearchResultItemIntents() searchViewModel.start() } private fun render(viewState: SearchViewState) { view_search_bar.render(viewState.searchBarViewState) val content = viewState.contentState view_search_empty_result.setVisible(content is Empty) view_search_list.setVisible(content is Content || content is Loading) if (currentViewState?.contentState != content) { // Avoid unnecessary re-rendering when (content) { is Initial -> adapter.clear() // TODO Add search history here is Loading -> adapter.update((1..4).map { SearchResultItemPlaceholder }) is Content -> adapter.update(content.searchResults.map { SearchResultItem(it) }) is Empty -> { adapter.clear() view_search_empty_result.text = getString( R.string.search_empty_results_text, viewState.searchBarViewState.query ) } is Error -> { adapter.clear() showError(content) } } currentViewState = viewState } } private fun showError(error: Error) { when (error) { is Error.NetworkErrorRetry -> view?.let { messageManager.showError( it, ErrorMessage.NetworkErrorRetry { searchViewModel.handleIntent(SearchIntent.NetworkErrorRetryTapped) } ) } is Error.UnknownError -> navigate( ToError(getString(R.string.error_dialog_generic_message)) ) } } private fun navigate(navigation: SearchNavigation) { with(findNavController()) { // TODO Fast workaround to prevent current navigation destination is unknown exception. if (this.currentBackStackEntry?.destination?.id == R.id.search_fragment) { when (navigation) { is ToProduct -> navigate( SearchFragmentDirections.actionSearchFragmentToProductFragment( navigation.productId ) ) is ToError -> navigate( SearchFragmentDirections.actionSearchFragmentToErrorDialogFragment( navigation.message ) ) } } } } override fun onDestroyView() { view_search_list.adapter = null disposable.clear() super.onDestroyView() } private fun subscribeToSearchResultItemIntents() { adapter.setOnItemClickListener { item, _ -> when (item) { is SearchResultItem -> searchViewModel.handleIntent( SearchIntent.SearchResultTapped(item.viewState.productId) ) } } } private fun subscribeToSearchBarIntents() { view_search_bar.getIntents() .subscribe { searchViewModel.handleIntent( when (it) { is SearchBarIntent.Search -> Search(it.query) is SearchBarIntent.TextChanged -> TextChanged(it.currentQuery) is SearchBarIntent.SearchFocus -> SearchFocus(it.focused) is SearchBarIntent.ClearSearch -> ClearSearch is SearchBarIntent.BackPressed -> SearchBarBackPressed } ) } .addTo(disposable) } }
import { SiteClient } from 'datocms-client' export default async function communitiesApi(req, res) { if (req.method === 'POST') { const TOKEN = process.env.NEXT_PUBLIC_API_DATOCMS_TOKEN_FULL const modelId = process.env.NEXT_PUBLIC_API_DATOCMS_MODEL_ID const client = new SiteClient(TOKEN) const record = await client.items.create({ itemType: modelId, // Model ID for communities ...req.body, }) res.json({ data: 'Some date here', record, }) return } res.status(404).json({ message: 'Not Found', }) }
# This small script has been created to automate the task of # changing the parche for the Encrl version. # # If the version is something like: # version.number.parche # # For example # 1.0.3 # # This script modifies the 'parche' section to `parche=parche+1` # # The script works in the file version.txt by default # Modify the name of the file here: FILE_ROUTE="version.txt" VERSION_INCREMENT=1 # DO NOT TOUCH ANYTHING FROM HERE TO THE END OF THE CODE # -------------------------------------------------------------------- # Before making any important change inside the version file we have # to work with the file routes and handle the errors. # - Convert from the relative to the absolute path using thr readlink # command, then store the value in a variable # - Read the version parche # - Increase it by 1 (nv(parche)=v+1||v++) FILE=$(readlink ${FILE_ROUTE} -f) PARCHE=$(sed -n "3p" ${FILE}) PARCHE=$((PARCHE+VERSION_INCREMENT)) echo $PARCHE # Once we have all this information, we have to actually modify the # file to increase the version. # - Delete all the content inside the file # - Open the file itself # - Set the parche to line 3 sed -i "3s/.*/${PARCHE}/" ${FILE}
package org.oppia.app.ongoingtopiclist import android.content.Context import android.content.Intent import android.os.Bundle import org.oppia.app.activity.InjectableAppCompatActivity import javax.inject.Inject /** Activity for ongoing topics. */ class OngoingTopicListActivity : InjectableAppCompatActivity() { @Inject lateinit var ongoingTopicListActivityPresenter: OngoingTopicListActivityPresenter override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) activityComponent.inject(this) val internalProfileId: Int = intent.getIntExtra(ONGOING_TOPIC_LIST_ACTIVITY_PROFILE_ID_KEY, -1) ongoingTopicListActivityPresenter.handleOnCreate(internalProfileId) } companion object { internal const val ONGOING_TOPIC_LIST_ACTIVITY_PROFILE_ID_KEY = "OngoingTopicListActivity.profile_id" /** Returns a new [Intent] to route to [OngoingTopicListActivity] for a specified profile ID. */ fun createOngoingTopicListActivityIntent(context: Context, internalProfileId: Int): Intent { val intent = Intent(context, OngoingTopicListActivity::class.java) intent.putExtra(ONGOING_TOPIC_LIST_ACTIVITY_PROFILE_ID_KEY, internalProfileId) return intent } } }
export default { EMAIL_IS_ALREADY_IN_USE: 'Bu email adresi zaten kullanılıyor.', USER_NOT_FOUND: 'Kullanıcı bulunamadı.', USER_NOT_ACTIVE: 'Kullanıcı deaktif.', USER_NOT_LOGGED_IN: 'Lütfen giriş yapınız.', USER_NOT_AUTHORIZED: 'Yetkisiz Kullanıcı', USER_NOT_FOUND_FOR_THIS_ID: 'Kullanıcı bulunamadı.', USER_NOT_FOUND_FOR_THIS_EMAIL: 'Kullanıcı bulunamadı.', USER_NOT_CREATED: 'Kullanıcı oluşturulamadı.', PASSWORD_INCORRECT: 'Şifre yanlış.', TOKEN_INVALID: 'Geçersiz token.', TOKEN_MISSING: 'Token eksik.', };
// @flow declare module 'material-ui' { declare var exports: any; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <DevToolsCore/PBXReference.h> @class PBXContainerItemProxy, PBXFileType; @interface PBXReferenceProxy : PBXReference { PBXContainerItemProxy *_remoteRef; BOOL _needsSync; PBXFileType *_fileType; } + (id)archivableRelationships; + (id)archivableAttributes; - (id)innerDescription; - (void)awakeFromPListUnarchiver:(id)arg1; - (void)writeToPListArchiver:(id)arg1; - (void)_syncCachedValuesWithRemoteReferenceIfNeeded; - (BOOL)needsSync; - (void)setNeedsSync:(BOOL)arg1; - (void)_setFileType:(id)arg1; - (id)_fileType; - (void)setIncludeInIndex:(long long)arg1; - (BOOL)canSetIncludeInIndex; - (BOOL)includeInIndex; - (id)fileProperties; - (void)setFileType:(id)arg1; - (id)fileType; - (id)destinationGroupForFilenames:(id)arg1; - (id)destinationGroupForInsertion; - (BOOL)changeSourceTree:(id)arg1; - (BOOL)moveToNewPath:(id)arg1; - (BOOL)copyToNewPath:(id)arg1; - (BOOL)setPath:(id)arg1; - (void)setPath:(id)arg1 andSourceTree:(id)arg2; - (BOOL)fileExists; - (id)absolutePathForDisplay; - (id)buildProductRelativePath; - (id)groupRelativePath; - (id)projectRelativePath; - (id)resolvedAbsoluteDirectory; - (id)resolvedAbsolutePath; - (id)absoluteDirectory; - (id)absolutePathForConfigurationNamed:(id)arg1; - (id)absolutePath; - (id)path; - (id)sourceTree; - (BOOL)canSetName; - (void)setName:(id)arg1; - (id)name; - (BOOL)allowsRemovalFromDisk; - (BOOL)allowsEditing; - (id)includingTargets; - (id)producingTarget; - (BOOL)deleteFromProjectAndDisk:(BOOL)arg1; - (void)deleteFromDisk; - (void)setContainer:(id)arg1; - (id)realReference; - (void)dealloc; - (id)initRemoteProductReferenceWithPortal:(id)arg1 remoteGlobalIDString:(id)arg2 remoteInfo:(id)arg3; - (id)initWithType:(int)arg1 portal:(id)arg2 remoteGlobalIDString:(id)arg3 remoteInfo:(id)arg4; @end
--- title: "オリジナルコミック “あぶないネコでんせつ”" post_id: "2895" date: "1992-05-01T00:00:00+09:00" draft: true tags: [] --- 当時自分が描いていた初のストーリー物ギャグ漫画 “あぶないネコでんせつ” の1コマ。 ストーリーものとは名ばかりの、1 ~ 4P 程度の編成の事実上超短編ギャグ漫画だった。 左から、やさぐれ系悪ガキで主人公の “ミー”、主人公の仲間 4 人組の紅一点 “ミュー”、ガキ大将系悪ガキの “ニャン太”、現役殺し屋の “ミャー”。 残念ながら当時描いていたものは見つからず、このイラストは 2000 ~ 2001 年頃に当時の画力を思い出しつつ再現したもの。 ちなみに、それから3年後の中学当時、[RPG ゲーム化しようと画策して二回ほどシナリオを書き直した](https://danmaq.com/tag/cats-story)。 “ネコでんせつ” と名称変更、一回目で最後まで一本の長編ストーリーとなり、二回目では “CATS STORY” とさらに名を変え、人間とネコ種族の戦争を描いたシリアスものになった。 この時に当時のプログラミング能力が仇となってRPG製作を断念、ラノベに使用とノートに文章を書き起こしている。 その断片が幾分か残っているので、そのうち暇を見つけたらテキスト化して公開したいと思う。 ここからは余談だが、[同時期にもう一本、漫画改めライトノベルを書いていた](https://danmaq.com/tag/evil-magic)。 こちらは断片ではなく、ほぼ完全な形で残っていたので、近いうちにWebかコミケかで公開したいなと考えている。 →[しました](https://danmaq.com/evilmagic)。
namespace Ae.Freezer.Entities { /// <summary> /// Describes the type of website resource. /// </summary> public enum WebsiteResourceType { /// <summary> /// This resource is buffered text (as a string) /// </summary> Text, /// <summary> /// This resource is unbuffered binary (as a stream) /// </summary> Binary } }
--- title: 'Random family photos' default_image: mac-winter-2015.jpg show_captions: true --- The photos here are just random photos of my family. Some I have taken and some found on facebook.
# NGO2.0 MiniProgram - 🔍 NGO索引+地图 ## Screenshots ![wxSearch效果gif1](IMG_6773.PNG) ![wxSearch效果gif2](IMG_6774.PNG)
# NJU-Graphics-Homework-2019 ## 南京大学 2019年计算机图形学课程 CG2019 大作业 ### 支持图元拖曳、定点滚轮旋转和缩放 基于Qt 不涉及opengl [编译和使用手册.md,点击查看](./171860633_系统使用说明书.md) ### 试用 Emscripten, Qt-5.14.1 * 10M左右的WASM传输,薛定谔秒的加载,刷新之前,这网页是传还是没传过来呢?桌面端firefox(√)、Edge(√)、chrome(√),移动端MIUI自带浏览器(×) [测试链接](http://Xuguodong1999.github.io/CG2019.html) * 测试链接中,内容由一个后台node进程分发,没有重启机制,让我们祝愿这个进程活到服务器到期(×) ![](./picture/浏览器测试.png) * 备注:没有对图元编辑功能进行抽象 * 备注:没有使用树状结构进行图元管理
<?php declare(strict_types = 1); namespace DemoApiContext\Domain\Workflow\Actor\Observer\Persistence; use DemoApiContext\Domain\Entity\Actor; use DemoApiContext\Domain\ValueObject\ActorVO; use Exception; use ProjetNormandie\DddProviderBundle\Layer\Domain\Generalisation\Observer\AbstractObserver; use ProjetNormandie\DddProviderBundle\Layer\Infrastructure\Exception\DomainException; use ProjetNormandie\DddProviderBundle\Layer\Infrastructure\Manipulation\TypeHinting\TraitStdClass; /** * Class WFCreateManyEntity * * @category DemoApiContext * @package Domain * @subpackage Workflow\Actor\Observer\Persistence * * @license MIT */ class WFCreateManyEntity extends WFSaveEntity { use TraitStdClass; /** * Sends a persist action create to specific create manager for all entities. * * @uses WFCreateManyEntity::processToManager() * @return AbstractObserver */ public function update(): AbstractObserver { $this->wfLastData->entity = \array_map( [$this, 'processToManager'], $this->wfLastData->actorVO ); return $this; } /** * Checks that the value object linked to the entity is well defined and asks the manager to process if it is. * * @param ActorVO $actorVO Should be an instance of ActorVO, to avoid throwing an exception. * @used-by WFCreateManyEntity::update() * @return Actor * @throws Exception */ private function processToManager(ActorVO $actorVO): Actor { $this->checkVO([$actorVO], DomainException::someValueObjectHaveNotBeenCreated()); return $this->manager->process(static::buildFromArray(['actorVO' => $actorVO])); } }
package io.aigar.game.serializable import com.github.jpbetz.subspace.Vector2 /** * Serializable classes that represent the current state of a game. These are * the classes that will be sent over the network, so they should follow the * conventions of the API. */ case class Position( x: Float, y: Float ) case class Dimensions( width: Int, height: Int ) case class Cell( id: Int, mass: Int, radius: Int, position: Position, target: Position, burst: Boolean ) case class Player( id: Int, name: String, total_mass: Integer, isActive: Boolean, cells: List[Cell] ) case class Resources( regular: List[Vector2], silver: List[Vector2], gold: List[Vector2] ) case class Virus( position: Position, mass: Int, radius: Int ) case class GameState( id: Int, var paused: Boolean, var disabledLeaderboard: Boolean, multiplier: Int, tick: Int, timeLeft: Float, players: List[Player], resources: Resources, map: Dimensions, viruses: List[Virus] )
interface Digitaljs { Circuit: any; Monitor: any; MonitorView: any; IOPanelView: any; transform: any; engines: any; } declare var digitaljs: Digitaljs; interface Document { digitaljsInput: string; simplifyDiagram: boolean; layoutEngine: string; simulationEngine: string; workerURL: any; }
#!/bin/bash if [[ -n "${EC2_INIT}" && "${EC2_INIT}" == "true" ]]; then if [[ -d '/user-data' ]]; then rm /var/www/html/cli/user-data || true cd /user-data for k8s_secret in $(ls) ; do echo "${k8s_secret}=$(cat $k8s_secret)" >> /var/www/html/cli/user-data done fi /usr/local/bin/php -c /usr/local/etc/php/php.ini /var/www/html/cli/ec2init.php fi
package com.github.greennick.properties.android import android.app.Activity import android.text.Editable import android.text.TextWatcher import android.widget.TextView import com.github.greennick.properties.generic.MutableProperty import com.github.greennick.properties.generic.Property import com.github.greennick.properties.subscriptions.ListenableSubscription import com.github.greennick.properties.subscriptions.Subscription /** * Binds [TextView] to Property<Any?>. * Uses [TextView.setText] * Will map object through `toString` or set empty string if null * * @param property - object holder */ fun TextView.bindText(property: Property<CharSequence?>): ListenableSubscription = property.subscribe { text = it } /** * Binds [TextView] to Property<Int>. * Uses [TextView.setText] * * @param property - string resource id holder */ @JvmName("bindTextId") fun TextView.bindText(property: Property<Int?>): ListenableSubscription = property.subscribe { if (it != null) setText(it) else text = null } /** * Binds [TextView] to Property<CharSequence?>. * Uses [TextView.setHint] * * @param property - hint text holder */ fun TextView.bindHint(property: Property<CharSequence?>): ListenableSubscription = property.subscribe { hint = it } /** * Binds [TextView] to Property<Int>. * Uses [TextView.setHint] * * @param property - string resource id holder */ @JvmName("bindHintId") fun TextView.bindHint(property: Property<Int?>): ListenableSubscription = property.subscribe { if (it != null) setHint(it) else text = null } /** * Binds [TextView] to MutableProperty<String>. * Uses [TextView.setText] * From user perspective uses [TextWatcher.onTextChanged]. * Received CharSequence converted with `toString` or empty string if null * * @param property - text holder */ fun TextView.bindTextBidirectionally(property: MutableProperty<String>): Subscription { val subscription = property.subscribe { if (text?.toString() != it) { text = it } } val watcher = textChanged { property.value = it } subscription.onUnsubscribe { removeTextChangedListener(watcher) } return subscription } fun TextView.textChanged(action: (String) -> Unit): TextWatcher { val watcher = object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { } override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { action(s?.toString().orEmpty()) } override fun afterTextChanged(s: Editable) { } } addTextChangedListener(watcher) return watcher } fun Activity.textChanged(viewId: Int, action: (String) -> Unit): TextWatcher = find<TextView>(viewId).textChanged(action) fun TextView.actionListener(listener: ((Int) -> Unit)? = null) { if (listener == null) { setOnEditorActionListener(null) } else { setOnEditorActionListener { _, actionId, _ -> listener(actionId) true } } } fun Activity.actionListener(viewId: Int, listener: ((Int) -> Unit)? = null): Unit = find<TextView>(viewId).actionListener(listener)
// Code generated by go-bindata. DO NOT EDIT. // sources: // migrations/sql/mysql/.gitkeep // migrations/sql/mysql/5.sql // migrations/sql/mysql/6.sql // migrations/sql/mysql/7.sql // migrations/sql/mysql/9.sql // migrations/sql/postgres/.gitkeep // migrations/sql/postgres/5.sql // migrations/sql/postgres/6.sql // migrations/sql/postgres/7.sql // migrations/sql/postgres/9.sql // migrations/sql/shared/1.sql // migrations/sql/shared/2.sql // migrations/sql/shared/3.sql // migrations/sql/shared/4.sql // migrations/sql/shared/8.sql // migrations/sql/tests/.gitkeep // migrations/sql/tests/1_test.sql // migrations/sql/tests/2_test.sql // migrations/sql/tests/3_test.sql // migrations/sql/tests/4_test.sql // migrations/sql/tests/5_test.sql // migrations/sql/tests/6_test.sql // migrations/sql/tests/7_test.sql // migrations/sql/tests/8_test.sql // migrations/sql/tests/9_test.sql package oauth2 import ( "bytes" "compress/gzip" "fmt" "io" "io/ioutil" "os" "path/filepath" "strings" "time" ) func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer _, err = io.Copy(&buf, gz) clErr := gz.Close() if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err } return buf.Bytes(), nil } type asset struct { bytes []byte info fileInfoEx } type fileInfoEx interface { os.FileInfo MD5Checksum() string } type bindataFileInfo struct { name string size int64 mode os.FileMode modTime time.Time md5checksum string } func (fi bindataFileInfo) Name() string { return fi.name } func (fi bindataFileInfo) Size() int64 { return fi.size } func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } func (fi bindataFileInfo) MD5Checksum() string { return fi.md5checksum } func (fi bindataFileInfo) IsDir() bool { return false } func (fi bindataFileInfo) Sys() interface{} { return nil } var _bindataMigrationsSqlMysqlGitkeep = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") func bindataMigrationsSqlMysqlGitkeepBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlMysqlGitkeep, "migrations/sql/mysql/.gitkeep", ) } func bindataMigrationsSqlMysqlGitkeep() (*asset, error) { bytes, err := bindataMigrationsSqlMysqlGitkeepBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/mysql/.gitkeep", size: 0, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlMysql5sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd5\x55\xd0\xce\xcd\x4c\x2f\x4a\x2c\x49\x55\x08\x2d\xe0\x72\x0e\x72" + "\x75\x0c\x71\x55\x08\xf5\xf3\x0c\x0c\x75\x55\xf0\xf4\x73\x71\x8d\x50\xc8\xa8\x4c\x29\x4a\x8c\xcf\x4f\x2c\x2d\xc9" + "\x30\x8a\x4f\x4c\x4e\x4e\x2d\x2e\x8e\x2f\x4a\x2d\x2c\x4d\x2d\x2e\x89\xcf\x4c\x89\xcf\x4c\xa9\x50\xf0\xf7\xc3\xa6" + "\x4a\x41\x03\xa1\x4c\xd3\x9a\xb0\xd9\x45\xa9\x69\x45\xa9\xc5\x19\x84\x0c\x87\x2a\x43\x33\x9d\x0b\xd9\x27\x2e\xf9" + "\xe5\x79\x5c\x2e\x41\xfe\x01\x94\x7a\xc1\x1a\xa7\x29\xa4\x39\xd6\x9a\x0b\x10\x00\x00\xff\xff\x5b\x41\x11\xcf\x69" + "\x01\x00\x00") func bindataMigrationsSqlMysql5sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlMysql5sql, "migrations/sql/mysql/5.sql", ) } func bindataMigrationsSqlMysql5sql() (*asset, error) { bytes, err := bindataMigrationsSqlMysql5sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/mysql/5.sql", size: 361, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlMysql6sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd5\x55\xd0\xce\xcd\x4c\x2f\x4a\x2c\x49\x55\x08\x2d\xe0\x72\x0e\x72" + "\x75\x0c\x71\x55\xf0\xf4\x73\x71\x8d\x50\xc8\xa8\x4c\x29\x4a\x8c\xcf\x4f\x2c\x2d\xc9\x30\x8a\x4f\x4c\x4e\x4e\x2d" + "\x2e\x8e\x2f\x4a\x2d\x2c\x4d\x2d\x2e\x49\x4d\x89\x4f\x2c\x89\xcf\x4c\xa9\x50\xf0\xf7\xc3\xa6\x4e\x41\x03\x59\xa1" + "\xa6\x35\x17\x17\xb2\x45\x2e\xf9\xe5\x79\x5c\x2e\x41\xfe\x01\x94\x5b\x64\xcd\x05\x08\x00\x00\xff\xff\xf1\x5f\x27" + "\x42\xc2\x00\x00\x00") func bindataMigrationsSqlMysql6sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlMysql6sql, "migrations/sql/mysql/6.sql", ) } func bindataMigrationsSqlMysql6sql() (*asset, error) { bytes, err := bindataMigrationsSqlMysql6sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/mysql/6.sql", size: 194, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlMysql7sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x95\x4d\x6a\xc3\x30\x10\x85\xf7\x39\x85\x76\x59\x94\x6c\xba\x0d\x5d" + "\xb8\x95\x0b\x05\x27\x0e\xa9\x0c\xed\xca\x08\x69\x1a\x9b\x52\x3b\x95\x6d\x4a\x6f\x1f\x18\xb0\x10\xfe\xc1\x99\xf1" + "\x01\x9e\xde\xa7\x6f\x64\xcf\x6e\x27\x1e\x7e\xca\x8b\xd3\x2d\x88\xec\xba\x89\x12\x15\x9f\x85\x8a\x9e\x93\x58\x14" + "\xff\xd6\xe9\xbc\xd6\x5d\x5b\x3c\xe6\xda\x18\x68\x1a\x11\x49\x29\x1c\xfc\x76\xd0\xb4\x60\x73\xdd\xd9\x12\x2a\x03" + "\x42\xc5\x1f\x4a\x1c\xb3\x24\xd9\x6f\xb2\x93\x8c\xd4\x74\xf8\x3d\x56\x13\xe1\xa7\xed\x76\xbf\xd8\x7b\x48\xe5\xdb" + "\xeb\xe7\x7c\x75\xda\xd7\xdf\x73\x81\x8b\xd3\x15\x13\x7f\x18\xa5\xc0\xcf\xd4\x7a\xf4\xf9\x73\x1c\x7c\x39\x68\x0a" + "\xa6\xfd\x3e\xcd\xd1\xdf\x67\xd7\xfb\x0f\xef\x40\x1d\x40\x78\x03\xda\x04\x06\xfc\xfc\x11\x98\xda\x02\xd3\x3f\x46" + "\x39\xf2\x31\xb8\xde\xbc\x47\xa7\x6a\xf7\xe0\x34\xe7\x21\x36\x5f\x78\x5d\x5a\xc3\x14\x8e\x51\x8e\x70\x0c\xae\x17" + "\xee\xd1\xa9\xc2\x3d\x38\x4d\x78\x88\xcd\x17\x7e\xfd\x36\xdc\x17\x8e\x51\x8e\x70\x0c\xae\x17\xee\xd1\xa9\xc2\x3d" + "\x38\x4d\x78\x88\xbd\x28\x3c\xdc\xb0\xb2\xfe\xab\x16\xd7\x85\x3c\xa7\x27\xf1\x92\x26\xd9\xe1\x38\x21\x65\x79\xdd" + "\x84\xf9\x21\xdd\x3d\x5b\x86\xdd\x3f\x75\x00\x05\x00\x7f\x1c\xec\xf6\x51\x9a\x52\x8d\x9f\x10\xbb\x7a\x94\xa6\x54" + "\xe3\x63\x62\x57\x8f\xd2\xe3\xea\x5b\x00\x00\x00\xff\xff\xd3\x68\x22\x03\xe3\x09\x00\x00") func bindataMigrationsSqlMysql7sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlMysql7sql, "migrations/sql/mysql/7.sql", ) } func bindataMigrationsSqlMysql7sql() (*asset, error) { bytes, err := bindataMigrationsSqlMysql7sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/mysql/7.sql", size: 2531, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlMysql9sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x58\xd1\x72\xe2\x36\x14\x7d\xcf\x57\xdc\x37\xc2\xb4\xd0\xdd\x4c\xf2" + "\xc4\xb4\x33\x14\x8b\x5d\xa6\xac\xe9\x80\x33\x9b\x7d\x62\x54\xfb\x82\x35\x31\x12\x95\x04\x24\xfd\xfa\x8e\x04\x04" + "\x03\xc6\x96\xb1\x9b\xe6\x15\xeb\x1e\x1f\x7c\xce\x91\x74\x6f\xab\x05\x3f\x2d\xd8\x5c\x52\x8d\xf0\xb8\xbc\xb9\x69" + "\xb5\xa0\xcf\xa4\xd2\xb0\x41\xe0\x88\x11\x68\x01\x11\x26\xa8\x11\x68\x92\x80\x14\x1b\x05\x3a\xa6\x1a\x96\x82\x71" + "\x6d\x9e\x52\xe0\x82\xb7\xf0\x85\x29\xcd\xf8\x1c\x04\x5d\xe9\xf8\x0e\xc2\x84\x21\xd7\xed\x1b\x8f\x0c\x49\x40\xa0" + "\x3f\x1e\x7d\x83\xf8\x35\x92\x74\xba\x5d\x30\xa5\x61\x88\x4a\xc1\xf7\xaf\x64\x4c\xc0\x1f\x05\x40\x9e\x06\x93\x60" + "\x02\xb7\x13\x32\x24\xbd\x00\x3e\xa7\x6b\xb6\x68\xbb\xc5\x19\x30\xed\xed\x82\x29\x8b\xe0\xd7\xa3\x92\x36\x8b\x9a" + "\x9d\xcb\x24\x24\xce\x24\xaa\xb8\x32\x8b\x1d\xce\xb5\x34\x42\x11\x61\x65\x0e\x06\xe4\x5a\x02\x82\x45\x61\x65\x02" + "\x06\xe4\x5a\x02\xcb\xe7\xb0\xfa\x17\x30\x20\x05\x04\x8c\xbf\x25\xfe\xbd\x42\x65\x97\x30\x05\x14\xee\x3f\xc1\x9a" + "\xca\x30\xa6\x12\x18\x07\x1d\x23\x48\x9c\xa1\x44\x1e\x1a\xfb\xd3\xbf\x12\x84\x4d\xcc\xc2\xd8\xac\xde\xc4\xaf\x26" + "\x19\x54\x9a\x45\x8a\xfd\xc3\xf8\xdc\x40\x7e\x6e\xc3\x77\x84\xc5\x4a\x69\x90\xb8\x10\x6b\x4c\xbd\x44\x41\x22\xf8" + "\x1c\xa5\x89\x0d\x37\x2f\x33\x6f\x52\x6d\x08\x62\xa6\x40\xc5\x62\x95\x44\xc0\x71\x8d\x12\x62\xba\x5c\x22\x07\xaa" + "\x60\x83\x8d\x35\xee\x7e\x65\x4a\xad\x0c\x91\x18\x17\x47\x48\x3a\x66\xca\x31\x5e\x43\xe2\x7f\x09\xbe\xde\x1e\x38" + "\x35\xe1\x37\xb8\xff\xe4\x1c\x8c\xf2\xf5\x29\x47\x97\x2f\x4e\xb9\xb1\x7c\x71\xca\x49\x17\x8b\x8d\x64\x77\x6d\xf0" + "\xf1\xc5\xec\x73\x0d\x89\x40\x43\xbd\xa2\x49\xf2\x7a\x50\xb5\x3b\x0c\xc8\x18\x82\xee\xef\xc3\xcc\x1d\x07\xbe\x8d" + "\xbc\x41\xff\x47\xda\x4c\x3b\x13\xdd\xde\x7f\x6a\x5a\x13\xfb\x8f\xc3\x21\x78\xa4\xdf\x7d\x1c\x06\xd0\x68\x74\x2e" + "\x43\xee\xbf\x76\x9d\x98\x56\x81\x3a\x01\xad\x2a\x75\x02\x5a\xa5\xae\x00\x34\xea\x0d\x38\x2c\x25\x2e\xa9\xa4\x9a" + "\x09\x0e\x33\x21\x21\x94\x48\xed\x09\x64\x12\x7c\xd8\x05\x18\x8f\xf0\x05\x28\x8f\xcc\x22\x64\x73\x0e\xcf\xf8\xfa" + "\xb3\x09\xb1\x8d\xab\x42\x0d\xcc\x9e\x63\xfb\xf7\xde\x3d\x3c\x34\x0f\x81\xa7\x89\x12\xe6\x85\x06\x34\x41\x3e\xd7" + "\x31\x88\xd9\xe9\xc6\x52\x2e\x86\x6f\xdc\x8c\x1d\xef\x1e\x1e\xca\xc6\xb0\x44\xfd\x79\x0c\x4b\x14\x9f\xc7\xb0\x44" + "\xf1\x79\x0c\xcf\x8b\x1d\x23\x76\xd0\xf2\x48\xa2\x4a\x11\xab\x05\x33\x1d\xb1\x5a\x00\xd3\x11\xab\x05\x30\x1d\xb1" + "\x32\x80\xc6\xf1\xbe\xd8\x00\xd3\x0d\x05\x9a\x2d\xd0\x04\xc4\x06\x0c\x6d\x12\xb6\xa1\xb2\xa9\xdb\xa3\xde\xf4\xc6" + "\xa4\x1b\x10\x18\xf8\x1e\x79\xca\x92\x73\xfa\xb6\x74\xca\xa2\x17\x18\xf9\x99\x9a\xa7\x6c\xd2\xc9\x81\xdc\xc9\x59" + "\x80\xb9\x17\xdd\x11\xd4\xe8\x59\x80\x68\x25\x77\x84\x33\x6a\x16\xc0\x59\xc1\x1d\xe1\x8c\x96\x05\x70\x56\xee\x23" + "\x38\x7b\x9f\x3f\xec\x7b\x0a\x94\xa6\x52\x43\x8c\x12\xed\x33\x7b\x09\xd9\x0a\x6b\xae\x42\xa9\x2d\x72\x7b\xcb\x0f" + "\xa9\x0a\x69\x84\xbb\x16\xa0\xa1\x80\xcd\x4e\xf7\x57\xb5\xbb\xf2\x44\xed\xc2\x40\x77\x3d\x0f\x7a\x23\x7f\x12\x8c" + "\xbb\x03\x3f\x28\x30\xc9\xec\x19\xfa\xa3\x31\x19\x7c\xf1\xe1\x0f\xf2\x23\xfd\xb7\x60\x4c\xfa\x64\x4c\xfc\x1e\x99" + "\x1c\xed\xc4\xb7\xe6\xd9\xc8\x87\xdd\xa6\xd4\xeb\x4e\x7a\x5d\x8f\x38\x6c\x0a\x79\xbc\xce\x9d\xf6\x0e\xc4\xac\xcd" + "\xf2\x58\x9d\x58\xf5\x1d\x28\x59\xab\xe6\x51\x3a\xb1\xfb\x3b\x50\xb2\x76\xcf\xa3\x74\x12\x99\xfa\x28\x55\x8a\x8e" + "\xe0\xca\x34\x30\x54\x29\x11\x32\xaa\x31\x82\x0d\xd3\xb1\xbd\xcf\xd7\x9e\xa6\x98\x26\xe6\xd6\x82\x99\x7f\x3f\xf5" + "\x30\xe3\x0b\xbc\x39\xcd\xd2\x9d\xee\x6f\x68\x31\xe5\x51\x82\xd1\xa1\xfa\x3f\x8c\xdc\x87\x63\xef\x98\xcb\x0f\xc7" + "\xdb\x31\xbc\x1f\x8e\xb7\x63\xc2\xff\x2f\xde\x37\xe9\xe9\x99\x27\x36\xdc\xfe\xe2\x49\xb1\x54\x27\xa7\x64\x6a\x77" + "\x28\xcc\xb5\x37\x1e\xfd\x79\xf4\x1f\x8a\xce\x49\x87\xb8\xe5\x63\x66\x9d\x71\x45\x29\xc8\x47\x3c\x3b\x9f\x8a\xcc" + "\x99\x0f\x77\x76\xb6\x14\x79\x26\x1f\xee\xec\x5c\xe8\x9c\x0a\xb7\x97\xfd\x97\x54\x63\x5a\xbf\x86\xc7\xbe\xad\x4f" + "\x46\x67\x5c\x67\x25\x9d\x11\x9d\xc5\x74\x46\x74\xd6\xf3\x14\xf1\x58\xd2\xac\x96\xc5\xa2\x56\x6b\x58\x3a\x17\x41" + "\x4a\xb5\x28\x97\x61\x1c\x9b\x92\xcb\x00\x8e\x6d\xc8\x65\x00\xc7\xc6\xe3\x6c\xb8\xba\xa1\xca\x8e\x57\x52\xb3\x15" + "\x3b\xd3\x31\xcd\xe6\xad\xb9\xf2\x88\x95\x86\x08\x67\x74\x95\xe8\x26\xb4\x20\x41\xd3\x6d\x4a\x5c\xa3\xd4\xf6\x0a" + "\x55\x61\x06\x57\x7d\x42\x50\x0f\x68\xc1\x14\xae\xe2\x8c\xa0\x1e\xc4\x82\x39\x5c\xce\x94\xa0\xf4\x00\x27\x20\x4f" + "\xc1\x1b\xd6\x35\xd3\x1a\x57\x80\xec\xd1\x8c\x6b\x75\xf6\x1c\xc6\xb5\x3a\x7b\xe8\x72\x5c\xfd\x6f\x00\x00\x00\xff" + "\xff\xf1\x23\xf1\xe9\x77\x1b\x00\x00") func bindataMigrationsSqlMysql9sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlMysql9sql, "migrations/sql/mysql/9.sql", ) } func bindataMigrationsSqlMysql9sql() (*asset, error) { bytes, err := bindataMigrationsSqlMysql9sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/mysql/9.sql", size: 7031, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlPostgresGitkeep = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") func bindataMigrationsSqlPostgresGitkeepBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlPostgresGitkeep, "migrations/sql/postgres/.gitkeep", ) } func bindataMigrationsSqlPostgresGitkeep() (*asset, error) { bytes, err := bindataMigrationsSqlPostgresGitkeepBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/postgres/.gitkeep", size: 0, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlPostgres5sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd5\x55\xd0\xce\xcd\x4c\x2f\x4a\x2c\x49\x55\x08\x2d\xe0\x72\x0e\x72" + "\x75\x0c\x71\x55\x08\xf5\xf3\x0c\x0c\x75\x55\xf0\xf4\x73\x71\x8d\x50\xc8\xa8\x4c\x29\x4a\x8c\xcf\x4f\x2c\x2d\xc9" + "\x30\x8a\x4f\x4c\x4e\x4e\x2d\x2e\x8e\x2f\x4a\x2d\x2c\x4d\x2d\x2e\x89\xcf\x4c\x89\xcf\x4c\xa9\x50\xf0\xf7\xc3\xa6" + "\x4a\x41\x03\xa1\x4c\xd3\x9a\xb0\xd9\x45\xa9\x69\x45\xa9\xc5\x19\x84\x0c\x87\x2a\x43\x33\x9d\x0b\xd9\x27\x2e\xf9" + "\xe5\x79\x5c\x2e\x41\xfe\x01\x44\x7b\xc1\x1a\xa7\x72\xec\xae\xb2\xe6\x02\x04\x00\x00\xff\xff\x35\xd0\xf0\x59\x3a" + "\x01\x00\x00") func bindataMigrationsSqlPostgres5sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlPostgres5sql, "migrations/sql/postgres/5.sql", ) } func bindataMigrationsSqlPostgres5sql() (*asset, error) { bytes, err := bindataMigrationsSqlPostgres5sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/postgres/5.sql", size: 314, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlPostgres6sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd5\x55\xd0\xce\xcd\x4c\x2f\x4a\x2c\x49\x55\x08\x2d\xe0\x72\x0e\x72" + "\x75\x0c\x71\x55\xf0\xf4\x73\x71\x8d\x50\xc8\xa8\x4c\x29\x4a\x8c\xcf\x4f\x2c\x2d\xc9\x30\x8a\x4f\x4c\x4e\x4e\x2d" + "\x2e\x8e\x2f\x4a\x2d\x2c\x4d\x2d\x2e\x49\x4d\x89\x4f\x2c\x89\xcf\x4c\xa9\x50\xf0\xf7\xc3\xa6\x4e\x41\x03\x59\xa1" + "\xa6\x35\x17\x17\xb2\x45\x2e\xf9\xe5\x79\x5c\x2e\x41\xfe\x01\x24\x58\x64\xcd\x05\x08\x00\x00\xff\xff\xd2\x18\x3e" + "\xa9\xab\x00\x00\x00") func bindataMigrationsSqlPostgres6sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlPostgres6sql, "migrations/sql/postgres/6.sql", ) } func bindataMigrationsSqlPostgres6sql() (*asset, error) { bytes, err := bindataMigrationsSqlPostgres6sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/postgres/6.sql", size: 171, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlPostgres7sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x93\xb1\x4e\x85\x30\x14\x86\x77\x9f\xe2\x6c\x77\x30\x77\x71\x75\xaa" + "\xb6\x4e\x15\x0c\x69\x13\x37\xd2\xb4\x47\x20\x46\x8a\x2d\xc4\xf8\xf6\x26\x0c\x84\x58\x6e\x28\xa5\x0f\x70\xbe\xef" + "\x4b\xf3\xf7\x7a\x85\xfb\xaf\xae\x71\x6a\x44\x90\xc3\x1d\xe1\x82\x55\x20\xc8\x13\x67\xd0\xfe\x1a\xa7\x6a\xab\xa6" + "\xb1\x7d\xa8\x95\xd6\xe8\x3d\x10\x4a\xc1\xe1\xf7\x84\x7e\x44\x53\xab\xc9\x74\xd8\x6b\x04\xc1\xde\x05\x14\x92\x73" + "\xa0\xec\x85\x48\x2e\xe0\x72\x79\x8c\x82\x35\x4e\xf5\x11\xa8\xdb\x2c\x87\x1f\x0e\x7d\x9b\xa9\x6c\x4d\x3b\x9d\xa6" + "\xad\xc1\x4c\x5d\x0b\xea\x74\x94\xed\x8c\xce\x14\xb5\xa0\x4e\x47\x0d\x9f\x3a\xd7\x4b\x2d\xa8\xd8\xa8\xf5\x0f\xa0" + "\xf6\xa7\xdf\x9d\x2d\xad\xca\x37\x78\x2e\xb9\x7c\x2d\x36\x7a\xf7\x67\xbf\xbe\xff\x1f\x19\xb3\xf4\x64\xff\x16\xe0" + "\x48\xc0\x3c\xc2\x64\x7b\x70\x7d\x44\x3d\x4f\x2d\x59\x1d\x5c\x1f\x51\xcf\x83\x4a\x56\x07\xd7\xa1\xfa\x2f\x00\x00" + "\xff\xff\xfa\x0a\xa4\x20\x83\x05\x00\x00") func bindataMigrationsSqlPostgres7sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlPostgres7sql, "migrations/sql/postgres/7.sql", ) } func bindataMigrationsSqlPostgres7sql() (*asset, error) { bytes, err := bindataMigrationsSqlPostgres7sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/postgres/7.sql", size: 1411, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlPostgres9sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x58\x51\x73\xe2\x36\x10\x7e\xcf\xaf\xd8\x99\x3e\x24\x4c\x0f\x9a\xcb" + "\x24\x0f\x2d\x73\x9d\xa1\xa0\xdc\x31\xe5\xcc\x0d\x38\x73\xb9\x27\x46\xb5\x17\xac\x89\x91\xa8\x24\x20\xe9\xaf\xef" + "\x48\x86\x60\xb0\xb1\x65\x43\xd3\xbc\xe2\xdd\xcf\x1f\xfe\xf6\x5b\xad\xb6\xd9\x84\x9f\xe7\x6c\x26\xa9\x46\x78\x58" + "\x5c\x5c\x34\x9b\x70\xcf\xa4\xd2\xb0\x46\xe0\x88\x21\x68\x01\x21\xc6\xa8\x11\x68\x1c\x83\x14\x6b\x05\x3a\xa2\x1a" + "\x16\x82\x71\x6d\x9e\x52\xe0\x82\x37\xf1\x99\x29\xcd\xf8\x0c\x04\x5d\xea\xe8\x06\x82\x98\x21\xd7\xad\x8b\x1e\x19" + "\x10\x9f\xc0\xfd\x68\xf8\x15\xa2\x97\x50\xd2\x49\x12\x30\xa1\x41\x80\x4a\xc1\xf7\x2f\x64\x44\xc0\x1b\xfa\x40\x1e" + "\xfb\x63\x7f\x0c\x57\x63\x32\x20\x5d\x1f\x3e\xa6\x73\x12\xb4\x4d\x70\x0e\x4c\x2b\x09\x98\xb0\x10\x3e\xed\xa5\xb4" + "\x58\xd8\x68\x1f\x27\x21\x71\x2a\x51\x45\x27\xb3\xd8\xe0\xd4\xa5\x11\x88\x10\x4f\xe6\x60\x40\xea\x12\x10\x2c\x0c" + "\x4e\x26\x60\x40\xea\x12\x58\x3c\x05\xa7\x7f\x01\x03\x52\x42\xc0\xd4\xb7\xc4\xbf\x97\xa8\x6c\x08\x53\x40\xe1\xf6" + "\x1a\x56\x54\x06\x11\x95\xc0\x38\xe8\x08\x41\xe2\x14\x25\xf2\xc0\x94\x3f\xfd\x2b\x46\x58\x47\x2c\x88\x4c\xf4\x3a" + "\x7a\x31\xce\xa0\xd2\x04\x29\xf6\x0f\xe3\x33\x03\xf9\xb1\x05\xdf\x11\xe6\x4b\xa5\x41\xe2\x5c\xac\x30\xf5\x12\x05" + "\xb1\xe0\x33\x94\xc6\x36\xdc\xbc\xcc\xbc\x49\xb5\xc0\x8f\x98\x02\x15\x89\x65\x1c\x02\xc7\x15\x4a\x88\xe8\x62\x81" + "\x1c\xa8\x82\x35\x5e\xae\x70\xf3\x2b\x53\x6a\x69\x88\x44\x38\xdf\x43\xd2\x11\x53\x8e\xf6\x1a\x10\xef\xb3\xff\xe5" + "\x6a\xc7\xa9\x01\xbf\xc3\xed\xb5\xb3\x31\xaa\xe7\xa7\x2a\xba\x7a\x72\xaa\x1a\xab\x27\xa7\x2a\xe9\x68\xb2\x91\xec" + "\xa6\x05\x1e\x3e\x9b\x3e\x77\x29\x11\x68\xa0\x97\x34\x8e\x5f\x76\xaa\x76\x06\x3e\x19\x81\xdf\xf9\x63\x90\xdb\x71" + "\x20\x79\xde\x1d\x0e\x1e\xbe\x7a\xe9\x92\xf2\x7f\x7c\x23\xdb\x7a\xba\xba\xbd\x6e\xb4\x8f\x23\x6d\x3f\xf2\x19\xa0" + "\xec\xf7\x3e\x03\x8e\xfd\xf4\x67\xc0\xb1\x2a\xb8\xe3\x18\x41\xfa\x1c\x16\x12\x17\x54\x52\xcd\x04\x87\xa9\x90\x10" + "\x48\xa4\xf6\x50\x31\xa6\xdc\x19\x9b\xf1\x10\x9f\x81\xf2\xd0\x04\x21\x9b\x71\x78\xc2\x97\x0f\xc6\x97\xd6\x81\x0a" + "\x35\x30\x7b\x34\x6d\xdf\x71\x73\x77\xd7\xd8\x79\x98\xc6\x4a\x98\x17\x1a\xd0\x18\xf9\x4c\x47\x20\xa6\x87\xbd\xa2" + "\x9a\xb3\x5e\xb9\x99\x0a\xbb\xb9\xbb\xab\xea\xac\x0a\xf9\x59\x67\x55\x48\xce\x3a\xab\x42\x72\xd6\x59\xd9\xe4\x4a" + "\xae\xd9\x29\xba\x57\x11\x46\xad\xaa\xae\xa9\x07\x95\x75\x4d\x3d\x9c\xac\x6b\xea\xe1\x64\x5d\x53\x88\x63\x8a\xd8" + "\x13\x6b\x60\xfa\x52\x81\x66\x73\x34\x35\x6f\x3d\x83\xb6\xb8\x13\x9f\x58\x23\x6d\x61\x2e\xba\x23\xd2\xf1\x09\xf4" + "\xbd\x1e\x79\xcc\x53\x68\xf2\x1a\x3a\x61\xe1\x33\x0c\xbd\x5c\x19\x53\xca\xb7\x0b\x20\x37\x52\x95\x60\x6e\x05\x75" + "\x04\x35\xa2\x95\x20\x5a\x5d\x1d\xe1\x8c\x76\x25\x70\x56\x5e\x47\x38\x23\x61\x09\x9c\x55\x79\x0f\xce\x4e\xdd\xbb" + "\x56\xa6\x40\x69\x2a\x35\x44\x28\xd1\x3e\xb3\xa3\x42\x40\x97\x0a\x43\xf8\xe9\xe3\xcd\xf5\xaf\xbf\x99\x5f\xc7\xc4" + "\x07\x85\x4a\x31\xc1\x27\x12\x17\x31\x0b\x6c\xe7\x9c\x48\x11\x23\x7c\x82\xcd\x4f\xed\x14\x82\x2d\x0d\x33\xf2\xa4" + "\xfa\x66\x32\xcd\x07\x54\x05\x34\xc4\xcd\xa8\x7f\xa9\x80\x4d\x0f\x9b\xae\xda\x8c\x36\x61\xab\xdc\xe5\xbd\x1e\x74" + "\x87\xde\xd8\x1f\x75\xfa\x9e\x5f\x52\x66\xd3\x27\xb8\x1f\x8e\x48\xff\xb3\x07\x7f\x92\x1f\xe9\x0f\x03\x23\x72\x4f" + "\x46\xc4\xeb\x92\xf1\x5e\x7b\xbe\x32\xcf\x86\x1e\x6c\x3a\x55\xb7\x33\xee\x76\x7a\xc4\xa5\x65\x14\xf0\xca\xd6\xea" + "\x1b\x10\x4b\x1a\x50\x01\xab\x83\x62\x7f\x03\x4a\x49\x2f\x2b\xa0\x74\x60\x98\x37\xa0\x94\xb4\xc5\x02\x4a\x07\xa6" + "\x3b\x1f\xa5\x93\xac\x23\xb8\x32\x17\x15\xaa\x94\x08\x18\xd5\x18\xc2\x9a\xe9\xc8\xce\xed\x67\x77\x53\x44\x63\x33" + "\xca\x60\xee\xdf\x4f\x3d\xcc\xf9\x02\xaf\x95\x66\xe9\x4e\xb6\x73\x5a\x44\x79\x18\x63\xb8\xcb\xfe\x0f\x2d\xf7\xee" + "\xd8\x3b\xfa\xf2\xdd\xf1\x76\x34\xef\xbb\xe3\xed\xe8\xf0\xff\x8b\x77\xed\x33\xb8\x47\xee\x3b\x0f\x03\x3f\x41\x78" + "\xdd\xb3\xf5\xc4\x9a\xdb\x5f\x7a\x52\x2c\xd4\xc1\x39\x9b\xea\x2f\xa5\x9d\xa1\x37\x1a\x7e\xab\x72\xd0\x3a\xf8\xb5" + "\x10\x32\xef\x8c\x2c\x73\x51\x21\x60\xe6\x78\x2b\xab\xed\x42\xb4\xcc\xc9\x54\x56\x71\x85\x68\x99\x43\xa5\x7d\xa8" + "\xd9\xb6\x66\x7e\x49\xdd\x6d\xcf\x2e\xdf\x7e\xcd\x9f\x4d\x41\x67\x58\x57\x11\x9d\x01\x5d\x75\x74\x06\x74\x95\xf2" + "\x10\x70\x5f\xcd\xbc\xcb\x92\x05\x75\xbc\x2a\xb5\x8f\x46\xe7\xde\x82\x8e\x87\x67\xef\x37\xc7\x63\xb3\x97\x97\xe3" + "\xb1\xd9\x9b\x49\x66\x1d\xba\xa6\xca\x6e\x4f\x52\xab\x93\xdb\xeb\x06\x78\x0f\x83\x01\x5c\x99\xe1\x45\x2c\x35\x84" + "\x38\xa5\xcb\x58\x37\xa0\x09\x31\x9a\x9b\xa7\xc4\x15\x4a\x6d\x87\xa1\xf3\x6c\xcd\xea\x2c\x00\x6a\x62\xb9\xef\xcd" + "\x2a\xaf\x00\x6a\x02\xb9\x6f\xce\x76\x4b\x80\xdd\xe9\x91\xa3\xa0\x09\xfb\x90\x95\xca\x61\xee\x2c\x58\x44\xf8\xe4" + "\xd1\x3f\x71\x47\x53\x02\x51\xba\x9b\x29\xc9\x2f\xdd\xc9\x94\xe4\x97\xee\x62\x92\xfc\x7f\x03\x00\x00\xff\xff\x31" + "\x85\x44\xc6\x40\x1b\x00\x00") func bindataMigrationsSqlPostgres9sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlPostgres9sql, "migrations/sql/postgres/9.sql", ) } func bindataMigrationsSqlPostgres9sql() (*asset, error) { bytes, err := bindataMigrationsSqlPostgres9sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/postgres/9.sql", size: 6976, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlShared1sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\x31\x6f\xf2\x30\x10\x86\x67\xfb\x57\xdc\x08\xfa\x60\x41\x62\x62" + "\xca\x57\x8c\x84\x9a\x02\x0a\x41\x2a\x53\x74\xb2\x8f\xc4\x52\x63\xa7\xb6\x53\xda\x7f\x5f\x85\xa6\x82\x22\x22\xb5" + "\x03\x5b\xb2\x3e\xef\xbd\xb1\x1e\x5b\x37\x1e\xc3\xbf\x52\xe7\x0e\x03\xc1\xae\xe2\x0f\x89\x88\x52\x01\x69\xf4\x3f" + "\x16\xb0\x5c\xc0\x6a\x9d\x82\x78\x5e\x6e\xd3\x2d\x14\x1f\xca\x61\x66\xb1\x0e\xc5\x24\x43\x29\xc9\x7b\x18\x70\xe6" + "\x75\x6e\x30\xd4\x8e\xe0\xf4\xb1\x37\x74\xb2\x40\x37\x98\x4c\xa7\xc3\xd3\xf8\x6a\x17\xc7\xb0\x49\x96\x4f\x51\xb2" + "\x87\x47\xb1\x1f\x71\xe6\xe8\xb5\x26\x1f\x32\xad\x00\x18\xc0\xcd\x91\x73\x8c\x54\x86\x01\x80\x05\x5d\x92\x0f\x58" + "\x56\xe7\xda\xb9\x58\x44\xbb\x38\x05\x63\x8f\x83\xe1\x88\x33\xf9\xa2\xc9\xb4\xbd\x0c\x20\xd0\x7b\xb8\x2c\xf4\xd2" + "\x56\xd4\x20\xd6\x1c\xf5\x9a\xe6\x0e\x4d\xf3\xb3\xaf\x14\xbb\xc6\x07\xeb\xca\x4c\x61\xc0\x8e\x6e\xf2\x5e\x5b\xf3" + "\x9d\xf8\x81\xf9\x70\xc6\x7f\xad\xd6\xd1\xc1\x91\x2f\x7a\xb7\x77\x70\x2b\xad\xa2\x5e\xec\x1d\xc4\x5a\xad\x64\x2f" + "\xf6\x0f\x62\x2f\xf7\xee\xdc\x1e\x0d\x9f\x27\xeb\x4d\xeb\xf9\xc6\xa6\x9d\x75\xf2\x76\x5d\x74\x07\x9a\x37\xdf\x4d" + "\x9b\x8b\x9b\xf1\xcf\x00\x00\x00\xff\xff\x94\xd2\x19\xdf\x06\x06\x00\x00") func bindataMigrationsSqlShared1sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlShared1sql, "migrations/sql/shared/1.sql", ) } func bindataMigrationsSqlShared1sql() (*asset, error) { bytes, err := bindataMigrationsSqlShared1sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/shared/1.sql", size: 1542, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlShared2sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x90\xb1\x0a\xc2\x30\x14\x45\xf7\x7e\xc5\xdd\xaa\x48\x97\x42\x27\xa7" + "\x68\xea\x14\x5b\x29\xc9\x5c\x62\x1a\x4d\x05\x8d\xbc\xb4\x8a\x7f\x2f\x14\x04\x07\x45\x0b\xfd\x80\x73\x2e\xf7\x24" + "\x09\x16\xe7\xf6\x48\xba\xb3\x50\xd7\x88\x09\x99\x57\x90\x6c\x25\x72\xb8\x47\x43\xba\xf6\xba\xef\x5c\x5a\x6b\x63" + "\x6c\x08\x60\x9c\x23\xf4\xfb\x93\x35\x1d\x6e\x9a\x8c\xd3\x34\x4b\xb3\x6c\x8e\xa2\x94\x28\x94\x10\xe0\xf9\x86\x29" + "\x21\x11\xc7\xcb\xef\x36\xb2\x07\xb2\xc1\x4d\xa5\x33\xbe\xb1\x53\xb9\x7c\xdb\x98\x91\xae\xe8\x3d\x22\xf7\xf7\xcb" + "\xcf\x8c\xe0\x55\xb9\xc3\xba\x14\x6a\x5b\xbc\x86\xfe\xc8\x35\x8e\x1a\xaa\x8c\x43\x86\xf3\x1f\x91\x67\x00\x00\x00" + "\xff\xff\xa3\x05\x9b\x27\x28\x02\x00\x00") func bindataMigrationsSqlShared2sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlShared2sql, "migrations/sql/shared/2.sql", ) } func bindataMigrationsSqlShared2sql() (*asset, error) { bytes, err := bindataMigrationsSqlShared2sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/shared/2.sql", size: 552, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlShared3sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x91\xb1\x6e\xc2\x30\x10\x86\x67\xfb\x29\x6e\x24\x2a\x2c\x48\x4c\x4c" + "\x69\x63\xa4\xa8\x29\xa0\x90\x48\x65\x8a\xae\xc9\x35\x71\xdb\xd8\xa9\x7d\x29\xed\xdb\x57\x01\x2a\x10\x50\xaf\xdf" + "\x7f\xdf\xd9\xfe\x27\x13\xb8\x6b\x75\xed\x90\x09\xf2\x4e\x3e\xa4\x2a\xcc\x14\x64\xe1\x7d\xa2\x20\x5e\xc0\x72\x95" + "\x81\x7a\x8e\x37\xd9\x06\x9a\x9f\xca\x61\x61\xb1\xe7\x66\x5a\x74\xef\x25\xc1\x48\x0a\xaf\x6b\x83\xdc\x3b\x82\xfd" + "\x11\x5f\xe8\xca\x06\xdd\x68\x3a\x9b\x05\xfb\xe1\x65\x9e\x24\xb0\x4e\xe3\xa7\x30\xdd\xc2\xa3\xda\x8e\xa5\x70\xf4" + "\xd9\x93\xe7\x42\x57\x00\x02\xe0\xe6\xc8\x29\x46\x55\x81\x0c\x20\x58\xb7\xe4\x19\xdb\xee\xa4\x8d\xd4\x22\xcc\x93" + "\x0c\x8c\xdd\x8d\x82\xb1\x14\xe5\x87\x26\x73\xf4\x0a\x00\xa6\x6f\x3e\x17\xfa\xd2\x76\x34\x20\x31\x5c\xf5\x92\xd6" + "\x0e\xcd\xb0\xec\x90\x12\x97\xf8\xd5\xba\xb6\xa8\x90\xf1\x1f\x37\x79\xaf\xad\xf9\x4b\x5c\xe1\xfe\xe5\x8d\x4a\x86" + "\xc3\xea\x9b\x2f\x96\xc1\x5c\xca\xf3\x36\x22\xbb\x33\x32\x4a\x57\xeb\x63\x1b\x57\xff\x3f\x97\xbf\x01\x00\x00\xff" + "\xff\x58\x5f\xd7\xfa\xbd\x01\x00\x00") func bindataMigrationsSqlShared3sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlShared3sql, "migrations/sql/shared/3.sql", ) } func bindataMigrationsSqlShared3sql() (*asset, error) { bytes, err := bindataMigrationsSqlShared3sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/shared/3.sql", size: 445, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlShared4sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\xd0\xb1\x0e\x82\x30\x10\xc6\xf1\x9d\xa7\xf8\x76\xc3\xe2\xea\x54\x6c" + "\x9d\x4e\x6a\x48\x3b\x93\xa6\x9c\x42\x8c\x96\x14\xd4\xf8\xf6\x26\xc4\xc1\x41\x23\xa4\x0f\xf0\xfd\xef\xf2\xcb\x73" + "\xac\x2e\xdd\x29\xba\x91\x61\xfb\x4c\x90\x51\x15\x8c\x28\x48\xa1\x7d\x36\xd1\xd5\xc1\xdd\xc6\x76\x5d\x3b\xef\x79" + "\x18\x20\xa4\x84\xf3\x63\x77\x67\x14\x5a\x13\x4a\x6d\x50\x5a\x22\x48\xb5\x13\x96\x0c\x4c\x65\xd5\xe6\x77\x26\xf2" + "\x31\xf2\xd0\x26\x77\x7c\x68\x38\x39\x12\xba\xc6\x27\x47\xfa\xb3\x9f\xfd\x49\xf6\xa9\x2d\xc3\xe3\xfa\xd7\x5b\x56" + "\xfa\x80\xad\x26\xbb\x2f\xdf\x07\x66\xe0\x2e\x1a\x4d\x92\x8b\x16\x13\xdb\xa2\xc5\x64\xf4\x6d\xf1\x0a\x00\x00\xff" + "\xff\xcb\x7a\x0d\xdc\x7e\x02\x00\x00") func bindataMigrationsSqlShared4sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlShared4sql, "migrations/sql/shared/4.sql", ) } func bindataMigrationsSqlShared4sql() (*asset, error) { bytes, err := bindataMigrationsSqlShared4sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/shared/4.sql", size: 638, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlShared8sql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\xd0\xc1\x0a\x82\x40\x10\xc6\xf1\xbb\x4f\x31\xc7\x22\x84\x88\x6e\x9d" + "\xac\xf5\xb6\x69\x88\x9e\x65\x98\x9d\x5c\xc9\x5c\x19\xad\xe8\xed\x03\x4f\x75\x90\xc4\x7d\x80\xef\xcf\xc7\x2f\x0c" + "\x61\x73\xaf\x2b\xc1\x81\xa1\xe8\x82\x48\xe7\x71\x06\x79\x74\xd4\x31\xd8\xb7\x11\x2c\x1d\x3e\x06\xbb\x2b\x91\x88" + "\xfb\x1e\x22\xa5\x80\x2c\x36\x0d\xb7\x15\x97\xb5\x81\x27\x0a\x59\x94\xd5\x7e\xbb\x86\xa4\xd0\xfa\x30\x9d\x10\xbe" + "\x0a\xf7\xd6\xab\x41\xce\xb0\x57\xc0\xd5\x86\xbc\x02\xdd\x8d\x66\x3d\x08\xbe\x65\x95\x7b\xb5\x7f\x6d\x41\x65\xe9" + "\x05\x4e\xa9\x2e\xce\xc9\x4f\x7d\x86\xe9\x82\xe9\x48\xb9\x60\x37\x0a\x2e\xd8\x8d\x70\xd3\xbb\x4f\x00\x00\x00\xff" + "\xff\x36\xe3\x63\x3b\x89\x02\x00\x00") func bindataMigrationsSqlShared8sqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlShared8sql, "migrations/sql/shared/8.sql", ) } func bindataMigrationsSqlShared8sql() (*asset, error) { bytes, err := bindataMigrationsSqlShared8sqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/shared/8.sql", size: 649, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTestsGitkeep = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") func bindataMigrationsSqlTestsGitkeepBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTestsGitkeep, "migrations/sql/tests/.gitkeep", ) } func bindataMigrationsSqlTestsGitkeep() (*asset, error) { bytes, err := bindataMigrationsSqlTestsGitkeepBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/.gitkeep", size: 0, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests1testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x93\x41\x4b\x03\x31\x10\x85\xcf\xcd\xaf\x98\x5b\x76\x31\x7b\xa8\x57" + "\x4f\x82\x3d\x14\x64\x0b\xb6\xd5\x63\x18\x92\x69\x36\x60\x93\x3a\x93\x45\x44\xfc\xef\xd2\xcd\xa2\x9e\xbc\xb7\x87" + "\xc0\xbc\xf7\xe0\x3d\xbe\x43\xba\x0e\x6e\x8e\x31\x30\x16\x82\xfd\x49\xad\xfb\xed\xea\x69\x07\xeb\x7e\xb7\x51\x8b" + "\xe1\xc3\x33\xda\x8c\x63\x19\x6e\x2d\x3a\x47\x22\xd0\x48\x0c\x09\xcb\xc8\x64\x80\xe9\x6d\x24\x29\x36\xfa\x9f\x9b" + "\xbc\xc5\x62\xc0\xbd\x46\x4a\x35\x10\x97\x4f\x64\x20\x30\xa6\x73\x3a\xcb\x43\xe6\xa3\xf5\x58\xd0\x80\x90\x48\xcc" + "\x69\x52\xad\x7a\xbe\x7f\xdc\xaf\xb6\x6a\xd1\xe8\x65\x27\x31\x68\x03\x7a\xd9\xcd\xe5\xda\x40\xbf\x79\x69\xda\xc9" + "\xab\x13\x35\x9f\x4a\xeb\x39\xef\xfc\x5a\xe7\xf7\xf9\xa5\xdb\x3b\xf5\x0f\x1c\xd3\x81\x49\x86\x2b\xa5\x73\xd9\xd3" + "\x95\xa2\xe5\xe8\xdd\x45\xa3\xfd\xfd\x7f\x0f\xf9\x3d\xa9\xef\x00\x00\x00\xff\xff\x72\x0a\x2b\x58\x91\x03\x00\x00" + "") func bindataMigrationsSqlTests1testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests1testsql, "migrations/sql/tests/1_test.sql", ) } func bindataMigrationsSqlTests1testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests1testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/1_test.sql", size: 913, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests2testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x93\xbf\x4e\xc3\x30\x10\xc6\xe7\xfa\x29\x6e\x73\x22\x9c\x25\x2b\x13" + "\x12\x1d\x2a\xa1\x54\xa2\x2d\x8c\xd6\x61\x5f\x13\x23\x6a\x97\x3b\x47\x08\x21\xde\x1d\xb5\x0e\x7f\x26\x1e\xa0\x19" + "\x2c\xdd\x7d\x9f\xe5\x9f\x7e\x83\x9b\x06\xae\x0e\xa1\x67\xcc\x04\xbb\xa3\x5a\x75\x9b\xe5\xfd\x16\x56\xdd\x76\xad" + "\x16\xc3\xbb\x67\xb4\x09\xc7\x3c\xb4\x16\x9d\x23\x11\xa8\x24\xf4\x11\xf3\xc8\x64\x80\xe9\x75\x24\xc9\x36\xf8\x9f" + "\x99\xbc\xc5\x6c\xc0\xbd\x04\x8a\xa5\x10\x97\x8e\x64\xa0\x67\x8c\xa7\x76\x5a\xf7\x89\x0f\xd6\x63\x46\x03\x42\x22" + "\x21\xc5\xef\x6d\x7c\x7a\x26\x97\x6b\xf5\x70\x73\xb7\x5b\x6e\xd4\xa2\xd2\x6d\x23\xa1\xd7\x06\x74\xdb\x4c\x14\x6d" + "\xa0\x5b\x3f\x56\xf5\x39\x2b\xac\xd2\x9f\x5f\x2f\xe3\x04\xfc\x8d\x4e\xe7\xe3\x73\xba\x57\x28\xba\xbe\x56\xff\x28" + "\x33\xed\x99\x64\x98\x95\xb3\x4b\x9e\x66\x25\x9c\x82\x77\x17\x28\xfc\xf7\x5f\xdf\xa6\xb7\xa8\xbe\x02\x00\x00\xff" + "\xff\x68\x3d\x71\xc0\xe9\x03\x00\x00") func bindataMigrationsSqlTests2testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests2testsql, "migrations/sql/tests/2_test.sql", ) } func bindataMigrationsSqlTests2testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests2testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/2_test.sql", size: 1001, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests3testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x94\xcf\x4a\x03\x31\x10\x87\xcf\xcd\x53\xcc\x2d\xbb\x98\xbd\xd8\xa3" + "\x27\xc1\x1e\x0a\xb2\x05\xdb\xea\x31\x8c\xc9\x74\x37\x6a\x93\x35\x93\x45\x44\x7c\x77\xe9\x26\xfe\x39\xf9\x00\xdd" + "\x43\x60\x66\x7e\x21\x1f\x1f\x81\x69\x1a\xb8\x38\xba\x2e\x62\x22\xd8\x0f\x42\xac\xdb\xed\xea\x6e\x07\xeb\x76\xb7" + "\x11\x8b\xfe\xdd\x46\xd4\x01\xc7\xd4\x5f\x6a\x34\x86\x98\xa1\x62\xd7\x79\x4c\x63\x24\x05\x91\x5e\x47\xe2\xa4\x9d" + "\xfd\xa9\xc9\x6a\x4c\x0a\xcc\x8b\x23\x9f\x03\x36\x61\x20\x05\x5d\x44\x7f\x4a\x4b\x7b\x08\xf1\xa8\x2d\x26\x54\xc0" + "\xc4\xec\x82\xff\xee\xc6\xc7\x27\x32\xa9\x16\xf7\xd7\xb7\xfb\xd5\x56\x2c\x2a\xb9\x6c\xd8\x75\x52\x81\x5c\x36\x85" + "\x22\x15\xb4\x9b\x87\xaa\x9e\x66\x99\x95\xf3\xe9\xf5\x5c\x16\xe0\xef\xe8\x74\x3e\x3e\xcb\xbd\x4c\x91\xf5\xd5\x7f" + "\xca\x91\x0e\x91\xb8\x9f\x95\xb3\x09\x96\x66\x25\x1c\x9c\x35\xb3\x12\x1e\x9e\xcd\x39\xfe\xf0\xdf\x4d\x76\x13\xde" + "\xbc\xf8\x0a\x00\x00\xff\xff\xf0\x6b\xe4\x10\xdb\x04\x00\x00") func bindataMigrationsSqlTests3testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests3testsql, "migrations/sql/tests/3_test.sql", ) } func bindataMigrationsSqlTests3testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests3testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/3_test.sql", size: 1243, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests4testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x94\x4f\x4b\x03\x31\x10\xc5\xcf\xcd\xa7\x98\x5b\x76\x31\x7b\x91\xde" + "\x3c\x09\xf6\x50\x90\x2d\xd8\x56\x8f\x61\x4c\xa6\xbb\x51\x9b\xac\x99\x44\x11\xf1\xbb\x4b\x37\xeb\x9f\x93\x1f\xc0" + "\x3d\x04\x66\xde\x0b\xfc\x78\x2f\x90\xa6\x81\xb3\xa3\xeb\x22\x26\x82\xfd\x20\xc4\xba\xdd\xae\x6e\x76\xb0\x6e\x77" + "\x1b\xb1\xe8\xdf\x6c\x44\x1d\x30\xa7\xfe\x5c\xa3\x31\xc4\x0c\x15\xbb\xce\x63\xca\x91\x14\x44\x7a\xce\xc4\x49\x3b" + "\xfb\x3d\x93\xd5\x98\x14\x98\x27\x47\xbe\x18\x6c\xc2\x40\x0a\xba\x88\xfe\xe4\x4e\xeb\x21\xc4\xa3\xb6\x98\x50\x01" + "\x13\xb3\x0b\xfe\x6b\xcb\xf7\x0f\x64\x92\x02\x34\xc9\xbd\x50\x2d\x6e\x2f\xaf\xf7\xab\xad\x58\x54\x72\xd9\xb0\xeb" + "\xa4\x02\xb9\x6c\x26\x9a\x54\xd0\x6e\xee\xaa\x7a\xd4\x0a\xb3\xf8\x23\xa5\x8c\x13\xf8\x47\x3a\x9d\xf7\x8f\xe9\x5e" + "\xa1\x49\x05\x29\x66\xaa\x2f\xfe\x2a\x20\xd2\x21\x12\xf7\x33\x6e\xc0\x04\x4b\x33\x8e\x1f\x9c\x35\x33\x8e\x3f\x3c" + "\x9a\xff\xff\xfa\xbf\xff\xc3\xab\xf0\xea\xc5\x67\x00\x00\x00\xff\xff\x9c\xc9\xf4\x9c\x21\x05\x00\x00") func bindataMigrationsSqlTests4testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests4testsql, "migrations/sql/tests/4_test.sql", ) } func bindataMigrationsSqlTests4testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests4testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/4_test.sql", size: 1313, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests5testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x94\x4f\x4b\x03\x31\x10\xc5\xcf\xcd\xa7\x98\x5b\x76\x31\x7b\x11\x7a" + "\xf2\x24\xd8\x43\x41\xb6\x60\x5b\x3d\x86\x31\x99\xee\x46\x6d\xb2\x66\x12\x45\xc4\xef\x2e\xdd\xac\x7f\x4e\x7e\x00" + "\xf7\x10\x98\x79\x2f\xf0\xe3\xbd\x40\x9a\x06\xce\x8e\xae\x8b\x98\x08\xf6\x83\x10\xeb\x76\xbb\xba\xd9\xc1\xba\xdd" + "\x6d\xc4\xa2\x7f\xb3\x11\x75\xc0\x9c\xfa\x73\x8d\xc6\x10\x33\x54\xec\x3a\x8f\x29\x47\x52\x10\xe9\x39\x13\x27\xed" + "\xec\xf7\x4c\x56\x63\x52\x60\x9e\x1c\xf9\x62\xb0\x09\x03\x29\xe8\x22\xfa\x93\x3b\xad\x87\x10\x8f\xda\x62\x42\x05" + "\x4c\xcc\x2e\xf8\xaf\x2d\xdf\x3f\x90\x49\x0a\xd0\x24\xf7\x42\xb5\xb8\xbd\xbc\xde\xaf\xb6\x62\x51\xc9\x65\xc3\xae" + "\x93\x0a\xe4\xb2\x99\x68\x52\x41\xbb\xb9\xab\xea\x51\x2b\xcc\xe2\x8f\x94\x32\x4e\xe0\x1f\xe9\x74\xde\x3f\xa6\x7b" + "\x85\x26\x15\xa4\x98\xa9\xbe\xf8\xab\x80\x48\x87\x48\xdc\xcf\xb8\x01\x13\x2c\xcd\x38\x7e\x70\xd6\xcc\x38\xfe\xf0" + "\x68\xfe\xff\xeb\xff\xfe\x0f\xaf\xc2\xab\x17\x9f\x01\x00\x00\xff\xff\x97\x6c\xcb\x19\x21\x05\x00\x00") func bindataMigrationsSqlTests5testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests5testsql, "migrations/sql/tests/5_test.sql", ) } func bindataMigrationsSqlTests5testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests5testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/5_test.sql", size: 1313, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests6testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x94\x4f\x4b\x03\x31\x10\xc5\xcf\xcd\xa7\x98\x5b\x76\x31\x7b\xf1\xd0" + "\x8b\x27\xc1\x1e\x0a\xb2\x05\xdb\xea\x31\x8c\xc9\x74\x37\x6a\x93\x35\x93\x28\x22\x7e\x77\xe9\x66\xfd\x73\xf2\x03" + "\xb8\x87\xc0\xcc\x7b\x81\x1f\xef\x05\xd2\x34\x70\x76\x74\x5d\xc4\x44\xb0\x1f\x84\x58\xb7\xdb\xd5\xcd\x0e\xd6\xed" + "\x6e\x23\x16\xfd\x9b\x8d\xa8\x03\xe6\xd4\x9f\x6b\x34\x86\x98\xa1\x62\xd7\x79\x4c\x39\x92\x82\x48\xcf\x99\x38\x69" + "\x67\xbf\x67\xb2\x1a\x93\x02\xf3\xe4\xc8\x17\x83\x4d\x18\x48\x41\x17\xd1\x9f\xdc\x69\x3d\x84\x78\xd4\x16\x13\x2a" + "\x60\x62\x76\xc1\x7f\x6d\xf9\xfe\x81\x4c\x52\x80\x26\xb9\x17\xaa\xc5\xed\xe5\xf5\x7e\xb5\x15\x8b\x4a\x2e\x1b\x76" + "\x9d\x54\x20\x97\xcd\x44\x93\x0a\xda\xcd\x5d\x55\x8f\x5a\x61\x16\x7f\xa4\x94\x71\x02\xff\x48\xa7\xf3\xfe\x31\xdd" + "\x2b\x34\xa9\x20\xc5\x4c\xf5\xc5\x5f\x05\x44\x3a\x44\xe2\x7e\xc6\x0d\x98\x60\x69\xc6\xf1\x83\xb3\x66\xc6\xf1\x87" + "\x47\xf3\xff\x5f\xff\xf7\x7f\x78\x15\x5e\xbd\xf8\x0c\x00\x00\xff\xff\xcb\x85\xfa\x4d\x21\x05\x00\x00") func bindataMigrationsSqlTests6testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests6testsql, "migrations/sql/tests/6_test.sql", ) } func bindataMigrationsSqlTests6testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests6testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/6_test.sql", size: 1313, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests7testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x95\x31\x4f\xc3\x30\x10\x85\xe7\xfa\x57\xdc\x96\x46\x38\x0b\x4b\x07" + "\x26\x24\x3a\x54\x42\xa9\x44\x5b\x18\xa3\xc3\xbe\x26\x06\x6a\x07\x9f\x0d\x42\x88\xff\x8e\x52\xa7\x90\x2e\x88\x21" + "\x63\x86\x48\x77\xef\xc5\x4f\x4f\x9f\x2c\xb9\x28\xe0\xe2\x60\x6a\x8f\x81\x60\xd7\x0a\xb1\x2a\x37\xcb\xbb\x2d\xac" + "\xca\xed\x5a\xcc\x9a\x0f\xed\xb1\x72\x18\x43\x73\x59\xa1\x52\xc4\x0c\x73\x36\xb5\xc5\x10\x3d\x49\xf0\xf4\x1a\x89" + "\x43\x65\xf4\xcf\x4c\xba\xc2\x20\x41\xbd\x18\xb2\xc9\x60\xe5\x5a\x92\x50\x7b\xb4\x9d\xdb\xaf\x7b\xe7\x0f\x95\xc6" + "\x80\x12\x98\x98\x8d\xb3\xa7\x2d\x3e\x3e\x91\x0a\x12\x50\x05\xf3\x46\x67\xc1\x51\x1b\xb2\x6a\x10\x76\x52\x72\x71" + "\x7f\x7d\xbb\x5b\x6e\xc4\x6c\x9e\x2d\x0a\x36\x75\x26\x21\x5b\x14\xfd\xd1\x4c\x42\xb9\x7e\x98\xe7\x47\x2d\x35\x4b" + "\xfe\xb1\x4b\x1a\xfb\xc4\x5f\xa9\xfb\x3e\xbf\xfa\xff\x52\xa7\x4c\x42\xf0\x91\x86\xd1\xa4\x0b\x8c\xfa\x3c\xa2\x13" + "\xf2\xab\xbf\x50\x7a\xda\x7b\xe2\x66\x62\x39\x02\x4b\xe5\x34\x4d\x20\x47\x00\xe9\x8c\x56\x13\xc8\x11\x40\xb6\xcf" + "\x6a\xba\x91\xff\x07\x39\x7c\x81\x6e\xdc\xbb\x15\xdf\x01\x00\x00\xff\xff\x49\xf5\x0d\xb6\x93\x06\x00\x00") func bindataMigrationsSqlTests7testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests7testsql, "migrations/sql/tests/7_test.sql", ) } func bindataMigrationsSqlTests7testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests7testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/7_test.sql", size: 1683, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests8testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x95\xbf\x6a\xc3\x30\x10\x87\xe7\xe8\x29\x6e\x73\x42\xe5\xa5\x53\xa0" + "\x53\xa1\x19\x02\xc6\x81\x26\x6e\x47\x71\x95\x2e\xb6\x5a\x47\x72\xf5\xa7\xa5\x94\xbe\x7b\x49\xe4\x36\xce\xd2\xa5" + "\x78\xf3\x20\xb8\xfb\x9d\xf8\x38\x3e\x04\xca\x73\xb8\x3a\xe8\xda\x61\x20\xa8\x3a\xc6\xd6\xe5\x76\x75\xbf\x83\x75" + "\xb9\xdb\xb0\x59\xf3\xa1\x1c\x0a\x8b\x31\x34\xd7\x02\xa5\x24\xef\x61\xee\x75\x6d\x30\x44\x47\x1c\x1c\xbd\x46\xf2" + "\x41\x68\xf5\x5b\x93\x12\x18\x38\xc8\x56\x93\x49\x03\x2f\x6d\x47\x1c\x6a\x87\xe6\x38\xed\xdb\xbd\x75\x07\xa1\x30" + "\x20\x07\x4f\xde\x6b\x6b\x7e\xba\xf8\xf4\x4c\x32\x70\x40\x19\xf4\x1b\x5d\x80\xa3\xd2\x64\xe4\x00\x76\x4e\x64\x83" + "\x6d\x4b\xa6\x26\xa1\xd5\x82\x3d\xdc\x16\xd5\x6a\xcb\x66\xf3\x6c\x99\x7b\x5d\x67\x1c\xb2\x65\xde\x83\x32\x0e\xe5" + "\xe6\x71\xbe\x38\x65\x69\xcf\x34\x3f\x6d\x96\xca\x9e\x7f\x8e\x8e\xe7\xf3\xab\xbf\x97\x36\xcc\x38\x04\x17\x69\x88" + "\x26\x95\x63\x54\x97\x88\x14\x94\x55\x51\x2c\x6e\xfe\xd2\xeb\x68\xef\xc8\x37\x93\xdf\x91\xfc\x4a\xab\x68\x92\x3b" + "\x92\x5c\xab\x95\x9c\xe4\x8e\x24\xb7\x7b\x91\xd3\xcb\xfd\x9f\xdc\xe1\x2f\x77\x67\xdf\x0d\xfb\x0e\x00\x00\xff\xff" + "\xc1\xaa\xd6\x5b\xf7\x06\x00\x00") func bindataMigrationsSqlTests8testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests8testsql, "migrations/sql/tests/8_test.sql", ) } func bindataMigrationsSqlTests8testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests8testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/8_test.sql", size: 1783, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1554831411, 0), } a := &asset{bytes: bytes, info: info} return a, nil } var _bindataMigrationsSqlTests9testsql = []byte( "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\x4d\x6f\x1c\x37\x0c\x3d\x67\x7f\x05\x91\xcb\xd8\xe8\x6c\xec\xba" + "\x48\x00\xbb\xa7\x02\xcd\x21\x40\xe1\x00\x8d\xd3\x1e\x8a\x42\xd0\x4a\x9c\x19\x7a\x67\xc5\xa9\xa8\xf1\xda\xcd\xfa" + "\xbf\x17\x1a\xcd\xd7\x3a\x0b\x37\x01\x6a\x34\x07\x5f\x0c\x91\x12\x25\xf2\xbd\x47\x8e\x77\xb9\x84\xef\x36\x54\x7a" + "\x1d\x10\x3e\x36\x8b\x77\x97\x1f\xde\xfe\x7a\x05\xef\x2e\xaf\xde\x43\x75\x67\xbd\x56\xa6\x26\x74\x01\x8e\xc8\xe6" + "\xa0\xeb\x9a\xb7\x68\x95\x61\x2f\x8a\x3d\x95\xe4\x24\x87\x74\x42\x39\xbd\xc1\xd1\x10\x34\x1e\x43\x0e\x1e\x2d\x79" + "\x34\x41\xb5\x9e\x24\x87\xd2\x6b\x17\x54\xb8\x6b\x50\xe2\x9e\x34\xec\x04\x07\x5b\x0c\x37\x98\x03\x6f\x1d\xfa\x1c" + "\x1a\xae\xc9\xdc\xc5\xb8\x1c\x02\x4b\x5a\xf4\xb7\x77\xeb\x9a\x4b\xee\xbd\xec\x82\x36\x41\x1e\xbc\xae\xf0\xb6\x21" + "\x8f\xa2\x74\xc8\x41\xd0\x04\xf6\x8a\x2c\xba\x40\x05\xa1\x4f\xa1\xd7\xdb\xb5\xa4\xbf\xc3\x4b\x6b\x74\x0a\x9d\x6d" + "\x98\x5c\x50\xba\x0d\x95\xda\x60\xa8\xd8\xc6\x7c\xff\x6a\x51\x86\x52\x06\x8b\x57\xd7\xb1\x3e\xa1\xd2\x91\x2b\x95" + "\xae\xcb\x1c\x5a\x41\x4f\xae\xe0\xce\x8b\x56\x8d\x95\x76\xbb\xd2\xa6\x90\x58\x76\x0e\xba\xb5\x84\xce\xe0\xf1\xe2" + "\xb7\x9f\x7e\xf9\xf8\xf6\xc3\x02\xe0\x28\x3b\x5f\xa6\x4a\xb2\x1c\xb2\x2a\x84\xe6\xe2\xe4\xa4\x66\xa3\xeb\x8a\x25" + "\xec\x7a\x47\xc9\x5c\xd6\x18\x4f\x08\x6f\x70\x16\xa0\x57\xc6\x62\xf1\x65\xa1\xb1\x40\xf6\xf4\x37\x2a\xc3\x16\x77" + "\xb4\x69\x6a\x32\xd4\x5d\xd3\x41\xb1\x23\xab\xba\x45\xf4\x14\xcc\xbb\x95\xf6\x5d\x1c\x3a\xd4\x32\x7b\x23\xd1\x35" + "\x73\x04\x9e\x6f\x1f\x28\xa7\xe4\xe9\xa2\x5d\xc1\xd1\x3a\x9d\xf6\x13\x5f\xf1\xc4\xa7\x97\x6b\xbc\x93\x97\x17\xf0" + "\xc7\x9f\xf7\xb3\x0b\x22\x67\xd1\x74\xec\x70\xe6\x6e\x3d\x7d\xbf\x9b\xd6\x67\x71\xcb\xcb\xd9\xeb\x37\x69\xf1\xfa" + "\xac\x5b\x34\xed\xaa\x26\x33\x84\xc9\xc5\xc9\xc9\x76\xbb\x7d\xc5\xfe\xee\x95\x54\x27\xba\xa1\xec\xf8\xc7\xc5\xbc" + "\x17\x16\x2f\x52\x33\x70\xc4\xeb\xac\x93\x45\xd4\x91\xd1\x81\xd8\x29\x41\x11\x62\xd7\xf7\xc8\xb4\x87\x36\x49\x2f" + "\xf1\x3d\x12\xfc\x22\xf2\x5b\x73\x49\x6e\xd9\x47\x2e\xc9\x66\x39\x5c\xbe\xff\xfd\xe8\x38\x87\xec\x7c\x29\xed\xea" + "\xeb\x32\xe8\xc5\x08\x47\xa6\xd2\x75\x8d\xae\xc4\x1c\x6e\xd0\x77\x42\x1f\xbb\x22\x66\xd7\xe7\x32\x17\x73\x9d\x83" + "\xac\xa9\x19\x5d\x68\x55\xdf\x89\x46\x7c\x71\xa8\xa0\xe9\x60\xb4\x98\xac\x51\xb1\x05\xf1\x36\x74\x5d\x49\x23\x22" + "\xdd\x93\xf3\xd3\xea\x33\xb5\x77\x60\x8c\x59\x67\x5d\xf9\x43\xe6\xc9\x9a\xa4\xd3\x01\x13\xd3\x4f\xc6\x30\x5b\xb2" + "\x1c\x0a\x5d\x0b\xa6\x13\x31\xf5\x3e\x50\x7c\x31\xc1\x3a\xa0\xfb\xe9\x3e\xed\x1e\x20\x20\x3b\x5f\xea\xd6\xfe\x0b" + "\xf2\x26\x36\xb2\x0b\xdf\x10\xe4\x05\x7b\x13\x6f\xe8\xc7\xca\x34\xe2\x0e\xb1\x91\x3c\xb3\x9c\x0f\xd2\x93\x83\x36" + "\x3e\x0d\x56\xbc\x0d\xff\x3f\x59\xa9\xc4\xae\x2f\x1e\x21\xef\x41\x66\x91\xcb\xb4\x30\x69\x90\xdc\x7f\x1d\xb5\xaa" + "\xd2\xce\xd6\x68\xf7\x28\xee\xbe\x60\x13\x5f\x1e\x37\xb8\x59\x45\xa8\x87\x95\x2a\xd8\xe7\x80\xde\xb3\x7f\x48\xdb" + "\xc0\x83\x36\x06\x45\xd2\x5c\x9d\xbc\xc3\xa4\x3d\x44\xff\x56\x8b\x6a\x05\xed\xf4\xfe\x97\xf6\xd2\x00\x71\xf0\x2d" + "\xe6\xf0\xc3\x9b\xd3\xd3\x01\xd6\x7d\x8c\xe7\xae\x89\xa0\xa1\x1d\x96\x4b\xb8\xaa\x10\x1a\x8f\x37\xc4\xad\xc0\xaa" + "\x66\xb3\x06\x12\xb8\x6e\x25\x40\x60\x28\x31\x44\x1d\x22\x95\x0e\xe2\xb8\x86\x2d\xfb\x35\xb9\xf2\xd1\x19\xd6\xc1" + "\x00\x47\xf1\x23\xa9\x43\xeb\x27\x31\x7e\x36\x37\xf6\x1b\x2a\x41\xff\x80\x89\x82\xfd\x46\x59\x1d\xf4\x84\x68\x6f" + "\x0d\xfd\xa7\x4d\xa0\x9b\x7d\xc5\x8f\x72\x1f\x61\x1d\x3d\x23\x8e\x8a\xec\x3e\xc2\x42\xe5\xa0\xe9\xee\xa2\xbd\xd1" + "\xbd\xd7\x00\x93\xbc\xfb\xfb\x27\x57\x36\x53\xf7\xd4\x28\x89\xa5\x39\x8b\x68\x27\x1d\x0f\x97\x8c\x8e\x89\xeb\xc7" + "\x85\xed\xb1\xf0\x28\xd5\x33\xd4\x4f\x0f\x75\xfc\x37\xea\x19\xe7\xa7\xc7\x39\x7e\x02\x9f\x71\x7e\x7a\x9c\x9b\xb5" + "\x79\xd6\xf3\x7f\x86\xf3\xfc\xd7\xf6\xcf\xbc\x75\x8b\x7f\x02\x00\x00\xff\xff\xc5\x7d\x17\x1f\x7f\x0f\x00\x00") func bindataMigrationsSqlTests9testsqlBytes() ([]byte, error) { return bindataRead( _bindataMigrationsSqlTests9testsql, "migrations/sql/tests/9_test.sql", ) } func bindataMigrationsSqlTests9testsql() (*asset, error) { bytes, err := bindataMigrationsSqlTests9testsqlBytes() if err != nil { return nil, err } info := bindataFileInfo{ name: "migrations/sql/tests/9_test.sql", size: 3967, md5checksum: "", mode: os.FileMode(420), modTime: time.Unix(1555175700, 0), } a := &asset{bytes: bytes, info: info} return a, nil } // // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. // func Asset(name string) ([]byte, error) { cannonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) } return a.bytes, nil } return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} } // // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. // nolint: deadcode // func MustAsset(name string) []byte { a, err := Asset(name) if err != nil { panic("asset: Asset(" + name + "): " + err.Error()) } return a } // // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or could not be loaded. // func AssetInfo(name string) (os.FileInfo, error) { cannonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) } return a.info, nil } return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} } // // AssetNames returns the names of the assets. // nolint: deadcode // func AssetNames() []string { names := make([]string, 0, len(_bindata)) for name := range _bindata { names = append(names, name) } return names } // // _bindata is a table, holding each asset generator, mapped to its name. // var _bindata = map[string]func() (*asset, error){ "migrations/sql/mysql/.gitkeep": bindataMigrationsSqlMysqlGitkeep, "migrations/sql/mysql/5.sql": bindataMigrationsSqlMysql5sql, "migrations/sql/mysql/6.sql": bindataMigrationsSqlMysql6sql, "migrations/sql/mysql/7.sql": bindataMigrationsSqlMysql7sql, "migrations/sql/mysql/9.sql": bindataMigrationsSqlMysql9sql, "migrations/sql/postgres/.gitkeep": bindataMigrationsSqlPostgresGitkeep, "migrations/sql/postgres/5.sql": bindataMigrationsSqlPostgres5sql, "migrations/sql/postgres/6.sql": bindataMigrationsSqlPostgres6sql, "migrations/sql/postgres/7.sql": bindataMigrationsSqlPostgres7sql, "migrations/sql/postgres/9.sql": bindataMigrationsSqlPostgres9sql, "migrations/sql/shared/1.sql": bindataMigrationsSqlShared1sql, "migrations/sql/shared/2.sql": bindataMigrationsSqlShared2sql, "migrations/sql/shared/3.sql": bindataMigrationsSqlShared3sql, "migrations/sql/shared/4.sql": bindataMigrationsSqlShared4sql, "migrations/sql/shared/8.sql": bindataMigrationsSqlShared8sql, "migrations/sql/tests/.gitkeep": bindataMigrationsSqlTestsGitkeep, "migrations/sql/tests/1_test.sql": bindataMigrationsSqlTests1testsql, "migrations/sql/tests/2_test.sql": bindataMigrationsSqlTests2testsql, "migrations/sql/tests/3_test.sql": bindataMigrationsSqlTests3testsql, "migrations/sql/tests/4_test.sql": bindataMigrationsSqlTests4testsql, "migrations/sql/tests/5_test.sql": bindataMigrationsSqlTests5testsql, "migrations/sql/tests/6_test.sql": bindataMigrationsSqlTests6testsql, "migrations/sql/tests/7_test.sql": bindataMigrationsSqlTests7testsql, "migrations/sql/tests/8_test.sql": bindataMigrationsSqlTests8testsql, "migrations/sql/tests/9_test.sql": bindataMigrationsSqlTests9testsql, } // // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: // data/ // foo.txt // img/ // a.png // b.png // then AssetDir("data") would return []string{"foo.txt", "img"} // AssetDir("data/img") would return []string{"a.png", "b.png"} // AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. // func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { cannonicalName := strings.Replace(name, "\\", "/", -1) pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { return nil, &os.PathError{ Op: "open", Path: name, Err: os.ErrNotExist, } } } } if node.Func != nil { return nil, &os.PathError{ Op: "open", Path: name, Err: os.ErrNotExist, } } rv := make([]string, 0, len(node.Children)) for childName := range node.Children { rv = append(rv, childName) } return rv, nil } type bintree struct { Func func() (*asset, error) Children map[string]*bintree } var _bintree = &bintree{Func: nil, Children: map[string]*bintree{ "migrations": {Func: nil, Children: map[string]*bintree{ "sql": {Func: nil, Children: map[string]*bintree{ "mysql": {Func: nil, Children: map[string]*bintree{ ".gitkeep": {Func: bindataMigrationsSqlMysqlGitkeep, Children: map[string]*bintree{}}, "5.sql": {Func: bindataMigrationsSqlMysql5sql, Children: map[string]*bintree{}}, "6.sql": {Func: bindataMigrationsSqlMysql6sql, Children: map[string]*bintree{}}, "7.sql": {Func: bindataMigrationsSqlMysql7sql, Children: map[string]*bintree{}}, "9.sql": {Func: bindataMigrationsSqlMysql9sql, Children: map[string]*bintree{}}, }}, "postgres": {Func: nil, Children: map[string]*bintree{ ".gitkeep": {Func: bindataMigrationsSqlPostgresGitkeep, Children: map[string]*bintree{}}, "5.sql": {Func: bindataMigrationsSqlPostgres5sql, Children: map[string]*bintree{}}, "6.sql": {Func: bindataMigrationsSqlPostgres6sql, Children: map[string]*bintree{}}, "7.sql": {Func: bindataMigrationsSqlPostgres7sql, Children: map[string]*bintree{}}, "9.sql": {Func: bindataMigrationsSqlPostgres9sql, Children: map[string]*bintree{}}, }}, "shared": {Func: nil, Children: map[string]*bintree{ "1.sql": {Func: bindataMigrationsSqlShared1sql, Children: map[string]*bintree{}}, "2.sql": {Func: bindataMigrationsSqlShared2sql, Children: map[string]*bintree{}}, "3.sql": {Func: bindataMigrationsSqlShared3sql, Children: map[string]*bintree{}}, "4.sql": {Func: bindataMigrationsSqlShared4sql, Children: map[string]*bintree{}}, "8.sql": {Func: bindataMigrationsSqlShared8sql, Children: map[string]*bintree{}}, }}, "tests": {Func: nil, Children: map[string]*bintree{ ".gitkeep": {Func: bindataMigrationsSqlTestsGitkeep, Children: map[string]*bintree{}}, "1_test.sql": {Func: bindataMigrationsSqlTests1testsql, Children: map[string]*bintree{}}, "2_test.sql": {Func: bindataMigrationsSqlTests2testsql, Children: map[string]*bintree{}}, "3_test.sql": {Func: bindataMigrationsSqlTests3testsql, Children: map[string]*bintree{}}, "4_test.sql": {Func: bindataMigrationsSqlTests4testsql, Children: map[string]*bintree{}}, "5_test.sql": {Func: bindataMigrationsSqlTests5testsql, Children: map[string]*bintree{}}, "6_test.sql": {Func: bindataMigrationsSqlTests6testsql, Children: map[string]*bintree{}}, "7_test.sql": {Func: bindataMigrationsSqlTests7testsql, Children: map[string]*bintree{}}, "8_test.sql": {Func: bindataMigrationsSqlTests8testsql, Children: map[string]*bintree{}}, "9_test.sql": {Func: bindataMigrationsSqlTests9testsql, Children: map[string]*bintree{}}, }}, }}, }}, }} // RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { return err } info, err := AssetInfo(name) if err != nil { return err } err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) if err != nil { return err } err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } // RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File if err != nil { return RestoreAsset(dir, name) } // Dir for _, child := range children { err = RestoreAssets(dir, filepath.Join(name, child)) if err != nil { return err } } return nil } func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) }
module Cuttings class Railtie < Rails::Railtie rake_tasks do tasks_path = Rails.root.join('lib', 'seeds', 'tasks', '**', '*.rake') Dir[tasks_path].each do |file| load file end end end end
# -*- coding: utf-8 -*- import numpy as np from numba import jit from numpy import fft from load import * ##### Function to define inverse fft properly, with hermitian symmetries ##### the input will be f(kx,ky,kz), kx, ky and kz; the output will be the FT and ##### the axes x and y @jit def fft_fwd3d(fld): #we assume ky and kz have positive and negative wavenumbers, #kx only positive => add conjugates #create the fftfreq-like array kx_full = np.hstack([kx, -kx[:0:-1]]) nkx_full = kx_full.size ###enforce hermitian symmetry fld_full = np.zeros(nkx_full*nky*nkz, dtype=complex).reshape(nkx_full, nky, nkz) # fill kx >= 0 entries fld_full[:nkx, :]=fld[:nkx, :] # generate kx < 0 entries using Hermiticity # i.e. fld(-k) = conjg(fld(k)) for i in range(-nkx + 1, 0): # treat special case of ky=0 & ky=0 fld_full[i + nkx_full, 0, 0] = np.conj(fld[-i, 0, 0]) # treat special case of ky=0 for k in range(1, nkz): fld_full[i + nkx_full, 0, k] = np.conj(fld[-i, 0, nkz - k]) # treat special case of kz = 0 for j in range(1, nky): fld_full[i + nkx_full, j, 0] = np.conj(fld[-i, nky - j, 0]) # next treat general case of kx /= 0 and ky /= 0 for j in range(1, nky): for k in range(1, nkz): fld_full[i + nkx_full, j, k] = np.conj(fld[-i, nky - j, nkz - k]) #calculate ifftn fft3d = np.real(np.fft.ifftn(fld_full)) #normalize fft3d = fft3d*(nkx_full*nky*nkz) return fft3d @jit def fft_fwd3d_t(fld): #we assume ky and kz have positive and negative wavenumbers, #kx only positive => add conjugates ntfield = fld.shape[-1] #create the fftfreq-like array kx_full = np.hstack([kx, -kx[:0:-1]]) nkx_full = kx_full.size ###enforce hermitian symmetry fld_full = np.zeros(nkx_full*nky*nkz*ntfield, dtype=complex).reshape(nkx_full, nky, nkz, ntfield) # fill kx >= 0 entries fld_full[:nkx, :]=fld[:nkx, :] # generate kx < 0 entries using Hermiticity # i.e. fld(-k) = conjg(fld(k)) for i in range(-nkx + 1, 0): # treat special case of ky=0 & ky=0 fld_full[i + nkx_full, 0, 0, :] = np.conj(fld[-i, 0, 0, :]) # treat special case of ky=0 for k in range(1, nkz): fld_full[i + nkx_full, 0, k, :] = np.conj(fld[-i, 0, nkz - k, :]) # treat special case of kz = 0 for j in range(1, nky): fld_full[i + nkx_full, j, 0, :] = np.conj(fld[-i, nky - j, 0, :]) # next treat general case of kx /= 0 and ky /= 0 for j in range(1, nky): for k in range(1, nkz): fld_full[i + nkx_full, j, k, :] = np.conj(fld[-i, nky - j, nkz - k, :]) #calculate ifftn fft3d = np.real(np.fft.ifftn(fld_full, axes=(0, 1, 2))) #normalize fft3d = fft3d*(nkx_full*nky*nkz) return fft3d # @jit def sum_negative_kz2d(fld): fld_new = np.zeros([nt, int(nkz/2), nkpolar]) fld_new[:, 0, :] = fld[:, 0, :] for i in np.arange(1, int(nkz/2)): fld_new[:, i, :] = 0.5*(fld[:, i, :] + fld[:, nkz - i, :]) return fld_new
import 'package:equatable/equatable.dart'; import 'package:grin_plus_plus/strings.dart'; class TransportType extends Equatable { static const TransportType http = TransportType._(kHttpString); static const TransportType tor = TransportType._(kTorString); static const TransportType file = TransportType._(kFileString); final String type; const TransportType._(this.type); factory TransportType.parse(String type) { return TransportType._(type); } @override List<Object> get props => [type]; @override String toString() => type; }
/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ package org.opensearch.indexmanagement.indexstatemanagement.action import org.opensearch.common.io.stream.StreamInput import org.opensearch.common.xcontent.XContentParser import org.opensearch.common.xcontent.XContentParser.Token import org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken import org.opensearch.indexmanagement.indexstatemanagement.action.NotificationAction.Companion.DESTINATION_FIELD import org.opensearch.indexmanagement.indexstatemanagement.action.NotificationAction.Companion.MESSAGE_TEMPLATE_FIELD import org.opensearch.indexmanagement.indexstatemanagement.model.destination.Destination import org.opensearch.indexmanagement.spi.indexstatemanagement.Action import org.opensearch.indexmanagement.spi.indexstatemanagement.ActionParser import org.opensearch.script.Script class NotificationActionParser : ActionParser() { override fun fromStreamInput(sin: StreamInput): Action { val destination = Destination(sin) val messageTemplate = Script(sin) val index = sin.readInt() return NotificationAction(destination, messageTemplate, index) } override fun fromXContent(xcp: XContentParser, index: Int): Action { var destination: Destination? = null var messageTemplate: Script? = null ensureExpectedToken(Token.START_OBJECT, xcp.currentToken(), xcp) while (xcp.nextToken() != Token.END_OBJECT) { val fieldName = xcp.currentName() xcp.nextToken() when (fieldName) { DESTINATION_FIELD -> destination = Destination.parse(xcp) MESSAGE_TEMPLATE_FIELD -> messageTemplate = Script.parse(xcp, Script.DEFAULT_TEMPLATE_LANG) else -> throw IllegalArgumentException("Invalid field: [$fieldName] found in NotificationAction.") } } return NotificationAction( destination = requireNotNull(destination) { "NotificationAction destination is null" }, messageTemplate = requireNotNull(messageTemplate) { "NotificationAction message template is null" }, index = index ) } override fun getActionType(): String { return NotificationAction.name } }
package com.github.htdangkhoa.nexterp.data.remote.stockcount.stockcount import com.google.gson.annotations.SerializedName data class NewStockCountRequest( @SerializedName("name") var name: String, @SerializedName("location_id") var location_id: Int, @SerializedName("tag_ids") var tag_ids: List<Long>, @SerializedName("stock_locator_ids") var stock_locator_ids: List<Long>, @SerializedName("bin_ids") var bin_ids: List<Long>, @SerializedName("category_ids") var category_ids: List<Long>, @SerializedName("brand_ids") var brand_ids: List<Long>, )
import org.gradle.plugin.use.PluginDependenciesSpec val PluginDependenciesSpec.`openapi-generator-kotlin-jvm` get() = id("com.justai.plugins.internal.openapi")
package org.seekloud.VideoMeeting.rtpServer.core import akka.actor.typed.{ActorRef, Behavior} import akka.actor.typed.scaladsl.{ActorContext, Behaviors, StashBuffer, TimerScheduler} import org.slf4j.LoggerFactory import org.seekloud.VideoMeeting.rtpServer.Boot.publishManager import org.seekloud.VideoMeeting.rtpServer.Boot.streamManager import org.seekloud.VideoMeeting.rtpServer.Boot.dataStoreActor import org.seekloud.VideoMeeting.rtpServer.utils.RtpUtil import concurrent.duration._ import scala.collection.mutable /** * Created by haoshuhan on 2019/7/16. */ object StreamActor { private val log = LoggerFactory.getLogger(this.getClass) sealed trait Command case class StreamData(data: Array[Byte], ssrc: Int, timeStamp: Long) extends Command case class AuthSuccess(ssrc: Int) extends Command case object StopPushing2Manager extends Command case class CalculateBandwidth(unit: Int) extends Command case class GetBandwidth(replyTo: ActorRef[(String, List[(Int, Int)])]) extends Command case object LoopKey def create(liveId: String): Behavior[Command] = { Behaviors.setup[Command] { ctx => implicit val stashBuffer: StashBuffer[Command] = StashBuffer[Command](Int.MaxValue) Behaviors.withTimers[Command] { implicit timer => waiting4Auth(liveId) } } } def waiting4Auth(liveId: String) (implicit timer: TimerScheduler[Command], stashBuffer: StashBuffer[Command]): Behavior[Command] = { Behaviors.receive[Command] { (ctx, msg) => msg match { case AuthSuccess(ssrc) => timer.startSingleTimer(s"LoopKey-$liveId", StopPushing2Manager, 30.seconds) log.info(s"liveId $liveId auth success, turn to work behavior") //入口带宽计算 val countMap = mutable.Map(1 -> 0, 3 -> 0, 10 -> 0) countMap.keys.foreach {i => timer.startPeriodicTimer(s"BandwidthCal-$i", CalculateBandwidth(i), i.seconds) } work(liveId, ssrc, countMap, mutable.Map(1 -> 0, 3 -> 0, 10 -> 0)) case GetBandwidth(replyTo) => replyTo ! (liveId, List((1, -1), (3, -1), (10, -1))) Behaviors.same case x => log.info(s"recv unknown msg: $x") Behaviors.same } } } def work(liveId: String, ssrc: Int, dataCountMap: mutable.Map[Int, Int], bandwidthMap: mutable.Map[Int, Int] ) (implicit timer: TimerScheduler[Command], stashBuffer: StashBuffer[Command]): Behavior[Command] = { Behaviors.receive[Command] { (ctx, msg) => msg match { case StreamData(data, ssrcRecv, timeStamp) => // println(s"liveId:$liveId, recv new stream data, length: ${data.length}") if (ssrcRecv == ssrc) { //transfer publishManager ! PublishManager.StreamData(liveId, data) } else { // println(s"liveId: $liveId, ssrc match error: recv:$ssrcRecv; real:$ssrc") } dataCountMap.foreach { i => dataCountMap.update(i._1, i._2 + data.length) } val present = RtpUtil.toInt(RtpUtil.toByte(System.currentTimeMillis(), 4).toArray) // log.info(s"present:$present===present1:${System.currentTimeMillis()}===timeStamp:$timeStamp") val differ = Math.abs(present - timeStamp).toInt timer.startSingleTimer(s"LoopKey-$liveId", StopPushing2Manager, 30.seconds) Behaviors.same case AuthSuccess(ssrcRecv) => log.info(s"liveId $liveId auth another time success") timer.startSingleTimer(s"LoopKey-$liveId", StopPushing2Manager, 30.seconds) work(liveId, ssrcRecv, dataCountMap, bandwidthMap) case StopPushing2Manager => streamManager ! StreamManager.StopPushing(liveId :: Nil) dataStoreActor ! DataStoreActor.stopGetData(liveId) Behaviors.same case CalculateBandwidth(unit) => //计算unit时间内带宽 val dataCountOption = dataCountMap.get(unit) if (dataCountOption.isDefined) { val dataCount = dataCountOption.get val dataBandwidth = dataCount * 8 / unit bandwidthMap.update(unit, dataBandwidth) dataCountMap.update(unit, 0) } else log.error(s"unit $unit not exists") Behaviors.same case GetBandwidth(replyTo) => replyTo ! (liveId, bandwidthMap.toList) Behaviors.same case x => log.info(s"recv unknown msg: $x") Behaviors.same } } } }
var express = require('express'); var router = express.Router(); var models = require('../models') var ObjectId = require('mongodb').ObjectID; router.get('/', async function(req, res, next) { res.json({counters: await models.all.Counter.find()}); }); router.patch('/:id', async function(req, res, next) { console.log(req.body); var id = req.params.id; await models.all.Counter.updateOne({_id: ObjectId(id)}, { $set: { count: req.body.count } }, (err, raw) => { } ); }); router.get('/:id', async function(req, res, next) { var id = req.params.id; var result = {count: 0} await models.all.Counter.findOne({_id: ObjectId(id)}, function(err, foundCounter) { if(!err && foundCounter !== null) result = foundCounter; }); res.json(result); }); module.exports = router;
## usage ```bash west build -t guiconfig west build -b nrf52840_sensortag -- -DCONF_FILE=prj.conf west build -b nrf52dk_nrf52832 -- -DCONF_FILE=prj.conf west flash ``` ## Documentation https://www.homesmartmesh.com/docs/microcontrollers/nrf52/thread_sensortag/#tag_battery
# GraphQL-Server Built a simple GraphQL Server and learnt about what it is used for and how to use it. Node.js/Express CRUD backend using GraphQL and JSON-Server. ## Usage -Install Dependencies ```bash $ npm install ``` -Run JSON-Server (Port 3000) ```bash $ npm run json:server ``` -Run GraphQL Server (Port 4000) ```bash $ npm run dev:server ``` -Visit Graphiql IDE Go to http://localhost:4000/graphql
<?php $vendorDir = dirname(__DIR__); return array ( 'yiisoft/yii2-swiftmailer' => array ( 'name' => 'yiisoft/yii2-swiftmailer', 'version' => '2.0.7.0', 'alias' => array ( '@yii/swiftmailer' => $vendorDir . '/yiisoft/yii2-swiftmailer', ), ), 'yiisoft/yii2-bootstrap' => array ( 'name' => 'yiisoft/yii2-bootstrap', 'version' => '2.0.6.0', 'alias' => array ( '@yii/bootstrap' => $vendorDir . '/yiisoft/yii2-bootstrap', ), ), 'yiisoft/yii2-debug' => array ( 'name' => 'yiisoft/yii2-debug', 'version' => '2.0.9.0', 'alias' => array ( '@yii/debug' => $vendorDir . '/yiisoft/yii2-debug', ), ), 'yiisoft/yii2-gii' => array ( 'name' => 'yiisoft/yii2-gii', 'version' => '2.0.5.0', 'alias' => array ( '@yii/gii' => $vendorDir . '/yiisoft/yii2-gii', ), ), 'yiisoft/yii2-faker' => array ( 'name' => 'yiisoft/yii2-faker', 'version' => '2.0.3.0', 'alias' => array ( '@yii/faker' => $vendorDir . '/yiisoft/yii2-faker', ), ), 'vova07/yii2-imperavi-widget' => array ( 'name' => 'vova07/yii2-imperavi-widget', 'version' => '9999999-dev', 'alias' => array ( '@vova07/imperavi' => $vendorDir . '/vova07/yii2-imperavi-widget/src', ), ), 'kop/yii2-scroll-pager' => array ( 'name' => 'kop/yii2-scroll-pager', 'version' => '9999999-dev', 'alias' => array ( '@kop/y2sp' => $vendorDir . '/kop/yii2-scroll-pager', ), ), 'amilna/yii2-nivo-slider' => array ( 'name' => 'amilna/yii2-nivo-slider', 'version' => '9999999-dev', 'alias' => array ( '@amilna/nivoslider' => $vendorDir . '/amilna/yii2-nivo-slider', ), ), 'maksyutin/yii2-dual-list-box' => array ( 'name' => 'maksyutin/yii2-dual-list-box', 'version' => '9999999-dev', 'alias' => array ( '@maksyutin/duallistbox' => $vendorDir . '/maksyutin/yii2-dual-list-box', ), ), 'amilna/yii2-sequence-widget' => array ( 'name' => 'amilna/yii2-sequence-widget', 'version' => '0.0.2.0', 'alias' => array ( '@amilna/sequencejs' => $vendorDir . '/amilna/yii2-sequence-widget', ), ), 'kartik-v/yii2-krajee-base' => array ( 'name' => 'kartik-v/yii2-krajee-base', 'version' => '1.8.8.0', 'alias' => array ( '@kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base', ), ), 'kartik-v/yii2-dialog' => array ( 'name' => 'kartik-v/yii2-dialog', 'version' => '1.0.1.0', 'alias' => array ( '@kartik/dialog' => $vendorDir . '/kartik-v/yii2-dialog', ), ), 'kartik-v/yii2-grid' => array ( 'name' => 'kartik-v/yii2-grid', 'version' => '3.1.3.0', 'alias' => array ( '@kartik/grid' => $vendorDir . '/kartik-v/yii2-grid', ), ), 'kartik-v/yii2-mpdf' => array ( 'name' => 'kartik-v/yii2-mpdf', 'version' => '1.0.1.0', 'alias' => array ( '@kartik/mpdf' => $vendorDir . '/kartik-v/yii2-mpdf', ), ), 'kartik-v/yii2-widget-typeahead' => array ( 'name' => 'kartik-v/yii2-widget-typeahead', 'version' => '1.0.1.0', 'alias' => array ( '@kartik/typeahead' => $vendorDir . '/kartik-v/yii2-widget-typeahead', ), ), 'kartik-v/yii2-widget-touchspin' => array ( 'name' => 'kartik-v/yii2-widget-touchspin', 'version' => '1.2.1.0', 'alias' => array ( '@kartik/touchspin' => $vendorDir . '/kartik-v/yii2-widget-touchspin', ), ), 'kartik-v/yii2-widget-timepicker' => array ( 'name' => 'kartik-v/yii2-widget-timepicker', 'version' => '1.0.3.0', 'alias' => array ( '@kartik/time' => $vendorDir . '/kartik-v/yii2-widget-timepicker', ), ), 'kartik-v/yii2-widget-switchinput' => array ( 'name' => 'kartik-v/yii2-widget-switchinput', 'version' => '1.3.1.0', 'alias' => array ( '@kartik/switchinput' => $vendorDir . '/kartik-v/yii2-widget-switchinput', ), ), 'kartik-v/yii2-widget-spinner' => array ( 'name' => 'kartik-v/yii2-widget-spinner', 'version' => '1.0.0.0', 'alias' => array ( '@kartik/spinner' => $vendorDir . '/kartik-v/yii2-widget-spinner', ), ), 'kartik-v/yii2-widget-sidenav' => array ( 'name' => 'kartik-v/yii2-widget-sidenav', 'version' => '1.0.0.0', 'alias' => array ( '@kartik/sidenav' => $vendorDir . '/kartik-v/yii2-widget-sidenav', ), ), 'kartik-v/yii2-widget-select2' => array ( 'name' => 'kartik-v/yii2-widget-select2', 'version' => '2.0.9.0', 'alias' => array ( '@kartik/select2' => $vendorDir . '/kartik-v/yii2-widget-select2', ), ), 'kartik-v/yii2-widget-rating' => array ( 'name' => 'kartik-v/yii2-widget-rating', 'version' => '1.0.2.0', 'alias' => array ( '@kartik/rating' => $vendorDir . '/kartik-v/yii2-widget-rating', ), ), 'kartik-v/yii2-widget-rangeinput' => array ( 'name' => 'kartik-v/yii2-widget-rangeinput', 'version' => '1.0.1.0', 'alias' => array ( '@kartik/range' => $vendorDir . '/kartik-v/yii2-widget-rangeinput', ), ), 'kartik-v/yii2-widget-growl' => array ( 'name' => 'kartik-v/yii2-widget-growl', 'version' => '1.1.1.0', 'alias' => array ( '@kartik/growl' => $vendorDir . '/kartik-v/yii2-widget-growl', ), ), 'kartik-v/yii2-widget-fileinput' => array ( 'name' => 'kartik-v/yii2-widget-fileinput', 'version' => '1.0.6.0', 'alias' => array ( '@kartik/file' => $vendorDir . '/kartik-v/yii2-widget-fileinput', ), ), 'kartik-v/yii2-widget-depdrop' => array ( 'name' => 'kartik-v/yii2-widget-depdrop', 'version' => '1.0.4.0', 'alias' => array ( '@kartik/depdrop' => $vendorDir . '/kartik-v/yii2-widget-depdrop', ), ), 'kartik-v/yii2-widget-datetimepicker' => array ( 'name' => 'kartik-v/yii2-widget-datetimepicker', 'version' => '1.4.3.0', 'alias' => array ( '@kartik/datetime' => $vendorDir . '/kartik-v/yii2-widget-datetimepicker', ), ), 'kartik-v/yii2-widget-datepicker' => array ( 'name' => 'kartik-v/yii2-widget-datepicker', 'version' => '1.4.2.0', 'alias' => array ( '@kartik/date' => $vendorDir . '/kartik-v/yii2-widget-datepicker', ), ), 'kartik-v/yii2-widget-colorinput' => array ( 'name' => 'kartik-v/yii2-widget-colorinput', 'version' => '1.0.3.0', 'alias' => array ( '@kartik/color' => $vendorDir . '/kartik-v/yii2-widget-colorinput', ), ), 'kartik-v/yii2-widget-alert' => array ( 'name' => 'kartik-v/yii2-widget-alert', 'version' => '1.1.0.0', 'alias' => array ( '@kartik/alert' => $vendorDir . '/kartik-v/yii2-widget-alert', ), ), 'kartik-v/yii2-widget-affix' => array ( 'name' => 'kartik-v/yii2-widget-affix', 'version' => '1.0.0.0', 'alias' => array ( '@kartik/affix' => $vendorDir . '/kartik-v/yii2-widget-affix', ), ), 'kartik-v/yii2-widget-activeform' => array ( 'name' => 'kartik-v/yii2-widget-activeform', 'version' => '1.4.8.0', 'alias' => array ( '@kartik/form' => $vendorDir . '/kartik-v/yii2-widget-activeform', ), ), 'kartik-v/yii2-widgets' => array ( 'name' => 'kartik-v/yii2-widgets', 'version' => '3.4.0.0', 'alias' => array ( '@kartik/widgets' => $vendorDir . '/kartik-v/yii2-widgets', ), ), 'amilna/yii2-yap' => array ( 'name' => 'amilna/yii2-yap', 'version' => '9999999-dev', 'alias' => array ( '@amilna/yap' => $vendorDir . '/amilna/yii2-yap', ), ), 'iutbay/yii2-fontawesome' => array ( 'name' => 'iutbay/yii2-fontawesome', 'version' => '0.0.1.1', 'alias' => array ( '@iutbay/yii2fontawesome' => $vendorDir . '/iutbay/yii2-fontawesome', ), ), 'yiisoft/yii2-jui' => array ( 'name' => 'yiisoft/yii2-jui', 'version' => '2.0.6.0', 'alias' => array ( '@yii/jui' => $vendorDir . '/yiisoft/yii2-jui', ), ), 'iutbay/yii2-kcfinder' => array ( 'name' => 'iutbay/yii2-kcfinder', 'version' => '9999999-dev', 'alias' => array ( '@iutbay/yii2kcfinder' => $vendorDir . '/iutbay/yii2-kcfinder', ), ), 'himiklab/yii2-colorbox-widget' => array ( 'name' => 'himiklab/yii2-colorbox-widget', 'version' => '1.0.3.0', 'alias' => array ( '@himiklab/colorbox' => $vendorDir . '/himiklab/yii2-colorbox-widget', ), ), 'kartik-v/yii2-date-range' => array ( 'name' => 'kartik-v/yii2-date-range', 'version' => '1.6.7.0', 'alias' => array ( '@kartik/daterange' => $vendorDir . '/kartik-v/yii2-date-range', ), ), 'amilna/yii2-blog' => array ( 'name' => 'amilna/yii2-blog', 'version' => '9999999-dev', 'alias' => array ( '@amilna/blog' => $vendorDir . '/amilna/yii2-blog', ), ), 'yiisoft/yii2-httpclient' => array ( 'name' => 'yiisoft/yii2-httpclient', 'version' => '2.0.3.0', 'alias' => array ( '@yii/httpclient' => $vendorDir . '/yiisoft/yii2-httpclient', ), ), 'yiisoft/yii2-authclient' => array ( 'name' => 'yiisoft/yii2-authclient', 'version' => '2.1.2.0', 'alias' => array ( '@yii/authclient' => $vendorDir . '/yiisoft/yii2-authclient', ), ), 'dektrium/yii2-user' => array ( 'name' => 'dektrium/yii2-user', 'version' => '0.9.12.0', 'alias' => array ( '@dektrium/user' => $vendorDir . '/dektrium/yii2-user', ), 'bootstrap' => 'dektrium\\user\\Bootstrap', ), 'yiisoft/yii2-sphinx' => array ( 'name' => 'yiisoft/yii2-sphinx', 'version' => '2.0.8.0', 'alias' => array ( '@yii/sphinx' => $vendorDir . '/yiisoft/yii2-sphinx', ), ), );
#!/bin/bash # start[默认] 启动 , stop 停止 CMD=$1 if [ -z $CMD ]; then CMD=start fi # debug[默认] 前台启动, release 后台启动 MODE=$2 if [ -z $MODE ]; then MODE=debug fi CONFIG=$3 if [ -z $CONFIG ]; then CONFIG=config.lua fi SKYNET_EXTEND=$4 if [ -z $SKYNET_EXTEND ]; then SKYNET_EXTEND=. fi TMP=$PATH PATH=$TMP ulimit -c unlimited CUR_PATH=$PWD PID_FILE=$CONFIG.pid CONF_TEMP=$CONFIG.tmp DEBUG_CONF=$CONFIG.debug function make_conf(){ echo "skynet_extend='$SKYNET_EXTEND/'" > $CONF_TEMP cat $SKYNET_EXTEND/config.lua >> $CONF_TEMP cat $CONFIG >> $CONF_TEMP echo "daemon='$PID_FILE'" >> $CONF_TEMP echo "logger='log/$(basename $CONFIG).log'" >> $CONF_TEMP } function start(){ case "$MODE" in release) make_conf $SKYNET_EXTEND/skynet/skynet $CONF_TEMP sleep 1 echo $CONFIG start with pid $(cat $PID_FILE) rm $CONF_TEMP ;; debug) make_conf sed -e 's/daemon/--daemon/' $CONF_TEMP > $DEBUG_CONF rm $CONF_TEMP $SKYNET_EXTEND/skynet/skynet $DEBUG_CONF ;; *) esac } function stop(){ if [ ! -f $PID_FILE ] ;then echo "not found pid file $PID_FILE" exit 0 fi pid=`cat $PID_FILE` exist_pid=`pgrep skynet | grep $pid` if [ -z "$exist_pid" ] ;then echo "have no $CONFIG server" exit 0 else echo -n $"$pid $CONFIG server will killed" kill $pid echo fi } case "$CMD" in start) start ;; stop) stop ;; restart) stop MODE=release start ;; *) exit 2 esac
RSpec::Matchers.define :match_service_instance do |expected_service_instance| problems = [] space = expected_service_instance.space match do |actual_event| unless actual_event.org_guid == space.organization_guid problems << "event.org_guid: #{actual_event.org_guid}, service_instance.space.organization_guid: #{space.organization_guid}" end unless actual_event.space_guid == space.guid problems << "event.space_guid: #{actual_event.space_guid}, service_instance.space.guid: #{space.guid}" end unless actual_event.space_name == space.name problems << "event.space_name: #{actual_event.space_name}, service_instance.space.name: #{space.name}" end unless actual_event.service_instance_guid == expected_service_instance.guid problems << "event.service_instance_guid: #{actual_event.service_instance_guid}, service_instance.guid: #{expected_service_instance.guid}" end unless actual_event.service_instance_name == expected_service_instance.name problems << "event.service_instance_name: #{actual_event.service_instance_name}, service_instance.name: #{expected_service_instance.name}" end unless actual_event.service_instance_type == expected_service_instance.type problems << "event.service_instance_type: #{actual_event.service_instance_type}, service_instance.type: #{expected_service_instance.type}" end problems.empty? end if expected_service_instance.type == 'managed_service_instance' service_plan = expected_service_instance.service_plan service = service_plan.service broker = service.service_broker match do |actual_event| unless actual_event.service_plan_guid == service_plan.guid problems << "event.service_plan_guid: #{actual_event.service_plan_guid}, service_instance.service_plan.guid: #{service_plan.guid}" end unless actual_event.service_plan_name == service_plan.name problems << "event.service_plan_name: #{actual_event.service_plan_name}, service_instance.service_plan.name: #{service_plan.name}" end unless actual_event.service_guid == service.guid problems << "event.service_guid: #{actual_event.service_guid}, service_instance.service.guid: #{service.guid}" end unless actual_event.service_label == service.label problems << "event.service_label: #{actual_event.service_label}, service_instance.service.label: #{service.label}" end unless actual_event.service_broker_name == broker.name problems << "event.service_broker_name: #{actual_event.service_broker_name}, service_instance.service_broker.name: #{broker.name}" end unless actual_event.service_broker_guid == broker.guid problems << "event.service_broker_guid: #{actual_event.service_broker_guid}, service_instance.service_broker.guid: #{broker.guid}" end problems.empty? end end failure_message do |actual_event| "Expect event to match service_instance, but did not. Problems were:\n" + problems.join("\n") end end
<?php require "db.php"; session_start(); $action = $_POST["action"]; $session_user = $_SESSION['username']; if($action == "showcomment"){ $post_query =mysqli_query($conn,"SELECT * From msg"); if($post_query){ while($row=mysqli_fetch_assoc($post_query)){ echo "<li><b>$row[uname]</b> : $row[msg]</li>"; } } } else if($action=="addcomment"){ $uname= $_SESSION["username"]; $msg=$_POST["message"]; mysqli_query($conn,"INSERT INTO msg values(NULL,'$uname','$msg') "); } else if($action=="showusers"){ $user_online_query=mysqli_query($conn,"SELECT uname FROM login"); if($user_online_query){ echo "<center><font size=\"5\" color=\"red\">Online Users</font></center>"; while($row=mysqli_fetch_assoc($user_online_query)){ echo "<li><b>$row[uname]</b></li>"; } } } else if($action=="active"){ mysqli_query($conn,"UPDATE active SET time= NOW() WHERE uname='$session_user'"); } mysqli_close($conn); ?>
using Newtonsoft.Json; namespace TradingApi.ModelObjects.Bitfinex.Json { public class BitfinexNewOrderPost : BitfinexPostBase { [JsonProperty("symbol")] public string Symbol { get; set; } [JsonProperty("amount")] public string Amount { get; set; } [JsonProperty("price")] public string Price { get; set; } [JsonProperty("exchange")] public string Exchange { get; set; } [JsonProperty("side")] public string Side { get; set; } [JsonProperty("type")] public string Type { get; set; } //[JsonProperty("is_hidden")] //public string IsHidden { get; set; } public override string ToString() { var str = string.Format("Symbol: {0}, Amount: {1}, Price: {2}, Exchange: {3}, Side: {4}, Type: {5}", Symbol,Amount,Price,Exchange,Side,Type); return str; } } }
--- company: p-o-ferries-gb imo: 9169550 layout: ship name: MS Oceana outOfScope: false routes: [] slug: ms-oceana-9169550 tags: - ship photo: /img/300px-MV_Oceana_passing_Calshot_Spit_light.JPG unknownRoutes: true wikipediaUrl: https://no.wikipedia.org/wiki/MS_%C2%ABOceana%C2%BB ---
pub struct Fern{ pub size:f64, pub growth_rate:f64, } impl Fern{ pub fn grow(&mut self){ self.size *= 1.0 + self.growth_rate; } } pub fn run_simulation(fern:&mut Fern,days:usize){ for _ in 0..days{ fern.grow(); } } #[cfg(test)] mod tests { #[test] fn fern_simulation_test() { use crate::Fern; use crate::run_simulation; let mut fern = Fern { size: 2.0, growth_rate: 3.0, }; run_simulation(&mut fern,20); println!("Fern final size {}",&fern.size); } }
# Contributing guidelines - Open an issue before starting to implement a feature, so that it can be discussed and approved/rejected before you start working on it - Always allow edits from maintainers on your pull requests - Keep your code as clean as possible by following these tips: - a long but descriptive function/variable name is better than a concise but unclear one - keep functions short (try to keep an average of 5-10 lines, don't go over 20 unless necessary) - avoid code duplication - use comments only if you can't explain it with code - Please follow strictly these styling guidelines: - Place brackets on the next line, except for anonymous functions and array/dictionary/class initializers - Do not use brackets for one-line code blocks (unless they are mandatory, e.g. try/catch blocks) - Follow [Microsoft .NET guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines) for variables naming
require "language_pack" require "language_pack/rails41" class LanguagePack::Rails42 < LanguagePack::Rails41 # detects if this is a Rails 4.2 app # @return [Boolean] true if it's a Rails 4.2 app def self.use? rails_version = bundler.gem_version('railties') return false unless rails_version is_rails42 = rails_version >= Gem::Version.new('4.2.0') && rails_version < Gem::Version.new('5.0.0') return is_rails42 end def setup_profiled(*args) super(*args) set_env_default "RAILS_SERVE_STATIC_FILES", "enabled" end def default_config_vars super.merge({ "RAILS_SERVE_STATIC_FILES" => env("RAILS_SERVE_STATIC_FILES") || "enabled" }) end end
feature 'user can log in' do let(:registered_user) {create(:user)} before do visit root_path click_on 'Login' end describe 'user inputs correct credentials' do it 'user can successfully log in' do # login_as(registered_user, scope: :user) fill_in "Email", with: registered_user.email fill_in "Password", with: registered_user.password click_on "Log in" # visit root_path expect(page).to have_content "Signed in successfully." end end describe 'user inputs incorrect credentials' do it 'user input the wrong password' do fill_in "Email", with: registered_user.email fill_in "Password", with: "summertime" click_on "Log in" expect(page).to have_content "Invalid Email or password" end it 'user inputs the wrong email' do fill_in "Email", with: "[email protected]" fill_in "Password", with: registered_user.password click_on "Log in" expect(page).to have_content "Invalid Email or password" end end end
require 'i18n' require 'yaml' I18n.config.available_locales = :en I18n.default_locale = :en class CompanyNameNormalizer COUNTRIES = YAML.load_file(__dir__ + '/countries.yaml').freeze COUNTRY_SUBS = COUNTRIES.values.map { |c| '(' + c + ')' } REGION_SUBS = %w[ASIA EUROPE UK].map { |c| '(' + c + ')' } NON_UNICODE_REGEXP = /\P{Word}+/.freeze SUFFIXES = %w[ BHD BV CO COMPANY CORP CORPORATION DMCC DOO DWC FZC FZE GMBH INC KSCC LIMITED LLC LTD NV PLC PRIVATE P/L PTE PTY PVT SA SAS SDN SL SLU SRL TR WLL ].freeze SUFFIXES_SPACED = [ 'S. A.', 'SP Z OO', 'SP. Z O.O.' ] SUFFIXES.each do |suffix| next unless suffix.length > 2 && suffix.length < 5 SUFFIXES_SPACED << ' ' + suffix.split('').join(' ') SUFFIXES_SPACED << ' ' + suffix.split('').join('.') end SPLIT_WORDS = [ 'VIA ', 'C/O ', 'P\.O\.', 'PO BOX', ].freeze def self.normalize(name) self.new.normalize(name) end def normalize(name) name = name.to_s.upcase name = clean_whitespace(name) name = get_primary_name(name) name = transliterate(name) name = remove_place(name) name = space_word_stops(name) name = remove_spaced_suffixes(name) name = space_letter_stops(name) name = replace_dashes(name) name = replace_ands(name) words = name .split(' ').map! { |word| replace_non_alphanumeric_chars(word) } .reject{|w| w == ''} while company_suffix?(words.last) words.pop end words.map! do |word| capitalize(word) end n = words.join return nil if n == '' n end def transliterate(name) I18n.transliterate(name) end def remove_spaced_suffixes(name) SUFFIXES_SPACED.each do |suffix| name = name.gsub(suffix, '') end name end def replace_ands(name) name.gsub('&', ' AND ').gsub('+', ' AND ') end def clean_whitespace(name) name.gsub(/[[:space:]]+/, " ").strip end def space_word_stops(name) name.gsub(/(\w\w)\.(\S)/, '\1. \2') end def space_letter_stops(name) name .gsub(/^(\w)\.(\S)/, '\1. \2') .gsub(/(\W\w)\.(\S)/, '\1. \2') end def replace_dashes(name) name.gsub('-', ' ') end def get_primary_name(name) SPLIT_WORDS.each do |split_term| match = name.match(/(.*)\s?#{split_term}\s?(.*)/) next unless match a = match[1] b = match[2] name = a.length > 4 ? a : b end name end def remove_place(name) (COUNTRY_SUBS + REGION_SUBS).each do |c| name = name.sub(c, '') end name end def company_suffix?(word) SUFFIXES.member?(word) end def replace_non_alphanumeric_chars(word) return '&' if word == 'AND' word.gsub(NON_UNICODE_REGEXP, '') end def capitalize(word) return if word == '' word.downcase! word[0] = word[0].upcase word end end
// Libs import { EntityManager } from "typeorm"; // Datasources import { UserDataSource } from "./user"; export function createDataSources(manager: EntityManager) { return { users: new UserDataSource(manager) } } export type DataSources = ReturnType<typeof createDataSources>;