text stringlengths 558 4.54k | prefix stringlengths 100 2k | middle stringlengths 10 500 | suffix stringlengths 100 2k | type stringclasses 2
values |
|---|---|---|---|---|
<|fim_prefix|>P_SPACE && word->word->space() > 0 &&
!word->word->flag(W_FUZZY_NON) && !word->word->flag(W_FUZZY_SP)))) {
if (!word->word->flag(W_BOL) && word->word->space() > 0 && !word->word->flag(W_FUZZY_NON) &&
!word->word->flag(W_FUZZY_SP)) {
/* Write a space to separate fr... | P_SPACE && word->word->space() > 0 &&
!word->word->flag(W_FUZZY_NON) && !word->word->flag(W_FUZZY_SP)))) {
if (!word->word->flag(W_BOL) && word->word->space() > 0 && !word->word->flag(W_FUZZY_NON) &&
!word->word->flag(W_FUZZY_SP)) {
/* Write a space to separate from preceding g... | uni_ch = kLatinChs[j]; |
break;
}
}
if (uni_ch <= 0xff) {
*ptr++ = static_cast<char>(uni_ch);
last_char_was_tilde = false;
} else {
*ptr++ = kUNLVReject;
last_char_was_tilde = true;
}
}
}
... | ast_based |
<|fim_prefix|>_key_frame");
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
}
undo_redo->commit_action();
//selection.clear();
}
}
void AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim(const Ref<Animation> &p_anim, int p_track, double p_time, real_t p_value, const Vector2 &p_in_han... | _key_frame");
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
}
undo_redo->commit_action();
//selection.clear();
}
}
void AnimationBezierTrackEdit::_bezier_track_insert_key_at_anim(const Ref<Animation> &p_anim, int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vec... | callable_mp(this, &AnimationBezierTrackEdit::_zoom_callback) | );
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
play_position->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
play_position->connect(SceneStringName(draw), callable_mp(this, &AnimationBezierTrackEdit::_play_position_draw));
set_focus_mode(FOCUS... | ast_based |
<|fim_prefix|>s 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 P... | s 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 NON... | if (is_hdr) {
target_format = Image::FORMAT_ASTC_8x8_HDR;
} | else {
target_format = Image::FORMAT_ASTC_8x8;
}
block_x = 8;
block_y = 8;
}
// Compress image data and (if required) mipmaps.
const bool has_mipmaps = r_img->has_mipmaps();
int width = r_img->get_width();
int height = r_img->get_height();
int required_width = (width % block_x) != 0 ? width + (block_x ... | ast_based |
<|fim_prefix|>
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_group_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_set_member_of(ae->node, (accesskit_no... |
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_group_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_set_member_of(ae->node, (accesskit_node_id)p_group_... |
switch (p_live) {
case DisplayServer::AccessibilityLiveMode::LIVE_OFF: {
accesskit_node_set_live(ae->node, ACCESSKIT_LIVE_OFF);
} break;
case DisplayServer::AccessibilityLiveMode::LIVE_POLITE: {
accesskit_node_set_live(ae->node, ACCESSKIT_LIVE_POLITE);
} break;
case DisplayServer::AccessibilityLiveMod... | } break;
}
}
void AccessibilityDriverAccessKit::accessibility_update_add_action(const RID &p_id, DisplayServer::AccessibilityAction p_action, const Callable &p_callable) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification."... | random |
<|fim_prefix|>>GetScaledYResolution(), rect_left_, rect_top_,
rect_width_, rect_height_);
}
/**
* Get a reading-order iterator to the results of LayoutAnalysis and/or
* Recognize. The returned iterator must be deleted after use.
* WARNING! This class points to data held within the Tes... | >GetScaledYResolution(), rect_left_, rect_top_,
rect_width_, rect_height_);
}
/**
* Get a reading-order iterator to the results of LayoutAnalysis and/or
* Recognize. The returned iterator must be deleted after use.
* WARNING! This class points to data held within the TessBaseAPI class... | if (it->Empty(RIL_PARA)) {
continue;
} |
auto block_type = it->BlockType();
switch (block_type) {
case PT_FLOWING_IMAGE:
case PT_HEADING_IMAGE:
case PT_PULLOUT_IMAGE:
case PT_HORZ_LINE:
case PT_VERT_LINE:
// Ignore images and lines for text output.
continue;
case PT_NOISE:
tprintf("TODO: Ple... | ast_based |
<|fim_prefix|> (fgets(pagename, sizeof(pagename), flist) == nullptr) {
break;
}
} else {
if (page >= lines.size()) {
break;
}
snprintf(pagename, sizeof(pagename), "%s", lines[page].c_str());
}
chomp_string(pagename);
Pix *pix = pixRead(pagename);
if (pix == nu... | (fgets(pagename, sizeof(pagename), flist) == nullptr) {
break;
}
} else {
if (page >= lines.size()) {
break;
}
snprintf(pagename, sizeof(pagename), "%s", lines[page].c_str());
}
chomp_string(pagename);
Pix *pix = pixRead(pagename);
if (pix == nullptr) {
... | if (tessedit_page_number >= 0) {
break;
} |
if (!offset) {
break;
}
}
return true;
}
// Master ProcessPages calls ProcessPagesInternal and then does any post-
// processing required due to being in a training mode.
bool TessBaseAPI::ProcessPages(const char *filename, const char *retry_config, int timeout_millisec,
... | ast_based |
<|fim_prefix|> text_buf.draw(get_canvas_item(), string_pos, cc);
float icon_start_height = vofs + rect.size.y / 2.0;
Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2.0, remove->get_width(), remove->get_height());
if (read_only) {
draw_texture(remove, remove_r... | text_buf.draw(get_canvas_item(), string_pos, cc);
float icon_start_height = vofs + rect.size.y / 2.0;
Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2.0, remove->get_width(), remove->get_height());
if (read_only) {
draw_texture(remove, remove_rect.position, ... |
while (scale / timeline_v_zoom < min_left_scale * 2) { | scale += step;
}
bool first = true;
int prev_iv = 0;
for (int i = font->get_height(font_size); i < get_size().height; i++) {
float ofs = get_size().height / 2.0 - i;
ofs *= timeline_v_zoom;
ofs += timeline_v_scroll;
int iv = int(ofs / scale);
if (ofs < 0) {
iv -= 1;... | random |
<|fim_prefix|>R_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_related_id);
ERR_FAIL_NUL... | R_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_related_id);
ERR_FAIL_NULL(other_ae);
... | rid_owner.get_or_null(p_id) | ;
ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_other_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_set_previous_on_line(ae->node, (accesskit_node_id)p_other_id.get_id());
}
void AccessibilityDriverAccessKi... | ast_based |
<|fim_prefix|>
#include "android_keys_utils.h"
#include "display_server_android.h"
void AndroidInputHandler::process_joy_event(AndroidInputHandler::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
Input::get_singleton()->joy_button(p_event.device, (JoyButton)p_event.index, p_event.pressed);
... |
#include "android_keys_utils.h"
#include "display_server_android.h"
void AndroidInputHandler::process_joy_event(AndroidInputHandler::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
Input::get_singleton()->joy_button(p_event.device, (JoyButton)p_event.index, p_event.pressed);
break;
ca... | keycode = Key::KEY_DELETE; | } else {
keycode = fix_keycode(unicode, physical_keycode);
}
switch (physical_keycode) {
case Key::SHIFT: {
shift_mem = p_pressed;
} break;
case Key::ALT: {
alt_mem = p_pressed;
} break;
case Key::CTRL: {
control_mem = p_pressed;
} break;
case Key::META: {
meta_mem = p_pressed;
} break... | random |
<|fim_prefix|>
for (int i = 0; i < track_count; ++i) {
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER || hidden_tracks.has(i) || locked_tracks.has(i)) {
continue;
}
float track_h = animation->bezier_track_interpolate(i, time);
float track_height = _bezier_h_to_pixel(track... |
for (int i = 0; i < track_count; ++i) {
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER || hidden_tracks.has(i) || locked_tracks.has(i)) {
continue;
}
float track_h = animation->bezier_track_interpolate(i, time);
float track_height = _bezier_h_to_pixel(track_h);
if (... | amr.track = E->get().first; | amr.time = newtime;
to_restore.push_back(amr);
to_restore_handle_modes.push_back(animation->bezier_track_get_key_handle_mode(E->get().first, idx));
}
// 3 - Move the keys (re-insert them).
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t newpos = animation->... | random |
<|fim_prefix|> = [curl, &curlcode](const char *function) {
fprintf(stderr, "Error, %s failed with error %s\n", function, curl_easy_strerror(curlcode));
curl_easy_cleanup(curl);
return false;
};
curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
if (curlcode != CURLE_OK) ... | = [curl, &curlcode](const char *function) {
fprintf(stderr, "Error, %s failed with error %s\n", function, curl_easy_strerror(curlcode));
curl_easy_cleanup(curl);
return false;
};
curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
if (curlcode != CURLE_OK) {
retu... | {
return error("curl_easy_setopt");
} |
curlcode = curl_easy_perform(curl);
if (curlcode != CURLE_OK) {
return error("curl_easy_perform");
}
curl_easy_cleanup(curl);
data = reinterpret_cast<const l_uint8 *>(buf.data());
}
#else
fprintf(stderr, "Error, this tesseract has no URL support\n");
return false;
#end... | ast_based |
<|fim_prefix|> */
/* 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: */
/* ... | */
/* 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... | if (p_keycode != Key::META) {
ev->set_meta_pressed(meta_mem);
}
if (p_keycode != Key::CTRL) {
ev->set_ctrl_pressed(control_mem);
} |
}
void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed, bool p_echo) {
static char32_t prev_wc = 0;
char32_t unicode = p_unicode;
if ((p_unicode & 0xfffffc00) == 0xd800) {
if (prev_wc != 0) {
ERR_PRINT("invalid utf16 surrogate input");
}
prev_w... | ast_based |
<|fim_prefix|> ggml_context * ctx = ctx_for_buft(buft);
if (!ctx) {
LLAMA_LOG_ERROR("%s: failed to allocate context for control vector\n", __func__);
return false;
}
ggml_tensor * tensor = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, hparams.n_embd);
tensors.push... | ggml_context * ctx = ctx_for_buft(buft);
if (!ctx) {
LLAMA_LOG_ERROR("%s: failed to allocate context for control vector\n", __func__);
return false;
}
ggml_tensor * tensor = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, hparams.n_embd);
tensors.push_back(tensor);... | }
return true;
} |
// lora
llama_adapter_lora_weight * llama_adapter_lora::get_weight(ggml_tensor * w) {
const std::string name(w->name);
const auto pos = ab_map.find(name);
if (pos != ab_map.end()) {
return &pos->second;
}
return nullptr;
}
static void llama_adapter_lora_init_impl(llama_model & model, co... | random |
<|fim_prefix|> (int)getRMSState() + (int)mCoverageQualityState;
return rating == 4;
}
bool calib::calibController::getFramesNumberState() const
{
return std::max(mCalibData->imagePoints.size(), mCalibData->allCharucoCorners.size()) > mMinFramesNum;
}
bool calib::calibController::getConfidenceIntrer... | (int)getRMSState() + (int)mCoverageQualityState;
return rating == 4;
}
bool calib::calibController::getFramesNumberState() const
{
return std::max(mCalibData->imagePoints.size(), mCalibData->allCharucoCorners.size()) > mMinFramesNum;
}
bool calib::calibController::getConfidenceIntrervalsState() co... | return mean.at<double>(0) / (stdDev.at<double>(0) + 1e-7);
} | }
calib::calibDataController::calibDataController(cv::Ptr<calib::calibrationData> data, int maxFrames, double convParameter) :
mCalibData(data), mParamsFileName("CamParams.xml")
{
mMaxFramesNum = maxFrames;
mAlpha = convParameter;
}
calib::calibDataController::calibDataController()
{
}
void calib::calib... | random |
<|fim_prefix|>/* Copyright 2021 The TensorFlow 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 appli... | /* Copyright 2021 The TensorFlow 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 a... | return "Miscellaneous";
case ActivityCategory::kDatasetOp:
return "Dataset Op";
case ActivityCategory::kTpuOp:
return "TPU Op";
case ActivityCategory::kRendezvous:
return "Rendezvous"; | }
}
// An activity to be recorded.
struct Activity {
using Attributes = absl::flat_hash_map<tsl::string, tsl::string>;
// A human readable title of the activity.
tsl::string title;
// The category of the activity.
ActivityCategory category = ActivityCategory::kMisc;
// Key/value pairs that are attached t... | random |
<|fim_prefix|> const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr;
if (kRegistered) {
c_call = grpc_channel_create_registered_call(
c_channel_, context->propagate_from_call_,
context->propagation_options_.c_bitmask(), cq->cq(),
met... | const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr;
if (kRegistered) {
c_call = grpc_channel_create_registered_call(
c_channel_, context->propagate_from_call_,
context->propagation_options_.c_bitmask(), cq->cq(),
method.channel_ta... | grpc::internal::Call* call) {
ops->FillOps(
call); // Make a copy of call. It's fine since Call just has pointers
}
void* Channel::RegisterMethod(const char* method) {
return grpc_channel_register_call(
c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr... |
grpc_connectivity_state Channel::GetState(bool try_to_connect) {
return grpc_channel_check_connectivity_state(c_channel_, try_to_connect);
}
namespace {
class TagSaver final : public grpc::internal::CompletionQueueTag {
public:
explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() override {}
bool Finaliz... | random |
<|fim_prefix|>
int selected_track = 0;
Vector<Rect2> view_rects;
Ref<Texture2D> bezier_icon;
Ref<Texture2D> bezier_handle_icon;
Ref<Texture2D> selected_icon;
RBMap<int, Rect2> subtracks;
enum {
REMOVE_ICON,
LOCK_ICON,
SOLO_ICON,
VISIBILITY_ICON
};
RBMap<int, RBMap<int, Rect2>> subtrack_icons;
Has... |
int selected_track = 0;
Vector<Rect2> view_rects;
Ref<Texture2D> bezier_icon;
Ref<Texture2D> bezier_handle_icon;
Ref<Texture2D> selected_icon;
RBMap<int, Rect2> subtracks;
enum {
REMOVE_ICON,
LOCK_ICON,
SOLO_ICON,
VISIBILITY_ICON
};
RBMap<int, RBMap<int, Rect2>> subtrack_icons;
HashSet<int> lock... | {
int32_t hash = 23;
hash = hash * 31 * hash_one_uint64(p_value.first); |
hash = hash * 31 * hash_one_uint64(p_value.second);
return hash;
}
};
HashMap<Pair<int, int>, Vector2, PairHasher> additional_moving_handle_lefts;
HashMap<Pair<int, int>, Vector2, PairHasher> additional_moving_handle_rights;
void _clear_selection();
void _clear_selection_for_anim(const Ref<Animation> &p... | ast_based |
<|fim_prefix|>ling_selection_pivot.y) * (scaling_selection_scale.y - 1);
}
}
if (moving_inserted_key && moving_selection_from_track == p_track) {
if (moving_selection_from_key == i) {
Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(p_track, i);
if (handle_mode != Anima... | ling_selection_pivot.y) * (scaling_selection_scale.y - 1);
}
}
if (moving_inserted_key && moving_selection_from_track == p_track) {
if (moving_selection_from_key == i) {
Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(p_track, i);
if (handle_mode != Animation::HANDLE_M... | int j = from_x; | j <= to_x; j++) {
float t = (j - limit) / scale + timeline->get_value();
float h;
if (j == point_end) {
h = end.y; // Make sure it always connects.
} else if (j == point_start) {
h = start.y; // Make sure it always connects.
} else { // Custom interpolation, used because it needs to show paths... | ast_based |
<|fim_prefix|> }
Ref<Texture2D> t;
if (animation) {
t = frames->get_frame_texture(animation, frame);
}
if (t.is_null()) {
return Rect2();
}
Size2 s = t->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;
}
if (s == Size2(0, 0)) {
s = Size2(1, 1);
}
return Rect2(ofs, s);
}
void Anima... | }
Ref<Texture2D> t;
if (animation) {
t = frames->get_frame_texture(animation, frame);
}
if (t.is_null()) {
return Rect2();
}
Size2 s = t->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;
}
if (s == Size2(0, 0)) {
s = Size2(1, 1);
}
return Rect2(ofs, s);
}
void AnimatedSprite2D::_... | ERR_FAIL_COND(ae.is_null()); |
Rect2 dst_rect = _get_rect();
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_IMAGE);
DisplayServer::get_singleton()->accessibility_update_set_transform(ae, get_transform());
DisplayServer::get_singleton()->accessibility_update_set_bounds(ae, dst_re... | random |
<|fim_prefix|>/**************************************************************************/
/* engine.h */
/**************************************************************************/
/* This file is part of: *... | /**************************************************************************/
/* engine.h */
/**************************************************************************/
/* This file is part of: */
/* ... | /* 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, DA... | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/os/main_loop.h"
#include "core/string/ustring.h"
#include "... | random |
<|fim_prefix|> handle_mode,
handle_set_mode);
}
// 4 - (undo) Remove inserted keys.
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t newpos = animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x;
undo_redo->add_undo_meth... | handle_mode,
handle_set_mode);
}
// 4 - (undo) Remove inserted keys.
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t newpos = animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x;
undo_redo->add_undo_method(animation.p... | {
real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second); |
real_t newpos = oldpos + moving_selection_offset.x;
undo_redo->add_do_method(this, "_select_at_anim", animation, E->get().first, newpos, i == 0);
undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, oldpos, i == 0);
i++;
}
AnimationPlayerEditor *ape = AnimationPl... | ast_based |
<|fim_prefix|>
lc.a *= 0.5;
draw_line(Point2(limit, i), Point2(right_limit, i), lc, Math::round(EDSCALE));
Color c = color;
c.a *= 0.5;
draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, c);
... |
lc.a *= 0.5;
draw_line(Point2(limit, i), Point2(right_limit, i), lc, Math::round(EDSCALE));
Color c = color;
c.a *= 0.5;
draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, c);
}
f... | {
offset += moving_selection_offset.x;
value += moving_selection_offset.y; |
} else if (scaling_selection) {
offset += -scaling_selection_offset.x + (offset - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
value += -scaling_selection_offset.y + (value - scaling_selection_pivot.y) * (scaling_selection_scale.y - 1);
}
}
Vector2 pos((offse... | ast_based |
<|fim_prefix|>
// set tensor data
{
llama_file gguf_file(path_lora, "rb");
std::vector<uint8_t> read_buf;
auto set_tensor = [&](ggml_tensor * orig, ggml_tensor * dev) {
size_t offs = gguf_get_data_offset(ctx_gguf.get()) + gguf_get_tensor_offset(ctx_gguf.get(), gguf_find_tenso... |
// set tensor data
{
llama_file gguf_file(path_lora, "rb");
std::vector<uint8_t> read_buf;
auto set_tensor = [&](ggml_tensor * orig, ggml_tensor * dev) {
size_t offs = gguf_get_data_offset(ctx_gguf.get()) + gguf_get_tensor_offset(ctx_gguf.get(), gguf_find_tensor(ctx_gguf.get... | {
if (buf_size > 0) {
buf[0] = '\0';
}
return -1;
} |
auto it = adapter->gguf_kv.begin();
std::advance(it, i);
return snprintf(buf, buf_size, "%s", it->first.c_str());
}
int32_t llama_adapter_meta_val_str_by_index(const llama_adapter_lora * adapter, int32_t i, char * buf, size_t buf_size) {
if (i < 0 || i >= (int)adapter->gguf_kv.size()) {
if (bu... | ast_based |
<|fim_prefix|> } else if (p_delta.y < 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_DOWN, -p_delta.y);
}
if (p_delta.x > 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_RIGHT, p_delta.x);
} else if (p_delta.x < 0) {
_wheel_button_click(event_buttons_mask... | } else if (p_delta.y < 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_DOWN, -p_delta.y);
}
if (p_delta.x > 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_RIGHT, p_delta.x);
} else if (p_delta.x < 0) {
_wheel_button_click(event_buttons_mask, ev, MouseBut... | case MouseButtonMask::MB_XBUTTON1:
return MouseButton::MB_XBUTTON1;
case MouseButtonMask::MB_XBUTTON2:
return MouseButton::MB_XBUTTON2;
default: | return MouseButton::NONE;
}
}
BitField<MouseButtonMask> AndroidInputHandler::_android_button_mask_to_godot_button_mask(int android_button_mask) {
BitField<MouseButtonMask> godot_button_mask = MouseButtonMask::NONE;
if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) {
godot_button_mask.set_flag(MouseButton... | random |
<|fim_prefix|> text_width = TS->shaped_text_get_size(p_shaped_text).x;
text_height = MAX(text_height, TS->shaped_text_get_size(p_shaped_text).y);
words = TS->shaped_text_get_word_breaks(p_shaped_text);
run_count = TS->shaped_get_run_count(p_shaped_text);
gl = TS->shaped_text_get_glyphs(p_shaped_text);
gl_cou... | text_width = TS->shaped_text_get_size(p_shaped_text).x;
text_height = MAX(text_height, TS->shaped_text_get_size(p_shaped_text).y);
words = TS->shaped_text_get_word_breaks(p_shaped_text);
run_count = TS->shaped_get_run_count(p_shaped_text);
gl = TS->shaped_text_get_glyphs(p_shaped_text);
gl_count = TS->shape... | accesskit_node_set_word_lengths(ae->node, word_lengths.size(), word_lengths.ptr()) | ;
// Char widths and positions.
Vector<float> char_positions;
Vector<float> char_widths;
char_positions.resize_initialized(t.length());
float *positions_ptr = char_positions.ptrw();
char_widths.resize_initialized(t.length());
float *widths_ptr = char_widths.ptrw();
float size_x = 0.0;
for (int j =... | ast_based |
<|fim_prefix|> */
/* 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 ... | */
/* 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 AN... | CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting"); |
CHECK_EQ(variant.get_type(), Variant::NIL);
}
TEST_CASE("[ProjectSettings] Non existing setting should return default value") {
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting");
CHECK_EQ(var... | ast_based |
<|fim_prefix|> singleton->update_cb.call(window_id);
}
singleton->in_accessibility_update = false;
AccessibilityElement *focus_ae = singleton->rid_owner.get_or_null(singleton->focus);
uint32_t update_size = wd.update.size();
accesskit_node_id ac_focus = (accesskit_node_id)wd.root_id.get_id();
if (focus_ae && f... | singleton->update_cb.call(window_id);
}
singleton->in_accessibility_update = false;
AccessibilityElement *focus_ae = singleton->rid_owner.get_or_null(singleton->focus);
uint32_t update_size = wd.update.size();
accesskit_node_id ac_focus = (accesskit_node_id)wd.root_id.get_id();
if (focus_ae && focus_ae->windo... | }
_FORCE_INLINE_ void AccessibilityDriverAccessKit::_ensure_node(const RID &p_id, AccessibilityElement *p_ae) { | if (unlikely(!p_ae->node)) {
WindowData *wd = windows.getptr(p_ae->window_id);
ERR_FAIL_NULL(wd);
wd->update.insert(p_id);
p_ae->node = accesskit_node_new(p_ae->role);
}
}
void AccessibilityDriverAccessKit::accessibility_set_window_rect(DisplayServer::WindowID p_window_id, const Rect2 &p_rect_out, const Rec... | random |
<|fim_prefix|>get_key_transition(track_idx, key_idx));
undo_redo->add_undo_method(this, "_select_at_anim", animation, track_idx, time, i == 0);
i++;
}
i = 0;
for (RBMap<AnimationTrackEditor::SelectedKey, AnimationTrackEditor::KeyInfo>::Element *E = keys.back(); E; E = E->prev()) {
undo_redo->add_undo_met... | get_key_transition(track_idx, key_idx));
undo_redo->add_undo_method(this, "_select_at_anim", animation, track_idx, time, i == 0);
i++;
}
i = 0;
for (RBMap<AnimationTrackEditor::SelectedKey, AnimationTrackEditor::KeyInfo>::Element *E = keys.back(); E; E = E->prev()) {
undo_redo->add_undo_method(this, "_se... | timeline->get_play_position() | ;
if (p_ofs_valid) {
if (editor->snap_keys->is_pressed() && editor->step->get_value() != 0) {
insert_pos = editor->snap_time(insert_pos);
}
}
float dst_time = key.time + insert_pos;
int existing_idx = animation->track_find_key(selected_track, dst_time, Animation::FIND_MODE_APPROX);
Variant... | ast_based |
<|fim_prefix|>/* 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, *... | /* 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 O... | }
// Compress image data and (if required) mipmaps.
const bool has_mipmaps = r_img->has_mipmaps();
int width = r_img->get_width();
int height = r_img->get_height();
int required_width = (width % block_x) != 0 ? width + (block_x - (width % block_x)) : width;
int required_height = (height % block_y) != 0 ? height... | if (width != required_width || height != required_height) {
// Resize texture to fit block size.
r_img->resize(required_width, required_height);
width = required_width;
height = required_height;
}
print_verbose(vformat("astcenc: Encoding image size %dx%d to format %s%s.", width, height, Image::get_format_na... | random |
<|fim_prefix|>:get_singleton()->parse_input_event(ev);
}
}
}
void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false, false);
touch.clear();
}
void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points, bool p_double_tap) {
switch (p_event) {
cas... | :get_singleton()->parse_input_event(ev);
}
}
}
void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false, false);
touch.clear();
}
void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points, bool p_double_tap) {
switch (p_event) {
case AMOTION_EVEN... | touch.push_back(tp); |
Ref<InputEventScreenTouch> ev;
ev.instantiate();
ev->set_index(tp.id);
ev->set_pressed(true);
ev->set_position(tp.pos);
Input::get_singleton()->parse_input_event(ev);
break;
}
}
} break;
case AMOTION_EVENT_ACTION_POINTER_UP: { // remove touch
for (int i = 0; i < touc... | ast_based |
<|fim_prefix|>ations;
cv::Mat perViewErrors;
std::vector<cv::Mat> rvecs;
std::vector<cv::Mat> tvecs;
double totalAvgErr;
cv::Size imageSize;
std::vector<cv::Mat> allFrames;
std::vector<std::vector<cv::Point2f> > imagePoints;
std::vector< std::vector<cv::... | ations;
cv::Mat perViewErrors;
std::vector<cv::Mat> rvecs;
std::vector<cv::Mat> tvecs;
double totalAvgErr;
cv::Size imageSize;
std::vector<cv::Mat> allFrames;
std::vector<std::vector<cv::Point2f> > imagePoints;
std::vector< std::vector<cv::Point3f> > obj... | minFramesNum = 10; |
fps = 30;
cameraResolution = cv::Size(IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT);
saveFrames = false;
}
};
struct internalParameters
{
double solverEps;
int solverMaxIters;
bool fastSolving;
bool rationalModel;
bool thinPrismModel... | ast_based |
<|fim_prefix|>_slice;
if (host_str != nullptr) {
host_slice = grpc::SliceFromCopiedString(*host_str);
}
c_call = grpc_channel_create_call(
c_channel_, context->propagate_from_call_,
context->propagation_options_.c_bitmask(), cq->cq(), method_slice,
host_str == nullptr ? nullptr... | _slice;
if (host_str != nullptr) {
host_slice = grpc::SliceFromCopiedString(*host_str);
}
c_call = grpc_channel_create_call(
c_channel_, context->propagate_from_call_,
context->propagation_options_.c_bitmask(), cq->cq(), method_slice,
host_str == nullptr ? nullptr : &host_slice... | delete this;
return true; |
}
private:
void* tag_;
};
} // namespace
void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline,
grpc::CompletionQueue* cq, void* tag) {
TagSaver* tag_saver = new TagSaver(tag);
grpc_cha... | ast_based |
<|fim_prefix|>gBox(level, raw_padding, &left, &top, &right, &bottom) &&
(!text_only || PTIsTextType(page_it->BlockType()))) {
++component_count;
}
} while (page_it->Next(level));
} else {
// Get bounding box from binarized imaged. Note that this could be
// differently scaled from ... | gBox(level, raw_padding, &left, &top, &right, &bottom) &&
(!text_only || PTIsTextType(page_it->BlockType()))) {
++component_count;
}
} while (page_it->Next(level));
} else {
// Get bounding box from binarized imaged. Note that this could be
// differently scaled from the original i... | {
++blockid;
paraid = 0;
} |
}
++component_index;
}
} while (page_it->Next(level));
return boxa;
}
int TessBaseAPI::GetThresholdedImageScaleFactor() const {
if (thresholder_ == nullptr) {
return 0;
}
return thresholder_->GetScaleFactor();
}
/**
* Runs page layout analysis in the mode set by SetPageSegMode.
* May ... | ast_based |
<|fim_prefix|>#pragma once
#include "common.h"
#include <set>
#include <string>
#include <vector>
//
// CLI argument parsing
//
struct common_arg {
std::set<enum llama_example> examples = {LLAMA_EXAMPLE_COMMON};
std::set<enum llama_example> excludes = {};
std::vector<const char *> args;
const char *... | #pragma once
#include "common.h"
#include <set>
#include <string>
#include <vector>
//
// CLI argument parsing
//
struct common_arg {
std::set<enum llama_example> examples = {LLAMA_EXAMPLE_COMMON};
std::set<enum llama_example> excludes = {};
std::vector<const char *> args;
const char * value_hint ... | const std::string & help | ,
void (*handler)(common_params & params, const std::string &)
) : args(args), value_hint(value_hint), help(help), handler_string(handler) {}
common_arg(
const std::initializer_list<const char *> & args,
const char * value_hint,
const std::string & help,
void (*handler)(... | ast_based |
<|fim_prefix|>tyDriver {
static AccessibilityDriverAccessKit *singleton;
struct AccessibilityElement {
HashMap<accesskit_action, Callable> actions;
DisplayServer::WindowID window_id = DisplayServer::INVALID_WINDOW_ID;
RID parent;
LocalVector<RID> children;
Vector3i run;
Variant meta;
String name;
St... | tyDriver {
static AccessibilityDriverAccessKit *singleton;
struct AccessibilityElement {
HashMap<accesskit_action, Callable> actions;
DisplayServer::WindowID window_id = DisplayServer::INVALID_WINDOW_ID;
RID parent;
LocalVector<RID> children;
Vector3i run;
Variant meta;
String name;
String name_extr... | DisplayServer::WindowID p_window_id | , DisplayServer::AccessibilityRole p_role) override;
RID accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos = -1) override;
virtual RID accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, in... | ast_based |
<|fim_prefix|> _calc_frame_speed_scale();
frame_progress = 0.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining);
frame_progress += to_process * abs_speed;
remaining -= to_process;
} else ... | _calc_frame_speed_scale();
frame_progress = 0.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining);
frame_progress += to_process * abs_speed;
remaining -= to_process;
} else {
// Back... | if (frames.is_valid()) { | frames->disconnect(CoreStringName(changed), callable_mp(this, &AnimatedSprite2D::_res_changed));
}
stop();
frames = p_frames;
if (frames.is_valid()) {
frames->connect(CoreStringName(changed), callable_mp(this, &AnimatedSprite2D::_res_changed));
List<StringName> al;
frames->get_animation_list(&al);
if (al... | random |
<|fim_prefix|>#else
int dylibloader_verbose = 0;
#endif
void *library_handle = nullptr;
String path;
String arch = Engine::get_singleton()->get_architecture_name();
#ifdef LINUXBSD_ENABLED
path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("libaccesskit." + arch + ".so");
if (!FileAccess::... | #else
int dylibloader_verbose = 0;
#endif
void *library_handle = nullptr;
String path;
String arch = Engine::get_singleton()->get_architecture_name();
#ifdef LINUXBSD_ENABLED
path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("libaccesskit." + arch + ".so");
if (!FileAccess::exists(path)) ... | print_verbose("AccessKit loaded.");
} else {
return ERR_CANT_CREATE;
}
#endif
#ifdef MACOS_ENABLED | //accesskit_macos_add_focus_forwarder_to_window_class("GodotWindow");
#endif
return OK;
}
AccessibilityDriverAccessKit::AccessibilityDriverAccessKit() {
singleton = this;
role_map[DisplayServer::AccessibilityRole::ROLE_UNKNOWN] = ACCESSKIT_ROLE_UNKNOWN;
role_map[DisplayServer::AccessibilityRole::ROLE_DEFAULT_BUT... | random |
<|fim_prefix|>gml_format_name(layer.w2, TN_FFN_DOWN, i);
gguf_add_tensor(ctx, layer.w2);
ggml_format_name(layer.w3, TN_FFN_UP, i);
gguf_add_tensor(ctx, layer.w3);
ggml_format_name(layer.ffn_norm, TN_FFN_NORM, i);
gguf_add_tensor(ctx, layer.ffn_norm);
}
gguf_write_to_fi... | gml_format_name(layer.w2, TN_FFN_DOWN, i);
gguf_add_tensor(ctx, layer.w2);
ggml_format_name(layer.w3, TN_FFN_UP, i);
gguf_add_tensor(ctx, layer.w3);
ggml_format_name(layer.ffn_norm, TN_FFN_NORM, i);
gguf_add_tensor(ctx, layer.ffn_norm);
}
gguf_write_to_file(ctx, filena... | fprintf(stderr, "\n"); |
fprintf(stderr, "options:\n");
fprintf(stderr, " -h, --help show this help message and exit\n");
fprintf(stderr, " --copy-vocab-from-model FNAME path of gguf llama model or llama2.c vocabulary from which to copy vocab (default '%s')\n", params->fn_vocab_model);
fprintf(stderr... | ast_based |
<|fim_prefix|>/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). *... | /* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright... | #ifdef ACCESSKIT_ENABLED
#include "accessibility_driver_accesskit.h"
#include "core/config/project_settings.h"
#include "core/version.h"
#include "servers/text_server.h"
| AccessibilityDriverAccessKit *AccessibilityDriverAccessKit::singleton = nullptr;
_FORCE_INLINE_ accesskit_role AccessibilityDriverAccessKit::_accessibility_role(DisplayServer::AccessibilityRole p_role) const {
if (role_map.has(p_role)) {
return role_map[p_role];
}
return ACCESSKIT_ROLE_UNKNOWN;
}
_FORCE_INLINE_ ... | random |
<|fim_prefix|> size_t offs = gguf_get_data_offset(ctx_gguf.get()) + gguf_get_tensor_offset(ctx_gguf.get(), gguf_find_tensor(ctx_gguf.get(), orig->name));
size_t size = ggml_nbytes(orig);
read_buf.resize(size);
gguf_file.seek(offs, SEEK_SET);
gguf_file.read_raw(... | size_t offs = gguf_get_data_offset(ctx_gguf.get()) + gguf_get_tensor_offset(ctx_gguf.get(), gguf_find_tensor(ctx_gguf.get(), orig->name));
size_t size = ggml_nbytes(orig);
read_buf.resize(size);
gguf_file.seek(offs, SEEK_SET);
gguf_file.read_raw(read_buf.data(... | std::advance(it, i);
return snprintf(buf, buf_size, "%s", it->first.c_str());
}
int32_t llama_adapter_meta_val_str_by_index(const llama_adapter_lora * adapter, int32_t i, char * buf, size_t buf_size) { | if (i < 0 || i >= (int)adapter->gguf_kv.size()) {
if (buf_size > 0) {
buf[0] = '\0';
}
return -1;
}
auto it = adapter->gguf_kv.begin();
std::advance(it, i);
return snprintf(buf, buf_size, "%s", it->second.c_str());
}
void llama_adapter_lora_free(llama_adapter_lor... | random |
<|fim_prefix|>#include "ggml.h"
#include "gguf.h"
#include "llama.h"
#include "common.h"
#include "log.h"
#include <unordered_map>
#include <vector>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdarg>
#include <cinttypes>
#include <ctime>
#include <random>
#include <stdexcept>
#include <sstrea... | #include "ggml.h"
#include "gguf.h"
#include "llama.h"
#include "common.h"
#include "log.h"
#include <unordered_map>
#include <vector>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdarg>
#include <cinttypes>
#include <ctime>
#include <random>
#include <stdexcept>
#include <sstream>
#include <a... | #define KV_TOKENIZER_LIST "tokenizer.ggml.tokens" | #define KV_TOKENIZER_TOKEN_TYPE "tokenizer.ggml.token_type"
#define KV_TOKENIZER_SCORES "tokenizer.ggml.scores"
#define KV_TOKENIZER_BOS_ID "tokenizer.ggml.bos_token_id"
#define KV_TOKENIZER_EOS_ID "tokenizer.ggml.eos_token_id"
#define KV_TOKENIZER_UNK_ID "to... | random |
<|fim_prefix|> /* Write a space to separate from preceding good text */
*ptr++ = ' ';
last_char_was_tilde = false;
}
if (!last_char_was_tilde) {
// Write a reject char.
last_char_was_tilde = true;
*ptr++ = kUNLVReject;
tilde_crunch_wri... | /* Write a space to separate from preceding good text */
*ptr++ = ' ';
last_char_was_tilde = false;
}
if (!last_char_was_tilde) {
// Write a reject char.
last_char_was_tilde = true;
*ptr++ = kUNLVReject;
tilde_crunch_written = true;
... | last_char_was_tilde = true;
}
}
}
}
}
if (word->word->flag(W_EOL) && !last_char_was_newline) { | /* Add a new line output */
*ptr++ = '\n';
tilde_crunch_written = false;
last_char_was_newline = true;
last_char_was_tilde = false;
}
}
*ptr++ = '\n';
*ptr = '\0';
return result;
}
#ifndef DISABLED_LEGACY_ENGINE
/**
* Detect the orientation of the input image and apparent sc... | random |
<|fim_prefix|>/* 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, *... | /* 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 O... | wd.adapter = accesskit_windows_subclassing_adapter_new(static_cast<HWND>(p_handle), &_accessibility_initial_tree_update_callback, (void *)(size_t)p_window_id, &_accessibility_action_callback, (void *)(size_t)p_window_id); | #endif
#ifdef MACOS_ENABLED
wd.adapter = accesskit_macos_subclassing_adapter_for_window(p_handle, &_accessibility_initial_tree_update_callback, (void *)(size_t)p_window_id, &_accessibility_action_callback, (void *)(size_t)p_window_id);
#endif
#ifdef LINUXBSD_ENABLED
wd.adapter = accesskit_unix_adapter_new(&_accessibi... | random |
<|fim_prefix|>Type { return values_.Get(id); }
// Looks up the canonical ID for a value, or returns `None` if not in the
// store.
auto Lookup(KeyType key) const -> IdT;
// Reserves space.
auto Reserve(size_t size) -> void;
// These are to support printable structures, and are not guaranteed.
auto Outp... | Type { return values_.Get(id); }
// Looks up the canonical ID for a value, or returns `None` if not in the
// store.
auto Lookup(KeyType key) const -> IdT;
// Reserves space.
auto Reserve(size_t size) -> void;
// These are to support printable structures, and are not guaranteed.
auto OutputYaml() const... | {
if (auto result = set_.Lookup(key, KeyContext(&values_))) {
return result.key();
}
return IdT::None;
} |
template <typename IdT, typename KeyT, typename ValueT>
auto CanonicalValueStore<IdT, KeyT, ValueT>::Reserve(size_t size) -> void {
// Compute the resulting new insert count using the size of values -- the
// set doesn't have a fast to compute current size.
if (size > values_.size()) {
set_.GrowForInsertCou... | ast_based |
<|fim_prefix|>imationBezierTrackEdit : public Control {
GDCLASS(AnimationBezierTrackEdit, Control);
enum {
MENU_KEY_INSERT,
MENU_KEY_DUPLICATE,
MENU_KEY_CUT,
MENU_KEY_COPY,
MENU_KEY_PASTE,
MENU_KEY_DELETE,
MENU_KEY_SET_HANDLE_FREE,
MENU_KEY_SET_HANDLE_LINEAR,
MENU_KEY_SET_HANDLE_BALANCED,
MENU_KE... | imationBezierTrackEdit : public Control {
GDCLASS(AnimationBezierTrackEdit, Control);
enum {
MENU_KEY_INSERT,
MENU_KEY_DUPLICATE,
MENU_KEY_CUT,
MENU_KEY_COPY,
MENU_KEY_PASTE,
MENU_KEY_DELETE,
MENU_KEY_SET_HANDLE_FREE,
MENU_KEY_SET_HANDLE_LINEAR,
MENU_KEY_SET_HANDLE_BALANCED,
MENU_KEY_SET_HANDLE_M... | bool box_selecting_add = false; |
Vector2 box_selection_from;
Vector2 box_selection_to;
Rect2 selection_rect;
Rect2 selection_handles_rect;
bool scaling_selection = false;
Vector2i scaling_selection_handles;
Vector2 scaling_selection_scale = Vector2(1, 1);
Vector2 scaling_selection_offset;
Point2 scaling_selection_pivot;
int moving_handle... | ast_based |
<|fim_prefix|>Color track_color = Color(1, 1, 1, 1);
if (i != selected_track) {
track_color = subtrack_colors[i];
}
draw_texture(bezier_icon, ep.point_rect.position, track_color);
}
ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5);
}
ep.point_... | Color track_color = Color(1, 1, 1, 1);
if (i != selected_track) {
track_color = subtrack_colors[i];
}
draw_texture(bezier_icon, ep.point_rect.position, track_color);
}
ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5);
}
ep.point_rect = ep.poin... | if (selection_rect.size.height > CMP_EPSILON) {
_draw_line_clipped(selection_rect.position - Vector2(inner_ofs, inner_ofs), selection_rect.position + Vector2(selection_rect.size.width + inner_ofs, -inner_ofs), accent, limit, right_limit);
_draw_line_clipped(selection_rect.position + Vector2(-inner_ofs, select... |
// Draw vertical handles.
if (selection_rect.size.width > CMP_EPSILON) {
_draw_line_clipped(selection_rect.position - Vector2(inner_ofs, inner_ofs), selection_rect.position + Vector2(-inner_ofs, selection_rect.size.height + inner_ofs), accent, limit, right_limit);
_draw_line_clipped(selection_rect.po... | ast_based |
<|fim_prefix|> Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(p_track, i_n);
if (handle_mode != Animation::HANDLE_MODE_FREE) {
float offset_nn = offset_n;
float height_nn = height_n;
if (E->next()->next()) {
int i_nn = E->next()->next()->get();
offset_nn ... | Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(p_track, i_n);
if (handle_mode != Animation::HANDLE_MODE_FREE) {
float offset_nn = offset_n;
float height_nn = height_n;
if (E->next()->next()) {
int i_nn = E->next()->next()->get();
offset_nn = animation->t... | start.bezier_interpolate(out_handle, in_handle, end, low) | ;
Vector2 high_pos = start.bezier_interpolate(out_handle, in_handle, end, high);
float c = (t - low_pos.x) / (high_pos.x - low_pos.x);
h = low_pos.lerp(high_pos, c).y;
}
h = _bezier_h_to_pixel(h);
Vector2 pos(j, h);
if (j > from_x) {
lines.push_back(prev_pos);
lines.push_back(pos);
... | ast_based |
<|fim_prefix|>lama_get_state_size(struct llama_context * ctx),
"use llama_state_get_size instead");
// Copies the state to the specified destination address.
// Destination needs to have allocated enough memory.
// Returns the number of bytes copied
LLAMA_API size_t llama_state_get_data(
... | lama_get_state_size(struct llama_context * ctx),
"use llama_state_get_size instead");
// Copies the state to the specified destination address.
// Destination needs to have allocated enough memory.
// Returns the number of bytes copied
LLAMA_API size_t llama_state_get_data(
struct l... | struct llama_context * ctx | ,
const char * path_session,
const llama_token * tokens,
size_t n_token_count),
"use llama_state_save_file instead");
// Get the exact size needed to copy the state of a single sequence
LLAMA_API size_t llama_state_seq_get_size(
... | ast_based |
<|fim_prefix|>al_t> &E : new_selection_values) {
undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second, i == 0);
i++;
}
i = 0;
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t time = animation->track_get_key_time(E->get().first, E->get().second);
undo_redo... | al_t> &E : new_selection_values) {
undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second, i == 0);
i++;
}
i = 0;
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t time = animation->track_get_key_time(E->get().first, E->get().second);
undo_redo->add_undo_met... | int track_idx = E->key().track;
int key_idx = E->key().key; |
float time = E->value().pos;
undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_time", track_idx, time);
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track_idx, time, animation->track_get_key_value(track_idx, key_idx), animation->track_get_key_transition(track_idx, key_idx));
... | ast_based |
<|fim_prefix|>// File: altorenderer.cpp
// Description: ALTO rendering interface
// Author: Jake Sebright
// (C) Copyright 2018
// 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
/... | // File: altorenderer.cpp
// Description: ALTO rendering interface
// Author: Jake Sebright
// (C) Copyright 2018
// 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.a... | alto_str << " WC=\"0." << wc << "\"";
} else {
alto_str << ">";
}
} |
static std::string GetID(const char *prefix, int page_number, int counter) {
std::stringstream idstr;
// IDs will only have the counter for the first page to keep them consistent
// with the IDs assigned before this change was made.
// From the second page on, IDs will also contain the page number to make them... | random |
<|fim_prefix|>{
if (tex->Status == ImTextureStatus_WantCreate)
{
// Create and upload new texture to graphics system
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData =... | {
if (tex->Status == ImTextureStatus_WantCreate)
{
// Create and upload new texture to graphics system
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
... | tex->SetStatus(ImTextureStatus_OK); | }
else if (tex->Status == ImTextureStatus_WantUpdates)
{
// Update selected blocks. We only ever write to textures regions which have never been used before!
// This backend choose to use tex->Updates[] but you can use tex->UpdateRect to upload a single region.
ImTextureRect r = tex-... | random |
<|fim_prefix|> }
} else {
frame--;
}
_calc_frame_speed_scale();
frame_progress = 1.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN(frame_progress / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
... | }
} else {
frame--;
}
_calc_frame_speed_scale();
frame_progress = 1.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN(frame_progress / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
remaining ... | queue_redraw();
update_configuration_warnings();
emit_signal("sprite_frames_changed");
}
Ref<SpriteFrames> AnimatedSprite2D::get_sprite_frames() const {
return frames; | }
void AnimatedSprite2D::set_frame(int p_frame) {
set_frame_and_progress(p_frame, std::signbit(get_playing_speed()) ? 1.0 : 0.0);
}
int AnimatedSprite2D::get_frame() const {
return frame;
}
void AnimatedSprite2D::set_frame_progress(real_t p_progress) {
frame_progress = p_progress;
}
real_t AnimatedSprite2D::get_... | random |
<|fim_prefix|>in_top,
size_t margin_right, size_t margin_bottom, size_t ksize, int border_type)
{
CAROTENE_NS::Size2D sz(width, height);
CAROTENE_NS::BORDER_MODE border = borderCV2Carotene(border_type);
CAROTENE_NS::Margin mg(margin_left, margin_right, margin_top, margin_bottom);
... | in_top,
size_t margin_right, size_t margin_bottom, size_t ksize, int border_type)
{
CAROTENE_NS::Size2D sz(width, height);
CAROTENE_NS::BORDER_MODE border = borderCV2Carotene(border_type);
CAROTENE_NS::Margin mg(margin_left, margin_right, margin_top, margin_bottom);
if (ksize =... | size_t prev_data_step | ,
const short* prev_deriv_data, size_t prev_deriv_step,
const uchar* next_data, size_t next_step,
int width, int height, int cn,
const float *prev_points, float *next_points, size_t point_count,
uchar *sta... | ast_based |
<|fim_prefix|> if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
}
autoplay = p_name;
}
String AnimatedSprite2D::get_autoplay() const {
return autoplay;
}
void AnimatedSprite2D::play(const StringName &p... | if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
}
autoplay = p_name;
}
String AnimatedSprite2D::get_autoplay() const {
return autoplay;
}
void AnimatedSprite2D::play(const StringName &p_name, float p... |
double AnimatedSprite2D::_get_frame_duration() {
if (frames.is_valid() && frames->has_animation(animation)) {
return frames->get_frame_duration(animation, frame);
}
return 1.0;
}
| void AnimatedSprite2D::_calc_frame_speed_scale() {
frame_speed_scale = 1.0 / _get_frame_duration();
}
void AnimatedSprite2D::set_animation(const StringName &p_name) {
if (animation == p_name) {
return;
}
animation = p_name;
emit_signal(SceneStringName(animation_changed));
if (frames.is_null()) {
animation... | random |
<|fim_prefix|>id Engine::set_max_fps(int p_fps) {
_max_fps = p_fps > 0 ? p_fps : 0;
RenderingDevice *rd = RenderingDevice::get_singleton();
if (rd) {
rd->_set_max_fps(_max_fps);
}
}
int Engine::get_max_fps() const {
return _max_fps;
}
void Engine::set_audio_output_latency(int p_msec) {
_audio_output_latency ... | id Engine::set_max_fps(int p_fps) {
_max_fps = p_fps > 0 ? p_fps : 0;
RenderingDevice *rd = RenderingDevice::get_singleton();
if (rd) {
rd->_set_max_fps(_max_fps);
}
}
int Engine::get_max_fps() const {
return _max_fps;
}
void Engine::set_audio_output_latency(int p_msec) {
_audio_output_latency = p_msec > 1 ?... | int info_count | ) {
Array arr;
for (int i = 0; i < info_count; i++) {
arr.push_back(String::utf8(info_list[i]));
}
return arr;
}
Dictionary Engine::get_author_info() const {
Dictionary dict;
dict["lead_developers"] = array_from_info(AUTHORS_LEAD_DEVELOPERS);
dict["project_managers"] = array_from_info(AUTHORS_PROJECT_MANAGER... | ast_based |
<|fim_prefix|> curlcode = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
if (curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
// Allow no more than 8 redirections to prevent endless loops.
curlcode = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 8);
if (curlcode != ... | curlcode = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
if (curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
// Allow no more than 8 redirections to prevent endless loops.
curlcode = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 8);
if (curlcode != CURLE_OK) {
... | fprintf(stderr, "Error, cannot read input file %s: %s\n", filename, strerror(errno));
return false;
}
}
// Here is our autodetection
int format;
int r = | (data != nullptr) ? findFileFormatBuffer(data, &format) : findFileFormat(filename, &format);
// Maybe we have a filelist
if (r != 0 || format == IFF_UNKNOWN) {
std::string s;
if (data != nullptr) {
s = buf.c_str();
} else {
std::ifstream t(filename);
std::string u((std::istreamb... | random |
<|fim_prefix|>ocus(1, win_id);
accesskit_tree_update_set_tree(tree_update, accesskit_tree_new(win_id));
accesskit_tree_update_push_node(tree_update, win_id, win_node);
return tree_update;
}
RID AccessibilityDriverAccessKit::accessibility_create_element(DisplayServer::WindowID p_window_id, DisplayServer::Accessibi... | ocus(1, win_id);
accesskit_tree_update_set_tree(tree_update, accesskit_tree_new(win_id));
accesskit_tree_update_push_node(tree_update, win_id, win_node);
return tree_update;
}
RID AccessibilityDriverAccessKit::accessibility_create_element(DisplayServer::WindowID p_window_id, DisplayServer::AccessibilityRole p_rol... | parent_ae->children.insert(p_insert_pos, root_rid); |
}
wd->update.insert(root_rid);
float text_width = 0;
float text_height = p_min_height;
Vector<int32_t> words;
int64_t run_count = 0; // Note: runs in visual order.
const Glyph *gl = nullptr;
int64_t gl_count = 0;
int64_t gl_index = 0;
float run_off_x = 0.0;
Vector2i full_range;
if (p_shaped_text.is_valid... | ast_based |
<|fim_prefix|>
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
if (!p_shortcut.is_empty()) {
accesskit_node_set_keyboard_shortcut(ae->node, p_shortcut.utf8().ptr());
} else {
accesskit_node_clear_keyboard_shortcut(ae->node);
}
}
void AccessibilityDriverAcce... |
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
if (!p_shortcut.is_empty()) {
accesskit_node_set_keyboard_shortcut(ae->node, p_shortcut.utf8().ptr());
} else {
accesskit_node_clear_keyboard_shortcut(ae->node);
}
}
void AccessibilityDriverAccessKit::accessi... | void AccessibilityDriverAccessKit::accessibility_update_set_color_value(const RID &p_id, const Color &p_color) { | ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
accesskit_node_set_color_value(ae->node, p_color.to_rgba32());
}
vo... | random |
<|fim_prefix|> while (animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX) != -1) {
time += 0.0001;
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Add Bezier Point"));
undo_redo->add_do_method(animation.ptr(), "bezier... | while (animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX) != -1) {
time += 0.0001;
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Add Bezier Point"));
undo_redo->add_do_method(animation.ptr(), "bezier_track_insert_... | Vector2 bs_to = box_selection_to;
if (bs_from.x > bs_to.x) {
SWAP(bs_from.x, bs_to.x);
}
if (bs_from.y > bs_to.y) {
SWAP(bs_from.y, bs_to.y);
}
Rect2 rect(bs_from, bs_to - bs_from);
| bool track_set = false;
int j = 0;
for (int i = 0; i < edit_points.size(); i++) {
if (edit_points[i].point_rect.intersects(rect)) {
_select_at_anim(animation, edit_points[i].track, animation->track_get_key_time(edit_points[i].track, edit_points[i].key), j == 0 && !box_selecting_add);
if (!track_s... | random |
<|fim_prefix|> ERR_FAIL_COND_V_MSG(!E, nullptr, vformat("Failed to retrieve non-existent singleton '%s'.", p_name));
#ifdef TOOLS_ENABLED
if (!is_editor_hint() && is_singleton_editor_only(p_name)) {
ERR_FAIL_V_MSG(nullptr, vformat("Can't retrieve singleton '%s' outside of editor.", p_name));
}
#endif
return E->v... | ERR_FAIL_COND_V_MSG(!E, nullptr, vformat("Failed to retrieve non-existent singleton '%s'.", p_name));
#ifdef TOOLS_ENABLED
if (!is_editor_hint() && is_singleton_editor_only(p_name)) {
ERR_FAIL_V_MSG(nullptr, vformat("Can't retrieve singleton '%s' outside of editor.", p_name));
}
#endif
return E->value;
}
bool ... |
void Engine::set_freeze_time_scale(bool p_frozen) {
freeze_time_scale = p_frozen;
}
| void Engine::set_embedded_in_editor(bool p_enabled) {
embedded_in_editor = p_enabled;
}
bool Engine::is_embedded_in_editor() const {
return embedded_in_editor;
}
Engine::Engine() {
singleton = this;
}
Engine::~Engine() {
if (singleton == this) {
singleton = nullptr;
}
}
Engine::Singleton::Singleton(const Str... | random |
<|fim_prefix|> }
showOverlayMessage(cv::format("Frame %zu is worst", worstElemIndex + 1));
if(mCalibData->allFrames.size())
mCalibData->allFrames.erase(mCalibData->allFrames.begin() + worstElemIndex);
if(mCalibData->imagePoints.size()) {
mCalibData->imagePoints.e... | }
showOverlayMessage(cv::format("Frame %zu is worst", worstElemIndex + 1));
if(mCalibData->allFrames.size())
mCalibData->allFrames.erase(mCalibData->allFrames.begin() + worstElemIndex);
if(mCalibData->imagePoints.size()) {
mCalibData->imagePoints.erase(mCalibDat... | mCalibData->distCoeffs = (mParamsStack.top()).distCoeffs; | mCalibData->stdDeviations = (mParamsStack.top()).stdDeviations;
mCalibData->totalAvgErr = (mParamsStack.top()).avgError;
mParamsStack.pop();
}
}
void calib::calibDataController::rememberCurrentParameters()
{
cv::Mat oldCameraMat, oldDistcoeefs, oldStdDevs;
mCalibData->cameraMatrix.c... | random |
<|fim_prefix|> last_frame = fc - 1;
if (!std::signbit(speed)) {
// Forwards.
if (frame_progress >= 1.0) {
if (frame >= last_frame) {
if (frames->get_animation_loop(animation)) {
frame = 0;
emit_signal("animation_looped");
} else {
frame = last_frame;
pau... | last_frame = fc - 1;
if (!std::signbit(speed)) {
// Forwards.
if (frame_progress >= 1.0) {
if (frame >= last_frame) {
if (frames->get_animation_loop(animation)) {
frame = 0;
emit_signal("animation_looped");
} else {
frame = last_frame;
pause();
... | (ofs + Point2(0.5, 0.5)).floor() | ;
}
Rect2 dst_rect(ofs, s);
if (hflip) {
dst_rect.size.x = -dst_rect.size.x;
}
if (vflip) {
dst_rect.size.y = -dst_rect.size.y;
}
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
} break;
}
}
void AnimatedSprite2D::set_sprite_fram... | ast_based |
<|fim_prefix|>/**************************************************************************/
/* engine.h */
/**************************************************************************/
/* This file is part of: *... | /**************************************************************************/
/* engine.h */
/**************************************************************************/
/* This file is part of: */
/* ... | /* "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. */
/* ... | random |
<|fim_prefix|>} else {
// Now run the main recognition.
bool wait_for_text = true;
GetBoolVariable("paragraph_text_based", &wait_for_text);
if (!wait_for_text) {
DetectParagraphs(false);
}
if (tesseract_->recog_all_words(page_res_, monitor, nullptr, nullptr, 0)) {
if (wait_for_text) ... | } else {
// Now run the main recognition.
bool wait_for_text = true;
GetBoolVariable("paragraph_text_based", &wait_for_text);
if (!wait_for_text) {
DetectParagraphs(false);
}
if (tesseract_->recog_all_words(page_res_, monitor, nullptr, nullptr, 0)) {
if (wait_for_text) {
Dete... | lines.empty() | ) {
return false;
}
}
// Skip to the requested page number.
for (unsigned i = 0; i < page; i++) {
if (flist) {
if (fgets(pagename, sizeof(pagename), flist) == nullptr) {
break;
}
}
}
// Begin producing output
if (renderer && !renderer->BeginDocument(document_title.c_s... | ast_based |
<|fim_prefix|>ceAgent* agent);
namespace tfw_internal {
#if defined(TF_ENABLE_ACTIVITY_WATCHER)
// Records an activity start without checking whether the watcher is enabled.
ActivityId RecordActivityStart(std::unique_ptr<Activity> activity);
// Records an activity end without checking whether the activity_id is vali... | ceAgent* agent);
namespace tfw_internal {
#if defined(TF_ENABLE_ACTIVITY_WATCHER)
// Records an activity start without checking whether the watcher is enabled.
ActivityId RecordActivityStart(std::unique_ptr<Activity> activity);
// Records an activity end without checking whether the activity_id is valid.
void Record... | return kActivityNotRecorded; |
}
inline void ActivityEnd(ActivityId id) {
#if defined(TF_ENABLE_ACTIVITY_WATCHER)
if (TF_PREDICT_FALSE(id != kActivityNotRecorded)) {
tfw_internal::RecordActivityEnd(id);
}
#endif
}
// ActivityScope marks a scope as an activity and record it with a global
// ActivityRecorder.
// Example Usage:
// {
// ... | ast_based |
<|fim_prefix|>me = t + (insert_pos - top_time);
int existing_idx = animation->track_find_key(E->get().first, dst_time, Animation::FIND_MODE_APPROX);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), animation->tr... | me = t + (insert_pos - top_time);
int existing_idx = animation->track_find_key(E->get().first, dst_time, Animation::FIND_MODE_APPROX);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), animation->track_get_key_tr... | float t = animation->track_get_key_time(E->get().first, E->get().second);
if (t < top_time) {
top_time = t;
} |
}
RBMap<AnimationTrackEditor::SelectedKey, AnimationTrackEditor::KeyInfo> keys;
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
AnimationTrackEditor::SelectedKey sk;
AnimationTrackEditor::KeyInfo ki;
sk.track = E->get().first;
sk.key = E->get().second;
ki.pos = animation->track_get_... | ast_based |
<|fim_prefix|>CV_HAL_ERROR_OK;
}
else
{
return CV_HAL_ERROR_UNKNOWN;
}
}
#define TEGRA_SEPFILTERIMPL(context, src_data, src_step, dst_data, dst_step, width, height, full_width, full_height, offset_x, offset_y) \
( \
context && CAROTENE_NS::isSeparableFilter3x3Supported(CAROTENE_NS::Size2D(wi... | CV_HAL_ERROR_OK;
}
else
{
return CV_HAL_ERROR_UNKNOWN;
}
}
#define TEGRA_SEPFILTERIMPL(context, src_data, src_step, dst_data, dst_step, width, height, full_width, full_height, offset_x, offset_y) \
( \
context && CAROTENE_NS::isSeparableFilter3x3Supported(CAROTENE_NS::Size2D(width, height), ... | CV_MAT_DEPTH(src_type) | != CV_8U || src_type < 0 || (src_type >> CV_CN_SHIFT) > 3 ||
width < kernel_width || height < kernel_height ||
allowSubmatrix || allowInplace || iterations != 1 ||
!CAROTENE_NS::isSupportedConfiguration())
return CV_HAL_ERROR_NOT_IMPLEMENTED;
switch(CV_MAT_DEPTH(kernel_type))
{
... | ast_based |
<|fim_prefix|> must call SetImage or TesseractRect before doing
* any Recognize or Get* operation.
*/
void TessBaseAPI::Clear() {
if (thresholder_ != nullptr) {
thresholder_->Clear();
}
ClearResults();
if (tesseract_ != nullptr) {
SetInputImage(nullptr);
}
}
/**
* Close down tesseract and free up ... | must call SetImage or TesseractRect before doing
* any Recognize or Get* operation.
*/
void TessBaseAPI::Clear() {
if (thresholder_ != nullptr) {
thresholder_->Clear();
}
ClearResults();
if (tesseract_ != nullptr) {
SetInputImage(nullptr);
}
}
/**
* Close down tesseract and free up all memory. En... | const char *utf8_character | ) const {
return tesseract_->unicharset.contains_unichar(utf8_character);
}
// TODO(rays) Obsolete this function and replace with a more aptly named
// function that returns image coordinates rather than tesseract coordinates.
bool TessBaseAPI::GetTextDirection(int *out_offset, float *out_slope) {
const std::uniqu... | ast_based |
<|fim_prefix|>en_tracks.insert(updated_hidden_tracks[i]);
}
}
}
String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const {
return Control::get_tooltip(p_pos);
}
void AnimationBezierTrackEdit::_clear_selection() {
selection.clear();
emit_signal(SNAME("clear_selection"));
queue_redraw();
}
void A... | en_tracks.insert(updated_hidden_tracks[i]);
}
}
}
String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const {
return Control::get_tooltip(p_pos);
}
void AnimationBezierTrackEdit::_clear_selection() {
selection.clear();
emit_signal(SNAME("clear_selection"));
queue_redraw();
}
void AnimationBezier... | {
return;
} |
_clear_selection();
}
void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos, bool p_single) {
if (!(animation == p_anim) || !is_visible()) {
return;
}
int idx = animation->track_find_key(p_track, p_pos, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(idx < 0);
se... | ast_based |
<|fim_prefix|>scale) {
_time_scale = p_scale;
}
double Engine::get_time_scale() const {
return freeze_time_scale ? 0 : _time_scale;
}
double Engine::get_unfrozen_time_scale() const {
return _time_scale;
}
Dictionary Engine::get_version_info() const {
Dictionary dict;
dict["major"] = GODOT_VERSION_MAJOR;
dict["... | scale) {
_time_scale = p_scale;
}
double Engine::get_time_scale() const {
return freeze_time_scale ? 0 : _time_scale;
}
double Engine::get_unfrozen_time_scale() const {
return _time_scale;
}
Dictionary Engine::get_version_info() const {
Dictionary dict;
dict["major"] = GODOT_VERSION_MAJOR;
dict["minor"] = GODO... | for (int i = 0; i < cp_info.part_count; i++) {
const ComponentCopyrightPart &cp_part = cp_info.parts[i];
Dictionary part_dict;
part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count);
part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count);... |
component_dict["parts"] = parts;
components.push_back(component_dict);
}
return components;
}
Dictionary Engine::get_donor_info() const {
Dictionary donors;
donors["patrons"] = array_from_info(DONORS_PATRONS);
donors["platinum_sponsors"] = array_from_info(DONORS_SPONSORS_PLATINUM);
donors["gold_sponsors"] ... | ast_based |
<|fim_prefix|>eys_handle_mode(Animation::HandleMode p_mode, bool p_auto) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Update Selected Key Handles"), UndoRedo::MERGE_DISABLE, animation.ptr());
for (SelectionSet::Element *E = selection.back(); E; E = E->pre... | eys_handle_mode(Animation::HandleMode p_mode, bool p_auto) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Update Selected Key Handles"), UndoRedo::MERGE_DISABLE, animation.ptr());
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
const... | IntPair(p_track, idx) | );
emit_signal(SNAME("select_key"), idx, p_single, p_track);
queue_redraw();
}
void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (panner->gui_input(p_event)) {
accept_event();
return;
}
if (p_event->is_pressed()) {
if (ED_IS_SHORTCUT("animatio... | ast_based |
<|fim_prefix|>//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... | //
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
#ifndef GRPCPP_CHANNEL_H
#define GRPCPP_CHANNEL_H |
#include <grpc/grpc.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/client_interceptor.h>
#include <grpcpp/support/config.h>
#include <memory>
struct grpc_chan... | random |
<|fim_prefix|>, context->raw_deadline(), nullptr);
} else {
const ::std::string* host_str = nullptr;
if (!context->authority_.empty()) {
host_str = &context->authority_;
} else if (!host_.empty()) {
host_str = &host_;
}
grpc_slice method_slice =
SliceFromArray(method.name(), st... | , context->raw_deadline(), nullptr);
} else {
const ::std::string* host_str = nullptr;
if (!context->authority_.empty()) {
host_str = &context->authority_;
} else if (!host_.empty()) {
host_str = &host_;
}
grpc_slice method_slice =
SliceFromArray(method.name(), strlen(method.na... | bool try_to_connect | ) {
return grpc_channel_check_connectivity_state(c_channel_, try_to_connect);
}
namespace {
class TagSaver final : public grpc::internal::CompletionQueueTag {
public:
explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() override {}
bool FinalizeResult(void** tag, bool* /*status*/) override {
*tag = ta... | ast_based |
<|fim_prefix|>den_tracks.has(E.key)) {
set_animation_and_track(animation, E.key, read_only);
_clear_selection();
}
return;
}
}
for (const KeyValue<int, RBMap<int, Rect2>> &E : subtrack_icons) {
int track = E.key;
RBMap<int, Rect2> track_icons = E.value;
for (const KeyValue<int, Rect2>... | den_tracks.has(E.key)) {
set_animation_and_track(animation, E.key, read_only);
_clear_selection();
}
return;
}
}
for (const KeyValue<int, RBMap<int, Rect2>> &E : subtrack_icons) {
int track = E.key;
RBMap<int, Rect2> track_icons = E.value;
for (const KeyValue<int, Rect2> &I : track_ic... | if (!locked_tracks.has(i) && animation->track_get_type(i) == Animation::TrackType::TYPE_BEZIER) {
set_animation_and_track(animation, i, read_only);
break;
} |
}
}
}
queue_redraw();
return;
} else if (I.key == VISIBILITY_ICON) {
if (hidden_tracks.has(track)) {
hidden_tracks.erase(track);
} else {
hidden_tracks.insert(track);
if (selected_track == track) {
for (int i = 0; i < animation->get_track_c... | ast_based |
<|fim_prefix|>
text_elements.push_back(ae);
Vector<uint8_t> char_lengths;
char_lengths.push_back(1);
accesskit_node_set_value(ae->node, "\n");
accesskit_node_set_character_lengths(ae->node, char_lengths.size(), char_lengths.ptr());
Vector<float> char_positions;
Vector<float> char_widths;
char_position... |
text_elements.push_back(ae);
Vector<uint8_t> char_lengths;
char_lengths.push_back(1);
accesskit_node_set_value(ae->node, "\n");
accesskit_node_set_character_lengths(ae->node, char_lengths.size(), char_lengths.ptr());
Vector<float> char_positions;
Vector<float> char_widths;
char_positions.push_back(0.... | WindowData *wd = windows.getptr(ae->window_id);
AccessibilityElement *parent_ae = rid_owner.get_or_null(ae->parent);
if (parent_ae) {
parent_ae->children.erase(p_id);
} | _free_recursive(wd, p_id);
}
}
void AccessibilityDriverAccessKit::accessibility_element_set_meta(const RID &p_id, const Variant &p_meta) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = r... | random |
<|fim_prefix|>in() + worstElemIndex);
if(mCalibData->imagePoints.size()) {
mCalibData->imagePoints.erase(mCalibData->imagePoints.begin() + worstElemIndex);
mCalibData->objectPoints.erase(mCalibData->objectPoints.begin() + worstElemIndex);
if (mCalibData->allCharucoCorners.si... | in() + worstElemIndex);
if(mCalibData->imagePoints.size()) {
mCalibData->imagePoints.erase(mCalibData->imagePoints.begin() + worstElemIndex);
mCalibData->objectPoints.erase(mCalibData->objectPoints.begin() + worstElemIndex);
if (mCalibData->allCharucoCorners.size()) {
... | mParamsStack.pop() | ;
}
}
void calib::calibDataController::rememberCurrentParameters()
{
cv::Mat oldCameraMat, oldDistcoeefs, oldStdDevs;
mCalibData->cameraMatrix.copyTo(oldCameraMat);
mCalibData->distCoeffs.copyTo(oldDistcoeefs);
mCalibData->stdDeviations.copyTo(oldStdDevs);
mParamsStack.push(cameraParameters(old... | ast_based |
<|fim_prefix|>ge_height_ - bottom, right, image_height_ - top, page_number);
output_length += strlen(result + output_length);
// Just in case...
if (output_length + kMaxBytesPerLine > total_length) {
break;
}
}
} while (it->Next(RIL_SYMBOL));
delete it;
return result;
}
/**
*... | ge_height_ - bottom, right, image_height_ - top, page_number);
output_length += strlen(result + output_length);
// Just in case...
if (output_length + kMaxBytesPerLine > total_length) {
break;
}
}
} while (it->Next(RIL_SYMBOL));
delete it;
return result;
}
/**
* Conversion ta... | last_char_was_tilde = false; |
}
if (!last_char_was_tilde) {
// Write a reject char.
last_char_was_tilde = true;
*ptr++ = kUNLVReject;
tilde_crunch_written = true;
last_char_was_newline = false;
}
}
} else {
// NORMAL PROCESSING of non tilde crunched words.
... | ast_based |
<|fim_prefix|>s
if (pchMsgTmp != Params().MessageStart()) {
throw std::runtime_error{"Invalid network magic number"};
}
// de-serialize data
verifier >> data;
// verify checksum
if (fCheckSum) {
uint256 hashTmp;
stream >> hashTmp;
if (hashTmp != verifier.GetHash... | s
if (pchMsgTmp != Params().MessageStart()) {
throw std::runtime_error{"Invalid network magic number"};
}
// de-serialize data
verifier >> data;
// verify checksum
if (fCheckSum) {
uint256 hashTmp;
stream >> hashTmp;
if (hashTmp != verifier.GetHash()) {
... | fs::PathToString(m_banlist_json) | , e.what());
return false;
}
return true;
}
bool DumpPeerAddresses(const ArgsManager& args, const AddrMan& addr)
{
const auto pathAddr = args.GetDataDirNet() / "peers.dat";
return SerializeFileDB("peers", pathAddr, addr);
}
void ReadFromStream(AddrMan& addr, DataStream& ssPeers)
{
Deseria... | ast_based |
<|fim_prefix|>ual size_t requiredMem(const std::string &modelPath, int n_ctx, int ngl) = 0;
virtual size_t stateSize() const = 0;
virtual size_t saveState(std::span<uint8_t> stateOut, std::vector<Token> &inputTokensOut) const = 0;
virtual size_t restoreState(std::span<const uint8_t> state, std::span<const T... | ual size_t requiredMem(const std::string &modelPath, int n_ctx, int ngl) = 0;
virtual size_t stateSize() const = 0;
virtual size_t saveState(std::span<uint8_t> stateOut, std::vector<Token> &inputTokensOut) const = 0;
virtual size_t restoreState(std::span<const uint8_t> state, std::span<const Token> inputTok... | return false; |
}
virtual bool initializeGPUDevice(int device, std::string *unavail_reason = nullptr) const {
(void)device;
if (unavail_reason) {
*unavail_reason = "model has no GPU support";
}
return false;
}
virtual bool usingGPUDevice() const { return false; }
virtu... | ast_based |
<|fim_prefix|>* ctx, std::vector<llama_token> & tokens) {
llama_memory_clear(llama_get_memory(ctx), true);
if (llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size()))) {
fprintf(stderr, "%s : failed to eval\n", __func__);
return false;
}
return true;
}
static void export_gg... | * ctx, std::vector<llama_token> & tokens) {
llama_memory_clear(llama_get_memory(ctx), true);
if (llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size()))) {
fprintf(stderr, "%s : failed to eval\n", __func__);
return false;
}
return true;
}
static void export_gguf(const std::... | common_params params; |
params.out_file = "control_vector.gguf";
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_CVECTOR_GENERATOR, print_usage)) {
return 1;
}
if (params.n_pca_iterations % params.n_pca_batch != 0) {
fprintf(stderr, "PCA iterations must by multiply of PCA batch size\n");
... | ast_based |
<|fim_prefix|>
src_data, src_step, \
(CAROTENE_NS::s16*)dst_data, dst_step, \
3, 3, ((SepFilterCtx*)context)->kernelx_data, ((SepFilterCtx*)context)->kernely_data, \
((SepFilte... |
src_data, src_step, \
(CAROTENE_NS::s16*)dst_data, dst_step, \
3, 3, ((SepFilterCtx*)context)->kernelx_data, ((SepFilterCtx*)context)->kernely_data, \
((SepFilterCtx*)context)... | if(CAROTENE_NS::countNonZero(CAROTENE_NS::Size2D(kernel_width, kernel_height), (uint16_t*)kernel_data, kernel_step) != kernel_width * kernel_height)
return CV_HAL_ERROR_NOT_IMPLEMENTED; |
break;
case CV_32S:
if(CAROTENE_NS::countNonZero(CAROTENE_NS::Size2D(kernel_width, kernel_height), (int32_t*)kernel_data, kernel_step) != kernel_width * kernel_height)
return CV_HAL_ERROR_NOT_IMPLEMENTED;
break;
case CV_32F:
if(CAROTENE_NS::countNonZero(CAROTENE_NS::... | ast_based |
<|fim_prefix|> gguf_set_val_u32(ctx, KV_TOKENIZER_EOS_ID, EOS_TOKEN_ID);
gguf_set_val_u32(ctx, KV_TOKENIZER_SEP_ID, LLAMA_TOKEN_NULL);
gguf_set_val_u32(ctx, KV_TOKENIZER_PAD_ID, LLAMA_TOKEN_NULL);
gguf_set_val_u32(ctx, KV_CONTEXT_LENGTH, model->hparams.n_ctx);
gguf_set_val_u32(ctx, KV_EMBEDDING_LENG... | gguf_set_val_u32(ctx, KV_TOKENIZER_EOS_ID, EOS_TOKEN_ID);
gguf_set_val_u32(ctx, KV_TOKENIZER_SEP_ID, LLAMA_TOKEN_NULL);
gguf_set_val_u32(ctx, KV_TOKENIZER_PAD_ID, LLAMA_TOKEN_NULL);
gguf_set_val_u32(ctx, KV_CONTEXT_LENGTH, model->hparams.n_ctx);
gguf_set_val_u32(ctx, KV_EMBEDDING_LENGTH, model->hpa... | gguf_add_tensor(ctx, layer.w3);
ggml_format_name(layer.ffn_norm, TN_FFN_NORM, i);
gguf_add_tensor(ctx, layer.ffn_norm);
}
gguf_write_to_file(ctx, filename, false);
gguf_free(ctx);
} |
static struct train_params get_default_train_params() {
struct train_params params;
params.fn_vocab_model = "models/7B/ggml-model-f16.gguf";
params.fn_llama2c_output_model = "ak_llama_model.bin";
params.fn_train_data = "shakespeare.txt";
params.fn_checkpoint_in = "checkpoi... | random |
<|fim_prefix|> /// Both "model" and "custom_template" are optional, but at least one is required. "custom_template" has higher precedence than "model"
/// NOTE: This function does not use a jinja parser. It only support a pre-defined list of template. See more: https://github.com/ggml-org/llama.cpp/wiki/Template... | /// Both "model" and "custom_template" are optional, but at least one is required. "custom_template" has higher precedence than "model"
/// NOTE: This function does not use a jinja parser. It only support a pre-defined list of template. See more: https://github.com/ggml-org/llama.cpp/wiki/Templates-supported-by... | // llama_sampler_chain_add(smpl, llama_sampler_init_temp (0.8)); | //
// // typically, the chain should end with a sampler such as "greedy", "dist" or "mirostat"
// // this sampler will be responsible to select the actual token
// llama_sampler_chain_add(smpl, llama_sampler_init_dist(seed));
//
// ...
//
// // decoding loop:
// whi... | random |
<|fim_prefix|> TEST_ASSERT((string = hex::crypt::encode16(i.vec)) == i.string, "string: '{}' i.string: '{}' from: {}", string, i.string, i.vec);
std::vector<u8> vec;
TEST_ASSERT((vec = hex::crypt::decode16(i.string)) == i.vec, "vec: {} i.vec: {} from: '{}'", vec, i.vec, i.string);
}
std... | TEST_ASSERT((string = hex::crypt::encode16(i.vec)) == i.string, "string: '{}' i.string: '{}' from: {}", string, i.string, i.vec);
std::vector<u8> vec;
TEST_ASSERT((vec = hex::crypt::decode16(i.string)) == i.vec, "vec: {} i.vec: {} from: '{}'", vec, i.vec, i.string);
}
std::random_devic... |
for (auto &i : golden_samples) {
std::string string; | TEST_ASSERT((string = vectorToString(hex::crypt::encode64(i.vec))) == i.string, "string: '{}' i.string: '{}' from: {}", string, i.string, i.vec);
std::vector<u8> vec;
TEST_ASSERT((vec = hex::crypt::decode64(stringToVector(i.string))) == i.vec, "vec: {} i.vec: {} from: '{}'", vec, i.vec, i.strin... | random |
<|fim_prefix|>
ClassDB::bind_method(D_METHOD("set_offset", "offset"), &AnimatedSprite2D::set_offset);
ClassDB::bind_method(D_METHOD("get_offset"), &AnimatedSprite2D::get_offset);
ClassDB::bind_method(D_METHOD("set_flip_h", "flip_h"), &AnimatedSprite2D::set_flip_h);
ClassDB::bind_method(D_METHOD("is_flipped_h"), &A... |
ClassDB::bind_method(D_METHOD("set_offset", "offset"), &AnimatedSprite2D::set_offset);
ClassDB::bind_method(D_METHOD("get_offset"), &AnimatedSprite2D::get_offset);
ClassDB::bind_method(D_METHOD("set_flip_h", "flip_h"), &AnimatedSprite2D::set_flip_h);
ClassDB::bind_method(D_METHOD("is_flipped_h"), &AnimatedSprite2... | ADD_PROPERTY(PropertyInfo(Variant::INT, "frame"), "set_frame", "get_frame");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "frame_progress", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_frame_progress", "get_frame_progress"); | ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale"), "set_speed_scale", "get_speed_scale");
ADD_GROUP("Offset", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset", PROPERTY_HINT_NONE, "suffix:px"), "set_offset", "get_o... | random |
<|fim_prefix|>W;
ae->window_id = p_window_id;
wd.root_id = rid_owner.make_rid(ae);
#ifdef WINDOWS_ENABLED
wd.adapter = accesskit_windows_subclassing_adapter_new(static_cast<HWND>(p_handle), &_accessibility_initial_tree_update_callback, (void *)(size_t)p_window_id, &_accessibility_action_callback, (void *)(size_t)p_... | W;
ae->window_id = p_window_id;
wd.root_id = rid_owner.make_rid(ae);
#ifdef WINDOWS_ENABLED
wd.adapter = accesskit_windows_subclassing_adapter_new(static_cast<HWND>(p_handle), &_accessibility_initial_tree_update_callback, (void *)(size_t)p_window_id, &_accessibility_action_callback, (void *)(size_t)p_window_id);
#e... | if (!ae->actions.has(p_request->action) && ae->role == ACCESSKIT_ROLE_TEXT_RUN && p_request->action == ACCESSKIT_ACTION_SCROLL_INTO_VIEW) {
AccessibilityElement *root_ae = singleton->rid_owner.get_or_null(ae->parent);
ERR_FAIL_NULL(root_ae);
ae = root_ae;
rq_data = ae->run;
} |
if (ae->actions.has(p_request->action)) {
Callable &cb = ae->actions[p_request->action];
if (cb.is_valid()) {
if (p_request->data.has_value) {
switch (p_request->data.value.tag) {
case ACCESSKIT_ACTION_DATA_CUSTOM_ACTION: {
rq_data = p_request->data.value.custom_action;
} break;
case ... | ast_based |
<|fim_prefix|>/* 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 *... | /* 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 pe... | }
}
void AndroidInputHandler::_set_key_modifier_state(Ref<InputEventWithModifiers> ev, Key p_keycode) {
if (p_keycode != Key::SHIFT) {
ev->set_shift_pressed(shift_mem);
} | if (p_keycode != Key::ALT) {
ev->set_alt_pressed(alt_mem);
}
if (p_keycode != Key::META) {
ev->set_meta_pressed(meta_mem);
}
if (p_keycode != Key::CTRL) {
ev->set_ctrl_pressed(control_mem);
}
}
void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_presse... | random |
<|fim_prefix|>());
}
void AccessibilityDriverAccessKit::accessibility_update_set_background_color(const RID &p_id, const Color &p_color) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_... | ());
}
void AccessibilityDriverAccessKit::accessibility_update_set_background_color(const RID &p_id, const Color &p_color) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_n... | OS::get_singleton()->get_executable_path().get_base_dir().path_join("../Frameworks") | .path_join("libaccesskit." + arch + ".dylib");
}
if (!FileAccess::exists(path)) {
path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("libaccesskit.dylib");
}
if (!FileAccess::exists(path)) {
path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("../Frameworks").path_... | ast_based |
<|fim_prefix|> float(i*squareSize), 0));
}
static bool run3Calibration(vector<vector<Point2f> > imagePoints1,
vector<vector<Point2f> > imagePoints2,
vector<vector<Point2f> > imagePoints3,
Size imageSize, Size boardSize,
... | float(i*squareSize), 0));
}
static bool run3Calibration(vector<vector<Point2f> > imagePoints1,
vector<vector<Point2f> > imagePoints2,
vector<vector<Point2f> > imagePoints3,
Size imageSize, Size boardSize,
... | {
printf("Error: camera %d was not calibrated\n", c);
return false;
} |
printf("Camera %d calibration reprojection error = %g\n", c, sqrt(err/N));
if( c == 1 )
cameraMatrix1 = cameraMatrix, distCoeffs1 = distCoeffs;
else if( c == 2 )
cameraMatrix2 = cameraMatrix, distCoeffs2 = distCoeffs;
else
cameraMatrix3 = cameraMatri... | ast_based |
<|fim_prefix|> _ensure_node(p_id, ae);
accesskit_affine transform = { p_transform.columns[0][0], p_transform.columns[0][1], p_transform.columns[1][0], p_transform.columns[1][1], p_transform.columns[2][0], p_transform.columns[2][1] };
accesskit_node_set_transform(ae->node, transform);
}
void AccessibilityDriverAcces... | _ensure_node(p_id, ae);
accesskit_affine transform = { p_transform.columns[0][0], p_transform.columns[0][1], p_transform.columns[1][0], p_transform.columns[1][1], p_transform.columns[2][0], p_transform.columns[2][1] };
accesskit_node_set_transform(ae->node, transform);
}
void AccessibilityDriverAccessKit::accessib... |
accesskit_node_push_detail(ae->node, (accesskit_node_id)p_related_id.get_id());
}
void AccessibilityDriverAccessKit::accessibility_update_add_related_described_by(const RID &p_id, const RID &p_related_id) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_A... | ERR_FAIL_NULL(ae);
AccessibilityElement *other_ae = rid_owner.get_or_null(p_related_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_push_described_by(ae->node, (accesskit_node_id)p_related_id.get_id());
}
void AccessibilityDriverAccessKit... | random |
<|fim_prefix|>andles.
for (int i = 0; i < edit_points.size(); i++) {
if (!read_only) {
if (edit_points[i].in_rect.has_point(mb->get_position())) {
moving_handle = -1;
moving_handle_key = edit_points[i].key;
moving_handle_track = edit_points[i].track;
moving_handle_left = animation->bezier_t... | andles.
for (int i = 0; i < edit_points.size(); i++) {
if (!read_only) {
if (edit_points[i].in_rect.has_point(mb->get_position())) {
moving_handle = -1;
moving_handle_key = edit_points[i].key;
moving_handle_track = edit_points[i].track;
moving_handle_left = animation->bezier_track_get_key_i... | Point2(time, h) | ;
return;
}
// If not scaling, that means we're moving.
moving_selection_attempt = true;
moving_selection = false;
moving_selection_mouse_begin = mb->get_position();
// The pivot will be from the mouse click location, not a specific key.
moving_selection_from_key = -1;
moving_selection_fro... | ast_based |
<|fim_prefix|> }
if (bs_from.y > bs_to.y) {
SWAP(bs_from.y, bs_to.y);
}
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_selection_fill_color"), EditorStringName(Editor)));
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_select... | }
if (bs_from.y > bs_to.y) {
SWAP(bs_from.y, bs_to.y);
}
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_selection_fill_color"), EditorStringName(Editor)));
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_selection_stroke_col... | // Box selecting or moving a handle
if (box_selecting || Math::abs(moving_handle) == 1) {
return get_default_cursor_shape();
}
// Hovering a handle
if (!read_only) {
for (const EditPoint &edit_point : edit_points) {
if (edit_point.in_rect.has_point(p_pos) || edit_point.out_rect.has_point(p_pos)) {
retur... | }
}
}
// Currently box scaling
if (scaling_selection) {
if (scaling_selection_handles == Vector2i(1, 1) || scaling_selection_handles == Vector2i(-1, -1)) {
return CURSOR_FDIAGSIZE;
} else if (scaling_selection_handles == Vector2i(1, -1) || scaling_selection_handles == Vector2i(-1, 1)) {
return CURSOR_... | random |
<|fim_prefix|>_log";
// Attribute used to record the name of the eager operation triggered the
// DTensor rewrites.
static constexpr char kEagerOperationName[] = "dtensor.eager_operation_name";
// The number of TPU cores in a donut.
static constexpr int kTpuDonutSize = 8;
// An attribute used to cache the computatio... | _log";
// Attribute used to record the name of the eager operation triggered the
// DTensor rewrites.
static constexpr char kEagerOperationName[] = "dtensor.eager_operation_name";
// The number of TPU cores in a donut.
static constexpr int kTpuDonutSize = 8;
// An attribute used to cache the computation of device se... | static constexpr char kIteratorOutputShapes[] = "output_shapes"; |
// The number of list of regular tensors used to represent sparse tensors.
static constexpr int kSparseTensorNum = 3;
// Attribute which stores the environment variable value for all_reduce
// optimization group size: DTENSOR_ALLREDUCE_COMBINE_OPTIMIZATION_GROUP_SIZE.
// This represents the maximum number of AllRedu... | ast_based |
<|fim_prefix|>_path_win = ProjectSettings::get_singleton()->get_resource_path().replace_char('/', '\\');
#endif
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("filename"), "res://filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("path/filename"), "res://path/filename");
CHECK_EQ(Project... | _path_win = ProjectSettings::get_singleton()->get_resource_path().replace_char('/', '\\');
#endif
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("filename"), "res://filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("path/filename"), "res://path/filename");
CHECK_EQ(ProjectSettings::get_... | ProjectSettings::get_singleton() | ->localize_path("C:/testroot/path/./filename"), "C:/testroot/path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("C:\\testroot\\filename"), "C:/testroot/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("C:\\testroot\\path\\filename"), "C:/testroot/path/filename");
CHECK_EQ(P... | ast_based |
<|fim_prefix|>ating [%d] x [%d] x [%d] = [%d] float space for w->w1\n",__func__,p->n_layers, p->hidden_dim, p->dim, p->n_layers * p->hidden_dim * p->dim);
w->w2.resize(p->n_layers * p->hidden_dim * p->dim);
LOG_INF("%s: Allocating [%d] x [%d] x [%d] = [%d] float space for w->w2\n",__func__,p->n_layers,... | ating [%d] x [%d] x [%d] = [%d] float space for w->w1\n",__func__,p->n_layers, p->hidden_dim, p->dim, p->n_layers * p->hidden_dim * p->dim);
w->w2.resize(p->n_layers * p->hidden_dim * p->dim);
LOG_INF("%s: Allocating [%d] x [%d] x [%d] = [%d] float space for w->w2\n",__func__,p->n_layers, p->dim, p->hi... | w->w1.data() | , sizeof(float), w->w1.size(), f) != w->w1.size()) return 1;
if (fread(w->w2.data(), sizeof(float), w->w2.size(), f) != w->w2.size()) return 1;
if (fread(w->w3.data(), sizeof(float), w->w3.size(), f) != w->w3.size()) return 1;
if (fread(w->rms_final_weight.data(), sizeof(float), w->rms_final_weight.size(), ... | ast_based |
<|fim_prefix|>// (C) Copyright 2017, Google Inc.
// 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 ... | // (C) Copyright 2017, Google Inc.
// 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,... | api_.SetImage(src_pix_);
api_.SetVariable("tessedit_make_boxes_from_boxes", "1");
api_.SetInputName(TestDataNameToPath(filename).c_str()); |
found = true;
}
return found;
}
// Runs ApplyBoxes (via setting the appropriate variables and Recognize)
// and checks that the output ocr text matches the truth_str, and that
// the boxes match the given box file well enough.
// If line_mode is true, ApplyBoxes is run in line segmentation mod... | ast_based |
<|fim_prefix|>M_KV_ADAPTER_ALORA_INVOCATION_TOKENS);
const int kid = gguf_find_key(ctx_gguf.get(), key.c_str());
if (kid >= 0) {
if (gguf_get_kv_type(ctx_gguf.get(), kid) != GGUF_TYPE_ARRAY) {
throw std::runtime_error("invalid gguf type for " + key);
}
... | M_KV_ADAPTER_ALORA_INVOCATION_TOKENS);
const int kid = gguf_find_key(ctx_gguf.get(), key.c_str());
if (kid >= 0) {
if (gguf_get_kv_type(ctx_gguf.get(), kid) != GGUF_TYPE_ARRAY) {
throw std::runtime_error("invalid gguf type for " + key);
}
const auto ar... | str.size() | -suffix.size(), suffix.size(), suffix) == 0;
};
for (ggml_tensor * cur = ggml_get_first_tensor(ctx.get()); cur; cur = ggml_get_next_tensor(ctx.get(), cur)) {
std::string name(cur->name);
if (str_endswith(name, ".lora_a")) {
replace_all(name, ".lora_a", "");
if (ab_map.fi... | ast_based |
<|fim_prefix|>num_graph_nodes_ TF_GUARDED_BY(mu_) = 0;
};
ClientSession::ClientSession(const Scope& scope, const string& target)
: ClientSession(scope, Impl::MakeDefaultSessionOptions(target)) {}
ClientSession::ClientSession(const Scope& scope) : ClientSession(scope, "") {}
ClientSession::ClientSession(const Sco... | num_graph_nodes_ TF_GUARDED_BY(mu_) = 0;
};
ClientSession::ClientSession(const Scope& scope, const string& target)
: ClientSession(scope, Impl::MakeDefaultSessionOptions(target)) {}
ClientSession::ClientSession(const Scope& scope) : ClientSession(scope, "") {}
ClientSession::ClientSession(const Scope& scope,
... | if (num_nodes > last_num_graph_nodes_) {
GraphDef graph_def;
graph_->ToGraphDefSubRange(&graph_def, last_num_graph_nodes_);
last_num_graph_nodes_ = num_nodes;
return session_->Extend(graph_def);
}
return absl::OkStatus(); |
}
absl::Status ClientSession::Run(const RunOptions& run_options,
const FeedType& inputs,
const std::vector<Output>& fetch_outputs,
const std::vector<Operation>& run_outputs,
std::vector<Tens... | ast_based |
<|fim_prefix|> "\n", argv[0] );
}
static void calcChessboardCorners(Size boardSize, float squareSize, vector<Point3f>& corners)
{
corners.resize(0);
for( int i = 0; i < boardSize.height; i++ )
for( int j = 0; j < boardSize.width; j++ )
corners.push_back(Point3f(float(j*squareSize)... | "\n", argv[0] );
}
static void calcChessboardCorners(Size boardSize, float squareSize, vector<Point3f>& corners)
{
corners.resize(0);
for( int i = 0; i < boardSize.height; i++ )
for( int j = 0; j < boardSize.width; j++ )
corners.push_back(Point3f(float(j*squareSize),
... | Mat::zeros(5, 1, CV_64F) | ;
double err = calibrateCamera(objpt, imgpt, imageSize, cameraMatrix,
distCoeffs, rvecs, tvecs,
flags|CALIB_FIX_K3/*|CALIB_FIX_K4|CALIB_FIX_K5|CALIB_FIX_K6*/);
bool ok = checkRange(cameraMatrix) && checkRange(distCoeffs);
if(!ok)
{
... | ast_based |
<|fim_prefix|> set_only_non_debug_params, nullptr);
}
// In-memory version reads the traineddata file directly from the given
// data[data_size] array. Also implements the version with a datapath in data,
// flagged by data_size = 0.
int TessBaseAPI::Init(const char *data, int data_size, const char *langu... | set_only_non_debug_params, nullptr);
}
// In-memory version reads the traineddata file directly from the given
// data[data_size] array. Also implements the version with a datapath in data,
// flagged by data_size = 0.
int TessBaseAPI::Init(const char *data, int data_size, const char *language, OcrEngine... | }
}
| // Update datapath and language requested for the last valid initialization.
datapath_ = std::move(datapath);
if (datapath_.empty() && !tesseract_->datadir.empty()) {
datapath_ = tesseract_->datadir;
}
language_ = language;
last_oem_requested_ = oem;
#ifndef DISABLED_LEGACY_ENGINE
// For same langua... | random |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.