text
stringlengths 2
1.04M
| meta
dict |
---|---|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/media/rtc_video_decoder.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/metrics/histogram.h"
#include "base/safe_numerics.h"
#include "base/stl_util.h"
#include "base/task_runner_util.h"
#include "content/child/child_thread.h"
#include "content/renderer/media/native_handle_impl.h"
#include "media/base/bind_to_loop.h"
#include "media/filters/gpu_video_accelerator_factories.h"
#include "third_party/webrtc/common_video/interface/texture_video_frame.h"
#include "third_party/webrtc/system_wrappers/interface/ref_count.h"
namespace content {
const int32 RTCVideoDecoder::ID_LAST = 0x3FFFFFFF;
const int32 RTCVideoDecoder::ID_HALF = 0x20000000;
const int32 RTCVideoDecoder::ID_INVALID = -1;
// Maximum number of concurrent VDA::Decode() operations RVD will maintain.
// Higher values allow better pipelining in the GPU, but also require more
// resources.
static const size_t kMaxInFlightDecodes = 8;
// Size of shared-memory segments we allocate. Since we reuse them we let them
// be on the beefy side.
static const size_t kSharedMemorySegmentBytes = 100 << 10;
// Maximum number of allocated shared-memory segments.
static const int kMaxNumSharedMemorySegments = 16;
// Maximum number of pending WebRTC buffers that are waiting for the shared
// memory. 10 seconds for 30 fps.
static const size_t kMaxNumOfPendingBuffers = 300;
// A shared memory segment and its allocated size. This class has the ownership
// of |shm|.
class RTCVideoDecoder::SHMBuffer {
public:
SHMBuffer(base::SharedMemory* shm, size_t size);
~SHMBuffer();
base::SharedMemory* const shm;
const size_t size;
};
RTCVideoDecoder::SHMBuffer::SHMBuffer(base::SharedMemory* shm, size_t size)
: shm(shm), size(size) {}
RTCVideoDecoder::SHMBuffer::~SHMBuffer() { shm->Close(); }
RTCVideoDecoder::BufferData::BufferData(int32 bitstream_buffer_id,
uint32_t timestamp,
int width,
int height,
size_t size)
: bitstream_buffer_id(bitstream_buffer_id),
timestamp(timestamp),
width(width),
height(height),
size(size) {}
RTCVideoDecoder::BufferData::BufferData() {}
RTCVideoDecoder::BufferData::~BufferData() {}
RTCVideoDecoder::RTCVideoDecoder(
const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories)
: weak_factory_(this),
weak_this_(weak_factory_.GetWeakPtr()),
factories_(factories),
vda_loop_proxy_(factories->GetMessageLoop()),
decoder_texture_target_(0),
next_picture_buffer_id_(0),
state_(UNINITIALIZED),
decode_complete_callback_(NULL),
num_shm_buffers_(0),
next_bitstream_buffer_id_(0),
reset_bitstream_buffer_id_(ID_INVALID) {
DCHECK(!vda_loop_proxy_->BelongsToCurrentThread());
base::WaitableEvent message_loop_async_waiter(false, false);
// Waiting here is safe. The media thread is stopped in the child thread and
// the child thread is blocked when VideoDecoderFactory::CreateVideoDecoder
// runs.
vda_loop_proxy_->PostTask(FROM_HERE,
base::Bind(&RTCVideoDecoder::Initialize,
base::Unretained(this),
&message_loop_async_waiter));
message_loop_async_waiter.Wait();
}
RTCVideoDecoder::~RTCVideoDecoder() {
DVLOG(2) << "~RTCVideoDecoder";
// Destroy VDA and remove |this| from the observer if this is vda thread.
if (vda_loop_proxy_->BelongsToCurrentThread()) {
base::MessageLoop::current()->RemoveDestructionObserver(this);
DestroyVDA();
} else {
// VDA should have been destroyed in WillDestroyCurrentMessageLoop.
DCHECK(!vda_);
}
// Delete all shared memories.
STLDeleteElements(&available_shm_segments_);
STLDeleteValues(&bitstream_buffers_in_decoder_);
STLDeleteContainerPairFirstPointers(decode_buffers_.begin(),
decode_buffers_.end());
decode_buffers_.clear();
// Delete WebRTC input buffers.
for (std::deque<std::pair<webrtc::EncodedImage, BufferData> >::iterator it =
pending_buffers_.begin();
it != pending_buffers_.end();
++it) {
delete[] it->first._buffer;
}
}
scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
webrtc::VideoCodecType type,
const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories) {
scoped_ptr<RTCVideoDecoder> decoder;
// Convert WebRTC codec type to media codec profile.
media::VideoCodecProfile profile;
switch (type) {
case webrtc::kVideoCodecVP8:
profile = media::VP8PROFILE_MAIN;
break;
default:
DVLOG(2) << "Video codec not supported:" << type;
return decoder.Pass();
}
decoder.reset(new RTCVideoDecoder(factories));
decoder->vda_ =
factories->CreateVideoDecodeAccelerator(profile, decoder.get()).Pass();
// vda can be NULL if VP8 is not supported.
if (decoder->vda_ != NULL) {
decoder->state_ = INITIALIZED;
} else {
factories->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder.release());
}
return decoder.Pass();
}
int32_t RTCVideoDecoder::InitDecode(const webrtc::VideoCodec* codecSettings,
int32_t /*numberOfCores*/) {
DVLOG(2) << "InitDecode";
DCHECK_EQ(codecSettings->codecType, webrtc::kVideoCodecVP8);
if (codecSettings->codecSpecific.VP8.feedbackModeOn) {
LOG(ERROR) << "Feedback mode not supported";
return RecordInitDecodeUMA(WEBRTC_VIDEO_CODEC_ERROR);
}
base::AutoLock auto_lock(lock_);
if (state_ == UNINITIALIZED || state_ == DECODE_ERROR) {
LOG(ERROR) << "VDA is not initialized. state=" << state_;
return RecordInitDecodeUMA(WEBRTC_VIDEO_CODEC_UNINITIALIZED);
}
// Create some shared memory if the queue is empty.
if (available_shm_segments_.size() == 0) {
vda_loop_proxy_->PostTask(FROM_HERE,
base::Bind(&RTCVideoDecoder::CreateSHM,
weak_this_,
kMaxInFlightDecodes,
kSharedMemorySegmentBytes));
}
return RecordInitDecodeUMA(WEBRTC_VIDEO_CODEC_OK);
}
int32_t RTCVideoDecoder::Decode(
const webrtc::EncodedImage& inputImage,
bool missingFrames,
const webrtc::RTPFragmentationHeader* /*fragmentation*/,
const webrtc::CodecSpecificInfo* /*codecSpecificInfo*/,
int64_t /*renderTimeMs*/) {
DVLOG(3) << "Decode";
base::AutoLock auto_lock(lock_);
if (state_ == UNINITIALIZED || decode_complete_callback_ == NULL) {
LOG(ERROR) << "The decoder has not initialized.";
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
if (state_ == DECODE_ERROR) {
LOG(ERROR) << "Decoding error occurred.";
return WEBRTC_VIDEO_CODEC_ERROR;
}
if (missingFrames || !inputImage._completeFrame) {
DLOG(ERROR) << "Missing or incomplete frames.";
// Unlike the SW decoder in libvpx, hw decoder cannot handle broken frames.
// Return an error to request a key frame.
return WEBRTC_VIDEO_CODEC_ERROR;
}
if (inputImage._frameType == webrtc::kKeyFrame) {
DVLOG(2) << "Got key frame. size=" << inputImage._encodedWidth << "x"
<< inputImage._encodedHeight;
frame_size_.SetSize(inputImage._encodedWidth, inputImage._encodedHeight);
} else if (IsFirstBufferAfterReset(next_bitstream_buffer_id_,
reset_bitstream_buffer_id_)) {
// TODO(wuchengli): VDA should handle it. Remove this when
// http://crosbug.com/p/21913 is fixed.
DVLOG(1) << "The first frame should be a key frame. Drop this.";
return WEBRTC_VIDEO_CODEC_ERROR;
}
// Create buffer metadata.
BufferData buffer_data(next_bitstream_buffer_id_,
inputImage._timeStamp,
frame_size_.width(),
frame_size_.height(),
inputImage._length);
// Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & ID_LAST;
// If the shared memory is available and there are no pending buffers, send
// the buffer for decode. If not, save the buffer in the queue for decode
// later.
scoped_ptr<SHMBuffer> shm_buffer;
if (pending_buffers_.size() == 0)
shm_buffer = GetSHM_Locked(inputImage._length);
if (!shm_buffer) {
int32_t result = SaveToPendingBuffers_Locked(inputImage, buffer_data);
return result ? WEBRTC_VIDEO_CODEC_OK : WEBRTC_VIDEO_CODEC_ERROR;
}
SaveToDecodeBuffers_Locked(inputImage, shm_buffer.Pass(), buffer_data);
vda_loop_proxy_->PostTask(
FROM_HERE, base::Bind(&RTCVideoDecoder::RequestBufferDecode, weak_this_));
return WEBRTC_VIDEO_CODEC_OK;
}
int32_t RTCVideoDecoder::RegisterDecodeCompleteCallback(
webrtc::DecodedImageCallback* callback) {
DVLOG(2) << "RegisterDecodeCompleteCallback";
base::AutoLock auto_lock(lock_);
decode_complete_callback_ = callback;
return WEBRTC_VIDEO_CODEC_OK;
}
int32_t RTCVideoDecoder::Release() {
DVLOG(2) << "Release";
// Do not destroy VDA because WebRTC can call InitDecode and start decoding
// again.
return Reset();
}
int32_t RTCVideoDecoder::Reset() {
DVLOG(2) << "Reset";
base::AutoLock auto_lock(lock_);
if (state_ == UNINITIALIZED) {
LOG(ERROR) << "Decoder not initialized.";
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
if (next_bitstream_buffer_id_ != 0)
reset_bitstream_buffer_id_ = next_bitstream_buffer_id_ - 1;
else
reset_bitstream_buffer_id_ = ID_LAST;
// If VDA is already resetting, no need to request the reset again.
if (state_ != RESETTING) {
state_ = RESETTING;
vda_loop_proxy_->PostTask(
FROM_HERE, base::Bind(&RTCVideoDecoder::ResetInternal, weak_this_));
}
return WEBRTC_VIDEO_CODEC_OK;
}
void RTCVideoDecoder::NotifyInitializeDone() {
DVLOG(2) << "NotifyInitializeDone";
NOTREACHED();
}
void RTCVideoDecoder::ProvidePictureBuffers(uint32 count,
const gfx::Size& size,
uint32 texture_target) {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
DVLOG(3) << "ProvidePictureBuffers. texture_target=" << texture_target;
if (!vda_)
return;
std::vector<uint32> texture_ids;
std::vector<gpu::Mailbox> texture_mailboxes;
decoder_texture_target_ = texture_target;
// Discards the sync point returned here since PictureReady will imply that
// the produce has already happened, and the texture is ready for use.
if (!factories_->CreateTextures(count,
size,
&texture_ids,
&texture_mailboxes,
decoder_texture_target_)) {
NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
DCHECK_EQ(count, texture_ids.size());
DCHECK_EQ(count, texture_mailboxes.size());
std::vector<media::PictureBuffer> picture_buffers;
for (size_t i = 0; i < texture_ids.size(); ++i) {
picture_buffers.push_back(media::PictureBuffer(
next_picture_buffer_id_++, size, texture_ids[i], texture_mailboxes[i]));
bool inserted = assigned_picture_buffers_.insert(std::make_pair(
picture_buffers.back().id(), picture_buffers.back())).second;
DCHECK(inserted);
}
vda_->AssignPictureBuffers(picture_buffers);
}
void RTCVideoDecoder::DismissPictureBuffer(int32 id) {
DVLOG(3) << "DismissPictureBuffer. id=" << id;
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
std::map<int32, media::PictureBuffer>::iterator it =
assigned_picture_buffers_.find(id);
if (it == assigned_picture_buffers_.end()) {
NOTREACHED() << "Missing picture buffer: " << id;
return;
}
media::PictureBuffer buffer_to_dismiss = it->second;
assigned_picture_buffers_.erase(it);
std::set<int32>::iterator at_display_it =
picture_buffers_at_display_.find(id);
if (at_display_it == picture_buffers_at_display_.end()) {
// We can delete the texture immediately as it's not being displayed.
factories_->DeleteTexture(buffer_to_dismiss.texture_id());
} else {
// Texture in display. Postpone deletion until after it's returned to us.
bool inserted = dismissed_picture_buffers_
.insert(std::make_pair(id, buffer_to_dismiss)).second;
DCHECK(inserted);
}
}
void RTCVideoDecoder::PictureReady(const media::Picture& picture) {
DVLOG(3) << "PictureReady";
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
std::map<int32, media::PictureBuffer>::iterator it =
assigned_picture_buffers_.find(picture.picture_buffer_id());
if (it == assigned_picture_buffers_.end()) {
NOTREACHED() << "Missing picture buffer: " << picture.picture_buffer_id();
NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
const media::PictureBuffer& pb = it->second;
// Create a media::VideoFrame.
uint32_t timestamp = 0, width = 0, height = 0;
size_t size = 0;
GetBufferData(
picture.bitstream_buffer_id(), ×tamp, &width, &height, &size);
scoped_refptr<media::VideoFrame> frame =
CreateVideoFrame(picture, pb, timestamp, width, height, size);
bool inserted =
picture_buffers_at_display_.insert(picture.picture_buffer_id()).second;
DCHECK(inserted);
// Create a WebRTC video frame.
webrtc::RefCountImpl<NativeHandleImpl>* handle =
new webrtc::RefCountImpl<NativeHandleImpl>(frame);
webrtc::TextureVideoFrame decoded_image(handle, width, height, timestamp, 0);
// Invoke decode callback. WebRTC expects no callback after Reset or Release.
{
base::AutoLock auto_lock(lock_);
DCHECK(decode_complete_callback_ != NULL);
if (IsBufferAfterReset(picture.bitstream_buffer_id(),
reset_bitstream_buffer_id_)) {
decode_complete_callback_->Decoded(decoded_image);
}
}
}
scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame(
const media::Picture& picture,
const media::PictureBuffer& pb,
uint32_t timestamp,
uint32_t width,
uint32_t height,
size_t size) {
gfx::Rect visible_rect(width, height);
gfx::Size natural_size(width, height);
DCHECK(decoder_texture_target_);
// Convert timestamp from 90KHz to ms.
base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
base::checked_numeric_cast<uint64_t>(timestamp) * 1000 / 90);
return media::VideoFrame::WrapNativeTexture(
new media::VideoFrame::MailboxHolder(
pb.texture_mailbox(),
0, // sync_point
media::BindToCurrentLoop(
base::Bind(&RTCVideoDecoder::ReusePictureBuffer,
weak_this_,
picture.picture_buffer_id()))),
decoder_texture_target_,
pb.size(),
visible_rect,
natural_size,
timestamp_ms,
base::Bind(&media::GpuVideoAcceleratorFactories::ReadPixels,
factories_,
pb.texture_id(),
decoder_texture_target_,
natural_size),
base::Closure());
}
void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) {
DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
std::map<int32, SHMBuffer*>::iterator it =
bitstream_buffers_in_decoder_.find(id);
if (it == bitstream_buffers_in_decoder_.end()) {
NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
NOTREACHED() << "Missing bitstream buffer: " << id;
return;
}
{
base::AutoLock auto_lock(lock_);
PutSHM_Locked(scoped_ptr<SHMBuffer>(it->second));
}
bitstream_buffers_in_decoder_.erase(it);
RequestBufferDecode();
}
void RTCVideoDecoder::NotifyFlushDone() {
DVLOG(3) << "NotifyFlushDone";
NOTREACHED() << "Unexpected flush done notification.";
}
void RTCVideoDecoder::NotifyResetDone() {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
DVLOG(3) << "NotifyResetDone";
if (!vda_)
return;
input_buffer_data_.clear();
{
base::AutoLock auto_lock(lock_);
state_ = INITIALIZED;
}
// Send the pending buffers for decoding.
RequestBufferDecode();
}
void RTCVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
if (!vda_)
return;
LOG(ERROR) << "VDA Error:" << error;
UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoDecoderError",
error,
media::VideoDecodeAccelerator::LARGEST_ERROR_ENUM);
DestroyVDA();
base::AutoLock auto_lock(lock_);
state_ = DECODE_ERROR;
}
void RTCVideoDecoder::WillDestroyCurrentMessageLoop() {
DVLOG(2) << "WillDestroyCurrentMessageLoop";
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
factories_->Abort();
weak_factory_.InvalidateWeakPtrs();
DestroyVDA();
}
void RTCVideoDecoder::Initialize(base::WaitableEvent* waiter) {
DVLOG(2) << "Initialize";
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
base::MessageLoop::current()->AddDestructionObserver(this);
waiter->Signal();
}
void RTCVideoDecoder::RequestBufferDecode() {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
if (!vda_)
return;
MovePendingBuffersToDecodeBuffers();
while (CanMoreDecodeWorkBeDone()) {
// Get a buffer and data from the queue.
SHMBuffer* shm_buffer = NULL;
BufferData buffer_data;
{
base::AutoLock auto_lock(lock_);
// Do not request decode if VDA is resetting.
if (decode_buffers_.size() == 0 || state_ == RESETTING)
return;
shm_buffer = decode_buffers_.front().first;
buffer_data = decode_buffers_.front().second;
decode_buffers_.pop_front();
// Drop the buffers before Reset or Release is called.
if (!IsBufferAfterReset(buffer_data.bitstream_buffer_id,
reset_bitstream_buffer_id_)) {
PutSHM_Locked(scoped_ptr<SHMBuffer>(shm_buffer));
continue;
}
}
// Create a BitstreamBuffer and send to VDA to decode.
media::BitstreamBuffer bitstream_buffer(buffer_data.bitstream_buffer_id,
shm_buffer->shm->handle(),
buffer_data.size);
bool inserted = bitstream_buffers_in_decoder_
.insert(std::make_pair(bitstream_buffer.id(), shm_buffer)).second;
DCHECK(inserted);
RecordBufferData(buffer_data);
vda_->Decode(bitstream_buffer);
}
}
bool RTCVideoDecoder::CanMoreDecodeWorkBeDone() {
return bitstream_buffers_in_decoder_.size() < kMaxInFlightDecodes;
}
bool RTCVideoDecoder::IsBufferAfterReset(int32 id_buffer, int32 id_reset) {
if (id_reset == ID_INVALID)
return true;
int32 diff = id_buffer - id_reset;
if (diff <= 0)
diff += ID_LAST + 1;
return diff < ID_HALF;
}
bool RTCVideoDecoder::IsFirstBufferAfterReset(int32 id_buffer, int32 id_reset) {
if (id_reset == ID_INVALID)
return id_buffer == 0;
return id_buffer == ((id_reset + 1) & ID_LAST);
}
void RTCVideoDecoder::SaveToDecodeBuffers_Locked(
const webrtc::EncodedImage& input_image,
scoped_ptr<SHMBuffer> shm_buffer,
const BufferData& buffer_data) {
memcpy(shm_buffer->shm->memory(), input_image._buffer, input_image._length);
std::pair<SHMBuffer*, BufferData> buffer_pair =
std::make_pair(shm_buffer.release(), buffer_data);
// Store the buffer and the metadata to the queue.
decode_buffers_.push_back(buffer_pair);
}
bool RTCVideoDecoder::SaveToPendingBuffers_Locked(
const webrtc::EncodedImage& input_image,
const BufferData& buffer_data) {
DVLOG(2) << "SaveToPendingBuffers_Locked"
<< ". pending_buffers size=" << pending_buffers_.size()
<< ". decode_buffers_ size=" << decode_buffers_.size()
<< ". available_shm size=" << available_shm_segments_.size();
// Queued too many buffers. Something goes wrong.
if (pending_buffers_.size() >= kMaxNumOfPendingBuffers) {
LOG(WARNING) << "Too many pending buffers!";
return false;
}
// Clone the input image and save it to the queue.
uint8_t* buffer = new uint8_t[input_image._length];
// TODO(wuchengli): avoid memcpy. Extend webrtc::VideoDecoder::Decode()
// interface to take a non-const ptr to the frame and add a method to the
// frame that will swap buffers with another.
memcpy(buffer, input_image._buffer, input_image._length);
webrtc::EncodedImage encoded_image(
buffer, input_image._length, input_image._length);
std::pair<webrtc::EncodedImage, BufferData> buffer_pair =
std::make_pair(encoded_image, buffer_data);
pending_buffers_.push_back(buffer_pair);
return true;
}
void RTCVideoDecoder::MovePendingBuffersToDecodeBuffers() {
base::AutoLock auto_lock(lock_);
while (pending_buffers_.size() > 0) {
// Get a pending buffer from the queue.
const webrtc::EncodedImage& input_image = pending_buffers_.front().first;
const BufferData& buffer_data = pending_buffers_.front().second;
// Drop the frame if it comes before Reset or Release.
if (!IsBufferAfterReset(buffer_data.bitstream_buffer_id,
reset_bitstream_buffer_id_)) {
delete[] input_image._buffer;
pending_buffers_.pop_front();
continue;
}
// Get shared memory and save it to decode buffers.
scoped_ptr<SHMBuffer> shm_buffer = GetSHM_Locked(input_image._length);
if (!shm_buffer)
return;
SaveToDecodeBuffers_Locked(input_image, shm_buffer.Pass(), buffer_data);
delete[] input_image._buffer;
pending_buffers_.pop_front();
}
}
void RTCVideoDecoder::ResetInternal() {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
DVLOG(2) << "ResetInternal";
if (vda_)
vda_->Reset();
}
void RTCVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id,
uint32 sync_point) {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
DVLOG(3) << "ReusePictureBuffer. id=" << picture_buffer_id;
if (!vda_)
return;
CHECK(!picture_buffers_at_display_.empty());
size_t num_erased = picture_buffers_at_display_.erase(picture_buffer_id);
DCHECK(num_erased);
std::map<int32, media::PictureBuffer>::iterator it =
assigned_picture_buffers_.find(picture_buffer_id);
if (it == assigned_picture_buffers_.end()) {
// This picture was dismissed while in display, so we postponed deletion.
it = dismissed_picture_buffers_.find(picture_buffer_id);
DCHECK(it != dismissed_picture_buffers_.end());
factories_->DeleteTexture(it->second.texture_id());
dismissed_picture_buffers_.erase(it);
return;
}
factories_->WaitSyncPoint(sync_point);
vda_->ReusePictureBuffer(picture_buffer_id);
}
void RTCVideoDecoder::DestroyTextures() {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
std::map<int32, media::PictureBuffer>::iterator it;
for (it = assigned_picture_buffers_.begin();
it != assigned_picture_buffers_.end();
++it) {
factories_->DeleteTexture(it->second.texture_id());
}
assigned_picture_buffers_.clear();
for (it = dismissed_picture_buffers_.begin();
it != dismissed_picture_buffers_.end();
++it) {
factories_->DeleteTexture(it->second.texture_id());
}
dismissed_picture_buffers_.clear();
}
void RTCVideoDecoder::DestroyVDA() {
DVLOG(2) << "DestroyVDA";
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
if (vda_)
vda_.release()->Destroy();
DestroyTextures();
base::AutoLock auto_lock(lock_);
state_ = UNINITIALIZED;
}
scoped_ptr<RTCVideoDecoder::SHMBuffer> RTCVideoDecoder::GetSHM_Locked(
size_t min_size) {
// Reuse a SHM if possible.
SHMBuffer* ret = NULL;
if (!available_shm_segments_.empty() &&
available_shm_segments_.back()->size >= min_size) {
ret = available_shm_segments_.back();
available_shm_segments_.pop_back();
}
// Post to vda thread to create shared memory if SHM cannot be reused or the
// queue is almost empty.
if (num_shm_buffers_ < kMaxNumSharedMemorySegments &&
(ret == NULL || available_shm_segments_.size() <= 1)) {
vda_loop_proxy_->PostTask(
FROM_HERE,
base::Bind(&RTCVideoDecoder::CreateSHM, weak_this_, 1, min_size));
}
return scoped_ptr<SHMBuffer>(ret);
}
void RTCVideoDecoder::PutSHM_Locked(scoped_ptr<SHMBuffer> shm_buffer) {
available_shm_segments_.push_back(shm_buffer.release());
}
void RTCVideoDecoder::CreateSHM(int number, size_t min_size) {
DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
DVLOG(2) << "CreateSHM. size=" << min_size;
int number_to_allocate;
{
base::AutoLock auto_lock(lock_);
number_to_allocate =
std::min(kMaxNumSharedMemorySegments - num_shm_buffers_, number);
}
size_t size_to_allocate = std::max(min_size, kSharedMemorySegmentBytes);
for (int i = 0; i < number_to_allocate; i++) {
base::SharedMemory* shm = factories_->CreateSharedMemory(size_to_allocate);
if (shm != NULL) {
base::AutoLock auto_lock(lock_);
num_shm_buffers_++;
PutSHM_Locked(
scoped_ptr<SHMBuffer>(new SHMBuffer(shm, size_to_allocate)));
}
}
// Kick off the decoding.
RequestBufferDecode();
}
void RTCVideoDecoder::RecordBufferData(const BufferData& buffer_data) {
input_buffer_data_.push_front(buffer_data);
// Why this value? Because why not. avformat.h:MAX_REORDER_DELAY is 16, but
// that's too small for some pathological B-frame test videos. The cost of
// using too-high a value is low (192 bits per extra slot).
static const size_t kMaxInputBufferDataSize = 128;
// Pop from the back of the list, because that's the oldest and least likely
// to be useful in the future data.
if (input_buffer_data_.size() > kMaxInputBufferDataSize)
input_buffer_data_.pop_back();
}
void RTCVideoDecoder::GetBufferData(int32 bitstream_buffer_id,
uint32_t* timestamp,
uint32_t* width,
uint32_t* height,
size_t* size) {
for (std::list<BufferData>::iterator it = input_buffer_data_.begin();
it != input_buffer_data_.end();
++it) {
if (it->bitstream_buffer_id != bitstream_buffer_id)
continue;
*timestamp = it->timestamp;
*width = it->width;
*height = it->height;
return;
}
NOTREACHED() << "Missing bitstream buffer id: " << bitstream_buffer_id;
}
int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) {
// Logging boolean is enough to know if HW decoding has been used. Also,
// InitDecode is less likely to return an error so enum is not used here.
bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false;
UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeStatus", sample);
return status;
}
} // namespace content
| {
"content_hash": "dc27619c23e1491df7b3b969f374c5b8",
"timestamp": "",
"source": "github",
"line_count": 762,
"max_line_length": 80,
"avg_line_length": 35.74803149606299,
"alnum_prop": 0.6606828193832599,
"repo_name": "mogoweb/chromium-crosswalk",
"id": "70f8add2d00495cfc9ab6bba0d8aca05c19896e4",
"size": "27240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "content/renderer/media/rtc_video_decoder.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "54831"
},
{
"name": "Awk",
"bytes": "8660"
},
{
"name": "C",
"bytes": "40940503"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "182703853"
},
{
"name": "CSS",
"bytes": "799795"
},
{
"name": "DOT",
"bytes": "1873"
},
{
"name": "Java",
"bytes": "4807735"
},
{
"name": "JavaScript",
"bytes": "20714038"
},
{
"name": "Mercury",
"bytes": "10299"
},
{
"name": "Objective-C",
"bytes": "985558"
},
{
"name": "Objective-C++",
"bytes": "6205987"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "1213389"
},
{
"name": "Python",
"bytes": "9735121"
},
{
"name": "Rebol",
"bytes": "262"
},
{
"name": "Shell",
"bytes": "1305641"
},
{
"name": "Tcl",
"bytes": "277091"
},
{
"name": "TypeScript",
"bytes": "1560024"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "14650"
}
],
"symlink_target": ""
} |
{-# LANGUAGE DeriveGeneric #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Sandbox.PackageEnvironment
-- Maintainer : [email protected]
-- Portability : portable
--
-- Utilities for working with the package environment file. Patterned after
-- Distribution.Client.Config.
-----------------------------------------------------------------------------
module Distribution.Client.Sandbox.PackageEnvironment (
PackageEnvironment(..)
, PackageEnvironmentType(..)
, classifyPackageEnvironment
, createPackageEnvironmentFile
, tryLoadSandboxPackageEnvironmentFile
, readPackageEnvironmentFile
, showPackageEnvironment
, showPackageEnvironmentWithComments
, setPackageDB
, sandboxPackageDBPath
, loadUserConfig
, basePackageEnvironment
, initialPackageEnvironment
, commentPackageEnvironment
, sandboxPackageEnvironmentFile
, userPackageEnvironmentFile
) where
import Distribution.Client.Config ( SavedConfig(..), commentSavedConfig
, loadConfig, configFieldDescriptions
, haddockFlagsFields
, installDirsFields, withProgramsFields
, withProgramOptionsFields
, defaultCompiler )
import Distribution.Client.ParseUtils ( parseFields, ppFields, ppSection )
import Distribution.Client.Setup ( GlobalFlags(..), ConfigExFlags(..)
, InstallFlags(..)
, defaultSandboxLocation )
import Distribution.Utils.NubList ( toNubList )
import Distribution.Simple.Compiler ( Compiler, PackageDB(..)
, compilerFlavor, showCompilerIdWithAbi )
import Distribution.Simple.InstallDirs ( InstallDirs(..), PathTemplate
, defaultInstallDirs, combineInstallDirs
, fromPathTemplate, toPathTemplate )
import Distribution.Simple.Setup ( Flag(..)
, ConfigFlags(..), HaddockFlags(..)
, fromFlagOrDefault, toFlag, flagToMaybe )
import Distribution.Simple.Utils ( die, info, notice, warn )
import Distribution.Solver.Types.ConstraintSource
import Distribution.ParseUtils ( FieldDescr(..), ParseResult(..)
, commaListField, commaNewLineListField
, liftField, lineNo, locatedErrorMsg
, parseFilePathQ, readFields
, showPWarning, simpleField
, syntaxError, warning )
import Distribution.System ( Platform )
import Distribution.Verbosity ( Verbosity, normal )
import Control.Monad ( foldM, liftM2, when, unless )
import Data.List ( partition )
import Data.Maybe ( isJust )
import Distribution.Compat.Exception ( catchIO )
import Distribution.Compat.Semigroup
import System.Directory ( doesDirectoryExist, doesFileExist
, renameFile )
import System.FilePath ( (<.>), (</>), takeDirectory )
import System.IO.Error ( isDoesNotExistError )
import Text.PrettyPrint ( ($+$) )
import qualified Text.PrettyPrint as Disp
import qualified Distribution.Compat.ReadP as Parse
import qualified Distribution.ParseUtils as ParseUtils ( Field(..) )
import qualified Distribution.Text as Text
import GHC.Generics ( Generic )
--
-- * Configuration saved in the package environment file
--
-- TODO: would be nice to remove duplication between
-- D.C.Sandbox.PackageEnvironment and D.C.Config.
data PackageEnvironment = PackageEnvironment {
-- The 'inherit' feature is not used ATM, but could be useful in the future
-- for constructing nested sandboxes (see discussion in #1196).
pkgEnvInherit :: Flag FilePath,
pkgEnvSavedConfig :: SavedConfig
} deriving Generic
instance Monoid PackageEnvironment where
mempty = gmempty
mappend = (<>)
instance Semigroup PackageEnvironment where
(<>) = gmappend
-- | The automatically-created package environment file that should not be
-- touched by the user.
sandboxPackageEnvironmentFile :: FilePath
sandboxPackageEnvironmentFile = "cabal.sandbox.config"
-- | Optional package environment file that can be used to customize the default
-- settings. Created by the user.
userPackageEnvironmentFile :: FilePath
userPackageEnvironmentFile = "cabal.config"
-- | Type of the current package environment.
data PackageEnvironmentType =
SandboxPackageEnvironment -- ^ './cabal.sandbox.config'
| UserPackageEnvironment -- ^ './cabal.config'
| AmbientPackageEnvironment -- ^ '~/.cabal/config'
-- | Is there a 'cabal.sandbox.config' or 'cabal.config' in this
-- directory?
classifyPackageEnvironment :: FilePath -> Flag FilePath -> Flag Bool
-> IO PackageEnvironmentType
classifyPackageEnvironment pkgEnvDir sandboxConfigFileFlag ignoreSandboxFlag =
do isSandbox <- liftM2 (||) (return forceSandboxConfig)
(configExists sandboxPackageEnvironmentFile)
isUser <- configExists userPackageEnvironmentFile
return (classify isSandbox isUser)
where
configExists fname = doesFileExist (pkgEnvDir </> fname)
ignoreSandbox = fromFlagOrDefault False ignoreSandboxFlag
forceSandboxConfig = isJust . flagToMaybe $ sandboxConfigFileFlag
classify :: Bool -> Bool -> PackageEnvironmentType
classify True _
| not ignoreSandbox = SandboxPackageEnvironment
classify _ True = UserPackageEnvironment
classify _ False = AmbientPackageEnvironment
-- | Defaults common to 'initialPackageEnvironment' and
-- 'commentPackageEnvironment'.
commonPackageEnvironmentConfig :: FilePath -> SavedConfig
commonPackageEnvironmentConfig sandboxDir =
mempty {
savedConfigureFlags = mempty {
-- TODO: Currently, we follow cabal-dev and set 'user-install: False' in
-- the config file. In the future we may want to distinguish between
-- global, sandbox and user install types.
configUserInstall = toFlag False,
configInstallDirs = installDirs
},
savedUserInstallDirs = installDirs,
savedGlobalInstallDirs = installDirs,
savedGlobalFlags = mempty {
globalLogsDir = toFlag $ sandboxDir </> "logs",
-- Is this right? cabal-dev uses the global world file.
globalWorldFile = toFlag $ sandboxDir </> "world"
}
}
where
installDirs = sandboxInstallDirs sandboxDir
-- | 'commonPackageEnvironmentConfig' wrapped inside a 'PackageEnvironment'.
commonPackageEnvironment :: FilePath -> PackageEnvironment
commonPackageEnvironment sandboxDir = mempty {
pkgEnvSavedConfig = commonPackageEnvironmentConfig sandboxDir
}
-- | Given a path to a sandbox, return the corresponding InstallDirs record.
sandboxInstallDirs :: FilePath -> InstallDirs (Flag PathTemplate)
sandboxInstallDirs sandboxDir = mempty {
prefix = toFlag (toPathTemplate sandboxDir)
}
-- | These are the absolute basic defaults, the fields that must be
-- initialised. When we load the package environment from the file we layer the
-- loaded values over these ones.
basePackageEnvironment :: PackageEnvironment
basePackageEnvironment =
mempty {
pkgEnvSavedConfig = mempty {
savedConfigureFlags = mempty {
configHcFlavor = toFlag defaultCompiler,
configVerbosity = toFlag normal
}
}
}
-- | Initial configuration that we write out to the package environment file if
-- it does not exist. When the package environment gets loaded this
-- configuration gets layered on top of 'basePackageEnvironment'.
initialPackageEnvironment :: FilePath -> Compiler -> Platform
-> IO PackageEnvironment
initialPackageEnvironment sandboxDir compiler platform = do
defInstallDirs <- defaultInstallDirs (compilerFlavor compiler)
{- userInstall= -} False {- _hasLibs= -} False
let initialConfig = commonPackageEnvironmentConfig sandboxDir
installDirs = combineInstallDirs (\d f -> Flag $ fromFlagOrDefault d f)
defInstallDirs (savedUserInstallDirs initialConfig)
return $ mempty {
pkgEnvSavedConfig = initialConfig {
savedUserInstallDirs = installDirs,
savedGlobalInstallDirs = installDirs,
savedGlobalFlags = (savedGlobalFlags initialConfig) {
globalLocalRepos = toNubList [sandboxDir </> "packages"]
},
savedConfigureFlags = setPackageDB sandboxDir compiler platform
(savedConfigureFlags initialConfig),
savedInstallFlags = (savedInstallFlags initialConfig) {
installSummaryFile = toNubList [toPathTemplate (sandboxDir </>
"logs" </> "build.log")]
}
}
}
-- | Return the path to the sandbox package database.
sandboxPackageDBPath :: FilePath -> Compiler -> Platform -> String
sandboxPackageDBPath sandboxDir compiler platform =
sandboxDir
</> (Text.display platform ++ "-"
++ showCompilerIdWithAbi compiler
++ "-packages.conf.d")
-- The path in sandboxPackageDBPath should be kept in sync with the
-- path in the bootstrap.sh which is used to bootstrap cabal-install
-- into a sandbox.
-- | Use the package DB location specific for this compiler.
setPackageDB :: FilePath -> Compiler -> Platform -> ConfigFlags -> ConfigFlags
setPackageDB sandboxDir compiler platform configFlags =
configFlags {
configPackageDBs = [Just (SpecificPackageDB $ sandboxPackageDBPath
sandboxDir
compiler
platform)]
}
-- | Almost the same as 'savedConf `mappend` pkgEnv', but some settings are
-- overridden instead of mappend'ed.
overrideSandboxSettings :: PackageEnvironment -> PackageEnvironment ->
PackageEnvironment
overrideSandboxSettings pkgEnv0 pkgEnv =
pkgEnv {
pkgEnvSavedConfig = mappendedConf {
savedConfigureFlags = (savedConfigureFlags mappendedConf) {
configPackageDBs = configPackageDBs pkgEnvConfigureFlags
}
, savedInstallFlags = (savedInstallFlags mappendedConf) {
installSummaryFile = installSummaryFile pkgEnvInstallFlags
}
},
pkgEnvInherit = pkgEnvInherit pkgEnv0
}
where
pkgEnvConf = pkgEnvSavedConfig pkgEnv
mappendedConf = (pkgEnvSavedConfig pkgEnv0) `mappend` pkgEnvConf
pkgEnvConfigureFlags = savedConfigureFlags pkgEnvConf
pkgEnvInstallFlags = savedInstallFlags pkgEnvConf
-- | Default values that get used if no value is given. Used here to include in
-- comments when we write out the initial package environment.
commentPackageEnvironment :: FilePath -> IO PackageEnvironment
commentPackageEnvironment sandboxDir = do
commentConf <- commentSavedConfig
let baseConf = commonPackageEnvironmentConfig sandboxDir
return $ mempty {
pkgEnvSavedConfig = commentConf `mappend` baseConf
}
-- | If this package environment inherits from some other package environment,
-- return that package environment; otherwise return mempty.
inheritedPackageEnvironment :: Verbosity -> PackageEnvironment
-> IO PackageEnvironment
inheritedPackageEnvironment verbosity pkgEnv = do
case (pkgEnvInherit pkgEnv) of
NoFlag -> return mempty
confPathFlag@(Flag _) -> do
conf <- loadConfig verbosity confPathFlag
return $ mempty { pkgEnvSavedConfig = conf }
-- | Load the user package environment if it exists (the optional "cabal.config"
-- file). If it does not exist locally, attempt to load an optional global one.
userPackageEnvironment :: Verbosity -> FilePath -> Maybe FilePath -> IO PackageEnvironment
userPackageEnvironment verbosity pkgEnvDir globalConfigLocation = do
let path = pkgEnvDir </> userPackageEnvironmentFile
minp <- readPackageEnvironmentFile (ConstraintSourceUserConfig path) mempty path
case (minp, globalConfigLocation) of
(Just parseRes, _) -> processConfigParse path parseRes
(_, Just globalLoc) -> maybe (warn verbosity ("no constraints file found at " ++ globalLoc) >> return mempty) (processConfigParse globalLoc) =<< readPackageEnvironmentFile (ConstraintSourceUserConfig globalLoc) mempty globalLoc
_ -> return mempty
where
processConfigParse path (ParseOk warns parseResult) = do
when (not $ null warns) $ warn verbosity $
unlines (map (showPWarning path) warns)
return parseResult
processConfigParse path (ParseFailed err) = do
let (line, msg) = locatedErrorMsg err
warn verbosity $ "Error parsing package environment file " ++ path
++ maybe "" (\n -> ":" ++ show n) line ++ ":\n" ++ msg
return mempty
-- | Same as @userPackageEnvironmentFile@, but returns a SavedConfig.
loadUserConfig :: Verbosity -> FilePath -> Maybe FilePath -> IO SavedConfig
loadUserConfig verbosity pkgEnvDir globalConfigLocation =
fmap pkgEnvSavedConfig $ userPackageEnvironment verbosity pkgEnvDir globalConfigLocation
-- | Common error handling code used by 'tryLoadSandboxPackageEnvironment' and
-- 'updatePackageEnvironment'.
handleParseResult :: Verbosity -> FilePath
-> Maybe (ParseResult PackageEnvironment)
-> IO PackageEnvironment
handleParseResult verbosity path minp =
case minp of
Nothing -> die $
"The package environment file '" ++ path ++ "' doesn't exist"
Just (ParseOk warns parseResult) -> do
when (not $ null warns) $ warn verbosity $
unlines (map (showPWarning path) warns)
return parseResult
Just (ParseFailed err) -> do
let (line, msg) = locatedErrorMsg err
die $ "Error parsing package environment file " ++ path
++ maybe "" (\n -> ":" ++ show n) line ++ ":\n" ++ msg
-- | Try to load the given package environment file, exiting with error if it
-- doesn't exist. Also returns the path to the sandbox directory. The path
-- parameter should refer to an existing file.
tryLoadSandboxPackageEnvironmentFile :: Verbosity -> FilePath -> (Flag FilePath)
-> IO (FilePath, PackageEnvironment)
tryLoadSandboxPackageEnvironmentFile verbosity pkgEnvFile configFileFlag = do
let pkgEnvDir = takeDirectory pkgEnvFile
minp <- readPackageEnvironmentFile
(ConstraintSourceSandboxConfig pkgEnvFile) mempty pkgEnvFile
pkgEnv <- handleParseResult verbosity pkgEnvFile minp
-- Get the saved sandbox directory.
-- TODO: Use substPathTemplate with
-- compilerTemplateEnv ++ platformTemplateEnv ++ abiTemplateEnv.
let sandboxDir = fromFlagOrDefault defaultSandboxLocation
. fmap fromPathTemplate . prefix . savedUserInstallDirs
. pkgEnvSavedConfig $ pkgEnv
-- Do some sanity checks
dirExists <- doesDirectoryExist sandboxDir
-- TODO: Also check for an initialised package DB?
unless dirExists $
die ("No sandbox exists at " ++ sandboxDir)
info verbosity $ "Using a sandbox located at " ++ sandboxDir
let base = basePackageEnvironment
let common = commonPackageEnvironment sandboxDir
user <- userPackageEnvironment verbosity pkgEnvDir Nothing --TODO
inherited <- inheritedPackageEnvironment verbosity user
-- Layer the package environment settings over settings from ~/.cabal/config.
cabalConfig <- fmap unsetSymlinkBinDir $ loadConfig verbosity configFileFlag
return (sandboxDir,
updateInstallDirs $
(base `mappend` (toPkgEnv cabalConfig) `mappend`
common `mappend` inherited `mappend` user)
`overrideSandboxSettings` pkgEnv)
where
toPkgEnv config = mempty { pkgEnvSavedConfig = config }
updateInstallDirs pkgEnv =
let config = pkgEnvSavedConfig pkgEnv
configureFlags = savedConfigureFlags config
installDirs = savedUserInstallDirs config
in pkgEnv {
pkgEnvSavedConfig = config {
savedConfigureFlags = configureFlags {
configInstallDirs = installDirs
}
}
}
-- We don't want to inherit the value of 'symlink-bindir' from
-- '~/.cabal/config'. See #1514.
unsetSymlinkBinDir config =
let installFlags = savedInstallFlags config
in config {
savedInstallFlags = installFlags {
installSymlinkBinDir = NoFlag
}
}
-- | Create a new package environment file, replacing the existing one if it
-- exists. Note that the path parameters should point to existing directories.
createPackageEnvironmentFile :: Verbosity -> FilePath -> FilePath
-> Compiler
-> Platform
-> IO ()
createPackageEnvironmentFile verbosity sandboxDir pkgEnvFile compiler platform = do
notice verbosity $ "Writing a default package environment file to " ++ pkgEnvFile
initialPkgEnv <- initialPackageEnvironment sandboxDir compiler platform
writePackageEnvironmentFile pkgEnvFile initialPkgEnv
-- | Descriptions of all fields in the package environment file.
pkgEnvFieldDescrs :: ConstraintSource -> [FieldDescr PackageEnvironment]
pkgEnvFieldDescrs src = [
simpleField "inherit"
(fromFlagOrDefault Disp.empty . fmap Disp.text) (optional parseFilePathQ)
pkgEnvInherit (\v pkgEnv -> pkgEnv { pkgEnvInherit = v })
, commaNewLineListField "constraints"
(Text.disp . fst) ((\pc -> (pc, src)) `fmap` Text.parse)
(configExConstraints . savedConfigureExFlags . pkgEnvSavedConfig)
(\v pkgEnv -> updateConfigureExFlags pkgEnv
(\flags -> flags { configExConstraints = v }))
, commaListField "preferences"
Text.disp Text.parse
(configPreferences . savedConfigureExFlags . pkgEnvSavedConfig)
(\v pkgEnv -> updateConfigureExFlags pkgEnv
(\flags -> flags { configPreferences = v }))
]
++ map toPkgEnv configFieldDescriptions'
where
optional = Parse.option mempty . fmap toFlag
configFieldDescriptions' :: [FieldDescr SavedConfig]
configFieldDescriptions' = filter
(\(FieldDescr name _ _) -> name /= "preference" && name /= "constraint")
(configFieldDescriptions src)
toPkgEnv :: FieldDescr SavedConfig -> FieldDescr PackageEnvironment
toPkgEnv fieldDescr =
liftField pkgEnvSavedConfig
(\savedConfig pkgEnv -> pkgEnv { pkgEnvSavedConfig = savedConfig})
fieldDescr
updateConfigureExFlags :: PackageEnvironment
-> (ConfigExFlags -> ConfigExFlags)
-> PackageEnvironment
updateConfigureExFlags pkgEnv f = pkgEnv {
pkgEnvSavedConfig = (pkgEnvSavedConfig pkgEnv) {
savedConfigureExFlags = f . savedConfigureExFlags . pkgEnvSavedConfig
$ pkgEnv
}
}
-- | Read the package environment file.
readPackageEnvironmentFile :: ConstraintSource -> PackageEnvironment -> FilePath
-> IO (Maybe (ParseResult PackageEnvironment))
readPackageEnvironmentFile src initial file =
handleNotExists $
fmap (Just . parsePackageEnvironment src initial) (readFile file)
where
handleNotExists action = catchIO action $ \ioe ->
if isDoesNotExistError ioe
then return Nothing
else ioError ioe
-- | Parse the package environment file.
parsePackageEnvironment :: ConstraintSource -> PackageEnvironment -> String
-> ParseResult PackageEnvironment
parsePackageEnvironment src initial str = do
fields <- readFields str
let (knownSections, others) = partition isKnownSection fields
pkgEnv <- parse others
let config = pkgEnvSavedConfig pkgEnv
installDirs0 = savedUserInstallDirs config
(haddockFlags, installDirs, paths, args) <-
foldM parseSections
(savedHaddockFlags config, installDirs0, [], [])
knownSections
return pkgEnv {
pkgEnvSavedConfig = config {
savedConfigureFlags = (savedConfigureFlags config) {
configProgramPaths = paths,
configProgramArgs = args
},
savedHaddockFlags = haddockFlags,
savedUserInstallDirs = installDirs,
savedGlobalInstallDirs = installDirs
}
}
where
isKnownSection :: ParseUtils.Field -> Bool
isKnownSection (ParseUtils.Section _ "haddock" _ _) = True
isKnownSection (ParseUtils.Section _ "install-dirs" _ _) = True
isKnownSection (ParseUtils.Section _ "program-locations" _ _) = True
isKnownSection (ParseUtils.Section _ "program-default-options" _ _) = True
isKnownSection _ = False
parse :: [ParseUtils.Field] -> ParseResult PackageEnvironment
parse = parseFields (pkgEnvFieldDescrs src) initial
parseSections :: SectionsAccum -> ParseUtils.Field
-> ParseResult SectionsAccum
parseSections accum@(h,d,p,a)
(ParseUtils.Section _ "haddock" name fs)
| name == "" = do h' <- parseFields haddockFlagsFields h fs
return (h', d, p, a)
| otherwise = do
warning "The 'haddock' section should be unnamed"
return accum
parseSections (h,d,p,a)
(ParseUtils.Section line "install-dirs" name fs)
| name == "" = do d' <- parseFields installDirsFields d fs
return (h, d',p,a)
| otherwise =
syntaxError line $
"Named 'install-dirs' section: '" ++ name
++ "'. Note that named 'install-dirs' sections are not allowed in the '"
++ userPackageEnvironmentFile ++ "' file."
parseSections accum@(h, d,p,a)
(ParseUtils.Section _ "program-locations" name fs)
| name == "" = do p' <- parseFields withProgramsFields p fs
return (h, d, p', a)
| otherwise = do
warning "The 'program-locations' section should be unnamed"
return accum
parseSections accum@(h, d, p, a)
(ParseUtils.Section _ "program-default-options" name fs)
| name == "" = do a' <- parseFields withProgramOptionsFields a fs
return (h, d, p, a')
| otherwise = do
warning "The 'program-default-options' section should be unnamed"
return accum
parseSections accum f = do
warning $ "Unrecognized stanza on line " ++ show (lineNo f)
return accum
-- | Accumulator type for 'parseSections'.
type SectionsAccum = (HaddockFlags, InstallDirs (Flag PathTemplate)
, [(String, FilePath)], [(String, [String])])
-- | Write out the package environment file.
writePackageEnvironmentFile :: FilePath -> PackageEnvironment -> IO ()
writePackageEnvironmentFile path pkgEnv = do
let tmpPath = (path <.> "tmp")
writeFile tmpPath $ explanation ++ pkgEnvStr ++ "\n"
renameFile tmpPath path
where
pkgEnvStr = showPackageEnvironment pkgEnv
explanation = unlines
["-- This is a Cabal package environment file."
,"-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY."
,"-- Please create a 'cabal.config' file in the same directory"
,"-- if you want to change the default settings for this sandbox."
,"",""
]
-- | Pretty-print the package environment.
showPackageEnvironment :: PackageEnvironment -> String
showPackageEnvironment pkgEnv = showPackageEnvironmentWithComments Nothing pkgEnv
-- | Pretty-print the package environment with default values for empty fields
-- commented out (just like the default ~/.cabal/config).
showPackageEnvironmentWithComments :: (Maybe PackageEnvironment)
-> PackageEnvironment
-> String
showPackageEnvironmentWithComments mdefPkgEnv pkgEnv = Disp.render $
ppFields (pkgEnvFieldDescrs ConstraintSourceUnknown)
mdefPkgEnv pkgEnv
$+$ Disp.text ""
$+$ ppSection "install-dirs" "" installDirsFields
(fmap installDirsSection mdefPkgEnv) (installDirsSection pkgEnv)
where
installDirsSection = savedUserInstallDirs . pkgEnvSavedConfig
| {
"content_hash": "f31d175701257a8fbe19fc1ac9284644",
"timestamp": "",
"source": "github",
"line_count": 557,
"max_line_length": 233,
"avg_line_length": 44.57809694793537,
"alnum_prop": 0.6608135320177205,
"repo_name": "thomie/cabal",
"id": "18588bd372926fd06391e3a78624a260d6a13fe0",
"size": "24830",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "212"
},
{
"name": "CSS",
"bytes": "1051"
},
{
"name": "Haskell",
"bytes": "3554729"
},
{
"name": "M4",
"bytes": "555"
},
{
"name": "Makefile",
"bytes": "3299"
},
{
"name": "Shell",
"bytes": "39522"
}
],
"symlink_target": ""
} |
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Analyzer.Utilities;
namespace System.Runtime.Analyzers
{
/// <summary>
/// CA1601: Do not use timers that prevent power state changes
/// </summary>
public abstract class DoNotUseTimersThatPreventPowerStateChangesAnalyzer : DiagnosticAnalyzer
{
internal const string RuleId = "CA1601";
private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DoNotUseTimersThatPreventPowerStateChangesTitle), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DoNotUseTimersThatPreventPowerStateChangesMessage), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DoNotUseTimersThatPreventPowerStateChangesDescription), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
s_localizableTitle,
s_localizableMessage,
DiagnosticCategory.Mobility,
DiagnosticSeverity.Warning,
isEnabledByDefault: false,
description: s_localizableDescription,
helpLinkUri: null, // TODO: add MSDN url
customTags: WellKnownDiagnosticTags.Telemetry);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);
public override void Initialize(AnalysisContext analysisContext)
{
}
}
} | {
"content_hash": "aa2962a0e41272a582fd16e05da7eef1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 292,
"avg_line_length": 68.5,
"alnum_prop": 0.6184103811841039,
"repo_name": "Anniepoh/roslyn-analyzers",
"id": "e185f21a3945f36e97b7b2a1f92ba0025cc972a7",
"size": "2628",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/System.Runtime.Analyzers/Core/DoNotUseTimersThatPreventPowerStateChanges.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7988"
},
{
"name": "C#",
"bytes": "5492150"
},
{
"name": "Groovy",
"bytes": "1356"
},
{
"name": "PowerShell",
"bytes": "49937"
},
{
"name": "Visual Basic",
"bytes": "180001"
}
],
"symlink_target": ""
} |
copyright:
years: 2016, 2017
lastupdated: "2017-03-13"
---
{:new_window: target="\_blank"}
{:shortdesc: .shortdesc}
{:screen: .screen}
{:codeblock: .codeblock}
{:pre: .pre}
# Identification et résolution des problèmes liés à {{site.data.keyword.iot_short_notm}}
{: #ts}
Voici les réponses aux questions fréquentes sur l'identification et la résolution des problèmes liés à l'utilisation d'{{site.data.keyword.iot_full}} sur {{site.data.keyword.Bluemix_notm}}.
{:shortdesc}
## Problème lors de l'accès à votre organisation {{site.data.keyword.iot_short_notm}}
{: #access-expiry-problem}
Vous ne pouvez pas vous connecter à une organisation {{site.data.keyword.iot_short_notm}} dont vous êtes propriétaire.
{:shortdesc}
Vous ne pouvez pas vous connecter à votre organisation {{site.data.keyword.iot_short_notm}} directement en utilisant l'URL de l'organisation ou en utilisant `https://internetofthings.ibmcloud.com`.
{: tsSymptoms}
Votre accès à votre organisation {{site.data.keyword.iot_short_notm}} est peut-être arrivé à expiration. Les organisations {{site.data.keyword.iot_short_notm}} qui ont été créées à l'aide de {{site.data.keyword.Bluemix}} utilisent des profils utilisateur temporaires par défaut.
{: tsCauses}
Vous pouvez résoudre ce problème en accédant à votre organisation {{site.data.keyword.iot_short_notm}} à l'aide de {{site.data.keyword.Bluemix_notm}} et en modifiant les paramètres d'expiration de votre profil utilisateur. Pour modifier les paramètres d'expiration de votre profil utilisateur :
1. Dans votre tableau de bord {{site.data.keyword.Bluemix_notm}}, ouvrez votre service {{site.data.keyword.iot_short_notm}}.
2. Cliquez sur **Membres** dans la barre de navigation.
3. Cliquez sur l'icône **Editer**.
4. Désélectionnez la zone **L'accès arrive à expiration** et cliquez sur **Sauvegarder**.
{: tsResolve}
## Problème lors de la connexion à {{site.data.keyword.iot_short_notm}}
{: #connection_problem}
Votre connexion à {{site.data.keyword.iot_short_notm}} s'interrompt de manière inattendue.
{:shortdesc}
Lorsque vous tentez de vous connecter à {{site.data.keyword.iot_short_notm}}, une erreur s'affiche sur votre terminal ou votre application.
{: tsSymptoms}
Il est possible que deux terminaux tentent de se connecter avec le même ID de client et les mêmes données d'identification. Une seule connexion unique est autorisée par ID de client. Vous ne pouvez pas avoir deux connexions simultanées utilisant le même ID. Les applications peuvent partager la même clé d'API, mais MQTT requiert que l'ID de client soit toujours unique.
{: tsCauses}
Pour résoudre ce problème, vous pouvez vérifier que deux terminaux ne tentent pas de se connecter en utilisant les mêmes données d'identification.
{: tsResolve}
## Déconnexion par intermittence d'un terminal à {{site.data.keyword.iot_short_notm}}
{: #disconnection_problem}
La connexion de votre terminal à {{site.data.keyword.iot_short_notm}} s'interrompt par intermittence de manière inattendue.
{:shortdesc}
Un terminal connecté au service {{site.data.keyword.iot_short_notm}} est déconnecté par intermittence. Il se reconnecte, mais il est de nouveau déconnecté de manière inattendue au bout d'un certain temps.
{: tsSymptoms}
Il se peut que lorsque vous vous connectez, vous utilisiez une valeur trop faible pour une option de commande ping MQTT, ce qui peut donner l'impression qu'un dépassement de délai d'attente s'est produit pour la connexion. Par exemple, si MQTT client est défini de manière incorrecte, les commandes ping ne sont pas reçues à temps, et la connexion prend fin.
{: tsCauses}
Pour résoudre ce problème, vous pouvez vérifier que vous avez correctement défini les paramètres ping et KeepAlive pour votre connexion.
{: tsResolve}
## Aide et support pour {{site.data.keyword.iot_short_notm}}
{: #gettinghelp}
Si vous avez des problèmes ou de questions quand vous utilisez {{site.data.keyword.iot_short_notm}}, vous pouvez obtenir de l'aide en recherchant des informations précises ou en posant des questions via un forum. Vous pouvez également ouvrir un ticket de demande de service.
Si vous utilisez les forums pour poser une question, libellez votre question de sorte qu'elle soit vue par les équipes de développement {{site.data.keyword.Bluemix_notm}}.
* Si vous avez des questions techniques concernant le développement ou le déploiement d'une application avec {{site.data.keyword.iot_short_notm}}, publiez-les sur [Stack Overflow ](http://stackoverflow.com/search?q=watson-iot+ibm-bluemix){:new_window} et ajoutez les étiquettes "ibm-bluemix" et "watson-iot".
<!--Insert the appropriate dW Answers tag for your service for <service_keyword> in URL below: -->
* Pour des questions relatives au service et aux instructions de mise en route, utilisez le forum [IBM developerWorks dW Answers ](https://developer.ibm.com/answers/topics/watson-iot/?smartspace=bluemix){:new_window}. Ajoutez les étiquettes "watson-iot" et "bluemix".
Pour plus d'informations sur l'utilisation des forums, voir la rubrique décrivant [comment obtenir de l'aide](https://www.{DomainName}/docs/support/index.html#getting-help).
Pour plus d'informations sur l'ouverture d'un ticket de demande de service IBM, sur les niveaux de support disponibles ou les niveaux de gravité des tickets, voir la rubrique décrivant [Comment contacter le support ](https://www.{DomainName}/docs/support/index.html#contacting-support).
| {
"content_hash": "ab75b4f2e266902c0259c2549505e1f0",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 386,
"avg_line_length": 68.19277108433735,
"alnum_prop": 0.7743816254416961,
"repo_name": "nickgaski/docs",
"id": "eedb5b96dd0737acf8166dd3defc09a384c4a1ea",
"size": "5762",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/IoT/nl/fr/ts_index.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "80383"
}
],
"symlink_target": ""
} |
<?php
use SimpleEventStoreManager\Infrastructure\Drivers\DbalDriver;
use SimpleEventStoreManager\Infrastructure\Drivers\InMemoryDriver;
use SimpleEventStoreManager\Infrastructure\Drivers\MongoDriver;
use SimpleEventStoreManager\Infrastructure\Drivers\PdoDriver;
use SimpleEventStoreManager\Infrastructure\Drivers\RedisDriver;
use SimpleEventStoreManager\Tests\BaseTestCase;
class DriverTest extends BaseTestCase
{
/**
* @test
*/
public function it_should_return_the_correct_driver_instance()
{
$dbal = new DbalDriver($this->dbal_parameters);
$this->assertInstanceOf(Doctrine\DBAL\Connection::class, $dbal->instance());
$memory = new InMemoryDriver();
$this->assertInstanceOf(InMemoryDriver::class, $memory->instance());
$mongo = new MongoDriver($this->mongo_parameters);
$this->assertInstanceOf(\MongoDB\Database::class, $mongo->instance());
$pdo = new PdoDriver($this->pdo_parameters);
$this->assertInstanceOf(\PDO::class, $pdo->instance());
$redis = new RedisDriver($this->redis_parameters);
$this->assertInstanceOf(\Predis\Client::class, $redis->instance());
}
}
| {
"content_hash": "72db34ce3d6383a9fcc995336aafaced",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 84,
"avg_line_length": 35.72727272727273,
"alnum_prop": 0.7175572519083969,
"repo_name": "mauretto78/simple-event-store-manager",
"id": "11fbc44af9bb966e671e0b3e6047f56b156997b5",
"size": "1426",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Infrastructure/DriverTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "108884"
}
],
"symlink_target": ""
} |
namespace VRTK.Examples
{
using UnityEngine;
using UnityEventHelper;
public class ButtonReactor : MonoBehaviour
{
public GameObject go;
public Transform dispenseLocation;
private VRTK_Button_UnityEvents buttonEvents;
private void Start()
{
buttonEvents = GetComponent<VRTK_Button_UnityEvents>();
if (buttonEvents == null)
{
buttonEvents = gameObject.AddComponent<VRTK_Button_UnityEvents>();
}
buttonEvents.OnPushed.AddListener(handlePush);
}
private void handlePush(object sender, Control3DEventArgs e)
{
Debug.Log("Pushed");
GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity);
Destroy(newGo, 10f);
}
}
} | {
"content_hash": "ca360539cb4c88ef665f07fa856bb39a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 107,
"avg_line_length": 28.64516129032258,
"alnum_prop": 0.5855855855855856,
"repo_name": "jonathanrlouie/unity-vr-livestream",
"id": "6e8fdc26bb5ef352bfdc55f244cca0925c1a6b4d",
"size": "890",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "PhysicsWorld/Physics World/Assets/VRTK/Examples/Resources/Scripts/ButtonReactor.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2833842"
},
{
"name": "GLSL",
"bytes": "33248"
}
],
"symlink_target": ""
} |
package org.mvel2.tests.core;
import junit.framework.TestCase;
import org.mvel2.MVEL;
import java.io.File;
import java.io.IOException;
/**
* @author yone098
*/
public class MVELTest extends TestCase {
private File file;
public void setUp() {
file = new File("samples/scripts/multibyte.mvel");
}
/**
* evalFile with encoding(workspace encoding utf-8)
*
* @throws IOException
*/
public void testEvalFile1() throws IOException {
Object obj = MVEL.evalFile(file, "UTF-8");
assertEquals("?????", obj);
// use default encoding
obj = MVEL.evalFile(file);
assertEquals("?????", obj);
}
}
| {
"content_hash": "9f052b0a9c0cbc5b8361d96d6cddde71",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 54,
"avg_line_length": 19.303030303030305,
"alnum_prop": 0.6562009419152276,
"repo_name": "mikebrock/mvel",
"id": "193f66da442af541541acf8822ebdbcd51088ab6",
"size": "637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/mvel2/tests/core/MVELTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2192886"
}
],
"symlink_target": ""
} |
ziggy-karma
====
[](https://travis-ci.org/jarofghosts/ziggy-karma)
[](https://www.npmjs.org/package/ziggy-karma)
a karma plugin for [ziggy](https://github.com/jarofghosts/ziggy)
## usage
#### !m, !merit, !motivate, !thanks, !ty, !durant `<name>`
add a karma point to `<name>`
#### !highfive, !hf `<name>`
add ten karma points to `<name>`
#### !dm, !demerit, !demotivate, !boo `<name>`
remove a karma point from `<name>`
#### !flog `<name>`
remove 10 points from `<name>`
#### !k, !karma `<name>`
check the karma points for `<name>`
## license
MIT
| {
"content_hash": "8005a6f0b426892deeb2d041aad0daf1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 133,
"avg_line_length": 21.727272727272727,
"alnum_prop": 0.6555090655509066,
"repo_name": "jarofghosts/ziggy-karma",
"id": "f63448c2b6d29c90ca7f83fe76a4b4dbbd7021c6",
"size": "717",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7530"
}
],
"symlink_target": ""
} |
/*Fix the content collaboration UI bug*/
div.epi-comment-container span[title*="Comment on"] { display: none !important; }
| {
"content_hash": "cf1ea771300798ad0ae67545ffeae685",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 81,
"avg_line_length": 62,
"alnum_prop": 0.7338709677419355,
"repo_name": "episerver/AlloyDemoKit",
"id": "88cfefd3082b2b4f23f186d5e55e08b97df70b46",
"size": "126",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/AlloyDemoKit/ClientResources/Styles/ContentColabFix.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "38246"
},
{
"name": "C#",
"bytes": "384403"
},
{
"name": "CSS",
"bytes": "24732"
},
{
"name": "HTML",
"bytes": "95332"
},
{
"name": "JavaScript",
"bytes": "175125"
}
],
"symlink_target": ""
} |
/*
* 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 com.facebook.presto.operator.scalar;
import com.facebook.presto.metadata.FunctionKind;
import com.facebook.presto.metadata.MetadataManager;
import com.facebook.presto.metadata.Signature;
import com.facebook.presto.operator.project.PageProcessor;
import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.PageBuilder;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.block.BlockBuilder;
import com.facebook.presto.spi.block.BlockBuilderStatus;
import com.facebook.presto.spi.type.ArrayType;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.sql.gen.ExpressionCompiler;
import com.facebook.presto.sql.relational.CallExpression;
import com.facebook.presto.sql.relational.ConstantExpression;
import com.facebook.presto.sql.relational.InputReferenceExpression;
import com.facebook.presto.sql.relational.LambdaDefinitionExpression;
import com.facebook.presto.sql.relational.RowExpression;
import com.facebook.presto.sql.relational.VariableReferenceExpression;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableList;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.VerboseMode;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.facebook.presto.spi.function.OperatorType.GREATER_THAN;
import static com.facebook.presto.spi.type.BigintType.BIGINT;
import static com.facebook.presto.spi.type.BooleanType.BOOLEAN;
import static com.facebook.presto.spi.type.TypeSignature.parseTypeSignature;
import static com.facebook.presto.testing.TestingConnectorSession.SESSION;
@SuppressWarnings("MethodMayBeStatic")
@State(Scope.Thread)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(2)
@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.AverageTime)
public class BenchmarkArrayTransform
{
private static final int POSITIONS = 100_000;
private static final int ARRAY_SIZE = 4;
private static final int NUM_TYPES = 1;
private static final List<Type> TYPES = ImmutableList.of(BIGINT);
static {
Verify.verify(NUM_TYPES == TYPES.size());
}
@Benchmark
@OperationsPerInvocation(POSITIONS * ARRAY_SIZE * NUM_TYPES)
public Object benchmark(BenchmarkData data)
{
return ImmutableList.copyOf(data.getPageProcessor().process(SESSION, data.getPage()));
}
@SuppressWarnings("FieldMayBeFinal")
@State(Scope.Thread)
public static class BenchmarkData
{
private PageBuilder pageBuilder;
private Page page;
private PageProcessor pageProcessor;
@Setup
public void setup()
{
MetadataManager metadata = MetadataManager.createTestMetadataManager();
ExpressionCompiler compiler = new ExpressionCompiler(metadata);
ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder();
Block[] blocks = new Block[TYPES.size()];
Type returnType = new ArrayType(BOOLEAN);
for (int i = 0; i < TYPES.size(); i++) {
Type elementType = TYPES.get(i);
ArrayType arrayType = new ArrayType(elementType);
Signature signature = new Signature("transform", FunctionKind.SCALAR, returnType.getTypeSignature(), arrayType.getTypeSignature(), parseTypeSignature("function(bigint,boolean)"));
Signature greaterThan = new Signature("$operator$" + GREATER_THAN.name(), FunctionKind.SCALAR, BOOLEAN.getTypeSignature(), BIGINT.getTypeSignature(), BIGINT.getTypeSignature());
projectionsBuilder.add(new CallExpression(signature, returnType, ImmutableList.of(
new InputReferenceExpression(0, arrayType),
new LambdaDefinitionExpression(
ImmutableList.of(BIGINT),
ImmutableList.of("x"),
new CallExpression(greaterThan, BOOLEAN, ImmutableList.of(new VariableReferenceExpression("x", BIGINT), new ConstantExpression(0L, BIGINT)))))));
blocks[i] = createChannel(POSITIONS, ARRAY_SIZE, arrayType);
}
ImmutableList<RowExpression> projections = projectionsBuilder.build();
pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get();
pageBuilder = new PageBuilder(projections.stream().map(RowExpression::getType).collect(Collectors.toList()));
page = new Page(blocks);
}
private static Block createChannel(int positionCount, int arraySize, ArrayType arrayType)
{
BlockBuilder blockBuilder = arrayType.createBlockBuilder(new BlockBuilderStatus(), positionCount);
for (int position = 0; position < positionCount; position++) {
BlockBuilder entryBuilder = blockBuilder.beginBlockEntry();
for (int i = 0; i < arraySize; i++) {
if (arrayType.getElementType().getJavaType() == long.class) {
arrayType.getElementType().writeLong(entryBuilder, ThreadLocalRandom.current().nextLong());
}
else {
throw new UnsupportedOperationException();
}
}
blockBuilder.closeEntry();
}
return blockBuilder.build();
}
public PageProcessor getPageProcessor()
{
return pageProcessor;
}
public Page getPage()
{
return page;
}
public PageBuilder getPageBuilder()
{
return pageBuilder;
}
}
public static void main(String[] args)
throws Throwable
{
// assure the benchmarks are valid before running
BenchmarkData data = new BenchmarkData();
data.setup();
new BenchmarkArrayTransform().benchmark(data);
Options options = new OptionsBuilder()
.verbosity(VerboseMode.NORMAL)
.include(".*" + BenchmarkArrayTransform.class.getSimpleName() + ".*")
.build();
new Runner(options).run();
}
}
| {
"content_hash": "ac1cab8f4c22c8a8256df0199163e197",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 195,
"avg_line_length": 43.72832369942196,
"alnum_prop": 0.6972901520158625,
"repo_name": "mandusm/presto",
"id": "d45baad21c9074c7ddd65c66b34fed3790584af7",
"size": "7565",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "presto-main/src/test/java/com/facebook/presto/operator/scalar/BenchmarkArrayTransform.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "18224"
},
{
"name": "HTML",
"bytes": "45184"
},
{
"name": "Java",
"bytes": "13257462"
},
{
"name": "JavaScript",
"bytes": "1431"
},
{
"name": "Makefile",
"bytes": "6819"
},
{
"name": "PLSQL",
"bytes": "3860"
},
{
"name": "Python",
"bytes": "4479"
},
{
"name": "SQLPL",
"bytes": "6363"
},
{
"name": "Shell",
"bytes": "2201"
}
],
"symlink_target": ""
} |
sap.ui.define([
"sap/ui/fl/changeHandler/common/revertAddedControls",
"sap/ui/fl/changeHandler/common/getTargetAggregationIndex",
"sap/ui/fl/changeHandler/common/createIFrame",
"sap/ui/fl/changeHandler/condenser/Classification"
], function(
revertAddedControls,
getTargetAggregationIndex,
createIFrame,
Classification
) {
"use strict";
/**
* Change handler for adding UI Extension
*
* @alias sap.ui.fl.changeHandler.AddIFrame
* @author SAP SE
* @version ${version}
* @since 1.72
* @private
*/
var AddIFrame = {};
/**
* Add the IFrame control to the target control within the target aggregation.
*
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange Change object with instructions to be applied on the control map
* @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change
* @param {object} mPropertyBag Map of properties
* @param {object} mPropertyBag.modifier Modifier for the controls
* @returns {Promise} Promise resolving when the change is successfully applied
* @ui5-restricted sap.ui.fl
*/
AddIFrame.applyChange = function(oChange, oControl, mPropertyBag) {
var oModifier = mPropertyBag.modifier;
var oChangeContent = oChange.getContent();
var oView = mPropertyBag.view;
var sAggregationName = oChangeContent.targetAggregation;
var iIndex;
var oIFrame;
return Promise.resolve()
.then(oModifier.findAggregation.bind(oModifier, oControl, sAggregationName))
.then(function(oAggregationDefinition) {
if (!oAggregationDefinition) {
throw new Error("The given Aggregation is not available in the given control: " + oModifier.getId(oControl));
}
return getTargetAggregationIndex(oChange, oControl, mPropertyBag);
})
.then(function(iRetrievedIndex) {
iIndex = iRetrievedIndex;
return createIFrame(oChange, mPropertyBag, oChangeContent.selector);
})
.then(function(oCreatedIFrame) {
oIFrame = oCreatedIFrame;
return oModifier.insertAggregation(oControl, sAggregationName, oIFrame, iIndex, oView);
})
.then(function() {
oChange.setRevertData([oModifier.getId(oIFrame)]);
});
};
/**
* Reverts previously applied change.
*
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange Change object with instructions to be applied on the control map
* @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change
* @param {object} mPropertyBag Map of properties
* @param {object} mPropertyBag.modifier Modifier for the controls
* @ui5-restricted sap.ui.fl
*/
AddIFrame.revertChange = revertAddedControls;
/**
* Completes the change by adding change handler specific content.
*
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange Change object to be completed
* @param {object} oSpecificChangeInfo Specific change information
* @param {object} oSpecificChangeInfo.content Must contain UI extension settings
* @param {string} oSpecificChangeInfo.content.targetAggregation Aggregation to add the extension to
* @param {string} oSpecificChangeInfo.content.baseId Base ID to allocate controls
* @param {string} [oSpecificChangeInfo.content.width] IFrame Width
* @param {string} [oSpecificChangeInfo.content.height] IFrame Height
* @param {string} oSpecificChangeInfo.content.url IFrame Url
* @param {object} mPropertyBag Property bag containing the modifier, the appComponent and the view
* @param {object} mPropertyBag.modifier Modifier for the controls
* @param {object} mPropertyBag.appComponent Component in which the change should be applied
* @param {object} mPropertyBag.view Application view
* @ui5-restricted sap.ui.fl
*/
AddIFrame.completeChangeContent = function (oChange, oSpecificChangeInfo, mPropertyBag) {
var oModifier = mPropertyBag.modifier;
var oAppComponent = mPropertyBag.appComponent;
// Required settings
["targetAggregation", "baseId", "url"].forEach(function (sRequiredProperty) {
if (!Object.prototype.hasOwnProperty.call(oSpecificChangeInfo.content, sRequiredProperty)) {
throw new Error("Attribute missing from the change specific content '" + sRequiredProperty + "'");
}
});
var oContent = Object.assign({}, oSpecificChangeInfo.content);
oContent.selector = oModifier.getSelector(oContent.baseId, oAppComponent);
oChange.setContent(oContent);
};
AddIFrame.getChangeVisualizationInfo = function(oChange) {
return {
affectedControls: [oChange.getContent().selector]
};
};
AddIFrame.getCondenserInfo = function(oChange) {
var oContent = oChange.getContent();
return {
classification: Classification.Create,
uniqueKey: "iFrame",
affectedControl: oContent.selector,
targetContainer: oChange.getSelector(),
targetAggregation: oContent.targetAggregation,
setTargetIndex: function(oChange, iNewTargetIndex) {
oChange.getContent().index = iNewTargetIndex;
},
getTargetIndex: function(oChange) {
return oChange.getContent().index;
},
update: function(oChange, oNewContent) {
Object.assign(oChange.getContent(), oNewContent);
}
};
};
return AddIFrame;
}, /* bExport= */true);
| {
"content_hash": "0b46b186254883d0ae561d6e557b66dc",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 134,
"avg_line_length": 38.71641791044776,
"alnum_prop": 0.7480724749421742,
"repo_name": "SAP/openui5",
"id": "997d86b77f0e970a0f46b575c6590a814529e8af",
"size": "5211",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sap.ui.fl/src/sap/ui/fl/changeHandler/AddIFrame.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "294216"
},
{
"name": "Gherkin",
"bytes": "17201"
},
{
"name": "HTML",
"bytes": "6443688"
},
{
"name": "Java",
"bytes": "83398"
},
{
"name": "JavaScript",
"bytes": "109546491"
},
{
"name": "Less",
"bytes": "8741757"
},
{
"name": "TypeScript",
"bytes": "20918"
}
],
"symlink_target": ""
} |
import { NgModule, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HelloModule } from './hello/hello.module';
import { DataDomModule } from './data-dom/data-dom.module';
import { CommunicationModule } from './comunication/comunication.module';
import { ComplistModule } from './complist/complist.module';
import { FormModule } from './form/form.module';
@Component({
selector: 'my-app',
template: `
<fo-main></fo-main>
<!--
<cl-main></cl-main>
<cc-main></cc-main>
<dd-main></dd-main>
<ha-hello-input></ha-hello-input>
<ha-hello-simple></ha-hello-simple>
-->
`
})
class AppComponent {}
@NgModule({
imports: [
BrowserModule,
HelloModule,
DataDomModule,
CommunicationModule,
ComplistModule,
FormModule
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { } | {
"content_hash": "345509ba30faac6e8c00320034d0c7dc",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 32.30555555555556,
"alnum_prop": 0.5219260533104041,
"repo_name": "krzosik/szkolenie_angular",
"id": "50236519e255f0c23155128f49d66d48b7be7a27",
"size": "1163",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/app.module.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "7319"
},
{
"name": "JavaScript",
"bytes": "14954"
},
{
"name": "TypeScript",
"bytes": "17081"
}
],
"symlink_target": ""
} |
var http = require('http');
var url = require('url');
var fs = require('fs');
var path = require('path');
var mime = require('mime');
var config = require('./config');
var zlib = require('zlib');
//Accept-Encoding:gzip, deflate, sdch
var server = http.createServer(function(req,res){
var pathname = url.parse(req.url).pathname;
if(pathname == '/favicon.ico')return res.end('404');
if(pathname.slice(-1) == '/'){
pathname+='index.html';
}
var realPath = path.join('public',pathname);
var ext = path.extname(realPath);
if(ext.match(config.CachedType.fileMatch)){
fs.stat(realPath,function(err,stat){
var lastModified = stat.mtime.toUTCString();
if(req.headers['if-modified-since'] && req.headers['if-modified-since'] == lastModified){
res.writeHead(304);
return res.end(http.STATUS_CODES[304]);
}else{
var expires = new Date(new Date().getTime()+config.CachedType.maxAge*1000);
res.setHeader('Expires',expires.toUTCString());
res.setHeader('Cache-Control','max-age='+config.CachedType.maxAge);
res.setHeader('Last-Modified',lastModified);
var raw = fs.createReadStream(realPath);
var acceptEncoding = req.headers['accept-encoding'];
var matched = ext.match(config.Compress.match);
console.log('matched',matched)
if(matched){
//gzip, deflate, sdch
if(acceptEncoding.match(/\bgzip\b/)){
res.writeHead(200,'OK',{'Content-Encoding':'gzip','Content-Type':mime.lookup(realPath)});
raw.pipe(zlib.createGzip()).pipe(res);
}else{
res.writeHead(200,'OK',{'Content-Type':mime.lookup(realPath)});
raw.pipe(res);
}
}
}
})
}else{
res.writeHead(200,{'Content-Type':mime.lookup(realPath)})
fs.createReadStream(realPath).pipe(res);
}
}).listen(8080); | {
"content_hash": "b509be0e71a8228c1db4514682005a40",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 113,
"avg_line_length": 43.3469387755102,
"alnum_prop": 0.5527306967984934,
"repo_name": "plxiayutian/201505",
"id": "aecfba26d5a6a06d0144abc7410b4a90be238224",
"size": "2124",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "15.http_ext/static/app.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "153"
},
{
"name": "HTML",
"bytes": "35774"
},
{
"name": "JavaScript",
"bytes": "139284"
}
],
"symlink_target": ""
} |
require 'librato/metrics'
Librato::Metrics.authenticate 'my email', 'my api key'
# send a measurement of 12 for 'foo'
Librato::Metrics.submit :cpu => 54
# submit multiple metrics at once
Librato::Metrics.submit :cpu => 63, :memory => 213
# submit a metric with a custom source
Librato::Metrics.submit :cpu => {:source => 'myapp', :value => 75}
# if you are sending many metrics it is much more performant
# to submit them in sets rather than individually:
queue = Librato::Metrics::Queue.new
queue.add 'disk.free' => 1223121
queue.add :memory => 2321
queue.add :cpu => {:source => 'myapp', :value => 52}
#...
queue.submit | {
"content_hash": "499863f516f4ea0bc2ff4579b9afc79d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 26.208333333333332,
"alnum_prop": 0.7011128775834659,
"repo_name": "winebarrel/librato-metrics",
"id": "679c68c9acc71d4d71059876f192762ad008b401",
"size": "629",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/simple.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ruby",
"bytes": "112537"
}
],
"symlink_target": ""
} |
NCM\::Component\::libvirtd - schema
###################################
Types
-----
- **/software/components/libvirtd/structure_libvirtd_network**
- */software/components/libvirtd/structure_libvirtd_network/listen_tls*
- Optional
- Type: long
- Range: 0..1
- */software/components/libvirtd/structure_libvirtd_network/listen_tcp*
- Optional
- Type: long
- Range: 0..1
- */software/components/libvirtd/structure_libvirtd_network/tls_port*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_network/tcp_port*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_network/listen_addr*
- Optional
- Type: type_hostname
- */software/components/libvirtd/structure_libvirtd_network/mdns_adv*
- Optional
- Type: long
- Range: 0..1
- */software/components/libvirtd/structure_libvirtd_network/mdns_name*
- Optional
- Type: string
- **/software/components/libvirtd/structure_libvirtd_socket**
- */software/components/libvirtd/structure_libvirtd_socket/unix_sock_group*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_socket/unix_sock_ro_perms*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_socket/unix_sock_rw_perms*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_socket/unix_sock_dir*
- Optional
- Type: string
- **/software/components/libvirtd/structure_libvirtd_authn**
- */software/components/libvirtd/structure_libvirtd_authn/auth_unix_ro*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_authn/auth_unix_rw*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_authn/auth_tcp*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_authn/auth_tls*
- Optional
- Type: string
- **/software/components/libvirtd/structure_libvirtd_tls**
- */software/components/libvirtd/structure_libvirtd_tls/key_file*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_tls/cert_file*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_tls/ca_file*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_tls/crl_file*
- Optional
- Type: string
- **/software/components/libvirtd/structure_libvirtd_authz**
- */software/components/libvirtd/structure_libvirtd_authz/tls_no_verify_certificate*
- Optional
- Type: long
- Range: 0..1
- */software/components/libvirtd/structure_libvirtd_authz/tls_allowed_dn_list*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_authz/sasl_allowed_username_list*
- Optional
- Type: string
- **/software/components/libvirtd/structure_libvirtd_processing**
- */software/components/libvirtd/structure_libvirtd_processing/max_clients*
- Optional
- Type: long
- Range: 1..
- */software/components/libvirtd/structure_libvirtd_processing/min_workers*
- Optional
- Type: long
- Range: 1..
- */software/components/libvirtd/structure_libvirtd_processing/max_workers*
- Optional
- Type: long
- Range: 1..
- */software/components/libvirtd/structure_libvirtd_processing/max_requests*
- Optional
- Type: long
- Range: 1..
- */software/components/libvirtd/structure_libvirtd_processing/max_client_requests*
- Optional
- Type: long
- Range: 1..
- **/software/components/libvirtd/structure_libvirtd_logging**
- */software/components/libvirtd/structure_libvirtd_logging/log_level*
- Optional
- Type: long
- Range: 0..4
- */software/components/libvirtd/structure_libvirtd_logging/log_filters*
- Optional
- Type: string
- */software/components/libvirtd/structure_libvirtd_logging/log_outputs*
- Optional
- Type: string
- **/software/components/libvirtd/structure_component_libvirtd**
- */software/components/libvirtd/structure_component_libvirtd/libvirtd_config*
- Required
- Type: string
- Default value: /etc/libvirt/libvirtd.conf
- */software/components/libvirtd/structure_component_libvirtd/network*
- Optional
- Type: structure_libvirtd_network
- */software/components/libvirtd/structure_component_libvirtd/socket*
- Optional
- Type: structure_libvirtd_socket
- */software/components/libvirtd/structure_component_libvirtd/authn*
- Optional
- Type: structure_libvirtd_authn
- */software/components/libvirtd/structure_component_libvirtd/tls*
- Optional
- Type: structure_libvirtd_tls
- */software/components/libvirtd/structure_component_libvirtd/authz*
- Optional
- Type: structure_libvirtd_authz
- */software/components/libvirtd/structure_component_libvirtd/processing*
- Optional
- Type: structure_libvirtd_processing
- */software/components/libvirtd/structure_component_libvirtd/logging*
- Optional
- Type: structure_libvirtd_logging
| {
"content_hash": "790d691277a7392ae49f451a09e65204",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 89,
"avg_line_length": 39.611510791366904,
"alnum_prop": 0.6520159825644751,
"repo_name": "wdpypere/docs-test-comps",
"id": "d11b30b2b7d1fbf033027e46286037563e8c9eaa",
"size": "5542",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/components/NCM_Component_libvirtd_schema.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "57"
},
{
"name": "Shell",
"bytes": "186"
}
],
"symlink_target": ""
} |
Reveal.addEventListener( 'ready', function() {
QUnit.module( 'Markdown' );
test( 'Options are set', function() {
strictEqual( marked.defaults.smartypants, true );
});
test( 'Smart quotes are activated', function() {
var text = document.querySelector( '.reveal .slides>section>p' ).textContent;
strictEqual( /['"]/.test( text ), false );
strictEqual( /[“”‘’]/.test( text ), true );
});
} );
Reveal.initialize({
dependencies: [
{ src: '../plugin/markdown/marked.js' },
{ src: '../plugin/markdown/markdown.js' },
],
markdown: {
smartypants: true
}
});
| {
"content_hash": "0dce80c55218cb52499f9d878db7e28e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 23.23076923076923,
"alnum_prop": 0.6009933774834437,
"repo_name": "giuliacot/Il-front-end-spiegato-alle-bionde",
"id": "4872447c836351233413a077eccbb469258f2e3f",
"size": "612",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "test/test-markdown-options.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "209872"
},
{
"name": "HTML",
"bytes": "88803"
},
{
"name": "JavaScript",
"bytes": "278895"
}
],
"symlink_target": ""
} |
using System;
using GalaSoft.MvvmLight.Helpers;
using GalaSoft.MvvmLight.Views;
using Microsoft.Practices.ServiceLocation;
using UIKit;
using XamBindingSample.ViewModel;
namespace XamBindingSample
{
partial class Bindings5ViewController : UIViewController
{
// ReSharper disable once ConvertToConstant.Local
// ReSharper disable once FieldCanBeMadeReadOnly.Local
private static bool _falseFlag = false;
// Saving bindings to avoid garbage collection
// ReSharper disable once NotAccessedField.Local
private Binding _binding;
public INavigationService Nav
{
get
{
return ServiceLocator.Current.GetInstance<INavigationService>();
}
}
public BindingsViewModel Vm
{
get
{
return Application.Locator.Bindings;
}
}
public Bindings5ViewController(IntPtr handle)
: base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var nextButton = new UIBarButtonItem(
"Next",
UIBarButtonItemStyle.Plain,
(s, e) =>
{
Nav.NavigateTo(AppDelegate.BindingsPage6Key);
});
NavigationItem.SetRightBarButtonItem(nextButton, false);
View.AddGestureRecognizer(
new UITapGestureRecognizer(
() =>
{
if (MyTextFieldA1.CanResignFirstResponder)
{
MyTextFieldA1.ResignFirstResponder();
}
}));
// Conversion back and forth --------------------------------------------------------------------
#region Conversion back and forth
_binding = this.SetBinding(
() => MySwitchA1.On,
() => MyTextFieldA1.Text,
BindingMode.TwoWay)
.ConvertSourceToTarget(val => val ? "TTT" : "FFF")
.ConvertTargetToSource(val => val == "TTT");
#endregion
#region Subscribing to events to avoid linker issues in release mode
// This "fools" the linker into believing that the events are used.
// In fact we don't even subscribe to them.
// See https://developer.xamarin.com/guides/android/advanced_topics/linking/
if (_falseFlag)
{
MySwitchA1.ValueChanged += (s, e) =>
{
};
MyTextFieldA1.EditingChanged += (s, e) =>
{
};
}
#endregion
}
}
} | {
"content_hash": "f805297c4b90173f39d72970d69f6a0e",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 109,
"avg_line_length": 29.144329896907216,
"alnum_prop": 0.500884329678104,
"repo_name": "lbugnion/sample-2017-techorama",
"id": "a89227ba2f1ab7c46d7772c6581b29c6cda3edb1",
"size": "2827",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "XamBindingSample/XamBindingSample/XamBindingSample.iOS/Bindings5ViewController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "Batchfile",
"bytes": "1688"
},
{
"name": "C#",
"bytes": "384297"
},
{
"name": "HTML",
"bytes": "449"
},
{
"name": "Pascal",
"bytes": "2720"
},
{
"name": "PowerShell",
"bytes": "15567"
}
],
"symlink_target": ""
} |
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreHome\DataTableRowAction;
use Exception;
use Piwik\API\DataTablePostProcessor;
use Piwik\API\Request;
use Piwik\API\ResponseBuilder;
use Piwik\Common;
use Piwik\DataTable;
use Piwik\Date;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution as EvolutionViz;
use Piwik\Url;
use Piwik\ViewDataTable\Factory;
/**
* ROW EVOLUTION
* The class handles the popover that shows the evolution of a singe row in a data table
*/
class RowEvolution
{
/** The current site id */
protected $idSite;
/** The api method to get the data. Format: Plugin.apiAction */
protected $apiMethod;
/** The label of the requested row */
protected $label;
/** The requested period */
protected $period;
/** The requested date */
protected $date;
/** The request segment */
protected $segment;
/** The metrics that are available for the requested report and period */
protected $availableMetrics;
/** The name of the dimension of the current report */
protected $dimension;
/**
* The data
* @var \Piwik\DataTable
*/
protected $dataTable;
/** The label of the current record */
protected $rowLabel;
/** The icon of the current record */
protected $rowIcon;
/** The type of graph that has been requested last */
protected $graphType;
/** The metrics for the graph that has been requested last */
protected $graphMetrics;
/** Whether or not to show all metrics in the evolution graph when to popover opens */
protected $initiallyShowAllMetrics = false;
/**
* The constructor
* Initialize some local variables from the request
* @param int $idSite
* @param Date $date ($this->date from controller)
* @param null|string $graphType
* @throws Exception
*/
public function __construct($idSite, $date, $graphType = 'graphEvolution')
{
$this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
if (empty($this->apiMethod)) throw new Exception("Parameter apiMethod not set.");
$this->label = DataTablePostProcessor::getLabelFromRequest($_GET);
if (!is_array($this->label)) {
throw new Exception("Expected label to be an array, got instead: " . $this->label);
}
$this->label = $this->label[0];
if ($this->label === '') throw new Exception("Parameter label not set.");
$this->period = Common::getRequestVar('period', '', 'string');
if (empty($this->period)) throw new Exception("Parameter period not set.");
$this->idSite = $idSite;
$this->graphType = $graphType;
if ($this->period != 'range') {
// handle day, week, month and year: display last X periods
$end = $date->toString();
list($this->date, $lastN) = EvolutionViz::getDateRangeAndLastN($this->period, $end);
}
$this->segment = \Piwik\API\Request::getRawSegmentFromRequest();
$this->loadEvolutionReport();
}
/**
* Render the popover
* @param \Piwik\Plugins\CoreHome\Controller $controller
* @param View (the popover_rowevolution template)
*/
public function renderPopover($controller, $view)
{
// render main evolution graph
$this->graphType = 'graphEvolution';
$this->graphMetrics = $this->availableMetrics;
$view->graph = $controller->getRowEvolutionGraph($fetch = true, $rowEvolution = $this);
// render metrics overview
$view->metrics = $this->getMetricsToggles();
// available metrics text
$metricsText = Piwik::translate('RowEvolution_AvailableMetrics');
$popoverTitle = '';
if ($this->rowLabel) {
$icon = $this->rowIcon ? '<img src="' . $this->rowIcon . '" alt="">' : '';
$metricsText = sprintf(Piwik::translate('RowEvolution_MetricsFor'), $this->dimension . ': ' . $icon . ' ' . $this->rowLabel);
$popoverTitle = $icon . ' ' . $this->rowLabel;
}
$view->availableMetricsText = $metricsText;
$view->popoverTitle = $popoverTitle;
return $view->render();
}
protected function loadEvolutionReport($column = false)
{
list($apiModule, $apiAction) = explode('.', $this->apiMethod);
$parameters = array(
'method' => 'API.getRowEvolution',
'label' => $this->label,
'apiModule' => $apiModule,
'apiAction' => $apiAction,
'idSite' => $this->idSite,
'period' => $this->period,
'date' => $this->date,
'format' => 'original',
'serialize' => '0'
);
if (!empty($this->segment)) {
$parameters['segment'] = $this->segment;
}
if ($column !== false) {
$parameters['column'] = $column;
}
$url = Url::getQueryStringFromParameters($parameters);
$request = new Request($url);
$report = $request->process();
$this->extractEvolutionReport($report);
}
protected function extractEvolutionReport($report)
{
$this->dataTable = $report['reportData'];
$this->rowLabel = $this->extractPrettyLabel($report);
$this->rowIcon = !empty($report['logo']) ? $report['logo'] : false;
$this->availableMetrics = $report['metadata']['metrics'];
$this->dimension = $report['metadata']['dimension'];
}
/**
* Generic method to get an evolution graph or a sparkline for the row evolution popover.
* Do as much as possible from outside the controller.
* @param string|bool $graphType
* @param array|bool $metrics
* @return Factory
*/
public function getRowEvolutionGraph($graphType = false, $metrics = false)
{
// set up the view data table
$view = Factory::build($graphType ? : $this->graphType, $this->apiMethod,
$controllerAction = 'CoreHome.getRowEvolutionGraph', $forceDefault = true);
$view->setDataTable($this->dataTable);
if (!empty($this->graphMetrics)) { // In row Evolution popover, this is empty
$view->config->columns_to_display = array_keys($metrics ? : $this->graphMetrics);
}
$view->requestConfig->request_parameters_to_modify['label'] = '';
$view->config->show_goals = false;
$view->config->show_search = false;
$view->config->show_all_views_icons = false;
$view->config->show_active_view_icon = false;
$view->config->show_related_reports = false;
$view->config->show_series_picker = false;
$view->config->show_footer_message = false;
foreach ($this->availableMetrics as $metric => $metadata) {
$view->config->translations[$metric] = $metadata['name'];
}
$view->config->external_series_toggle = 'RowEvolutionSeriesToggle';
$view->config->external_series_toggle_show_all = $this->initiallyShowAllMetrics;
return $view;
}
/**
* Prepare metrics toggles with spark lines
* @return array
*/
protected function getMetricsToggles()
{
$i = 0;
$metrics = array();
foreach ($this->availableMetrics as $metric => $metricData) {
$unit = Metrics::getUnit($metric, $this->idSite);
$change = isset($metricData['change']) ? $metricData['change'] : false;
list($first, $last) = $this->getFirstAndLastDataPointsForMetric($metric);
$details = Piwik::translate('RowEvolution_MetricBetweenText', array($first, $last));
if ($change !== false) {
$lowerIsBetter = Metrics::isLowerValueBetter($metric);
if (substr($change, 0, 1) == '+') {
$changeClass = $lowerIsBetter ? 'bad' : 'good';
$changeImage = $lowerIsBetter ? 'arrow_up_red' : 'arrow_up';
} else if (substr($change, 0, 1) == '-') {
$changeClass = $lowerIsBetter ? 'good' : 'bad';
$changeImage = $lowerIsBetter ? 'arrow_down_green' : 'arrow_down';
} else {
$changeClass = 'neutral';
$changeImage = false;
}
$change = '<span class="' . $changeClass . '">'
. ($changeImage ? '<img src="plugins/MultiSites/images/' . $changeImage . '.png" /> ' : '')
. $change . '</span>';
$details .= ', ' . Piwik::translate('RowEvolution_MetricChangeText', $change);
}
// set metric min/max text (used as tooltip for details)
$max = isset($metricData['max']) ? $metricData['max'] : 0;
$min = isset($metricData['min']) ? $metricData['min'] : 0;
$min .= $unit;
$max .= $unit;
$minmax = Piwik::translate('RowEvolution_MetricMinMax', array($metricData['name'], $min, $max));
$newMetric = array(
'label' => $metricData['name'],
'details' => $details,
'minmax' => $minmax,
'sparkline' => $this->getSparkline($metric),
);
// Multi Rows, each metric can be for a particular row and display an icon
if (!empty($metricData['logo'])) {
$newMetric['logo'] = $metricData['logo'];
}
// TODO: this check should be determined by metric metadata, not hardcoded here
if ($metric == 'nb_users'
&& $first == 0
&& $last == 0
) {
$newMetric['hide'] = true;
}
$metrics[] = $newMetric;
$i++;
}
return $metrics;
}
/** Get the img tag for a sparkline showing a single metric */
protected function getSparkline($metric)
{
// sparkline is always echoed, so we need to buffer the output
$view = $this->getRowEvolutionGraph($graphType = 'sparkline', $metrics = array($metric => $metric));
ob_start();
$view->render();
$spark = ob_get_contents();
ob_end_clean();
// undo header change by sparkline renderer
header('Content-type: text/html');
// base64 encode the image and put it in an img tag
$spark = base64_encode($spark);
return '<img src="data:image/png;base64,' . $spark . '" />';
}
/** Use the available metrics for the metrics of the last requested graph. */
public function useAvailableMetrics()
{
$this->graphMetrics = $this->availableMetrics;
}
private function getFirstAndLastDataPointsForMetric($metric)
{
$first = 0;
$firstTable = $this->dataTable->getFirstRow();
if (!empty($firstTable)) {
$row = $firstTable->getFirstRow();
if (!empty($row)) {
$first = floatval($row->getColumn($metric));
}
}
$last = 0;
$lastTable = $this->dataTable->getLastRow();
if (!empty($lastTable)) {
$row = $lastTable->getFirstRow();
if (!empty($row)) {
$last = floatval($row->getColumn($metric));
}
}
return array($first, $last);
}
/**
* @param $report
* @return string
*/
protected function extractPrettyLabel($report)
{
// By default, use the specified label
$rowLabel = Common::sanitizeInputValue($report['label']);
$rowLabel = str_replace('/', '<wbr>/', str_replace('&', '<wbr>&', $rowLabel ));
// If the dataTable specifies a label_html, use this instead
/** @var $dataTableMap \Piwik\DataTable\Map */
$dataTableMap = $report['reportData'];
$labelPretty = $dataTableMap->getColumn('label_html');
$labelPretty = array_filter($labelPretty, 'strlen');
$labelPretty = current($labelPretty);
if (!empty($labelPretty)) {
return $labelPretty;
}
return $rowLabel;
}
}
| {
"content_hash": "681289830c403d724516ad839fe9acb8",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 137,
"avg_line_length": 34.51260504201681,
"alnum_prop": 0.5667559451343235,
"repo_name": "ItsAGeekThing/heroku-docker-piwik",
"id": "85fa98bc3edbf64655eeefdae3b6b12b1d7687ab",
"size": "12321",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/piwik/piwik/plugins/CoreHome/DataTableRowAction/RowEvolution.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Nginx",
"bytes": "246"
},
{
"name": "PHP",
"bytes": "2369"
}
],
"symlink_target": ""
} |
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
from .._vendor import _convert_request, _format_url_section
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_data_policy_manifests_get_by_policy_mode_request(policy_mode: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}")
path_format_arguments = {
"policyMode": _SERIALIZER.url("policy_mode", policy_mode, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_data_policy_manifests_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/dataPolicyManifests")
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_delete_request(scope: str, policy_assignment_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyAssignmentName": _SERIALIZER.url("policy_assignment_name", policy_assignment_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_create_request(scope: str, policy_assignment_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyAssignmentName": _SERIALIZER.url("policy_assignment_name", policy_assignment_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_get_request(scope: str, policy_assignment_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyAssignmentName": _SERIALIZER.url("policy_assignment_name", policy_assignment_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_update_request(scope: str, policy_assignment_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyAssignmentName": _SERIALIZER.url("policy_assignment_name", policy_assignment_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_list_for_resource_group_request(
resource_group_name: str,
subscription_id: str,
*,
filter: Optional[str] = None,
top: Optional[int] = None,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments",
) # pylint: disable=line-too-long
path_format_arguments = {
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_list_for_resource_request(
resource_group_name: str,
resource_provider_namespace: str,
parent_resource_path: str,
resource_type: str,
resource_name: str,
subscription_id: str,
*,
filter: Optional[str] = None,
top: Optional[int] = None,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments",
) # pylint: disable=line-too-long
path_format_arguments = {
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
),
"resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"),
"parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True),
"resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True),
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_list_for_management_group_request(
management_group_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_list_request(
subscription_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments"
)
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_delete_by_id_request(policy_assignment_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/{policyAssignmentId}")
path_format_arguments = {
"policyAssignmentId": _SERIALIZER.url("policy_assignment_id", policy_assignment_id, "str", skip_quote=True),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_create_by_id_request(policy_assignment_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/{policyAssignmentId}")
path_format_arguments = {
"policyAssignmentId": _SERIALIZER.url("policy_assignment_id", policy_assignment_id, "str", skip_quote=True),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_get_by_id_request(policy_assignment_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/{policyAssignmentId}")
path_format_arguments = {
"policyAssignmentId": _SERIALIZER.url("policy_assignment_id", policy_assignment_id, "str", skip_quote=True),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_assignments_update_by_id_request(policy_assignment_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/{policyAssignmentId}")
path_format_arguments = {
"policyAssignmentId": _SERIALIZER.url("policy_assignment_id", policy_assignment_id, "str", skip_quote=True),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_create_or_update_request(
policy_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_delete_request(
policy_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_get_request(
policy_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_get_built_in_request(policy_definition_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}")
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_create_or_update_at_management_group_request(
policy_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_delete_at_management_group_request(
policy_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_get_at_management_group_request(
policy_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_list_request(
subscription_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions"
)
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_list_built_in_request(
*, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/policyDefinitions")
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_definitions_list_by_management_group_request(
management_group_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_create_or_update_request(
policy_set_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_delete_request(
policy_set_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_get_request(
policy_set_definition_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_get_built_in_request(policy_set_definition_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"
)
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_list_request(
subscription_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_list_built_in_request(
*, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/policySetDefinitions")
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_create_or_update_at_management_group_request(
policy_set_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_delete_at_management_group_request(
policy_set_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_get_at_management_group_request(
policy_set_definition_name: str, management_group_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"),
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_set_definitions_list_by_management_group_request(
management_group_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
if top is not None:
_params["$top"] = _SERIALIZER.query("top", top, "int", maximum=1000, minimum=1)
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_delete_request(scope: str, policy_exemption_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyExemptionName": _SERIALIZER.url("policy_exemption_name", policy_exemption_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_create_or_update_request(
scope: str, policy_exemption_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyExemptionName": _SERIALIZER.url("policy_exemption_name", policy_exemption_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_get_request(scope: str, policy_exemption_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"
)
path_format_arguments = {
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
"policyExemptionName": _SERIALIZER.url("policy_exemption_name", policy_exemption_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_list_request(
subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions"
)
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_list_for_resource_group_request(
resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_list_for_resource_request(
resource_group_name: str,
resource_provider_namespace: str,
parent_resource_path: str,
resource_type: str,
resource_name: str,
subscription_id: str,
*,
filter: Optional[str] = None,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$"
),
"resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"),
"parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True),
"resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True),
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_policy_exemptions_list_for_management_group_request(
management_group_id: str, *, filter: Optional[str] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
if filter is not None:
_params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True)
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_delete_request(variable_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_create_or_update_request(variable_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_get_request(variable_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_delete_at_management_group_request(
management_group_id: str, variable_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_create_or_update_at_management_group_request(
management_group_id: str, variable_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_get_at_management_group_request(
management_group_id: str, variable_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables")
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variables_list_for_management_group_request(management_group_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_delete_request(
variable_name: str, variable_value_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_create_or_update_request(
variable_name: str, variable_value_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_get_request(
variable_name: str, variable_value_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_list_request(variable_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_list_for_management_group_request(
management_group_id: str, variable_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_delete_at_management_group_request(
management_group_id: str, variable_name: str, variable_value_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_create_or_update_at_management_group_request(
management_group_id: str, variable_name: str, variable_value_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_variable_values_get_at_management_group_request(
management_group_id: str, variable_name: str, variable_value_name: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"),
"variableName": _SERIALIZER.url("variable_name", variable_name, "str"),
"variableValueName": _SERIALIZER.url("variable_value_name", variable_value_name, "str"),
}
_url = _format_url_section(_url, **path_format_arguments)
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class DataPolicyManifestsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`data_policy_manifests` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def get_by_policy_mode(self, policy_mode: str, **kwargs: Any) -> _models.DataPolicyManifest:
"""Retrieves a data policy manifest.
This operation retrieves the data policy manifest with the given policy mode.
:param policy_mode: The policy mode of the data policy manifest to get. Required.
:type policy_mode: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DataPolicyManifest or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.DataPolicyManifest
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.DataPolicyManifest]
request = build_data_policy_manifests_get_by_policy_mode_request(
policy_mode=policy_mode,
api_version=api_version,
template_url=self.get_by_policy_mode.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("DataPolicyManifest", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_policy_mode.metadata = {"url": "/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}"} # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DataPolicyManifest"]:
"""Retrieves data policy manifests.
This operation retrieves a list of all the data policy manifests that match the optional given
$filter. Valid values for $filter are: "$filter=namespace eq '{0}'". If $filter is not
provided, the unfiltered list includes all data policy manifests for data resource types. If
$filter=namespace is provided, the returned list only includes all data policy manifests that
have a namespace matching the provided value.
:param filter: The filter to apply on the operation. Valid values for $filter are: "namespace
eq '{value}'". If $filter is not provided, no filtering is performed. If $filter=namespace eq
'{value}' is provided, the returned list only includes all data policy manifests that have a
namespace matching the provided value. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DataPolicyManifest or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.DataPolicyManifest]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.DataPolicyManifestListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_data_policy_manifests_list_request(
filter=filter,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("DataPolicyManifestListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.Authorization/dataPolicyManifests"} # type: ignore
class PolicyAssignmentsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`policy_assignments` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]:
"""Deletes a policy assignment.
This operation deletes a policy assignment, given its name and the scope it was created in. The
scope of a policy assignment is the part of its ID preceding
'/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment to delete. Required.
:type policy_assignment_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PolicyAssignment]]
request = build_policy_assignments_delete_request(
scope=scope,
policy_assignment_name=policy_assignment_name,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"} # type: ignore
@overload
def create(
self,
scope: str,
policy_assignment_name: str,
parameters: _models.PolicyAssignment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates a policy assignment with the given scope and name. Policy
assignments apply to all resources contained within their scope. For example, when you assign a
policy at resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for the policy assignment. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create(
self,
scope: str,
policy_assignment_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates a policy assignment with the given scope and name. Policy
assignments apply to all resources contained within their scope. For example, when you assign a
policy at resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for the policy assignment. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create(
self, scope: str, policy_assignment_name: str, parameters: Union[_models.PolicyAssignment, IO], **kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates a policy assignment with the given scope and name. Policy
assignments apply to all resources contained within their scope. For example, when you assign a
policy at resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for the policy assignment. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyAssignment")
request = build_policy_assignments_create_request(
scope=scope,
policy_assignment_name=policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"} # type: ignore
@distributed_trace
def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment:
"""Retrieves a policy assignment.
This operation retrieves a single policy assignment, given its name and the scope it was
created at.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment to get. Required.
:type policy_assignment_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
request = build_policy_assignments_get_request(
scope=scope,
policy_assignment_name=policy_assignment_name,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"} # type: ignore
@overload
def update(
self,
scope: str,
policy_assignment_name: str,
parameters: _models.PolicyAssignmentUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates a policy assignment with the given scope and name. Policy assignments
apply to all resources contained within their scope. For example, when you assign a policy at
resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for policy assignment patch request. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def update(
self,
scope: str,
policy_assignment_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates a policy assignment with the given scope and name. Policy assignments
apply to all resources contained within their scope. For example, when you assign a policy at
resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for policy assignment patch request. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def update(
self,
scope: str,
policy_assignment_name: str,
parameters: Union[_models.PolicyAssignmentUpdate, IO],
**kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates a policy assignment with the given scope and name. Policy assignments
apply to all resources contained within their scope. For example, when you assign a policy at
resource group scope, that policy applies to all resources in the group.
:param scope: The scope of the policy assignment. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_assignment_name: The name of the policy assignment. Required.
:type policy_assignment_name: str
:param parameters: Parameters for policy assignment patch request. Is either a model type or a
IO type. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyAssignmentUpdate")
request = build_policy_assignments_update_request(
scope=scope,
policy_assignment_name=policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"} # type: ignore
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyAssignment"]:
"""Retrieves all policy assignments that apply to a resource group.
This operation retrieves the list of all policy assignments associated with the given resource
group in the given subscription that match the optional given $filter. Valid values for $filter
are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not
provided, the unfiltered list includes all policy assignments associated with the resource
group, including those that apply directly or apply from containing scopes, as well as any
applied to resources contained within the resource group. If $filter=atScope() is provided, the
returned list includes all policy assignments that apply to the resource group, which is
everything in the unfiltered list except those applied to resources contained within the
resource group. If $filter=atExactScope() is provided, the returned list only includes all
policy assignments that at the resource group. If $filter=policyDefinitionId eq '{value}' is
provided, the returned list includes all policy assignments of the policy definition whose id
is {value} that apply to the resource group.
:param resource_group_name: The name of the resource group that contains policy assignments.
Required.
:type resource_group_name: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering
is performed. If $filter=atScope() is provided, the returned list only includes all policy
assignments that apply to the scope, which is everything in the unfiltered list except those
applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided,
the returned list only includes all policy assignments that at the given scope. If
$filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy
assignments of the policy definition whose id is {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignmentListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_assignments_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_for_resource_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyAssignmentListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments"} # type: ignore
@distributed_trace
def list_for_resource(
self,
resource_group_name: str,
resource_provider_namespace: str,
parent_resource_path: str,
resource_type: str,
resource_name: str,
filter: Optional[str] = None,
top: Optional[int] = None,
**kwargs: Any
) -> Iterable["_models.PolicyAssignment"]:
"""Retrieves all policy assignments that apply to a resource.
This operation retrieves the list of all policy assignments associated with the specified
resource in the given resource group and subscription that match the optional given $filter.
Valid values for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq
'{value}''. If $filter is not provided, the unfiltered list includes all policy assignments
associated with the resource, including those that apply directly or from all containing
scopes, as well as any applied to resources contained within the resource. If $filter=atScope()
is provided, the returned list includes all policy assignments that apply to the resource,
which is everything in the unfiltered list except those applied to resources contained within
the resource. If $filter=atExactScope() is provided, the returned list only includes all policy
assignments that at the resource level. If $filter=policyDefinitionId eq '{value}' is provided,
the returned list includes all policy assignments of the policy definition whose id is {value}
that apply to the resource. Three parameters plus the resource name are used to identify a
specific resource. If the resource is not part of a parent resource (the more common case), the
parent resource path should not be provided (or provided as ''). For example a web app could be
specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '',
{resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent
resource, then all parameters should be provided. For example a virtual machine DNS name could
be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} ==
'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} ==
'MyComputerName'). A convenient alternative to providing the namespace and type name separately
is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '',
{parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} ==
'MyWebApp').
:param resource_group_name: The name of the resource group containing the resource. Required.
:type resource_group_name: str
:param resource_provider_namespace: The namespace of the resource provider. For example, the
namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines).
Required.
:type resource_provider_namespace: str
:param parent_resource_path: The parent resource path. Use empty string if there is none.
Required.
:type parent_resource_path: str
:param resource_type: The resource type name. For example the type name of a web app is 'sites'
(from Microsoft.Web/sites). Required.
:type resource_type: str
:param resource_name: The name of the resource. Required.
:type resource_name: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering
is performed. If $filter=atScope() is provided, the returned list only includes all policy
assignments that apply to the scope, which is everything in the unfiltered list except those
applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided,
the returned list only includes all policy assignments that at the given scope. If
$filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy
assignments of the policy definition whose id is {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignmentListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_assignments_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
resource_type=resource_type,
resource_name=resource_name,
subscription_id=self._config.subscription_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_for_resource.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyAssignmentListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments"} # type: ignore
@distributed_trace
def list_for_management_group(
self, management_group_id: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyAssignment"]:
"""Retrieves all policy assignments that apply to a management group.
This operation retrieves the list of all policy assignments applicable to the management group
that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' or
'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes
all policy assignments that are assigned to the management group or the management group's
ancestors. If $filter=atExactScope() is provided, the returned list only includes all policy
assignments that at the management group. If $filter=policyDefinitionId eq '{value}' is
provided, the returned list includes all policy assignments of the policy definition whose id
is {value} that apply to the management group.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering
is performed. If $filter=atScope() is provided, the returned list only includes all policy
assignments that apply to the scope, which is everything in the unfiltered list except those
applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided,
the returned list only includes all policy assignments that at the given scope. If
$filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy
assignments of the policy definition whose id is {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignmentListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_assignments_list_for_management_group_request(
management_group_id=management_group_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_for_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyAssignmentListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments"} # type: ignore
@distributed_trace
def list(
self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyAssignment"]:
"""Retrieves all policy assignments that apply to a subscription.
This operation retrieves the list of all policy assignments associated with the given
subscription that match the optional given $filter. Valid values for $filter are: 'atScope()',
'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
unfiltered list includes all policy assignments associated with the subscription, including
those that apply directly or from management groups that contain the given subscription, as
well as any applied to objects contained within the subscription. If $filter=atScope() is
provided, the returned list includes all policy assignments that apply to the subscription,
which is everything in the unfiltered list except those applied to objects contained within the
subscription. If $filter=atExactScope() is provided, the returned list only includes all policy
assignments that at the subscription. If $filter=policyDefinitionId eq '{value}' is provided,
the returned list includes all policy assignments of the policy definition whose id is {value}.
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering
is performed. If $filter=atScope() is provided, the returned list only includes all policy
assignments that apply to the scope, which is everything in the unfiltered list except those
applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided,
the returned list only includes all policy assignments that at the given scope. If
$filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy
assignments of the policy definition whose id is {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignmentListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_assignments_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyAssignmentListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments"} # type: ignore
@distributed_trace
def delete_by_id(self, policy_assignment_id: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]:
"""Deletes a policy assignment.
This operation deletes the policy with the given ID. Policy assignment IDs have this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}'
(management group), '/subscriptions/{subscriptionId}' (subscription),
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
(resource).
:param policy_assignment_id: The ID of the policy assignment to delete. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PolicyAssignment]]
request = build_policy_assignments_delete_by_id_request(
policy_assignment_id=policy_assignment_id,
api_version=api_version,
template_url=self.delete_by_id.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
delete_by_id.metadata = {"url": "/{policyAssignmentId}"} # type: ignore
@overload
def create_by_id(
self,
policy_assignment_id: str,
parameters: _models.PolicyAssignment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates the policy assignment with the given ID. Policy assignments
made on a scope apply to all resources contained in that scope. For example, when you assign a
policy to a resource group that policy applies to all resources in the group. Policy assignment
IDs have this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to create. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_by_id(
self, policy_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates the policy assignment with the given ID. Policy assignments
made on a scope apply to all resources contained in that scope. For example, when you assign a
policy to a resource group that policy applies to all resources in the group. Policy assignment
IDs have this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to create. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_by_id(
self, policy_assignment_id: str, parameters: Union[_models.PolicyAssignment, IO], **kwargs: Any
) -> _models.PolicyAssignment:
"""Creates or updates a policy assignment.
This operation creates or updates the policy assignment with the given ID. Policy assignments
made on a scope apply to all resources contained in that scope. For example, when you assign a
policy to a resource group that policy applies to all resources in the group. Policy assignment
IDs have this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to create. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyAssignment")
request = build_policy_assignments_create_by_id_request(
policy_assignment_id=policy_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_by_id.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_by_id.metadata = {"url": "/{policyAssignmentId}"} # type: ignore
@distributed_trace
def get_by_id(self, policy_assignment_id: str, **kwargs: Any) -> _models.PolicyAssignment:
"""Retrieves the policy assignment with the given ID.
The operation retrieves the policy assignment with the given ID. Policy assignment IDs have
this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to get. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
request = build_policy_assignments_get_by_id_request(
policy_assignment_id=policy_assignment_id,
api_version=api_version,
template_url=self.get_by_id.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_id.metadata = {"url": "/{policyAssignmentId}"} # type: ignore
@overload
def update_by_id(
self,
policy_assignment_id: str,
parameters: _models.PolicyAssignmentUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates the policy assignment with the given ID. Policy assignments made on a
scope apply to all resources contained in that scope. For example, when you assign a policy to
a resource group that policy applies to all resources in the group. Policy assignment IDs have
this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to update. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment patch request. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def update_by_id(
self, policy_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates the policy assignment with the given ID. Policy assignments made on a
scope apply to all resources contained in that scope. For example, when you assign a policy to
a resource group that policy applies to all resources in the group. Policy assignment IDs have
this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to update. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment patch request. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def update_by_id(
self, policy_assignment_id: str, parameters: Union[_models.PolicyAssignmentUpdate, IO], **kwargs: Any
) -> _models.PolicyAssignment:
"""Updates a policy assignment.
This operation updates the policy assignment with the given ID. Policy assignments made on a
scope apply to all resources contained in that scope. For example, when you assign a policy to
a resource group that policy applies to all resources in the group. Policy assignment IDs have
this format:
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid
scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
:param policy_assignment_id: The ID of the policy assignment to update. Use the format
'{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Required.
:type policy_assignment_id: str
:param parameters: Parameters for policy assignment patch request. Is either a model type or a
IO type. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignmentUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyAssignment]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyAssignmentUpdate")
request = build_policy_assignments_update_by_id_request(
policy_assignment_id=policy_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.update_by_id.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyAssignment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update_by_id.metadata = {"url": "/{policyAssignmentId}"} # type: ignore
class PolicyDefinitionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`policy_definitions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
def create_or_update(
self,
policy_definition_name: str,
parameters: _models.PolicyDefinition,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a subscription.
This operation creates or updates a policy definition in the given subscription with the given
name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param parameters: The policy definition properties. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self, policy_definition_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a subscription.
This operation creates or updates a policy definition in the given subscription with the given
name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param parameters: The policy definition properties. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self, policy_definition_name: str, parameters: Union[_models.PolicyDefinition, IO], **kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a subscription.
This operation creates or updates a policy definition in the given subscription with the given
name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param parameters: The policy definition properties. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinition]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyDefinition")
request = build_policy_definitions_create_or_update_request(
policy_definition_name=policy_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, policy_definition_name: str, **kwargs: Any
) -> None:
"""Deletes a policy definition in a subscription.
This operation deletes the policy definition in the given subscription with the given name.
:param policy_definition_name: The name of the policy definition to delete. Required.
:type policy_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_policy_definitions_delete_request(
policy_definition_name=policy_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def get(self, policy_definition_name: str, **kwargs: Any) -> _models.PolicyDefinition:
"""Retrieves a policy definition in a subscription.
This operation retrieves the policy definition in the given subscription with the given name.
:param policy_definition_name: The name of the policy definition to get. Required.
:type policy_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinition]
request = build_policy_definitions_get_request(
policy_definition_name=policy_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def get_built_in(self, policy_definition_name: str, **kwargs: Any) -> _models.PolicyDefinition:
"""Retrieves a built-in policy definition.
This operation retrieves the built-in policy definition with the given name.
:param policy_definition_name: The name of the built-in policy definition to get. Required.
:type policy_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinition]
request = build_policy_definitions_get_built_in_request(
policy_definition_name=policy_definition_name,
api_version=api_version,
template_url=self.get_built_in.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_built_in.metadata = {"url": "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@overload
def create_or_update_at_management_group(
self,
policy_definition_name: str,
management_group_id: str,
parameters: _models.PolicyDefinition,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a management group.
This operation creates or updates a policy definition in the given management group with the
given name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy definition properties. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update_at_management_group(
self,
policy_definition_name: str,
management_group_id: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a management group.
This operation creates or updates a policy definition in the given management group with the
given name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy definition properties. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update_at_management_group(
self,
policy_definition_name: str,
management_group_id: str,
parameters: Union[_models.PolicyDefinition, IO],
**kwargs: Any
) -> _models.PolicyDefinition:
"""Creates or updates a policy definition in a management group.
This operation creates or updates a policy definition in the given management group with the
given name.
:param policy_definition_name: The name of the policy definition to create. Required.
:type policy_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy definition properties. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinition]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyDefinition")
request = build_policy_definitions_create_or_update_at_management_group_request(
policy_definition_name=policy_definition_name,
management_group_id=management_group_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def delete_at_management_group( # pylint: disable=inconsistent-return-statements
self, policy_definition_name: str, management_group_id: str, **kwargs: Any
) -> None:
"""Deletes a policy definition in a management group.
This operation deletes the policy definition in the given management group with the given name.
:param policy_definition_name: The name of the policy definition to delete. Required.
:type policy_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_policy_definitions_delete_at_management_group_request(
policy_definition_name=policy_definition_name,
management_group_id=management_group_id,
api_version=api_version,
template_url=self.delete_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def get_at_management_group(
self, policy_definition_name: str, management_group_id: str, **kwargs: Any
) -> _models.PolicyDefinition:
"""Retrieve a policy definition in a management group.
This operation retrieves the policy definition in the given management group with the given
name.
:param policy_definition_name: The name of the policy definition to get. Required.
:type policy_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinition]
request = build_policy_definitions_get_at_management_group_request(
policy_definition_name=policy_definition_name,
management_group_id=management_group_id,
api_version=api_version,
template_url=self.get_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"} # type: ignore
@distributed_trace
def list(
self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyDefinition"]:
"""Retrieves policy definitions in a subscription.
This operation retrieves a list of all the policy definitions in a given subscription that
match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType
-eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list
includes all policy definitions associated with the subscription, including those that apply
directly or from management groups that contain the given subscription. If
$filter=atExactScope() is provided, the returned list only includes all policy definitions that
at the given subscription. If $filter='policyType -eq {value}' is provided, the returned list
only includes all policy definitions whose type match the {value}. Possible policyType values
are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided,
the returned list only includes all policy definitions whose category match the {value}.
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy definitions whose type match
the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_definitions_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions"} # type: ignore
@distributed_trace
def list_built_in(
self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyDefinition"]:
"""Retrieve built-in policy definitions.
This operation retrieves a list of all the built-in policy definitions that match the optional
given $filter. If $filter='policyType -eq {value}' is provided, the returned list only includes
all built-in policy definitions whose type match the {value}. Possible policyType values are
NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the
returned list only includes all built-in policy definitions whose category match the {value}.
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy definitions whose type match
the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_definitions_list_built_in_request(
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_built_in.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_built_in.metadata = {"url": "/providers/Microsoft.Authorization/policyDefinitions"} # type: ignore
@distributed_trace
def list_by_management_group(
self, management_group_id: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicyDefinition"]:
"""Retrieve policy definitions in a management group.
This operation retrieves a list of all the policy definitions in a given management group that
match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType
-eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list
includes all policy definitions associated with the management group, including those that
apply directly or from management groups that contain the given management group. If
$filter=atExactScope() is provided, the returned list only includes all policy definitions that
at the given management group. If $filter='policyType -eq {value}' is provided, the returned
list only includes all policy definitions whose type match the {value}. Possible policyType
values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is
provided, the returned list only includes all policy definitions whose category match the
{value}.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy definitions whose type match
the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_definitions_list_by_management_group_request(
management_group_id=management_group_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_by_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_by_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions"} # type: ignore
class PolicySetDefinitionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`policy_set_definitions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
def create_or_update(
self,
policy_set_definition_name: str,
parameters: _models.PolicySetDefinition,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the
given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param parameters: The policy set definition properties. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self, policy_set_definition_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the
given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param parameters: The policy set definition properties. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self, policy_set_definition_name: str, parameters: Union[_models.PolicySetDefinition, IO], **kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the
given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param parameters: The policy set definition properties. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinition]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicySetDefinition")
request = build_policy_set_definitions_create_or_update_request(
policy_set_definition_name=policy_set_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, policy_set_definition_name: str, **kwargs: Any
) -> None:
"""Deletes a policy set definition.
This operation deletes the policy set definition in the given subscription with the given name.
:param policy_set_definition_name: The name of the policy set definition to delete. Required.
:type policy_set_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_policy_set_definitions_delete_request(
policy_set_definition_name=policy_set_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def get(self, policy_set_definition_name: str, **kwargs: Any) -> _models.PolicySetDefinition:
"""Retrieves a policy set definition.
This operation retrieves the policy set definition in the given subscription with the given
name.
:param policy_set_definition_name: The name of the policy set definition to get. Required.
:type policy_set_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinition]
request = build_policy_set_definitions_get_request(
policy_set_definition_name=policy_set_definition_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def get_built_in(self, policy_set_definition_name: str, **kwargs: Any) -> _models.PolicySetDefinition:
"""Retrieves a built in policy set definition.
This operation retrieves the built-in policy set definition with the given name.
:param policy_set_definition_name: The name of the policy set definition to get. Required.
:type policy_set_definition_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinition]
request = build_policy_set_definitions_get_built_in_request(
policy_set_definition_name=policy_set_definition_name,
api_version=api_version,
template_url=self.get_built_in.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_built_in.metadata = {"url": "/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def list(
self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicySetDefinition"]:
"""Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in a given subscription that
match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType
-eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list
includes all policy set definitions associated with the subscription, including those that
apply directly or from management groups that contain the given subscription. If
$filter=atExactScope() is provided, the returned list only includes all policy set definitions
that at the given subscription. If $filter='policyType -eq {value}' is provided, the returned
list only includes all policy set definitions whose type match the {value}. Possible policyType
values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is provided, the
returned list only includes all policy set definitions whose category match the {value}.
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy set definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy set definitions whose type
match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy set
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicySetDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_set_definitions_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicySetDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions"} # type: ignore
@distributed_trace
def list_built_in(
self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicySetDefinition"]:
"""Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions that match the
optional given $filter. If $filter='category -eq {value}' is provided, the returned list only
includes all built-in policy set definitions whose category match the {value}.
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy set definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy set definitions whose type
match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy set
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicySetDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_set_definitions_list_built_in_request(
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_built_in.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicySetDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_built_in.metadata = {"url": "/providers/Microsoft.Authorization/policySetDefinitions"} # type: ignore
@overload
def create_or_update_at_management_group(
self,
policy_set_definition_name: str,
management_group_id: str,
parameters: _models.PolicySetDefinition,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with
the given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy set definition properties. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update_at_management_group(
self,
policy_set_definition_name: str,
management_group_id: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with
the given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy set definition properties. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update_at_management_group(
self,
policy_set_definition_name: str,
management_group_id: str,
parameters: Union[_models.PolicySetDefinition, IO],
**kwargs: Any
) -> _models.PolicySetDefinition:
"""Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with
the given name.
:param policy_set_definition_name: The name of the policy set definition to create. Required.
:type policy_set_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param parameters: The policy set definition properties. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinition]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicySetDefinition")
request = build_policy_set_definitions_create_or_update_at_management_group_request(
policy_set_definition_name=policy_set_definition_name,
management_group_id=management_group_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def delete_at_management_group( # pylint: disable=inconsistent-return-statements
self, policy_set_definition_name: str, management_group_id: str, **kwargs: Any
) -> None:
"""Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given
name.
:param policy_set_definition_name: The name of the policy set definition to delete. Required.
:type policy_set_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_policy_set_definitions_delete_at_management_group_request(
policy_set_definition_name=policy_set_definition_name,
management_group_id=management_group_id,
api_version=api_version,
template_url=self.delete_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def get_at_management_group(
self, policy_set_definition_name: str, management_group_id: str, **kwargs: Any
) -> _models.PolicySetDefinition:
"""Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given
name.
:param policy_set_definition_name: The name of the policy set definition to get. Required.
:type policy_set_definition_name: str
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicySetDefinition or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinition]
request = build_policy_set_definitions_get_at_management_group_request(
policy_set_definition_name=policy_set_definition_name,
management_group_id=management_group_id,
api_version=api_version,
template_url=self.get_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicySetDefinition", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"} # type: ignore
@distributed_trace
def list_by_management_group(
self, management_group_id: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any
) -> Iterable["_models.PolicySetDefinition"]:
"""Retrieves all policy set definitions in management group.
This operation retrieves a list of all the policy set definitions in a given management group
that match the optional given $filter. Valid values for $filter are: 'atExactScope()',
'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered
list includes all policy set definitions associated with the management group, including those
that apply directly or from management groups that contain the given management group. If
$filter=atExactScope() is provided, the returned list only includes all policy set definitions
that at the given management group. If $filter='policyType -eq {value}' is provided, the
returned list only includes all policy set definitions whose type match the {value}. Possible
policyType values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is
provided, the returned list only includes all policy set definitions whose category match the
{value}.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param filter: The filter to apply on the operation. Valid values for $filter are:
'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list
only includes all policy set definitions that at the given scope. If $filter='policyType -eq
{value}' is provided, the returned list only includes all policy set definitions whose type
match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If
$filter='category -eq {value}' is provided, the returned list only includes all policy set
definitions whose category match the {value}. Default value is None.
:type filter: str
:param top: Maximum number of records to return. When the $top filter is not provided, it will
return 500 records. Default value is None.
:type top: int
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicySetDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicySetDefinition]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicySetDefinitionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_set_definitions_list_by_management_group_request(
management_group_id=management_group_id,
filter=filter,
top=top,
api_version=api_version,
template_url=self.list_by_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicySetDefinitionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_by_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions"} # type: ignore
class PolicyExemptionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`policy_exemptions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, scope: str, policy_exemption_name: str, **kwargs: Any
) -> None:
"""Deletes a policy exemption.
This operation deletes a policy exemption, given its name and the scope it was created in. The
scope of a policy exemption is the part of its ID preceding
'/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'.
:param scope: The scope of the policy exemption. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_exemption_name: The name of the policy exemption to delete. Required.
:type policy_exemption_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_policy_exemptions_delete_request(
scope=scope,
policy_exemption_name=policy_exemption_name,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"} # type: ignore
@overload
def create_or_update(
self,
scope: str,
policy_exemption_name: str,
parameters: _models.PolicyExemption,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyExemption:
"""Creates or updates a policy exemption.
This operation creates or updates a policy exemption with the given scope and name. Policy
exemptions apply to all resources contained within their scope. For example, when you create a
policy exemption at resource group scope for a policy assignment at the same or above level,
the exemption exempts to all applicable resources in the resource group.
:param scope: The scope of the policy exemption. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_exemption_name: The name of the policy exemption to delete. Required.
:type policy_exemption_name: str
:param parameters: Parameters for the policy exemption. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyExemption or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self,
scope: str,
policy_exemption_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.PolicyExemption:
"""Creates or updates a policy exemption.
This operation creates or updates a policy exemption with the given scope and name. Policy
exemptions apply to all resources contained within their scope. For example, when you create a
policy exemption at resource group scope for a policy assignment at the same or above level,
the exemption exempts to all applicable resources in the resource group.
:param scope: The scope of the policy exemption. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_exemption_name: The name of the policy exemption to delete. Required.
:type policy_exemption_name: str
:param parameters: Parameters for the policy exemption. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyExemption or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self, scope: str, policy_exemption_name: str, parameters: Union[_models.PolicyExemption, IO], **kwargs: Any
) -> _models.PolicyExemption:
"""Creates or updates a policy exemption.
This operation creates or updates a policy exemption with the given scope and name. Policy
exemptions apply to all resources contained within their scope. For example, when you create a
policy exemption at resource group scope for a policy assignment at the same or above level,
the exemption exempts to all applicable resources in the resource group.
:param scope: The scope of the policy exemption. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_exemption_name: The name of the policy exemption to delete. Required.
:type policy_exemption_name: str
:param parameters: Parameters for the policy exemption. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyExemption or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemption]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyExemption")
request = build_policy_exemptions_create_or_update_request(
scope=scope,
policy_exemption_name=policy_exemption_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PolicyExemption", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PolicyExemption", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"} # type: ignore
@distributed_trace
def get(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> _models.PolicyExemption:
"""Retrieves a policy exemption.
This operation retrieves a single policy exemption, given its name and the scope it was created
at.
:param scope: The scope of the policy exemption. Valid scopes are: management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
'/subscriptions/{subscriptionId}'), resource group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
Required.
:type scope: str
:param policy_exemption_name: The name of the policy exemption to delete. Required.
:type policy_exemption_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PolicyExemption or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemption]
request = build_policy_exemptions_get_request(
scope=scope,
policy_exemption_name=policy_exemption_name,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("PolicyExemption", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}"} # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.PolicyExemption"]:
"""Retrieves all policy exemptions that apply to a subscription.
This operation retrieves the list of all policy exemptions associated with the given
subscription that match the optional given $filter. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not
provided, the unfiltered list includes all policy exemptions associated with the subscription,
including those that apply directly or from management groups that contain the given
subscription, as well as any applied to objects contained within the subscription.
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter is not provided, the unfiltered list includes
all policy exemptions associated with the scope, including those that apply directly or apply
from containing scopes. If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the unfiltered list except
those applied to sub scopes contained within the given scope. If $filter=atExactScope() is
provided, the returned list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes all policy exemptions
that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq
'{value}' is provided. the returned list only includes all policy exemptions that are
associated with the give policyAssignmentId. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyExemption or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemptionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_exemptions_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyExemptionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions"} # type: ignore
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.PolicyExemption"]:
"""Retrieves all policy exemptions that apply to a resource group.
This operation retrieves the list of all policy exemptions associated with the given resource
group in the given subscription that match the optional given $filter. Valid values for $filter
are: 'atScope()', 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If
$filter is not provided, the unfiltered list includes all policy exemptions associated with the
resource group, including those that apply directly or apply from containing scopes, as well as
any applied to resources contained within the resource group.
:param resource_group_name: The name of the resource group containing the resource. Required.
:type resource_group_name: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter is not provided, the unfiltered list includes
all policy exemptions associated with the scope, including those that apply directly or apply
from containing scopes. If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the unfiltered list except
those applied to sub scopes contained within the given scope. If $filter=atExactScope() is
provided, the returned list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes all policy exemptions
that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq
'{value}' is provided. the returned list only includes all policy exemptions that are
associated with the give policyAssignmentId. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyExemption or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemptionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_exemptions_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
template_url=self.list_for_resource_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyExemptionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions"} # type: ignore
@distributed_trace
def list_for_resource(
self,
resource_group_name: str,
resource_provider_namespace: str,
parent_resource_path: str,
resource_type: str,
resource_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.PolicyExemption"]:
"""Retrieves all policy exemptions that apply to a resource.
This operation retrieves the list of all policy exemptions associated with the specified
resource in the given resource group and subscription that match the optional given $filter.
Valid values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, the unfiltered list includes all
policy exemptions associated with the resource, including those that apply directly or from all
containing scopes, as well as any applied to resources contained within the resource. Three
parameters plus the resource name are used to identify a specific resource. If the resource is
not part of a parent resource (the more common case), the parent resource path should not be
provided (or provided as ''). For example a web app could be specified as
({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} ==
'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all
parameters should be provided. For example a virtual machine DNS name could be specified as
({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} ==
'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} ==
'MyComputerName'). A convenient alternative to providing the namespace and type name separately
is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '',
{parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} ==
'MyWebApp').
:param resource_group_name: The name of the resource group containing the resource. Required.
:type resource_group_name: str
:param resource_provider_namespace: The namespace of the resource provider. For example, the
namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines).
Required.
:type resource_provider_namespace: str
:param parent_resource_path: The parent resource path. Use empty string if there is none.
Required.
:type parent_resource_path: str
:param resource_type: The resource type name. For example the type name of a web app is 'sites'
(from Microsoft.Web/sites). Required.
:type resource_type: str
:param resource_name: The name of the resource. Required.
:type resource_name: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter is not provided, the unfiltered list includes
all policy exemptions associated with the scope, including those that apply directly or apply
from containing scopes. If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the unfiltered list except
those applied to sub scopes contained within the given scope. If $filter=atExactScope() is
provided, the returned list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes all policy exemptions
that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq
'{value}' is provided. the returned list only includes all policy exemptions that are
associated with the give policyAssignmentId. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyExemption or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemptionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_exemptions_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
resource_type=resource_type,
resource_name=resource_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
template_url=self.list_for_resource.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyExemptionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions"} # type: ignore
@distributed_trace
def list_for_management_group(
self, management_group_id: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.PolicyExemption"]:
"""Retrieves all policy exemptions that apply to a management group.
This operation retrieves the list of all policy exemptions applicable to the management group
that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()',
'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter=atScope() is provided, the
returned list includes all policy exemptions that are assigned to the management group or the
management group's ancestors.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not
provided, no filtering is performed. If $filter is not provided, the unfiltered list includes
all policy exemptions associated with the scope, including those that apply directly or apply
from containing scopes. If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the unfiltered list except
those applied to sub scopes contained within the given scope. If $filter=atExactScope() is
provided, the returned list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes all policy exemptions
that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq
'{value}' is provided. the returned list only includes all policy exemptions that are
associated with the give policyAssignmentId. Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PolicyExemption or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyExemption]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyExemptionListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_policy_exemptions_list_for_management_group_request(
management_group_id=management_group_id,
filter=filter,
api_version=api_version,
template_url=self.list_for_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PolicyExemptionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions"} # type: ignore
class VariablesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`variables` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def delete(self, variable_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Deletes a variable.
This operation deletes a variable, given its name and the subscription it was created in. The
scope of a variable is the part of its ID preceding
'/providers/Microsoft.Authorization/variables/{variableName}'.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_variables_delete_request(
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@overload
def create_or_update(
self, variable_name: str, parameters: _models.Variable, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given subscription and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self, variable_name: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given subscription and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self, variable_name: str, parameters: Union[_models.Variable, IO], **kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given subscription and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Is either a model type or a IO type. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.Variable]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "Variable")
request = build_variables_create_or_update_request(
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Variable", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Variable", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@distributed_trace
def get(self, variable_name: str, **kwargs: Any) -> _models.Variable:
"""Retrieves a variable.
This operation retrieves a single variable, given its name and the subscription it was created
at.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.Variable]
request = build_variables_get_request(
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Variable", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@distributed_trace
def delete_at_management_group( # pylint: disable=inconsistent-return-statements
self, management_group_id: str, variable_name: str, **kwargs: Any
) -> None:
"""Deletes a variable.
This operation deletes a variable, given its name and the management group it was created in.
The scope of a variable is the part of its ID preceding
'/providers/Microsoft.Authorization/variables/{variableName}'.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_variables_delete_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
api_version=api_version,
template_url=self.delete_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@overload
def create_or_update_at_management_group(
self,
management_group_id: str,
variable_name: str,
parameters: _models.Variable,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given management group and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update_at_management_group(
self,
management_group_id: str,
variable_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given management group and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update_at_management_group(
self, management_group_id: str, variable_name: str, parameters: Union[_models.Variable, IO], **kwargs: Any
) -> _models.Variable:
"""Creates or updates a variable.
This operation creates or updates a variable with the given management group and name. Policy
variables can only be used by a policy definition at the scope they are created or below.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param parameters: Parameters for the variable. Is either a model type or a IO type. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.Variable]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "Variable")
request = build_variables_create_or_update_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Variable", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Variable", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@distributed_trace
def get_at_management_group(self, management_group_id: str, variable_name: str, **kwargs: Any) -> _models.Variable:
"""Retrieves a variable.
This operation retrieves a single variable, given its name and the management group it was
created at.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.Variable
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.Variable]
request = build_variables_get_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
api_version=api_version,
template_url=self.get_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("Variable", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}"} # type: ignore
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.Variable"]:
"""Retrieves all variables that are at this subscription level.
This operation retrieves the list of all variables associated with the given subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Variable or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.Variable]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_variables_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VariableListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables"} # type: ignore
@distributed_trace
def list_for_management_group(self, management_group_id: str, **kwargs: Any) -> Iterable["_models.Variable"]:
"""Retrieves all variables that are at this management group level.
This operation retrieves the list of all variables applicable to the management group.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Variable or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.Variable]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_variables_list_for_management_group_request(
management_group_id=management_group_id,
api_version=api_version,
template_url=self.list_for_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VariableListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables"} # type: ignore
class VariableValuesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.policy.v2021_06_01.PolicyClient`'s
:attr:`variable_values` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, variable_name: str, variable_value_name: str, **kwargs: Any
) -> None:
"""Deletes a variable value.
This operation deletes a variable value, given its name, the subscription it was created in,
and the variable it belongs to. The scope of a variable value is the part of its ID preceding
'/providers/Microsoft.Authorization/variables/{variableName}'.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_variable_values_delete_request(
variable_name=variable_name,
variable_value_name=variable_value_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
@overload
def create_or_update(
self,
variable_name: str,
variable_value_name: str,
parameters: _models.VariableValue,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given subscription and name for a
given variable. Variable values are scoped to the variable for which they are created for.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self,
variable_name: str,
variable_value_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given subscription and name for a
given variable. Variable values are scoped to the variable for which they are created for.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self, variable_name: str, variable_value_name: str, parameters: Union[_models.VariableValue, IO], **kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given subscription and name for a
given variable. Variable values are scoped to the variable for which they are created for.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValue]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "VariableValue")
request = build_variable_values_create_or_update_request(
variable_name=variable_name,
variable_value_name=variable_value_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("VariableValue", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("VariableValue", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
@distributed_trace
def get(self, variable_name: str, variable_value_name: str, **kwargs: Any) -> _models.VariableValue:
"""Retrieves a variable value.
This operation retrieves a single variable value; given its name, subscription it was created
at and the variable it's created for.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValue]
request = build_variable_values_get_request(
variable_name=variable_name,
variable_value_name=variable_value_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("VariableValue", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
@distributed_trace
def list(self, variable_name: str, **kwargs: Any) -> Iterable["_models.VariableValue"]:
"""List variable values for a variable.
This operation retrieves the list of all variable values associated with the given variable
that is at a subscription level.
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VariableValue or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValueListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_variable_values_list_request(
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VariableValueListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values"} # type: ignore
@distributed_trace
def list_for_management_group(
self, management_group_id: str, variable_name: str, **kwargs: Any
) -> Iterable["_models.VariableValue"]:
"""List variable values at management group level.
This operation retrieves the list of all variable values applicable the variable indicated at
the management group scope.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VariableValue or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValueListResult]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_variable_values_list_for_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
api_version=api_version,
template_url=self.list_for_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = HttpRequest("GET", next_link)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VariableValueListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_for_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values"} # type: ignore
@distributed_trace
def delete_at_management_group( # pylint: disable=inconsistent-return-statements
self, management_group_id: str, variable_name: str, variable_value_name: str, **kwargs: Any
) -> None:
"""Deletes a variable value.
This operation deletes a variable value, given its name, the management group it was created
in, and the variable it belongs to. The scope of a variable value is the part of its ID
preceding '/providers/Microsoft.Authorization/variables/{variableName}'.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_variable_values_delete_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
variable_value_name=variable_value_name,
api_version=api_version,
template_url=self.delete_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
@overload
def create_or_update_at_management_group(
self,
management_group_id: str,
variable_name: str,
variable_value_name: str,
parameters: _models.VariableValue,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given management group and name for
a given variable. Variable values are scoped to the variable for which they are created for.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update_at_management_group(
self,
management_group_id: str,
variable_name: str,
variable_value_name: str,
parameters: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given management group and name for
a given variable. Variable values are scoped to the variable for which they are created for.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Required.
:type parameters: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update_at_management_group(
self,
management_group_id: str,
variable_name: str,
variable_value_name: str,
parameters: Union[_models.VariableValue, IO],
**kwargs: Any
) -> _models.VariableValue:
"""Creates or updates a variable value.
This operation creates or updates a variable value with the given management group and name for
a given variable. Variable values are scoped to the variable for which they are created for.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:param parameters: Parameters for the variable value. Is either a model type or a IO type.
Required.
:type parameters: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValue]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "VariableValue")
request = build_variable_values_create_or_update_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
variable_value_name=variable_value_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("VariableValue", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("VariableValue", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
@distributed_trace
def get_at_management_group(
self, management_group_id: str, variable_name: str, variable_value_name: str, **kwargs: Any
) -> _models.VariableValue:
"""Retrieves a variable value.
This operation retrieves a single variable value; given its name, management group it was
created at and the variable it's created for.
:param management_group_id: The ID of the management group. Required.
:type management_group_id: str
:param variable_name: The name of the variable to operate on. Required.
:type variable_name: str
:param variable_value_name: The name of the variable value to operate on. Required.
:type variable_value_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VariableValue or the result of cls(response)
:rtype: ~azure.mgmt.resource.policy.v2021_06_01.models.VariableValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.VariableValue]
request = build_variable_values_get_at_management_group_request(
management_group_id=management_group_id,
variable_name=variable_name,
variable_value_name=variable_value_name,
api_version=api_version,
template_url=self.get_at_management_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize("VariableValue", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_at_management_group.metadata = {"url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}"} # type: ignore
| {
"content_hash": "58bb4584d66182ba104c0499a36182c9",
"timestamp": "",
"source": "github",
"line_count": 7088,
"max_line_length": 267,
"avg_line_length": 47.67127539503386,
"alnum_prop": 0.6552794663415153,
"repo_name": "Azure/azure-sdk-for-python",
"id": "2b54a968098a0a4bdaeb108c7beb05054827f725",
"size": "338394",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1224"
},
{
"name": "Bicep",
"bytes": "24196"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "4892"
},
{
"name": "HTML",
"bytes": "12058"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "Jinja",
"bytes": "10377"
},
{
"name": "Jupyter Notebook",
"bytes": "272022"
},
{
"name": "PowerShell",
"bytes": "518535"
},
{
"name": "Python",
"bytes": "715484989"
},
{
"name": "Shell",
"bytes": "3631"
}
],
"symlink_target": ""
} |
package org.apache.flink.streaming.util;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.ClosureCleaner;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.streaming.api.operators.MultipleInputStreamOperator;
import org.apache.flink.streaming.api.operators.StreamOperatorFactory;
/**
* A test harness for testing a {@link MultipleInputStreamOperator}.
*
* <p>This mock task provides the operator with a basic runtime context and allows pushing elements
* and watermarks into the operator. {@link java.util.Deque}s containing the emitted elements and
* watermarks can be retrieved. you are free to modify these.
*/
public class KeyedMultiInputStreamOperatorTestHarness<KEY, OUT>
extends MultiInputStreamOperatorTestHarness<OUT> {
public KeyedMultiInputStreamOperatorTestHarness(
StreamOperatorFactory<OUT> operator, TypeInformation<KEY> keyType) throws Exception {
this(operator, 1, 1, 0);
config.setStateKeySerializer(keyType.createSerializer(executionConfig));
config.serializeAllConfigs();
}
public KeyedMultiInputStreamOperatorTestHarness(
StreamOperatorFactory<OUT> operatorFactory,
int maxParallelism,
int numSubtasks,
int subtaskIndex)
throws Exception {
super(operatorFactory, maxParallelism, numSubtasks, subtaskIndex);
}
public void setKeySelector(int idx, KeySelector<?, KEY> keySelector) {
ClosureCleaner.clean(keySelector, ExecutionConfig.ClosureCleanerLevel.RECURSIVE, false);
config.setStatePartitioner(idx, keySelector);
config.serializeAllConfigs();
}
}
| {
"content_hash": "84b2ae7766b19ea90110bbfde16ca44c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 99,
"avg_line_length": 41.16279069767442,
"alnum_prop": 0.7519774011299435,
"repo_name": "wwjiang007/flink",
"id": "704bd27fe7b4e09083b1993fc42ad3903fa8265c",
"size": "2571",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedMultiInputStreamOperatorTestHarness.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "20596"
},
{
"name": "Batchfile",
"bytes": "1863"
},
{
"name": "C",
"bytes": "847"
},
{
"name": "Cython",
"bytes": "137975"
},
{
"name": "Dockerfile",
"bytes": "5579"
},
{
"name": "FreeMarker",
"bytes": "101034"
},
{
"name": "GAP",
"bytes": "139876"
},
{
"name": "HTML",
"bytes": "188268"
},
{
"name": "HiveQL",
"bytes": "215858"
},
{
"name": "Java",
"bytes": "95983055"
},
{
"name": "JavaScript",
"bytes": "7038"
},
{
"name": "Less",
"bytes": "84321"
},
{
"name": "Makefile",
"bytes": "5134"
},
{
"name": "Python",
"bytes": "3100138"
},
{
"name": "Scala",
"bytes": "10646171"
},
{
"name": "Shell",
"bytes": "513029"
},
{
"name": "TypeScript",
"bytes": "381893"
},
{
"name": "q",
"bytes": "16945"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'Welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
//$route['Login'] = 'Welcome/Login';
$route['Dashboard'] = 'Pages/Dashboard';
$route['Tickets'] = 'Pages/Tickets';
$route['ManageTickets'] = 'Pages/ManageTickets';
$route['SubAdminSA'] = 'Pages/SubAdminSA';
$route['Users'] = 'Pages/Users';
$route['Messages'] = 'Pages/Messages';
| {
"content_hash": "6db1c96641c90ea315356c406a2204e2",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 75,
"avg_line_length": 36.29032258064516,
"alnum_prop": 0.6306666666666667,
"repo_name": "Rainiel/orange_ticket3",
"id": "5184e58a8e77670eb397edadaeac9970d7c9ad33",
"size": "2250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/config/routes.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "1515"
},
{
"name": "CSS",
"bytes": "556598"
},
{
"name": "HTML",
"bytes": "8547369"
},
{
"name": "JavaScript",
"bytes": "4304963"
},
{
"name": "PHP",
"bytes": "1858479"
}
],
"symlink_target": ""
} |
@implementation COAddLocationCell
- (void)awakeFromNib {
// Initialization code
_selectedView.hidden = TRUE;
self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
self.selectedBackgroundView.backgroundColor = selectedColor;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setCur:(BOOL)selected
{
if (selected) {
_titleLabel.textColor = [UIColor colorWithRed:59/255.0 green:190/255.0 blue:121/255.0 alpha:1.0];
_selectedView.hidden = FALSE;
} else {
_titleLabel.textColor = [UIColor colorWithRed:74/255.0 green:74/255.0 blue:74/255.0 alpha:1.0];
_selectedView.hidden = TRUE;
}
}
@end
| {
"content_hash": "abd78fb4eef41763ce1f873b97c02383",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 105,
"avg_line_length": 29.51851851851852,
"alnum_prop": 0.6925972396486826,
"repo_name": "Coding/Coding-iPad",
"id": "5fbfd13dbf6378a8d91ea1962441fe37f9f84980",
"size": "973",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CodingForiPad/ViewController/Base/COAddLocationCell.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "48624"
},
{
"name": "CSS",
"bytes": "19267"
},
{
"name": "JavaScript",
"bytes": "16201"
},
{
"name": "Objective-C",
"bytes": "1986765"
},
{
"name": "Ruby",
"bytes": "421"
},
{
"name": "Shell",
"bytes": "142"
},
{
"name": "Smarty",
"bytes": "4782"
}
],
"symlink_target": ""
} |
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
| {
"content_hash": "29c4abb8494a5ba4d6d71d61fec431a9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 17.42105263157895,
"alnum_prop": 0.7190332326283988,
"repo_name": "taojigu/JTGuideViewController",
"id": "566829623bafda3f79da3f74610f8418d8b02e88",
"size": "509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JTGuideViewControllerDemo/ViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "19488"
},
{
"name": "Ruby",
"bytes": "6211"
},
{
"name": "Shell",
"bytes": "482"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
Copyright 2003 - 2022 The eFaps Team
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.
-->
<ui-menu xmlns="http://www.efaps.org/xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
<uuid>a53fa5b0-1a9d-4a21-ba86-8553bb9690a1</uuid>
<file-application>eFapsApp-Sales</file-application>
<definition>
<version-expression>(version==latest)</version-expression>
<name>Sales_CreditNoteTree_File_Menu_Action</name>
<childs>
<child>Sales_CreditNoteTree_File_Menu_Action_CreateRoot</child>
<child>Sales_CreditNoteTree_File_Menu_Action_Create</child>
<child>Sales_CreditNoteTree_File_Menu_Action_Disconnect</child>
</childs>
</definition>
</ui-menu> | {
"content_hash": "f157354da58bd1a94043daac090bf0a8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 89,
"avg_line_length": 42.90625,
"alnum_prop": 0.7123088128186453,
"repo_name": "eFaps/eFapsApp-Sales",
"id": "2b2e13610c99b66e13557bd210dfd2f0dfd68143",
"size": "1373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/efaps/UserInterface/Document/CreditNote/Sales_CreditNoteTree_File_Menu_Action.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3983951"
},
{
"name": "XSLT",
"bytes": "6575"
}
],
"symlink_target": ""
} |
package dht
import (
"fmt"
"sync"
"time"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
peer "gx/ipfs/QmRBqJF7hb8ZSpRcMwUt8hNhydWcxGEhtk81HKq6oUwKvs/go-libp2p-peer"
inet "gx/ipfs/QmVCe3SNMjkcPgnpFhZs719dheq6xE7gJwjzV7aWcUM4Ms/go-libp2p/p2p/net"
ctxio "gx/ipfs/QmX6DhWrpBB5NtadXmPSXYNdVvuLfJXoFNMvUMoVvP5UJa/go-context/io"
ggio "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/io"
context "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
)
var dhtReadMessageTimeout = time.Minute
var ErrReadTimeout = fmt.Errorf("timed out reading response")
// handleNewStream implements the inet.StreamHandler
func (dht *IpfsDHT) handleNewStream(s inet.Stream) {
go dht.handleNewMessage(s)
}
func (dht *IpfsDHT) handleNewMessage(s inet.Stream) {
defer s.Close()
ctx := dht.Context()
cr := ctxio.NewReader(ctx, s) // ok to use. we defer close stream in this func
cw := ctxio.NewWriter(ctx, s) // ok to use. we defer close stream in this func
r := ggio.NewDelimitedReader(cr, inet.MessageSizeMax)
w := ggio.NewDelimitedWriter(cw)
mPeer := s.Conn().RemotePeer()
for {
// receive msg
pmes := new(pb.Message)
if err := r.ReadMsg(pmes); err != nil {
log.Debugf("Error unmarshaling data: %s", err)
return
}
// update the peer (on valid msgs only)
dht.updateFromMessage(ctx, mPeer, pmes)
// get handler for this msg type.
handler := dht.handlerForMsgType(pmes.GetType())
if handler == nil {
log.Debug("got back nil handler from handlerForMsgType")
return
}
// dispatch handler.
rpmes, err := handler(ctx, mPeer, pmes)
if err != nil {
log.Debugf("handle message error: %s", err)
return
}
// if nil response, return it before serializing
if rpmes == nil {
log.Debug("got back nil response from request")
continue
}
// send out response msg
if err := w.WriteMsg(rpmes); err != nil {
log.Debugf("send response error: %s", err)
return
}
}
}
// sendRequest sends out a request, but also makes sure to
// measure the RTT for latency measurements.
func (dht *IpfsDHT) sendRequest(ctx context.Context, p peer.ID, pmes *pb.Message) (*pb.Message, error) {
ms := dht.messageSenderForPeer(p)
start := time.Now()
rpmes, err := ms.SendRequest(ctx, pmes)
if err != nil {
return nil, err
}
// update the peer (on valid msgs only)
dht.updateFromMessage(ctx, p, rpmes)
dht.peerstore.RecordLatency(p, time.Since(start))
log.Event(ctx, "dhtReceivedMessage", dht.self, p, rpmes)
return rpmes, nil
}
// sendMessage sends out a message
func (dht *IpfsDHT) sendMessage(ctx context.Context, p peer.ID, pmes *pb.Message) error {
ms := dht.messageSenderForPeer(p)
if err := ms.SendMessage(ctx, pmes); err != nil {
return err
}
log.Event(ctx, "dhtSentMessage", dht.self, p, pmes)
return nil
}
func (dht *IpfsDHT) updateFromMessage(ctx context.Context, p peer.ID, mes *pb.Message) error {
dht.Update(ctx, p)
return nil
}
func (dht *IpfsDHT) messageSenderForPeer(p peer.ID) *messageSender {
dht.smlk.Lock()
defer dht.smlk.Unlock()
ms, ok := dht.strmap[p]
if !ok {
ms = dht.newMessageSender(p)
dht.strmap[p] = ms
}
return ms
}
type messageSender struct {
s inet.Stream
r ggio.ReadCloser
w ggio.WriteCloser
lk sync.Mutex
p peer.ID
dht *IpfsDHT
singleMes int
}
func (dht *IpfsDHT) newMessageSender(p peer.ID) *messageSender {
return &messageSender{p: p, dht: dht}
}
func (ms *messageSender) prep() error {
if ms.s != nil {
return nil
}
nstr, err := ms.dht.host.NewStream(ms.dht.ctx, ProtocolDHT, ms.p)
if err != nil {
return err
}
ms.r = ggio.NewDelimitedReader(nstr, inet.MessageSizeMax)
ms.w = ggio.NewDelimitedWriter(nstr)
ms.s = nstr
return nil
}
// streamReuseTries is the number of times we will try to reuse a stream to a
// given peer before giving up and reverting to the old one-message-per-stream
// behaviour.
const streamReuseTries = 3
func (ms *messageSender) SendMessage(ctx context.Context, pmes *pb.Message) error {
ms.lk.Lock()
defer ms.lk.Unlock()
if err := ms.prep(); err != nil {
return err
}
if err := ms.writeMessage(pmes); err != nil {
return err
}
if ms.singleMes > streamReuseTries {
ms.s.Close()
ms.s = nil
}
return nil
}
func (ms *messageSender) writeMessage(pmes *pb.Message) error {
err := ms.w.WriteMsg(pmes)
if err != nil {
// If the other side isnt expecting us to be reusing streams, we're gonna
// end up erroring here. To make sure things work seamlessly, lets retry once
// before continuing
log.Infof("error writing message: ", err)
ms.s.Close()
ms.s = nil
if err := ms.prep(); err != nil {
return err
}
if err := ms.w.WriteMsg(pmes); err != nil {
return err
}
// keep track of this happening. If it happens a few times, its
// likely we can assume the otherside will never support stream reuse
ms.singleMes++
}
return nil
}
func (ms *messageSender) SendRequest(ctx context.Context, pmes *pb.Message) (*pb.Message, error) {
ms.lk.Lock()
defer ms.lk.Unlock()
if err := ms.prep(); err != nil {
return nil, err
}
if err := ms.writeMessage(pmes); err != nil {
return nil, err
}
log.Event(ctx, "dhtSentMessage", ms.dht.self, ms.p, pmes)
mes := new(pb.Message)
if err := ms.ctxReadMsg(ctx, mes); err != nil {
ms.s.Close()
ms.s = nil
return nil, err
}
if ms.singleMes > streamReuseTries {
ms.s.Close()
ms.s = nil
}
return mes, nil
}
func (ms *messageSender) ctxReadMsg(ctx context.Context, mes *pb.Message) error {
errc := make(chan error, 1)
go func(r ggio.ReadCloser) {
errc <- r.ReadMsg(mes)
}(ms.r)
t := time.NewTimer(dhtReadMessageTimeout)
defer t.Stop()
select {
case err := <-errc:
return err
case <-ctx.Done():
return ctx.Err()
case <-t.C:
return ErrReadTimeout
}
}
| {
"content_hash": "757b56c9d5cbd79e6c88951bc7bcf894",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 104,
"avg_line_length": 23.144,
"alnum_prop": 0.688212927756654,
"repo_name": "peersafe/go-ipfs",
"id": "405ae1572f388ed3127ee155fc586dcca803e717",
"size": "5786",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "routing/dht/dht_net.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "1635772"
},
{
"name": "Makefile",
"bytes": "10001"
},
{
"name": "Protocol Buffer",
"bytes": "5933"
},
{
"name": "PureBasic",
"bytes": "29"
},
{
"name": "Python",
"bytes": "788"
},
{
"name": "Shell",
"bytes": "143865"
}
],
"symlink_target": ""
} |
<div class="container">
<div class="alert alert-danger" style="text-align: center">
<h2><i class="glyphicon glyphicon-warning-sign"></i></h2>
<h3>Ocurrió un error con su solicitud.</h3>
<h3>Por favor intente más tarde.</h3>
</div>
</div> | {
"content_hash": "f94a1579b8f23f48475b21f79a1c06e4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 38.42857142857143,
"alnum_prop": 0.6171003717472119,
"repo_name": "gsmahajan/pvcloud",
"id": "09d4af27b66ff52ab2e1bc0fc9ec03b303e7231c",
"size": "271",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/views/error.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "Arduino",
"bytes": "154"
},
{
"name": "CSS",
"bytes": "1056182"
},
{
"name": "HTML",
"bytes": "75188"
},
{
"name": "JavaScript",
"bytes": "94595"
},
{
"name": "PHP",
"bytes": "162807"
}
],
"symlink_target": ""
} |
package org.apereo.portal.events.aggr;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.apereo.portal.concurrency.FunctionWithoutResult;
import org.apereo.portal.concurrency.locking.ClusterMutex;
import org.apereo.portal.concurrency.locking.IClusterLockService;
import org.apereo.portal.concurrency.locking.IClusterLockService.LockStatus;
import org.apereo.portal.concurrency.locking.IClusterLockService.TryLockFunctionResult;
import org.apereo.portal.concurrency.locking.LockOptions;
import org.apereo.portal.jpa.BaseAggrEventsJpaDao;
import org.apereo.portal.jpa.BaseRawEventsJpaDao;
import org.apereo.portal.version.dao.VersionDao;
import org.apereo.portal.version.om.Version;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service("portalEventAggregationManager")
public class PortalEventProcessingManagerImpl
implements IPortalEventProcessingManager, HibernateCacheEvictor, DisposableBean {
protected final Logger logger = LoggerFactory.getLogger(getClass());
private PortalEventDimensionPopulator portalEventDimensionPopulator;
private PortalRawEventsAggregator portalEventAggregator;
private PortalEventPurger portalEventPurger;
private PortalEventSessionPurger portalEventSessionPurger;
private IClusterLockService clusterLockService;
private Map<String, Version> requiredProductVersions = Collections.emptyMap();
private VersionDao versionDao;
private long aggregateRawEventsPeriod = 0;
private long purgeRawEventsPeriod = 0;
private long purgeEventSessionsPeriod = 0;
private final ThreadLocal<Map<Class<?>, Collection<Serializable>>> evictedEntitiesHolder =
new ThreadLocal<Map<Class<?>, Collection<Serializable>>>() {
@Override
protected Map<Class<?>, Collection<Serializable>> initialValue() {
return new HashMap<>();
}
};
private volatile boolean shutdown = false;
@Autowired
public void setClusterLockService(IClusterLockService clusterLockService) {
this.clusterLockService = clusterLockService;
}
@Autowired
public void setPortalEventDimensionPopulator(
PortalEventDimensionPopulator portalEventDimensionPopulator) {
this.portalEventDimensionPopulator = portalEventDimensionPopulator;
}
@Autowired
public void setPortalEventAggregator(PortalRawEventsAggregator portalEventAggregator) {
this.portalEventAggregator = portalEventAggregator;
}
@Autowired
public void setPortalEventPurger(PortalEventPurger portalEventPurger) {
this.portalEventPurger = portalEventPurger;
}
@Autowired
public void setPortalEventSessionPurger(PortalEventSessionPurger portalEventSessionPurger) {
this.portalEventSessionPurger = portalEventSessionPurger;
}
@Value(
"${org.apereo.portal.events.aggr.PortalEventProcessingManagerImpl.aggregateRawEventsPeriod}")
public void setAggregateRawEventsPeriod(long aggregateRawEventsPeriod) {
this.aggregateRawEventsPeriod = aggregateRawEventsPeriod;
}
@Value("${org.apereo.portal.events.aggr.PortalEventProcessingManagerImpl.purgeRawEventsPeriod}")
public void setPurgeRawEventsPeriod(long purgeRawEventsPeriod) {
this.purgeRawEventsPeriod = purgeRawEventsPeriod;
}
@Value(
"${org.apereo.portal.events.aggr.PortalEventProcessingManagerImpl.purgeEventSessionsPeriod}")
public void setPurgeEventSessionsPeriod(long purgeEventSessionsPeriod) {
this.purgeEventSessionsPeriod = purgeEventSessionsPeriod;
}
@Resource(name = "productVersions")
public void setRequiredProductVersions(Map<String, Version> requiredProductVersions) {
this.requiredProductVersions = ImmutableMap.copyOf(requiredProductVersions);
}
@Autowired
public void setVersionDao(VersionDao versionDao) {
this.versionDao = versionDao;
}
@Override
public void destroy() {
this.shutdown = true;
}
@Override
public boolean populateDimensions() {
if (shutdown) {
logger.warn("populateDimensions called after shutdown, ignoring call");
return false;
}
if (!this.checkDatabaseVersion(BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME)) {
logger.info(
"The database and software versions for "
+ BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME
+ " do not match. No dimension population will be done");
return false;
}
try {
final TryLockFunctionResult<Object> result =
this.clusterLockService.doInTryLock(
PortalEventDimensionPopulator.DIMENSION_LOCK_NAME,
new FunctionWithoutResult<ClusterMutex>() {
@Override
protected void applyWithoutResult(ClusterMutex input) {
portalEventDimensionPopulator.doPopulateDimensions();
}
});
return result.getLockStatus() == LockStatus.EXECUTED;
} catch (InterruptedException e) {
logger.warn("Interrupted while populating dimensions", e);
Thread.currentThread().interrupt();
return false;
} catch (RuntimeException e) {
logger.error("populateDimensions failed", e);
throw e;
}
}
@Override
public boolean aggregateRawEvents() {
if (shutdown) {
logger.warn("aggregateRawEvents called after shutdown, ignoring call");
return false;
}
if (!this.checkDatabaseVersion(BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME)) {
logger.info(
"The database and software versions for "
+ BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME
+ " do not match. No event aggregation will be done");
return false;
}
if (!this.checkDatabaseVersion(BaseRawEventsJpaDao.PERSISTENCE_UNIT_NAME)) {
logger.info(
"The database and software versions for "
+ BaseRawEventsJpaDao.PERSISTENCE_UNIT_NAME
+ " do not match. No event aggregation will be done");
return false;
}
long aggregateLastRunDelay = (long) (this.aggregateRawEventsPeriod * .95);
final long aggregateServerBiasDelay = this.aggregateRawEventsPeriod * 4;
TryLockFunctionResult<EventProcessingResult> result = null;
EventProcessingResult aggrResult = null;
do {
if (result != null) {
logger.info(
"doAggregateRawEvents signaled that not all eligible events were aggregated in a single transaction, running aggregation again.");
// Set aggr period to 0 to allow immediate re-run locally
aggregateLastRunDelay = 0;
}
try {
long start = System.nanoTime();
// Try executing aggregation within lock
result =
clusterLockService.doInTryLock(
PortalRawEventsAggregator.AGGREGATION_LOCK_NAME,
LockOptions.builder()
.lastRunDelay(aggregateLastRunDelay)
.serverBiasDelay(aggregateServerBiasDelay),
new Function<ClusterMutex, EventProcessingResult>() {
@Override
public EventProcessingResult apply(final ClusterMutex input) {
return portalEventAggregator.doAggregateRawEvents();
}
});
aggrResult = result.getResult();
// Check the result, warn if null
if (result.getLockStatus() == LockStatus.EXECUTED && aggrResult == null) {
logger.warn("doAggregateRawEvents did not execute");
} else if (aggrResult != null) {
if (logger.isInfoEnabled()) {
logResult(
"Aggregated {} events created at {} events/second between {} and {} in {}ms - {} e/s a {}x speedup.",
aggrResult,
start);
}
// If events were processed purge old aggregations from the cache and then clean
// unclosed aggregations
if (aggrResult.getProcessed() > 0) {
final Map<Class<?>, Collection<Serializable>> evictedEntities =
evictedEntitiesHolder.get();
if (evictedEntities.size() > 0) {
portalEventAggregator.evictAggregates(evictedEntities);
}
TryLockFunctionResult<EventProcessingResult> cleanAggrResult;
EventProcessingResult cleanResult;
do {
// Update start time so logging is accurate
start = System.nanoTime();
cleanAggrResult =
clusterLockService.doInTryLock(
PortalRawEventsAggregator.AGGREGATION_LOCK_NAME,
new Function<ClusterMutex, EventProcessingResult>() {
@Override
public EventProcessingResult apply(
final ClusterMutex input) {
return portalEventAggregator
.doCloseAggregations();
}
});
cleanResult = cleanAggrResult.getResult();
if (cleanAggrResult.getLockStatus() == LockStatus.EXECUTED
&& cleanResult == null) {
logger.warn("doCloseAggregations was not executed");
} else if (cleanResult != null && logger.isInfoEnabled()) {
logResult(
"Clean {} unclosed agregations created at {} aggrs/second between {} and {} in {}ms - {} a/s a {}x speedup",
cleanResult,
start);
}
// Loop if doCloseAggregations returns false, that means there is more
// to clean
} while (cleanAggrResult.getLockStatus() == LockStatus.EXECUTED
&& cleanResult != null
&& !cleanResult.isComplete());
}
}
} catch (InterruptedException e) {
logger.warn("Interrupted while aggregating", e);
Thread.currentThread().interrupt();
return false;
} catch (RuntimeException e) {
logger.error("aggregateRawEvents failed", e);
throw e;
} finally {
// Make sure we clean up the thread local
evictedEntitiesHolder.remove();
}
// Loop if doAggregateRawEvents returns false, this means that there is more to
// aggregate
} while (result.getLockStatus() == LockStatus.EXECUTED
&& aggrResult != null
&& !aggrResult.isComplete());
return result != null
&& result.getLockStatus() == LockStatus.EXECUTED
&& aggrResult != null
&& aggrResult.isComplete();
}
@Override
public boolean purgeRawEvents() {
if (shutdown) {
logger.warn("purgeRawEvents called after shutdown, ignoring call");
return false;
}
if (!this.checkDatabaseVersion(BaseRawEventsJpaDao.PERSISTENCE_UNIT_NAME)) {
logger.info(
"The database and software versions for "
+ BaseRawEventsJpaDao.PERSISTENCE_UNIT_NAME
+ " do not match. No event purging will be done");
return false;
}
long purgeLastRunDelay = (long) (this.purgeRawEventsPeriod * .95);
TryLockFunctionResult<EventProcessingResult> result = null;
EventProcessingResult purgeResult = null;
do {
if (result != null) {
logger.debug(
"doPurgeRawEvents signaled that not all eligibe events were purged in a single transaction, running purge again.");
// Set purge period to 0 to allow immediate re-run locally
purgeLastRunDelay = 0;
}
try {
final long start = System.nanoTime();
result =
clusterLockService.doInTryLock(
PortalEventPurger.PURGE_RAW_EVENTS_LOCK_NAME,
LockOptions.builder().lastRunDelay(purgeLastRunDelay),
new Function<ClusterMutex, EventProcessingResult>() {
@Override
public EventProcessingResult apply(final ClusterMutex input) {
return portalEventPurger.doPurgeRawEvents();
}
});
purgeResult = result.getResult();
// Check the result, warn if null
if (result.getLockStatus() == LockStatus.EXECUTED && purgeResult == null) {
logger.warn("doPurgeRawEvents did not execute");
} else if (purgeResult != null && logger.isInfoEnabled()) {
logResult(
"Purged {} events created at {} events/second between {} and {} in {}ms - {} e/s a {}x speedup",
purgeResult,
start);
}
} catch (InterruptedException e) {
logger.warn("Interrupted while purging raw events", e);
Thread.currentThread().interrupt();
return false;
} catch (RuntimeException e) {
logger.error("purgeRawEvents failed", e);
throw e;
}
// Loop if doPurgeRawEvents returns false, this means that there is more to purge
} while (result.getLockStatus() == LockStatus.EXECUTED
&& purgeResult != null
&& !purgeResult.isComplete());
return result != null
&& result.getLockStatus() == LockStatus.EXECUTED
&& purgeResult != null
&& purgeResult.isComplete();
}
@Override
public boolean purgeEventSessions() {
if (shutdown) {
logger.warn("purgeEventSessions called after shutdown, ignoring call");
return false;
}
if (!this.checkDatabaseVersion(BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME)) {
logger.info(
"The database and software versions for "
+ BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME
+ " do not match. No event session purging will be done");
return false;
}
try {
final long start = System.nanoTime();
final long purgeLastRunDelay = (long) (this.purgeEventSessionsPeriod * .95);
final TryLockFunctionResult<EventProcessingResult> result =
clusterLockService.doInTryLock(
PortalEventSessionPurger.PURGE_EVENT_SESSION_LOCK_NAME,
LockOptions.builder().lastRunDelay(purgeLastRunDelay),
new Function<ClusterMutex, EventProcessingResult>() {
@Override
public EventProcessingResult apply(final ClusterMutex input) {
return portalEventSessionPurger.doPurgeEventSessions();
}
});
final EventProcessingResult purgeResult = result.getResult();
// Check the result, warn if null
if (result.getLockStatus() == LockStatus.EXECUTED && purgeResult == null) {
logger.warn("doPurgeRawEvents did not execute");
} else if (purgeResult != null && logger.isInfoEnabled()) {
logResult(
"Purged {} event sessions created before {} in {}ms - {} sessions/second",
purgeResult,
start);
}
return result.getLockStatus() == LockStatus.EXECUTED
&& purgeResult != null
&& purgeResult.isComplete();
} catch (InterruptedException e) {
logger.warn("Interrupted while purging event sessions", e);
Thread.currentThread().interrupt();
return false;
} catch (RuntimeException e) {
logger.error("purgeEventSessions failed", e);
throw e;
}
}
@Override
public void evictEntity(Class<?> entityClass, Serializable identifier) {
final Map<Class<?>, Collection<Serializable>> evictedEntities = evictedEntitiesHolder.get();
Collection<Serializable> ids = evictedEntities.get(entityClass);
if (ids == null) {
ids = new ArrayList<>();
evictedEntities.put(entityClass, ids);
}
ids.add(identifier);
}
/** Check if the database and software versions match */
private boolean checkDatabaseVersion(String databaseName) {
final Version softwareVersion = this.requiredProductVersions.get(databaseName);
if (softwareVersion == null) {
throw new IllegalStateException("No version number is configured for: " + databaseName);
}
final Version databaseVersion = this.versionDao.getVersion(databaseName);
if (databaseVersion == null) {
throw new IllegalStateException(
"No version number is exists in the database for: " + databaseName);
}
return softwareVersion.equals(databaseVersion);
}
private void logResult(String message, EventProcessingResult aggrResult, long start) {
final long runTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
final double processRate = aggrResult.getProcessed() / (runTime / 1000d);
final DateTime startDate = aggrResult.getStart();
if (startDate != null) {
final double creationRate = aggrResult.getCreationRate();
final double processSpeedUp = processRate / creationRate;
logger.info(
message,
new Object[] {
aggrResult.getProcessed(),
String.format("%.4f", creationRate),
startDate,
aggrResult.getEnd(),
runTime,
String.format("%.4f", processRate),
String.format("%.4f", processSpeedUp)
});
} else {
logger.info(
message,
new Object[] {
aggrResult.getProcessed(),
aggrResult.getEnd(),
runTime,
String.format("%.4f", processRate)
});
}
}
}
| {
"content_hash": "d52f9aeefba8421c474796f32fdd5909",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 154,
"avg_line_length": 44.53632478632478,
"alnum_prop": 0.5583649186777335,
"repo_name": "mgillian/uPortal",
"id": "65cd976e19928a790ea35ecc9a262ad34c1eb047",
"size": "21632",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "uPortal-events/src/main/java/org/apereo/portal/events/aggr/PortalEventProcessingManagerImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1744"
},
{
"name": "Groovy",
"bytes": "56524"
},
{
"name": "HTML",
"bytes": "219389"
},
{
"name": "Java",
"bytes": "10251304"
},
{
"name": "JavaScript",
"bytes": "288203"
},
{
"name": "Less",
"bytes": "138521"
},
{
"name": "StringTemplate",
"bytes": "1107"
},
{
"name": "XSLT",
"bytes": "255894"
}
],
"symlink_target": ""
} |
package org.xdi.oxauth.model.register;
import org.xdi.oxauth.model.error.IErrorType;
/**
* Error codes for register error responses.
*
* @author Javier Rojas Blum
* @version 0.9 May 18, 2015
*/
public enum RegisterErrorResponseType implements IErrorType {
/**
* Value of one or more redirect_uris is invalid.
*/
INVALID_REDIRECT_URI("invalid_redirect_uri"),
/**
* The value of one of the Client Metadata fields is invalid and the server has rejected this request.
* Note that an Authorization Server MAY choose to substitute a valid value for any requested parameter
* of a Client's Metadata.
*/
INVALID_CLIENT_METADATA("invalid_client_metadata"),
/**
* The access token provided is expired, revoked, malformed, or invalid for other reasons.
*/
INVALID_TOKEN("invalid_token"),
/**
* Value of logout_uri is invalid.
*/
INVALID_LOGOUT_URI("invalid_logout_uri"),
/**
* The authorization server denied the request.
*/
ACCESS_DENIED("access_denied");
private final String paramName;
private RegisterErrorResponseType(String paramName) {
this.paramName = paramName;
}
/**
* Return the corresponding enumeration from a string parameter.
*
* @param param The parameter to be match.
* @return The <code>enumeration</code> if found, otherwise
* <code>null</code>.
*/
public static RegisterErrorResponseType fromString(String param) {
if (param != null) {
for (RegisterErrorResponseType err : RegisterErrorResponseType
.values()) {
if (param.equals(err.paramName)) {
return err;
}
}
}
return null;
}
/**
* Returns a string representation of the object. In this case, the lower case code of the error.
*/
@Override
public String toString() {
return paramName;
}
/**
* Gets error parameter.
*
* @return error parameter
*/
@Override
public String getParameter() {
return paramName;
}
}
| {
"content_hash": "2a0faaec0497221d2efc2bfdbd61aa60",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 107,
"avg_line_length": 26.20731707317073,
"alnum_prop": 0.6170311772917636,
"repo_name": "diedertimmers/oxAuth",
"id": "947734afad21e693e5fac7330fecb276a31370b3",
"size": "2293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Model/src/main/java/org/xdi/oxauth/model/register/RegisterErrorResponseType.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "49"
},
{
"name": "C",
"bytes": "102966"
},
{
"name": "CSS",
"bytes": "43980"
},
{
"name": "HTML",
"bytes": "156734"
},
{
"name": "Java",
"bytes": "4642185"
},
{
"name": "JavaScript",
"bytes": "9618"
},
{
"name": "PHP",
"bytes": "19271"
},
{
"name": "Python",
"bytes": "267184"
},
{
"name": "XSLT",
"bytes": "35486"
}
],
"symlink_target": ""
} |
package me.shkschneider.skeleton.ui;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import me.shkschneider.skeleton.helper.ApplicationHelper;
public class DrawableHelper {
@SuppressWarnings("deprecation")
public static Drawable fromResource(@DrawableRes final int id) {
return ApplicationHelper.resources().getDrawable(id);
}
public static Drawable fromBitmap(@NonNull final Bitmap bitmap) {
return new BitmapDrawable(ApplicationHelper.resources(), bitmap);
}
public static Drawable circular(@NonNull final Bitmap bitmap) {
final RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(ApplicationHelper.resources(), bitmap);
roundedBitmapDrawable.setCornerRadius(Math.min(roundedBitmapDrawable.getMinimumWidth(), roundedBitmapDrawable.getMinimumHeight()) / 2.0F);
return roundedBitmapDrawable;
}
public static String toBase64(@NonNull final Drawable drawable) {
return BitmapHelper.toBase64(BitmapHelper.fromDrawable(drawable));
}
}
| {
"content_hash": "a3254c5a9bf05b8baa5b1b9627a17523",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 146,
"avg_line_length": 40,
"alnum_prop": 0.7897058823529411,
"repo_name": "vcgato29/android_Skeleton",
"id": "a80d40227f6cd1cdbd38cb8f6c45c0a9ba812244",
"size": "1360",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "library/src/main/java/me/shkschneider/skeleton/ui/DrawableHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "340508"
},
{
"name": "Makefile",
"bytes": "1856"
},
{
"name": "Shell",
"bytes": "1914"
}
],
"symlink_target": ""
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
String.prototype.split (separator, limit) returns an Array object into which substrings of the result of converting this object to a string have
been stored. The substrings are determined by searching from left to right for occurrences of
separator; these occurrences are not part of any substring in the returned array, but serve to divide up
the string value. The value of separator may be a string of any length or it may be a RegExp object
es5id: 15.5.4.14_A2_T37
description: Call split(1,-Math.pow(2,32)+1), instance is Number
---*/
var __instance = new Number(100111122133144155);
Number.prototype.split = String.prototype.split;
var __split = __instance.split(1, -Math.pow(2,32)+1);
var __expected = [];
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (__split.constructor !== Array) {
$ERROR('#1: __split.constructor === Array. Actual: '+__split.constructor );
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__split.length !== __expected.length) {
$ERROR('#2: __split.length === __expected.length. Actual: '+__split.length );
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__split[0] !== __expected[0]) {
$ERROR('#3: __split[0] === '+__expected[0]+'. Actual: '+__split[index] );
}
//
//////////////////////////////////////////////////////////////////////////////
| {
"content_hash": "a69d94a7453d4d8819fed27f3f2d0e64",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 148,
"avg_line_length": 39.81818181818182,
"alnum_prop": 0.4965753424657534,
"repo_name": "PiotrDabkowski/Js2Py",
"id": "85a4bf128e9e0e7e52787ace1d0de386c5c0c15f",
"size": "1752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_cases/built-ins/String/prototype/split/S15.5.4.14_A2_T37.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "289"
},
{
"name": "JavaScript",
"bytes": "8556970"
},
{
"name": "Python",
"bytes": "4583980"
},
{
"name": "Shell",
"bytes": "457"
}
],
"symlink_target": ""
} |
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';
import '@angular/router';
import 'rxjs';
// import '@angularclass/hmr';
// Other vendors for example jQuery, Lodash or Bootstrap
// You can import js, ts, css, sass, ...
| {
"content_hash": "cb645738d65d58a58ed6bba5aa6d2060",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 27.166666666666668,
"alnum_prop": 0.7177914110429447,
"repo_name": "dvhuy/dkNg",
"id": "1648fe8d3e49a19b14de84d875adbfb037e35c96",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vendor.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3166014"
},
{
"name": "HTML",
"bytes": "21965"
},
{
"name": "JavaScript",
"bytes": "17942"
},
{
"name": "TypeScript",
"bytes": "51250"
}
],
"symlink_target": ""
} |
//
// Shared utilities for commandline tools
//
#include <string>
namespace wasm {
// Removes a specific suffix if it is present, otherwise no-op
inline std::string removeSpecificSuffix(std::string str, std::string suffix) {
if (str.size() <= suffix.size()) {
return str;
}
if (str.substr(str.size() - suffix.size()).compare(suffix) == 0) {
return str.substr(0, str.size() - suffix.size());
}
return str;
}
} // namespace wasm
| {
"content_hash": "defff67f6edb80b121314a65068ece39",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 20.5,
"alnum_prop": 0.6541019955654102,
"repo_name": "WebAssembly/binaryen",
"id": "9e010ae3a7e67cb6ad8b4be8e36ada55f62a7842",
"size": "1074",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "src/tools/tool-utils.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "818"
},
{
"name": "C",
"bytes": "207547"
},
{
"name": "C++",
"bytes": "5985800"
},
{
"name": "CMake",
"bytes": "23829"
},
{
"name": "JavaScript",
"bytes": "1691950"
},
{
"name": "Python",
"bytes": "285958"
},
{
"name": "Shell",
"bytes": "3871"
},
{
"name": "WebAssembly",
"bytes": "12585074"
}
],
"symlink_target": ""
} |
package com.magnet.mmx.server.plugin.mmxmgmt.util;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.magnet.mmx.server.common.data.AppEntity;
import com.magnet.mmx.server.plugin.mmxmgmt.db.AppDAO;
import com.magnet.mmx.server.plugin.mmxmgmt.db.AppDAOImpl;
import com.magnet.mmx.server.plugin.mmxmgmt.db.ConnectionProvider;
import com.magnet.mmx.server.plugin.mmxmgmt.db.OpenFireDBConnectionProvider;
import java.util.concurrent.ExecutionException;
/**
*/
public class AppEntityDBLoadingEntityCache implements DBEntityCache<AppEntity> {
private static AppEntityDBLoadingEntityCache INSTANCE;
private static int CACHE_SIZE = 100;
private LoadingCache<String,AppEntity> cache;
public AppEntityDBLoadingEntityCache(int size, CacheLoader<String, AppEntity> appEntityCacheLoader) {
cache = CacheBuilder.newBuilder()
.maximumSize(CACHE_SIZE)
.build(appEntityCacheLoader);
}
@Override
public AppEntity get(String key) {
try {
return cache.get(key);
} catch (ExecutionException e) {
return null;
}
}
@Override
public void purge(String key) {
cache.refresh(key);
}
private static class AppEntityNotFoundException extends Exception {
private AppEntityNotFoundException(String message) {
super(message);
}
}
public static class AppEntityDBLoader extends CacheLoader<String, AppEntity> {
private ConnectionProvider provider;
public AppEntityDBLoader (ConnectionProvider provider) {
this.provider = provider;
}
public AppEntityDBLoader() {
this (new OpenFireDBConnectionProvider());
}
public AppEntity load(String key) throws AppEntityNotFoundException {
AppDAO appDAO = new AppDAOImpl(this.provider);
AppEntity entity = appDAO.getAppForAppKey(key);
if (entity == null) {
throw new AppEntityNotFoundException(String.format("AppEntity with key:%s not found", key));
}
return entity;
}
}
}
| {
"content_hash": "ac8127f683709e542a1caddf8a1246cc",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 103,
"avg_line_length": 28.19178082191781,
"alnum_prop": 0.7395529640427599,
"repo_name": "sanyaade-iot/message-server",
"id": "c1470bca22f0b9b182d972ab081330ea22f745dc",
"size": "2673",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "server/plugins/mmxmgmt/src/main/java/com/magnet/mmx/server/plugin/mmxmgmt/util/AppEntityDBLoadingEntityCache.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "15"
},
{
"name": "Java",
"bytes": "2078934"
},
{
"name": "Shell",
"bytes": "7282"
}
],
"symlink_target": ""
} |
package cmd
import (
"fmt"
"regexp"
"strings"
)
// A typed value to indicate which table columns should be included in the output.
type tableColumnType int
const (
tableColTotal tableColumnType = iota
tableColMin
tableColMax
tableColMean
tableColMedian
tableColInvocations
tableColP50
tableColP75
tableColP90
tableColP99
tableColStdDev
// a sentinel value allowing us to iterate all valid table column types
numTableColumns
)
var (
tableColSplitRegex = regexp.MustCompile(`\s*,\s*`)
tableColTypeToName = map[tableColumnType]string{
tableColTotal: "total",
tableColMin: "min",
tableColMax: "max",
tableColMean: "mean",
tableColMedian: "median",
tableColInvocations: "invocations",
tableColP50: "p50",
tableColP75: "p75",
tableColP90: "p90",
tableColP99: "p99",
tableColStdDev: "stddev",
}
)
// Header returns the table header description for this column type.
func (dc tableColumnType) Header() string {
switch dc {
case tableColTotal:
return "total"
case tableColMin:
return "min"
case tableColMax:
return "max"
case tableColMean:
return "mean"
case tableColMedian:
return "median"
case tableColInvocations:
return "invoc"
case tableColP50:
return "p50"
case tableColP75:
return "p75"
case tableColP90:
return "p90"
case tableColP99:
return "p99"
case tableColStdDev:
return "stddev"
}
panic("unsupported column type")
}
// Name returns a string representation of this column's type.
func (dc tableColumnType) Name() string {
return tableColTypeToName[dc]
}
// Parse a comma delimited set of column types.
func parseTableColumList(list string) ([]tableColumnType, error) {
cols := make([]tableColumnType, 0)
for _, colName := range tableColSplitRegex.Split(list, -1) {
found := false
for colType, colTypeName := range tableColTypeToName {
if colName == colTypeName {
cols = append(cols, colType)
found = true
break
}
}
if !found {
return nil, fmt.Errorf("unsupported column name %q; supported column names are: %s", colName, SupportedColumnNames())
}
}
return cols, nil
}
// SupportedColumnNames returns back a string will all supported metric column names.
func SupportedColumnNames() string {
set := make([]string, numTableColumns)
for i := 0; i < int(numTableColumns); i++ {
set[i] = tableColumnType(i).Name()
}
return strings.Join(set, ", ")
}
| {
"content_hash": "ac404e1cf045db6d92aeab9648eebfeb",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 120,
"avg_line_length": 22.675925925925927,
"alnum_prop": 0.7011024908125766,
"repo_name": "geckoboard/prism",
"id": "cfe63e7660d9e81ef9b0a4a54667be197884a134",
"size": "2449",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cmd/table_column.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "105742"
},
{
"name": "Makefile",
"bytes": "639"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
namespace WpfApplication1
{
public interface ISmoTasks
{
IEnumerable<string> SqlServers {get;}
List<string> GetDatabases(SqlConnectionString connectionString);
List<DatabaseTable> GetTables(SqlConnectionString connectionString);
}
}
| {
"content_hash": "3c50ef93196a360c00e62af7fb399bd3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 27.727272727272727,
"alnum_prop": 0.7377049180327869,
"repo_name": "JakeGinnivan/SqlConnectionControl",
"id": "08224fa3873f6daac0d2a7df7d1eaba26f2fbbe6",
"size": "307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WpfApplication1/ISmoTasks.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "18777"
}
],
"symlink_target": ""
} |
title: Cookie Policy
nav_id: cookie-policy
---
TL;DR
-----
### Italiano
Purtroppo questo sito usa dei cookie ed usa servizi di terze parti che
**potrebbero** utilizzare a loro volta dei cookie. So che non ve ne frega
niente perché si tratta di cookie che non vengono usati per profilarvi,
ma una legge idiota interpretata in modo ancora più idiota mi obbliga
ad avvisarvi. Meh.
### English
Unfortunately this website uses some cookies and relies on third-party
services which, in turn, **might** set some cookies. I know you don't give a
shit about it because they're not being used to profile or otherwise track
you, but an asinine law forces me to nag you about them. Meh.
Versione completa (Italian only)
--------------------------------
Questo sito utilizza dei cookie per garantirne il corretto funzionamento.
Per la privacy policy completa si rimanda al link nel footer.
### Cookie tecnici
I cookie tecnici sono quelli utilizzati al solo fine di "effettuare la
trasmissione di una comunicazione su una rete di comunicazione elettronica, o
nella misura strettamente necessaria al fornitore di un servizio della
società dell'informazione esplicitamente richiesto dall'abbonato o
dall'utente a erogare tale servizio" (cfr. art. 122, comma 1, del Codice).
Essi non vengono utilizzati per scopi ulteriori e sono normalmente installati
direttamente dal titolare o gestore del sito web. Possono essere suddivisi in
cookie di navigazione o di sessione, che garantiscono la normale navigazione e
fruizione del sito web (permettendo, ad esempio, di realizzare un acquisto o
autenticarsi per accedere ad aree riservate); cookie analytics, assimilati ai
cookie tecnici laddove utilizzati direttamente dal gestore del sito per
raccogliere informazioni, in forma aggregata, sul numero degli utenti e su
come questi visitano il sito stesso; cookie di funzionalità, che
permettono all'utente la navigazione in funzione di una serie di criteri
selezionati (ad esempio, la lingua, i prodotti selezionati per l'acquisto) al
fine di migliorare il servizio reso allo stesso. Per l'installazione di tali
cookie non è richiesto il preventivo consenso degli utenti, mentre
resta fermo l'obbligo di dare l'informativa ai sensi dell'art. 13 del Codice,
che il gestore del sito potrà fornire con le modalità che
ritiene più idonee.
Elenco dei cookie tecnici:
* `__cfduid`:
* Origine: CloudFlare
* Scopo: gestione degli abusi
* Durata: 1 anno
* Maggiori informazioni: ["What does the CloudFlare cfduid cookie do?"][cfduid] (inglese)
* `cookieconsent_dismissed`
* Origine: locale (Javascript)
* Scopo: gestione della barra con l'informativa sintetica
* Durata: 1 anno
### Cookie di profilazione
Questo sito non usa cookie di profilazione.
### Cookie di terze parti
Questo sito non usa cookie di terze parti.
### Riferimenti normativi
* [Dlgs. 30 giugno 2003, n. 196][privacy]
* [Individuazione delle modalità semplificate per l'informativa e
l'acquisizione del consenso per l'uso dei cookie - 8 maggio 2014
\[3118884\]][cookie-law]
[cfduid]: https://support.cloudflare.com/hc/en-us/articles/200170156-What-does-the-CloudFlare-cfduid-cookie-do-
[privacy]: http://www.garanteprivacy.it/web/guest/home/docweb/-/docweb-display/docweb/1311248
[cookie-law]: http://www.garanteprivacy.it/web/guest/home/docweb/-/docweb-display/docweb/3118884
| {
"content_hash": "16571b845f81f8827cdd1033eaee17ba",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 111,
"avg_line_length": 38,
"alnum_prop": 0.7748538011695907,
"repo_name": "rfc1459/newblog",
"id": "a8d01dc18032f73f42d5922e80e1215bbbd60374",
"size": "3424",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "content/cookie-policy/index.md",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "5575"
},
{
"name": "HTML",
"bytes": "22414"
},
{
"name": "JavaScript",
"bytes": "564"
},
{
"name": "Ruby",
"bytes": "38769"
}
],
"symlink_target": ""
} |
/*
Copyright � 1999 CERN - European Organization for Nuclear Research.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose
is hereby granted without fee, provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in supporting documentation.
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
package org.apache.mahout.math.map;
import java.util.Arrays;
import java.util.List;
import org.apache.mahout.math.function.ByteObjectProcedure;
import org.apache.mahout.math.function.ByteProcedure;
import org.apache.mahout.math.list.ByteArrayList;
public class OpenByteObjectHashMap<T> extends AbstractByteObjectMap<T> {
private static final byte FREE = 0;
private static final byte FULL = 1;
private static final byte REMOVED = 2;
/** The hash table keys. */
private byte[] table;
/** The hash table values. */
private T[] values;
/** The state of each hash table entry (FREE, FULL, REMOVED). */
private byte[] state;
/** The number of table entries in state==FREE. */
private int freeEntries;
/** Constructs an empty map with default capacity and default load factors. */
public OpenByteObjectHashMap() {
this(defaultCapacity);
}
/**
* Constructs an empty map with the specified initial capacity and default load factors.
*
* @param initialCapacity the initial capacity of the map.
* @throws IllegalArgumentException if the initial capacity is less than zero.
*/
public OpenByteObjectHashMap(int initialCapacity) {
this(initialCapacity, defaultMinLoadFactor, defaultMaxLoadFactor);
}
/**
* Constructs an empty map with the specified initial capacity and the specified minimum and maximum load factor.
*
* @param initialCapacity the initial capacity.
* @param minLoadFactor the minimum load factor.
* @param maxLoadFactor the maximum load factor.
* @throws IllegalArgumentException if <tt>initialCapacity < 0 || (minLoadFactor < 0.0 || minLoadFactor >= 1.0) ||
* (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor >=
* maxLoadFactor)</tt>.
*/
public OpenByteObjectHashMap(int initialCapacity, double minLoadFactor, double maxLoadFactor) {
setUp(initialCapacity, minLoadFactor, maxLoadFactor);
}
/** Removes all (key,value) associations from the receiver. Implicitly calls <tt>trimToSize()</tt>. */
@Override
public void clear() {
Arrays.fill(state, 0, this.state.length - 1, FREE);
Arrays.fill(values, 0, state.length - 1, null); // delta
this.distinct = 0;
this.freeEntries = table.length; // delta
trimToSize();
}
/**
* Returns a deep copy of the receiver.
*
* @return a deep copy of the receiver.
*/
@SuppressWarnings("unchecked")
@Override
public OpenByteObjectHashMap<T> clone() {
OpenByteObjectHashMap<T> copy = (OpenByteObjectHashMap<T>) super.clone();
copy.table = copy.table.clone();
copy.values = copy.values.clone();
copy.state = copy.state.clone();
return copy;
}
/**
* Returns <tt>true</tt> if the receiver contains the specified key.
*
* @return <tt>true</tt> if the receiver contains the specified key.
*/
@Override
public boolean containsKey(byte key) {
return indexOfKey(key) >= 0;
}
/**
* Returns <tt>true</tt> if the receiver contains the specified value.
*
* @return <tt>true</tt> if the receiver contains the specified value.
*/
@Override
public boolean containsValue(T value) {
return indexOfValue(value) >= 0;
}
/**
* Ensures that the receiver can hold at least the specified number of associations without needing to allocate new
* internal memory. If necessary, allocates new internal memory and increases the capacity of the receiver. <p> This
* method never need be called; it is for performance tuning only. Calling this method before <tt>put()</tt>ing a
* large number of associations boosts performance, because the receiver will grow only once instead of potentially
* many times and hash collisions get less probable.
*
* @param minCapacity the desired minimum capacity.
*/
@Override
public void ensureCapacity(int minCapacity) {
if (table.length < minCapacity) {
int newCapacity = nextPrime(minCapacity);
rehash(newCapacity);
}
}
/**
* Applies a procedure to each key of the receiver, if any. Note: Iterates over the keys in no particular order.
* Subclasses can define a particular order, for example, "sorted by key". All methods which <i>can</i> be expressed
* in terms of this method (most methods can) <i>must guarantee</i> to use the <i>same</i> order defined by this
* method, even if it is no particular order. This is necessary so that, for example, methods <tt>keys</tt> and
* <tt>values</tt> will yield association pairs, not two uncorrelated lists.
*
* @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise
* continues.
* @return <tt>false</tt> if the procedure stopped before all keys where iterated over, <tt>true</tt> otherwise.
*/
@Override
public boolean forEachKey(ByteProcedure procedure) {
for (int i = table.length; i-- > 0;) {
if (state[i] == FULL) {
if (!procedure.apply(table[i])) {
return false;
}
}
}
return true;
}
/**
* Applies a procedure to each (key,value) pair of the receiver, if any. Iteration order is guaranteed to be
* <i>identical</i> to the order used by method {@link #forEachKey(ByteProcedure)}.
*
* @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise
* continues.
* @return <tt>false</tt> if the procedure stopped before all keys where iterated over, <tt>true</tt> otherwise.
*/
@Override
public boolean forEachPair(ByteObjectProcedure<T> procedure) {
for (int i = table.length; i-- > 0;) {
if (state[i] == FULL) {
if (!procedure.apply(table[i], values[i])) {
return false;
}
}
}
return true;
}
/**
* Returns the value associated with the specified key. It is often a good idea to first check with
* containsKey(byte) whether the given key has a value associated or not, i.e. whether there exists an association
* for the given key or not.
*
* @param key the key to be searched for.
* @return the value associated with the specified key; <tt>null</tt> if no such key is present.
*/
@Override
public T get(byte key) {
final int i = indexOfKey(key);
if (i < 0) {
return null;
} //not contained
return values[i];
}
/**
* @param key the key to be added to the receiver.
* @return the index where the key would need to be inserted, if it is not already contained. Returns -index-1 if the
* key is already contained at slot index. Therefore, if the returned index < 0, then it is already contained
* at slot -index-1. If the returned index >= 0, then it is NOT already contained and should be inserted at
* slot index.
*/
protected int indexOfInsertion(byte key) {
final int length = table.length;
final int hash = HashFunctions.hash(key) & 0x7FFFFFFF;
int i = hash % length;
int decrement = hash % (length - 2); // double hashing, see http://www.eece.unm.edu/faculty/heileman/hash/node4.html
//int decrement = (hash / length) % length;
if (decrement == 0) {
decrement = 1;
}
// stop if we find a removed or free slot, or if we find the key itself
// do NOT skip over removed slots (yes, open addressing is like that...)
while (state[i] == FULL && table[i] != key) {
i -= decrement;
//hashCollisions++;
if (i < 0) {
i += length;
}
}
if (state[i] == REMOVED) {
// stop if we find a free slot, or if we find the key itself.
// do skip over removed slots (yes, open addressing is like that...)
// assertion: there is at least one FREE slot.
final int j = i;
while (state[i] != FREE && (state[i] == REMOVED || table[i] != key)) {
i -= decrement;
//hashCollisions++;
if (i < 0) {
i += length;
}
}
if (state[i] == FREE) {
i = j;
}
}
if (state[i] == FULL) {
// key already contained at slot i.
// return a negative number identifying the slot.
return -i - 1;
}
// not already contained, should be inserted at slot i.
// return a number >= 0 identifying the slot.
return i;
}
/**
* @param key the key to be searched in the receiver.
* @return the index where the key is contained in the receiver, returns -1 if the key was not found.
*/
protected int indexOfKey(byte key) {
final int length = table.length;
final int hash = HashFunctions.hash(key) & 0x7FFFFFFF;
int i = hash % length;
int decrement = hash % (length - 2); // double hashing, see http://www.eece.unm.edu/faculty/heileman/hash/node4.html
//int decrement = (hash / length) % length;
if (decrement == 0) {
decrement = 1;
}
// stop if we find a free slot, or if we find the key itself.
// do skip over removed slots (yes, open addressing is like that...)
while (state[i] != FREE && (state[i] == REMOVED || table[i] != key)) {
i -= decrement;
//hashCollisions++;
if (i < 0) {
i += length;
}
}
if (state[i] == FREE) {
return -1;
} // not found
return i; //found, return index where key is contained
}
/**
* @param value the value to be searched in the receiver.
* @return the index where the value is contained in the receiver, returns -1 if the value was not found.
*/
protected int indexOfValue(T value) {
T[] val = values;
byte[] stat = state;
for (int i = stat.length; --i >= 0;) {
if (stat[i] == FULL && val[i] == value) {
return i;
}
}
return -1; // not found
}
/**
* Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this
* call returns the specified list has a new size that equals <tt>this.size()</tt>. Iteration order is guaranteed to
* be <i>identical</i> to the order used by method {@link #forEachKey(ByteProcedure)}. <p> This method can be used to
* iterate over the keys of the receiver.
*
* @param list the list to be filled, can have any size.
*/
@Override
public void keys(ByteArrayList list) {
list.setSize(distinct);
byte[] elements = list.elements();
int j = 0;
for (int i = table.length; i-- > 0;) {
if (state[i] == FULL) {
elements[j++] = table[i];
}
}
}
/**
* Fills all pairs satisfying a given condition into the specified lists. Fills into the lists, starting at index 0.
* After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
* Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(ByteProcedure)}.
* <p> <b>Example:</b> <br>
* <pre>
* ByteObjectProcedure condition = new ByteObjectProcedure() { // match even keys only
* public boolean apply(byte key, Object value) { return key%2==0; }
* }
* keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
* </pre>
*
* @param condition the condition to be matched. Takes the current key as first and the current value as second
* argument.
* @param keyList the list to be filled with keys, can have any size.
* @param valueList the list to be filled with values, can have any size.
*/
@Override
public void pairsMatching(ByteObjectProcedure<T> condition,
ByteArrayList keyList,
List<T> valueList) {
keyList.clear();
valueList.clear();
for (int i = table.length; i-- > 0;) {
if (state[i] == FULL && condition.apply(table[i], values[i])) {
keyList.add(table[i]);
valueList.add(values[i]);
}
}
}
/**
* Associates the given key with the given value. Replaces any old <tt>(key,someOtherValue)</tt> association, if
* existing.
*
* @param key the key the value shall be associated with.
* @param value the value to be associated.
* @return <tt>true</tt> if the receiver did not already contain such a key; <tt>false</tt> if the receiver did
* already contain such a key - the new value has now replaced the formerly associated value.
*/
@Override
public boolean put(byte key, T value) {
int i = indexOfInsertion(key);
if (i < 0) { //already contained
i = -i - 1;
this.values[i] = value;
return false;
}
if (this.distinct > this.highWaterMark) {
int newCapacity = chooseGrowCapacity(this.distinct + 1, this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
return put(key, value);
}
this.table[i] = key;
this.values[i] = value;
if (this.state[i] == FREE) {
this.freeEntries--;
}
this.state[i] = FULL;
this.distinct++;
if (this.freeEntries < 1) { //delta
int newCapacity = chooseGrowCapacity(this.distinct + 1, this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
}
return true;
}
/**
* Rehashes the contents of the receiver into a new table with a smaller or larger capacity. This method is called
* automatically when the number of keys in the receiver exceeds the high water mark or falls below the low water
* mark.
*/
@SuppressWarnings("unchecked")
protected void rehash(int newCapacity) {
int oldCapacity = table.length;
//if (oldCapacity == newCapacity) return;
byte[] oldTable = table;
T[] oldValues = values;
byte[] oldState = state;
this.table = new byte[newCapacity];
this.values = (T[]) new Object[newCapacity];
this.state = new byte[newCapacity];
this.lowWaterMark = chooseLowWaterMark(newCapacity, this.minLoadFactor);
this.highWaterMark = chooseHighWaterMark(newCapacity, this.maxLoadFactor);
this.freeEntries = newCapacity - this.distinct; // delta
for (int i = oldCapacity; i-- > 0;) {
if (oldState[i] == FULL) {
byte element = oldTable[i];
int index = indexOfInsertion(element);
this.table[index] = element;
this.values[index] = oldValues[i];
this.state[index] = FULL;
}
}
}
/**
* Removes the given key with its associated element from the receiver, if present.
*
* @param key the key to be removed from the receiver.
* @return <tt>true</tt> if the receiver contained the specified key, <tt>false</tt> otherwise.
*/
@Override
public boolean removeKey(byte key) {
int i = indexOfKey(key);
if (i < 0) {
return false;
} // key not contained
this.state[i] = REMOVED;
this.values[i] = null; // delta
this.distinct--;
if (this.distinct < this.lowWaterMark) {
int newCapacity = chooseShrinkCapacity(this.distinct, this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
}
return true;
}
/**
* Initializes the receiver.
*
* @param initialCapacity the initial capacity of the receiver.
* @param minLoadFactor the minLoadFactor of the receiver.
* @param maxLoadFactor the maxLoadFactor of the receiver.
* @throws IllegalArgumentException if <tt>initialCapacity < 0 || (minLoadFactor < 0.0 || minLoadFactor >= 1.0) ||
* (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor >=
* maxLoadFactor)</tt>.
*/
@SuppressWarnings("unchecked")
@Override
protected void setUp(int initialCapacity, double minLoadFactor, double maxLoadFactor) {
int capacity = initialCapacity;
super.setUp(capacity, minLoadFactor, maxLoadFactor);
capacity = nextPrime(capacity);
if (capacity == 0) {
capacity = 1;
} // open addressing needs at least one FREE slot at any time.
this.table = new byte[capacity];
this.values = (T[]) new Object[capacity];
this.state = new byte[capacity];
// memory will be exhausted long before this pathological case happens, anyway.
this.minLoadFactor = minLoadFactor;
if (capacity == PrimeFinder.largestPrime) {
this.maxLoadFactor = 1.0;
} else {
this.maxLoadFactor = maxLoadFactor;
}
this.distinct = 0;
this.freeEntries = capacity; // delta
// lowWaterMark will be established upon first expansion.
// establishing it now (upon instance construction) would immediately make the table shrink upon first put(...).
// After all the idea of an "initialCapacity" implies violating lowWaterMarks when an object is young.
// See ensureCapacity(...)
this.lowWaterMark = 0;
this.highWaterMark = chooseHighWaterMark(capacity, this.maxLoadFactor);
}
/**
* Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An
* application can use this operation to minimize the storage of the receiver.
*/
@Override
public void trimToSize() {
// * 1.2 because open addressing's performance exponentially degrades beyond that point
// so that even rehashing the table can take very long
int newCapacity = nextPrime((int) (1 + 1.2 * size()));
if (table.length > newCapacity) {
rehash(newCapacity);
}
}
/**
* Fills all values contained in the receiver into the specified list. Fills the list, starting at index 0. After this
* call returns the specified list has a new size that equals <tt>this.size()</tt>.
* <p> This method can be used to
* iterate over the values of the receiver.
*
* @param list the list to be filled, can have any size.
*/
@Override
public void values(List<T> list) {
list.clear();
for (int i = state.length; i-- > 0;) {
if (state[i] == FULL) {
list.add(values[i]);
}
}
}
/**
* Access for unit tests.
* @param capacity
* @param minLoadFactor
* @param maxLoadFactor
*/
protected void getInternalFactors(int[] capacity,
double[] minLoadFactor,
double[] maxLoadFactor) {
capacity[0] = table.length;
minLoadFactor[0] = this.minLoadFactor;
maxLoadFactor[0] = this.maxLoadFactor;
}
}
| {
"content_hash": "25314aec6cebeef132a99895ff74e7af",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 121,
"avg_line_length": 35.061682242990656,
"alnum_prop": 0.6466041155773536,
"repo_name": "BigData-Lab-Frankfurt/HiBench-DSE",
"id": "59232b5d149903ba707d4ad886c00099fda75114",
"size": "19563",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "common/mahout-distribution-0.7-hadoop1/math/target/generated-sources/org/apache/mahout/math/map/OpenByteObjectHashMap.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "26324"
},
{
"name": "C++",
"bytes": "42301"
},
{
"name": "Erlang",
"bytes": "1451"
},
{
"name": "Java",
"bytes": "20935825"
},
{
"name": "PHP",
"bytes": "907744"
},
{
"name": "Perl",
"bytes": "557333"
},
{
"name": "Python",
"bytes": "811495"
},
{
"name": "Ruby",
"bytes": "5876"
},
{
"name": "Shell",
"bytes": "149193"
},
{
"name": "XSLT",
"bytes": "1431"
}
],
"symlink_target": ""
} |
#include "base/os.h"
#include <boost/assign/list_of.hpp>
#include <cfg/cfg_init.h>
#include <oper/operdb_init.h>
#include <controller/controller_init.h>
#include <controller/controller_ifmap.h>
#include <pkt/pkt_init.h>
#include <services/services_init.h>
#include <vrouter/ksync/ksync_init.h>
#include <cmn/agent_cmn.h>
#include <base/task.h>
#include <io/event_manager.h>
#include <base/util.h>
#include <oper/vn.h>
#include <oper/vm.h>
#include <oper/vm_interface.h>
#include <oper/agent_sandesh.h>
#include <oper/interface_common.h>
#include <oper/vxlan.h>
#include "vr_types.h"
#include "testing/gunit.h"
#include "test_cmn_util.h"
#include "xmpp/test/xmpp_test_util.h"
using namespace std;
using namespace boost::assign;
void RouterIdDepInit(Agent *agent) {
}
static void ValidateSandeshResponse(Sandesh *sandesh, vector<int> &result) {
//TBD
//Validate the response by the expectation
}
void DoInterfaceSandesh(std::string name) {
ItfReq *itf_req = new ItfReq();
std::vector<int> result = list_of(1);
Sandesh::set_response_callback(boost::bind(ValidateSandeshResponse, _1, result));
if (name != "") {
itf_req->set_name(name);
}
itf_req->HandleRequest();
client->WaitForIdle();
itf_req->Release();
client->WaitForIdle();
}
AgentIntfSandesh *CreateAgentIntfSandesh(const char *name) {
return new AgentIntfSandesh("", "", "vnet1", "", "", "", "", "", "",
"", "", "");
}
class CfgTest : public ::testing::Test {
public:
virtual void SetUp() {
agent_ = Agent::GetInstance();
}
virtual void TearDown() {
EXPECT_EQ(0U, Agent::GetInstance()->acl_table()->Size());
}
Agent *agent_;
};
TEST_F(CfgTest, AddDelVmPortNoVn_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
IntfCfgAdd(input, 0);
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(4U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, PortSubscribeSize(agent_));
client->Reset();
IntfCfgDel(input, 0);
client->WaitForIdle();
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(3U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, PortSubscribeSize(agent_));
}
TEST_F(CfgTest, AddDelExport) {
client->Reset();
boost::system::error_code ec;
Ip4Address ip = Ip4Address::from_string("1.1.1.1", ec);
PortSubscribe("vnet1", MakeUuid(1), MakeUuid(1), UuidToString(MakeUuid(1)),
MakeUuid(1), MakeUuid(kProjectUuid), ip, Ip6Address(),
"00:00:00:01:01:01");
client->WaitForIdle();
EXPECT_EQ(1U, PortSubscribeSize(agent_));
PortUnSubscribe(MakeUuid(1));
client->WaitForIdle();
EXPECT_EQ(0U, PortSubscribeSize(agent_));
}
TEST_F(CfgTest, AddDelVmPortDepOnVmVn_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
// Nova Port add message - Should be inactive since VM and VN not present
client->Reset();
IntfCfgAdd(input, 0);
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(4U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, PortSubscribeSize(agent_));
// Config VM Add - Port inactive since VN not present
AddVm("vm1", 1);
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
AddVrf("vrf1");
client->WaitForIdle();
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(VrfFind("vrf1"));
// Config VN Add - Port inactive since interface oper-db not aware of
// VM and VN added
AddVn("vn1", 1);
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_TRUE(VnFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
// Config Port add - Interface oper-db still inactive since no link between
// VN and VRF
client->Reset();
AddPort(input[0].name, input[0].intf_id);
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add VN and VRF link. Port in-active since not linked to VM and VN
client->Reset();
AddLink("virtual-network", "vn1", "routing-instance", "vrf1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add VM and Port link. Port in-active since port not linked to VN
client->Reset();
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
//EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
// Add Port to VN link - Port is active
client->Reset();
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
AddVmPortVrf("vnet1", "", 0);
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
client->Reset();
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
// Delete Port to VN link. Port is inactive
client->Reset();
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf1");
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
DelLink("instance-ip", "instance0", "virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vnet1");
client->WaitForIdle();
// Delete config port entry. Port still present but inactive
client->Reset();
DelLink("virtual-network", "vn1", "routing-instance", "vrf1");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface", "vnet1");
DelNode("virtual-machine", "vm1");
DelNode("virtual-network", "vn1");
client->WaitForIdle();
EXPECT_TRUE(VmPortFind(input, 0));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_FALSE(VmFind(1));
DelNode("routing-instance", "vrf1");
DelInstanceIp("instance0");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf1"));
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
client->WaitForIdle();
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(3U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(0U, PortSubscribeSize(agent_));
EXPECT_EQ(0U, Agent::GetInstance()->vn_table()->Size());
EXPECT_FALSE(VnFind(1));
}
TEST_F(CfgTest, AddDelVmPortDepOnVmVn_2) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
// Config VM Add - Port inactive since VN not present
client->Reset();
AddVm("vm1", 1);
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
// Nova Port add message - Should be inactive since VN not present
client->Reset();
IntfCfgAdd(input, 0);
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(4U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, PortSubscribeSize(agent_));
// Config VN Add - Port inactive since interface oper-db not aware of
// VM and VN added
AddVn("vn1", 1);
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_TRUE(VnFind(1));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
// Add link between VN and VRF. Interface still inactive
client->Reset();
AddVrf("vrf2");
AddLink("virtual-network", "vn1", "routing-instance", "vrf2");
client->WaitForIdle();
EXPECT_TRUE(VrfFind("vrf2"));
// Config Port add - Interface still inactive
client->Reset();
AddPort(input[0].name, input[0].intf_id);
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add Port to VM link - Port is inactive
client->Reset();
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add vm-port interface to vrf link
AddVmPortVrf("vnet1", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf2");
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add Port to VN link - Port is active
client->Reset();
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_TRUE(VmPortActive(input, 0));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf2");
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vnet1");
DelLink("instance-ip", "instance0", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(3U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, PortSubscribeSize(agent_));
client->Reset();
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelNode("virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
DelLink("virtual-network", "vn1", "routing-instance", "vrf2");
client->WaitForIdle();
DelNode("virtual-network", "vn1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
EXPECT_FALSE(VmFind(1));
EXPECT_FALSE(VmPortFind(input, 0));
DelNode("routing-instance", "vrf2");
DelInstanceIp("instance0");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf2"));
}
TEST_F(CfgTest, AddDelVmPortDepOnVmVn_3) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
// Nova Port add message - Should be inactive since VM and VN not present
client->Reset();
IntfCfgAdd(input, 0);
EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(4U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, PortSubscribeSize(agent_));
// Config VM Add - Port inactive since VN not present
AddVm("vm1", 1);
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
AddVrf("vrf1");
client->WaitForIdle();
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(VrfFind("vrf1"));
// Config VN Add - Port inactive since interface oper-db not aware of
// VM and VN added
AddVn("vn1", 1);
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_TRUE(VnFind(1));
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
// Config Port add - Interface oper-db still inactive since no link between
// VN and VRF
client->Reset();
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
client->Reset();
AddPort(input[0].name, input[0].intf_id);
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add vm-port interface to vrf link
AddVmPortVrf("vnet1", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf1");
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add VN and VRF link. Port in-active since not linked to VM and VN
client->Reset();
AddLink("virtual-network", "vn1", "routing-instance", "vrf1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add VM and Port link. Port in-active since port not linked to VN
client->Reset();
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
//EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
//Add instance ip configuration
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
//EXPECT_TRUE(client->PortNotifyWait(1));
EXPECT_TRUE(VmPortInactive(input, 0));
// Add Port to VN link - Port is active
client->Reset();
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_TRUE(VmPortActive(input, 0));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf1");
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
DelLink( "virtual-machine-interface", "vnet1", "instance-ip", "instance0");
DelNode("virtual-machine-interface-routing-instance", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
client->WaitForIdle();
// Delete VM and its associated links. INSTANCE_MSG is still not deleted
// Vmport should be inactive
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
DelLink("virtual-network", "vn1", "routing-instance", "vrf1");
DelNode("routing-instance", "vrf1");
DelNode("virtual-network", "vn1");
DelNode("virtual-machine-interface", "vnet1");
DelInstanceIp("instance0");
client->WaitForIdle();
IntfCfgDel(input, 0);
client->WaitForIdle();
}
// VN has ACL set before VM Port is created
TEST_F(CfgTest, VmPortPolicy_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
{"vnet2", 2, "1.1.1.2", "00:00:00:02:02:02", 1, 1},
};
client->Reset();
AddVm("vm1", 1);
client->WaitForIdle();
AddAcl("acl1", 1);
client->WaitForIdle();
AddVrf("vrf3");
client->WaitForIdle();
AddVn("vn1", 1);
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(1));
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->acl_table()->Size());
EXPECT_TRUE(VrfFind("vrf3"));
// Add vm-port interface to vrf link
AddVmPortVrf("vmvrf1", "", 0);
AddVmPortVrf("vmvrf2", "", 0);
client->WaitForIdle();
AddPort(input[0].name, input[0].intf_id);
AddPort(input[1].name, input[1].intf_id);
AddLink("virtual-network", "vn1", "routing-instance", "vrf3");
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "vrf3");
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
AddLink("virtual-machine-interface-routing-instance", "vmvrf2",
"routing-instance", "vrf3");
AddLink("virtual-machine-interface-routing-instance", "vmvrf2",
"virtual-machine-interface", "vnet2");
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddInstanceIp("instance1", input[0].vm_id, input[1].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
AddLink("virtual-machine-interface", input[1].name,
"instance-ip", "instance1");
client->WaitForIdle();
client->Reset();
IntfCfgAdd(input, 0);
IntfCfgAdd(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortActive(input, 1));
// Policy still enabled, since its based on disable_policy attribute
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
AddLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
client->Reset();
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(0));
EXPECT_TRUE(client->VnNotifyWait(1));
// Policy still enabled, since its based on disable_policy attribute
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
client->Reset();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(1));
EXPECT_EQ(0U, Agent::GetInstance()->acl_table()->Size());
// Del VN to VRF link. Port should become inactive
client->Reset();
DelLink("virtual-network", "vn1", "routing-instance", "vrf3");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortActive(input, 1));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "vrf3");
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vmvrf1");
DelLink("virtual-machine-interface-routing-instance", "vmvrf2",
"routing-instance", "vrf3");
DelLink("virtual-machine-interface-routing-instance", "vmvrf2",
"virtual-machine-interface", "vnet2");
DelNode("virtual-machine-interface-routing-instance", "vmvrf2");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_TRUE(VmPortInactive(input, 1));
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine-interface", input[0].name, "instance-ip",
"instance0");
DelLink("virtual-machine-interface", input[1].name, "instance-ip",
"instance1");
// Delete config vm entry - no-op for oper-db. Port is active
client->Reset();
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
// VM not deleted. Interface still refers to it
EXPECT_FALSE(VmFind(1));
client->Reset();
DelNode("virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface", "vnet2");
EXPECT_TRUE(client->PortNotifyWait(2));
//After deleting vmport interface config, verify config name is set to ""
const Interface *intf = VmPortGet(1);
const VmInterface *vm_intf = static_cast<const VmInterface *>(intf);
EXPECT_TRUE((vm_intf->cfg_name() == ""));
intf = VmPortGet(2);
vm_intf = static_cast<const VmInterface *>(intf);
EXPECT_TRUE((vm_intf->cfg_name() == ""));
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
IntfCfgDel(input, 1);
EXPECT_TRUE(client->PortDelNotifyWait(2));
EXPECT_FALSE(VmFind(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(3U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
DelNode("virtual-network", "vn1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
DelNode("routing-instance", "vrf3");
DelInstanceIp("instance0");
DelInstanceIp("instance1");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf3"));
}
// ACL added after VM Port is created
TEST_F(CfgTest, VmPortPolicy_2) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
{"vnet2", 2, "1.1.1.2", "00:00:00:02:02:02", 1, 1},
};
client->Reset();
AddVm("vm1", 1);
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
AddVn("vn1", 1);
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
client->Reset();
AddAcl("acl1", 1);
EXPECT_TRUE(client->AclNotifyWait(1));
client->Reset();
AddPort(input[0].name, input[0].intf_id);
AddPort(input[1].name, input[1].intf_id);
client->Reset();
IntfCfgAdd(input, 0);
IntfCfgAdd(input, 1);
EXPECT_TRUE(client->PortNotifyWait(2));
// Port inactive since VRF is not yet present
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_TRUE(VmPortInactive(input, 1));
/* Policy will be disabled because layer3_forwarding is false on that VMI.
* layer3_forwarding is false because VMI is not associated with VN */
EXPECT_FALSE(VmPortPolicyEnable(input, 0));
EXPECT_FALSE(VmPortPolicyEnable(input, 1));
EXPECT_EQ(5U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(2U, PortSubscribeSize(agent_));
AddVrf("vrf4");
client->WaitForIdle();
EXPECT_TRUE(VrfFind("vrf4"));
// Add vm-port interface to vrf link
AddVmPortVrf("vmvrf1", "", 0);
AddVmPortVrf("vmvrf2", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "vrf4");
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
AddLink("virtual-machine-interface-routing-instance", "vmvrf2",
"routing-instance", "vrf4");
AddLink("virtual-machine-interface-routing-instance", "vmvrf2",
"virtual-machine-interface", "vnet2");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
EXPECT_TRUE(VmPortInactive(input, 1));
AddLink("virtual-network", "vn1", "routing-instance", "vrf4");
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddInstanceIp("instance1", input[0].vm_id, input[1].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
AddLink("virtual-machine-interface", input[1].name,
"instance-ip", "instance1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortActive(input, 1));
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
client->Reset();
AddLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
client->Reset();
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(0));
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
client->Reset();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(1));
EXPECT_EQ(0U, Agent::GetInstance()->acl_table()->Size());
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "vrf4");
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vmvrf1");
DelLink("virtual-machine-interface-routing-instance", "vmvrf2",
"routing-instance", "vrf4");
DelLink("virtual-machine-interface-routing-instance", "vmvrf2",
"virtual-machine-interface", "vnet2");
DelNode("virtual-machine-interface-routing-instance", "vmvrf2");
client->WaitForIdle();
DelLink("virtual-network", "vn1", "routing-instance", "vrf4");
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine-interface", input[0].name, "instance-ip",
"instance0");
DelLink("virtual-machine-interface", input[1].name, "instance-ip",
"instance1");
// Delete config vm entry - no-op for oper-db. Port is active
client->Reset();
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_FALSE(VmFind(1));
EXPECT_TRUE(VmPortFind(input, 0));
EXPECT_EQ(5U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(2U, PortSubscribeSize(agent_));
DelPort(input[0].name);
DelPort(input[1].name);
client->Reset();
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
IntfCfgDel(input, 1);
EXPECT_TRUE(client->PortDelNotifyWait(2));
EXPECT_FALSE(VmFind(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(3U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
// Del VN to VRF link. Port should become inactive
client->Reset();
DelNode("virtual-network", "vn1");
DelInstanceIp("instance0");
DelInstanceIp("instance1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
DelNode("routing-instance", "vrf4");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf4"));
}
TEST_F(CfgTest, VnDepOnVrfAcl_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
{"vnet2", 2, "1.1.1.2", "00:00:00:02:02:02", 1, 1},
};
client->Reset();
AddVm("vm1", 1);
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
client->Reset();
AddVrf("vrf5");
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(VrfFind("vrf5"));
AddVn("vn1", 1);
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
client->Reset();
AddAcl("acl1", 1);
EXPECT_TRUE(client->AclNotifyWait(1));
AddLink("virtual-network", "vn1", "routing-instance", "vrf5");
client->WaitForIdle();
VnEntry *vn = VnGet(1);
EXPECT_TRUE(vn->GetVrf() != NULL);
EXPECT_TRUE(vn->GetAcl() == NULL);
AddLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(vn->GetVrf() != NULL);
EXPECT_TRUE(vn->GetAcl() != NULL);
AddPort(input[0].name, input[0].intf_id);
AddPort(input[1].name, input[1].intf_id);
client->Reset();
client->Reset();
IntfCfgAdd(input, 0);
IntfCfgAdd(input, 1);
EXPECT_TRUE(client->PortNotifyWait(2));
// Add vm-port interface to vrf link
AddVmPortVrf("vnet1", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf5");
AddLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Add vm-port interface to vrf link
AddVmPortVrf("vnet2", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vnet2",
"routing-instance", "vrf5");
AddLink("virtual-machine-interface-routing-instance", "vnet2",
"virtual-machine-interface", "vnet2");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 1));
// Port Active since VRF and VM already added
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddInstanceIp("instance1", input[0].vm_id, input[1].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
AddLink("virtual-machine-interface", input[1].name,
"instance-ip", "instance1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortActive(input, 1));
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
EXPECT_EQ(5U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(2U, PortSubscribeSize(agent_));
client->Reset();
AddLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortActive(input, 1));
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"routing-instance", "vrf5");
DelLink("virtual-machine-interface-routing-instance", "vnet1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 0));
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnet2",
"routing-instance", "vrf5");
DelLink("virtual-machine-interface-routing-instance", "vnet2",
"virtual-machine-interface", "vnet2");
DelNode("virtual-machine-interface-routing-instance", "vnet2");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(input, 1));
client->Reset();
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_TRUE(VmPortPolicyEnable(input, 0));
EXPECT_TRUE(VmPortPolicyEnable(input, 1));
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet2");
DelLink("virtual-machine-interface", input[0].name, "instance-ip",
"instance0");
DelLink("virtual-machine-interface", input[1].name, "instance-ip",
"instance1");
client->WaitForIdle();
DelPort(input[0].name);
DelPort(input[1].name);
client->Reset();
client->Reset();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
EXPECT_TRUE(client->AclNotifyWait(1));
EXPECT_EQ(0U, Agent::GetInstance()->acl_table()->Size());
// Delete config vm entry - no-op for oper-db. Port is active
client->Reset();
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_FALSE(VmFind(1));
EXPECT_TRUE(VmPortFind(input, 0));
EXPECT_EQ(5U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(2U, PortSubscribeSize(agent_));
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
IntfCfgDel(input, 1);
EXPECT_TRUE(client->PortNotifyWait(2));
EXPECT_FALSE(VmFind(1));
EXPECT_FALSE(VmPortFind(input, 0));
WAIT_FOR(100, 1000,
(3U == Agent::GetInstance()->interface_table()->Size()));
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
// Del VN to VRF link. Port should become inactive
client->Reset();
DelLink("virtual-network", "vn1", "routing-instance", "vrf5");
DelNode("virtual-network", "vn1");
DelInstanceIp("instance0");
DelInstanceIp("instance1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
DelNode("routing-instance", "vrf5");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf5"));
}
//TBD
//Reduce the waitforidle to improve on timing of UT
TEST_F(CfgTest, FloatingIp_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
client->WaitForIdle();
client->Reset();
AddVm("vm1", 1);
client->WaitForIdle();
EXPECT_TRUE(client->VmNotifyWait(1));
EXPECT_TRUE(VmFind(1));
client->Reset();
AddVrf("vrf6");
client->WaitForIdle();
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(VrfFind("vrf6"));
AddVn("vn1", 1);
client->WaitForIdle();
EXPECT_TRUE(client->VnNotifyWait(1));
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
AddLink("virtual-network", "vn1", "routing-instance", "vrf6");
client->WaitForIdle();
client->Reset();
IntfCfgAdd(input, 0);
client->WaitForIdle();
EXPECT_TRUE(client->PortNotifyWait(1));
AddPort(input[0].name, input[0].intf_id);
client->WaitForIdle();
// Create floating-ip on default-project:vn2
client->Reset();
AddVn("default-project:vn2", 2);
client->WaitForIdle();
EXPECT_TRUE(client->VnNotifyWait(1));
AddVrf("default-project:vn2:vn2");
AddVrf("vrf8");
client->WaitForIdle();
EXPECT_TRUE(client->VrfNotifyWait(2));
EXPECT_TRUE(VrfFind("default-project:vn2:vn2"));
EXPECT_TRUE(VrfFind("vrf8"));
AddFloatingIpPool("fip-pool1", 1);
AddFloatingIp("fip1", 1, "1.1.1.1");
AddFloatingIp("fip3", 3, "2.2.2.5");
AddFloatingIp("fip4", 4, "2.2.2.1");
client->WaitForIdle();
AddLink("virtual-network", "default-project:vn2", "routing-instance",
"default-project:vn2:vn2");
AddLink("floating-ip-pool", "fip-pool1", "virtual-network",
"default-project:vn2");
AddLink("floating-ip", "fip1", "floating-ip-pool", "fip-pool1");
AddLink("floating-ip", "fip3", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
AddLink("floating-ip", "fip4", "floating-ip-pool", "fip-pool1");
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip1");
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip3");
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip4");
client->WaitForIdle();
LOG(DEBUG, "Adding Floating-ip fip2");
AddFloatingIp("fip2", 2, "2.2.2.2");
client->WaitForIdle();
// Port Active since VRF and VM already added
client->Reset();
AddLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
AddLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
// Add vm-port interface to vrf link
AddVmPortVrf("vnvrf1", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vnvrf1",
"routing-instance", "vrf6");
AddLink("virtual-machine-interface-routing-instance", "vnvrf1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(VmPortFloatingIpCount(1, 3));
LOG(DEBUG, "Link fip2 to fip-pool1");
AddLink("floating-ip", "fip2", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip2");
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip3");
DelLink("floating-ip", "fip3", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelNode("floating-ip", "fip3");
client->WaitForIdle();
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip4");
DelLink("floating-ip", "fip4", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelNode("floating-ip", "fip4");
client->WaitForIdle();
EXPECT_TRUE(VmPortFloatingIpCount(1, 2));
DelLink("virtual-network", "vn1", "routing-instance", "vrf6");
client->WaitForIdle();
DelLink("virtual-network", "default-project:vn2", "routing-instance",
"default-project:vn2:vn2");
client->WaitForIdle();
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip1");
client->WaitForIdle();
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip2");
client->WaitForIdle();
DelLink("floating-ip", "fip1", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelLink("floating-ip", "fip2", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelLink("virtual-network", "default-project:vn2", "floating-ip-pool",
"fip-pool1");
client->WaitForIdle();
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelLink("virtual-machine-interface", input[0].name, "instance-ip",
"instance1");
client->WaitForIdle();
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vnvrf1",
"routing-instance", "vrf6");
DelLink("virtual-machine-interface-routing-instance", "vnvrf1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vnvrf1");
client->WaitForIdle();
DelNode("floating-ip", "fip1");
client->WaitForIdle();
DelNode("floating-ip", "fip2");
client->WaitForIdle();
EXPECT_TRUE(VmPortFloatingIpCount(1, 0));
DelNode("floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelNode("routing-instance", "vrf6");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf6"));
DelNode("routing-instance", "default-project:vn2:vn2");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("default-project:vn2:vn2"));
DelNode("routing-instance", "vrf8");
client->WaitForIdle();
EXPECT_FALSE(VrfFind("vrf8"));
DelNode("virtual-network", "vn1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
DelNode("virtual-network", "default-project:vn2");
client->WaitForIdle();
EXPECT_FALSE(VnFind(2));
DelNode("virtual-machine", "vm1");
DelLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
DelInstanceIp("instance0");
client->WaitForIdle();
EXPECT_FALSE(VmFind(1));
IntfCfgDel(input, 0);
client->WaitForIdle();
EXPECT_FALSE(VmPortFind(input, 0));
#if 0
DelLink("virtual-network", "vn1", "virtual-machine-interface", "vnet1");
DelLink("virtual-machine", "vm1", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
LOG(DEBUG, "Cleanup implementation pending...");
// Delete config vm entry - no-op for oper-db. Port is active
client->Reset();
DelNode("virtual-machine", "vm1");
client->WaitForIdle();
EXPECT_TRUE(VnFind(1));
EXPECT_FALSE(VmFind(1));
EXPECT_TRUE(VmPortFind(input, 0));
EXPECT_EQ(4U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(2U, PortSubscribeSize(agent_));
// Delete Nova Port entry.
client->Reset();
IntfCfgDel(input, 0);
IntfCfgDel(input, 1);
EXPECT_TRUE(client->PortNotifyWait(2));
EXPECT_FALSE(VmFind(1));
EXPECT_FALSE(VmPortFind(input, 0));
EXPECT_EQ(2U, Agent::GetInstance()->interface_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
EXPECT_EQ(1U, Agent::GetInstance()->vn_table()->Size());
EXPECT_EQ(0U, Agent::GetInstance()->vm_table()->Size());
// Del VN to VRF link. Port should become inactive
client->Reset();
DelLink("virtual-network", "vn1", "routing-instance", "vrf5");
DelNode("virtual-network", "vn1");
client->WaitForIdle();
EXPECT_FALSE(VnFind(1));
#endif
}
TEST_F(CfgTest, Basic_1) {
string eth_intf = "eth10";
string vrf_name = "__non_existent_vrf__";
//char buff[4096];
//int len = 0;
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 5, 5},
};
PhysicalInterfaceKey key(eth_intf);
PhysicalInterface *phy_intf = NULL;
client->Reset();
PhysicalInterface::CreateReq(Agent::GetInstance()->interface_table(),
eth_intf, Agent::GetInstance()->fabric_vrf_name(),
PhysicalInterface::FABRIC,
PhysicalInterface::ETHERNET, false,
boost::uuids::nil_uuid(), Ip4Address(0),
Interface::TRANSPORT_ETHERNET);
client->WaitForIdle();
phy_intf = static_cast<PhysicalInterface *>
(agent_->interface_table()->FindActiveEntry(&key));
EXPECT_TRUE(phy_intf->persistent() == false);
EXPECT_TRUE(phy_intf->subtype() == PhysicalInterface::FABRIC);
InetInterface::CreateReq(Agent::GetInstance()->interface_table(),
"vhost10", InetInterface::VHOST,
Agent::GetInstance()->fabric_vrf_name(),
Ip4Address(0), 0, Ip4Address(0), eth_intf, "",
Interface::TRANSPORT_ETHERNET);
client->WaitForIdle();
AddVn("default-project:vn5", 5);
client->WaitForIdle();
EXPECT_TRUE(client->VnNotifyWait(1));
AddVm("vm5", 5);
client->WaitForIdle();
EXPECT_TRUE(client->VmNotifyWait(1));
AddVrf("default-project:vn5:vn5");
client->WaitForIdle();
EXPECT_TRUE(client->VrfNotifyWait(1));
EXPECT_TRUE(VrfFind("default-project:vn5:vn5"));
AddFloatingIpPool("fip-pool1", 1);
AddFloatingIp("fip1", 1, "10.10.10.1");
AddFloatingIp("fip2", 2, "2.2.2.2");
AddFloatingIp("fip3", 3, "30.30.30.1");
client->WaitForIdle();
IntfCfgAdd(input, 0);
client->WaitForIdle();
AddPort(input[0].name, input[0].intf_id);
client->WaitForIdle();
AddLink("virtual-network", "default-project:vn5", "routing-instance",
"default-project:vn5:vn5");
client->WaitForIdle();
AddLink("floating-ip-pool", "fip-pool1", "virtual-network",
"default-project:vn5");
client->WaitForIdle();
AddLink("floating-ip", "fip1", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
AddLink("floating-ip", "fip2", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
AddLink("floating-ip", "fip3", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip2");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip3");
client->WaitForIdle();
AddLink("virtual-network", "default-project:vn5", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
AddLink("virtual-machine", "vm5", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
AddInstanceIp("instance0", input[0].vm_id, input[0].addr);
AddLink("virtual-machine-interface", input[0].name,
"instance-ip", "instance0");
client->WaitForIdle();
// Add vm-port interface to vrf link
AddVmPortVrf("vmvrf1", "", 0);
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "default-project:vn5:vn5");
AddLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
client->WaitForIdle();
std::vector<int> result = list_of(1);
Sandesh::set_response_callback(boost::bind(ValidateSandeshResponse, _1, result));
AgentSandeshPtr sand_1(CreateAgentIntfSandesh("vnet1"));
sand_1->DoSandesh(sand_1);
client->WaitForIdle();
AgentSandeshPtr sand_2(CreateAgentIntfSandesh("eth10"));
sand_2->DoSandesh(sand_2);
client->WaitForIdle();
AgentSandeshPtr sand_3(CreateAgentIntfSandesh("pkt0"));
sand_3->DoSandesh(sand_3);
client->WaitForIdle();
AgentSandeshPtr sand_4(CreateAgentIntfSandesh("vhost10"));
sand_4->DoSandesh(sand_4);
client->WaitForIdle();
AgentSandeshPtr sand_5(CreateAgentIntfSandesh("vhost10"));
sand_5->DoSandesh(sand_5, 0, 1);
client->WaitForIdle();
InetInterface::DeleteReq(Agent::GetInstance()->interface_table(),
"vhost10");
client->WaitForIdle();
PhysicalInterface::DeleteReq(Agent::GetInstance()->interface_table(),
eth_intf);
client->WaitForIdle();
client->Reset();
DelLink("virtual-network", "default-project:vn5", "routing-instance",
"default-project:vn5:vn5");
client->WaitForIdle();
DelLink("floating-ip-pool", "fip-pool1", "virtual-network",
"default-project:vn5");
client->WaitForIdle();
DelLink("floating-ip", "fip1", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelLink("floating-ip", "fip2", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelLink("floating-ip", "fip3", "floating-ip-pool", "fip-pool1");
client->WaitForIdle();
DelNode("floating-ip-pool", "fip-pool1");
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip1");
client->WaitForIdle();
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip2");
client->WaitForIdle();
DelLink("virtual-machine-interface", "vnet1", "floating-ip", "fip3");
client->WaitForIdle();
DelLink("virtual-network", "default-project:vn5", "virtual-machine-interface",
"vnet1");
client->WaitForIdle();
DelLink("virtual-machine", "vm5", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
DelLink("instance-ip", "instance0", "virtual-machine-interface", "vnet1");
client->WaitForIdle();
// Delete virtual-machine-interface to vrf link attribute
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"routing-instance", "default-project:vn5:vn5");
DelLink("virtual-machine-interface-routing-instance", "vmvrf1",
"virtual-machine-interface", "vnet1");
DelNode("virtual-machine-interface-routing-instance", "vmvrf1");
client->WaitForIdle();
client->Reset();
IntfCfgDel(input, 0);
DelPort(input[0].name);
client->WaitForIdle();
client->Reset();
DelNode("floating-ip", "fip1");
DelNode("floating-ip", "fip2");
DelNode("floating-ip", "fip3");
client->WaitForIdle();
DelNode("virtual-machine", "vm5");
client->WaitForIdle();
DelNode("routing-instance", "default-project:vn5:vn5");
DelInstanceIp("instance0");
client->WaitForIdle();
DelNode("virtual-network", "default-project:vn5");
client->WaitForIdle();
WAIT_FOR(1000, 1000, (0 == Agent::GetInstance()->vm_table()->Size()));
WAIT_FOR(1000, 1000, (VnFind(5) == false));
WAIT_FOR(1000, 1000, (VmFind(5) == false));
}
TEST_F(CfgTest, Basic_2) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1}
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.10", true},
};
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
VmInterfaceKey key(AgentKey::ADD_DEL_CHANGE, MakeUuid(1), "");
VmInterface *intf = static_cast<VmInterface *>
(Agent::GetInstance()->interface_table()->FindActiveEntry(&key));
EXPECT_TRUE(intf != NULL);
if (intf == NULL) {
return;
}
InetUnicastAgentRouteTable *table =
Agent::GetInstance()->fabric_inet4_unicast_table();
InetUnicastRouteEntry *rt = static_cast<InetUnicastRouteEntry *>
(table->FindRoute(intf->mdata_ip_addr()));
EXPECT_TRUE(rt != NULL);
if (rt == NULL) {
return;
}
const NextHop *nh = rt->GetActiveNextHop();
EXPECT_TRUE(nh != NULL);
if (nh == NULL) {
return;
}
EXPECT_TRUE(nh->PolicyEnabled());
Ip4Address addr = Ip4Address::from_string("1.1.1.1");
table = static_cast<InetUnicastAgentRouteTable *>
(Agent::GetInstance()->vrf_table()->GetInet4UnicastRouteTable("vrf1"));
rt = table->FindRoute(addr);
EXPECT_TRUE(rt != NULL);
if (rt == NULL) {
return;
}
nh = rt->GetActiveNextHop();
EXPECT_TRUE(nh != NULL);
if (nh == NULL) {
return;
}
EXPECT_TRUE(nh->PolicyEnabled());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
DelIPAM("vn1");
client->WaitForIdle();
EXPECT_FALSE(VmPortFind(1));
}
TEST_F(CfgTest, SecurityGroup_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1}
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.10", true},
};
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
AddSg("sg1", 1);
AddAcl("acl1", 1);
AddLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
client->WaitForIdle();
VmInterfaceKey key(AgentKey::ADD_DEL_CHANGE, MakeUuid(1), "");
VmInterface *intf = static_cast<VmInterface *>
(Agent::GetInstance()->interface_table()->FindActiveEntry(&key));
EXPECT_TRUE(intf != NULL);
if (intf == NULL) {
return;
}
EXPECT_TRUE(intf->sg_list().list_.size() == 1);
DoInterfaceSandesh("vnet1");
Ip4Address addr(Ip4Address::from_string("1.1.1.1"));
InetUnicastAgentRouteTable *table =
static_cast<InetUnicastAgentRouteTable *>
(Agent::GetInstance()->vrf_table()->GetInet4UnicastRouteTable("vrf1"));
InetUnicastRouteEntry *rt = table->FindRoute(addr);
EXPECT_TRUE(rt != NULL);
if (rt == NULL) {
return;
}
const AgentPath *path = rt->GetActivePath();
EXPECT_EQ(path->sg_list().size(), 1);
EXPECT_TRUE(path->vxlan_id() == VxLanTable::kInvalidvxlan_id);
EXPECT_TRUE(path->tunnel_bmap() == TunnelType::MplsType());
DoInterfaceSandesh("vnet1");
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
DelLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
DelLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, true);
DelNode("security-group", "sg1");
DelIPAM("vn1");
client->WaitForIdle();
EXPECT_FALSE(VmPortFind(1));
}
TEST_F(CfgTest, SecurityGroup_ignore_invalid_sgid_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1}
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.10", true},
};
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
AddSg("sg1", 1, 0);
AddAcl("acl1", 1);
AddLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
client->WaitForIdle();
//Query for SG
SgKey *key = new SgKey(MakeUuid(1));
const SgEntry *sg_entry =
static_cast<const SgEntry *>(Agent::GetInstance()->sg_table()->
FindActiveEntry(key));
EXPECT_TRUE(sg_entry == NULL);
//Modify SGID
AddSg("sg1", 1, 2);
client->WaitForIdle();
sg_entry = static_cast<const SgEntry *>(Agent::GetInstance()->sg_table()->
FindActiveEntry(key));
EXPECT_TRUE(sg_entry != NULL);
EXPECT_TRUE(sg_entry->GetSgId() == 2);
AddSg("sg1", 1, 3);
client->WaitForIdle();
sg_entry = static_cast<const SgEntry *>(Agent::GetInstance()->sg_table()->
FindActiveEntry(key));
EXPECT_TRUE(sg_entry != NULL);
EXPECT_TRUE(sg_entry->GetSgId() == 3);
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
DelLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
DelLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, true);
DelNode("security-group", "sg1");
DelIPAM("vn1");
client->WaitForIdle();
delete key;
EXPECT_FALSE(VmPortFind(1));
}
// Test invalid sgid with interface update
TEST_F(CfgTest, SecurityGroup_ignore_invalid_sgid_2) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1}
};
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
AddSg("sg1", 1, 0);
AddAcl("acl1", 1);
AddLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
AddLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
client->WaitForIdle();
VmInterfaceKey key(AgentKey::ADD_DEL_CHANGE, MakeUuid(1), "");
VmInterface *intf = static_cast<VmInterface *>
(Agent::GetInstance()->interface_table()->FindActiveEntry(&key));
EXPECT_TRUE(intf != NULL);
if (intf == NULL) {
return;
}
EXPECT_TRUE(intf->sg_list().list_.size() == 0);
// Add with proper sg id
AddSg("sg1", 1, 1);
client->WaitForIdle();
EXPECT_TRUE(intf->sg_list().list_.size() == 1);
VmInterface::SecurityGroupEntrySet::const_iterator it =
intf->sg_list().list_.begin();
EXPECT_TRUE(it->sg_.get() != NULL);
EXPECT_TRUE(it->sg_->GetSgId() == 1);
DelLink("virtual-network", "vn1", "access-control-list", "acl1");
DelLink("virtual-machine-interface", "vnet1", "security-group", "sg1");
DelLink("security-group", "sg1", "access-control-list", "acl1");
client->WaitForIdle();
DelNode("access-control-list", "acl1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, true);
DelNode("security-group", "sg1");
client->WaitForIdle();
EXPECT_FALSE(VmPortFind(1));
}
int main(int argc, char **argv) {
GETUSERARGS();
client = TestInit(init_file, ksync_init);
int ret = RUN_ALL_TESTS();
TestShutdown();
delete client;
return ret;
}
| {
"content_hash": "1c757f563ef41d987d94669c05321ae4",
"timestamp": "",
"source": "github",
"line_count": 1586,
"max_line_length": 92,
"avg_line_length": 36.555485498108446,
"alnum_prop": 0.6332166203839453,
"repo_name": "rombie/contrail-controller",
"id": "95b3036365b3126a7e3e0139d630e7826f14ecdb",
"size": "58049",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vnsw/agent/test/test_vmport_cfg.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "722850"
},
{
"name": "C++",
"bytes": "22461123"
},
{
"name": "GDB",
"bytes": "39260"
},
{
"name": "Go",
"bytes": "59593"
},
{
"name": "Java",
"bytes": "91653"
},
{
"name": "Lua",
"bytes": "13345"
},
{
"name": "PowerShell",
"bytes": "2391"
},
{
"name": "Python",
"bytes": "7791777"
},
{
"name": "Roff",
"bytes": "41295"
},
{
"name": "Ruby",
"bytes": "13596"
},
{
"name": "Shell",
"bytes": "52086"
}
],
"symlink_target": ""
} |
import {NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {FormsModule} from "@angular/forms";
import {HttpModule} from "@angular/http";
import {routing} from "./routing";
import {AppComponent} from "./component_app";
import {ConfigComponent, TweetsComponent, TweetColumnComponent} from "./component_tweets";
import {MainViewService} from "./service_mainview";
import { LocalStorageModule } from 'angular-2-local-storage';
@NgModule({
imports: [
LocalStorageModule.withConfig({
prefix: 'twittertrack',
storageType: 'localStorage'
}),
BrowserModule,
FormsModule,
HttpModule,
routing
],
declarations: [
AppComponent,
TweetsComponent,
ConfigComponent,
TweetColumnComponent
],
providers: [MainViewService],
bootstrap: [AppComponent]
})
export class AppModule {
}
| {
"content_hash": "e0349b8ea533dbf0781918840019eb05",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 90,
"avg_line_length": 26.055555555555557,
"alnum_prop": 0.664179104477612,
"repo_name": "tveronezi/twittertrack",
"id": "fd8f8dbc7149b867a2e7de091d4d60aa457ea6e3",
"size": "938",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/static/src/app/scripts/module_app.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2072"
},
{
"name": "Groovy",
"bytes": "4305"
},
{
"name": "HTML",
"bytes": "1819"
},
{
"name": "JavaScript",
"bytes": "4746"
},
{
"name": "TypeScript",
"bytes": "7173"
}
],
"symlink_target": ""
} |
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("jspdf"));
else if(typeof define === 'function' && define.amd)
define(["jspdf"], factory);
else {
var a = typeof exports === 'object' ? factory(require("jspdf")) : factory(root["jsPDF"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function(__WEBPACK_EXTERNAL_MODULE__4__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var defaultsDocument = null;
var previousTableState;
var tableState = null;
exports.globalDefaults = {};
exports.documentDefaults = {};
function default_1() {
return tableState;
}
exports.default = default_1;
function getGlobalOptions() {
return exports.globalDefaults;
}
exports.getGlobalOptions = getGlobalOptions;
function getDocumentOptions() {
return exports.documentDefaults;
}
exports.getDocumentOptions = getDocumentOptions;
var TableState = /** @class */ (function () {
function TableState(doc) {
this.doc = doc;
}
TableState.prototype.pageHeight = function () {
return this.pageSize().height;
};
;
TableState.prototype.pageWidth = function () {
return this.pageSize().width;
};
;
TableState.prototype.pageSize = function () {
var pageSize = this.doc.internal.pageSize;
// JSPDF 1.4 uses get functions instead of properties on pageSize
if (pageSize.width == null) {
pageSize = {
width: pageSize.getWidth(),
height: pageSize.getHeight()
};
}
return pageSize;
};
;
TableState.prototype.scaleFactor = function () {
return this.doc.internal.scaleFactor;
};
;
TableState.prototype.pageNumber = function () {
return this.doc.internal.getCurrentPageInfo().pageNumber;
};
return TableState;
}());
function setupState(doc) {
previousTableState = tableState;
tableState = new TableState(doc);
if (doc !== defaultsDocument) {
defaultsDocument = doc;
exports.documentDefaults = {};
}
}
exports.setupState = setupState;
function resetState() {
tableState = previousTableState;
}
exports.resetState = resetState;
function setDefaults(defaults, doc) {
if (doc === void 0) { doc = null; }
if (doc) {
exports.documentDefaults = defaults || {};
defaultsDocument = doc;
}
else {
exports.globalDefaults = defaults || {};
}
}
exports.setDefaults = setDefaults;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = __webpack_require__(2);
var state_1 = __webpack_require__(0);
var polyfills_1 = __webpack_require__(3);
function getStringWidth(text, styles) {
var fontSize = styles.fontSize / state_1.default().scaleFactor();
applyStyles(styles);
text = Array.isArray(text) ? text : [text];
var maxWidth = 0;
text.forEach(function (line) {
var width = state_1.default().doc.getStringUnitWidth(line);
if (width > maxWidth) {
maxWidth = width;
}
});
var precision = 10000 * state_1.default().scaleFactor();
maxWidth = Math.floor(maxWidth * precision) / precision;
return maxWidth * fontSize;
}
exports.getStringWidth = getStringWidth;
/**
* Ellipsize the text to fit in the width
*/
function ellipsize(text, width, styles, ellipsizeStr) {
if (ellipsizeStr === void 0) { ellipsizeStr = '...'; }
if (Array.isArray(text)) {
var value_1 = [];
text.forEach(function (str, i) {
value_1[i] = ellipsize(str, width, styles, ellipsizeStr);
});
return value_1;
}
var precision = 10000 * state_1.default().scaleFactor();
width = Math.ceil(width * precision) / precision;
if (width >= getStringWidth(text, styles)) {
return text;
}
while (width < getStringWidth(text + ellipsizeStr, styles)) {
if (text.length <= 1) {
break;
}
text = text.substring(0, text.length - 1);
}
return text.trim() + ellipsizeStr;
}
exports.ellipsize = ellipsize;
function addTableBorder() {
var table = state_1.default().table;
var styles = { lineWidth: table.settings.tableLineWidth, lineColor: table.settings.tableLineColor };
applyStyles(styles);
var fs = getFillStyle(styles);
if (fs) {
state_1.default().doc.rect(table.pageStartX, table.pageStartY, table.width, table.cursor.y - table.pageStartY, fs);
}
}
exports.addTableBorder = addTableBorder;
function getFillStyle(styles) {
var drawLine = styles.lineWidth > 0;
var drawBackground = styles.fillColor || styles.fillColor === 0;
if (drawLine && drawBackground) {
return 'DF'; // Fill then stroke
}
else if (drawLine) {
return 'S'; // Only stroke (transparent background)
}
else if (drawBackground) {
return 'F'; // Only fill, no stroke
}
else {
return false;
}
}
exports.getFillStyle = getFillStyle;
function applyUserStyles() {
applyStyles(state_1.default().table.userStyles);
}
exports.applyUserStyles = applyUserStyles;
function applyStyles(styles) {
var doc = state_1.default().doc;
var styleModifiers = {
fillColor: doc.setFillColor,
textColor: doc.setTextColor,
fontStyle: doc.setFontStyle,
lineColor: doc.setDrawColor,
lineWidth: doc.setLineWidth,
font: doc.setFont,
fontSize: doc.setFontSize
};
Object.keys(styleModifiers).forEach(function (name) {
var style = styles[name];
var modifier = styleModifiers[name];
if (typeof style !== 'undefined') {
if (Array.isArray(style)) {
modifier.apply(this, style);
}
else {
modifier(style);
}
}
});
}
exports.applyStyles = applyStyles;
// This is messy, only keep array and number format the next major version
function marginOrPadding(value, defaultValue) {
var newValue = {};
if (Array.isArray(value)) {
if (value.length >= 4) {
newValue = { 'top': value[0], 'right': value[1], 'bottom': value[2], 'left': value[3] };
}
else if (value.length === 3) {
newValue = { 'top': value[0], 'right': value[1], 'bottom': value[2], 'left': value[1] };
}
else if (value.length === 2) {
newValue = { 'top': value[0], 'right': value[1], 'bottom': value[0], 'left': value[1] };
}
else if (value.length === 1) {
value = value[0];
}
else {
value = defaultValue;
}
}
else if (typeof value === 'object') {
if (value['vertical']) {
value['top'] = value['vertical'];
value['bottom'] = value['vertical'];
}
if (value['horizontal']) {
value['right'] = value['horizontal'];
value['left'] = value['horizontal'];
}
for (var _i = 0, _a = ['top', 'right', 'bottom', 'left']; _i < _a.length; _i++) {
var side = _a[_i];
newValue[side] = (value[side] || value[side] === 0) ? value[side] : defaultValue;
}
}
if (typeof value === 'number') {
newValue = { 'top': value, 'right': value, 'bottom': value, 'left': value };
}
return newValue;
}
exports.marginOrPadding = marginOrPadding;
function styles(styles) {
styles = Array.isArray(styles) ? styles : [styles];
return polyfills_1.assign.apply(void 0, [config_1.defaultStyles()].concat(styles));
}
exports.styles = styles;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Ratio between font size and font height. The number comes from jspdf's source code
*/
exports.FONT_ROW_RATIO = 1.15;
var state_1 = __webpack_require__(0);
function defaultConfig() {
return {
// Html content
html: null,
// Custom content
head: null,
body: null,
foot: null,
// Properties
includeHiddenHtml: false,
startY: null,
margin: 40 / state_1.default().scaleFactor(),
pageBreak: 'auto',
rowPageBreak: 'auto',
tableWidth: 'auto',
showHead: 'everyPage',
showFoot: 'everyPage',
tableLineWidth: 0,
tableLineColor: 200,
tableId: null,
// Styling
theme: 'striped',
useCss: false,
styles: {},
headStyles: {},
bodyStyles: {},
footStyles: {},
alternateRowStyles: {},
columnStyles: {},
// Hooks
// Use to change the content of the cell before width calculations etc are performed
didParseCell: function (data) {
},
willDrawCell: function (data) {
},
// Use to draw additional content such as images in table cells
didDrawCell: function (data) {
},
// Use to draw additional content to each page such as headers and footers
didDrawPage: function (data) {
},
};
}
exports.defaultConfig = defaultConfig;
// Base style for all themes
function defaultStyles() {
return {
font: "helvetica",
fontStyle: 'normal',
overflow: 'linebreak',
fillColor: false,
textColor: 20,
halign: 'left',
valign: 'top',
fontSize: 10,
cellPadding: 5 / state_1.default().scaleFactor(),
lineColor: 200,
lineWidth: 0 / state_1.default().scaleFactor(),
cellWidth: 'auto',
minCellHeight: 0
};
}
exports.defaultStyles = defaultStyles;
/**
* Styles for the themes (overriding the default styles)
*/
function getTheme(name) {
var themes = {
'striped': {
table: { fillColor: 255, textColor: 80, fontStyle: 'normal' },
head: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },
body: {},
foot: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },
alternateRow: { fillColor: 245 }
},
'grid': {
table: { fillColor: 255, textColor: 80, fontStyle: 'normal', lineWidth: 0.1 },
head: { textColor: 255, fillColor: [26, 188, 156], fontStyle: 'bold', lineWidth: 0 },
body: {},
foot: { textColor: 255, fillColor: [26, 188, 156], fontStyle: 'bold', lineWidth: 0 },
alternateRow: {}
},
'plain': {
head: { fontStyle: 'bold' },
foot: { fontStyle: 'bold' }
}
};
return themes[name];
}
exports.getTheme = getTheme;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
* Include common small polyfills instead of requiring the user to to do it
*/
Object.defineProperty(exports, "__esModule", { value: true });
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
function assign(target) {
'use strict';
var varArgs = [];
for (var _i = 1; _i < arguments.length; _i++) {
varArgs[_i - 1] = arguments[_i];
}
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
}
exports.assign = assign;
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tableDrawer_1 = __webpack_require__(6);
var widthCalculator_1 = __webpack_require__(7);
var inputParser_1 = __webpack_require__(8);
var state_1 = __webpack_require__(0);
__webpack_require__(15);
var common_1 = __webpack_require__(1);
var jsPDF = __webpack_require__(4);
function autoTable() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
state_1.setupState(this);
// 1. Parse and unify user input
var table = inputParser_1.parseInput(args);
// 2. Calculate preliminary table, column, row and cell dimensions
widthCalculator_1.calculateWidths(table);
// 3. Output table to pdf
tableDrawer_1.drawTable(table);
table.finalY = table.cursor.y;
this.previousAutoTable = table;
this.lastAutoTable = table;
this.autoTable.previous = table; // Deprecated
common_1.applyUserStyles();
state_1.resetState();
return this;
}
jsPDF.API.autoTable = autoTable;
// Assign false to enable `doc.lastAutoTable.finalY || 40` sugar;
jsPDF.API.lastAutoTable = false;
jsPDF.API.previousAutoTable = false; // deprecated in v3
jsPDF.API.autoTable.previous = false; // deprecated in v3
jsPDF.API.autoTableSetDefaults = function (defaults) {
state_1.setDefaults(defaults, this);
return this;
};
jsPDF.autoTableSetDefaults = function (defaults, doc) {
state_1.setDefaults(defaults, doc);
return this;
};
/**
* @Deprecated. Use html option instead doc.autoTable(html: '#table')
*/
jsPDF.API.autoTableHtmlToJson = function (tableElem, includeHiddenElements) {
console.error("Use of deprecated function: autoTableHtmlToJson. Use html option instead.");
includeHiddenElements = includeHiddenElements || false;
if (!tableElem || !(tableElem instanceof HTMLTableElement)) {
console.error("A HTMLTableElement has to be sent to autoTableHtmlToJson");
return null;
}
var columns = {}, rows = [];
var header = tableElem.rows[0];
for (var i = 0; i < header.cells.length; i++) {
var cell = header.cells[i];
var style = window.getComputedStyle(cell);
if (includeHiddenElements || style.display !== 'none') {
columns[i] = cell;
}
}
var _loop_1 = function (i) {
var tableRow = tableElem.rows[i];
var style = window.getComputedStyle(tableRow);
if (includeHiddenElements || style.display !== 'none') {
var rowData_1 = [];
Object.keys(columns).forEach(function (key) {
var cell = tableRow.cells[key];
rowData_1.push(cell);
});
rows.push(rowData_1);
}
};
for (var i = 1; i < tableElem.rows.length; i++) {
_loop_1(i);
}
var values = Object.keys(columns).map(function (key) {
return columns[key];
});
return { columns: values, rows: rows, data: rows };
};
/**
* @deprecated
*/
jsPDF.API.autoTableEndPosY = function () {
console.error("Use of deprecated function: autoTableEndPosY. Use doc.previousAutoTable.finalY instead.");
var prev = this.previousAutoTable;
if (prev.cursor && typeof prev.cursor.y === 'number') {
return prev.cursor.y;
}
else {
return 0;
}
};
/**
* @deprecated
*/
jsPDF.API.autoTableAddPageContent = function (hook) {
console.error("Use of deprecated function: autoTableAddPageContent. Use jsPDF.autoTableSetDefaults({didDrawPage: () => {}}) instead.");
if (!jsPDF.API.autoTable.globalDefaults) {
jsPDF.API.autoTable.globalDefaults = {};
}
jsPDF.API.autoTable.globalDefaults.addPageContent = hook;
return this;
};
/**
* @deprecated
*/
jsPDF.API.autoTableAddPage = function () {
console.error("Use of deprecated function: autoTableAddPage. Use doc.addPage()");
this.addPage();
return this;
};
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = __webpack_require__(2);
var common_1 = __webpack_require__(1);
var state_1 = __webpack_require__(0);
function drawTable(table) {
var settings = table.settings;
table.cursor = {
x: table.margin('left'),
y: settings.startY == null ? table.margin('top') : settings.startY
};
var minTableBottomPos = settings.startY + table.margin('bottom') + table.headHeight + table.footHeight;
if (settings.pageBreak === 'avoid') {
minTableBottomPos += table.height;
}
if (settings.pageBreak === 'always' || settings.startY != null && settings.startY !== false && minTableBottomPos > state_1.default().pageHeight()) {
nextPage(state_1.default().doc);
table.cursor.y = table.margin('top');
}
table.pageStartX = table.cursor.x;
table.pageStartY = table.cursor.y;
table.startPageNumber = state_1.default().pageNumber();
common_1.applyUserStyles();
if (settings.showHead === true || settings.showHead === 'firstPage' || settings.showHead === 'everyPage') {
table.head.forEach(function (row) { return printRow(row); });
}
common_1.applyUserStyles();
table.body.forEach(function (row, index) {
printFullRow(row, index === table.body.length - 1);
});
common_1.applyUserStyles();
if (settings.showFoot === true || settings.showFoot === 'lastPage' || settings.showFoot === 'everyPage') {
table.foot.forEach(function (row) { return printRow(row); });
}
common_1.addTableBorder();
table.callEndPageHooks();
}
exports.drawTable = drawTable;
function printFullRow(row, isLastRow) {
var remainingRowHeight = 0;
var remainingTexts = {};
var table = state_1.default().table;
var remainingPageSpace = getRemainingPageSpace(isLastRow);
if (remainingPageSpace < row.maxCellHeight) {
if (remainingPageSpace < getOneRowHeight(row) || (table.settings.rowPageBreak === 'avoid' && !rowHeightGreaterThanMaxTableHeight(row))) {
addPage();
}
else {
// Modify the row to fit the current page and calculate text and height of partial row
row.spansMultiplePages = true;
for (var j = 0; j < table.columns.length; j++) {
var column = table.columns[j];
var cell = row.cells[column.dataKey];
if (!cell) {
continue;
}
var fontHeight = cell.styles.fontSize / state_1.default().scaleFactor() * config_1.FONT_ROW_RATIO;
var vPadding = cell.padding('vertical');
var remainingLineCount = Math.floor((remainingPageSpace - vPadding) / fontHeight);
// Note that this will cut cells with specified custom min height at page break
if (Array.isArray(cell.text) && cell.text.length > remainingLineCount) {
remainingTexts[column.dataKey] = cell.text.splice(remainingLineCount, cell.text.length);
var rCellHeight = cell.height - remainingPageSpace;
if (rCellHeight > remainingRowHeight) {
remainingRowHeight = rCellHeight;
}
}
cell.height = Math.min(remainingPageSpace, cell.height);
}
}
}
printRow(row);
// Parts of the row is now printed. Time for adding a new page, prune
// the text and start over
if (Object.keys(remainingTexts).length > 0) {
var maxCellHeight = 0;
for (var j = 0; j < table.columns.length; j++) {
var col = table.columns[j];
var cell = row.cells[col.dataKey];
if (!cell)
continue;
cell.height = remainingRowHeight;
if (cell.height > maxCellHeight) {
maxCellHeight = cell.height;
}
if (cell) {
cell.text = remainingTexts[col.dataKey] || '';
}
}
addPage();
row.pageNumber++;
row.height = remainingRowHeight;
row.maxCellHeight = maxCellHeight;
printFullRow(row, isLastRow);
}
}
function getOneRowHeight(row) {
return state_1.default().table.columns.reduce(function (acc, column) {
var cell = row.cells[column.dataKey];
if (!cell)
return 0;
var fontHeight = cell.styles.fontSize / state_1.default().scaleFactor() * config_1.FONT_ROW_RATIO;
var vPadding = cell.padding('vertical');
var oneRowHeight = vPadding + fontHeight;
return oneRowHeight > acc ? oneRowHeight : acc;
}, 0);
}
function rowHeightGreaterThanMaxTableHeight(row) {
var table = state_1.default().table;
var pageHeight = state_1.default().pageHeight();
var maxTableHeight = pageHeight - table.margin('top') - table.margin('bottom');
return row.maxCellHeight > maxTableHeight;
}
function printRow(row) {
var table = state_1.default().table;
table.cursor.x = table.margin('left');
row.y = table.cursor.y;
row.x = table.cursor.x;
// For backwards compatibility reset those after addingRow event
table.cursor.x = table.margin('left');
row.y = table.cursor.y;
row.x = table.cursor.x;
for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
var column = _a[_i];
var cell = row.cells[column.dataKey];
if (!cell) {
table.cursor.x += column.width;
continue;
}
common_1.applyStyles(cell.styles);
cell.x = table.cursor.x;
cell.y = row.y;
if (cell.styles.valign === 'top') {
cell.textPos.y = table.cursor.y + cell.padding('top');
}
else if (cell.styles.valign === 'bottom') {
cell.textPos.y = table.cursor.y + cell.height - cell.padding('bottom');
}
else {
cell.textPos.y = table.cursor.y + cell.height / 2;
}
if (cell.styles.halign === 'right') {
cell.textPos.x = cell.x + cell.width - cell.padding('right');
}
else if (cell.styles.halign === 'center') {
cell.textPos.x = cell.x + cell.width / 2;
}
else {
cell.textPos.x = cell.x + cell.padding('left');
}
if (table.callCellHooks(table.cellHooks.willDrawCell, cell, row, column) === false) {
table.cursor.x += column.width;
continue;
}
var fillStyle = common_1.getFillStyle(cell.styles);
if (fillStyle) {
state_1.default().doc.rect(cell.x, table.cursor.y, cell.width, cell.height, fillStyle);
}
state_1.default().doc.autoTableText(cell.text, cell.textPos.x, cell.textPos.y, {
halign: cell.styles.halign,
valign: cell.styles.valign,
maxWidth: cell.width - cell.padding('left') - cell.padding('right')
});
table.callCellHooks(table.cellHooks.didDrawCell, cell, row, column);
table.cursor.x += column.width;
}
table.cursor.y += row.height;
}
function getRemainingPageSpace(isLastRow) {
var table = state_1.default().table;
var bottomContentHeight = table.margin('bottom');
var showFoot = table.settings.showFoot;
if (showFoot === true || showFoot === 'everyPage' || (showFoot === 'lastPage' && isLastRow)) {
bottomContentHeight += table.footHeight;
}
return state_1.default().pageHeight() - table.cursor.y - bottomContentHeight;
}
function addPage() {
var table = state_1.default().table;
common_1.applyUserStyles();
if (table.settings.showFoot === true || table.settings.showFoot === 'everyPage') {
table.foot.forEach(function (row) { return printRow(row); });
}
table.finalY = table.cursor.y;
// Add user content just before adding new page ensure it will
// be drawn above other things on the page
table.callEndPageHooks();
common_1.addTableBorder();
nextPage(state_1.default().doc);
table.pageNumber++;
table.cursor = { x: table.margin('left'), y: table.margin('top') };
table.pageStartX = table.cursor.x;
table.pageStartY = table.cursor.y;
if (table.settings.showHead === true || table.settings.showHead === 'everyPage') {
table.head.forEach(function (row) { return printRow(row); });
}
}
exports.addPage = addPage;
function nextPage(doc) {
var current = state_1.default().pageNumber();
doc.setPage(current + 1);
var newCurrent = state_1.default().pageNumber();
if (newCurrent === current) {
doc.addPage();
}
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = __webpack_require__(2);
var common_1 = __webpack_require__(1);
var state_1 = __webpack_require__(0);
/**
* Calculate the column widths
*/
function calculateWidths(table) {
// TODO Handle these cases
var columnMinWidth = 10 / state_1.default().scaleFactor();
if (columnMinWidth * table.columns.length > table.width) {
console.error('Columns could not fit on page');
}
else if (table.minWidth > table.width) {
console.error("Column widths to wide and can't fit page");
}
var copy = table.columns.slice(0);
var diffWidth = table.width - table.wrappedWidth;
distributeWidth(copy, diffWidth, table.wrappedWidth);
applyColSpans(table);
fitContent(table);
applyRowSpans(table);
}
exports.calculateWidths = calculateWidths;
function applyRowSpans(table) {
var rowSpanCells = {};
var colRowSpansLeft = 1;
var all = table.allRows();
for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {
var row = all[rowIndex];
for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
var column = _a[_i];
var data = rowSpanCells[column.dataKey];
if (colRowSpansLeft > 1) {
colRowSpansLeft--;
delete row.cells[column.dataKey];
}
else if (data) {
data.cell.height += row.height;
if (data.cell.height > row.maxCellHeight) {
data.row.maxCellHeight = data.cell.height;
data.row.maxCellLineCount = Array.isArray(data.cell.text) ? data.cell.text.length : 1;
}
colRowSpansLeft = data.cell.colSpan;
delete row.cells[column.dataKey];
data.left--;
if (data.left <= 1) {
delete rowSpanCells[column.dataKey];
}
}
else {
var cell = row.cells[column.dataKey];
if (!cell) {
continue;
}
cell.height = row.height;
if (cell.rowSpan > 1) {
var remaining = all.length - rowIndex;
var left = cell.rowSpan > remaining ? remaining : cell.rowSpan;
rowSpanCells[column.dataKey] = { cell: cell, left: left, row: row };
}
}
}
if (row.section === 'head') {
table.headHeight += row.maxCellHeight;
}
if (row.section === 'foot') {
table.footHeight += row.maxCellHeight;
}
table.height += row.height;
}
}
function applyColSpans(table) {
var all = table.allRows();
for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {
var row = all[rowIndex];
var colSpanCell = null;
var combinedColSpanWidth = 0;
var colSpansLeft = 0;
for (var columnIndex = 0; columnIndex < table.columns.length; columnIndex++) {
var column = table.columns[columnIndex];
var cell = null;
// Width and colspan
colSpansLeft -= 1;
if (colSpansLeft > 1 && table.columns[columnIndex + 1]) {
combinedColSpanWidth += column.width;
delete row.cells[column.dataKey];
continue;
}
else if (colSpanCell) {
cell = colSpanCell;
delete row.cells[column.dataKey];
colSpanCell = null;
}
else {
cell = row.cells[column.dataKey];
if (!cell)
continue;
colSpansLeft = cell.colSpan;
combinedColSpanWidth = 0;
if (cell.colSpan > 1) {
colSpanCell = cell;
combinedColSpanWidth += column.width;
continue;
}
}
cell.width = column.width + combinedColSpanWidth;
}
}
}
function fitContent(table) {
var rowSpanHeight = { count: 0, height: 0 };
for (var _i = 0, _a = table.allRows(); _i < _a.length; _i++) {
var row = _a[_i];
for (var _b = 0, _c = table.columns; _b < _c.length; _b++) {
var column = _c[_b];
var cell = row.cells[column.dataKey];
if (!cell)
continue;
common_1.applyStyles(cell.styles);
var textSpace = cell.width - cell.padding('horizontal');
if (cell.styles.overflow === 'linebreak') {
// Add one pt to textSpace to fix rounding error
cell.text = state_1.default().doc.splitTextToSize(cell.text, textSpace + 1 / (state_1.default().scaleFactor() || 1), { fontSize: cell.styles.fontSize });
}
else if (cell.styles.overflow === 'ellipsize') {
cell.text = common_1.ellipsize(cell.text, textSpace, cell.styles);
}
else if (cell.styles.overflow === 'hidden') {
cell.text = common_1.ellipsize(cell.text, textSpace, cell.styles, '');
}
else if (typeof cell.styles.overflow === 'function') {
cell.text = cell.styles.overflow(cell.text, textSpace);
}
var lineCount = Array.isArray(cell.text) ? cell.text.length : 1;
var fontHeight = cell.styles.fontSize / state_1.default().scaleFactor() * config_1.FONT_ROW_RATIO;
cell.contentHeight = lineCount * fontHeight + cell.padding('vertical');
if (cell.styles.minCellHeight > cell.contentHeight) {
cell.contentHeight = cell.styles.minCellHeight;
}
var realContentHeight = cell.contentHeight / cell.rowSpan;
if (cell.rowSpan > 1 && (rowSpanHeight.count * rowSpanHeight.height < realContentHeight * cell.rowSpan)) {
rowSpanHeight = { height: realContentHeight, count: cell.rowSpan };
}
else if (rowSpanHeight && rowSpanHeight.count > 0) {
if (rowSpanHeight.height > realContentHeight) {
realContentHeight = rowSpanHeight.height;
}
}
if (realContentHeight > row.height) {
row.height = realContentHeight;
row.maxCellHeight = realContentHeight;
row.maxCellLineCount = lineCount;
}
}
rowSpanHeight.count--;
}
}
function distributeWidth(autoColumns, diffWidth, wrappedAutoColumnsWidth) {
for (var i = 0; i < autoColumns.length; i++) {
var column = autoColumns[i];
var ratio = column.wrappedWidth / wrappedAutoColumnsWidth;
var suggestedChange = diffWidth * ratio;
var suggestedWidth = column.wrappedWidth + suggestedChange;
if (suggestedWidth >= column.minWidth) {
column.width = suggestedWidth;
}
else {
// We can't reduce the width of this column. Mark as none auto column and start over
// Add 1 to minWidth as linebreaks calc otherwise sometimes made two rows
column.width = column.minWidth + 1 / state_1.default().scaleFactor();
wrappedAutoColumnsWidth -= column.wrappedWidth;
autoColumns.splice(i, 1);
distributeWidth(autoColumns, diffWidth, wrappedAutoColumnsWidth);
break;
}
}
}
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var models_1 = __webpack_require__(9);
var config_1 = __webpack_require__(2);
var htmlParser_1 = __webpack_require__(12);
var polyfills_1 = __webpack_require__(3);
var common_1 = __webpack_require__(1);
var state_1 = __webpack_require__(0);
var inputValidator_1 = __webpack_require__(14);
/**
* Create models from the user input
*/
function parseInput(args) {
var tableOptions = parseUserArguments(args);
var globalOptions = state_1.getGlobalOptions();
var documentOptions = state_1.getDocumentOptions();
var allOptions = [globalOptions, documentOptions, tableOptions];
inputValidator_1.default(allOptions);
var table = new models_1.Table();
state_1.default().table = table;
table.id = tableOptions.tableId;
var doc = state_1.default().doc;
table.userStyles = {
// Setting to black for versions of jspdf without getTextColor
textColor: doc.getTextColor ? doc.getTextColor() : 0,
fontSize: doc.internal.getFontSize(),
fontStyle: doc.internal.getFont().fontStyle,
font: doc.internal.getFont().fontName
};
var _loop_1 = function (styleProp) {
var styles = allOptions.map(function (opts) { return opts[styleProp] || {}; });
table.styles[styleProp] = polyfills_1.assign.apply(void 0, [{}].concat(styles));
};
// Merge styles one level deeper
for (var _i = 0, _a = Object.keys(table.styles); _i < _a.length; _i++) {
var styleProp = _a[_i];
_loop_1(styleProp);
}
// Append hooks
for (var _b = 0, allOptions_1 = allOptions; _b < allOptions_1.length; _b++) {
var opts = allOptions_1[_b];
for (var _c = 0, _d = Object.keys(table.cellHooks); _c < _d.length; _c++) {
var hookName = _d[_c];
if (opts && typeof opts[hookName] === 'function') {
table.cellHooks[hookName].push(opts[hookName]);
delete opts[hookName];
}
}
}
table.settings = polyfills_1.assign.apply(void 0, [{}, config_1.defaultConfig()].concat(allOptions));
table.settings.margin = common_1.marginOrPadding(table.settings.margin, config_1.defaultConfig().margin);
if (table.settings.theme === 'auto') {
table.settings.theme = table.settings.useCss ? 'plain' : 'striped';
}
if (table.settings.startY === false) {
delete table.settings.startY;
}
var previous = state_1.default().doc.previousAutoTable;
var isSamePageAsPrevious = previous && previous.startPageNumber + previous.pageNumber - 1 === state_1.default().pageNumber();
if (table.settings.startY == null && isSamePageAsPrevious) {
table.settings.startY = previous.finalY + 20 / state_1.default().scaleFactor();
}
var htmlContent = {};
if (table.settings.html) {
htmlContent = htmlParser_1.parseHtml(table.settings.html, table.settings.includeHiddenHtml, table.settings.useCss) || {};
}
table.settings.head = htmlContent.head || table.settings.head || [];
table.settings.body = htmlContent.body || table.settings.body || [];
table.settings.foot = htmlContent.foot || table.settings.foot || [];
parseContent(table);
table.minWidth = table.columns.reduce(function (total, col) { return (total + col.minWidth); }, 0);
table.wrappedWidth = table.columns.reduce(function (total, col) { return (total + col.wrappedWidth); }, 0);
if (typeof table.settings.tableWidth === 'number') {
table.width = table.settings.tableWidth;
}
else if (table.settings.tableWidth === 'wrap') {
table.width = table.wrappedWidth;
}
else {
table.width = state_1.default().pageWidth() - table.margin('left') - table.margin('right');
}
return table;
}
exports.parseInput = parseInput;
function parseUserArguments(args) {
// Normal initialization on format doc.autoTable(options)
if (args.length === 1) {
return args[0];
}
else {
// Deprecated initialization on format doc.autoTable(columns, body, [options])
var opts = args[2] || {};
opts.body = args[1];
opts.columns = args[0];
// Support v2 title prop in v3
opts.columns.forEach(function (col) {
if (col.header == null) {
col.header = col.title;
}
});
return opts;
}
}
function parseContent(table) {
var settings = table.settings;
table.columns = getTableColumns(settings);
var _loop_2 = function (sectionName) {
var rowSpansLeftForColumn = {};
var sectionRows = settings[sectionName];
if (sectionRows.length === 0 && settings.columns) {
var sectionRow_1 = {};
table.columns
.forEach(function (col) {
var columnData = col.raw;
if (sectionName === 'head') {
var val = typeof columnData === 'object' ? columnData.header : columnData;
if (val) {
sectionRow_1[col.dataKey] = val;
}
}
else if (sectionName === 'foot' && columnData.footer) {
sectionRow_1[col.dataKey] = columnData.footer;
}
});
if (Object.keys(sectionRow_1).length) {
sectionRows.push(sectionRow_1);
}
}
sectionRows.forEach(function (rawRow, rowIndex) {
var skippedRowForRowSpans = 0;
var row = new models_1.Row(rawRow, rowIndex, sectionName);
table[sectionName].push(row);
var colSpansAdded = 0;
var columnSpansLeft = 0;
for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
var column = _a[_i];
if (rowSpansLeftForColumn[column.dataKey] == null || rowSpansLeftForColumn[column.dataKey].left === 0) {
if (columnSpansLeft === 0) {
var rawCell = void 0;
if (Array.isArray(rawRow)) {
rawCell = rawRow[column.dataKey - colSpansAdded - skippedRowForRowSpans];
}
else {
rawCell = rawRow[column.dataKey];
}
var styles = cellStyles(sectionName, column.dataKey, rowIndex);
var cell = new models_1.Cell(rawCell, styles, sectionName);
row.cells[column.dataKey] = cell;
table.callCellHooks(table.cellHooks.didParseCell, cell, row, column);
columnSpansLeft = cell.colSpan - 1;
rowSpansLeftForColumn[column.dataKey] = { left: cell.rowSpan - 1, times: columnSpansLeft };
}
else {
columnSpansLeft--;
colSpansAdded++;
}
}
else {
rowSpansLeftForColumn[column.dataKey].left--;
columnSpansLeft = rowSpansLeftForColumn[column.dataKey].times;
skippedRowForRowSpans++;
}
}
});
};
for (var _i = 0, _a = ['head', 'body', 'foot']; _i < _a.length; _i++) {
var sectionName = _a[_i];
_loop_2(sectionName);
}
table.allRows().forEach(function (row) {
for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
var column = _a[_i];
var cell = row.cells[column.dataKey];
// Kind of make sense to not consider width of cells with colspan columns
// Consider this in a future release however
if (cell && cell.colSpan === 1) {
if (cell.wrappedWidth > column.wrappedWidth) {
column.wrappedWidth = cell.wrappedWidth;
}
if (cell.minWidth > column.minWidth) {
column.minWidth = cell.minWidth;
}
}
}
});
}
function getTableColumns(settings) {
if (settings.columns) {
return settings.columns.map(function (input, index) {
var key = input.dataKey || input.key || index;
var raw = input != null ? input : index;
return new models_1.Column(key, raw, index);
});
}
else {
var merged = __assign({}, settings.head[0], settings.body[0], settings.foot[0]);
delete merged._element;
var dataKeys = Object.keys(merged);
return dataKeys.map(function (key) { return new models_1.Column(key, key, key); });
}
}
function cellStyles(sectionName, dataKey, rowIndex) {
var table = state_1.default().table;
var theme = config_1.getTheme(table.settings.theme);
var otherStyles = [theme.table, theme[sectionName], table.styles.styles, table.styles[sectionName + "Styles"]];
var colStyles = sectionName === 'body' ? table.styles.columnStyles[dataKey] || {} : {};
var rowStyles = sectionName === 'body' && rowIndex % 2 === 0 ? polyfills_1.assign({}, theme.alternateRow, table.styles.alternateRowStyles) : {};
return polyfills_1.assign.apply(void 0, [config_1.defaultStyles()].concat(otherStyles.concat([rowStyles, colStyles])));
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = __webpack_require__(2);
var state_1 = __webpack_require__(0);
var HookData_1 = __webpack_require__(10);
var common_1 = __webpack_require__(1);
var assign = __webpack_require__(11);
var CellHooks = /** @class */ (function () {
function CellHooks() {
this.didParseCell = [];
this.willDrawCell = [];
this.didDrawCell = [];
this.didDrawPage = [];
}
return CellHooks;
}());
var Table = /** @class */ (function () {
function Table() {
this.columns = [];
this.head = [];
this.body = [];
this.foot = [];
this.height = 0;
this.width = 0;
this.preferredWidth = 0;
this.wrappedWidth = 0;
this.minWidth = 0;
this.headHeight = 0;
this.footHeight = 0;
this.startPageNumber = 1;
this.pageNumber = 1;
this.styles = {
styles: {},
headStyles: {},
bodyStyles: {},
footStyles: {},
alternateRowStyles: {},
columnStyles: {},
};
this.cellHooks = new CellHooks();
}
Object.defineProperty(Table.prototype, "pageCount", {
get: function () {
return this.pageNumber;
},
enumerable: true,
configurable: true
});
Table.prototype.allRows = function () {
return this.head.concat(this.body).concat(this.foot);
};
Table.prototype.callCellHooks = function (handlers, cell, row, column) {
for (var _i = 0, handlers_1 = handlers; _i < handlers_1.length; _i++) {
var handler = handlers_1[_i];
if (handler(new HookData_1.CellHookData(cell, row, column)) === false) {
return false;
}
}
return true;
};
Table.prototype.callEndPageHooks = function () {
common_1.applyUserStyles();
for (var _i = 0, _a = this.cellHooks.didDrawPage; _i < _a.length; _i++) {
var handler = _a[_i];
handler(new HookData_1.HookData());
}
};
Table.prototype.margin = function (side) {
return common_1.marginOrPadding(this.settings.margin, config_1.defaultConfig().margin)[side];
};
return Table;
}());
exports.Table = Table;
var Row = /** @class */ (function () {
function Row(raw, index, section) {
this.cells = {};
this.height = 0;
this.maxCellLineCount = 1;
this.maxCellHeight = 0;
this.pageNumber = 1;
this.spansMultiplePages = false;
this.raw = raw;
if (raw._element) {
this.raw = raw._element;
}
this.index = index;
this.section = section;
}
Object.defineProperty(Row.prototype, "pageCount", {
get: function () {
return this.pageNumber;
},
enumerable: true,
configurable: true
});
return Row;
}());
exports.Row = Row;
var Cell = /** @class */ (function () {
function Cell(raw, themeStyles, section) {
this.contentWidth = 0;
this.wrappedWidth = 0;
this.minWidth = 0;
this.textPos = {};
this.height = 0;
this.width = 0;
this.rowSpan = raw && raw.rowSpan || 1;
this.colSpan = raw && raw.colSpan || 1;
this.styles = assign(themeStyles, raw && raw.styles || {});
this.section = section;
var text = '';
var content = raw && typeof raw.content !== 'undefined' ? raw.content : raw;
content = content != undefined && content.dataKey != undefined ? content.title : content;
var fromHtml = typeof window === 'object' && window.HTMLElement && content instanceof window.HTMLElement;
this.raw = fromHtml ? content : raw;
if (content && fromHtml) {
text = (content.innerText || '').replace(/' '+/g, ' ').trim();
}
else {
// Stringify 0 and false, but not undefined or null
text = content != undefined ? '' + content : '';
}
var splitRegex = /\r\n|\r|\n/g;
this.text = text.split(splitRegex);
this.contentWidth = this.padding('horizontal') + common_1.getStringWidth(this.text, this.styles);
if (typeof this.styles.cellWidth === 'number') {
this.minWidth = this.styles.cellWidth;
this.wrappedWidth = this.styles.cellWidth;
}
else if (this.styles.cellWidth === 'wrap') {
this.minWidth = this.contentWidth;
this.wrappedWidth = this.contentWidth;
}
else { // auto
var defaultMinWidth = 10 / state_1.default().scaleFactor();
this.minWidth = this.styles.minCellWidth || defaultMinWidth;
this.wrappedWidth = this.contentWidth;
if (this.minWidth > this.wrappedWidth) {
this.wrappedWidth = this.minWidth;
}
}
}
Cell.prototype.padding = function (name) {
var padding = common_1.marginOrPadding(this.styles.cellPadding, common_1.styles([]).cellPadding);
if (name === 'vertical') {
return padding.top + padding.bottom;
}
else if (name === 'horizontal') {
return padding.left + padding.right;
}
else {
return padding[name];
}
};
return Cell;
}());
exports.Cell = Cell;
var Column = /** @class */ (function () {
function Column(dataKey, raw, index) {
this.preferredWidth = 0;
this.minWidth = 0;
this.wrappedWidth = 0;
this.width = 0;
this.dataKey = dataKey;
this.raw = raw;
this.index = index;
}
return Column;
}());
exports.Column = Column;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var state_1 = __webpack_require__(0);
var HookData = /** @class */ (function () {
function HookData() {
var table = state_1.default().table;
this.table = table;
this.pageNumber = table.pageNumber;
this.settings = table.settings;
this.cursor = table.cursor;
this.doc = state_1.default().doc;
}
Object.defineProperty(HookData.prototype, "pageCount", {
get: function () {
return this.pageNumber;
},
enumerable: true,
configurable: true
});
return HookData;
}());
exports.HookData = HookData;
var CellHookData = /** @class */ (function (_super) {
__extends(CellHookData, _super);
function CellHookData(cell, row, column) {
var _this = _super.call(this) || this;
_this.cell = cell;
_this.row = row;
_this.column = column;
_this.section = row.section;
return _this;
}
return CellHookData;
}(HookData));
exports.CellHookData = CellHookData;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var cssParser_1 = __webpack_require__(13);
var state_1 = __webpack_require__(0);
function parseHtml(input, includeHiddenHtml, useCss) {
if (includeHiddenHtml === void 0) { includeHiddenHtml = false; }
if (useCss === void 0) { useCss = false; }
var tableElement;
if (typeof input === 'string') {
tableElement = window.document.querySelector(input);
}
else {
tableElement = input;
}
if (!tableElement) {
console.error("Html table could not be found with input: ", input);
return;
}
var head = parseTableSection(window, tableElement.tHead, includeHiddenHtml, useCss);
var body = [];
for (var i = 0; i < tableElement.tBodies.length; i++) {
body = body.concat(parseTableSection(window, tableElement.tBodies[i], includeHiddenHtml, useCss));
}
var foot = parseTableSection(window, tableElement.tFoot, includeHiddenHtml, useCss);
return { head: head, body: body, foot: foot };
}
exports.parseHtml = parseHtml;
function parseTableSection(window, sectionElement, includeHidden, useCss) {
var results = [];
if (!sectionElement) {
return results;
}
for (var i = 0; i < sectionElement.rows.length; i++) {
var row = sectionElement.rows[i];
var resultRow = [];
var rowStyles = useCss ? cssParser_1.parseCss(row, state_1.default().scaleFactor(), ['cellPadding', 'lineWidth', 'lineColor']) : {};
for (var i_1 = 0; i_1 < row.cells.length; i_1++) {
var cell = row.cells[i_1];
var style = window.getComputedStyle(cell);
if (includeHidden || style.display !== 'none') {
var cellStyles = useCss ? cssParser_1.parseCss(cell, state_1.default().scaleFactor()) : {};
resultRow.push({
rowSpan: cell.rowSpan,
colSpan: cell.colSpan,
styles: useCss ? cellStyles : null,
content: cell
});
}
}
if (resultRow.length > 0 && (includeHidden || rowStyles.display !== 'none')) {
resultRow._element = row;
results.push(resultRow);
}
}
return results;
}
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Limitations
// - No support for border spacing
// - No support for transparency
var common_1 = __webpack_require__(1);
function parseCss(element, scaleFactor, ignored) {
if (ignored === void 0) { ignored = []; }
var result = {};
var style = window.getComputedStyle(element);
function assign(name, value, accepted) {
if (accepted === void 0) { accepted = []; }
if ((accepted.length === 0 || accepted.indexOf(value) !== -1) && ignored.indexOf(name) === -1) {
if (value === 0 || value) {
result[name] = value;
}
}
}
var pxScaleFactor = 96 / 72;
assign('fillColor', parseColor(element, 'backgroundColor'));
assign('lineColor', parseColor(element, 'borderColor'));
assign('fontStyle', parseFontStyle(style));
assign('textColor', parseColor(element, 'color'));
assign('halign', style.textAlign, ['left', 'right', 'center', 'justify']);
assign('valign', style.verticalAlign, ['middle', 'bottom', 'top']);
assign('fontSize', parseInt(style.fontSize || '') / pxScaleFactor);
assign('cellPadding', parsePadding(style.padding, style.fontSize, style.lineHeight, scaleFactor));
assign('lineWidth', parseInt(style.borderWidth || '') / pxScaleFactor / scaleFactor);
assign('font', (style.fontFamily || '').toLowerCase());
return result;
}
exports.parseCss = parseCss;
function parseFontStyle(style) {
var res = '';
if (style.fontWeight === 'bold' || style.fontWeight === 'bolder' || parseInt(style.fontWeight) >= 700) {
res += 'bold';
}
if (style.fontStyle === 'italic' || style.fontStyle === 'oblique') {
res += 'italic';
}
return res;
}
function parseColor(element, colorProp) {
var cssColor = realColor(element, colorProp);
if (!cssColor)
return null;
var rgba = cssColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);
if (!rgba || !Array.isArray(rgba)) {
return null;
}
var color = [parseInt(rgba[1]), parseInt(rgba[2]), parseInt(rgba[3])];
var alpha = parseInt(rgba[4]);
if (alpha === 0 || isNaN(color[0]) || isNaN(color[1]) || isNaN(color[2])) {
return null;
}
return color;
}
function realColor(elem, colorProp) {
if (!elem)
return null;
var bg = window.getComputedStyle(elem)[colorProp];
if (bg === 'rgba(0, 0, 0, 0)' || bg === 'transparent' || bg === 'initial' || bg === 'inherit') {
return realColor(elem.parentElement, colorProp);
}
else {
return bg;
}
}
function parsePadding(val, fontSize, lineHeight, scaleFactor) {
if (!val)
return null;
var pxScaleFactor = (96 / (72 / scaleFactor));
var linePadding = (parseInt(lineHeight) - parseInt(fontSize)) / scaleFactor / 2;
var padding = val.split(' ').map(function (n) {
return parseInt(n) / pxScaleFactor;
});
padding = common_1.marginOrPadding(padding, 0);
if (linePadding > padding.top) {
padding.top = linePadding;
}
if (linePadding > padding.bottom) {
padding.bottom = linePadding;
}
return padding;
}
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = __webpack_require__(1);
function default_1(allOptions) {
var _loop_1 = function (settings) {
if (settings && typeof settings !== 'object') {
console.error("The options parameter should be of type object, is: " + typeof settings);
}
if (typeof settings.extendWidth !== 'undefined') {
settings.tableWidth = settings.extendWidth ? 'auto' : 'wrap';
console.error("Use of deprecated option: extendWidth, use tableWidth instead.");
}
if (typeof settings.margins !== 'undefined') {
if (typeof settings.margin === 'undefined')
settings.margin = settings.margins;
console.error("Use of deprecated option: margins, use margin instead.");
}
if (!settings.didDrawPage && (settings.afterPageContent || settings.beforePageContent || settings.afterPageAdd)) {
console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead");
settings.didDrawPage = function (data) {
common_1.applyUserStyles();
if (settings.beforePageContent)
settings.beforePageContent(data);
common_1.applyUserStyles();
if (settings.afterPageContent)
settings.afterPageContent(data);
common_1.applyUserStyles();
if (settings.afterPageAdd && data.pageNumber > 1) {
data.afterPageAdd(data);
}
common_1.applyUserStyles();
};
}
["createdHeaderCell", "drawHeaderRow", "drawRow", "drawHeaderCell"].forEach(function (name) {
if (settings[name]) {
console.error("The \"" + name + "\" hook has changed in version 3.0, check the changelog for how to migrate.");
}
});
[['showFoot', 'showFooter'], ['showHead', 'showHeader'], ['didDrawPage', 'addPageContent'], ['didParseCell', 'createdCell'], ['headStyles', 'headerStyles']].forEach(function (_a) {
var current = _a[0], deprecated = _a[1];
if (settings[deprecated]) {
console.error("Use of deprecated option " + deprecated + ". Use " + current + " instead");
settings[current] = settings[deprecated];
}
});
[['padding', 'cellPadding'], ['lineHeight', 'rowHeight'], 'fontSize', 'overflow'].forEach(function (o) {
var deprecatedOption = typeof o === 'string' ? o : o[0];
var style = typeof o === 'string' ? o : o[1];
if (typeof settings[deprecatedOption] !== 'undefined') {
if (typeof settings.styles[style] === 'undefined') {
settings.styles[style] = settings[deprecatedOption];
}
console.error("Use of deprecated option: " + deprecatedOption + ", use the style " + style + " instead.");
}
});
for (var _i = 0, _a = ['styles', 'bodyStyles', 'headStyles', 'footStyles']; _i < _a.length; _i++) {
var styleProp = _a[_i];
checkStyles(settings[styleProp] || {});
}
var columnStyles = settings['columnStyles'] || {};
for (var _b = 0, _c = Object.keys(columnStyles); _b < _c.length; _b++) {
var dataKey = _c[_b];
checkStyles(columnStyles[dataKey] || {});
}
};
for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {
var settings = allOptions_1[_i];
_loop_1(settings);
}
}
exports.default = default_1;
function checkStyles(styles) {
if (styles.rowHeight) {
console.error("Use of deprecated style rowHeight. It is renamed to minCellHeight.");
if (!styles.minCellHeight) {
styles.minCellHeight = styles.rowHeight;
}
}
else if (styles.columnWidth) {
console.error("Use of deprecated style columnWidth. It is renamed to cellWidth.");
if (!styles.cellWidth) {
styles.cellWidth = styles.columnWidth;
}
}
}
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
var jsPDF = __webpack_require__(4);
/**
* Improved text function with halign and valign support
* Inspiration from: http://stackoverflow.com/questions/28327510/align-text-right-using-jspdf/28433113#28433113
*/
jsPDF.API.autoTableText = function (text, x, y, styles) {
styles = styles || {};
var FONT_ROW_RATIO = 1.15;
if (typeof x !== 'number' || typeof y !== 'number') {
console.error('The x and y parameters are required. Missing for text: ', text);
}
var k = this.internal.scaleFactor;
var fontSize = this.internal.getFontSize() / k;
var splitRegex = /\r\n|\r|\n/g;
var splitText = null;
var lineCount = 1;
if (styles.valign === 'middle' || styles.valign === 'bottom' || styles.halign === 'center' || styles.halign === 'right') {
splitText = typeof text === 'string' ? text.split(splitRegex) : text;
lineCount = splitText.length || 1;
}
// Align the top
y += fontSize * (2 - FONT_ROW_RATIO);
if (styles.valign === 'middle')
y -= (lineCount / 2) * fontSize * FONT_ROW_RATIO;
else if (styles.valign === 'bottom')
y -= lineCount * fontSize * FONT_ROW_RATIO;
if (styles.halign === 'center' || styles.halign === 'right') {
var alignSize = fontSize;
if (styles.halign === 'center')
alignSize *= 0.5;
if (lineCount >= 1) {
for (var iLine = 0; iLine < splitText.length; iLine++) {
this.text(splitText[iLine], x - this.getStringUnitWidth(splitText[iLine]) * alignSize, y);
y += fontSize;
}
return this;
}
x -= this.getStringUnitWidth(text) * alignSize;
}
if (styles.halign === 'justify') {
this.text(text, x, y, { maxWidth: styles.maxWidth || 100, align: 'justify' });
}
else {
this.text(text, x, y);
}
return this;
};
/***/ })
/******/ ]);
}); | {
"content_hash": "8bd86a6dfb4dda951338c426ac538d1b",
"timestamp": "",
"source": "github",
"line_count": 1860,
"max_line_length": 188,
"avg_line_length": 36.30967741935484,
"alnum_prop": 0.5721541104003791,
"repo_name": "extend1994/cdnjs",
"id": "25a04cd73c7881cd6b04aca64a1c6dbb7947deb0",
"size": "67948",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "ajax/libs/jspdf-autotable/3.1.1/jspdf.plugin.autotable.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
@interface PodsDummy_SwiftTask : NSObject
@end
@implementation PodsDummy_SwiftTask
@end
| {
"content_hash": "635b2e2cbddbe76493ae29e458eb3ac0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 41,
"avg_line_length": 22,
"alnum_prop": 0.8295454545454546,
"repo_name": "noppefoxwolf/TVUploader-iOS",
"id": "05ecdf0db5d51064ced2b50c180e405e01106e2a",
"size": "122",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "Example/Pods/Target Support Files/SwiftTask/SwiftTask-dummy.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "536448"
},
{
"name": "Ruby",
"bytes": "3387"
},
{
"name": "Shell",
"bytes": "17681"
},
{
"name": "Swift",
"bytes": "115083"
}
],
"symlink_target": ""
} |
#ifndef HTMLFieldSetElement_h
#define HTMLFieldSetElement_h
#include "core/html/HTMLFormControlElement.h"
namespace blink {
class FormAssociatedElement;
class HTMLCollection;
class HTMLFormControlsCollection;
class HTMLFieldSetElement FINAL : public HTMLFormControlElement {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtrWillBeRawPtr<HTMLFieldSetElement> create(Document&, HTMLFormElement*);
virtual void trace(Visitor*) OVERRIDE;
HTMLLegendElement* legend() const;
PassRefPtrWillBeRawPtr<HTMLFormControlsCollection> elements();
const FormAssociatedElement::List& associatedElements() const;
protected:
virtual void disabledAttributeChanged() OVERRIDE;
private:
HTMLFieldSetElement(Document&, HTMLFormElement*);
virtual bool isEnumeratable() const OVERRIDE { return true; }
virtual bool supportsFocus() const OVERRIDE;
virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
virtual const AtomicString& formControlType() const OVERRIDE;
virtual bool recalcWillValidate() const OVERRIDE { return false; }
virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
static void invalidateDisabledStateUnder(Element&);
void refreshElementsIfNeeded() const;
mutable FormAssociatedElement::List m_associatedElements;
// When dom tree is modified, we have to refresh the m_associatedElements array.
mutable uint64_t m_documentVersion;
};
} // namespace blink
#endif // HTMLFieldSetElement_h
| {
"content_hash": "5bd834ddd61e971bb34fe65a6cd9219a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 91,
"avg_line_length": 31.918367346938776,
"alnum_prop": 0.7813299232736572,
"repo_name": "Fusion-Rom/android_external_chromium_org_third_party_WebKit",
"id": "644a10a52f5ccc22bb6f691c2370b09145b39837",
"size": "2578",
"binary": false,
"copies": "9",
"ref": "refs/heads/lp5.1",
"path": "Source/core/html/HTMLFieldSetElement.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "14584"
},
{
"name": "Batchfile",
"bytes": "35"
},
{
"name": "C",
"bytes": "106925"
},
{
"name": "C++",
"bytes": "41915988"
},
{
"name": "CSS",
"bytes": "386919"
},
{
"name": "Groff",
"bytes": "26536"
},
{
"name": "HTML",
"bytes": "11501040"
},
{
"name": "Java",
"bytes": "66510"
},
{
"name": "JavaScript",
"bytes": "9328662"
},
{
"name": "Makefile",
"bytes": "99861997"
},
{
"name": "Objective-C",
"bytes": "48021"
},
{
"name": "Objective-C++",
"bytes": "377388"
},
{
"name": "PHP",
"bytes": "3941"
},
{
"name": "Perl",
"bytes": "490099"
},
{
"name": "Python",
"bytes": "3712782"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "8806"
},
{
"name": "Yacc",
"bytes": "64394"
}
],
"symlink_target": ""
} |
#include <jni.h>
#include "cacommon.h"
#include "experimental/logger.h"
#include "cacommonutil.h"
#include "camanagerleutil.h"
#include "uarraylist.h"
#include "octhread.h"
#include "camanagerdevice.h"
#include "oic_malloc.h"
/**
* Logging tag for module name.
*/
#define TAG "OIC_CA_MANAGER_DEVICE"
/**
* List to store devices for auto connection.
*/
static u_arraylist_t *g_deviceACDataList = NULL;
/**
* Mutex to synchronize access to the auto connection list.
*/
static oc_mutex g_deviceACDataListMutex = NULL;
static bool g_isBTRecovery = false;
/**
* Get address from auto connection list.
*/
jstring CAManagerGetLEAddressFromACData(JNIEnv *env, size_t idx)
{
OIC_LOG_V(DEBUG, TAG, "CAManagerGetLEAddressFromACData (idx : %d)", idx);
if (idx <= u_arraylist_length(g_deviceACDataList))
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(
g_deviceACDataList, idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
return NULL;
}
const char* address = (*env)->GetStringUTFChars(env, curData->address, NULL);
if (!address)
{
OIC_LOG(ERROR, TAG, "address is null");
return NULL;
}
OIC_LOG_V(INFO, TAG, "found target address : %s", address);
(*env)->ReleaseStringUTFChars(env, curData->address, address);
return curData->address;
}
OIC_LOG(DEBUG, TAG, "idx is greater than the length of ACDataList");
return NULL;
}
/**
* Create auto connection list.
*/
void CAManagerCreateACDataList()
{
OIC_LOG(DEBUG, TAG, "CAManagerCreateACDataList");
oc_mutex_lock(g_deviceACDataListMutex);
if (NULL == g_deviceACDataList)
{
OIC_LOG(DEBUG, TAG, "Create AC Data list");
g_deviceACDataList = u_arraylist_create();
}
oc_mutex_unlock(g_deviceACDataListMutex);
}
/**
* Destroy auto connection list.
*/
void CAManagerDestroyACDataList()
{
OIC_LOG(DEBUG, TAG, "CAManagerDestroyACDataList");
if (g_deviceACDataList)
{
OIC_LOG(DEBUG, TAG, "Destroy AC Data list");
u_arraylist_free(&g_deviceACDataList);
g_deviceACDataList = NULL;
}
}
/**
* Initialize mutex.
*/
CAResult_t CAManagerInitMutexVaraibles()
{
if (NULL == g_deviceACDataListMutex)
{
g_deviceACDataListMutex = oc_mutex_new();
if (NULL == g_deviceACDataListMutex)
{
OIC_LOG(ERROR, TAG, "oc_mutex_new has failed");
return CA_STATUS_FAILED;
}
}
return CA_STATUS_OK;
}
/**
* Terminate mutex.
*/
void CAManagerTerminateMutexVariables()
{
if (g_deviceACDataListMutex)
{
oc_mutex_free(g_deviceACDataListMutex);
g_deviceACDataListMutex = NULL;
}
}
/**
* Create auto connection data for device to be added in list.
*/
static CAManagerACData_t *CAManagerCreateACData(jstring jaddress)
{
VERIFY_NON_NULL_RET(jaddress, TAG, "jaddress", NULL);
// create AC data
CAManagerACData_t *data = (CAManagerACData_t *) OICCalloc(1, sizeof(*data));
if (!data)
{
OIC_LOG(ERROR, TAG, "memory alloc has failed");
return NULL;
}
data->address = jaddress;
data->isAutoConnecting = false;
return data;
}
/**
* Check whether target address is already contained in ACData list or not.
*/
bool CAManagerIsInACDataList(JNIEnv *env, jstring jaddress)
{
VERIFY_NON_NULL_RET(env, TAG, "env", NULL);
VERIFY_NON_NULL_RET(jaddress, TAG, "jaddress", false);
oc_mutex_lock(g_deviceACDataListMutex);
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
{
OIC_LOG(ERROR, TAG, "address is null");
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
size_t length = u_arraylist_length(g_deviceACDataList);
for (size_t idx = 0; idx < length; idx++)
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(g_deviceACDataList,
idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
const char* setAddress = (*env)->GetStringUTFChars(env, curData->address, NULL);
if (!setAddress)
{
OIC_LOG(ERROR, TAG, "address is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
if (!strcmp(setAddress, address))
{
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return true;
}
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
}
OIC_LOG_V(DEBUG, TAG, "[%s] doesn't exist in list", address);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
/**
* Add auto connection data into list.
*/
void CAManagerAddACData(JNIEnv *env, jstring jaddress)
{
VERIFY_NON_NULL_VOID(env, TAG, "env");
VERIFY_NON_NULL_VOID(jaddress, TAG, "jaddress");
if(!CAManagerIsInACDataList(env, jaddress))
{
OIC_LOG(DEBUG, TAG, "new ACdata will be added in List");
// add CAManagerACData
jobject gaddress = (*env)->NewGlobalRef(env, jaddress);
//creating auto connection data
CAManagerACData_t *data = CAManagerCreateACData(gaddress);
oc_mutex_lock(g_deviceACDataListMutex);
u_arraylist_add(g_deviceACDataList, data);
oc_mutex_unlock(g_deviceACDataListMutex);
}
else
{
OIC_LOG(DEBUG, TAG, "the address is already in ACData list");
}
}
/**
* Remove auto connection data from ACData list for selected ble address.
*/
CAResult_t CAManagerRemoveACData(JNIEnv *env, jstring jaddress)
{
OIC_LOG(DEBUG, TAG, "CAManagerRemoveACData");
VERIFY_NON_NULL(env, TAG, "env");
VERIFY_NON_NULL(jaddress, TAG, "jaddress");
oc_mutex_lock(g_deviceACDataListMutex);
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
{
OIC_LOG(ERROR, TAG, "address is null");
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
OIC_LOG_V(DEBUG, TAG, "[%s] will be removed", address);
size_t length = u_arraylist_length(g_deviceACDataList);
for (size_t idx = 0; idx < length; idx++)
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(g_deviceACDataList,
idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
const char* setAddress = (*env)->GetStringUTFChars(env, curData->address, NULL);
if (!setAddress)
{
OIC_LOG(ERROR, TAG, "address is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
if (!strcmp(setAddress, address))
{
if (NULL == u_arraylist_remove(g_deviceACDataList, idx))
{
OIC_LOG(ERROR, TAG, "removal has failed.");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
if (curData->address)
{
(*env)->DeleteGlobalRef(env, curData->address);
}
OICFree(curData);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
OIC_LOG(DEBUG, TAG, "remove done");
return CA_STATUS_OK;
}
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
}
OIC_LOG_V(DEBUG, TAG, "[%s] doesn't exist in list", address);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_OK;
}
/**
* Remove auto connection data from ACData list for all devices.
*/
CAResult_t CAManagerRemoveAllACData(JNIEnv *env)
{
OIC_LOG(DEBUG, TAG, "IN - CAManagerRemoveAllACData");
VERIFY_NON_NULL(env, TAG, "env");
oc_mutex_lock(g_deviceACDataListMutex);
size_t length = u_arraylist_length(g_deviceACDataList);
for (size_t idx = 0; idx < length; idx++)
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(g_deviceACDataList,
idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
if (NULL == u_arraylist_remove(g_deviceACDataList, idx))
{
OIC_LOG(ERROR, TAG, "removal has failed.");
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
if (curData->address)
{
(*env)->DeleteGlobalRef(env, curData->address);
}
OICFree(curData);
}
oc_mutex_unlock(g_deviceACDataListMutex);
OIC_LOG(DEBUG, TAG, "OUT - CAManagerRemoveAllACData");
return CA_STATUS_OK;
}
/**
* Get isAutoConnecting flag for the address.
*/
CAResult_t CAManagerGetAutoConnectingFlag(JNIEnv *env, jstring jaddress, bool *flag)
{
OIC_LOG(DEBUG, TAG, "CAManagerGetAutoConnectingFlag");
VERIFY_NON_NULL(env, TAG, "env");
VERIFY_NON_NULL(jaddress, TAG, "jaddress");
oc_mutex_lock(g_deviceACDataListMutex);
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
{
OIC_LOG(ERROR, TAG, "address is null");
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
size_t length = u_arraylist_length(g_deviceACDataList);
for (size_t idx = 0; idx < length; idx++)
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(g_deviceACDataList,
idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
const char* setAddress = (*env)->GetStringUTFChars(env, curData->address, NULL);
if (!setAddress)
{
OIC_LOG(ERROR, TAG, "setAddress is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
if (!strcmp(setAddress, address))
{
OIC_LOG_V(DEBUG, TAG, "address : [%s], isAutoConnecting : %d", address,
curData->isAutoConnecting);
*flag = curData->isAutoConnecting;
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_OK;
}
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
}
OIC_LOG_V(DEBUG, TAG, "[%s] doesn't exist in list", address);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return CA_STATUS_FAILED;
}
/**
* Set isAutoConnecting flag for the address.
*/
bool CAManagerSetAutoConnectingFlag(JNIEnv *env, jstring jaddress, bool flag)
{
OIC_LOG(DEBUG, TAG, "CAManagerSetAutoConnectingFlag");
VERIFY_NON_NULL_RET(env, TAG, "env", false);
VERIFY_NON_NULL_RET(jaddress, TAG, "jaddress", false);
oc_mutex_lock(g_deviceACDataListMutex);
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
{
OIC_LOG(ERROR, TAG, "address is null");
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
size_t length = u_arraylist_length(g_deviceACDataList);
for (size_t idx = 0; idx < length; idx++)
{
CAManagerACData_t *curData = (CAManagerACData_t *) u_arraylist_get(g_deviceACDataList,
idx);
if (!curData)
{
OIC_LOG(ERROR, TAG, "curData is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
const char* setAddress = (*env)->GetStringUTFChars(env, curData->address, NULL);
if (!setAddress)
{
OIC_LOG(ERROR, TAG, "address is null");
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
if (!strcmp(setAddress, address))
{
OIC_LOG_V(DEBUG, TAG, "isAutoConnecting flag of [%s] is set to %d", address,
curData->isAutoConnecting);
curData->isAutoConnecting = flag;
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return true;
}
(*env)->ReleaseStringUTFChars(env, curData->address, setAddress);
}
OIC_LOG_V(DEBUG, TAG, "[%s] doesn't exist in list", address);
(*env)->ReleaseStringUTFChars(env, jaddress, address);
oc_mutex_unlock(g_deviceACDataListMutex);
return false;
}
/**
* Get length of auto connection list.
*/
size_t CAManagerGetACDataLength()
{
return u_arraylist_length(g_deviceACDataList);
}
/**
* Set BT adapter recovery flag.
*/
void CAManagerSetBTRecovery(bool flag)
{
g_isBTRecovery = flag;
OIC_LOG_V(DEBUG, TAG, "BT recovery flag is set to %d", g_isBTRecovery);
}
/**
* Get BT adapter recovery flag.
*/
bool CAManagerIsRecoveryFlagSet()
{
return g_isBTRecovery;
}
| {
"content_hash": "0c5b704d1efd5cc0be31e8ab2e008fee",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 94,
"avg_line_length": 30.541322314049587,
"alnum_prop": 0.5979569746989581,
"repo_name": "rzr/iotivity",
"id": "f8c40e660a79baeeeac1ad31cb33cf17e7731b12",
"size": "15548",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "resource/csdk/connectivity/util/src/camanager/bt_le_manager/android/camanagerdevice.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12408"
},
{
"name": "C",
"bytes": "8157549"
},
{
"name": "C++",
"bytes": "13386094"
},
{
"name": "CSS",
"bytes": "1069"
},
{
"name": "Dockerfile",
"bytes": "8372"
},
{
"name": "HTML",
"bytes": "1714"
},
{
"name": "Java",
"bytes": "6702288"
},
{
"name": "JavaScript",
"bytes": "167465"
},
{
"name": "Less",
"bytes": "39"
},
{
"name": "M4",
"bytes": "2816"
},
{
"name": "Makefile",
"bytes": "52136"
},
{
"name": "Python",
"bytes": "1469227"
},
{
"name": "RAML",
"bytes": "1535"
},
{
"name": "Roff",
"bytes": "2808"
},
{
"name": "Shell",
"bytes": "200101"
}
],
"symlink_target": ""
} |
\include prepare-union.sql;
--- SELECT * FROM test1 EXCEPT ALL SELECT * FROM test2;
SELECT generate_plan_tree_dot('SELECT * FROM test1 EXCEPT ALL SELECT * FROM test2;', 'sample-except-all.dot');
\include cleanup-union.sql;
| {
"content_hash": "722b8f5e24e695f09f9dc262b32cfe77",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 110,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.7236842105263158,
"repo_name": "nminoru/pg_plan_tree_dot",
"id": "f0a945e93b51cde6642de3fa09b092c693dbb6d2",
"size": "228",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sample/sample-except-all.sql",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "4325"
},
{
"name": "C++",
"bytes": "157965"
},
{
"name": "Makefile",
"bytes": "751"
}
],
"symlink_target": ""
} |
set -e
set -u
set -o pipefail
function on_error {
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
fi
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
elif [ -L "${binary}" ]; then
echo "Destination binary is symlinked..."
dirname="$(dirname "${binary}")"
binary="${dirname}/$(readlink "${binary}")"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
warn_missing_arch=${2:-true}
if [ -r "$source" ]; then
# Copy the dSYM into the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .dSYM "$source")"
binary_name="$(ls "$source/Contents/Resources/DWARF")"
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
strip_invalid_archs "$binary" "$warn_missing_arch"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
fi
fi
}
# Copies the bcsymbolmap files of a vendored framework
install_bcsymbolmap() {
local bcsymbolmap_path="$1"
local destination="${BUILT_PRODUCTS_DIR}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identity
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
code_sign_cmd="$code_sign_cmd &"
fi
echo "$code_sign_cmd"
eval "$code_sign_cmd"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
warn_missing_arch=${2:-true}
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
if [[ "$warn_missing_arch" == "true" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
fi
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary"
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
install_artifact() {
artifact="$1"
base="$(basename "$artifact")"
case $base in
*.framework)
install_framework "$artifact"
;;
*.dSYM)
# Suppress arch warnings since XCFrameworks will include many dSYM files
install_dsym "$artifact" "false"
;;
*.bcsymbolmap)
install_bcsymbolmap "$artifact"
;;
*)
echo "error: Unrecognized artifact "$artifact""
;;
esac
}
copy_artifacts() {
file_list="$1"
while read artifact; do
install_artifact "$artifact"
done <$file_list
}
ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt"
if [ -r "${ARTIFACT_LIST_FILE}" ]; then
copy_artifacts "${ARTIFACT_LIST_FILE}"
fi
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework"
fi
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
wait
fi
| {
"content_hash": "e5cdd11f3d4597d4f5355eac1e484877",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 311,
"avg_line_length": 42.529126213592235,
"alnum_prop": 0.6378267321082068,
"repo_name": "MainasuK/Bangumi-M",
"id": "3f3c0c68573d32bf0ab018fed74f29d74db8d6a5",
"size": "8771",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Percolator/Pods/Target Support Files/Pods-Bangumi M Tests/Pods-Bangumi M Tests-frameworks.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "8294"
},
{
"name": "Ruby",
"bytes": "908"
},
{
"name": "Swift",
"bytes": "352699"
}
],
"symlink_target": ""
} |
/**
* @fileoverview Abstract base class for subviews of the Analyze tab.
*/
gd.TabAnalyzeSubviewAbstractBase = Backbone.View.extend({
/** Override. */
initialize: function() {
this.render();
},
/** Override. */
render: function() {
this.renderDatatable();
// This needs to happen afterwards since they are now inside the table.
},
/** Register control listeners. Inheriting classes should override. */
listenToControls: function() {
},
/** Render the DataTable. Inheriting classes should override. */
renderDatatable: function() {
$('#gd-datatable-hook').append(
'<h3>Datatable goes here</h3>');
},
/** Properly clean up this component. Inheriting classes should override. */
destroy: function() {
}
});
| {
"content_hash": "ca129a8b4c55d0fff40a07b0c71ce8a4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 22.02857142857143,
"alnum_prop": 0.6536964980544747,
"repo_name": "woodymit/millstone_accidental_source",
"id": "bf2a556a5b91980066fad0f09d567a79dc81e903",
"size": "771",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "genome_designer/main/static/js/analyze/tab_analyze_subview_abstract_base.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11461"
},
{
"name": "CoffeeScript",
"bytes": "3226"
},
{
"name": "HTML",
"bytes": "76254"
},
{
"name": "JavaScript",
"bytes": "140841"
},
{
"name": "Python",
"bytes": "1009103"
},
{
"name": "Shell",
"bytes": "824"
}
],
"symlink_target": ""
} |
package de.marx_labs.utilities.utils.logging.handler;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.logging.ErrorManager;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.StreamHandler;
/**
* File handler that supports different kind of rolling than
* java.util.logging.FileHandler. Supported rolling methods are: by date (day).
*
* Example of entries in the logging file (system property
* "java.util.logging.config.file"):
*
* <table align="center" bgcolor="#ddddff" border=1 cellpadding="10" cellspacing="0">
* <tr>
* <td>
*
* <pre>
* logging.RollingFileHandler.level = FINEST
* logging.RollingFileHandler.prefix = MyApp_
* logging.RollingFileHandler.dateFormat = yyyyMMdd
* logging.RollingFileHandler.suffix = .log
* logging.RollingFileHanlder.cycle=day
* logging.RollingFileHandler.formatter = java.util.logging.SimpleFormatter
* </pre>
*
* </td>
* </tr>
* </table>
*
* @version $Revision:$ ($Date:$)
* @author $Author:$
*/
public class RollingFileHandler extends StreamHandler {
/** File prefix. */
private static String prefix = null;
/** Date format to use in file name. */
private static String dateFormat = "yyyy-MM-dd"; // default
/** File suffix. */
private static String suffix = null;
/** Time in milliseconds for the next cycle */
private static long nextCycle = 0;
/** Time cycle (for file roling) */
private static String cycle = "day"; // default
public RollingFileHandler(String prefix, String suffix) {
this.suffix = suffix;
this.prefix = prefix;
openFile();
}
/**
* Constructor.
*/
public RollingFileHandler() {
super();
LogManager manager = LogManager.getLogManager();
String className = RollingFileHandler.class.getName();
prefix = manager.getProperty(className + ".prefix");
String dfs = manager.getProperty(className + ".dateFormat");
suffix = manager.getProperty(className + ".suffix");
String c = manager.getProperty(className + ".cycle");
String formatter = manager.getProperty(className + ".formatter");
if (dfs != null) {
dateFormat = dfs;
}
if (c != null) {
if (c.equalsIgnoreCase("day") || c.equalsIgnoreCase("week")
|| c.equalsIgnoreCase("month")
|| c.equalsIgnoreCase("year")) {
cycle = c;
}
}
if (formatter != null) {
try {
setFormatter((Formatter) Class.forName(formatter).newInstance());
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
openFile();
}// RollingFileHandler()
/**
* Open existing or create new log file.
*/
private synchronized void openFile() {
// create file name:
String dateString = dateFormat; // default (to note error in file name)
Date currentDate = new Date();
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat,
Locale.getDefault());
dateString = sdf.format(currentDate);
} catch (IllegalArgumentException iae) {
/* ignore wrong date format */
}
// compute next cycle:
Date nextDate = null;
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(currentDate);
if (cycle.equalsIgnoreCase("week")) {
gc.add(Calendar.WEEK_OF_YEAR, 1);
nextDate = gc.getTime();
} else if (cycle.equalsIgnoreCase("month")) {
gc.add(Calendar.MONTH, 1);
int month = gc.get(Calendar.MONTH);
int year = gc.get(Calendar.YEAR);
GregorianCalendar gc2 = new GregorianCalendar(year, month, 1);
nextDate = gc2.getTime();
} else if (cycle.equalsIgnoreCase("year")) {
gc.add(Calendar.YEAR, 1);
int year = gc.get(Calendar.YEAR);
GregorianCalendar gc2 = new GregorianCalendar(year, 0, 1);
nextDate = gc2.getTime();
} else { // day by default
gc.add(Calendar.DAY_OF_MONTH, 1);
nextDate = gc.getTime();
}
// to zero time:
gc = new GregorianCalendar();
gc.setTime(nextDate);
gc.set(Calendar.HOUR, 0);
gc.set(Calendar.HOUR_OF_DAY, 0);
gc.set(Calendar.MINUTE, 0);
gc.set(Calendar.SECOND, 0);
gc.set(Calendar.MILLISECOND, 0);
nextDate = gc.getTime();
nextCycle = nextDate.getTime();
// create new file:
String fileName = prefix + dateString + suffix;
File file = new File(fileName);
// create file:
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
}
}
// set log file as OutputStream:
try {
FileOutputStream fos = new FileOutputStream(file, true);
setOutputStream(fos);
} catch (FileNotFoundException fnfe) {
reportError(null, fnfe, ErrorManager.OPEN_FAILURE);
fnfe.printStackTrace(System.err);
setOutputStream(System.out); // fallback stream
}
}// openFile()
/**
* Overwrites super.
*/
public synchronized void publish(LogRecord record) {
if (!isLoggable(record)) {
return;
}
super.publish(record);
flush();
// check if we need to rotate
if (System.currentTimeMillis() >= nextCycle) { // next cycle?
role();
}
}// publish()
/**
* Role file. Close current file and possibly create new file.
*/
final private synchronized void role() {
Level oldLevel = getLevel();
setLevel(Level.OFF);
super.close();
openFile();
setLevel(oldLevel);
}// rotate()
}// RollingFileHandler | {
"content_hash": "b4639f060711ee8a571ae91dc27bfeb9",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 85,
"avg_line_length": 28.638743455497384,
"alnum_prop": 0.686837294332724,
"repo_name": "thmarx/Utilities",
"id": "a64157a3e25522def53171091c271ebc1fce9a69",
"size": "6102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/utils/src/main/java/de/marx_labs/utilities/utils/logging/handler/RollingFileHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "139067"
}
],
"symlink_target": ""
} |
using NUnit.Framework;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class AudioComponentTest : AudioThreadTest
{
[Test]
public void TestNestedStoreAdjustments()
{
var customStore = Manager.GetSampleStore(new ResourceStore<byte[]>());
checkAggregateVolume(Manager.Samples, 1);
checkAggregateVolume(customStore, 1);
Manager.Samples.Volume.Value = 0.5;
WaitAudioFrame();
checkAggregateVolume(Manager.Samples, 0.5);
checkAggregateVolume(customStore, 0.5);
customStore.Volume.Value = 0.5;
WaitAudioFrame();
checkAggregateVolume(Manager.Samples, 0.5);
checkAggregateVolume(customStore, 0.25);
}
private void checkAggregateVolume(ISampleStore store, double expected)
{
Assert.AreEqual(expected, store.AggregateVolume.Value);
}
[Test]
public void TestVirtualTrack()
{
var track = Manager.Tracks.GetVirtual();
WaitAudioFrame();
checkTrackCount(1);
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(0, track.CurrentTime);
track.Start();
WaitAudioFrame();
Assert.Greater(track.CurrentTime, 0);
track.Stop();
Assert.IsFalse(track.IsRunning);
track.Dispose();
WaitAudioFrame();
checkTrackCount(0);
}
[Test]
public void TestTrackVirtualSeekCurrent()
{
var trackVirtual = Manager.Tracks.GetVirtual();
trackVirtual.Start();
WaitAudioFrame();
Assert.Greater(trackVirtual.CurrentTime, 0);
trackVirtual.Tempo.Value = 2.0f;
trackVirtual.Frequency.Value = 2.0f;
WaitAudioFrame();
Assert.AreEqual(4.0f, trackVirtual.Rate);
trackVirtual.Stop();
var stoppedTime = trackVirtual.CurrentTime;
Assert.Greater(stoppedTime, 0);
trackVirtual.Seek(stoppedTime);
Assert.AreEqual(stoppedTime, trackVirtual.CurrentTime);
}
private void checkTrackCount(int expected)
=> Assert.AreEqual(expected, ((TrackStore)Manager.Tracks).Items.Count);
}
}
| {
"content_hash": "5115b6f1b45bac2571e0edfa6da0fa82",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 83,
"avg_line_length": 26.148936170212767,
"alnum_prop": 0.5890968266883645,
"repo_name": "ZLima12/osu-framework",
"id": "052e1d19004852cc6109cbaa711d30c6a678f57b",
"size": "2608",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "osu.Framework.Tests/Audio/AudioComponentTest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2489138"
},
{
"name": "C++",
"bytes": "777"
},
{
"name": "GLSL",
"bytes": "7949"
}
],
"symlink_target": ""
} |
package com.bs.lang.builtin;
import com.bs.lang.BsAbstractProto;
import com.bs.lang.BsConst;
import com.bs.lang.BsObject;
import com.bs.lang.annot.BsRuntimeMessage;
public class BsNil extends BsAbstractProto {
public BsNil() {
super(BsConst.Proto, "Nil", BsNil.class);
}
@BsRuntimeMessage(name = "toString", arity = 0)
public BsObject toString(BsObject self, BsObject... args) {
return BsString.clone("Nil");
}
@BsRuntimeMessage(name = "ifNil", arity = 1)
public BsObject ifNil(BsObject self, BsObject... args) {
if (args[0].instanceOf(BsConst.Block)) {
return args[0].invoke("call");
}
return BsError.typeError("ifNil", args[0], BsConst.Block);
}
@BsRuntimeMessage(name = "nil?", arity = 0)
public BsObject isNil(BsObject self, BsObject... args) {
return BsConst.True;
}
@BsRuntimeMessage(name = "nonNil?", arity = 0)
public BsObject isNonNil(BsObject self, BsObject... args) {
return BsConst.False;
}
}
| {
"content_hash": "b93af3bc5e76eb846c9a29268adaaac7",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 60,
"avg_line_length": 25.513513513513512,
"alnum_prop": 0.7076271186440678,
"repo_name": "isakkarlsson/bs",
"id": "f79b2ee8a33b814173f2aa76e3d12233b1608187",
"size": "944",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/bs/lang/builtin/BsNil.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "177839"
},
{
"name": "Perl",
"bytes": "2289"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>V8 API Reference Guide for node.js v9.8.0: v8_inspector::V8Inspector Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v9.8.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>v8_inspector</b></li><li class="navelem"><a class="el" href="classv8__inspector_1_1V8Inspector.html">V8Inspector</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classv8__inspector_1_1V8Inspector-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8_inspector::V8Inspector Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8__inspector_1_1V8Inspector_1_1Channel.html">Channel</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2027babae023eb7745a699de30ef2040"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2027babae023eb7745a699de30ef2040"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>contextCreated</b> (const <a class="el" href="classv8__inspector_1_1V8ContextInfo.html">V8ContextInfo</a> &)=0</td></tr>
<tr class="separator:a2027babae023eb7745a699de30ef2040"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a519c21ce7d4693e27c0b2859f3c5901d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a519c21ce7d4693e27c0b2859f3c5901d"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>contextDestroyed</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >)=0</td></tr>
<tr class="separator:a519c21ce7d4693e27c0b2859f3c5901d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab65e4ca3316c60644bfdefc52a769d99"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab65e4ca3316c60644bfdefc52a769d99"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>resetContextGroup</b> (int contextGroupId)=0</td></tr>
<tr class="separator:ab65e4ca3316c60644bfdefc52a769d99"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a923d7681b39db723a43b279a7429d9ea"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a923d7681b39db723a43b279a7429d9ea"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>idleStarted</b> ()=0</td></tr>
<tr class="separator:a923d7681b39db723a43b279a7429d9ea"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a679251f1e8f90799c45dde8a86c73a80"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a679251f1e8f90799c45dde8a86c73a80"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>idleFinished</b> ()=0</td></tr>
<tr class="separator:a679251f1e8f90799c45dde8a86c73a80"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab9d050ddc357b771b932af978e52aff3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9d050ddc357b771b932af978e52aff3"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskScheduled</b> (const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &taskName, void *task, bool recurring)=0</td></tr>
<tr class="separator:ab9d050ddc357b771b932af978e52aff3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad443be8234a20744558250b92451fc9d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad443be8234a20744558250b92451fc9d"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskCanceled</b> (void *task)=0</td></tr>
<tr class="separator:ad443be8234a20744558250b92451fc9d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a18081a671c17b6c8cc9e827e834518fc"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a18081a671c17b6c8cc9e827e834518fc"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskStarted</b> (void *task)=0</td></tr>
<tr class="separator:a18081a671c17b6c8cc9e827e834518fc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa19d6664fb011102014395d54d16ed68"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa19d6664fb011102014395d54d16ed68"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>asyncTaskFinished</b> (void *task)=0</td></tr>
<tr class="separator:aa19d6664fb011102014395d54d16ed68"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2a92520981e6d348ae004c6c72098975"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a92520981e6d348ae004c6c72098975"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>allAsyncTasksCanceled</b> ()=0</td></tr>
<tr class="separator:a2a92520981e6d348ae004c6c72098975"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a71e69c7b3fbb5eb9c0b5272f6aab3a2d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a71e69c7b3fbb5eb9c0b5272f6aab3a2d"></a>
virtual unsigned </td><td class="memItemRight" valign="bottom"><b>exceptionThrown</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &message, <a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Value.html">v8::Value</a> > exception, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &detailedMessage, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> >, int scriptId)=0</td></tr>
<tr class="separator:a71e69c7b3fbb5eb9c0b5272f6aab3a2d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6853e6b53df0a0058b0e7ff2a3cc94ec"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6853e6b53df0a0058b0e7ff2a3cc94ec"></a>
virtual void </td><td class="memItemRight" valign="bottom"><b>exceptionRevoked</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1Context.html">v8::Context</a> >, unsigned exceptionId, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &message)=0</td></tr>
<tr class="separator:a6853e6b53df0a0058b0e7ff2a3cc94ec"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ada36fa35ede4b3fda70b07fc855458e4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ada36fa35ede4b3fda70b07fc855458e4"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8InspectorSession.html">V8InspectorSession</a> > </td><td class="memItemRight" valign="bottom"><b>connect</b> (int contextGroupId, <a class="el" href="classv8__inspector_1_1V8Inspector_1_1Channel.html">Channel</a> *, const <a class="el" href="classv8__inspector_1_1StringView.html">StringView</a> &state)=0</td></tr>
<tr class="separator:ada36fa35ede4b3fda70b07fc855458e4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4ac935e4871eef8ee5cb2e5ca41a2142"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4ac935e4871eef8ee5cb2e5ca41a2142"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> > </td><td class="memItemRight" valign="bottom"><b>createStackTrace</b> (<a class="el" href="classv8_1_1Local.html">v8::Local</a>< <a class="el" href="classv8_1_1StackTrace.html">v8::StackTrace</a> >)=0</td></tr>
<tr class="separator:a4ac935e4871eef8ee5cb2e5ca41a2142"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a22af900e1627ca8ef9382c0507645d70"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a22af900e1627ca8ef9382c0507645d70"></a>
virtual std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8StackTrace.html">V8StackTrace</a> > </td><td class="memItemRight" valign="bottom"><b>captureStackTrace</b> (bool fullStack)=0</td></tr>
<tr class="separator:a22af900e1627ca8ef9382c0507645d70"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ac7b64842334aadde7dabff1ac6d82cff"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7b64842334aadde7dabff1ac6d82cff"></a>
static std::unique_ptr< <a class="el" href="classv8__inspector_1_1V8Inspector.html">V8Inspector</a> > </td><td class="memItemRight" valign="bottom"><b>create</b> (<a class="el" href="classv8_1_1Isolate.html">v8::Isolate</a> *, <a class="el" href="classv8__inspector_1_1V8InspectorClient.html">V8InspectorClient</a> *)</td></tr>
<tr class="separator:ac7b64842334aadde7dabff1ac6d82cff"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>deps/v8/include/<a class="el" href="v8-inspector_8h_source.html">v8-inspector.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| {
"content_hash": "69341887d3de45f9637dc7211d4782fb",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 813,
"avg_line_length": 80.94767441860465,
"alnum_prop": 0.707749766573296,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "e48c9b1593b5b6ef67ab1ff5c07fda8904e47d23",
"size": "13923",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "056001d/html/classv8__inspector_1_1V8Inspector.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _MonthPanel = require('../month/MonthPanel');
var _MonthPanel2 = _interopRequireDefault(_MonthPanel);
var _YearPanel = require('../year/YearPanel');
var _YearPanel2 = _interopRequireDefault(_YearPanel);
var _mapSelf = require('rc-util/lib/Children/mapSelf');
var _mapSelf2 = _interopRequireDefault(_mapSelf);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function goMonth(direction) {
var next = this.props.value.clone();
next.add(direction, 'months');
this.props.onValueChange(next);
}
function goYear(direction) {
var next = this.props.value.clone();
next.add(direction, 'years');
this.props.onValueChange(next);
}
var CalendarHeader = _react2["default"].createClass({
displayName: 'CalendarHeader',
propTypes: {
enablePrev: _react.PropTypes.any,
enableNext: _react.PropTypes.any,
prefixCls: _react.PropTypes.string,
showTimePicker: _react.PropTypes.bool,
locale: _react.PropTypes.object,
value: _react.PropTypes.object,
onValueChange: _react.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
enableNext: 1,
enablePrev: 1
};
},
getInitialState: function getInitialState() {
this.nextMonth = goMonth.bind(this, 1);
this.previousMonth = goMonth.bind(this, -1);
this.nextYear = goYear.bind(this, 1);
this.previousYear = goYear.bind(this, -1);
return {};
},
onSelect: function onSelect(value) {
this.setState({
showMonthPanel: 0,
showYearPanel: 0
});
this.props.onValueChange(value);
},
monthYearElement: function monthYearElement(showTimePicker) {
var props = this.props;
var prefixCls = props.prefixCls;
var locale = props.locale;
var value = props.value;
var monthBeforeYear = locale.monthBeforeYear;
var selectClassName = prefixCls + '-' + (monthBeforeYear ? 'my-select' : 'ym-select');
var year = _react2["default"].createElement(
'a',
{
className: prefixCls + '-year-select',
role: 'button',
onClick: showTimePicker ? null : this.showYearPanel,
title: locale.monthSelect
},
value.format(locale.yearFormat)
);
var month = _react2["default"].createElement(
'a',
{
className: prefixCls + '-month-select',
role: 'button',
onClick: showTimePicker ? null : this.showMonthPanel,
title: locale.monthSelect
},
value.format(locale.monthFormat)
);
var day = void 0;
if (showTimePicker) {
day = _react2["default"].createElement(
'a',
{
className: prefixCls + '-day-select',
role: 'button'
},
value.format(locale.dayFormat)
);
}
var my = [];
if (monthBeforeYear) {
my = [month, day, year];
} else {
my = [year, month, day];
}
return _react2["default"].createElement(
'span',
{ className: selectClassName },
(0, _mapSelf2["default"])(my)
);
},
showIf: function showIf(condition, el) {
return condition ? el : null;
},
showMonthPanel: function showMonthPanel() {
this.setState({
showMonthPanel: 1,
showYearPanel: 0
});
},
showYearPanel: function showYearPanel() {
this.setState({
showMonthPanel: 0,
showYearPanel: 1
});
},
render: function render() {
var props = this.props;
var enableNext = props.enableNext,
enablePrev = props.enablePrev,
prefixCls = props.prefixCls,
locale = props.locale,
value = props.value,
showTimePicker = props.showTimePicker;
var state = this.state;
var PanelClass = null;
if (state.showMonthPanel) {
PanelClass = _MonthPanel2["default"];
} else if (state.showYearPanel) {
PanelClass = _YearPanel2["default"];
}
var panel = void 0;
if (PanelClass) {
panel = _react2["default"].createElement(PanelClass, {
locale: locale,
defaultValue: value,
rootPrefixCls: prefixCls,
onSelect: this.onSelect
});
}
return _react2["default"].createElement(
'div',
{ className: prefixCls + '-header' },
_react2["default"].createElement(
'div',
{ style: { position: 'relative' } },
this.showIf(enablePrev && !showTimePicker, _react2["default"].createElement('a', {
className: prefixCls + '-prev-year-btn',
role: 'button',
onClick: this.previousYear,
title: locale.previousYear
})),
this.showIf(enablePrev && !showTimePicker, _react2["default"].createElement('a', {
className: prefixCls + '-prev-month-btn',
role: 'button',
onClick: this.previousMonth,
title: locale.previousMonth
})),
this.monthYearElement(showTimePicker),
this.showIf(enableNext && !showTimePicker, _react2["default"].createElement('a', {
className: prefixCls + '-next-month-btn',
onClick: this.nextMonth,
title: locale.nextMonth
})),
this.showIf(enableNext && !showTimePicker, _react2["default"].createElement('a', {
className: prefixCls + '-next-year-btn',
onClick: this.nextYear,
title: locale.nextYear
}))
),
panel
);
}
});
exports["default"] = CalendarHeader;
module.exports = exports['default']; | {
"content_hash": "ba7906b28ff7ce13c81646f0439b1457",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 97,
"avg_line_length": 28.505102040816325,
"alnum_prop": 0.6130302487918382,
"repo_name": "hong1012/FreePay",
"id": "5372fc855136a6bd718e0328aa725b0f370c6fa0",
"size": "5587",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/rc-calendar/lib/calendar/CalendarHeader.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1840"
},
{
"name": "HTML",
"bytes": "649"
},
{
"name": "JavaScript",
"bytes": "57040"
}
],
"symlink_target": ""
} |
package mock_source
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
source "github.com/golang/mock/mockgen/internal/tests/import_source/definition"
)
// MockS is a mock of S interface.
type MockS struct {
ctrl *gomock.Controller
recorder *MockSMockRecorder
}
// MockSMockRecorder is the mock recorder for MockS.
type MockSMockRecorder struct {
mock *MockS
}
// NewMockS creates a new mock instance.
func NewMockS(ctrl *gomock.Controller) *MockS {
mock := &MockS{ctrl: ctrl}
mock.recorder = &MockSMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockS) EXPECT() *MockSMockRecorder {
return m.recorder
}
// F mocks base method.
func (m *MockS) F(arg0 source.X) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "F", arg0)
}
// F indicates an expected call of F.
func (mr *MockSMockRecorder) F(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "F", reflect.TypeOf((*MockS)(nil).F), arg0)
}
| {
"content_hash": "ebbacedcb249f83896cf76cdb39f71f9",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 98,
"avg_line_length": 24.348837209302324,
"alnum_prop": 0.728748806112703,
"repo_name": "golang/mock",
"id": "46677a311038a3737d3b89f3d1dd929f7a8757b7",
"size": "1166",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "mockgen/internal/tests/import_source/source_mock.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "196268"
},
{
"name": "Shell",
"bytes": "1673"
}
],
"symlink_target": ""
} |
@implementation UIRefreshControl (Additions)
- (void)updateRefreshControlTextRefreshing:(BOOL)refreshing
{
NSString *text = nil;
if (refreshing) {
text = NSLocalizedString(@"GENERIC_UPDATING_TITLE", @"Updating...");
} else {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterMediumStyle;
dateFormatter.timeStyle = NSDateFormatterShortStyle;
NSString *lastUpdatedText = NSLocalizedString(@"GENERIC_LAST_UPDATED_TITLE", @"Last updated");
NSString *lastUpdatedDate = [dateFormatter stringFromDate:[[POSModelManager sharedManager] rootResourceCreatedAt]];
lastUpdatedDate = lastUpdatedDate ?: NSLocalizedString(@"GENERIC_UPDATED_NEVER_TITLE", @"never");
text = [NSString stringWithFormat:@"%@: %@", lastUpdatedText, lastUpdatedDate];
}
NSDictionary *attributes = [self.attributedTitle attributesAtIndex:0
effectiveRange:NULL];
self.attributedTitle = [[NSAttributedString alloc] initWithString:text
attributes:attributes];
}
- (void)initializeRefreshControlText
{
NSDictionary *attributes = nil;
if ([self isKindOfClass:[POSDocumentsViewController class]]) {
attributes = @{NSForegroundColorAttributeName : [UIColor colorWithWhite:0.4
alpha:1.0]};
} else {
attributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
}
self.attributedTitle = [[NSAttributedString alloc] initWithString:@" "
attributes:attributes];
}
@end
| {
"content_hash": "a3344d20102f416bb52f09ba61195032",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 123,
"avg_line_length": 45.15384615384615,
"alnum_prop": 0.6240772288472459,
"repo_name": "digipost/ios",
"id": "ab04517ab66325e74178b2f72a46bc45fb16e199",
"size": "2470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Digipost/UIRefreshControl+Additions.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2181"
},
{
"name": "CSS",
"bytes": "216"
},
{
"name": "Objective-C",
"bytes": "573540"
},
{
"name": "Ruby",
"bytes": "1573"
},
{
"name": "Shell",
"bytes": "771"
},
{
"name": "Swift",
"bytes": "299129"
}
],
"symlink_target": ""
} |
#ifndef ASF_H
#define ASF_H
/*
* This file includes all API header files for the selected drivers from ASF.
* Note: There might be duplicate includes required by more than one driver.
*
* The file is automatically generated and will be re-written when
* running the ASF driver selector tool. Any changes will be discarded.
*/
// From module: CPU specific features
#include <mega_reset_cause.h>
// From module: Delay routines
#include <delay.h>
// From module: GPIO - General purpose Input/Output
#include <gpio.h>
// From module: Generic board support
#include <board.h>
// From module: IOPORT - General purpose I/O service
#include <ioport.h>
// From module: Interrupt management - megaAVR and tinyAVR implementation
#include <interrupt.h>
// From module: MAC Symbol Counter
#include <macsc_megarf.h>
// From module: MEGA compiler driver
#include <compiler.h>
#include <status_codes.h>
// From module: Part identification macros
#include <parts.h>
// From module: Sleep Controller driver
#include <sleep.h>
#include <sleep_megarf.h>
// From module: Sleep manager - MEGARF implementation
#include <mega/sleepmgr.h>
#include <sleepmgr.h>
// From module: Standard serial I/O (stdio) - MEGARF implementation
#include <stdio_serial.h>
// From module: System Clock Control - MEGA RF A1 implementation
#include <sysclk.h>
// From module: Timer/Counter (TC) driver
#include <tc_megarf.h>
// From module: USART - Serial interface - MEGARF implementation
#include <serial.h>
// From module: USART - Universal Synchronous/Asynchronous Receiver/Transmitter
#include <usart_megarf.h>
#endif // ASF_H
| {
"content_hash": "4f08528689a973ee6af254bbc7f758ad",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 25.615384615384617,
"alnum_prop": 0.7171171171171171,
"repo_name": "femtoio/femto-usb-blink-example",
"id": "f19f949d2ed5bdcd0445dee61033052300b4f61a",
"size": "3457",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "blinky/blinky/asf-3.21.0/thirdparty/wireless/avr2130_lwmesh/apps/wsndemo/atmega256rfr2_rcb/iar/asf.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "178794"
},
{
"name": "C",
"bytes": "251878780"
},
{
"name": "C++",
"bytes": "47991929"
},
{
"name": "CSS",
"bytes": "2147"
},
{
"name": "HTML",
"bytes": "107322"
},
{
"name": "JavaScript",
"bytes": "588817"
},
{
"name": "Logos",
"bytes": "570108"
},
{
"name": "Makefile",
"bytes": "64558964"
},
{
"name": "Matlab",
"bytes": "10660"
},
{
"name": "Objective-C",
"bytes": "15780083"
},
{
"name": "Perl",
"bytes": "12845"
},
{
"name": "Python",
"bytes": "67293"
},
{
"name": "Scilab",
"bytes": "88572"
},
{
"name": "Shell",
"bytes": "126729"
}
],
"symlink_target": ""
} |
import bisect
from collections import defaultdict
import io
import json
import logging
import zipfile
from babelfish import Language
from guessit import guessit
from requests import Session
from . import ParserBeautifulSoup, Provider
from .. import __short_version__
from ..cache import SHOW_EXPIRATION_TIME, region
from ..exceptions import AuthenticationError, ConfigurationError, ProviderError
from ..subtitle import Subtitle, fix_line_ending, guess_matches
from ..utils import sanitize
from ..video import Episode, Movie
logger = logging.getLogger(__name__)
class SubsCenterSubtitle(Subtitle):
"""SubsCenter Subtitle."""
provider_name = 'subscenter'
def __init__(self, language, hearing_impaired, page_link, series, season, episode, title, subtitle_id, subtitle_key,
downloaded, releases):
super(SubsCenterSubtitle, self).__init__(language, hearing_impaired, page_link)
self.series = series
self.season = season
self.episode = episode
self.title = title
self.subtitle_id = subtitle_id
self.subtitle_key = subtitle_key
self.downloaded = downloaded
self.releases = releases
@property
def id(self):
return str(self.subtitle_id)
def get_matches(self, video):
matches = set()
# episode
if isinstance(video, Episode):
# series
if video.series and sanitize(self.series) == sanitize(video.series):
matches.add('series')
# season
if video.season and self.season == video.season:
matches.add('season')
# episode
if video.episode and self.episode == video.episode:
matches.add('episode')
# guess
for release in self.releases:
matches |= guess_matches(video, guessit(release, {'type': 'episode'}))
# movie
elif isinstance(video, Movie):
# guess
for release in self.releases:
matches |= guess_matches(video, guessit(release, {'type': 'movie'}))
# title
if video.title and sanitize(self.title) == sanitize(video.title):
matches.add('title')
return matches
class SubsCenterProvider(Provider):
"""SubsCenter Provider."""
languages = {Language.fromalpha2(l) for l in ['he']}
server_url = 'http://subscenter.cinemast.com/he/'
def __init__(self, username=None, password=None):
if username is not None and password is None or username is None and password is not None:
raise ConfigurationError('Username and password must be specified')
self.username = username
self.password = password
self.logged_in = False
def initialize(self):
self.session = Session()
self.session.headers['User-Agent'] = 'Subliminal/%s' % __short_version__
# login
if self.username is not None and self.password is not None:
logger.debug('Logging in')
url = self.server_url + 'subscenter/accounts/login/'
# retrieve CSRF token
self.session.get(url)
csrf_token = self.session.cookies['csrftoken']
# actual login
data = {'username': self.username, 'password': self.password, 'csrfmiddlewaretoken': csrf_token}
r = self.session.post(url, data, allow_redirects=False, timeout=10)
if r.status_code != 302:
raise AuthenticationError(self.username)
logger.info('Logged in')
self.logged_in = True
def terminate(self):
# logout
if self.logged_in:
logger.info('Logging out')
r = self.session.get(self.server_url + 'subscenter/accounts/logout/', timeout=10)
r.raise_for_status()
logger.info('Logged out')
self.logged_in = False
self.session.close()
@region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME)
def _search_url_titles(self, title):
"""Search the URL titles by kind for the given `title`.
:param str title: title to search for.
:return: the URL titles by kind.
:rtype: collections.defaultdict
"""
# make the search
logger.info('Searching title name for %r', title)
r = self.session.get(self.server_url + 'subtitle/search/', params={'q': title}, timeout=10)
r.raise_for_status()
# get the suggestions
soup = ParserBeautifulSoup(r.content, ['lxml', 'html.parser'])
links = soup.select('#processes div.generalWindowTop a')
logger.debug('Found %d suggestions', len(links))
url_titles = defaultdict(list)
for link in links:
parts = link.attrs['href'].split('/')
url_titles[parts[-3]].append(parts[-2])
return url_titles
def query(self, title, season=None, episode=None):
# search for the url title
url_titles = self._search_url_titles(title)
# episode
if season and episode:
if 'series' not in url_titles:
logger.error('No URL title found for series %r', title)
return []
url_title = url_titles['series'][0]
logger.debug('Using series title %r', url_title)
url = self.server_url + 'cinemast/data/series/sb/{}/{}/{}/'.format(url_title, season, episode)
page_link = self.server_url + 'subtitle/series/{}/{}/{}/'.format(url_title, season, episode)
else:
if 'movie' not in url_titles:
logger.error('No URL title found for movie %r', title)
return []
url_title = url_titles['movie'][0]
logger.debug('Using movie title %r', url_title)
url = self.server_url + 'cinemast/data/movie/sb/{}/'.format(url_title)
page_link = self.server_url + 'subtitle/movie/{}/'.format(url_title)
# get the list of subtitles
logger.debug('Getting the list of subtitles')
r = self.session.get(url)
r.raise_for_status()
results = json.loads(r.text)
# loop over results
subtitles = {}
for language_code, language_data in results.items():
for quality_data in language_data.values():
for quality, subtitles_data in quality_data.items():
for subtitle_item in subtitles_data.values():
# read the item
language = Language.fromalpha2(language_code)
hearing_impaired = bool(subtitle_item['hearing_impaired'])
subtitle_id = subtitle_item['id']
subtitle_key = subtitle_item['key']
downloaded = subtitle_item['downloaded']
release = subtitle_item['subtitle_version']
# add the release and increment downloaded count if we already have the subtitle
if subtitle_id in subtitles:
logger.debug('Found additional release %r for subtitle %d', release, subtitle_id)
bisect.insort_left(subtitles[subtitle_id].releases, release) # deterministic order
subtitles[subtitle_id].downloaded += downloaded
continue
# otherwise create it
subtitle = SubsCenterSubtitle(language, hearing_impaired, page_link, title, season, episode,
title, subtitle_id, subtitle_key, downloaded, [release])
logger.debug('Found subtitle %r', subtitle)
subtitles[subtitle_id] = subtitle
return subtitles.values()
def list_subtitles(self, video, languages):
season = episode = None
title = video.title
if isinstance(video, Episode):
title = video.series
season = video.season
episode = video.episode
return [s for s in self.query(title, season, episode) if s.language in languages]
def download_subtitle(self, subtitle):
# download
url = self.server_url + 'subtitle/download/{}/{}/'.format(subtitle.language.alpha2, subtitle.subtitle_id)
params = {'v': subtitle.releases[0], 'key': subtitle.subtitle_key}
r = self.session.get(url, params=params, headers={'Referer': subtitle.page_link}, timeout=10)
r.raise_for_status()
# open the zip
with zipfile.ZipFile(io.BytesIO(r.content)) as zf:
# remove some filenames from the namelist
namelist = [n for n in zf.namelist() if not n.endswith('.txt')]
if len(namelist) > 1:
raise ProviderError('More than one file to unzip')
subtitle.content = fix_line_ending(zf.read(namelist[0]))
| {
"content_hash": "5603096772a0d567d61e4feb4c5bbcaa",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 120,
"avg_line_length": 39.440528634361236,
"alnum_prop": 0.5872891768122417,
"repo_name": "neo1691/subliminal",
"id": "ac620a3d1f6f601c5031d20b156e545e8feb37a6",
"size": "8977",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "subliminal/providers/subscenter.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "317334"
}
],
"symlink_target": ""
} |
module Msg
class Attachment < ActiveRecord::Base
belongs_to :message
def for_mandrill
{
type: file_content_type,
name: file_name,
content: file_content
}
end
end
end
| {
"content_hash": "13d8690f6a5480edb1c1c6dd3592932a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 39,
"avg_line_length": 15.714285714285714,
"alnum_prop": 0.5818181818181818,
"repo_name": "spanner/msg",
"id": "f7ef7553922fc4aa53108af24e577f0038f5e8bf",
"size": "307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/msg/attachment.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4590"
},
{
"name": "CoffeeScript",
"bytes": "166"
},
{
"name": "JavaScript",
"bytes": "7215"
},
{
"name": "Ruby",
"bytes": "61389"
}
],
"symlink_target": ""
} |
from copy import copy
from optparse import Option, OptionValueError
def _check_mesos_cluster(option, opt, value):
cluster_name = value
if option.clusters and cluster_name in option.clusters:
return option.clusters[cluster_name]
elif option.cluster_provider:
return option.cluster_provider(cluster_name)
cluster_list = ""
if option.clusters:
cluster_list = 'Valid options for clusters are %s' % ' '.join(option.clusters)
raise OptionValueError(
'%s is not a valid cluster for the %s option. %s' % (value, opt, cluster_list))
class ClusterOption(Option):
"""A command-line Option that requires a valid cluster name and returns a Cluster object.
Use in an @app.command_option decorator to avoid boilerplate. For example:
CLUSTER_PATH = os.path.expanduser('~/.clusters')
CLUSTERS = Clusters.from_json(CLUSTER_PATH)
@app.command
@app.command_option(ClusterOption('--cluster', default='smf1-test', clusters=CLUSTERS))
def get_health(args, options):
if options.cluster.zk_server:
do_something(options.cluster)
@app.command
@app.command_option(ClusterOption('-s',
'--source_cluster',
default='smf1-test',
clusters=CLUSTERS,
help='Source cluster to pull metadata from.'))
@app.command_option(ClusterOption('-d',
'--dest_cluster',
clusters=CLUSTERS,
default='smf1-test'))
def copy_metadata(args, options):
if not options.source_cluster:
print('required option source_cluster missing!')
metadata_copy(options.source_cluster, options.dest_cluster)
"""
# Needed since we're creating a new type for validation - see optparse docs.
TYPES = copy(Option.TYPES) + ('mesos_cluster',)
TYPE_CHECKER = copy(Option.TYPE_CHECKER)
TYPE_CHECKER['mesos_cluster'] = _check_mesos_cluster
def __init__(self, *opt_str, **attrs):
"""
*opt_str: Same meaning as in twitter.common.options.Option, at least one is required.
**attrs: See twitter.common.options.Option, with the following caveats:
Exactly one of the following must be provided:
clusters: A static Clusters object from which to pick clusters.
cluster_provider: A function that takes a cluster name and returns a Cluster object.
"""
self.clusters = attrs.pop('clusters', None)
self.cluster_provider = attrs.pop('cluster_provider', None)
if not (self.clusters is not None) ^ (self.cluster_provider is not None):
raise ValueError('Must specify exactly one of clusters and cluster_provider.')
default_attrs = dict(
default=None,
action='store',
type='mesos_cluster',
help='Mesos cluster to use (Default: %%default)'
)
combined_attrs = default_attrs
combined_attrs.update(attrs) # Defensive copy
Option.__init__(self, *opt_str, **combined_attrs) # old-style superclass
| {
"content_hash": "791afa89f5481f2a70b59fa4a8c73ca2",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 91,
"avg_line_length": 36.30379746835443,
"alnum_prop": 0.6886331938633193,
"repo_name": "mkhutornenko/incubator-aurora",
"id": "77202c286529e59576cb8aeb1c3e24f86ee5cb27",
"size": "3417",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "src/main/python/apache/aurora/common/cluster_option.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2391"
},
{
"name": "Groovy",
"bytes": "15108"
},
{
"name": "Java",
"bytes": "1620408"
},
{
"name": "JavaScript",
"bytes": "71008"
},
{
"name": "Python",
"bytes": "1327488"
},
{
"name": "Ruby",
"bytes": "4252"
},
{
"name": "Shell",
"bytes": "53305"
}
],
"symlink_target": ""
} |
/* eslint ava/no-only-test:0 */
const test = require('ava')
const plugin = require('../lib/')
const { readFileSync } = require('fs')
const path = require('path')
const posthtml = require('posthtml')
const render = require('posthtml-render')
const fixtures = path.join(__dirname, 'fixtures')
const { minify } = require('html-minifier')
function min(inp) {
return minify(inp, { collapseWhitespace: true, minifyCSS: true })
}
function compare(t, name, options) {
const html = readFileSync(path.join(fixtures, `${name}.html`), 'utf8')
const expected = readFileSync(path.join(fixtures, `${name}.expected.html`), 'utf8')
return posthtml([plugin(options)])
.process(html)
.then(res => t.truthy(min(render(res.tree)) === min(expected)))
}
test.only('html file, removes some classes, some id\'s', t => compare(t, 'basic'))
test('works with non-html content on a file with .html extension', t => compare(t, 'non-html'))
test('it\'s working when empty html files are passed', t => compare(t, 'empty'))
test('ignores (with glob) in the options object do work', t => compare(t, 'options', { whitelist: ['#ignored-id', '.module-*'] }))
| {
"content_hash": "77387198f84a5513965026664142f9ad",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 130,
"avg_line_length": 36.96774193548387,
"alnum_prop": 0.6736474694589878,
"repo_name": "code-and-send/posthtml-email-remove-unused-css",
"id": "1fb6376201c820bbf620c5841e195dfc82d06dfa",
"size": "1146",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1490"
}
],
"symlink_target": ""
} |
// /Copyright 2003-2005 Arthur van Hoff, Rick Blair
// Licensed under Apache License version 2.0
// Original license LGPL
package javax.jmdns;
import java.io.Closeable;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Collection;
import java.util.Map;
import javax.jmdns.impl.JmDNSImpl;
/**
* mDNS implementation in Java.
*
* @author Arthur van Hoff, Rick Blair, Jeff Sonstein, Werner Randelshofer, Pierre Frisch, Scott Lewis, Scott Cytacki
*/
public abstract class JmDNS implements Closeable {
/**
*
*/
public static interface Delegate {
/**
* This method is called if JmDNS cannot recover from an I/O error.
*
* @param dns
* target DNS
* @param infos
* service info registered with the DNS
*/
public void cannotRecoverFromIOError(JmDNS dns, Collection<ServiceInfo> infos);
}
/**
* The version of JmDNS.
*/
public static final String VERSION = "3.4.0";
/**
* <p>
* Create an instance of JmDNS.
* </p>
* <p>
* <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
* Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
* This call is equivalent to <code>create(null, null)</code>.
* </p>
*
* @see #create(InetAddress, String)
* @return jmDNS instance
* @exception IOException
* if an exception occurs during the socket creation
*/
public static JmDNS create() throws IOException {
return new JmDNSImpl(null, null);
}
/**
* <p>
* Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
* </p>
* <p>
* <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
* Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
* This call is equivalent to <code>create(addr, null)</code>.
* </p>
*
* @see #create(InetAddress, String)
* @param addr
* IP address to bind to.
* @return jmDNS instance
* @exception IOException
* if an exception occurs during the socket creation
*/
public static JmDNS create(final InetAddress addr) throws IOException {
return new JmDNSImpl(addr, null);
}
/**
* <p>
* Create an instance of JmDNS.
* </p>
* <p>
* <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
* Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
* This call is equivalent to <code>create(null, name)</code>.
* </p>
*
* @see #create(InetAddress, String)
* @param name
* name of the newly created JmDNS
* @return jmDNS instance
* @exception IOException
* if an exception occurs during the socket creation
*/
public static JmDNS create(final String name) throws IOException {
return new JmDNSImpl(null, name);
}
/**
* <p>
* Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
* </p>
* If <code>addr</code> parameter is null this method will try to resolve to a local IP address of the machine using a network discovery:
* <ol>
* <li>Check the system property <code>net.mdns.interface</code></li>
* <li>Check the JVM local host</li>
* <li>Use the {@link NetworkTopologyDiscovery} to find a valid network interface and IP.</li>
* <li>In the last resort bind to the loopback address. This is non functional in most cases.</li>
* </ol>
* If <code>name</code> parameter is null will use the hostname. The hostname is determined by the following algorithm:
* <ol>
* <li>Get the hostname from the InetAdress obtained before.</li>
* <li>If the hostname is a reverse lookup default to <code>JmDNS name</code> or <code>computer</code> if null.</li>
* <li>If the name contains <code>'.'</code> replace them by <code>'-'</code></li>
* <li>Add <code>.local.</code> at the end of the name.</li>
* </ol>
* <p>
* <b>Note:</b> If you need to use a custom {@link NetworkTopologyDiscovery} it must be setup before any call to this method. This is done by setting up a {@link NetworkTopologyDiscovery.Factory.ClassDelegate} and installing it using
* {@link NetworkTopologyDiscovery.Factory#setClassDelegate(NetworkTopologyDiscovery.Factory.ClassDelegate)}. This must be done before creating a {@link JmDNS} or {@link JmmDNS} instance.
* </p>
*
* @param addr
* IP address to bind to.
* @param name
* name of the newly created JmDNS
* @return jmDNS instance
* @exception IOException
* if an exception occurs during the socket creation
*/
public static JmDNS create(final InetAddress addr, final String name) throws IOException {
return new JmDNSImpl(addr, name);
}
/**
* Return the name of the JmDNS instance. This is an arbitrary string that is useful for distinguishing instances.
*
* @return name of the JmDNS
*/
public abstract String getName();
/**
* Return the HostName associated with this JmDNS instance. Note: May not be the same as what started. The host name is subject to negotiation.
*
* @return Host name
*/
public abstract String getHostName();
/**
* Return the address of the interface to which this instance of JmDNS is bound.
*
* @return Internet Address
* @exception IOException
* if there is an error in the underlying protocol, such as a TCP error.
*/
public abstract InetAddress getInterface() throws IOException;
/**
* Get service information. If the information is not cached, the method will block until updated information is received.
* <p/>
* Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
*
* @param type
* fully qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @return null if the service information cannot be obtained
*/
public abstract ServiceInfo getServiceInfo(String type, String name);
/**
* Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.
* <p/>
* Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param timeout
* timeout in milliseconds. Typical timeout should be 5s.
* @return null if the service information cannot be obtained
*/
public abstract ServiceInfo getServiceInfo(String type, String name, long timeout);
/**
* Get service information. If the information is not cached, the method will block until updated information is received.
* <p/>
* Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
*
* @param type
* fully qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param persistent
* if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
* @return null if the service information cannot be obtained
*/
public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent);
/**
* Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.
* <p/>
* Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param timeout
* timeout in milliseconds. Typical timeout should be 5s.
* @param persistent
* if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
* @return null if the service information cannot be obtained
*/
public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent, long timeout);
/**
* Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
* <p/>
* Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
*/
public abstract void requestServiceInfo(String type, String name);
/**
* Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
* <p/>
* Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param persistent
* if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
*/
public abstract void requestServiceInfo(String type, String name, boolean persistent);
/**
* Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param timeout
* timeout in milliseconds
*/
public abstract void requestServiceInfo(String type, String name, long timeout);
/**
* Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code> .
* @param name
* unqualified service name, such as <code>foobar</code> .
* @param persistent
* if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
* @param timeout
* timeout in milliseconds
*/
public abstract void requestServiceInfo(String type, String name, boolean persistent, long timeout);
/**
* Listen for service types.
*
* @param listener
* listener for service types
* @exception IOException
* if there is an error in the underlying protocol, such as a TCP error.
*/
public abstract void addServiceTypeListener(ServiceTypeListener listener) throws IOException;
/**
* Remove listener for service types.
*
* @param listener
* listener for service types
*/
public abstract void removeServiceTypeListener(ServiceTypeListener listener);
/**
* Listen for services of a given type. The type has to be a fully qualified type name such as <code>_http._tcp.local.</code>.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code>.
* @param listener
* listener for service updates
*/
public abstract void addServiceListener(String type, ServiceListener listener);
/**
* Remove listener for services of a given type.
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code>.
* @param listener
* listener for service updates
*/
public abstract void removeServiceListener(String type, ServiceListener listener);
/**
* Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.<br>
* Note that the given {@code ServiceInfo} is bound to this {@code JmDNS} instance, and should not be reused for any other {@linkplain #registerService(ServiceInfo)}.
*
* @param info
* service info to register
* @exception IOException
* if there is an error in the underlying protocol, such as a TCP error.
*/
public abstract void registerService(ServiceInfo info) throws IOException;
/**
* Unregister a service. The service should have been registered.
* <p>
* <b>Note:</b> Unregistered services will not disappear form the list of services immediately. According to the specification, when unregistering services we send goodbye packets and then wait <b>1s</b> before purging the cache.<br/>
* This is support for shared records that can be rescued by some other cooperation DNS.
*
* <pre>
* Clients receiving a Multicast DNS Response with a TTL of zero SHOULD NOT immediately delete the record from the cache, but instead record a TTL of 1 and then delete the record one second later.
* </pre>
*
* </p>
*
* @param info
* service info to remove
*/
public abstract void unregisterService(ServiceInfo info);
/**
* Unregister all services.
*/
public abstract void unregisterAllServices();
/**
* Register a service type. If this service type was not already known, all service listeners will be notified of the new service type.
* <p>
* Service types are automatically registered as they are discovered.
* </p>
*
* @param type
* full qualified service type, such as <code>_http._tcp.local.</code>.
* @return <code>true</code> if the type or subtype was added, <code>false</code> if the type was already registered.
*/
public abstract boolean registerServiceType(String type);
/**
* List Services and serviceTypes. Debugging Only
*
* @deprecated since 3.2.2
*/
@Deprecated
public abstract void printServices();
/**
* Returns a list of service infos of the specified type.
*
* @param type
* Service type name, such as <code>_http._tcp.local.</code>.
* @return An array of service instance.
*/
public abstract ServiceInfo[] list(String type);
/**
* Returns a list of service infos of the specified type.
*
* @param type
* Service type name, such as <code>_http._tcp.local.</code>.
* @param timeout
* timeout in milliseconds. Typical timeout should be 6s.
* @return An array of service instance.
*/
public abstract ServiceInfo[] list(String type, long timeout);
/**
* Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
*
* @param type
* Service type name, such as <code>_http._tcp.local.</code>.
* @return A dictionary of service info by subtypes.
*/
public abstract Map<String, ServiceInfo[]> listBySubtype(String type);
/**
* Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
*
* @param type
* Service type name, such as <code>_http._tcp.local.</code>.
* @param timeout
* timeout in milliseconds. Typical timeout should be 6s.
* @return A dictionary of service info by subtypes.
*/
public abstract Map<String, ServiceInfo[]> listBySubtype(String type, long timeout);
/**
* Returns the instance delegate
*
* @return instance delegate
*/
public abstract Delegate getDelegate();
/**
* Sets the instance delegate
*
* @param value
* new instance delegate
* @return previous instance delegate
*/
public abstract Delegate setDelegate(Delegate value);
}
| {
"content_hash": "a1948f2b751b137ea278067a234c6353",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 238,
"avg_line_length": 41.51184834123223,
"alnum_prop": 0.6461924877269095,
"repo_name": "narakai/JAirPort",
"id": "08576742bc2c12fafa3d71b31daa2f6477e56366",
"size": "17518",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "src/javax/jmdns/JmDNS.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "534606"
}
],
"symlink_target": ""
} |
import myfunctions
import random
#Ask user for inputs and check validity
while True:
qns = int(input("How many problems would you like to attempt? "))
if qns <= 0:
print("Invalid number, try again\n")
continue
else:
break
while True:
width = int(input("How wide do you want your digits to be? 5-10: "))
if width < 5 or width > 10:
print("Invalid width, try again\n")
continue
else:
break
while True:
drill = str.lower(input("Would you like to activate 'drill' mode? yes or no: "))
if drill != "yes" and drill != "no":
print("Invalid response, try again\n")
continue
else:
break
print("\nHere we go!")
#Define variables to track score and statistics
tscore = 0
addition = 0
subtraction = 0
multiplication = 0
division = 0
addition_score = 0
subtraction_score = 0
multiplication_score = 0
division_score = 0
#Set number of questions
for i in range(qns):
print("\nWhat is .....\n")
#Define parameters
x = random.randint(0, 9)
op = random.randint(1, 4)
y = random.randint(0, 9)
#Check for valid division equation
if op == 4:
if y == 0:
y = random.randint(1, 9)
while x % y != 0:
x = random.randint(0, 9)
y = random.randint(1, 9)
#Display first number
if x == 0:
myfunctions.number_0(width)
elif x == 1:
myfunctions.number_1(width)
elif x == 2:
myfunctions.number_2(width)
elif x == 3:
myfunctions.number_3(width)
elif x == 4:
myfunctions.number_4(width)
elif x == 5:
myfunctions.number_5(width)
elif x == 6:
myfunctions.number_6(width)
elif x == 7:
myfunctions.number_7(width)
elif x == 8:
myfunctions.number_8(width)
elif x == 9:
myfunctions.number_9(width)
#Display operator
if op == 1:
op = "+"
myfunctions.plus(width)
addition += 1
elif op == 2:
op = "-"
myfunctions.minus(width)
subtraction += 1
elif op == 3:
op = "*"
myfunctions.multiply(width)
multiplication += 1
elif op == 4:
op = "/"
myfunctions.divide(width)
division += 1
#Display second number
if y == 0:
myfunctions.number_0(width)
elif y == 1:
myfunctions.number_1(width)
elif y == 2:
myfunctions.number_2(width)
elif y == 3:
myfunctions.number_3(width)
elif y == 4:
myfunctions.number_4(width)
elif y == 5:
myfunctions.number_5(width)
elif y == 6:
myfunctions.number_6(width)
elif y == 7:
myfunctions.number_7(width)
elif y == 8:
myfunctions.number_8(width)
elif y == 9:
myfunctions.number_9(width)
#Ask user for answer and check answer
if drill == "no":
z = int(input("= "))
if myfunctions.check_answer(x, y, z, op) == True:
print("Correct!")
tscore += 1
if op == "+":
addition_score += 1
if op == "-":
subtraction_score += 1
if op == "*":
multiplication_score += 1
if op == "/":
division_score += 1
else:
print("Sorry, that's not correct.")
elif drill == "yes":
while True:
z = int(input("= "))
if myfunctions.check_answer(x, y, z, op) == False:
print("Sorry, that's not correct.")
if op == "+":
addition_score += 1
if op == "-":
subtraction_score += 1
if op == "*":
multiplication_score += 1
if op == "/":
division_score += 1
continue
else:
print("Correct!")
break
#Display score
if drill == "no":
print("\nYou got %d out of %d correct!" %(tscore, qns))
for operator, count, score in zip(["addition", "subtraction", "multiplication", "division"], [addition, subtraction, multiplication, division], [addition_score, subtraction_score, multiplication_score, division_score]):
if count == 0:
print("\nNo %s problems presented" %(operator))
else:
print("\nTotal %s problems presented: %d" %(operator, count))
print("Correct %s problems: %d (%s)" %(operator, score, format(score/count, ".1%")))
elif drill == "yes":
for operator, count, score in zip(["addition", "subtraction", "multiplication", "division"], [addition, subtraction, multiplication, division], [addition_score, subtraction_score, multiplication_score, division_score]):
if score == 0:
praise = "(perfect!)"
else:
praise = ""
if count == 0:
print("\nNo %s problems presented" %(operator))
else:
print("\nTotal %s problems presented: %d" %(operator, count))
print("# of extra attempts needed: %d %s" %(score, praise))
| {
"content_hash": "1c8cfcecee1e05b506bd545ad0865ec6",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 223,
"avg_line_length": 30.03409090909091,
"alnum_prop": 0.5107832009080591,
"repo_name": "sojournexx/python",
"id": "b4f467de862ac5d1ca87acf2d7d8a6057e9f8502",
"size": "5318",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assignments/TanAndrew_assign6.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "48441"
}
],
"symlink_target": ""
} |
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtiRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._reader = vtk.vtkXMLImageDataReader()
# ctor for this specific mixin
FilenameViewModuleMixin.__init__(
self,
'Select a filename',
'VTK Image Data (*.vti)|*.vti|All files (*)|*',
{'vtkXMLImageDataReader': self._reader,
'Module (self)' : self})
module_utils.setup_vtk_object_progress(
self, self._reader,
'Reading VTK ImageData')
# set up some defaults
self._config.filename = ''
# there is no view yet...
self._module_manager.sync_module_logic_with_config(self)
def close(self):
del self._reader
FilenameViewModuleMixin.close(self)
def get_input_descriptions(self):
return ()
def set_input(self, idx, input_stream):
raise Exception
def get_output_descriptions(self):
return ('vtkImageData',)
def get_output(self, idx):
return self._reader.GetOutput()
def logic_to_config(self):
filename = self._reader.GetFileName()
if filename == None:
filename = ''
self._config.filename = filename
def config_to_logic(self):
self._reader.SetFileName(self._config.filename)
def view_to_config(self):
self._config.filename = self._getViewFrameFilename()
def config_to_view(self):
self._setViewFrameFilename(self._config.filename)
def execute_module(self):
# get the vtkPolyDataReader to try and execute
if len(self._reader.GetFileName()):
self._reader.Update()
def streaming_execute_module(self):
if len(self._reader.GetFileName()):
self._reader.UpdateInformation()
self._reader.GetOutput().SetUpdateExtentToWholeExtent()
self._reader.Update()
| {
"content_hash": "b508aa2e2167c2d33641ec154d421e34",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 67,
"avg_line_length": 27.743589743589745,
"alnum_prop": 0.6030499075785583,
"repo_name": "chrisidefix/devide",
"id": "4fdd5bc150789a8c98d7fe31f8011c5630fbb523",
"size": "2172",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "modules/readers/vtiRDR.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Diff",
"bytes": "1373"
},
{
"name": "NSIS",
"bytes": "2786"
},
{
"name": "Python",
"bytes": "3104368"
},
{
"name": "Shell",
"bytes": "7369"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Windows.Media;
using AllYourTextsLib.Framework;
using AllYourTextsUi.Framework;
namespace AllYourTextsUi
{
public abstract class ConversationRendererBase : IConversationRenderer
{
private IDisplayOptionsReadOnly _displayOptions;
protected string _remoteName;
private const string _localName = "Me";
private IConversation _conversation;
private DateTime _lastMessageDate;
private int _lastMessageReadIndex;
private bool _renderedEmptyMessage;
private List<IContact> _remoteContacts;
private Color _localSenderColor;
private Color[] _remoteSenderColors;
protected const string _noConversationMessage = "No messages for this contact.";
public const int RenderAllMessages = -1;
public ConversationRendererBase(IDisplayOptionsReadOnly displayOptions, IConversation conversation)
{
_displayOptions = displayOptions;
_conversation = conversation;
_lastMessageDate = DateTime.MinValue;
_lastMessageReadIndex = -1;
_renderedEmptyMessage = false;
_remoteContacts = new List<IContact>();
_localSenderColor = Color.FromRgb(210, 0, 0);
_remoteSenderColors = new Color[6];
_remoteSenderColors[0] = Color.FromRgb(0, 0, 210);
_remoteSenderColors[1] = Color.FromRgb(114, 159, 0);
_remoteSenderColors[2] = Color.FromRgb(186, 124, 30);
_remoteSenderColors[3] = Color.FromRgb(0, 210, 210);
_remoteSenderColors[4] = Color.FromRgb(143, 2, 128);
_remoteSenderColors[5] = Color.FromRgb(52, 143, 156);
ClearRenderingBuffer();
}
public bool HasUnprocessedMessages
{
get
{
if (_conversation == null)
{
return false;
}
if ((_conversation.MessageCount - (_lastMessageReadIndex + 1)) <= 0)
{
return false;
}
return true;
}
}
private bool IsEmptyConversation()
{
if ((_conversation != null) && (_conversation.MessageCount == 0))
{
return true;
}
else
{
return false;
}
}
protected void RenderMessagesImpl(int messageCount)
{
if (!_renderedEmptyMessage && IsEmptyConversation())
{
AddEmptyConversationMessage();
_renderedEmptyMessage = true;
return;
}
else if ((_conversation == null) || (_lastMessageReadIndex + 1 >= _conversation.MessageCount))
{
ClearRenderingBuffer();
return;
}
ClearRenderingBuffer();
int messageEndIndex;
if (messageCount == RenderAllMessages)
{
messageEndIndex = _conversation.MessageCount;
}
else
{
messageEndIndex = Math.Min(_conversation.MessageCount, (_lastMessageReadIndex + 1) + messageCount);
}
for (int messageIndex = _lastMessageReadIndex + 1; messageIndex < messageEndIndex; messageIndex++)
{
ProcessMessage(messageIndex);
}
if (messageEndIndex == _conversation.MessageCount)
{
MoveCurrentParagraphToBuffer();
}
}
private void ProcessMessage(int messageIndex)
{
IConversationMessage message = _conversation.GetMessage(messageIndex);
if (message.Timestamp.Date != _lastMessageDate)
{
StartNewParagraph();
AddDateLine(message.Timestamp);
_lastMessageDate = message.Timestamp.Date;
}
AddLineBreak();
AddMessageLine(message);
if (_displayOptions.LoadMmsAttachments && message.HasAttachments())
{
foreach (IMessageAttachment attachment in message.Attachments)
{
AddLineBreak();
try
{
AddAttachment(attachment);
}
catch
{
// Ignore attachment errors
}
}
}
_lastMessageReadIndex = messageIndex;
}
protected static string GetSenderDisplayName(IConversationMessage message)
{
if (message.IsOutgoing)
{
return _localName;
}
else
{
return message.Contact.DisplayName;
}
}
protected Color GetSenderDisplayColor(IConversationMessage message)
{
if (message.IsOutgoing)
{
return _localSenderColor;
}
int brushIndex;
int phoneNumberIndex = _remoteContacts.IndexOf(message.Contact);
if (phoneNumberIndex < 0)
{
_remoteContacts.Add(message.Contact);
brushIndex = (_remoteContacts.Count - 1) % _remoteSenderColors.Length;
}
else
{
brushIndex = phoneNumberIndex % _remoteSenderColors.Length;
}
return _remoteSenderColors[brushIndex];
}
protected string FormatTimeForConversation(DateTime time)
{
return FormatTimeForConversation(time, _displayOptions.TimeDisplayFormat);
}
private static string FormatTimeForConversation(DateTime time, TimeDisplayFormat displayFormat)
{
string formatString;
switch (displayFormat)
{
case TimeDisplayFormat.HideTime:
return null;
case TimeDisplayFormat.HourMin24h:
formatString = "{0:H:mm}";
break;
case TimeDisplayFormat.HourMinAmPm:
formatString = "{0:h:mm tt}";
break;
case TimeDisplayFormat.HourMinSec24h:
formatString = "{0:H:mm:ss}";
break;
case TimeDisplayFormat.HourMinSecAmPm:
formatString = "{0:h:mm:ss tt}";
break;
default:
throw new ArgumentException("Invalid display format type", "displayFormat");
}
return string.Format(formatString, time);
}
protected static string FormatDateForConversation(DateTime date)
{
return string.Format("{0:dddd, MMM d, yyyy}", date);
}
protected abstract void ClearRenderingBuffer();
protected abstract void StartNewParagraph();
protected abstract void MoveCurrentParagraphToBuffer();
protected abstract void AddDateLine(DateTime date);
protected abstract void AddMessageLine(IConversationMessage message);
protected abstract void AddAttachment(IMessageAttachment messageAttachment);
protected abstract void AddLineBreak();
protected abstract void AddEmptyConversationMessage();
public abstract string RenderMessagesAsString(int messageCount);
public abstract List<System.Windows.Documents.Paragraph> RenderMessagesAsParagraphs(int messageCount);
}
}
| {
"content_hash": "c4abb0bf97ebf75d06e1c459e8815426",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 115,
"avg_line_length": 29.60153256704981,
"alnum_prop": 0.542712917421693,
"repo_name": "AllYourTexts/AllYourTexts",
"id": "87e887511580b314b0092b99c7e0cf7dff5f4d06",
"size": "7728",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AllYourTextsUI/ConversationRendering/ConversationRendererBase.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "795928"
},
{
"name": "Smalltalk",
"bytes": "6656"
}
],
"symlink_target": ""
} |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get(
'SECRET_KEY') or 'WILL.I.AM tour with Wale featuring Leon_Omosh'
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
WANANCHI_MAIL_SUBJECT_PREFIX = '[CHUDI INVESTMENTS]'
WANANCHI_MAIL_SENDER = 'CHUDI INVESTMENTS ADMININSTRATOR'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
WANANCHI_ADMIN = os.environ.get('CHUDI_ADMIN')
username = os.environ.get('username')
api_key = os.environ.get('api_key')
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data.sqlite')
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}
| {
"content_hash": "68de6b4f7cea71dede044a691a8082fe",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 72,
"avg_line_length": 29.551020408163264,
"alnum_prop": 0.669889502762431,
"repo_name": "Kimanicodes/wananchi",
"id": "c847e6d17e7e48b21665b02b83a4ecedb4af39b2",
"size": "1448",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "356373"
},
{
"name": "HTML",
"bytes": "195521"
},
{
"name": "JavaScript",
"bytes": "938345"
},
{
"name": "Mako",
"bytes": "412"
},
{
"name": "Python",
"bytes": "96355"
}
],
"symlink_target": ""
} |
module Pacto
class RequestClause < Hashie::Dash
include Hashie::Extensions::Coercion
# include Hashie::Extensions::IndifferentAccess # remove this if we cleanup string vs symbol
property :host # required?
property :http_method, required: true
property :schema, default: {}
property :path
property :headers
property :timeout
property :params, default: {}
def initialize(definition)
mash = Hashie::Mash.new definition
mash['http_method'] = normalize(mash['http_method'])
super mash
end
def http_method=(method)
normalize(method)
end
def uri
@uri ||= Pacto::URI.for(host, path, params)
end
private
def normalize(method)
method.to_s.downcase.to_sym
end
end
end
| {
"content_hash": "c3250e05d8d50e3610fbc16ebedb50fa",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 96,
"avg_line_length": 23.454545454545453,
"alnum_prop": 0.6563307493540051,
"repo_name": "farismosman/pacto",
"id": "b27b654fdc3be41ede350e971e513f791f0d6258",
"size": "774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/pacto/request_clause.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Cucumber",
"bytes": "13306"
},
{
"name": "Ruby",
"bytes": "163539"
}
],
"symlink_target": ""
} |
(function($) {
"use strict";
//windows load event
$(window).load(function() {
/* ---------------------------------------------------------------------- */
/* -------------------------- 01 - Preloader ---------------------------- */
/* ---------------------------------------------------------------------- */
$('#preloader').delay(20).fadeOut('slow');
/* ---------------------------------------------------------------------- */
/* ---------------------------- 02 - OwlCarousel ----------------------- */
/* ---------------------------------------------------------------------- */
/* latest */
$(".epi-carousel4").owlCarousel({
autoPlay: true,
items : 4,
pagination : false,
responsive : true,
itemsDesktop : [1199, 4],
itemsDesktopSmall : [979, 4],
itemsTablet : [768, 3],
itemsTabletSmall : [600, 3],
itemsMobile : [479, 3]
});
/* portfolio Logos */
$(".epi-carousel").owlCarousel({
autoPlay: true,
items : 1,
pagination : false,
navigation:true,
navigationText: [
"<span class='leftarrow'></span>",
"<span class='rightarrow'></span>"
],
responsive : false
});
});
/* -------------------------- 04 - Sticky ---------------------------- */
$(".sticky").sticky({topSpacing:0});
/* -------------------------- 06 - scrollToTop ------------------------- */
$(window).scroll(function(){
if ($(this).scrollTop() > 600) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
/* ---------------------------------------------------------------------- */
/* -------------------------- search_btn ------------------------ */
/* ---------------------------------------------------------------------- */
$(".search_btn").click(function(){
if($(this).parent().hasClass('closed')){
$(this).parent().removeClass('closed');
$(this).parent().find('.btmsearch').slideDown(200);
} else {
$(this).parent().addClass('closed');
$(this).parent().find('.btmsearch').slideUp(200);
}
});
/* ---------------------------------------------------------------------- */
/* -------------------------- 10 - Fit Vids ----------------------------- */
/* ---------------------------------------------------------------------- */
$('#wrapper').fitVids();
/*----------------------------- selectpicker------------------*/
$('.selectpicker').selectpicker({
style: 'btn-info',
size: 4
});
/* ---------------------------------------------------------------------- */
/* -------------------------- 12 - Contact Form ------------------------- */
/* ---------------------------------------------------------------------- */
// Needed variables
var $contactform = $('#contact-form'),
$response = '';
// After contact form submit
$contactform.submit(function() {
// Hide any previous response text
$contactform.children(".alert").remove();
// Are all the fields filled in?
if (!$('#contact_name').val()) {
$response = '<div class="alert alert-danger">Please enter your name.</div>';
$('#contact_name').focus();
$contactform.prepend($response);
} else if (!$('#contact_message').val()) {
$response = '<div class="alert alert-danger">Please enter your message.</div>';
$('#contact_message').focus();
$contactform.prepend($response);
} else if (!$('#contact_email').val()) {
$response = '<div class="alert alert-danger">Please enter valid e-mail.</div>';
$('#contact_email').focus();
$contactform.prepend($response);
} else {
// Yes, submit the form to the PHP script via Ajax
$contactform.children('button[type="submit"]').button('loading');
$.ajax({
type: "POST",
url: "php/contact-form.php",
data: $(this).serialize(),
success: function(msg) {
if (msg == 'sent') {
$response = '<div class="alert alert-success">Your message has been sent. Thank you!</div>';
$contactform[0].reset();
} else {
$response = '<div class="alert alert-danger">' + msg + '</div>';
}
// Show response message
$contactform.prepend($response);
$contactform.children('button[type="submit"]').button('reset');
}
});
}
return false;
});
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("body").toggleClass("toggled");
});
/* ---------------------------------------------------------------------- */
/* -------------------------- bootstrap dropdown menu ----------------------------- */
/* ---------------------------------------------------------------------- */
$('.navbar .dropdown').hover(function() {
$(this).find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();
}, function() {
$(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideUp();
});
$('.navbar a').click(function(){
location.href = this.href;
});
$('nav#menu').mmenu();
$("[name='my-checkbox']").bootstrapSwitch();
/* ---------------------------------------------------------------------- */
/* -------------------------- bootstrap tooltip ----------------------------- */
/* ---------------------------------------------------------------------- */
$('[data-toggle="tooltip"]').tooltip()
})(jQuery);
| {
"content_hash": "a4f14fda243e073478b82dc02f51dc10",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 104,
"avg_line_length": 34.80891719745223,
"alnum_prop": 0.3934126258005489,
"repo_name": "williamgomes/etv",
"id": "4668f84c8d28c656c31920b3e0591a45691b7e29",
"size": "5465",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ETV_HTML/js/custom.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3297"
},
{
"name": "CSS",
"bytes": "623188"
},
{
"name": "HTML",
"bytes": "734032"
},
{
"name": "JavaScript",
"bytes": "866241"
},
{
"name": "PHP",
"bytes": "440207"
}
],
"symlink_target": ""
} |
title: Extensions
layout: default
route: extensions
breadcrumb:
- home
- more
- extensions
extensions:
- name: bulma-o-steps
url: https://octoshrimpy.github.io/bulma-o-steps/
slug: bulma-o-steps
width: 401
height: 352
- name: bulma-accordion
url: https://wikiki.github.io/components/accordion
slug: bulma-accordion
width: 640
height: 310
- name: bulma-carousel
url: https://wikiki.github.io/components/carousel
slug: bulma-carousel
width: 640
height: 433
- name: bulma-quickview
url: https://wikiki.github.io/components/quickview
slug: bulma-quickview
width: 1438
height: 499
- name: bulma-iconpicker
url: https://wikiki.github.io/form/iconpicker
slug: bulma-iconpicker
width: 237
height: 89
- name: bulma-tagsinput
url: https://wikiki.github.io/form/tagsinput
slug: bulma-tagsinput
width: 423
height: 50
- name: bulma-tagsfield
url: https://github.com/vyachkonovalov/bulma-tagsfield
slug: bulma-tagsfield
width: 471
height: 70
- name: bulma-pricingtable
url: https://wikiki.github.io/components/pricingtable
slug: bulma-pricingtable
width: 1301
height: 428
- name: bulma-megamenu
url: https://github.com/hunzaboy/bulma-megamenu
slug: bulma-megamenu
width: 668
height: 182
- name: bulma-coolcheckboxes
url: https://github.com/hunzaboy/Cool-Checkboxes-for-Bulma.io
slug: bulma-coolcheckbox
width: 450
height: 184
- name: bulma-slider
url: https://wikiki.github.io/form/slider
slug: bulma-slider
width: 647
height: 166
- name: bulma.io-axure
url: https://github.com/AGmakonts/Bulma.io-axure
slug: bulma.io-axure
width: 888
height: 541
- name: bulma-checkradio
url: https://wikiki.github.io/form/checkradio
slug: bulma-checkradio
width: 247
height: 193
- name: bulma-switch
url: https://wikiki.github.io/form/switch
slug: bulma-switch
width: 193
height: 193
- name: bulma-steps (alternative)
url: https://aramvisser.github.io/bulma-steps/
slug: bulma-steps-alternative
width: 1078
height: 280
- name: bulma-divider
url: https://wikiki.github.io/layout/divider
slug: bulma-divider
width: 651
height: 54
- name: bulma-calendar
url: https://wikiki.github.io/components/calendar
slug: bulma-calendar
width: 338
height: 352
- name: bulma-pageloader
url: https://wikiki.github.io/elements/pageloader
slug: bulma-pageloader
width: 245
height: 139
- name: bulma-ribbon
url: https://github.com/Wikiki/bulma-ribbon
slug: bulma-ribbon
width: 323
height: 87
- name: bulma-badge
url: https://wikiki.github.io/elements/badge
slug: bulma-badge
width: 623
height: 211
- name: bulma-steps
url: https://wikiki.github.io/components/steps
slug: bulma-steps
width: 1294
height: 147
- name: bulma-tooltip
url: https://wikiki.github.io/elements/tooltip
slug: bulma-tooltip
width: 215
height: 55
- name: bulma-timeline
url: https://wikiki.github.io/components/timeline
slug: bulma-timeline
width: 634
height: 469
- name: bulma-toast
url: https://rfoel.github.io/bulma-toast/
slug: bulma-toast
width: 208
height: 173
- name: bulma-dashboard
url: https://github.com/lucperkins/bulma-dashboard
slug: bulma-dashboard
- name: bulma-block-list
url: https://github.com/chrisrhymes/bulma-block-list
slug: bulma-block-list
- name: bulma-spacing
url: https://github.com/kaangokdemir/bulma-spacing
slug: bulma-spacing
- name: bulma-list
url: https://bluefantail.github.io/bulma-list
slug: bulma-list
width: 1186
height: 480
---
{% include global/navbar.html id="Extensions" %}
{%
include components/hero.html
color="extensions"
icon="fas fa-plug"
title="Bulma **extensions**"
subtitle="Side projects to **enhance** your Bulma **experience**"
%}
{% capture call_button %}
<a class="button bd-fat-button is-extensions is-medium"
href="https://github.com/jgthms/bulma/pulls"
target="_blank">
<span class="icon">
<i class="fas fa-code-branch"></i>
</span>
<span>
Submit a Pull Request
</span>
</a>
{% endcapture %}
{%
include components/call.html
color="extensions"
text='Have an <strong>extension</strong> to <strong>share</strong> with the community?'
button=call_button
%}
<div class="bd-posts">
{% for extension in page.extensions %}
<div class="bd-post bd-is-extension">
<a class="bd-post-link" href="{{ extension.url }}" target="_blank" rel="nofollow">
<div class="bd-post-body">
<div class="bd-post-content">
<h2 class="title">
{{ extension.name }}
</h2>
<div class="subtitle">
{{ extension.url | remove:'http://' | remove:'https://' | remove:'www.' }}
</div>
</div>
</div>
<figure class="bd-post-screenshot">
<img src="{{site.url}}/images/extensions/{{ extension.slug }}.png" width="{{ extension.width }}" height="{{ extension.height }}">
</figure>
</a>
</div>
{% endfor %}
</div>
| {
"content_hash": "a5c1ec88a3e6528bb94a7c64846353be",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 139,
"avg_line_length": 25.331632653061224,
"alnum_prop": 0.6811681772406848,
"repo_name": "jgthms/bulma",
"id": "4b428fbb8133f1c068b61bb77bc61f36350d4a01",
"size": "4969",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/extensions.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "245028"
},
{
"name": "JavaScript",
"bytes": "3952"
},
{
"name": "SCSS",
"bytes": "1979"
},
{
"name": "Sass",
"bytes": "141318"
},
{
"name": "Shell",
"bytes": "969"
}
],
"symlink_target": ""
} |
<?php
/**
* General excpetion for any issues with the Dojo plugin.
*
*/
class DojoException extends sfException
{
}
?> | {
"content_hash": "7cbb899d73b6968a30b315c54bd0ebfd",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 13.1,
"alnum_prop": 0.6412213740458015,
"repo_name": "Symfony-Plugins/dgDojoPlugin",
"id": "52ff01447eec53743cc69a26e5b178b3401e9e93",
"size": "131",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/dojo/Exceptions/DojoException.class.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "135297"
}
],
"symlink_target": ""
} |
package au.com.windyroad.hateoas.client;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class WebDriverFactory {
@Value(value = "${webdriver.driver:org.openqa.selenium.firefox.FirefoxDriver}")
String driverClassName;
@Value(value = "${webdriver.window.width:1024}")
int width;
@Value(value = "${webdriver.window.height:768}")
int height;
public WebDriver createWebDriver() throws ClassNotFoundException,
NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException,
InvocationTargetException {
DesiredCapabilities cap = new DesiredCapabilities();
WebDriver driver = createDriver(cap);
driver.manage().window().setSize(new Dimension(width, height));
return driver;
}
private WebDriver createDriver(DesiredCapabilities cap)
throws ClassNotFoundException, NoSuchMethodException,
InstantiationException, IllegalAccessException,
InvocationTargetException {
Class<?> driverClass = Class.forName(driverClassName);
Constructor<?> constructor = driverClass
.getConstructor(Capabilities.class);
return (WebDriver) constructor.newInstance(cap);
}
}
| {
"content_hash": "9b19f1923630a07335166263a6aa12a8",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 33.79545454545455,
"alnum_prop": 0.8036314727639543,
"repo_name": "windyroad/service-gateway",
"id": "2fb0c4b4e0ae2e716d049ea3aae8f3f51640fa12",
"size": "1487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/au/com/windyroad/hateoas/client/WebDriverFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "46"
},
{
"name": "Cucumber",
"bytes": "544"
},
{
"name": "HTML",
"bytes": "4474"
},
{
"name": "Java",
"bytes": "199142"
},
{
"name": "JavaScript",
"bytes": "4074"
}
],
"symlink_target": ""
} |
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// 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 net.starlark.java.annot.processor.testsources;
import com.google.devtools.build.lib.syntax.StarlarkValue;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.StarlarkMethod;
/**
* Test case for a class which contains multiple StarlarkMethod methods with the same name. This
* should cause a compile failure -- overrides are not allowed.
*/
public class ConflictingMethodNames implements StarlarkValue {
@StarlarkMethod(
name = "conflicting_method",
documented = false,
parameters = {
@Param(name = "one", type = String.class, named = true),
})
public String conflictingMethod(String one) {
return "foo";
}
@StarlarkMethod(
name = "conflicting_method",
documented = false,
parameters = {
@Param(name = "one", type = String.class, named = true),
@Param(name = "two", type = Integer.class, named = true),
})
public String conflictingMethodTwo(String one, Integer two) {
return "foo";
}
}
| {
"content_hash": "91f881178c1be85890284f18857e9e42",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 34.57446808510638,
"alnum_prop": 0.7058461538461539,
"repo_name": "ulfjack/bazel",
"id": "7a0ae861cd394f93aacb7f3a2744e9df882a00db",
"size": "1625",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/net/starlark/java/annot/processor/testsources/ConflictingMethodNames.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1588"
},
{
"name": "C",
"bytes": "25393"
},
{
"name": "C++",
"bytes": "1525276"
},
{
"name": "Dockerfile",
"bytes": "839"
},
{
"name": "HTML",
"bytes": "21431"
},
{
"name": "Java",
"bytes": "35781133"
},
{
"name": "Makefile",
"bytes": "248"
},
{
"name": "Objective-C",
"bytes": "10369"
},
{
"name": "Objective-C++",
"bytes": "1043"
},
{
"name": "PowerShell",
"bytes": "15431"
},
{
"name": "Python",
"bytes": "2555679"
},
{
"name": "Ruby",
"bytes": "639"
},
{
"name": "Shell",
"bytes": "2022858"
},
{
"name": "Smarty",
"bytes": "18683"
}
],
"symlink_target": ""
} |
/**
* Provides the data objects referred to by the methods of
* the <code>org.oscm.app</code> package.
*/
package org.oscm.app.v2_0.data;
| {
"content_hash": "66ac6ef6ae48615ac3eccab79e3c37d2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 59,
"avg_line_length": 24.166666666666668,
"alnum_prop": 0.6758620689655173,
"repo_name": "opetrovski/development",
"id": "c766eaec5e9e8a952fd4df5668a04ccef6d5adad",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oscm-app-extsvc-2-0/javasrc/org/oscm/app/v2_0/data/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "5304"
},
{
"name": "Batchfile",
"bytes": "273"
},
{
"name": "CSS",
"bytes": "389539"
},
{
"name": "HTML",
"bytes": "1884410"
},
{
"name": "Java",
"bytes": "41884121"
},
{
"name": "JavaScript",
"bytes": "259479"
},
{
"name": "PHP",
"bytes": "620531"
},
{
"name": "PLSQL",
"bytes": "4929"
},
{
"name": "SQLPL",
"bytes": "25278"
},
{
"name": "Shell",
"bytes": "3250"
}
],
"symlink_target": ""
} |
package org.apache.camel.component.cxf;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.cxf.binding.soap.SoapHeader;
public class CxfConsumerPayloadTest extends CxfConsumerMessageTest {
private static final String ECHO_RESPONSE = "<ns1:echoResponse xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
+ "<return xmlns=\"http://cxf.component.camel.apache.org/\">echo Hello World!</return>"
+ "</ns1:echoResponse>";
private static final String ECHO_BOOLEAN_RESPONSE = "<ns1:echoBooleanResponse xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
+ "<return xmlns=\"http://cxf.component.camel.apache.org/\">true</return>"
+ "</ns1:echoBooleanResponse>";
private static final String ECHO_REQUEST = "<ns1:echo xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
+ "<arg0 xmlns=\"http://cxf.component.camel.apache.org/\">Hello World!</arg0></ns1:echo>";
private static final String ECHO_BOOLEAN_REQUEST = "<ns1:echoBoolean xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
+ "<arg0 xmlns=\"http://cxf.component.camel.apache.org/\">true</arg0></ns1:echoBoolean>";
// START SNIPPET: payload
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from(simpleEndpointURI + "&dataFormat=PAYLOAD").to("log:info").process(new Processor() {
@SuppressWarnings("unchecked")
public void process(final Exchange exchange) throws Exception {
CxfPayload<SoapHeader> requestPayload = exchange.getIn().getBody(CxfPayload.class);
List<Element> inElements = requestPayload.getBody();
List<Element> outElements = new ArrayList<Element>();
// You can use a customer toStringConverter to turn a CxfPayLoad message into String as you want
String request = exchange.getIn().getBody(String.class);
XmlConverter converter = new XmlConverter();
String documentString = ECHO_RESPONSE;
if (inElements.get(0).getLocalName().equals("echoBoolean")) {
documentString = ECHO_BOOLEAN_RESPONSE;
assertEquals("Get a wrong request", ECHO_BOOLEAN_REQUEST, request);
} else {
assertEquals("Get a wrong request", ECHO_REQUEST, request);
}
Document outDocument = converter.toDOMDocument(documentString);
outElements.add(outDocument.getDocumentElement());
// set the payload header with null
CxfPayload<SoapHeader> responsePayload = new CxfPayload<SoapHeader>(null, outElements);
exchange.getOut().setBody(responsePayload);
}
});
}
};
}
// END SNIPPET: payload
}
| {
"content_hash": "00afbb2a4c0641a96071aa6d090cacd5",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 144,
"avg_line_length": 55.65,
"alnum_prop": 0.6028751123090745,
"repo_name": "chicagozer/rheosoft",
"id": "b1733f11272e5014d9879851a14ff9adef764452",
"size": "4142",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "20202"
},
{
"name": "Groovy",
"bytes": "2682"
},
{
"name": "Java",
"bytes": "22573774"
},
{
"name": "JavaScript",
"bytes": "3695704"
},
{
"name": "PHP",
"bytes": "90746"
},
{
"name": "Ruby",
"bytes": "4814"
},
{
"name": "Scala",
"bytes": "199461"
},
{
"name": "Shell",
"bytes": "1180"
},
{
"name": "XQuery",
"bytes": "464"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "2ecc89bcd02d8e2b86e8dc566d459d4f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "91d320078e216b63861417ed9ab9b9a13f07f971",
"size": "174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Psychoglossum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
namespace Rj\FrontendBundle\Tests\DependencyInjection\Compiler;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
abstract class BaseCompilerPassTest extends AbstractCompilerPassTestCase
{
/**
* @param string $id
*
* @return string
*/
protected function namespaceService($id)
{
return "rj_frontend.$id";
}
}
| {
"content_hash": "e6874a2f7e22373b8bf390f75a0a89e9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 81,
"avg_line_length": 21.833333333333332,
"alnum_prop": 0.7175572519083969,
"repo_name": "regularjack/frontend-bundle",
"id": "a6f93e3450028a5c429b8a5e583f3e712040d6c3",
"size": "393",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tests/DependencyInjection/Compiler/BaseCompilerPassTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "106279"
},
{
"name": "Python",
"bytes": "705"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Search with widget</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.0/esri/css/main.css">
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script src="https://js.arcgis.com/4.0/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/widgets/Search",
"esri/layers/FeatureLayer",
"dojo/domReady!"
], function(Map, MapView, Search, FeatureLayer) {
var map = new Map({
basemap: "dark-gray"
});
var view = new MapView({
container: "viewDiv",
map: map,
center: [-122.68, 45.52], // lon, lat
zoom: 10
});
// Create search widget
var searchWidget = new Search({
view: view,
allPlaceholder: "Neighborhood e.g. Downtown",
searchAllEnabled: true
});
var sources = [];
// Add the default world geocoder source
sources.push(searchWidget.defaultSource);
// Add the feature layer source to search
sources.push({
featureLayer: new FeatureLayer("http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/PDX_Neighborhoods_Styled/FeatureServer/0"),
name: "Neighborhood Search",
searchFields: ["NAME"],
displayField: "NAME",
exactMatch: false,
outFields: ["NAME","AVGHINC_CY","MEDAGE_CY","TOTPOP_CY"],
placeholder: "Neighborhood e.g. Downtown",
// Create a PopupTemplate to format data
popupTemplate: {
title: "{NAME}",
content: "Median Age: {MEDAGE_CY}</br>Average Household Income: {AVGHINC_CY}</br> Population: {TOTPOP_CY}"
}
});
// Set the sources
searchWidget.sources = sources;
// Initialize the widget
searchWidget.startup();
// Add widget to the UI
view.ui.add(searchWidget, {
position: "top-right"
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html> | {
"content_hash": "990eef60d7ccb4fa8e04842e7f0a2cea",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 148,
"avg_line_length": 25.529411764705884,
"alnum_prop": 0.5792626728110599,
"repo_name": "nixta/geodev-hackerlabs",
"id": "dead52f70360c6ac628053b3601f7cefbcd73943",
"size": "2170",
"binary": false,
"copies": "2",
"ref": "refs/heads/gh-pages",
"path": "develop/jsapi/search_with_widget/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2678"
},
{
"name": "HTML",
"bytes": "82384"
},
{
"name": "JavaScript",
"bytes": "759"
}
],
"symlink_target": ""
} |
<div class="row">
<div class="col-lg-12">
<h1>How do I obtain a copy of my COMPLETE DC Criminal Record?</h1>
<p class="text-italic">
If you have already acquired your COMPLETE criminal record in front of you, click
<a ui-sref="legal">here</a>. Your complete criminal record consist of the Form PD 70 provided by
the Police Department and your court record provided by the Superior Court.
</p>
<h4>Step 1</h4>
<p>Obtain a copy of your police record at Metropolitan Police Department (MPD):</p>
<ol class="list-alpha-upper">
<li>Be prepared to bring with you to MPD the following items:
<ol class="list-roman-lower">
<li>a copy of a valid ID (such as a driver's license)</li>
<li>$7.00 cash or money order to pay for the record AND</li>
<li>a copy of your social security number</li>
</ol>
</li>
<li>
Go to: Metropolitan Police Department (MPD) Record Information Desk
300 Indiana Avenue, NW, 1st Floor, Criminal History Section, Room 1075
Monday – Friday, 9:00 a.m. – 5:00 p.m.
</li>
<li>
Stop at the desk and show valid identification to receive a payment slip
</li>
<li>
Take the payment slip to room 1140B on the 1st Floor to pay the $7 charge and
obtain a receipt for proof of payment.
</li>
<li>
Go back to the desk on the 1st Floor and show paid receipt and copy of your
ID to receive a Criminal History Request Form.
</li>
<li>
Complete the Criminal History Request Form in all of the spaces marked with a dot, as instructed.
</li>
<li>
Go to the service window down the hallway. The clerk will check the identification and take the
receipt
and Criminal History Request form.
</li>
<li>
Have a seat until you are called when the police clearance is ready. The clerk
will give you a copy of the Police Record (Form PD 70).<br>
<strong>
HOLD ONTO THIS FORM. You will file a copy of it as Exhibit A when you file your Motion to Seal.
</strong>
</li>
</ol>
<h4>Step 2</h4>
<p>
Obtain a copy of your court record from the Superior Court of the District of Columbia. Go to the:
</p>
<address>
<strong>Criminal Records Division</strong><br>
D.C. Superior Court, Room 4001 (on the 4th floor)<br>
500 Indiana Avenue, N.W. <br>
<abbr title="Telephone">Tel:</abbr> (202) 879-11451<br>
Monday through Friday, 8:30am to 5:30pm
</address>
<p>
To obtain the information needed to complete the Motion to Seal Records, give your name and birth date to
the Clerk and request your entire Superior Court criminal record OR enter your name into the Court View
software on the computers in Room 4001 and search for your records.
</p>
</div>
</div> | {
"content_hash": "4879a34bf33f7d509f2ed193ca132731",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 117,
"avg_line_length": 44.82666666666667,
"alnum_prop": 0.5585960737656157,
"repo_name": "omarimayerswalker/clean-slate",
"id": "8757d2c36a58ef1a7c44402cfbe235373b47a42a",
"size": "3366",
"binary": false,
"copies": "5",
"ref": "refs/heads/gh-pages",
"path": "views/acquire-in-person.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3921"
},
{
"name": "HTML",
"bytes": "34046"
},
{
"name": "JavaScript",
"bytes": "10938"
}
],
"symlink_target": ""
} |
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
process.env.NODE_ENV = "development";
module.exports = {
mode: "development",
entry: ["@babel/polyfill", "./example/index.js"],
devServer: {
port: 8080
},
resolve: {
alias: {
"@webscopeio/react-textarea-autocomplete": path.resolve(
__dirname,
"./src"
)
},
extensions: [".js", ".jsx", ".json"]
},
module: {
rules: [
{
test: /\.jsx?$/,
use: { loader: "babel-loader" },
exclude: /node_modules/
},
{
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }]
}
]
},
plugins: [new HtmlWebpackPlugin({ template: "./example/index.html" })]
};
| {
"content_hash": "d99ed0a845b16df64f862a16f1c0aa62",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 22.2,
"alnum_prop": 0.5238095238095238,
"repo_name": "webscopeio/react-textarea-autocomplete",
"id": "a0bb42de3320beaf051bce8f88c4f35f0c7f21bf",
"size": "777",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webpack.config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1509"
},
{
"name": "HTML",
"bytes": "256"
},
{
"name": "JavaScript",
"bytes": "91642"
},
{
"name": "Shell",
"bytes": "338"
}
],
"symlink_target": ""
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
If argArray is either an array or an arguments object,
the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]
es5id: 15.3.4.3_A7_T9
description: >
argArray is (empty object, arguments), inside function declaration
used
---*/
function FACTORY(){
var obj = {};
Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(obj,arguments);
return obj;
}
obj=new FACTORY("",1,2);
//CHECK#1
if (typeof this["shifted"] !== "undefined") {
$ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...');
}
//CHECK#2
if (obj.shifted !== "12") {
$ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...');
}
| {
"content_hash": "f21d1f1e0ac863f22163ffd6cd138041",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 135,
"avg_line_length": 30.6,
"alnum_prop": 0.681917211328976,
"repo_name": "PiotrDabkowski/Js2Py",
"id": "ff2090d75f6a2f1eb42b162864d69c793415c68b",
"size": "918",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_cases/built-ins/Function/prototype/apply/S15.3.4.3_A7_T9.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "289"
},
{
"name": "JavaScript",
"bytes": "8556970"
},
{
"name": "Python",
"bytes": "4583980"
},
{
"name": "Shell",
"bytes": "457"
}
],
"symlink_target": ""
} |
"""RequestContext: context for requests that persist through all of nova."""
import copy
import uuid
from nova.openstack.common import local
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import policy
LOG = logging.getLogger(__name__)
def generate_request_id():
return 'req-' + str(uuid.uuid4())
class RequestContext(object):
"""Security context and request information.
Represents the user taking a given action within the system.
"""
def __init__(self, user_id, project_id, is_admin=None, read_deleted="no",
roles=None, remote_address=None, timestamp=None,
request_id=None, auth_token=None, overwrite=True,
quota_class=None, user_name=None, project_name=None,
service_catalog=None, instance_lock_checked=False, **kwargs):
"""
:param read_deleted: 'no' indicates deleted records are hidden, 'yes'
indicates deleted records are visible, 'only' indicates that
*only* deleted records are visible.
:param overwrite: Set to False to ensure that the greenthread local
copy of the index is not overwritten.
:param kwargs: Extra arguments that might be present, but we ignore
because they possibly came in from older rpc messages.
"""
if kwargs:
LOG.warn(_('Arguments dropped when creating context: %s') %
str(kwargs))
self.user_id = user_id
self.project_id = project_id
self.roles = roles or []
self.is_admin = is_admin
if self.is_admin is None:
self.is_admin = policy.check_is_admin(self.roles)
self.read_deleted = read_deleted
self.remote_address = remote_address
if not timestamp:
timestamp = timeutils.utcnow()
if isinstance(timestamp, basestring):
timestamp = timeutils.parse_strtime(timestamp)
self.timestamp = timestamp
if not request_id:
request_id = generate_request_id()
self.request_id = request_id
self.auth_token = auth_token
self.service_catalog = service_catalog
self.instance_lock_checked = instance_lock_checked
# NOTE(markmc): this attribute is currently only used by the
# rs_limits turnstile pre-processor.
# See https://lists.launchpad.net/openstack/msg12200.html
self.quota_class = quota_class
self.user_name = user_name
self.project_name = project_name
if overwrite or not hasattr(local.store, 'context'):
self.update_store()
def _get_read_deleted(self):
return self._read_deleted
def _set_read_deleted(self, read_deleted):
if read_deleted not in ('no', 'yes', 'only'):
raise ValueError(_("read_deleted can only be one of 'no', "
"'yes' or 'only', not %r") % read_deleted)
self._read_deleted = read_deleted
def _del_read_deleted(self):
del self._read_deleted
read_deleted = property(_get_read_deleted, _set_read_deleted,
_del_read_deleted)
def update_store(self):
local.store.context = self
def to_dict(self):
return {'user_id': self.user_id,
'project_id': self.project_id,
'is_admin': self.is_admin,
'read_deleted': self.read_deleted,
'roles': self.roles,
'remote_address': self.remote_address,
'timestamp': timeutils.strtime(self.timestamp),
'request_id': self.request_id,
'auth_token': self.auth_token,
'quota_class': self.quota_class,
'user_name': self.user_name,
'service_catalog': self.service_catalog,
'project_name': self.project_name,
'instance_lock_checked': self.instance_lock_checked}
@classmethod
def from_dict(cls, values):
return cls(**values)
def elevated(self, read_deleted=None, overwrite=False):
"""Return a version of this context with admin flag set."""
context = copy.copy(self)
context.is_admin = True
if 'admin' not in context.roles:
context.roles.append('admin')
if read_deleted is not None:
context.read_deleted = read_deleted
return context
def get_admin_context(read_deleted="no"):
return RequestContext(user_id=None,
project_id=None,
is_admin=True,
read_deleted=read_deleted,
overwrite=False)
| {
"content_hash": "e146c1486978d27205be6d9505a986de",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 35.54887218045113,
"alnum_prop": 0.5930626057529611,
"repo_name": "houshengbo/nova_vmware_compute_driver",
"id": "094e2bffbc33804d992949d79295234811de502c",
"size": "5537",
"binary": false,
"copies": "2",
"ref": "refs/heads/attach-detach-VMware-iSCSI-driver",
"path": "nova/context.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "7403"
},
{
"name": "Python",
"bytes": "7173520"
},
{
"name": "Shell",
"bytes": "15478"
}
],
"symlink_target": ""
} |
package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.GlobalProperty}
*/
public class GlobalPropertyTests extends TestCase {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
public void testValidEnums() {
String example = "HELPPROMPT";
GlobalProperty enumHelpPrompt = GlobalProperty.valueForString(example);
example = "TIMEOUTPROMPT";
GlobalProperty enumTimeoutPrompt = GlobalProperty.valueForString(example);
example = "VRHELPTITLE";
GlobalProperty enumVrHelpTitle = GlobalProperty.valueForString(example);
example = "VRHELPITEMS";
GlobalProperty enumVrHelpItems = GlobalProperty.valueForString(example);
example = "MENUNAME";
GlobalProperty enumMenuName = GlobalProperty.valueForString(example);
example = "MENUICON";
GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example);
example = "KEYBOARDPROPERTIES";
GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example);
example = "USER_LOCATION";
GlobalProperty enumUserLocation = GlobalProperty.valueForString(example);
assertNotNull("HELPPROMPT returned null", enumHelpPrompt);
assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt);
assertNotNull("VRHELPTITLE returned null", enumVrHelpTitle);
assertNotNull("VRHELPITEMS returned null", enumVrHelpItems);
assertNotNull("MENUNAME returned null", enumMenuName);
assertNotNull("MENUICON returned null", enumMenuIcon);
assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
assertNotNull("USER_LOCATION returned null", enumUserLocation);
}
/**
* Verifies that an invalid assignment is null.
*/
public void testInvalidEnum() {
String example = "heLp_ProMPt";
try {
GlobalProperty temp = GlobalProperty.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
} catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
/**
* Verifies that a null assignment is invalid.
*/
public void testNullEnum() {
String example = null;
try {
GlobalProperty temp = GlobalProperty.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
} catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
/**
* Verifies the possible enum values of GlobalProperty.
*/
public void testListEnum() {
List<GlobalProperty> enumValueList = Arrays.asList(GlobalProperty.values());
List<GlobalProperty> enumTestList = new ArrayList<GlobalProperty>();
enumTestList.add(GlobalProperty.HELPPROMPT);
enumTestList.add(GlobalProperty.TIMEOUTPROMPT);
enumTestList.add(GlobalProperty.VRHELPTITLE);
enumTestList.add(GlobalProperty.VRHELPITEMS);
enumTestList.add(GlobalProperty.MENUNAME);
enumTestList.add(GlobalProperty.MENUICON);
enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES);
enumTestList.add(GlobalProperty.USERLOCATION);
enumTestList.add(GlobalProperty.USER_LOCATION);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
} | {
"content_hash": "76d0b2bbe35d2c8e24b714318121e925",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 100,
"avg_line_length": 40.87234042553192,
"alnum_prop": 0.6991150442477876,
"repo_name": "smartdevicelink/sdl_android",
"id": "4fc2f256d7bfb91f1f22a1622c1e6f354a07406a",
"size": "3842",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "4666491"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_25) on Fri Jun 05 10:51:18 EDT 2015 -->
<title>HeapAllocator (apache-cassandra API)</title>
<meta name="date" content="2015-06-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="HeapAllocator (apache-cassandra API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/HeapAllocator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/cassandra/utils/memory/ContextAllocator.html" title="class in org.apache.cassandra.utils.memory"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/cassandra/utils/memory/HeapPool.html" title="class in org.apache.cassandra.utils.memory"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/utils/memory/HeapAllocator.html" target="_top">Frames</a></li>
<li><a href="HeapAllocator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.cassandra.utils.memory</div>
<h2 title="Class HeapAllocator" class="title">Class HeapAllocator</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html" title="class in org.apache.cassandra.utils.memory">org.apache.cassandra.utils.memory.AbstractAllocator</a></li>
<li>
<ul class="inheritance">
<li>org.apache.cassandra.utils.memory.HeapAllocator</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">HeapAllocator</span>
extends <a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html" title="class in org.apache.cassandra.utils.memory">AbstractAllocator</a></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/utils/memory/HeapAllocator.html" title="class in org.apache.cassandra.utils.memory">HeapAllocator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/utils/memory/HeapAllocator.html#instance">instance</a></span></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.nio.ByteBuffer</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/utils/memory/HeapAllocator.html#allocate-int-">allocate</a></span>(int size)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.cassandra.utils.memory.AbstractAllocator">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.cassandra.utils.memory.<a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html" title="class in org.apache.cassandra.utils.memory">AbstractAllocator</a></h3>
<code><a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html#clone-java.nio.ByteBuffer-">clone</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="instance">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>instance</h4>
<pre>public static final <a href="../../../../../org/apache/cassandra/utils/memory/HeapAllocator.html" title="class in org.apache.cassandra.utils.memory">HeapAllocator</a> instance</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="allocate-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>allocate</h4>
<pre>public java.nio.ByteBuffer allocate(int size)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html#allocate-int-">allocate</a></code> in class <code><a href="../../../../../org/apache/cassandra/utils/memory/AbstractAllocator.html" title="class in org.apache.cassandra.utils.memory">AbstractAllocator</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/HeapAllocator.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/cassandra/utils/memory/ContextAllocator.html" title="class in org.apache.cassandra.utils.memory"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/cassandra/utils/memory/HeapPool.html" title="class in org.apache.cassandra.utils.memory"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/utils/memory/HeapAllocator.html" target="_top">Frames</a></li>
<li><a href="HeapAllocator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 The Apache Software Foundation</small></p>
</body>
</html>
| {
"content_hash": "e076a8b9dab7f1871ea27101fd630636",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 391,
"avg_line_length": 38.286206896551725,
"alnum_prop": 0.6418085202197604,
"repo_name": "Jcamilorada/Cassandra",
"id": "a92fca3607d1be32b9f09b86f9983ce75b356301",
"size": "11103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Instalacion/javadoc/org/apache/cassandra/utils/memory/HeapAllocator.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "30209"
},
{
"name": "C#",
"bytes": "3784"
},
{
"name": "Java",
"bytes": "1841"
},
{
"name": "PowerShell",
"bytes": "37207"
},
{
"name": "Python",
"bytes": "335281"
},
{
"name": "Shell",
"bytes": "53546"
},
{
"name": "Thrift",
"bytes": "40240"
}
],
"symlink_target": ""
} |
<div class="tab">
<button type="action" name="act_characteristics" >Characteristics</button>
<button type="action" name="act_gear" >Gear</button>
<button type="action" name="act_skills" >Skills</button>
<button type="action" name="act_powers" >Powers</button>
<button type="action" name="act_complications" >Talents & Complications</button>
<button type="action" name="act_options" >Options</button>
</div>
<input type="hidden" class="sheet-tabstoggle" name="attr_sheetTab" value="character"/>
<!-- --------------------------------------------------------------------------------- -->
<!-- Bio, primary statistics, and combat statistics tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-characteristics">
<div class="grid-container-tab-characteristics">
<div class="grid-container-characteristics-leftGrid">
<div class="item-characteristics-logo">
<img src="https://github.com/Roll20/roll20-character-sheets/blob/master/HeroSystem6eHeroic/HeroSystemGraphic.png?raw=true" alt="Sheet Logo" style="width:209px;height:105px;">
</div>
<div class="item-characteristics-bio">
<div class="item-characteristics-bio-nameLabel">
<h1>Name:</h1>
</div>
<div class="item-characteristics-bio-nameText">
<input type="text" value="" name="attr_character_name" maxlength="36" tabindex="1"/>
</div>
<div class="item-characteristics-bio-titleLabel">
<h1>Title:</h1>
</div>
<div class="item-characteristics-bio-titleText">
<input type="text" value="" name="attr_character_title" maxlength="36" tabindex="2"/>
</div>
<div class="item-characteristics-bio-backgroundLabel">
<h1>Background:</h1>
</div>
<div class="item-characteristics-bio-backgroundText">
<textarea name="attr_backgroundText" cols="28" rows="3" maxlength="64" tabindex="3"/></textarea>
</div>
</div>
<div class="item-characteristics-earnings">
<div class="item-characteristics-earnings-experienceLabel">
<h1>Experience:</h1>
</div>
<div class="item-characteristics-earnings-experience">
<input type="number" min="0" value="0" name="attr_experience" tabindex="4"/>
</div>
<div class="item-characteristics-earnings-moneyLabel">
<input type="text" value="Money:" name="attr_moneyLabel" maxlength="15" tabindex="-1">
</div>
<div class="item-characteristics-earnings-money">
<input type="number" value="0" name="attr_money" step="1" tabindex="5"/>
</div>
</div>
<div class="item-characteristics-primary-attributes">
<div class="item-characteristics-primary-attributes-names">
<h1>Characteristics</h1>
<h2>Strength</h2>
<h2>Dexterity</h2>
<h2>Constitution</h2>
<h2>Intelligence</h2>
<h2>Ego</h2>
<h2>Presence</h2>
</div>
<div class="item-characteristics-primary-attributes-values">
<h1>Value</h1>
<input type="number" value="10" name="attr_strength" min="1" tabindex="6"/>
<input type="number" value="10" name="attr_dexterity" min="1" tabindex="7"/>
<input type="number" value="10" name="attr_constitution" min="1" tabindex="8"/>
<input type="number" value="10" name="attr_intelligence" min="1" tabindex="9"/>
<input type="number" value="10" name="attr_ego" min="1" tabindex="10"/>
<input type="number" value="10" name="attr_presence" min="1" tabindex="11"/>
</div>
<div class="item-characteristics-primary-attributes-rollChances">
<h1>Roll</h1>
<input type="text" value="11" name="attr_strengthChance" readonly tabindex="-1"/>
<input type="text" value="11" name="attr_dexterityChance" readonly tabindex="-1"/>
<input type="text" value="11" name="attr_constitutionChance" readonly tabindex="-1"/>
<input type="text" value="11" name="attr_intelligenceChance" readonly tabindex="-1"/>
<input type="text" value="11" name="attr_egoChance" readonly tabindex="-1"/>
<input type="text" value="11" name="attr_presenceChance" readonly tabindex="-1"/>
</div>
<div class="item-characteristics-primary-attributes-rollButtons">
<h1>‍</h1> <!-- Invisible character -->
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_strength" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Strength }} {{Base Chance = [[@{strengthChance}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_dexterity" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Dexterity }} {{Base Chance = [[@{dexterityChance}+@{weightDexDCVPenalty}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_constitution" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Constitution}} {{Base Chance = [[@{constitutionChance}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_intelligence" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Intelligence}} {{Base Chance = [[@{intelligenceChance}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_ego" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Ego}} {{Base Chance = [[@{egoChance}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_presence" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Presence}} {{Base Chance = [[@{presenceChance}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
</div>
<div class="item-characteristics-primary-attributes-costs">
<h1>CP</h1>
<input type="text" value="0" name="attr_strengthCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_dexterityCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_constitutionCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_intelligenceCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_egoCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_presenceCP" readonly tabindex="-1"/>
</div>
</div>
<div class="item-characteristics-combat-attributes">
<div class="item-characteristics-combat-attributes-names">
<h1>Combat Abilities</h1>
<h2>OCV</h2>
<h2>DCV</h2>
<h2>OMCV</h2>
<h2>DMCV</h2>
<h2>Speed</h2>
<h2>Physical Defense</h2>
<h2>Energy Defense</h2>
<h2>Body</h2>
<h2>Stun</h2>
<h2>Endurance</h2>
<h2>Recovery</h2>
</div>
<div class="item-characteristics-combat-attributes-values">
<h1>Value</h1>
<input type="number" value="3" name="attr_ocv" min="1" tabindex="12"/>
<input type="number" value="3" name="attr_dcv" min="1" tabindex="13"/>
<input type="number" value="3" name="attr_omcv" min="1" tabindex="14"/>
<input type="number" value="3" name="attr_dmcv" min="1" tabindex="15"/>
<input type="number" value="2" name="attr_speed" min="1" max="12" tabindex="16"/>
<input type="number" value="2" name="attr_pd" min="1" tabindex="17"/>
<input type="number" value="2" name="attr_ed" min="1" tabindex="18"/>
<input type="number" value="10" name="attr_body" min ="1" tabindex="19"/>
<input type="number" value="20" name="attr_stun" min="0" step="2" tabindex="20"/>
<input type="number" value="20" name="attr_endurance" min="0" step="5" tabindex="21"/>
<input type="number" value="4" name="attr_recovery" min="1" tabindex="22"/>
</div>
<div class="item-characteristics-combat-attributes-costs">
<h1>CP</h1>
<input type="text" value="0" name="attr_ocvCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_dcvCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_omcvCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_dmcvCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_speedCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_pdCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_edCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_bodyCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_stunCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enduranceCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_recoveryCP" readonly tabindex="-1"/>
</div>
</div>
<div class="item-characteristics-movement-abilities">
<div class="item-characteristics-movement-abilities-names">
<h1>Movement</h1>
<h2>Running</h2>
<h2>Leaping</h2>
<h2>Swimming</h2>
</div>
<div class="item-characteristics-movement-abilities-values">
<h1>Value</h1>
<input type="number" value="12" name="attr_running" min="0" step="1" tabindex="23"/>
<input type="number" value="4" name="attr_leaping" min="0" step="2" tabindex="24"/>
<input type="number" value="4" name="attr_swimming" min="0" step="2" tabindex="25"/>
</div>
<div class="item-characteristics-movement-abilities-costs">
<h1>CP</h1>
<input type="text" value="0" name="attr_runningCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_leapingCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_swimmingCP" readonly tabindex="-1"/>
</div>
</div>
</div>
<div class="grid-container-characteristics-rightGrid">
<div class="item-characteristics-portrait">
<!-- Hidden variables for the portrait display slideshow -->
<input type="hidden" class="item-portrait-slideshow" name="attr_portraitSelection" value="0" min="0" step="1" max="2"/>
<input type="hidden" name="attr_totalNumberOfPortraits" value="2"/>
<!-- A set of portrait images or rule cards with the visible image selected by the user. -->
<!-- There are three cards: -->
<!-- (1) A welcome card that could be changed to something else. Increasing attr_totalNumberOfPortraits's maximum value (and updates to the CSS) would allow for more cards. -->
<!-- (2) The character's Avatar Portrait. -->
<!-- (3) A sticky note for more player notes. -->
<!-- The rule card: -->
<div class="item-portrait-00">
<h1>Welcome!</h1>
<div class="item-portrait-flex-container">
<div class="item-portrait-rule-description">
<h1>Starting Character Points</h1>
<p>Heroic characters are typically built on a base of 125 CP plus up to 50 CP that are offset with Complications. Use the Bonus CP input at the bottom of this sheet to account for free abilities.</p>
</div>
<div class="item-portrait-rule-description">
<h1>Portrait</h1>
<p>You may change this frame to your avatar or to space for more notes with the hidden side arrow buttons.</p>
</div>
</div>
</div>
<!-- Avatar Portrait Image -->
<div class="item-portrait-01">
<img alt="Character Avatar" name="attr_theSheetAvatar" style="width:250px;height:250px;">
</div>
<!-- Sticky Note -->
<div class="item-portrait-02">
<textarea name="attr_portraitStickyNote" maxlength="403">Sticky Note</textarea>
</div>
<!-- Portrait frame select buttons -->
<button type="action" name="act_left-arrow-button" tabindex="-1" class="button button-left-arrow">❮</button>
<button type="action" name="act_right-arrow-button" tabindex="-1" class="button button-right-arrow">❯</button>
</div>
<div class="item-characteristics-health">
<h2>BODY</h2>
<div class="item-health-stat">
<input type="text" name="attr_CurrentBODY" value="10" maxlength="3" pattern="[0-9]+" tabindex="26"/>
<div class="item-health-stat-plus-minus-enclosure">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_currentBODYplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_currentBODYminus">
<span>❮</span>
</button>
</div>
</div>
<h2>STUN</h2>
<div class="item-health-stat">
<input type="text" name="attr_CurrentSTUN" value="20" maxlength="3" pattern="[0-9]+" tabindex="27"/>
<div class="item-health-stat-plus-minus-enclosure ">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_currentSTUNplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_currentSTUNminus">
<span>❮</span>
</button>
</div>
</div>
<h2>END</h2>
<div class="item-health-stat">
<input type="text" name="attr_CurrentEND" value="20" maxlength="3" pattern="[0-9]+" tabindex="28"/>
<div class="item-health-stat-plus-minus-enclosure ">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_currentENDplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_currentENDminus">
<span>❮</span>
</button>
</div>
</div>
<button type="action" class="button buttonRecover" tabindex="-1" name="act_recoverHealth">Recover</button>
<button type="action" class="button buttonReset" tabindex="-1" name="act_resetHealth">Reset</button>
</div>
<div class="grid-container-container-turn-segments">
<label class="container-speed-indicator" >
<input type="checkbox" name="attr_speedIndicator01">
<span class="checkmark01" ></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator02">
<span class="checkmark02"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator03">
<span class="checkmark03"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator04">
<span class="checkmark04"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator05">
<span class="checkmark05"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator06" checked="true">
<span class="checkmark06"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator07">
<span class="checkmark07"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator08">
<span class="checkmark08"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator09">
<span class="checkmark09"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator10">
<span class="checkmark10"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator11">
<span class="checkmark11"></span>
</label>
<label class="container-speed-indicator">
<input type="checkbox" name="attr_speedIndicator12" checked="true">
<span class="checkmark12"></span>
</label>
</div>
<div class="item-characteristics-turn-tracker">
<button type="roll" class="button buttonTracker" tabindex="-1" name="roll_initiative" value="[[(?{Modifiers|0}+@{dexterity}) &{tracker}]]">Tracker</button>
</div>
<div class="item-characteristics-history">
<textarea name="attr_historyText" maxlength="4440" tabindex="36">Biography</textarea>
</div>
<!-- Perception Rolls -->
<div class="item-characteristics-perception">
<div class="subitem-characteristics-perception-row-container">
<div class="subitem-characteristics-perception-stat-container">
<h1>Perception</h1>
<div class="subitem-characteristics-perception-column-container">
<input type="text" name="attr_perceptionBase" value="11" readonly tabindex="-1">
<span>+<input type="number" name="attr_enhancedPerceptionModifier" value="0" min="-10" max="10" step="1" tabindex="29"></span>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_perceptionRoll" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Perception}} {{Base Chance = [[?{Modifiers|0}+@{perceptionBase}+@{enhancedPerceptionModifier}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
</div>
</div>
<div class="subitem-characteristics-perception-stat-container">
<input type="text" value="Vision" name="attr_perceptionVisionLabel" maxlength="12" tabindex="30">
<div class="subitem-characteristics-perception-column-container">
<input type="text" name="attr_perceptionVision" value="11" readonly tabindex="-1">
<span>+<input type="number" name="attr_perceptionModifierVision" value="0" min="-10" max="10" step="1" tabindex="31"></span>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_perceptionRollVision" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Perception - @{perceptionVisionLabel} }} {{Base Chance = [[?{Modifiers|0}+@{intelligenceChance}+@{enhancedPerceptionModifier}+@{perceptionModifierVision}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
</div>
</div>
<div class="subitem-characteristics-perception-stat-container">
<input type="text" value="Hearing" name="attr_perceptionHearingLabel" maxlength="12" tabindex="32">
<div class="subitem-characteristics-perception-column-container">
<input type="text" name="attr_perceptionHearing" value="11" readonly tabindex="-1">
<span>+<input type="number" name="attr_perceptionModifierHearing" value="0" min="-10" max="10" step="1" tabindex="33"></span>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_perceptionRollHearing" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Perception - @{perceptionHearingLabel} }} {{Base Chance = [[?{Modifiers|0}+@{intelligenceChance}+@{enhancedPerceptionModifier}+@{perceptionModifierHearing}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
</div>
</div>
<div class="subitem-characteristics-perception-stat-container">
<input type="text" value="Smell" name="attr_perceptionSmellLabel" maxlength="12" tabindex="34">
<div class="subitem-characteristics-perception-column-container">
<input type="text" name="attr_perceptionSmell" value="11" readonly tabindex="-1">
<span>+<input type="number" name="attr_perceptionModifierSmell" value="0" min="-10" max="10" step="1" tabindex="35"></span>
<button type="roll" class="button buttonRoll" tabindex="-1" name="roll_perceptionRollSmell" value="&{template:custom} {{title=@{character_name} - @{character_title}}} {{subtitle= Uses Perception - @{perceptionSmellLabel} }} {{Base Chance = [[?{Modifiers|0}+@{intelligenceChance}+@{enhancedPerceptionModifier}+@{perceptionModifierSmell}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Gear, weapons, and armor tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-gear">
<div class="grid-container-tab-gear">
<div class="item-tab-gear-flex-container-encumbrance">
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>Lift</h1>
<h1>Weight</h1>
<input type="number" name="attr_liftWeight" value="100" readonly tabindex="-1"/>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>Free</h1>
<h1>Carry</h1>
<input type="number" name="attr_encumbranceFreeCarry" value="10" readonly tabindex="-1"/>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>Carried</h1>
<h1>Load</h1>
<input type="number" name="attr_carriedWeight" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>END</h1>
<h1>per Turn</h1>
<input type="number" name="attr_weightEndPenalty" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>DCV & DEX</h1>
<h1>Roll Penalty</h1>
<input type="number" name="attr_weightDexDCVPenalty" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance-bonus">
<h1>DCV</h1>
<h1>Modifier</h1>
<div class="subitem-tab-gear-plus-minus-enclosure">
<input type="text" name="attr_bonusDCVmodifier" value="0" maxlength="2" pattern="[0-9]+" tabindex="-1"/>
<div class="subitem-tab-gear-flex-container-stat">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_bonusDCVmodifierPlus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_bonusDCVmodifierMinus">
<span>❮</span>
</button>
</div>
</div>
</div>
<div class="subitem-tab-gear-flex-container-encumbrance">
<h1>Movement</h1>
<h1>Penalty</h1>
<input type="number" name="attr_weightMovePenalty" value="0" readonly tabindex="-1"/>
</div>
</div>
<div class="item-tab-gear-grid-container-armor">
<div class="subitem-tab-gear-flex-container-armor">
<div class="subitem-tab-gear-flex-container-armor-row">
<h1>Armor</h1>
<h1>rPD</h1>
<h1>PD</h1>
<h1>rED</h1>
<h1>ED</h1>
<h1>END/T</h1>
<h1>ACT</h1>
<h1>‍</h1>
<h1>Locations</h1>
<h1>Mass</h1>
</div>
<!-- Armor Item 01 -->
<div class="subitem-tab-gear-flex-container-armor-row">
<input type="text" name="attr_armorName01" value="" maxlength="20" tabindex="50"/>
<input type="number" name="attr_armorPD01" step="1" value="0" min="0" step="1" tabindex="51"/>
<input type="number" name="attr_totalPD01" step="1" value="0" min="0" step="1" tabindex="51.5"/>
<input type="number" name="attr_armorED01" step="1" value="0" min="0" step="1" tabindex="52"/>
<input type="number" name="attr_totalED01" step="1" value="0" min="0" step="1" tabindex="52.5"/>
<div class="custom-select">
<select name="attr_armorEND01" tabindex="-1">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
<option value="0" selected>0</option>
</select>
</div>
<div class="custom-select">
<select name="attr_armorActivation01" tabindex="-1">
<option value="15">15-</option>
<option value="14">14-</option>
<option value="13">13-</option>
<option value="12">12-</option>
<option value="11">11-</option>
<option value="10">10-</option>
<option value="9">9-</option>
<option value="8">8-</option>
<option value="18" selected>NA</option>
</select>
</div>
<button type="roll" class="button buttonRollActivate" tabindex="-1" name="roll_armorActivation01" value="&{template:custom-activate} {{title=@{character_name} - @{character_title}}} {{subtitle= Defends with @{armorName01}**}} {{Activate on = [[@{armorActivation01}]] **or less**}} {{Result = [[3d6cf<0cs>0]]}} {{Resistant Defense = **rPD ``@{armorPD01}`` rED ``@{armorED01}``**}} {{Total Defense = **PD ``@{totalPD01}`` ED ``@{totalED01}``**}}" >Roll</button>
<input type="text" class="armorLocationsText" name="attr_armorLocations01" maxlength="24" tabindex="54"/>
<input type="number" name="attr_armorMass01" value="0" min="0" step="0.1" tabindex="55"/>
</div>
<!-- Armor Item 02 -->
<div class="subitem-tab-gear-flex-container-armor-row">
<input type="text" name="attr_armorName02" value="" maxlength="20" tabindex="56"/>
<input type="number" name="attr_armorPD02" step="1" value="0" min="0" step="1" tabindex="57"/>
<input type="number" name="attr_totalPD02" step="1" value="0" min="0" step="1" tabindex="57.5"/>
<input type="number" name="attr_armorED02" step="1" value="0" min="0" step="1" tabindex="58"/>
<input type="number" name="attr_totalED02" step="1" value="0" min="0" step="1" tabindex="58.5"/>
<div class="custom-select">
<select name="attr_armorEND02" tabindex="-1">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
<option value="0" selected>0</option>
</select>
</div>
<div class="custom-select">
<select name="attr_armorActivation02" tabindex="-1">
<option value="15">15-</option>
<option value="14">14-</option>
<option value="13">13-</option>
<option value="12">12-</option>
<option value="11">11-</option>
<option value="10">10-</option>
<option value="9">9-</option>
<option value="8">8-</option>
<option value="18" selected>NA</option>
</select>
</div>
<button type="roll" class="button buttonRollActivate" tabindex="-1" name="roll_armorActivation02" value="&{template:custom-activate} {{title=@{character_name} - @{character_title}}} {{subtitle= Defends with @{armorName02}**}} {{Activate on = [[@{armorActivation02}]] **or less**}} {{Result = [[3d6cf<0cs>0]]}} {{Resistant Defense = **rPD ``@{armorPD02}`` rED ``@{armorED02}``**}} {{Total Defense = **PD ``@{totalPD02}`` ED ``@{totalED02}``**}}" >Roll</button>
<input type="text" class="armorLocationsText" name="attr_armorLocations02" maxlength="24" tabindex="59"/>
<input type="number" name="attr_armorMass02" value="0" min="0" step="0.1" tabindex="60"/>
</div>
<!-- Armor Item 03 -->
<div class="subitem-tab-gear-flex-container-armor-row">
<input type="text" name="attr_armorName03" value="" maxlength="20" tabindex="61"/>
<input type="number" name="attr_armorPD03" step="1" value="0" min="0" step="1" tabindex="62"/>
<input type="number" name="attr_totalPD03" step="1" value="0" min="0" step="1" tabindex="62.5"/>
<input type="number" name="attr_armorED03" step="1" value="0" min="0" step="1" tabindex="63"/>
<input type="number" name="attr_totalED03" step="1" value="0" min="0" step="1" tabindex="63.5"/>
<div class="custom-select">
<select name="attr_armorEND03" tabindex="-1">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
<option value="0" selected>0</option>
</select>
</div>
<div class="custom-select">
<select name="attr_armorActivation03" tabindex="-1">
<option value="15">15-</option>
<option value="14">14-</option>
<option value="13">13-</option>
<option value="12">12-</option>
<option value="11">11-</option>
<option value="10">10-</option>
<option value="9">9-</option>
<option value="8">8-</option>
<option value="18" selected>NA</option>
</select>
</div>
<button type="roll" class="button buttonRollActivate" tabindex="-1" name="roll_armorActivation03" value="&{template:custom-activate} {{title=@{character_name} - @{character_title}}} {{subtitle= Defends with @{armorName03}**}} {{Activate on = [[@{armorActivation03}]] **or less**}} {{Result = [[3d6cf<0cs>0]]}} {{Resistant Defense = **rPD ``@{armorPD03}`` rED ``@{armorED03}``**}} {{Total Defense = **PD ``@{totalPD03}`` ED ``@{totalED03}``**}}" >Roll</button>
<input type="text" class="armorLocationsText" name="attr_armorLocations03" maxlength="24" tabindex="64"/>
<input type="number" name="attr_armorMass03" value="0" min="0" step="0.1" tabindex="65"/>
</div>
<!-- Armor Item 04 -->
<div class="subitem-tab-gear-flex-container-armor-row">
<input type="text" name="attr_armorName04" value="" maxlength="20" tabindex="66"/>
<input type="number" name="attr_armorPD04" step="1" value="0" min="0" step="1" tabindex="67"/>
<input type="number" name="attr_totalPD04" step="1" value="0" min="0" step="1" tabindex="67.5"/>
<input type="number" name="attr_armorED04" step="1" value="0" min="0" step="1" tabindex="68"/>
<input type="number" name="attr_totalED04" step="1" value="0" min="0" step="1" tabindex="68.5"/>
<div class="custom-select">
<select name="attr_armorEND04" tabindex="-1">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
<option value="0" selected>0</option>
</select>
</div>
<div class="custom-select">
<select name="attr_armorActivation04" tabindex="-1">
<option value="15">15-</option>
<option value="14">14-</option>
<option value="13">13-</option>
<option value="12">12-</option>
<option value="11">11-</option>
<option value="10">10-</option>
<option value="9">9-</option>
<option value="8">8-</option>
<option value="18" selected>NA</option>
</select>
</div>
<button type="roll" class="button buttonRollActivate" tabindex="-1" name="roll_armorActivation04" value="&{template:custom-activate} {{title=@{character_name} - @{character_title}}} {{subtitle= Defends with @{armorName04}**}} {{Activate on = [[@{armorActivation04}]] **or less**}} {{Result = [[3d6cf<0cs>0]]}} {{Resistant Defense = **rPD ``@{armorPD04}`` rED ``@{armorED04}``**}} {{Total Defense = **PD ``@{totalPD04}`` ED ``@{totalED04}``**}}" >Roll</button>
<input type="text" class="armorLocationsText" name="attr_armorLocations04" maxlength="24" tabindex="69"/>
<input type="number" name="attr_armorMass04" value="0" min="0" step="0.1" tabindex="70"/>
</div>
</div>
<!-- Shield -->
<div class="subitem-tab-gear-flex-container-shield">
<div class="subitem-tab-gear-flex-container-shield-row">
<h1>Shield</h1>
<h1>DCV</h1>
<h1>Damage</h1>
<h1>N</h1>
<h1>‍</h1>
<h1>OCV</h1>
<h1>STUNx</h1>
<h1>STR</h1>
<h1>END</h1>
<h1>BODY</h1>
<h1>DEF</h1>
<h1>Mass</h1>
</div>
<input type="hidden" name="attr_targetOCVpenalty" value="0"/>
<div class="subitem-tab-gear-flex-container-shield-row">
<input type="text" name="attr_shieldName" value="" maxlength="20" tabindex="76"/>
<input type="number" name="attr_shieldDCV" step="1" min="0" value="0" tabindex="77"/>
<input type="text" name="attr_shieldDamage" step="1" min="0" value="0" maxlength="16" tabindex="78"/>
<label class="container-checkbox-small">
<input type="checkbox" checked="checked" name="attr_shieldNormalDamage">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollShieldAttack" tabindex="-1" name="act_attackShield">Roll</button>
<input type="number" name="attr_shieldOCV" step="1" min="-10" value="0" tabindex="79"/>
<input type="number" name="attr_shieldStunMod" value="0" min="-2" step="1" tabindex="80"/>
<input type="number" name="attr_shieldStrength"step="1" min="0" value="0" tabindex="81"/>
<input type="text" name="attr_shieldEndurance" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_shieldBody" step="1" min="0" value="0" tabindex="83"/>
<input type="number" name="attr_shieldDefense" step="1" min="0" value="0" tabindex="84"/>
<input type="number" name="attr_shieldMass" step="0.1" min="0" value="0" tabindex="85"/>
</div>
</div>
</div>
<div class="item-tab-gear-flex-container-weapons">
<div class="subitem-tab-gear-flex-container-weapon-row">
<h1>Weapons</h1>
<h1>Damage</h1>
<h1>N</h1>
<h1>‍</h1>
<h1>OCV</h1>
<h1>RMod</h1>
<h1>STUNx</h1>
<h1>Shots</h1>
<h1>STR</h1>
<h1>END</h1>
<h1>Range</h1>
<h1>AoE</h1>
<h1>Mass</h1>
</div>
<!-- Weapon 01 -->
<input type="hidden" name="attr_weaponOCVPenalty01" value="0"/>
<div class="subitem-tab-gear-flex-container-weapon-row">
<input type="text" name="attr_weaponName01" value="" maxlength="20" tabindex="86"/>
<input type="text" name="attr_weaponDamage01" value="0" maxlength="16" tabindex="87"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponNormalDamage01">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollAttack" tabindex="-1" name="act_attackWeapon01">Roll</button>
<input type="number" name="attr_weaponOCV01" step="1" value="0" tabindex="88"/>
<input type="number" name="attr_weaponRangeMod01" step="1" value="0" tabindex="89"/>
<input type="number" name="attr_weaponStunMod01" value="0" min="-2" step="1" tabindex="90"/>
<input type="number" name="attr_weaponShots01" step="1" min="0" value ="0" tabindex="91"/>
<input type="number" name="attr_weaponStrength01" step="1" min="0" value="0" tabindex="92"/>
<input type="text" name="attr_weaponEndurance01" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_weaponRange01" step="1" min="0" value="0" tabindex="93"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponAreaEffect01">
<span class="checkmark-small"></span>
</label>
<input type="number" name="attr_weaponMass01" step="0.1" min="0" value="0" tabindex="94"/>
</div>
<!-- Weapon 02 -->
<input type="hidden" name="attr_weaponOCVPenalty02" value="0"/>
<div class="subitem-tab-gear-flex-container-weapon-row">
<input type="text" name="attr_weaponName02" value="" maxlength="20" tabindex="95"/>
<input type="text" name="attr_weaponDamage02" value="0" maxlength="16" tabindex="96"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponNormalDamage02">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollAttack" tabindex="-1" name="act_attackWeapon02">Roll</button>
<input type="number" name="attr_weaponOCV02" step="1" value="0" tabindex="97"/>
<input type="number" name="attr_weaponRangeMod02" step="1" value="0" tabindex="98"/>
<input type="number" name="attr_weaponStunMod02" value="0" min="-2" step="1" tabindex="99"/>
<input type="number" name="attr_weaponShots02" step="1" min="0" value="0" tabindex="100"/>
<input type="number" name="attr_weaponStrength02" step="1" min="0" value="0" tabindex="101"/>
<input type="text" name="attr_weaponEndurance02" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_weaponRange02" step="1" min="0" value="0" tabindex="102"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponAreaEffect02">
<span class="checkmark-small"></span>
</label>
<input type="number" name="attr_weaponMass02" step="0.1" min="0" value="0" tabindex="103"/>
</div>
<!-- Weapon 03 -->
<input type="hidden" name="attr_weaponOCVPenalty03" value="0"/>
<div class="subitem-tab-gear-flex-container-weapon-row">
<input type="text" name="attr_weaponName03" value="" maxlength="20" tabindex="104"/>
<input type="text" name="attr_weaponDamage03" value="0" maxlength="16" tabindex="105"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponNormalDamage03">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollAttack" tabindex="-1" name="act_attackWeapon03">Roll</button>
<input type="number" name="attr_weaponOCV03" step="1" value="0" tabindex="106"/>
<input type="number" name="attr_weaponRangeMod03" step="1" value="0" tabindex="107"/>
<input type="number" name="attr_weaponStunMod03" value="0" min="-2" step="1" tabindex="108"/>
<input type="number" name="attr_weaponShots03" step="1" min="0" value="0" tabindex="109"/>
<input type="number" name="attr_weaponStrength03" step="1" min="0" value="0" tabindex="110"/>
<input type="text" name="attr_weaponEndurance03" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_weaponRange03" step="1" min="0" value="0" tabindex="111"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponAreaEffect03">
<span class="checkmark-small"></span>
</label>
<input type="number" name="attr_weaponMass03" step="0.1" min="0" value="0" tabindex="112"/>
</div>
<!-- Weapon 04 -->
<input type="hidden" name="attr_weaponOCVPenalty04" value="0"/>
<div class="subitem-tab-gear-flex-container-weapon-row">
<input type="text" name="attr_weaponName04" value="" maxlength="20" tabindex="113"/>
<input type="text" name="attr_weaponDamage04" value="0" maxlength="16" tabindex="114"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponNormalDamage04">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollAttack" tabindex="-1" name="act_attackWeapon04">Roll</button>
<input type="number" name="attr_weaponOCV04" step="1" value="0" tabindex="115"/>
<input type="number" name="attr_weaponRangeMod04" step="1" value="0" tabindex="116"/>
<input type="number" name="attr_weaponStunMod04" value="0" min="-2" step="1" tabindex="117"/>
<input type="number" name="attr_weaponShots04" step="1" min="0" value="0" tabindex="118"/>
<input type="number" name="attr_weaponStrength04" step="1" min="0" value="0" tabindex="119"/>
<input type="text" name="attr_weaponEndurance04" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_weaponRange04" step="1" min="0" value="0" tabindex="120"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponAreaEffect04">
<span class="checkmark-small"></span>
</label>
<input type="number" name="attr_weaponMass04" step="0.1" min="0" value="0" tabindex="121"/>
</div>
<!-- Weapon 05 -->
<input type="hidden" name="attr_weaponOCVPenalty05" value="0"/>
<div class="subitem-tab-gear-flex-container-weapon-row">
<input type="text" name="attr_weaponName05" vvalue="" maxlength="20" tabindex="122"/>
<input type="text" name="attr_weaponDamage05"value="0" maxlength="16" tabindex="123"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponNormalDamage05">
<span class="checkmark-small"></span>
</label>
<button type="action" class="button buttonRollAttack" tabindex="-1" name="act_attackWeapon05">Roll</button>
<input type="number" name="attr_weaponOCV05" step="1" value="0" tabindex="124"/>
<input type="number" name="attr_weaponRangeMod05" step="1" value="0" tabindex="125"/>
<input type="number" name="attr_weaponStunMod04" value="0" min="-2" step="1" tabindex="126"/>
<input type="number" name="attr_weaponShots05" step="1" min="0" value="0" tabindex="127"/>
<input type="number" name="attr_weaponStrength05" step="1" min="0" value="0" tabindex="128"/>
<input type="text" name="attr_weaponEndurance05" value="0" readonly tabindex="-1"/>
<input type="number" name="attr_weaponRange05" step="1" min="0" value="0" tabindex="129"/>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_weaponAreaEffect05">
<span class="checkmark-small"></span>
</label>
<input type="number" name="attr_weaponMass05" step="0.1" min="0" value="0" tabindex="130"/>
</div>
</div>
<div class="item-tab-gear-flex-container-equipment">
<div class="subitem-tab-gear-flex-container-equipment">
<h1>Equipment</h1>
<h1>Mass</h1>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText01" maxlength="30" tabindex="131"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp01">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown01">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass01" min="0" step="0.1" tabindex="132"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText02" maxlength="30" tabindex="134"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp02">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown02">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass02" min="0" step="0.1" tabindex="135"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText03" maxlength="30" tabindex="136"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp03">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown03">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass03" min="0" step="0.1" tabindex="137"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText04" maxlength="30" tabindex="138"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp04">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown04">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass04" min="0" step="0.1" tabindex="139"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText05" maxlength="30" tabindex="140"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp05">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown05">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass05" min="0" step="0.1" tabindex="141"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText06" maxlength="30" tabindex="142"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp06">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown06">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass06" min="0" step="0.1" tabindex="143"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText07" maxlength="30" tabindex="144"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp07">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown07">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass07" min="0" step="0.1" tabindex="145"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText08" maxlength="30" tabindex="146"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp08">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown08">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass08" min="0" step="0.1" tabindex="147"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText09" maxlength="30" tabindex="148"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp09">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown09">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass09" min="0" step="0.1" tabindex="149"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText10" maxlength="30" tabindex="150"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp10">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown10">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass10" min="0" step="0.1" tabindex="151"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText11" maxlength="30" tabindex="152"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp11">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown11">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass11" min="0" step="0.1" tabindex="153"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText12" maxlength="30" tabindex="154"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp12">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown12">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass12" min="0" step="0.1" tabindex="155"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText13" maxlength="30" tabindex="156"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp13">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown13">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass13" min="0" step="0.1"/ tabindex="157"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText14" maxlength="30" tabindex="158"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp14">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown14">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass14" min="0" step="0.1" tabindex="159"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText15" maxlength="30" tabindex="160"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp15">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown15">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass15" min="0" step="0.1" tabindex="161"/>
</div>
<div class="subitem-tab-gear-flex-container-equipment">
<input type="text" name="attr_equipText16" maxlength="30" tabindex="162"/>
<div class="gear-mover-plus-minus-enclosure">
<div class="gear-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_equipUp16">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_equipDown16">
<span>❮</span>
</button>
</div>
</div>
<input type="number" name="attr_equipMass16" min="0" step="0.1" tabindex="163"/>
</div>
</div>
<!-- Tab Gear Health Status -->
<div class="item-gear-health">
<h2>BODY</h2>
<div class="item-health-stat">
<input type="text" name="attr_gearCurrentBODY" value="10" maxlength="3" pattern="[0-9]+" tabindex="-1"/>
<div class="item-health-stat-plus-minus-enclosure ">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_gearCurrentBODYplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_gearCurrentBODYminus">
<span>❮</span>
</button>
</div>
</div>
<h2>STUN</h2>
<div class="item-health-stat">
<input type="text" name="attr_gearCurrentSTUN" value="20" maxlength="3" pattern="[0-9]+" tabindex="-1"/>
<div class="item-health-stat-plus-minus-enclosure ">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_gearCurrentSTUNplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_gearCurrentSTUNminus">
<span>❮</span>
</button>
</div>
</div>
<h2>END</h2>
<div class="item-health-stat">
<input type="text" name="attr_gearCurrentEND" value="20" maxlength="3" pattern="[0-9]+" tabindex="-1"/>
<div class="item-health-stat-plus-minus-enclosure ">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_gearCurrentENDplus">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_gearCurrentENDminus">
<span>❮</span>
</button>
</div>
</div>
<button type="action" class="button buttonRecover" tabindex="-1" name="act_gearRecoverHealth">Recover</button>
<button type="action" class="button buttonReset" tabindex="-1" name="act_gearResetHealth">Reset</button>
</div>
<!-- Maneuvers Container -->
<div class="item-tab-gear-slide-container">
<input type="hidden" class="item-gear-slideshow" name="attr_gearSlideSelection" value="1" min="1" step="1" max="4"/>
<input type="hidden" name="attr_totalNumberOfGearSlides" value="4"/>
<div class="item-tab-gear-slide-flex-container-maneuvers">
<!-- Slide showing basic Hero combat maneuvers a flex container for rows of flex columns -->
<div class="subitem-tab-gear-slide-flex-container-maneuvers-heading">
<h1>Maneuver</h1>
<h1>Phase</h1>
<h1>OCV</h1>
<h1>DCV</h1>
<h1>Effects</h1>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Block</h1>
<h2>1/2</h2>
<h2>+0</h2>
<h2>+0</h2>
<h2>Block, Abort</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Brace</h1>
<h2>0</h2>
<h2>+2</h2>
<h2>1/2</h2>
<h2>+2 OCV vs. Range Mod.</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Disarm</h1>
<h2>1/2</h2>
<h2>-2</h2>
<h2>+0</h2>
<h2>Strength vs Strength</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Dodge</h1>
<h2>1/2</h2>
<h2>—</h2>
<h2>+3</h2>
<h2>Abort, vs. all attacks</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Grab</h1>
<h2>1/2</h2>
<h2>-1*</h2>
<h2>-2*</h2>
<h2>Grab two limbs</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Grab By</h1>
<h2>1/2</h2>
<h2>-3</h2>
<h2>-4</h2>
<h2>Move, grab, +v/10 STR</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Haymaker</h1>
<h2>1/2*</h2>
<h2>+0</h2>
<h2>-5</h2>
<h2>+4 DC to attack</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Move By</h1>
<h2>1/2</h2>
<h2>-2</h2>
<h2>-2</h2>
<h2>STR/2 +v/10; take 1/3</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Move Through</h1>
<h2>1/2</h2>
<h2>-v/10</h2>
<h2>-3</h2>
<h2>STR+v/6; take 1/2 or full</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Multiple Attack</h1>
<h2>1</h2>
<h2>var.</h2>
<h2>1/2</h2>
<h2>Attack multiple times</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Set</h1>
<h2>1</h2>
<h2>+1*</h2>
<h2>+0</h2>
<h2>Ranged attacks. May Brace</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-dark-row">
<h1>Shove</h1>
<h2>1/2</h2>
<h2>-1</h2>
<h2>-1</h2>
<h2>Push 1m per 5 STR</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Strike</h1>
<h2>1/2</h2>
<h2>+0</h2>
<h2>+0</h2>
<h2>Damage by STR or weapon</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Throw</h1>
<h2>1/2</h2>
<h2>+0</h2>
<h2>+0</h2>
<h2>Throw with STR damage</h2>
</div>
<div class="subitem-tab-gear-slide-flex-container-maneuvers-light-row">
<h1>Trip</h1>
<h2>1/2</h2>
<h2>-1</h2>
<h2>-2</h2>
<h2>Knock target prone</h2>
</div>
</div>
<div class="item-tab-gear-slide-flex-container-martial-maneuvers">
<!-- Slide showing special martial arts maneuvers. Entries need to be supplied by the user. -->
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-heading">
<h1>Martial Maneuver</h1>
<h1>Phase</h1>
<h1>OCV</h1>
<h1>DCV</h1>
<h1>Effects</h1>
</div>
<div class="item-tab-gear-slide-flex-container-martial-maneuvers-block">
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName01" tabindex="164"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP01" tabindex="165"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll01" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName01}}} {{Phases=@{martialManeuverPhase01}}} {{OCV = @{martialManeuverOCV01}}} {{DCV = @{martialManeuverDCV01}}} {{desc=@{martialManeuverEffect01}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase01" tabindex="166"/>
<input type="text" value="+0" name="attr_martialManeuverOCV01" tabindex="167"/>
<input type="text" value="+0" name="attr_martialManeuverDCV01" tabindex="168"/>
<textarea value="" name="attr_martialManeuverEffect01" tabindex="169"/>
</div>
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName02" tabindex="170"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP02" tabindex="171"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll02" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName02}}} {{Phases=@{martialManeuverPhase02}}} {{OCV = @{martialManeuverOCV02}}} {{DCV = @{martialManeuverDCV02}}} {{desc=@{martialManeuverEffect02}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase02" tabindex="172"/>
<input type="text" value="+0" name="attr_martialManeuverOCV02" tabindex="173"/>
<input type="text" value="+0" name="attr_martialManeuverDCV02" tabindex="174"/>
<textarea value="" name="attr_martialManeuverEffect02" tabindex="175"/>
</div>
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName03" tabindex="176"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP03" tabindex="177"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll03" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName03}}} {{Phases=@{martialManeuverPhase03}}} {{OCV = @{martialManeuverOCV03}}} {{DCV = @{martialManeuverDCV03}}} {{desc=@{martialManeuverEffect03}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase03" tabindex="178"/>
<input type="text" value="+0" name="attr_martialManeuverOCV03" tabindex="179"/>
<input type="text" value="+0" name="attr_martialManeuverDCV03" tabindex="180"/>
<textarea value="" name="attr_martialManeuverEffect03" tabindex="181"/>
</div>
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName04" tabindex="182"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP04"tabindex="183"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll04" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName04}}} {{Phases=@{martialManeuverPhase04}}} {{OCV = @{martialManeuverOCV04}}} {{DCV = @{martialManeuverDCV04}}} {{desc=@{martialManeuverEffect04}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase04" tabindex="184"/>
<input type="text" value="+0" name="attr_martialManeuverOCV04" tabindex="185"/>
<input type="text" value="+0" name="attr_martialManeuverDCV04" tabindex="186"/>
<textarea value="" name="attr_martialManeuverEffect04" tabindex="187"/>
</div>
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName05" tabindex="188"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP05" tabindex="189"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll05" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName05}}} {{Phases=@{martialManeuverPhase05}}} {{OCV = @{martialManeuverOCV05}}} {{DCV = @{martialManeuverDCV05}}} {{desc=@{martialManeuverEffect05}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase05" tabindex="190"/>
<input type="text" value="+0" name="attr_martialManeuverOCV05" tabindex="191"/>
<input type="text" value="+0" name="attr_martialManeuverDCV05" tabindex="192"/>
<textarea value="" name="attr_martialManeuverEffect05" tabindex="193"/>
</div>
<div class="subitem-tab-gear-slide-flex-container-martial-maneuvers-row">
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points">
<input type="text" value="" maxlength="24" name="attr_martialManeuverName06" tabindex="194"/>
<div class="subitem-tab-gear-slide-flex-container-martial-name-and-points-row">
<h1>CP:</h1>
<input type="number" value="0" min="0" step="1" name="attr_martialManeuverCP06" tabindex="195"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showMartialRoll06" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Martial Maneuver - @{martialManeuverName06}}} {{Phases=@{martialManeuverPhase06}}} {{OCV = @{martialManeuverOCV06}}} {{DCV = @{martialManeuverDCV06}}} {{desc=@{martialManeuverEffect06}}}">Show</button>
</div>
</div>
<input type="text" value="1/2" name="attr_martialManeuverPhase06" tabindex="196"/>
<input type="text" value="+0" name="attr_martialManeuverOCV06" tabindex="197"/>
<input type="text" value="+0" name="attr_martialManeuverDCV06" tabindex="198"/>
<textarea value="" name="attr_martialManeuverEffect06" tabindex="199"/>
</div>
</div>
<div class="subitem-tab-gear-slide-flex-container-standard-attack">
<h1>Basic Attack</h1>
<span><button type="action" class="button buttonRollNormalAttack" tabindex="-1" name="act_standardAttackRoll">Roll</button></span>
<h2>1/2</h2>
<h2>+0</h2>
<h2>+0</h2>
<h2>Normal damage STR/5</h2>
</div>
<!-- Range Modifier Table -->
<div class="subitem-tab-gear-slide-flex-container-range-modifiers">
<div class="subitem-tab-gear-slide-range-modifier-container-first">
<h2>Range (m)</h2>
<h2>OCV Mod:</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>0-8</h2>
<h2>0</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>9-16</h2>
<h2>-2</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>17-32</h2>
<h2>-4</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>33-64</h2>
<h2>-6</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>65-125</h2>
<h2>-8</h2>
</div>
<div class="subitem-tab-gear-slide-range-modifier-container">
<h2>126-250</h2>
<h2>-10</h2>
</div>
</div>
</div>
<div class="item-tab-gear-slide-flex-container-hit-locations">
<div class="item-gear-slide-container-hit-locations-flex-row">
<!-- Special target locations -->
<div class="item-gear-slide-flex-container-hit-locations-special">
<div class="subitem-gear-slide-flex-container-hit-locations-special-heading">
<h1>Target</h1>
<h1>Roll</h1>
<h1>Location</h1>
<h1>OCV</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-top-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="1" checked>
<span class="custom-radio-button"></span>
</label>
<h1>3d6</h1>
<h1>Any</h1>
<h1>0</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="12">
<span class="custom-radio-button"></span>
</label>
<h1>1d6+3</h1>
<h1>Head Shot</h1>
<h1>-4</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="13">
<span class="custom-radio-button"></span>
</label>
<h1>2d6+1</h1>
<h1>High Shot</h1>
<h1>-2</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="14">
<span class="custom-radio-button"></span>
</label>
<h1>2d6+4</h1>
<h1>Body Shot</h1>
<h1>-1</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="15">
<span class="custom-radio-button"></span>
</label>
<h1>2d6+7</h1>
<h1>Low Shot</h1>
<h1>-2</h1>
</div>
<div class="subitem-gear-slide-flex-container-hit-locations-special-bottom-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="16">
<span class="custom-radio-button"></span>
</label>
<h1>1d6+12</h1>
<h1>Leg Shot</h1>
<h1>-4</h1>
</div>
</div>
<!-- Targeting Options -->
<div class="item-gear-slide-container-hit-locations-options">
<div class="subitem-gear-slide-container-hit-locations-options-top">
<label class="container-checkbox-small-gray">
<input type="checkbox" name="attr_halveTargetOCVpenalty">
<span class="checkmark-small-gray"></span>
</label>
<h1>Half Penalty</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-options-bottom">
<h1>Apply PSL</h1>
<input type="number" name="attr_penaltySkillLevels" value="0" min="0" step="1" tabindex="200"/>
</div>
</div>
</div>
<!-- Standard Hit Location Table -->
<div class="item-gear-slide-container-hit-locations-table">
<div class="subitem-gear-slide-container-hit-locations-table-heading">
<h1>Target</h1>
<h1>Roll</h1>
<h1>Location</h1>
<h1>STUNx</h1>
<h1>N STUN</h1>
<h1>BODYx</h1>
<h1>OCV</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-top-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="2">
<span class="custom-radio-button"></span>
</label>
<h1>3-5</h1>
<h1>Head</h1>
<h1>x5</h1>
<h1>x2</h1>
<h1>x2</h1>
<h1>-8</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="3">
<span class="custom-radio-button"></span>
</label>
<h1>6</h1>
<h1>Hands</h1>
<h1>x1</h1>
<h1>x1/2</h1>
<h1>x1/2</h1>
<h1>-6</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="4">
<span class="custom-radio-button"></span>
</label>
<h1>7-8</h1>
<h1>Arms</h1>
<h1>x2</h1>
<h1>x1/2</h1>
<h1>x1/2</h1>
<h1>-5</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="5">
<span class="custom-radio-button"></span>
</label>
<h1>9</h1>
<h1>Shoulders</h1>
<h1>x3</h1>
<h1>x1</h1>
<h1>x1</h1>
<h1>-5</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="6">
<span class="custom-radio-button"></span>
</label>
<h1>10-11</h1>
<h1>Chest</h1>
<h1>x3</h1>
<h1>x1</h1>
<h1>x1</h1>
<h1>-3</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="7">
<span class="custom-radio-button"></span>
</label>
<h1>12</h1>
<h1>Stomach</h1>
<h1>x4</h1>
<h1>x3/2</h1>
<h1>x1</h1>
<h1>-7</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="8">
<span class="custom-radio-button"></span>
</label>
<h1>13</h1>
<h1>Vitals</h1>
<h1>x4</h1>
<h1>x3/2</h1>
<h1>x2</h1>
<h1>-8</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="9">
<span class="custom-radio-button"></span>
</label>
<h1>14</h1>
<h1>Thighs</h1>
<h1>x2</h1>
<h1>x1</h1>
<h1>x1</h1>
<h1>-4</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-middle-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="10">
<span class="custom-radio-button"></span>
</label>
<h1>15-16</h1>
<h1>Legs</h1>
<h1>x2</h1>
<h1>x1/2</h1>
<h1>x1/2</h1>
<h1>-6</h1>
</div>
<div class="subitem-gear-slide-container-hit-locations-table-bottom-row">
<label class="custom-radio-button-container">
<input type="radio" name="attr_targetSelection" value="11">
<span class="custom-radio-button"></span>
</label>
<h1>17-18</h1>
<h1>Feet</h1>
<h1>x1</h1>
<h1>x1/2</h1>
<h1>x1/2</h1>
<h1>-8</h1>
</div>
</div>
</div>
<!-- Slide for text -->
<div class="item-tab-gear-slide-treasure-text">
<textarea name="attr_treasures" maxlength="4096" tabindex="201"></textarea>
</div>
<button type="action" name="act_left-gear-arrow-button" tabindex="-1" class="button button-left-arrow">❮</button>
<button type="action" name="act_right-gear-arrow-button" tabindex="-1" class="button button-right-arrow">❯</button>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Skills tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-skills">
<div class="grid-container-skills-tab">
<div class="item-skillsTab-flex-container-skills-group01">
<!-- Left side skills heading -->
<div class="subitem-skillsTab-grid-container-skills-heading-left">
<div class="subitem-skillsTab-grid-container-skills-heading-left-name">
<h1>Skill</h1>
</div>
<div class="subitem-skillsTab-grid-container-skills-heading-left-type">
<h1>Type</h1>
</div>
<div class="subitem-skillsTab-grid-container-skills-heading-left-roll">
<h1>Roll</h1>
</div>
<div class="subitem-skillsTab-grid-container-skills-heading-left-cost">
<h1>CP</h1>
</div>
</div>
<!-- Skill 01 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName01" maxlength="20" tabindex="300"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp01">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown01">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType01">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance01" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill01" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName01}}} {{Base Chance = [[@{skillRollChance01}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}">Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP01" tabindex="301"/>
</div>
<!-- Skill 02 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName02" maxlength="20" tabindex="302"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp02">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown02">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType02">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance02" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill02" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName02}}} {{Base Chance = [[@{skillRollChance02}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP02" tabindex="303"/>
</div>
<!-- Skill 03 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName03" maxlength="20" tabindex="304"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp03">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown03">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType03">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance03" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill03" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName03}}} {{Base Chance = [[@{skillRollChance03}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP03" tabindex="305"/>
</div>
<!-- Skill 04 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName04" maxlength="20" tabindex="306"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp04">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown04">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType04">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance04" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill04" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName04}}} {{Base Chance = [[@{skillRollChance04}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP04" tabindex="307"/>
</div>
<!-- Skill 05 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName05" maxlength="20" tabindex="308"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp05">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown05">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType05">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance05" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill05" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName05}}} {{Base Chance = [[@{skillRollChance05}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP05" tabindex="309"/>
</div>
<!-- Skill 06 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName06" maxlength="20" tabindex="310"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp06">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown06">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType06">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance06" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill06" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName06}}} {{Base Chance = [[@{skillRollChance06}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP06" tabindex="311"/>
</div>
<!-- Skill 07 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName07" maxlength="20" tabindex="312"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp07">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown07">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType07">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance07" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill07" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName07}}} {{Base Chance = [[@{skillRollChance07}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP07" tabindex="313"/>
</div>
<!-- Skill 08 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName08" maxlength="20" tabindex="314"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp08">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown08">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType08">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance08" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill08" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName08}}} {{Base Chance = [[@{skillRollChance08}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP08" tabindex="315"/>
</div>
<!-- Skill 09 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName09" maxlength="20" tabindex="316"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp09">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown09">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType09">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance09" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill09" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName09}}} {{Base Chance = [[@{skillRollChance09}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP09" tabindex="317"/>
</div>
<!-- Skill 10 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName10" maxlength="20" tabindex="318"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp10">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown10">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType10">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance10" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill10" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName10}}} {{Base Chance = [[@{skillRollChance10}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP10" tabindex="319"/>
</div>
</div>
<!-- Skill Group 02-->
<div class="item-skillsTab-flex-container-skills-group02">
<!-- Skill 11 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName11" maxlength="20" tabindex="320"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp11">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown11">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType11">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance11" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill11" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName11}}} {{Base Chance = [[@{skillRollChance11}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP11" tabindex="321"/>
</div>
<!-- Skill 12 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName12" maxlength="20" tabindex="322"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp12">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown12">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType12">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance12" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill12" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName12}}} {{Base Chance = [[@{skillRollChance12}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP12" tabindex="323"/>
</div>
<!-- Skill 13 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName13" maxlength="20" tabindex="324"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp13">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown13">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType13">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance13" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill13" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName13}}} {{Base Chance = [[@{skillRollChance13}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP13" tabindex="325"/>
</div>
<!-- Skill 14 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName14" maxlength="20" tabindex="326"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp14">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown14">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType14">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance14" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill14" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName14}}} {{Base Chance = [[@{skillRollChance14}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP14" tabindex="327"/>
</div>
<!-- Skill 15 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName15" maxlength="20" tabindex="328"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp15">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown15">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType15">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance15" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill15" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName15}}} {{Base Chance = [[@{skillRollChance15}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP15" tabindex="329"/>
</div>
<!-- Skill 16 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName16" maxlength="20" tabindex="330"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp16">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown16">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType16">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance16" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill16" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName16}}} {{Base Chance = [[@{skillRollChance16}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP16" tabindex="331"/>
</div>
<!-- Skill 17 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName17" maxlength="20" tabindex="332"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp17">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown17">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType17">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance17" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill17" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName17}}} {{Base Chance = [[@{skillRollChance17}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP17" tabindex="333"/>
</div>
<!-- Skill 18 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName18" maxlength="20" tabindex="334"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp18">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown18">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType18">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance18" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill18" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName18}}} {{Base Chance = [[@{skillRollChance18}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP18" tabindex="335"/>
</div>
<!-- Skill 19 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName19" maxlength="20" tabindex="336"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp19">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown19">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType19">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance19" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill19" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName19}}} {{Base Chance = [[@{skillRollChance19}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP19" tabindex="337"/>
</div>
<!-- Skill 20 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName20" maxlength="20" tabindex="338"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp20">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown20">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType20">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance20" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill20" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName20}}} {{Base Chance = [[@{skillRollChance20}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP20" tabindex="339"/>
</div>
</div>
<!-- Skill Group 03-->
<div class="item-skillsTab-flex-container-skills-group03">
<!-- Skill 21 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName21" maxlength="20" tabindex="340"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp21">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown21">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType21">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="combat">Combat</option>
<option value="tf">TF</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance21" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill21" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName21}}} {{Base Chance = [[@{skillRollChance21}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP21" tabindex="341"/>
</div>
<!-- Skill 22 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName22" maxlength="20" tabindex="342"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp22">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown22">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType22">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance22" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill22" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName22}}} {{Base Chance = [[@{skillRollChance22}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP22" tabindex="343"/>
</div>
<!-- Skill 23 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName23" maxlength="20" tabindex="344"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp23">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown23">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType23">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance23" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill23" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName23}}} {{Base Chance = [[@{skillRollChance23}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP23" tabindex="345"/>
</div>
<!-- Skill 24 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName24" maxlength="20" tabindex="346"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp24">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown24">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType24">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance24" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill24" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName24}}} {{Base Chance = [[@{skillRollChance24}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP24" tabindex="347"/>
</div>
<!-- Skill 25 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName25" maxlength="20" tabindex="348"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp25">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown25">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-alternate-skill">
<select name="attr_skillType25">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance25" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill25" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName25}}} {{Base Chance = [[@{skillRollChance25}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP25" tabindex="349"/>
</div>
<!-- Skill 26 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName26" maxlength="20" tabindex="350"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp26">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown26">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType26">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance26" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill26" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName26}}} {{Base Chance = [[@{skillRollChance26}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP26" tabindex="351"/>
</div>
<!-- Skill 27 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName27" maxlength="20" tabindex="352"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp27">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown27">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType27">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance27" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill27" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName27}}} {{Base Chance = [[@{skillRollChance27}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP27" tabindex="353"/>
</div>
<!-- Skill 28 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName28" maxlength="20" tabindex="354"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp28">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown28">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType28">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance28" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill28" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName28}}} {{Base Chance = [[@{skillRollChance28}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP28" tabindex="355"/>
</div>
<!-- Skill 29 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName29" maxlength="20" tabindex="356"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp29">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown29">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType29">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance29" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill29" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName29}}} {{Base Chance = [[@{skillRollChance29}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP29" tabindex="357"/>
</div>
<!-- Skill 30 -->
<div class="subitem-skillsTab-flex-container-skill">
<input type="text" value="" name="attr_skillName30" maxlength="20" tabindex="358"/>
<div class="skill-mover-plus-minus-enclosure">
<div class="skill-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_skillUp30">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_skillDown30">
<span>❮</span>
</button>
</div>
</div>
<div class="custom-select-skill">
<select name="attr_skillType30">
<option value="none" selected>-</option>
<option value="str">STR</option>
<option value="dex">DEX</option>
<option value="con">CON</option>
<option value="int">INT</option>
<option value="ego">EGO</option>
<option value="pre">PRE</option>
<option value="ak">AK</option>
<option value="ks">KS</option>
<option value="intKS">KS (INT)</option>
<option value="ps">PS</option>
<option value="intPS">PS (INT)</option>
<option value="dexPS">PS (DEX)</option>
<option value="ss">SS</option>
<option value="intSS">SS (INT)</option>
<option value="tf">TF</option>
<option value="combat">Combat</option>
<option value="other">Other</option>
<option value="group">Group</option>
</select>
</div>
<input type="text" value="0" name="attr_skillRollChance30" readonly tabindex="-1"/>
<button type="roll" class='button buttonRoll' name="roll_testSkill30" tabindex="-1" value="&{template:custom} {{title=@{character_name} - @{character_title} }} {{subtitle= Uses @{skillName30}}} {{Base Chance = [[@{skillRollChance30}+?{Modifiers|0}]] }} {{Roll=[[3d6cf<7cs>0]]}} {{}}" >Roll</button>
<input type="number" value="0" min="0" name="attr_skillCP30" tabindex="359"/>
</div>
</div>
<!-- Combat skills section -->
<div class="item-skillsTab-grid-container-combat-skills">
<!-- Combat skill names -->
<div class="subitem-skillsTab-flex-container-combat-skills-names">
<h1>Combat Skills</h1>
<input type="text" value="" name="attr_skillName31" maxlength="20" tabindex="360"/>
<input type="text" value="" name="attr_skillName32" maxlength="20" tabindex="362"/>
<input type="text" value="" name="attr_skillName33" maxlength="20" tabindex="364"/>
<input type="text" value="" name="attr_skillName34" maxlength="20" tabindex="366"/>
<input type="text" value="" name="attr_skillName35" maxlength="20" tabindex="368"/>
<input type="text" value="" name="attr_skillName36" maxlength="20" tabindex="370"/>
<input type="text" value="" name="attr_skillName37" maxlength="20" tabindex="372"/>
</div>
<div class="subitem-skillsTab-flex-container-combat-skills-level-names">
<h1>All HTH Levels</h1> <!-- skill 38 -->
<h1>All Range Levels</h1> <!-- skill 39 -->
<h1>All Combat Levels</h1> <!-- skill 40 -->
</div>
<!-- Combat skill levels where needed -->
<div class="subitem-skillsTab-flex-container-combat-skills-levels">
<h1>Levels</h1>
<input type="number" value="0" min="0" name="attr_skillLevels31" tabindex="361"/>
<input type="number" value="0" min="0" name="attr_skillLevels32" tabindex="363"/>
<input type="number" value="0" min="0" name="attr_skillLevels33" tabindex="365"/>
<input type="number" value="0" min="0" name="attr_skillLevels34" tabindex="367"/>
<input type="number" value="0" min="0" name="attr_skillLevels35" tabindex="369"/>
<input type="number" value="0" min="0" name="attr_skillLevels36" tabindex="371"/>
<input type="number" value="0" min="0" name="attr_skillLevels37" tabindex="373"/>
<input type="number" value="0" min="0" name="attr_skillLevels38" tabindex="375"/> <!-- All HTH -->
<input type="number" value="0" min="0" name="attr_skillLevels39" tabindex="377"/> <!-- All Range -->
<input type="number" value="0" min="0" name="attr_skillLevels40" tabindex="379"/> <!-- All Combat -->
</div>
<div class="subitem-skillsTab-flex-container-combat-skills-types">
<h1>Type</h1>
<div class="custom-select">
<select name="attr_skillType31">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType32">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL8">CSL8</option>
<option value="CSL5">CSL5</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType33">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType34">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType35">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType36">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<div class="custom-select">
<select name="attr_skillType37">
<option value="none" selected>-</option>
<option value="Fam1" >WF1</option>
<option value="Fam2" >WF2</option>
<option value="CSL2">CSL2</option>
<option value="CSL3">CSL3</option>
<option value="CSL5">CSL5</option>
<option value="CSL8">CSL8</option>
<option value="PSL1">PSL1</option>
<option value="PSL2">PSL2</option>
<option value="PSL3">PSL3</option>
</select>
</div>
<!-- Blank entry for Skill 38 type: All HTH -->
<!-- Blank entry for Skill 39 type: All Range -->
<!-- Blank entry for Skill 40 type: All Combat -->
</div>
<div class="subitem-skillsTab-flex-container-combat-skills-costs">
<h1>CP</h1>
<input type="text" value="0" name="attr_skillCP31" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP32" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP33" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP34" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP35" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP36" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP37" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP38" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP39" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_skillCP40" readonly tabindex="-1"/>
</div>
</div>
<!-- Language skills section -->
<div class="item-skillsTab-flex-container-languages">
<!-- Language skills heading -->
<div class="subitem-skillsTab-flex-container-languages-heading">
<div class="subitem-skillsTab-flex-container-languages-heading-name">
<h1>Languages</h1>
</div>
<div class="subitem-skillsTab-flex-container-languages-heading-fluency">
<h1>Fluency</h1>
</div>
<div class="subitem-skillsTab-flex-container-languages-heading-literacy">
<h1>Lit.</h1>
</div>
<div class="subitem-skillsTab-flex-container-languages-heading-cost">
<h1>CP</h1>
</div>
</div>
<!-- Language skill 01 (41 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="Native Language" name="attr_skillName41" maxlength="23" tabindex="380"/>
<div class="custom-select">
<select name="attr_skillFluency41">
<option value="native" selected >Native</option>
<option value="none">-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy41">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP41" readonly tabindex="-1"/>
</div>
<!-- Language skill 02 (42 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName42" maxlength="23" tabindex="381"/>
<div class="custom-select">
<select name="attr_skillFluency42">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy42">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP42" readonly tabindex="-1"/>
</div>
<!-- Language skill 03 (43 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName43" maxlength="23" tabindex="382"/>
<div class="custom-select">
<select name="attr_skillFluency43">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy43">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP43" readonly tabindex="-1"/>
</div>
<!-- Language skill 04 (44 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName44" maxlength="23" tabindex="383"/>
<div class="custom-select">
<select name="attr_skillFluency44">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy44">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP44" readonly tabindex="-1"/>
</div>
<!-- Language skill 05 (45 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName45" maxlength="23" tabindex="384"/>
<div class="custom-select">
<select name="attr_skillFluency45">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy45">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP45" readonly tabindex="-1"/>
</div>
<!-- Language skill 06 (46 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName46" maxlength="23" tabindex="385"/>
<div class="custom-select">
<select name="attr_skillFluency46">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy46">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP46" readonly tabindex="-1"/>
</div>
<!-- Language skill 07 (47 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName47" maxlength="23" tabindex="386"/>
<div class="custom-select">
<select name="attr_skillFluency47">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy47">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP47" readonly tabindex="-1"/>
</div>
<!-- Language skill 08 (48 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName48" maxlength="23" tabindex="387"/>
<div class="custom-select">
<select name="attr_skillFluency48">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy48">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP48" readonly tabindex="-1"/>
</div>
<!-- Language skill 09 (49 overall) -->
<div class="subitem-skillsTab-flex-container-language">
<input type="text" value="" name="attr_skillName49" maxlength="23" tabindex="388"/>
<div class="custom-select">
<select name="attr_skillFluency49">
<option value="native">Native</option>
<option value="none" selected >-</option>
<option value="basic" >Basic</option>
<option value="fluent" >Fluent</option>
<option value="accent" >Accent</option>
<option value="idiomatic">Idiomatic</option>
<option value="imitate" >Imitate</option>
</select>
</div>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_skillLiteracy49">
<span class="checkmark-small"></span>
</label>
<input type="text" value="0" name="attr_skillCP49" readonly tabindex="-1"/>
</div>
</div>
<!-- Enhancers and Levels -->
<div class="item-skillsTab-grid-container-skill-enhancers">
<!-- Enhancer Heading -->
<div class="subitem-skillsTab-flex-container-skill-enhancers-heading">
<h1>Enhancer</h1>
<h1>CP</h1>
</div>
<!-- Enhancer Checkboxes -->
<div class="subitem-skillsTab-flex-container-skill-enhancers-checkboxes">
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerJack">
<span class="checkmark-small"></span>
</label>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerLing">
<span class="checkmark-small"></span>
</label>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerSch">
<span class="checkmark-small"></span>
</label>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerSci">
<span class="checkmark-small"></span>
</label>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerTrav">
<span class="checkmark-small"></span>
</label>
<label class="container-checkbox-small">
<input type="checkbox" name="attr_enhancerWell">
<span class="checkmark-small"></span>
</label>
</div>
<!-- Skill Names -->
<div class="subitem-skillsTab-flex-container-skill-enhancers-names">
<h1>Jack of all Trades</h1>
<h1>Linguist</h1>
<h1>Scholar</h1>
<h1>Scientist</h1>
<h1>Traveler</h1>
<h1>Well-Connected</h1>
<h1>Interaction Skill Levels</h1>
<h1>Intellect Skill Levels</h1>
<h1>Agility Skill Levels</h1>
<h1>Non-combat Skill Levels</h1>
<h1>Overall Levels</h1>
</div>
<!-- Skill Levels -->
<div class="subitem-skillsTab-flex-container-skill-enhancers-levels">
<input type="number" name="attr_interactionLevels" min="0" value="0" tabindex="390"/>
<input type="number" name="attr_intellectLevels" min="0" value="0" tabindex="391"/>
<input type="number" name="attr_agilityLevels" min="0" value="0" tabindex="392"/>
<input type="number" name="attr_noncombatLevels" min="0" value="0" tabindex="393"/>
<input type="number" name="attr_overallLevels" min="0" value="0" tabindex="394"/>
</div>
<!-- Skill Costs -->
<div class="subitem-skillsTab-flex-container-skill-enhancers-costs">
<input type="text" value="0" name="attr_enhancerJackCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enhancerLingCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enhancerSchCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enhancerSciCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enhancerTravCP" readonly tabindex="-1"/>
<input type="text" value="0" name="attr_enhancerWellCP" readonly tabindex="-1"/>
<input type="text" name="attr_interactionLevelsCP" value="0" readonly tabindex="-1"/>
<input type="text" name="attr_intellectLevelsCP" value="0" readonly tabindex="-1"/>
<input type="text" name="attr_agilityLevelsCP" value="0" readonly tabindex="-1"/>
<input type="text" name="attr_noncombatLevelsCP" value="0" readonly tabindex="-1"/>
<input type="text" name="attr_overallLevelsCP" value="0" readonly tabindex="-1"/>
</div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Powers tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-powers">
<div class="grid-container-powers">
<!-- Left side powers -->
<div class="flex-container-powers-left">
<!-- Power 01 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-left">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp01">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown01">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName01" maxlength="35" tabindex="400"/>
<div class="custom-select">
<select name="attr_powerType01">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND01" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-left" tabindex="-1" name="act_buttonPowerEND01" tabindex="-1">END</button>
</div>
<div class="subitem-flex-power-effect-left">
<input type="text" name="attr_powerEffect01" maxlength="25" tabindex="401"/>
<input type="text" name="attr_powerDice01" value="0d6" maxlength="16" tabindex="402"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll01" value="18" min="0" max="30" tabindex="403"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll01">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-left">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost01" min="0" value="0" tabindex="404"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost01" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP01" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-left">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages01" min="0" value="0" step="0.25" tabindex="405"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations01" min="0" value="0" step="0.25" tabindex="406"/>
<h1>END:</h1>
<div class="custom-select">
<select name="attr_powerReducedEND01">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText01" maxlength="512" tabindex="407"></textarea>
</div>
<!-- Power 02 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-left">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp02">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown02">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName02" maxlength="35" tabindex="410"/>
<div class="custom-select">
<select name="attr_powerType02">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND02" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-left" tabindex="-1" name="act_buttonPowerEND02">END</button>
</div>
<div class="subitem-flex-power-effect-left">
<input type="text" name="attr_powerEffect02" maxlength="25" tabindex="411"/>
<input type="text" name="attr_powerDice02" value="0d6" maxlength="16" tabindex="412"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll02" value="18" min="0" max="30" tabindex="413"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll02">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-left">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost02" min="0" value="0" tabindex="414"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost02" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP02" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-left">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages02" min="0" value="0" step="0.25" tabindex="415"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations02" min="0" value="0" step="0.25" tabindex="416"/>
<h1>END:</h1>
<div class="custom-select">
<select name="attr_powerReducedEND02">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText02" maxlength="512" tabindex="417"></textarea>
</div>
<!-- Power 03 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-left">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp03">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown03">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName03" maxlength="35" tabindex="420"/>
<div class="custom-select">
<select name="attr_powerType03">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND03" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-left" tabindex="-1" name="act_buttonPowerEND03">END</button>
</div>
<div class="subitem-flex-power-effect-left">
<input type="text" name="attr_powerEffect03" maxlength="25" tabindex="421"/>
<input type="text" name="attr_powerDice03" value="0d6" maxlength="16" tabindex="422"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll03" value="18" min="0" max="30" tabindex="423"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll03">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-left">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost03" min="0" value="0" tabindex="424"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost03" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP03" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-left">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages03" min="0" value="0" step="0.25" tabindex="425"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations03" min="0" value="0" step="0.25" tabindex="426"/>
<h1>END:</h1>
<div class="custom-select">
<select name="attr_powerReducedEND03">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText03" maxlength="512" tabindex="427"></textarea>
</div>
<!-- Power 04 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-left">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp04">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown04">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName04" maxlength="35" tabindex="430"/>
<div class="custom-select">
<select name="attr_powerType04">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND04" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-left" tabindex="-1" name="act_buttonPowerEND04">END</button>
</div>
<div class="subitem-flex-power-effect-left">
<input type="text" name="attr_powerEffect04" maxlength="25" tabindex="431"/>
<input type="text" name="attr_powerDice04" value="0d6" maxlength="16" tabindex="432"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll04" value="18" min="0" max="30" tabindex="433"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll04">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-left">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost04" min="0" value="0" tabindex="434"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost04" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP04" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-left">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages04" min="0" value="0" step="0.25" tabindex="435"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations04" min="0" value="0" step="0.25" tabindex="436"/>
<h1>END:</h1>
<div class="custom-select">
<select name="attr_powerReducedEND04">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText04" maxlength="512" tabindex="437"></textarea>
</div>
<!-- Power 05 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-left">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp05">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown05">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName05" maxlength="35" tabindex="440"/>
<div class="custom-select">
<select name="attr_powerType05">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND05" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-left" tabindex="-1" name="act_buttonPowerEND05">END</button>
</div>
<div class="subitem-flex-power-effect-left">
<input type="text" name="attr_powerEffect05" maxlength="25" tabindex="441"/>
<input type="text" name="attr_powerDice05" value="0d6" maxlength="16" tabindex="442"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll05" value="18" min="0" max="30" tabindex="443"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll05">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-left">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost05" min="0" value="0" tabindex="444"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost05" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP05" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-left">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages05" min="0" value="0" step="0.25" tabindex="445"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations05" min="0" value="0" step="0.25" tabindex="446"/>
<h1>END:</h1>
<div class="custom-select">
<select name="attr_powerReducedEND05">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText05" maxlength="512" tabindex="447"></textarea>
</div>
</div>
<!-- Right side powers -->
<div class="flex-container-powers-right">
<!-- Power 06 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-right">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp06">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown06">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName06" maxlength="35" tabindex="450"/>
<div class="custom-select-alternate">
<select name="attr_powerType06">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND06" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-right" tabindex="-1" name="act_buttonPowerEND06">END</button>
</div>
<div class="subitem-flex-power-effect-right">
<input type="text" name="attr_powerEffect06" maxlength="25" tabindex="451"/>
<input type="text" name="attr_powerDice06" value="0d6" maxlength="16" tabindex="452"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll06" value="18" min="0" max="30" tabindex="453"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll06">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-right">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost06" min="0" value="0" tabindex="454"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost06" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP06" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-right">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages06" min="0" value="0" step="0.25" tabindex="455"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations06" min="0" value="0" step="0.25" tabindex="456"/>
<h1>END:</h1>
<div class="custom-select-alternate">
<select name="attr_powerReducedEND06">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText06" maxlength="512" tabindex="457"></textarea>
</div>
<!-- Power 07 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-right">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp07">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown07">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName07" maxlength="35" tabindex="460"/>
<div class="custom-select-alternate">
<select name="attr_powerType07">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND07" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-right" tabindex="-1" name="act_buttonPowerEND07">END</button>
</div>
<div class="subitem-flex-power-effect-right">
<input type="text" name="attr_powerEffect07" maxlength="25" tabindex="461"/>
<input type="text" name="attr_powerDice07" value="0d6" maxlength="16" tabindex="462"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll07" value="18" min="0" max="30" tabindex="463"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll07">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-right">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost07" min="0" value="0" tabindex="464"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost07" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP07" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-right">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages07" min="0" value="0" step="0.25" tabindex="465"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations07" min="0" value="0" step="0.25" tabindex="466"/>
<h1>END:</h1>
<div class="custom-select-alternate">
<select name="attr_powerReducedEND07">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText07" maxlength="512" tabindex="467"></textarea>
</div>
<!-- Power 08 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-right">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp08">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown08">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName08" maxlength="35" tabindex="470"/>
<div class="custom-select-alternate">
<select name="attr_powerType08">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND08" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-right" tabindex="-1" name="act_buttonPowerEND08">END</button>
</div>
<div class="subitem-flex-power-effect-right">
<input type="text" name="attr_powerEffect08" maxlength="25" tabindex="471"/>
<input type="text" name="attr_powerDice08" value="0d6" maxlength="16" tabindex="472"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll08" value="18" min="0" max="30" tabindex="473"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll08">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-right">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost08" min="0" value="0" tabindex="474"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost08" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP08" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-right">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages08" min="0" value="0" step="0.25" tabindex="475"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations08" min="0" value="0" step="0.25" tabindex="476"/>
<h1>END:</h1>
<div class="custom-select-alternate">
<select name="attr_powerReducedEND08">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText08" maxlength="512" tabindex="477"></textarea>
</div>
<!-- Power 09 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-right">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp09">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown09">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName09" maxlength="35" tabindex="480"/>
<div class="custom-select-alternate">
<select name="attr_powerType09">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND09" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-right" tabindex="-1" name="act_buttonPowerEND09">END</button>
</div>
<div class="subitem-flex-power-effect-right">
<input type="text" name="attr_powerEffect09" maxlength="25" tabindex="481"/>
<input type="text" name="attr_powerDice09" value="0d6" maxlength="16" tabindex="482"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll09" value="18" min="0" max="30" tabindex="483"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll09">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-right">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost09" min="0" value="0" tabindex="484"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost09" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP09" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-right">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages09" min="0" value="0" step="0.25" tabindex="485"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations09" min="0" value="0" step="0.25" tabindex="486"/>
<h1>END:</h1>
<div class="custom-select-alternate">
<select name="attr_powerReducedEND09">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText09" maxlength="512" tabindex="487"></textarea>
</div>
<!-- Power 10 -->
<div class="item-flex-power">
<div class="subitem-flex-power-heading-right">
<div class="power-mover-plus-minus-enclosure">
<div class="power-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_powerUp10">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_powerDown10">
<span>❮</span>
</button>
</div>
</div>
<input type="text" value="" name="attr_powerName10" maxlength="35" tabindex="490"/>
<div class="custom-select-alternate">
<select name="attr_powerType10">
<option value="single" selected>Single Power</option>
<option value="multipower">Multipower</option>
<option value="variableSlot">Variable Slot</option>
<option value="fixedSlot">Fixed Slot</option>
<option value="powerPool">Power Pool</option>
<option value="compound">Compound</option>
<option value="unified">Unified</option>
</select>
</div>
<input type="text" name="attr_powerEND10" value="0" readonly tabindex="-1"/>
<button type="action" class="button button-Power-END-right" tabindex="-1" tabindex="-1" name="act_buttonPowerEND10">END</button>
</div>
<div class="subitem-flex-power-effect-right">
<input type="text" name="attr_powerEffect10" maxlength="25" tabindex="491"/>
<input type="text" name="attr_powerDice10" value="0d6" maxlength="16" tabindex="492"/>
<h1>Roll:</h1>
<input type="number" name="attr_powerSkillRoll10" value="18" min="0" max="30" tabindex="493"/>
<button type="action" class="button buttonRollPower" tabindex="-1" name="act_powerRoll10">Roll</button>
</div>
<div class="subitem-flex-power-active-cost-right">
<h1>Base CP:</h1>
<input type="number" name="attr_powerBaseCost10" min="0" value="0" tabindex="494"/>
<h1>Active CP:</h1>
<input type="text" name="attr_powerActiveCost10" value="0" readonly tabindex="-1"/>
<h1>Real CP:</h1>
<input type="text" name="attr_powerCP10" value="0" readonly tabindex="-1"/>
</div>
<div class="subitem-flex-power-limitations-right">
<h1>Adv:</h1>
<input type="number" name="attr_powerAdvantages10" min="0" value="0" step="0.25" tabindex="495"/>
<h1>Lim:</h1>
<input type="number" name="attr_powerLimitations10" min="0" value="0" step="0.25" tabindex="496"/>
<h1>END:</h1>
<div class="custom-select-alternate">
<select name="attr_powerReducedEND10">
<option value="noEND">None</option>
<option value="costsENDhalf">Costs END (half)</option>
<option value="costsENDfull">Costs END (full)</option>
<option value="zeroENDAF">Zero (AF)</option>
<option value="zeroEND">Zero</option>
<option value="reducedENDAF">Reduced (AF)</option>
<option value="reducedEND">Reduced</option>
<option value="standardEND" selected>Standard</option>
<option value="increasedENDx2">Increase x2</option>
<option value="increasedENDx3">Increase x3</option>
<option value="increasedENDx4">Increase x4</option>
<option value="increasedENDx5">Increase x5</option>
<option value="increasedENDx6">Increase x6</option>
<option value="increasedENDx7">Increase x7</option>
<option value="increasedENDx8">Increase x8</option>
<option value="increasedENDx9">Increase x9</option>
<option value="increasedENDx10">Increase x10</option>
</select>
</div>
</div>
<textarea name="attr_powerText10" maxlength="512" tabindex="497"></textarea>
</div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Perks, Talents, and Complications tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-complications">
<div class="grid-container-complications-talents">
<!-- Perks and Talents -->
<div class="flex-container-complications-talents-left">
<h2> Perks and Talents</h2>
<!-- Talent 01 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp01">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown01">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName01" value="" maxlength="32" tabindex="500"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll01" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName01}}} {{desc=@{talentText01}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP01" value="0" min="0" tabindex="501"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText01" maxlength="240" tabindex="502"></textarea>
</div>
<!-- Talent 02 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp02">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown02">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName02" value="" maxlength="32" tabindex="503"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll02" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName02}}} {{desc=@{talentText02}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP02" value="0" min="0" tabindex="504"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText02" maxlength="240" tabindex="505"></textarea>
</div>
<!-- Talent 03 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp03">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown03">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName03" value="" maxlength="32"tabindex="506"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll03" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName03}}} {{desc=@{talentText03}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP03" value="0" min="0" tabindex="507"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText03" maxlength="240" tabindex="508"></textarea>
</div>
<!-- Talent 04 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp04">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown04">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName04" value="" maxlength="32" tabindex="509"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll04" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName04}}} {{desc=@{talentText04}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP04" value="0" min="0" tabindex="510"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText04" maxlength="240" tabindex="511"></textarea>
</div>
<!-- Talent 05 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp05">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown05">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName05" value="" maxlength="32" tabindex="512"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll05" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName05}}} {{desc=@{talentText05}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP05" value="0" min="0" tabindex="513"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText05" maxlength="240" tabindex="514"></textarea>
</div>
<!-- Talent 06 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp06">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown06">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName06" value="" maxlength="32" tabindex="515"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll06" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName06}}} {{desc=@{talentText06}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP06" value="0" min="0" tabindex="516"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText06" maxlength="240" tabindex="517"></textarea>
</div>
<!-- Talent 07 -->
<div class="item-talent-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_talentUp07">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_talentDown07">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_talentName07" value="" maxlength="32" tabindex="518"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showTalentRoll07" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Perks & Talents - @{talentName07}}} {{desc=@{talentText07}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_talentCP07" value="0" min="0" tabindex="519"/>
</div>
<div class="item-talent-textbox">
<textarea name="attr_talentText07" maxlength="240" tabindex="520"></textarea>
</div>
</div>
<!-- Complications -->
<div class="flex-container-complications-talents-right">
<h2>Complications</h2>
<!-- Complication 01 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp01">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown01">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName01" value="" maxlength="32" tabindex="530"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll01" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName01}}} {{desc=@{complicationText01}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP01" value="0" min="0" tabindex="531"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText01" maxlength="240" tabindex="532"></textarea>
</div>
<!-- Complication 02 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp02">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown02">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName02" value="" maxlength="32" tabindex="533"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll02" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName02}}} {{desc=@{complicationText02}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP02" value="0" min="0" tabindex="534"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText02" maxlength="240" tabindex="535"></textarea>
</div>
<!-- Complication 03 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp03">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown03">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName03" value="" maxlength="32" tabindex="536"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll03" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName03}}} {{desc=@{complicationText03}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP03" value="0" min="0" tabindex="537"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText03" maxlength="240" tabindex="538"></textarea>
</div>
<!-- Complication 04 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp04">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown04">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName04" value="" maxlength="32" tabindex="539"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll04" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName04}}} {{desc=@{complicationText04}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP04" value="0" min="0" tabindex="540"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText04" maxlength="240" tabindex="541"></textarea>
</div>
<!-- Complication 05 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp05">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown05">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName05" value="" maxlength="32" tabindex="542"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll05" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName05}}} {{desc=@{complicationText05}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP05" value="0" min="0" tabindex="543"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText05" maxlength="240" tabindex="544"></textarea>
</div>
<!-- Complication 06 -->
<div class="item-complication-heading">
<div class="talent-mover-plus-minus-enclosure">
<div class="talent-mover-plus-minus-button">
<button type="action" class="button buttonPlus" tabindex="-1" name="act_complicationUp06">
<span>❯</span>
</button>
<button type="action" class="button buttonMinus" tabindex="-1" name="act_complicationDown06">
<span>❮</span>
</button>
</div>
</div>
<input type="text" name="attr_complicationName06" value="" maxlength="32" tabindex="545"/>
<button type="roll" class="button buttonRollShow" tabindex="-1" name="roll_showComplicationRoll06" value="&{template:custom-show} {{title=@{character_name} - @{character_title}}} {{subtitle= Complication - @{complicationName06}}} {{desc=@{complicationText06}}}">Show</button>
<h1>CP:</h1>
<input type="number" name="attr_complicationCP06" value="0" min="0" tabindex="546"/>
</div>
<div class="item-complication-textbox">
<textarea name="attr_complicationText06" maxlength="240" tabindex="547"></textarea>
</div>
</div>
<!-- Complications Notes -->
<div class="flex-container-complications-bottom">
<textarea name="attr_complicationsTextLeft" maxlength="2048" tabindex="548"></textarea>
<textarea name="attr_complicationsTextRight" maxlength="2048" tabindex="549"></textarea>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Options tab -->
<!-- --------------------------------------------------------------------------------- -->
<div class="sheet-options">
<div class="grid-container-tab-options">
<div class="item-options">
<div class="item-options-row">
<h1> Options </h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" name="attr_useCharacteristicMaximums">
<span class="checkmark"></span>
</label>
<h1>Characteristic Maximums</h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" checked="checked" name="attr_optionLiteracyCostsPoints">
<span class="checkmark"></span>
</label>
<h1>Literacy Costs Character Points</h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" checked="checked" name="attr_optionAutoSubtractEND">
<span class="checkmark"></span>
</label>
<h1>Attack and Power Buttons Apply END Costs</h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" name="attr_optionSuperHeroicEndurance">
<span class="checkmark"></span>
</label>
<h1>Super-Heroic Campaign Endurance</h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" name="attr_optionHitLocationSystem">
<span class="checkmark"></span>
</label>
<h1>Use Hit Location System</h1>
</div>
<div class="item-options-row">
<label class="container-checkbox">
<input type="checkbox" name="attr_optionTakesNoSTUN">
<span class="checkmark"></span>
</label>
<h1>Takes No STUN</h1>
</div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------- -->
<!-- Tally bar that appears below all tabs to keep track of point totals -->
<!-- --------------------------------------------------------------------------------- -->
<div class = "sheet-tallybar">
<div class="sheet-flex-tallybar">
<span>Char:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_characteristicsCost readonly="true" tabindex="-1"/></span>
<span>Skills:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_skillsCost readonly="true" tabindex="-1"/></span>
<span>Powers:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_powersPerksTalentsCost readonly="true" tabindex="-1"/></span>
<span>Complications:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_complicationsBenefit readonly="true" tabindex="-1"/></span>
<span>Bonus:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_bonusBenefit tabindex="-1"/></span>
<span>EXP:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_experienceBenefit tabindex="-1"/></span>
<span>Total:</span>
<span><input class="tally" type="number" value="0" min="0" name=attr_totalCharacterCost readonly="true" tabindex="-1"/></span>
</div>
</div>
<!-- Hidden variables to protect characteristics during option changes -->
<input type="hidden" name="attr_hiddenSTUN" value="20"/>
<!-- Some hidden variables to help simplify skill point calculations -->
<input type="hidden" name="attr_hiddenSet1SkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenSet2SkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenSet3SkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenCombatSkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenLanguageSkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenEnhancerSkillsCost" value="0"/>
<input type="hidden" name="attr_hiddenMartialSkillsCost" value="0"/>
<!-- Hidden variables for clean weapon damage strings -->
<input type="hidden" name="attr_hiddenShieldDamage01" value="0"/>
<input type="hidden" name="attr_hiddenWeaponDamage01" value="0"/>
<input type="hidden" name="attr_hiddenWeaponDamage02" value="0"/>
<input type="hidden" name="attr_hiddenWeaponDamage03" value="0"/>
<input type="hidden" name="attr_hiddenWeaponDamage04" value="0"/>
<input type="hidden" name="attr_hiddenWeaponDamage05" value="0"/>
<input type="hidden" name="attr_hiddenManeuverDamage01" value="2d6"/>
<!-- Hidden variables for clean power dice strings -->
<input type="hidden" name="attr_hiddenPowerDice01" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice02" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice03" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice04" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice05" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice06" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice07" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice08" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice09" value="0"/>
<input type="hidden" name="attr_hiddenPowerDice10" value="0"/>
<!-- Hidden variable for token display -->
<input type="hidden" name="attr_currentDCV" value="0"/>
<!-- Jackob's Roll Template -->
<rolltemplate class="sheet-rolltemplate-custom">
<div class="template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
</div>
</div>
</div>
</rolltemplate>
<!-- Jackob's Roll Template for normal damage attacks -->
<!-- Includes row for computed BODY damage using July, 2021 Roll Parsing feature -->
<rolltemplate class="sheet-rolltemplate-custom-normal-attack">
<div class="sheet-template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
<!-- Computed result inserted as final row -->
<div class="sheet-key">BODY</div>
<div class="sheet-value">{{computed::STUN}}</div>
</div>
</div>
</div>
</rolltemplate>
<!-- Jackob's Roll Template for killing damage attacks -->
<rolltemplate class="sheet-rolltemplate-custom-attack">
<div class="sheet-template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
<!-- Computed result inserted as final row -->
<div class="sheet-key">STUN</div>
<div class="sheet-value">{{computed::BODY}}</div>
</div>
</div>
</div>
</rolltemplate>
<!-- Jackob's Roll Template -->
<rolltemplate class="sheet-rolltemplate-custom-activate">
<div class="sheet-template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
</div>
</div>
</div>
</rolltemplate>
<!-- Jackob's Roll Template for Powers -->
<rolltemplate class="sheet-rolltemplate-custom-power-attack">
<div class="sheet-template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
</div>
</div>
</div>
</rolltemplate>
<!-- Jackob's Roll Template used for showing talents, perks, and complications -->
<rolltemplate class="sheet-rolltemplate-custom-show">
<div class="sheet-template-wrapper">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}<div class="sheet-title">{{title}}</div>{{/title}}
{{#subtitle}}<div class="sheet-subtitle">{{subtitle}}</div>{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}<div class="sheet-desc">{{desc}}</div>{{/desc}}
</div>
</div>
</div>
</rolltemplate>
<!-- --------------------------------------------------------------------------------- -->
<!-- Sheet workers -->
<!-- --------------------------------------------------------------------------------- -->
<script type="text/worker">
// Get the URL to the pseudo attribute attr_character_avatar for use in the Portrait Section.
on("sheet:opened", function() {
getAttrs(["character_avatar"], function(values) {
let theAvatarURL=values.character_avatar;
setAttrs({
theSheetAvatar:theAvatarURL
});
});
});
// Tab buttons
const buttonlist = ["characteristics","skills","powers","complications","gear","options"];
buttonlist.forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
sheetTab: button
});
});
});
/* ------------------------- */
/* Functions used sheet-wide */
/* ------------------------- */
function heroRoundHigh(theNumber) {
// In the Hero System rounding favors the player. Here where high is good.
let theIntegerPart = Math.floor(theNumber);
let theRemainder = Math.floor(100*(theNumber-theIntegerPart))/100;
if (theRemainder<=0.4) {
return theIntegerPart;
} else {
return theIntegerPart+1;
}
}
function heroRoundLow(theNumber) {
// In the Hero System rounding favors the player. Here where low is good.
let theIntegerPart = Math.floor(theNumber);
let theRemainder = Math.floor(100*(theNumber-theIntegerPart))/100;
if (theRemainder<0.6) {
return theIntegerPart;
} else {
return theIntegerPart+1;
}
}
function calculateRoll(theNumber) {
// Determine basic characteristic and skill roll chance
return heroRoundHigh(9+theNumber/5);
}
/* ------------------------- */
/* Portrait Selection */
/* ------------------------- */
// Demote the portrait slide show.
on("clicked:left-arrow-button", function () {
advancePortrait(-1);
});
// Advance the portrait slide show.
on("clicked:right-arrow-button", function () {
advancePortrait(+1);
});
function advancePortrait(direction) {
getAttrs(["portraitSelection", "totalNumberOfPortraits"], function(values) {
const currentSelection = parseInt(values.portraitSelection)||0;
const minimumSelection = 0;
const maximumSelection = parseInt(values.totalNumberOfPortraits)||1;
let newSelection = currentSelection+direction;
if (newSelection < minimumSelection) {
newSelection = maximumSelection;
}
if (newSelection > maximumSelection) {
newSelection = minimumSelection;
}
setAttrs({
"portraitSelection":newSelection
});
});
}
/* ------------------------- */
/* Gear Slide Selection */
/* ------------------------- */
// Demote the portrait slide show.
on("clicked:left-gear-arrow-button", function () {
advanceGearSlide(-1);
});
// Advance the portrait slide show.
on("clicked:right-gear-arrow-button", function () {
advanceGearSlide(+1);
});
function advanceGearSlide(direction) {
getAttrs(["gearSlideSelection", "totalNumberOfGearSlides"], function(values) {
const currentSelection = parseInt(values.gearSlideSelection)||1;
const minimumSelection = 1;
const maximumSelection = parseInt(values.totalNumberOfGearSlides)||1;
let newSelection = currentSelection+direction;
if (newSelection < minimumSelection) {
newSelection = maximumSelection;
}
if (newSelection > maximumSelection) {
newSelection = minimumSelection;
}
setAttrs({
"gearSlideSelection":newSelection
});
});
}
/* -------------------------------------- */
/* Functions used for health status boxes */
/* -------------------------------------- */
/* Increment and Decrement buttons for Health Fields on Page 1: Characteristics */
// Add 1 to currentBODY
on("clicked:currentBODYplus", function () {
getAttrs(["currentBODY"], function(values) {
const currentValue = parseInt(values.currentBODY)||0;
setAttrs({
"currentBODY":currentValue+1
});
});
});
// Subtract 1 from currentBODY
on("clicked:currentBODYminus", function () {
getAttrs(["currentBODY"], function(values) {
const currentValue = parseInt(values.currentBODY)||0;
setAttrs({
"currentBODY":currentValue-1
});
});
});
// Add 1 to currentSTUN
on("clicked:currentSTUNplus", function () {
getAttrs(["currentSTUN", "optionTakesNoSTUN"], function(values) {
let currentValue = parseInt(values.currentSTUN)||0;
const takesNoSTUN = values.optionTakesNoSTUN;
if (takesNoSTUN != 0) {
currentValue = 0;
} else {
currentValue = currentValue+1;
}
setAttrs({
"currentSTUN":currentValue
});
});
});
// Subtract 1 from currentSTUN
on("clicked:currentSTUNminus", function () {
getAttrs(["currentSTUN", "optionTakesNoSTUN"], function(values) {
let currentValue = parseInt(values.currentSTUN)||0;
const takesNoSTUN = values.optionTakesNoSTUN;
if (takesNoSTUN != 0) {
currentValue = 0;
} else {
currentValue = currentValue-1;
}
setAttrs({
"currentSTUN":currentValue
});
});
});
// Add 1 to currentEND
on("clicked:currentENDplus", function () {
getAttrs(["currentEND"], function(values) {
const currentValue = parseInt(values.currentEND)||0;
if (currentValue < 0) {
// Attempt to correct negative END values.
setAttrs({
"currentEND":0
});
} else {
setAttrs({
"currentEND":currentValue+1
});
}
});
});
// Subtract 1 from currentEND
on("clicked:currentENDminus", function () {
getAttrs(["currentEND"], function(values) {
const currentValue = parseInt(values.currentEND)||0;
if (currentValue > 0) {
setAttrs({
"currentEND":currentValue-1
});
}
});
});
// Subtract X from currentEND.
// Used for power and attack buttons.
function subtractEndurance(enduranceSpent) {
getAttrs(["currentEND"], function(values) {
let currentValue = parseInt(values.currentEND)||0;
currentValue = currentValue - enduranceSpent;
if (currentValue < 0) {
currentValue = 0;
}
setAttrs({
"currentEND":currentValue
});
});
}
/* Increment and Decrement buttons for Health Fields on Page 2: Gear */
// Add 1 to gearCurrentBODY
on("clicked:gearCurrentBODYplus", function () {
getAttrs(["gearCurrentBODY"], function(values) {
const currentValue = parseInt(values.gearCurrentBODY)||0;
setAttrs({
"gearCurrentBODY":currentValue+1
});
});
});
// Subtract 1 from gearCurrentBODY
on("clicked:gearCurrentBODYminus", function () {
getAttrs(["gearCurrentBODY"], function(values) {
const currentValue = parseInt(values.gearCurrentBODY)||0;
setAttrs({
"gearCurrentBODY":currentValue-1
});
});
});
// Add 1 to gearCurrentSTUN
on("clicked:gearCurrentSTUNplus", function () {
getAttrs(["gearCurrentSTUN", "optionTakesNoSTUN"], function(values) {
let currentValue = parseInt(values.gearCurrentSTUN)||0;
const takesNoSTUN = values.optionTakesNoSTUN;
if (takesNoSTUN != 0) {
currentValue = 0;
} else {
currentValue = currentValue +1;
}
setAttrs({
"gearCurrentSTUN":currentValue
});
});
});
// Subtract 1 from gearCurrentSTUN
on("clicked:gearCurrentSTUNminus", function () {
getAttrs(["gearCurrentSTUN", "optionTakesNoSTUN"], function(values) {
let currentValue = parseInt(values.gearCurrentSTUN)||0;
const takesNoSTUN = values.optionTakesNoSTUN;
if (takesNoSTUN != 0) {
currentValue = 0;
} else {
currentValue = currentValue -1;
}
setAttrs({
"gearCurrentSTUN":currentValue
});
});
});
// Add 1 to gearCurrentEND
on("clicked:gearCurrentENDplus", function () {
getAttrs(["gearCurrentEND"], function(values) {
const currentValue = parseInt(values.gearCurrentEND)||0;
if (currentValue < 0) {
// Attempt to correct negative END values.
setAttrs({
"gearCurrentEND":0
});
} else {
setAttrs({
"gearCurrentEND":currentValue+1
});
}
});
});
// Subtract 1 from gearCurrentEND
on("clicked:gearCurrentENDminus", function () {
getAttrs(["gearCurrentEND"], function(values) {
const currentValue = parseInt(values.gearCurrentEND)||0;
if (currentValue > 0) {
setAttrs({
"gearCurrentEND":currentValue-1
});
}
});
});
// Subtract X from gearCurrentEND.
// Used for power and attack buttons.
function subtractGearEndurance(enduranceSpent) {
getAttrs(["gearCurrentEND"], function(values) {
let currentValue = parseInt(values.gearCurrentEND)||0;
currentValue = currentValue - enduranceSpent;
if (currentValue < 0) {
currentValue = 0;
}
setAttrs({
"gearCurrentEND":currentValue
});
});
}
// Reset endurance and stun in item-characteristics-health when the reset action button is clicked.
on("clicked:resetHealth", function () {
applyResetHealth();
});
// Reset endurance and stun when the resect action button in item-gear-health panel is clicked.
on("clicked:gearResetHealth", function () {
applyResetHealth();
});
function applyResetHealth() {
getAttrs(["endurance","stun"], function(values) {
const maxEND = parseInt(values.endurance);
const maxSTUN = parseInt(values.stun);
setAttrs({
"currentSTUN":maxSTUN,
"currentEND":maxEND,
"gearCurrentSTUN":maxSTUN,
"gearCurrentEND":maxEND
});
});
}
/* Recover Buttons */
// Recover endurance and stun when the recover button in the item-characteristics-health box is clicked.
on("clicked:recoverHealth", function () {
applyRecovery();
});
// Recover endurance and stun when the recover button in the gear health status box is clicked.
on("clicked:gearRecoverHealth", function () {
applyRecovery();
});
function applyRecovery() {
getAttrs(["endurance","stun","currentEND","currentSTUN","gearCurrentEND","gearCurrentSTUN","recovery","sheetTab"], function(values) {
const maxEND = parseInt(values.endurance);
const maxSTUN = parseInt(values.stun);
const recovery = parseInt(values.recovery);
const currentSheet = values.sheetTab;
if (currentSheet=="characteristics") {
// The player is viewing the Page 1: characteristics.
let currentEND = parseInt(values.currentEND);
let currentSTUN = parseInt(values.currentSTUN);
if (currentSTUN<=maxSTUN) { // Check to see if character hasn't been boosted above character max by Aid power or similar.
if (currentSTUN+recovery<=maxSTUN) {
setAttrs({
"currentSTUN":currentSTUN+recovery
});
} else {
setAttrs({
"currentSTUN":maxSTUN
});
}
}
if (currentEND<=maxEND) { // Check to see if character hasn't been boosted above character max by Aid power or similar.
if (currentEND+recovery<=maxEND) {
setAttrs({
"currentEND":currentEND+recovery
});
} else {
setAttrs({
"currentEND":maxEND
});
}
}
} else {
// The player is viewing Page 2: gear.
let currentEND = parseInt(values.gearCurrentEND);
let currentSTUN = parseInt(values.gearCurrentSTUN);
if (currentSTUN<=maxSTUN) { // Check to see if character hasn't been boosted above character max by Aid power or similar.
if (currentSTUN+recovery<=maxSTUN) {
setAttrs({
"gearCurrentSTUN":currentSTUN+recovery
});
} else {
setAttrs({
"gearCurrentSTUN":maxSTUN
});
}
}
if (currentEND<=maxEND) { // Check to see if character hasn't been boosted above character max by Aid power or similar.
if (currentEND+recovery<=maxEND) {
setAttrs({
"gearCurrentEND":currentEND+recovery
});
} else {
setAttrs({
"gearCurrentEND":maxEND
});
}
}
}
});
}
/* Synchronize health statuses */
// Keep the gear tab's health status up to date with the character tab's health status.
on("change:currentBODY change:currentSTUN change:currentEND", function () {
getAttrs(["gearCurrentBODY","gearCurrentSTUN","gearCurrentEND","currentBODY","currentSTUN","currentEND","sheetTab"], function(values) {
// Get the visible sheet.
const currentSheet = values.sheetTab;
// As long as the visible sheet is not Page 2 (Gear) change Page 2's BODY, STUN, and END health status.
if (currentSheet != "gear") {
setAttrs({
"gearCurrentBODY":parseInt(values.currentBODY)||0,
"gearCurrentSTUN":parseInt(values.currentSTUN)||0,
"gearCurrentEND":parseInt(values.currentEND)||0,
})
}
});
});
// Keep the gear tab's health status up to date with the character tab's health status.
on("change:gearCurrentBODY change:gearCurrentSTUN change:gearCurrentEND", function () {
getAttrs(["gearCurrentBODY","gearCurrentSTUN","gearCurrentEND","currentBODY","currentSTUN","currentEND","sheetTab"], function(values) {
// Get the visible sheet.
const currentSheet = values.sheetTab;
// As long as the visible sheet is Page 2 (Gear) change Page 1's BODY, STUN, and END health status.
if (currentSheet == "gear") {
setAttrs({
"currentBODY":parseInt(values.gearCurrentBODY)||0,
"currentSTUN":parseInt(values.gearCurrentSTUN)||0,
"currentEND":parseInt(values.gearCurrentEND)||0,
})
}
});
});
/* -------------------------------------- */
/* Functions used for characteristics tab */
/* -------------------------------------- */
function sumCharacteristicPoints() {
// Add up points spent on characteristics.
// All character attributes added in one function to avoid getAttrs() limitations.
// Add attribute costs in one go
getAttrs(["strengthCP","dexterityCP","constitutionCP","intelligenceCP","egoCP","presenceCP","ocvCP","dcvCP","omcvCP","dmcvCP","speedCP","pdCP","edCP","bodyCP","stunCP","enduranceCP","recoveryCP","runningCP","leapingCP","swimmingCP"], function(values) {
const strengthCost = parseInt(values.strengthCP)||0;
const dexterityCost = parseInt(values.dexterityCP)||0;
const constitutionCost = parseInt(values.constitutionCP)||0;
const intelligenceCost = parseInt(values.intelligenceCP)||0;
const egoCost = parseInt(values.egoCP)||0;
const presenceCost = parseInt(values.presenceCP)||0;
const ocvCost = parseInt(values.ocvCP)||0;
const dcvCost = parseInt(values.dcvCP)||0;
const omcvCost = parseInt(values.omcvCP)||0;
const dmcvCost = parseInt(values.dmcvCP)||0;
const speedCost = parseInt(values.speedCP)||0;
const pdCost = parseInt(values.pdCP)||0;
const edCost = parseInt(values.edCP)||0;
const bodyCost = parseInt(values.bodyCP)||0;
const stunCost = parseInt(values.stunCP)||0;
const endCost = parseInt(values.enduranceCP)||0;
const recCost = parseInt(values.recoveryCP)||0;
const runningCost = parseInt(values.runningCP)||0;
const leapingCost = parseInt(values.leapingCP)||0;
const swimmingCost = parseInt(values.swimmingCP)||0;
let primaryAttributesCost = strengthCost+dexterityCost+constitutionCost+intelligenceCost+egoCost+presenceCost;
let combatValuesCost = ocvCost+dcvCost+omcvCost+dmcvCost;
let defenseCost = pdCost+edCost;
let healthCost = bodyCost+stunCost+endCost+recCost;
let movementCost = runningCost+leapingCost+swimmingCost;
let characterAttributeCost = primaryAttributesCost+combatValuesCost+speedCost+defenseCost+healthCost+movementCost;
setAttrs({
"characteristicsCost":parseInt(characterAttributeCost)
});
});
}
// Update Strength related stats and skills
on("change:strength change:useCharacteristicMaximums", function () {
getAttrs(["strength","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.strength)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
var liftCapability;
var freeCarry;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
switch (statValue) {
case 0: liftCapability = 0;
break;
case 1: liftCapability = 8;
break;
case 2: liftCapability = 16;
break;
case 3: liftCapability = 25;
break;
case 4: liftCapability = 38;
break;
default: liftCapability=Math.round(25*Math.pow(2,(statValue/5)));
}
freeCarry=liftCapability/10;
// Update cost and roll chance
setAttrs({
"strengthCP":statCP,
"strengthChance":calculateRoll(statValue),
"liftWeight":liftCapability,
"encumbranceFreeCarry":freeCarry
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Dexterity
on("change:dexterity change:useCharacteristicMaximums", function () {
getAttrs(["dexterity","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.dexterity)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 2;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and roll chance
setAttrs({
"dexterityCP":statCP,
"dexterityChance":calculateRoll(statValue)
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Constitution
on("change:constitution change:useCharacteristicMaximums", function () {
getAttrs(["constitution","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.constitution)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and roll chance
setAttrs({
"constitutionCP":statCP,
"constitutionChance":calculateRoll(statValue)
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Intelligence
on("change:intelligence change:enhancedPerceptionModifier change:useCharacteristicMaximums", function () {
getAttrs(["intelligence","useCharacteristicMaximums","enhancedPerceptionModifier"], function(values) {
const statValue = parseInt(values.intelligence)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
// Here we get the enhanced perception modifier. Perception is like a child of Intelligence.
// The base value of perception is the intelligence roll. The Perception roll is the base value plus the enhancedPerceptionModifier.
// Individual senses start at Intelligence Chance + Perception modifier.
const enhancedPerceptionMod = parseInt(values.enhancedPerceptionModifier)||0;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and roll chance
setAttrs({
"intelligenceCP":statCP,
"intelligenceChance":calculateRoll(statValue),
"perceptionBase":calculateRoll(statValue),
"perceptionVision":calculateRoll(statValue)+enhancedPerceptionMod,
"perceptionHearing":calculateRoll(statValue)+enhancedPerceptionMod,
"perceptionSmell":calculateRoll(statValue)+enhancedPerceptionMod
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Ego
on("change:ego change:useCharacteristicMaximums", function () {
getAttrs(["ego","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.ego)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and roll chance
setAttrs({
"egoCP":statCP,
"egoChance":calculateRoll(statValue)
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Presence
on("change:presence change:useCharacteristicMaximums", function () {
getAttrs(["presence","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.presence)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and roll chance
setAttrs({
"presenceCP":statCP,
"presenceChance":calculateRoll(statValue)
});
// Update costs
sumCharacteristicPoints();
});
});
// Combat Characteristics
// Update Offensive Combat Value
on("change:ocv change:useCharacteristicMaximums", function () {
getAttrs(["ocv","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.ocv)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 3;
const maxStat = 8;
const costStat = 5;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"ocvCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Defensive Combat Value
// Encumbrance Section: Add 1 to bonusDCVmodifier
on("clicked:bonusDCVmodifierPlus", function () {
getAttrs(["bonusDCVmodifier"], function(values) {
const currentValue = parseInt(values.bonusDCVmodifier)||0;
setAttrs({
"bonusDCVmodifier":Math.min(Math.max(-10, (currentValue+1) ), +10)
});
});
});
// Encumbrance Section: Subtract 1 from bonusDCVmodifier
on("clicked:bonusDCVmodifierMinus", function () {
getAttrs(["bonusDCVmodifier"], function(values) {
const currentValue = parseInt(values.bonusDCVmodifier)||0;
setAttrs({
"bonusDCVmodifier":Math.min(Math.max(-10, (currentValue-1) ), +10)
});
});
});
// Update hidden attribute currentDCV
on("change:dcv change:weightDexDCVPenalty change:shieldDCV change:bonusDCVmodifier change:useCharacteristicMaximums change:optionTakesNoSTUN", function () {
getAttrs(["dcv","useCharacteristicMaximums","currentDCV","weightDexDCVPenalty","shieldDCV","bonusDCVmodifier", "optionTakesNoSTUN"], function(values) {
const statValue = parseInt(values.dcv)||0;
const shieldBonus = parseInt(values.shieldDCV)||0;
const weightPenalty = parseInt(values.weightDexDCVPenalty)||0;
const bonusModifier = parseInt(values.bonusDCVmodifier)||0;
const useMaximums = values.useCharacteristicMaximums;
const takesNoSTUN = values.optionTakesNoSTUN;
let baseStat = 3;
const maxStat = 8;
let costStat = 5;
let statCP = 0;
// Automaton defenses cost triple.
if (takesNoSTUN != 0) {
costStat = costStat*3;
}
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost and current DCV
setAttrs({
"dcvCP":statCP,
"currentDCV":statValue+shieldBonus+weightPenalty+bonusModifier
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Mental Offensive Combat Value
on("change:omcv change:useCharacteristicMaximums", function () {
getAttrs(["omcv","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.omcv)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 3;
const maxStat = 8;
const costStat = 3;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"omcvCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Mental Defensive Combat Value
on("change:dmcv change:useCharacteristicMaximums change:optionTakesNoSTUN", function () {
getAttrs(["dmcv","useCharacteristicMaximums", "optionTakesNoSTUN"], function(values) {
const statValue = parseInt(values.dmcv)||0;
const useMaximums = values.useCharacteristicMaximums;
const takesNoSTUN = values.optionTakesNoSTUN;
const baseStat = 3;
const maxStat = 8;
let costStat = 3;
let statCP = 0;
// Automaton defenses cost triple.
if (takesNoSTUN != 0) {
costStat = costStat*3;
}
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"dmcvCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Speed
on("change:speed change:useCharacteristicMaximums", function () {
getAttrs(["speed","useCharacteristicMaximums"], function(values) {
let theSpeed = parseInt(values.speed)||0;
let useMaximums = values.useCharacteristicMaximums;
const baseStat = 2;
const maxStat = 4;
const costStat = 10;
let statCP = 0;
if ( (theSpeed>maxStat) && (useMaximums != 0) ) {
statCP=(theSpeed-maxStat)*costStat+(theSpeed-baseStat)*costStat;
} else {
statCP=(theSpeed-baseStat)*costStat;
}
// Update cost
setAttrs({
"speedCP":statCP
});
sumCharacteristicPoints();
// Update speed indicator checkboxes
if (theSpeed==12) {
setAttrs({
"speedIndicator01":"on"
});
} else {
setAttrs({
"speedIndicator01":0
});
}
if (theSpeed>=6) {
setAttrs({
"speedIndicator02":"on"
});
} else {
setAttrs({
"speedIndicator02":0
});
}
if ((theSpeed>=8)||(theSpeed===4)||(theSpeed===5)) {
setAttrs({
"speedIndicator03":"on"
});
} else {
setAttrs({
"speedIndicator03":0
});
}
if ((theSpeed>=9)||(theSpeed===3)||(theSpeed===6)||(theSpeed===7)) {
setAttrs({
"speedIndicator04":"on"
});
} else {
setAttrs({
"speedIndicator04":0
});
}
if ((theSpeed>=10)||(theSpeed===8)||(theSpeed===5)) {
setAttrs({
"speedIndicator05":"on"
});
} else {
setAttrs({
"speedIndicator05":0
});
}
if ((theSpeed>=6)||(theSpeed===2)||(theSpeed===4)) {
setAttrs({
"speedIndicator06":"on"
});
} else {
setAttrs({
"speedIndicator06":0
});
}
if ((theSpeed>=11)||(theSpeed===1)||(theSpeed===7)||(theSpeed===9)) {
setAttrs({
"speedIndicator07":"on"
});
} else {
setAttrs({
"speedIndicator07":0
});
}
if ((theSpeed>=8)||(theSpeed===3)||(theSpeed===5)||(theSpeed===6)) {
setAttrs({
"speedIndicator08":"on"
});
} else {
setAttrs({
"speedIndicator08":0
});
}
if ((theSpeed>=10)||(theSpeed===4)||(theSpeed===7)||(theSpeed===8)) {
setAttrs({
"speedIndicator09":"on"
});
} else {
setAttrs({
"speedIndicator09":0
});
}
if ((theSpeed>=9)||(theSpeed===5)||(theSpeed===6)) {
setAttrs({
"speedIndicator10":"on"
});
} else {
setAttrs({
"speedIndicator10":0
});
}
if (theSpeed>=7) {
setAttrs({
"speedIndicator11":"on"
});
} else {
setAttrs({
"speedIndicator11":0
});
}
if (theSpeed>=2) {
setAttrs({
"speedIndicator12":"on"
});
} else {
setAttrs({
"speedIndicator12":0
});
}
});
});
// Update Physical Defense
on("change:pd change:useCharacteristicMaximums change:optionTakesNoSTUN", function () {
getAttrs(["pd","useCharacteristicMaximums", "optionTakesNoSTUN"], function(values) {
const statValue = parseInt(values.pd)||0;
const useMaximums = values.useCharacteristicMaximums;
const takesNoSTUN = values.optionTakesNoSTUN;
let baseStat = 2;
const maxStat = 8;
let costStat = 1;
let statCP = 0;
// Automaton defenses cost triple.
if (takesNoSTUN != 0) {
costStat = costStat*3;
baseStat = 1;
}
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"pdCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Update Energy Defense
on("change:ed change:useCharacteristicMaximums change:optionTakesNoSTUN", function () {
getAttrs(["ed","useCharacteristicMaximums", "optionTakesNoSTUN"], function(values) {
const statValue = parseInt(values.ed)||0;
const useMaximums = values.useCharacteristicMaximums;
const takesNoSTUN = values.optionTakesNoSTUN;
let baseStat = 2;
const maxStat = 8;
let costStat = 1;
let statCP = 0;
// Automaton defenses cost triple.
if (takesNoSTUN != 0) {
costStat = costStat*3;
baseStat = 1;
}
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"edCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Update BODY
on("change:body change:useCharacteristicMaximums", function () {
getAttrs(["body","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.body)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 10;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"bodyCP":statCP
});
// Update costs
sumCharacteristicPoints();
});
});
// Handle STUN data when optionTakesNoSTUN is checked.
on("change:optionTakesNoSTUN", function () {
getAttrs(["optionTakesNoSTUN", "stun", "hiddenSTUN"], function(values) {
const takesNoSTUN = values.optionTakesNoSTUN;
let statValue = values.stun;
let savedStatValue = values.hiddenSTUN;
// Store STUN in hiddenSTUN and then set it to zero.
if (takesNoSTUN != 0) {
savedStatValue = statValue;
statValue = 0;
} else {
statValue = savedStatValue;
}
// Update character. Reset health status.
setAttrs({
"hiddenSTUN":savedStatValue,
"stun":statValue,
"currentSTUN":statValue,
"gearCurrentSTUN":statValue
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Update STUN
on("change:stun change:useCharacteristicMaximums change:optionTakesNoSTUN", function () {
getAttrs(["stun","useCharacteristicMaximums", "hiddenSTUN", "optionTakesNoSTUN"], function(values) {
const statValue = parseInt(values.stun)||0;
const useMaximums = values.useCharacteristicMaximums;
const takesNoSTUN = values.optionTakesNoSTUN;
let baseStat = 20;
const maxStat = 50;
const costStat = 0.5;
let statCP = 0;
// If option takesNoSTUN is not checked. Save the new value of STUN.
if (takesNoSTUN != 0) {
// Reset STUN and cost to zero.
setAttrs({
"stun":0,
"stunCP":0
});
} else {
// Calculate costs, save stun to hiddenSTUN, and calculate cost.
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
setAttrs({
"hiddenSTUN":statValue,
"stunCP":heroRoundLow(statCP)
});
}
// Update costs
sumCharacteristicPoints();
});
});
// Update Endurance
on("change:endurance change:useCharacteristicMaximums", function () {
getAttrs(["endurance","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.endurance)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 20;
const maxStat = 50;
const costStat = 0.2;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"enduranceCP":heroRoundLow(statCP)
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Update Recovery
on("change:recovery change:useCharacteristicMaximums", function () {
getAttrs(["recovery","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.recovery)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 4;
const maxStat = 10;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"recoveryCP":statCP
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Movement abilities
// Update Running
on("change:running change:useCharacteristicMaximums", function () {
getAttrs(["running","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.running)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 12;
const maxStat = 20;
const costStat = 1;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"runningCP":statCP
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Update Leaping
on("change:leaping change:useCharacteristicMaximums", function () {
getAttrs(["leaping","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.leaping)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 4;
const maxStat = 10;
const costStat = 0.5;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"leapingCP":heroRoundLow(statCP)
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Update Swimming
on("change:swimming change:useCharacteristicMaximums", function () {
getAttrs(["swimming","useCharacteristicMaximums"], function(values) {
const statValue = parseInt(values.swimming)||0;
const useMaximums = values.useCharacteristicMaximums;
const baseStat = 4;
const maxStat = 10;
const costStat = 0.5;
let statCP = 0;
if ( (statValue>maxStat) && (useMaximums != 0) ) {
statCP=(statValue-maxStat)*costStat+(statValue-baseStat)*costStat;
} else {
statCP=(statValue-baseStat)*costStat;
}
// Update cost
setAttrs({
"swimmingCP":heroRoundLow(statCP)
});
// Update characteristics cost
sumCharacteristicPoints();
});
});
// Update point totals when option: useCharacteristicMaximums checked or unchecked.
on("change:useCharacteristicMaximums", function () {
sumCharacteristicPoints();
});
/* -------------------------------------- */
/* Functions used for tally bar */
/* -------------------------------------- */
function addPoints() {
// Add up points from each section of the tally bar and subtract the complications benefit to arrive at a total character cost
// Seems to need a onchange() notice for each tab total to be recognized correctly.
getAttrs(["hiddenCombatSkillsCost","characteristicsCost","hiddenSet1SkillsCost","hiddenSet2SkillsCost","hiddenSet3SkillsCost","hiddenLanguageSkillsCost","hiddenEnhancerSkillsCost","hiddenMartialSkillsCost","powersPerksTalentsCost","complicationsBenefit","bonusBenefit","experienceBenefit"], function(values) {
const characteristicsCP = parseInt(values.characteristicsCost)||0;
const set1SkillsCP = parseInt(values.hiddenSet1SkillsCost)||0;
const set2SkillsCP = parseInt(values.hiddenSet2SkillsCost)||0;
const set3SkillsCP = parseInt(values.hiddenSet3SkillsCost)||0;
const combatSkillsCP = parseInt(values.hiddenCombatSkillsCost)||0;
const languageSkillsCP = parseInt(values.hiddenLanguageSkillsCost)||0;
const enhancerSkillsCP = parseInt(values.hiddenEnhancerSkillsCost)||0;
const martialSkillsCP = parseInt(values.hiddenMartialSkillsCost)||0;
const powersPerksTalentsCP = parseInt(values.powersPerksTalentsCost)||0;
const complicationsCP = parseInt(values.complicationsBenefit)||0;
const bonusCP = parseInt(values.bonusBenefit)||0;
const experienceCP = parseInt(values.experienceBenefit)||0;
let totalSkillsCP = set1SkillsCP+set2SkillsCP+set3SkillsCP+combatSkillsCP+languageSkillsCP+enhancerSkillsCP+martialSkillsCP;
let totalCP = characteristicsCP+totalSkillsCP+powersPerksTalentsCP-complicationsCP-bonusCP-experienceCP;
setAttrs({
"skillsCost":totalSkillsCP,
"totalCharacterCost":totalCP
});
});
}
on("change:characteristicsCost change:hiddenSet1SkillsCost change:hiddenSet2SkillsCost change:hiddenSet3SkillsCost change:hiddenCombatSkillsCost change:hiddenEnhancerSkillsCost change:hiddenLanguageSkillsCost change:hiddenMartialSkillsCost change:powersPerksTalentsCost change:complicationsBenefit change:bonusBenefit change:experienceBenefit", function () {
// Update total character points any of the hidden character point subtotals change.
addPoints();
});
/* -------------------------------------------------- */
/* Functions used for talents and complications tab */
/* -------------------------------------------------- */
function sumComplicationsBenefit() {
getAttrs(["complicationCP01","complicationCP02","complicationCP03","complicationCP04","complicationCP05","complicationCP06"], function(values) {
const complication01benefit = parseInt(values.complicationCP01)||0;
const complication02benefit = parseInt(values.complicationCP02)||0;
const complication03benefit = parseInt(values.complicationCP03)||0;
const complication04benefit = parseInt(values.complicationCP04)||0;
const complication05benefit = parseInt(values.complicationCP05)||0;
const complication06benefit = parseInt(values.complicationCP06)||0;
let totalBenefit = complication01benefit+complication02benefit+complication03benefit+complication04benefit+complication05benefit+complication06benefit;
setAttrs({
"complicationsBenefit":totalBenefit
});
});
}
// Update Tally Bar after change notice any complication's CP benefit.
on("change:complicationCP01 change:complicationCP02 change:complicationCP03 change:complicationCP04 change:complicationCP05 change:complicationCP06", function () {
sumComplicationsBenefit();
});
function sumPowersPerksTalents() {
getAttrs(["talentCP01","talentCP02","talentCP03","talentCP04","talentCP05","talentCP06","talentCP07","powerCP01","powerCP02","powerCP03","powerCP04","powerCP05","powerCP06", "powerCP07", "powerCP08", "powerCP09", "powerCP10"], function(values) {
const talent01cost = parseInt(values.talentCP01)||0;
const talent02cost = parseInt(values.talentCP02)||0;
const talent03cost = parseInt(values.talentCP03)||0;
const talent04cost = parseInt(values.talentCP04)||0;
const talent05cost = parseInt(values.talentCP05)||0;
const talent06cost = parseInt(values.talentCP06)||0;
const talent07cost = parseInt(values.talentCP07)||0;
let talentsCost = talent01cost+talent02cost+talent03cost+talent04cost+talent05cost+talent06cost+talent07cost;
const power01cost = parseInt(values.powerCP01)||0;
const power02cost = parseInt(values.powerCP02)||0;
const power03cost = parseInt(values.powerCP03)||0;
const power04cost = parseInt(values.powerCP04)||0;
const power05cost = parseInt(values.powerCP05)||0;
const power06cost = parseInt(values.powerCP06)||0;
const power07cost = parseInt(values.powerCP07)||0;
const power08cost = parseInt(values.powerCP08)||0;
const power09cost = parseInt(values.powerCP09)||0;
const power10cost = parseInt(values.powerCP10)||0;
let powersCost = power01cost+power02cost+power03cost+power04cost+power05cost+power06cost+power07cost+power08cost+power09cost+power10cost;
let totalCost=talentsCost+powersCost;
setAttrs({
"powersPerksTalentsCost":totalCost
});
});
}
// Update Tally Bar after change to any Talent's CP cost.
on("change:talentCP01 change:talentCP02 change:talentCP03 change:talentCP04 change:talentCP05 change:talentCP06 change:talentCP07", function () {
sumPowersPerksTalents();
});
/* -------------------------------------------------- */
/* Functions used for powers tab */
/* -------------------------------------------------- */
function calculatePowerEND(powerActiveCost,powerReducedEND) {
// Calculates power endurance given active cost and reduced, standard, or increased endurance limitation.
var powerEND=0;
switch (powerReducedEND) {
case 'increasedENDx10': powerEND=10*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx9': powerEND=9*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx8': powerEND=8*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx7': powerEND=7*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx6': powerEND=6*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx5': powerEND=5*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx4': powerEND=4*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx3': powerEND=3*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'increasedENDx2': powerEND=2*(heroRoundLow(powerActiveCost/10));
if (powerEND<1) {
powerEND=1;
};
break;
case 'standardEND': powerEND=heroRoundLow(powerActiveCost/10);
if (powerEND<1) {
powerEND=1;
};
break;
case 'reducedEND': powerEND=heroRoundLow(powerActiveCost/20);
if (powerEND<1) {
powerEND=1;
};
break;
case 'reducedENDAF': powerEND=heroRoundLow(powerActiveCost/20);
if (powerEND<1) {
powerEND=1;
};
break;
case 'costsENDhalf': powerEND=heroRoundLow(powerActiveCost/20);
if (powerEND<1) {
powerEND=1;
};
break;
case 'costsENDfull': powerEND=heroRoundLow(powerActiveCost/10);
if (powerEND<1) {
powerEND=1;
};
break;
default: powerEND=0;
}
return powerEND;
}
function calculateActiveCost(powerBaseCost,powerAdvantages,powerReducedEND) {
var powerActiveCost=0;
switch (powerReducedEND) {
case 'reducedENDAF': powerActiveCost=powerBaseCost*(powerAdvantages+1.5);
break;
case 'zeroENDAF': powerActiveCost=powerBaseCost*(powerAdvantages+2);
break;
case 'reducedEND': powerActiveCost=powerBaseCost*(powerAdvantages+1.25);
break;
case 'zeroEND': powerActiveCost=powerBaseCost*(powerAdvantages+1.5);
break;
default: powerActiveCost=powerBaseCost*(1+powerAdvantages);
}
return powerActiveCost;
}
function increasedENDlimitation(settingEND) {
switch (settingEND) {
case 'costsENDhalf': return 0.25;
break;
case 'costsENDfull': return 0.5;
break;
case 'increasedENDx2': return 0.5;
break;
case 'increasedENDx2': return 0.5;
break;
case 'increasedENDx3': return 1;
break;
case 'increasedENDx4': return 1.5;
break;
case 'increasedENDx5': return 2;
break;
case 'increasedENDx6': return 2.5;
break;
case 'increasedENDx7': return 3;
break;
case 'increasedENDx8': return 3.5;
break;
case 'increasedENDx9': return 3.5;
break;
case 'increasedENDx10': return 4;
break;
default: return 0;
}
}
/* Update Power01 after detecting change to any of the numerical vales in the flex container */
on("change:powerType01 change:powerBaseCost01 change:powerAdvantages01 change:powerReducedEND01 change:powerLimitations01 change:powerDice01", function () {
getAttrs(["powerType01","powerBaseCost01","powerAdvantages01","powerReducedEND01","powerLimitations01","powerDice01"], function(values) {
let powerType = values.powerType01;
const powerBaseCost = parseInt(values.powerBaseCost01)||0;
const powerAdvantages = parseFloat(values.powerAdvantages01)||0;
const powerReducedEND = values.powerReducedEND01;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice01;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations01)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost01":powerActiveCost,
"powerEND01":powerEND,
"powerCP01":powerRealCost,
"hiddenPowerDice01":thePowerDice
});
});
});
// Use Power 01 Endurance
on("clicked:buttonPowerEND01", function () {
getAttrs(["currentEND","powerEND01"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND01);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 01 */
on('clicked:powerRoll01', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName01} - @{powerEffect01}}} {{desc=@{powerText01}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll01}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice01}sd]]}} {{END=[[@{powerEND01}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND01"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND01)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power02 after detecting change to any of the numerical vales in the flex container */
on("change:powerType02 change:powerBaseCost02 change:powerAdvantages02 change:powerReducedEND02 change:powerLimitations02 change:powerDice02", function () {
getAttrs(["powerType02","powerBaseCost02","powerAdvantages02","powerReducedEND02","powerLimitations02","powerDice02"], function(values) {
let powerType = values.powerType02;
const powerBaseCost = parseInt(values.powerBaseCost02)||0;
const powerAdvantages = parseFloat(values.powerAdvantages02)||0;
const powerReducedEND = values.powerReducedEND02;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice02;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations02)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost02":powerActiveCost,
"powerEND02":powerEND,
"powerCP02":powerRealCost,
"hiddenPowerDice02":thePowerDice
});
});
});
// Use Power 02 Endurance
on("clicked:buttonPowerEND02", function () {
getAttrs(["currentEND","powerEND02"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND02);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 02 */
on('clicked:powerRoll02', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName02} - @{powerEffect02}}} {{desc=@{powerText02}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll02}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice02}sd]]}} {{END=[[@{powerEND02}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND02"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND02)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power03 after detecting change to any of the numerical vales in the flex container */
on("change:powerType03 change:powerBaseCost03 change:powerAdvantages03 change:powerReducedEND03 change:powerLimitations03 change:powerDice03", function () {
getAttrs(["powerType03","powerBaseCost03","powerAdvantages03","powerReducedEND03","powerLimitations03","powerDice03"], function(values) {
let powerType = values.powerType03;
const powerBaseCost = parseInt(values.powerBaseCost03)||0;
const powerAdvantages = parseFloat(values.powerAdvantages03)||0;
const powerReducedEND = values.powerReducedEND03;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice03;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations03)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost03":powerActiveCost,
"powerEND03":powerEND,
"powerCP03":powerRealCost,
"hiddenPowerDice03":thePowerDice
});
});
});
// Use Power 03 Endurance
on("clicked:buttonPowerEND03", function () {
getAttrs(["currentEND","powerEND03"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND03);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 03 */
on('clicked:powerRoll03', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName03} - @{powerEffect03}}} {{desc=@{powerText03}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll03}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice03}sd]]}} {{END=[[@{powerEND03}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND03"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND03)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power04 after detecting change to any of the numerical vales in the flex container */
on("change:powerType04 change:powerBaseCost04 change:powerAdvantages04 change:powerReducedEND04 change:powerLimitations04 change:powerDice04", function () {
getAttrs(["powerType04","powerBaseCost04","powerAdvantages04","powerReducedEND04","powerLimitations04","powerDice04"], function(values) {
let powerType = values.powerType04;
const powerBaseCost = parseInt(values.powerBaseCost04)||0;
const powerAdvantages = parseFloat(values.powerAdvantages04)||0;
const powerReducedEND = values.powerReducedEND04;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice04;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations04)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost04":powerActiveCost,
"powerEND04":powerEND,
"powerCP04":powerRealCost,
"hiddenPowerDice04":thePowerDice
});
});
});
// Use Power 04 Endurance
on("clicked:buttonPowerEND04", function () {
getAttrs(["currentEND","powerEND04"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND04);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 04 */
on('clicked:powerRoll04', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName04} - @{powerEffect04}}} {{desc=@{powerText04}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll04}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice04}sd]]}} {{END=[[@{powerEND04}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND04"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND04)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power05 after detecting change to any of the numerical vales in the flex container */
on("change:powerType05 change:powerBaseCost05 change:powerAdvantages05 change:powerReducedEND05 change:powerLimitations05 change:powerDice05", function () {
getAttrs(["powerType05","powerBaseCost05","powerAdvantages05","powerReducedEND05","powerLimitations05","powerDice05"], function(values) {
let powerType = values.powerType05;
const powerBaseCost = parseInt(values.powerBaseCost05)||0;
const powerAdvantages = parseFloat(values.powerAdvantages05)||0;
const powerReducedEND = values.powerReducedEND05;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice05;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations05)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost05":powerActiveCost,
"powerEND05":powerEND,
"powerCP05":powerRealCost,
"hiddenPowerDice05":thePowerDice
});
});
});
// Use Power 05 Endurance
on("clicked:buttonPowerEND05", function () {
getAttrs(["currentEND","powerEND05"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND05);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 05 */
on('clicked:powerRoll05', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName05} - @{powerEffect05}}} {{desc=@{powerText05}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll05}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice05}sd]]}} {{END=[[@{powerEND05}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND05"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND05)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power06 after detecting change to any of the numerical vales in the flex container */
on("change:powerType06 change:powerBaseCost06 change:powerAdvantages06 change:powerReducedEND06 change:powerLimitations06 change:powerDice06", function () {
getAttrs(["powerType06","powerBaseCost06","powerAdvantages06","powerReducedEND06","powerLimitations06","powerDice06"], function(values) {
let powerType = values.powerType06;
const powerBaseCost = parseInt(values.powerBaseCost06)||0;
const powerAdvantages = parseFloat(values.powerAdvantages06)||0;
const powerReducedEND = values.powerReducedEND06;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice06;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations06)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost06":powerActiveCost,
"powerEND06":powerEND,
"powerCP06":powerRealCost,
"hiddenPowerDice06":thePowerDice
});
});
});
// Use Power 06
on("clicked:buttonPowerEND06", function () {
getAttrs(["currentEND","powerEND06"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND06);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 06 */
on('clicked:powerRoll06', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName06} - @{powerEffect06}}} {{desc=@{powerText06}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll06}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice06}sd]]}} {{END=[[@{powerEND06}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND06"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND06)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power07 after detecting change to any of the numerical vales in the flex container */
on("change:powerType07 change:powerBaseCost07 change:powerAdvantages07 change:powerReducedEND07 change:powerLimitations07 change:powerDice07", function () {
getAttrs(["powerType07","powerBaseCost07","powerAdvantages07","powerReducedEND07","powerLimitations07","powerDice07"], function(values) {
let powerType = values.powerType07;
const powerBaseCost = parseInt(values.powerBaseCost07)||0;
const powerAdvantages = parseFloat(values.powerAdvantages07)||0;
const powerReducedEND = values.powerReducedEND07;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice07;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations07)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost07":powerActiveCost,
"powerEND07":powerEND,
"powerCP07":powerRealCost,
"hiddenPowerDice07":thePowerDice
});
});
});
// Use Power 07 Endurance
on("clicked:buttonPowerEND07", function () {
getAttrs(["currentEND","powerEND07"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND07);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 07 */
on('clicked:powerRoll07', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName07} - @{powerEffect07}}} {{desc=@{powerText07}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll07}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice07}sd]]}} {{END=[[@{powerEND07}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND07"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND07)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power08 after detecting change to any of the numerical vales in the flex container */
on("change:powerType08 change:powerBaseCost08 change:powerAdvantages08 change:powerReducedEND08 change:powerLimitations08 change:powerDice08", function () {
getAttrs(["powerType08","powerBaseCost08","powerAdvantages08","powerReducedEND08","powerLimitations08","powerDice08"], function(values) {
let powerType = values.powerType08;
const powerBaseCost = parseInt(values.powerBaseCost08)||0;
const powerAdvantages = parseFloat(values.powerAdvantages08)||0;
const powerReducedEND = values.powerReducedEND08;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice08;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations08)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost08":powerActiveCost,
"powerEND08":powerEND,
"powerCP08":powerRealCost,
"hiddenPowerDice08":thePowerDice
});
});
});
// Use Power 08
on("clicked:buttonPowerEND08", function () {
getAttrs(["currentEND","powerEND08"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND08);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 08 */
on('clicked:powerRoll08', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName08} - @{powerEffect08}}} {{desc=@{powerText08}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll08}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice08}sd]]}} {{END=[[@{powerEND08}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND08"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND08)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power09 after detecting change to any of the numerical vales in the flex container */
on("change:powerType09 change:powerBaseCost09 change:powerAdvantages09 change:powerReducedEND09 change:powerLimitations09 change:powerDice09", function () {
getAttrs(["powerType09","powerBaseCost09","powerAdvantages09","powerReducedEND09","powerLimitations09","powerDice09"], function(values) {
let powerType = values.powerType09;
const powerBaseCost = parseInt(values.powerBaseCost09)||0;
const powerAdvantages = parseFloat(values.powerAdvantages09)||0;
const powerReducedEND = values.powerReducedEND09;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice09;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations09)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost09":powerActiveCost,
"powerEND09":powerEND,
"powerCP09":powerRealCost,
"hiddenPowerDice09":thePowerDice
});
});
});
// Use Power 09 Endurance
on("clicked:buttonPowerEND09", function () {
getAttrs(["currentEND","powerEND09"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND09);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 09 */
on('clicked:powerRoll09', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName09} - @{powerEffect09}}} {{desc=@{powerText09}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll09}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice09}sd]]}} {{END=[[@{powerEND09}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND09"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND09)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
/* Update Power10 after detecting change to any of the numerical vales in the flex container */
on("change:powerType10 change:powerBaseCost10 change:powerAdvantages10 change:powerReducedEND10 change:powerLimitations10 change:powerDice10", function () {
getAttrs(["powerType10","powerBaseCost10","powerAdvantages10","powerReducedEND10","powerLimitations10","powerDice10"], function(values) {
let powerType = values.powerType10;
const powerBaseCost = parseInt(values.powerBaseCost10)||0;
const powerAdvantages = parseFloat(values.powerAdvantages10)||0;
const powerReducedEND = values.powerReducedEND10;
let powerActiveCost=0;
let powerModifiedCost=0;
let powerRealCost=0;
let powerEND=0;
let thePowerDice=values.powerDice10;
var increasedENDLimitation=increasedENDlimitation(powerReducedEND);
var powerLimitations = (parseFloat(values.powerLimitations10)||0)+increasedENDLimitation;
powerPreReducedEndActiveCost=powerBaseCost * (1+powerAdvantages);
powerEND=calculatePowerEND(powerPreReducedEndActiveCost, powerReducedEND);
powerActiveCost=calculateActiveCost(powerBaseCost, powerAdvantages, powerReducedEND);
powerActiveCost=heroRoundLow(powerActiveCost);
thePowerDice=thePowerDice.replace(/[^\ddD\\+\\-]/g,"");
if (powerBaseCost != 0) {
switch (powerType) {
case 'variableSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/5;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
case 'fixedSlot': powerRealCost=powerActiveCost/(1+powerLimitations)/10;
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
break;
default: powerRealCost=powerActiveCost/(1+powerLimitations);
powerRealCost=heroRoundLow(powerRealCost);
if (powerRealCost<1) {
powerRealCost=1;
};
}
} else {
powerActiveCost=0;
powerEND=0;
}
setAttrs({
"powerActiveCost10":powerActiveCost,
"powerEND10":powerEND,
"powerCP10":powerRealCost,
"hiddenPowerDice10":thePowerDice
});
});
});
// Use Power 10 Endurance
on("clicked:buttonPowerEND10", function () {
getAttrs(["currentEND","powerEND10"], function(values) {
const currentEND = parseInt(values.currentEND);
const powerEND = parseInt(values.powerEND10);
let updatedEND=currentEND-powerEND;
if (updatedEND<0) {
updatedEND=0;
}
setAttrs({
"currentEND":updatedEND
});
});
});
/* Activate Power 10 */
on('clicked:powerRoll10', (info) => {
startRoll("&{template:custom-power-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= @{powerName10} - @{powerEffect10}}} {{desc=@{powerText10}}} {{Activate On = [[?{Modifiers|0}+@{powerSkillRoll10}]] **or less**}} {{Success Roll=[[3d6cf<0cs>0]]}} {{Attack Roll=[[3d6cf<0cs>0]]}} {{Effect Roll=[[@{hiddenPowerDice10}sd]]}} {{END=[[@{powerEND10}]]}}", (results) => {
// Roll activation and effect dice. If the option to auto apply endurance is TRUE, subtract the power's END once from currentEND.
getAttrs(["optionAutoSubtractEND", "powerEND10"], function(values) {
let autoSubtractEND = values.optionAutoSubtractEND;
let powerEND = parseInt(values.powerEND10)||0;
subtractEndurance(powerEND);
});
finishRoll(
results.rollId,
{
}
);
});
});
// Update Tally Bar after change to any Power's CP cost.
on("change:powerCP01 change:powerCP02 change:powerCP03 change:powerCP04 change:powerCP05 change:powerCP06 change:powerCP07 change:powerCP08 change:powerCP09 change:powerCP10", function () {
sumPowersPerksTalents();
});
/* -------------- */
/* Power Movers */
/* -------------- */
on("clicked:powerDown01 clicked:powerUp02", function () {
getAttrs(["powerName01", "powerName02", "powerType01", "powerType02", "powerEffect01", "powerEffect02", "powerDice01", "powerDice02", "powerSkillRoll01", "powerSkillRoll02", "powerBaseCost01", "powerBaseCost02", "powerAdvantages01", "powerAdvantages02", "powerLimitations01", "powerLimitations02", "powerReducedEND01", "powerReducedEND02", "powerText01", "powerText02"], function(values) {
let destinationName = values.powerName02;
let sourceName = values.powerName01;
let destinationType = values.powerType02;
let sourceType = values.powerType01;
let destinationEffect = values.powerEffect02;
let sourceEffect = values.powerEffect01;
let destinationDice = values.powerDice02;
let sourceDice = values.powerDice01;
let destinationSkillRoll = values.powerSkillRoll02;
let sourceSkillRoll = values.powerSkillRoll01;
let destinationBaseCost = values.powerBaseCost02;
let sourceBaseCost = values.powerBaseCost01;
let destinationAdvantages = values.powerAdvantages02;
let sourceAdvantages = values.powerAdvantages01;
let destinationLimitations = values.powerLimitations02;
let sourceLimitations = values.powerLimitations01;
let destinationReducedEND = values.powerReducedEND02;
let sourceReducedEND = values.powerReducedEND01;
let destinationText = values.powerText02;
let sourceText = values.powerText01;
setAttrs({
"powerName02":sourceName,
"powerName01":destinationName,
"powerType02":sourceType,
"powerType01":destinationType,
"powerEffect02":sourceEffect,
"powerEffect01":destinationEffect,
"powerDice02":sourceDice,
"powerDice01":destinationDice,
"powerSkillRoll02":sourceSkillRoll,
"powerSkillRoll01":destinationSkillRoll,
"powerBaseCost02":sourceBaseCost,
"powerBaseCost01":destinationBaseCost,
"powerAdvantages02":sourceAdvantages,
"powerAdvantages01":destinationAdvantages,
"powerLimitations02":sourceLimitations,
"powerLimitations01":destinationLimitations,
"powerReducedEND02":sourceReducedEND,
"powerReducedEND01":destinationReducedEND,
"powerText02":sourceText,
"powerText01":destinationText
});
});
});
on("clicked:powerDown02 clicked:powerUp03", function () {
getAttrs(["powerName02", "powerName03", "powerType02", "powerType03", "powerEffect02", "powerEffect03", "powerDice02", "powerDice03", "powerSkillRoll02", "powerSkillRoll03", "powerBaseCost02", "powerBaseCost03", "powerAdvantages02", "powerAdvantages03", "powerLimitations02", "powerLimitations03", "powerReducedEND02", "powerReducedEND03", "powerText02", "powerText03"], function(values) {
let destinationName = values.powerName03;
let sourceName = values.powerName02;
let destinationType = values.powerType03;
let sourceType = values.powerType02;
let destinationEffect = values.powerEffect03;
let sourceEffect = values.powerEffect02;
let destinationDice = values.powerDice03;
let sourceDice = values.powerDice02;
let destinationSkillRoll = values.powerSkillRoll03;
let sourceSkillRoll = values.powerSkillRoll02;
let destinationBaseCost = values.powerBaseCost03;
let sourceBaseCost = values.powerBaseCost02;
let destinationAdvantages = values.powerAdvantages03;
let sourceAdvantages = values.powerAdvantages02;
let destinationLimitations = values.powerLimitations03;
let sourceLimitations = values.powerLimitations02;
let destinationReducedEND = values.powerReducedEND03;
let sourceReducedEND = values.powerReducedEND02;
let destinationText = values.powerText03;
let sourceText = values.powerText02;
setAttrs({
"powerName03":sourceName,
"powerName02":destinationName,
"powerType03":sourceType,
"powerType02":destinationType,
"powerEffect03":sourceEffect,
"powerEffect02":destinationEffect,
"powerDice03":sourceDice,
"powerDice02":destinationDice,
"powerSkillRoll03":sourceSkillRoll,
"powerSkillRoll02":destinationSkillRoll,
"powerBaseCost03":sourceBaseCost,
"powerBaseCost02":destinationBaseCost,
"powerAdvantages03":sourceAdvantages,
"powerAdvantages02":destinationAdvantages,
"powerLimitations03":sourceLimitations,
"powerLimitations02":destinationLimitations,
"powerReducedEND03":sourceReducedEND,
"powerReducedEND02":destinationReducedEND,
"powerText03":sourceText,
"powerText02":destinationText
});
});
});
on("clicked:powerDown03 clicked:powerUp04", function () {
getAttrs(["powerName03", "powerName04", "powerType03", "powerType04", "powerEffect03", "powerEffect04", "powerDice03", "powerDice04", "powerSkillRoll03", "powerSkillRoll04", "powerBaseCost03", "powerBaseCost04", "powerAdvantages03", "powerAdvantages04", "powerLimitations03", "powerLimitations04", "powerReducedEND03", "powerReducedEND04", "powerText03", "powerText04"], function(values) {
let destinationName = values.powerName04;
let sourceName = values.powerName03;
let destinationType = values.powerType04;
let sourceType = values.powerType03;
let destinationEffect = values.powerEffect04;
let sourceEffect = values.powerEffect03;
let destinationDice = values.powerDice04;
let sourceDice = values.powerDice03;
let destinationSkillRoll = values.powerSkillRoll04;
let sourceSkillRoll = values.powerSkillRoll03;
let destinationBaseCost = values.powerBaseCost04;
let sourceBaseCost = values.powerBaseCost03;
let destinationAdvantages = values.powerAdvantages04;
let sourceAdvantages = values.powerAdvantages03;
let destinationLimitations = values.powerLimitations04;
let sourceLimitations = values.powerLimitations03;
let destinationReducedEND = values.powerReducedEND04;
let sourceReducedEND = values.powerReducedEND03;
let destinationText = values.powerText04;
let sourceText = values.powerText03;
setAttrs({
"powerName04":sourceName,
"powerName03":destinationName,
"powerType04":sourceType,
"powerType03":destinationType,
"powerEffect04":sourceEffect,
"powerEffect03":destinationEffect,
"powerDice04":sourceDice,
"powerDice03":destinationDice,
"powerSkillRoll04":sourceSkillRoll,
"powerSkillRoll03":destinationSkillRoll,
"powerBaseCost04":sourceBaseCost,
"powerBaseCost03":destinationBaseCost,
"powerAdvantages04":sourceAdvantages,
"powerAdvantages03":destinationAdvantages,
"powerLimitations04":sourceLimitations,
"powerLimitations03":destinationLimitations,
"powerReducedEND04":sourceReducedEND,
"powerReducedEND03":destinationReducedEND,
"powerText04":sourceText,
"powerText03":destinationText
});
});
});
on("clicked:powerDown04 clicked:powerUp05", function () {
getAttrs(["powerName04", "powerName05", "powerType04", "powerType05", "powerEffect04", "powerEffect05", "powerDice04", "powerDice05", "powerSkillRoll04", "powerSkillRoll05", "powerBaseCost04", "powerBaseCost05", "powerAdvantages04", "powerAdvantages05", "powerLimitations04", "powerLimitations05", "powerReducedEND04", "powerReducedEND05", "powerText04", "powerText05"], function(values) {
let destinationName = values.powerName05;
let sourceName = values.powerName04;
let destinationType = values.powerType05;
let sourceType = values.powerType04;
let destinationEffect = values.powerEffect05;
let sourceEffect = values.powerEffect04;
let destinationDice = values.powerDice05;
let sourceDice = values.powerDice04;
let destinationSkillRoll = values.powerSkillRoll05;
let sourceSkillRoll = values.powerSkillRoll04;
let destinationBaseCost = values.powerBaseCost05;
let sourceBaseCost = values.powerBaseCost04;
let destinationAdvantages = values.powerAdvantages05;
let sourceAdvantages = values.powerAdvantages04;
let destinationLimitations = values.powerLimitations05;
let sourceLimitations = values.powerLimitations04;
let destinationReducedEND = values.powerReducedEND05;
let sourceReducedEND = values.powerReducedEND04;
let destinationText = values.powerText05;
let sourceText = values.powerText04;
setAttrs({
"powerName05":sourceName,
"powerName04":destinationName,
"powerType05":sourceType,
"powerType04":destinationType,
"powerEffect05":sourceEffect,
"powerEffect04":destinationEffect,
"powerDice05":sourceDice,
"powerDice04":destinationDice,
"powerSkillRoll05":sourceSkillRoll,
"powerSkillRoll04":destinationSkillRoll,
"powerBaseCost05":sourceBaseCost,
"powerBaseCost04":destinationBaseCost,
"powerAdvantages05":sourceAdvantages,
"powerAdvantages04":destinationAdvantages,
"powerLimitations05":sourceLimitations,
"powerLimitations04":destinationLimitations,
"powerReducedEND05":sourceReducedEND,
"powerReducedEND04":destinationReducedEND,
"powerText05":sourceText,
"powerText04":destinationText
});
});
});
on("clicked:powerDown05 clicked:powerUp06", function () {
getAttrs(["powerName05", "powerName06", "powerType05", "powerType06", "powerEffect05", "powerEffect06", "powerDice05", "powerDice06", "powerSkillRoll05", "powerSkillRoll06", "powerBaseCost05", "powerBaseCost06", "powerAdvantages05", "powerAdvantages06", "powerLimitations05", "powerLimitations06", "powerReducedEND05", "powerReducedEND06", "powerText05", "powerText06"], function(values) {
let destinationName = values.powerName06;
let sourceName = values.powerName05;
let destinationType = values.powerType06;
let sourceType = values.powerType05;
let destinationEffect = values.powerEffect06;
let sourceEffect = values.powerEffect05;
let destinationDice = values.powerDice06;
let sourceDice = values.powerDice05;
let destinationSkillRoll = values.powerSkillRoll06;
let sourceSkillRoll = values.powerSkillRoll05;
let destinationBaseCost = values.powerBaseCost06;
let sourceBaseCost = values.powerBaseCost05;
let destinationAdvantages = values.powerAdvantages06;
let sourceAdvantages = values.powerAdvantages05;
let destinationLimitations = values.powerLimitations06;
let sourceLimitations = values.powerLimitations05;
let destinationReducedEND = values.powerReducedEND06;
let sourceReducedEND = values.powerReducedEND05;
let destinationText = values.powerText06;
let sourceText = values.powerText05;
setAttrs({
"powerName06":sourceName,
"powerName05":destinationName,
"powerType06":sourceType,
"powerType05":destinationType,
"powerEffect06":sourceEffect,
"powerEffect05":destinationEffect,
"powerDice06":sourceDice,
"powerDice05":destinationDice,
"powerSkillRoll06":sourceSkillRoll,
"powerSkillRoll05":destinationSkillRoll,
"powerBaseCost06":sourceBaseCost,
"powerBaseCost05":destinationBaseCost,
"powerAdvantages06":sourceAdvantages,
"powerAdvantages05":destinationAdvantages,
"powerLimitations06":sourceLimitations,
"powerLimitations05":destinationLimitations,
"powerReducedEND06":sourceReducedEND,
"powerReducedEND05":destinationReducedEND,
"powerText06":sourceText,
"powerText05":destinationText
});
});
});
on("clicked:powerDown06 clicked:powerUp07", function () {
getAttrs(["powerName06", "powerName07", "powerType06", "powerType07", "powerEffect06", "powerEffect07", "powerDice06", "powerDice07", "powerSkillRoll06", "powerSkillRoll07", "powerBaseCost06", "powerBaseCost07", "powerAdvantages06", "powerAdvantages07", "powerLimitations06", "powerLimitations07", "powerReducedEND06", "powerReducedEND07", "powerText06", "powerText07"], function(values) {
let destinationName = values.powerName07;
let sourceName = values.powerName06;
let destinationType = values.powerType07;
let sourceType = values.powerType06;
let destinationEffect = values.powerEffect07;
let sourceEffect = values.powerEffect06;
let destinationDice = values.powerDice07;
let sourceDice = values.powerDice06;
let destinationSkillRoll = values.powerSkillRoll07;
let sourceSkillRoll = values.powerSkillRoll06;
let destinationBaseCost = values.powerBaseCost07;
let sourceBaseCost = values.powerBaseCost06;
let destinationAdvantages = values.powerAdvantages07;
let sourceAdvantages = values.powerAdvantages06;
let destinationLimitations = values.powerLimitations07;
let sourceLimitations = values.powerLimitations06;
let destinationReducedEND = values.powerReducedEND07;
let sourceReducedEND = values.powerReducedEND06;
let destinationText = values.powerText07;
let sourceText = values.powerText06;
setAttrs({
"powerName07":sourceName,
"powerName06":destinationName,
"powerType07":sourceType,
"powerType06":destinationType,
"powerEffect07":sourceEffect,
"powerEffect06":destinationEffect,
"powerDice07":sourceDice,
"powerDice06":destinationDice,
"powerSkillRoll07":sourceSkillRoll,
"powerSkillRoll06":destinationSkillRoll,
"powerBaseCost07":sourceBaseCost,
"powerBaseCost06":destinationBaseCost,
"powerAdvantages07":sourceAdvantages,
"powerAdvantages06":destinationAdvantages,
"powerLimitations07":sourceLimitations,
"powerLimitations06":destinationLimitations,
"powerReducedEND07":sourceReducedEND,
"powerReducedEND06":destinationReducedEND,
"powerText07":sourceText,
"powerText06":destinationText
});
});
});
on("clicked:powerDown07 clicked:powerUp08", function () {
getAttrs(["powerName07", "powerName08", "powerType07", "powerType08", "powerEffect07", "powerEffect08", "powerDice07", "powerDice08", "powerSkillRoll07", "powerSkillRoll08", "powerBaseCost07", "powerBaseCost08", "powerAdvantages07", "powerAdvantages08", "powerLimitations07", "powerLimitations08", "powerReducedEND07", "powerReducedEND08", "powerText07", "powerText08"], function(values) {
let destinationName = values.powerName08;
let sourceName = values.powerName07;
let destinationType = values.powerType08;
let sourceType = values.powerType07;
let destinationEffect = values.powerEffect08;
let sourceEffect = values.powerEffect07;
let destinationDice = values.powerDice08;
let sourceDice = values.powerDice07;
let destinationSkillRoll = values.powerSkillRoll08;
let sourceSkillRoll = values.powerSkillRoll07;
let destinationBaseCost = values.powerBaseCost08;
let sourceBaseCost = values.powerBaseCost07;
let destinationAdvantages = values.powerAdvantages08;
let sourceAdvantages = values.powerAdvantages07;
let destinationLimitations = values.powerLimitations08;
let sourceLimitations = values.powerLimitations07;
let destinationReducedEND = values.powerReducedEND08;
let sourceReducedEND = values.powerReducedEND07;
let destinationText = values.powerText08;
let sourceText = values.powerText07;
setAttrs({
"powerName08":sourceName,
"powerName07":destinationName,
"powerType08":sourceType,
"powerType07":destinationType,
"powerEffect08":sourceEffect,
"powerEffect07":destinationEffect,
"powerDice08":sourceDice,
"powerDice07":destinationDice,
"powerSkillRoll08":sourceSkillRoll,
"powerSkillRoll07":destinationSkillRoll,
"powerBaseCost08":sourceBaseCost,
"powerBaseCost07":destinationBaseCost,
"powerAdvantages08":sourceAdvantages,
"powerAdvantages07":destinationAdvantages,
"powerLimitations08":sourceLimitations,
"powerLimitations07":destinationLimitations,
"powerReducedEND08":sourceReducedEND,
"powerReducedEND07":destinationReducedEND,
"powerText08":sourceText,
"powerText07":destinationText
});
});
});
on("clicked:powerDown08 clicked:powerUp09", function () {
getAttrs(["powerName08", "powerName09", "powerType08", "powerType09", "powerEffect08", "powerEffect09", "powerDice08", "powerDice09", "powerSkillRoll08", "powerSkillRoll09", "powerBaseCost08", "powerBaseCost09", "powerAdvantages08", "powerAdvantages09", "powerLimitations08", "powerLimitations09", "powerReducedEND08", "powerReducedEND09", "powerText08", "powerText09"], function(values) {
let destinationName = values.powerName09;
let sourceName = values.powerName08;
let destinationType = values.powerType09;
let sourceType = values.powerType08;
let destinationEffect = values.powerEffect09;
let sourceEffect = values.powerEffect08;
let destinationDice = values.powerDice09;
let sourceDice = values.powerDice08;
let destinationSkillRoll = values.powerSkillRoll09;
let sourceSkillRoll = values.powerSkillRoll08;
let destinationBaseCost = values.powerBaseCost09;
let sourceBaseCost = values.powerBaseCost08;
let destinationAdvantages = values.powerAdvantages09;
let sourceAdvantages = values.powerAdvantages08;
let destinationLimitations = values.powerLimitations09;
let sourceLimitations = values.powerLimitations08;
let destinationReducedEND = values.powerReducedEND09;
let sourceReducedEND = values.powerReducedEND08;
let destinationText = values.powerText09;
let sourceText = values.powerText08;
setAttrs({
"powerName09":sourceName,
"powerName08":destinationName,
"powerType09":sourceType,
"powerType08":destinationType,
"powerEffect09":sourceEffect,
"powerEffect08":destinationEffect,
"powerDice08":sourceDice,
"powerDice09":destinationDice,
"powerSkillRoll09":sourceSkillRoll,
"powerSkillRoll08":destinationSkillRoll,
"powerBaseCost09":sourceBaseCost,
"powerBaseCost08":destinationBaseCost,
"powerAdvantages09":sourceAdvantages,
"powerAdvantages08":destinationAdvantages,
"powerLimitations09":sourceLimitations,
"powerLimitations08":destinationLimitations,
"powerReducedEND09":sourceReducedEND,
"powerReducedEND08":destinationReducedEND,
"powerText09":sourceText,
"powerText08":destinationText
});
});
});
on("clicked:powerDown09 clicked:powerUp10", function () {
getAttrs(["powerName09", "powerName10", "powerType09", "powerType10", "powerEffect09", "powerEffect10", "powerDice09", "powerDice10", "powerSkillRoll09", "powerSkillRoll10", "powerBaseCost09", "powerBaseCost10", "powerAdvantages09", "powerAdvantages10", "powerLimitations09", "powerLimitations10", "powerReducedEND09", "powerReducedEND10", "powerText09", "powerText10"], function(values) {
let destinationName = values.powerName10;
let sourceName = values.powerName09;
let destinationType = values.powerType10;
let sourceType = values.powerType09;
let destinationEffect = values.powerEffect10;
let sourceEffect = values.powerEffect09;
let destinationDice = values.powerDice10;
let sourceDice = values.powerDice09;
let destinationSkillRoll = values.powerSkillRoll10;
let sourceSkillRoll = values.powerSkillRoll09;
let destinationBaseCost = values.powerBaseCost10;
let sourceBaseCost = values.powerBaseCost09;
let destinationAdvantages = values.powerAdvantages10;
let sourceAdvantages = values.powerAdvantages09;
let destinationLimitations = values.powerLimitations10;
let sourceLimitations = values.powerLimitations09;
let destinationReducedEND = values.powerReducedEND10;
let sourceReducedEND = values.powerReducedEND09;
let destinationText = values.powerText10;
let sourceText = values.powerText09;
setAttrs({
"powerName10":sourceName,
"powerName09":destinationName,
"powerType10":sourceType,
"powerType09":destinationType,
"powerEffect10":sourceEffect,
"powerEffect09":destinationEffect,
"powerDice09":sourceDice,
"powerDice10":destinationDice,
"powerSkillRoll10":sourceSkillRoll,
"powerSkillRoll09":destinationSkillRoll,
"powerBaseCost10":sourceBaseCost,
"powerBaseCost09":destinationBaseCost,
"powerAdvantages10":sourceAdvantages,
"powerAdvantages09":destinationAdvantages,
"powerLimitations10":sourceLimitations,
"powerLimitations09":destinationLimitations,
"powerReducedEND10":sourceReducedEND,
"powerReducedEND09":destinationReducedEND,
"powerText10":sourceText,
"powerText09":destinationText
});
});
});
on("clicked:powerDown10 clicked:powerUp01", function () {
getAttrs(["powerName10", "powerName01", "powerType10", "powerType01", "powerEffect10", "powerEffect01", "powerDice10", "powerDice01", "powerSkillRoll10", "powerSkillRoll01", "powerBaseCost10", "powerBaseCost01", "powerAdvantages10", "powerAdvantages01", "powerLimitations10", "powerLimitations01", "powerReducedEND10", "powerReducedEND01", "powerText10", "powerText01"], function(values) {
let destinationName = values.powerName01;
let sourceName = values.powerName10;
let destinationType = values.powerType01;
let sourceType = values.powerType10;
let destinationEffect = values.powerEffect01;
let sourceEffect = values.powerEffect10;
let destinationDice = values.powerDice01;
let sourceDice = values.powerDice10;
let destinationSkillRoll = values.powerSkillRoll01;
let sourceSkillRoll = values.powerSkillRoll10;
let destinationBaseCost = values.powerBaseCost01;
let sourceBaseCost = values.powerBaseCost10;
let destinationAdvantages = values.powerAdvantages01;
let sourceAdvantages = values.powerAdvantages10;
let destinationLimitations = values.powerLimitations01;
let sourceLimitations = values.powerLimitations10;
let destinationReducedEND = values.powerReducedEND01;
let sourceReducedEND = values.powerReducedEND10;
let destinationText = values.powerText01;
let sourceText = values.powerText10;
setAttrs({
"powerName01":sourceName,
"powerName10":destinationName,
"powerType01":sourceType,
"powerType10":destinationType,
"powerEffect01":sourceEffect,
"powerEffect10":destinationEffect,
"powerDice01":sourceDice,
"powerDice10":destinationDice,
"powerSkillRoll01":sourceSkillRoll,
"powerSkillRoll10":destinationSkillRoll,
"powerBaseCost01":sourceBaseCost,
"powerBaseCost10":destinationBaseCost,
"powerAdvantages01":sourceAdvantages,
"powerAdvantages10":destinationAdvantages,
"powerLimitations01":sourceLimitations,
"powerLimitations10":destinationLimitations,
"powerReducedEND01":sourceReducedEND,
"powerReducedEND10":destinationReducedEND,
"powerText01":sourceText,
"powerText10":destinationText
});
});
});
/* -------------------------------------------------- */
/* Functions used for skills tab */
/* -------------------------------------------------- */
function calculateLanguageSkillCost(skillFluency, skillLiteracy, enhancerLinguist, literacyCost) {
var enhancerBonus=0;
var languageCP=0;
let literacyCP=0;
if (skillLiteracy!=0) {
literacyCP=literacyCost;
}
if (enhancerLinguist!=0) {
enhancerBonus=1;
}
switch (skillFluency) {
case "native": languageCP = literacyCP;
break;
case "none": languageCP = literacyCP;
break;
case "basic": languageCP = 1+literacyCP;
break;
case "fluent": languageCP = 2+literacyCP-enhancerBonus;
break;
case "accent": languageCP = 3+literacyCP-enhancerBonus;
break;
case "idiomatic": languageCP = 4+literacyCP-enhancerBonus;
break;
case "imitate": languageCP = 5+literacyCP-enhancerBonus;
break;
}
return languageCP;
}
function standardSkillChance(theBaseSkillRoll,skillCP,additionalLevels) {
var skillCost=3;
var skillLevelCost=2;
var theSkillRollChance;
var theSkillBonus;
if (skillCP==0) {
theSkillRollChance=0;
} else if (skillCP==1) {
theSkillRollChance=8;
} else if (skillCP==2) {
theSkillRollChance=10;
} else {
theSkillBonus=Math.floor((skillCP-skillCost)/skillLevelCost);
theSkillRollChance=theBaseSkillRoll+theSkillBonus+additionalLevels;
}
return theSkillRollChance;
}
function knowledgeSkillChance(enhancer,skillCP,additionalLevels) {
// Calculate KS, PS, or AK-type skill roll chance.
var skillCost=2;
var skillLevelCost=1;
var theBaseSkillRoll=11;
var theSkillBonus=0;
var theSkillRollChance=0;
if (skillCP==0) {
theSkillRollChance = 0;
} else if (skillCP==1 && enhancer == 0) {
theSkillRollChance = 8;
} else if ( (skillCP>=2) && (enhancer == 0) ) {
theSkillBonus=skillCP-skillCost;
theSkillRollChance = theBaseSkillRoll+theSkillBonus+additionalLevels;
} else {
skillCost=1;
theSkillBonus=skillCP-skillCost;
theSkillRollChance = theBaseSkillRoll+theSkillBonus+additionalLevels;
}
return theSkillRollChance;
}
function knowledgeIntSkillChance(theBaseSkillRoll, enhancer, skillCP, additionalLevels) {
// Knowledge, Professional, and Science Skills can be purchased as Intelligence-based skills. In such a case
// this function replaces the more general knowledgeSkillChance(...) function.
var skillCost=3;
var skillLevelCost=1;
var theSkillBonus=0;
var theSkillRollChance=0;
if (skillCP==0) {
theSkillRollChance = 0;
} else if (skillCP==1 && enhancer == 0) {
theSkillRollChance = 8;
} else if (skillCP==1 && enhancer != 0) {
theSkillRollChance = 11+additionalLevels; // I.e., a regular Knowledge Skill is the better choice.
} else if ( (skillCP==2) && (enhancer == 0) ) {
theSkillRollChance = 11+additionalLevels; // I.e., a regular Knowledge Skill is better than 10- skill proficiency.
} else if ( (skillCP==3) && (enhancer == 0) ) {
theSkillBonus=0;
theSkillRollChance=theBaseSkillRoll+theSkillBonus+additionalLevels;
} else {
if (enhancer!=0) {
skillCost=2;
}
theSkillBonus=Math.floor((skillCP-skillCost)/skillLevelCost);
theSkillRollChance=theBaseSkillRoll+theSkillBonus+additionalLevels;
}
return theSkillRollChance;
}
function calculateSkillChance(skillType,skillCP,enhancerJack,enhancerSch,enhancerSci,enhancerTrav,strengthChance,dexterityChance,constitutionChance,intelligenceChance,egoChance,presenceChance,interactionSkillLevels,intellectSkillLevels,agilitySkillLevels,bonusLevels) {
// Calculates the skill roll chance for a general skill.
//
// A bit crazy, but all of these variables need to be passed to this function for the the switch function contained below
// to calculate the skill roll chance for the skill passed to the function.
switch (skillType) {
case "str":
theSkillRollChance=standardSkillChance( strengthChance,skillCP,bonusLevels);
break;
case "dex":
theSkillRollChance=standardSkillChance( dexterityChance,skillCP,agilitySkillLevels+bonusLevels);
break;
case "con":
theSkillRollChance=standardSkillChance( constitutionChance,skillCP,bonusLevels);
break;
case "int":
theSkillRollChance=standardSkillChance( intelligenceChance,skillCP,intellectSkillLevels+bonusLevels);
break;
case "ego":
theSkillRollChance=standardSkillChance( egoChance,skillCP,bonusLevels);
break;
case "pre":
theSkillRollChance=standardSkillChance( presenceChance,skillCP,interactionSkillLevels+bonusLevels);
break;
case "ps":
theSkillRollChance=knowledgeSkillChance( enhancerJack,skillCP,bonusLevels);
break;
case "intPS":
theSkillRollChance=knowledgeIntSkillChance( intelligenceChance, enhancerJack,skillCP,bonusLevels);
break;
case "dexPS":
theSkillRollChance=knowledgeIntSkillChance( dexterityChance, enhancerJack,skillCP,bonusLevels);
break;
case "ks":
theSkillRollChance=knowledgeSkillChance( enhancerSch,skillCP,bonusLevels);
break;
case "intKS":
theSkillRollChance=knowledgeIntSkillChance( intelligenceChance, enhancerSch, skillCP,bonusLevels);
break;
case "ss":
theSkillRollChance=knowledgeSkillChance( enhancerSci,skillCP,bonusLevels);
break;
case "intSS":
theSkillRollChance=knowledgeIntSkillChance( intelligenceChance, enhancerSci, skillCP,bonusLevels);
break;
case "ak":
theSkillRollChance=knowledgeSkillChance( enhancerTrav,skillCP,bonusLevels);;
break;
case "other":
theSkillRollChance=0;
break;
case "none":
theSkillRollChance=0;
break;
case "group":
theSkillRollChance=0;
break;
default:
theSkillRollChance=0;
}
return theSkillRollChance;
}
/* -------------- */
/* Skill Movers */
/* -------------- */
/* Move Skills 01-10 */
on("clicked:skillDown01 clicked:skillUp02", function () {
getAttrs(["skillName01", "skillName02", "skillType01", "skillType02", "skillCP01", "skillCP02"], function(values) {
let destinationName = values.skillName02;
let sourceName = values.skillName01;
let destinationType = values.skillType02;
let sourceType = values.skillType01;
let destinationCP = values.skillCP02;
let sourceCP = values.skillCP01;
setAttrs({
"skillName02":sourceName,
"skillName01":destinationName,
"skillType02":sourceType,
"skillType01":destinationType,
"skillCP02":sourceCP,
"skillCP01":destinationCP
});
});
});
on("clicked:skillDown02 clicked:skillUp03", function () {
getAttrs(["skillName02", "skillName03", "skillType02", "skillType03", "skillCP02", "skillCP03"], function(values) {
let destinationName = values.skillName03;
let sourceName = values.skillName02;
let destinationType = values.skillType03;
let sourceType = values.skillType02;
let destinationCP = values.skillCP03;
let sourceCP = values.skillCP02;
setAttrs({
"skillName03":sourceName,
"skillName02":destinationName,
"skillType03":sourceType,
"skillType02":destinationType,
"skillCP03":sourceCP,
"skillCP02":destinationCP
});
});
});
on("clicked:skillDown03 clicked:skillUp04", function () {
getAttrs(["skillName03", "skillName04", "skillType03", "skillType04", "skillCP03", "skillCP04"], function(values) {
let destinationName = values.skillName04;
let sourceName = values.skillName03;
let destinationType = values.skillType04;
let sourceType = values.skillType03;
let destinationCP = values.skillCP04;
let sourceCP = values.skillCP03;
setAttrs({
"skillName04":sourceName,
"skillName03":destinationName,
"skillType04":sourceType,
"skillType03":destinationType,
"skillCP04":sourceCP,
"skillCP03":destinationCP
});
});
});
on("clicked:skillDown04 clicked:skillUp05", function () {
getAttrs(["skillName04", "skillName05", "skillType04", "skillType05", "skillCP04", "skillCP05"], function(values) {
let destinationName = values.skillName05;
let sourceName = values.skillName04;
let destinationType = values.skillType05;
let sourceType = values.skillType04;
let destinationCP = values.skillCP05;
let sourceCP = values.skillCP04;
setAttrs({
"skillName05":sourceName,
"skillName04":destinationName,
"skillType05":sourceType,
"skillType04":destinationType,
"skillCP05":sourceCP,
"skillCP04":destinationCP
});
});
});
on("clicked:skillDown05 clicked:skillUp06", function () {
getAttrs(["skillName05", "skillName06", "skillType05", "skillType06", "skillCP05", "skillCP06"], function(values) {
let destinationName = values.skillName06;
let sourceName = values.skillName05;
let destinationType = values.skillType06;
let sourceType = values.skillType05;
let destinationCP = values.skillCP06;
let sourceCP = values.skillCP05;
setAttrs({
"skillName06":sourceName,
"skillName05":destinationName,
"skillType06":sourceType,
"skillType05":destinationType,
"skillCP06":sourceCP,
"skillCP05":destinationCP
});
});
});
on("clicked:skillDown06 clicked:skillUp07", function () {
getAttrs(["skillName06", "skillName07", "skillType06", "skillType07", "skillCP06", "skillCP07"], function(values) {
let destinationName = values.skillName07;
let sourceName = values.skillName06;
let destinationType = values.skillType07;
let sourceType = values.skillType06;
let destinationCP = values.skillCP07;
let sourceCP = values.skillCP06;
setAttrs({
"skillName07":sourceName,
"skillName06":destinationName,
"skillType07":sourceType,
"skillType06":destinationType,
"skillCP07":sourceCP,
"skillCP06":destinationCP
});
});
});
on("clicked:skillDown07 clicked:skillUp08", function () {
getAttrs(["skillName07", "skillName08", "skillType07", "skillType08", "skillCP07", "skillCP08"], function(values) {
let destinationName = values.skillName08;
let sourceName = values.skillName07;
let destinationType = values.skillType08;
let sourceType = values.skillType07;
let destinationCP = values.skillCP08;
let sourceCP = values.skillCP07;
setAttrs({
"skillName08":sourceName,
"skillName07":destinationName,
"skillType08":sourceType,
"skillType07":destinationType,
"skillCP08":sourceCP,
"skillCP07":destinationCP
});
});
});
on("clicked:skillDown08 clicked:skillUp09", function () {
getAttrs(["skillName08", "skillName09", "skillType08", "skillType09", "skillCP08", "skillCP09"], function(values) {
let destinationName = values.skillName09;
let sourceName = values.skillName08;
let destinationType = values.skillType09;
let sourceType = values.skillType08;
let destinationCP = values.skillCP09;
let sourceCP = values.skillCP08;
setAttrs({
"skillName09":sourceName,
"skillName08":destinationName,
"skillType09":sourceType,
"skillType08":destinationType,
"skillCP09":sourceCP,
"skillCP08":destinationCP
});
});
});
on("clicked:skillDown09 clicked:skillUp10", function () {
getAttrs(["skillName09", "skillName10", "skillType09", "skillType10", "skillCP09", "skillCP10"], function(values) {
let destinationName = values.skillName10;
let sourceName = values.skillName09;
let destinationType = values.skillType10;
let sourceType = values.skillType09;
let destinationCP = values.skillCP10;
let sourceCP = values.skillCP09;
setAttrs({
"skillName10":sourceName,
"skillName09":destinationName,
"skillType10":sourceType,
"skillType09":destinationType,
"skillCP10":sourceCP,
"skillCP09":destinationCP
});
});
});
/* Move Skills 11-20 */
on("clicked:skillDown10 clicked:skillUp11", function () {
getAttrs(["skillName10", "skillName11", "skillType10", "skillType11", "skillCP10", "skillCP11"], function(values) {
let destinationName = values.skillName11;
let sourceName = values.skillName10;
let destinationType = values.skillType11;
let sourceType = values.skillType10;
let destinationCP = values.skillCP11;
let sourceCP = values.skillCP10;
setAttrs({
"skillName11":sourceName,
"skillName10":destinationName,
"skillType11":sourceType,
"skillType10":destinationType,
"skillCP11":sourceCP,
"skillCP10":destinationCP
});
});
});
on("clicked:skillDown11 clicked:skillUp12", function () {
getAttrs(["skillName11", "skillName12", "skillType11", "skillType12", "skillCP11", "skillCP12"], function(values) {
let destinationName = values.skillName12;
let sourceName = values.skillName11;
let destinationType = values.skillType12;
let sourceType = values.skillType11;
let destinationCP = values.skillCP12;
let sourceCP = values.skillCP11;
setAttrs({
"skillName12":sourceName,
"skillName11":destinationName,
"skillType12":sourceType,
"skillType11":destinationType,
"skillCP12":sourceCP,
"skillCP11":destinationCP
});
});
});
on("clicked:skillDown12 clicked:skillUp13", function () {
getAttrs(["skillName12", "skillName13", "skillType12", "skillType13", "skillCP12", "skillCP13"], function(values) {
let destinationName = values.skillName13;
let sourceName = values.skillName12;
let destinationType = values.skillType13;
let sourceType = values.skillType12;
let destinationCP = values.skillCP13;
let sourceCP = values.skillCP12;
setAttrs({
"skillName13":sourceName,
"skillName12":destinationName,
"skillType13":sourceType,
"skillType12":destinationType,
"skillCP13":sourceCP,
"skillCP12":destinationCP
});
});
});
on("clicked:skillDown13 clicked:skillUp14", function () {
getAttrs(["skillName13", "skillName14", "skillType13", "skillType14", "skillCP13", "skillCP14"], function(values) {
let destinationName = values.skillName14;
let sourceName = values.skillName13;
let destinationType = values.skillType14;
let sourceType = values.skillType13;
let destinationCP = values.skillCP14;
let sourceCP = values.skillCP13;
setAttrs({
"skillName14":sourceName,
"skillName13":destinationName,
"skillType14":sourceType,
"skillType13":destinationType,
"skillCP14":sourceCP,
"skillCP13":destinationCP
});
});
});
on("clicked:skillDown14 clicked:skillUp15", function () {
getAttrs(["skillName14", "skillName15", "skillType14", "skillType15", "skillCP14", "skillCP15"], function(values) {
let destinationName = values.skillName15;
let sourceName = values.skillName14;
let destinationType = values.skillType15;
let sourceType = values.skillType14;
let destinationCP = values.skillCP15;
let sourceCP = values.skillCP14;
setAttrs({
"skillName15":sourceName,
"skillName14":destinationName,
"skillType15":sourceType,
"skillType14":destinationType,
"skillCP15":sourceCP,
"skillCP14":destinationCP
});
});
});
on("clicked:skillDown15 clicked:skillUp16", function () {
getAttrs(["skillName15", "skillName16", "skillType15", "skillType16", "skillCP15", "skillCP16"], function(values) {
let destinationName = values.skillName16;
let sourceName = values.skillName15;
let destinationType = values.skillType16;
let sourceType = values.skillType15;
let destinationCP = values.skillCP16;
let sourceCP = values.skillCP15;
setAttrs({
"skillName16":sourceName,
"skillName15":destinationName,
"skillType16":sourceType,
"skillType15":destinationType,
"skillCP16":sourceCP,
"skillCP15":destinationCP
});
});
});
on("clicked:skillDown16 clicked:skillUp17", function () {
getAttrs(["skillName16", "skillName17", "skillType16", "skillType17", "skillCP16", "skillCP17"], function(values) {
let destinationName = values.skillName17;
let sourceName = values.skillName16;
let destinationType = values.skillType17;
let sourceType = values.skillType16;
let destinationCP = values.skillCP17;
let sourceCP = values.skillCP16;
setAttrs({
"skillName17":sourceName,
"skillName16":destinationName,
"skillType17":sourceType,
"skillType16":destinationType,
"skillCP17":sourceCP,
"skillCP16":destinationCP
});
});
});
on("clicked:skillDown17 clicked:skillUp18", function () {
getAttrs(["skillName17", "skillName18", "skillType17", "skillType18", "skillCP17", "skillCP18"], function(values) {
let destinationName = values.skillName18;
let sourceName = values.skillName17;
let destinationType = values.skillType18;
let sourceType = values.skillType17;
let destinationCP = values.skillCP18;
let sourceCP = values.skillCP17;
setAttrs({
"skillName18":sourceName,
"skillName17":destinationName,
"skillType18":sourceType,
"skillType17":destinationType,
"skillCP18":sourceCP,
"skillCP17":destinationCP
});
});
});
on("clicked:skillDown18 clicked:skillUp19", function () {
getAttrs(["skillName18", "skillName19", "skillType18", "skillType19", "skillCP18", "skillCP19"], function(values) {
let destinationName = values.skillName19;
let sourceName = values.skillName18;
let destinationType = values.skillType19;
let sourceType = values.skillType18;
let destinationCP = values.skillCP19;
let sourceCP = values.skillCP18;
setAttrs({
"skillName19":sourceName,
"skillName18":destinationName,
"skillType19":sourceType,
"skillType18":destinationType,
"skillCP19":sourceCP,
"skillCP18":destinationCP
});
});
});
on("clicked:skillDown19 clicked:skillUp20", function () {
getAttrs(["skillName19", "skillName20", "skillType19", "skillType20", "skillCP19", "skillCP20"], function(values) {
let destinationName = values.skillName20;
let sourceName = values.skillName19;
let destinationType = values.skillType20;
let sourceType = values.skillType19;
let destinationCP = values.skillCP20;
let sourceCP = values.skillCP19;
setAttrs({
"skillName20":sourceName,
"skillName19":destinationName,
"skillType20":sourceType,
"skillType19":destinationType,
"skillCP20":sourceCP,
"skillCP19":destinationCP
});
});
});
/* Move Skills 11-20 */
on("clicked:skillDown20 clicked:skillUp21", function () {
getAttrs(["skillName20", "skillName21", "skillType20", "skillType21", "skillCP20", "skillCP21"], function(values) {
let destinationName = values.skillName21;
let sourceName = values.skillName20;
let destinationType = values.skillType21;
let sourceType = values.skillType20;
let destinationCP = values.skillCP21;
let sourceCP = values.skillCP20;
setAttrs({
"skillName21":sourceName,
"skillName20":destinationName,
"skillType21":sourceType,
"skillType20":destinationType,
"skillCP21":sourceCP,
"skillCP20":destinationCP
});
});
});
on("clicked:skillDown21 clicked:skillUp22", function () {
getAttrs(["skillName21", "skillName22", "skillType21", "skillType22", "skillCP21", "skillCP22"], function(values) {
let destinationName = values.skillName22;
let sourceName = values.skillName21;
let destinationType = values.skillType22;
let sourceType = values.skillType21;
let destinationCP = values.skillCP22;
let sourceCP = values.skillCP21;
setAttrs({
"skillName22":sourceName,
"skillName21":destinationName,
"skillType22":sourceType,
"skillType21":destinationType,
"skillCP22":sourceCP,
"skillCP21":destinationCP
});
});
});
on("clicked:skillDown22 clicked:skillUp23", function () {
getAttrs(["skillName22", "skillName23", "skillType22", "skillType23", "skillCP22", "skillCP23"], function(values) {
let destinationName = values.skillName23;
let sourceName = values.skillName22;
let destinationType = values.skillType23;
let sourceType = values.skillType22;
let destinationCP = values.skillCP23;
let sourceCP = values.skillCP22;
setAttrs({
"skillName23":sourceName,
"skillName22":destinationName,
"skillType23":sourceType,
"skillType22":destinationType,
"skillCP23":sourceCP,
"skillCP22":destinationCP
});
});
});
on("clicked:skillDown23 clicked:skillUp24", function () {
getAttrs(["skillName23", "skillName24", "skillType23", "skillType24", "skillCP23", "skillCP24"], function(values) {
let destinationName = values.skillName24;
let sourceName = values.skillName23;
let destinationType = values.skillType24;
let sourceType = values.skillType23;
let destinationCP = values.skillCP24;
let sourceCP = values.skillCP23;
setAttrs({
"skillName24":sourceName,
"skillName23":destinationName,
"skillType24":sourceType,
"skillType23":destinationType,
"skillCP24":sourceCP,
"skillCP23":destinationCP
});
});
});
on("clicked:skillDown24 clicked:skillUp25", function () {
getAttrs(["skillName24", "skillName25", "skillType24", "skillType25", "skillCP24", "skillCP25"], function(values) {
let destinationName = values.skillName25;
let sourceName = values.skillName24;
let destinationType = values.skillType25;
let sourceType = values.skillType24;
let destinationCP = values.skillCP25;
let sourceCP = values.skillCP24;
setAttrs({
"skillName25":sourceName,
"skillName24":destinationName,
"skillType25":sourceType,
"skillType24":destinationType,
"skillCP25":sourceCP,
"skillCP24":destinationCP
});
});
});
on("clicked:skillDown25 clicked:skillUp26", function () {
getAttrs(["skillName25", "skillName26", "skillType25", "skillType26", "skillCP25", "skillCP26"], function(values) {
let destinationName = values.skillName26;
let sourceName = values.skillName25;
let destinationType = values.skillType26;
let sourceType = values.skillType25;
let destinationCP = values.skillCP26;
let sourceCP = values.skillCP25;
setAttrs({
"skillName26":sourceName,
"skillName25":destinationName,
"skillType26":sourceType,
"skillType25":destinationType,
"skillCP26":sourceCP,
"skillCP25":destinationCP
});
});
});
on("clicked:skillDown26 clicked:skillUp27", function () {
getAttrs(["skillName26", "skillName27", "skillType26", "skillType27", "skillCP26", "skillCP27"], function(values) {
let destinationName = values.skillName27;
let sourceName = values.skillName26;
let destinationType = values.skillType27;
let sourceType = values.skillType26;
let destinationCP = values.skillCP27;
let sourceCP = values.skillCP26;
setAttrs({
"skillName27":sourceName,
"skillName26":destinationName,
"skillType27":sourceType,
"skillType26":destinationType,
"skillCP27":sourceCP,
"skillCP26":destinationCP
});
});
});
on("clicked:skillDown27 clicked:skillUp28", function () {
getAttrs(["skillName27", "skillName28", "skillType27", "skillType28", "skillCP27", "skillCP28"], function(values) {
let destinationName = values.skillName28;
let sourceName = values.skillName27;
let destinationType = values.skillType28;
let sourceType = values.skillType27;
let destinationCP = values.skillCP28;
let sourceCP = values.skillCP27;
setAttrs({
"skillName28":sourceName,
"skillName27":destinationName,
"skillType28":sourceType,
"skillType27":destinationType,
"skillCP28":sourceCP,
"skillCP27":destinationCP
});
});
});
on("clicked:skillDown28 clicked:skillUp29", function () {
getAttrs(["skillName28", "skillName29", "skillType28", "skillType29", "skillCP28", "skillCP29"], function(values) {
let destinationName = values.skillName29;
let sourceName = values.skillName28;
let destinationType = values.skillType29;
let sourceType = values.skillType28;
let destinationCP = values.skillCP29;
let sourceCP = values.skillCP28;
setAttrs({
"skillName29":sourceName,
"skillName28":destinationName,
"skillType29":sourceType,
"skillType28":destinationType,
"skillCP29":sourceCP,
"skillCP28":destinationCP
});
});
});
on("clicked:skillDown29 clicked:skillUp30", function () {
getAttrs(["skillName29", "skillName30", "skillType29", "skillType30", "skillCP29", "skillCP30"], function(values) {
let destinationName = values.skillName30;
let sourceName = values.skillName29;
let destinationType = values.skillType30;
let sourceType = values.skillType29;
let destinationCP = values.skillCP30;
let sourceCP = values.skillCP29;
setAttrs({
"skillName30":sourceName,
"skillName29":destinationName,
"skillType30":sourceType,
"skillType29":destinationType,
"skillCP30":sourceCP,
"skillCP29":destinationCP
});
});
});
on("clicked:skillDown30 clicked:skillUp01", function () {
getAttrs(["skillName30", "skillName01", "skillType30", "skillType01", "skillCP30", "skillCP01"], function(values) {
let destinationName = values.skillName01;
let sourceName = values.skillName30;
let destinationType = values.skillType01;
let sourceType = values.skillType30;
let destinationCP = values.skillCP01;
let sourceCP = values.skillCP30;
setAttrs({
"skillName01":sourceName,
"skillName30":destinationName,
"skillType01":sourceType,
"skillType30":destinationType,
"skillCP01":sourceCP,
"skillCP30":destinationCP
});
});
});
/* ------------------- */
/* Skill Updaters */
/* ------------------- */
/* Skill set 01-10 */
on("change:skillType01 change:skillCP01 change:skillType02 change:skillCP02 change:skillType03 change:skillCP03 change:skillType04 change:skillCP04 change:skillType05 change:skillCP05 change:skillType06 change:skillCP06 change:skillType07 change:skillCP07 change:skillType08 change:skillCP08 change:skillType09 change:skillCP09 change:skillType10 change:skillCP10 change:enhancerJack change:enhancerSch change:enhancerSci change:enhancerTrav change:strengthChance change:dexterityChance change:constitutionChance change:intelligenceChance change:egoChance change:presenceChance change:interactionLevels change:intellectLevels change:agilityLevels change:noncombatLevels change:overallLevels", function() {
//
// The sandbox makes calculating the skill roll chance of general skills messy. All of these modifiers need to be accessed and checked for changes.
// Group levels are handled by slotting into skills 01 and 05. A player will need to organize the three skills that the group levels apply into
// the three lines below the desired group level.
//
getAttrs(["skillType01","skillCP01","skillType02","skillCP02","skillType03","skillCP03","skillType04","skillCP04","skillType05","skillCP05","skillType06","skillCP06","skillType07","skillCP07","skillType08","skillCP08","skillType09","skillCP09","skillType10","skillCP10","enhancerJack","enhancerSch","enhancerSci","enhancerTrav","strengthChance","dexterityChance","constitutionChance","intelligenceChance","egoChance","presenceChance","interactionLevels","intellectLevels","agilityLevels","noncombatLevels","overallLevels"], function(values) {
// Skill 01
let bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance01=calculateSkillChance(values.skillType01, (parseInt(values.skillCP01)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 02
// Bonus Levels for Skills 02, 03, and 04 may include group levels if Skill 01 is of type "group".
if (values.skillType01==="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP01))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance02=calculateSkillChance(values.skillType02, (parseInt(values.skillCP02)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 03
let skillRollChance03=calculateSkillChance(values.skillType03, (parseInt(values.skillCP03)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 04
let skillRollChance04=calculateSkillChance(values.skillType04, (parseInt(values.skillCP04)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 05
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance05=calculateSkillChance(values.skillType05, (parseInt(values.skillCP05)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 06
// Bonus Levels for Skills 06, 07, and 08 may include group levels if Skill 05 is of type "group".
if (values.skillType05=="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP05))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance06=calculateSkillChance(values.skillType06, (parseInt(values.skillCP06)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 07
let skillRollChance07=calculateSkillChance(values.skillType07, (parseInt(values.skillCP07)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 08
let skillRollChance08=calculateSkillChance(values.skillType08, (parseInt(values.skillCP08)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 09
// Skills 09 and 10 aren't available for group levels.
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance09=calculateSkillChance(values.skillType09, (parseInt(values.skillCP09)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 10
let skillRollChance10=calculateSkillChance(values.skillType10, (parseInt(values.skillCP10)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill Set 1 total character point cost
let setSkillsCost=(parseInt(values.skillCP01)||0)+(parseInt(values.skillCP02)||0)+(parseInt(values.skillCP03)||0)+(parseInt(values.skillCP04)||0)+(parseInt(values.skillCP05)||0)+(parseInt(values.skillCP06)||0)+(parseInt(values.skillCP07)||0)+(parseInt(values.skillCP08)||0)+(parseInt(values.skillCP09)||0)+(parseInt(values.skillCP10)||0);
// Assign calculated skill rolls.
setAttrs({
"skillRollChance01":skillRollChance01,
"skillRollChance02":skillRollChance02,
"skillRollChance03":skillRollChance03,
"skillRollChance04":skillRollChance04,
"skillRollChance05":skillRollChance05,
"skillRollChance06":skillRollChance06,
"skillRollChance07":skillRollChance07,
"skillRollChance08":skillRollChance08,
"skillRollChance09":skillRollChance09,
"skillRollChance10":skillRollChance10,
"hiddenSet1SkillsCost":setSkillsCost
});
});
});
/* Skill set 11-20 */
on("change:skillType11 change:skillCP11 change:skillType12 change:skillCP12 change:skillType13 change:skillCP13 change:skillType14 change:skillCP14 change:skillType15 change:skillCP15 change:skillType16 change:skillCP16 change:skillType17 change:skillCP17 change:skillType18 change:skillCP18 change:skillType19 change:skillCP19 change:skillType20 change:skillCP20 change:enhancerJack change:enhancerSch change:enhancerSci change:enhancerTrav change:strengthChance change:dexterityChance change:constitutionChance change:intelligenceChance change:egoChance change:presenceChance change:interactionLevels change:intellectLevels change:agilityLevels change:noncombatLevels change:overallLevels", function() {
//
// The sandbox makes calculating the skill roll chance of general skills messy. All of these modifiers need to be accessed and checked for changes.
// Group levels are handled by slotting into skills 11 and 15. A player will need to organize the three skills that the group levels apply into
// the three lines below the desired group level.
//
getAttrs(["skillType11","skillCP11","skillType12","skillCP12","skillType13","skillCP13","skillType14","skillCP14","skillType15","skillCP15","skillType16","skillCP16","skillType17","skillCP17","skillType18","skillCP18","skillType19","skillCP19","skillType20","skillCP20","enhancerJack","enhancerSch","enhancerSci","enhancerTrav","strengthChance","dexterityChance","constitutionChance","intelligenceChance","egoChance","presenceChance","interactionLevels","intellectLevels","agilityLevels","noncombatLevels","overallLevels"], function(values) {
// Skill 11
let bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance11=calculateSkillChance(values.skillType11, (parseInt(values.skillCP11)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 12
// Bonus Levels for Skills 12, 13, and 14 may include group levels if Skill 11 is of type "group".
if (values.skillType11==="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP11))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance12=calculateSkillChance(values.skillType12, (parseInt(values.skillCP12)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 13
let skillRollChance13=calculateSkillChance(values.skillType13, (parseInt(values.skillCP13)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 14
let skillRollChance14=calculateSkillChance(values.skillType14, (parseInt(values.skillCP14)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 15
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance15=calculateSkillChance(values.skillType15, (parseInt(values.skillCP15)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 16
// Bonus Levels for Skills 16, 17, and 18 may include group levels if Skill 15 is of type "group".
if (values.skillType15==="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP15))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance16=calculateSkillChance(values.skillType16, (parseInt(values.skillCP16)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 17
let skillRollChance17=calculateSkillChance(values.skillType17, (parseInt(values.skillCP17)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 18
let skillRollChance18=calculateSkillChance(values.skillType18, (parseInt(values.skillCP18)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 19
// Skills 19 and 20 aren't available for group levels.
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance19=calculateSkillChance(values.skillType19, (parseInt(values.skillCP19)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 20
let skillRollChance20=calculateSkillChance(values.skillType20, (parseInt(values.skillCP20)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill Set 2 total character point cost
let setSkillsCost=(parseInt(values.skillCP11)||0)+(parseInt(values.skillCP12)||0)+(parseInt(values.skillCP13)||0)+(parseInt(values.skillCP14)||0)+(parseInt(values.skillCP15)||0)+(parseInt(values.skillCP16)||0)+(parseInt(values.skillCP17)||0)+(parseInt(values.skillCP18)||0)+(parseInt(values.skillCP19)||0)+(parseInt(values.skillCP20)||0);
// Assign calculated skill rolls.
setAttrs({
"skillRollChance11":skillRollChance11,
"skillRollChance12":skillRollChance12,
"skillRollChance13":skillRollChance13,
"skillRollChance14":skillRollChance14,
"skillRollChance15":skillRollChance15,
"skillRollChance16":skillRollChance16,
"skillRollChance17":skillRollChance17,
"skillRollChance18":skillRollChance18,
"skillRollChance19":skillRollChance19,
"skillRollChance20":skillRollChance20,
"hiddenSet2SkillsCost":setSkillsCost
});
});
});
/* Skill set 21-30 */
on("change:skillType21 change:skillCP21 change:skillType22 change:skillCP22 change:skillType23 change:skillCP23 change:skillType24 change:skillCP24 change:skillType25 change:skillCP25 change:skillType26 change:skillCP26 change:skillType27 change:skillCP27 change:skillType28 change:skillCP28 change:skillType29 change:skillCP29 change:skillType30 change:skillCP30 change:enhancerJack change:enhancerSch change:enhancerSci change:enhancerTrav change:strengthChance change:dexterityChance change:constitutionChance change:intelligenceChance change:egoChance change:presenceChance change:interactionLevels change:intellectLevels change:agilityLevels change:noncombatLevels change:overallLevels", function() {
//
// The sandbox makes calculating the skill roll chance of general skills messy. All of these modifiers need to be accessed and checked for changes.
// Group levels are handled by slotting into skills 21 and 25. A player will need to organize the three skills that the group levels apply into
// the three lines below the desired group level.
//
getAttrs(["skillType21","skillCP21","skillType22","skillCP22","skillType23","skillCP23","skillType24","skillCP24","skillType25","skillCP25","skillType26","skillCP26","skillType27","skillCP27","skillType28","skillCP28","skillType29","skillCP29","skillType30","skillCP30","enhancerJack","enhancerSch","enhancerSci","enhancerTrav","strengthChance","dexterityChance","constitutionChance","intelligenceChance","egoChance","presenceChance","interactionLevels","intellectLevels","agilityLevels","noncombatLevels","overallLevels"], function(values) {
// Skill 21
let bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance21=calculateSkillChance(values.skillType21, (parseInt(values.skillCP21)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 22
// Bonus Levels for Skills 22, 23, and 24 may include group levels if Skill 21 is of type "group".
if (values.skillType21==="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP21))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance22=calculateSkillChance(values.skillType22, (parseInt(values.skillCP22)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 23
let skillRollChance23=calculateSkillChance(values.skillType23, (parseInt(values.skillCP23)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 24
let skillRollChance24=calculateSkillChance(values.skillType24, (parseInt(values.skillCP24)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 25
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance25=calculateSkillChance(values.skillType25, (parseInt(values.skillCP25)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 26
// Bonus Levels for Skills 26, 27, and 28 may include group levels if Skill 25 is of type "group".
if (values.skillType25==="group") {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0)+Math.floor((parseInt(values.skillCP25))/3);
} else {
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
}
let skillRollChance26=calculateSkillChance(values.skillType26, (parseInt(values.skillCP26)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 27
let skillRollChance27=calculateSkillChance(values.skillType27, (parseInt(values.skillCP27)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 28
let skillRollChance28=calculateSkillChance(values.skillType28, (parseInt(values.skillCP28)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 29
// Skills 29 and 30 aren't available for group levels.
bonusLevels=(parseInt(values.noncombatLevels)||0)+(parseInt(values.overallLevels)||0);
let skillRollChance29=calculateSkillChance(values.skillType29, (parseInt(values.skillCP29)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill 30
let skillRollChance30=calculateSkillChance(values.skillType30, (parseInt(values.skillCP30)||0), values.enhancerJack, values.enhancerSch, values.enhancerSci, values.enhancerTrav, (parseInt(values.strengthChance)||0), (parseInt(values.dexterityChance)||0), (parseInt(values.constitutionChance)||0), (parseInt(values.intelligenceChance)||0), (parseInt(values.egoChance)||0), (parseInt(values.presenceChance)||0), (parseInt(values.interactionLevels)||0), (parseInt(values.intellectLevels)||0), (parseInt(values.agilityLevels)||0), bonusLevels);
// Skill Set 3 total character point cost
let setSkillsCost=(parseInt(values.skillCP21)||0)+(parseInt(values.skillCP22)||0)+(parseInt(values.skillCP23)||0)+(parseInt(values.skillCP24)||0)+(parseInt(values.skillCP25)||0)+(parseInt(values.skillCP26)||0)+(parseInt(values.skillCP27)||0)+(parseInt(values.skillCP28)||0)+(parseInt(values.skillCP29)||0)+(parseInt(values.skillCP30)||0);
// Assign calculated skill rolls.
setAttrs({
"skillRollChance21":skillRollChance21,
"skillRollChance22":skillRollChance22,
"skillRollChance23":skillRollChance23,
"skillRollChance24":skillRollChance24,
"skillRollChance25":skillRollChance25,
"skillRollChance26":skillRollChance26,
"skillRollChance27":skillRollChance27,
"skillRollChance28":skillRollChance28,
"skillRollChance29":skillRollChance29,
"skillRollChance30":skillRollChance30,
"hiddenSet3SkillsCost":setSkillsCost
});
});
});
/* Combat Skills */
on("change:skillLevels31 change:skillType31 change:skillLevels32 change:skillType32 change:skillLevels33 change:skillType33 change:skillLevels34 change:skillType34 change:skillLevels35 change:skillType35 change:skillLevels36 change:skillType36 change:skillLevels37 change:skillType37 change:skillLevels38 change:skillLevels39 change:skillLevels40", function () {
//
// Calculation of combat skill costs is based on many user selections.
// If the skill is a weapon familiarity, the cost is either 1 CP (WF1) or 2 CP (WF2).
// If the selection is a skill level, the cost is determined by number of levels and the scope (single: 2, small group: 3, or large group: 5).
// The costs of general combat skills are calculated by the function calculateCombatSkillCost(..).
//
// Skill level costs for all HTH, all ranged, and all combat are calculated here without the calculateCombatSkillCost(..).
//
getAttrs(["skillLevels31", "skillType31", "skillLevels32", "skillType32", "skillLevels33", "skillType33", "skillLevels34", "skillType34", "skillLevels35", "skillType35", "skillLevels36", "skillType36", "skillLevels37", "skillType37", "skillLevels38","skillLevels39","skillLevels40"], function(values) {
// Skills 31-37 are general combat skills with costs determined by their skill type or levels.
let skill31Cost = calculateCombatSkillCost(values.skillType31, (parseInt(values.skillLevels31)||0) );
let skill32Cost = calculateCombatSkillCost(values.skillType32, (parseInt(values.skillLevels32)||0) );
let skill33Cost = calculateCombatSkillCost(values.skillType33, (parseInt(values.skillLevels33)||0) );
let skill34Cost = calculateCombatSkillCost(values.skillType34, (parseInt(values.skillLevels34)||0) );
let skill35Cost = calculateCombatSkillCost(values.skillType35, (parseInt(values.skillLevels35)||0) );
let skill36Cost = calculateCombatSkillCost(values.skillType36, (parseInt(values.skillLevels36)||0) );
let skill37Cost = calculateCombatSkillCost(values.skillType37, (parseInt(values.skillLevels37)||0) );
// Skill 38: All HTH Combat Levels cost 8 CP each.
let skill38Cost = 8*(parseInt(values.skillLevels38)||0);
// Skill 39: All Range Combat Levels cost 8 CP each.
let skill39Cost = 8*(parseInt(values.skillLevels39)||0);
// Skill 40: All Combat Levels cost 10 CP each.
let skill40Cost = 10*(parseInt(values.skillLevels40)||0);
let combatSkillsCost = skill31Cost+skill32Cost+skill33Cost+skill34Cost+skill35Cost+skill36Cost+skill37Cost+skill38Cost+skill39Cost+skill40Cost;
setAttrs({
"hiddenCombatSkillsCost":combatSkillsCost,
"skillCP31":skill31Cost,
"skillCP32":skill32Cost,
"skillCP33":skill33Cost,
"skillCP34":skill34Cost,
"skillCP35":skill35Cost,
"skillCP36":skill36Cost,
"skillCP37":skill37Cost,
"skillCP38":skill38Cost,
"skillCP39":skill39Cost,
"skillCP40":skill40Cost
});
});
});
function calculateCombatSkillCost(skillType,numberOfLevels) {
// Used to calculate costs of general combat skill and familiarities.
let skillBaseCost=0;
let skillLevelCost=0;
switch (skillType) {
case "none": skillLevelCost=0;
skillBaseCost = 0;
break;
case "Fam1": skillLevelCost=0;
skillBaseCost = 1;
break;
case "Fam2": skillLevelCost=0;
skillBaseCost = 2;
break;
case "CSL2": skillLevelCost=2;
skillBaseCost = 0;
break;
case "CSL3": skillLevelCost=3;
skillBaseCost = 0;
break;
case "CSL5": skillLevelCost=5;
skillBaseCost = 0;
break;
case "CSL8": skillLevelCost=8;
skillBaseCost = 0;
break;
case "PSL1": skillLevelCost=1;
skillBaseCost = 0;
break;
case "PSL2": skillLevelCost=2;
skillBaseCost = 0;
break;
case "PSL3": skillLevelCost=3;
skillBaseCost = 0;
break;
default: skillLevelCost=0;
skillBaseCost = 0;
break;
}
return skillBaseCost+numberOfLevels*skillLevelCost;
}
/* Language Skills */
on("change:enhancerLing change:skillFluency41 change:skillLiteracy41 change:skillFluency42 change:skillLiteracy42 change:skillFluency43 change:skillLiteracy43 change:skillFluency44 change:skillLiteracy44 change:skillFluency45 change:skillLiteracy45 change:skillFluency46 change:skillLiteracy46 change:skillFluency47 change:skillLiteracy47 change:skillFluency48 change:skillLiteracy48 change:skillFluency49 change:skillLiteracy49, optionLiteracyCostsPoints", function () {
// Language skills are relatively simple without levels or roll calculations. The linguist enhancer is the only complication.
// All calculations handled by the function calculateLanguageSkillCost(...).
getAttrs(["enhancerLing", "skillFluency41","skillLiteracy41", "skillFluency42","skillLiteracy42", "skillFluency43","skillLiteracy43", "skillFluency44","skillLiteracy44", "skillFluency45","skillLiteracy45", "skillFluency46","skillLiteracy46", "skillFluency47","skillLiteracy47", "skillFluency48","skillLiteracy48", "skillFluency49","skillLiteracy49","optionLiteracyCostsPoints"], function(values) {
const linguist = values.enhancerLing;
let literacyCost = 0;
if (values.optionLiteracyCostsPoints!=0) {
literacyCost = 1;
}
let skill41Cost = calculateLanguageSkillCost( values.skillFluency41 , values.skillLiteracy41, linguist, literacyCost);
let skill42Cost = calculateLanguageSkillCost( values.skillFluency42 , values.skillLiteracy42, linguist, literacyCost);
let skill43Cost = calculateLanguageSkillCost( values.skillFluency43 , values.skillLiteracy43, linguist, literacyCost);
let skill44Cost = calculateLanguageSkillCost( values.skillFluency44 , values.skillLiteracy44, linguist, literacyCost);
let skill45Cost = calculateLanguageSkillCost( values.skillFluency45 , values.skillLiteracy45, linguist, literacyCost);
let skill46Cost = calculateLanguageSkillCost( values.skillFluency46 , values.skillLiteracy46, linguist, literacyCost);
let skill47Cost = calculateLanguageSkillCost( values.skillFluency47 , values.skillLiteracy47, linguist, literacyCost);
let skill48Cost = calculateLanguageSkillCost( values.skillFluency48 , values.skillLiteracy48, linguist, literacyCost);
let skill49Cost = calculateLanguageSkillCost( values.skillFluency49 , values.skillLiteracy49, linguist, literacyCost);
let totalLanguageCosts = skill41Cost+skill42Cost+skill43Cost+skill44Cost+skill45Cost+skill46Cost+skill47Cost+skill48Cost+skill49Cost;
setAttrs({
"hiddenLanguageSkillsCost":totalLanguageCosts,
"skillCP41":skill41Cost,
"skillCP42":skill42Cost,
"skillCP43":skill43Cost,
"skillCP44":skill44Cost,
"skillCP45":skill45Cost,
"skillCP46":skill46Cost,
"skillCP47":skill47Cost,
"skillCP48":skill48Cost,
"skillCP49":skill49Cost
});
});
});
/* Skill Enhancers and wide-scope noncombat levels */
on("change:enhancerJack change:enhancerLing change:enhancerSch change:enhancerSci change:enhancerTrav change:enhancerWell change:interactionLevels change:intellectLevels change:agilityLevels change:noncombatLevels change:overallLevels", function () {
// If any of the enhancers or wide-scope noncombat levels change (anything in the lower right skill block) recalculate their costs.
// Because enhancers lower the costs of other skills and wide-scope levels change the rolls of other other skills, the
// non-combat skills 01-30 will have their costs and roll chances recalculated as well.
getAttrs(["enhancerJack","enhancerLing","enhancerSch","enhancerSci","enhancerTrav","enhancerWell","interactionLevels","intellectLevels","agilityLevels","noncombatLevels","overallLevels"], function(values) {
// Check for purchased enhancers and assign costs of 3 CP for each.
const enhancerJackStatus=values.enhancerJack;
const enhancerLingStatus=values.enhancerLing;
const enhancerSchStatus=values.enhancerSch;
const enhancerSciStatus=values.enhancerSci;
const enhancerTravStatus=values.enhancerTrav;
const enhancerWellStatus=values.enhancerWell;
let enhancerJackCost = 0;
let enhancerLingCost = 0;
let enhancerSchCost = 0;
let enhancerSciCost = 0;
let enhancerTravCost = 0;
let enhancerWellCost = 0;
if (enhancerJackStatus!=0) {
enhancerJackCost = 3;
}
if (enhancerLingStatus!=0) {
enhancerLingCost = 3;
}
if (enhancerSchStatus!=0) {
enhancerSchCost = 3;
}
if (enhancerSciStatus!=0) {
enhancerSciCost = 3;
}
if (enhancerTravStatus!=0) {
enhancerTravCost = 3;
}
if (enhancerWellStatus!=0) {
enhancerWellCost = 3;
}
setAttrs({
"enhancerJackCP":enhancerJackCost,
"enhancerLingCP":enhancerLingCost,
"enhancerSchCP":enhancerSchCost,
"enhancerSciCP":enhancerSciCost,
"enhancerWellCP":enhancerWellCost,
"enhancerTravCP":enhancerTravCost
});
// Calculate costs for each wide-scope non-combat level.
const interactionSkillLevels=parseInt(values.interactionLevels)||0;
const intellectSkillLevels=parseInt(values.intellectLevels)||0;
const agilitySkillLevels=parseInt(values.agilityLevels)||0;
const noncombatSkillLevels=parseInt(values.noncombatLevels)||0;
const overallSkillLevels=parseInt(values.overallLevels)||0;
let interactionSkillLevelsCost= interactionSkillLevels*4;
let intellectSkillLevelsCost= intellectSkillLevels*4;
let agilitySkillLevelsCost= agilitySkillLevels*6;
let noncombatSkillLevelsCost= noncombatSkillLevels*10;
let overallSkillLevelsCost= overallSkillLevels*12;
setAttrs({
"interactionLevelsCP":interactionSkillLevelsCost,
"intellectLevelsCP":intellectSkillLevelsCost,
"agilityLevelsCP":agilitySkillLevelsCost,
"noncombatLevelsCP":noncombatSkillLevelsCost,
"overallLevelsCP":overallSkillLevelsCost
});
skillEnhancersCost = enhancerJackCost+enhancerLingCost+enhancerSchCost+enhancerSciCost+enhancerTravCost+enhancerWellCost;
skillLevelsCost=interactionSkillLevelsCost+intellectSkillLevelsCost+agilitySkillLevelsCost+noncombatSkillLevelsCost+overallSkillLevelsCost;
setAttrs({
"hiddenEnhancerSkillsCost":skillEnhancersCost+skillLevelsCost,
});
//addSkillPoints();
});
});
/* Martial Skills, which are entered in the Gear Section */
on("change:martialManeuverCP01 change:martialManeuverCP02 change:martialManeuverCP03 change:martialManeuverCP04 change:martialManeuverCP05 change:martialManeuverCP06", function () {
// Martial maneuver skills are not dependent on other attributes or skills.
getAttrs(["martialManeuverCP01", "martialManeuverCP02","martialManeuverCP03", "martialManeuverCP04","martialManeuverCP05", "martialManeuverCP06"], function(values) {
let martialManeuver01Cost = parseInt(values.martialManeuverCP01)||0;
let martialManeuver02Cost = parseInt(values.martialManeuverCP02)||0;
let martialManeuver03Cost = parseInt(values.martialManeuverCP03)||0;
let martialManeuver04Cost = parseInt(values.martialManeuverCP04)||0;
let martialManeuver05Cost = parseInt(values.martialManeuverCP05)||0;
let martialManeuver06Cost = parseInt(values.martialManeuverCP06)||0;
let totalMartialManeuversCost = martialManeuver01Cost+martialManeuver02Cost+martialManeuver03Cost+martialManeuver04Cost+martialManeuver05Cost+martialManeuver06Cost;
setAttrs({
"hiddenMartialSkillsCost":totalMartialManeuversCost
});
});
});
/* -------------------------------------------------- */
/* Functions used for gear tab */
/* -------------------------------------------------- */
/* Calculate weapon endurance costs */
on("change:optionSuperHeroicEndurance change:weaponStrength01 change:weaponStrength02 change:weaponStrength03 change:weaponStrength04 change:weaponStrength05 change:shieldStrength", function() {
getAttrs(["optionSuperHeroicEndurance", "weaponStrength01","weaponStrength02","weaponStrength03","weaponStrength04","weaponStrength05","shieldStrength"], function(values) {
// If optionSuperHeroicEndurance is true, endurance cost is 1 per 5 strength, otherwise it is 1 per 10 strength used.
optionSuperHeroic = values.optionSuperHeroicEndurance;
let enduranceCostFactor = 10;
if (optionSuperHeroic != 0) {
enduranceCostFactor=5;
}
let enduranceCost01= heroRoundLow( (parseInt(values.weaponStrength01)||0)/enduranceCostFactor );
if ( (enduranceCost01<1) && (parseInt(values.weaponStrength01)||0)>0) {
enduranceCost01=1
}
let enduranceCost02= heroRoundLow( (parseInt(values.weaponStrength02)||0)/enduranceCostFactor );
if ( (enduranceCost02<1) && (parseInt(values.weaponStrength02)||0)>0) {
enduranceCost02=1
}
let enduranceCost03= heroRoundLow( (parseInt(values.weaponStrength03)||0)/enduranceCostFactor );
if ( (enduranceCost03<1) && (parseInt(values.weaponStrength03)||0)>0) {
enduranceCost03=1
}
let enduranceCost04= heroRoundLow( (parseInt(values.weaponStrength04)||0)/enduranceCostFactor );
if ( (enduranceCost04<1) && (parseInt(values.weaponStrength04)||0)>0) {
enduranceCost04=1
}
let enduranceCost05= heroRoundLow( (parseInt(values.weaponStrength05)||0)/enduranceCostFactor );
if ( (enduranceCost05<1) && (parseInt(values.weaponStrength05)||0)>0) {
enduranceCost05=1
}
let enduranceCostShield= heroRoundLow( (parseInt(values.shieldStrength)||0)/enduranceCostFactor );
if ( (enduranceCostShield<1) && (parseInt(values.shieldStrength)||0)>0) {
enduranceCostShield=1
}
setAttrs({
"weaponEndurance01":enduranceCost01,
"weaponEndurance02":enduranceCost02,
"weaponEndurance03":enduranceCost03,
"weaponEndurance04":enduranceCost04,
"weaponEndurance05":enduranceCost05,
"shieldEndurance":enduranceCostShield
});
});
});
/* Gear Tab sum up equipment weight */
on("change:liftWeight change:armorEND01 change:armorEND02 change:armorEND03 change:armorEND04 change:armorMass01 change:armorMass01 change:armorMass02 change:armorMass03 change:armorMass04 change:shieldMass change:weaponMass01 change:weaponMass02 change:weaponMass03 change:weaponMass04 change:weaponMass05 change:equipMass01 change:equipMass02 change:equipMass03 change:equipMass04 change:equipMass05 change:equipMass06 change:equipMass07 change:equipMass08 change:equipMass09 change:equipMass10 change:equipMass11 change:equipMass12 change:equipMass13 change:equipMass14 change:equipMass15 change:equipMass16", function () {
// Add the masses of all items of equipment.
// Determine END used per turn, DCV/DEX roll penalty, and Movement Penalty.
getAttrs(["liftWeight","armorEND01","armorEND02","armorEND03","armorEND04","armorMass01","armorMass02","armorMass03","armorMass04","shieldMass", "weaponMass01", "weaponMass02", "weaponMass03", "weaponMass04", "weaponMass05", "equipMass01", "equipMass02", "equipMass03", "equipMass04", "equipMass05", "equipMass06", "equipMass07", "equipMass08", "equipMass09", "equipMass10", "equipMass11", "equipMass12", "equipMass13", "equipMass14", "equipMass15", "equipMass16"], function(values) {
// Add up carried mass
armorCarried=(parseFloat(values.armorMass01)||0)+(parseFloat(values.armorMass02)||0)+(parseFloat(values.armorMass03)||0)+(parseFloat(values.armorMass04)||0)+(parseFloat(values.shieldMass)||0);
weaponsCarried=(parseFloat(values.weaponMass01)||0)+(parseFloat(values.weaponMass02)||0)+(parseFloat(values.weaponMass03)||0)+(parseFloat(values.weaponMass04)||0)+(parseFloat(values.weaponMass05)||0);
equipmentCarried=(parseFloat(values.equipMass01)||0)+(parseFloat(values.equipMass02)||0)+(parseFloat(values.equipMass03)||0)+(parseFloat(values.equipMass04)||0)+(parseFloat(values.equipMass05)||0)+(parseFloat(values.equipMass06)||0)+(parseFloat(values.equipMass07)||0)+(parseFloat(values.equipMass08)||0)+(parseFloat(values.equipMass09)||0)+(parseFloat(values.equipMass10)||0)+(parseFloat(values.equipMass11)||0)+(parseFloat(values.equipMass12)||0)+(parseFloat(values.equipMass13)||0)+(parseFloat(values.equipMass14)||0)+(parseFloat(values.equipMass15)||0)+(parseFloat(values.equipMass16)||0);
carriedWeight=armorCarried+weaponsCarried+equipmentCarried;
carriedWeight=Math.floor(10*carriedWeight)/10;
// Determine penalties
const lift=(parseFloat(values.liftWeight)||0);
const armorENDcost = (parseInt(values.armorEND01)||0)+(parseInt(values.armorEND02)||0)+(parseInt(values.armorEND03)||0)+(parseInt(values.armorEND04)||0);
let enduranceCost=0;
let dexPenalty=0;
let movePenalty=0;
if (carriedWeight<=lift*0.1) {
dexPenalty=0;
enduranceCost=0+armorENDcost;
movePenalty=0;
} else if (carriedWeight<=lift*0.24) {
dexPenalty=-1;
enduranceCost=0+armorENDcost;
movePenalty=0;
} else if (carriedWeight<=lift*0.49) {
dexPenalty=-2;
enduranceCost=1+armorENDcost;
movePenalty=-2;
} else if (carriedWeight<=lift*0.74) {
dexPenalty=-3;
enduranceCost=2+armorENDcost;
movePenalty=-4;
} else if (carriedWeight<=lift*0.89) {
dexPenalty=-4;
enduranceCost=3+armorENDcost;
movePenalty=-8;
} else {
dexPenalty=-5;
enduranceCost=4+armorENDcost;
movePenalty=-16;
}
setAttrs({
"carriedWeight":carriedWeight,
"weightEndPenalty":enduranceCost,
"weightDexDCVPenalty":dexPenalty,
"weightMovePenalty":movePenalty
});
});
});
// Open with first tab (thanks to GiGs)
on("sheet:opened", function() {
setAttrs({sheetTab:"characteristics"});
});
/* ------------------------------------------------ */
/* --- Weapon Attacks and Hit Location Helpers --- */
/* ------------------------------------------------ */
// Update weaponOCVPenalty01
on("change:optionHitLocationSystem change:targetSelection change:weaponAreaEffect01 change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","weaponAreaEffect01","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect01;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
// For some reason I couldn't get this switch function work in an independent function. Will have to suffer with the extra space needed.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for weapon01
setAttrs({
"weaponOCVPenalty01":penalty
});
});
});
// Update weaponOCVPenalty02
on("change:optionHitLocationSystem change:targetSelection change:weaponAreaEffect02 change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","weaponAreaEffect02","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect02;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for weapon02
setAttrs({
"weaponOCVPenalty02":penalty
});
});
});
// Update weaponOCVPenalty03
on("change:optionHitLocationSystem change:targetSelection change:weaponAreaEffect03 change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","weaponAreaEffect03","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect03;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for weapon03
setAttrs({
"weaponOCVPenalty03":penalty
});
});
});
// Update weaponOCVPenalty04
on("change:optionHitLocationSystem change:targetSelection change:weaponAreaEffect04 change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","weaponAreaEffect04","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect04;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for weapon04
setAttrs({
"weaponOCVPenalty04":penalty
});
});
});
// Update weaponOCVPenalty05
on("change:optionHitLocationSystem change:targetSelection change:weaponAreaEffect05 change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","weaponAreaEffect05","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect05;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for weapon05
setAttrs({
"weaponOCVPenalty05":penalty
});
});
});
// Update targetOCVpenalty. No area of effect complication. Used for shield and basic attacks.
on("change:optionHitLocationSystem change:targetSelection change:halveTargetOCVpenalty change:penaltySkillLevels", function () {
getAttrs(["optionHitLocationSystem","targetSelection","halveTargetOCVpenalty","penaltySkillLevels"], function(values) {
let penalty = 0;
let useHitLocations = values.optionHitLocationSystem;
let targetSelectionType = parseInt(values.targetSelection)||1;
let halveTargetPenalty = values.halveTargetOCVpenalty;
let penaltySkillLevels = parseInt(values.penaltySkillLevels)||0;
if (useHitLocations != 0) {
switch (targetSelectionType) {
case 1: penalty = 0;
break;
case 2: penalty = -8;
break;
case 3: penalty = -6;
break;
case 4: penalty = -5;
break;
case 5: penalty = -5;
break;
case 6: penalty = -3;
break;
case 7: penalty = -7;
break;
case 8: penalty = -8;
break;
case 9: penalty = -4;
break;
case 10: penalty = -6;
break;
case 11: penalty = -8;
break;
case 12: penalty = -4;
break;
case 13: penalty = -2;
break;
case 14: penalty = -1;
break;
case 15: penalty = -2;
break;
case 16: penalty = -4;
break;
default: penalty = 0;
};
if (halveTargetPenalty != 0) {
penalty = heroRoundHigh(penalty/2);
}
// Apply penalty skill levels.
penalty = penalty+penaltySkillLevels;
// The net penaly cannot be positive.
if (penalty>0) {
penalty=0;
}
}
// Update OCV penalty for the shield
setAttrs({
"targetOCVpenalty":penalty
});
});
});
function killingHitLocation(targetSelection) {
// Used to determine hit location message and stun multiplier of Killing Attacks.
var theHitLocation = new Object();
// From the targeting selection determine the target roll:
switch (targetSelection) {
//Standard attack.
case 1: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1);
break;
// Head (3-5)
case 2: theHitLocation.roll = Math.floor(Math.random()*3+1)+2;
break;
// Hands (6)
case 3: theHitLocation.roll = 6;
break;
// Arms (7-8)
case 4: theHitLocation.roll = Math.floor(Math.random()*2+1)+6;
break;
// Shoulders (9)
case 5: theHitLocation.roll = 9;
break;
// Shoulders (10-11)
case 6: theHitLocation.roll = Math.floor(Math.random()*2+1)+9;
break;
// Stomach (12)
case 7: theHitLocation.roll = 12;
break;
// Vitals (13)
case 8: theHitLocation.roll = 13;
break;
// Thighs (14)
case 9: theHitLocation.roll = 14;
break;
// Legs (15-16)
case 10: theHitLocation.roll = Math.floor(Math.random()*2+1)+14;
break;
// Feet (17-18)
case 11: theHitLocation.roll = Math.floor(Math.random()*2+1)+16;
break;
// Head Shot (1d6+3)
case 12: theHitLocation.roll = Math.floor(Math.random()*6+1)+3;
break;
// High Shot (2d6+1)
case 13: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+1;
break;
// Body Shot (2d6+4)
case 14: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+4;
break;
// Low Shot (2d6+7)
case 15: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+7;
break;
// Leg Shot (1d6+12)
case 16: theHitLocation.roll = Math.floor(Math.random()*6+1)+12;
break;
// Default 3d6
default: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1);
}
// Determine target location and stun multiplier.
switch (theHitLocation.roll) {
case 3: theMessage = ": Head(3) BODYx2";
theSTUNmultiplier = 5;
break;
case 4: theMessage = ": Head(4) BODYx2";
theSTUNmultiplier = 5;
break;
case 5: theMessage = ": Head(5) BODYx2";
theSTUNmultiplier = 5;
break;
case 6: theMessage = ": Hands(6) BODY/2";
theSTUNmultiplier = 1;
break;
case 7: theMessage = ": Arms(7) BODY/2";
theSTUNmultiplier = 1;
break;
case 8: theMessage = ": Arms(8) BODY/2";
theSTUNmultiplier = 2;
break;
case 9: theMessage = ": Shoulders(9) BODYx1";
theSTUNmultiplier = 3;
break;
case 10: theMessage = ": Chest(10) BODYx1";
theSTUNmultiplier = 3;
break;
case 11: theMessage = ": Chest(11) BODYx1";
theSTUNmultiplier = 3;
break;
case 12: theMessage = ": Stomach(12) BODYx1";
theSTUNmultiplier = 4;
break;
case 13: theMessage = ": Vitals(13) BODYx2";
theSTUNmultiplier = 4;
break;
case 14: theMessage = ": Thighs(14) BODYx1";
theSTUNmultiplier = 2;
break;
case 15: theMessage = ": Legs(15) BODY/2";
theSTUNmultiplier = 2;
break;
case 16: theMessage = ": Legs(16) BODY/2";
theSTUNmultiplier = 2;
break;
case 17: theMessage = ": Feet(17) BODY/2";
theSTUNmultiplier = 1;
break;
case 18: theMessage = ": Feet(18) BODY/2";
theSTUNmultiplier = 1;
break;
default: theMessage = ": Feet(18) BODY/2";
theSTUNmultiplier = 1;
}
theHitLocation.stunMultiplier=theSTUNmultiplier;
theHitLocation.message=theMessage;
return theHitLocation;
}
function normalHitLocation(targetSelection) {
// Used to determine hit location message of normal attacks.
var theHitLocation = new Object();
// From the targeting selection determine the target roll:
switch (targetSelection) {
//Standard attack.
case 1: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1);
break;
// Head (3-5)
case 2: theHitLocation.roll = Math.floor(Math.random()*3+1)+2;
break;
// Hands (6)
case 3: theHitLocation.roll = 6;
break;
// Arms (7-8)
case 4: theHitLocation.roll = Math.floor(Math.random()*2+1)+6;
break;
// Shoulders (9)
case 5: theHitLocation.roll = 9;
break;
// Shoulders (10-11)
case 6: theHitLocation.roll = Math.floor(Math.random()*2+1)+9;
break;
// Stomach (12)
case 7: theHitLocation.roll = 12;
break;
// Vitals (13)
case 8: theHitLocation.roll = 13;
break;
// Thighs (14)
case 9: theHitLocation.roll = 14;
break;
// Legs (15-16)
case 10: theHitLocation.roll = Math.floor(Math.random()*2+1)+14;
break;
// Feet (17-18)
case 11: theHitLocation.roll = Math.floor(Math.random()*2+1)+16;
break;
// Head Shot (1d6+3)
case 12: theHitLocation.roll = Math.floor(Math.random()*6+1)+3;
break;
// High Shot (2d6+1)
case 13: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+1;
break;
// Body Shot (2d6+4)
case 14: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+4;
break;
// Low Shot (2d6+7)
case 15: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+7;
break;
// Leg Shot (1d6+12)
case 16: theHitLocation.roll = Math.floor(Math.random()*6+1)+12;
break;
// Default 3d6
default: theHitLocation.roll = Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1)+Math.floor(Math.random()*6+1);
}
// Determine target location and stun multiplier.
switch (theHitLocation.roll) {
case 3: theMessage = ": Head(3) Sx2 Bx2";
break;
case 4: theMessage = ": Head(4) Sx2 Bx2";
break;
case 5: theMessage = ": Head(5) Sx2 Bx2";
break;
case 6: theMessage = ": Hands(6) S/2 B/2";
break;
case 7: theMessage = ": Arms(7) S/2 B/2";
break;
case 8: theMessage = ": Arms(8) S/2 B/2";
break;
case 9: theMessage = ": Shoulders(9) Sx1 Bx1";
break;
case 10: theMessage = ": Chest(10) Sx1 Bx1";
break;
case 11: theMessage = ": Chest(11) Sx1 Bx1";
break;
case 12: theMessage = ": Stomach(12) 3S/2 Bx1";
break;
case 13: theMessage = ": Vitals(13) 3S/2 Bx2";
break;
case 14: theMessage = ": Thighs(14) Sx1 Bx1";
break;
case 15: theMessage = ": Legs(15) S/2 B/2";
break;
case 16: theMessage = ": Legs(16) S/2 B/2";
break;
case 17: theMessage = ": Feet(17) S/2 B/2";
break;
case 18: theMessage = ": Feet(18) S/2 B/2";
break;
default: theMessage = ": No Location";
}
theHitLocation.message=theMessage;
return theHitLocation;
}
/* ------------------------ */
/* --- Weapon Attacks --- */
/* ------------------------ */
on("change:shieldDamage change:weaponDamage01 change:weaponDamage02 change:weaponDamage03 change:weaponDamage04 change:weaponDamage05 change:strength", function () {
// This function attempts to clean damage text input into text more likely to be rollable dice.
// Only characters 0-9, d, D, +, and - are passed to attack rolls.
getAttrs(["shieldDamage","weaponDamage01","weaponDamage02","weaponDamage03","weaponDamage04","weaponDamage05","strength"], function(values) {
var theShieldDamage=values.shieldDamage;
theShieldDamage=theShieldDamage.replace(/[^\ddD\\+\\-]/g,"");
var theWeaponDamage01=values.weaponDamage01;
theWeaponDamage01=theWeaponDamage01.replace(/[^\ddD\\+\\-]/g,"");
var theWeaponDamage02=values.weaponDamage02;
theWeaponDamage02=theWeaponDamage02.replace(/[^\ddD\\+\\-]/g,"");
var theWeaponDamage03=values.weaponDamage03;
theWeaponDamage03=theWeaponDamage03.replace(/[^\ddD\\+\\-]/g,"");
var theWeaponDamage04=values.weaponDamage04;
theWeaponDamage04=theWeaponDamage04.replace(/[^\ddD\\+\\-]/g,"");
var theWeaponDamage05=values.weaponDamage05;
theWeaponDamage05=theWeaponDamage05.replace(/[^\ddD\\+\\-]/g,"");
// Calculate basic strength damage dice and create a roll20 dice string of d6s and d3s.
let theStrength=parseInt(values.strength)||0;
let theNumberOfD6=(parseInt((theStrength-(theStrength%5))/5)||0).toString();
let theNumberOfD3=0;
if (theStrength%5>2) {
theNumberOfD3=1;
}
var theStrengthDamage=theNumberOfD6.concat("d6+",theNumberOfD3.toString(),"d3");
setAttrs({
hiddenShieldDamage01:theShieldDamage,
hiddenWeaponDamage01:theWeaponDamage01,
hiddenWeaponDamage02:theWeaponDamage02,
hiddenWeaponDamage03:theWeaponDamage03,
hiddenWeaponDamage04:theWeaponDamage04,
hiddenWeaponDamage05:theWeaponDamage05,
hiddenManeuverDamage01:theStrengthDamage
});
});
});
on('clicked:attackWeapon01', (info) => {
// Roll attack and damage dice for Weapon 01.
// First determine if the weapon does normal or killing damage.
getAttrs(["weaponNormalDamage01", "optionAutoSubtractEND", "weaponEndurance01"], function(values) {
let isNormalDamage = values.weaponNormalDamage01;
let autoSubtractEND = values.optionAutoSubtractEND;
let weaponEND = parseInt(values.weaponEndurance01)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{weaponName01}}} {{OCV=[[?{Modifier|0}+@{weaponOCV01}+@{weaponOCVPenalty01}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenWeaponDamage01}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "weaponAreaEffect01", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect01;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
} else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{weaponName01}}} {{OCV=[[?{Modifier|0}+@{weaponOCV01}+@{weaponOCVPenalty01}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenWeaponDamage01}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
getAttrs(["optionHitLocationSystem", "weaponStunMod01", "weaponAreaEffect01", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect01;
let theSTUNmodifier = parseInt(values.weaponStunMod01)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:attackWeapon02', (info) => {
// Roll attack and damage dice for Weapon 02.
// First determine if the weapon does normal or killing damage.
getAttrs(["weaponNormalDamage02", "optionAutoSubtractEND", "weaponEndurance02"], function(values) {
let isNormalDamage = values.weaponNormalDamage02;
let autoSubtractEND = values.optionAutoSubtractEND;
let weaponEND = parseInt(values.weaponEndurance02)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{weaponName02}}} {{OCV=[[?{Modifier|0}+@{weaponOCV02}+@{weaponOCVPenalty02}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenWeaponDamage02}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "weaponAreaEffect02", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect02;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
} else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{weaponName02}}} {{OCV=[[?{Modifier|0}+@{weaponOCV02}+@{weaponOCVPenalty02}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenWeaponDamage02}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
getAttrs(["optionHitLocationSystem", "weaponStunMod02", "weaponAreaEffect02", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect02;
let theSTUNmodifier = parseInt(values.weaponStunMod02)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:attackWeapon03', (info) => {
// Roll attack and damage dice for Weapon 03.
// First determine if the weapon does normal or killing damage.
getAttrs(["weaponNormalDamage03", "optionAutoSubtractEND", "weaponEndurance03"], function(values) {
let isNormalDamage = values.weaponNormalDamage03;
let autoSubtractEND = values.optionAutoSubtractEND;
let weaponEND = parseInt(values.weaponEndurance03)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{weaponName03}}} {{OCV=[[?{Modifier|0}+@{weaponOCV03}+@{weaponOCVPenalty03}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenWeaponDamage03}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "weaponAreaEffect03", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect03;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
} else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{weaponName03}}} {{OCV=[[?{Modifier|0}+@{weaponOCV03}+@{weaponOCVPenalty03}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenWeaponDamage03}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
getAttrs(["optionHitLocationSystem", "weaponStunMod03", "weaponAreaEffect03", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect03;
let theSTUNmodifier = parseInt(values.weaponStunMod03)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:attackWeapon04', (info) => {
// Roll attack and damage dice for Weapon 04.
// First determine if the weapon does normal or killing damage.
getAttrs(["weaponNormalDamage04", "optionAutoSubtractEND", "weaponEndurance04"], function(values) {
let isNormalDamage = values.weaponNormalDamage04;
let autoSubtractEND = values.optionAutoSubtractEND;
let weaponEND = parseInt(values.weaponEndurance04)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{weaponName04}}} {{OCV=[[?{Modifier|0}+@{weaponOCV04}+@{weaponOCVPenalty04}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenWeaponDamage04}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "weaponAreaEffect04", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect04;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
} else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{weaponName04}}} {{OCV=[[?{Modifier|0}+@{weaponOCV04}+@{weaponOCVPenalty04}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenWeaponDamage04}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
getAttrs(["optionHitLocationSystem", "weaponStunMod04", "weaponAreaEffect04", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect04;
let theSTUNmodifier = parseInt(values.weaponStunMod04)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:attackWeapon05', (info) => {
// Roll attack and damage dice for Weapon 02.
// First determine if the weapon does normal or killing damage.
getAttrs(["weaponNormalDamage05", "optionAutoSubtractEND", "weaponEndurance05"], function(values) {
let isNormalDamage = values.weaponNormalDamage05;
let autoSubtractEND = values.optionAutoSubtractEND;
let weaponEND = parseInt(values.weaponEndurance05)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{weaponName05}}} {{OCV=[[?{Modifier|0}+@{weaponOCV05}+@{weaponOCVPenalty05}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenWeaponDamage05}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "weaponAreaEffect05", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect05;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
} else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{weaponName05}}} {{OCV=[[?{Modifier|0}+@{weaponOCV05}+@{weaponOCVPenalty05}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenWeaponDamage05}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(weaponEND);
}
getAttrs(["optionHitLocationSystem", "weaponStunMod05", "weaponAreaEffect05", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect05;
let theSTUNmodifier = parseInt(values.weaponStunMod05)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if ((useHitLocations != 0) && (areaEffectWeapon == 0)) {
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
else if (areaEffectWeapon != 0) {
theMessage = " AoE";
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:attackShield', (info) => {
// Roll attack and damage dice for the shield.
// First determine if the shield does normal or killing damage.
getAttrs(["shieldNormalDamage", "optionAutoSubtractEND", "shieldEndurance"], function(values) {
let isNormalDamage = values.shieldNormalDamage;
let autoSubtractEND = values.optionAutoSubtractEND;
let shieldEND = parseInt(values.shieldEndurance)||0;
// If isNormalDamage is TRUE, use the Normal Damage template.
if (isNormalDamage != 0) {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle=Attacks with @{shieldName}}} {{OCV=[[?{Modifiers|0}-@{shieldDCV}+@{shieldOCV}+@{targetOCVpenalty}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenShieldDamage01}]]}}", (results) => {
// Convert dice roll to equivalent BODY damage.
let computed =0;
const theDice = results.results.STUN.rolls;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(shieldEND);
}
// For each type of dice (d3 or d6) calculate BODY:
for(let groupOfDice of theDice) {
if (groupOfDice.sides == 3) {
// calculate normal damage of d3 dice.
for (let element of groupOfDice.results) {
if (element === 3) {
computed = computed+1;
} else if (element === 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
} else if (groupOfDice.sides == 6) {
// calculate normal damage of d6 dice.
for (let element of groupOfDice.results) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
}
}
// Get hit location message if system used.
getAttrs(["optionHitLocationSystem", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
if (useHitLocations != 0) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
} else {
// If isNormalDamage is FALSE, use the killing Damage template.
startRoll("&{template:custom-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with @{shieldName}}} {{OCV=[[?{Modifiers|0}-@{shieldDCV}+@{shieldOCV}+@{targetOCVpenalty}+@{ocv}]]}} {{Result=[[3d6cf<0cs>0]]}} {{BODY=[[@{hiddenShieldDamage01}]]}}", (results) => {
let computed = parseInt(results.results.BODY.result)||0;
setAttrs({
hiddenDamageRoll: computed
});
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
subtractGearEndurance(shieldEND);
}
getAttrs(["optionHitLocationSystem", "shieldStunMod", "targetSelection"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let areaEffectWeapon = values.weaponAreaEffect05;
let theSTUNmodifier = parseInt(values.shieldStunMod)||0;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
// Determine the base stun multiple, which is 1d3.
let theSTUNmultiplier = Math.floor(Math.random()*3+1);
// If the hit location system option is used and the weapon is not of type area effect call the hit location function.
if (useHitLocations != 0){
var theHitLocation = new killingHitLocation(targetSelectionType);
theSTUNmultiplier = theHitLocation.stunMultiplier;
theMessage = theHitLocation.message;
}
// Add the weapon's stun modifier.
theSTUNmultiplier = theSTUNmultiplier + theSTUNmodifier;
// Prevent STUN multiples of less than 1.
if (theSTUNmultiplier < 1) {
theSTUNmultiplier = 1;
}
setAttrs({
rollDialogMessage:theMessage,
hiddenSTUNmultiplier:theSTUNmultiplier
});
let theResult = String(computed*theSTUNmultiplier);
finishRoll(
results.rollId,
{
BODY: theResult.concat(theMessage)
}
);
});
});
}
});
});
on('clicked:standardAttackRoll', (info) => {
startRoll("&{template:custom-normal-attack} {{title=@{character_name} - @{character_title}}} {{subtitle= Attacks with Strength @{strength}}} {{OCV=[[?{Modifiers|0}+@{ocv}+@{targetOCVpenalty}]]}} {{Result=[[3d6cf<0cs>0]]}} {{STUN=[[@{hiddenManeuverDamage01}]]}}", (results) => {
// A standard strength-based attack is complicated by the need to use a 1d3 for strength%5 == 3 or 4, such as 4, 8, 13, 19, etc.
getAttrs(["optionHitLocationSystem", "targetSelection", "strength", "optionAutoSubtractEND", "optionSuperHeroicEndurance"], function(values) {
let useHitLocations = values.optionHitLocationSystem;
let autoSubtractEND = values.optionAutoSubtractEND;
let optionSuperHeroic = values.optionSuperHeroicEndurance;
let enduranceCostFactor = 10;
let targetSelectionType = parseInt(values.targetSelection)||1;
let theMessage = " ";
let computed =0;
const theDiceD6 = results.results.STUN.dice;
// Subtract END cost if option checked.
if (autoSubtractEND != 0) {
/* Determine END cost */
if (optionSuperHeroic != 0) {
enduranceCostFactor=5;
}
let enduranceCost= heroRoundLow( (parseInt(values.strength)||0)/enduranceCostFactor );
if ( (enduranceCost<1) && (parseInt(values.strength)||0)>0) {
enduranceCost=1
}
subtractGearEndurance(enduranceCost);
}
// Determine BODY damage of d3 dice.
if (parseInt(values.strength)%5>2) {
// Get the last die value, which was rolled with a d3.
let theDiceD3 = theDiceD6.pop(); // Take the d3 off of the array.
if (theDiceD3 == 3) {
computed = computed+1;
} else if (theDiceD3 == 2) {
computed = computed + Math.floor(Math.random()*2); // Flip a coin. 0 or 1 BODY corresponding to a '3' or '4' on a d6.
} else {
computed = computed+0; // Add nothing.
}
}
// Calculate BODY damage of d6 dice.
for (let element of theDiceD6) {
if (element === 1) {
computed = computed+0; // Add nothing.
} else if (element === 6) {
computed = computed+2;
} else {
computed = computed+1;
}
}
// Get hit location message if system used.
if (useHitLocations != 0) {
var theHitLocation = new normalHitLocation(targetSelectionType);
theMessage = theHitLocation.message;
}
setAttrs({
rollDialogMessage:theMessage
});
let theResult = String(computed);
finishRoll(
results.rollId,
{
STUN: theResult.concat(theMessage)
}
);
});
});
});
/* ---------------- */
/* Equipment Movers */
/* ---------------- */
on("clicked:equipDown01 clicked:equipUp02", function () {
getAttrs(["equipText01", "equipText02", "equipMass01", "equipMass02"], function(values) {
let destinationText = values.equipText02;
let sourceText = values.equipText01;
let destinationMass = values.equipMass02;
let sourceMass = values.equipMass01;
setAttrs({
"equipText02":sourceText,
"equipText01":destinationText,
"equipMass02":sourceMass,
"equipMass01":destinationMass
});
});
});
on("clicked:equipDown02 clicked:equipUp03", function () {
getAttrs(["equipText02", "equipText03", "equipMass02", "equipMass03"], function(values) {
let destinationText = values.equipText03;
let sourceText = values.equipText02;
let destinationMass = values.equipMass03;
let sourceMass = values.equipMass02;
setAttrs({
"equipText03":sourceText,
"equipText02":destinationText,
"equipMass03":sourceMass,
"equipMass02":destinationMass
});
});
});
on("clicked:equipDown03 clicked:equipUp04", function () {
getAttrs(["equipText03", "equipText04", "equipMass03", "equipMass04"], function(values) {
let destinationText = values.equipText04;
let sourceText = values.equipText03;
let destinationMass = values.equipMass04;
let sourceMass = values.equipMass03;
setAttrs({
"equipText04":sourceText,
"equipText03":destinationText,
"equipMass04":sourceMass,
"equipMass03":destinationMass
});
});
});
on("clicked:equipDown04 clicked:equipUp05", function () {
getAttrs(["equipText04", "equipText05", "equipMass04", "equipMass05"], function(values) {
let destinationText = values.equipText05;
let sourceText = values.equipText04;
let destinationMass = values.equipMass05;
let sourceMass = values.equipMass04;
setAttrs({
"equipText05":sourceText,
"equipText04":destinationText,
"equipMass05":sourceMass,
"equipMass04":destinationMass
});
});
});
on("clicked:equipDown05 clicked:equipUp06", function () {
getAttrs(["equipText05", "equipText06", "equipMass05", "equipMass06"], function(values) {
let destinationText = values.equipText06;
let sourceText = values.equipText05;
let destinationMass = values.equipMass06;
let sourceMass = values.equipMass05;
setAttrs({
"equipText06":sourceText,
"equipText05":destinationText,
"equipMass06":sourceMass,
"equipMass05":destinationMass
});
});
});
on("clicked:equipDown06 clicked:equipUp07", function () {
getAttrs(["equipText06", "equipText07", "equipMass06", "equipMass07"], function(values) {
let destinationText = values.equipText07;
let sourceText = values.equipText06;
let destinationMass = values.equipMass07;
let sourceMass = values.equipMass06;
setAttrs({
"equipText07":sourceText,
"equipText06":destinationText,
"equipMass07":sourceMass,
"equipMass06":destinationMass
});
});
});
on("clicked:equipDown07 clicked:equipUp08", function () {
getAttrs(["equipText07", "equipText08", "equipMass07", "equipMass08"], function(values) {
let destinationText = values.equipText08;
let sourceText = values.equipText07;
let destinationMass = values.equipMass08;
let sourceMass = values.equipMass07;
setAttrs({
"equipText08":sourceText,
"equipText07":destinationText,
"equipMass08":sourceMass,
"equipMass07":destinationMass
});
});
});
on("clicked:equipDown08 clicked:equipUp09", function () {
getAttrs(["equipText08", "equipText09", "equipMass08", "equipMass09"], function(values) {
let destinationText = values.equipText09;
let sourceText = values.equipText08;
let destinationMass = values.equipMass09;
let sourceMass = values.equipMass08;
setAttrs({
"equipText09":sourceText,
"equipText08":destinationText,
"equipMass09":sourceMass,
"equipMass08":destinationMass
});
});
});
on("clicked:equipDown09 clicked:equipUp10", function () {
getAttrs(["equipText09", "equipText10", "equipMass09", "equipMass10"], function(values) {
let destinationText = values.equipText10;
let sourceText = values.equipText09;
let destinationMass = values.equipMass10;
let sourceMass = values.equipMass09;
setAttrs({
"equipText10":sourceText,
"equipText09":destinationText,
"equipMass10":sourceMass,
"equipMass09":destinationMass
});
});
});
on("clicked:equipDown10 clicked:equipUp11", function () {
getAttrs(["equipText10", "equipText11", "equipMass10", "equipMass11"], function(values) {
let destinationText = values.equipText11;
let sourceText = values.equipText10;
let destinationMass = values.equipMass11;
let sourceMass = values.equipMass10;
setAttrs({
"equipText11":sourceText,
"equipText10":destinationText,
"equipMass11":sourceMass,
"equipMass10":destinationMass
});
});
});
on("clicked:equipDown11 clicked:equipUp12", function () {
getAttrs(["equipText11", "equipText12", "equipMass11", "equipMass12"], function(values) {
let destinationText = values.equipText12;
let sourceText = values.equipText11;
let destinationMass = values.equipMass12;
let sourceMass = values.equipMass11;
setAttrs({
"equipText12":sourceText,
"equipText11":destinationText,
"equipMass12":sourceMass,
"equipMass11":destinationMass
});
});
});
on("clicked:equipDown12 clicked:equipUp13", function () {
getAttrs(["equipText12", "equipText13", "equipMass12", "equipMass13"], function(values) {
let destinationText = values.equipText13;
let sourceText = values.equipText12;
let destinationMass = values.equipMass13;
let sourceMass = values.equipMass12;
setAttrs({
"equipText13":sourceText,
"equipText12":destinationText,
"equipMass13":sourceMass,
"equipMass12":destinationMass
});
});
});
on("clicked:equipDown13 clicked:equipUp14", function () {
getAttrs(["equipText13", "equipText14", "equipMass13", "equipMass14"], function(values) {
let destinationText = values.equipText14;
let sourceText = values.equipText13;
let destinationMass = values.equipMass14;
let sourceMass = values.equipMass13;
setAttrs({
"equipText14":sourceText,
"equipText13":destinationText,
"equipMass14":sourceMass,
"equipMass13":destinationMass
});
});
});
on("clicked:equipDown14 clicked:equipUp15", function () {
getAttrs(["equipText14", "equipText15", "equipMass14", "equipMass15"], function(values) {
let destinationText = values.equipText15;
let sourceText = values.equipText14;
let destinationMass = values.equipMass15;
let sourceMass = values.equipMass14;
setAttrs({
"equipText15":sourceText,
"equipText14":destinationText,
"equipMass15":sourceMass,
"equipMass14":destinationMass
});
});
});
on("clicked:equipDown15 clicked:equipUp16", function () {
getAttrs(["equipText15", "equipText16", "equipMass15", "equipMass16"], function(values) {
let destinationText = values.equipText16;
let sourceText = values.equipText15;
let destinationMass = values.equipMass16;
let sourceMass = values.equipMass15;
setAttrs({
"equipText16":sourceText,
"equipText15":destinationText,
"equipMass16":sourceMass,
"equipMass15":destinationMass
});
});
});
on("clicked:equipDown16 clicked:equipUp01", function () {
getAttrs(["equipText16", "equipText01", "equipMass16", "equipMass01"], function(values) {
let destinationText = values.equipText01;
let sourceText = values.equipText16;
let destinationMass = values.equipMass01;
let sourceMass = values.equipMass16;
setAttrs({
"equipText01":sourceText,
"equipText16":destinationText,
"equipMass01":sourceMass,
"equipMass16":destinationMass
});
});
});
// Talent Movers
on("clicked:talentDown01 clicked:talentUp02", function () {
getAttrs(["talentName01", "talentName02", "talentText01", "talentText02", "talentCP01", "talentCP02"], function(values) {
let destinationName = values.talentName02;
let sourceName = values.talentName01;
let destinationText = values.talentText02;
let sourceText = values.talentText01;
let destinationCP = values.talentCP02;
let sourceCP = values.talentCP01;
setAttrs({
"talentName02":sourceName,
"talentName01":destinationName,
"talentText02":sourceText,
"talentText01":destinationText,
"talentCP02":sourceCP,
"talentCP01":destinationCP
});
});
});
on("clicked:talentDown02 clicked:talentUp03", function () {
getAttrs(["talentName02", "talentName03", "talentText02", "talentText03", "talentCP02", "talentCP03"], function(values) {
let destinationName = values.talentName03;
let sourceName = values.talentName02;
let destinationText = values.talentText03;
let sourceText = values.talentText02;
let destinationCP = values.talentCP03;
let sourceCP = values.talentCP02;
setAttrs({
"talentName03":sourceName,
"talentName02":destinationName,
"talentText03":sourceText,
"talentText02":destinationText,
"talentCP03":sourceCP,
"talentCP02":destinationCP
});
});
});
on("clicked:talentDown03 clicked:talentUp04", function () {
getAttrs(["talentName03", "talentName04", "talentText03", "talentText04", "talentCP03", "talentCP04"], function(values) {
let destinationName = values.talentName04;
let sourceName = values.talentName03;
let destinationText = values.talentText04;
let sourceText = values.talentText03;
let destinationCP = values.talentCP04;
let sourceCP = values.talentCP03;
setAttrs({
"talentName04":sourceName,
"talentName03":destinationName,
"talentText04":sourceText,
"talentText03":destinationText,
"talentCP04":sourceCP,
"talentCP03":destinationCP
});
});
});
on("clicked:talentDown04 clicked:talentUp05", function () {
getAttrs(["talentName04", "talentName05", "talentText04", "talentText05", "talentCP04", "talentCP05"], function(values) {
let destinationName = values.talentName05;
let sourceName = values.talentName04;
let destinationText = values.talentText05;
let sourceText = values.talentText04;
let destinationCP = values.talentCP05;
let sourceCP = values.talentCP04;
setAttrs({
"talentName05":sourceName,
"talentName04":destinationName,
"talentText05":sourceText,
"talentText04":destinationText,
"talentCP05":sourceCP,
"talentCP04":destinationCP
});
});
});
on("clicked:talentDown05 clicked:talentUp06", function () {
getAttrs(["talentName05", "talentName06", "talentText05", "talentText06", "talentCP05", "talentCP06"], function(values) {
let destinationName = values.talentName06;
let sourceName = values.talentName05;
let destinationText = values.talentText06;
let sourceText = values.talentText05;
let destinationCP = values.talentCP06;
let sourceCP = values.talentCP05;
setAttrs({
"talentName06":sourceName,
"talentName05":destinationName,
"talentText06":sourceText,
"talentText05":destinationText,
"talentCP06":sourceCP,
"talentCP05":destinationCP
});
});
});
on("clicked:talentDown06 clicked:talentUp07", function () {
getAttrs(["talentName06", "talentName07", "talentText06", "talentText07", "talentCP06", "talentCP07"], function(values) {
let destinationName = values.talentName07;
let sourceName = values.talentName06;
let destinationText = values.talentText07;
let sourceText = values.talentText06;
let destinationCP = values.talentCP07;
let sourceCP = values.talentCP06;
setAttrs({
"talentName07":sourceName,
"talentName06":destinationName,
"talentText07":sourceText,
"talentText06":destinationText,
"talentCP07":sourceCP,
"talentCP06":destinationCP
});
});
});
on("clicked:talentDown07 clicked:talentUp01", function () {
getAttrs(["talentName07", "talentName01", "talentText07", "talentText01", "talentCP07", "talentCP01"], function(values) {
let destinationName = values.talentName01;
let sourceName = values.talentName07;
let destinationText = values.talentText01;
let sourceText = values.talentText07;
let destinationCP = values.talentCP01;
let sourceCP = values.talentCP07;
setAttrs({
"talentName01":sourceName,
"talentName07":destinationName,
"talentText01":sourceText,
"talentText07":destinationText,
"talentCP01":sourceCP,
"talentCP07":destinationCP
});
});
});
// Complication Movers
on("clicked:complicationDown01 clicked:complicationUp02", function () {
getAttrs(["complicationName01", "complicationName02", "complicationText01", "complicationText02", "complicationCP01", "complicationCP02"], function(values) {
let destinationName = values.complicationName02;
let sourceName = values.complicationName01;
let destinationText = values.complicationText02;
let sourceText = values.complicationText01;
let destinationCP = values.complicationCP02;
let sourceCP = values.complicationCP01;
setAttrs({
"complicationName02":sourceName,
"complicationName01":destinationName,
"complicationText02":sourceText,
"complicationText01":destinationText,
"complicationCP02":sourceCP,
"complicationCP01":destinationCP
});
});
});
on("clicked:complicationDown02 clicked:complicationUp03", function () {
getAttrs(["complicationName02", "complicationName03", "complicationText02", "complicationText03", "complicationCP02", "complicationCP03"], function(values) {
let destinationName = values.complicationName03;
let sourceName = values.complicationName02;
let destinationText = values.complicationText03;
let sourceText = values.complicationText02;
let destinationCP = values.complicationCP03;
let sourceCP = values.complicationCP02;
setAttrs({
"complicationName03":sourceName,
"complicationName02":destinationName,
"complicationText03":sourceText,
"complicationText02":destinationText,
"complicationCP03":sourceCP,
"complicationCP02":destinationCP
});
});
});
on("clicked:complicationDown03 clicked:complicationUp04", function () {
getAttrs(["complicationName03", "complicationName04", "complicationText03", "complicationText04", "complicationCP03", "complicationCP04"], function(values) {
let destinationName = values.complicationName04;
let sourceName = values.complicationName03;
let destinationText = values.complicationText04;
let sourceText = values.complicationText03;
let destinationCP = values.complicationCP04;
let sourceCP = values.complicationCP03;
setAttrs({
"complicationName04":sourceName,
"complicationName03":destinationName,
"complicationText04":sourceText,
"complicationText03":destinationText,
"complicationCP04":sourceCP,
"complicationCP03":destinationCP
});
});
});
on("clicked:complicationDown04 clicked:complicationUp05", function () {
getAttrs(["complicationName04", "complicationName05", "complicationText04", "complicationText05", "complicationCP04", "complicationCP05"], function(values) {
let destinationName = values.complicationName05;
let sourceName = values.complicationName04;
let destinationText = values.complicationText05;
let sourceText = values.complicationText04;
let destinationCP = values.complicationCP05;
let sourceCP = values.complicationCP04;
setAttrs({
"complicationName05":sourceName,
"complicationName04":destinationName,
"complicationText05":sourceText,
"complicationText04":destinationText,
"complicationCP05":sourceCP,
"complicationCP04":destinationCP
});
});
});
on("clicked:complicationDown05 clicked:complicationUp06", function () {
getAttrs(["complicationName05", "complicationName06", "complicationText05", "complicationText06", "complicationCP05", "complicationCP06"], function(values) {
let destinationName = values.complicationName06;
let sourceName = values.complicationName05;
let destinationText = values.complicationText06;
let sourceText = values.complicationText05;
let destinationCP = values.complicationCP06;
let sourceCP = values.complicationCP05;
setAttrs({
"complicationName06":sourceName,
"complicationName05":destinationName,
"complicationText06":sourceText,
"complicationText05":destinationText,
"complicationCP06":sourceCP,
"complicationCP05":destinationCP
});
});
});
on("clicked:complicationDown06 clicked:complicationUp01", function () {
getAttrs(["complicationName06", "complicationName01", "complicationText06", "complicationText01", "complicationCP06", "complicationCP01"], function(values) {
let destinationName = values.complicationName01;
let sourceName = values.complicationName06;
let destinationText = values.complicationText01;
let sourceText = values.complicationText06;
let destinationCP = values.complicationCP01;
let sourceCP = values.complicationCP06;
setAttrs({
"complicationName01":sourceName,
"complicationName06":destinationName,
"complicationText01":sourceText,
"complicationText06":destinationText,
"complicationCP01":sourceCP,
"complicationCP06":destinationCP
});
});
});
// End sheet workers
</script> | {
"content_hash": "0b4a7abc738e773680950f872776d1e5",
"timestamp": "",
"source": "github",
"line_count": 11310,
"max_line_length": 706,
"avg_line_length": 40.66684350132626,
"alnum_prop": 0.6573567971613812,
"repo_name": "kreuvf/roll20-character-sheets",
"id": "b25ee5c8ad60f0b8d9ee18dfee131ef84cec2d2a",
"size": "459944",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "HeroSystem6eHeroic/HeroSystem6eHeroic.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "381"
},
{
"name": "CSS",
"bytes": "32500770"
},
{
"name": "EJS",
"bytes": "563554"
},
{
"name": "HTML",
"bytes": "250364925"
},
{
"name": "JavaScript",
"bytes": "8286359"
},
{
"name": "Less",
"bytes": "79342"
},
{
"name": "Makefile",
"bytes": "297"
},
{
"name": "Nunjucks",
"bytes": "12443"
},
{
"name": "PowerShell",
"bytes": "4843"
},
{
"name": "Pug",
"bytes": "3593992"
},
{
"name": "Python",
"bytes": "58000"
},
{
"name": "Rich Text Format",
"bytes": "86823"
},
{
"name": "SCSS",
"bytes": "3100529"
},
{
"name": "Sass",
"bytes": "238408"
},
{
"name": "Shell",
"bytes": "1455"
},
{
"name": "Stylus",
"bytes": "707027"
},
{
"name": "TypeScript",
"bytes": "169273"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
Testes de controle de acesso
</title>
</head>
<body bgcolor="#ffffff">
<h1>Testes de controle de acesso</h1>
<p>
Este complemento permite aos usuários comparar quais partes de um aplicativo da web estão disponíveis para alguns usuários, fazer testes de controle de acesso e identificar possíveis problemas de controle de acesso. Ele permite a configuração das regras de acesso e conduz um ataque destinado a ajudar a identificar partes de um aplicativo da web que são acessíveis por clientes não autorizados.
</p>
<p>
Existem dois conceitos principais relacionados com este complemento que precisam ser explicados: as <b>Regras de Acesso</b> e o <b>procedimento de teste</b>.
</p>
<h3>Regras de acesso</h3>
<p>
A fim de identificar possíveis problemas de controle de acesso, o ZAP precisa saber quais partes do aplicativo da web podem ser acessadas e por qual o usuário. No ZAP, o nome para estas regras é o seguinte: <i>Regras de acesso</i> e geralmente elas têm o seguinte significado: "<i>A página xis deve/não deve ser acessada pelo usuário Xis</i>".
</p>
<p>As regras são configuradas para um contexto e, para cada usuário desse contexto, cada Site/nó (página web) será associado a um dos seguintes valores:</p>
<ul>
<li><b>Permitido</b> - o recurso <b>pode</b> ser acessado pelo usuário ao qual se refere a regra</li>
<li><b>Negado</b> - o recurso <b>não deve</b> ser acessado pelo usuário ao qual se refere a regra</li>
<li><b>Desconhecido</b> - não há <b>nenhuma informação</b> sobre se o recurso deve ou não deve ser acessível para o usuário ao qual se refere a regra
</li>
</ul>
<p>
Para simplificar o processo de definição das regras de acesso, o ZAP faz uso da estrutura baseada em árvore de URLs.
Ao analisar as regras, um algoritmo de inferência é usado para detectar as regras de correspondência para cada nó baseado no seu pai na URL, quando não há regras específicas definidas. Isto significa que, ao configurar as regras de acesso, apenas uma regra precisa ser definida explicitamente para uma subárvore inteira, enquanto para os outros nós as regras são inferidas. Mais detalhes sobre isso podem ser encontrados na página de ajuda das <a href="contextOptions.html">Opções de contexto</a> do controle de acesso.</td>
</p>
<h3>Procedimento de teste</h3>
<p> No geral, para realizar plenamente testes de controle de acesso para um aplicativo da web, as seguintes etapas devem ser seguidas:</p>
<ul>
<li>o testador define o conjunto de usuários e como eles se autenticam;
</li>
<li>o testador define como ZAP pode identificar solicitações não-autorizadas (através do painel de autorização nas propriedades da sessão);
</li>
<li>o aplicativo da web é explorado manualmente ou através do spider;</li>
<li>o testador define as regras de acesso para cada um dos usuários associados ao contexto, basicamente deixando ZAP conheça quais partes do aplicativo da web devem ser acessadas e seus usuários;
</li>
<li>um 'ataque' é executado pelo ZAP, tentando acessar cada URL do web-app do ponto de vista de cada usuário;
</li>
<li>na aba de Status correspondente, os resultados são exibidos, mostrando quais páginas foram acessadas com êxito por quais usuários e marcando os casos onde as regras de acesso não foram seguidas.
</li>
</ul>
<h2>Leia também</h2>
<table>
<tr>
<td> </td>
<td>
<a href="tab.html">Guia de testes de controle de acesso</a></td>
<td>para obter uma descrição da guia de status utilizada pelo complemento</td>
</tr>
<tr>
<td> </td>
<td>
<a href="contextOptions.html">Opções de contexto de controle de acesso</a></td>
<td>para saber mais sobre as opções de contexto relacionadas</td>
</tr>
</table>
</body>
</html>
| {
"content_hash": "eb69faaa93fd668791469a3e1e5b6589",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 528,
"avg_line_length": 55.21917808219178,
"alnum_prop": 0.7233936988340363,
"repo_name": "zapbot/zap-extensions",
"id": "e47470d8fe6d5bf71c448f1728eb9dab4996a360",
"size": "4106",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "addOns/accessControl/src/main/javahelp/org/zaproxy/zap/extension/accessControl/resources/help_pt_BR/contents/concepts.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "29979"
},
{
"name": "HTML",
"bytes": "6653830"
},
{
"name": "Haskell",
"bytes": "1533212"
},
{
"name": "Java",
"bytes": "10514059"
},
{
"name": "JavaScript",
"bytes": "160056"
},
{
"name": "Kotlin",
"bytes": "80437"
},
{
"name": "Python",
"bytes": "26411"
},
{
"name": "Ruby",
"bytes": "16551"
},
{
"name": "XSLT",
"bytes": "78761"
}
],
"symlink_target": ""
} |
namespace Kvasir {
//Static Memory Controller
namespace SmcSetup0{ ///<SMC Setup Register (CS_number = 0)
using Addr = Register::Address<0xffffec00,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse0{ ///<SMC Pulse Register (CS_number = 0)
using Addr = Register::Address<0xffffec04,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle0{ ///<SMC Cycle Register (CS_number = 0)
using Addr = Register::Address<0xffffec08,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode0{ ///<SMC Mode Register (CS_number = 0)
using Addr = Register::Address<0xffffec0c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup1{ ///<SMC Setup Register (CS_number = 1)
using Addr = Register::Address<0xffffec10,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse1{ ///<SMC Pulse Register (CS_number = 1)
using Addr = Register::Address<0xffffec14,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle1{ ///<SMC Cycle Register (CS_number = 1)
using Addr = Register::Address<0xffffec18,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode1{ ///<SMC Mode Register (CS_number = 1)
using Addr = Register::Address<0xffffec1c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup2{ ///<SMC Setup Register (CS_number = 2)
using Addr = Register::Address<0xffffec20,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse2{ ///<SMC Pulse Register (CS_number = 2)
using Addr = Register::Address<0xffffec24,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle2{ ///<SMC Cycle Register (CS_number = 2)
using Addr = Register::Address<0xffffec28,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode2{ ///<SMC Mode Register (CS_number = 2)
using Addr = Register::Address<0xffffec2c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup3{ ///<SMC Setup Register (CS_number = 3)
using Addr = Register::Address<0xffffec30,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse3{ ///<SMC Pulse Register (CS_number = 3)
using Addr = Register::Address<0xffffec34,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle3{ ///<SMC Cycle Register (CS_number = 3)
using Addr = Register::Address<0xffffec38,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode3{ ///<SMC Mode Register (CS_number = 3)
using Addr = Register::Address<0xffffec3c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup4{ ///<SMC Setup Register (CS_number = 4)
using Addr = Register::Address<0xffffec40,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse4{ ///<SMC Pulse Register (CS_number = 4)
using Addr = Register::Address<0xffffec44,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle4{ ///<SMC Cycle Register (CS_number = 4)
using Addr = Register::Address<0xffffec48,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode4{ ///<SMC Mode Register (CS_number = 4)
using Addr = Register::Address<0xffffec4c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup5{ ///<SMC Setup Register (CS_number = 5)
using Addr = Register::Address<0xffffec50,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse5{ ///<SMC Pulse Register (CS_number = 5)
using Addr = Register::Address<0xffffec54,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle5{ ///<SMC Cycle Register (CS_number = 5)
using Addr = Register::Address<0xffffec58,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode5{ ///<SMC Mode Register (CS_number = 5)
using Addr = Register::Address<0xffffec5c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup6{ ///<SMC Setup Register (CS_number = 6)
using Addr = Register::Address<0xffffec60,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse6{ ///<SMC Pulse Register (CS_number = 6)
using Addr = Register::Address<0xffffec64,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle6{ ///<SMC Cycle Register (CS_number = 6)
using Addr = Register::Address<0xffffec68,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode6{ ///<SMC Mode Register (CS_number = 6)
using Addr = Register::Address<0xffffec6c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
namespace SmcSetup7{ ///<SMC Setup Register (CS_number = 7)
using Addr = Register::Address<0xffffec70,0xc0c0c0c0,0x00000000,unsigned>;
///NWE Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,0),Register::ReadWriteAccess,unsigned> nweSetup{};
///NCS Setup Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,8),Register::ReadWriteAccess,unsigned> ncsWrSetup{};
///NRD Setup Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,16),Register::ReadWriteAccess,unsigned> nrdSetup{};
///NCS Setup Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,24),Register::ReadWriteAccess,unsigned> ncsRdSetup{};
}
namespace SmcPulse7{ ///<SMC Pulse Register (CS_number = 7)
using Addr = Register::Address<0xffffec74,0x80808080,0x00000000,unsigned>;
///NWE Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,0),Register::ReadWriteAccess,unsigned> nwePulse{};
///NCS Pulse Length in WRITE Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,8),Register::ReadWriteAccess,unsigned> ncsWrPulse{};
///NRD Pulse Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,16),Register::ReadWriteAccess,unsigned> nrdPulse{};
///NCS Pulse Length in READ Access
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,24),Register::ReadWriteAccess,unsigned> ncsRdPulse{};
}
namespace SmcCycle7{ ///<SMC Cycle Register (CS_number = 7)
using Addr = Register::Address<0xffffec78,0xfe00fe00,0x00000000,unsigned>;
///Total Write Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,0),Register::ReadWriteAccess,unsigned> nweCycle{};
///Total Read Cycle Length
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,16),Register::ReadWriteAccess,unsigned> nrdCycle{};
}
namespace SmcMode7{ ///<SMC Mode Register (CS_number = 7)
using Addr = Register::Address<0xffffec7c,0xcee0cecc,0x00000000,unsigned>;
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> readMode{};
///
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> writeMode{};
///NWAIT Mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> exnwMode{};
///Byte Access Type
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> bat{};
///Data Bus Width
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> dbw{};
///Data Float Time
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> tdfCycles{};
///TDF Optimization
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> tdfMode{};
///Page Mode Enabled
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> pmen{};
///Page Size
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> ps{};
}
}
| {
"content_hash": "da0c7f516d803e04ba97b204e3a17d31",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 128,
"avg_line_length": 70.98759305210918,
"alnum_prop": 0.712143456375839,
"repo_name": "kvasir-io/Kvasir",
"id": "b08f868c20b55fafdc92a8205f532c268f15073a",
"size": "28654",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Lib/Chip/Unknown/Atmel/AT91SAM9G10/SMC.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "16510"
},
{
"name": "C++",
"bytes": "763432371"
},
{
"name": "CMake",
"bytes": "1504"
},
{
"name": "Python",
"bytes": "13502"
}
],
"symlink_target": ""
} |
@implementation Tweet
@dynamic created_at;
@dynamic num_stars;
@dynamic num_replies;
@dynamic text;
@dynamic num_reposts;
@dynamic canonical_url;
@dynamic html;
@dynamic machine_only;
@dynamic reply_to;
@dynamic thread_id;
@dynamic id;
@dynamic source;
@dynamic entities;
@dynamic user;
@end
| {
"content_hash": "c1dcbdfb394ee83c5d4eb8ada38146cf",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 23,
"avg_line_length": 16.333333333333332,
"alnum_prop": 0.7585034013605442,
"repo_name": "esttorhe/ETFramework",
"id": "bd63071c067e4adeb0eede6d2294cec9e8e1faa3",
"size": "513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ETFrameworkDemo/ETFrameworkDemo/Classes/Model/Tweet.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4590"
},
{
"name": "Objective-C",
"bytes": "180901"
},
{
"name": "Ruby",
"bytes": "413"
},
{
"name": "Shell",
"bytes": "1854"
}
],
"symlink_target": ""
} |
import os
import sys
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
LOG_PATH = "logs-2.txt"
SEARCHSTRING = "NARF: "
SAVENAME = "plot2"
x = []
y = []
z = []
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
f = open(LOG_PATH, "r")
lines = f.readlines()
for line in lines:
pos = line.index(SEARCHSTRING) + len(SEARCHSTRING)
payload = line[pos:-2]
# last line as no CRLF, don't care
foo = payload.split(";")
x.append(float(foo[0]))
y.append(float(foo[1]))
z.append(float(foo[2]))
ax.scatter(x, y, zs=z) #, c="r", marker="s", label="ground truth")
plt.savefig(os.path.join(".", SAVENAME + ".png"), bbox_inches='tight')
plt.show() | {
"content_hash": "1e2ad518b7a9cee8b5af0dc04a74fa22",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 70,
"avg_line_length": 21.87878787878788,
"alnum_prop": 0.6260387811634349,
"repo_name": "mcguenther/MIScreen",
"id": "60d3340a6b6436fc1738ac4dab7f5a3bcff7839a",
"size": "722",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "analysis/plot.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "201719"
},
{
"name": "Python",
"bytes": "722"
}
],
"symlink_target": ""
} |
"""
Tools for managing data for use with `~windspharm.standard.VectorWind`
(or indeed `spharm.Spharmt`).
"""
# Copyright (c) 2012-2013 Andrew Dawson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import
import numpy as np
def __order_dims(d, inorder):
if 'x' not in inorder or 'y' not in inorder:
raise ValueError('a latitude-longitude grid is required')
lonpos = inorder.lower().find('x')
latpos = inorder.lower().find('y')
d = np.rollaxis(d, lonpos)
if latpos < lonpos:
latpos += 1
d = np.rollaxis(d, latpos)
outorder = inorder.replace('x', '')
outorder = outorder.replace('y', '')
outorder = 'yx' + outorder
return d, outorder
def __reshape(d):
out = d.reshape(d.shape[:2] + (np.prod(d.shape[2:]),))
return out, d.shape
def prep_data(data, dimorder):
"""
Prepare data for input to `~windspharm.standard.VectorWind` (or to
`spharm.Spharmt` method calls).
Returns a dictionary of intermediate information that can be passed
to `recover_data` or `get_recovery` to recover the original shape
and order of the data.
**Arguments:**
*data*
Data array. The array must be at least 2D.
*dimorder*
String specifying the order of dimensions in the data array. The
characters 'x' and 'y' represent longitude and latitude
respectively. Any other characters can be used to represent
other dimensions.
**Returns:**
*pdata*
*data* reshaped/reordered to (latitude, longitude, other).
*info*
A dictionary of information required to recover *data*.
**See also:**
`recover_data`, `get_recovery`.
**Examples:**
Prepare an array with dimensions (12, 17, 73, 144) where the
dimensions are (time, level, latitude, longitude)::
pdata, info = prep_data(data, 'tzyx')
Prepare an array with dimensions (144, 16, 73, 21) where the first
dimension is longitude and the third dimension is latitude. The
characters used to represent the other dimensions are arbitrary::
pdata, info = prep_data(data, 'xayb')
"""
# Returns the prepared data and some data info to help data recovery.
pdata, intorder = __order_dims(data, dimorder)
pdata, intshape = __reshape(pdata)
info = dict(intermediate_shape=intshape,
intermediate_order=intorder,
original_order=dimorder)
return pdata, info
def recover_data(pdata, info):
"""
Recover the shape and dimension order of an array output from
`~windspharm.standard.VectorWind` methods (or from `spharm.Spharmt`
methods).
This function performs the opposite of `prep_data`.
For recovering the shape of multiple variables, see `get_recovery`.
**Arguments:**
*pdata*
Data array with either 2 or 3 dimensions. The first two
dimensions are latitude and longitude respectively.
*info*
Information dictionary output from `prep_data`.
**Returns:**
*data*
The data reshaped/reordered.
**See also:**
`prep_data`, `get_recovery`.
**Example:**
Recover the original input shape and dimension order of an array
processed with `prep_data` or an output of
`~windspharm.standard.VectorWind` or `sparm.Spharmt` method calls on
such data::
data = recover_data(pdata, info)
"""
# Convert to intermediate shape (full dimensionality, windspharm order).
data = pdata.reshape(info['intermediate_shape'])
# Re-order dimensions correctly.
rolldims = np.array([info['intermediate_order'].index(dim)
for dim in info['original_order'][::-1]])
for i in xrange(len(rolldims)):
# Roll the axis to the front.
data = np.rollaxis(data, rolldims[i])
rolldims = np.where(rolldims < rolldims[i], rolldims + 1, rolldims)
return data
__recover_docstring_template = """Shape/dimension recovery.
Recovers variable shape/dimension according to:
{!s}
Returns a `list` of variables.
"""
def get_recovery(info):
"""
Return a function that can be used to recover the shape and
dimension order of multiple arrays output from
`~windspharm.standard.VectorWind` methods (or from `spharm.Spharmt`
methods) according to a single dictionary of recovery information.
**Argument:**
*info*
Information dictionary output from `prep_data`.
**Returns:**
*recover*
A function used to recover arrays.
**See also:**
`recover_data`, `prep_data`.
**Example:**
Generate a function to recover the original input shape and
dimension order of arrays processed with `prep_data` and outputs of
`~windspharm.standard.VectorWind` method calls on this data::
u, info = prep_data(u, 'tzyx')
v, info = prep_data(v, 'tzyx')
w = VectorWind(u, v)
sf, vp = w.sfvp()
recover = get_recovery(info)
u, v, sf, vp = recover(u, v, sf, vp)
"""
def __recover(*args):
return [recover_data(arg, info) for arg in args]
info_nice = ["'{!s}': {!s}".format(key, value)
for key, value in info.items()]
__recover.__name__ = 'recover'
__recover.__doc__ = __recover_docstring_template.format(
'\n'.join(info_nice))
return __recover
def reverse_latdim(u, v, axis=0):
"""
Reverse the order of the latitude dimension of zonal and meridional
wind components.
**Arguments:**
*u*, *v*
Zonal and meridional wind components respectively.
**Optional argument:**
*axis*
Index of the latitude dimension. This dimension will be reversed
in the input arrays. Defaults to 0 (the first dimension).
**Returns:**
*ur*, *vr*
Zonal and meridional wind components with the latitude dimensions
reversed. These are always copies of the input.
**See also:**
`order_latdim`.
**Examples:**
Reverse the dimension corresponding to latitude when it is the first
dimension of the inputs::
u, v = reverse_latdim(u, v)
Reverse the dimension corresponding to latitude when it is the third
dimension of the inputs::
u, v = reverse_latdim(u, v, axis=2)
"""
slicelist = [slice(0, None)] * u.ndim
slicelist[axis] = slice(None, None, -1)
u = u.copy()[slicelist]
v = v.copy()[slicelist]
return u, v
def order_latdim(latdim, u, v, axis=0):
"""Ensure the latitude dimension is north-to-south.
Returns copies of the latitude dimension and wind components
with the latitude dimension going from north to south. If the
latitude dimension is already in this order then the output will
just be copies of the input.
**Arguments:**
*latdim*
Array of latitude values.
*u*, *v*
Zonal and meridional wind components respectively.
**Keyword argument:**
*axis*
Index of the latitude dimension in the zonal and meridional wind
components. Defaults to 0 (the first dimension).
**Returns:**
*latdimr*
Possibly reversed *latdim*, always a copy of *latdim*.
*ur*, *vr*
Possibly reversed *u* and *v* respectively. Always copies of *u*
and *v* respectively.
**See also:**
`reverse_latdim`.
**Examples:**
Order the latitude dimension when latitude is the first dimension of
the wind components::
latdim, u, v = order_latdim(latdim, u, v)
Order the latitude dimension when latitude is the third dimension of
the wind components::
latdim, u, v = order_latdim(latdim, u, v, axis=2)
"""
latdim = latdim.copy()
if latdim[0] < latdim[-1]:
latdim = latdim[::-1]
# reverse_latdim() will make copies of u and v
u, v = reverse_latdim(u, v, axis=axis)
else:
# we return copies from this function
u, v = u.copy(), v.copy()
return latdim, u, v
| {
"content_hash": "79dd80e39c90b5044330af3b152bf16b",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 79,
"avg_line_length": 28.782747603833865,
"alnum_prop": 0.6517926517926518,
"repo_name": "nicolasfauchereau/windspharm",
"id": "f4384940c0bb836a6b9a7fb7f31fe1a7ca0e357d",
"size": "9009",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/windspharm/tools.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "132549"
}
],
"symlink_target": ""
} |
// Implements the member functions of CEnv
CEnv::CEnv(SQLHANDLE InputHandle) : CHandle(SQL_HANDLE_ENV, InputHandle)
{
m_ODBCVersion = SQL_OV_ODBC3;
}
SQLRETURN CEnv::SetEnvAttr(SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength)
{
SQLRETURN rc = SQL_SUCCESS;
switch (Attribute)
{
case SQL_ATTR_CONNECTION_POOLING: // Implemented by DM
break;
case SQL_ATTR_CP_MATCH: // Implemented by DM
break;
case SQL_ATTR_ODBC_VERSION:
m_ODBCVersion = (long)ValuePtr;
break;
case SQL_ATTR_OUTPUT_NTS: // Implemented by DM
break;
}
return rc;
}
SQLRETURN CEnv::GetEnvAttr(SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER BufferLength,
SQLINTEGER *StringLengthPtr)
{
SQLRETURN rc = SQL_SUCCESS;
RETURN_VALUE_STRUCT retValue;
retValue.dataType = DRVR_PENDING;
retValue.u.strPtr = NULL;
switch (Attribute)
{
case SQL_ATTR_CONNECTION_POOLING: // Implemented by DM
break;
case SQL_ATTR_CP_MATCH: // Implemented by DM
break;
case SQL_ATTR_ODBC_VERSION:
retValue.u.s32Value = m_ODBCVersion;
retValue.dataType = SQL_IS_INTEGER;
break;
case SQL_ATTR_OUTPUT_NTS: // Implemented by DM
break;
}
if (rc == SQL_SUCCESS)
rc = returnAttrValue(TRUE, this, &retValue, ValuePtr, BufferLength, StringLengthPtr);
return rc;
}
SQLRETURN CEnv::AllocHandle(SQLSMALLINT HandleType,SQLHANDLE InputHandle, SQLHANDLE *OutputHandle)
{
SQLRETURN rc = SQL_SUCCESS;
CConnect* pConnect = new CConnect(InputHandle);
if (pConnect != NULL)
{
if ((rc = pConnect->initialize()) == SQL_SUCCESS)
*OutputHandle = pConnect;
else
{
delete pConnect;
rc = SQL_ERROR;
}
}
else
{
setDiagRec(DRIVER_ERROR, IDS_HY_001);
rc = SQL_ERROR;
}
return rc;
}
| {
"content_hash": "10df67f5bb8307dea4437bb5f50e639a",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 98,
"avg_line_length": 23.44871794871795,
"alnum_prop": 0.6675779114270093,
"repo_name": "rlugojr/incubator-trafodion",
"id": "7064b97bce3b6ff92ebe8ba9af03ac1f2b2af296",
"size": "2792",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "win-odbc64/odbcclient/drvr35/cenv.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "1C Enterprise",
"bytes": "27762"
},
{
"name": "Awk",
"bytes": "20971"
},
{
"name": "Batchfile",
"bytes": "27013"
},
{
"name": "C",
"bytes": "18884632"
},
{
"name": "C++",
"bytes": "69005301"
},
{
"name": "CSS",
"bytes": "99092"
},
{
"name": "GDB",
"bytes": "62692"
},
{
"name": "HTML",
"bytes": "4618"
},
{
"name": "Inno Setup",
"bytes": "14579"
},
{
"name": "Java",
"bytes": "12259696"
},
{
"name": "JavaScript",
"bytes": "883279"
},
{
"name": "LLVM",
"bytes": "42952"
},
{
"name": "Makefile",
"bytes": "325397"
},
{
"name": "Objective-C",
"bytes": "637330"
},
{
"name": "PHP",
"bytes": "8438"
},
{
"name": "PLpgSQL",
"bytes": "292377"
},
{
"name": "Perl",
"bytes": "549871"
},
{
"name": "Protocol Buffer",
"bytes": "121282"
},
{
"name": "Python",
"bytes": "524027"
},
{
"name": "QMake",
"bytes": "3622"
},
{
"name": "Roff",
"bytes": "46673"
},
{
"name": "Ruby",
"bytes": "8053"
},
{
"name": "SQLPL",
"bytes": "170800"
},
{
"name": "Shell",
"bytes": "1999814"
},
{
"name": "Tcl",
"bytes": "2763"
},
{
"name": "XSLT",
"bytes": "6100"
},
{
"name": "Yacc",
"bytes": "1380249"
}
],
"symlink_target": ""
} |
package uk.ac.manchester.cs.owl.semspreadsheets.model.skos;
import java.net.URI;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.skos.SKOSAnnotation;
import org.semanticweb.skos.SKOSConcept;
import org.semanticweb.skos.SKOSDataset;
import org.semanticweb.skosapibinding.SKOSManager;
import uk.ac.manchester.cs.owl.semspreadsheets.model.OntologyManager;
/**
* A simple reader to fetch the heirarchy of broader/narrower terms based upon the annotations.
* This is a naive implementation reading the annotations directly, for use until problems getting the SKOSReasoner working
* as expected are solved, afterwhich the internals can be replaced to use the Reasoner without affecting the rest of the integration of SKOS
*
* @author Stuart Owen
*
*/
public class SKOSHierarchyReader {
private SKOSManager skosManager;
private Map<URI,Set<SKOSConcept>> broader = new HashMap<URI, Set<SKOSConcept>>();
private Map<URI,Set<SKOSConcept>> narrower = new HashMap<URI, Set<SKOSConcept>>();
private final OWLOntology skosDocument;
private final OntologyManager ontologyManager;
//takes the ontology manager and OWLOntology holding the skos.
//although strictly speaking the SKOS isn't an OWL ontology, the SKOS api it built upon the OWL-API, and can be used together in this way
public SKOSHierarchyReader(OntologyManager ontologyManager, OWLOntology skosDocument) {
this.ontologyManager = ontologyManager;
this.skosDocument = skosDocument;
skosManager = new SKOSManager(ontologyManager.getOWLOntologyManager());
buildGraph(skosDocument);
}
public Set<SKOSConcept> getTopConcepts() {
Set<SKOSConcept> top = new SKOSHashSet();
for (SKOSConcept concept : getOntologyManager().getSKOSDataset(skosDocument).getSKOSConcepts()) {
if (getBroaderThan(concept).isEmpty()) {
top.add(concept);
}
}
return top;
}
public SKOSConcept getSKOSConcept(URI uri) {
return skosManager.getSKOSDataFactory().getSKOSConcept(uri);
}
public Set<SKOSConcept> getBroaderThan(SKOSConcept concept) {
Set<SKOSConcept> result = this.broader.get(concept.getURI());
if (result == null) {
result = new SKOSHashSet();
}
return result;
}
public Set<SKOSConcept> getNarrowerThan(SKOSConcept concept, boolean deep) {
if (deep) {
Set<SKOSConcept> concepts = getNarrowerThan(concept);
for (SKOSConcept c : new HashSet<SKOSConcept>(concepts)) {
concepts.addAll(getNarrowerThan(c,true));
}
return concepts;
}
else {
return getNarrowerThan(concept);
}
}
public Set<SKOSConcept> getNarrowerThan(SKOSConcept concept) {
Set<SKOSConcept> result = this.narrower.get(concept.getURI());
if (result == null) {
result = new SKOSHashSet();
}
return result;
}
private OntologyManager getOntologyManager() {
return ontologyManager;
}
private void buildGraph(OWLOntology ontology) {
SKOSDataset dataset = getOntologyManager().getSKOSDataset(ontology);
for (SKOSConcept concept : dataset.getSKOSConcepts()) {
Set<SKOSConcept> narrower = parseNarrower(concept,dataset);
Set<SKOSConcept> broader = parseBroader(concept,dataset);
addToBroader(concept.getURI(),broader);
addToNarrower(concept.getURI(),narrower);
}
}
private void addToNarrower(URI parentURI,Set<SKOSConcept> concepts) {
for (SKOSConcept concept : concepts) {
addToNarrower(parentURI,concept);
}
}
private void addToBroader(URI parentURI,Set<SKOSConcept> concepts) {
for (SKOSConcept concept : concepts) {
addToBroader(parentURI,concept);
}
}
private void addToNarrower(URI parentURI,SKOSConcept concept) {
Set<SKOSConcept> set = narrower.get(parentURI);
if (set==null) {
set=new SKOSHashSet();
}
set.add(concept);
narrower.put(parentURI, set);
SKOSConcept parentConcept = getSKOSConcept(parentURI);
if (!getBroaderThan(concept).contains(parentConcept)) {
addToBroader(concept.getURI(),getSKOSConcept(parentURI));
}
}
private void addToBroader(URI parentURI,SKOSConcept concept) {
Set<SKOSConcept> set = broader.get(parentURI);
if (set==null) {
set=new SKOSHashSet();
}
set.add(concept);
broader.put(parentURI, set);
SKOSConcept parentConcept = getSKOSConcept(parentURI);
if (!getNarrowerThan(concept).contains(parentConcept)) {
addToNarrower(concept.getURI(),getSKOSConcept(parentURI));
}
}
private Set<SKOSConcept> parseNarrower(SKOSConcept concept,SKOSDataset dataset) {
return annotationValuesByURI(concept,URI.create("http://www.w3.org/2004/02/skos/core#narrower"),dataset);
}
private Set<SKOSConcept> parseBroader(SKOSConcept concept,SKOSDataset dataset) {
return annotationValuesByURI(concept,URI.create("http://www.w3.org/2004/02/skos/core#broader"),dataset);
}
private Set<SKOSConcept> annotationValuesByURI(SKOSConcept concept,URI annotation,SKOSDataset dataset) {
Set<SKOSConcept> values = new HashSet<SKOSConcept>();
for (SKOSAnnotation an : concept.getSKOSAnnotationsByURI(dataset, annotation)) {
values.add(getSKOSConcept(an.getAnnotationValue().getURI()));
}
return values;
}
}
/**
* Specialised HashSet, creating to specifically treat concepts with the same URI being regarded as equal
*
* @author Stuart Owen
*
*/
class SKOSHashSet extends HashSet<SKOSConcept> {
private static final long serialVersionUID = -1115862678232624477L;
SKOSHashSet() {
super();
}
SKOSHashSet(Collection<SKOSConcept>c) {
super(c);
}
@Override
public boolean add(SKOSConcept e) {
if (!contains(e)) {
return super.add(e);
}
return false;
}
@Override
public boolean contains(Object o) {
if (super.contains(o)) {
return true;
}
if (o==null) {
return false;
}
if (!(o instanceof SKOSConcept)) {
return false;
}
for (Iterator<SKOSConcept> i = iterator() ; i.hasNext() ;) {
SKOSConcept c = i.next();
if (c.getURI().equals(((SKOSConcept)o).getURI())) {
return true;
}
}
return false;
}
}
| {
"content_hash": "7e536dcba539821ffde4ddec89b9739d",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 141,
"avg_line_length": 29.080952380952382,
"alnum_prop": 0.7373505813001474,
"repo_name": "Tokebluff/RightField",
"id": "5272d6b1cd753bce9c242064ef4aae68a4377d19",
"size": "6433",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/model/skos/SKOSHierarchyReader.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "106"
},
{
"name": "Java",
"bytes": "736823"
},
{
"name": "Shell",
"bytes": "256"
},
{
"name": "Web Ontology Language",
"bytes": "902301"
}
],
"symlink_target": ""
} |
namespace FluentLinqToSql.DatabaseTests.Mappings {
using Entities;
using FluentLinqToSql.Mappings;
public class CustomerMapping : Mapping<Customer> {
public CustomerMapping() {
Named("Customers");
Identity(x => x.Id);
Map(x => x.Name).DbType("nvarchar(50)");
HasMany(x => x.Orders).OtherKey(x => x.CustomerId);
HasOne(x => x.ContactDetails);
DiscriminateOnProperty(x => x.CustomerType)
.BaseClassDiscriminatorValue(0)
.SubClass<PreferredCustomer>(2, preferredCustomer => {
preferredCustomer.Map(x => x.Discount);
});
}
}
} | {
"content_hash": "9c21347be02cc2372d45442e2c72f5ce",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 58,
"avg_line_length": 29.789473684210527,
"alnum_prop": 0.6943462897526502,
"repo_name": "JeremySkinner/FluentLinqToSql",
"id": "1f5ad8b9527bdf8736a01ef9e6be48d3f5f914b3",
"size": "566",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/FluentLinqToSql.DatabaseTests/Mappings/CustomerMapping.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Boo",
"bytes": "2951"
},
{
"name": "C#",
"bytes": "241991"
}
],
"symlink_target": ""
} |
<?php
$editID = intval( preg_replace( '([\D])', '', $_GET['edit'] ) );
$editPost = mysqli_query( $con, "SELECT title, body FROM " . TSA_DB_PREFIX . "posts WHERE id='" . $editID . "' LIMIT 1;" );
if( mysqli_num_rows( $editPost ) == 0 ) {
?>
<div class="alert alert-danger">Post does not exist.</div>
<?php
} else {
$postInfo = mysqli_fetch_array( $editPost );
if( isset( $_POST['editPostTitle'] ) && isset( $_POST['editPostBody'] ) ) {
$editPostTitle = mysqli_real_escape_string( $con, $_POST['editPostTitle'] );
$editPostBody = mysqli_real_escape_string( $con, $_POST['editPostBody'] );
if( mysqli_query( $con, "UPDATE " . TSA_DB_PREFIX . "posts SET title='" . $editPostTitle . "', body='" . $editPostBody . "' WHERE id='" . $editID ."';" ) ) {
?>
<div class="alert alert-success">Post "<?php echo stripslashes( $editPostTitle ); ?>" has been edited.</div>
<?php
} else {
?>
<div class="alert alert-danger">Error! - <?php echo mysqli_error( $con ); ?></div>
<?php
}
} else {
?>
<div class="panel panel-warning">
<div class="panel-heading">Currently editing: "<strong><?php echo $postInfo['title']; ?></strong>"</div>
<div class="panel-body">
<form method="post" action="<?php echo TSA_REDIRECTURL; ?>/editor.php?edit=<?php echo $editID; ?>">
<div class="form-group">
<label for="postTitle">Post title:</label>
<input type="text" class="form-control" name="editPostTitle" id="postTitle" value="<?php echo $postInfo['title']; ?>" required="" />
</div>
<div class="form-group">
<label for="postBody">Post body (main text):</label>
<textarea class="form-control" name="editPostBody" id="postBody" rows="10" cols="50" required=""><?php echo $postInfo['body']; ?></textarea>
</div>
<button type="submit" class="btn btn-success">Edit post!</button>
</form>
</div>
</div>
<?php
}
}
?>
<br />
<a href="<?php echo TSA_REDIRECTURL; ?>/editor.php" class="btn btn-info">Back to editor page</a><br />
<?php
| {
"content_hash": "e18ad3cf668b33fc97d491063494ba98",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 165,
"avg_line_length": 50.630434782608695,
"alnum_prop": 0.5199656504937742,
"repo_name": "The-Blacklist/Twitch-Subscriber-Area",
"id": "c5a980d31a9849b520146da7e07777867daff293",
"size": "2329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "includes/editor/edit.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "166"
},
{
"name": "Hack",
"bytes": "1051"
},
{
"name": "PHP",
"bytes": "117916"
}
],
"symlink_target": ""
} |
package by.vorokhobko.servlets;
import by.vorokhobko.database.TransmissionDatabase;
import by.vorokhobko.models.Transmission;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
public class GetTransmission extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/json");
List<Transmission> transmissions = TransmissionDatabase.getINSTANCE().getAll();
PrintWriter writer = resp.getWriter();
ObjectMapper mapper = new ObjectMapper();
writer.append(mapper.writeValueAsString(transmissions));
writer.flush();
}
} | {
"content_hash": "c2f5421b284c56cf03bbc99b54f846ae",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 96,
"avg_line_length": 33.80769230769231,
"alnum_prop": 0.7724687144482366,
"repo_name": "1Evgeny/java-a-to-z",
"id": "219862e3ef7dcfbdf58c2b575944676fdc4ebf98",
"size": "879",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chapter_010_hibernate/area_car_sales/src/main/java/by.vorokhobko/servlets/GetTransmission.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "16294"
},
{
"name": "Java",
"bytes": "697413"
},
{
"name": "JavaScript",
"bytes": "9341"
},
{
"name": "TSQL",
"bytes": "11619"
},
{
"name": "XSLT",
"bytes": "595"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<sqlMap resource="egovframework/sqlmap/com/ssi/syi/ims/EgovCntcMessage_SQL_Tibero.xml" />
</sqlMapConfig>
| {
"content_hash": "1b53fffff2e09b63d73f0edbf9df221d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 90,
"avg_line_length": 31.3,
"alnum_prop": 0.6645367412140575,
"repo_name": "dasomel/egovframework",
"id": "530fd20cef6130f4ed7124d2b987a76997c6438a",
"size": "313",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "common-component/v3.5.3/src/main/resources/egovframework/sqlmap/config/tibero/sql-map-config-tibero-ssi-syi-ims.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#ifndef AXIOM_STAX_BUILDER_INTERNAL_H
#define AXIOM_STAX_BUILDER_INTERNAL_H
/** @defgroup axiom AXIOM (Axis Object Model)
* @ingroup axis2
* @{
*/
#include <axiom_stax_builder.h>
#include <axiom_soap_builder.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @defgroup axiom_stax builder
* @ingroup axiom
* @{
*/
int AXIS2_CALL
axiom_stax_builder_get_current_event(
axiom_stax_builder_t * builder,
const axutil_env_t * env);
void AXIS2_CALL
axiom_stax_builder_set_lastnode(
axiom_stax_builder_t * builder,
const axutil_env_t * env,
axiom_node_t * om_node);
axiom_node_t *AXIS2_CALL
axiom_stax_builder_get_lastnode(
axiom_stax_builder_t * builder,
const axutil_env_t * env);
void AXIS2_CALL
axiom_stax_builder_set_element_level(
axiom_stax_builder_t * builder,
const axutil_env_t * env,
int element_level);
int AXIS2_CALL
axiom_stax_builder_get_element_level(
axiom_stax_builder_t * builder,
const axutil_env_t * env);
/* this will be called from root node to free the stax builder */
void AXIS2_CALL
axiom_stax_builder_free_internal(
axiom_stax_builder_t * builder,
const axutil_env_t * env);
/**
* builder is finished building om structure
* @param builder pointer to stax builder struct to be used
* @param environment Environment. MUST NOT be NULL.
*
* @return AXIS2_TRUE if is complete or AXIS2_FALSE otherwise
*/
axis2_bool_t AXIS2_CALL
axiom_stax_builder_is_complete(
struct axiom_stax_builder *builder,
const axutil_env_t * env);
/**
* moves the reader to next event and returns the token returned by the xml_reader ,
* @param builder pointer to STAX builder struct to be used
* @param environment Environment. MUST NOT be NULL.
* @return next event axiom_xml_reader_event_types. Returns -1 on error
*/
int AXIS2_CALL
axiom_stax_builder_next_with_token(
struct axiom_stax_builder *builder,
const axutil_env_t * env);
void AXIS2_CALL
axiom_stax_builder_set_soap_builder(
axiom_stax_builder_t *om_builder,
const axutil_env_t *env,
axiom_soap_builder_t *soap_builder);
axiom_node_t *AXIS2_CALL
axiom_stax_builder_get_root_node(
axiom_stax_builder_t *om_builder,
const axutil_env_t * env);
#if 0
/**
* Discards the element that is being built currently.
* @param environment Environment. MUST NOT be NULL, .
* @param builder pointer to stax builder struct to be used
* @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE.
*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_stax_builder_discard_current_element(
struct axiom_stax_builder *builder,
const axutil_env_t * env);
AXIS2_EXTERN axiom_xml_reader_t *AXIS2_CALL
axiom_stax_builder_get_parser(
axiom_stax_builder_t * om_builder,
const axutil_env_t * env);
AXIS2_EXTERN void AXIS2_CALL
axiom_stax_builder_set_cache(
axiom_stax_builder_t * om_builder,
const axutil_env_t * env,
axis2_bool_t enable_cache);
/**
* Builds the next node from stream. Moves pull parser forward and reacts
* to events.
* @param builder pointer to stax builder struct to be used
* @param environment Environment. MUST NOT be NULL.
* @return a pointer to the next node, or NULL if there are no more nodes.
* On erros sets the error and returns NULL.
*/
axiom_node_t *AXIS2_CALL
axiom_stax_builder_next(
struct axiom_stax_builder *builder,
const axutil_env_t * env);
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#endif /** AXIOM_STAX_BUILDER_INTERNAL_H */
| {
"content_hash": "b3812ee36eb620d9daa81a8df7b7ecc7",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 89,
"avg_line_length": 27.5177304964539,
"alnum_prop": 0.6350515463917525,
"repo_name": "MI-LA01/kt_wso2-php5.3",
"id": "4294778739f5b24f8ec6e0980e03663ff4787347",
"size": "4682",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "wsf_c/axis2c/axiom/src/om/axiom_stax_builder_internal.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6037"
},
{
"name": "C",
"bytes": "17550697"
},
{
"name": "C++",
"bytes": "982562"
},
{
"name": "CSS",
"bytes": "18954"
},
{
"name": "HTML",
"bytes": "611390"
},
{
"name": "JavaScript",
"bytes": "8450"
},
{
"name": "Makefile",
"bytes": "147221"
},
{
"name": "Objective-C",
"bytes": "8687"
},
{
"name": "PHP",
"bytes": "495961"
},
{
"name": "Perl",
"bytes": "398"
},
{
"name": "Shell",
"bytes": "101791"
},
{
"name": "XSLT",
"bytes": "412479"
}
],
"symlink_target": ""
} |
@extends('enblogmaster')
@section('content')
<main class="mdl-layout__content">
<div class="tealinux-toko-content">
<div class="mdl-grid">
<div class="mdl-card something-else mdl-cell mdl-cell--8-col mdl-cell--4-col-desktop mdl-shadow--2dp">
<button class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-color--accent"><i class="material-icons mdl-color-text--white">shopping_cart</i></button>
<div class="mdl-card__media mdl-color--white mdl-color-text--grey-600">
<img src="{{asset('images/logo.png')}}">
Rp. 10.000
</div>
<div class="mdl-card__supporting-text meta meta--fill mdl-color-text--grey-600">
<div>
<strong>TeaLinuxOS kit</strong>
</div>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons">share</i>
</button>
</div>
</div>
<div class="mdl-card something-else mdl-cell mdl-cell--8-col mdl-cell--4-col-desktop mdl-shadow--2dp">
<button class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-color--accent"><i class="material-icons mdl-color-text--white">shopping_cart</i></button>
<div class="mdl-card__media mdl-color--white mdl-color-text--grey-600">
<img src="{{asset('images/logo.png')}}">
Rp. 50.000
</div>
<div class="mdl-card__supporting-text meta meta--fill mdl-color-text--grey-600">
<div>
<strong>Mug TeaLinux</strong>
</div>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons">share</i>
</button>
</div>
</div>
<div class="mdl-card something-else mdl-cell mdl-cell--8-col mdl-cell--4-col-desktop mdl-shadow--2dp">
<button class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-color--accent"><i class="material-icons mdl-color-text--white">shopping_cart</i></button>
<div class="mdl-card__media mdl-color--white mdl-color-text--grey-600">
<img src="{{asset('images/logo.png')}}">
Rp. 100.000
</div>
<div class="mdl-card__supporting-text meta meta--fill mdl-color-text--grey-600">
<div>
<strong>Kaos TeaLinuxOS</strong>
</div>
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons">share</i>
</button>
</div>
</div>
</div>
</div>
@endsection | {
"content_hash": "1eb04f519464fc465e2e87213bf7e402",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 211,
"avg_line_length": 57.6140350877193,
"alnum_prop": 0.4884287454323995,
"repo_name": "tealinuxos/tealinuxos-blog",
"id": "ec6cc2474d030d9a575157844e10964e15e73ec5",
"size": "3284",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/views/en/blog/toko.blade.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "382"
},
{
"name": "CSS",
"bytes": "204993"
},
{
"name": "HTML",
"bytes": "401064"
},
{
"name": "JavaScript",
"bytes": "27695"
},
{
"name": "PHP",
"bytes": "416293"
}
],
"symlink_target": ""
} |
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/home/bladestery/Sapphire/example_apps/AndroidStudioMinnie/sapphire/.externalNativeBuild/cmake/debug/mips64/install")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Debug")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/libs/mips64" TYPE STATIC_LIBRARY OPTIONAL FILES "/home/bladestery/Sapphire/example_apps/AndroidStudioMinnie/sapphire/.externalNativeBuild/cmake/debug/mips64/lib/mips64/libopencv_videostab.a")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/deblurring.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/fast_marching.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/fast_marching_inl.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/frame_source.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/global_motion.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/inpainting.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/log.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/motion_core.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/optical_flow.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/outlier_rejection.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/ring_buffer.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/stabilizer.hpp")
endif()
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "dev" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/sdk/native/jni/include/opencv2/videostab" TYPE FILE OPTIONAL FILES "/home/bladestery/Downloads/opencv-3.2.0/modules/videostab/include/opencv2/videostab/wobble_suppression.hpp")
endif()
| {
"content_hash": "ddea96eecdf2631414312ee1f1fc2dc4",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 254,
"avg_line_length": 63.136842105263156,
"alnum_prop": 0.7802600866955652,
"repo_name": "bladestery/Sapphire",
"id": "5268ef16e3f312df9d17077bbbbc23f8d337601d",
"size": "6114",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example_apps/AndroidStudioMinnie/sapphire/.externalNativeBuild/cmake/debug/mips64/modules/videostab/cmake_install.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "139298"
},
{
"name": "C++",
"bytes": "1444206"
},
{
"name": "CMake",
"bytes": "3964660"
},
{
"name": "Java",
"bytes": "14581743"
},
{
"name": "Makefile",
"bytes": "107081"
},
{
"name": "Python",
"bytes": "11485"
},
{
"name": "Shell",
"bytes": "495"
}
],
"symlink_target": ""
} |
package org.lavenderx.service;
/**
* Created on 2016-01-18.
*
* @author lavenderx
*/
public interface UserService {
}
| {
"content_hash": "14f3681a33515e7a33fc0538e2f8f079",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 30,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.6829268292682927,
"repo_name": "lavenderx/modern-java-web-scaffold",
"id": "d97e5b8809902c8312e6fdc7bcb87dae4163582d",
"size": "123",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/src/main/java/org/lavenderx/service/UserService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20"
},
{
"name": "HTML",
"bytes": "363"
},
{
"name": "Java",
"bytes": "17142"
},
{
"name": "JavaScript",
"bytes": "11631"
},
{
"name": "Shell",
"bytes": "2305"
},
{
"name": "Vue",
"bytes": "4895"
}
],
"symlink_target": ""
} |
<?php
if(isset($frame)==true){
check_permiss($_SESSION['kt_login_id'], 29, 'admin.php');
}else{
header("location: ../admin.php");
}
?>
<? $errMsg =''?>
<?
$path = "../web/images/adv";
$pathdb = "images/adv";
if (isset($_POST['btnSave'])){
$code = isset($_POST['txtCode']) ? trim($_POST['txtCode']) : '';
$name = isset($_POST['txtName']) ? trim($_POST['txtName']) : '';
$type = $_POST['slType'];
$parent = $_POST['ddCat'];
$subject = vietdecode($name);
$detail_short = isset($_POST['txtDetailShort']) ? trim($_POST['txtDetailShort']) : '';
$detail = isset($_POST['txtDetail']) ? trim($_POST['txtDetail']) : '';
$link = isset($_POST['link']) ? trim($_POST['link']) : '';
$sort = isset($_POST['txtSort']) ? trim($_POST['txtSort']) : 0;
$status = $_POST['chkStatus']!='' ? 1 : 0;
$mainPosition = $_POST['slAlignCreateAdminBanner'];
$subPosition = $_POST['slPageCreateAdminBanner'];
$startDateTime = $_POST['txtCreateBannerCreateDatetime'] ? trim($_POST['txtCreateBannerCreateDatetime']) : '';
$endDateTime = $_POST['txtCreateBannerEndDatetime'] ? trim($_POST['txtCreateBannerEndDatetime']) : '';
$catInfo = getRecord('tbl_adv', 'id='.$parent);
if(!$multiLanguage){
$lang = $catInfo['lang'];
}else{
$lang = $catInfo['lang'] != '' ? $catInfo['lang'] : $_POST['cmbLang'];
}
if ($name=="") $errMsg .= "Hãy nhập tên banner !<br>";
if ($link=="") $errMsg .= "Hãy nhập liên kết cho banner !<br>";
if ($startDateTime=="") $errMsg .= "Hãy nhập thời gian đặt banner !<br>";
if ($endDateTime=="") $errMsg .= "Hãy nhập thời gian kết thúc banner !<br>";
if ($endDateTime < $startDateTime) $errMsg .= "Thời gian kết thúc phải bằng hoặc lớn hơn thời gian đặt banner !<br>";
$errMsg .= checkUpload($_FILES["txtImage"],".jpg;.gif;.bmp;.png",500*1024,0);
$errMsg .= checkUpload($_FILES["txtImageLarge"],".jpg;.gif;.bmp;.png",500*1024,0);
if ($errMsg==''){
if (!empty($_POST['id'])){
$oldid = $_POST['id'];
$sql = "update tbl_adv set name='".$name."',style='".$type."',link='".$link."',sort='".$sort."', status='".$status."'
,main_position='".$mainPosition."',sub_position='".$subPosition."',start_banner='".$startDateTime."',finish_banner='".$endDateTime."',last_modified=now() where id='".$oldid."'";
}else{
$sql = "insert into tbl_adv (name, style, link, sort, status, date_added, last_modified, main_position, sub_position, start_banner, finish_banner) values ('".$name."'
,'".$type."','".$link."','".$sort."','1',now(),now(),'".$mainPosition."','".$subPosition."','".$startDateTime."','".$endDateTime."')";
}
if (mysql_query($sql,$conn)){
if(empty($_POST['id'])) $oldid = mysql_insert_id();
$r = getRecord("tbl_adv","id=".$oldid);
$sqlUpdateField = "";
if ($_POST['chkClearImg']==''){
$extsmall=getFileExtention($_FILES['txtImage']['name']);
if (makeUpload($_FILES['txtImage'],"$path/advs$oldid$extsmall")){
@chmod("$path/advs$oldid$extsmall", 0777);
$sqlUpdateField = " image='$pathdb/advs$oldid$extsmall' ";
}
}else{
if(file_exists('../'.$r['image'])) @unlink('../'.$r['image']);
$sqlUpdateField = " image='' ";
}
if ($_POST['chkClearImgLarge']==''){
$extlarge=getFileExtention($_FILES['txtImageLarge']['name']);
if (makeUpload($_FILES['txtImageLarge'],"$path/adv_l$oldid$extlarge")){
@chmod("$path/adv_l$oldid$extlarge", 0777);
if($sqlUpdateField != "") $sqlUpdateField .= ",";
$sqlUpdateField .= " image_large='$pathdb/adv_l$oldid$extlarge' ";
}
}else{
if(file_exists('../'.$r['image_large'])) @unlink('../'.$r['image_large']);
if($sqlUpdateField != "") $sqlUpdateField .= ",";
$sqlUpdateField .= " image_large='' ";
}
if($sqlUpdateField!='') {
$sqlUpdate = "update tbl_adv set $sqlUpdateField where id='".$oldid."'";
mysql_query($sqlUpdate,$conn);
}
}else{
$errMsg = "Không thể cập nhật !";
}
}
if ($errMsg == '')
echo '<script>window.location="admin.php?act=adv&cat='.$_REQUEST['cat'].'&page='.$_REQUEST['page'].'&code=1"</script>';
}else{
if (isset($_GET['id'])){
$oldid=$_GET['id'];
$page = $_GET['page'];
$sql = "select * from tbl_adv where id='".$oldid."'";
if ($result = mysql_query($sql,$conn)) {
$row=mysql_fetch_array($result);
$code = $row['code'];
$name = $row['name'];
$type = $row['type'];
$parent = $row['parent'];
$subject = $row['subject'];
$detail_short = $row['detail_short'];
$link = $row['link'];
$detail = $row['detail'];
$image = $row['image'];
$image_large = $row['image_large'];
$sort = $row['sort'];
$status = $row['status'];
$date_added = $row['date_added'];
$last_modified = $row['last_modified'];
$mainPosition = $row['main_position'];
$subPosition = $row['sub_position'];
$startDateTime = $row['start_banner'];
$endDateTime = $row['finish_banner'];
$style = $row['style'];
}
}
}
?>
<?php if( $errMsg !=""){ ?>
<div class="alert alert-block no-radius fade in">
<button type="button" class="close" data-dismiss="alert"><span class="mini-icon cross_c"></span></button>
<p class="pAlert pWarning"><strong class="strongAlert strongWarning">Warning!</strong> <?php echo $errMsg; ?> <span class="xClose" title="Đóng" onclick="$(this).parent().hide();">x</span></p>
</div>
<?php }?>
<div class="row-fluid">
<div class="span12">
<div class="box-widget">
<div class="widget-container">
<div class="widget-block">
<form method="post" name="frmForm" enctype="multipart/form-data" action="admin.php?act=adv_m">
<input type="hidden" name="txtSubject" id="txtSubject">
<input type="hidden" name="txtDetailShort" id="txtDetailShort">
<input type="hidden" name="txtDetail" id="txtDetail">
<input type="hidden" name="act" value="adv_m">
<input type="hidden" name="id" value="<?=$_REQUEST['id']?>">
<input type="hidden" name="page" value="<?=$_REQUEST['page']?>">
<div><? if($errMsg!=''){echo '<p align=center class="err">'.$errMsg.'<br></p>';} ?></div>
<table class="table_chinh">
<tr>
<td class="table_chu_tieude_them" colspan="2" align="center" valign="middle">QUẢNG CÁO</td>
</tr>
<tr>
<td valign="middle" class="table_chu"> </td>
<td valign="middle"> </td>
</tr>
<tr>
<td valign="middle" width="30%">Tên<span class="sao_bb">*</span></td>
<td valign="middle" width="70%">
<input name="txtName" type="text" class="table_khungnho" id="txtName" value="<?=$name?>"/>
</td>
</tr>
<tr>
<td valign="middle" width="30%">Link<span class="sao_bb">*</span></td>
<td valign="middle"><input name="link" type="text" class="table_khungnho" id="link" value="<?php echo $link; ?>" onchange="if(this.value != ''){addhttp(this.id, this.value);}"/></td>
</tr>
<tr>
<td valign="middle" width="30%">Thứ tự sắp xếp</td>
<td valign="middle" width="70%">
<input class="table_khungnho" value="<?=$sort?>" type="text" name="txtSort" />
</td>
</tr>
<tr>
<td valign="middle" width="30%">Vị trí<span class="sao_bb">*</span></td>
<td valign="middle" width="70%">
<select class="table_khungnho" id="slAlignCreateAdminBanner" name="slAlignCreateAdminBanner" value="<?=$mainPosition?>" style="margin-bottom: 5px;" onchange="positionSelector(this.value);">
<option value="0" id="0">BÊN TRÁI</option>
<option value="1" id="1">Ở GIỮA</option>
<option value="2" id="2">BÊN TRÊN</option>
<option value="3" id="3">BÊN PHẢI</option>
</select>
<input type="hidden" name="slType" id="slType" value="<?=$style?>">
<select class="table_khungnho" id="slPageCreateAdminBanner" name="slPageCreateAdminBanner" value="<?=$subPosition?>" onchange="$('#slType').val($('#slPageCreateAdminBanner option:selected').text());"> </select>
</td>
</tr>
<tr>
<td valign="middle" width="30%">Thời gian đặt banner<span class="sao_bb">*</span></td>
<td valign="middle" width="70%">
<input style="margin-top: 2px;" type="date" class="table_khungnho" name="txtCreateBannerCreateDatetime" value="<?=$startDateTime?>" id="txtCreateBannerCreateDatetime">
</td>
</tr>
<tr>
<td valign="middle" width="30%">Thời gian kết thúc banner<span class="sao_bb">*</span></td>
<td valign="middle" width="70%">
<input style="margin-top: 2px;" type="date" class="table_khungnho" name="txtCreateBannerEndDatetime" value="<?=$endDateTime?>" id="txtCreateBannerEndDatetime">
</td>
</tr>
<tr>
<td valign="middle" width="30%">Hình đại diện</td>
<td valign="middle" width="70%">
<input type="file" name="txtImage" class="textbox" size="34">
<input type="checkbox" name="chkClearImg" value="on"> Xóa bỏ hình ảnh <br>
<? if ($image!=''){ echo '<img border="0" width="80" height="80" src="../web/'.$image.'"><br><br>Hình (kích thước nhỏ)';}?>
</td>
</tr>
<tr>
<td valign="top" width="30%">Không hiển thị</td>
<td valign="middle" width="70%">
<input type="checkbox" name="chkStatus" value="<?php if($status>0){echo $status;}else{echo 0;} ?>" <? if ($status>0) echo 'checked' ?> onchange="if($(this).is(':checked')){this.value = 1;}else{this.value = 0;}">
</td>
</tr>
<tr>
<td valign="top" width="30%"> </td>
<td valign="middle" width="70%">
<input type="submit" name="btnSave" VALUE="Cập nhật" class=button onclick="return btnSave_onclick()">
<input type="reset" class=button value="Nhập lại">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var subPosition = "<?php echo $subPosition ?>";
if(subPosition == ''){
positionSelector(0);
}
else{
positionSelector("<?php echo $mainPosition ?>");
$("select#slAlignCreateAdminBanner").val("<?php echo $mainPosition ?>");
$("select#slPageCreateAdminBanner").val("<?php echo $subPosition ?>");
}
});
</script> | {
"content_hash": "66fb161629cabc3b5372561db056cf47",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 246,
"avg_line_length": 53.833333333333336,
"alnum_prop": 0.46852425180598556,
"repo_name": "vikigroup/cbuilk",
"id": "0e59bd2c961ff08e83912fccad98e5cd2076f390",
"size": "12719",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "admin/adv/adv_m.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "67667"
},
{
"name": "ApacheConf",
"bytes": "12244"
},
{
"name": "CSS",
"bytes": "1113898"
},
{
"name": "HTML",
"bytes": "2118990"
},
{
"name": "JavaScript",
"bytes": "3533478"
},
{
"name": "PHP",
"bytes": "4772319"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/darker_gray" />
<corners android:radius="@dimen/statebutton_md_radius" />
</shape>
</item>
<item
android:bottom="@dimen/statebutton_md_bottom_shadow"
android:left="@dimen/statebutton_md_left_shadow"
android:right="@dimen/statebutton_md_right_shadow">
<shape android:shape="rectangle">
<corners android:radius="@dimen/statebutton_md_radius" />
<solid android:color="@color/md_light_green_900" />
</shape>
</item>
</layer-list>
| {
"content_hash": "9edbb103ed4ae8420d41a88269d8d646",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 40.833333333333336,
"alnum_prop": 0.6163265306122448,
"repo_name": "andrea-rosa/statebutton-android",
"id": "f6bfb119e9de740a0ea18026d8eb216654b5b034",
"size": "735",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "statebutton/src/main/res/drawable/statebutton_md_lightgreenbg_success.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "21445"
}
],
"symlink_target": ""
} |
void* qtc_QGraphicsScene();
void* qtc_QGraphicsScene1(void*);
void* qtc_QGraphicsScene2(double, double, double, double);
void* qtc_QGraphicsScene3(void*);
void* qtc_QGraphicsScene4(void*,void*);
void* qtc_QGraphicsScene5(double, double, double, double,void*);
void* qtc_QGraphicsScene6(double,double,double,double);
void* qtc_QGraphicsScene7(double,double,double,double,void*);
void* qtc_QGraphicsScene_addEllipse(void*,void*);
void* qtc_QGraphicsScene_addEllipse_qth(void*);
void* qtc_QGraphicsScene_addEllipse1(void*,void*,void*);
void* qtc_QGraphicsScene_addEllipse1_qth(void*,void*);
void* qtc_QGraphicsScene_addEllipse2(void*,void*,void*,void*);
void* qtc_QGraphicsScene_addEllipse2_qth(void*,void*,void*);
void* qtc_QGraphicsScene_addEllipse3(void*,double,double,double,double);
void* qtc_QGraphicsScene_addEllipse4(void*,double,double,double,double,void*);
void* qtc_QGraphicsScene_addEllipse5(void*,double,double,double,double,void*,void*);
void qtc_QGraphicsScene_addItem(void*,void*);
void qtc_QGraphicsScene_addItem_graphicstextitem(void*,void*);
void* qtc_QGraphicsScene_addLine(void*,void*);
void* qtc_QGraphicsScene_addLine_qth(void*);
void* qtc_QGraphicsScene_addLine1(void*,void*,void*);
void* qtc_QGraphicsScene_addLine1_qth(void*,void*);
void* qtc_QGraphicsScene_addLine2(void*,double,double,double,double);
void* qtc_QGraphicsScene_addLine3(void*,double,double,double,double,void*);
void* qtc_QGraphicsScene_addPath(void*,void*);
void* qtc_QGraphicsScene_addPath1(void*,void*,void*);
void* qtc_QGraphicsScene_addPath2(void*,void*,void*,void*);
void* qtc_QGraphicsScene_addPixmap(void*,void*);
void* qtc_QGraphicsScene_addPolygon(void*,void*);
void* qtc_QGraphicsScene_addPolygon1(void*,void*,void*);
void* qtc_QGraphicsScene_addPolygon2(void*,void*,void*,void*);
void* qtc_QGraphicsScene_addRect(void*,void*);
void* qtc_QGraphicsScene_addRect_qth(void*);
void* qtc_QGraphicsScene_addRect1(void*,void*,void*);
void* qtc_QGraphicsScene_addRect1_qth(void*,void*);
void* qtc_QGraphicsScene_addRect2(void*,void*,void*,void*);
void* qtc_QGraphicsScene_addRect2_qth(void*,void*,void*);
void* qtc_QGraphicsScene_addRect3(void*,double,double,double,double);
void* qtc_QGraphicsScene_addRect4(void*,double,double,double,double,void*);
void* qtc_QGraphicsScene_addRect5(void*,double,double,double,double,void*,void*);
void* qtc_QGraphicsScene_addSimpleText(void*,void*);
void* qtc_QGraphicsScene_addSimpleText1(void*,void*,void*);
void* qtc_QGraphicsScene_addText(void*,void*);
void* qtc_QGraphicsScene_addText1(void*,void*,void*);
void qtc_QGraphicsScene_advance(void*);
void* qtc_QGraphicsScene_backgroundBrush(void*);
int qtc_QGraphicsScene_bspTreeDepth(void*);
void qtc_QGraphicsScene_clearFocus(void*);
void qtc_QGraphicsScene_clearSelection(void*);
int qtc_QGraphicsScene_collidingItems(void*,void*,void*);
int qtc_QGraphicsScene_collidingItems_graphicstextitem(void*,void*,void*);
int qtc_QGraphicsScene_collidingItems1(void*,void*,long,void*);
int qtc_QGraphicsScene_collidingItems1_graphicstextitem(void*,void*,long,void*);
void qtc_QGraphicsScene_contextMenuEvent(void*,void*);
void qtc_QGraphicsScene_destroyItemGroup(void*,void*);
void qtc_QGraphicsScene_dragEnterEvent(void*,void*);
void qtc_QGraphicsScene_dragLeaveEvent(void*,void*);
void qtc_QGraphicsScene_dragMoveEvent(void*,void*);
void qtc_QGraphicsScene_drawBackground(void*,void*,void*);
void qtc_QGraphicsScene_drawBackground_qth(void*,void*, double, double, double, double);
void qtc_QGraphicsScene_drawForeground(void*,void*,void*);
void qtc_QGraphicsScene_drawForeground_qth(void*,void*, double, double, double, double);
void qtc_QGraphicsScene_drawItems(void*,void*,int,int,QGraphicsItem**,int,void*);
void qtc_QGraphicsScene_drawItems1(void*,void*,int,int,QGraphicsItem**,int,void*,void*);
void qtc_QGraphicsScene_dropEvent(void*,void*);
int qtc_QGraphicsScene_event(void*,void*);
void qtc_QGraphicsScene_focusInEvent(void*,void*);
void* qtc_QGraphicsScene_focusItem(void*);
void qtc_QGraphicsScene_focusOutEvent(void*,void*);
void* qtc_QGraphicsScene_foregroundBrush(void*);
int qtc_QGraphicsScene_hasFocus(void*);
double qtc_QGraphicsScene_height(void*);
void qtc_QGraphicsScene_helpEvent(void*,void*);
void qtc_QGraphicsScene_inputMethodEvent(void*,void*);
void* qtc_QGraphicsScene_inputMethodQuery(void*,long);
void qtc_QGraphicsScene_invalidate(void*);
void qtc_QGraphicsScene_invalidate1(void*,void*);
void qtc_QGraphicsScene_invalidate1_qth(void*);
void qtc_QGraphicsScene_invalidate2(void*,void*,long);
void qtc_QGraphicsScene_invalidate2_qth(void*,long);
void qtc_QGraphicsScene_invalidate3(void*,double,double,double,double);
void qtc_QGraphicsScene_invalidate4(void*,double,double,double,double,long);
void* qtc_QGraphicsScene_itemAt(void*,void*);
void* qtc_QGraphicsScene_itemAt_qth(void*);
void* qtc_QGraphicsScene_itemAt1(void*,double,double);
long qtc_QGraphicsScene_itemIndexMethod(void*);
int qtc_QGraphicsScene_items(void*,void*);
int qtc_QGraphicsScene_items1(void*,void*,void*);
int qtc_QGraphicsScene_items1_qth(void*,void*);
int qtc_QGraphicsScene_items2(void*,void*,void*);
int qtc_QGraphicsScene_items3(void*,void*,void*);
int qtc_QGraphicsScene_items3_qth(void*,void*);
int qtc_QGraphicsScene_items4(void*,void*,void*);
int qtc_QGraphicsScene_items5(void*,void*,long,void*);
int qtc_QGraphicsScene_items6(void*,void*,long,void*);
int qtc_QGraphicsScene_items7(void*,void*,long,void*);
int qtc_QGraphicsScene_items7_qth(void*,long,void*);
int qtc_QGraphicsScene_items8(void*,double,double,double,double,void*);
int qtc_QGraphicsScene_items9(void*,double,double,double,double,long,void*);
void* qtc_QGraphicsScene_itemsBoundingRect(void*);
void* qtc_QGraphicsScene_itemsBoundingRect_qth(void*,double*,double*,double*,double*);
void qtc_QGraphicsScene_keyPressEvent(void*,void*);
void qtc_QGraphicsScene_keyReleaseEvent(void*,void*);
void qtc_QGraphicsScene_mouseDoubleClickEvent(void*,void*);
void* qtc_QGraphicsScene_mouseGrabberItem(void*);
void qtc_QGraphicsScene_mouseMoveEvent(void*,void*);
void qtc_QGraphicsScene_mousePressEvent(void*,void*);
void qtc_QGraphicsScene_mouseReleaseEvent(void*,void*);
void qtc_QGraphicsScene_removeItem(void*,void*);
void qtc_QGraphicsScene_removeItem_graphicstextitem(void*,void*);
void qtc_QGraphicsScene_render(void*,void*);
void qtc_QGraphicsScene_render1(void*,void*,void*);
void qtc_QGraphicsScene_render1_qth(void*,void*);
void qtc_QGraphicsScene_render2(void*,void*,void*,void*);
void qtc_QGraphicsScene_render2_qth(void*,void*);
void qtc_QGraphicsScene_render3(void*,void*,void*,void*,long);
void qtc_QGraphicsScene_render3_qth(void*,void*,long);
void* qtc_QGraphicsScene_sceneRect(void*);
void* qtc_QGraphicsScene_sceneRect_qth(void*,double*,double*,double*,double*);
int qtc_QGraphicsScene_selectedItems(void*,void*);
void* qtc_QGraphicsScene_selectionArea(void*);
void qtc_QGraphicsScene_setBackgroundBrush(void*,void*);
void qtc_QGraphicsScene_setBspTreeDepth(void*,int);
void qtc_QGraphicsScene_setFocus(void*);
void qtc_QGraphicsScene_setFocus1(void*,long);
void qtc_QGraphicsScene_setFocusItem(void*,void*);
void qtc_QGraphicsScene_setFocusItem_graphicstextitem(void*,void*);
void qtc_QGraphicsScene_setFocusItem1(void*,void*,long);
void qtc_QGraphicsScene_setFocusItem1_graphicstextitem(void*,void*,long);
void qtc_QGraphicsScene_setForegroundBrush(void*,void*);
void qtc_QGraphicsScene_setItemIndexMethod(void*,long);
void qtc_QGraphicsScene_setSceneRect(void*,void*);
void qtc_QGraphicsScene_setSceneRect_qth(void*);
void qtc_QGraphicsScene_setSceneRect1(void*,double,double,double,double);
void qtc_QGraphicsScene_setSelectionArea(void*,void*);
void qtc_QGraphicsScene_setSelectionArea1(void*,void*,long);
void qtc_QGraphicsScene_update(void*);
void qtc_QGraphicsScene_update1(void*,void*);
void qtc_QGraphicsScene_update1_qth(void*);
void qtc_QGraphicsScene_update2(void*,double,double,double,double);
int qtc_QGraphicsScene_views(void*,void*);
void qtc_QGraphicsScene_wheelEvent(void*,void*);
double qtc_QGraphicsScene_width(void*);
void qtc_QGraphicsScene_finalizer(void*);
void* qtc_QGraphicsScene_getFinalizer();
void qtc_QGraphicsScene_delete(void*);
void qtc_QGraphicsScene_deleteLater(void*);
void qtc_QGraphicsScene_childEvent(void*,void*);
void qtc_QGraphicsScene_connectNotify(void*,void*);
void qtc_QGraphicsScene_customEvent(void*,void*);
void qtc_QGraphicsScene_disconnectNotify(void*,void*);
int qtc_QGraphicsScene_eventFilter(void*,void*,void*);
int qtc_QGraphicsScene_receivers(void*,void*);
void* qtc_QGraphicsScene_sender(void*);
void qtc_QGraphicsScene_timerEvent(void*,void*);
| {
"content_hash": "80a6b125564afba799e01d10fc3da2d9",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 88,
"avg_line_length": 54.90384615384615,
"alnum_prop": 0.7952130764740222,
"repo_name": "keera-studios/hsQt",
"id": "6402944c9a2927e42fbf15bb5d7528983225b15b",
"size": "8999",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Qtc/include/gui/qtc_hs_QGraphicsScene.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "4327"
},
{
"name": "C",
"bytes": "2769338"
},
{
"name": "C++",
"bytes": "12337641"
},
{
"name": "Haskell",
"bytes": "18998024"
},
{
"name": "Perl",
"bytes": "28076"
},
{
"name": "Prolog",
"bytes": "527"
},
{
"name": "QMake",
"bytes": "4574"
},
{
"name": "Shell",
"bytes": "3752"
}
],
"symlink_target": ""
} |
from __future__ import print_function, absolute_import, division, unicode_literals
try:
import numpy
except: # NOQA
numpy = None
def Xtest_numpy():
import srsly.ruamel_yaml
if numpy is None:
return
data = numpy.arange(10)
print("data", type(data), data)
yaml_str = srsly.ruamel_yaml.dump(data)
datb = srsly.ruamel_yaml.load(yaml_str)
print("datb", type(datb), datb)
print("\nYAML", yaml_str)
assert data == datb
| {
"content_hash": "c5cd502eb5fcbf036f10993798eea1d9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 82,
"avg_line_length": 21.40909090909091,
"alnum_prop": 0.6411889596602972,
"repo_name": "explosion/srsly",
"id": "2c21854408f94aea8f9a0fd86a562e6e0f59b012",
"size": "488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "srsly/tests/ruamel_yaml/test_numpy.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "137170"
},
{
"name": "C++",
"bytes": "16926"
},
{
"name": "Cython",
"bytes": "33068"
},
{
"name": "Python",
"bytes": "981631"
},
{
"name": "Shell",
"bytes": "346"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.