text stringlengths 1 1.05M |
|---|
<reponame>geopm/geopm.github.io<gh_stars>0
var searchData=
[
['runtime',['runtime',['../structgeopm__region__info__s.html#a95539c3912abe1ae80bd19c7e04fccc7',1,'geopm_region_info_s']]]
];
|
<reponame>johnmcconnell/cucumber_generator<gh_stars>1-10
def edited_model_with_login_params
pending
end
def model_with_login
@model_with_login ||= pending
end
def new_model_with_login_params
pending
end
def user_with_model_with_logins
@session_user ||= pending
end
### GIVEN ###
Given(/^I am on the model_with_logins page$/) do
visit(model_with_login_path(model_with_login))
end
Given(/^I have some model_with_logins$/) do
user_with_model_with_logins
end
Given(/^I am on the model_with_logins page$/) do
visit(model_with_logins_path)
end
### WHEN ###
When(/^I destroy one model_with_login$/) do
pending
end
When(/^I edit model_with_login info$/) do
enter_form(edited_model_with_login_params)
end
When(/^I enter new model_with_login info$/) do
enter_form(new_model_with_login_params)
end
### THEN ###
Then(/^I should see the new model_with_login info$/) do
pending
end
Then(/^I should see model_with_logins content$/) do
pending
end
Then(/^I should be on the model_with_logins page$/) do
expect(current_path).to eq(model_with_logins_path)
end
|
<gh_stars>0
declare const NestedReact: any;
export default NestedReact;
export * from 'react-mvx';
import * as PropTypes from 'prop-types';
import subview from './view-element';
export { subview };
import createClass from './createClass';
export { PropTypes, createClass };
export declare function useView(View: any): void;
|
<filename>mongo/tests/mocked_api.py<gh_stars>0
import itertools
import json
import os
from bson import Timestamp, json_util
from mock import MagicMock
from .common import HERE
class MockedCollection(object):
def __init__(self, db_name, coll_name):
self._coll_name = coll_name
self._db_name = db_name
if coll_name == "system.replset":
with open(os.path.join(HERE, "fixtures", "find_one_system_replset"), 'r') as f:
self.find_one = MagicMock(return_value=json.load(f, object_hook=json_util.object_hook))
elif coll_name in ("oplog.rs", "oplog.$main"):
with open(os.path.join(HERE, "fixtures", "oplog_rs_options"), 'r') as f:
self.options = MagicMock(return_value=json.load(f, object_hook=json_util.object_hook))
val1 = [{'ts': Timestamp(1600262019, 1)}]
val2 = [{'ts': Timestamp(1600327624, 8)}]
limit = MagicMock(limit=MagicMock(side_effect=itertools.cycle([val1, val2])))
sort = MagicMock(sort=MagicMock(return_value=limit))
self.find = MagicMock(return_value=sort)
else:
with open(os.path.join(HERE, "fixtures", "indexStats-{}".format(coll_name)), 'r') as f:
self.aggregate = MagicMock(return_value=json.load(f, object_hook=json_util.object_hook))
class MockedDB(object):
def __init__(self, db_name):
self._db_name = db_name
self.current_op = lambda: self.command("current_op")
self._query_count = 0
def __getitem__(self, coll_name):
return MockedCollection(self._db_name, coll_name)
def authenticate(self, *_, **__):
return True
def command(self, command, *args, **_):
filename = command
if command == "dbstats":
filename += "-{}".format(self._db_name)
elif command == "collstats":
coll_name = args[0]
filename += "-{}".format(coll_name)
elif command in ("find", "count", "aggregate"):
# At time of writing, those commands only are for custom queries.
filename = "custom-query-{}".format(self._query_count)
self._query_count += 1
with open(os.path.join(HERE, "fixtures", filename), 'r') as f:
return json.load(f, object_hook=json_util.object_hook)
class MockedPyMongoClient(object):
def __init__(self):
with open(os.path.join(HERE, "fixtures", "server_info"), 'r') as f:
self.server_info = MagicMock(return_value=json.load(f))
with open(os.path.join(HERE, "fixtures", "list_database_names"), 'r') as f:
self.list_database_names = MagicMock(return_value=json.load(f))
def __getitem__(self, db_name):
return MockedDB(db_name)
|
<filename>data-processor/src/main/java/io/micronaut/data/processor/model/criteria/impl/SourcePersistentEntityCriteriaDeleteImpl.java
/*
* Copyright 2017-2021 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.micronaut.data.processor.model.criteria.impl;
import io.micronaut.core.annotation.Internal;
import io.micronaut.data.model.PersistentEntity;
import io.micronaut.data.model.jpa.criteria.impl.AbstractPersistentEntityCriteriaDelete;
import io.micronaut.data.model.jpa.criteria.PersistentEntityRoot;
import io.micronaut.data.processor.model.SourcePersistentEntity;
import io.micronaut.data.processor.model.criteria.SourcePersistentEntityCriteriaDelete;
import io.micronaut.inject.ast.ClassElement;
import java.util.function.Function;
import static io.micronaut.data.model.jpa.criteria.impl.CriteriaUtils.notSupportedOperation;
/**
* The internal source implementation of {@link SourcePersistentEntityCriteriaDelete}.
*
* @param <T> The entity type
* @author <NAME>
* @since 3.2
*/
@Internal
final class SourcePersistentEntityCriteriaDeleteImpl<T> extends AbstractPersistentEntityCriteriaDelete<T>
implements SourcePersistentEntityCriteriaDelete<T> {
private final Function<ClassElement, SourcePersistentEntity> entityResolver;
public SourcePersistentEntityCriteriaDeleteImpl(Function<ClassElement, SourcePersistentEntity> entityResolver, Class<T> root) {
this.entityResolver = entityResolver;
}
@Override
public PersistentEntityRoot<T> from(ClassElement entityClassElement) {
return from(new SourcePersistentEntity(entityClassElement, entityResolver));
}
@Override
public PersistentEntityRoot<T> from(Class<T> entityClass) {
throw notSupportedOperation();
}
@Override
public PersistentEntityRoot<T> from(PersistentEntity persistentEntity) {
if (entityRoot != null) {
throw new IllegalStateException("The root entity is already specified!");
}
SourcePersistentEntityRoot<T> newEntityRoot = new SourcePersistentEntityRoot<>((SourcePersistentEntity) persistentEntity);
entityRoot = newEntityRoot;
return newEntityRoot;
}
}
|
class ProcessManager:
def __init__(self):
self.current_process = None
def start_process(self, p, redirect_to):
self.current_process = p
self.process_output = redirect_to
return p
def kill(self, process=None):
if process is None:
if self.current_process:
self.current_process = None
return True
else:
return False
else:
# Assuming process is a reference to a running process
# Kill the specified process and return True if successful
# Otherwise, return False
# Example: process.kill() or appropriate method to terminate the process
return True # Placeholder for process termination logic |
/*
* Fast car reverse image preview module
*
* Copyright (C) 2015-2018 AllwinnerTech, Inc.
*
* Contacts:
* Zeng.Yajian <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/jiffies.h>
#include <linux/sunxi_tr.h>
#include "include.h"
#include "car_reverse.h"
#include "../../../video/sunxi/disp2/disp/dev_disp.h"
#undef _TRANSFORM_DEBUG
#define BUFFER_CNT (4)
#define BUFFER_MASK (0x03)
#define AUXLAYER_WIDTH (480)
#define AUXLAYER_HEIGHT (854)
#define AUXLAYER_SIZE (AUXLAYER_WIDTH * AUXLAYER_HEIGHT * 4)
struct rect {
int x, y;
int w, h;
};
struct preview_private_data {
struct device *dev;
struct rect src;
struct rect frame;
struct rect screen;
struct disp_layer_config config[2];
int layer_cnt;
int format;
int rotation;
unsigned long tr_handler;
tr_info transform;
struct buffer_pool *disp_buffer;
struct buffer_node *fb[BUFFER_CNT];
#ifdef CONFIG_SUPPORT_AUXILIARY_LINE
struct buffer_pool *auxiliary_line;
struct buffer_node *auxlayer;
#endif
};
/* for auxiliary line */
#ifdef CONFIG_SUPPORT_AUXILIARY_LINE
extern int draw_auxiliary_line(void *base, int width, int height);
int init_auxiliary_line(void);
#endif
/* function from sunxi transform driver */
extern unsigned long sunxi_tr_request(void);
extern int sunxi_tr_release(unsigned long hdl);
extern int sunxi_tr_commit(unsigned long hdl, tr_info *info);
extern int sunxi_tr_set_timeout(unsigned long hdl, unsigned long timeout);
extern int sunxi_tr_query(unsigned long hdl);
/* function from display driver */
extern struct disp_manager *disp_get_layer_manager(u32 disp);
static struct preview_private_data preview;
int preview_output_start(struct preview_params *params)
{
int i;
struct rect perfect;
struct disp_manager *mgr = disp_get_layer_manager(0);
if (!mgr || !mgr->force_set_layer_config) {
logerror("preview init error\n");
return -1;
}
memset(&preview, 0, sizeof(preview));
preview.dev = params->dev;
preview.src.w = params->src_width;
preview.src.h = params->src_height;
preview.format = params->format;
preview.layer_cnt = 1;
if (mgr->device && mgr->device->get_resolution) {
mgr->device->get_resolution(mgr->device, &preview.screen.w, &preview.screen.h);
logdebug("screen size: %dx%d\n", preview.screen.w, preview.screen.h);
} else {
preview.screen.w = 400;
preview.screen.h = 400;
logerror("can't get screen size, use default: %dx%d\n",
preview.screen.w, preview.screen.h);
}
if (params->rotation) {
perfect.w = params->screen_height;
perfect.h = params->screen_width;
} else {
perfect.w = params->screen_width;
perfect.h = params->screen_height;
}
preview.frame.w = (perfect.w > preview.screen.w) ? preview.screen.w : perfect.w;
preview.frame.h = (perfect.h > preview.screen.h) ? preview.screen.h : perfect.h;
preview.frame.x = (preview.screen.w - preview.frame.w) / 2;
preview.frame.y = (preview.screen.h - preview.frame.h) / 2;
if (params->rotation) {
preview.rotation = params->rotation;
preview.tr_handler = sunxi_tr_request();
if (!preview.tr_handler) {
logerror("request transform channel failed\n");
return -1;
}
preview.disp_buffer = alloc_buffer_pool(preview.dev, BUFFER_CNT,
preview.src.w * preview.src.h * 2);
if (!preview.disp_buffer) {
sunxi_tr_release(preview.tr_handler);
logerror("request display buffer failed\n");
return -1;
}
for (i = 0; i < BUFFER_CNT; i++)
preview.fb[i] = preview.disp_buffer->dequeue_buffer(preview.disp_buffer);
}
#ifdef CONFIG_SUPPORT_AUXILIARY_LINE
init_auxiliary_line();
#endif
return 0;
}
#ifdef CONFIG_SUPPORT_AUXILIARY_LINE
int init_auxiliary_line(void)
{
struct disp_layer_config *config;
void *start;
void *end;
preview.auxiliary_line = alloc_buffer_pool(preview.dev, 1, AUXLAYER_SIZE);
if (!preview.auxiliary_line) {
logerror("request auxiliary line buffer failed\n");
return -1;
}
preview.auxlayer = preview.auxiliary_line->dequeue_buffer(preview.auxiliary_line);
if (!preview.auxlayer) {
logerror("no buffer in buffer pool\n");
return -1;
}
memset(preview.auxlayer->vir_address, 0, AUXLAYER_SIZE);
draw_auxiliary_line(preview.auxlayer->vir_address, AUXLAYER_WIDTH, AUXLAYER_HEIGHT);
start = preview.auxlayer->vir_address;
end = (void *)((unsigned long)start + preview.auxlayer->size);
dmac_flush_range(start, end);
config = &preview.config[1];
memset(config, 0, sizeof(struct disp_layer_config));
config->channel = 1;
config->enable = 1;
config->layer_id = 0;
config->info.fb.addr[0] = (unsigned int)preview.auxlayer->phy_address;
config->info.fb.format = DISP_FORMAT_ARGB_8888;
config->info.fb.size[0].width = AUXLAYER_WIDTH;
config->info.fb.size[0].height = AUXLAYER_HEIGHT;
config->info.fb.size[1].width = AUXLAYER_WIDTH;
config->info.fb.size[1].height = AUXLAYER_HEIGHT;
config->info.fb.size[2].width = AUXLAYER_WIDTH;
config->info.fb.size[2].height = AUXLAYER_HEIGHT;
config->info.mode = LAYER_MODE_BUFFER;
config->info.zorder = 1;
config->info.fb.crop.width = (unsigned long long)AUXLAYER_WIDTH << 32;
config->info.fb.crop.height = (unsigned long long)AUXLAYER_HEIGHT << 32;
config->info.alpha_mode = 0; /* pixel alpha */
config->info.alpha_value = 0;
config->info.screen_win.x = preview.frame.x;
config->info.screen_win.y = preview.frame.y;
config->info.screen_win.width = preview.frame.w;
config->info.screen_win.height = preview.frame.h;
preview.layer_cnt++;
return 0;
}
void deinit_auxiliary_line(void)
{
if (preview.auxlayer)
preview.auxiliary_line->queue_buffer(preview.auxiliary_line, preview.auxlayer);
free_buffer_pool(preview.dev, preview.auxiliary_line);
}
#endif
int preview_output_stop(void)
{
int i;
struct disp_manager *mgr = disp_get_layer_manager(0);
if (!mgr || !mgr->force_set_layer_config_exit) {
logerror("preview stop error\n");
return -1;
}
mgr->force_set_layer_config_exit(mgr);
msleep(100);
if (preview.tr_handler)
sunxi_tr_release(preview.tr_handler);
if (preview.disp_buffer) {
for (i = 0; i < BUFFER_CNT; i++) {
if (!preview.fb[i])
continue;
preview.disp_buffer->queue_buffer(preview.disp_buffer, preview.fb[i]);
}
free_buffer_pool(preview.dev, preview.disp_buffer);
}
#ifdef CONFIG_SUPPORT_AUXILIARY_LINE
deinit_auxiliary_line();
#endif
return 0;
}
int image_rotate(struct buffer_node *frame, struct buffer_node **rotate)
{
static int active;
int retval;
struct buffer_node *node;
tr_info *info = &preview.transform;
#ifdef _TRANSFORM_DEBUG
unsigned long start_jiffies;
unsigned long end_jiffies;
unsigned long time;
#endif
active++;
node = preview.fb[active & BUFFER_MASK];
if (!node || !frame) {
logerror("%s, alloc buffer failed\n", __func__);
return -1;
}
info->mode = TR_ROT_90;
info->src_frame.fmt = TR_FORMAT_YUV420_SP_UVUV;
info->src_frame.laddr[0] = (unsigned int)frame->phy_address;
info->src_frame.laddr[1] = (unsigned int)frame->phy_address + preview.src.w * preview.src.h;
info->src_frame.laddr[2] = 0;
info->src_frame.pitch[0] = preview.src.w;
info->src_frame.pitch[1] = preview.src.w / 2;
info->src_frame.pitch[2] = 0;
info->src_frame.height[0] = preview.src.h;
info->src_frame.height[1] = preview.src.h / 2;
info->src_frame.height[2] = 0;
info->src_rect.x = 0;
info->src_rect.y = 0;
info->src_rect.w = preview.src.w;
info->src_rect.h = preview.src.h;
info->dst_frame.fmt = TR_FORMAT_YUV420_P;
info->dst_frame.laddr[0] = (unsigned long)node->phy_address;
info->dst_frame.laddr[1] = (unsigned long)node->phy_address +
preview.src.w * preview.src.h;
info->dst_frame.laddr[2] = (unsigned long)node->phy_address +
preview.src.w * preview.src.h +
preview.src.w * preview.src.h / 4;
info->dst_frame.pitch[0] = preview.src.h;
info->dst_frame.pitch[1] = preview.src.h / 2;
info->dst_frame.pitch[2] = preview.src.h / 2;
info->dst_frame.height[0] = preview.src.w;
info->dst_frame.height[1] = preview.src.w / 2;
info->dst_frame.height[2] = preview.src.w / 2;
info->dst_rect.x = 0;
info->dst_rect.y = 0;
info->dst_rect.w = preview.src.h;
info->dst_rect.h = preview.src.w;
#ifdef _TRANSFORM_DEBUG
start_jiffies = jiffies;
#endif
if (sunxi_tr_commit(preview.tr_handler, info) < 0) {
logerror("transform commit error!\n");
return -1;
}
while (1) {
retval = sunxi_tr_query(preview.tr_handler);
if (retval == 0 || retval == -1)
break;
msleep(1);
}
*rotate = node;
#ifdef _TRANSFORM_DEBUG
end_jiffies = jiffies;
time = jiffies_to_msecs(end_jiffies - start_jiffies);
logerror("TR:%ld ms\n", time);
#endif
return retval;
}
void preview_update(struct buffer_node *frame)
{
struct disp_layer_config *config = &preview.config[0];
struct buffer_node *rotate = NULL;
int buffer_format = preview.format;
int width = preview.src.w;
int height = preview.src.h;
struct disp_manager *mgr = disp_get_layer_manager(0);
if (!mgr || !mgr->force_set_layer_config) {
logerror("preview update error\n");
return;
}
if (preview.rotation && image_rotate(frame, &rotate) == 0) {
if (!rotate) {
logerror("image rotate error\n");
return;
}
buffer_format = V4L2_PIX_FMT_YVU420;
width = preview.src.h;
height = preview.src.w;
}
switch (buffer_format) {
case V4L2_PIX_FMT_NV21:
config->info.fb.format = DISP_FORMAT_YUV420_SP_VUVU;
config->info.fb.addr[0] = (unsigned int)frame->phy_address;
config->info.fb.addr[1] = (unsigned int)frame->phy_address + (width * height);
config->info.fb.addr[2] = 0;
config->info.fb.size[0].width = width;
config->info.fb.size[0].height = height;
config->info.fb.size[1].width = width / 2;
config->info.fb.size[1].height = height / 2;
config->info.fb.size[2].width = 0;
config->info.fb.size[2].height = 0;
config->info.fb.align[1] = 0;
config->info.fb.align[2] = 0;
config->info.fb.crop.width = (unsigned long long)width << 32;
config->info.fb.crop.height = (unsigned long long)height << 32;
config->info.screen_win.x = preview.frame.x;
config->info.screen_win.y = preview.frame.y;
config->info.screen_win.width = preview.frame.w;
config->info.screen_win.height = preview.frame.h;
config->channel = 0;
config->layer_id = 0;
config->enable = 1;
config->info.mode = LAYER_MODE_BUFFER;
config->info.zorder = 12;
config->info.alpha_mode = 1;
config->info.alpha_value = 0xff;
break;
case V4L2_PIX_FMT_YVU420:
config->info.fb.format = DISP_FORMAT_YUV420_P;
config->info.fb.addr[0] = (unsigned int)rotate->phy_address;
config->info.fb.addr[1] = (unsigned int)rotate->phy_address + (width * height) + (width * height / 4);
config->info.fb.addr[2] = (unsigned int)rotate->phy_address + (width * height);
config->info.fb.size[0].width = width;
config->info.fb.size[0].height = height;
config->info.fb.size[1].width = width / 2;
config->info.fb.size[1].height = height / 2;
config->info.fb.size[2].width = width / 2;
config->info.fb.size[2].height = height / 2;
config->info.fb.align[1] = 0;
config->info.fb.align[2] = 0;
config->info.fb.crop.width = (unsigned long long)width << 32;
config->info.fb.crop.height = (unsigned long long)height << 32;
config->info.screen_win.x = preview.frame.x;
config->info.screen_win.y = preview.frame.y;
config->info.screen_win.width = preview.frame.w; /* FIXME */
config->info.screen_win.height = preview.frame.h;
config->channel = 0;
config->layer_id = 0;
config->enable = 1;
config->info.mode = LAYER_MODE_BUFFER;
config->info.zorder = 0;
config->info.alpha_mode = 1;
config->info.alpha_value = 0xff;
break;
default:
logerror("%s: unknown pixel format, skip\n", __func__);
break;
}
mgr->force_set_layer_config(mgr, &preview.config[0], preview.layer_cnt);
}
|
<filename>Quadruped.WebInterface/wwwroot/lib/nipplejs/src/super.js
///////////////////////
/// SUPER CLASS ///
///////////////////////
function Super () {};
// Basic event system.
Super.prototype.on = function (arg, cb) {
var self = this;
var types = arg.split(/[ ,]+/g);
var type;
self._handlers_ = self._handlers_ || {};
for (var i = 0; i < types.length; i += 1) {
type = types[i];
self._handlers_[type] = self._handlers_[type] || [];
self._handlers_[type].push(cb);
}
return self;
};
Super.prototype.off = function (type, cb) {
var self = this;
self._handlers_ = self._handlers_ || {};
if (type === undefined) {
self._handlers_ = {};
} else if (cb === undefined) {
self._handlers_[type] = null;
} else if (self._handlers_[type] &&
self._handlers_[type].indexOf(cb) >= 0) {
self._handlers_[type].splice(self._handlers_[type].indexOf(cb), 1);
}
return self;
};
Super.prototype.trigger = function (arg, data) {
var self = this;
var types = arg.split(/[ ,]+/g);
var type;
self._handlers_ = self._handlers_ || {};
for (var i = 0; i < types.length; i += 1) {
type = types[i];
if (self._handlers_[type] && self._handlers_[type].length) {
self._handlers_[type].forEach(function (handler) {
handler.call(self, {
type: type,
target: self
}, data);
});
}
}
};
// Configuration
Super.prototype.config = function (options) {
var self = this;
self.options = self.defaults || {};
if (options) {
self.options = u.safeExtend(self.options, options);
}
};
// Bind internal events.
Super.prototype.bindEvt = function (el, type) {
var self = this;
self._domHandlers_ = self._domHandlers_ || {};
self._domHandlers_[type] = function () {
if (typeof self['on' + type] === 'function') {
self['on' + type].apply(self, arguments);
} else {
console.warn('[WARNING] : Missing "on' + type + '" handler.');
}
};
u.bindEvt(el, toBind[type], self._domHandlers_[type]);
if (secondBind[type]) {
// Support for both touch and mouse at the same time.
u.bindEvt(el, secondBind[type], self._domHandlers_[type]);
}
return self;
};
// Unbind dom events.
Super.prototype.unbindEvt = function (el, type) {
var self = this;
self._domHandlers_ = self._domHandlers_ || {};
u.unbindEvt(el, toBind[type], self._domHandlers_[type]);
if (secondBind[type]) {
// Support for both touch and mouse at the same time.
u.unbindEvt(el, secondBind[type], self._domHandlers_[type]);
}
delete self._domHandlers_[type];
return this;
};
|
import {OnInit, Service} from '@tsed/common';
import {getInputOutputService} from '../../io/InputOutputServiceFactory';
import {InputOutputServiceInterface, ByteOrder, PinMode} from '../../io/InputOutputServiceInterface';
import {ControlVoltageOutput} from '../../model/ControlVoltageOutput';
import {config} from '../../config';
import {GateOutput} from '../../model/GateOutput';
@Service()
export class InputOutputService implements OnInit {
private io: InputOutputServiceInterface;
async $onInit() {
this.io = await getInputOutputService();
this.io.setup();
this.setupPins();
return this.io;
}
private setupPins() {
if (config.dacOutputChannels > 0) {
this.io.setPinMode(config.dacDataPin, PinMode.OUTPUT);
this.io.setPinMode(config.dacClockPin, PinMode.OUTPUT);
this.io.setPinMode(config.dacLatchPin, PinMode.OUTPUT);
this.io.digitalWrite(config.dacDataPin, false);
this.io.digitalWrite(config.dacClockPin, false);
this.io.digitalWrite(config.dacLatchPin, false);
}
if (config.gateOutputChannels > 0) {
this.io.setPinMode(config.gateDataPin, PinMode.OUTPUT);
this.io.setPinMode(config.gateClockPin, PinMode.OUTPUT);
this.io.setPinMode(config.gateLatchPin, PinMode.OUTPUT);
this.io.digitalWrite(config.gateDataPin, false);
this.io.digitalWrite(config.gateClockPin, false);
this.io.digitalWrite(config.gateLatchPin, false);
}
}
public dacShiftOut(controlVoltages: ControlVoltageOutput[]) {
for (let i = controlVoltages.length - 1; i >= 0; i--) {
const controlVoltage = controlVoltages[i];
// Using native shiftOut is too fast for DAC!!!
// const bytes: number[] = controlVoltage.getBytes();
// this.io.shiftOut(config.dacDataPin, config.dacClockPin, ByteOrder.MSBFIRST, bytes[1]);
// this.io.shiftOut(config.dacDataPin, config.dacClockPin, ByteOrder.MSBFIRST, bytes[0]);
const intValue = controlVoltage.getIntValue();
this.io.shiftOut16(config.dacDataPin, config.dacClockPin, intValue);
}
}
public dacLatch() {
this.io.digitalWrite(config.dacLatchPin, true);
this.io.digitalWrite(config.dacLatchPin, false);
}
public gateShiftOut(gateOutputs: GateOutput[]) {
for (let i = gateOutputs.length - 1; i >= 0; i--) {
const gateOutput = gateOutputs[i];
this.io.digitalWrite(config.gateDataPin, gateOutput.value);
this.io.digitalWrite(config.gateClockPin, true);
this.io.digitalWrite(config.gateClockPin, false);
}
}
public gateLatch() {
this.io.digitalWrite(config.gateLatchPin, true);
this.io.digitalWrite(config.gateLatchPin, false);
}
}
|
module.exports = [new Set()];
|
def exponential_lr_decay(current_step, base_lr, decay_factor, iter_timescale):
"""
Apply exponential learning rate decay based on the number of iterations completed.
Args:
current_step (int): The current iteration step.
base_lr (float): The initial learning rate.
decay_factor (float): The factor by which the learning rate is decayed.
iter_timescale (int): The number of iterations after which the learning rate decay is applied.
Returns:
float: The updated learning rate after applying exponential decay.
"""
n_timescales = current_step // iter_timescale
lr = base_lr * (decay_factor ** n_timescales)
return lr |
<filename>crypt/des/des.cc
//
// Created by <NAME> on 2021/10/20.
//
#include <cstring>
#include "des.h"
// 匿名命名空间, 保存各种 DES 要用到的常量
namespace {
///< 初始置换 IP
constexpr unsigned char kIP[] = {58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7};
///< IP 逆置换表
constexpr unsigned char kIP_1[] = {40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25};
///< 压缩置换 1, 将 64 位密钥压缩为 56 位
constexpr unsigned char kPC_1[] = {57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4};
///< 压缩置换 2, 将 56 位密钥压缩为 48 位
constexpr unsigned char kPC_2[] = {14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32};
///< 密钥每轮左移的位数
constexpr unsigned char kShiftBits[] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
// 轮函数相关设定
///< 扩展置换表,将右 32位数据扩展至 48位
constexpr unsigned char kE[] = {32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1};
///< SBox 8 张 6 到 4 位的压缩置换表
constexpr unsigned char kSBox[8][4][16] = {
{
{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7},
{0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8},
{4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0},
{15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}
},
{
{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10},
{3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5},
{0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15},
{13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}
},
{
{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8},
{13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1},
{13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7},
{1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}
},
{
{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15},
{13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9},
{10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4},
{3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}
},
{
{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9},
{14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6},
{4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14},
{11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}
},
{
{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11},
{10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8},
{9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6},
{4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}
},
{
{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1},
{13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6},
{1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2},
{6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}
},
{
{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7},
{1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2},
{7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8},
{2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}
}
};
///< P置换,32 位到32 位的置换表
constexpr unsigned char kP[] = {16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25};
} // namespace
namespace des {
namespace common {
/**
* @brief 将 8 个字节转换为一个 64 位 bitset
* @param c 字符数组指针
* @return
*/
std::bitset<64> Bytes2Bits(const char *c) {
auto bit_set = std::bitset<64>(0x0);
for (unsigned char i = 0; i < 8; ++i) {
for (unsigned char j = 0; j < 8; ++j) {
(bit_set)[8 * i + j] = ((c[i] >> j) & 0x1);
}
}
return bit_set;
}
/**
* @brief 将一个 28 位的子密钥左移
* @param _k 子密钥
* @param _shift_num 左移位数
* @return 左移后的密钥
*/
std::bitset<28> KeyLeftShift(const std::bitset<28> &_k, const unsigned char &_shift_num) {
auto tmp = std::bitset<28>(_k);
for (unsigned char i = 0; i < 28 - _shift_num; ++i) {
tmp[i + _shift_num] = _k[i];
}
for (unsigned char i = 0, offset = 28 - _shift_num; i < _shift_num; ++i, ++offset) {
tmp[i] = _k[offset];
}
return tmp;
}
/**
* @brief 轮函数
* @param _r 上一轮右 32 位
* @param _k 48 位子密钥
* @return 加密后的 32 位数据
*/
std::bitset<32> RoundFunc(const std::bitset<32> &_r, const std::bitset<48> &_k) {
auto expend_e = std::bitset<48>(0x0); // 存储经过 e 表扩展的数据
// 明文经过扩展置换到 48 位
for (unsigned char i = 0; i < 48; ++i) {
expend_e[i] = _r[kE[i] - 1];
}
// 扩展的明文与密钥进行异或
expend_e = expend_e ^ _k;
auto tmp = std::bitset<32>(0x0); // 暂存 S Box 的输出
// S Box
for (unsigned char i = 0, loc = 0; i < 48; i += 6, loc += 4) {
// 将经过 e 表扩展的数据通过 S Box 进行压缩置换
auto result = std::bitset<4>(
kSBox[i / 6][common::ExpendBin2Dec(expend_e, i + 1, i + 0)][common::ExpendBin2Dec(expend_e,
i + 5,
i + 4,
i + 3,
i + 2)]);
tmp[loc] = result[0];
tmp[loc + 1] = result[1];
tmp[loc + 2] = result[2];
tmp[loc + 3] = result[3];
}
auto output = std::bitset<32>(0x0);
// P 置换
for (unsigned char i = 0; i < 32; ++i) {
output[i] = tmp[kP[i] - 1];
}
return output;
}
} // namespace common
/**
* @brief 初始化密钥
* @details DES 加密算法,密钥 8 位,多余丢弃,不足补 0
* @param _password 8 位密钥
* @return bool
*/
void Des::Init(const std::string &_password) {
char key[8]{0};
memcpy(key, _password.c_str(), _password.size()); // 密码拷贝到 char 数组中,少的为 0
key_ = common::Bytes2Bits(key);
GenSubKey();
}
/**
* @brief 生成 16 个 48 位的子密钥
*/
void Des::GenSubKey() {
auto key_56 = std::bitset<56>(0x0);
// 压缩置换 1, 64 位压缩到 56 位
for (unsigned char i = 0; i < 56; ++i) {
key_56[i] = key_[kPC_1[i] - 1];
}
auto left_key = std::bitset<28>(0x0);
auto right_key = std::bitset<28>(0x0);
// 56 位密钥分为左右两边两个 28 位的密钥
for (unsigned char i = 0; i < 28; ++i) {
left_key[i] = key_56[i + 28];
right_key[i] = key_56[i];
}
auto key_48 = std::bitset<48>(0x0);
// 16 轮
for (unsigned char i = 0; i < 16; ++i) {
// 循环左移
left_key = common::KeyLeftShift(left_key, kShiftBits[i]);
right_key = common::KeyLeftShift(right_key, kShiftBits[i]);
// 拼接
for (unsigned char j = 0; j < 28; ++j) {
key_56[j + 28] = left_key[j];
key_56[j] = right_key[j];
}
// 压缩置换 2, 56 位压缩到 48 位
for (unsigned char j = 0; j < 48; ++j) {
key_48[j] = key_56[kPC_2[j] - 1];
}
sub_keys_[i] = key_48;
}
}
/**
* @brief 加密
* @param _text 明文, 64 位 bitset
* @return 密文, 64 位 bitset
*/
std::bitset<64> Des::Crypt(const std::bitset<64> &_text, bool _is_encrypt = kEncrypt) {
auto temp = std::bitset<64>(0x0);
// 初始 IP 置换
for (unsigned char i = 0; i < 64; ++i) {
temp[i] = _text[kIP[i] - 1];
}
auto left = std::bitset<32>(0x0);
auto right = std::bitset<32>(0x0);
// 分为左半部分和右半部分
for (unsigned char i = 0; i < 32; ++i) {
left[i] = temp[i + 32];
right[i] = temp[i];
}
// 16 次轮函数
if (_is_encrypt) {
// 加密
for (auto &sub_key: sub_keys_) {
auto tmp = right;
right = left ^ common::RoundFunc(right, sub_key);
left = tmp;
}
} else {
// 解密, 密钥逆用
for (unsigned char index = 0; index < 16; ++index) {
auto tmp = right;
right = left ^ common::RoundFunc(right, sub_keys_[15 - index]);
left = tmp;
}
}
// 交换左半部分和右半部分, 并合并
for (unsigned char i = 0; i < 32; ++i) {
temp[i] = left[i];
temp[i + 32] = right[i];
}
auto result = std::bitset<64>(0x0);
// IP 逆置换
for (unsigned char i = 0; i < 64; ++i) {
result[i] = temp[kIP_1[i] - 1];
}
return result;
}
/**
* @brief 加密, 单次加密 8 个字节
* @param _in 输入数据
* @param _out 输出数据
*/
void Des::Encrypt(const void *_in, void *_out) {
char src[8]{0};
memcpy(static_cast<void *>(src), _in, 8);
auto plain_text = common::Bytes2Bits(src);
auto result = Crypt(plain_text, kEncrypt);
memcpy(_out, static_cast<void *>(&result), 8);
}
/**
* @brief 解密, 单次解密 8 个字节
* @param _in 输入数据
* @param _out 输出数据
*/
void Des::Decrypt(const void *_in, void *_out) {
char src[8]{0};
memcpy(static_cast<void *>(src), _in, 8);
auto plain_text = common::Bytes2Bits(src);
auto result = Crypt(plain_text, kDecrypt);
memcpy(_out, static_cast<void *>(&result), 8);
}
} // namespace des |
<reponame>iskraL/cinema-app
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.List;
public class ClientFrame extends JFrame implements WindowListener {
private static final int PORT = 8081;
private JPanel panel;
private ClientSocket clientSocket;
private JComboBox<Object> moviesComboBox;
private JComboBox<Object> seatsComboBox;
private JButton button;
private int id;
public ClientFrame(int id) {
super("IMAX Client " + id);
setId(id);
initializeGui();
initializeActionListeners();
}
private void initializeActionListeners() {
addWindowListener(this);
button.addActionListener(new StartButtonListener(this));
}
private void initializeGui() {
this.panel = new JPanel();
this.panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.panel.setOpaque(true);
this.setContentPane(panel);
this.panel.add(createMoviesPanel());
this.panel.add(createSeatsPanel());
button = new JButton("Buy Ticket");
this.panel.add(button);
this.setBounds(100, 100, 400, 400);
this.setVisible(true);
}
private JPanel createMoviesPanel() {
JPanel panel = new JPanel(new GridLayout(1, 0));
moviesComboBox = new JComboBox<>();
moviesComboBox.addItemListener(e -> {
if (e.getStateChange() != ItemEvent.SELECTED) {
return;
}
Movie movie = (Movie) e.getItem();
ClientFrame.this.showMovie(movie);
});
panel.add(moviesComboBox);
return panel;
}
private JPanel createSeatsPanel() {
JPanel panel = new JPanel(new GridLayout(1, 0));
seatsComboBox= new JComboBox<>();
panel.add(seatsComboBox);
return panel;
}
private void showMovie(Movie movie) {
clientSocket.getSeats(movie.getId());
}
@Override
public void windowOpened(WindowEvent e) {
clientSocket = new ClientSocket(PORT, ClientFrame.this);
clientSocket.loadMovies();
}
@Override
public void windowClosing(WindowEvent e) {
clientSocket.closeSocket();
clientSocket = null;
}
public void setMovies(List<Movie> movies) {
moviesComboBox.removeAllItems();
movies.forEach(moviesComboBox::addItem);
}
public void setSeats(List<Integer> seats) {
seatsComboBox.removeAllItems();
seats.forEach(seatsComboBox::addItem);
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
private class StartButtonListener extends Thread implements ActionListener {
private ClientFrame clientFrame;
StartButtonListener(ClientFrame clientFrame) {
this.clientFrame = clientFrame;
}
@Override
public void run() {
int movieId = ((Movie) moviesComboBox.getSelectedItem()).getId();
int seatNumber = (int) seatsComboBox.getSelectedItem();
clientSocket.buyTicket(movieId, seatNumber);
}
@Override
public void actionPerformed(ActionEvent e) {
// When start button is clicked
this.start();
}
}
}
|
#!/usr/bin/env bats
load test_helper
setup() {
dokku "$PLUGIN_COMMAND_PREFIX:create" ls
}
teardown() {
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" ls
}
@test "($PLUGIN_COMMAND_PREFIX:expose) error when there are no arguments" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose"
assert_contains "${lines[*]}" "Please specify a valid name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:expose) error when service does not exist" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" not_existing_service
assert_contains "${lines[*]}" "service not_existing_service does not exist"
}
@test "($PLUGIN_COMMAND_PREFIX:expose) success when not providing custom ports" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" ls
[[ "${lines[*]}" =~ exposed\ on\ port\(s\)\ \[container\-\>host\]\:\ [[:digit:]]+ ]]
}
@test "($PLUGIN_COMMAND_PREFIX:expose) success when providing custom ports" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" ls 4242
assert_contains "${lines[*]}" "exposed on port(s) [container->host]: 5984->4242"
}
|
package net.lightbody.bmp.proxy;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
import java.io.IOException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assume.assumeThat;
/**
* Tests to exercise blacklist and whitelist functionality
*
* @author <NAME> (<EMAIL>)
*
*/
public class BlackAndWhiteListTest extends DummyServerTest {
/*
* Some tests were hanging when trying to GET un-whitelisted URLs.
* Implementing a timeouts prevents these from blocking a test indefinitely.
*
* Applied to each test, rather with a global Timeout rule, as global
* timeout rule was preventing parent's @After rule from running, and dummy
* server from being shut down.
*/
/**
* Checks that the modified status code is returned for blacklisted URLs,
* but that the original one is returned for URLs that don't match the
* blacklisting pattern.
*/
@Test
public void testStatusCodeIsReturnedOnBlacklist()
throws ClientProtocolException, IOException {
proxy.blacklistRequests(".*a\\.txt.*", 500);
assertThat("Unexpected status code for unblacklisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/b.txt"), is(200));
assertThat("Unexpected status code for blacklisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(500));
}
/**
* Checks that the alternative status is returned for all but whitelisted
* URLs.
*/
@Test
public void testStatusCodeIsReturnedOnWhitelist()
throws ClientProtocolException, IOException {
proxy.whitelistRequests(new String[] { ".*a\\.txt.*", ".*\\.png" }, 500);
assertThat("Unexpected status code for whitelisted URL, first entry",
httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"),
is(not(500)));
assertThat("Unexpected status code for whitelisted URL, second entry",
httpStatusWhenGetting("http://127.0.0.1:8080/c.png"),
is(not(500)));
assertThat("Unexpected status code for un-whitelisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/b.txt"), is(500));
}
/**
* Check that an entry in the blacklist will override the status code
* returned, even if the URL matches a pattern of an entry in the whitelist.
*/
@Test
public void testBlacklistOverridesWhitelist()
throws ClientProtocolException, IOException {
int NON_WHITE_CODE = 500;
int BLACK_CODE_1 = 400;
int BLACK_CODE_2 = 404;
int NORMAL_CODE = 200;
proxy.whitelistRequests(new String[] { ".*\\.txt" }, NON_WHITE_CODE);
proxy.blacklistRequests(".*b\\.txt", BLACK_CODE_1);
proxy.blacklistRequests(".*\\.gz", BLACK_CODE_2);
// whitelisted URL gets normal status code
assertThat("Unexpected status code from whitelisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"),
is(NORMAL_CODE));
// should get normal status as whitelisted, but blacklist kicks in
assertThat("Unexpected status code for blacklisted & whitelisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/b.txt"),
is(BLACK_CODE_1));
// not on the whitelist, so should get NON_WHITE_CODE, but blacklist
// should kick in and prevent that.
assertThat(
"Unexpeced status code for non-whitelisted, blacklisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/a.txt.gz"),
is(BLACK_CODE_2));
// not whitelisted, not blacklisted, so gets non-whitelist code
assertThat("Unexpected status code for un-whitelisted URL",
httpStatusWhenGetting("http://127.0.0.1:8080/c.png"),
is(NON_WHITE_CODE));
}
/**
* Checks that a proxy whitelist can be cleared successfully.
*/
@Test
public void testWhitelistCanBeCleared() throws ClientProtocolException, IOException {
proxy.whitelistRequests(new String[] { ".*\\.txt" }, 500);
// assume that proxy is working before
assumeThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(200));
assumeThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(500));
// clear the whitelist
proxy.clearWhitelist();
// check that no whitelist is in effect
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(200));
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(200));
}
@Test
public void testWhitelistCanBeReplaced() throws ClientProtocolException, IOException {
proxy.whitelistRequests(new String[] { ".*\\.txt" }, 404);
// test that the whitelist is working
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(200));
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(404));
proxy.whitelistRequests(new String[] { ".*\\.png" }, 404);
// check that the new whitelist is working and the old is gone
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(404));
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(200));
}
@Test
public void testEmptyWhitelist() throws ClientProtocolException, IOException {
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(200));
proxy.enableEmptyWhitelist(404);
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(404));
}
@Test
public void testWhitelistIsDisabledByDefault() {
assertFalse("whitelist should be diabled unless explicitly set", proxy.isWhitelistEnabled());
}
/**
* Checks that a proxy blacklist can be cleared successfully.
*/
@Test
public void testBlacklistCanBeCleared() throws ClientProtocolException, IOException {
proxy.blacklistRequests(".*\\.txt", 404);
// assume that proxy is working before
assumeThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(404));
assumeThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(200));
// clear the blacklist
proxy.clearBlacklist();
// check that no blacklist is in effect
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/a.txt"), is(200));
assertThat(httpStatusWhenGetting("http://127.0.0.1:8080/c.png"), is(200));
}
@Test
public void testFacebook() throws IOException {
proxy.blacklistRequests("https?://.*\\.facebook\\.com/.*", 678);
assertThat("Unexpected status code from blacklisted URL",
httpStatusWhenGetting("http://www.facebook.com/something-not-really-there"),
is(678));
}
/**
* Makes a HTTP Get request to the supplied URI, and returns the HTTP status
* code.
* <p>
* Consumes any HTTP response body to prevent subsequent calls from hanging.
*/
protected int httpStatusWhenGetting(String uri)
throws ClientProtocolException, IOException {
HttpResponse response = null;
try {
response = client.execute(new HttpGet(uri));
return response.getStatusLine().getStatusCode();
} finally {
EntityUtils.consumeQuietly(response.getEntity());
}
}
} |
package views
import cats.syntax.all._
import helper.TwirlImports.toHtml
import java.util.UUID
import models.{Area, Authorization, User}
import org.webjars.play.WebJarsUtil
import play.api.mvc.{Flash, RequestHeader}
import play.twirl.api.Html
import scalatags.Text.all._
object applicationsAdmin {
def page(
currentUser: User,
currentUserRights: Authorization.UserRights,
selectedArea: Option[Area],
numOfMonthsDisplayed: Int,
)(implicit
flash: Flash,
request: RequestHeader,
webJarsUtil: WebJarsUtil,
mainInfos: MainInfos
): Html =
views.html.main(currentUser, currentUserRights, maxWidth = false)(
s"Metadonnées des demandes"
)(Nil)(
frag(
areaSelect("applications-area-id", currentUser, selectedArea.getOrElse(Area.allArea).id),
div(
cls := "mdl-cell mdl-cell--3-col",
label(
`for` := "num-of-months-displayed-box",
"Nombre de mois : "
),
input(
`type` := "number",
id := "num-of-months-displayed-box",
cls := "single--width-48px",
name := "num-of-months-displayed-box",
value := numOfMonthsDisplayed.toString
),
),
div(
cls := "mdl-cell mdl-cell--3-col",
a(
id := "applications-download-btn-csv",
href := "#",
i(cls := "fas fa-download"),
" Téléchargement au format CSV"
)
),
div(
cls := "mdl-cell mdl-cell--3-col",
a(
id := "applications-download-btn-xlsx",
href := "#",
i(cls := "fas fa-download"),
" Téléchargement au format XLSX"
)
),
div(cls := "mdl-cell mdl-cell--12-col", id := "tabulator-applications-table"),
)
)(
views.helpers.head.publicScript("generated-js/xlsx.full.min.js")
)
def areaSelect(selectId: String, currentUser: User, selectedAreaId: UUID): Frag =
(currentUser.areas.length > 1).some
.filter(identity)
.map(_ =>
p(
cls := "mdl-cell mdl-cell--3-col",
"Territoire : ",
select(
id := selectId,
name := "area-selector",
frag(
(Area.allArea :: currentUser.areas.flatMap(Area.fromId)).map(area =>
option(
value := area.id.toString,
(area.id === selectedAreaId).some.filter(identity).map(_ => selected),
if (area.id === Area.allArea.id)
"Tous les territoires"
else
area.toString
)
)
)
)
)
)
}
|
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF 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.
#
#set working dir to current location
cd "${0%/*}"
#unzip files for docker image
unzip ../assemblies/web/target/hop.war -d ../assemblies/web/target/webapp
unzip ../assemblies/plugins/dist/target/hop-assemblies-*.zip -d ../assemblies/plugins/dist/target/
#copy recent changes in libraries...
cp ../core/target/hop-core-*SNAPSHOT.jar ../assemblies/web/target/webapp/WEB-INF/lib/
cp ../engine/target/hop-engine-*SNAPSHOT.jar ../assemblies/web/target/webapp/WEB-INF/lib/
cp ../ui/target/hop-ui-*SNAPSHOT.jar ../assemblies/web/target/webapp/WEB-INF/lib/
#build docker image
docker build ../ -f Dockerfile.web -t hop-web
#cleanup
rm -rf ../assemblies/web/target/webapp
rm -rf ../assemblies/plugins/dist/target/plugins
|
#include <iostream>
using namespace std;
int main() {
int correctProvince = 1; // Assume the correct province is San Jose
int guess;
cout << "Welcome to the Costa Rican birthplace guessing game!" << endl;
while (true) {
cout << "Enter the number corresponding to a province (1-7): ";
cin >> guess;
if (guess == correctProvince) {
cout << "Congratulations! The person was born in San Jose." << endl;
break;
} else if (guess >= 1 && guess <= 7) {
cout << "Incorrect guess. Try again!" << endl;
} else {
cout << "Invalid input. Please enter a number between 1 and 7." << endl;
}
}
return 0;
} |
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import Glitch from './Glitch';
class Project extends Component {
render() {
const { start, project, onTransition, onEnd } = this.props;
const { title, description, img } = project;
return (
<div className="flex flex-d-responsive flex-jc-center flex-ai-center w-100 white">
<Glitch
containerId="projectImg"
containerClassName="project_item flex flex-jc-center"
variant="div"
variantClassName="project_img"
glitchType="glitch-img"
data={{
content: "",
style: { backgroundImage: `url(${img || ""})` }
}}
start={start}
onTransition={onTransition}
onEnd={onEnd}
/>
<div className="project_item flex flex-jc-center">
<div className="flex flex-d-col project_info">
<Glitch
containerId="projectTitle"
containerClassName="w-100"
variant="h2"
variantClassName="project_title"
glitchType="glitch-text"
data={{
content: title || "",
style: {}
}}
start={start}
onTransition={onTransition}
onEnd={onEnd}
/>
<div className="project_rectangle" />
<Glitch
containerId="projectDescription"
containerClassName="w-100"
variant="p"
variantClassName="project_description"
glitchType="glitch-text"
data={{
content: description || "",
style: {}
}}
start={start}
onTransition={onTransition}
onEnd={onEnd}
/>
<div className="btn-highlight btn_marginTop" >
<Link to="/projects">
View More
</Link>
</div>
</div>
</div >
</div>
);
}
}
export default Project; |
<reponame>OSWeDev/oswedev<filename>src/vuejsclient/ts/components/dashboard_builder/droppable_vo_fields/DroppableVoFieldsComponent.ts
import Component from 'vue-class-component';
import { Prop, Vue, Watch } from 'vue-property-decorator';
import VOsTypesManager from '../../../../../shared/modules/VOsTypesManager';
import VueComponentBase from '../../VueComponentBase';
import DroppableVoFieldComponent from './field/DroppableVoFieldComponent';
import './DroppableVoFieldsComponent.scss';
import DroppableVoFieldsController from './DroppableVoFieldsController';
import { ModuleDroppableVoFieldsAction, ModuleDroppableVoFieldsGetter } from './DroppableVoFieldsStore';
import DashboardVO from '../../../../../shared/modules/DashboardBuilder/vos/DashboardVO';
@Component({
template: require('./DroppableVoFieldsComponent.pug'),
components: {
Droppablevofieldcomponent: DroppableVoFieldComponent
}
})
export default class DroppableVoFieldsComponent extends VueComponentBase {
@ModuleDroppableVoFieldsGetter
private get_filter_by_field_id_or_api_type_id: string;
@ModuleDroppableVoFieldsAction
private set_filter_by_field_id_or_api_type_id: (filter_by_field_id_or_api_type_id: string) => void;
private filter_value: string = null;
private closed_api_type_id: { [api_type_id: string]: boolean } = {};
@Prop()
private dashboard: DashboardVO;
@ModuleDroppableVoFieldsGetter
private get_selected_fields: { [api_type_id: string]: { [field_id: string]: boolean } };
private switch_open_closed(api_type_id: string) {
Vue.set(this.closed_api_type_id, api_type_id, !this.closed_api_type_id[api_type_id]);
}
@Watch("get_filter_by_field_id_or_api_type_id", { immediate: true })
private onchange_store_filter() {
this.filter_value = this.get_filter_by_field_id_or_api_type_id;
}
private filter_by_field_id_or_api_type_id(event) {
this.set_filter_by_field_id_or_api_type_id(event.srcElement.value);
}
get api_type_ids(): string[] {
let res: string[] = [];
for (let i in this.dashboard.api_type_ids) {
let vo_type = this.dashboard.api_type_ids[i];
if (DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids &&
(typeof DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type] === 'undefined')) {
continue;
}
res.push(vo_type);
}
res.sort();
return res;
}
get fields_ids_by_api_type_ids(): { [api_type_id: string]: string[] } {
let res: { [api_type_id: string]: string[] } = {};
for (let i in this.api_type_ids) {
let vo_type = this.api_type_ids[i];
res[vo_type] = [];
if (DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids &&
(typeof DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type] === 'undefined')) {
// console.log(vo_type + ":" + typeof DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type]);
continue;
}
let fields = VOsTypesManager.getInstance().moduleTables_by_voType[vo_type].get_fields();
res[vo_type].push('id');
for (let j in fields) {
let field = fields[j];
if ((DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids &&
(typeof DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type] === 'undefined')) ||
(DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids &&
DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type] &&
(!DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type][field.field_id]))) {
// console.log(vo_type + ":" + typeof DroppableVoFieldsController.getInstance().visible_fields_and_api_type_ids[vo_type]);
continue;
}
res[vo_type].push(field.field_id);
}
}
return res;
}
get api_type_titles(): { [api_type_id: string]: string } {
let res: { [api_type_id: string]: string } = {};
for (let i in this.api_type_ids) {
let vo_type = this.api_type_ids[i];
res[vo_type] = this.t(VOsTypesManager.getInstance().moduleTables_by_voType[vo_type].label.code_text);
}
return res;
}
get field_titles_by_api_type(): { [api_type_id: string]: { [field_id: string]: string } } {
let res: { [api_type_id: string]: { [field_id: string]: string } } = {};
for (let vo_type in this.fields_ids_by_api_type_ids) {
let fields = this.fields_ids_by_api_type_ids[vo_type];
res[vo_type] = {};
for (let i in fields) {
let field_id = fields[i];
let field = VOsTypesManager.getInstance().moduleTables_by_voType[vo_type].get_field_by_id(field_id);
res[vo_type][field_id] = field ? this.t(field.field_label.code_text) : field_id;
}
}
return res;
}
get has_selected_field(): { [api_type_id: string]: boolean } {
let res: { [api_type_id: string]: boolean } = {};
for (let i in this.api_type_ids) {
let vo_type = this.api_type_ids[i];
let fields = VOsTypesManager.getInstance().moduleTables_by_voType[vo_type].get_fields();
res[vo_type] = false;
for (let j in fields) {
let field = fields[j];
res[vo_type] = res[vo_type] || (this.get_selected_fields && this.get_selected_fields[vo_type] && this.get_selected_fields[vo_type][field.field_id]);
if (res[vo_type]) {
break;
}
}
res[vo_type] = res[vo_type] || (this.get_selected_fields && this.get_selected_fields[vo_type] && this.get_selected_fields[vo_type]['id']);
}
return res;
}
} |
import java.util.HashMap;
import java.util.Map;
public class ConfigurationManager {
private Map<String, Map<String, String>> configurationMap;
public ConfigurationManager() {
configurationMap = new HashMap<>();
}
public void saveConfiguration(String targetComponent, Map<String, String> settings) {
configurationMap.put(targetComponent, settings);
}
public Map<String, String> retrieveConfiguration(String targetComponent) {
return configurationMap.get(targetComponent);
}
public static void main(String[] args) {
ConfigurationManager configManager = new ConfigurationManager();
// Save configuration settings for a target component
Map<String, String> sampleSettings = new HashMap<>();
sampleSettings.put("setting1", "value1");
sampleSettings.put("setting2", "value2");
configManager.saveConfiguration("targetComponent1", sampleSettings);
// Retrieve configuration settings for a target component
Map<String, String> retrievedSettings = configManager.retrieveConfiguration("targetComponent1");
System.out.println("Retrieved settings for targetComponent1: " + retrievedSettings);
}
} |
def validate_license_plate(test_cases):
def calculate_average_confidence(substring, confidence_scores):
total_score = sum(confidence_scores)
average_score = total_score / len(confidence_scores) if len(confidence_scores) > 0 else 0
return average_score
def is_valid_license_plate(license_plate, expected_result, substrings, confidence_scores):
valid_substrings = 0
for start, end in substrings:
average_score = calculate_average_confidence(license_plate[start:end+1], confidence_scores[start:end+1])
if average_score >= 0.01:
valid_substrings += 1
return 1 if valid_substrings >= expected_result else 0
results = []
for test_case in test_cases:
license_plate, expected_result, substrings, confidence_scores = test_case
results.append(is_valid_license_plate(license_plate, expected_result, substrings, confidence_scores))
return results
# Test cases
test_cases = [
("123456789 1234567890 12345679012 123456790123 1234567901234 1234", 5, ((0, 9), (10, 20), (21, 32), (33, 45), (46, 59),), ((0.0, 0.02), (0.0, 0.02), (0.0, 0.02), (0.0, 0.02), (0.0, 0.02),)),
("ABCDEFG ABCDEFGH ABCDEFGHI", 0, (), (),),
("ABCD ABCDEFGHIJ", 0, (), (),),
]
print(validate_license_plate(test_cases)) # Output: [1, 0, 0] |
/* eslint-disable no-undef */
/* eslint-disable no-shadow */
// sc: https://ru.hexlet.io/courses/js-http-server/lessons/data/exercise_unit
// server.js
// Реализуйте создание новой записи в справочнике. Точкой входа будет маршрут POST
// на /users.json. Данные:
// {
// "name": "<name>",
// "phone": "<phone>"
// }
// На стороне сервера необходимо проверять корректность данных (валидировать).
// Пример запроса:
// $ curl -XPOST \
// > -H 'Content-Type: application/json' \
// > --data '{"name":"Bob","phone":"912-114-23-22"}' \
// > localhost:4000/users.json
// {"meta":{"location":"/users/10.json"},
// "data": { "name": "Bob", "phone": "912-114-23-22", "id": 10 }
// }
// В случае успеха должен быть возвращен код ответа 201 (created) и тело:
// {
// "meta": {
// "location": "/users/10.json"
// },
// "data": {
// "name": "Bob",
// "phone": "912-114-23-22",
// "id": 10
// }
// }
// location - адрес по которому можно получить данные этой записи
// id - генерируется с помощью функции nextId и проставляется в запись перед
// добавлением в общий список
// В случае ошибок валидации должен быть возвращен код ответа 422 (unprocessable
// entity) и тело:
// {
// "errors": [
// {
// "source": "name",
// "title" :"bad format"
// },
// {
// "source": "phone",
// "title" :"can't be blank"
// }
// ]
// }
// Количество ошибок и их тип зависит от пришедших данных.
// user.js
// Реализуйте функцию для валидации данных, пришедших из формы, по следующим правилам:
// Имя не может быть пустым
// Имя должно соответствовать шаблону ^[\w\.]+$
// Телефон не может быть пустым
// Функция должна возвращать пустой массив в случае отсутствия ошибок и массив с
// ошибками в случае их наличия. Каждый элемент массива – это объект следующей
// структуры:
// {
// source: <field-name>,
// title: <message>,
// }
// Виды сообщений:
// Если поле пустое: can't be blank
// Если формат не соответствует нужному: bad format
// Flow
// Кроме запуска тестов, обязательно попробуйте "поиграть" с написанным сервером.
// Для этого воспользуйтесь командой make start, которая запускает ваш сервер.
// После этого вы можете делать к нему запросы, используя, например, curl: curl
// localhost:8080. В данном уроке сервер перезапускается автоматически.
// => user.js
let id = 1000;
export const nextId = () => {
id += 1;
return id;
};
export const validate = ({ name, phone }) => {
// BEGIN (write your solution here)
const validateMap = {
empty: (value) => value === undefined || value === '',
badFormat: (value) => /^[\w.]+$/g.test(value) === false,
};
const errorMessages = {
empty: "can't be blank",
badFormat: 'bad format',
};
const errors = [];
const fabricError = (fieldName, message) => ({
source: fieldName,
title: message,
});
if (validateMap.empty(name)) {
errors.push(fabricError('name', errorMessages.empty));
} else if (validateMap.badFormat(name)) {
errors.push(fabricError('name', errorMessages.badFormat));
}
if (validateMap.empty(phone)) {
errors.push(fabricError('phone', errorMessages.empty));
}
return errors;
// END
};
// => server.js
// import http from 'http';
// import url from 'url';
// import querystring from 'querystring';
// import { validate, nextId } from './user';
const getParams = (address) => {
const { query } = url.parse(address);
return querystring.parse(decodeURI(query || ''));
};
const router = {
GET: {
'/': (req, res, matches, body, users) => {
const messages = ['Welcome to The Phonebook', `Records count: ${Object.keys(users).length}`];
res.end(messages.join('\n'));
},
'/search.json': (req, res, matches, body, users) => {
res.setHeader('Content-Type', 'application/json');
const { q = '' } = getParams(req.url);
const normalizedSearch = q.trim().toLowerCase();
const ids = Object.keys(users);
const usersSubset = ids
.filter((id) => users[id].name.toLowerCase().includes(normalizedSearch))
.map((id) => users[id]);
res.end(JSON.stringify({ data: usersSubset }));
},
'/users.json': (req, res, matches, body, users) => {
res.setHeader('Content-Type', 'application/json');
const { page = 1, perPage = 10 } = getParams(req.url);
const ids = Object.keys(users);
const usersSubset = ids.slice(page * perPage - perPage, page * perPage).map((id) => users[id]);
const totalPages = Math.ceil(ids.length / perPage);
res.end(JSON.stringify({ meta: { page, perPage, totalPages }, data: usersSubset }));
},
'/users/(\\w+).json': (req, res, matches, body, users) => {
const id = matches[1];
res.setHeader('Content-Type', 'application/json');
const user = users[id];
if (!user) {
res.writeHead(404);
res.end();
return;
}
res.end(JSON.stringify({ data: user }));
},
},
POST: {
// BEGIN (write your solution here)
'/users.json': (req, res, matches, body, users) => {
res.setHeader('Content-Type', 'application/json');
const dataParsed = JSON.parse(body);
const errors = validate(dataParsed);
if (errors.length !== 0) {
res.writeHead(422); // ошибка валидации
res.end(
JSON.stringify({
errors,
})
);
return;
}
const id = nextId();
const newUser = {
name: dataParsed.name,
phone: dataParsed.phone,
};
users[id] = newUser; // eslint-disable-line
const response = {
meta: {
location: `/users/${id}.json`,
},
data: {
...newUser,
id,
},
};
res.writeHead(201); // запрос выполнен успешно и привёл к созданию ресурса
res.end(JSON.stringify(response));
},
// END
},
};
export default (users) =>
http.createServer((request, response) => {
const body = [];
request
.on('data', (chunk) => body.push(chunk.toString()))
.on('end', () => {
const routes = router[request.method];
const result = Object.keys(routes).find((str) => {
const { pathname } = url.parse(request.url);
if (!pathname) {
return false;
}
const regexp = new RegExp(`^${str}$`);
const matches = pathname.match(regexp);
if (!matches) {
return false;
}
routes[str](request, response, matches, body, users);
return true;
});
if (!result) {
response.writeHead(404);
response.end();
}
});
});
|
#!/bin/sh -e
# System requirements for this script:
# - git >= 2.7.0
# - cmake >= 3.12.0
# - Latest C++ compiler
# Set directories and files
export medyan_root_dir=$(X= cd -- "$(dirname -- "$0")" && pwd -P)
# Run bootstrapping
echo "Bootstrapping..."
$medyan_root_dir/scripts/bootstrap.sh
|
def get_products_by_brand(brand_name):
brand = Brand.query.filter_by(name=brand_name).first()
if brand:
return brand.products.all()
else:
return [] |
from django.db import models
from django.db.models import Q
import datetime
import reportengine
from jsonfield import JSONField
from settings import STALE_REPORT_SECONDS
class AbstractScheduledTask(models.Model):
"""
Base class of scheduled task.
"""
request_made = models.DateTimeField(default=datetime.datetime.now, db_index=True)
completion_timestamp = models.DateTimeField(blank=True, null=True)
token = models.CharField(max_length=255, db_index=True)
task = models.CharField(max_length=128, blank=True)
def get_task_function(self):
raise NotImplementedError
def task_status(self):
if self.task:
func = self.get_task_function()
result = func.AsyncResult(self.task)
return result.state
return None
def schedule_task(self):
func = self.get_task_function()
return func.delay(self.token)
class Meta:
abstract = True
class ReportRequestManager(models.Manager):
"""
The manager for report requests.
"""
def completed(self):
"""
Gets all completed requests.
:return: A queryset of completed requests.
"""
return self.filter(completion_timestamp__isnull=False)
def stale(self):
"""
Gets all stale requests, based on "STALE_REPORT_SECONDS" settings.
:return: A queryset of all outstanding requests older than STALE_REPORT_SECONDS.
"""
cutoff = datetime.datetime.now() - datetime.timedelta(seconds=STALE_REPORT_SECONDS)
return self.filter(completion_timestamp__lte=cutoff).filter(Q(viewed_on__lte=cutoff) | Q(viewed_on__isnull=True))
def cleanup_stale_requests(self):
"""
Deletes all stale requests.
:return: A queryset of deleted requests.
"""
return self.stale().delete()
class ReportRequest(AbstractScheduledTask):
"""
Session based report request. Report request is made, and the token for the request is stored in the session so
only that user can access this report. Task system generates the report and drops it into "content".
When content is no longer null, user sees full report and their session token is cleared.
"""
# TODO consider cleanup (when should this be happening? after the request is made? What about caching? throttling?)
namespace = models.CharField(max_length=255)
slug = models.CharField(max_length=255)
params = JSONField() #GET params
viewed_on = models.DateTimeField(blank=True, null=True)
aggregates = JSONField(datatype=list)
objects = ReportRequestManager()
def get_report(self):
"""
Gets a report object, based on this ReportRequest's slug and namespace.
:return: A subclass of reportengine.Report
"""
return reportengine.get_report(self.namespace, self.slug)()
@models.permalink
def get_absolute_url(self):
"""
This is a URL to a message that either the report is currently being processed, or the report results.
:return: A tuple of reports-request-view, the report token and no keywords.
"""
return ('reports-request-view', [self.token], {})
@models.permalink
def get_report_url(self):
"""
This is a URL to the report constructor view.
:return: A tuple of report-view, and the namespace and slug for the referenced report for this request.
"""
return ('reports-view', [self.namespace, self.slug], {})
def build_report(self):
"""
build_report does this:
fetch the report associated to this report request,
constructs the filter form, based on this report request's params,
get the report's default mask,
updates it with the filters (again from params),
gets the report's results, ordered by the 'order_by' value in params
this then saves every row in the report as a reportrequestrow object.
the aggregates and completion timestamp are stored on this request.
"""
kwargs = self.params
# THis is like 90% the same
#reportengine.autodiscover() ## Populate the reportengine registry
try:
report = self.get_report()
except Exception, err:
raise err
filter_form = report.get_filter_form(kwargs)
if filter_form.fields:
if filter_form.is_valid():
filters = filter_form.cleaned_data
else:
filters = {}
else:
if report.allow_unspecified_filters:
filters = kwargs
else:
filters = {}
# Remove blank filters
for k in filters.keys():
if filters[k] == '':
del filters[k]
## Update the mask and run the report!
mask = report.get_default_mask()
mask.update(filters)
rows, aggregates = report.get_rows(mask, order_by=kwargs.get('order_by',None))
ReportRequestRow.objects.filter(report_request=self).delete()
for index, row in enumerate(rows):
report_row = ReportRequestRow(report_request=self, row_number=index)
report_row.data = row
report_row.save()
self.aggregates = aggregates
self.completion_timestamp = datetime.datetime.now()
self.save()
def get_task_function(self):
from tasks import async_report
return async_report
class ReportRequestRow(models.Model):
"""
Report Request Row holds report result rows for each report request.
The data is stored in a list-typed JSONField.
"""
report_request = models.ForeignKey(ReportRequest, related_name='rows')
row_number = models.PositiveIntegerField()
data = JSONField(datatype=list)
class ReportRequestExport(AbstractScheduledTask):
report_request = models.ForeignKey(ReportRequest, related_name='exports')
format = models.CharField(max_length=10)
#mimetype = models.CharField(max_length=50)
#content_disposition = models.CharField(max_length=200)
payload = models.FileField(upload_to='reportengine/exports/%Y/%m/%d')
def build_report(self):
"""
Builds the export from a previously-run report.
"""
from views import ReportRowQuery
from urllib import urlencode
from django.test.client import RequestFactory
from django.core.files.base import ContentFile
report = self.report_request.get_report()
object_list = ReportRowQuery(self.report_request.rows.all())
kwargs = {'report': report,
'title':report.verbose_name,
'rows':object_list,
'filter_form':report.get_filter_form(data=None),
"aggregates":self.report_request.aggregates,
"cl":None,
'report_request':self.report_request,
"urlparams":urlencode(self.report_request.params)}
outputformat = None
for of in report.output_formats:
if of.slug == self.format:
outputformat = of
response = outputformat.get_response(kwargs, RequestFactory().get('/'))
#TODO this is a hack
filename = response.get('Content-Disposition', '').rsplit('filename=',1)[-1]
if not filename:
filename = u'%s.%s' % (self.token, self.format)
self.payload.save(filename, ContentFile(response.content), False)
self.completion_timestamp = datetime.datetime.now()
self.save()
def get_task_function(self):
from tasks import async_report_export
return async_report_export
|
from django.contrib.auth.models import User
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from friendships.models import Friendship
from utils.memcached_helper import MemcachedHelper
@receiver(post_save, sender=Friendship)
def invalidate_following_cache_on_follow(sender, instance, created, **kwargs):
if created:
follower = instance.follower
following = instance.following
cache_key = f'following_cache_{follower.id}'
MemcachedHelper.invalidate_cache(cache_key)
@receiver(pre_delete, sender=Friendship)
def invalidate_following_cache_on_unfollow(sender, instance, **kwargs):
follower = instance.follower
following = instance.following
cache_key = f'following_cache_{follower.id}'
MemcachedHelper.invalidate_cache(cache_key) |
import { taigaTypes } from "../../constants/action-types";
export const taiga = {
succLogin: data => ({
type: taigaTypes.TAIGA_LOGIN,
payload: data
}),
askLogout: () => ({
type: taigaTypes.TAIGA_LOGOUT
}),
clean: () =>({
type: taigaTypes.TAIGA_CLEAN
}),
setProjects: data => ({
type: taigaTypes.TAIGA_SET_PROJECTS,
payload: data
}),
setStories: data => ({
type: taigaTypes.SET_STORIES,
payload: data
})
}
|
<gh_stars>1-10
package serve
import (
"context"
"net/http"
"github.com/stellar/go/keypair"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/support/http/httpdecode"
"github.com/stellar/go/support/log"
"github.com/stellar/go/support/render/httpjson"
"github.com/stellar/go/txnbuild"
)
type sep8Status string
const (
Sep8StatusRejected sep8Status = "rejected"
)
const (
missingParamErr = "Missing parameter \"tx\"."
invalidParamErr = "Invalid parameter \"tx\"."
internalErrErr = "Internal Error."
invalidSrcAccErr = "The source account is invalid."
unauthorizedOpErr = "There is one or more unauthorized operations in the provided transaction."
notImplementedErr = "Not implemented."
)
type txApproveHandler struct {
issuerKP *keypair.Full
assetCode string
}
type txApproveRequest struct {
Transaction string `json:"tx" form:"tx"`
}
type txApproveResponse struct {
Status sep8Status `json:"status"`
Error string `json:"error"`
}
func NewRejectedTXApproveResponse(errorMessage string) *txApproveResponse {
return &txApproveResponse{
Status: Sep8StatusRejected,
Error: errorMessage,
}
}
func (h txApproveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
in := txApproveRequest{}
err := httpdecode.Decode(r, &in)
if err != nil {
log.Ctx(ctx).Error(errors.Wrap(err, "decoding input parameters"))
httpErr := NewHTTPError(http.StatusBadRequest, "Invalid input parameters")
httpErr.Render(w)
return
}
rejectedResponse, err := h.isRejected(ctx, in)
if err != nil {
httpErr, ok := err.(*httpError)
if !ok {
httpErr = serverError
}
httpErr.Render(w)
return
}
httpjson.RenderStatus(w, http.StatusBadRequest, rejectedResponse, httpjson.JSON)
}
func (h txApproveHandler) isRejected(ctx context.Context, in txApproveRequest) (*txApproveResponse, error) {
if in.Transaction == "" {
return NewRejectedTXApproveResponse(missingParamErr), nil
}
// Decode the request transaction.
parsed, err := txnbuild.TransactionFromXDR(in.Transaction)
if err != nil {
log.Ctx(ctx).Error(errors.Wrapf(err, "Parsing transaction %s failed", in.Transaction))
return NewRejectedTXApproveResponse(invalidParamErr), nil
}
tx, ok := parsed.Transaction()
if !ok {
log.Ctx(ctx).Errorf("Transaction %s is not a simple transaction.", in.Transaction)
return NewRejectedTXApproveResponse(invalidParamErr), nil
}
// Check if transaction's source account is the same as the server issuer account.
if tx.SourceAccount().AccountID == h.issuerKP.Address() {
log.Ctx(ctx).Errorf("Transaction %s sourceAccount is the same as the server issuer account %s",
in.Transaction,
h.issuerKP.Address())
return NewRejectedTXApproveResponse(invalidSrcAccErr), nil
}
// Check if transaction's operation(s)' sourceaccount is the same as the server issuer account.
for _, op := range tx.Operations() {
if op.GetSourceAccount() == h.issuerKP.Address() {
return NewRejectedTXApproveResponse(unauthorizedOpErr), nil
}
}
return NewRejectedTXApproveResponse(notImplementedErr), nil
}
|
<reponame>jeckhummer/wf-constructor
import {connect} from 'react-redux';
import {EditableRulerItem} from "../../dumb/coordinate_plane/EditableRulerItem";
import {EDITOR} from '../../styles';
import {getPhasesDictionary} from "../../selectors/phases";
import {movePhaseLeft, movePhaseRight} from "../../actions/phases";
const mapStateToProps = (state, {id, size}) => {
const item = getPhasesDictionary(state)[id];
return {
vertical: false,
content: item.name,
width: size,
height: EDITOR.CORNER.HEIGHT,
first: item.first,
last: item.last,
};
};
const mapDispatchToProps = (dispatch, {id}) => {
return {
onPrevClick: () => dispatch(movePhaseLeft(id)),
onNextClick: () => dispatch(movePhaseRight(id)),
};
};
export const EditableWorkflowPhaseRulerItem = connect(
mapStateToProps,
mapDispatchToProps
)(EditableRulerItem); |
def find_sum(n):
return (n*(n+1))/2
print(find_sum(10))
# Output:55 |
<gh_stars>1-10
/*
Copyright 2021 The k8gb Contributors.
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.
Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
*/
package dns
import (
"fmt"
"reflect"
"time"
externaldns "sigs.k8s.io/external-dns/endpoint"
"github.com/AbsaOSS/k8gb/controllers/providers/assistant"
k8gbv1beta1 "github.com/AbsaOSS/k8gb/api/v1beta1"
"github.com/AbsaOSS/k8gb/controllers/depresolver"
ibclient "github.com/infobloxopen/infoblox-go-client"
)
type InfobloxProvider struct {
assistant assistant.Assistant
config depresolver.Config
}
func NewInfobloxDNS(config depresolver.Config, assistant assistant.Assistant) *InfobloxProvider {
return &InfobloxProvider{
assistant: assistant,
config: config,
}
}
func (p *InfobloxProvider) sanitizeDelegateZone(local, upstream []ibclient.NameServer) []ibclient.NameServer {
// Drop own records for straight away update
// And ensure local entries are up to date
// And final list is sorted
remote := p.filterOutDelegateTo(upstream, p.config.GetClusterNSName())
remote = p.filterOutDelegateTo(remote, p.config.GetClusterOldNSName())
final := append(local, remote...)
sortZones(final)
return final
}
func (p *InfobloxProvider) CreateZoneDelegationForExternalDNS(gslb *k8gbv1beta1.Gslb) error {
objMgr, err := p.infobloxConnection()
if err != nil {
return err
}
addresses, err := p.assistant.GslbIngressExposedIPs(gslb)
if err != nil {
return err
}
var delegateTo []ibclient.NameServer
for _, address := range addresses {
nameServer := ibclient.NameServer{Address: address, Name: p.config.GetClusterNSName()}
delegateTo = append(delegateTo, nameServer)
}
findZone, err := objMgr.GetZoneDelegated(p.config.DNSZone)
if err != nil {
return err
}
if !p.config.SplitBrainCheck {
log.Info().Msg("Split-brain handling is disabled")
}
if findZone != nil {
err = p.checkZoneDelegated(findZone)
if err != nil {
return err
}
if len(findZone.Ref) > 0 {
sortZones(findZone.DelegateTo)
currentList := p.sanitizeDelegateZone(delegateTo, findZone.DelegateTo)
// Drop external records if they are stale
extClusterHeartbeatFQDNs := p.config.GetExternalClusterHeartbeatFQDNs(gslb.Name)
if p.config.SplitBrainCheck {
for extClusterGeoTag, nsServerNameExt := range p.config.GetExternalClusterNSNames() {
err = p.assistant.InspectTXTThreshold(
extClusterHeartbeatFQDNs[extClusterGeoTag],
time.Second*time.Duration(gslb.Spec.Strategy.SplitBrainThresholdSeconds))
if err != nil {
log.Err(err).Msgf("Got the error from TXT based checkAlive. External cluster (%s) doesn't "+
"look alive, filtering it out from delegated zone configuration...", nsServerNameExt)
currentList = p.filterOutDelegateTo(currentList, nsServerNameExt)
}
}
}
if !reflect.DeepEqual(findZone.DelegateTo, currentList) {
log.Info().Msgf("Found delegated zone records (%v)", findZone.DelegateTo)
log.Info().Msgf("Updating delegated zone(%s) with the server list(%v)", p.config.DNSZone, currentList)
_, err = objMgr.UpdateZoneDelegated(findZone.Ref, currentList)
if err != nil {
return err
}
}
}
} else {
log.Info().Msgf("Creating delegated zone(%s)...", p.config.DNSZone)
sortZones(delegateTo)
log.Debug().Msgf("Delegated records (%v)", delegateTo)
_, err = objMgr.CreateZoneDelegated(p.config.DNSZone, delegateTo)
if err != nil {
return err
}
}
if p.config.SplitBrainCheck {
return p.saveHeartbeatTXTRecord(objMgr, gslb)
}
return nil
}
func (p *InfobloxProvider) Finalize(gslb *k8gbv1beta1.Gslb) error {
objMgr, err := p.infobloxConnection()
if err != nil {
return err
}
findZone, err := objMgr.GetZoneDelegated(p.config.DNSZone)
if err != nil {
return err
}
if findZone != nil {
err = p.checkZoneDelegated(findZone)
if err != nil {
return err
}
if len(findZone.Ref) > 0 {
log.Info().Msgf("Deleting delegated zone(%s)...", p.config.DNSZone)
_, err := objMgr.DeleteZoneDelegated(findZone.Ref)
if err != nil {
return err
}
}
}
heartbeatTXTName := p.config.GetClusterHeartbeatFQDN(gslb.Name)
findTXT, err := objMgr.GetTXTRecord(heartbeatTXTName)
if err != nil {
return err
}
if findTXT != nil {
if len(findTXT.Ref) > 0 {
log.Info().Msgf("Deleting split brain TXT record(%s)...", heartbeatTXTName)
_, err := objMgr.DeleteTXTRecord(findTXT.Ref)
if err != nil {
return err
}
}
}
return nil
}
func (p *InfobloxProvider) GetExternalTargets(host string) (targets []string) {
return p.assistant.GetExternalTargets(host, p.config.GetExternalClusterNSNames())
}
func (p *InfobloxProvider) GslbIngressExposedIPs(gslb *k8gbv1beta1.Gslb) ([]string, error) {
return p.assistant.GslbIngressExposedIPs(gslb)
}
func (p *InfobloxProvider) SaveDNSEndpoint(gslb *k8gbv1beta1.Gslb, i *externaldns.DNSEndpoint) error {
return p.assistant.SaveDNSEndpoint(gslb.Namespace, i)
}
func (p *InfobloxProvider) String() string {
return "Infoblox"
}
func (p *InfobloxProvider) saveHeartbeatTXTRecord(objMgr *ibclient.ObjectManager, gslb *k8gbv1beta1.Gslb) (err error) {
var heartbeatTXTRecord *ibclient.RecordTXT
edgeTimestamp := fmt.Sprint(time.Now().UTC().Format("2006-01-02T15:04:05"))
heartbeatTXTName := p.config.GetClusterHeartbeatFQDN(gslb.Name)
heartbeatTXTRecord, err = objMgr.GetTXTRecord(heartbeatTXTName)
if err != nil {
return
}
if heartbeatTXTRecord == nil {
log.Info().Str("HeartbeatTXTName", heartbeatTXTName).Msg("Creating split brain TXT record")
_, err = objMgr.CreateTXTRecord(heartbeatTXTName, edgeTimestamp, gslb.Spec.Strategy.DNSTtlSeconds, "default")
if err != nil {
return
}
} else {
log.Info().Str("HeartbeatTXTName", heartbeatTXTName).Msg("Updating split brain TXT record")
_, err = objMgr.UpdateTXTRecord(heartbeatTXTName, edgeTimestamp)
if err != nil {
return
}
}
return
}
|
"""
Implementation of Gherkin (acceptance) steps for GUI BDD tests
"""
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2016 ACK CYFRONET AGH"
__license__ = "This software is released under the MIT license cited in " \
"LICENSE.txt"
|
<gh_stars>10-100
import chai from 'chai';
import valjs, {
date,
} from 'valjs';
const should = chai.should();
describe('date', function() {
it('check if date', (done) => {
const error = valjs(new Date(), date);
should.equal(error, null);
done();
});
it('error that got date', (done) => {
const error = valjs('hey', date);
should.equal(error, 'Invalid: expected date. got string');
done();
});
it('error that got date', (done) => {
const error = valjs(2, date);
should.equal(error, 'Invalid: expected date. got number');
done();
});
it('error that got object', (done) => {
const error = valjs({}, date);
should.equal(error, 'Invalid: expected date. got object');
done();
});
it('error that got array', (done) => {
const error = valjs([], date);
should.equal(error, 'Invalid: expected date. got array');
done();
});
it('error that got bool', (done) => {
const error = valjs(true, date);
should.equal(error, 'Invalid: expected date. got bool');
done();
});
});
describe('date require', function() {
it('check require', (done) => {
const error = valjs(new Date(), date.require());
should.equal(error, null);
done();
});
it('error require', (done) => {
const error = valjs(null, date.require());
should.equal(error, 'Invalid: required');
done();
});
});
|
#!/bin/bash
set -eu
TEST_DIR=/tmp/dm_test
stop_services() {
# killall -9 tidb-server || true
echo "..."
}
check_mysql() {
host=$1
port=$2
while ! mysql -u root -h ${host} -P ${port} -e 'select version();'; do
i=$((i+1))
if [ "$i" -gt 10 ]; then
echo "wait for mysql ${host}:${port} timeout"
exit 1
fi
sleep 1
done
}
start_services() {
stop_services
mkdir -p "$TEST_DIR"
rm -rf "$TEST_DIR/*.log"
echo "Starting TiDB..."
bin/tidb-server \
-P 4000 \
--store mocktikv \
--log-file "$TEST_DIR/tidb.log" &
echo "Verifying TiDB is started..."
i=0
while ! mysql -uroot -h127.0.0.1 -P4000 --default-character-set utf8 -e 'select * from mysql.tidb;'; do
i=$((i+1))
if [ "$i" -gt 10 ]; then
echo 'Failed to start TiDB'
exit 1
fi
sleep 2
done
i=0
MYSQL_HOST1=${MYSQL_HOST1:-127.0.0.1}
MYSQL_PORT1=${MYSQL_PORT1:-3306}
MYSQL_HOST2=${MYSQL_HOST2:-127.0.0.1}
MYSQL_PORT2=${MYSQL_PORT2:-3307}
check_mysql $MYSQL_HOST1 $MYSQL_PORT1
check_mysql $MYSQL_HOST2 $MYSQL_PORT2
}
if [ "$#" -ge 1 ]; then
test_case=$1
if [ "$test_case" != "*" ] && [ ! -d "tests/$test_case" ]; then
echo "test case $test_case not found"
exit 1
fi
else
test_case="*"
fi
trap stop_services EXIT
start_services
for script in tests/$test_case/run.sh; do
echo "Running test $script..."
TEST_DIR="$TEST_DIR" \
PATH="tests/_utils:$PATH" \
TEST_NAME="$(basename "$(dirname "$script")")" \
bash +x "$script"
done
|
#include "bu_timer.h"
static Uint32 start_time = 0;
static Uint32 current_time = 0;
void time_init()
{
start_time = SDL_GetTicks();
}
Uint32 get_start_time()
{
return start_time;
}
Uint32 get_current_time()
{
current_time = SDL_GetTicks();
return current_time;
}
/*eol@eof*/
|
def complete_str(given_str):
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
index = letters.index(given_str[0])
return letters[index - 1] + given_str |
cd "$(dirname "${BASH_SOURCE[0]}")" \
&& . "../util/utils.sh"
create_directories() {
declare -a DIRECTORIES=(
"$HOME/git"
"$HOME/projects"
"$HOME/Downloads/torrents"
)
for i in "${DIRECTORIES[@]}"; do
mkd "$i"
done
}
main() {
print_in_purple "\n • Creating directories\n\n"
create_directories
}
main |
<reponame>angilin/JavaTest
package rabbitmq;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringConsumerTest2 {
//另一种接收消息的方式
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
"conf/applicationContext-rabbitmq-producter.xml");
AmqpTemplate amqpTemplate = (AmqpTemplate) context
.getBean("amqpTemplate");
while(true){
String message = (String)amqpTemplate.receiveAndConvert("q_msg_test");
System.out.println("Recv:" + message);
}
}
}
|
package bootcamp.mercado.validator;
import bootcamp.mercado.produto.compra.gateway.GatewayList;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class GatewayExistsValidator implements ConstraintValidator<GatewayExists, String> {
private final GatewayList gatewayList;
public GatewayExistsValidator(GatewayList gatewayList) {
this.gatewayList = gatewayList;
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null) return true;
return gatewayList.exists(value);
}
}
|
import { Injectable } from '@angular/core';
import { HttpRequestService } from './http-request-services';
import { Observable } from 'rxjs';
import { Page } from '../model/api/page.model';
import { FilterResponse, SortResponse } from '../model/components/frontend.model';
import { OcApiPaths } from '../oc-ng-common-service.module';
/**
*
* Description: API service for getting available features for frontend.<br>
*
* Endpoints:<br>
*
* GET 'v2/frontEnd/sorts'<br>
*
* GET 'v2/frontEnd/filters'<br>
*/
@Injectable({
providedIn: 'root',
})
export class FrontendService {
constructor(private httpRequest: HttpRequestService, private apiPaths: OcApiPaths) {}
/**
*
* Description: Get available sorts for frontend
*
* @returns {Observable<Page<SortResponse>>} `Observable<Page<SortResponse>>`
*
* ### Example:
*
* `getSorts();`
*/
getSorts(): Observable<Page<SortResponse>> {
return this.httpRequest.get(`${this.apiPaths.frontEnd}/sorts`);
}
/**
*
* Description: Get available filters for frontend
*
* @returns {Observable<Page<FilterResponse>>} `Observable<Page<FilterResponse>>`
*
* ### Example:
*
* `getFilters();`
*/
getFilters(): Observable<Page<FilterResponse>> {
return this.httpRequest.get(`${this.apiPaths.frontEnd}/filters`);
}
}
|
<reponame>rbrtsmith/flexmenu
import React from 'react';
const SearchIcon = () => <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M32 28.5l-8.2-8.2c3.4-5.1 2.9-12-1.6-16.4C19.7 1.3 16.3 0 13 0 9.7 0 6.3 1.3 3.8 3.8c-5.1 5.1-5.1 13.3 0 18.4C6.3 24.7 9.7 26 13 26c2.5 0 5.1-.7 7.3-2.2l8.2 8.2 3.5-3.5zM6.6 19.4C4.9 17.7 4 15.4 4 13s.9-4.7 2.6-6.4C8.3 4.9 10.6 4 13 4c2.4 0 4.7.9 6.4 2.6 3.5 3.5 3.5 9.2 0 12.7-1.7 1.7-4 2.6-6.4 2.6s-4.7-.8-6.4-2.5z"/></svg>;
export default SearchIcon;
|
<gh_stars>0
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';
import { EuiHeader } from './header';
describe('EuiHeader', () => {
test('is rendered', () => {
const component = render(<EuiHeader {...requiredProps} />);
expect(component).toMatchSnapshot();
});
test('renders children', () => {
const component = render(
<EuiHeader>
<span>Hello!</span>
</EuiHeader>
);
expect(component).toMatchSnapshot();
});
test('renders in fixed position', () => {
const component = render(
<EuiHeader position="fixed">
<span>Hello!</span>
</EuiHeader>
);
expect(component).toMatchSnapshot();
});
test('renders dark theme', () => {
const component = render(<EuiHeader theme="dark" />);
expect(component).toMatchSnapshot();
});
describe('sections', () => {
test('render simple items and borders', () => {
const component = render(
<EuiHeader
sections={[
{
items: ['Item 1', 'Item 2'],
borders: 'right',
},
{
items: ['Item A', 'Item B'],
},
]}
/>
);
expect(component).toMatchSnapshot();
});
test('render breadcrumbs and props', () => {
const component = render(
<EuiHeader
sections={[
{
breadcrumbs: [{ text: 'Breadcrumb' }],
breadcrumbProps: { responsive: false },
},
]}
/>
);
expect(component).toMatchSnapshot();
});
});
describe('throws a warning', () => {
const oldConsoleError = console.warn;
let consoleStub: jest.Mock;
beforeEach(() => {
// We don't use jest.spyOn() here, because EUI's tests apply a global
// console.error() override that throws an exception. For these
// tests, we just want to know if console.error() was called.
console.warn = consoleStub = jest.fn();
});
afterEach(() => {
console.warn = oldConsoleError;
});
test('if both children and sections were passed', () => {
const component = render(
<EuiHeader
sections={[
{
items: ['Item 1', 'Item 2'],
},
]}
>
Child
</EuiHeader>
);
expect(consoleStub).toBeCalled();
expect(consoleStub.mock.calls[0][0]).toMatch(
'cannot accept both `children` and `sections`'
);
expect(component).toMatchSnapshot();
});
});
});
|
const city = 'Tokyo';
const url = `https://api.weather.com/v3/wx/forecast/daily/5day?geocode=${city}&format=json&units=m`;
fetch(url).then(async response => {
const json = await response.json();
console.log(json);
}); |
import React from 'react'
import { Link } from 'react-router-dom'
import Icon from 'components/Icon'
import './CloseMessages.scss'
function CloseMessages ({ onCloseURL }) {
return <Link to={onCloseURL} styleName='close-messages'>
<Icon name='Ex' styleName='close-messages-icon' />
</Link>
}
export default CloseMessages
|
<reponame>quicker-js/class-decorator
/**
* decorators
*/
export * from './property';
export * from './entity';
export * from './param';
export * from './request';
|
# Generate Terraform files
touch settings/config.yml
./docker_helper.sh ansible-playbook --extra-vars="@settings/config.yml" --extra-vars="@settings/vault.yml" -i inventory playbook.terraform.yml
# Run terraform
# If we send multiple commands to the docker container (/bin/bash -c), we can "cd" into the "settings" directory
# then run terraform... which will then place the .tfstate file in the "settings" directory for safe keeping (aka "backing up")
./docker_helper.sh /bin/bash -c "cd settings; terraform init && terraform apply"
# Get instance IP for next run
TERRAFORM_IP=$(./docker_helper.sh /bin/bash -c "cd settings; terraform show -json | jq -r .values.root_module.resources[0].values.ipv4_address")
echo "Successfully created a server at: ${TERRAFORM_IP}\n\nPlace this IP where you want it in your settings (either 'homelab_ip' or 'bastion.server_address'), then run 'make' to complete the setup."
|
<filename>jena-3.0.1/jena-sdb/src/main/java/org/apache/jena/sdb/core/sqlnode/GenerateSQLMySQL.java<gh_stars>0
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF 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.
*/
package org.apache.jena.sdb.core.sqlnode;
import org.apache.jena.atlas.io.IndentedLineBuffer;
import org.apache.jena.atlas.io.IndentedWriter;
import org.apache.jena.sdb.core.JoinType ;
public class GenerateSQLMySQL extends GenerateSQL
{
@Override
protected SqlNodeVisitor makeVisitor(IndentedLineBuffer buff)
{
return new GeneratorVisitorMySQL(buff) ;
}
}
class GeneratorVisitorMySQL extends GenerateSQLVisitor
{
// STRAIGHT_JOIN stops the optimizer reordering inner join
// It requires that the left table and right table are kept as left and right,
// so a sequence of joins can not be reordered.
static final String InnerJoinOperatorStraight = "STRAIGHT_JOIN" ;
static final String InnerJoinOperatorDefault = JoinType.INNER.sqlOperator() ;
public GeneratorVisitorMySQL(IndentedWriter out) { super(out) ; }
@Override
public void visit(SqlJoinInner join)
{
join = rewrite(join) ;
visitJoin(join, InnerJoinOperatorDefault) ;
}
@Override
protected void genLimitOffset(SqlSelectBlock sqlSelectBlock)
{
if ( sqlSelectBlock.getLength() >= 0 || sqlSelectBlock.getStart() >= 0 )
{
// MySQL syntax issue - need LIMIT even if only OFFSET
long length = sqlSelectBlock.getLength() ;
if ( length < 0 )
{
sqlSelectBlock.addNote("Require large LIMIT") ;
length = Long.MAX_VALUE ;
}
out.println("LIMIT "+length) ;
if ( sqlSelectBlock.getStart() >= 0 )
out.println("OFFSET "+sqlSelectBlock.getStart()) ;
}
}
}
|
#!/bin/bash
# Check if the time parameter is provided
if [ -z "$1" ]; then
echo "Usage: $0 <time_in_seconds>"
exit 1
fi
# Extract the time parameter
time_in_seconds=$1
# Display the notification using notify-send
notify-send -u critical -t 10000 -- "LOCKING screen in $time_in_seconds seconds" |
import React, { Component } from "react";
import {
Title,Footer
} from "native-base";
class AdFooter extends Component {
render() {
return (
<Footer >
<Title style={{paddingTop:10}}>Your AD Here</Title>
</Footer>
);
}
}
export default AdFooter;
|
#!/bin/bash
### Syncs s3 files with onedrive folder for data sharing
### Depend on rclone configured to access the drive beforehand (see rclone config)
projectString=$1
onedriveDrive="covidseq_onedrive"
#s3ProjectString has the shape 2021-09-21_Covid-M000_276600326
newProjectName=`echo $projectString | awk 'BEGIN {FS="_"}{print $2}'`
echo "Project name is $newProjectName"
runCode=`echo $newProjectName | awk 'BEGIN {FS="-"}{print $2}'`
echo "Run Code is $runCode"
date=`echo $projectString | awk 'BEGIN {FS="_"}{print $1}'`
echo "Date for folder is $date"
### Need to download xlsx and fasta results from s3, which are linked specifically to Microbiologia_HUGTiP project.
if [[ -e /tmp/${newProjectName}_completed.txt ]]
### Mkdir On the onedrive diskspace
rclone mkdir ${onedriveDrive}://General/SharedResults/Microbiologia_HUGTiP/${runCode}-${date}
then
echo "listing bucket $s3Bucket"
for file in `aws s3 ls ${s3Bucket}Runs/$projectString/ --recursive | grep '.xlsx' | awk '{print $4}'`
do
echo $file
csvFile=$file
fastaFile=${file%%.xlsx}.fasta
aws s3 cp ${s3Bucket}$csvFile /tmp/
aws s3 cp ${s3Bucket}$fastaFile /tmp/
localCsvFile=/tmp/${csvFile##*/}
localFastaFile=/tmp/${fastaFile##*/}
echo "Using $localCsvFile and $localFastaFile for $projectString"
#destDir="${onedriveDrive}://'General - Covid-Seq'/SharedResults/Microbiologia_HUGTiP/${runCode}-${date}/"
echo "Copying to ${onedriveDrive}://"General - Covid-Seq"/SharedResults/Microbiologia_HUGTiP/${runCode}-${date}/ "
rclone copy --ignore-size --ignore-checksum $localCsvFile ${onedriveDrive}://"General - Covid-Seq"/SharedResults/Microbiologia_HUGTiP/${runCode}-${date}/ && \
rclone copy --ignore-size --ignore-checksum $localFastaFile ${onedriveDrive}://"General - Covid-Seq"/SharedResults/Microbiologia_HUGTiP/${runCode}-${date}/ && \
rm $localFastaFile $localCsvFile
done
fi
|
<reponame>754340156/NQ_quanfu
//
// Animation.h
// FullRich
//
// Created by 任强宾 on 16/10/26.
// Copyright © 2016年 任强宾. All rights reserved.
//
#ifndef Animation_h
#define Animation_h
//tableView刷新的时候的动画
#define Animation_TableViewRow UITableViewRowAnimationNone
#endif /* Animation_h */
|
#!/bin/bash
# check if root
if [[ $(whoami) != "root" ]] ; then
echo "run me as a root!";
exit 1;
fi
# check if crontab already has simple-monitor.sh defined
crontab -l | grep "simple-monitor.sh"
if [[ $? -eq 0 ]] ; then
echo "simple-monitor.sh is already defined in crontab. Delete it first and re-run this script"
echo "type 'crontab -e' to edit cron job list"
exit 2;
fi
# download simple monitor script
curl -O https://raw.githubusercontent.com/jakubpartyka/simple-vps-monitoring/master/simple-monitor.sh
chmod +x simple-monitor.sh
# get user input
echo "provide interval for monitoring log file updating (minutes):"
read INTERVAL
# check if interval is correct
if [[ $INTERVAL -gt 59 ]] || [[ $INTERVAL -lt 1 ]] ; then
echo "Incorrect interval was specified. Please choose a value between 1 and 59"
exit 3
fi
echo "how much time a log entry should be kept? This implies how far back memory and cpu usage will be show on monitoring page. Provide time in hours:"
read HOURS
MAX_LOGS=$(((60/INTERVAL)*HOURS))
echo "$MAX_LOGS log entries will be kept"
# get output folder
echo "specify output folder where HTML file should be saved:"
read OUTPUT
mkdir -p $OUTPUT
if ! [[ -d $OUTPUT ]] ; then
echo "Specified folder does not exists"
exit 4
fi
echo "configuring monitoring script"
# delete first 5 lines from monitoring file
tail -n +6 "simple-monitor.sh" > "simple-monitor.sh.tmp"
echo "#!/bin/bash
### CONFIG ###
MAX_LOG_CNT=$MAX_LOGS # max number of monitoring log entries that will be kept
OUTPUT="$OUTPUT/index.html" # file to which an usage graph will be written to" > simple-monitor.sh
cat "simple-monitor.sh.tmp" >> "simple-monitor.sh"
rm "simple-monitor.sh.tmp"
echo "creating cron job"
(crontab -l 2>/dev/null; echo "*/$INTERVAL * * * * $(pwd)/simple-monitor.sh") | crontab -
echo "simple monitor is now configured!"
|
package com.modesteam.urutau.model;
import org.junit.Assert;
import org.junit.Test;
import com.modesteam.urutau.model.system.ArtifactType;
public class RequirementTest {
public Requirement requirementTest;
@Test
public void testGetType() {
Requirement feature = new Feature();
Assert.assertEquals("feature", feature.toString());
Requirement storie = new Storie();
Assert.assertEquals("storie", storie.toString());
Requirement epic = new Epic();
// More verbose
Assert.assertEquals("epic", epic.getType());
}
@Test
public void testEnum() {
Requirement generic = new Generic();
Assert.assertEquals(ArtifactType.GENERIC, ArtifactType.equivalentTo(generic.getType()));
}
}
|
<reponame>sotovdev/yandexDirectJavaApi<filename>src/main/java/ru/contextguide/yandexservices/campaigns/CampaignsAddRequest.java
package ru.contextguide.yandexservices.campaigns;
import ru.contextguide.campaign.campaign.CampaignAddItem;
import ru.contextguide.yandexservices.utils.JsonSerializableObject;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class CampaignsAddRequest implements JsonSerializableObject {
@NotNull
private final List<CampaignAddItem> campaigns;
public CampaignsAddRequest(List<CampaignAddItem> campaigns) {
this.campaigns = new ArrayList<>(campaigns);
}
public CampaignsAddRequest(CampaignAddItem campaign) {
this.campaigns = new ArrayList<>(1);
this.campaigns.add(campaign);
}
public List<CampaignAddItem> getCampaigns() {
return this.campaigns;
}
public void add(CampaignAddItem campaign) {
this.campaigns.add(campaign);
}
public void addAll(List<CampaignAddItem> campaigns) {
this.campaigns.addAll(campaigns);
}
@Override
public String toString() {
return this.toJson();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CampaignsAddRequest that = (CampaignsAddRequest) o;
return Objects.equals(campaigns, that.campaigns);
}
@Override
public int hashCode() {
return Objects.hash(campaigns);
}
}
|
import pymongo
# 指定数据库
client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client.test
# 指定集合
collection = db.students
# 进行更新
condition = {'name': 'Google'}
student = collection.find_one(condition)
student['age'] = 25
result = collection.update(condition,student)
print(result)
# 进行更新(用 $set)
condition = {'name': 'Apple'}
student1 = collection.find_one(condition)
student1['age'] = 30
result1 = collection.update(condition,{'$set' : student1})
print(result1)
|
class CMSConfig {
public $modx;
public $config = array();
public $prefix;
public function setConfig($key, $value) {
$this->config[$key] = $value;
}
public function getConfig($key) {
return isset($this->config[$key]) ? $this->config[$key] : null;
}
public function setPrefix($prefix) {
$this->prefix = $prefix;
}
} |
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
// Pages
import HomePage from 'pages/home';
const Stack = createStackNavigator();
const Routes = () => {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomePage} />
</Stack.Navigator>
</NavigationContainer>
);
};
export default Routes;
|
int[] arr1 = {1, 2, 3, 4, 5};
int[] arr2 = new int[arr1.Length];
Array.Copy(arr1, arr2, arr1.Length);
Console.Write("Array 1: ");
for (int i = 0; i < arr1.Length; i++)
{
Console.Write(arr1[i] + " ");
}
Console.Write("\nArray 2: ");
for (int i = 0; i < arr2.Length; i++)
{
Console.Write(arr2[i] + " ");
} |
#include "stdafx.h"
#include "draw_to_texture.h"
#include "matrix_call.h"
#include "mmcore/param/BoolParam.h"
#include "mmcore/param/IntParam.h"
#include "mmcore/view/AbstractCallRender.h"
#include "mmcore/view/CallRender2D.h"
#include "compositing/CompositingCalls.h"
#include "vislib/sys/Log.h"
#include "glowl/FramebufferObject.hpp"
#include "glm/mat4x4.hpp"
#include <array>
#include <memory>
namespace megamol {
namespace flowvis {
draw_to_texture::draw_to_texture()
: texture_slot("texture", "Target texture")
, model_matrix_slot("model_matrix", "Model matrix defining the position of the texture in world space")
, rendering_slot("rendering", "Input rendering")
, width("width", "Texture width in pixel")
, height("height", "Texture height in pixel")
, keep_aspect_ratio(
"keep_aspect_ratio", "Keep aspect ratio of the incoming bounding rectangle, ignoring the height parameter")
, fbo(nullptr)
, hash(-1) {
// Connect output
this->texture_slot.SetCallback(compositing::CallTexture2D::ClassName(), compositing::CallTexture2D::FunctionName(0),
&draw_to_texture::get_data);
this->texture_slot.SetCallback(compositing::CallTexture2D::ClassName(), compositing::CallTexture2D::FunctionName(1),
&draw_to_texture::get_extent);
this->MakeSlotAvailable(&this->texture_slot);
this->model_matrix_slot.SetCallback(
matrix_call::ClassName(), matrix_call::FunctionName(0), &draw_to_texture::get_matrix);
this->MakeSlotAvailable(&this->model_matrix_slot);
// Connect input
this->rendering_slot.SetCompatibleCall<core::view::CallRender2DDescription>();
this->MakeSlotAvailable(&this->rendering_slot);
// Set up parameters
this->width << new core::param::IntParam(4000);
this->MakeSlotAvailable(&this->width);
this->height << new core::param::IntParam(4000);
this->MakeSlotAvailable(&this->height);
this->keep_aspect_ratio << new core::param::BoolParam(false);
this->MakeSlotAvailable(&this->keep_aspect_ratio);
}
draw_to_texture::~draw_to_texture() { this->Release(); }
bool draw_to_texture::create() { return true; }
void draw_to_texture::release() {}
bool draw_to_texture::get_input_extent() {
auto rc_ptr = this->rendering_slot.CallAs<core::view::CallRender2D>();
if (rc_ptr == nullptr) {
vislib::sys::Log::DefaultLog.WriteError("No input connected");
return false;
}
auto& rc = *rc_ptr;
if (!rc(core::view::AbstractCallRender::FnGetExtents)) {
vislib::sys::Log::DefaultLog.WriteError("Error getting input rendering extent");
return false;
}
this->bounding_rectangle = rc.GetBoundingBox();
}
bool draw_to_texture::get_data(core::Call& call) {
auto rc_ptr = this->rendering_slot.CallAs<core::view::CallRender2D>();
if (rc_ptr == nullptr) {
vislib::sys::Log::DefaultLog.WriteError("No input connected");
return false;
}
auto& rc = *rc_ptr;
// Set dummy hash
core::BasicMetaData meta_data;
meta_data.m_data_hash = this->hash++;
static_cast<compositing::CallTexture2D&>(call).setMetaData(meta_data);
// Save state
GLint oldFb, oldDb, oldRb;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFb);
glGetIntegerv(GL_DRAW_BUFFER, &oldDb);
glGetIntegerv(GL_READ_BUFFER, &oldRb);
GLint vp[4];
glGetIntegerv(GL_VIEWPORT, vp);
std::array<float, 4> clear_color;
glGetFloatv(GL_COLOR_CLEAR_VALUE, clear_color.data());
// Create texture if necessary
const auto aspect_ratio = this->bounding_rectangle.AspectRatio();
const auto width = this->width.Param<core::param::IntParam>()->Value();
const auto height = this->keep_aspect_ratio.Param<core::param::BoolParam>()->Value()
? static_cast<int>(this->width.Param<core::param::IntParam>()->Value() / aspect_ratio)
: this->height.Param<core::param::IntParam>()->Value();
if (this->fbo == nullptr || this->width.IsDirty() || this->height.IsDirty()) {
this->fbo = std::make_unique<glowl::FramebufferObject>(width, height);
this->fbo->createColorAttachment(GL_RGBA16F, GL_RGBA, GL_FLOAT);
this->width.ResetDirty();
this->height.ResetDirty();
}
// Set view
glViewport(0, 0, static_cast<GLsizei>(width), static_cast<GLsizei>(height));
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glm::mat4 view_mx(1.0f);
view_mx[0][0] = 2.0f / this->bounding_rectangle.Width();
view_mx[1][1] = 2.0f / this->bounding_rectangle.Height();
view_mx[3][0] = -this->bounding_rectangle.Left() * view_mx[0][0] - 1.0f;
view_mx[3][1] = -this->bounding_rectangle.Bottom() * view_mx[1][1] - 1.0f;
glLoadMatrixf(glm::value_ptr(view_mx));
// Render
this->fbo->bind();
//glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (!rc(core::view::AbstractCallRender::FnRender)) {
vislib::sys::Log::DefaultLog.WriteError("Error getting input rendering");
return false;
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// Restore state
glViewport(vp[0], vp[1], vp[2], vp[3]);
glClearColor(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
glBindFramebuffer(GL_FRAMEBUFFER_EXT, oldFb);
glDrawBuffer(oldDb);
glReadBuffer(oldRb);
// Set output
static_cast<compositing::CallTexture2D&>(call).setData(this->fbo->getColorAttachment(0));
return true;
}
bool draw_to_texture::get_extent(core::Call&) { return get_input_extent(); }
bool draw_to_texture::get_matrix(core::Call& call) {
if (!this->get_input_extent()) return false;
// Assume texture quad to live in [0, 0] x [1, 1] and create model matrix to transform
// this quad to the coordinates and extent of the bounding rectangle, setting z=0
glm::mat4 scale(1.0f);
scale[0][0] = this->bounding_rectangle.Width();
scale[1][1] = this->bounding_rectangle.Height();
glm::mat4 translate(1.0f);
translate[3][0] = this->bounding_rectangle.Left();
translate[3][1] = this->bounding_rectangle.Bottom();
const glm::mat4 model = translate * scale;
static_cast<matrix_call&>(call).set_matrix(model);
return true;
}
} // namespace flowvis
} // namespace megamol
|
<reponame>v3nd3774/testing-framework-for-dynamic-graph-program-analysis
package io.github.v3nd3774.uta2218.cse6324.s001;
import junit.framework.TestCase;
import org.jgrapht.Graph;
import java.util.HashMap;
public class GraphUtilityTest extends TestCase {
protected Graph<HashMap<String, String>, HashMapEdge> emptyGraphA;
protected Graph<HashMap<String, String>, HashMapEdge> emptyGraphB;
protected Graph<HashMap<String, String>, HashMapEdge> graphC;
protected Graph<HashMap<String, String>, HashMapEdge> graphD;
// assigning the values
protected void setUp(){
emptyGraphA = DotLanguageFile.createEmptyGraph();
emptyGraphB = DotLanguageFile.createEmptyGraph();
graphC = DotLanguageFile.createEmptyGraph();
graphD = DotLanguageFile.createEmptyGraph();
HashMap<String, String> nodeC = new HashMap<String, String>();
HashMap<String, String> nodeD = new HashMap<String, String>();
nodeC.put("KEYC", "VALUEC");
nodeD.put("KEYD", "VALUED");
graphC.addVertex(nodeC);
graphC.addVertex(nodeD);
}
public void testEmptyEquality(){
assertTrue(GraphUtility.equals(emptyGraphA, emptyGraphB));
}
public void testNonemptyInequality(){
assertTrue(!GraphUtility.equals(graphC, graphD));
}
public void testNonemptyEquality(){
assertTrue(GraphUtility.equals(graphC, graphC));
assertTrue(GraphUtility.equals(graphD, graphD));
}
}
|
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def max_depth(node):
if node is None:
return 0 ;
else :
# Compute the depth of each subtree
lDepth = max_depth(node.left)
rDepth = max_depth(node.right)
# Use the larger one
if (lDepth > rDepth):
return lDepth+1
else:
return rDepth+1 |
import SwiftUI
struct ContentView: View {
@State private var text = ""
@State private var numCommits = 0
@State private var isFocused = false
@State private var emptyString = ""
var body: some View {
VStack {
TextField("Basic text field", text: $text)
TextField("Press enter to commit", text: $text, onCommit: { numCommits += 1 })
TextField(
isFocused ? "Focused" : "Not focused",
text: $emptyString,
onEditingChanged: { editing in isFocused = editing }
).textFieldStyle(RoundedBorderTextFieldStyle())
Text("Commits: \(numCommits)")
Text("Text: “\(text)”")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
} |
<reponame>lamastex/mep
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "org.lamastex",
scalaVersion := "2.13.3"
)),
name := "mep"
)
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % Test
libraryDependencies += "org.twitter4j" % "twitter4j-examples" % "4.0.7"
libraryDependencies += "com.google.code.gson" % "gson" % "2.8.6"
libraryDependencies += "com.typesafe" % "config" % "1.4.1"
libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.7.1"
libraryDependencies += "org.jboss" % "jdk-misc" % "3.Final"
scalacOptions += "-deprecation"
|
<gh_stars>1-10
import { firebase, socket } from './instances'
import axios from './axios'
export { firebase, socket, axios }
|
<reponame>rubenqba/gearman-java<gh_stars>0
package net.johnewart.gearman.server.web;
public class NumberFormatter
{
public NumberFormatter() {}
public String format(Number number) {
long longVal = number.longValue();
if(longVal < 1000)
{
return number.toString();
}
if (longVal < 1000000)
{
return String.format("%.1fK", number.doubleValue() / 1000.0);
}
if (longVal < 1000000000)
{
return String.format("%.2M", number.doubleValue() / 1000000.0);
}
return String.format("%.3B", number.doubleValue() / 1000000000.0);
}
} |
class BankAccount:
"""This class will contain the basic properties and methods of a bank account."""
def __init__(self, balance):
self.balance = balance
# add other properties and methods as needed. |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
self.middle = None
def addNode(self, node):
if self.head is None:
self.head = node
self.tail = node
self.middle = node
else:
self.tail.next = node
self.tail = node
# To mark the middle node
if self.head.next is self.middle:
self.middle = node
def mark_middle(self):
if self.middle is None:
return
self.middle.data = 'Middle Node' |
var a = 1;
function outer(){
function inner(){
console.log("inner : " + a);
var a = 3;
}
inner();
console.log("outer : " + a);
}
outer();
console.log("main : " + a); |
<reponame>jtmccormick18/electron-react-bp
/* jshint indent: 1 */
module.exports = function(sequelize, DataTypes) {
return sequelize.define('nadaSvs', {
recid: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'RECID'
},
nadaYear: {
type: DataTypes.CHAR,
allowNull: true,
field: 'NADA_YEAR'
},
quality: {
type: DataTypes.CHAR,
allowNull: false,
primaryKey: true,
field: 'QUALITY'
},
width: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
field: 'WIDTH'
},
new: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'NEW'
},
yr0: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR0'
},
yr1: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR1'
},
yr2: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR2'
},
yr3: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR3'
},
yr4: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR4'
},
yr5: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR5'
},
yr6: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR6'
},
yr7: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR7'
},
yr8: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR8'
},
yr9: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR9'
},
yr10: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR10'
},
yr11: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR11'
},
yr12: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR12'
},
yr13: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: '((0))',
field: 'YR13'
}
}, {
tableName: 'NADA_SVS',
timestamps: false
});
};
|
data = [
{
"text": "The CEO of the company attended the conference.",
"label": "business"
},
{
"text": "We analysed the data before making a decision.",
"label": "data"
},
{
"text": "Our team developed an algorithm to improve efficiency.",
"label": "data"
},
{
"text": "We are hiring a new CFO.",
"label": "business"
},
{
"text": "Data science is a growing field.",
"label": "data"
},
] |
import re
def get_view_function(url_pattern, url_patterns):
for pattern, view_function in url_patterns:
if re.match(pattern, url_pattern):
return view_function
return None |
/*ckwg +29
* Copyright 2011-2017 by Kitware, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither name of Kitware, Inc. nor the names of any contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPROKIT_PIPELINE_PROCESS_EXCEPTION_H
#define SPROKIT_PIPELINE_PROCESS_EXCEPTION_H
#include <sprokit/pipeline/sprokit_pipeline_export.h>
#include <vital/config/config_block.h>
#include "process.h"
#include "types.h"
#include <string>
/**
* \file process_exception.h
*
* \brief Header for exceptions used within \link sprokit::process processes\endlink.
*/
namespace sprokit {
// ----------------------------------------------------------------------------
/**
* \class process_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief The base class for all exceptions thrown from a \ref process.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT process_exception
: public pipeline_exception
{
public:
/**
* \brief Constructor.
*/
process_exception() noexcept;
/**
* \brief Destructor.
*/
virtual ~process_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class null_process_config_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a \c NULL \ref config is passed to a process.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_process_config_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*/
null_process_config_exception() noexcept;
/**
* \brief Destructor.
*/
~null_process_config_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class already_initialized_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a process has been initialized before configure.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT already_initialized_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
*/
already_initialized_exception(process::name_t const& name) noexcept;
/**
* \brief Destructor.
*/
~already_initialized_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
};
// ----------------------------------------------------------------------------
/**
* \class unconfigured_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a process hasn't been configured before initialization or stepping.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT unconfigured_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
*/
unconfigured_exception(process::name_t const& name) noexcept;
/**
* \brief Destructor.
*/
~unconfigured_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
};
// ----------------------------------------------------------------------------
/**
* \class reconfigured_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a process is configured for a second time.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT reconfigured_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
*/
reconfigured_exception(process::name_t const& name) noexcept;
/**
* \brief Destructor.
*/
~reconfigured_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
};
// ----------------------------------------------------------------------------
/**
* \class reinitialization_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a process is initialized for a second time.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT reinitialization_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
*/
reinitialization_exception(process::name_t const& name) noexcept;
/**
* \brief Destructor.
*/
~reinitialization_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
};
// ----------------------------------------------------------------------------
/**
* \class null_conf_info_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a port is declared with a \c NULL info structure.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_conf_info_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param key The configuration key with \c NULL information.
*/
null_conf_info_exception(process::name_t const& name, kwiver::vital::config_block_key_t const& key) noexcept;
/**
* \brief Destructor.
*/
~null_conf_info_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
/// The configuration key.
kwiver::vital::config_block_key_t const m_key;
};
// ----------------------------------------------------------------------------
/**
* \class null_port_info_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when \c NULL is passed as information for a port.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_port_info_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The port with \c NULL information.
* \param type The type of port.
*/
null_port_info_exception(process::name_t const& name, process::port_t const& port, std::string const& type) noexcept;
/**
* \brief Destructor.
*/
~null_port_info_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
/// The name of the port.
process::port_t const m_port;
};
// ----------------------------------------------------------------------------
/**
* \class null_input_port_info_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when \c NULL is passed as information for an input port.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_input_port_info_exception
: public null_port_info_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the \ref process.
* \param port The port with \c NULL information.
*/
null_input_port_info_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
~null_input_port_info_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class null_output_port_info_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when \c NULL is passed as information for an output port.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_output_port_info_exception
: public null_port_info_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the \ref process.
* \param port The port with \c NULL information.
*/
null_output_port_info_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
~null_output_port_info_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class flag_mismatch_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when incompatible flags are given for a port.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT flag_mismatch_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the \ref process.
* \param port The port with \c NULL information.
* \param reason The reason why the flags are incompatible.
*/
flag_mismatch_exception(process::name_t const& name, process::port_t const& port, std::string const& reason) noexcept;
/**
* \brief Destructor.
*/
~flag_mismatch_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
/// The name of the port.
process::port_t const m_port;
/// A reason for the incompatible flags.
std::string const m_reason;
};
// ----------------------------------------------------------------------------
/**
* \class set_type_on_initialized_process_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when the type on a port is attempted to be set after initialization.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT set_type_on_initialized_process_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the \ref process.
* \param port The name of the port on the \ref process.
* \param type The type that was attempted to be set.
*/
set_type_on_initialized_process_exception(process::name_t const& name, process::port_t const& port, process::port_type_t const& type) noexcept;
/**
* \brief Destructor.
*/
~set_type_on_initialized_process_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
/// The name of the port.
process::port_t const m_port;
/// The type that was attempted to be set.
process::port_type_t const m_type;
};
// ----------------------------------------------------------------------------
/**
* \class set_frequency_on_initialized_process_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when the frequency on a port is attempted to be set after initialization.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT set_frequency_on_initialized_process_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the \ref process.
* \param port The name of the port on the \ref process.
* \param frequency The frequency that was attempted to be set.
*/
set_frequency_on_initialized_process_exception(process::name_t const& name,
process::port_t const& port,
process::port_frequency_t const& frequency) noexcept;
/**
* \brief Destructor.
*/
~set_frequency_on_initialized_process_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
/// The name of the port.
process::port_t const m_port;
/// The frequency that was attempted to be set.
process::port_frequency_t const m_frequency;
};
// ----------------------------------------------------------------------------
/**
* \class uninitialized_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a process is stepped before initialization.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT uninitialized_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
*/
uninitialized_exception(process::name_t const& name) noexcept;
/**
* \brief Destructor.
*/
~uninitialized_exception() noexcept;
/// The name of the \ref process.
process::name_t const m_name;
};
// ----------------------------------------------------------------------------
/**
* \class port_connection_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief The base class used when an error occurs when connecting to a port.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT port_connection_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
*/
port_connection_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
virtual ~port_connection_exception() noexcept;
/// The name of the \ref process which was connected to.
process::name_t const m_name;
/// The name of the port which was connected to.
process::port_t const m_port;
};
// ----------------------------------------------------------------------------
/**
* \class connect_to_initialized_process_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a connection is requested to be made to an initialized process.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT connect_to_initialized_process_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
*/
connect_to_initialized_process_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
~connect_to_initialized_process_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class no_such_port_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a connection to a port that does not exist is requested.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT no_such_port_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
*/
no_such_port_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
* \param all_ports List of all available ports
*/
no_such_port_exception(process::name_t const& name, process::port_t const& port,
process::ports_t const& all_ports) noexcept;
/**
* \brief Destructor.
*/
~no_such_port_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class null_edge_port_connection_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a connection to a port is given an \ref edge that is \c NULL.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT null_edge_port_connection_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
*/
null_edge_port_connection_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
~null_edge_port_connection_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class static_type_reset_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a port type is attempted to be reset on a static type.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT static_type_reset_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
* \param orig_type The original type of the port.
* \param new_type The type that was attempted to be set on the port.
*/
static_type_reset_exception(process::name_t const& name, process::port_t const& port, process::port_type_t const& orig_type, process::port_type_t const& new_type) noexcept;
/**
* \brief Destructor.
*/
~static_type_reset_exception() noexcept;
/// The original type on the port.
process::port_type_t const m_orig_type;
/// The new type for the port.
process::port_type_t const m_new_type;
};
// ----------------------------------------------------------------------------
/**
* \class port_reconnect_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a port that is already connected is connected to again.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT port_reconnect_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
*/
port_reconnect_exception(process::name_t const& name, process::port_t const& port) noexcept;
/**
* \brief Destructor.
*/
~port_reconnect_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class missing_connection_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a connection to a port that is marked as required is missing.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT missing_connection_exception
: public port_connection_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param port The name of the port.
* \param reason The reason why the connection is necessary.
*/
missing_connection_exception(process::name_t const& name, process::port_t const& port, std::string const& reason) noexcept;
/**
* \brief Destructor.
*/
~missing_connection_exception() noexcept;
/// A reason for the missing connection.
std::string const m_reason;
};
// ----------------------------------------------------------------------------
/**
* \class process_configuration_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a \ref process has a configuration issue.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT process_configuration_exception
: public process_exception
{
public:
/**
* \brief Constructor.
*/
process_configuration_exception() noexcept;
/**
* \brief Destructor.
*/
virtual ~process_configuration_exception() noexcept;
};
// ----------------------------------------------------------------------------
/**
* \class unknown_configuration_value_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a requested configuration value does not exist.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT unknown_configuration_value_exception
: public process_configuration_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param key The key requested.
*/
unknown_configuration_value_exception(process::name_t const& name, kwiver::vital::config_block_key_t const& key) noexcept;
/**
* \brief Destructor.
*/
~unknown_configuration_value_exception() noexcept;
/// The name of the \ref process which was connected to.
process::name_t const m_name;
/// The name of the key which was given.
kwiver::vital::config_block_key_t const m_key;
};
// ----------------------------------------------------------------------------
/**
* \class invalid_configuration_value_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a configuration value has an invalid value.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT invalid_configuration_value_exception
: public process_configuration_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param key The key requested.
* \param value The value given.
* \param desc A description of the configuration value.
*/
invalid_configuration_value_exception(process::name_t const& name, kwiver::vital::config_block_key_t const& key, kwiver::vital::config_block_value_t const& value, kwiver::vital::config_block_description_t const& desc) noexcept;
/**
* \brief Destructor.
*/
~invalid_configuration_value_exception() noexcept;
/// The name of the \ref process which was connected to.
process::name_t const m_name;
/// The name of the key which was given.
kwiver::vital::config_block_key_t const m_key;
/// The invalid value.
kwiver::vital::config_block_value_t const m_value;
/// A description of the key.
kwiver::vital::config_block_description_t const m_desc;
};
// ----------------------------------------------------------------------------
/**
* \class invalid_configuration_exception process_exception.h <sprokit/pipeline/process_exception.h>
*
* \brief Thrown when a configuration for a \ref process is invalid.
*
* \ingroup exceptions
*/
class SPROKIT_PIPELINE_EXPORT invalid_configuration_exception
: public process_configuration_exception
{
public:
/**
* \brief Constructor.
*
* \param name The name of the process.
* \param reason The reason why the configuration is invalid.
*/
invalid_configuration_exception(process::name_t const& name, std::string const& reason) noexcept;
/**
* \brief Destructor.
*/
~invalid_configuration_exception() noexcept;
/// The name of the \ref process which was connected to.
process::name_t const m_name;
/// A reason for the invalid configuration.
std::string const m_reason;
};
}
#endif // SPROKIT_PIPELINE_PROCESS_EXCEPTION_H
|
import psutil
def get_cpu_usage():
return psutil.cpu_percent(interval=1)
def get_total_physical_memory():
return psutil.virtual_memory().total
def list_running_processes():
processes = []
for proc in psutil.process_iter(['pid', 'name']):
processes.append((proc.info['pid'], proc.info['name']))
return processes
def main():
try:
print(f"CPU Usage: {get_cpu_usage()}%")
print(f"Total Physical Memory: {get_total_physical_memory()} bytes")
print("Running Processes:")
for pid, name in list_running_processes():
print(f"PID: {pid}, Name: {name}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main() |
#!/bin/bash
sudo docker start postgres
sudo docker start www |
<filename>tests/test_negation.py
from hypothesis import given
from ppb_vector import Vector
from utils import vectors
@given(v=vectors())
def test_negation_scalar(v: Vector):
assert -v == (-1) * v
@given(v=vectors())
def test_negation_involutive(v: Vector):
assert v == -(-v)
@given(v=vectors())
def test_negation_addition(v: Vector):
assert not (v + (-v))
|
package com.jeespring.modules.sys.dao;
import com.jeespring.modules.monitor.entity.OnlineSession;
import com.jeespring.modules.sys.entity.SysUserOnline;
import com.jeespring.modules.sys.service.SysUserOnlineService;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import java.io.Serializable;
import java.util.Date;
/**
* 针对自定义的ShiroSession的db操作
*
* @author JeeSpring
*/
@Service
public class OnlineSessionDAO extends EnterpriseCacheSessionDAO
{
/**
* 同步session到数据库的周期 单位为毫秒(默认1分钟)
*/
@Value("${shiro.session.dbSyncPeriod}")
private int dbSyncPeriod=1;
/**
* 上次同步数据库的时间戳
*/
private static final String LAST_SYNC_DB_TIMESTAMP = OnlineSessionDAO.class.getName() + "LAST_SYNC_DB_TIMESTAMP";
@Autowired
private SysUserOnlineService sysUserOnlineService;
@Autowired
private OnlineSessionFactory onlineSessionFactory;
public OnlineSessionDAO()
{
super();
}
public OnlineSessionDAO(long expireTime)
{
super();
}
/**
* 根据会话ID获取会话
*
* @param sessionId 会话ID
* @return ShiroSession
*/
@Override
protected Session doReadSession(Serializable sessionId)
{
SysUserOnline sysUserOnline=new SysUserOnline();
if(sysUserOnlineService==null ){
sysUserOnline.setId(String.valueOf(sessionId));
}else{
sysUserOnline = sysUserOnlineService.get(String.valueOf(sessionId));
}
if (sysUserOnline == null)
{
return null;
}
return onlineSessionFactory.createSession(sysUserOnline);
}
/**
* 当会话过期/停止(如用户退出时)属性等会调用
*/
@Override
protected void doDelete(Session session)
{
OnlineSession onlineSession = (OnlineSession) session;
if (null == onlineSession)
{
return;
}
onlineSession.setStatus(OnlineSession.OnlineStatus.off_line);
SysUserOnline sysUserOnline=new SysUserOnline();
sysUserOnline.setId(String.valueOf(onlineSession.getId()));
sysUserOnlineService.delete(sysUserOnline);
}
}
|
<gh_stars>1-10
const sequenceParser = require('../generated-parser/sequenceParser');
const seqParser = sequenceParser.sequenceParser;
const RetContext = seqParser.RetContext;
const ProgContext = seqParser.ProgContext;
const MessageContext = seqParser.MessageContext;
const CreationContext = seqParser.CreationContext;
RetContext.prototype.ReturnTo = function() {
const stat = this.parentCtx;
const block = stat.parentCtx;
const blockParent = block.parentCtx;
if(blockParent instanceof ProgContext) {
return blockParent.Starter();
} else {
let ctx = blockParent;
while (ctx && !(ctx instanceof MessageContext) && !(ctx instanceof CreationContext)) {
if(ctx instanceof ProgContext) {
return ctx.Starter();
}
ctx = ctx.parentCtx;
}
if(ctx instanceof MessageContext) {
return ctx.messageBody()?.from()?.getFormattedText() || ctx.ClosestAncestorStat().Origin();
}
return ctx.ClosestAncestorStat().Origin();
}
}
|
<reponame>eddie4941/servicetalk
/*
* Copyright © 2019, 2021 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.servicetalk.http.netty;
import io.servicetalk.buffer.api.Buffer;
import io.servicetalk.buffer.netty.BufferAllocators;
import io.servicetalk.concurrent.SingleSource;
import io.servicetalk.concurrent.api.Processors;
import io.servicetalk.concurrent.api.Publisher;
import io.servicetalk.concurrent.api.Single;
import io.servicetalk.http.api.StreamingHttpConnection;
import io.servicetalk.http.api.StreamingHttpRequest;
import io.servicetalk.http.api.StreamingHttpResponse;
import io.servicetalk.http.api.StreamingHttpService;
import io.servicetalk.transport.netty.internal.FlushStrategies;
import io.servicetalk.transport.netty.internal.NettyConnectionContext;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeoutException;
import static io.servicetalk.concurrent.api.SourceAdapters.fromSource;
import static io.servicetalk.concurrent.internal.TestTimeoutConstants.CI;
import static io.servicetalk.http.api.HttpHeaderNames.TRANSFER_ENCODING;
import static io.servicetalk.http.api.HttpHeaderValues.CHUNKED;
import static io.servicetalk.http.api.HttpRequestMethod.POST;
import static io.servicetalk.http.netty.AbstractNettyHttpServerTest.ExecutorSupplier.CACHED;
import static io.servicetalk.http.netty.AbstractNettyHttpServerTest.ExecutorSupplier.CACHED_SERVER;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.fail;
class FlushStrategyForClientApiTest extends AbstractNettyHttpServerTest {
private final CountDownLatch requestLatch = new CountDownLatch(1);
private final BlockingQueue<Buffer> payloadBuffersReceived = new ArrayBlockingQueue<>(2);
private volatile StreamingHttpRequest request;
@BeforeEach
void setUp() {
setUp(CACHED, CACHED_SERVER);
}
@Override
void service(final StreamingHttpService service) {
super.service((ctx, request, responseFactory) -> {
FlushStrategyForClientApiTest.this.request = request;
requestLatch.countDown();
request.payloadBody().forEach(buffer -> {
try {
payloadBuffersReceived.put(buffer);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
return Single.succeeded(responseFactory.ok());
});
}
@Test
void aggregatedApiShouldFlushOnEnd() throws Exception {
final StreamingHttpConnection connection = streamingHttpConnection();
// The payload never completes, so since the aggregated API should use `flushOnEnd`, it should never flush.
final Single<StreamingHttpResponse> responseSingle = connection.request(
connection.asConnection().newRequest(POST, "/")
.addHeader(TRANSFER_ENCODING, CHUNKED)
.toStreamingRequest().payloadBody(Publisher.never()));
try {
responseSingle.toFuture().get(CI ? 900 : 100, MILLISECONDS);
fail("Expected timeout");
} catch (TimeoutException e) {
// After the timeout, we've given the client some time to write and send the metadata, if it was going to.
assertNull(request);
}
}
@Test
void aggregatedApiShouldNotOverrideExplicit() throws Exception {
final StreamingHttpConnection connection = streamingHttpConnection();
((NettyConnectionContext) connection.connectionContext()).updateFlushStrategy(
(prev, isOriginal) -> FlushStrategies.flushOnEach());
final Single<StreamingHttpResponse> responseSingle = connection.request(
connection.asConnection().newRequest(POST, "/")
.addHeader(TRANSFER_ENCODING, CHUNKED)
.toStreamingRequest().payloadBody(Publisher.never()));
responseSingle.toFuture(); // Subscribe, to initiate the request, but we don't care about the response.
requestLatch.await(); // Wait for the server to receive the response, meaning the client wrote and flushed.
}
@Test
void streamingApiShouldFlushOnEach() throws Exception {
final StreamingHttpConnection connection = streamingHttpConnection();
final SingleSource.Processor<Buffer, Buffer> payloadItemProcessor = Processors.newSingleProcessor();
final Publisher<Buffer> payload = fromSource(payloadItemProcessor).toPublisher();
final Single<StreamingHttpResponse> responseSingle = connection.request(
connection.newRequest(POST, "/").payloadBody(payload));
responseSingle.toFuture(); // Subscribe, to initiate the request, but we don't care about the response.
requestLatch.await(); // Wait for the server to receive the response, meaning the client wrote and flushed.
MatcherAssert.assertThat(payloadBuffersReceived.size(), is(0));
final Buffer payloadItem = BufferAllocators.DEFAULT_ALLOCATOR.fromAscii("Hello");
payloadItemProcessor.onSuccess(payloadItem);
Buffer receivedBuffer = payloadBuffersReceived.take(); // Wait for the server to receive the payload
MatcherAssert.assertThat(receivedBuffer, is(payloadItem));
}
}
|
<filename>x/staking/types/query.pb.go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/staking/query.proto
package types
import (
context "context"
fmt "fmt"
github_com_cosmos_cosmos_sdk_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
// QueryValidatorsRequest is request type for Query/Validators RPC method
type QueryValidatorsRequest struct {
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryValidatorsRequest) Reset() { *m = QueryValidatorsRequest{} }
func (m *QueryValidatorsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorsRequest) ProtoMessage() {}
func (*QueryValidatorsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{0}
}
func (m *QueryValidatorsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorsRequest.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 *QueryValidatorsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorsRequest.Merge(m, src)
}
func (m *QueryValidatorsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorsRequest proto.InternalMessageInfo
func (m *QueryValidatorsRequest) GetStatus() string {
if m != nil {
return m.Status
}
return ""
}
func (m *QueryValidatorsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryValidatorsResponse is response type for the Query/Validators RPC method
type QueryValidatorsResponse struct {
Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryValidatorsResponse) Reset() { *m = QueryValidatorsResponse{} }
func (m *QueryValidatorsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorsResponse) ProtoMessage() {}
func (*QueryValidatorsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{1}
}
func (m *QueryValidatorsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorsResponse.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 *QueryValidatorsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorsResponse.Merge(m, src)
}
func (m *QueryValidatorsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorsResponse proto.InternalMessageInfo
func (m *QueryValidatorsResponse) GetValidators() []Validator {
if m != nil {
return m.Validators
}
return nil
}
func (m *QueryValidatorsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryValidatorRequest is response type for the Query/Validator RPC method
type QueryValidatorRequest struct {
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
}
func (m *QueryValidatorRequest) Reset() { *m = QueryValidatorRequest{} }
func (m *QueryValidatorRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorRequest) ProtoMessage() {}
func (*QueryValidatorRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{2}
}
func (m *QueryValidatorRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorRequest.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 *QueryValidatorRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorRequest.Merge(m, src)
}
func (m *QueryValidatorRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorRequest proto.InternalMessageInfo
func (m *QueryValidatorRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
// QueryValidatorResponse is response type for the Query/Validator RPC method
type QueryValidatorResponse struct {
Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"`
}
func (m *QueryValidatorResponse) Reset() { *m = QueryValidatorResponse{} }
func (m *QueryValidatorResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorResponse) ProtoMessage() {}
func (*QueryValidatorResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{3}
}
func (m *QueryValidatorResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorResponse.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 *QueryValidatorResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorResponse.Merge(m, src)
}
func (m *QueryValidatorResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorResponse proto.InternalMessageInfo
func (m *QueryValidatorResponse) GetValidator() Validator {
if m != nil {
return m.Validator
}
return Validator{}
}
// QueryValidatorDelegationsRequest is request type for the Query/ValidatorDelegations RPC method
type QueryValidatorDelegationsRequest struct {
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryValidatorDelegationsRequest) Reset() { *m = QueryValidatorDelegationsRequest{} }
func (m *QueryValidatorDelegationsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorDelegationsRequest) ProtoMessage() {}
func (*QueryValidatorDelegationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{4}
}
func (m *QueryValidatorDelegationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorDelegationsRequest.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 *QueryValidatorDelegationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorDelegationsRequest.Merge(m, src)
}
func (m *QueryValidatorDelegationsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorDelegationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorDelegationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorDelegationsRequest proto.InternalMessageInfo
func (m *QueryValidatorDelegationsRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
func (m *QueryValidatorDelegationsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryValidatorDelegationsRequest is response type for the Query/ValidatorDelegations RPC method
type QueryValidatorDelegationsResponse struct {
DelegationResponses DelegationResponses `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3,castrepeated=DelegationResponses" json:"delegation_responses"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryValidatorDelegationsResponse) Reset() { *m = QueryValidatorDelegationsResponse{} }
func (m *QueryValidatorDelegationsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidatorDelegationsResponse) ProtoMessage() {}
func (*QueryValidatorDelegationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{5}
}
func (m *QueryValidatorDelegationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorDelegationsResponse.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 *QueryValidatorDelegationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorDelegationsResponse.Merge(m, src)
}
func (m *QueryValidatorDelegationsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorDelegationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorDelegationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorDelegationsResponse proto.InternalMessageInfo
func (m *QueryValidatorDelegationsResponse) GetDelegationResponses() DelegationResponses {
if m != nil {
return m.DelegationResponses
}
return nil
}
func (m *QueryValidatorDelegationsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryValidatorUnbondingDelegationsRequest is required type for the Query/ValidatorUnbondingDelegations RPC method
type QueryValidatorUnbondingDelegationsRequest struct {
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryValidatorUnbondingDelegationsRequest) Reset() {
*m = QueryValidatorUnbondingDelegationsRequest{}
}
func (m *QueryValidatorUnbondingDelegationsRequest) String() string {
return proto.CompactTextString(m)
}
func (*QueryValidatorUnbondingDelegationsRequest) ProtoMessage() {}
func (*QueryValidatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{6}
}
func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.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 *QueryValidatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.Merge(m, src)
}
func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorUnbondingDelegationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest proto.InternalMessageInfo
func (m *QueryValidatorUnbondingDelegationsRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
func (m *QueryValidatorUnbondingDelegationsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryValidatorUnbondingDelegationsResponse is response type for the Query/ValidatorUnbondingDelegations RPC method
type QueryValidatorUnbondingDelegationsResponse struct {
UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryValidatorUnbondingDelegationsResponse) Reset() {
*m = QueryValidatorUnbondingDelegationsResponse{}
}
func (m *QueryValidatorUnbondingDelegationsResponse) String() string {
return proto.CompactTextString(m)
}
func (*QueryValidatorUnbondingDelegationsResponse) ProtoMessage() {}
func (*QueryValidatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{7}
}
func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.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 *QueryValidatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.Merge(m, src)
}
func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidatorUnbondingDelegationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse proto.InternalMessageInfo
func (m *QueryValidatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation {
if m != nil {
return m.UnbondingResponses
}
return nil
}
func (m *QueryValidatorUnbondingDelegationsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryDelegationRequest is request type for the Query/Delegation RPC method
type QueryDelegationRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
}
func (m *QueryDelegationRequest) Reset() { *m = QueryDelegationRequest{} }
func (m *QueryDelegationRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationRequest) ProtoMessage() {}
func (*QueryDelegationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{8}
}
func (m *QueryDelegationRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationRequest.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 *QueryDelegationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationRequest.Merge(m, src)
}
func (m *QueryDelegationRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationRequest proto.InternalMessageInfo
func (m *QueryDelegationRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryDelegationRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
// QueryDelegationResponse is response type for the Query/Delegation RPC method
type QueryDelegationResponse struct {
DelegationResponse *DelegationResponse `protobuf:"bytes,1,opt,name=delegation_response,json=delegationResponse,proto3,casttype=DelegationResponse" json:"delegation_response,omitempty"`
}
func (m *QueryDelegationResponse) Reset() { *m = QueryDelegationResponse{} }
func (m *QueryDelegationResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegationResponse) ProtoMessage() {}
func (*QueryDelegationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{9}
}
func (m *QueryDelegationResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegationResponse.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 *QueryDelegationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegationResponse.Merge(m, src)
}
func (m *QueryDelegationResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegationResponse proto.InternalMessageInfo
func (m *QueryDelegationResponse) GetDelegationResponse() *DelegationResponse {
if m != nil {
return m.DelegationResponse
}
return nil
}
// QueryUnbondingDelegationRequest is request type for the Query/UnbondingDelegation RPC method
type QueryUnbondingDelegationRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
}
func (m *QueryUnbondingDelegationRequest) Reset() { *m = QueryUnbondingDelegationRequest{} }
func (m *QueryUnbondingDelegationRequest) String() string { return proto.CompactTextString(m) }
func (*QueryUnbondingDelegationRequest) ProtoMessage() {}
func (*QueryUnbondingDelegationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{10}
}
func (m *QueryUnbondingDelegationRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryUnbondingDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryUnbondingDelegationRequest.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 *QueryUnbondingDelegationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryUnbondingDelegationRequest.Merge(m, src)
}
func (m *QueryUnbondingDelegationRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryUnbondingDelegationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryUnbondingDelegationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryUnbondingDelegationRequest proto.InternalMessageInfo
func (m *QueryUnbondingDelegationRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryUnbondingDelegationRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
// QueryDelegationResponse is response type for the Query/UnbondingDelegation RPC method
type QueryUnbondingDelegationResponse struct {
Unbond UnbondingDelegation `protobuf:"bytes,1,opt,name=unbond,proto3" json:"unbond"`
}
func (m *QueryUnbondingDelegationResponse) Reset() { *m = QueryUnbondingDelegationResponse{} }
func (m *QueryUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) }
func (*QueryUnbondingDelegationResponse) ProtoMessage() {}
func (*QueryUnbondingDelegationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{11}
}
func (m *QueryUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryUnbondingDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryUnbondingDelegationResponse.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 *QueryUnbondingDelegationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryUnbondingDelegationResponse.Merge(m, src)
}
func (m *QueryUnbondingDelegationResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryUnbondingDelegationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryUnbondingDelegationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryUnbondingDelegationResponse proto.InternalMessageInfo
func (m *QueryUnbondingDelegationResponse) GetUnbond() UnbondingDelegation {
if m != nil {
return m.Unbond
}
return UnbondingDelegation{}
}
// QueryDelegatorDelegationsRequest is request type for the Query/DelegatorDelegations RPC method
type QueryDelegatorDelegationsRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryDelegatorDelegationsRequest) Reset() { *m = QueryDelegatorDelegationsRequest{} }
func (m *QueryDelegatorDelegationsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorDelegationsRequest) ProtoMessage() {}
func (*QueryDelegatorDelegationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{12}
}
func (m *QueryDelegatorDelegationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorDelegationsRequest.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 *QueryDelegatorDelegationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorDelegationsRequest.Merge(m, src)
}
func (m *QueryDelegatorDelegationsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorDelegationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorDelegationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorDelegationsRequest proto.InternalMessageInfo
func (m *QueryDelegatorDelegationsRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryDelegatorDelegationsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryDelegatorDelegationsResponse is response type for the Query/DelegatorDelegations RPC method
type QueryDelegatorDelegationsResponse struct {
DelegationResponses []DelegationResponse `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3" json:"delegation_responses"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryDelegatorDelegationsResponse) Reset() { *m = QueryDelegatorDelegationsResponse{} }
func (m *QueryDelegatorDelegationsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorDelegationsResponse) ProtoMessage() {}
func (*QueryDelegatorDelegationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{13}
}
func (m *QueryDelegatorDelegationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorDelegationsResponse.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 *QueryDelegatorDelegationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorDelegationsResponse.Merge(m, src)
}
func (m *QueryDelegatorDelegationsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorDelegationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorDelegationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorDelegationsResponse proto.InternalMessageInfo
func (m *QueryDelegatorDelegationsResponse) GetDelegationResponses() []DelegationResponse {
if m != nil {
return m.DelegationResponses
}
return nil
}
func (m *QueryDelegatorDelegationsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryDelegatorUnbondingDelegationsRequest is request type for the Query/DelegatorUnbondingDelegations RPC method
type QueryDelegatorUnbondingDelegationsRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryDelegatorUnbondingDelegationsRequest) Reset() {
*m = QueryDelegatorUnbondingDelegationsRequest{}
}
func (m *QueryDelegatorUnbondingDelegationsRequest) String() string {
return proto.CompactTextString(m)
}
func (*QueryDelegatorUnbondingDelegationsRequest) ProtoMessage() {}
func (*QueryDelegatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{14}
}
func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.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 *QueryDelegatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.Merge(m, src)
}
func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest proto.InternalMessageInfo
func (m *QueryDelegatorUnbondingDelegationsRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryDelegatorUnbondingDelegationsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryUnbondingDelegatorDelegationsResponse is response type for the Query/UnbondingDelegatorDelegations RPC method
type QueryDelegatorUnbondingDelegationsResponse struct {
UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryDelegatorUnbondingDelegationsResponse) Reset() {
*m = QueryDelegatorUnbondingDelegationsResponse{}
}
func (m *QueryDelegatorUnbondingDelegationsResponse) String() string {
return proto.CompactTextString(m)
}
func (*QueryDelegatorUnbondingDelegationsResponse) ProtoMessage() {}
func (*QueryDelegatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{15}
}
func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.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 *QueryDelegatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.Merge(m, src)
}
func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse proto.InternalMessageInfo
func (m *QueryDelegatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation {
if m != nil {
return m.UnbondingResponses
}
return nil
}
func (m *QueryDelegatorUnbondingDelegationsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryRedelegationsRequest is request type for the Query/Redelegations RPC method
type QueryRedelegationsRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
SrcValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=src_validator_addr,json=srcValidatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"src_validator_addr,omitempty"`
DstValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,3,opt,name=dst_validator_addr,json=dstValidatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"dst_validator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,4,opt,name=req,proto3" json:"req,omitempty"`
}
func (m *QueryRedelegationsRequest) Reset() { *m = QueryRedelegationsRequest{} }
func (m *QueryRedelegationsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryRedelegationsRequest) ProtoMessage() {}
func (*QueryRedelegationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{16}
}
func (m *QueryRedelegationsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryRedelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryRedelegationsRequest.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 *QueryRedelegationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryRedelegationsRequest.Merge(m, src)
}
func (m *QueryRedelegationsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryRedelegationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryRedelegationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryRedelegationsRequest proto.InternalMessageInfo
func (m *QueryRedelegationsRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryRedelegationsRequest) GetSrcValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.SrcValidatorAddr
}
return nil
}
func (m *QueryRedelegationsRequest) GetDstValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.DstValidatorAddr
}
return nil
}
func (m *QueryRedelegationsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryRedelegationsResponse is response type for the Query/Redelegations RPC method
type QueryRedelegationsResponse struct {
RedelegationResponses []RedelegationResponse `protobuf:"bytes,1,rep,name=redelegation_responses,json=redelegationResponses,proto3" json:"redelegation_responses"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
func (m *QueryRedelegationsResponse) Reset() { *m = QueryRedelegationsResponse{} }
func (m *QueryRedelegationsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryRedelegationsResponse) ProtoMessage() {}
func (*QueryRedelegationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{17}
}
func (m *QueryRedelegationsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryRedelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryRedelegationsResponse.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 *QueryRedelegationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryRedelegationsResponse.Merge(m, src)
}
func (m *QueryRedelegationsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryRedelegationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryRedelegationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryRedelegationsResponse proto.InternalMessageInfo
func (m *QueryRedelegationsResponse) GetRedelegationResponses() []RedelegationResponse {
if m != nil {
return m.RedelegationResponses
}
return nil
}
func (m *QueryRedelegationsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryDelegatorValidatorsRequest is request type for the Query/DelegatorValidators RPC method
type QueryDelegatorValidatorsRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
Req *query.PageRequest `protobuf:"bytes,2,opt,name=req,proto3" json:"req,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_802d43a0c79dce0e, []int{18}
}
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) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryDelegatorValidatorsRequest) GetReq() *query.PageRequest {
if m != nil {
return m.Req
}
return nil
}
// QueryDelegatorValidatorsResponse is response type for the Query/DelegatorValidators RPC method
type QueryDelegatorValidatorsResponse struct {
Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,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_802d43a0c79dce0e, []int{19}
}
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() []Validator {
if m != nil {
return m.Validators
}
return nil
}
func (m *QueryDelegatorValidatorsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
// QueryDelegatorValidatorRequest is request type for the Query/DelegatorValidator RPC method
type QueryDelegatorValidatorRequest struct {
DelegatorAddr github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_addr,omitempty"`
ValidatorAddr github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_addr,omitempty"`
}
func (m *QueryDelegatorValidatorRequest) Reset() { *m = QueryDelegatorValidatorRequest{} }
func (m *QueryDelegatorValidatorRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorValidatorRequest) ProtoMessage() {}
func (*QueryDelegatorValidatorRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{20}
}
func (m *QueryDelegatorValidatorRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorValidatorRequest.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 *QueryDelegatorValidatorRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorValidatorRequest.Merge(m, src)
}
func (m *QueryDelegatorValidatorRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorValidatorRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorValidatorRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorValidatorRequest proto.InternalMessageInfo
func (m *QueryDelegatorValidatorRequest) GetDelegatorAddr() github_com_cosmos_cosmos_sdk_types.AccAddress {
if m != nil {
return m.DelegatorAddr
}
return nil
}
func (m *QueryDelegatorValidatorRequest) GetValidatorAddr() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.ValidatorAddr
}
return nil
}
// QueryDelegatorValidatorResponse response type for the Query/DelegatorValidator RPC method
type QueryDelegatorValidatorResponse struct {
Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"`
}
func (m *QueryDelegatorValidatorResponse) Reset() { *m = QueryDelegatorValidatorResponse{} }
func (m *QueryDelegatorValidatorResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDelegatorValidatorResponse) ProtoMessage() {}
func (*QueryDelegatorValidatorResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{21}
}
func (m *QueryDelegatorValidatorResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDelegatorValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDelegatorValidatorResponse.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 *QueryDelegatorValidatorResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDelegatorValidatorResponse.Merge(m, src)
}
func (m *QueryDelegatorValidatorResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDelegatorValidatorResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDelegatorValidatorResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDelegatorValidatorResponse proto.InternalMessageInfo
func (m *QueryDelegatorValidatorResponse) GetValidator() Validator {
if m != nil {
return m.Validator
}
return Validator{}
}
// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC method
type QueryHistoricalInfoRequest struct {
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *QueryHistoricalInfoRequest) Reset() { *m = QueryHistoricalInfoRequest{} }
func (m *QueryHistoricalInfoRequest) String() string { return proto.CompactTextString(m) }
func (*QueryHistoricalInfoRequest) ProtoMessage() {}
func (*QueryHistoricalInfoRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{22}
}
func (m *QueryHistoricalInfoRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryHistoricalInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryHistoricalInfoRequest.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 *QueryHistoricalInfoRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryHistoricalInfoRequest.Merge(m, src)
}
func (m *QueryHistoricalInfoRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryHistoricalInfoRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryHistoricalInfoRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryHistoricalInfoRequest proto.InternalMessageInfo
func (m *QueryHistoricalInfoRequest) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC method
type QueryHistoricalInfoResponse struct {
Hist *HistoricalInfo `protobuf:"bytes,1,opt,name=hist,proto3" json:"hist,omitempty"`
}
func (m *QueryHistoricalInfoResponse) Reset() { *m = QueryHistoricalInfoResponse{} }
func (m *QueryHistoricalInfoResponse) String() string { return proto.CompactTextString(m) }
func (*QueryHistoricalInfoResponse) ProtoMessage() {}
func (*QueryHistoricalInfoResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{23}
}
func (m *QueryHistoricalInfoResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryHistoricalInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryHistoricalInfoResponse.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 *QueryHistoricalInfoResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryHistoricalInfoResponse.Merge(m, src)
}
func (m *QueryHistoricalInfoResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryHistoricalInfoResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryHistoricalInfoResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryHistoricalInfoResponse proto.InternalMessageInfo
func (m *QueryHistoricalInfoResponse) GetHist() *HistoricalInfo {
if m != nil {
return m.Hist
}
return nil
}
// QueryPoolRequest is request type for the Query/Pool RPC method
type QueryPoolRequest struct {
}
func (m *QueryPoolRequest) Reset() { *m = QueryPoolRequest{} }
func (m *QueryPoolRequest) String() string { return proto.CompactTextString(m) }
func (*QueryPoolRequest) ProtoMessage() {}
func (*QueryPoolRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{24}
}
func (m *QueryPoolRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryPoolRequest.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 *QueryPoolRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPoolRequest.Merge(m, src)
}
func (m *QueryPoolRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryPoolRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPoolRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPoolRequest proto.InternalMessageInfo
// QueryPoolResponse is response type for the Query/Pool RPC method
type QueryPoolResponse struct {
Pool Pool `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"`
}
func (m *QueryPoolResponse) Reset() { *m = QueryPoolResponse{} }
func (m *QueryPoolResponse) String() string { return proto.CompactTextString(m) }
func (*QueryPoolResponse) ProtoMessage() {}
func (*QueryPoolResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_802d43a0c79dce0e, []int{25}
}
func (m *QueryPoolResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryPoolResponse.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 *QueryPoolResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPoolResponse.Merge(m, src)
}
func (m *QueryPoolResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryPoolResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPoolResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPoolResponse proto.InternalMessageInfo
func (m *QueryPoolResponse) GetPool() Pool {
if m != nil {
return m.Pool
}
return Pool{}
}
// QueryParametersRequest is request type for the Query/Parameters 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_802d43a0c79dce0e, []int{26}
}
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
// QueryParametersResponse is response type for the Query/Parameters RPC method
type QueryParamsResponse struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"`
}
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_802d43a0c79dce0e, []int{27}
}
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{}
}
func (m *QueryParamsResponse) GetRes() *query.PageResponse {
if m != nil {
return m.Res
}
return nil
}
func init() {
proto.RegisterType((*QueryValidatorsRequest)(nil), "cosmos.staking.QueryValidatorsRequest")
proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.staking.QueryValidatorsResponse")
proto.RegisterType((*QueryValidatorRequest)(nil), "cosmos.staking.QueryValidatorRequest")
proto.RegisterType((*QueryValidatorResponse)(nil), "cosmos.staking.QueryValidatorResponse")
proto.RegisterType((*QueryValidatorDelegationsRequest)(nil), "cosmos.staking.QueryValidatorDelegationsRequest")
proto.RegisterType((*QueryValidatorDelegationsResponse)(nil), "cosmos.staking.QueryValidatorDelegationsResponse")
proto.RegisterType((*QueryValidatorUnbondingDelegationsRequest)(nil), "cosmos.staking.QueryValidatorUnbondingDelegationsRequest")
proto.RegisterType((*QueryValidatorUnbondingDelegationsResponse)(nil), "cosmos.staking.QueryValidatorUnbondingDelegationsResponse")
proto.RegisterType((*QueryDelegationRequest)(nil), "cosmos.staking.QueryDelegationRequest")
proto.RegisterType((*QueryDelegationResponse)(nil), "cosmos.staking.QueryDelegationResponse")
proto.RegisterType((*QueryUnbondingDelegationRequest)(nil), "cosmos.staking.QueryUnbondingDelegationRequest")
proto.RegisterType((*QueryUnbondingDelegationResponse)(nil), "cosmos.staking.QueryUnbondingDelegationResponse")
proto.RegisterType((*QueryDelegatorDelegationsRequest)(nil), "cosmos.staking.QueryDelegatorDelegationsRequest")
proto.RegisterType((*QueryDelegatorDelegationsResponse)(nil), "cosmos.staking.QueryDelegatorDelegationsResponse")
proto.RegisterType((*QueryDelegatorUnbondingDelegationsRequest)(nil), "cosmos.staking.QueryDelegatorUnbondingDelegationsRequest")
proto.RegisterType((*QueryDelegatorUnbondingDelegationsResponse)(nil), "cosmos.staking.QueryDelegatorUnbondingDelegationsResponse")
proto.RegisterType((*QueryRedelegationsRequest)(nil), "cosmos.staking.QueryRedelegationsRequest")
proto.RegisterType((*QueryRedelegationsResponse)(nil), "cosmos.staking.QueryRedelegationsResponse")
proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.staking.QueryDelegatorValidatorsRequest")
proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.staking.QueryDelegatorValidatorsResponse")
proto.RegisterType((*QueryDelegatorValidatorRequest)(nil), "cosmos.staking.QueryDelegatorValidatorRequest")
proto.RegisterType((*QueryDelegatorValidatorResponse)(nil), "cosmos.staking.QueryDelegatorValidatorResponse")
proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "cosmos.staking.QueryHistoricalInfoRequest")
proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "cosmos.staking.QueryHistoricalInfoResponse")
proto.RegisterType((*QueryPoolRequest)(nil), "cosmos.staking.QueryPoolRequest")
proto.RegisterType((*QueryPoolResponse)(nil), "cosmos.staking.QueryPoolResponse")
proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.staking.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.staking.QueryParamsResponse")
}
func init() { proto.RegisterFile("cosmos/staking/query.proto", fileDescriptor_802d43a0c79dce0e) }
var fileDescriptor_802d43a0c79dce0e = []byte{
// 1099 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0xf7, 0x24, 0xc6, 0x52, 0x1e, 0x6d, 0x54, 0xc6, 0xae, 0x49, 0xb7, 0xd4, 0x76, 0xb7, 0x50,
0xfa, 0xd7, 0x4e, 0x43, 0x2f, 0x20, 0x21, 0x94, 0x50, 0x21, 0x38, 0x20, 0xb5, 0x8b, 0x08, 0xa8,
0x80, 0xcc, 0xc6, 0xbb, 0xac, 0x57, 0x71, 0x3c, 0xce, 0xce, 0x1a, 0x08, 0x12, 0x57, 0xc4, 0x11,
0x6e, 0x7c, 0x04, 0x40, 0x82, 0x03, 0x07, 0xbe, 0x01, 0xa2, 0x07, 0x0e, 0x3d, 0x80, 0xc4, 0x29,
0xa0, 0x84, 0x4f, 0xd1, 0x13, 0xda, 0xd9, 0xb7, 0xe3, 0xf5, 0xee, 0xec, 0x66, 0x9d, 0xa6, 0x90,
0x9e, 0x6c, 0xcf, 0xbc, 0xf7, 0x7b, 0xbf, 0x79, 0xef, 0xcd, 0x7b, 0x6f, 0x0c, 0x5a, 0x8f, 0xf1,
0x2d, 0xc6, 0x3b, 0xdc, 0x37, 0x37, 0xdd, 0xa1, 0xd3, 0xd9, 0x1e, 0xdb, 0xde, 0x4e, 0x7b, 0xe4,
0x31, 0x9f, 0xd1, 0xc5, 0x70, 0xaf, 0x8d, 0x7b, 0xda, 0x39, 0x94, 0x15, 0x32, 0x9d, 0x91, 0xe9,
0xb8, 0x43, 0xd3, 0x77, 0xd9, 0x30, 0x14, 0xd7, 0x6a, 0x0e, 0x73, 0x98, 0xf8, 0xda, 0x09, 0xbe,
0xe1, 0xea, 0x33, 0x09, 0x03, 0xf8, 0x19, 0xee, 0xea, 0x1f, 0x40, 0xfd, 0x4e, 0x80, 0xb6, 0x6e,
0x0e, 0x5c, 0xcb, 0xf4, 0x99, 0xc7, 0x0d, 0x7b, 0x7b, 0x6c, 0x73, 0x9f, 0xd6, 0xa1, 0xc2, 0x7d,
0xd3, 0x1f, 0xf3, 0x25, 0xd2, 0x22, 0x97, 0x16, 0x0c, 0xfc, 0x45, 0xaf, 0xc2, 0xbc, 0x67, 0x6f,
0x2f, 0xcd, 0xb5, 0xc8, 0xa5, 0x27, 0x57, 0xce, 0xb4, 0x91, 0x62, 0x48, 0xfb, 0xb6, 0xe9, 0xd8,
0xa8, 0x6f, 0x04, 0x52, 0xfa, 0x97, 0x04, 0x9e, 0x4e, 0xe1, 0xf3, 0x11, 0x1b, 0x72, 0x9b, 0xbe,
0x02, 0xf0, 0xb1, 0x5c, 0x5d, 0x22, 0xad, 0xf9, 0x38, 0x5e, 0xc4, 0x52, 0xea, 0xad, 0x95, 0xef,
0xed, 0x36, 0x4b, 0x46, 0x4c, 0x85, 0x5e, 0x0b, 0x98, 0x70, 0x64, 0xa2, 0xa9, 0x98, 0x84, 0x96,
0x02, 0x2a, 0x5c, 0xdf, 0x86, 0xd3, 0xd3, 0x4c, 0xa2, 0x83, 0xbe, 0x0b, 0x8b, 0x12, 0xb4, 0x6b,
0x5a, 0x96, 0x27, 0x0e, 0x7c, 0x62, 0xed, 0xc6, 0x83, 0xdd, 0xe6, 0x75, 0xc7, 0xf5, 0xfb, 0xe3,
0x8d, 0x76, 0x8f, 0x6d, 0x75, 0xd0, 0x8f, 0xe1, 0xc7, 0x75, 0x6e, 0x6d, 0x76, 0xfc, 0x9d, 0x91,
0xcd, 0x03, 0x8a, 0xab, 0x96, 0xe5, 0xd9, 0x9c, 0x1b, 0x27, 0x25, 0x50, 0xb0, 0xa2, 0xbf, 0x93,
0x74, 0xae, 0x3c, 0xfb, 0xcb, 0xb0, 0x20, 0x45, 0x85, 0xb9, 0x02, 0x47, 0x9f, 0x68, 0xe8, 0xdf,
0x11, 0x68, 0x4d, 0x23, 0xdf, 0xb2, 0x07, 0xb6, 0x23, 0x92, 0x81, 0x3f, 0xf2, 0x73, 0xcd, 0x96,
0x02, 0xbf, 0x10, 0x38, 0x9f, 0xc3, 0x15, 0x1d, 0xe2, 0x41, 0xcd, 0x92, 0xcb, 0x5d, 0x0f, 0x97,
0xa3, 0xb4, 0xd0, 0x93, 0xbe, 0x99, 0x40, 0x44, 0x08, 0x6b, 0x67, 0x03, 0x27, 0x7d, 0xff, 0x57,
0xb3, 0x9a, 0xde, 0xe3, 0x46, 0xd5, 0x4a, 0x2f, 0xce, 0x98, 0x3f, 0x3f, 0x11, 0xb8, 0x3c, 0x7d,
0x8e, 0xb7, 0x87, 0x1b, 0x6c, 0x68, 0xb9, 0x43, 0xe7, 0xf8, 0x3a, 0xff, 0x67, 0x02, 0x57, 0x8a,
0x90, 0xc6, 0x28, 0xdc, 0x85, 0xea, 0x38, 0xda, 0x4f, 0x05, 0xe1, 0x42, 0x32, 0x08, 0x0a, 0x28,
0x4c, 0x55, 0x2a, 0x51, 0x0e, 0xeb, 0xed, 0xdf, 0x08, 0xde, 0x9d, 0x78, 0x34, 0xa5, 0x6b, 0x31,
0x9a, 0x87, 0x73, 0xed, 0x6a, 0xaf, 0x27, 0x5d, 0x2b, 0x81, 0x84, 0x6b, 0xd3, 0x41, 0x9b, 0x3b,
0xa2, 0x4a, 0xf0, 0x45, 0x54, 0x07, 0xd3, 0xc9, 0x49, 0x37, 0xa1, 0xaa, 0x48, 0x7d, 0xac, 0x0a,
0x45, 0x32, 0xbf, 0xfe, 0x60, 0xb7, 0x49, 0xd3, 0xeb, 0x06, 0x4d, 0x27, 0xbd, 0xfe, 0x07, 0x81,
0xa6, 0x20, 0xa2, 0x08, 0xde, 0xe3, 0xec, 0x60, 0x1b, 0x0b, 0xa2, 0xf2, 0x58, 0xe8, 0xe8, 0x55,
0xa8, 0x84, 0x79, 0x89, 0xbe, 0x9d, 0x21, 0xa1, 0x51, 0x71, 0x52, 0x78, 0x6f, 0x45, 0xe7, 0x52,
0xdf, 0xfd, 0x47, 0xe4, 0xbf, 0x99, 0xee, 0xfe, 0x8f, 0x51, 0xe1, 0x55, 0x73, 0x45, 0xa7, 0xbc,
0xf7, 0xd0, 0x85, 0x37, 0xf4, 0xd0, 0x51, 0x56, 0x58, 0x49, 0xf8, 0x80, 0x0a, 0x7b, 0x1c, 0xbc,
0x2c, 0x2b, 0xec, 0x01, 0xa4, 0x8f, 0x5d, 0x85, 0xfd, 0x67, 0x0e, 0xce, 0x08, 0xe2, 0x86, 0x6d,
0xfd, 0x97, 0xde, 0xed, 0x02, 0xe5, 0x5e, 0xaf, 0x7b, 0x54, 0x75, 0xe0, 0x14, 0xf7, 0x7a, 0xeb,
0x53, 0x0d, 0xb2, 0x0b, 0xd4, 0xe2, 0x7e, 0xd2, 0xc0, 0xfc, 0xa1, 0x0d, 0x58, 0xdc, 0x5f, 0x57,
0x75, 0xe0, 0x72, 0xa1, 0xfc, 0xf8, 0x81, 0x80, 0xa6, 0x72, 0x33, 0xe6, 0x83, 0x09, 0x75, 0xcf,
0xce, 0xb9, 0x80, 0xcf, 0x26, 0x53, 0x22, 0x0e, 0x93, 0xb8, 0x82, 0xa7, 0x3d, 0xfb, 0xe1, 0x2f,
0xe1, 0xb7, 0x51, 0x83, 0x90, 0xf9, 0x9c, 0x7e, 0x1a, 0x1c, 0x93, 0xab, 0xf7, 0x75, 0xaa, 0x18,
0xff, 0xff, 0xaf, 0x8c, 0xdf, 0x09, 0x34, 0x32, 0x38, 0x3d, 0xce, 0xed, 0xf5, 0xc3, 0xcc, 0xa4,
0x38, 0xaa, 0x27, 0xcd, 0x4d, 0xbc, 0x26, 0xaf, 0xbb, 0xdc, 0x67, 0x9e, 0xdb, 0x33, 0x07, 0x6f,
0x0c, 0x3f, 0x62, 0xb1, 0xc7, 0x68, 0xdf, 0x76, 0x9d, 0xbe, 0x2f, 0x90, 0xe7, 0x0d, 0xfc, 0xa5,
0xdf, 0x81, 0xb3, 0x4a, 0x2d, 0xe4, 0xb4, 0x02, 0xe5, 0xbe, 0xcb, 0x7d, 0xa4, 0xd3, 0x48, 0xd2,
0x49, 0x68, 0x09, 0x59, 0x9d, 0xc2, 0x29, 0x01, 0x79, 0x9b, 0xb1, 0x01, 0x9a, 0xd7, 0x5f, 0x85,
0xa7, 0x62, 0x6b, 0x08, 0xde, 0x86, 0xf2, 0x88, 0xb1, 0x01, 0x82, 0xd7, 0x92, 0xe0, 0x81, 0x2c,
0x1e, 0x53, 0xc8, 0xe9, 0x35, 0xa0, 0x21, 0x88, 0xe9, 0x99, 0x5b, 0xd1, 0x5d, 0xd2, 0x77, 0xa0,
0x3a, 0xb5, 0x8a, 0xe0, 0x37, 0xa1, 0x32, 0x12, 0x2b, 0x08, 0x5f, 0x4f, 0xc1, 0x8b, 0xdd, 0x68,
0x3c, 0x09, 0x65, 0x67, 0xcb, 0xd5, 0x95, 0x5f, 0x4f, 0xc0, 0x13, 0xc2, 0x36, 0xed, 0x02, 0x4c,
0xae, 0x0e, 0xbd, 0x98, 0xb4, 0xa5, 0xfe, 0x87, 0x40, 0x7b, 0xfe, 0x40, 0x39, 0x1c, 0x3a, 0x4b,
0xf4, 0x7d, 0x58, 0x90, 0xeb, 0xf4, 0xb9, 0x7c, 0xbd, 0x08, 0xfe, 0xe2, 0x41, 0x62, 0x12, 0xfd,
0x73, 0xa8, 0xa9, 0x1e, 0x97, 0x74, 0x39, 0x1f, 0x21, 0x3d, 0x54, 0x68, 0x37, 0x66, 0xd0, 0x90,
0xe6, 0xbf, 0x21, 0x70, 0x2e, 0xf7, 0x7d, 0x45, 0x5f, 0xcc, 0x87, 0xcd, 0x19, 0x73, 0xb4, 0x97,
0x0e, 0xa3, 0x2a, 0xa9, 0x75, 0x01, 0x26, 0x1b, 0x19, 0x81, 0x4d, 0x3d, 0x00, 0x32, 0x02, 0x9b,
0x1e, 0xfd, 0xf4, 0x12, 0xfd, 0x0c, 0xaa, 0x0a, 0x0a, 0xb4, 0xa3, 0x44, 0xc8, 0x7e, 0x73, 0x68,
0xcb, 0xc5, 0x15, 0xe2, 0x61, 0x57, 0x8d, 0xb6, 0x19, 0x61, 0xcf, 0x99, 0xd8, 0x33, 0xc2, 0x9e,
0x37, 0x37, 0x63, 0xd8, 0x73, 0x87, 0xbe, 0x8c, 0xb0, 0x17, 0x99, 0x6e, 0x33, 0xc2, 0x5e, 0x68,
0xc6, 0xd4, 0x4b, 0xb4, 0x0f, 0x27, 0xa7, 0xc6, 0x0d, 0x7a, 0x59, 0x09, 0xa7, 0x9a, 0xfc, 0xb4,
0x2b, 0x45, 0x44, 0xe3, 0xf1, 0x57, 0x74, 0xdf, 0x8c, 0xf8, 0x67, 0x8f, 0x14, 0xda, 0x72, 0x71,
0x05, 0x69, 0xfb, 0x13, 0xa0, 0x69, 0x01, 0xda, 0x2e, 0x88, 0x14, 0x59, 0xee, 0x14, 0x96, 0x97,
0x86, 0x37, 0x61, 0x71, 0xba, 0x75, 0x50, 0xb5, 0xd3, 0x94, 0xbd, 0x4c, 0xbb, 0x5a, 0x48, 0x56,
0x1a, 0x7b, 0x13, 0xca, 0x41, 0x2b, 0xa1, 0x2d, 0xa5, 0x5a, 0xac, 0x4b, 0x69, 0xe7, 0x73, 0x24,
0x24, 0xdc, 0x5b, 0x50, 0x09, 0x5b, 0x07, 0xd5, 0xd5, 0xe2, 0xf1, 0xee, 0xa4, 0x5d, 0xc8, 0x95,
0x89, 0x40, 0xd7, 0x5e, 0xbb, 0xb7, 0xd7, 0x20, 0xf7, 0xf7, 0x1a, 0xe4, 0xef, 0xbd, 0x06, 0xf9,
0x6a, 0xbf, 0x51, 0xba, 0xbf, 0xdf, 0x28, 0xfd, 0xb9, 0xdf, 0x28, 0xdd, 0xbd, 0x96, 0x3b, 0x76,
0x7c, 0x2a, 0xff, 0x95, 0x16, 0x03, 0xc8, 0x46, 0x45, 0xfc, 0x29, 0xfd, 0xc2, 0xbf, 0x01, 0x00,
0x00, 0xff, 0xff, 0x4d, 0x50, 0xb2, 0x10, 0x15, 0x17, 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 {
// Validators queries all validators that match the given status
Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error)
// Validator queries validator info for given validator addr
Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error)
// ValidatorDelegations queries delegate info for given validator
ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error)
// ValidatorUnbondingDelegations queries unbonding delegations of a validator
ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error)
// Delegation queries delegate info for given validator delegator pair
Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error)
// UnbondingDelegation queries unbonding info for give validator delegator pair
UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error)
// DelegatorDelegations queries all delegations of a give delegator address
DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error)
// DelegatorUnbondingDelegations queries all unbonding delegations of a give delegator address
DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error)
// Redelegations queries redelegations of given address
Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error)
// DelegatorValidators queries all validator info for given delegator address
DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error)
// DelegatorValidator queries validator info for given delegator validator pair
DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error)
// HistoricalInfo queries the historical info for given height
HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error)
// Pool queries the pool info
Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error)
// Parameters queries the staking parameters
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) {
out := new(QueryValidatorsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Validators", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) {
out := new(QueryValidatorResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Validator", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) {
out := new(QueryValidatorDelegationsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/ValidatorDelegations", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) {
out := new(QueryValidatorUnbondingDelegationsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/ValidatorUnbondingDelegations", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) {
out := new(QueryDelegationResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Delegation", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) {
out := new(QueryUnbondingDelegationResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/UnbondingDelegation", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) {
out := new(QueryDelegatorDelegationsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/DelegatorDelegations", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) {
out := new(QueryDelegatorUnbondingDelegationsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/DelegatorUnbondingDelegations", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) {
out := new(QueryRedelegationsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Redelegations", 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.staking.Query/DelegatorValidators", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) {
out := new(QueryDelegatorValidatorResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/DelegatorValidator", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) {
out := new(QueryHistoricalInfoResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/HistoricalInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) {
out := new(QueryPoolResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Pool", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/cosmos.staking.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Validators queries all validators that match the given status
Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error)
// Validator queries validator info for given validator addr
Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error)
// ValidatorDelegations queries delegate info for given validator
ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error)
// ValidatorUnbondingDelegations queries unbonding delegations of a validator
ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error)
// Delegation queries delegate info for given validator delegator pair
Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error)
// UnbondingDelegation queries unbonding info for give validator delegator pair
UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error)
// DelegatorDelegations queries all delegations of a give delegator address
DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error)
// DelegatorUnbondingDelegations queries all unbonding delegations of a give delegator address
DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error)
// Redelegations queries redelegations of given address
Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error)
// DelegatorValidators queries all validator info for given delegator address
DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error)
// DelegatorValidator queries validator info for given delegator validator pair
DelegatorValidator(context.Context, *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error)
// HistoricalInfo queries the historical info for given height
HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error)
// Pool queries the pool info
Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error)
// Parameters queries the staking parameters
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Validators(ctx context.Context, req *QueryValidatorsRequest) (*QueryValidatorsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Validators not implemented")
}
func (*UnimplementedQueryServer) Validator(ctx context.Context, req *QueryValidatorRequest) (*QueryValidatorResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Validator not implemented")
}
func (*UnimplementedQueryServer) ValidatorDelegations(ctx context.Context, req *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidatorDelegations not implemented")
}
func (*UnimplementedQueryServer) ValidatorUnbondingDelegations(ctx context.Context, req *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidatorUnbondingDelegations not implemented")
}
func (*UnimplementedQueryServer) Delegation(ctx context.Context, req *QueryDelegationRequest) (*QueryDelegationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delegation not implemented")
}
func (*UnimplementedQueryServer) UnbondingDelegation(ctx context.Context, req *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnbondingDelegation not implemented")
}
func (*UnimplementedQueryServer) DelegatorDelegations(ctx context.Context, req *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorDelegations not implemented")
}
func (*UnimplementedQueryServer) DelegatorUnbondingDelegations(ctx context.Context, req *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorUnbondingDelegations not implemented")
}
func (*UnimplementedQueryServer) Redelegations(ctx context.Context, req *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Redelegations not implemented")
}
func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented")
}
func (*UnimplementedQueryServer) DelegatorValidator(ctx context.Context, req *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidator not implemented")
}
func (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented")
}
func (*UnimplementedQueryServer) Pool(ctx context.Context, req *QueryPoolRequest) (*QueryPoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented")
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Validators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Validators(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/Validators",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Validators(ctx, req.(*QueryValidatorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Validator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Validator(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/Validator",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Validator(ctx, req.(*QueryValidatorRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorDelegationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidatorDelegations(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/ValidatorDelegations",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidatorDelegations(ctx, req.(*QueryValidatorDelegationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidatorUnbondingDelegationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/ValidatorUnbondingDelegations",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, req.(*QueryValidatorUnbondingDelegationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Delegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Delegation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/Delegation",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Delegation(ctx, req.(*QueryDelegationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_UnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryUnbondingDelegationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).UnbondingDelegation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/UnbondingDelegation",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).UnbondingDelegation(ctx, req.(*QueryUnbondingDelegationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegatorDelegationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegatorDelegations(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/DelegatorDelegations",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegatorDelegations(ctx, req.(*QueryDelegatorDelegationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_DelegatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegatorUnbondingDelegationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/DelegatorUnbondingDelegations",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, req.(*QueryDelegatorUnbondingDelegationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Redelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRedelegationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Redelegations(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/Redelegations",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Redelegations(ctx, req.(*QueryRedelegationsRequest))
}
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.staking.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_DelegatorValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDelegatorValidatorRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DelegatorValidator(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/DelegatorValidator",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DelegatorValidator(ctx, req.(*QueryDelegatorValidatorRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryHistoricalInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).HistoricalInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/HistoricalInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).HistoricalInfo(ctx, req.(*QueryHistoricalInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryPoolRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Pool(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.staking.Query/Pool",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest))
}
return interceptor(ctx, in, info, handler)
}
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.staking.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.staking.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Validators",
Handler: _Query_Validators_Handler,
},
{
MethodName: "Validator",
Handler: _Query_Validator_Handler,
},
{
MethodName: "ValidatorDelegations",
Handler: _Query_ValidatorDelegations_Handler,
},
{
MethodName: "ValidatorUnbondingDelegations",
Handler: _Query_ValidatorUnbondingDelegations_Handler,
},
{
MethodName: "Delegation",
Handler: _Query_Delegation_Handler,
},
{
MethodName: "UnbondingDelegation",
Handler: _Query_UnbondingDelegation_Handler,
},
{
MethodName: "DelegatorDelegations",
Handler: _Query_DelegatorDelegations_Handler,
},
{
MethodName: "DelegatorUnbondingDelegations",
Handler: _Query_DelegatorUnbondingDelegations_Handler,
},
{
MethodName: "Redelegations",
Handler: _Query_Redelegations_Handler,
},
{
MethodName: "DelegatorValidators",
Handler: _Query_DelegatorValidators_Handler,
},
{
MethodName: "DelegatorValidator",
Handler: _Query_DelegatorValidator_Handler,
},
{
MethodName: "HistoricalInfo",
Handler: _Query_HistoricalInfo_Handler,
},
{
MethodName: "Pool",
Handler: _Query_Pool_Handler,
},
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/staking/query.proto",
}
func (m *QueryValidatorsRequest) 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 *QueryValidatorsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorsRequest) 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] = 0x12
}
if len(m.Status) > 0 {
i -= len(m.Status)
copy(dAtA[i:], m.Status)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Status)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorsResponse) 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 *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorsResponse) 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.Validators) > 0 {
for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Validators[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 *QueryValidatorRequest) 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 *QueryValidatorRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorResponse) 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 *QueryValidatorResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Validator.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 *QueryValidatorDelegationsRequest) 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 *QueryValidatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorDelegationsRequest) 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] = 0x12
}
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorDelegationsResponse) 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 *QueryValidatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorDelegationsResponse) 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.DelegationResponses) > 0 {
for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.DelegationResponses[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 *QueryValidatorUnbondingDelegationsRequest) 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 *QueryValidatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorUnbondingDelegationsRequest) 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] = 0x12
}
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidatorUnbondingDelegationsResponse) 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 *QueryValidatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 {
for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.UnbondingResponses[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 *QueryDelegationRequest) 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 *QueryDelegationRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegationResponse) 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 *QueryDelegationResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.DelegationResponse != nil {
{
size, err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) 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 *QueryUnbondingDelegationRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryUnbondingDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryUnbondingDelegationResponse) 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 *QueryUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Unbond.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 *QueryDelegatorDelegationsRequest) 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 *QueryDelegatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorDelegationsRequest) 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] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorDelegationsResponse) 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 *QueryDelegatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorDelegationsResponse) 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.DelegationResponses) > 0 {
for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.DelegationResponses[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 *QueryDelegatorUnbondingDelegationsRequest) 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 *QueryDelegatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorUnbondingDelegationsRequest) 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] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorUnbondingDelegationsResponse) 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 *QueryDelegatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 {
for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.UnbondingResponses[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 *QueryRedelegationsRequest) 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 *QueryRedelegationsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryRedelegationsRequest) 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 len(m.DstValidatorAddr) > 0 {
i -= len(m.DstValidatorAddr)
copy(dAtA[i:], m.DstValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DstValidatorAddr)))
i--
dAtA[i] = 0x1a
}
if len(m.SrcValidatorAddr) > 0 {
i -= len(m.SrcValidatorAddr)
copy(dAtA[i:], m.SrcValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.SrcValidatorAddr)))
i--
dAtA[i] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryRedelegationsResponse) 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 *QueryRedelegationsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryRedelegationsResponse) 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.RedelegationResponses) > 0 {
for iNdEx := len(m.RedelegationResponses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.RedelegationResponses[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 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] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
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 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.Validators) > 0 {
for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Validators[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 *QueryDelegatorValidatorRequest) 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 *QueryDelegatorValidatorRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ValidatorAddr) > 0 {
i -= len(m.ValidatorAddr)
copy(dAtA[i:], m.ValidatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr)))
i--
dAtA[i] = 0x12
}
if len(m.DelegatorAddr) > 0 {
i -= len(m.DelegatorAddr)
copy(dAtA[i:], m.DelegatorAddr)
i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryDelegatorValidatorResponse) 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 *QueryDelegatorValidatorResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDelegatorValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Validator.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 *QueryHistoricalInfoRequest) 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 *QueryHistoricalInfoRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryHistoricalInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryHistoricalInfoResponse) 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 *QueryHistoricalInfoResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Hist != nil {
{
size, err := m.Hist.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 *QueryPoolRequest) 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 *QueryPoolRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryPoolResponse) 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 *QueryPoolResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Pool.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 *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
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
}
{
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 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 *QueryValidatorsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Status)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Validators) > 0 {
for _, e := range m.Validators {
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 *QueryValidatorRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Validator.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryValidatorDelegationsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorDelegationsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.DelegationResponses) > 0 {
for _, e := range m.DelegationResponses {
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 *QueryValidatorUnbondingDelegationsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidatorUnbondingDelegationsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.UnbondingResponses) > 0 {
for _, e := range m.UnbondingResponses {
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 *QueryDelegationRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegationResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.DelegationResponse != nil {
l = m.DelegationResponse.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryUnbondingDelegationRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryUnbondingDelegationResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Unbond.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryDelegatorDelegationsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegatorDelegationsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.DelegationResponses) > 0 {
for _, e := range m.DelegationResponses {
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 *QueryDelegatorUnbondingDelegationsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegatorUnbondingDelegationsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.UnbondingResponses) > 0 {
for _, e := range m.UnbondingResponses {
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 *QueryRedelegationsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.SrcValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.DstValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryRedelegationsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.RedelegationResponses) > 0 {
for _, e := range m.RedelegationResponses {
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 *QueryDelegatorValidatorsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Req != nil {
l = m.Req.Size()
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 _, e := range m.Validators {
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 *QueryDelegatorValidatorRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.DelegatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ValidatorAddr)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDelegatorValidatorResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Validator.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryHistoricalInfoRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
return n
}
func (m *QueryHistoricalInfoResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Hist != nil {
l = m.Hist.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryPoolRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryPoolResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Pool.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
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))
if m.Res != nil {
l = m.Res.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 *QueryValidatorsRequest) 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: QueryValidatorsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Status = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
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 *QueryValidatorsResponse) 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: QueryValidatorsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorsResponse: 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 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.Validators = append(m.Validators, Validator{})
if err := m.Validators[len(m.Validators)-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 *QueryValidatorRequest) 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: QueryValidatorRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []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 *QueryValidatorResponse) 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: QueryValidatorResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Validator", 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.Validator.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 *QueryValidatorDelegationsRequest) 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: QueryValidatorDelegationsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
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 *QueryValidatorDelegationsResponse) 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: QueryValidatorDelegationsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{})
if err := m.DelegationResponses[len(m.DelegationResponses)-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 *QueryValidatorUnbondingDelegationsRequest) 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: QueryValidatorUnbondingDelegationsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
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 *QueryValidatorUnbondingDelegationsResponse) 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: QueryValidatorUnbondingDelegationsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{})
if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 *QueryDelegationRequest) 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: QueryDelegationRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []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 *QueryDelegationResponse) 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: QueryDelegationResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponse", 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.DelegationResponse == nil {
m.DelegationResponse = &DelegationResponse{}
}
if err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) 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: QueryUnbondingDelegationRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryUnbondingDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []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 *QueryUnbondingDelegationResponse) 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: QueryUnbondingDelegationResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Unbond", 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.Unbond.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 *QueryDelegatorDelegationsRequest) 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: QueryDelegatorDelegationsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
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 *QueryDelegatorDelegationsResponse) 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: QueryDelegatorDelegationsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{})
if err := m.DelegationResponses[len(m.DelegationResponses)-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 *QueryDelegatorUnbondingDelegationsRequest) 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: QueryDelegatorUnbondingDelegationsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
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 *QueryDelegatorUnbondingDelegationsResponse) 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: QueryDelegatorUnbondingDelegationsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{})
if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 *QueryRedelegationsRequest) 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: QueryRedelegationsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryRedelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SrcValidatorAddr", 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.SrcValidatorAddr = append(m.SrcValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.SrcValidatorAddr == nil {
m.SrcValidatorAddr = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DstValidatorAddr", 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.DstValidatorAddr = append(m.DstValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DstValidatorAddr == nil {
m.DstValidatorAddr = []byte{}
}
iNdEx = postIndex
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 *QueryRedelegationsResponse) 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: QueryRedelegationsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryRedelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RedelegationResponses", 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.RedelegationResponses = append(m.RedelegationResponses, RedelegationResponse{})
if err := m.RedelegationResponses[len(m.RedelegationResponses)-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 *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 DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
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 *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 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.Validators = append(m.Validators, Validator{})
if err := m.Validators[len(m.Validators)-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 *QueryDelegatorValidatorRequest) 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: QueryDelegatorValidatorRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = append(m.DelegatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.DelegatorAddr == nil {
m.DelegatorAddr = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = append(m.ValidatorAddr[:0], dAtA[iNdEx:postIndex]...)
if m.ValidatorAddr == nil {
m.ValidatorAddr = []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 *QueryDelegatorValidatorResponse) 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: QueryDelegatorValidatorResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDelegatorValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Validator", 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.Validator.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 *QueryHistoricalInfoRequest) 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: QueryHistoricalInfoRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryHistoricalInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
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 *QueryHistoricalInfoResponse) 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: QueryHistoricalInfoResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryHistoricalInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hist", 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.Hist == nil {
m.Hist = &HistoricalInfo{}
}
if err := m.Hist.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 *QueryPoolRequest) 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: QueryPoolRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryPoolRequest: 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 *QueryPoolResponse) 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: QueryPoolResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryPoolResponse: 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
}
if err := m.Pool.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 *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
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 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")
)
|
<gh_stars>0
package com.ipec.trazactivo.controller;
import com.ipec.trazactivo.model.*;
import com.ipec.trazactivo.service.*;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/activo")
public class ActivoController {
private final Logger logger = LoggerFactory.getLogger(ActivoController.class);
@Autowired
private ActivoServiceInterface activoService;
@Autowired
private DescripcionActivoServiceInterface descripcionActivoService;
@Autowired
private EstadoActivoServiceInterface estadoActivoService;
@Autowired
private NumeroAulaServiceInterface numeoAulaService;
@Autowired
private ModoAdquisicionServiceInterface modoAdquisicionService;
@Autowired
private ActivoObservacionServiceInterface activoObservacionService;
@Autowired
private EspecialidadAcademicaServiceInterface especialidadAcademicaService;
@Autowired
private PersonaResponsableServiceInterface personaResponsableService;
@GetMapping("")
public String inicio(Model model) {
List<Activo> activoTodo = activoService.listarTodo();
model.addAttribute("activotodo", activoTodo);
return "activo/index";
}
@GetMapping("/agregar")
public String agregar(@ModelAttribute("activoobjeto") Activo activo, Model model, HttpSession session) {
model.addAttribute("activoobjeto", activo);
model.addAttribute("habilitareliminar", false);
model.addAttribute("habilitareditarpkjunta", true);
model.addAttribute("habilitareditaranotaciones", false);
session.setAttribute("tipoaccionvista", "es agregar");
ListarTodo(model);
return "activo/modificar";
}
@PostMapping("/guardar") // @RequestParam(value = "nuevoregistro") Boolean nuevoRegistro,
public String guardar(@Valid @ModelAttribute("activoobjeto") Activo activo,
BindingResult errores, Model model, HttpSession session) {
//if(activo.getActivoPK().getNumeroJunta() == null)
// errores.addError(new ObjectError("activoobjeto.activoPK.numeroJunta", "error null junta
String valor = (String) session.getAttribute("tipoaccionvista");
if (errores.hasErrors()) {
if (activo.getMarca() == "") {
activo.setMarca("no indica");
}
if (activo.getModelo() == "") {
activo.setModelo("no indica");
}
if (activo.getSerie() == "") {
activo.setSerie("no indica");
}
model.addAttribute("activoobjeto", activo);
if (valor.contains("es agregar")) {
model.addAttribute("habilitareliminar", false);
model.addAttribute("habilitareditarpkjunta", true);
model.addAttribute("habilitareditaranotaciones", false);
} else if (valor.contains("es editar")) {
model.addAttribute("habilitareliminar", true);
model.addAttribute("habilitareditarpkjunta", false);
model.addAttribute("habilitareditaranotaciones", true);
}
ListarTodo(model);
return "activo/modificar";
}
// Verificar que el activo a agregar no se encuentre registrado
if (valor.contains("es agregar")) {
Activo activoEncontrado = activoService.encontrarPorNumeroActivo(activo.getActivoPK());
if (activoEncontrado != null) {
model.addAttribute("habilitareliminar", false);
model.addAttribute("habilitareditarpkjunta", true);
model.addAttribute("habilitareditaranotaciones", false);
model.addAttribute("activoestaasignado", true);
ListarTodo(model);
return "activo/modificar";
}
}
activoService.guardar(activo);
return "redirect:/activo";
}
@GetMapping("/editar/{numeroJunta}/{numeroActivo}")
public String editar(@ModelAttribute("activoobjeto") Activo activo, Model model,
@PathVariable Integer numeroJunta, @PathVariable Integer numeroActivo, HttpSession session) {
activo = activoService.encontrarPorNumeroActivo(new ActivoPK(numeroActivo, numeroJunta));
if (activo == null) {
return "redirect:/activo";
}
model.addAttribute("activoobjeto", activo);
model.addAttribute("habilitareliminar", true);
model.addAttribute("habilitareditarpkjunta", false);
model.addAttribute("habilitareditaranotaciones", true);
session.setAttribute("tipoaccionvista", "es editar");
ListarTodo(model);
/*List<ActivoObservacion> prueba = activo.getActivoObservaciones();
logger.info("Valores de prueba inicio");
for (ActivoObservacion valor: prueba) {
logger.info(valor.getTomo() + "/" + valor.getFolio() + "/" + valor.getAsiento());
}
logger.info("Valores de prueba fin");
*/
return "activo/modificar";
}
@GetMapping("/eliminar/{numeroJunta}/{numeroActivo}")
public String eliminar(@PathVariable Integer numeroJunta,
@PathVariable Integer numeroActivo) {
Activo activo = activoService.encontrarPorNumeroActivo(new ActivoPK(numeroActivo, numeroJunta));
if (activo != null) {
activoService.eliminar(activo);
}
return "redirect:/activo";
}
private void ListarTodo(Model model) {
var descripcionActivo = descripcionActivoService.listarTodo();
var estadoActivo = estadoActivoService.listarTodo();
var numeroAula = numeoAulaService.listarTodo();
var modoAdquisicion = modoAdquisicionService.listarTodo();
var especialidadAcademica = especialidadAcademicaService.listarTodo();
var personaResponsable = personaResponsableService.listarTodo();
// Ordenar alfabetico
Collections.sort(descripcionActivo, (DescripcionActivo value1, DescripcionActivo value2)
-> value1.getDetalleDescripcionActivo().compareTo(value2.getDetalleDescripcionActivo()));
Collections.sort(estadoActivo, (EstadoActivo value1, EstadoActivo value2)
-> value1.getDetalleEstadoActivo().compareTo(value2.getDetalleEstadoActivo()));
Collections.sort(numeroAula, (NumeroAula value1, NumeroAula value2)
-> value1.getDetalleNumeroAula().compareTo(value2.getDetalleNumeroAula()));
Collections.sort(modoAdquisicion, (ModoAdquisicion value1, ModoAdquisicion value2)
-> value1.getDetalleModoAdquisicion().compareTo(value2.getDetalleModoAdquisicion()));
Collections.sort(especialidadAcademica, (EspecialidadAcademica value1, EspecialidadAcademica value2)
-> value1.getDetalleEspecialidadAcademica().compareTo(value2.getDetalleEspecialidadAcademica()));
Collections.sort(personaResponsable, (PersonaResponsable value1, PersonaResponsable value2)
-> value1.getDetallePersonaResponsable().compareTo(value2.getDetallePersonaResponsable()));
model.addAttribute("descripcionactivolista", descripcionActivo);
model.addAttribute("estadoactivolista", estadoActivo);
model.addAttribute("numeroaulalista", numeroAula);
model.addAttribute("modoadquisicionlista", modoAdquisicion);
model.addAttribute("especialidadacademicalista", especialidadAcademica);
model.addAttribute("personaresponsablelista", personaResponsable);
}
}
|
The machine learning algorithm for facial recognition should comprise of two phases. The first phase should involve training a Convolutional Neural Network (CNN) using a dataset containing labeled images of faces. The CNN should have multiple layers with each layer learning a different feature or pattern in the face. During initialization, the CNN should be given a set of weights obtained from the training dataset. The weights will act as the starting point for optimization.
The second phase of the algorithm should involve the deployment of the trained CNN model for facial recognition. An input image is fed into the model, and the output of the model is compared to the pre-trained weights to identify the person in the image. If the output matches one of the pre-trained input weights, the person is identified. |
#!/bin/sh
#
# Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Distribution License v. 1.0, which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#
# Script to run schemagen
#
# Resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
WEBSERVICES_LIB=$PRG/../../..
if [ -n "$JAVA_HOME" ]
then
JAVA=$JAVA_HOME/bin/java
else
JAVA=java
fi
$JAVA $SCHEMAGEN_OPTS -cp "$WEBSERVICES_LIB/jaxb/lib/jaxb-core.jar:$WEBSERVICES_LIB/jaxb/lib/jaxb-xjc.jar:$WEBSERVICES_LIB/jaxb/lib/jaxb-jxc.jar:$WEBSERVICES_LIB/jaxb/lib/jaxb-impl.jar" com.sun.tools.jxc.SchemaGeneratorFacade "$@"
|
"""
Otrzymujesz liste wysokosci slupkow. Wszystkie slupki maja jednakowa szerokosc,
rowna jednej jednostce wysokosci i ustawione sa jeden obok drugiego. Wysokosc rowna 0
oznacza brak slupka. Oblicz ile jednostek wody mozemy maksymalnie umiescic miedzy
slupkami.
"""
# Zlozonosc czasowa O(n)
# Zlozonosc pamieciowa O(n)
# Znajdz najwyzsze graniczne slupki
# Ilosc wody rowna sie mniejszemu z dwoch granicznych slupkow minus wysokosci aktualnego
def ile_wody_v1(slupki):
n = len(slupki)
woda = 0
lewy = [float("-inf")]
for i in range(n):
lewy.append(max(lewy[i], slupki[i]))
prawy = float("-inf")
for i in range(n - 1, -1, -1):
prawy = max(prawy, slupki[i])
if min(lewy[i], prawy) > slupki[i]:
woda += min(lewy[i], prawy) - slupki[i]
return woda
# Testy Poprawnosci
def test_1():
slupki = [3, 0, 1, 0, 2]
wynik = 5
assert ile_wody_v1(slupki) == wynik
def test_2():
slupki = [9, 2, 3, 9, 0, 2]
wynik = 15
assert ile_wody_v1(slupki) == wynik
def test_3():
slupki = [1, 1]
wynik = 0
assert ile_wody_v1(slupki) == wynik
def main():
test_1()
test_2()
test_3()
if __name__ == "__main__":
main()
|
package web
import (
"embed"
"io/fs"
)
//go:embed build
var staticFiles embed.FS
// GetStaticFiles returns the embedded filesystem of static files
func GetStaticFiles() fs.FS {
fsys, err := fs.Sub(staticFiles, "build")
if err != nil {
panic(err)
}
return fsys
}
|
import {compose, createStore, applyMiddleware} from 'redux';
import rootReducer from './reducers';
import thunkMiddleware from 'redux-thunk';
import {persistStore, persistReducer} from 'redux-persist';
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web and AsyncStorage for react-native
// Redux dev tool extension
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const persistConfig = {
key: 'root',
storage,
stateReconciler: autoMergeLevel2,
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const store = createStore(
persistedReducer,
composeEnhancers(applyMiddleware(thunkMiddleware)),
);
export const persistor = persistStore(store);
export default store;
|
#! /bin/sh
# see https://www.claudiokuenzler.com/blog/796/install-upgrade-cmake-3.12.1-ubuntu-14.04-trusty-alternatives
FULLVERSION=3.12.1
VERSION=v3.12
me=`id -u`
err(){
echo "ERROR: $*"
exit 1
}
if [ "$me" != 0 ]; then
err must be run as root
fi
apt-get update
apt-get install wget
cd
url="http://www.cmake.org/files/$VERSION/cmake-$FULLVERSION.tar.gz"
fname="cmake-$FULLVERSION.tar.gz"
dir="cmake-$FULLVERSION"
[ -f "$fname" ] && rm -f $fname
[ -d "$dir" ] && rm -rf "$dir"
wget "$url" || err "unable to download $url"
[ ! -f "$fname" ] && err "$fname not found after download"
tar -xvzf "$fname" || err "unable to untar"
[ ! -d "$dir" ] && err "$dir not found after unpack"
cd $dir || err "unable to cd into $dir"
./configure || err configure failed
make install || err make failed
update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force || err "alternatives failed"
echo "cmake installed"
cmake --version
|
// sorts the array of images by creation date
// the most recent AMIs will appear first
/**
* sorts the array of images by creation date
* the most recent AMIs will appear first
*
* @param data
*/
function sortByCreationDate(data) {
const images = data.Images;
images.sort(function(a,b) {
const dateA = new Date(a['CreationDate']).getTime();
const dateB = new Date(b['CreationDate']).getTime();
return dateB - dateA;
});
}
module.exports = {
sortByCreationDate,
}
|
#!/bin/bash
#colors
RED='\033[0;31m'
BLUE='\033[40;38;5;82m'
PURPLE='\033[0;35m'
#version
NODEJS_VERSION='10'
MONGODB_VERSION='3.6'
echo "***** Installing MongoDB, Nextjs and NodeJS ********"
sleep 2
echo -e "Checking for Nodejs"
sleep 2
if [ -x "$(command -v node)" ];
then
echo -e " ${RED} You have NodeJS installed!"
else
echo -e " ${BLUE} Installing Nodejs and npm "
sleep 2
brew install node@${NODEJS_VERSION}
echo -e " ${BLUE} Nodejs and npm has been installed!"
fi
echo "Checking for Create-Next-app(React)"
sleep 2
if [ -x "$(command -v create-next-app)" ];
then
echo -e " ${RED} You have Create-Next-app(React) installed! "
else
echo -e " ${BLUE} Installing Create-Next-app(React)"
sleep 2
npm install -g create-next-app
echo -e " ${BLUE} Create-Next-app(React) has been installed!"
fi
echo "Checking for MongoDB"
sleep 2
if [ -x "$(command -v mongo)" ];
then
echo -e " ${RED} You have MongoDB database Installed!"
else
echo -e " ${BLUE} Installing MongoDB "
sleep 2
brew tap mongodb/brew && \
brew install mongodb-community@${MONGODB_VERSION} && \
brew services start mongodb-community
echo -e " ${BLUE} MongoDB has been installed!"
fi
echo Done
echo -e " ${BLUE} Tweet me @odirionyeo"
|
package com.qinjun.autotest.tsplugin.listener;
import com.qinjun.autotest.tsplugin.annotation.DemoTestData;
import com.qinjun.autotest.tsplugin.annotation.DemoUrl;
import org.testng.*;
import java.lang.reflect.Field;
public class DemoMethodListener implements IInvokedMethodListener {
@Override
public void beforeInvocation(IInvokedMethod invokedMethod, ITestResult testResult) {
ITestNGMethod testNGMethod = invokedMethod.getTestMethod();
String methodName = testNGMethod.getMethodName();
if (methodName.equals("baseTest")) {
ITestClass testClass = testNGMethod.getTestClass();
Object object = testNGMethod.getInstance();
Class cls = testClass.getRealClass();
DemoTestData demoTestData = (DemoTestData)cls.getAnnotation(DemoTestData.class);
DemoUrl demoUrl = (DemoUrl) cls.getAnnotation(DemoUrl.class);
String demoTestDataStr = demoTestData.value();
String demoUrlStr = demoUrl.value();
try {
Field fieldData = cls.getSuperclass().getDeclaredField("testData");
fieldData.set(object,demoTestDataStr);
Field fieldUrl = cls.getSuperclass().getDeclaredField("url");
fieldUrl.set(object,demoUrlStr);
}
catch (Exception e) {
System.err.println(e);
}
}
}
@Override
public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
}
}
|
<gh_stars>0
package com.cjy.flb.activity;
import android.app.Activity;
import android.content.Intent;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.cjy.flb.R;
import com.cjy.flb.adapter.WifiListViewAdapter;
import com.cjy.flb.wifi.WifiAdmin;
import com.socks.library.KLog;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.List;
/**
* 显示wifi信息页面
*/
public class WifiListActivity extends BaseActivity {
private WifiAdmin mWifiAdmin;
private ListView wifiList;
private WifiListViewAdapter mAdapter;
private List<ScanResult> tmpList;//扫描信息
private List<ScanResult> list;//扫描信息
private static final int REFRESH_CONN = 100;//刷新连接
private static final int REFRESH_NOCONN = 200;
private static final int REFRESH_LIST = 300;//刷新数据
@Override
public void initView()
{
setContentView(R.layout.activity_wifi_list);
initBar(getString(R.string.wireless_connection), false, false);
wifiList = (ListView) findViewById(R.id.wifi_listview);
}
@Override
public void initData()
{
if (mWifiAdmin == null) {
mWifiAdmin = WifiAdmin.getInstance(this);
}
mAdapter = new WifiListViewAdapter(this, list);
wifiList.setAdapter(mAdapter);
mHandler.sendEmptyMessage(REFRESH_CONN);
}
private void getWifiListInfo()
{
mWifiAdmin.openWifi();
mWifiAdmin.startScan();
tmpList = mWifiAdmin.getWifiList();
KLog.i(Arrays.toString(tmpList.toArray()));
if (tmpList == null) {
list.clear();
} else {
list = tmpList;
}
mHandler.sendEmptyMessage(REFRESH_LIST);
}
private final WifiHandler mHandler = new WifiHandler(this);
static class WifiHandler extends Handler {
WeakReference<Activity> weakReference;
public WifiHandler(Activity activity)
{
weakReference = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg)
{
WifiListActivity activity = (WifiListActivity) weakReference.get();
if (activity != null) {
switch (msg.what) {
case REFRESH_CONN:
activity.getWifiListInfo();
break;
case REFRESH_NOCONN:
activity.onClearList();
break;
case REFRESH_LIST:
activity.refershList();
break;
default:
break;
}
}
super.handleMessage(msg);
}
}
private void refershList()
{
mAdapter.setDatas(list);
mAdapter.notifyDataSetChanged();
}
private void onClearList()
{
list.clear();
mAdapter.setDatas(list);
mAdapter.notifyDataSetChanged();
}
@Override
protected void onStart()
{
super.onStart();
}
@Override
public void initListener()
{
wifiList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Intent resultIntent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("result", list.get(position).SSID);
resultIntent.putExtras(bundle);
setResult(RESULT_OK, resultIntent);
finish();
}
});
}
@Override
protected void onResume()
{
super.onResume();
}
@Override
protected void onPause()
{
super.onPause();
}
@Override
protected void onDestroy()
{
super.onDestroy();
}
}
|
<gh_stars>10-100
// Autogenerated from library/channels.i
package ideal.library.channels;
import ideal.library.elements.*;
public interface immutable_input<element> extends immutable_closeable, immutable_syncable, readonly_input<element> { }
|
<gh_stars>1-10
# frozen_string_literal: true
module HardCider
module Utils
# @param hash [Hash]
# @return [Hash]
def self.underscore_keys(hash)
hash.map { |k, v| [underscore(k), v] }.to_h
end
# @param string_or_symbol [String|Symbol]
# @return [Symbol]
def self.underscore(string_or_symbol)
string_or_symbol.to_s.gsub('-', '_').to_sym
end
end
end
|
<gh_stars>0
package intcode
import (
"os"
"testing"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
)
func init() {
out := zerolog.NewConsoleWriter()
out.Out = os.Stderr
out.NoColor = true
log.Logger = log.Output(out)
zerolog.SetGlobalLevel(zerolog.TraceLevel)
}
func TestGet(t *testing.T) {
computer := NewComputer([]AddressValue{1, 2, 3})
assert.Equal(t, AddressValue(2), computer.Memory.Get(1))
}
func TestGetRange(t *testing.T) {
computer := NewComputer([]AddressValue{1, 2, 3, 4, 5, 6})
assert.Equal(t, []AddressValue{3, 4, 5}, computer.Memory.GetRange(2, 3))
}
func TestSet(t *testing.T) {
computer := NewComputer([]AddressValue{1, 2, 3})
computer.Memory.Set(1, 10)
assert.Equal(t, AddressValue(10), computer.Memory.Get(1))
}
|
#!/bin/sh
if [ $TRAVIS_PULL_REQUEST == 'false' ]; then
echo -e "Starting to update gh-pages\n"
# copy data we're interested in to other place
cp -R docs/coverage $HOME/coverage
# go to home and setup git
cd $HOME
git config --global user.email "builds@travis-ci.org"
git config --global user.name "Travis"
# using token clone gh-pages branch
git clone --quiet --branch=gh-pages https://$GITHUBKEY@github.com/clickalicious/caching-middleware.git gh-pages > /dev/null 2>&1
# go into directory and copy data we're interested in to that directory
cd gh-pages
cp -Rf $HOME/coverage/* .
# add, commit and push files
git add -f .
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq origin gh-pages > /dev/null 2>&1
echo -e "Done\n"
fi
|
<gh_stars>100-1000
import Event from './Event';
describe('@modus/gimbal-core/event/Event', (): void => {
describe('fire', (): void => {
it('should fire an event', (): void => {
const fn = jest.fn().mockReturnValue('returned');
const instance = new Event('foo', fn);
const ret = instance.fire('foo', 'bar');
expect(ret).toBe('returned');
expect(fn).toHaveBeenCalledWith('foo', 'bar');
});
it('should fire an event when configured with an object', (): void => {
const fn = jest.fn().mockReturnValue('returned');
const instance = new Event('foo', {
fn,
priority: -10,
});
expect(instance.priority).toBe(-10);
const ret = instance.fire('foo', 'bar');
expect(ret).toBe('returned');
expect(fn).toHaveBeenCalledWith('foo', 'bar');
});
});
describe('createCallback', (): void => {
it('should create a function to fire with', (): void => {
const fn = jest.fn().mockReturnValue('returned');
const instance = new Event('foo', {
fn,
});
const cb = instance.createCallback('foo');
const ret = cb('bar');
expect(ret).toBe('returned');
expect(fn).toHaveBeenCalledWith('foo', 'bar');
});
});
});
|
def sum_digits(num):
if num == 0:
return num
else:
return (num % 10 + sum_digits(num // 10)) |
#!/bin/bash
#SBATCH -J Act_selu_1
#SBATCH --mail-user=eger@ukp.informatik.tu-darmstadt.de
#SBATCH --mail-type=FAIL
#SBATCH -e /work/scratch/se55gyhe/log/output.err.%j
#SBATCH -o /work/scratch/se55gyhe/log/output.out.%j
#SBATCH -n 1 # Number of cores
#SBATCH --mem-per-cpu=6000
#SBATCH -t 23:59:00 # Hours, minutes and seconds, or '#SBATCH -t 10' -only mins
#module load intel python/3.5
python3 /home/se55gyhe/Act_func/sequence_tagging/arg_min/PE-my.py selu 481 sgd 4 0.20233988011837312 0.011214421533709485 he_uniform 0.3
|
#!/usr/env/bin bash
#
# Buildah config settings to be applied to the Container
#
if [ -z ${BUILDAH+x} ];
then
echo "BUILDAH is unset. This scripts configures a container."
exit 1
else
echo "BUILDAH is set to '$BUILDAH'."
fi
${BUILDAH} config --author "${OCI_AUTHOR}" \
--cmd "agent -dev -client 0.0.0.0" \
--entrypoint "/usr/local/bin/consul-entrypoint.sh" \
--port 8888/tcp \
--port 8300/tcp \
--port 8301/tcp \
--port 8301/udp \
--port 8302/tcp \
--port 8302/udp \
--port 8500/tcp \
--port 8600/tcp \
--port 8600/udp \
--shell "/bin/bash -E" \
--user ${OCI_USER} \
--volume "/consul/data" \
--workingdir "/home/${OCI_USER}" \
${OCI_NAME}
# Expose the consul data directory as a volume since there's mutable state in there.
#--volume "/consul/data"
# Server RPC is used for communication between Consul clients and servers for internal
# request forwarding.
#--port=8300
# Serf LAN and WAN (WAN is used only by Consul servers) are used for gossip between
# Consul agents. LAN is within the datacenter and WAN is between just the Consul
# servers in all datacenters.
#--port=8301 8301/udp 8302 8302/udp
# HTTP and DNS (both TCP and UDP) are the primary interfaces that applications
# use to interact with Consul.
#--port=8500 8600 8600/udp
# Consul doesn't need root privileges so we run it as the consul user from the
# entry point script. The entry point script also uses dumb-init as the top-level
# process to reap any zombie processes created by Consul sub-processes.
#--entrypoint="/usr/local/bin/consul-entrypoint.sh"
# By default you'll get an insecure single-node development server that stores
# everything in RAM, exposes a web UI and HTTP endpoints, and bootstraps itself.
# Don't use this configuration for production.
#--cmd "agent -dev -client 0.0.0.0"
|
#!/bin/bash
set -e
pr_number=$1
mm_commit_sha=$2
github_username=modular-magician
sed -i 's/{{pr_number}}/'"$pr_number"'/g' /teamcityparams.xml
curl --header "Accept: application/json" --header "Authorization: Bearer $TEAMCITY_TOKEN" https://ci-oss.hashicorp.engineering/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @/teamcityparams.xml -o build.json
function update_status {
local post_body=$( jq -n \
--arg context "beta-provider-vcr-test" \
--arg target_url "${1}" \
--arg state "${2}" \
'{context: $context, target_url: $target_url, state: $state}')
curl \
-X POST \
-u "$github_username:$GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/$mm_commit_sha" \
-d "$post_body"
}
build_url=$(cat build.json | jq .webUrl)
update_status "${build_url}" "pending"
ID=$(cat build.json | jq .id -r)
curl --header "Authorization: Bearer $TEAMCITY_TOKEN" --header "Accept: application/json" https://ci-oss.hashicorp.engineering/app/rest/builds/id:$ID --output poll.json
STATUS=$(cat poll.json | jq .status -r)
STATE=$(cat poll.json | jq .state -r)
counter=0
while [[ "$STATE" != "finished" ]]; do
if [ "$counter" -gt "500" ]; then
echo "Failed to wait for job to finish, exiting"
# Call this an error because we don't know if the tests failed or not
update_status "${build_url}" "error"
# exit 0 because this script didn't have an error; the failure
# is reported via the Github Status API
exit 0
fi
sleep 30
curl --header "Authorization: Bearer $TEAMCITY_TOKEN" --header "Accept: application/json" https://ci-oss.hashicorp.engineering/app/rest/builds/id:$ID --output poll.json
STATUS=$(cat poll.json | jq .status -r)
STATE=$(cat poll.json | jq .state -r)
echo "Trying again, State: $STATE Status: $STATUS"
counter=$((counter + 1))
done
if [ "$STATUS" == "SUCCESS" ]; then
echo "Tests succeeded."
update_status "${build_url}" "success"
exit 0
fi
curl --header "Accept: application/json" --header "Authorization: Bearer $TEAMCITY_TOKEN" http://ci-oss.hashicorp.engineering/app/rest/testOccurrences?locator=build:$ID,status:FAILURE --output failed.json -L
set +e
FAILED_TESTS=$(cat failed.json | jq -r '.testOccurrence | map(.name) | join("|")')
ret=$?
if [ $ret -ne 0 ]; then
echo "Job failed without failing tests"
update_status "${build_url}" "failure"
# exit 0 because this script didn't have an error; the failure
# is reported via the Github Status API
exit 0
fi
set -e
sed -i 's/{{pr_number}}/'"$pr_number"'/g' /teamcityparamsrecording.xml
sed -i 's/{{FAILED_TESTS}}/'"$FAILED_TESTS"'/g' /teamcityparamsrecording.xml
curl --header "Accept: application/json" --header "Authorization: Bearer $TEAMCITY_TOKEN" https://ci-oss.hashicorp.engineering/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @/teamcityparamsrecording.xml --output record.json
build_url=$(cat record.json | jq .webUrl)
comment="I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: $FAILED_TESTS You can view the result here: $build_url"
curl -H "Authorization: token ${GITHUB_TOKEN}" \
-d "$(jq -r --arg comment "$comment" -n "{body: \$comment}")" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/issues/${pr_number}/comments"
update_status "${build_url}" "pending"
# Reset for checking failed tests
rm poll.json
rm failed.json
ID=$(cat record.json | jq .id -r)
curl --header "Authorization: Bearer $TEAMCITY_TOKEN" --header "Accept: application/json" https://ci-oss.hashicorp.engineering/app/rest/builds/id:$ID --output poll.json
STATUS=$(cat poll.json | jq .status -r)
STATE=$(cat poll.json | jq .state -r)
counter=0
while [[ "$STATE" != "finished" ]]; do
if [ "$counter" -gt "500" ]; then
echo "Failed to wait for job to finish, exiting"
# Call this an error because we don't know if the tests failed or not
update_status "${build_url}" "error"
# exit 0 because this script didn't have an error; the failure
# is reported via the Github Status API
exit 0
fi
sleep 30
curl --header "Authorization: Bearer $TEAMCITY_TOKEN" --header "Accept: application/json" https://ci-oss.hashicorp.engineering/app/rest/builds/id:$ID --output poll.json
STATUS=$(cat poll.json | jq .status -r)
STATE=$(cat poll.json | jq .state -r)
echo "Trying again, State: $STATE Status: $STATUS"
counter=$((counter + 1))
done
if [ "$STATUS" == "SUCCESS" ]; then
echo "Tests succeeded."
update_status "${build_url}" "success"
exit 0
fi
curl --header "Accept: application/json" --header "Authorization: Bearer $TEAMCITY_TOKEN" http://ci-oss.hashicorp.engineering/app/rest/testOccurrences?locator=build:$ID,status:FAILURE --output failed.json -L
set +e
FAILED_TESTS=$(cat failed.json | jq -r '.testOccurrence | map(.name) | join("|")')
ret=$?
if [ $ret -ne 0 ]; then
echo "Job failed without failing tests"
update_status "${build_url}" "failure"
# exit 0 because this script didn't have an error; the failure
# is reported via the Github Status API
exit 0
fi
set -e
comment="Tests failed during RECORDING mode: $FAILED_TESTS Please fix these to complete your PR"
curl -H "Authorization: token ${GITHUB_TOKEN}" \
-d "$(jq -r --arg comment "$comment" -n "{body: \$comment}")" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/issues/${pr_number}/comments"
update_status "${build_url}" "failure"
# exit 0 because this script didn't have an error; the failure
# is reported via the Github Status API
exit 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.