text stringlengths 1 1.05M |
|---|
<reponame>avarun42/micronaut-data<gh_stars>100-1000
package io.micronaut.data.hibernate;
import io.micronaut.data.annotation.Repository;
import io.micronaut.data.hibernate.entities.UserWithWhere;
import io.micronaut.data.repository.CrudRepository;
import java.util.UUID;
@Repository
public interface UserWithWhereRepository extends CrudRepository<UserWithWhere, UUID> {
}
|
#!/bin/bash -x
#####################################################################
# SUMMARY: Train a RNN language model
# AUTHOR: snukky
# TAGS: lm rnn
#####################################################################
# Exit on error
set -e
# Test code goes here
rm -rf lm lm.log
mkdir -p lm
$MRT_MARIAN/marian \
--seed 1111 --no-shuffle \
--type lm --dim-emb 128 --dim-rnn 256 --cost-type ce-mean \
-m lm/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.en -v vocab.en.yml \
--disp-freq 20 --after-batches 100 \
--log lm.log
test -e lm/model.npz
test -e lm/model.npz.yml
test -e lm.log
cat lm.log | grep 'Ep\. 1 :' | $MRT_TOOLS/extract-costs.sh > lm.out
$MRT_TOOLS/diff-nums.py lm.out lm.expected -p 0.02 -o lm.diff
# Scoring with LM
test -s temp.bpe.en || tail $MRT_DATA/europarl.de-en/corpus.bpe.en > test.bpe.en
$MRT_MARIAN/marian-scorer -m lm/model.npz -t test.bpe.en -v vocab.en.yml > lm.scores.out
$MRT_TOOLS/diff-nums.py lm.scores.out lm.scores.expected -p 0.002 -o lm.scores.diff
# Exit with success code
exit 0
|
<reponame>IvanIndaia/Bolao-Libertadores21<gh_stars>0
function apostar () {
var fla = document.getElementById("placarF").value
var pal = document.getElementById("placarP").value
var apostador = document.getElementById("nomeApostador").value
if (fla == pal) {
/*setstyle '.\style.css' = '#penalte', visibility=hidden;*/
document.getElementById("penaltP").value = prompt("Quantos Penalts o Palmeiras vai acertar? ")
document.getElementById("penaltF").value = prompt("Quantos Penalts o Flamengo vai acertar? ")
}else {
}
}
/*
//Cria Objeto ActiveX
var dados = new ActiveXObject("Scripting.FileSystemObject");
//Função para gravar o arquivo
function GravaArquivo(arq,texto){
//pasta a ser salvo o arquivo
var pasta="C:/Documents and Settings/Computador2/Desktop/LerGravartxtcomJS/";
//se o parametro arq que é o nome do arquivo vier vazio ele salvará o arquivo com o nome “Sem Titulo”
if(arq==""){arq="Sem Titulo";}
//carrega o txt
var esc = dados.CreateTextFile(pasta+arq+”.txt”, false);
//escreve o que foi passado no parametro texto que é o texto contido no TextArea
esc.WriteLine(texto);
//fecha o txt
esc.Close();
}
//Função para abrir o arquivo
function AbreArquivo(arq){
//o parametro arq é o endereço do txt
//carrega o txt
var arquivo = dados.OpenTextFile(arq, 1, true);
//varre o arquivo
while(!arquivo.AtEndOfStream){
//escreve o txt no TextArea
document.getElementById(“texto”).value = arquivo.ReadAll();
}
//fecha o txt
arquivo.Close();
}
*/ |
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Block = void 0;
const _ = __importStar(require("lodash"));
const blockheader_1 = require("./blockheader");
const bn_1 = require("../crypto/bn");
const buffer_1 = require("../util/buffer");
const bufferreader_1 = require("../encoding/bufferreader");
const bufferwriter_1 = require("../encoding/bufferwriter");
const hash_1 = require("../crypto/hash");
const transaction_1 = require("../transaction");
const $ = require('../util/preconditions');
class Block {
constructor(arg) {
this.toObject = function toObject() {
var transactions = [];
this.transactions.forEach(function (tx) {
transactions.push(tx.toObject());
});
return {
header: this.header.toObject(),
transactions: transactions
};
};
this.toJSON = this.toObject;
this.toBuffer = function toBuffer() {
return this.toBufferWriter().concat();
};
this.toString = function toString() {
return this.toBuffer().toString('hex');
};
this.toBufferWriter = function toBufferWriter(bw) {
if (!bw) {
bw = new bufferwriter_1.BufferWriter();
}
bw.write(this.header.toBuffer());
bw.writeVarintNum(this.transactions.length);
for (var i = 0; i < this.transactions.length; i++) {
this.transactions[i].toBufferWriter(bw);
}
return bw;
};
this.getTransactionHashes = function getTransactionHashes() {
var hashes = [];
if (this.transactions.length === 0) {
return [Block.Values.NULL_HASH];
}
for (var t = 0; t < this.transactions.length; t++) {
hashes.push(this.transactions[t]._getHash());
}
return hashes;
};
this.getMerkleTree = function getMerkleTree() {
var tree = this.getTransactionHashes();
var j = 0;
for (var size = this.transactions.length; size > 1; size = Math.floor((size + 1) / 2)) {
for (var i = 0; i < size; i += 2) {
var i2 = Math.min(i + 1, size - 1);
var buf = Buffer.concat([tree[j + i], tree[j + i2]]);
tree.push(hash_1.Hash.sha256sha256(buf));
}
j += size;
}
return tree;
};
this.getMerkleRoot = function getMerkleRoot() {
var tree = this.getMerkleTree();
return tree[tree.length - 1];
};
this.validMerkleRoot = function validMerkleRoot() {
var h = new bn_1.BitcoreBN(this.header.merkleRoot.toString('hex'), 'hex');
var c = new bn_1.BitcoreBN(this.getMerkleRoot().toString('hex'), 'hex');
if (h.cmp(c) !== 0) {
return false;
}
return true;
};
this._getHash = function () {
return this.header._getHash();
};
this.inspect = function inspect() {
return '<Block ' + this.id + '>';
};
if (!(this instanceof Block)) {
return new Block(arg);
}
_.extend(this, Block._from(arg));
return this;
}
get hash() {
return this.id;
}
get id() {
if (!this._id) {
this._id = this.header.id;
}
return this._id;
}
}
exports.Block = Block;
Block.MAX_BLOCK_SIZE = 2000000;
Block._from = function _from(arg) {
var info = {};
if (buffer_1.BufferUtil.isBuffer(arg)) {
info = Block._fromBufferReader(new bufferreader_1.BufferReader(arg));
}
else if (_.isObject(arg)) {
info = Block._fromObject(arg);
}
else {
throw new TypeError('Unrecognized argument for Block');
}
return info;
};
Block._fromObject = function _fromObject(data) {
var transactions = [];
data.transactions.forEach(function (tx) {
if (tx instanceof transaction_1.Transaction) {
transactions.push(tx);
}
else {
transactions.push(new transaction_1.Transaction().fromObject(tx));
}
});
var info = {
header: blockheader_1.BlockHeader.fromObject(data.header),
transactions: transactions
};
return info;
};
Block.fromObject = function fromObject(obj) {
var info = Block._fromObject(obj);
return new Block(info);
};
Block._fromBufferReader = function _fromBufferReader(br) {
const info = {};
$.checkState(!br.finished(), 'No block data received');
info.header = blockheader_1.BlockHeader.fromBufferReader(br);
var transactions = br.readVarintNum();
info.transactions = [];
for (var i = 0; i < transactions; i++) {
info.transactions.push(new transaction_1.Transaction().fromBufferReader(br));
}
return info;
};
Block.fromBufferReader = function fromBufferReader(br) {
$.checkArgument(br, 'br is required');
var info = Block._fromBufferReader(br);
return new Block(info);
};
Block.fromBuffer = function fromBuffer(buf) {
return Block.fromBufferReader(new bufferreader_1.BufferReader(buf));
};
Block.fromString = function fromString(str) {
var buf = new Buffer(str, 'hex');
return Block.fromBuffer(buf);
};
Block.fromRawBlock = function fromRawBlock(data) {
if (!buffer_1.BufferUtil.isBuffer(data)) {
data = new Buffer(data, 'binary');
}
var br = new bufferreader_1.BufferReader(data);
br.pos = Block.Values.START_OF_BLOCK;
var info = Block._fromBufferReader(br);
return new Block(info);
};
Block.Values = {
START_OF_BLOCK: 8,
NULL_HASH: Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
};
//# sourceMappingURL=block.js.map |
<reponame>DevinShuFan/mysise
package com.devin.client.mysise.model.bean;
public class Subject {
private String name;
private String score;
private String term;
private String id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public String getTerm() {
return term;
}
public void setTerm(String term) {
this.term = term;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
|
rm -rf bin
mkdir bin
cd bin
proj_name=path_tracing
proj_root_dir=$(pwd)/../
flags=(
-std=c++17 -Wall -pthread
)
inc=(
-I ../source/
)
src=(
../source/main.cpp
)
g++ -g ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name}
cd ..
|
model = Sequential()
model.add(Embedding(input_dim=vocabulary_size, output_dim=embedding_size, input_length=max_length))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy']) |
#!/usr/bin/env bats
readonly gsapp="$BATS_TEST_DIRNAME/../gsapp"
readonly GSAPP_PATH="$BATS_TMPDIR/applications"
setup() {
export GSAPP_PATH
mkdir -p -- "$GSAPP_PATH"
}
teardown() {
rm -rf -- "$GSAPP_PATH"
}
@test "gsapp delete: exit non-zero if arguments is not enough" {
run "$gsapp" delete
[[ $status != 0 ]]
}
@test "gsapp delete: exit non-zero if \$GSAPP_PATH doesn't exist" {
rm -rf -- "$GSAPP_PATH"
run "$gsapp" delete app
[[ $status != 0 ]]
}
@test "gsapp delete: exit non-zero if the specified application doesn't exist" {
run "$gsapp" delete app
[[ $status != 0 ]]
}
@test "gsapp delete: delete the specified application" {
touch "$GSAPP_PATH/app1.desktop"
touch "$GSAPP_PATH/app2.desktop"
run "$gsapp" delete app2
[[ $status == 0 ]]
[[ -f "$GSAPP_PATH/app1.desktop" ]]
[[ ! -f "$GSAPP_PATH/app2.desktop" ]]
}
@test "gsapp delete: delete the specified applications" {
touch "$GSAPP_PATH/app1.desktop"
touch "$GSAPP_PATH/app2.desktop"
run "$gsapp" delete app1 app2
[[ $status == 0 ]]
[[ ! -f "$GSAPP_PATH/app1.desktop" ]]
[[ ! -f "$GSAPP_PATH/app2.desktop" ]]
}
|
package back_tracking;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
/**
*
* @author exponential-e
* 백준 14502번: 연구소
*
* @see https://www.acmicpc.net/problem/14502/
*
*/
public class Boj14502 {
private static final int BLOCK = 1;
private static final int VIRUS = 2;
private static final int SAFE = 0;
private static final int[][] DIRECTIONS = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
private static final int ROW = 0, COL = 1;
private static int N, M;
private static boolean[][][] visit;
private static boolean[] used;
private static int[] list = new int[3];
private static int result = 0;
private static class Point{
int row;
int col;
public Point(int row, int col) {
this.row = row;
this.col = col;
}
}
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
M = Integer.parseInt(st.nextToken());
int[][] map = new int[N][M];
visit = new boolean[N * M][N * M][N * M];
used = new boolean[N * M];
for(int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
for(int j = 0; j < M; j++) {
map[i][j] = Integer.parseInt(st.nextToken());
}
}
for(int i = 0; i < N * M; i++) {
if(map[i / M][i % M] != SAFE) continue;
backTracking(map, 0, i); // located blocks
}
System.out.println(result);
}
private static void backTracking(int[][] arr, int count, int current) {
if(used[current]) return;
used[current] = true;
list[count] = current;
if(count == 2) {
if(visit[list[0]][list[1]][list[2]]) return; // remove duplicated
visit[list[0]][list[1]][list[2]] = visit[list[0]][list[2]][list[1]]
= visit[list[1]][list[2]][list[0]] = visit[list[1]][list[0]][list[2]]
= visit[list[2]][list[1]][list[0]] = visit[list[2]][list[0]][list[1]] = true;
int area = bfs(arr); // find safe area
if(area > result) result = area;
return;
}
for(int next = 0; next < N * M; next++) {
if(used[next] || arr[next / M][next % M] != SAFE) continue;
backTracking(arr, count + 1, next);
used[next] = false;
}
}
private static int bfs(int[][] arr) {
Queue<Point> q = new LinkedList<>();
int[][] lab = new int[N][M];
for(int row = 0; row < N; row++) {
for(int col = 0; col < M; col++) {
if(arr[row][col] == VIRUS) q.offer(new Point(row, col));
lab[row][col] = arr[row][col];
}
}
while(!q.isEmpty()) {
Point current = q.poll();
for(final int[] DIRECTION: DIRECTIONS) {
int nextRow = current.row + DIRECTION[ROW];
int nextCol = current.col + DIRECTION[COL];
if(nextRow < 0 || nextRow >= N || nextCol < 0 || nextCol >= M || isBoundary(nextRow, nextCol)) continue;
if(lab[nextRow][nextCol] == BLOCK || lab[nextRow][nextCol] == VIRUS) continue;
lab[nextRow][nextCol] = VIRUS;
q.offer(new Point(nextRow, nextCol));
}
}
int count = 0;
for(int row = 0; row < N; row++) {
for(int col = 0; col < M; col++) {
if(lab[row][col] == SAFE && !isBoundary(row, col)) count++;
}
}
return count;
}
private static boolean isBoundary(int row, int col) {
for(int idx: list) {
if(idx / M == row && idx % M == col) return true;
}
return false;
}
}
|
(function () {
require('../src');
const dd = require('dingtalk-jsapi');
describe('api.basic test', () => {
test('nx.ddPromisfyAll should create the same apis when suffix is empty', function () {
var apis = nx.mix(
null,
dd.device.audio,
dd.device.base
);
var target = nx.ddPromisfyAll(apis);
expect(
Object.keys(apis)
).toEqual(
Object.keys(target)
);
});
});
})();
|
<filename>src/main/java/com/pchudzik/blog/exmples/randomtestdata/ArticleFactory.java
package com.pchudzik.blog.exmples.randomtestdata;
import lombok.RequiredArgsConstructor;
import java.time.Clock;
@RequiredArgsConstructor
class ArticleFactory {
private final Clock systemClock;
public ArticleFactory() {
this(Clock.systemDefaultZone());
}
public Article newArticle() {
return new Article(systemClock);
}
}
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Email.proto
package org.xtwy.pb.protocol;
public final class EmailProbuf {
private EmailProbuf() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface EmailOrBuilder extends
// @@protoc_insertion_point(interface_extends:Email)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required int32 id = 1;</code>
*/
boolean hasId();
/**
* <code>required int32 id = 1;</code>
*/
int getId();
/**
* <code>required string subject = 2;</code>
*/
boolean hasSubject();
/**
* <code>required string subject = 2;</code>
*/
java.lang.String getSubject();
/**
* <code>required string subject = 2;</code>
*/
com.google.protobuf.ByteString
getSubjectBytes();
/**
* <code>optional string content = 3;</code>
*/
boolean hasContent();
/**
* <code>optional string content = 3;</code>
*/
java.lang.String getContent();
/**
* <code>optional string content = 3;</code>
*/
com.google.protobuf.ByteString
getContentBytes();
/**
* <code>required string fromUser = 4;</code>
*/
boolean hasFromUser();
/**
* <code>required string fromUser = 4;</code>
*/
java.lang.String getFromUser();
/**
* <code>required string fromUser = 4;</code>
*/
com.google.protobuf.ByteString
getFromUserBytes();
}
/**
* Protobuf type {@code Email}
*/
public static final class Email extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:Email)
EmailOrBuilder {
// Use Email.newBuilder() to construct.
private Email(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Email(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Email defaultInstance;
public static Email getDefaultInstance() {
return defaultInstance;
}
public Email getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Email(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
id_ = input.readInt32();
break;
}
case 18: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000002;
subject_ = bs;
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
content_ = bs;
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000008;
fromUser_ = bs;
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.xtwy.pb.protocol.EmailProbuf.internal_static_Email_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.xtwy.pb.protocol.EmailProbuf.internal_static_Email_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.xtwy.pb.protocol.EmailProbuf.Email.class, org.xtwy.pb.protocol.EmailProbuf.Email.Builder.class);
}
public static com.google.protobuf.Parser<Email> PARSER =
new com.google.protobuf.AbstractParser<Email>() {
public Email parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Email(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Email> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int ID_FIELD_NUMBER = 1;
private int id_;
/**
* <code>required int32 id = 1;</code>
*/
public boolean hasId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 id = 1;</code>
*/
public int getId() {
return id_;
}
public static final int SUBJECT_FIELD_NUMBER = 2;
private java.lang.Object subject_;
/**
* <code>required string subject = 2;</code>
*/
public boolean hasSubject() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string subject = 2;</code>
*/
public java.lang.String getSubject() {
java.lang.Object ref = subject_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
subject_ = s;
}
return s;
}
}
/**
* <code>required string subject = 2;</code>
*/
public com.google.protobuf.ByteString
getSubjectBytes() {
java.lang.Object ref = subject_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
subject_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CONTENT_FIELD_NUMBER = 3;
private java.lang.Object content_;
/**
* <code>optional string content = 3;</code>
*/
public boolean hasContent() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string content = 3;</code>
*/
public java.lang.String getContent() {
java.lang.Object ref = content_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
content_ = s;
}
return s;
}
}
/**
* <code>optional string content = 3;</code>
*/
public com.google.protobuf.ByteString
getContentBytes() {
java.lang.Object ref = content_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
content_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int FROMUSER_FIELD_NUMBER = 4;
private java.lang.Object fromUser_;
/**
* <code>required string fromUser = 4;</code>
*/
public boolean hasFromUser() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string fromUser = 4;</code>
*/
public java.lang.String getFromUser() {
java.lang.Object ref = fromUser_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
fromUser_ = s;
}
return s;
}
}
/**
* <code>required string fromUser = 4;</code>
*/
public com.google.protobuf.ByteString
getFromUserBytes() {
java.lang.Object ref = fromUser_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
fromUser_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
id_ = 0;
subject_ = "";
content_ = "";
fromUser_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasId()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasSubject()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasFromUser()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, id_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getSubjectBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getContentBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(4, getFromUserBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, id_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getSubjectBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getContentBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, getFromUserBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.xtwy.pb.protocol.EmailProbuf.Email parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.xtwy.pb.protocol.EmailProbuf.Email prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code Email}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:Email)
org.xtwy.pb.protocol.EmailProbuf.EmailOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.xtwy.pb.protocol.EmailProbuf.internal_static_Email_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.xtwy.pb.protocol.EmailProbuf.internal_static_Email_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.xtwy.pb.protocol.EmailProbuf.Email.class, org.xtwy.pb.protocol.EmailProbuf.Email.Builder.class);
}
// Construct using org.xtwy.pb.protocol.EmailProbuf.Email.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
id_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
subject_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
content_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
fromUser_ = "";
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.xtwy.pb.protocol.EmailProbuf.internal_static_Email_descriptor;
}
public org.xtwy.pb.protocol.EmailProbuf.Email getDefaultInstanceForType() {
return org.xtwy.pb.protocol.EmailProbuf.Email.getDefaultInstance();
}
public org.xtwy.pb.protocol.EmailProbuf.Email build() {
org.xtwy.pb.protocol.EmailProbuf.Email result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.xtwy.pb.protocol.EmailProbuf.Email buildPartial() {
org.xtwy.pb.protocol.EmailProbuf.Email result = new org.xtwy.pb.protocol.EmailProbuf.Email(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.id_ = id_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.subject_ = subject_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.content_ = content_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.fromUser_ = fromUser_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.xtwy.pb.protocol.EmailProbuf.Email) {
return mergeFrom((org.xtwy.pb.protocol.EmailProbuf.Email)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(org.xtwy.pb.protocol.EmailProbuf.Email other) {
if (other == org.xtwy.pb.protocol.EmailProbuf.Email.getDefaultInstance()) return this;
if (other.hasId()) {
setId(other.getId());
}
if (other.hasSubject()) {
bitField0_ |= 0x00000002;
subject_ = other.subject_;
onChanged();
}
if (other.hasContent()) {
bitField0_ |= 0x00000004;
content_ = other.content_;
onChanged();
}
if (other.hasFromUser()) {
bitField0_ |= 0x00000008;
fromUser_ = other.fromUser_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasId()) {
return false;
}
if (!hasSubject()) {
return false;
}
if (!hasFromUser()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.xtwy.pb.protocol.EmailProbuf.Email parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.xtwy.pb.protocol.EmailProbuf.Email) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int id_ ;
/**
* <code>required int32 id = 1;</code>
*/
public boolean hasId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 id = 1;</code>
*/
public int getId() {
return id_;
}
/**
* <code>required int32 id = 1;</code>
*/
public Builder setId(int value) {
bitField0_ |= 0x00000001;
id_ = value;
onChanged();
return this;
}
/**
* <code>required int32 id = 1;</code>
*/
public Builder clearId() {
bitField0_ = (bitField0_ & ~0x00000001);
id_ = 0;
onChanged();
return this;
}
private java.lang.Object subject_ = "";
/**
* <code>required string subject = 2;</code>
*/
public boolean hasSubject() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string subject = 2;</code>
*/
public java.lang.String getSubject() {
java.lang.Object ref = subject_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
subject_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string subject = 2;</code>
*/
public com.google.protobuf.ByteString
getSubjectBytes() {
java.lang.Object ref = subject_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
subject_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string subject = 2;</code>
*/
public Builder setSubject(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
subject_ = value;
onChanged();
return this;
}
/**
* <code>required string subject = 2;</code>
*/
public Builder clearSubject() {
bitField0_ = (bitField0_ & ~0x00000002);
subject_ = getDefaultInstance().getSubject();
onChanged();
return this;
}
/**
* <code>required string subject = 2;</code>
*/
public Builder setSubjectBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
subject_ = value;
onChanged();
return this;
}
private java.lang.Object content_ = "";
/**
* <code>optional string content = 3;</code>
*/
public boolean hasContent() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional string content = 3;</code>
*/
public java.lang.String getContent() {
java.lang.Object ref = content_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
content_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string content = 3;</code>
*/
public com.google.protobuf.ByteString
getContentBytes() {
java.lang.Object ref = content_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
content_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string content = 3;</code>
*/
public Builder setContent(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
content_ = value;
onChanged();
return this;
}
/**
* <code>optional string content = 3;</code>
*/
public Builder clearContent() {
bitField0_ = (bitField0_ & ~0x00000004);
content_ = getDefaultInstance().getContent();
onChanged();
return this;
}
/**
* <code>optional string content = 3;</code>
*/
public Builder setContentBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
content_ = value;
onChanged();
return this;
}
private java.lang.Object fromUser_ = "";
/**
* <code>required string fromUser = 4;</code>
*/
public boolean hasFromUser() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required string fromUser = 4;</code>
*/
public java.lang.String getFromUser() {
java.lang.Object ref = fromUser_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
fromUser_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string fromUser = 4;</code>
*/
public com.google.protobuf.ByteString
getFromUserBytes() {
java.lang.Object ref = fromUser_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
fromUser_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string fromUser = 4;</code>
*/
public Builder setFromUser(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
fromUser_ = value;
onChanged();
return this;
}
/**
* <code>required string fromUser = 4;</code>
*/
public Builder clearFromUser() {
bitField0_ = (bitField0_ & ~0x00000008);
fromUser_ = getDefaultInstance().getFromUser();
onChanged();
return this;
}
/**
* <code>required string fromUser = 4;</code>
*/
public Builder setFromUserBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000008;
fromUser_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:Email)
}
static {
defaultInstance = new Email(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:Email)
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_Email_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_Email_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\013Email.proto\"G\n\005Email\022\n\n\002id\030\001 \002(\005\022\017\n\007su" +
"bject\030\002 \002(\t\022\017\n\007content\030\003 \001(\t\022\020\n\010fromUser" +
"\030\004 \002(\tB#\n\024org.xtwy.pb.protocolB\013EmailPro" +
"buf"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_Email_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_Email_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_Email_descriptor,
new java.lang.String[] { "Id", "Subject", "Content", "FromUser", });
}
// @@protoc_insertion_point(outer_class_scope)
}
|
package com.yin.springboot.shiro.exception;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date:2019/7/30
* Time: 17:26
* To change this template use File | Settings | File Templates.
*/
@ControllerAdvice
public class AuthorationException {
@ExceptionHandler(UnauthorizedException.class)
public String handleShiroException(Exception ex) {
return "redirect:/unauthor";
}
@ExceptionHandler(AuthorizationException.class)
public String AuthorizationException(Exception ex) {
return "redirect:/unauthor";
}
}
|
#!/bin/bash
dieharder -d 203 -g 50 -S 3477418323
|
#!/bin/sh
set -e
set -u
set -o pipefail
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
fi
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
code_sign_cmd="$code_sign_cmd &"
fi
echo "$code_sign_cmd"
eval "$code_sign_cmd"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/SquareMosaicLayout/SquareMosaicLayout.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/SquareMosaicLayout/SquareMosaicLayout.framework"
fi
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
wait
fi
|
#!/bin/bash
#$ -q 1-day
#$ -cwd
#$ -l h_vmem=8G
source $BIN_PATH/job.config
REF=$1
DATA=$2
OUT=$3
REFDICT=${REF/%.fasta/.dict}
REFDICT=${REFDICT/%.fa/.dict}
ALLDATA=${DATA/passed/all}
ALLDATA=${ALLDATA/%.vcf/.decomp.norm.uniq.vcf.gz}
Q20DATA=${ALLDATA/all.somatic.indels/q20.somatic.indels}
DATAMD5=$(dirname $DATA)/checksum/$(basename $DATA).md5
OUTMD5=$(dirname $OUT)/checksum/$(basename $OUT).md5
if [[ -f $DATA && -f $DATAMD5 && \
$(md5sum $DATA|cut -f1 -d' ') = \
$(cut -f1 -d' ' $DATAMD5) ]]; then
$BIN_PATH/vcf_simplify.sh -r $REF ${DATA/passed/all}
$BCFTOOLS filter -i 'SGT="ref->het" && QSI >= 20' -o $Q20DATA -O z $ALLDATA
printf "#chr\tpos\tref\talt\tclone_f\tcl_total_reads\tcl_ref_count\tcl_alt_count\ttissue_f\tti_total_reads\tti_ref_count\tti_alt_count\n" > $OUT
$BCFTOOLS query -f "%CHROM\t%POS\t%REF\t%ALT[\t%DP\t%TAR{0}\t%TIR{0}\t%TOR{0}]\n" $Q20DATA \
|perl -ane '
($chr, $pos, $ref, $alt,
$ti_dp, $ti_tar, $ti_tir, $ti_tor,
$cl_dp, $cl_tar, $cl_tir, $cl_tor) = @F;
$cl_ref_count = $cl_tar;
$cl_alt_count = $cl_tir;
$cl_total_reads = $cl_ref_count + $cl_alt_count;
if ($cl_total_reads == 0) {
$clone_f = -1;
} else {
$clone_f = $cl_alt_count / $cl_total_reads;
}
$ti_ref_count = $ti_tar;
$ti_alt_count = $ti_tir;
$ti_total_reads = $ti_ref_count + $ti_alt_count;
if ($ti_total_reads == 0) {
$tissue_f = -1;
} else {
$tissue_f = $ti_alt_count / $ti_total_reads;
}
print "$chr\t$pos\t$ref\t$alt\t$clone_f\t$cl_total_reads\t$cl_ref_count\t$cl_alt_count\t$tissue_f\t$ti_total_reads\t$ti_ref_count\t$ti_alt_count\n"
' >> $OUT
if [[ $? = 0 ]]; then
mkdir -p $(dirname $OUTMD5)
md5sum $OUT > $OUTMD5
fi
else
echo "$DATA doesn't exist or doesn't match to the checksum."
exit 1
fi
|
#!/bin/sh
# CYBERWATCH SAS - 2017
#
# Security fix for DLA-787-1
#
# Security announcement date: 2017-01-16 00:00:00 UTC
# Script generation date: 2017-01-18 21:13:08 UTC
#
# Operating System: Debian 7 (Wheezy)
# Architecture: x86_64
#
# Vulnerable packages fix on version:
# - otrs2:3.1.7+dfsg1-8+deb7u6
#
# Last versions recommanded by security team:
# - otrs2:3.1.7+dfsg1-8+deb7u6
#
# CVE List:
# - CVE-2016-9139
#
# More details:
# - https://www.cyberwatch.fr/vulnerabilites
#
# Licence: Released under The MIT License (MIT), See LICENSE FILE
sudo apt-get install --only-upgrade otrs2=3.1.7+dfsg1-8+deb7u6 -y
|
#!/bin/sh
TEMPLATE=src/match/esa-bottomup
SC=scripts/gen-esa-bottomup.rb
${SC} --key maxpairs --reader --absolute \
--no_process_lcpinterval > ${TEMPLATE}-maxpairs.inc
${SC} --key spmsk --no_process_branchingedge > ${TEMPLATE}-spmsk.inc
${SC} --key rdjcv --reader --absolute \
--no_process_lcpinterval > ${TEMPLATE}-rdjcv.inc
${SC} --key rdjce --reader --absolute \
--no_process_lcpinterval > ${TEMPLATE}-rdjce.inc
${SC} --key errfind --reader --absolute > ${TEMPLATE}-errfind.inc
${SC} --key spmeq --no_process_lcpinterval > ${TEMPLATE}-spmeq.inc
${SC} --key spmvar > ${TEMPLATE}-spmvar.inc
${SC} --key shulen --reader --absolute \
--no_process_lcpinterval > ${TEMPLATE}-shulen.inc
${SC} --key shulen --gtlcpvaluetypeset --absolute --no_process_lastvalue \
--no_process_lcpinterval \
--withlastfrompreviousbucket \
--additionaluint32bucket \
--no_declarations > ${TEMPLATE}-shulen-RAM.inc
|
def insertion_sort(list):
for i in range(1, len(list)):
key = list[i]
j = i - 1
while j >= 0 and list[j] > key:
list[j + 1] = list[j]
j = j - 1
list[j + 1] = key |
#!/usr/bin/env bash
if [ ! -f .telegraf/tele.conf ]; then
echo "Initializing the telegraf config. If you need to point to an influx instance not on localhost, modify ./telegraf/tele.conf"
mkdir .telegraf
telegraf --input-filter statsd --output-filter influxdb config > ./.telegraf/tele.conf
fi
telegraf -config ./.telegraf/tele.conf |
/// <reference path="../../model/result.ts"/>
import 'ace';
import 'ace/theme-github';
import 'ace/mode-javascript';
import {Result, ResultSet} from 'app/model/result';
class MainController {
static ACE_BASE_PATH: String = "libs/ace@1.2.0/";
/**
* DI
* @type {ng.IScope}
*/
private scope: ng.IScope;
public resultSets: ResultSet[] = [];
private activeResultSet: ResultSet;
/**
* Context Object for eval.call()
* @type {Object}
*/
private evalContext: Object = {}
constructor($scope: ng.IScope) {
this.scope = $scope;
this.initAce();
}
private initAce(): void {
var thisObj: MainController = this;
var editor: AceAjax.Editor = ace.edit("ec-ace-editor");
ace.config.set("basePath", MainController.ACE_BASE_PATH);
editor.setTheme("ace/theme/github");
editor.getSession().setMode("ace/mode/javascript");
editor.commands.addCommands([
// bind to Enter
<AceAjax.EditorCommand> {
name: 'enterCommand',
bindKey: {win: 'Enter', mac: 'Enter'},
exec: function(editor: AceAjax.Editor) {
thisObj.enterHandler(editor);
},
readOnly: false
},
// bind to Shift+Enter
<AceAjax.EditorCommand> {
name: 'shiftEnterCommand',
bindKey: {win: 'Shift+Enter', mac: 'Shift+Enter'},
exec: function(editor: AceAjax.Editor) {
thisObj.shiftEnterHandler(editor);
},
readOnly: false
},
// bind to Ctrl+Enter
<AceAjax.EditorCommand> {
name: 'ctrlEnterCommand',
bindKey: {win: 'Ctrl+Enter', mac: 'Cmd+Enter'},
exec: function(editor: AceAjax.Editor) {
thisObj.ctrlEnterHandler(editor);
},
readOnly: false
}
]);
}
/**
* insert a end-of-line to current position
* @param {AceAjax.Editor} editor instance
*/
private insertNewLine(editor: AceAjax.Editor): void {
var currentPos: AceAjax.Position = editor.getCursorPosition();
editor.getSession().getDocument().insertMergedLines(currentPos, ['', '']);
}
private getActiveResultSet(): ResultSet {
if (this.activeResultSet == null) {
this.activeResultSet = new ResultSet();
this.resultSets.push(this.activeResultSet);
}
return this.activeResultSet;
}
private evalAll(editor: AceAjax.Editor): void {
// TODO implements
var lastLineNum = 10;
this.evalSelectedLines(editor, 0, lastLineNum);
}
private evalSelectedLines(editor: AceAjax.Editor, startLineNum: number, endLineNum: number): void {
var resultSet: ResultSet = new ResultSet();
// eval start to end
for (var i=startLineNum; i<=endLineNum; i++) {
var result: Result = this.evalLine(editor, i);
if (result != null) {
resultSet.addResult(result);
};
}
// store resultSet
this.resultSets.push(resultSet);
// reset active
this.activeResultSet = null;
// apply
this.scope.$apply(<any> this.resultSets);
}
private evalCurrentLine(editor: AceAjax.Editor): void {
var currentPos: AceAjax.Position = editor.getCursorPosition();
var lineNum: number = currentPos.row;
// eval
var result: Result = this.evalLine(editor, lineNum);
if (result != null) {
this.getActiveResultSet().addResult(result);
// apply
this.scope.$apply(<any> this.resultSets);
}
}
/**
* evaluate script of the specified line
* @param {AceAjax.Editor} editor [description]
* @param {number} lineNum line Number
* @return {Result} [description]
*/
private evalLine(editor: AceAjax.Editor, lineNum: number): Result {
var line: String = editor.getSession().getLine(lineNum)
return this.eval(line)
}
/**
* evaluate the specified script
* @param {String} line script
* @return {Result} [description]
*/
private eval(line: String): Result {
line = line.trim()
// return null if empty
if (line === "") {
return null
}
var resultStr = eval.call(this.evalContext, line.toString())
return <Result> { input: line, output: resultStr }
}
private enterHandler(editor: AceAjax.Editor): void {
console.log("Enter");
this.evalCurrentLine(editor);
this.insertNewLine(editor);
}
private shiftEnterHandler(editor: AceAjax.Editor): void {
this.insertNewLine(editor);
}
private ctrlEnterHandler(editor: AceAjax.Editor): void {
console.log("Ctrl + Enter");
// TODO evaluate all
}
}
export default MainController;
|
#!/usr/bin/env python
import smach
import random
class RandomOutcomeState(smach.State):
def __init__(self, input_keys = ['outcome'], output_keys = ['outcome'], callbacks = {}, outcomes=['succeeded']):
smach.State.__init__(self, input_keys=input_keys, output_keys=output_keys, outcomes=outcomes)
self._cbs = []
if callbacks:
for cb in sorted(callbacks):
if cb in globals():
self._cbs.append(globals()[cb])
elif cb in locals():
self._cbs.append(locals()[cb])
elif cb in dir(self):
self._cbs.append(getattr(self, cb))
self._cb_input_keys = []
self._cb_output_keys = []
self._cb_outcomes = []
for cb in self._cbs:
if cb and smach.has_smach_interface(cb):
self._cb_input_keys.append(cb.get_registered_input_keys())
self._cb_output_keys.append(cb.get_registered_output_keys())
self._cb_outcomes.append(cb.get_registered_outcomes())
self.register_input_keys(self._cb_input_keys[-1])
self.register_output_keys(self._cb_output_keys[-1])
self.register_outcomes(self._cb_outcomes[-1])
def execute(self, userdata):
# Call callbacks
for (cb, ik, ok) in zip(self._cbs,
self._cb_input_keys,
self._cb_output_keys):
# Call callback with limited userdata
try:
cb_outcome = cb(self, smach.Remapper(userdata,ik,ok,{}))
except:
cb_outcome = cb(smach.Remapper(userdata,ik,ok,{}))
return userdata.outcome
class CallbacksState(smach.State):
def __init__(self, input_keys=[], output_keys=[], callbacks=[]):
smach.State.__init__(self, input_keys=input_keys, output_keys=output_keys, outcomes=['succeeded'])
self._cbs = []
if callbacks:
for cb in sorted(callbacks):
if cb in globals():
self._cbs.append(globals()[cb])
elif cb in locals():
self._cbs.append(locals()[cb])
elif cb in dir(self):
self._cbs.append(getattr(self, cb))
self._cb_input_keys = []
self._cb_output_keys = []
self._cb_outcomes = []
for cb in self._cbs:
if cb and smach.has_smach_interface(cb):
self._cb_input_keys.append(cb.get_registered_input_keys())
self._cb_output_keys.append(cb.get_registered_output_keys())
self._cb_outcomes.append(cb.get_registered_outcomes())
self.register_input_keys(self._cb_input_keys[-1])
self.register_output_keys(self._cb_output_keys[-1])
self.register_outcomes(self._cb_outcomes[-1])
def execute(self, userdata):
# Call callbacks
for (cb, ik, ok) in zip(self._cbs,
self._cb_input_keys,
self._cb_output_keys):
# Call callback with limited userdata
try:
cb_outcome = cb(self, smach.Remapper(userdata,ik,ok,{}))
except:
cb_outcome = cb(smach.Remapper(userdata,ik,ok,{}))
return 'succeeded'
@smach.cb_interface(input_keys=[],
output_keys=['outcome'],
outcomes=['foo_0', 'foo_1', 'foo_2'])
def outcome_randomize_lambda_cb(self, userdata):
lambda_cb = lambda ud: random.choice(list(self._outcomes))
userdata.outcome = lambda_cb(userdata)
return 'succeeded'
RandomOutcomeState.outcome_randomize_lambda_cb = outcome_randomize_lambda_cb
@smach.cb_interface(input_keys=[],
output_keys=['outcome'],
outcomes=[])
def outcome_foo_0_lambda_cb(self, userdata):
lambda_cb = lambda ud: random.choice(list(self._outcomes))
userdata.outcome = lambda_cb(userdata)
return 'succeeded'
CallbacksState.outcome_foo_0_lambda_cb = outcome_foo_0_lambda_cb
@smach.cb_interface(input_keys=[],
output_keys=['outcome'],
outcomes=[])
def outcome_foo_1_lambda_cb(self, userdata):
lambda_cb = lambda ud: random.choice(list(self._outcomes))
userdata.outcome = lambda_cb(userdata)
return 'succeeded'
CallbacksState.outcome_foo_1_lambda_cb = outcome_foo_1_lambda_cb
@smach.cb_interface(input_keys=[],
output_keys=['outcome'],
outcomes=[])
def outcome_foo_2_lambda_cb(self, userdata):
lambda_cb = lambda ud: random.choice(list(self._outcomes))
userdata.outcome = lambda_cb(userdata)
return 'succeeded'
CallbacksState.outcome_foo_2_lambda_cb = outcome_foo_2_lambda_cb
def main():
sm = smach.StateMachine(outcomes=['final_outcome'])
with sm:
smach.StateMachine.add('RANDOMIZE',
RandomOutcomeState(callbacks = ['outcome_randomize_lambda_cb'], outcomes=['foo_0', 'foo_1', 'foo_2']),
transitions={'foo_0':'FOO_0',
'foo_1':'FOO_1',
'foo_2':'FOO_2'})
smach.StateMachine.add('FOO_0',
CallbacksState(callbacks = ['outcome_foo_0_lambda_cb']),
transitions={'succeeded':'RANDOMIZE'})
smach.StateMachine.add('FOO_1',
CallbacksState(callbacks = ['outcome_foo_1_lambda_cb']),
transitions={'succeeded':'RANDOMIZE'})
smach.StateMachine.add('FOO_2',
CallbacksState(callbacks = ['outcome_foo_2_lambda_cb']),
transitions={'succeeded':'final_outcome'})
outcome = sm.execute()
if __name__ == '__main__':
main() |
def get_median(arr):
arr.sort()
n = len(arr)
if n % 2 == 0:
return (arr[n//2] + arr[n//2 - 1])/2
else:
return arr[n//2]
if name == "main":
arr = [3, 4, 9, 6, 5]
print(get_median(arr)) # Output -> 5.5 |
const varint = require('varint');
const libName = 'OntologyStorageLib';
const indentLevel = i => Array(i * 4 + 1).join(' ');
const storageMapName = kind => {
return `${kind.name.toLowerCase()}_hash_map`;
};
const storageDelegateName = kind => {
return `${kind.name.toLowerCase()}_storage`;
};
const codecName = kind => {
return `${kind.name}Codec`;
};
const codecClassName = kind => {
return `${codecName(kind)}.${kind.name}`;
};
// returns a rendered string of kind params for use in function signatures
const kindParamsWithType = kind => {
return kind.fields
.map(field => `${solidityTypeForParamKind(field.kind)} _${field.name}`)
.join(', ');
};
const kindParams = kind => {
return kind.fields.map(field => `_${field.name}`).join(', ');
};
const solidityTypeForParamKind = paramKind => {
if (paramKind.endsWith('[]')) {
return 'bytes[]';
} else {
return 'bytes';
}
};
const paramsToInstance = kind => {
let line = '';
line += indentLevel(2);
line += `${codecClassName(kind)} memory _instance = ${codecClassName(kind)}(`;
line += kindParams(kind);
line += ');\n';
return line;
};
const addCidConstant = (protobuf, kind, i) => {
const base = 0xc000;
const cidPrefixNumber = base + i;
const bytes = Buffer.from(varint.encode(cidPrefixNumber));
// TODO: per-kind value
protobuf.file += `${indentLevel(1)}bytes6 constant cidPrefix${
kind.name
} = 0x01${bytes.toString('hex')}1b20;\n`;
};
const addFunctionHashKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function hash${kind.name}(${codecClassName(
kind
)} memory _instance)`;
protobuf.file += ` public view returns (bytes32) {\n`;
protobuf.file += `${indentLevel(2)}bytes memory enc = ${codecName(
kind
)}.encode(_instance);\n`;
protobuf.file += `${indentLevel(2)}bytes32 hash = keccak256(enc);\n`;
protobuf.file += '\n';
protobuf.file += `${indentLevel(2)}return hash;\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionCalculateHashKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function calculateHash${kind.name}(`;
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') public view returns (bytes32) {\n';
protobuf.file += paramsToInstance(kind);
protobuf.file += `${indentLevel(2)}return hash${kind.name}(_instance);\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionCalculateCidKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function calculateCid${kind.name}(`;
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') public view returns (bytes _cid) {\n';
protobuf.file += paramsToInstance(kind);
protobuf.file += `${indentLevel(2)}bytes32 _hash = hash${
kind.name
}(_instance);\n`;
protobuf.file += `${indentLevel(2)}return cid.wrapInCid(cidPrefix${
kind.name
}, _hash);\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addStorageField = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `mapping (bytes32 => ${kind.name}Codec.${kind.name})`;
protobuf.file += ` private ${storageMapName(kind)};\n`;
};
const addKindStorageDelegateField = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `I${kind.name}Storage public ${storageDelegateName(
kind
)};\n`;
};
const addStoredEvent = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `event ${kind.name}Stored(bytes _cid);\n`;
};
const addFunctionStoreKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function store${kind.name}(`;
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') public returns (bytes) {\n';
protobuf.file += paramsToInstance(kind);
protobuf.file += `${indentLevel(2)}bytes32 hash = hash${
kind.name
}(_instance);\n`;
protobuf.file += '\n';
protobuf.file += `${indentLevel(2)}${storageMapName(
kind
)}[hash] = _instance;\n`;
protobuf.file += '\n';
protobuf.file += `${indentLevel(
2
)}bytes memory _cid = cid.wrapInCid(cidPrefix${kind.name}, hash);\n`;
protobuf.file += `${indentLevel(2)}emit ${kind.name}Stored(_cid);\n`;
protobuf.file += `${indentLevel(2)}return _cid;\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionDelegateStoreKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function store${kind.name}(`;
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') public returns (bytes) {\n';
protobuf.file += `${indentLevel(2)}bytes memory _cid = ${storageDelegateName(
kind
)}.store${kind.name}(${kindParams(kind)});\n`;
protobuf.file += `${indentLevel(2)}emit ${kind.name}Stored(_cid);\n`;
protobuf.file += `${indentLevel(2)}return _cid;\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionInterfaceStoreKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function store${kind.name}(`;
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') public returns (bytes);\n';
};
const addFunctionRetrieveKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function retrieve${kind.name}(bytes _cid)`;
protobuf.file += ' external view returns (';
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') {\n';
protobuf.file += `${indentLevel(2)}bytes32 _hash = cid.unwrapCid(_cid);\n`;
protobuf.file += `${indentLevel(2)}${codecClassName(
kind
)} memory _instance = ${storageMapName(kind)}[_hash];\n`;
protobuf.file += indentLevel(2);
protobuf.file += 'return (';
protobuf.file += kind.fields
.map(field => `_instance.${field.name}`)
.join(', ');
protobuf.file += ');\n';
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionDelegateRetrieveKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function retrieve${kind.name}(bytes _cid)`;
protobuf.file += ' external view returns (';
protobuf.file += kindParamsWithType(kind);
protobuf.file += ') {\n';
protobuf.file += indentLevel(2);
protobuf.file += `return ${storageDelegateName(kind)}.retrieve${
kind.name
}(_cid);\n`;
protobuf.file += `${indentLevel(1)}}\n`;
};
const addFunctionInterfaceRetrieveKind = (protobuf, kind) => {
protobuf.file += indentLevel(1);
protobuf.file += `function retrieve${kind.name}(bytes _cid)`;
protobuf.file += ' external view returns (';
protobuf.file += kindParamsWithType(kind);
protobuf.file += ');\n';
};
const addOntologyStorageContract = (protobuf, grammar) => {
const contractName = 'OntologyStorage';
const addConstructor = (protobuf, grammar) => {
protobuf.file += `${indentLevel(1)}constructor(`;
protobuf.file += 'address[] _storage_delegate_addrs';
protobuf.file += ') {\n';
grammar.kinds.forEach((kind, i) => {
protobuf.file += `${indentLevel(2)}${storageDelegateName(kind)} = I${
kind.name
}Storage(_storage_delegate_addrs[${i}]);\n`;
});
protobuf.file += `${indentLevel(1)}}\n`;
};
const addKindSection = (protobuf, kind) => {
addFunctionDelegateStoreKind(protobuf, kind);
protobuf.file += '\n';
addFunctionDelegateRetrieveKind(protobuf, kind);
protobuf.file += '\n';
};
protobuf.file += `contract ${contractName} is ${grammar.kinds
.map(n => `I${n.name}Storage`)
.join(', ')}{\n`;
grammar.kinds.forEach(kind => addKindStorageDelegateField(protobuf, kind));
protobuf.file += '\n';
grammar.kinds.forEach(kind => addStoredEvent(protobuf, kind));
protobuf.file += '\n';
addConstructor(protobuf, grammar);
protobuf.file += '\n';
grammar.kinds.forEach(kind => addKindSection(protobuf, kind));
protobuf.file += '}\n';
protobuf.file += '\n';
};
const addKindStorageContract = (protobuf, kind, i) => {
const contractName = `${kind.name}Storage`;
protobuf.file += `contract ${contractName} is I${contractName} {\n`;
addStorageField(protobuf, kind);
protobuf.file += '\n';
addCidConstant(protobuf, kind, i);
protobuf.file += '\n';
addStoredEvent(protobuf, kind);
protobuf.file += '\n';
addFunctionStoreKind(protobuf, kind);
protobuf.file += '\n';
addFunctionRetrieveKind(protobuf, kind);
protobuf.file += '\n';
addFunctionHashKind(protobuf, kind);
protobuf.file += '\n';
addFunctionCalculateCidKind(protobuf, kind);
protobuf.file += '}\n';
protobuf.file += '\n';
};
const addKindStorageContracts = (protobuf, grammar) => {
grammar.kinds.forEach((kind, i) => addKindStorageContract(protobuf, kind, i));
};
const addKindStorageInterfaceContract = (protobuf, kind) => {
const contractName = `I${kind.name}Storage`;
protobuf.file += `interface ${contractName} {\n`;
addFunctionInterfaceStoreKind(protobuf, kind);
protobuf.file += '\n';
addFunctionInterfaceRetrieveKind(protobuf, kind);
protobuf.file += '\n';
protobuf.file += '}\n';
protobuf.file += '\n';
};
const addKindStorageInterfaceContracts = (protobuf, grammar) => {
grammar.kinds.forEach(kind =>
addKindStorageInterfaceContract(protobuf, kind)
);
};
module.exports = {
addOntologyStorageContract,
addKindStorageContracts,
addKindStorageInterfaceContracts,
};
|
#!/usr/bin/env bash
################################################
# This script is invoked by a human who:
# - has invoked the setupForWlsAks.sh script
#
# This script removes the secrets and deletes the azure resources created in
# setupForWlsAks.sh.
#
# Script design taken from https://github.com/microsoft/NubesGen.
#
################################################
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
# script cleanup here
}
setup_colors() {
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
NOFORMAT='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
else
NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
fi
}
msg() {
echo >&2 -e "${1-}"
}
setup_colors
read -r -p "Enter disambiguation prefix: " DISAMBIG_PREFIX
read -r -p "Enter owner/reponame (blank for upsteam of current fork): " OWNER_REPONAME
if [ -z "${OWNER_REPONAME}" ] ; then
GH_FLAGS=""
else
GH_FLAGS="--repo ${OWNER_REPONAME}"
fi
SERVICE_PRINCIPAL_NAME=${DISAMBIG_PREFIX}sp
# Execute commands
msg "${GREEN}(1/4) Delete service principal ${SERVICE_PRINCIPAL_NAME}"
SUBSCRIPTION_ID=$(az account show --query id --output tsv --only-show-errors)
SP_OBJECT_ID_ARRAY=$(az ad sp list --display-name ${SERVICE_PRINCIPAL_NAME} --query "[].objectId") || true
# remove whitespace
SP_OBJECT_ID_ARRAY=$(echo ${SP_OBJECT_ID_ARRAY} | xargs) || true
SP_OBJECT_ID_ARRAY=${SP_OBJECT_ID_ARRAY//[/}
SP_OBJECT_ID=${SP_OBJECT_ID_ARRAY//]/}
az ad sp delete --id ${SP_OBJECT_ID} || true
# Check GitHub CLI status
msg "${GREEN}(3/4) Checking GitHub CLI status...${NOFORMAT}"
USE_GITHUB_CLI=false
{
gh auth status && USE_GITHUB_CLI=true && msg "${YELLOW}GitHub CLI is installed and configured!"
} || {
msg "${YELLOW}Cannot use the GitHub CLI. ${GREEN}No worries! ${YELLOW}We'll set up the GitHub secrets manually."
USE_GITHUB_CLI=false
}
msg "${GREEN}(4/4) Removing secrets...${NOFORMAT}"
if $USE_GITHUB_CLI; then
{
msg "${GREEN}Using the GitHub CLI to remove secrets.${NOFORMAT}"
gh ${GH_FLAGS} secret remove AZURE_CREDENTIALS
gh ${GH_FLAGS} secret remove ELK_PSW
gh ${GH_FLAGS} secret remove ELK_URI
gh ${GH_FLAGS} secret remove ELK_USER_NAME
gh ${GH_FLAGS} secret remove GIT_TOKEN
gh ${GH_FLAGS} secret remove OTN_PASSWORD
gh ${GH_FLAGS} secret remove OTN_USERID
gh ${GH_FLAGS} secret remove USER_EMAIL
gh ${GH_FLAGS} secret remove USER_NAME
gh ${GH_FLAGS} secret remove WLS_PSW
} || {
USE_GITHUB_CLI=false
}
fi
if [ $USE_GITHUB_CLI == false ]; then
msg "${NOFORMAT}======================MANUAL REMOVAL======================================"
msg "${GREEN}Using your Web browser to remove secrets..."
msg "${NOFORMAT}Go to the GitHub repository you want to configure."
msg "${NOFORMAT}In the \"settings\", go to the \"secrets\" tab and remove the following secrets:"
msg "(in ${YELLOW}yellow the secret name)"
msg "${YELLOW}\"AZURE_CREDENTIALS\""
msg "${YELLOW}\"ELK_PSW\""
msg "${YELLOW}\"ELK_URI\""
msg "${YELLOW}\"ELK_USER_NAME\""
msg "${YELLOW}\"GIT_TOKEN\""
msg "${YELLOW}\"OTN_PASSWORD\""
msg "${YELLOW}\"OTN_USERID\""
msg "${YELLOW}\"USER_EMAIL\""
msg "${YELLOW}\"USER_NAME\""
msg "${YELLOW}\"WLS_PSW\""
msg "${NOFORMAT}========================================================================"
fi
msg "${GREEN}Secrets removed"
|
<filename>src/main/java/com/dashradar/privatesendanalysis/PathIterator.java
package com.dashradar.privatesendanalysis;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import org.jgrapht.graph.DefaultEdge;
public interface PathIterator {
public void setPsGraph(PsGraph graph);
public void setPathFilter(Predicate<List<DefaultEdge>> pathFilter);
public void setAcceptedCombinationConsumer(Consumer<List<List<DefaultEdge>>> acceptedCombination);
public PathIteratorImpl.RESULT randomCombination(int maxrounds, long timeout);
}
|
package com.pickth.comepennyrenewal.main;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.pickth.comepennyrenewal.R;
import com.pickth.comepennyrenewal.booth.BoothFragment;
import com.pickth.comepennyrenewal.idea.IdeaFragment;
/**
* 메인 어답터
* Created by Kim on 2016-11-11.
*/
public class MainFragmentAdapter extends FragmentPagerAdapter {
final int PAGE_COUNT = 2;
private String tabTitles[] = new String[]{"내 정보", "쿠폰"};
private int switch_Icons[] = {R.drawable.selector_tab_homo, R.drawable.selector_tab_category};
private Fragment[] fragments = new Fragment[]{IdeaFragment.newInstance(), BoothFragment.newInstance()};
public MainFragmentAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragments[position];
}
@Override
public int getCount() {
return PAGE_COUNT;
}
/**
@Override
public CharSequence getPageTitle(int position) {
return tabTitles[position];
}
*/
}
|
class CreateSpeedrunDotComUsers < ActiveRecord::Migration[5.2]
def change
create_table :speedrun_dot_com_users, id: :uuid do |t|
t.belongs_to :user, foreign_key: true, null: false, index: {unique: true}
t.string :srdc_id, null: false, index: {unique: true}
t.string :name, null: false
t.string :url, null: false
t.string :api_key, null: false, index: {unique: true}
t.timestamps
end
end
end
|
<filename>assets/scripts/toggle.js
function toggleClick (event) {
if (!event.classList.contains('active')) {
var toggles = event.parentElement.children
for (var i = toggles.length - 1; i >= 0; i--) {
toggles[i].classList.remove('active');
};
event.classList.add('active');
}
} |
<gh_stars>1-10
import { ISerializable } from '../interface/Storage';
import { FieldSubType, FieldType, IField } from '../interface/Generator';
export class Field implements ISerializable<IField, Field> {
/** The field's name */
name: string;
/** The field's notes */
notes?: string;
/** The field's type */
type: FieldType;
/** The field's subtype */
subtype: FieldSubType | null;
/** The entity id, or the enum list */
value: string | string[];
/** Should be used as a primary key or not */
primary: boolean;
/** Should be used as a unique key or not */
unique: boolean;
/** Should be used as a label or not */
label: boolean;
/** Denotes if the field can be empty or not */
nullable: boolean;
/** Denotes if the field is an array of values */
multiple: boolean;
/** Indicate whether the field is embedded (should be always exposed explicitly) */
embedded: boolean;
/** Indicate whether the field is searchable or not */
searchable: boolean;
/** Indicate whether the field is sortable or not */
sortable: boolean;
/** Indicate whether the field is private (should not be exposed) */
hidden: boolean;
/** Indicate whether the field is for an internal use only (should not be defined by an user) */
internal: boolean;
/** Indicate whether the field is restricted to authorized roles (should only be defined by an admin) */
restricted: boolean;
/** Indicate that this field defines the owner of the entity */
ownership: boolean;
constructor(object?: IField) {
if (object) {
this.fromObject(object);
}
}
public fromObject(object: IField): Field {
this.name = object.name;
this.notes = object.notes || null;
this.type = object.type;
this.subtype = object.subtype;
this.value = object.value;
this.primary = !!(<any>object.primary);
this.unique = !!(<any>object.unique);
this.label = !!(<any>object.label);
this.nullable = !!(<any>object.nullable);
this.multiple = !!(<any>object.multiple);
this.embedded = !!(<any>object.embedded);
this.searchable = !!(<any>object.searchable);
this.sortable = !!(<any>object.sortable);
this.hidden = !!(<any>object.hidden);
this.internal = !!(<any>object.internal);
this.restricted = !!(<any>object.restricted);
this.ownership = !!(<any>object.ownership);
return this;
}
public toObject(): IField {
return {
name: this.name,
notes: this.notes || null,
type: this.type,
subtype: this.subtype,
value: this.type === 'entity' || this.type === 'enum' ? this.value : null,
primary: this.primary,
unique: this.unique,
label: this.label,
nullable: this.nullable,
multiple: this.multiple,
embedded: this.embedded,
searchable: this.searchable,
sortable: this.sortable,
hidden: this.hidden,
internal: this.internal,
restricted: this.restricted,
ownership: this.ownership,
};
}
}
|
/*****************************************************************************
* Licensed to Qualys, Inc. (QUALYS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* QUALYS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
****************************************************************************/
/**
* @file
* @brief IronBee --- Rules module.
*/
#include "ironbee_config_auto.h"
#include "engine_private.h"
#include "rule_engine_private.h"
#include <ironbee/action.h>
#include <ironbee/cfgmap.h>
#include <ironbee/config.h>
#include <ironbee/context.h>
#include <ironbee/core.h>
#include <ironbee/engine.h>
#include <ironbee/flags.h>
#include <ironbee/list.h>
#include <ironbee/lock.h>
#include <ironbee/mm.h>
#include <ironbee/module.h>
#include <ironbee/operator.h>
#include <ironbee/path.h>
#include <ironbee/rule_engine.h>
#include <ironbee/string.h>
#include <ironbee/util.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include <strings.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/stat.h>
#include <sys/types.h>
/* Define the module name as well as a string version of it. */
#define MODULE_NAME rules
#define MODULE_NAME_STR IB_XSTRINGIFY(MODULE_NAME)
/* Declare the public module symbol. */
IB_MODULE_DECLARE();
/* Configuration */
typedef struct {
/* Where to trace rules to. */
const char *trace_path;
/* List of rules being traced. Element: ib_rule_t* */
ib_list_t *trace_rules;
} per_context_t;
/** Initial value for per-context data. */
static per_context_t c_per_context_initial = {
NULL, NULL
};
/**
* Parse rule's operator.
*
* Parses the rule's operator and operand strings (@a operator and @a
* operand), and stores the results in the rule object @a rule.
*
* @param cp IronBee configuration parser
* @param rule Rule object to update
* @param operator_string Operator string
* @param operand Operand string
* @param is_stream Look for stream operator.
*
* @returns Status code
*/
static ib_status_t parse_operator(ib_cfgparser_t *cp,
ib_rule_t *rule,
const char *operator_string,
const char *operand,
bool is_stream)
{
assert(cp != NULL);
assert(rule != NULL);
assert(operator_string != NULL);
ib_status_t rc = IB_OK;
const char *opname = NULL;
const char *cptr = operator_string;
bool invert = false;
ib_rule_operator_inst_t *opinst;
const ib_operator_t *operator = NULL;
ib_operator_inst_t *real_opinst = NULL;
ib_mm_t main_mm = ib_engine_mm_main_get(cp->ib);
/* Leading '!' (invert flag)? */
if (*cptr == '!') {
invert = true;
++cptr;
}
/* Better be an '@' next... */
if ( (*cptr != '@') || (isalpha(*(cptr+1)) == 0) ) {
ib_cfg_log_error(cp, "Invalid rule syntax \"%s\"", operator_string);
return IB_EINVAL;
}
opname = cptr + 1;
/* Acquire operator */
if (is_stream) {
rc = ib_operator_stream_lookup(cp->ib, IB_S2SL(opname), &operator);
}
else {
rc = ib_operator_lookup(cp->ib, IB_S2SL(opname), &operator);
}
if (rc == IB_ENOENT) {
ib_cfg_log_error(cp, "Unknown operator: %s %s", opname, operand);
return IB_EINVAL;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error acquiring operator %s %s: %s",
opname, operand, ib_status_to_string(rc));
return rc;
}
assert(operator != NULL);
/* Allocate instance data. */
opinst = ib_mm_calloc(main_mm, 1, sizeof(*opinst));
if (opinst == NULL) {
return IB_EALLOC;
}
opinst->params = operand;
opinst->invert = invert;
rc = ib_field_create(&(opinst->fparam),
main_mm,
IB_S2SL("param"),
IB_FTYPE_NULSTR,
ib_ftype_nulstr_in(operand));
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error creating operand field %s %s: %s",
opname, operand, ib_status_to_string(rc));
return rc;
}
/* Create the operator instance */
rc = ib_operator_inst_create(
&real_opinst,
main_mm,
cp->cur_ctx,
operator,
ib_rule_required_op_flags(rule),
operand
);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error creating operator instance "
"operator=\"%s\" operand=\"%s\": %s",
opname,
operand == NULL ? "" : operand,
ib_status_to_string(rc));
return rc;
}
opinst->opinst = real_opinst;
/* Set the operator */
rule->opinst = opinst;
return rc;
}
/**
* Rewrite the target string if required
*
* Parses the rule's target field list string @a target_str, looking for
* the '&' tokens at the start of it.
*
* @param[in] cp IronBee configuration parser
* @param[in] target_str Target field name.
* @param[out] rewritten Rewritten string.
* @param[out] rewrites Number of rewrites found in @a target_str.
*
* @returns Status code
*/
#define MAX_TFN_TOKENS 10
static ib_status_t rewrite_target_tokens(ib_cfgparser_t *cp,
const char *target_str,
const char **rewritten,
int *rewrites)
{
char const *ops[MAX_TFN_TOKENS];
const char *cur = target_str;
char *new;
int count = 0;
int n;
int target_len = strlen(target_str) + 1;
/**
* Loop 'til we reach max count
*/
while ( (*cur != '\0') && (count < MAX_TFN_TOKENS) ) {
if (*cur == '&') {
ops[count] = ".count()";
}
else {
break;
}
/* Update the required length */
target_len += strlen(ops[count]) - 1;
++count;
++cur;
}
/* No rewrites? Done */
*rewrites = count;
if (count == 0) {
*rewritten = target_str;
return IB_OK;
}
/**
* Allocate & build the new string
*/
new = ib_mm_alloc(cp->mm, target_len);
if (new == NULL) {
ib_cfg_log_error(cp,
"Failed to duplicate target field string \"%s\".",
target_str);
return IB_EALLOC;
}
/* Add the functions in reverse order */
strcpy(new, target_str+count);
for (n = count-1; n >= 0; --n) {
strcat(new, ops[n] );
}
/* Log our rewrite */
ib_cfg_log_debug3(cp, "Rewrote: \"%s\" -> \"%s\"", target_str, new);
/* Done */
*rewritten = new;
return IB_OK;
}
/**
* Parse a rule's target string.
*
* Parses the rule's target field list string @a target_str, and stores the
* results in the rule object @a rule.
*
* @param[in] cp IronBee configuration parser
* @param[in,out] rule Rule to operate on
* @param[in] target_str Target string to parse
*
* @returns
* - IB_OK if there is one or more targets.
* - IB_EINVAL if not targets are found, including if the string is empty.
* - IB_EALLOC if a memory allocation fails.
*/
static ib_status_t parse_target(ib_cfgparser_t *cp,
ib_rule_t *rule,
const char *target_str)
{
assert(cp != NULL);
assert(cp->ib != NULL);
assert(rule != NULL);
assert(target_str != NULL);
ib_status_t rc;
ib_engine_t *ib = cp->ib;
const char *rewritten_target_str = NULL;
const char *final_target_str; /* Holder for the final target name. */
ib_list_t *tfns_str = NULL; /* Transformations to perform. */
ib_rule_target_t *ib_rule_target;
ib_list_t *tfns;
int rewrites;
ib_mm_t mm = ib_engine_mm_main_get(ib);
/* First, rewrite cur into rewritten_target_str. */
rc = rewrite_target_tokens(cp, target_str,
&rewritten_target_str, &rewrites);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Failed to rewriting target \"%s\".", target_str);
return rc;
}
rc = ib_list_create(&tfns_str, mm);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Cannot allocate transformation list.");
return rc;
}
/* Parse the rewritten string into the final_target_str. */
rc = ib_cfg_parse_target_string(
ib_engine_mm_main_get(cp->ib),
rewritten_target_str,
&final_target_str,
tfns_str);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error parsing target string \"%s\": %s",
target_str, ib_status_to_string(rc));
return rc;
}
rc = ib_list_create(&tfns, mm);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Cannot allocate transformations list.");
return rc;
}
/* Take parsed transformations and build transformation instances. */
rc = ib_rule_tfn_fields_to_inst(ib, mm, tfns_str, tfns);
if (rc != IB_OK) {
return rc;
}
/* Create the target object */
rc = ib_rule_create_target(cp->ib,
final_target_str,
tfns,
&ib_rule_target);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error creating rule target \"%s\": %s",
final_target_str, ib_status_to_string(rc));
return rc;
}
/* Add the target to the rule */
rc = ib_rule_add_target(cp->ib, rule, ib_rule_target);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Failed to add rule target \"%s\"", target_str);
return rc;
}
return IB_OK;
}
/**
* Attempt to register a string as an action.
*
* Treats the rule's modifier string @a name as a action, and registers
* the appropriate action with @a rule.
*
* @param[in] cp IronBee configuration parser
* @param[in,out] rule Rule to operate on
* @param[in] name Action name
* @param[in] params Parameters string
*
* @returns Status code
*/
static ib_status_t register_action_modifier(ib_cfgparser_t *cp,
ib_rule_t *rule,
const char *name,
const char *params)
{
ib_status_t rc = IB_OK;
const ib_action_t *action;
ib_action_inst_t *action_inst;
ib_rule_action_t atype = IB_RULE_ACTION_TRUE;
/* Select the action type */
switch (*name) {
case '!':
atype = IB_RULE_ACTION_FALSE;
++name;
break;
case '+':
atype = IB_RULE_ACTION_AUX;
++name;
break;
default:
atype = IB_RULE_ACTION_TRUE;
}
/* Create a new action instance */
rc = ib_action_lookup(cp->ib, IB_S2SL(name), &action);
if (rc == IB_ENOENT) {
ib_cfg_log_notice(cp, "Ignoring unknown modifier \"%s\"", name);
return IB_OK;
}
rc = ib_action_inst_create(
&action_inst,
ib_engine_mm_main_get(cp->ib),
cp->cur_ctx,
action,
params
);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error creating action instance \"%s\": %s",
name, ib_status_to_string(rc));
return rc;
}
/* Check the parameters */
rc = ib_rule_check_params(cp->ib, rule, params);
if (rc != IB_OK) {
ib_log_error(cp->ib,
"Error checking action \"%s\" parameter \"%s\": %s",
ib_action_name(action),
params == NULL ? "" : params,
ib_status_to_string(rc));
return rc;
}
/* Add the action to the rule */
rc = ib_rule_add_action(cp->ib, rule, action_inst, atype);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error adding action \"%s\" to rule \"%s\": %s",
name, ib_rule_id(rule), ib_status_to_string(rc));
return rc;
}
return IB_OK;
}
/**
* Check that a rule has all the proper modifiers.
*
* @param[in] cp The configuration parser
* @param[in] rule The rule to check
*
* @returns IB_EINVAL.
*/
static ib_status_t check_rule_has_id(ib_cfgparser_t *cp,
ib_rule_t *rule)
{
if ( ! ib_rule_is_chained(rule) && ib_rule_id(rule) == NULL) {
ib_cfg_log_error(cp, "No rule id specified (flags=0x%04"PRIx64")",
rule->flags);
return IB_EINVAL;
}
return IB_OK;
}
/**
* Parse a rule's modifier string.
*
* Parses the rule's modifier string @a modifier_str, and stores the results
* in the rule object @a rule.
*
* @param[in] cp IronBee configuration parser
* @param[in,out] rule Rule to operate on
* @param[in] modifier_str Modifier string
*
* @returns Status code
*/
static ib_status_t parse_modifier(ib_cfgparser_t *cp,
ib_rule_t *rule,
const char *modifier_str)
{
ib_status_t rc = IB_OK;
const char *name;
char *colon;
char *copy;
const char *value = NULL;
assert(cp != NULL);
assert(rule != NULL);
assert(modifier_str != NULL);
/* Copy the string */
copy = ib_mm_strdup(ib_rule_mm(cp->ib), modifier_str);
if (copy == NULL) {
ib_cfg_log_error(cp,
"Failed to copy rule modifier \"%s\".", modifier_str);
return IB_EALLOC;
}
/* Modifier name */
name = copy;
colon = strchr(copy, ':');
if ( (colon != NULL) && ( *(colon+1) != '\0' ) ) {
*colon = '\0';
value = colon + 1;
while( isspace(*value) ) {
++value;
}
if (*value == '\0') {
value = NULL;
}
}
/* ID modifier */
if (strcasecmp(name, "id") == 0) {
if (value == NULL) {
ib_cfg_log_error(cp, "Modifier ID with no value.");
return IB_EINVAL;
}
rc = ib_rule_set_id(cp->ib, rule, value);
return rc;
}
/* Message modifier */
if ( (strcasecmp(name, "msg") == 0) ||
(strcasecmp(name, "logdata") == 0) )
{
bool is_msg = toupper(*name) == 'M';
/* Check the parameter */
rc = ib_rule_check_params(cp->ib, rule, value);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error checking %s parameter value \"%s\": %s",
name,
value == NULL ? "" : value,
ib_status_to_string(rc));
return rc;
}
rc = ib_var_expand_acquire(
(is_msg ? &(rule->meta.msg) : &(rule->meta.data)),
ib_rule_mm(cp->ib),
IB_S2SL(value == NULL ? "" : value),
ib_engine_var_config_get(cp->ib)
);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error creating %s expansion value \"%s\": %s",
name,
value == NULL ? "" : value,
ib_status_to_string(rc)
);
return rc;
}
return IB_OK;
}
/* Tag modifier */
if (strcasecmp(name, "tag") == 0) {
rc = ib_list_push(rule->meta.tags, (void *)value);
return rc;
}
/* Severity modifier */
if (strcasecmp(name, "severity") == 0) {
int severity = value ? atoi(value) : 0;
if (severity > UINT8_MAX) {
ib_cfg_log_error(cp, "Invalid severity: %s", value);
return IB_EINVAL;
}
rule->meta.severity = (uint8_t)severity;
return IB_OK;
}
/* Confidence modifier */
if (strcasecmp(name, "confidence") == 0) {
int confidence = value ? atoi(value) : 0;
if (confidence > UINT8_MAX) {
ib_cfg_log_error(cp, "Invalid confidence: %s", value);
return IB_EINVAL;
}
rule->meta.confidence = (uint8_t)confidence;
return IB_OK;
}
/* Revision modifier */
if (strcasecmp(name, "rev") == 0) {
int rev = value ? atoi(value) : 0;
if ( (rev < 0) || (rev > UINT16_MAX) ) {
ib_cfg_log_error(cp, "Invalid revision: %s", value);
return IB_EINVAL;
}
rule->meta.revision = (uint16_t)rev;
return IB_OK;
}
/* Phase modifiers (Not valid for stream rules) */
if (! ib_rule_is_stream(rule)) {
ib_rule_phase_num_t phase = IB_PHASE_NONE;
if (strcasecmp(name, "phase") == 0) {
if (value == NULL) {
ib_cfg_log_error(cp, "Modifier PHASE with no value.");
return IB_EINVAL;
}
phase = ib_rule_lookup_phase(value, false);
if (phase == IB_PHASE_INVALID) {
ib_cfg_log_error(cp, "Invalid phase: %s", value);
return IB_EINVAL;
}
}
else {
ib_rule_phase_num_t tphase;
tphase = ib_rule_lookup_phase(name, false);
if (tphase != IB_PHASE_INVALID) {
phase = tphase;
}
}
/* If we encountered a phase modifier, set it */
if (phase != IB_PHASE_NONE && phase != IB_PHASE_INVALID) {
rc = ib_rule_set_phase(cp->ib, rule, phase);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error setting rule phase: %s",
ib_status_to_string(rc));
return rc;
}
return IB_OK;
}
/* Not a phase modifier, so don't return */
}
/* Chain modifier */
if ( (ib_rule_allow_chain(rule)) &&
(strcasecmp(name, "chain") == 0) )
{
rc = ib_rule_set_chain(cp->ib, rule);
return rc;
}
/* Capture modifier */
if (strcasecmp(name, "capture") == 0) {
rc = ib_rule_set_capture(cp->ib, rule, value);
if (rc == IB_ENOTIMPL) {
ib_cfg_log_error(cp, "Capture not supported by operator %s.",
ib_operator_name(
ib_operator_inst_operator(
rule->opinst->opinst)));
return IB_EINVAL;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error enabling capture: %s",
ib_status_to_string(rc));
return rc;
}
return IB_OK;
}
/* Finally, try to match it to an action */
rc = register_action_modifier(cp, rule, name, value);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering action \"%s\": %s",
name, ib_status_to_string(rc));
return rc;
}
return rc;
}
/**
* Parse a RuleExt directive.
*
* Register lua function. RuleExt lua:/path/to/rule.lua phase:REQUEST
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @a name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_ruleext_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
ib_status_t rc;
const ib_list_node_t *targets;
const ib_list_node_t *mod;
ib_rule_t *rule;
const char *file_name;
const char *colon;
const char *tag;
const char *location;
/* Get the targets string */
targets = ib_list_first_const(vars);
file_name = (const char *)ib_list_node_data_const(targets);
if ( file_name == NULL ) {
ib_cfg_log_error(cp, "No targets for rule.");
return IB_EINVAL;
}
ib_cfg_log_debug3(cp, "Processing external rule: %s", file_name);
/* Allocate a rule */
rc = ib_rule_create(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
false, &rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error creating rule: %s",
ib_status_to_string(rc));
return rc;
}
ib_flags_set(rule->flags, (IB_RULE_FLAG_EXTERNAL | IB_RULE_FLAG_NO_TGT));
/* Parse all of the modifiers */
mod = targets;
while( (mod = ib_list_node_next_const(mod)) != NULL) {
rc = parse_modifier(cp, rule, mod->data);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing external rule modifier \"%s\": %s",
(const char *)mod->data,
ib_status_to_string(rc)
);
return rc;
}
}
/* Check the rule modifiers. */
rc = check_rule_has_id(cp, rule);
if (rc != IB_OK) {
return rc;
}
/* Using the rule->meta and file_name, load and stage the ext rule. */
ib_rule_driver_t *driver;
colon = strchr(file_name, ':');
if (colon == NULL) {
ib_cfg_log_error(cp,
"Error parsing external rule location %s: No colon found.",
file_name
);
return IB_EINVAL;
}
tag = ib_mm_memdup_to_str(cp->mm, file_name, colon - file_name);
if (tag == NULL) {
return IB_EALLOC;
}
location = ib_util_relative_file(cp->mm, cp->curr->file, colon + 1);
if (location == NULL) {
return IB_EALLOC;
}
rc = ib_rule_lookup_external_driver(cp->ib, tag, &driver);
if (rc != IB_ENOENT) {
rc = driver->function(cp, rule, tag, location, driver->cbdata);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error in external rule driver for \"%s\": %s",
tag, ib_status_to_string(rc)
);
return rc;
}
}
else {
ib_cfg_log_error(cp, "No external rule driver for \"%s\"", tag);
return IB_EINVAL;
}
/* Finally, register the rule */
rc = ib_rule_register(cp->ib, cp->cur_ctx, rule);
if (rc == IB_EEXIST) {
ib_cfg_log_warning(cp, "Not overwriting existing rule");
return IB_OK;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering rule: %s",
ib_status_to_string(rc));
return rc;
}
/* Disable the entire chain if this rule is invalid */
if ( (rule->flags & IB_RULE_FLAG_VALID) == 0) {
rc = ib_rule_chain_invalidate(cp->ib, cp->cur_ctx, rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error invalidating rule chain: %s",
ib_status_to_string(rc));
return rc;
}
}
ib_cfg_log_debug(cp,
"Registered external rule \"%s\" for "
"phase \"%s\" context \"%s\"",
ib_rule_id(rule),
ib_rule_phase_name(rule->meta.phase),
ib_context_full_get(cp->cur_ctx));
/* Done */
return IB_OK;
}
/**
* Parse a Rule directive.
*
* Register a Rule directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @a name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_rule_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
ib_status_t rc;
const ib_list_node_t *node;
const char *nodestr;
const char *operator;
const char *operand;
ib_rule_t *rule = NULL;
int targets = 0;
if (cbdata != NULL) {
}
/* Allocate a rule */
rc = ib_rule_create(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
false, &rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Failed to allocate rule: %s",
ib_status_to_string(rc));
goto cleanup;
}
/* Loop through the targets, stop when we encounter an operator */
IB_LIST_LOOP_CONST(vars, node) {
if (node->data == NULL) {
ib_cfg_log_error(cp, "Found invalid rule target");
rc = IB_EINVAL;
goto cleanup;
}
nodestr = (const char *)node->data;
if ( (*nodestr == '@') ||
((*nodestr != '\0') && (*(nodestr+1) == '@')) )
{
break;
}
rc = parse_target(cp, rule, nodestr);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing rule target \"%s\": %s",
nodestr, ib_status_to_string(rc));
goto cleanup;
}
++targets;
}
/* No targets??? */
if (targets == 0) {
ib_cfg_log_error(cp, "No rule targets found");
rc = IB_EINVAL;
goto cleanup;
}
/* Verify that we have an operator and operand */
if ( (node == NULL) || (node-> data == NULL) ) {
ib_cfg_log_error(cp, "No rule operator found");
rc = IB_EINVAL;
goto cleanup;
}
operator = (const char *)node->data;
node = ib_list_node_next_const(node);
if ( (node == NULL) || (node-> data == NULL) ) {
ib_cfg_log_error(cp, "No rule operand found");
rc = IB_EINVAL;
goto cleanup;
}
operand = (const char *)node->data;
/* Parse the operator */
rc = parse_operator(cp, rule, operator, operand, false);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error parsing rule operator \"%s\": %s",
operator, ib_status_to_string(rc));
goto cleanup;
}
/* Parse all of the modifiers */
while( (node = ib_list_node_next_const(node)) != NULL) {
if (node->data == NULL) {
ib_cfg_log_error(cp, "Found invalid rule modifier");
rc = IB_EINVAL;
goto cleanup;
}
nodestr = (const char *)node->data;
rc = parse_modifier(cp, rule, nodestr);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error parsing rule modifier \"%s\": %s",
nodestr, ib_status_to_string(rc));
goto cleanup;
}
}
/* Check the rule modifiers. */
rc = check_rule_has_id(cp, rule);
if (rc != IB_OK) {
return rc;
}
/* Finally, register the rule */
rc = ib_rule_register(cp->ib, cp->cur_ctx, rule);
if (rc == IB_EEXIST) {
ib_cfg_log_warning(cp, "Not overwriting existing rule");
rc = IB_OK;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering rule: %s",
ib_status_to_string(rc));
goto cleanup;
}
/* Disable the entire chain if this rule is invalid */
cleanup:
if ((rule != NULL) && ((rule->flags & IB_RULE_FLAG_VALID) == 0)) {
ib_status_t irc = ib_rule_chain_invalidate(cp->ib, cp->cur_ctx, rule);
if (irc != IB_OK) {
ib_cfg_log_error(cp, "Error invalidating rule chain: %s",
ib_status_to_string(irc));
return rc;
}
else {
const char *chain = \
rule->meta.chain_id == NULL ? "UNKNOWN" : rule->meta.chain_id;
ib_cfg_log_debug2(cp,
"Invalidated all rules in chain \"%s\"",
chain);
}
}
/* Done */
return rc;
}
/**
* Parse a StreamInspect directive.
*
* Register the StreamInspect directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @a name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_streaminspect_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
ib_status_t rc;
const ib_list_node_t *node;
ib_rule_phase_num_t phase = IB_PHASE_INVALID;
const char *str;
const char *operator;
const char *operand;
ib_rule_t *rule;
/* Get the phase string */
node = ib_list_first_const(vars);
if ( (node == NULL) || (node->data == NULL) ) {
ib_cfg_log_error(cp, "No stream for StreamInspect");
return IB_EINVAL;
}
str = node->data;
/* Lookup the phase name */
phase = ib_rule_lookup_phase(str, true);
if (phase == IB_PHASE_INVALID) {
ib_cfg_log_error(cp, "Invalid phase: %s", str);
return IB_EINVAL;
}
/* Get the operator string */
node = ib_list_node_next_const(node);
if ( (node == NULL) || (node->data == NULL) ) {
ib_cfg_log_error(cp, "No operator for rule");
return IB_EINVAL;
}
operator = (const char *)node->data;
/* Allocate a rule */
rc = ib_rule_create(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
true, &rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Failed to create rule: %s",
ib_status_to_string(rc));
return rc;
}
ib_flags_set(rule->flags, IB_RULE_FLAG_NO_TGT);
/* Set the rule's stream */
rc = ib_rule_set_phase(cp->ib, rule, phase);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error setting rule phase: %s",
ib_status_to_string(rc));
return rc;
}
/* Verify that we have an operand */
node = ib_list_node_next_const(node);
if ( (node == NULL) || (node-> data == NULL) ) {
ib_cfg_log_error(cp, "No rule operand found");
return rc;
}
operand = (const char *)node->data;
/* Parse the operator */
rc = parse_operator(cp, rule, operator, operand, true);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing rule operator \"%s\": %s",
operator, ib_status_to_string(rc));
return rc;
}
/* Parse all of the modifiers */
while( (node = ib_list_node_next_const(node)) != NULL) {
rc = parse_modifier(cp, rule, node->data);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing stream rule modifier \"%s\": %s",
(const char *)node->data,
ib_status_to_string(rc));
return rc;
}
}
/* Finally, register the rule */
rc = ib_rule_register(cp->ib, cp->cur_ctx, rule);
if (rc == IB_EEXIST) {
ib_cfg_log_warning(cp, "Not overwriting existing rule.");
return IB_OK;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering rule: %s",
ib_status_to_string(rc));
return rc;
}
/* Done */
return IB_OK;
}
/**
* Parse a RuleEnable directive.
*
* Handle the RuleEnable directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @c name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_ruleenable_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
const ib_list_node_t *node;
ib_status_t rc = IB_OK;
if (cbdata != NULL) {
}
/* Loop through all of the parameters in the list */
IB_LIST_LOOP_CONST(vars, node) {
const char *param = (const char *)node->data;
if (strcasecmp(param, "all") == 0) {
rc = ib_rule_enable_all(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line);
}
else if (strncasecmp(param, "id:", 3) == 0) {
const char *id = param + 3;
rc = ib_rule_enable_id(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
id);
}
else if (strncasecmp(param, "tag:", 4) == 0) {
const char *tag = param + 4;
rc = ib_rule_enable_tag(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
tag);
}
else {
ib_cfg_log_error(cp, "Invalid %s parameter \"%s\"", name, param);
rc = IB_EINVAL;
continue;
}
}
/* Done */
return rc;
}
/**
* Parse a RuleDisable directive.
*
* Handle the RuleDisable directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @c name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_ruledisable_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
const ib_list_node_t *node;
ib_status_t rc = IB_OK;
if (cbdata != NULL) {
}
/* Loop through all of the parameters in the list */
IB_LIST_LOOP_CONST(vars, node) {
const char *param = (const char *)node->data;
if (strcasecmp(param, "all") == 0) {
rc = ib_rule_disable_all(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line);
}
else if (strncasecmp(param, "id:", 3) == 0) {
const char *id = param + 3;
rc = ib_rule_disable_id(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
id);
}
else if (strncasecmp(param, "tag:", 4) == 0) {
const char *tag = param + 4;
rc = ib_rule_disable_tag(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
tag);
}
else {
ib_cfg_log_error(cp, "Invalid %s parameter \"%s\"", name, param);
rc = IB_EINVAL;
continue;
}
}
/* Done */
return rc;
}
/**
* Parse a RuleMarker directive.
*
* Register a RuleMarker directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @a name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_rulemarker_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
ib_status_t rc;
const ib_list_node_t *node;
ib_rule_t *rule = NULL;
if (cbdata != NULL) {
}
/* Allocate a rule */
rc = ib_rule_create(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
false, &rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error allocating rule: %s",
ib_status_to_string(rc));
return rc;
}
ib_flags_set(rule->flags, IB_RULE_FLAG_ACTION);
/* Force the operator to one that will not execute (negated nop). */
rc = parse_operator(cp, rule, "!@nop", NULL, false);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing rule operator \"nop\": %s",
ib_status_to_string(rc));
return rc;
}
/* Parse all of the modifiers, only allowing id and phase. */
IB_LIST_LOOP_CONST(vars, node) {
const char *param = (const char *)node->data;
if ( (strncasecmp(param, "id:", 3) == 0)
|| (strncasecmp(param, "phase:", 6) == 0))
{
rc = parse_modifier(cp, rule, node->data);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing %s modifier \"%s\": %s",
name,
(const char *)node->data,
ib_status_to_string(rc));
return rc;
}
}
else {
ib_cfg_log_error(cp, "Invalid %s parameter \"%s\"", name, param);
return IB_EINVAL;
}
}
/* Force a zero revision so it can always be overridden. */
rc = parse_modifier(cp, rule, "rev:0");
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing %s modifier \"rev:0\": %s",
name,
ib_status_to_string(rc));
return rc;
}
/* Check the rule modifiers. */
rc = check_rule_has_id(cp, rule);
if (rc != IB_OK) {
return rc;
}
/* Finally, register the rule. */
rc = ib_rule_register(cp->ib, cp->cur_ctx, rule);
if (rc == IB_EEXIST) {
ib_cfg_log_notice(cp, "Not overwriting existing rule.");
rc = IB_OK;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering rule marker: %s",
ib_status_to_string(rc));
}
return rc;
}
/**
* Parse an Action directive.
*
* Register an Action directive to the engine.
*
* @param[in,out] cp Configuration parser that contains the engine being
* configured.
* @param[in] name The directive name.
* @param[in] vars The list of variables passed to @a name.
* @param[in] cbdata User data. Unused.
*/
static ib_status_t parse_action_params(ib_cfgparser_t *cp,
const char *name,
const ib_list_t *vars,
void *cbdata)
{
ib_status_t rc;
const ib_list_node_t *node;
ib_rule_t *rule = NULL;
if (cbdata != NULL) {
}
/* Allocate a rule */
rc = ib_rule_create(cp->ib, cp->cur_ctx,
cp->curr->file, cp->curr->line,
false, &rule);
if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error allocating rule: %s",
ib_status_to_string(rc));
goto cleanup;
}
ib_flags_set(rule->flags, IB_RULE_FLAG_ACTION);
/* Parse the operator */
rc = parse_operator(cp, rule, "@nop", NULL, false);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing rule operator \"nop\": %s",
ib_status_to_string(rc));
goto cleanup;
}
/* Parse all of the modifiers */
IB_LIST_LOOP_CONST(vars, node) {
rc = parse_modifier(cp, rule, node->data);
if (rc != IB_OK) {
ib_cfg_log_error(cp,
"Error parsing action modifier \"%s\": %s",
(const char *)node->data,
ib_status_to_string(rc));
goto cleanup;
}
}
/* Check the rule modifiers. */
rc = check_rule_has_id(cp, rule);
if (rc != IB_OK) {
return rc;
}
/* Finally, register the rule */
rc = ib_rule_register(cp->ib, cp->cur_ctx, rule);
if (rc == IB_EEXIST) {
ib_cfg_log_warning(cp, "Not overwriting existing rule.");
rc = IB_OK;
}
else if (rc != IB_OK) {
ib_cfg_log_error(cp, "Error registering rule: %s",
ib_status_to_string(rc));
goto cleanup;
}
/* Disable the entire chain if this rule is invalid */
cleanup:
if ((rule != NULL) && ((rule->flags & IB_RULE_FLAG_VALID) == 0)) {
ib_status_t irc = ib_rule_chain_invalidate(cp->ib, cp->cur_ctx, rule);
if (irc != IB_OK) {
ib_cfg_log_error(cp, "Error invalidating rule chain: %s",
ib_status_to_string(irc));
return rc;
}
else {
const char *chain = \
rule->meta.chain_id == NULL ? "UNKNOWN" : rule->meta.chain_id;
ib_cfg_log_debug2(cp,
"Invalidated all rules in chain \"%s\".",
chain);
}
}
/* Done */
return rc;
}
/* ifdef is because only rule tracing code currently uses this method. Remove
* ifdef if used outside of rule tracing. */
#ifdef IB_RULE_TRACE
/**
* Fetch per-context configuration for @a ctx.
*
* @param[in] ctx Context to fetch configuration for.
* @return Fetch configuration.
**/
static
per_context_t *fetch_per_context(ib_context_t *ctx)
{
assert(ctx != NULL);
ib_status_t rc;
per_context_t *per_context = NULL;
ib_module_t *module = NULL;
rc = ib_engine_module_get(
ib_context_get_engine(ctx),
MODULE_NAME_STR,
&module
);
assert(rc == IB_OK);
rc = ib_context_module_config(ctx, module, &per_context);
assert(rc == IB_OK);
return per_context;
}
#endif
/**
* Parse RuleTrace directive.
*
* Outputs warning if IB_RULE_TRACE not defined.
*
* @param[in] cp Configuration parser.
* @param[in] name Name of directive.
* @param[in] rule_id Parameter; ID of rule to trace.
* @param[in] cbdata Callback data; Unused.
* @returns IB_OK on success; IB_E* on error.
**/
static
ib_status_t parse_ruletrace_params(
ib_cfgparser_t *cp,
const char *name,
const char *rule_id,
void *cbdata
)
{
assert(cp != NULL);
assert(rule_id != NULL);
#ifdef IB_RULE_TRACE
ib_mm_t mm = ib_engine_mm_main_get(cp->ib);
ib_status_t rc;
ib_rule_t *rule;
per_context_t *per_context = fetch_per_context(cp->cur_ctx);
rc = ib_rule_lookup(cp->ib, cp->cur_ctx, rule_id, &rule);
if (rc == IB_ENOENT) {
ib_cfg_log_error(
cp,
"RuleTrace could not find rule with id: %s",
rule_id
);
return IB_ENOENT;
}
else if (rc != IB_OK) {
ib_cfg_log_error(
cp,
"RuleTrace experienced unexpected error looking up rule: %s (%s)",
rule_id, ib_status_to_string(rc)
);
return rc;
}
ib_flags_set(rule->flags, IB_RULE_FLAG_TRACE);
if (per_context->trace_rules == NULL) {
rc = ib_list_create(&per_context->trace_rules, mm);
if (rc != IB_OK) {
ib_cfg_log_error(
cp,
"RuleTrace could not create traced rules list: %s (%s)",
rule_id, ib_status_to_string(rc)
);
return rc;
}
}
rc = ib_list_push(per_context->trace_rules, rule);
if (rc != IB_OK) {
ib_cfg_log_error(
cp,
"RuleTrace could not pushed traced rules: %s (%s)",
rule_id, ib_status_to_string(rc)
);
return rc;
}
return IB_OK;
#else
ib_cfg_log_warning(
cp,
"IronBee compiled without rule tracing. "
"RuleTrace will have no effect."
);
return IB_OK;
#endif
}
/**
* Parse RuleTraceFile directive.
*
* Outputs warning if IB_RULE_TRACE not defined.
*
* @param[in] cp Configuration parser.
* @param[in] name Name of directive.
* @param[in] path Path to write traces to.
* @param[in] cbdata Callback data; Unused.
* @returns IB_OK on success; IB_E* on error.
**/
static
ib_status_t parse_ruletracefile_params(
ib_cfgparser_t *cp,
const char *name,
const char *path,
void *cbdata
)
{
#ifdef IB_RULE_TRACE
per_context_t *per_context = fetch_per_context(cp->cur_ctx);
per_context->trace_path = path;
return IB_OK;
#else
ib_cfg_log_warning(
cp,
"IronBee compiled without rule tracing. "
"RuleTraceFile will have no effect."
);
return IB_OK;
#endif
}
/**
* Handle postprocessing.
*
* Does nothing unless IB_RULE_TRACE is defined, in which case, outputs
* traces.
*
* @param[in] ib IronBee engine.
* @param[in] tx Transaction.
* @param[in] state State.
* @param[in] cbdata Callback data; unused.
* @returns IB_OK on success; IB_EOTHER on file system failure.
**/
static
ib_status_t postprocess(
ib_engine_t *ib,
ib_tx_t *tx,
ib_state_t state,
void *cbdata
)
{
assert(ib != NULL);
assert(tx != NULL);
#ifdef IB_RULE_TRACE
per_context_t *per_context = fetch_per_context(tx->ctx);
if (per_context->trace_rules != NULL) {
ib_list_node_t *node;
FILE *trace_fp = stderr;
if (per_context->trace_path) {
trace_fp = fopen(per_context->trace_path, "a");
if (trace_fp == NULL) {
ib_log_error_tx(
tx,
"Failed to open trace file: %s",
per_context->trace_path
);
return IB_EOTHER;
}
}
IB_LIST_LOOP(per_context->trace_rules, node) {
const ib_rule_t *rule =
(const ib_rule_t *)ib_list_node_data_const(node);
fprintf(trace_fp, "%s,%d,%s,%d,%s,%s,%zd,%" PRIu64 "\n",
tx->conn->local_ipstr, tx->conn->local_port,
tx->conn->remote_ipstr, tx->conn->remote_port,
tx->id,
rule->meta.full_id,
tx->rule_exec->traces[rule->meta.index].evaluation_n,
tx->rule_exec->traces[rule->meta.index].evaluation_time
);
}
}
#endif
return IB_OK;
}
/**
* Initialize module.
*
* @param[in] ib IronBee engine.
* @param[in] m Module.
* @param[in] cbdata Callback data; unused.
* @returns IB_OK
**/
static
ib_status_t rules_init(
ib_engine_t *ib,
ib_module_t *m,
void *cbdata
)
{
assert(ib != NULL);
ib_hook_tx_register(
ib,
handle_postprocess_state,
postprocess, NULL
);
return IB_OK;
}
static IB_DIRMAP_INIT_STRUCTURE(rules_directive_map) = {
/* Give the config parser a callback for the Rule and RuleExt directive */
IB_DIRMAP_INIT_LIST(
"Rule",
parse_rule_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"RuleExt",
parse_ruleext_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"RuleMarker",
parse_rulemarker_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"StreamInspect",
parse_streaminspect_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"RuleEnable",
parse_ruleenable_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"RuleDisable",
parse_ruledisable_params,
NULL
),
IB_DIRMAP_INIT_LIST(
"Action",
parse_action_params,
NULL
),
IB_DIRMAP_INIT_PARAM1(
"RuleTrace",
parse_ruletrace_params,
NULL
),
IB_DIRMAP_INIT_PARAM1(
"RuleTraceFile",
parse_ruletracefile_params,
NULL
),
/* signal the end of the list */
IB_DIRMAP_INIT_LAST
};
/* Initialize the module structure. */
IB_MODULE_INIT(
IB_MODULE_HEADER_DEFAULTS, /* Default metadata */
MODULE_NAME_STR, /* Module name */
IB_MODULE_CONFIG(&c_per_context_initial), /* Global config data */
NULL, /* Configuration field map */
rules_directive_map, /* Config directive map */
rules_init, /* Initialize function */
NULL, /* Callback data */
NULL, /* Finish function */
NULL, /* Callback data */
);
|
<filename>0765-Couples Holding Hands/cpp_0765/Solution2.h
/**
* @author ooooo
* @date 2021/2/14 09:43
*/
#ifndef CPP_0765__SOLUTION2_H_
#define CPP_0765__SOLUTION2_H_
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
class UF {
public:
vector<int> p;
int n;
UF(int n) : n(n), p(n) {
for (int i = 0; i < n; ++i) {
p[i] = i;
}
}
int find(int i) {
if (p[i] == i) return i;
return p[i] = find(p[i]);
}
bool connect(int i, int j) {
int pi = find(i), pj = find(j);
if (pi == pj) return true;
p[pi] = pj;
n--;
return false;
}
};
int minSwapsCouples(vector<int> &row) {
int n = row.size();
UF uf(n / 2);
for (int i = 0; i < n; i += 2) {
uf.connect(row[i] / 2, row[i + 1] / 2);
}
return n / 2 - uf.n;
}
};
#endif //CPP_0765__SOLUTION2_H_
|
'use strict';
const express = require('express');
const jwt = require("jsonwebtoken");
const moment = require("moment");
const path = require("path");
const config = require(path.join('..', '..', 'config.js'));
const tokenLib = require(__dirname + '/token.js');
const app = express();
module.exports = app;
app.post('/', (req, res, next) => {
if (!req.body.username) {
res.status(400).json({ error: 'Username is required' });
next();
return;
}
if (!req.body.password) {
res.status(400).json({ error: 'Password is required' });
next();
return;
}
if (!(req.body.username === 'dataphi' && req.body.password === '<PASSWORD>')) {
res.status(401).json({
'error': 'Invalid credentials'
});
return;
}
tokenLib.getContent(req.body.username, (err, tokenContent) => {
if (err) {
console.trace(err);
res.status(400).send(err);
return;
}
/**
* Sign token with the secret
* anf options defined in config file
*/
var token = jwt.sign(tokenContent, config.jwt.secret, config.jwt.options);
// Send Token
res.status(200).json({
access_token: token,
token_type: "bearer",
expires_in: config.jwt.options.expiresIn || 3600,
expires_at: moment().add(config.jwt.options.expiresIn || 3600, 'seconds').format('x')
});
});
});
|
from server.base import BaseHandler
class Meta(BaseHandler):
async def get(self, version: str, zone_id: str = None):
if version not in self.application.db.keys():
self.error(404, "not found version meta.")
return
result = {
"version": int(version),
}
if zone_id:
for zone in self.application.db[version]["zones"]:
if str(zone["zone_id"]) == zone_id:
result["data"] = zone
break
else:
result["data"] = self.application.db[version]
self.succ(result)
|
<reponame>micleb/m1-aco-tp2
package fr.istic.m1.aco.miniediteur.v3.invoker;
import java.util.Map;
import fr.istic.m1.aco.miniediteur.v3.command.Command;
import fr.istic.m1.aco.miniediteur.v3.command.CommandEnum;
import fr.istic.m1.aco.miniediteur.v3.memento.CommandsHistoric;
import fr.istic.m1.aco.miniediteur.v3.receiver.Enregistreur;
import fr.istic.m1.aco.miniediteur.v3.receiver.EnregistreurImpl;
import fr.istic.m1.aco.miniediteur.v3.receiver.Moteur;
import fr.istic.m1.aco.miniediteur.v3.receiver.Selection;
public class ControllerImpl implements Controller{
private Moteur m;
private CommandsHistoric historic;
private Enregistreur recorder;
private Map<CommandEnum, Command> cmdRetriever;
public ControllerImpl(Moteur m, Map<CommandEnum, Command> cmdsMap, Enregistreur recorder, CommandsHistoric historic) {
this.m = m;
this.historic = historic;
this.recorder = recorder;
recorder = new EnregistreurImpl();
this.cmdRetriever = cmdsMap;
}
@Override
public Selection getSelection() {
return m.getCurrentSelection();
}
@Override
public String getBuffer() {
return m.getContent();
}
@Override
public String getClipboard() {
return m.getPresspapierContent();
}
@Override
public void execute(CommandEnum command) {
Command cmd = this.cmdRetriever.get(command);
cmd.executer();
historic.registerCommand(cmd);
if (recorder.isOn()) {
recorder.rajouter(cmd);
}
}
@Override
public String getSelectedContent() {
return m.getSelectedContent();
}
}
|
#! /bin/bash
python api.py \
--model_select 112m \
--vocab_id_dir vocab_50257_ns \
--workspace pretrain0314 \
--ckpt_id epoch1-step142000 \
--enable_padding False \
--enable_bos True \
--enable_eos False \
--truncated_len 128 \
--min_length 50 \
--max_length 128 \
--do_sample True \
--top_p 0.9 \
--temperature 0.8 \
--repetition_penalty 1.2 \
--train_mode pretrain \
--use_cpu True \
--port 4000
|
//#####################################################################
// Copyright 2002, <NAME>.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
#include <PhysBAM_Tools/Grids_Uniform_Boundaries/BOUNDARY_UNIFORM.h>
#include <PhysBAM_Dynamics/Level_Sets/HAMILTON_JACOBI_1D.h>
#include <PhysBAM_Dynamics/Level_Sets/HAMILTONIAN_1D.h>
using namespace PhysBAM;
//#####################################################################
// Function Euler_Step
//#####################################################################
// providing time is optional
template<class T> void HAMILTON_JACOBI_1D<T>::
Euler_Step(const T dt,const T time)
{
int i;int m=grid.counts.x;
int ghost_cells=3;
ARRAY<T,VECTOR<int,1> > phi_ghost(grid.Domain_Indices(ghost_cells));boundary->Fill_Ghost_Cells(grid,phi,phi_ghost,dt,time,ghost_cells);
// find phx_plus and phix_minus
ARRAY<T,VECTOR<int,1> > phix_minus(1,m),phix_plus(1,m);
Calculate_Derivatives(phi_ghost,phix_minus,phix_plus);
if(LF_viscosity){
T phix_min=min(phix_minus(1),phix_plus(1)),phix_max=max(phix_minus(1),phix_plus(1));
for(i=1;i<=m;i++){phix_min=min(phix_min,phix_minus(i),phix_plus(i));phix_max=max(phix_max,phix_minus(i),phix_plus(i));}
for(i=1;i<=m;i++){
T phix_ave=(phix_minus(i)+phix_plus(i))/2,phix_difference=(phix_plus(i)-phix_minus(i))/2;
phi(i)-=dt*(hamiltonian.H(phix_ave,i,time)-hamiltonian.Maxabs_H1(phix_min,phix_max,i,time)*phix_difference);}}
else // LLF and LLLF are the same in 1D
for(i=1;i<=m;i++){
T phix_min=min(phix_minus(i),phix_plus(i)),phix_max=max(phix_minus(i),phix_plus(i));
T phix_ave=(phix_minus(i)+phix_plus(i))/2,phix_difference=(phix_plus(i)-phix_minus(i))/2;
phi(i)-=dt*(hamiltonian.H(phix_ave,i,time)-hamiltonian.Maxabs_H1(phix_min,phix_max,i,time)*phix_difference);}
boundary->Apply_Boundary_Condition(grid,phi,time+dt);
}
//#####################################################################
// Function Calculate_Derivatives
//#####################################################################
template<class T> void HAMILTON_JACOBI_1D<T>::
Calculate_Derivatives(ARRAY<T,VECTOR<int,1> >& phi_ghost,ARRAY<T,VECTOR<int,1> >& phix_minus,ARRAY<T,VECTOR<int,1> >& phix_plus)
{
int m=grid.counts.x;T dx=grid.dX.x;
int ghost_cells=3;
ARRAY<T,VECTOR<int,1> > phi_1d_x(1-ghost_cells,m+ghost_cells);
for(int i=1-ghost_cells;i<=m+ghost_cells;i++) phi_1d_x(i)=phi_ghost(i);
if(spatial_order == 5) HJ_WENO(m,dx,phi_1d_x,phix_minus,phix_plus);
else HJ_ENO(spatial_order,m,dx,phi_1d_x,phix_minus,phix_plus);
}
//#####################################################################
// Function CFL
//#####################################################################
template<class T> T HAMILTON_JACOBI_1D<T>::
CFL(const T time)
{
int i; int m=grid.counts.x;T dx=grid.dX.x;
int ghost_cells=3;
ARRAY<T,VECTOR<int,1> > phi_ghost(grid.Domain_Indices(ghost_cells));boundary->Fill_Ghost_Cells(grid,phi,phi_ghost,0,time,ghost_cells);
// find phx_plus and phix_minus
ARRAY<T,VECTOR<int,1> > phix_minus(1,m),phix_plus(1,m);
Calculate_Derivatives(phi_ghost,phix_minus,phix_plus);
T maxabs_H1;
if(LF_viscosity){
T phix_min=min(phix_minus(1),phix_plus(1)),phix_max=max(phix_minus(1),phix_plus(1));
for(i=1;i<=m;i++){phix_min=min(phix_min,phix_minus(i),phix_plus(i));phix_max=max(phix_max,phix_minus(i),phix_plus(i));}
maxabs_H1=hamiltonian.Maxabs_H1(phix_min,phix_max,1,time);
for(i=1;i<=m;i++) maxabs_H1=max(maxabs_H1,hamiltonian.Maxabs_H1(phix_min,phix_max,i,time));}
else{ // LLF and LLLF are the same in 1D
T phix_min=min(phix_minus(1),phix_plus(1)),phix_max=max(phix_minus(1),phix_plus(1));
maxabs_H1=hamiltonian.Maxabs_H1(phix_min,phix_max,1,time);
for(i=1;i<=m;i++){
phix_min=min(phix_minus(i),phix_plus(i)),phix_max=max(phix_minus(i),phix_plus(i));
maxabs_H1=max(maxabs_H1,hamiltonian.Maxabs_H1(phix_min,phix_max,i,time));}}
T dt_convect=maxabs_H1/dx;
dt_convect=max(dt_convect,1/max_time_step); // avoids division by zero
return 1/dt_convect;
}
//#####################################################################
template class HAMILTON_JACOBI_1D<float>;
#ifndef COMPILE_WITHOUT_DOUBLE_SUPPORT
template class HAMILTON_JACOBI_1D<double>;
#endif
|
# change dh-files on every provisioning
# openssl dhparam -out /opt/local/etc/postfix/dh4096.pem 4096
openssl dhparam -out /opt/local/etc/postfix/dh2048.pem 2048
openssl dhparam -out /opt/local/etc/postfix/dh1024.pem 1024
openssl dhparam -out /opt/local/etc/postfix/dh512.pem 512
chmod 0400 /opt/local/etc/postfix/dh*.pem
# add stub for postfix
touch /opt/local/etc/postfix/client_checks
touch /opt/local/etc/postfix/sender_checks
/opt/local/sbin/postmap hash:/opt/local/etc/postfix/client_checks
/opt/local/sbin/postmap hash:/opt/local/etc/postfix/sender_checks
|
#!/usr/bin/env bash
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o release/mysql_markdown_mac mysql_markdown.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o release/mysql_markdown_unix mysql_markdown.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o release/mysql_markdown_win mysql_markdown.go
chmod +x release/mysql_markdown_* |
<gh_stars>1-10
import Vue from "vue";
import App from "./App.vue";
import VueResource from "vue-resource";
import VueRouter from "vue-router";
import * as Vue2Leaflet from "vue2-leaflet";
import 'leaflet/dist/leaflet.css';
import { library } from "@fortawesome/fontawesome-svg-core";
import { faUsers, faCheckCircle, faTimes, faChevronLeft, faStar } from "@fortawesome/free-solid-svg-icons";
import { faGithub, faWikipediaW } from "@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
// FontAwesome
library.add(faCheckCircle);
library.add(faUsers);
library.add(faTimes);
library.add(faStar);
library.add(faGithub);
library.add(faChevronLeft);
library.add(faWikipediaW);
Vue.component("font-awesome-icon", FontAwesomeIcon);
Vue.config.productionTip = false;
// Leaflet
Vue.component('l-map', Vue2Leaflet.LMap);
Vue.component('l-tile-layer', Vue2Leaflet.LTileLayer);
Vue.component('l-marker', Vue2Leaflet.LMarker);
// Router and routes
import { routes } from "./routes";
Vue.use(VueResource);
Vue.use(VueRouter);
const router = new VueRouter({
routes: routes
});
new Vue({
el: "#app",
router,
render: h => h(App)
});
|
<gh_stars>1-10
'use strict';
describe('LoginCtrl', function () {
var scope, createController, c;
beforeEach(module('<%= appName %>'));
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
createController = function() {
return $controller('LoginCtrl as vm', {
'$scope': scope
});
};
createController();
c = scope.vm;
}));
it('credentials is correct', function() {
expect(c.credentials).toEqual({username: '', password: ''});
});
it('error is correct', function() {
expect(c.error).toEqual('');
});
it('login method is defined', function() {
expect(c.login).toBeDefined();
});
describe('Meteor methods called', function(){
beforeEach(function(){
c.credentials = {username: 'user', password: '<PASSWORD>'};
spyOn(Meteor, 'loginWithPassword');
});
it('loginWithPassword called', function() {
c.login();
expect(Meteor.loginWithPassword).toHaveBeenCalledWith(c.credentials.username, c.credentials.password, jasmine.any(Function));
});
});
});
|
CREATE TABLE records (id INT, name VARCHAR(20));
INSERT INTO records VALUES
(1, 'John'),
(2, 'Mark'),
(3, 'Nina'),
(4, 'Henry'),
(5, 'Linda'); |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var util_1 = require("../util/util");
var ArcAnnotation = /** @class */ (function (_super) {
tslib_1.__extends(ArcAnnotation, _super);
function ArcAnnotation() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @protected
* 默认的配置项
* @returns {object} 默认的配置项
*/
ArcAnnotation.prototype.getDefaultCfg = function () {
var cfg = _super.prototype.getDefaultCfg.call(this);
return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'arc', locationType: 'circle', center: null, radius: 100, startAngle: -Math.PI / 2, endAngle: (Math.PI * 3) / 2, style: {
stroke: '#999',
lineWidth: 1,
} });
};
ArcAnnotation.prototype.renderInner = function (group) {
this.renderArc(group);
};
ArcAnnotation.prototype.getArcPath = function () {
var _a = this.getLocation(), center = _a.center, radius = _a.radius, startAngle = _a.startAngle, endAngle = _a.endAngle;
var startPoint = util_1.getCirclePoint(center, radius, startAngle);
var endPoint = util_1.getCirclePoint(center, radius, endAngle);
var largeFlag = endAngle - startAngle > Math.PI ? 1 : 0;
var path = [['M', startPoint.x, startPoint.y]];
if (endAngle - startAngle === Math.PI * 2) {
// 整个圆是分割成两个圆
var middlePoint = util_1.getCirclePoint(center, radius, startAngle + Math.PI);
path.push(['A', radius, radius, 0, largeFlag, 1, middlePoint.x, middlePoint.y]);
path.push(['A', radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
}
else {
path.push(['A', radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
}
return path;
};
// 绘制 arc
ArcAnnotation.prototype.renderArc = function (group) {
// 也可以 通过 get('center') 类似的方式逐个获取
var path = this.getArcPath();
var style = this.get('style');
this.addShape(group, {
type: 'path',
id: this.getElementId('arc'),
name: 'annotation-arc',
attrs: tslib_1.__assign({ path: path }, style),
});
};
return ArcAnnotation;
}(group_component_1.default));
exports.default = ArcAnnotation;
//# sourceMappingURL=arc.js.map |
/**
* Contains customized stream classes, that can read or write compressed data on the fly,
* along with encoders and decoders for popular stream formats, such as Base64, ZIP (deflate), LZW, PackBits etc..
*
* @see com.twelvemonkeys.io.enc.DecoderStream
* @see com.twelvemonkeys.io.enc.EncoderStream
* @see com.twelvemonkeys.io.enc.Decoder
* @see com.twelvemonkeys.io.enc.Encoder
* @see com.twelvemonkeys.io.enc.DecodeException
*
* @version 2.0
* @author <a href="mailto:<EMAIL>"><NAME></a>
*/
package com.twelvemonkeys.io.enc; |
/* eslint no-unused-vars: "off" */
module.exports = {
name: 'leave',
category: 'Music',
usage: '<no have parameters>',
aliases: ['quit', 'exit'],
guildOnly: true,
description: 'Disconnects the bot from voice channel and clear the queue music',
execute(message, _args, _client, options) {
const { voiceChannel } = message.member;
let Status = options.isplay.get(message.guild.id) || {};
let stSong = options.songStatus.get(message.guild.id) || {};
if (!voiceChannel) {
return message.reply('Please join a voice channel first!');
}
const permissions = voiceChannel.permissionsFor(message.client.user);
if (!permissions.has('CONNECT')) {
return message.channel.send('I cannot connect to your voice channel, make sure I have the proper permissions!');
}
if (!permissions.has('SPEAK')) {
return message.channel.send('I cannot speak in this voice channel, make sure I have the proper permissions!');
}
if (Status.Playing == true || !Status.Playing) Status.Playing = false;
if (stSong.Paused == true || !stSong.Paused) stSong.Paused = false;
options.isplay.set(message.guild.id, Status);
options.songStatus.set(message.guild.id, stSong);
options.songQ.delete(message.guild.id);
options.backQ.delete(message.guild.id);
if(voiceChannel.connection != null) {
voiceChannel.leave();
message.channel.send('**Disconnected, and cleared the play and back queue** :thumbsup:');
}
else{
message.channel.send('**I can\'t leave, if i\'m not connected use `(prefix)join` instead** :x:');
}
},
};
|
#!/usr/bin/env bash
echo "root" > /etc/fcron/fcron.allow
#chmod 644 /etc/fcron/
chmod 644 /etc/fcron/fcron.conf /etc/fcron/fcron.allow /etc/fcron/fcron.deny
[ ! -f /run/fcron.pid ] || rm /run/fcron.pid
exec /usr/sbin/fcron --foreground
|
<filename>src/main/java/org/envirocar/trackcount/configuration/JtsConfiguration.java
package org.envirocar.trackcount.configuration;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.PrecisionModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JtsConfiguration {
@Bean
public GeometryFactory geometryFactory() {
return new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326);
}
}
|
<reponame>sergeytkachenko/siesta-template
Ext.onReady(function () {
var viewport = new Ext.Viewport({
layout : 'fit',
items : [
{
id : 'authResult',
title : 'Welcome to authenticated zone',
authResult : 'success'
}
]
})
})
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/distribution/query.proto
package types
import (
context "context"
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// QueryParamsRequest is the request type for the Query/Params RPC method
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{0}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is the response type for the Query/Params RPC method
type QueryParamsResponse struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{1}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
// QueryValidatorOutstandingRewardsRequest is the request type for the Query/ValidatorOutstandingRewards RPC method
type QueryValidatorOutstandingRewardsRequest struct {
ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty"`
}
func (m *QueryValidatorOutstandingRewardsRequest) Reset() {
*m = QueryValidatorOutstandingRewardsRequest{}
}
func (m *QueryValidatorOutstandingRewardsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorOutstandingRewardsRequest) ProtoMessage() {}
func (*QueryValidatorOutstandingRewardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{2}
}
func (m *QueryValidatorOutstandingRewardsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorOutstandingRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorOutstandingRewardsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorOutstandingRewardsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorOutstandingRewardsRequest.Merge(m, src)
}
func (m *QueryValidatorOutstandingRewardsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorOutstandingRewardsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorOutstandingRewardsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorOutstandingRewardsRequest proto.InternalMessageInfo
func (m *QueryValidatorOutstandingRewardsRequest) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddress
}
return nil
}
// QueryValidatorOutstandingRewardsResponse is the response type for the Query/ValidatorOutstandingRewards RPC method
type QueryValidatorOutstandingRewardsResponse struct {
Rewards ValidatorOutstandingRewards `protobuf:"bytes,1,opt,name=rewards,proto3" json:"rewards"`
}
func (m *QueryValidatorOutstandingRewardsResponse) Reset() {
*m = QueryValidatorOutstandingRewardsResponse{}
}
func (m *QueryValidatorOutstandingRewardsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorOutstandingRewardsResponse) ProtoMessage() {}
func (*QueryValidatorOutstandingRewardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{3}
}
func (m *QueryValidatorOutstandingRewardsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorOutstandingRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorOutstandingRewardsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorOutstandingRewardsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorOutstandingRewardsResponse.Merge(m, src)
}
func (m *QueryValidatorOutstandingRewardsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorOutstandingRewardsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorOutstandingRewardsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorOutstandingRewardsResponse proto.InternalMessageInfo
func (m *QueryValidatorOutstandingRewardsResponse) GetRewards() ValidatorOutstandingRewards {
if m != nil {
return m.Rewards
}
return ValidatorOutstandingRewards{}
}
// QueryValidatorCommissionRequest is the request type for the Query/ValidatorCommission RPC method
type QueryValidatorCommissionRequest struct {
ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty"`
}
func (m *QueryValidatorCommissionRequest) Reset() { *m = QueryValidatorCommissionRequest{} }
func (m *QueryValidatorCommissionRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorCommissionRequest) ProtoMessage() {}
func (*QueryValidatorCommissionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{4}
}
func (m *QueryValidatorCommissionRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorCommissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorCommissionRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorCommissionRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorCommissionRequest.Merge(m, src)
}
func (m *QueryValidatorCommissionRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorCommissionRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorCommissionRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorCommissionRequest proto.InternalMessageInfo
func (m *QueryValidatorCommissionRequest) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddress
}
return nil
}
// QueryValidatorCommissionResponse is the response type for the Query/ValidatorCommission RPC method
type QueryValidatorCommissionResponse struct {
Commission ValidatorAccumulatedCommission `protobuf:"bytes,1,opt,name=commission,proto3" json:"commission"`
}
func (m *QueryValidatorCommissionResponse) Reset() { *m = QueryValidatorCommissionResponse{} }
func (m *QueryValidatorCommissionResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorCommissionResponse) ProtoMessage() {}
func (*QueryValidatorCommissionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{5}
}
func (m *QueryValidatorCommissionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorCommissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorCommissionResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorCommissionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorCommissionResponse.Merge(m, src)
}
func (m *QueryValidatorCommissionResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorCommissionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorCommissionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorCommissionResponse proto.InternalMessageInfo
func (m *QueryValidatorCommissionResponse) GetCommission() ValidatorAccumulatedCommission {
if m != nil {
return m.Commission
}
return ValidatorAccumulatedCommission{}
}
// QueryValidatorSlashesRequest is the request type for the Query/ValidatorSlashes RPC method
type QueryValidatorSlashesRequest struct {
ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty"`
StartingHeight uint64 `protobuf:"varint,2,opt,name=starting_height,json=startingHeight,proto3" json:"starting_height,omitempty"`
EndingHeight uint64 `protobuf:"varint,3,opt,name=ending_height,json=endingHeight,proto3" json:"ending_height,omitempty"`
Req *query.PageRequest `protobuf:"bytes,4,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryValidatorSlashesRequest) Reset() { *m = QueryValidatorSlashesRequest{} }
func (m *QueryValidatorSlashesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorSlashesRequest) ProtoMessage() {}
func (*QueryValidatorSlashesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{6}
}
func (m *QueryValidatorSlashesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorSlashesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorSlashesRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorSlashesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorSlashesRequest.Merge(m, src)
}
func (m *QueryValidatorSlashesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorSlashesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorSlashesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorSlashesRequest proto.InternalMessageInfo
func (m *QueryValidatorSlashesRequest) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddress
}
return nil
}
func (m *QueryValidatorSlashesRequest) GetStartingHeight() uint64 {
if m != nil {
return m.StartingHeight
}
return 0
}
func (m *QueryValidatorSlashesRequest) GetEndingHeight() uint64 {
if m != nil {
return m.EndingHeight
}
return 0
}
func (m *QueryValidatorSlashesRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryValidatorSlashesResponse is the response type for the Query/ValidatorSlashes RPC method
type QueryValidatorSlashesResponse struct {
Slashes []ValidatorSlashEvent `protobuf:"bytes,1,rep,name=slashes,proto3" json:"slashes"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryValidatorSlashesResponse) Reset() { *m = QueryValidatorSlashesResponse{} }
func (m *QueryValidatorSlashesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorSlashesResponse) ProtoMessage() {}
func (*QueryValidatorSlashesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{7}
}
func (m *QueryValidatorSlashesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorSlashesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorSlashesResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryValidatorSlashesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorSlashesResponse.Merge(m, src)
}
func (m *QueryValidatorSlashesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorSlashesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorSlashesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorSlashesResponse proto.InternalMessageInfo
func (m *QueryValidatorSlashesResponse) GetSlashes() []ValidatorSlashEvent {
if m != nil {
return m.Slashes
}
return nil
}
func (m *QueryValidatorSlashesResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryDelegationRewardsRequest is the request type for the Query/DelegationRewards RPC method
type QueryDelegationRewardsRequest struct {
DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty"`
ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty"`
}
func (m *QueryDelegationRewardsRequest) Reset() { *m = QueryDelegationRewardsRequest{} }
func (m *QueryDelegationRewardsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationRewardsRequest) ProtoMessage() {}
func (*QueryDelegationRewardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{8}
}
func (m *QueryDelegationRewardsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationRewardsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegationRewardsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationRewardsRequest.Merge(m, src)
}
func (m *QueryDelegationRewardsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationRewardsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationRewardsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationRewardsRequest proto.InternalMessageInfo
func (m *QueryDelegationRewardsRequest) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddress
}
return nil
}
func (m *QueryDelegationRewardsRequest) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddress
}
return nil
}
// QueryDelegationRewardsResponse is the response type for the Query/DelegationRewards RPC method
type QueryDelegationRewardsResponse struct {
Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"`
}
func (m *QueryDelegationRewardsResponse) Reset() { *m = QueryDelegationRewardsResponse{} }
func (m *QueryDelegationRewardsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationRewardsResponse) ProtoMessage() {}
func (*QueryDelegationRewardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{9}
}
func (m *QueryDelegationRewardsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationRewardsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegationRewardsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationRewardsResponse.Merge(m, src)
}
func (m *QueryDelegationRewardsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationRewardsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationRewardsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationRewardsResponse proto.InternalMessageInfo
func (m *QueryDelegationRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins {
if m != nil {
return m.Rewards
}
return nil
}
// QueryDelegationTotalRewardsRequest is the request type for the Query/DelegationTotalRewards RPC method
type QueryDelegationTotalRewardsRequest struct {
DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty"`
}
func (m *QueryDelegationTotalRewardsRequest) Reset() { *m = QueryDelegationTotalRewardsRequest{} }
func (m *QueryDelegationTotalRewardsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationTotalRewardsRequest) ProtoMessage() {}
func (*QueryDelegationTotalRewardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{10}
}
func (m *QueryDelegationTotalRewardsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationTotalRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationTotalRewardsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegationTotalRewardsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationTotalRewardsRequest.Merge(m, src)
}
func (m *QueryDelegationTotalRewardsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationTotalRewardsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationTotalRewardsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationTotalRewardsRequest proto.InternalMessageInfo
func (m *QueryDelegationTotalRewardsRequest) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddress
}
return nil
}
// QueryDelegationTotalRewardsResponse is the response type for the Query/DelegationTotalRewards RPC method
type QueryDelegationTotalRewardsResponse struct {
Rewards []DelegationDelegatorReward `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards"`
Total github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=total,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"total"`
}
func (m *QueryDelegationTotalRewardsResponse) Reset() { *m = QueryDelegationTotalRewardsResponse{} }
func (m *QueryDelegationTotalRewardsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationTotalRewardsResponse) ProtoMessage() {}
func (*QueryDelegationTotalRewardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{11}
}
func (m *QueryDelegationTotalRewardsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationTotalRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationTotalRewardsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegationTotalRewardsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationTotalRewardsResponse.Merge(m, src)
}
func (m *QueryDelegationTotalRewardsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationTotalRewardsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationTotalRewardsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationTotalRewardsResponse proto.InternalMessageInfo
func (m *QueryDelegationTotalRewardsResponse) GetRewards() []DelegationDelegatorReward {
if m != nil {
return m.Rewards
}
return nil
}
func (m *QueryDelegationTotalRewardsResponse) GetTotal() github_com_cosmos_cosmos_sdk_types.DecCoins {
if m != nil {
return m.Total
}
return nil
}
// QueryDelegatorValidatorsRequest is the request type for the Query/DelegatorValidators RPC method
type QueryDelegatorValidatorsRequest struct {
DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty"`
}
func (m *QueryDelegatorValidatorsRequest) Reset() { *m = QueryDelegatorValidatorsRequest{} }
func (m *QueryDelegatorValidatorsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorValidatorsRequest) ProtoMessage() {}
func (*QueryDelegatorValidatorsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{12}
}
func (m *QueryDelegatorValidatorsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorValidatorsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegatorValidatorsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorValidatorsRequest.Merge(m, src)
}
func (m *QueryDelegatorValidatorsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorValidatorsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorValidatorsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorValidatorsRequest proto.InternalMessageInfo
func (m *QueryDelegatorValidatorsRequest) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddress
}
return nil
}
// QueryDelegatorValidatorsResponse is the response type for the Query/DelegatorValidators RPC method
type QueryDelegatorValidatorsResponse struct {
Validators []github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,rep,name=validators,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validators,omitempty"`
}
func (m *QueryDelegatorValidatorsResponse) Reset() { *m = QueryDelegatorValidatorsResponse{} }
func (m *QueryDelegatorValidatorsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorValidatorsResponse) ProtoMessage() {}
func (*QueryDelegatorValidatorsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{13}
}
func (m *QueryDelegatorValidatorsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorValidatorsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegatorValidatorsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorValidatorsResponse.Merge(m, src)
}
func (m *QueryDelegatorValidatorsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorValidatorsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorValidatorsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorValidatorsResponse proto.InternalMessageInfo
func (m *QueryDelegatorValidatorsResponse) GetValidators() []github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.Validators
}
return nil
}
// QueryDelegatorWithdrawAddressRequest is the request type for the Query/DelegatorWithdrawAddress RPC method
type QueryDelegatorWithdrawAddressRequest struct {
DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty"`
}
func (m *QueryDelegatorWithdrawAddressRequest) Reset() { *m = QueryDelegatorWithdrawAddressRequest{} }
func (m *QueryDelegatorWithdrawAddressRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorWithdrawAddressRequest) ProtoMessage() {}
func (*QueryDelegatorWithdrawAddressRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{14}
}
func (m *QueryDelegatorWithdrawAddressRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorWithdrawAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegatorWithdrawAddressRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.Merge(m, src)
}
func (m *QueryDelegatorWithdrawAddressRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorWithdrawAddressRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorWithdrawAddressRequest proto.InternalMessageInfo
func (m *QueryDelegatorWithdrawAddressRequest) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddress
}
return nil
}
// QueryDelegatorWithdrawAddressResponse is the response type for the Query/DelegatorWithdrawAddress RPC method
type QueryDelegatorWithdrawAddressResponse struct {
WithdrawAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=withdraw_address,json=withdrawAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"withdraw_address,omitempty"`
}
func (m *QueryDelegatorWithdrawAddressResponse) Reset() { *m = QueryDelegatorWithdrawAddressResponse{} }
func (m *QueryDelegatorWithdrawAddressResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorWithdrawAddressResponse) ProtoMessage() {}
func (*QueryDelegatorWithdrawAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{15}
}
func (m *QueryDelegatorWithdrawAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorWithdrawAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryDelegatorWithdrawAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.Merge(m, src)
}
func (m *QueryDelegatorWithdrawAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorWithdrawAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorWithdrawAddressResponse proto.InternalMessageInfo
func (m *QueryDelegatorWithdrawAddressResponse) GetWithdrawAddress() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.WithdrawAddress
}
return nil
}
// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC method
type QueryCommunityPoolRequest struct {
}
func (m *QueryCommunityPoolRequest) Reset() { *m = QueryCommunityPoolRequest{} }
func (m *QueryCommunityPoolRequest) String() string { return proto.CompactTextString(m) }
func (*QueryCommunityPoolRequest) ProtoMessage() {}
func (*QueryCommunityPoolRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{16}
}
func (m *QueryCommunityPoolRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryCommunityPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryCommunityPoolRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryCommunityPoolRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryCommunityPoolRequest.Merge(m, src)
}
func (m *QueryCommunityPoolRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryCommunityPoolRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryCommunityPoolRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryCommunityPoolRequest proto.InternalMessageInfo
// QueryCommunityPoolResponse is the response type for the Query/CommunityPool RPC method
type QueryCommunityPoolResponse struct {
Pool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=pool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"pool"`
}
func (m *QueryCommunityPoolResponse) Reset() { *m = QueryCommunityPoolResponse{} }
func (m *QueryCommunityPoolResponse) String() string { return proto.CompactTextString(m) }
func (*QueryCommunityPoolResponse) ProtoMessage() {}
func (*QueryCommunityPoolResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2111c1b119d22af6, []int{17}
}
func (m *QueryCommunityPoolResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryCommunityPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryCommunityPoolResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryCommunityPoolResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryCommunityPoolResponse.Merge(m, src)
}
func (m *QueryCommunityPoolResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryCommunityPoolResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryCommunityPoolResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryCommunityPoolResponse proto.InternalMessageInfo
func (m *QueryCommunityPoolResponse) GetPool() github_com_cosmos_cosmos_sdk_types.DecCoins {
if m != nil {
return m.Pool
}
return nil
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.distribution.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.distribution.QueryParamsResponse")
proto.RegisterType((*QueryValidatorOutstandingRewardsRequest)(nil), "cosmos.distribution.QueryValidatorOutstandingRewardsRequest")
proto.RegisterType((*QueryValidatorOutstandingRewardsResponse)(nil), "cosmos.distribution.QueryValidatorOutstandingRewardsResponse")
proto.RegisterType((*QueryValidatorCommissionRequest)(nil), "cosmos.distribution.QueryValidatorCommissionRequest")
proto.RegisterType((*QueryValidatorCommissionResponse)(nil), "cosmos.distribution.QueryValidatorCommissionResponse")
proto.RegisterType((*QueryValidatorSlashesRequest)(nil), "cosmos.distribution.QueryValidatorSlashesRequest")
proto.RegisterType((*QueryValidatorSlashesResponse)(nil), "cosmos.distribution.QueryValidatorSlashesResponse")
proto.RegisterType((*QueryDelegationRewardsRequest)(nil), "cosmos.distribution.QueryDelegationRewardsRequest")
proto.RegisterType((*QueryDelegationRewardsResponse)(nil), "cosmos.distribution.QueryDelegationRewardsResponse")
proto.RegisterType((*QueryDelegationTotalRewardsRequest)(nil), "cosmos.distribution.QueryDelegationTotalRewardsRequest")
proto.RegisterType((*QueryDelegationTotalRewardsResponse)(nil), "cosmos.distribution.QueryDelegationTotalRewardsResponse")
proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.distribution.QueryDelegatorValidatorsRequest")
proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.distribution.QueryDelegatorValidatorsResponse")
proto.RegisterType((*QueryDelegatorWithdrawAddressRequest)(nil), "cosmos.distribution.QueryDelegatorWithdrawAddressRequest")
proto.RegisterType((*QueryDelegatorWithdrawAddressResponse)(nil), "cosmos.distribution.QueryDelegatorWithdrawAddressResponse")
proto.RegisterType((*QueryCommunityPoolRequest)(nil), "cosmos.distribution.QueryCommunityPoolRequest")
proto.RegisterType((*QueryCommunityPoolResponse)(nil), "cosmos.distribution.QueryCommunityPoolResponse")
}
func init() { proto.RegisterFile("cosmos/distribution/query.proto", fileDescriptor_2111c1b119d22af6) }
var fileDescriptor_2111c1b119d22af6 = []byte{
// 940 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0xdc, 0x44,
0x14, 0xdf, 0x49, 0xd2, 0x54, 0xbc, 0xb4, 0x24, 0x9d, 0x54, 0x68, 0xeb, 0xd0, 0xdd, 0xc8, 0x05,
0xb2, 0x52, 0xa9, 0x4d, 0x36, 0x20, 0x28, 0x82, 0x43, 0xd2, 0x20, 0x55, 0x42, 0x82, 0xed, 0x82,
0x0a, 0x54, 0xd0, 0x6a, 0x62, 0x8f, 0xbc, 0x16, 0x5e, 0xcf, 0xc6, 0x33, 0x4e, 0x88, 0xf8, 0x23,
0x90, 0x0a, 0x12, 0x07, 0x24, 0x24, 0x0e, 0x5c, 0xf8, 0x04, 0xfd, 0x24, 0x3d, 0x96, 0x1b, 0xa7,
0x16, 0x25, 0x9f, 0x02, 0x4e, 0xc8, 0x33, 0x63, 0x67, 0x9d, 0xd8, 0xce, 0x66, 0x89, 0xf6, 0xb6,
0xfb, 0xe6, 0xbd, 0xdf, 0xfb, 0xbd, 0xdf, 0xbc, 0x79, 0x33, 0x86, 0xa6, 0xc3, 0x78, 0x9f, 0x71,
0xdb, 0xf5, 0xb9, 0x88, 0xfc, 0xad, 0x58, 0xf8, 0x2c, 0xb4, 0xb7, 0x63, 0x1a, 0xed, 0x59, 0x83,
0x88, 0x09, 0x86, 0x17, 0x95, 0x83, 0x35, 0xec, 0x60, 0x5c, 0xd5, 0x51, 0xd2, 0xd1, 0x1e, 0x10,
0xcf, 0x0f, 0x49, 0xb2, 0xa0, 0x62, 0x8c, 0xcb, 0x1e, 0xf3, 0x98, 0xfc, 0x69, 0x27, 0xbf, 0xb4,
0x55, 0x23, 0xd9, 0x1a, 0x50, 0x19, 0x5f, 0x29, 0xca, 0x3f, 0xfc, 0x47, 0xf9, 0x99, 0x97, 0x01,
0xdf, 0x49, 0x92, 0x75, 0x48, 0x44, 0xfa, 0xbc, 0x4b, 0xb7, 0x63, 0xca, 0x85, 0xd9, 0x81, 0xc5,
0x9c, 0x95, 0x0f, 0x58, 0xc8, 0x29, 0xbe, 0x09, 0xb3, 0x03, 0x69, 0xa9, 0xa3, 0x65, 0xd4, 0x9a,
0x6b, 0x2f, 0x59, 0x05, 0x45, 0x58, 0x2a, 0x68, 0x63, 0xe6, 0xf1, 0xd3, 0x66, 0xad, 0xab, 0x03,
0xcc, 0x9f, 0x11, 0xac, 0x48, 0xc8, 0xbb, 0x24, 0xf0, 0x5d, 0x22, 0x58, 0xf4, 0x61, 0x2c, 0xb8,
0x20, 0xa1, 0xeb, 0x87, 0x5e, 0x97, 0xee, 0x92, 0xc8, 0x4d, 0xb3, 0xe3, 0xfb, 0x70, 0x69, 0x27,
0xf5, 0x7a, 0x40, 0x5c, 0x37, 0xa2, 0x5c, 0x65, 0xbc, 0xb0, 0xb1, 0xfa, 0xef, 0xd3, 0xe6, 0x0d,
0xcf, 0x17, 0xbd, 0x78, 0xcb, 0x72, 0x58, 0xdf, 0xce, 0x95, 0x7e, 0x83, 0xbb, 0x5f, 0xda, 0x62,
0x6f, 0x40, 0xb9, 0x75, 0x97, 0x04, 0xeb, 0x2a, 0xb0, 0xbb, 0x90, 0x61, 0x69, 0x8b, 0xf9, 0x0d,
0xb4, 0x4e, 0xa6, 0xa2, 0x4b, 0xee, 0xc0, 0xf9, 0x48, 0x99, 0x74, 0xcd, 0xaf, 0x15, 0xd6, 0x5c,
0x01, 0xa5, 0x85, 0x48, 0x61, 0xcc, 0x1f, 0x10, 0x34, 0xf3, 0xe9, 0x6f, 0xb1, 0x7e, 0xdf, 0xe7,
0xdc, 0x67, 0xe1, 0xa4, 0x14, 0xf8, 0x16, 0x96, 0xcb, 0x29, 0xe8, 0xca, 0x3f, 0x03, 0x70, 0x32,
0xab, 0x2e, 0x7e, 0xad, 0xba, 0xf8, 0x75, 0xc7, 0x89, 0xfb, 0x71, 0x40, 0x04, 0x75, 0x0f, 0x01,
0x75, 0xfd, 0x43, 0x60, 0xe6, 0x3f, 0x08, 0x5e, 0xcc, 0xe7, 0xff, 0x28, 0x20, 0xbc, 0x47, 0x27,
0xd5, 0x01, 0x78, 0x05, 0xe6, 0xb9, 0x20, 0x91, 0xf0, 0x43, 0xef, 0x41, 0x8f, 0xfa, 0x5e, 0x4f,
0xd4, 0xa7, 0x96, 0x51, 0x6b, 0xa6, 0xfb, 0x7c, 0x6a, 0xbe, 0x2d, 0xad, 0xf8, 0x1a, 0x5c, 0xa4,
0x72, 0x33, 0x53, 0xb7, 0x69, 0xe9, 0x76, 0x41, 0x19, 0xb5, 0xd3, 0x75, 0x98, 0x8e, 0xe8, 0x76,
0x7d, 0x46, 0x4a, 0x74, 0x25, 0x95, 0x48, 0x1d, 0xf6, 0x0e, 0xf1, 0xa8, 0xae, 0xaa, 0x9b, 0x78,
0x99, 0xbf, 0x23, 0xb8, 0x5a, 0x52, 0xbb, 0x16, 0xfe, 0x36, 0x9c, 0xe7, 0xca, 0x54, 0x47, 0xcb,
0xd3, 0xad, 0xb9, 0x76, 0xab, 0x5a, 0x75, 0x19, 0xff, 0xde, 0x0e, 0x0d, 0x45, 0xda, 0x6a, 0x3a,
0x1c, 0xbf, 0x9a, 0x10, 0xe3, 0xb2, 0xb4, 0xb9, 0xb6, 0x51, 0x44, 0x4c, 0xa5, 0x4c, 0x98, 0x71,
0xf3, 0x59, 0xca, 0x6c, 0x93, 0x06, 0xd4, 0x93, 0x73, 0xe7, 0xf8, 0xc1, 0x74, 0xd5, 0xda, 0xd8,
0xdb, 0xb2, 0xee, 0x38, 0xd9, 0xb6, 0x64, 0x58, 0xe9, 0xb6, 0x14, 0x6e, 0xfb, 0xd4, 0xd9, 0xb5,
0xfd, 0xf7, 0x08, 0x1a, 0x65, 0x15, 0x6a, 0xf1, 0xef, 0x0f, 0x9f, 0xf7, 0x44, 0xfc, 0xf9, 0x54,
0xb6, 0x4d, 0xea, 0xdc, 0x62, 0x7e, 0xb8, 0xb1, 0x96, 0x68, 0xfc, 0xe8, 0x59, 0xf3, 0xfa, 0x08,
0x6c, 0x74, 0x0c, 0x3f, 0x3c, 0xfd, 0x0f, 0x11, 0x98, 0x47, 0x28, 0x7c, 0xcc, 0x04, 0x09, 0x26,
0xab, 0xb4, 0xf9, 0x27, 0x82, 0x6b, 0x95, 0x34, 0xb4, 0x1c, 0x1f, 0x1c, 0x95, 0xc3, 0x2a, 0xec,
0xc5, 0x43, 0x94, 0xcd, 0x34, 0x93, 0x42, 0x3a, 0x32, 0xfc, 0xf0, 0x3d, 0x38, 0x27, 0x92, 0x3c,
0xf5, 0xa9, 0x33, 0x14, 0x57, 0x41, 0x1e, 0x0e, 0xd6, 0x8c, 0x43, 0x76, 0x44, 0x26, 0xa6, 0x6b,
0xac, 0x07, 0x6b, 0x21, 0x05, 0xad, 0xe9, 0x1d, 0x80, 0xac, 0x33, 0x95, 0xac, 0x63, 0xb5, 0xf7,
0x10, 0x88, 0xf9, 0x13, 0x82, 0x97, 0xf2, 0x79, 0x3f, 0xf1, 0x45, 0xcf, 0x8d, 0xc8, 0x6e, 0xea,
0x3d, 0xa1, 0xfa, 0x7f, 0x44, 0xf0, 0xf2, 0x09, 0x44, 0xb4, 0x0a, 0x9f, 0xc3, 0xc2, 0xae, 0x5e,
0xfa, 0xff, 0x44, 0xe6, 0x77, 0xf3, 0x59, 0xcc, 0x25, 0xb8, 0x22, 0x69, 0x24, 0xd7, 0x50, 0x1c,
0xfa, 0x62, 0xaf, 0xc3, 0x58, 0x90, 0xbe, 0x6e, 0x76, 0xc0, 0x28, 0x5a, 0xd4, 0xc4, 0x3e, 0x85,
0x99, 0x01, 0x63, 0xc1, 0x99, 0x1e, 0x7f, 0x89, 0xd8, 0x7e, 0xf4, 0x1c, 0x9c, 0x93, 0x89, 0xf1,
0x17, 0x30, 0xab, 0x5e, 0x49, 0x78, 0xa5, 0xf0, 0x3c, 0x1d, 0x7f, 0x92, 0x19, 0xad, 0x93, 0x1d,
0x55, 0x01, 0x66, 0x0d, 0xff, 0x81, 0x60, 0xa9, 0xe2, 0x45, 0x82, 0xdf, 0x29, 0xc7, 0x3a, 0xf9,
0x79, 0x66, 0xbc, 0x3b, 0x66, 0x74, 0x46, 0xef, 0x21, 0x82, 0xc5, 0x82, 0x97, 0x07, 0x7e, 0x7d,
0x04, 0xe0, 0x63, 0x6f, 0x25, 0xe3, 0x8d, 0x53, 0x46, 0x65, 0x34, 0xbe, 0x86, 0x85, 0xa3, 0x77,
0x30, 0x5e, 0x1d, 0x01, 0x2c, 0xff, 0x56, 0x31, 0xda, 0xa7, 0x09, 0xc9, 0x92, 0x7f, 0x07, 0x97,
0x8e, 0x5d, 0x42, 0xb8, 0x02, 0xaa, 0xec, 0x4e, 0x36, 0xd6, 0x4e, 0x15, 0x93, 0xe5, 0xff, 0x05,
0xc1, 0x0b, 0xc5, 0xb3, 0x1f, 0xbf, 0x39, 0x0a, 0x62, 0xc1, 0xa5, 0x65, 0xbc, 0x75, 0xfa, 0xc0,
0x5c, 0x4f, 0x14, 0x0c, 0xcd, 0xaa, 0x9e, 0x28, 0x1f, 0xf3, 0x55, 0x3d, 0x51, 0x31, 0x99, 0xcd,
0x1a, 0xfe, 0x0d, 0x41, 0xbd, 0x6c, 0x74, 0xe1, 0x9b, 0x23, 0xa0, 0x16, 0xcf, 0x5d, 0xe3, 0xed,
0x71, 0x42, 0x33, 0x56, 0x11, 0x5c, 0xcc, 0xcd, 0x2a, 0x6c, 0x95, 0xc3, 0x15, 0x4d, 0x3c, 0xc3,
0x1e, 0xd9, 0x3f, 0xcd, 0xb9, 0xf1, 0xfe, 0xe3, 0xfd, 0x06, 0x7a, 0xb2, 0xdf, 0x40, 0x7f, 0xef,
0x37, 0xd0, 0xaf, 0x07, 0x8d, 0xda, 0x93, 0x83, 0x46, 0xed, 0xaf, 0x83, 0x46, 0xed, 0xde, 0x6a,
0xe5, 0xe4, 0xfb, 0x2a, 0xff, 0xc9, 0x29, 0x07, 0xe1, 0xd6, 0xac, 0xfc, 0xd8, 0x5c, 0xfb, 0x2f,
0x00, 0x00, 0xff, 0xff, 0xff, 0xaa, 0x49, 0xeb, 0x16, 0x0f, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type QueryClient interface {
// Params queries params of distribution module
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// ValidatorOutstandingRewards queries rewards of a validator address
ValidatorOutstandingRewards(ctx context.Context, in *QueryValidatorOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryValidatorOutstandingRewardsResponse, error)
// ValidatorCommission queries accumulated commission for a validator
ValidatorCommission(ctx context.Context, in *QueryValidatorCommissionRequest, opts ...grpc.CallOption) (*QueryValidatorCommissionResponse, error)
// ValidatorSlashes queries slash events of a validator
ValidatorSlashes(ctx context.Context, in *QueryValidatorSlashesRequest, opts ...grpc.CallOption) (*QueryValidatorSlashesResponse, error)
// DelegationRewards the total rewards accrued by a delegation
DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error)
// DelegationTotalRewards the total rewards accrued by a each validator
DelegationTotalRewards(ctx context.Context, in *QueryDelegationTotalRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationTotalRewardsResponse, error)
// DelegatorValidators queries the validators of a delegator
DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error)
// DelegatorWithdrawAddress queries withdraw address of a delegator
DelegatorWithdrawAddress(ctx context.Context, in *QueryDelegatorWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryDelegatorWithdrawAddressResponse, error)
// CommunityPool queries the community pool coins
CommunityPool(ctx context.Context, in *QueryCommunityPoolRequest, opts ...grpc.CallOption) (*QueryCommunityPoolResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidatorOutstandingRewards(ctx context.Context, in *QueryValidatorOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryValidatorOutstandingRewardsResponse, error) {
out := new(QueryValidatorOutstandingRewardsResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/ValidatorOutstandingRewards", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidatorCommission(ctx context.Context, in *QueryValidatorCommissionRequest, opts ...grpc.CallOption) (*QueryValidatorCommissionResponse, error) {
out := new(QueryValidatorCommissionResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/ValidatorCommission", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidatorSlashes(ctx context.Context, in *QueryValidatorSlashesRequest, opts ...grpc.CallOption) (*QueryValidatorSlashesResponse, error) {
out := new(QueryValidatorSlashesResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/ValidatorSlashes", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error) {
out := new(QueryDelegationRewardsResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/DelegationRewards", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegationTotalRewards(ctx context.Context, in *QueryDelegationTotalRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationTotalRewardsResponse, error) {
out := new(QueryDelegationTotalRewardsResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/DelegationTotalRewards", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) {
out := new(QueryDelegatorValidatorsResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/DelegatorValidators", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegatorWithdrawAddress(ctx context.Context, in *QueryDelegatorWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryDelegatorWithdrawAddressResponse, error) {
out := new(QueryDelegatorWithdrawAddressResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/DelegatorWithdrawAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) CommunityPool(ctx context.Context, in *QueryCommunityPoolRequest, opts ...grpc.CallOption) (*QueryCommunityPoolResponse, error) {
out := new(QueryCommunityPoolResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.Query/CommunityPool", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Params queries params of distribution module
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// ValidatorOutstandingRewards queries rewards of a validator address
ValidatorOutstandingRewards(context.Context, *QueryValidatorOutstandingRewardsRequest) (*QueryValidatorOutstandingRewardsResponse, error)
// ValidatorCommission queries accumulated commission for a validator
ValidatorCommission(context.Context, *QueryValidatorCommissionRequest) (*QueryValidatorCommissionResponse, error)
// ValidatorSlashes queries slash events of a validator
ValidatorSlashes(context.Context, *QueryValidatorSlashesRequest) (*QueryValidatorSlashesResponse, error)
// DelegationRewards the total rewards accrued by a delegation
DelegationRewards(context.Context, *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error)
// DelegationTotalRewards the total rewards accrued by a each validator
DelegationTotalRewards(context.Context, *QueryDelegationTotalRewardsRequest) (*QueryDelegationTotalRewardsResponse, error)
// DelegatorValidators queries the validators of a delegator
DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error)
// DelegatorWithdrawAddress queries withdraw address of a delegator
DelegatorWithdrawAddress(context.Context, *QueryDelegatorWithdrawAddressRequest) (*QueryDelegatorWithdrawAddressResponse, error)
// CommunityPool queries the community pool coins
CommunityPool(context.Context, *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) ValidatorOutstandingRewards(ctx context.Context, req *QueryValidatorOutstandingRewardsRequest) (*QueryValidatorOutstandingRewardsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidatorOutstandingRewards not implemented")
}
func (*UnimplementedQueryServer) ValidatorCommission(ctx context.Context, req *QueryValidatorCommissionRequest) (*QueryValidatorCommissionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidatorCommission not implemented")
}
func (*UnimplementedQueryServer) ValidatorSlashes(ctx context.Context, req *QueryValidatorSlashesRequest) (*QueryValidatorSlashesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidatorSlashes not implemented")
}
func (*UnimplementedQueryServer) DelegationRewards(ctx context.Context, req *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegationRewards not implemented")
}
func (*UnimplementedQueryServer) DelegationTotalRewards(ctx context.Context, req *QueryDelegationTotalRewardsRequest) (*QueryDelegationTotalRewardsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegationTotalRewards not implemented")
}
func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented")
}
func (*UnimplementedQueryServer) DelegatorWithdrawAddress(ctx context.Context, req *QueryDelegatorWithdrawAddressRequest) (*QueryDelegatorWithdrawAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorWithdrawAddress not implemented")
}
func (*UnimplementedQueryServer) CommunityPool(ctx context.Context, req *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CommunityPool not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidatorOutstandingRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorOutstandingRewardsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidatorOutstandingRewards(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/ValidatorOutstandingRewards",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidatorOutstandingRewards(ctx, req.(*QueryValidatorOutstandingRewardsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidatorCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorCommissionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidatorCommission(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/ValidatorCommission",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidatorCommission(ctx, req.(*QueryValidatorCommissionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidatorSlashes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorSlashesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidatorSlashes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/ValidatorSlashes",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidatorSlashes(ctx, req.(*QueryValidatorSlashesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegationRewardsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegationRewards(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/DelegationRewards",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegationRewards(ctx, req.(*QueryDelegationRewardsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegationTotalRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegationTotalRewardsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegationTotalRewards(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/DelegationTotalRewards",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegationTotalRewards(ctx, req.(*QueryDelegationTotalRewardsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegatorValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegatorValidatorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegatorValidators(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/DelegatorValidators",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegatorValidators(ctx, req.(*QueryDelegatorValidatorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegatorWithdrawAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegatorWithdrawAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegatorWithdrawAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/DelegatorWithdrawAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegatorWithdrawAddress(ctx, req.(*QueryDelegatorWithdrawAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_CommunityPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryCommunityPoolRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).CommunityPool(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.Query/CommunityPool",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).CommunityPool(ctx, req.(*QueryCommunityPoolRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.distribution.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "ValidatorOutstandingRewards",
Handler: _Query_ValidatorOutstandingRewards_Handler,
},
{
MethodName: "ValidatorCommission",
Handler: _Query_ValidatorCommission_Handler,
},
{
MethodName: "ValidatorSlashes",
Handler: _Query_ValidatorSlashes_Handler,
},
{
MethodName: "DelegationRewards",
Handler: _Query_DelegationRewards_Handler,
},
{
MethodName: "DelegationTotalRewards",
Handler: _Query_DelegationTotalRewards_Handler,
},
{
MethodName: "DelegatorValidators",
Handler: _Query_DelegatorValidators_Handler,
},
{
MethodName: "DelegatorWithdrawAddress",
Handler: _Query_DelegatorWithdrawAddress_Handler,
},
{
MethodName: "CommunityPool",
Handler: _Query_CommunityPool_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/distribution/query.proto",
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryValidatorOutstandingRewardsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorOutstandingRewardsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorOutstandingRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddress) > 0 {
i -= len(m.ValidatorAddress)
copy(dAtA[i:], m.ValidatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorOutstandingRewardsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorOutstandingRewardsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorOutstandingRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Rewards.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryValidatorCommissionRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorCommissionRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorCommissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddress) > 0 {
i -= len(m.ValidatorAddress)
copy(dAtA[i:], m.ValidatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorCommissionResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorCommissionResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryValidatorSlashesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorSlashesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorSlashesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Req != nil {
{
size, err := m.Req.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
if m.EndingHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.EndingHeight))
i--
dAtA[i] = 0x18
}
if m.StartingHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.StartingHeight))
i--
dAtA[i] = 0x10
}
if len(m.ValidatorAddress) > 0 {
i -= len(m.ValidatorAddress)
copy(dAtA[i:], m.ValidatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorSlashesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryValidatorSlashesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorSlashesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Res != nil {
{
size, err := m.Res.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Slashes) > 0 {
for iNdEx := len(m.Slashes) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Slashes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryDelegationRewardsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegationRewardsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddress) > 0 {
i -= len(m.ValidatorAddress)
copy(dAtA[i:], m.ValidatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress)))
i--
dAtA[i] = 0x12
}
if len(m.DelegatorAddress) > 0 {
i -= len(m.DelegatorAddress)
copy(dAtA[i:], m.DelegatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegationRewardsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Rewards) > 0 {
for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryDelegationTotalRewardsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegationTotalRewardsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationTotalRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DelegatorAddress) > 0 {
i -= len(m.DelegatorAddress)
copy(dAtA[i:], m.DelegatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegationTotalRewardsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegationTotalRewardsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationTotalRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Total) > 0 {
for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Rewards) > 0 {
for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorValidatorsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegatorValidatorsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DelegatorAddress) > 0 {
i -= len(m.DelegatorAddress)
copy(dAtA[i:], m.DelegatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorValidatorsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegatorValidatorsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Validators) > 0 {
for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Validators[iNdEx])
copy(dAtA[i:], m.Validators[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Validators[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorWithdrawAddressRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegatorWithdrawAddressRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorWithdrawAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DelegatorAddress) > 0 {
i -= len(m.DelegatorAddress)
copy(dAtA[i:], m.DelegatorAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorWithdrawAddressResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryDelegatorWithdrawAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorWithdrawAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.WithdrawAddress) > 0 {
i -= len(m.WithdrawAddress)
copy(dAtA[i:], m.WithdrawAddress)
i = encodeVarintQuery(dAtA, i, uint64(len(m.WithdrawAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryCommunityPoolRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryCommunityPoolRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryCommunityPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryCommunityPoolResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryCommunityPoolResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryCommunityPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Pool) > 0 {
for iNdEx := len(m.Pool) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Pool[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryValidatorOutstandingRewardsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorOutstandingRewardsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Rewards.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryValidatorCommissionRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorCommissionResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Commission.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryValidatorSlashesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.StartingHeight != 0 {
n += 1 + sovQuery(uint64(m.StartingHeight))
}
if m.EndingHeight != 0 {
n += 1 + sovQuery(uint64(m.EndingHeight))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorSlashesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Slashes) > 0 {
for _, e := range m.Slashes {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Res != nil {
l = m.Res.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegationRewardsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ValidatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegationRewardsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Rewards) > 0 {
for _, e := range m.Rewards {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryDelegationTotalRewardsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegationTotalRewardsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Rewards) > 0 {
for _, e := range m.Rewards {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if len(m.Total) > 0 {
for _, e := range m.Total {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryDelegatorValidatorsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegatorValidatorsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Validators) > 0 {
for _, b := range m.Validators {
l = len(b)
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func (m *QueryDelegatorWithdrawAddressRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegatorWithdrawAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.WithdrawAddress)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryCommunityPoolRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryCommunityPoolResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Pool) > 0 {
for _, e := range m.Pool {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorOutstandingRewardsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorOutstandingRewardsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorOutstandingRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddress == nil {
m.ValidatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorOutstandingRewardsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorOutstandingRewardsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorOutstandingRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Rewards.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorCommissionRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorCommissionRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorCommissionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddress == nil {
m.ValidatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorCommissionResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorCommissionResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorCommissionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorSlashesRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorSlashesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorSlashesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddress == nil {
m.ValidatorAddress = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field StartingHeight", wireType)
}
m.StartingHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.StartingHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EndingHeight", wireType)
}
m.EndingHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EndingHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Req", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Req == nil {
m.Req = &query.PageRequest{}
}
if err := m.Req.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidatorSlashesResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryValidatorSlashesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorSlashesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Slashes", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Slashes = append(m.Slashes, ValidatorSlashEvent{})
if err := m.Slashes[len(m.Slashes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Res", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Res == nil {
m.Res = &query.PageResponse{}
}
if err := m.Res.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegationRewardsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddress == nil {
m.DelegatorAddress = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddress == nil {
m.ValidatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegationRewardsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Rewards = append(m.Rewards, types.DecCoin{})
if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegationTotalRewardsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddress == nil {
m.DelegatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegationTotalRewardsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Rewards = append(m.Rewards, DelegationDelegatorReward{})
if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Total = append(m.Total, types.DecCoin{})
if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddress == nil {
m.DelegatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Validators = append(m.Validators, make([]byte, postIndex-iNdEx))
copy(m.Validators[len(m.Validators)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegatorWithdrawAddressRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddress == nil {
m.DelegatorAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDelegatorWithdrawAddressResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.WithdrawAddress = append(m.WithdrawAddress[:0], dAtA[iNdEx:postIndex]...)
if m.WithdrawAddress == nil {
m.WithdrawAddress = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryCommunityPoolRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryCommunityPoolRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryCommunityPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryCommunityPoolResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryCommunityPoolResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryCommunityPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Pool = append(m.Pool, types.DecCoin{})
if err := m.Pool[len(m.Pool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
|
def max_three(a, b, c):
m = max(a, b)
m = max(m, c)
return m |
#!/usr/bin/env sh
# abort on errors
set -e
# build
npm run docs:build
# navigate into the build output directory
cd docs/.vuepress/dist
# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:boldak/<USERNAME>.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f https://github.com/Bogdan-Zinovij/open-data-manage-system.git master:gh-pages
cd -
|
# frozen_string_literal: true
require_relative "query_basic"
##
# Custom query to search events by authority id in :data field in SQL
# @example search with a string property
# FindByEventDataProperty.new(query_service: query_service)
# .find_by_event_data_property(property: pref_label,
# value: 'label')
class FindByEventDataProperty < QueryBasic
# Access the list of methods exposed for the query
# @return [Array<Symbol>] query method signatures
def self.queries
[:find_by_event_data_property]
end
def find_by_event_data_property(property:, value:)
run_query(property, value)
end
private
##
# build the query
# @param property [String] the property the resources
# @param value [String] the value of the property
def query(property, value)
<<-SQL
select * FROM orm_resources WHERE
metadata @> '{"data": [{\"#{property}\": \"#{value}\"}]}'
ORDER BY created_at
SQL
end
##
# Execute the query
# @param property [String] the property the resources
# @param value [String] the value of the property
def run_query(property, value)
@query_service.run_query(query(property, value))
end
end
|
#!/usr/bin/env bash
sbt gatling:test |
#!/bin/bash
helmfile --environment $ENVIRONMENT -f helmfiles/helmfile.cluster.$CLUSTER.yaml repos
helmfile --environment $ENVIRONMENT -f helmfiles/helmfile.cluster.$CLUSTER.yaml charts |
/*
* Copyright 2018 <NAME> (<EMAIL>)
* Copyright 2018 <NAME> (<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.traccar.database;
import org.traccar.Context;
import org.traccar.model.Maintenance;
import org.traccar.model.MaintenanceItem;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class MaintenanceItemsManager extends BaseObjectManager<MaintenanceItem> implements ManagableObjects {
public MaintenanceItemsManager(DataManager dataManager) {
super(dataManager, MaintenanceItem.class);
}
@Override
public Set<Long> getUserItems(long userId) {
if (Context.getPermissionsManager() != null) {
Set<Long> result = new HashSet<>();
return result;
} else {
return new HashSet<>();
}
}
public Set<Long> getUserItems(long userId, Collection<Maintenance> related) {
if (Context.getPermissionsManager() != null) {
Set<Long> result = new HashSet<>();
for (Maintenance maintenance : related) {
List<MaintenanceItem> maintenanceItems = getByRelatedId(maintenance.getId());
for (MaintenanceItem maintenanceItem : maintenanceItems) {
result.add(maintenanceItem.getId());
}
}
return result;
} else {
return new HashSet<>();
}
}
@Override
public Set<Long> getManagedItems(long userId) {
Set<Long> result = new HashSet<>(getUserItems(userId));
for (long managedUserId : Context.getUsersManager().getUserItems(userId)) {
result.addAll(getUserItems(managedUserId));
}
return result;
}
public Set<Long> getManagedItems(long userId, Collection<Maintenance> related) {
Set<Long> result = new HashSet<>(getUserItems(userId));
for (long managedUserId : Context.getUsersManager().getUserItems(userId)) {
result.addAll(getUserItems(managedUserId));
}
return result;
}
}
|
/*
* Copyright 2021 <NAME>.
*
* 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 io.getlime.security.powerauth.app.nextstep.controller;
import io.getlime.core.rest.model.base.request.ObjectRequest;
import io.getlime.core.rest.model.base.response.ObjectResponse;
import io.getlime.security.powerauth.app.nextstep.service.AuthenticationService;
import io.getlime.security.powerauth.lib.nextstep.model.exception.*;
import io.getlime.security.powerauth.lib.nextstep.model.request.CombinedAuthenticationRequest;
import io.getlime.security.powerauth.lib.nextstep.model.request.CredentialAuthenticationRequest;
import io.getlime.security.powerauth.lib.nextstep.model.request.OtpAuthenticationRequest;
import io.getlime.security.powerauth.lib.nextstep.model.response.CombinedAuthenticationResponse;
import io.getlime.security.powerauth.lib.nextstep.model.response.CredentialAuthenticationResponse;
import io.getlime.security.powerauth.lib.nextstep.model.response.OtpAuthenticationResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* REST controller for user authentication.
*
* @author <NAME>, <EMAIL>
*/
@RestController
@RequestMapping("auth")
@Validated
public class AuthenticationController {
private static final Logger logger = LoggerFactory.getLogger(AuthenticationController.class);
private final AuthenticationService authenticationService;
/**
* REST controller constructor.
* @param authenticationService Authentication service.
*/
@Autowired
public AuthenticationController(AuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}
/**
* Authenticate with a credential.
* @param request Credential authentication request.
* @return Credential authentication response.
* @throws InvalidRequestException Thrown when request is invalid.
* @throws UserNotFoundException Thrown when user identity is not found.
* @throws OperationNotFoundException Thrown when operation is not found.
* @throws CredentialNotFoundException Thrown when credential is not found.
* @throws CredentialDefinitionNotFoundException Thrown when credential definition is not found.
* @throws InvalidConfigurationException Thrown when configuration is not found.
* @throws OperationAlreadyFinishedException Thrown when operation is already finished.
* @throws OperationAlreadyCanceledException Thrown when operation is already canceled.
* @throws OperationAlreadyFailedException Thrown when operation is already failed.
* @throws OperationNotValidException Thrown when operation is not valid.
* @throws AuthMethodNotFoundException Thrown when authentication method is not found.
* @throws EncryptionException Thrown when decryption fails.
*/
@Operation(summary = "Authenticate using a credential")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Authentication result sent in response"),
@ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, USER_IDENTITY_NOT_FOUND, OPERATION_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, OPERATION_ALREADY_FAILED, OPERATION_NOT_VALID, AUTH_METHOD_NOT_FOUND, ENCRYPTION_FAILED"),
@ApiResponse(responseCode = "500", description = "Unexpected error")
})
@RequestMapping(value = "credential", method = RequestMethod.POST)
public ObjectResponse<CredentialAuthenticationResponse> authenticateWithCredential(@Valid @RequestBody ObjectRequest<CredentialAuthenticationRequest> request) throws InvalidRequestException, UserNotFoundException, OperationNotFoundException, CredentialNotFoundException, CredentialDefinitionNotFoundException, InvalidConfigurationException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, OperationAlreadyFailedException, OperationNotValidException, AuthMethodNotFoundException, EncryptionException {
logger.info("Received authenticateWithCredential request, user ID: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId());
final CredentialAuthenticationResponse response = authenticationService.authenticateWithCredential(request.getRequestObject());
logger.info("The authenticateWithCredential request succeeded, user ID: {}, operation ID: {}, result: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId(), response.getAuthenticationResult());
return new ObjectResponse<>(response);
}
/**
* Authenticate with an OTP.
* @param request OTP authentication request.
* @return OTP authentication response.
* @throws InvalidRequestException Thrown when request is invalid.
* @throws AuthMethodNotFoundException Thrown when authentication method is not found.
* @throws OperationAlreadyFailedException Thrown when operation is already failed.
* @throws OperationAlreadyFinishedException Thrown when operation is already finished.
* @throws OperationAlreadyCanceledException Thrown when operation is already canceled.
* @throws InvalidConfigurationException Thrown when Next Step configuration is invalid.
* @throws CredentialNotFoundException Thrown when credential is not found.
* @throws OperationNotFoundException Throw when operation is not found.
* @throws OtpNotFoundException Thrown when OTP is not found.
* @throws OperationNotValidException Thrown when operation is not valid.
* @throws EncryptionException Thrown when decryption fails.
*/
@Operation(summary = "Authenticate using an OTP")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Authentication result sent in response"),
@ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, OPERATION_ALREADY_FAILED, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, INVALID_CONFIGURATION, CREDENTIAL_NOT_FOUND, OPERATION_NOT_FOUND, OTP_NOT_FOUND, OPERATION_NOT_VALID, ENCRYPTION_FAILED"),
@ApiResponse(responseCode = "500", description = "Unexpected error")
})
@RequestMapping(value = "otp", method = RequestMethod.POST)
public ObjectResponse<OtpAuthenticationResponse> authenticateWithOtp(@Valid @RequestBody ObjectRequest<OtpAuthenticationRequest> request) throws InvalidRequestException, AuthMethodNotFoundException, OperationAlreadyFailedException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, InvalidConfigurationException, CredentialNotFoundException, OperationNotFoundException, OtpNotFoundException, OperationNotValidException, EncryptionException {
logger.info("Received authenticateWithOtp request, OTP ID: {}, operation ID: {}", request.getRequestObject().getOtpId(), request.getRequestObject().getOperationId());
final OtpAuthenticationResponse response = authenticationService.authenticateWithOtp(request.getRequestObject());
logger.info("The authenticateWithOtp succeeded, OTP ID: {}, operation ID: {}, result: {}", request.getRequestObject().getOtpId(), request.getRequestObject().getOperationId(), response.getAuthenticationResult());
return new ObjectResponse<>(response);
}
/**
* Authenticate with credential and OTP.
* @param request Combined authentication request.
* @return Combined authentication response.
* @throws InvalidRequestException Thrown when request is invalid.
* @throws AuthMethodNotFoundException Thrown when authentication method is not found.
* @throws InvalidConfigurationException Thrown when configuration is invalid.
* @throws UserNotFoundException Thrown when user identity is not found.
* @throws OperationAlreadyFinishedException Thrown when operation is already finished.
* @throws OperationAlreadyCanceledException Thrown when operation is already canceled.
* @throws OperationAlreadyFailedException Thrown when operation is already failed.
* @throws CredentialNotFoundException Thrown when credential is not found.
* @throws OperationNotFoundException Thrown when operation is not found.
* @throws OtpNotFoundException Thrown when OTP is not found.
* @throws OperationNotValidException Thrown when operation is not valid.
* @throws EncryptionException Thrown when decryption fails.
*/
@Operation(summary = "Authenticate using a credential and OTP")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Authentication result sent in response"),
@ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, INVALID_CONFIGURATION, USER_IDENTITY_NOT_FOUND, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, OPERATION_ALREADY_FAILED, CREDENTIAL_NOT_FOUND, OPERATION_NOT_FOUND, OTP_NOT_FOUND, OPERATION_NOT_VALID, ENCRYPTION_FAILED"),
@ApiResponse(responseCode = "500", description = "Unexpected error")
})
@RequestMapping(value = "combined", method = RequestMethod.POST)
public ObjectResponse<CombinedAuthenticationResponse> authenticateCombined(@Valid @RequestBody ObjectRequest<CombinedAuthenticationRequest> request) throws InvalidRequestException, AuthMethodNotFoundException, InvalidConfigurationException, UserNotFoundException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, OperationAlreadyFailedException, CredentialNotFoundException, OperationNotFoundException, OtpNotFoundException, OperationNotValidException, EncryptionException {
logger.info("Received authenticateCombined request, user ID: {}, OTP ID: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId(), request.getRequestObject().getOtpId());
final CombinedAuthenticationResponse response = authenticationService.authenticateCombined(request.getRequestObject());
logger.info("The authenticateCombined request succeeded, user ID: {}, OTP ID: {}, operation ID: {}, result: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId(), request.getRequestObject().getOtpId(), response.getAuthenticationResult());
return new ObjectResponse<>(response);
}
}
|
import mongoose from "mongoose";
import Storecart_items from "../models/cartitems.js";
const StoreCartItemsItems = async (info, req, res) => {
mongoose
.model("cart-" + info.UserId, Storecart_items)
.find({}, async (err, data) => {
if (err) {
res.send({
Result: [],
Status: 500
});
} else {
res.send({
Result: data,
Status: 200
});
}
});
};
const DeleteStoreCartItemsItems = async (info, req, res) => {
mongoose
.model("cart-" + info.UserId, Storecart_items)
.deleteOne({ _id: info.id }, async (err, data) => {
if (err) {
res.send({
Result: [],
Status: 500
});
} else {
res.send({
Result: data,
Status: 200
});
}
});
};
export { StoreCartItemsItems, DeleteStoreCartItemsItems };
|
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) {
String dbUrl = "jdbc:mysql://localhost:3306/video_db";
String username = "your_username";
String password = "your_password";
try (Connection connection = DriverManager.getConnection(dbUrl, username, password)) {
VideoFileManager videoFileManager = new VideoFileManager();
int videoFileId = 123; // Replace with the actual video file ID
String newFilePath = "/path/to/new/video/file.mp4"; // Replace with the new file path
videoFileManager.updateVideoFilePath(connection, newFilePath, videoFileId);
System.out.println("Video file path updated successfully.");
} catch (SQLException e) {
e.printStackTrace();
}
}
} |
#!/bin/sh
php5-fpm
|
#! /bin/sh
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd "$srcdir"
autoreconf -v --install || exit 1
cd "$ORIGDIR" || exit $?
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
git config --local format.subjectPrefix "PATCH libX11"
if test -z "$NOCONFIGURE"; then
exec "$srcdir"/configure "$@"
fi
|
<filename>client/src/boot/applyTransform.js
import Injector from 'lib/Injector';
import ownerAwareUnpublish from 'transforms/FormAction/ownerAwareUnpublish';
import moveTreeDropdownField from 'transforms/TreeDropdownField/moveTreeDropdownField';
const applyTransform = () => {
Injector.transform(
'move-form-disabled',
(updater) => {
updater.component('TreeDropdownField.AssetAdmin.MoveForm', moveTreeDropdownField);
}
);
Injector.transform(
'owner-unpublishing',
(updater) => {
updater.component('FormAction.AssetAdmin.EditForm.action_unpublish', ownerAwareUnpublish);
}
);
};
export default applyTransform;
|
TENANT=$1
HOSTNAME="dba-postgres-prod-32.ist.berkeley.edu port=5307 sslmode=prefer"
#HOSTNAME="dba-postgres-dev-32.ist.berkeley.edu port=5107 sslmode=prefer"
USERNAME="nuxeo_${TENANT}"
DATABASE="${TENANT}_domain_${TENANT}"
CONNECTSTRING="host=$HOSTNAME dbname=$DATABASE password=xxxx"
time psql -U $USERNAME -d "$CONNECTSTRING" -c "select utils.refreshculturehierarchytable();"
time psql -U $USERNAME -d "$CONNECTSTRING" -c "select utils.refreshmaterialhierarchytable();"
time psql -U $USERNAME -d "$CONNECTSTRING" -c "select utils.refreshtaxonhierarchytable();"
time psql -U $USERNAME -d "$CONNECTSTRING" -c "select utils.refreshobjectplacelocationtable();"
|
/* Copyright 2017 <NAME>
*
* 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 de.bitbrain.braingdx.graphics.lighting;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenEquation;
import box2dLight.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Disposable;
import de.bitbrain.braingdx.behavior.BehaviorAdapter;
import de.bitbrain.braingdx.behavior.BehaviorManager;
import de.bitbrain.braingdx.tweens.ColorTween;
import de.bitbrain.braingdx.tweens.PointLight2DTween;
import de.bitbrain.braingdx.tweens.SharedTweenManager;
import de.bitbrain.braingdx.world.GameObject;
public class LightingManagerImpl implements LightingManager, Disposable {
private final RayHandler handler;
private final OrthographicCamera camera;
private final LightFactory lightFactory;
private final BehaviorManager behaviorManager;
private Color ambientLightColor = Color.WHITE.cpy();
private int rays;
private int size;
private boolean disposed = false;
static {
Tween.registerAccessor(PointLight.class, new PointLight2DTween());
}
public LightingManagerImpl(RayHandler rayHandler, BehaviorManager behaviorManager, OrthographicCamera camera) {
this(rayHandler, camera, behaviorManager, new LightFactory() {
@Override
public PointLight newPointLight(RayHandler handler, int rays, Color color, float distance, float x, float y) {
return new PointLight(handler, rays, color, distance, x, y);
}
@Override
public DirectionalLight newDirectionalLight(RayHandler handler, int rays, Color color, float degree) {
return new DirectionalLight(handler, rays, color, degree);
}
@Override
public ChainLight newChainLight(RayHandler handler, int rays, Color color, float distance, int direction,
float... chain) {
return new ChainLight(handler, rays, color, distance, direction, chain);
}
@Override
public ConeLight newConeLight(RayHandler handler, int rays, Color color, float distance, float x, float y,
float directionDegree, float coneDegree) {
return new ConeLight(handler, rays, color, distance, x, y, directionDegree, coneDegree);
}
});
}
public LightingManagerImpl(RayHandler rayHandler, OrthographicCamera camera, BehaviorManager behaviorManager, LightFactory lightFactory) {
this.handler = rayHandler;
this.behaviorManager = behaviorManager;
this.camera = camera;
setConfig(new LightingConfig());
setAmbientLight(Color.WHITE.cpy());
this.lightFactory = lightFactory;
}
@Override
public void setConfig(LightingConfig lightingConfig) {
this.handler.setShadows(lightingConfig.shadows);
this.handler.setBlur(lightingConfig.blur);
this.handler.setCulling(lightingConfig.culling);
RayHandler.setGammaCorrection(lightingConfig.gammaCorrection);
RayHandler.useDiffuseLight(lightingConfig.diffuseLighting);
this.rays = lightingConfig.rays;
}
@Override
public void setAmbientLight(Color ambientLightColor) {
this.ambientLightColor = ambientLightColor.cpy();
}
/**
* Sets a new ambient light with a fading transition.
*/
@Override
public void setAmbientLight(Color color, float interval, TweenEquation equation) {
SharedTweenManager.getInstance().killTarget(ambientLightColor);
Tween.to(ambientLightColor, ColorTween.R, interval)
.target(color.r)
.ease(equation)
.start(SharedTweenManager.getInstance());
Tween.to(ambientLightColor, ColorTween.G, interval)
.target(color.g)
.ease(equation)
.start(SharedTweenManager.getInstance());
Tween.to(ambientLightColor, ColorTween.B, interval)
.target(color.b)
.ease(equation)
.start(SharedTweenManager.getInstance());
Tween.to(ambientLightColor, ColorTween.A, interval)
.target(color.a)
.ease(equation)
.start(SharedTweenManager.getInstance());
}
@Override
public PointLight createPointLight(Vector2 pos, float distance, Color color) {
return createPointLight(pos.x, pos.y, distance, color);
}
@Override
public PointLight createPointLight(float x, float y, float distance, Color color) {
size++;
return lightFactory.newPointLight(handler, rays, color, distance, x, y);
}
@Override
public PointLight createPointLight(float distance, Color color) {
return createPointLight(0f, 0f, distance, color);
}
@Override
public DirectionalLight createDirectionalLight(Color color, float degree) {
size++;
return lightFactory.newDirectionalLight(handler, rays, color, degree);
}
@Override
public ChainLight createChainLight(float distance, int direction, Color color) {
return createChainLight(distance, direction, color);
}
@Override
public ChainLight createChainLight(float distance, int direction, Color color, float... chain) {
size++;
return lightFactory.newChainLight(handler, direction, color, distance, direction, chain);
}
@Override
public ConeLight createConeLight(float distance, float directionDegree, float coneDegree, Color color) {
return createConeLight(0f, 0f, distance, directionDegree, coneDegree, color);
}
@Override
public ConeLight createConeLight(float x, float y, float distance, float directionDegree, float coneDegree,
Color color) {
size++;
return lightFactory.newConeLight(handler, rays, color, distance, x, y, directionDegree, coneDegree);
}
@Override
public ConeLight createConeLight(Vector2 pos, float distance, float directionDegree, float coneDegree, Color color) {
return createConeLight(pos.x, pos.y, distance, directionDegree, coneDegree, color);
}
@Override
public void destroyLight(final Light light) {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
if (light != null) {
light.remove();
size--;
}
}
});
}
@Override
public void clear() {
handler.removeAll();
size = 0;
}
@Override
public void attach(Light light, GameObject object, boolean centered) {
behaviorManager.apply(new LightBehavior(light, centered), object);
}
@Override
public void attach(Light light, GameObject object) {
attach(light, object, 0f, 0f);
}
@Override
public void attach(Light light, GameObject object, float offsetX, float offsetY) {
behaviorManager.apply(new LightBehavior(light, offsetX, offsetY), object);
}
@Override
public int size() {
return size;
}
public void render() {
if (disposed) {
return;
}
handler.renderOnly();
}
public void resize(int width, int height) {
handler.resizeFBO(width, height);
}
@Override
public void dispose() {
if (!disposed) {
handler.dispose();
disposed = true;
}
}
public void beforeRender() {
handler.setAmbientLight(ambientLightColor);
handler.setCombinedMatrix(camera);
handler.update();
handler.prepareRender();
}
public interface LightFactory {
PointLight newPointLight(RayHandler handler, int rays, Color color, float distance, float x, float y);
DirectionalLight newDirectionalLight(RayHandler handler, int rays, Color color, float degree);
ChainLight newChainLight(RayHandler handler, int rays, Color color, float distance, int direction,
float... chain);
ConeLight newConeLight(RayHandler handler, int rays, Color color, float distance, float x, float y,
float directionDegree, float coneDegree);
}
private class LightBehavior extends BehaviorAdapter {
private final Light light;
private final float offsetX, offsetY;
private boolean centered = false;
LightBehavior(Light light, float offsetX, float offsetY) {
this.light = light;
this.offsetX = offsetX;
this.offsetY = offsetY;
}
LightBehavior(Light light, boolean centered) {
this.light = light;
this.offsetX = 0f;
this.offsetY = 0f;
this.centered = centered;
}
@Override
public void onStatusChange(GameObject source, boolean updateable) {
light.setActive(updateable);
}
@Override
public void update(GameObject source, float delta) {
super.update(source, delta);
if (centered) {
light.setPosition(source.getLeft() + source.getOffsetX() + source.getWidth() / 2f,
source.getTop() + source.getOffsetY() + source.getHeight() / 2f);
} else {
light.setPosition(source.getLeft() + source.getOffsetX() + offsetX,
source.getTop() + source.getOffsetY() + offsetY);
}
}
@Override
public void onDetach(GameObject source) {
this.light.remove(true);
}
}
} |
package queue
type ArrayQueue struct {
data []interface{}
cap, length int
}
// 初始化长度为capacity的栈
func NewArrayQueue(capacity int) *ArrayQueue {
if capacity < 1 {
return nil
}
stack := new(ArrayQueue)
stack.data = make([]interface{}, capacity)
stack.cap = capacity
return stack
}
// 查看top元素,但不删除
func (s *ArrayQueue) Peek() interface{} {
if s.Empty() {
return nil
}
return s.data[0]
}
// 出队列
func (s *ArrayQueue) Pop() interface{} {
if s.Empty() {
return nil
}
item := s.data[0]
s.data = s.data[1:]
s.length--
if s.length == s.cap/4 && s.length != 0 { // 1/4时缩容
s.resize(s.cap / 2)
}
return item
}
// 入队列
func (s *ArrayQueue) Push(e interface{}) {
if !s.Empty() && s.length == s.cap { // 不够时扩容成2倍
s.resize(s.cap * 2)
}
s.data[s.length] = e
s.length++
}
// 是否为空
func (s *ArrayQueue) Empty() bool {
return s.length == 0
}
// 如果e在队列上,返回从1开始的索引值(top结点为1)
// 如果e不队列上,返回-1
func (s *ArrayQueue) Search(e interface{}) int {
if s.Empty() {
return -1
}
for i := 0; i < s.length; i++ {
if s.data[i] == e {
return i + 1
}
}
return -1
}
// 扩缩容
func (s *ArrayQueue) resize(capacity int) {
newData := make([]interface{}, capacity)
for i := 0; i < s.length; i++ {
newData[i] = s.data[i]
}
s.data = newData
s.cap = capacity
}
|
<reponame>bhavyaw/connected
import PubSub from "./pubSub"
class Connected extends PubSub {
constructor() {
super()
console.log(this)
}
}
new Connected()
|
#!/bin/bash
#example call: ./init.sh 2 sayee
numServers=$1
user=$2
basedir="/users/$user"
prefix="h"
for ((i=0;i<numServers;i++)); do
echo "*******************************************"
echo "*******************************************"
echo "******************* node-$i ********************"
echo "*******************************************"
echo "*******************************************"
ssh -oStrictHostKeyChecking=no node-$i "sudo apt-get update"
ssh -oStrictHostKeyChecking=no node-$i "sudo apt-get --yes install screen"
ssh -n -f -oStrictHostKeyChecking=no node-$i screen -L -S env1 -dm "$basedir/scripts/env/setup-all.sh $user"
done
sleep 10
sleepcount="0"
for ((i=0;i<numServers;i++));
do
while ssh -oStrictHostKeyChecking=no node-$i "screen -list | grep -q env1"
do
((sleepcount++))
sleep 10
echo "waiting for node-$i "
done
echo "setup-all done for node-$i"
done
echo "init env took $((sleepcount/6)) minutes"
|
public function store(Request $request)
{
// Validate the incoming request data
$validatedData = $request->validate([
'title' => 'required|string|max:255',
'content' => 'required|string',
'category_id' => 'required|exists:categories,id'
]);
// Create a new resource instance with the validated data
$newResource = new News();
$newResource->title = $validatedData['title'];
$newResource->content = $validatedData['content'];
$newResource->category_id = $validatedData['category_id'];
// Save the new resource to the storage
$newResource->save();
// Redirect to a relevant page or return a success response
return redirect()->route('news.index')->with('success', 'Resource created successfully');
} |
def classify_message(message):
if message.find("happy") != -1 or message.find("great") != -1:
return "positive"
elif message.find("do not understand") != -1 or message.find("confused") != -1:
return "negative"
else:
return "neutral" |
#!/bin/bash
fp=/mnt_fp # /p/project/cjinm71/SC_Pipe_jung3/Neuroimage/Tools/freesurfer/subjects
ap=/mnt_ap # /p/project/cjinm71/SC_Pipe_jung3/Neuroimage/Atlas
tp=/mnt_tp # /p/scratch/cjinm71/jung3/03_Structural_Connectivity
atl=HarvardOxford_96Parcels
avg=fsaverage # OUTPUT of mode_labels_HarvOxf_96Parccels_annot_HCP_N351.m function, which makes fsaverage files from 351 annot files.
LUT=${ap}/${atl}_LUT.txt
# Call container_SC_dependencies
# ------------------------------
source /usr/local/bin/container_SC_dependencies.sh
export SUBJECTS_DIR=/opt/freesurfer/subjects
# Colors
# ------
RED='\033[1;31m' # Red
GRN='\033[1;32m' # Green
NCR='\033[0m' # No Color
mris_ca_train -sdir ${fp} -t ${LUT} -n 1 lh lh.sphere.reg HarvardOxford_96Parcels ${avg} ${fp}/lh.HarvardOxford_96Parcels.gcs
mris_ca_train -sdir ${fp} -t ${LUT} -n 1 rh rh.sphere.reg HarvardOxford_96Parcels ${avg} ${fp}/rh.HarvardOxford_96Parcels.gcs
mv ${fp}/lh.HarvardOxford_96Parcels.gcs ${ap}/lh.HarvardOxford_96Parcels.gcs
mv ${fp}/rh.HarvardOxford_96Parcels.gcs ${ap}/rh.HarvardOxford_96Parcels.gcs
printf "${GRN}[Freesurfer]${RED} Classifier ${ap}/xh.HarvardOxford_96Parcels.gcs have been saved.\n"
|
python train_paper_cite.py --data_dir /data/fengmingquan/data --domain _NN --model_dir /data/fengmingquan/output/HGT --conv_name hgt --n_layers 2 --n_epoch 3 --cuda 3 --prior_node_coef 0.1 --prior_relation_coef 0.1 1> out_cite_hgt.txt 2> log_cite_hgt.txt
|
package io.dronefleet.mavlink.uavionix;
import io.dronefleet.mavlink.AbstractMavlinkDialect;
import io.dronefleet.mavlink.MavlinkDialect;
import io.dronefleet.mavlink.common.CommonDialect;
import io.dronefleet.mavlink.util.UnmodifiableMapBuilder;
import java.lang.Class;
import java.lang.Integer;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public final class UavionixDialect extends AbstractMavlinkDialect {
/**
* A list of all of the dependencies of this dialect.
*/
private static final List<MavlinkDialect> dependencies = Arrays.asList(
new CommonDialect());
/**
* A list of all message types supported by this dialect.
*/
private static final Map<Integer, Class> messages = new UnmodifiableMapBuilder<Integer, Class>()
.put(10001, UavionixAdsbOutCfg.class)
.put(10002, UavionixAdsbOutDynamic.class)
.put(10003, UavionixAdsbTransceiverHealthReport.class)
.build();
public UavionixDialect() {
super("uavionix", dependencies, messages);
}
}
|
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2014 wcm.io
* %%
* 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.
* #L%
*/
package io.wcm.handler.link.type;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.adapter.Adaptable;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.WCMMode;
import io.wcm.handler.link.Link;
import io.wcm.handler.link.LinkHandler;
import io.wcm.handler.link.LinkNameConstants;
import io.wcm.handler.link.SyntheticLinkResource;
import io.wcm.handler.link.testcontext.AppAemContext;
import io.wcm.handler.link.testcontext.DummyAppTemplate;
import io.wcm.handler.url.UrlModes;
import io.wcm.handler.url.integrator.IntegratorModes;
import io.wcm.handler.url.integrator.IntegratorNameConstants;
import io.wcm.handler.url.integrator.IntegratorProtocol;
import io.wcm.sling.commons.adapter.AdaptTo;
import io.wcm.sling.commons.resource.ImmutableValueMap;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import io.wcm.wcm.commons.contenttype.FileExtension;
/**
* Test {@link InternalLinkType} methods.
*/
@ExtendWith(AemContextExtension.class)
class InternalLinkTypeTest {
final AemContext context = AppAemContext.newAemContext();
private Page targetPage;
protected Adaptable adaptable() {
return context.request();
}
@BeforeEach
void setUp() throws Exception {
// create current page in site context
context.currentPage(context.create().page("/content/unittest/de_test/brand/de/section/page",
DummyAppTemplate.CONTENT.getTemplatePath()));
// create internal pages for unit tests
targetPage = context.create().page("/content/unittest/de_test/brand/de/section/content",
DummyAppTemplate.CONTENT.getTemplatePath());
}
@Test
void testEmptyLink() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.build());
Link link = linkHandler.get(linkResource).build();
assertFalse(link.isValid(), "link valid");
assertFalse(link.isLinkReferenceInvalid(), "link ref invalid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
}
@Test
void testEmptyLink_EditMode() {
WCMMode.EDIT.toRequest(context.request());
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.build());
Link link = linkHandler.get(linkResource).build();
assertFalse(link.isValid(), "link valid");
assertFalse(link.isLinkReferenceInvalid(), "link ref invalid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
assertTrue(link.getRedirectPages().isEmpty());
}
@Test
void testInvalidLink() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, "/invalid/content/path")
.build());
Link link = linkHandler.get(linkResource).build();
assertFalse(link.isValid(), "link valid");
assertTrue(link.isLinkReferenceInvalid(), "link ref invalid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
assertTrue(link.getRedirectPages().isEmpty());
}
@Test
void testInvalidLink_EditMode() {
if (!(adaptable() instanceof SlingHttpServletRequest)) {
return;
}
WCMMode.EDIT.toRequest(context.request());
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, "/invalid/content/path")
.build());
Link link = linkHandler.get(linkResource).dummyLink(true).build();
assertFalse(link.isValid(), "link valid");
assertTrue(link.isLinkReferenceInvalid(), "link ref invalid");
assertNull(link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
assertEquals(LinkHandler.INVALID_LINK, link.getAnchor().getHRef(), "anchor.href");
}
@Test
void testTargetPage() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.build());
Link link = linkHandler.get(linkResource).build();
assertTrue(link.isValid(), "link valid");
assertFalse(link.isLinkReferenceInvalid(), "link ref invalid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
assertTrue(link.getRedirectPages().isEmpty());
}
@Test
void testStructureElement() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page structureElementPage = context.create().page("/content/unittest/de_test/brand/de/section/structureElement",
DummyAppTemplate.STRUCTURE_ELEMENT.getTemplatePath());
Link link = linkHandler.get(structureElementPage).build();
assertFalse(link.isValid(), "link valid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
}
@Test
void testSecureTargetPage() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page secureTargetPage = context.create().page("/content/unittest/de_test/brand/de/section/contentSecure",
DummyAppTemplate.CONTENT_SECURE.getTemplatePath());
Link link = linkHandler.get(secureTargetPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("https://www.dummysite.org/content/unittest/de_test/brand/de/section/contentSecure.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testRedirectInternal() throws Exception {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page redirectInternalPage = context.create().page("/content/unittest/de_test/brand/de/section/redirectInternal",
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.build());
Link link = linkHandler.get(redirectInternalPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
List<Page> redirectPages = link.getRedirectPages();
assertEquals(1, redirectPages.size());
assertEquals(redirectInternalPage, redirectPages.get(0));
}
@Test
void testRedirectInternal_EditMode() throws Exception {
if (!(adaptable() instanceof SlingHttpServletRequest)) {
return;
}
WCMMode.EDIT.toRequest(context.request());
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page redirectInternalPage = context.create().page("/content/unittest/de_test/brand/de/section/redirectInternal",
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.build());
Link link = linkHandler.get(redirectInternalPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/redirectInternal.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testRedirectRedirectInternal() throws Exception {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page redirectInternalPage = context.create().page("/content/unittest/de_test/brand/de/section/redirectInternal",
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.put(LinkNameConstants.PN_LINK_WINDOW_TARGET, "_blank")
.build());
Page redirectRedirectInternalPage = context.create().page("/content/unittest/de_test/brand/de/section/redirectRedirectInternal",
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, redirectInternalPage.getPath())
.build());
Link link = linkHandler.get(redirectRedirectInternalPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
assertEquals("_blank", link.getAnchor().getTarget(), "target");
List<Page> redirectPages = link.getRedirectPages();
assertEquals(2, redirectPages.size());
assertEquals(redirectRedirectInternalPage, redirectPages.get(0));
assertEquals(redirectInternalPage, redirectPages.get(1));
}
@Test
void testRedirectExternal() throws Exception {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page redirectExternalPage = context.create().page("/content/unittest/de_test/brand/de/section/redirectExternal",
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, ExternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, "http://xyz/abc")
.put(LinkNameConstants.PN_LINK_WINDOW_TARGET, "_blank")
.build());
Link link = linkHandler.get(redirectExternalPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://xyz/abc", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
assertEquals("_blank", link.getAnchor().getTarget(), "target");
}
@Test
void testRedirectCyclic() throws Exception {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
String redirectInternalCyclic1Path = "/content/unittest/de_test/brand/de/section/redirectInternalCyclic1";
String redirectInternalCyclic2Path = "/content/unittest/de_test/brand/de/section/redirectInternalCyclic2";
Page redirectInternalCyclic1Page = context.create().page(redirectInternalCyclic1Path,
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, redirectInternalCyclic2Path)
.build());
Page redirectInternalCyclic2Page = context.create().page(redirectInternalCyclic2Path,
DummyAppTemplate.REDIRECT.getTemplatePath(), ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, redirectInternalCyclic1Path)
.build());
Link link = linkHandler.get(redirectInternalCyclic1Page).build();
assertFalse(link.isValid(), "link valid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
link = linkHandler.get(redirectInternalCyclic2Page).build();
assertFalse(link.isValid(), "link valid");
assertNull(link.getUrl(), "link url");
assertNull(link.getAnchor(), "anchor");
}
@Test
void testIntegrator() throws Exception {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page integratorPage = context.create().page("/content/unittest/de_test/brand/de/section/integrator",
DummyAppTemplate.INTEGRATOR.getTemplatePath(), ImmutableValueMap.builder()
.put(IntegratorNameConstants.PN_INTEGRATOR_MODE, IntegratorModes.SIMPLE.getId())
.put(IntegratorNameConstants.PN_INTEGRATOR_PROTOCOL, IntegratorProtocol.HTTP.name())
.put(LinkNameConstants.PN_LINK_TYPE, ExternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, "http://xyz/app")
.build());
Link link = linkHandler.get(integratorPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://xyz/app", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testIntegrator_EditMode() throws Exception {
if (!(adaptable() instanceof SlingHttpServletRequest)) {
return;
}
WCMMode.EDIT.toRequest(context.request());
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Page integratorPage = context.create().page("/content/unittest/de_test/brand/de/section/integrator",
DummyAppTemplate.INTEGRATOR.getTemplatePath(), ImmutableValueMap.builder()
.put(IntegratorNameConstants.PN_INTEGRATOR_MODE, IntegratorModes.SIMPLE.getId())
.put(IntegratorNameConstants.PN_INTEGRATOR_PROTOCOL, IntegratorProtocol.HTTP.name())
.put(LinkNameConstants.PN_LINK_TYPE, ExternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, "http://xyz/app")
.build());
Link link = linkHandler.get(integratorPage).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/integrator.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageOtherSite() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, "/content/unittest/en_test/brand/en/section/content")
.build());
Link link = linkHandler.get(linkResource).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageLinkUrlVariants() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html",
linkHandler.get(targetPage).buildUrl());
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.sel1.html",
linkHandler.get(targetPage).selectors("sel1").buildUrl());
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.htx",
linkHandler.get(targetPage).extension(FileExtension.HTML_UNCACHED).buildUrl());
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.sel1.htx",
linkHandler.get(targetPage).selectors("sel1").extension(FileExtension.HTML_UNCACHED).buildUrl());
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.sel1.suffix.htx/suf1/suf2.htx",
linkHandler.get(targetPage).selectors("sel1").extension(FileExtension.HTML_UNCACHED).suffix("suf1/suf2").buildUrl());
assertEquals("/content/unittest/de_test/brand/de/section/content.sel1.suffix.htx/suf1/suf2.htx",
linkHandler.get(targetPage).selectors("sel1").extension(FileExtension.HTML_UNCACHED).suffix("suf1/suf2").urlMode(UrlModes.NO_HOSTNAME).buildUrl());
}
@Test
void testTargetPageWithQueryParams_Resource() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.put(LinkNameConstants.PN_LINK_QUERY_PARAM, "p1=abc&p2=def")
.build());
Link link = linkHandler.get(linkResource).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html?p1=abc&p2=def",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageWithFragment_Resource() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.put(LinkNameConstants.PN_LINK_FRAGMENT, "anchor1")
.build());
Link link = linkHandler.get(linkResource).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html#anchor1",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageWithQueryParamsFragment_Resource() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.put(LinkNameConstants.PN_LINK_QUERY_PARAM, "p1=abc&p2=def")
.put(LinkNameConstants.PN_LINK_FRAGMENT, "anchor1")
.build());
Link link = linkHandler.get(linkResource).build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html?p1=abc&p2=def#anchor1",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageWithQueryParamsFragment_LinkArgs() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.build());
Link link = linkHandler.get(linkResource).queryString("p5=abc&p6=xyz").fragment("anchor2").build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html?p5=abc&p6=xyz#anchor2",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testTargetPageWithQueryParamsFragment_LinkArgs_Resource() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
SyntheticLinkResource linkResource = new SyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
ImmutableValueMap.builder()
.put(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID)
.put(LinkNameConstants.PN_LINK_CONTENT_REF, targetPage.getPath())
.put(LinkNameConstants.PN_LINK_QUERY_PARAM, "p1=abc&p2=def")
.put(LinkNameConstants.PN_LINK_FRAGMENT, "anchor1")
.build());
Link link = linkHandler.get(linkResource).queryString("p5=abc&p6=xyz").fragment("anchor2").build();
assertTrue(link.isValid(), "link valid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html?p1=abc&p2=def#anchor1",
link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
@Test
void testGetSyntheticLinkResource() {
Resource resource = InternalLinkType.getSyntheticLinkResource(context.resourceResolver(),
"/content/dummy-path",
"/page/ref");
ValueMap expected = ImmutableValueMap.of(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID,
LinkNameConstants.PN_LINK_CONTENT_REF, "/page/ref");
assertEquals(expected, ImmutableValueMap.copyOf(resource.getValueMap()));
}
@Test
@SuppressWarnings("deprecation")
void testGetSyntheticLinkResource_Deprecated() {
Resource resource = InternalLinkType.getSyntheticLinkResource(context.resourceResolver(),
"/page/ref");
ValueMap expected = ImmutableValueMap.of(LinkNameConstants.PN_LINK_TYPE, InternalLinkType.ID,
LinkNameConstants.PN_LINK_CONTENT_REF, "/page/ref");
assertEquals(expected, ImmutableValueMap.copyOf(resource.getValueMap()));
}
@Test
void testReferenceAutoDetection() {
LinkHandler linkHandler = AdaptTo.notNull(adaptable(), LinkHandler.class);
Link link = linkHandler.get(targetPage.getPath()).build();
assertEquals(InternalLinkType.ID, link.getLinkType().getId());
assertTrue(link.isValid(), "link valid");
assertFalse(link.isLinkReferenceInvalid(), "link ref invalid");
assertEquals("http://www.dummysite.org/content/unittest/de_test/brand/de/section/content.html", link.getUrl(), "link url");
assertNotNull(link.getAnchor(), "anchor");
}
}
|
<gh_stars>0
package com.eje_c.rajawalicardboard;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* Created by iao on 06/10/15.
*/
public class PanoPicker extends Activity implements View.OnClickListener {
public PanoListAdapter panoListAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pano_picker);
panoListAdapter = new PanoListAdapter(this);
ListView panoList = (ListView) findViewById(R.id.mainListView);
panoList.setAdapter(panoListAdapter);
new ProgressTask(getString(R.string.panosurl)).execute();
//new ProgressTask("http://192.168.127.12/panodemo/panolist.php").execute();
}
public void refresh(View v) {
panoListAdapter.refresh();
new ProgressTask(getString(R.string.panosurl)).execute();
//new ProgressTask("http://192.168.127.12/panodemo/panolist.php").execute();
}
@Override
public void onClick(View v) {
File zipfile = new File("/sdcard/PhotoTour/" + v.getTag().toString());
File dir = new File(getFilesDir().getPath() + "/" + v.getTag().toString());
try {
unzip(zipfile, dir);
} catch (IOException e) {
e.printStackTrace();
return;
}
Intent panoview = new Intent(this, MainActivity.class);
panoview.putExtra("dir", dir.getPath());
startActivity(panoview);
}
public static void unzip(File zipFile, File targetDirectory) throws IOException {
ZipInputStream zis = new ZipInputStream(
new BufferedInputStream(new FileInputStream(zipFile)));
try {
ZipEntry ze;
int count;
byte[] buffer = new byte[8192];
while ((ze = zis.getNextEntry()) != null) {
File file = new File(targetDirectory, ze.getName());
File dir = ze.isDirectory() ? file : file.getParentFile();
if (!dir.isDirectory() && !dir.mkdirs())
throw new FileNotFoundException("Failed to ensure directory: " +
dir.getAbsolutePath());
if (ze.isDirectory())
continue;
FileOutputStream fout = new FileOutputStream(file);
try {
while ((count = zis.read(buffer)) != -1)
fout.write(buffer, 0, count);
} finally {
fout.close();
}
/* if time should be restored as well
long time = ze.getTime();
if (time > 0)
file.setLastModified(time);
*/
}
} finally {
zis.close();
}
}
private class ProgressTask extends AsyncTask<String, Void, Boolean> {
private String url;
private ArrayList<PanoSet> panoSets;
private boolean added;
public ProgressTask(String url) {
this.url = url;
panoSets = new ArrayList<>();
}
@Override
protected Boolean doInBackground(String... params) {
JSONArray json;
try {
json = JSONParser.getJSONFromUrl(url);
added = false;
for (int i = 0; i < json.length(); i++) {
try {
JSONObject c = json.getJSONObject(i);
String name = c.getString("name");
String url = c.getString("url").replace(" ", "%20");
long mtime = c.getLong("time");
panoSets.add(new PanoSet(url, name, mtime*1000));
added = true;
Log.d(PanoPicker.this.getLocalClassName(), "Name: " + name + " URL: " + url + " Time: " + mtime);
} catch (JSONException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Boolean result) {
if(added)
panoListAdapter.addAll(panoSets);
panoListAdapter.notifyDataSetChanged();
}
}
} |
#!/bin/sh
touch config.php
chmod 666 config.php
|
//
// NetErrorItem.h
// LiveTest
//
// Created by 任强宾 on 16/9/13.
// Copyright © 2016年 NeiQuan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NetErrorItem : UICollectionViewCell
@end
|
import MessageComponent from './MessageComponent'
import React from 'react'
import RedditManager from './RedditManager';
import {ThreadDataManager} from './ThreadDataManager'
interface ThreadProps {
submissionId: string,
}
export default class Thread extends React.Component<ThreadProps> {
dataManager: ThreadDataManager;
redditManager: RedditManager;
scrollRef: React.Ref<HTMLDivElement>;
constructor(props: ThreadProps) {
super(props);
this.dataManager = new ThreadDataManager();
this.redditManager = new RedditManager(this.dataManager);
this.scrollRef = React.createRef();
}
componentDidMount() {
this.redditManager.fetchPost(this.props.submissionId, () => {
this.dataManager.markReady();
this.forceUpdate();
})
}
getMessageComponents(): Array<React.ReactNode> {
let messageIds = this.dataManager.getRootMessageIds();
return messageIds.map((id) => <MessageComponent key={id} offsetHeight={0} messageId={id} dataManager={this.dataManager}/>)
}
render() {
return (
<div style={{display: 'flex', flexDirection: 'column', width: '90%'}}>
{this.dataManager.isReady() ? this.getMessageComponents() : null}
</div>
);
}
} |
#!/usr/bin/env python3
from PyQt5 import QtCore, QtWidgets
from dsrlib.meta import Meta
from dsrlib.ui.utils import LayoutBuilder
class AboutDialog(QtWidgets.QDialog):
def __init__(self, parent):
super().__init__(parent)
self.setWindowTitle(_('{appname} v{appversion}').format(appname=Meta.appName(), appversion=str(Meta.appVersion())))
iodev = QtCore.QFile(':/about.html')
iodev.open(iodev.ReadOnly)
try:
about = bytes(iodev.readAll()).decode('utf-8')
finally:
iodev.close()
about = about.format(author=Meta.appAuthor())
text = QtWidgets.QTextBrowser(self)
text.setHtml(about)
text.setOpenExternalLinks(True)
btn = QtWidgets.QPushButton(_('Done'), self)
bld = LayoutBuilder(self)
with bld.vbox() as vbox:
vbox.addWidget(text)
with bld.hbox() as buttons:
buttons.addStretch(1)
buttons.addWidget(btn)
btn.clicked.connect(self.accept)
self.resize(800, 600)
|
#!/bin/bash
declare -i DebugLevel=0
Target=/rootfs
[ -d $Target ] || mkdir $Target &> /dev/null
read -p "Input a command: " Command
while [ $Command != 'q' -a $Command != 'Q' ]; do
Command=`which $Command | grep -v "^alias" | grep -o "[^[:space:]]*"`
[ $DebugLevel -eq 1 ] && echo $Command
ComDir=${Command%/*}
[ $DebugLevel -eq 1 ] && echo $ComDir
[ -d ${Target}${ComDir} ] || mkdir -p ${Target}${ComDir}
[ ! -f ${Target}${Command} ] && cp $Command ${Target}${Command} && echo "Copy $Command to $Target finished."
for Lib in `ldd $Command | grep -o "[^[:space:]]*/lib[^[:space:]]*"`; do
LibDir=${Lib%/*}
[ $DebugLevel -eq 1 ] && echo $LibDir
[ -d ${Target}${LibDir} ] || mkdir -p ${Target}${LibDir}
[ ! -f ${Target}${Lib} ] && cp $Lib ${Target}${Lib} && echo "Copy $Lib to $Target finished."
done
read -p "Input a command: " Command
done
|
<gh_stars>0
package com.bcopstein.aplicacao;
import java.util.List;
import com.bcopstein.negocio.entidades.ItemEstoque;
import com.bcopstein.negocio.servicos.ServicoEstoque;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UC_ConsultaEstoque {
private ServicoEstoque servicoEstoque;
@Autowired
public UC_ConsultaEstoque(ServicoEstoque servicoEstoque) {
this.servicoEstoque = servicoEstoque;
}
public List<ItemEstoque> run(){
return this.servicoEstoque.listAll();
}
}
|
def is_panagram(str1):
alphabet = "abcdefghijklmnopqrstuvwxyz"
for char in alphabet:
if char not in str1.lower():
return False
return True |
#!/bin/bash
set -euo pipefail
source ./config.env
# these env variables are used in docker-compose itself so we're exporting them here
export PYROSCOPE_CPUS PYROSCOPE_MEMORY
export DOCKER_BUILDKIT=1
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up \
--build \
--abort-on-container-exit
|
set -e
cd ../demo-service
echo "==> Building demo-service..."
./gradlew clean build
echo "==> Starting demo-service..."
java -jar build/libs/demo-*.jar
cd -
exit
|
import bs4
html_string =
soup = bs4.BeautifulSoup(html_string, 'html.parser')
links = [a['href'] for a in soup.find_all('a', href=True)]
print(links)
# Output: ['www.example.com/link1', 'www.example.com/link2', 'www.example.com/link3'] |
<reponame>jhsware/inferno-popper
import { Component, createPortal } from 'inferno'
import { Children } from './compat'
const noop = () => null
class Travel extends Component {
constructor(props) {
super(props)
this.state = {
portalNode: null,
portalInstance: null
}
}
componentDidMount() {
this._setupPortal()
}
componentDidUpdate() {
this._updatePortal()
}
componentWillUnmount() {
this._destroyPortal()
}
_getRenderToNode() {
const { renderTo } = this.props
if (typeof renderTo === 'string') {
return document.querySelector(renderTo)
} else {
return renderTo || document.body
}
}
_getComponent() {
if (this.props.useArray) {
return Children.toArray(this.props.children)[1]
} else {
return Children.only(this.props.children)
}
}
_setupPortal() {
let { renderTag, onMount } = this.props
// Default props
renderTag = renderTag || 'div'
onMount = onMount || noop
const renderToNode = this._getRenderToNode()
// create a node that we can stick our component in
const portalNode = document.createElement(renderTag)
// append node to the render node
renderToNode.appendChild(portalNode)
// store the instance passed back to allow work to be done on it
const portalInstance = typeof onMount === 'function'
? onMount(portalNode)
: portalNode
this.setState({
portalNode,
portalInstance
})
}
_updatePortal() {
let { id, className, style, onUpdate } = this.props
// Default props
onUpdate = onUpdate || noop
if (id) {
this._portalNode.id = id
}
if (className) {
this._portalNode.className = className
}
if (style) {
Object.keys(style).forEach(key => {
this._portalNode.style[key] = style[key]
})
}
if (typeof onUpdate === 'function') {
this._portalInstance = onUpdate(this._portalInstance)
}
}
_destroyPortal() {
this.state.portalNode.parentNode.removeChild(this._portalNode)
this.setState({
portalNode: null,
portalInstance: null
})
}
render() {
return this.state.portalNode ? createPortal(this._getComponent(), this.state.portalNode) : null;
}
}
export default Travel |
#!/bin/bash
PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel)}
[[ "$1" == "-c" ]] && { rm -rf genesis exodus pg; exit; }
if [ ! -f ./genesis ]; then
curl -sf http://www.gutenberg.org/cache/epub/8001/pg8001.txt > genesis
"$PASH_TOP/scripts/append_nl_if_not.sh" genesis
fi
if [ ! -f ./exodus ]; then
curl -sf http://www.gutenberg.org/cache/epub/8001/pg8001.txt > exodus
"$PASH_TOP/scripts/append_nl_if_not.sh" exodus
fi
if [ ! -e ./pg ]; then
mkdir pg
cd pg
echo 'N.b.: download/extraction will take about 10min'
wget ndr.md/data/pg.tar.xz
if [ $? -ne 0 ]; then
cat <<-'EOF' | sed 's/^ *//'
Downloading input dataset failed, thus need to manually rsync all books from project gutenberg:
rsync -av --del --prune-empty-dirs --include='*.txt' --include='*/' --exclude='*' ftp@ftp.ibiblio.org::gutenberg .
please contact the pash developers pash-devs@googlegroups.com
EOF
exit 1
fi
cat pg.tar.xz | tar -xJ
for f in *.txt; do
"$PASH_TOP/scripts/append_nl_if_not.sh" $f
done
cd ..
fi
|
package com.telenav.osv.manager.network.parser;
import java.util.ArrayList;
import java.util.Currency;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.telenav.osv.item.network.PayRateCoverageInterval;
import com.telenav.osv.item.network.PayRateData;
import com.telenav.osv.item.network.PayRateItem;
import com.telenav.osv.utils.Log;
/**
* Parser which converts the json result of a pay rate info request into a {@link PayRateData} object.
* <p>
* Created by catalinj on 10/18/17.
*/
public class PayRateDataParser extends ApiResponseParser<PayRateData> {
public static final String JSON_NULL = "null";
private static final String TAG = PayRateDataParser.class.getSimpleName();
/**
* key of the object which contains the pay rate data in the json returned from the endpoint.
*/
private static final String PAY_RATES_DATA_CONTAINER = "osv";
/**
* key of the json field which represents the array of pay rates
*/
private static final String KEY_CURRENCY_TYPE = "currency";
/**
* key of the json field in which are stored the pay rates when obd is connected.
*/
private static final String KEY_PAY_RATES_ARRAY = "payrates";
/**
* key of the json field holding the value of a certain pay rate item. the value represents the monetary value a certain
* coverage interval has, in the currency expressed in the current field of the json.
*/
private static final String KEY_PAY_RATE_OBD_VALUE = "obdValue";
/**
* key of the json field holding the value of a certain pay rate item. the value represents the monetary value a certain
* coverage interval has, in the currency expressed in the current field of the json.
*/
private static final String KEY_PAY_RATE_NON_OBD_VALUE = "nonObdValue";
/**
* key of the json field holding the coverage interval of a specific pay rate item.
*/
private static final String KEY_PAY_RATE_COVERAGE_INFO = "coverage";
/**
* key of the field representing the maximum number of passes for which a certain coverage interval applies
*/
private static final String KEY_PAY_RATE_COVERAGE_INFO_MAX_PASS = "maxPass";
/**
* key of the field representing the minimum number of passes for which a certain coverage interval applies
*/
private static final String KEY_PAY_RATE_COVERAGE_MIN_PASS = "minPass";
@Override
public PayRateData getHolder() {
return new PayRateData();
}
@Override
public PayRateData parse(String json) {
PayRateData payRateData = super.parse(json);
if (json != null && !json.isEmpty()) {
String currency;
try {
JSONObject container = new JSONObject(json).getJSONObject(PAY_RATES_DATA_CONTAINER);
currency = container.getString(KEY_CURRENCY_TYPE);
try {
currency = Currency.getInstance(currency).getSymbol();
} catch (IllegalArgumentException ignored) {
Log.d(TAG, "An exception occurred when parsing the pay rate currency. Reverting to value in json.");
}
JSONArray obdPayRatesListContainer = container.getJSONArray(KEY_PAY_RATES_ARRAY);
List<PayRateItem> payRateItems = parsePayRatesListWithKey(obdPayRatesListContainer);
payRateData.setCurrency(currency);
payRateData.setPayRates(payRateItems);
} catch (Exception e) {
Log.d(TAG, "An exception occurred when parsing the pay rates.", e);
}
}
return payRateData;
}
/**
* Given the json array in the parameter, which holds an array of {@link PayRateItem} objects, it parses the json and
* returns the parsed equivalent {@link List}<{@link PayRateItem}>.
* @param payRatesListContainer the {@link JSONArray} which holds the array of {@link PayRateItem}s, as json objects
* @return the parsed list of {@link PayRateItem}
* @throws JSONException if anything bad occurs when parsing
*/
private List<PayRateItem> parsePayRatesListWithKey(JSONArray payRatesListContainer) throws JSONException {
final int payRateItemCount = payRatesListContainer.length();
final List<PayRateItem> payRatesList = new ArrayList<>(payRateItemCount);
for (int i = 0; i < payRateItemCount; i++) {
JSONObject payRateItemJson = payRatesListContainer.getJSONObject(i);
JSONObject coverageJson = payRateItemJson.getJSONObject(KEY_PAY_RATE_COVERAGE_INFO);
int minInterval = Integer.parseInt(coverageJson.getString(KEY_PAY_RATE_COVERAGE_MIN_PASS));
String maxPassString = coverageJson.getString(KEY_PAY_RATE_COVERAGE_INFO_MAX_PASS);
int maxInterval = isNotJsonStringNull(maxPassString) ? Integer.parseInt(maxPassString) : minInterval;
PayRateCoverageInterval payRateCoverageInterval = new PayRateCoverageInterval(minInterval, maxInterval);
float obdCoverageValue = (float) payRateItemJson.getDouble(KEY_PAY_RATE_OBD_VALUE);
float nonObdCoverageValue = (float) payRateItemJson.getDouble(KEY_PAY_RATE_NON_OBD_VALUE);
PayRateItem payRateItem = new PayRateItem(payRateCoverageInterval, obdCoverageValue, nonObdCoverageValue);
payRatesList.add(payRateItem);
}
return payRatesList;
}
private boolean isNotJsonStringNull(String maxPassString) {
return maxPassString != null && !maxPassString.equals(JSON_NULL);
}
}
|
def dict_to_html_table(dictionay):
"""
Builds an HTML table from a dictionary
:param dictionary: the target dictionary
:return: an HTML table
"""
table_html = "<table border='1'>"
table_html += "<tr>"
for key in dictionary.keys():
table_html += "<th>{}</th>".format(key)
table_html += "</tr>"
table_html += "<tr>"
for value in dictionary.values():
table_html += "<td>{}</td>".format(value)
table_html += "</tr>"
table_html += "</table>"
return table_html |
#!/bin/bash
FN="mirbase.db_1.2.0.tar.gz"
URLS=(
"https://bioconductor.org/packages/3.10/data/annotation/src/contrib/mirbase.db_1.2.0.tar.gz"
"https://bioarchive.galaxyproject.org/mirbase.db_1.2.0.tar.gz"
"https://depot.galaxyproject.org/software/bioconductor-mirbase.db/bioconductor-mirbase.db_1.2.0_src_all.tar.gz"
"https://depot.galaxyproject.org/software/bioconductor-mirbase.db/bioconductor-mirbase.db_1.2.0_src_all.tar.gz"
)
MD5="316bc12cee8c2dd9240b7fc30cd1619e"
# Use a staging area in the conda dir rather than temp dirs, both to avoid
# permission issues as well as to have things downloaded in a predictable
# manner.
STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM
mkdir -p $STAGING
TARBALL=$STAGING/$FN
SUCCESS=0
for URL in ${URLS[@]}; do
curl $URL > $TARBALL
[[ $? == 0 ]] || continue
# Platform-specific md5sum checks.
if [[ $(uname -s) == "Linux" ]]; then
if md5sum -c <<<"$MD5 $TARBALL"; then
SUCCESS=1
break
fi
else if [[ $(uname -s) == "Darwin" ]]; then
if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then
SUCCESS=1
break
fi
fi
fi
done
if [[ $SUCCESS != 1 ]]; then
echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:"
printf '%s\n' "${URLS[@]}"
exit 1
fi
# Install and clean up
R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL
rm $TARBALL
rmdir $STAGING
|
_lxsh_map_set() {
printf "%s\n" "$1" | grep -v "^$2\]"
if [ -n "$3" ] ; then
printf "%s]%s\n" "$2" "$3"
fi
}
|
<reponame>librairy/harvester-datosGobEs
package org.librairy.harvester.datosgobes.model;
import org.apache.commons.lang3.StringUtils;
import java.util.StringTokenizer;
/**
* @author <NAME>, Carlos <<EMAIL>>
*/
public class TimeExpression {
String year;
String month;
String day;
// mié, 26 nov 2014 23:00:00 GMT+0000
public TimeExpression(String value){
String[] values = StringUtils.substringAfter(value,",").trim().split(" ");
year = values[2];
month = getMonthNumber(values[1]);
day = values[0];
}
public String getISO8601(){
return year+month+day;
}
private String getMonthNumber(String text){
switch (text.toLowerCase()){
case "ene" : return "00";
case "feb" : return "01";
case "mar" : return "02";
case "abr" : return "03";
case "may" : return "04";
case "jun" : return "05";
case "jul" : return "06";
case "ago" : return "07";
case "sep" : return "08";
case "oct" : return "09";
case "nov" : return "10";
case "dic" : return "11";
default: throw new RuntimeException("Unknown month: " + text);
}
}
public static void main(String[] args) throws Exception {
System.out.println(new TimeExpression("mié, 26 nov 2014 23:00:00 GMT+0000").getISO8601());
}
}
|
<filename>src/__tests__/App.test.js
import renderer from 'react-test-renderer';
import Display from '../components/Display';
import ButtonPanel from '../components/ButtonPanel';
it('renders correctly', () => {
const app = renderer
.create(
<div className="App">
<header>
<h2>
Calculator App built using React
</h2>
<p>
Built by <NAME>
</p>
</header>
<div className="calculator">
<Display />
<ButtonPanel />
</div>
</div>,
)
.toJSON();
expect(app).toMatchSnapshot();
});
|
<filename>ffmpeg_sample/test06_pydub_volume.py<gh_stars>0
print ('pydubでmp3の音量を変更する')
# pydubを使うにはffmpegが必要-
from pydub import AudioSegment
# mp3ファイルの読み込み
audio1 = AudioSegment.from_file("./test_data/test1.mp3", "mp3")
#audio = audio1 +10; #音量を大きくする
audio = audio1 - 7; #音量を小さくする
# エクスポートする
audio.export("./test_data/output06.mp3", format="mp3")
print('Success!')
|
<reponame>leikui/eladmin-plus-study
package me.zhengjie.base;
/**
* Created by jinjin on 2020-09-22.
*/
public interface CommonService<T> {
}
|
SELECT * FROM XAFNFC.FBTB_TXNLOG_MASTER where TXNSTATUS NOT IN ('COM','DIS','REV','FAL') -- AND BRANCHCODE='002'
AND FUNCTIONID NOT IN ('TVCL','TVQR','EODM','LOCH')
ORDER BY BRANCHCODE for update
|
import React from "react";
import axios from "axios";
import Meta from "../components/Meta";
import Navbar from "../components/Navbar";
export default function Helpdesk() {
const send = async () => {
const text = document.getElementById("fi").value;
await axios.get(`/api/email/help-desk?m=${text}`);
window.location.replace("/");
};
return (
<>
<Navbar />
<Meta
title={"Contact our Team"}
desc={"Contact our Team for any bugs or glitches"}
/>
<div
className="content"
style={{ textAlign: "center", fontFamily: "var(--mainfont)" }}
>
<h1>Helpdesk</h1>
<p>If you want to contact our team, type your Message here</p>
<br />
<textarea style={{ height: "300px", width: "80vw" }} id="fi"></textarea>
<br />
<br />
<button className="standardButton" onClick={() => send()}>
Send
</button>
</div>
</>
);
}
|
#!/bin/sh
#
# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
# Creates the necessary Makefiles to build w/ the Makefile.{arch,in} files
DIRS="ldso libc libcrypt libintl libm libnsl libpthread libresolv librt libutil"
if [ ! -f Makerules ] ; then
echo "Run this command in top_srcdir"
exit 1
fi
if [ -z "${USE_CMD}" ] ; then
USE_CMD="cp"
fi
RM="rm -f"
${RM} Makefile
${USE_CMD} extra/scripts/Makefile.libs.lvl0 Makefile
#for x in ${DIRS} ; do
# find ./${x} -name Makefile -exec rm -f {} \;
#done
for x in */Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.libs.lvl1 `dirname ${x}`/Makefile
done
for x in utils/Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.utils.lvl1 `dirname ${x}`/Makefile
done
for x in */*/Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.objs.lvl2 `dirname ${x}`/Makefile
done
# overwrites the earlier ones, we do not add arch specific to libm/arch
for x in ldso/*/Makefile.in libpthread/*/Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.libs.lvl2 `dirname ${x}`/Makefile
done
for x in */*/*/Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.objs.lvl3 `dirname ${x}`/Makefile
done
for x in libc/*/*/Makefile.arch ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.arch.lvl3 `dirname ${x}`/Makefile
done
for x in */*/*/*/Makefile.in ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.objs.lvl4 `dirname ${x}`/Makefile
done
# we do not add these to libpthread/PTNAME/sysdeps/arch
for x in libc/*/*/*/Makefile.arch ; do
${RM} `dirname ${x}`/Makefile
${USE_CMD} extra/scripts/Makefile.arch.lvl4 `dirname ${x}`/Makefile
done
exit 0
|
# Reset
COLOR_OFF='\033[0m' # Text Reset
# Regular Colors
COLOR_BLACK='\033[0;30m' # Black
COLOR_RED='\033[0;31m' # Red
COLOR_GREEN='\033[0;32m' # Green
COLOR_YELLOW='\033[0;33m' # Yellow
COLOR_BLUE='\033[0;34m' # Blue
COLOR_PURPLE='\033[0;35m' # Purple
COLOR_CYAN='\033[0;36m' # Cyan
COLOR_WHITE='\033[0;37m' # White
LOG_ERROR()
{
echo -e -n $COLOR_RED
echo $@
echo -e -n $COLOR_OFF
}
LOG_INFO()
{
echo -e -n $COLOR_YELLOW
echo $@
echo -e -n $COLOR_OFF
}
|
#!/bin/bash
# Run script within the directory
BINDIR=$(dirname "$(readlink -fn "$0")")
cd "${BINDIR}" || exit 2
# Delete old VPKs and folders
rm -f -- *.vpk
rm -rf -- */
for F in ../../config/cfg/presets/*; do
if [ -f "${F}" ]; then
ext=${F##*.}
if [ "${ext}" = cfg ]; then
P=$(basename "${F}" ."${ext}")
mkdir -p mastercomfig-"${P}"-preset/cfg/presets
cp -f ../../config/cfg/presets/*.cfg mastercomfig-"${P}"-preset/cfg/presets
autoexec_file=mastercomfig-"${P}"-preset/cfg/autoexec.cfg
{
printf "exec comfig/define_langs.cfg;"
printf "lang=en;"
printf "exec comfig/define_presets.cfg;"
printf "preset=%s;" "${P}"
printf "exec user/pre_comfig.cfg;"
printf "lang;"
printf "exec comfig/comfig.cfg;"
printf "preset;"
printf "exec comfig/addons_setup.cfg;"
printf "exec comfig/addons.cfg;"
printf "modules_c;"
printf "exec comfig/echo.cfg;"
printf "run_modules;"
printf "exec comfig/addons.cfg;"
printf "autoexec_c;"
printf "exec comfig/finalize.cfg"
} > "${autoexec_file}"
fi
fi
done
# Fill folders with common files
mkdir mastercomfig-common-preset
cp -rf ../../config/mastercomfig/* mastercomfig-common-preset/
. ../common.sh
cleanItems
for D in *; do
if [ -d "${D}" ] && [ "${D}" != mastercomfig-common-preset ]; then
cp -rf mastercomfig-common-preset/* "${D}"
fi
done
rm -rf mastercomfig-common-preset/
# Disable dsp on very low and low
declare -a dsp_off=("very-low" "low")
for P in "${dsp_off[@]}"; do
sed -i "s/ConVar.dsp_off 0/ConVar.dsp_off 1/g" mastercomfig-"${P}"-preset/dxsupport_override.cfg
done
# Hide decals on very low
declare -a decals_depth=("very-low")
for P in "${decals_depth[@]}"; do
sed -i "s/ConVar.mat_slopescaledepthbias_decal -0.5/ConVar.mat_slopescaledepthbias_decal 0.000001/g" mastercomfig-"${P}"-preset/dxsupport_override.cfg
done
packageItems
printf "\n"
|
cd "$(dirname "$0")"
cd ..
# source tokens.sh
source host.sh
APIPATH=/login
URL="$HOST$APIPATH"
curl --data "user_login=fake&pass=fake" ${URL}
curl --data "user_login=DELETED_USER&pass=DELETED_USER" ${URL}
curl --data "user_login=admin&pass=123456" ${URL}
curl --data "user_login=pivan&pass=equalpass" ${URL}
curl --data "user_login=ysergey&pass=equalpass" ${URL}
curl --data "user_login=psergey&pass=psergeypass" ${URL}
curl --data "user_login=vmayakovskiy&pass=vmayakovskiypass" ${URL}
curl --data "user_login=dmoskvin&pass=dmoskvinpass" ${URL} |
public int[] mergeArrays(int[] arr1, int[] arr2) {
int[] mergedArray = new int[arr1.length + arr2.length];
int i = 0;
int j = 0;
int k = 0;
while (i < arr1.length && j < arr2.length) {
if (arr1[i] <= arr2[j]) {
mergedArray[k] = arr1[i];
i++;
} else {
mergedArray[k] = arr2[j];
j++;
}
k++;
}
while (i < arr1.length) {
mergedArray[k] = arr1[i];
i++;
k++;
}
while (j < arr2.length) {
mergedArray[k] = arr2[j];
j++;
k++;
}
return mergedArray;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.