repo stringclasses 183
values | ref stringlengths 40 40 | path stringlengths 8 198 | prompt stringlengths 0 24.6k | suffix stringlengths 0 24.5k | canonical_solution stringlengths 30 18.1k | lang stringclasses 12
values | timestamp timestamp[s]date 2019-12-19 23:00:04 2025-03-02 18:12:33 |
|---|---|---|---|---|---|---|---|
facebook/react-native | ee7514cf493dc126a4d80c913083a6f69676a225 | packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.kt | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.fabric.events
import android.annotation.SuppressLint
import com.facebook.jni.HybridClassBase
import c... |
import com.facebook.react.bridge.WritableMap
import com.facebook.react.fabric.FabricSoLoader.staticInit
import com.facebook.react.uimanager.events.EventCategoryDef
/**
* This class holds reference to the C++ EventEmitter object. Instances of this class are created in
* FabricMountingManager.cpp, where the pointer t... | import com.facebook.react.bridge.UiThreadUtil | kotlin | 2025-02-27T19:08:01 |
facebook/react-native | 8698ecad185d0ab2b32cc9fcb9e83badb65890d6 | packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PerformanceTracer.h"
#include <oscompat/OSCompat.h>
#include <folly/json.h>
#include <mutex>
namespace facebook::re... |
performanceMeasureCount_ = 0;
profileCount_ = 0;
tracing_ = false;
return true;
}
void PerformanceTracer::collectEvents(
const std::function<void(const folly::dynamic& eventsChunk)>&
resultCallback,
uint16_t chunkSize) {
std::lock_guard lock(mutex_);
if (buffer_.empty()) {
return;
... | // This is synthetic Trace Event, which should not be represented on a
// timeline. CDT is not using Profile or ProfileChunk events for determining
// trace timeline window, this is why trace that only contains JavaScript
// samples will be displayed as empty. We use this event to avoid that.
// This could happ... | cpp | 2025-02-27T18:38:38 |
facebook/react-native | 13177b3025d06c93fb2634a19e0033b8ac4f67a7 | packages/react-native/scripts/react_native_pods.rb | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require 'json'
require 'open3'
require 'pathname'
require_relative './react_native_pods_utils/script_phases.rb'
require_relative './cocoapod... |
def print_cocoapods_deprecation_message()
if ENV["RCT_IGNORE_PODS_DEPRECATION"] == "1"
return
end
puts ''
puts '==================== DEPRECATION NOTICE ====================='.yellow
puts 'Calling `pod install` directly is deprecated in React Native'.yellow
puts 'because we are moving away from Cocoap... | def print_jsc_removal_message()
puts ''
puts '=============== JavaScriptCore is being moved ==============='.yellow
puts 'JavaScriptCore has been extracted from react-native core'.yellow
puts 'and will be removed in a future release. It can now be'.yellow
puts 'installed from `@react-native-community/javascri... | ruby | 2025-02-27T18:32:25 |
facebook/react-native | 90e27c2b4f6c831922e61b370342ced328cb705d | packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react
import com.android.build.api.variant.Variant
import com.facebook.react.tasks.BundleHermesCTask
import... |
if (!isDebuggableVariant) {
val entryFileEnvVariable = System.getenv("ENTRY_FILE")
val bundleTask =
tasks.register("createBundle${targetName}JsAndAssets", BundleHermesCTask::class.java) {
it.root.set(config.root)
it.nodeExecutableAndArgs.set(config.nodeExecutableAndArgs)
... | if (!isHermesEnabledInThisVariant && !useThirdPartyJSC) {
showJSCRemovalMessage(project)
} | kotlin | 2025-02-27T16:38:35 |
facebook/react-native | 90e27c2b4f6c831922e61b370342ced328cb705d | packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.utils
import java.util.*
import org.gradle.api.Project
internal object BackwardCompatUtils {
priva... |
}
}
| }
fun showJSCRemovalMessage(project: Project) {
if (hasShownJSCRemovalMessage) {
return
}
val message =
"""
=============== JavaScriptCore is being moved ===============
JavaScriptCore has been extracted from react-native core
and will be removed in a future release. It can now be
install... | kotlin | 2025-02-27T16:38:35 |
facebook/react-native | 13a0b4691ab0be4b91fc9a438f02f43ba62573b0 | packages/react-native/ReactCommon/jsinspector-modern/TracingAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "TracingAgent.h"
#include <jsinspector-modern/tracing/PerformanceTracer.h>
#include <jsinspector-modern/tracing/Runtime... |
bool correctlyStopped = PerformanceTracer::getInstance().stopTracing();
if (!correctlyStopped) {
frontendChannel_(cdp::jsonError(
req.id,
cdp::ErrorCode::InternalError,
"Tracing session not started"));
return true;
}
// Send response to Tracing.end request.
... | tracing::RuntimeSamplingProfileTraceEventSerializer::serializeAndBuffer(
PerformanceTracer::getInstance(),
instanceAgent_->collectTracingProfile().getRuntimeSamplingProfile(),
instanceTracingStartTimestamp_); | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 290f237cfaa879cc03689aaad8680ab5a0d335a9 | packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PerformanceTracer.h"
#include <oscompat/OSCompat.h>
#include <folly/json.h>
#include <mutex>
namespace facebook::re... |
});
}
void PerformanceTracer::reportEventLoopTask(uint64_t start, uint64_t end) {
if (!tracing_) {
return;
}
std::lock_guard lock(mutex_);
if (!tracing_) {
return;
}
buffer_.push_back(TraceEvent{
.name = "RunTask",
.cat = "disabled-by-default-devtools.timeline",
.ph = 'X',
... | });
}
uint16_t PerformanceTracer::reportRuntimeProfile(
uint64_t threadId,
uint64_t eventUnixTimestamp) {
std::lock_guard lock(mutex_);
if (!tracing_) {
throw std::runtime_error(
"Runtime Profile should only be reported when Tracing is enabled");
}
++profileCount_;
// CDT prioritizes eve... | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 067c5f9954f6250d63da1619d960e345f6684e05 | packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PerformanceTracer.h"
#include <oscompat/OSCompat.h>
#include <folly/json.h>
#include <mutex>
namespace facebook::re... |
folly::dynamic PerformanceTracer::serializeTraceEvent(TraceEvent event) const {
folly::dynamic result = folly::dynamic::object;
if (event.id.has_value()) {
result["id"] = folly::sformat("0x{:X}", event.id.value());
}
result["name"] = event.name;
result["cat"] = event.cat;
result["ph"] = std::string(1... | void PerformanceTracer::reportEventLoopTask(uint64_t start, uint64_t end) {
if (!tracing_) {
return;
}
std::lock_guard lock(mutex_);
if (!tracing_) {
return;
}
buffer_.push_back(TraceEvent{
.name = "RunTask",
.cat = "disabled-by-default-devtools.timeline",
.ph = 'X',
.ts = ... | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 067c5f9954f6250d63da1619d960e345f6684e05 | packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "RuntimeScheduler_Modern.h"
#include "SchedulerPriorityUtils.h"
#include <cxxreact/TraceSection.h>
#include <jsinspecto... |
ScopedShadowTreeRevisionLock revisionLock(
shadowTreeRevisionConsistencyManager_);
currentTask_ = &task;
currentPriority_ = task.priority;
if (ReactNativeFeatureFlags::enableLongTaskAPI()) {
lastYieldingOpportunity_ = taskStartTime;
longestPeriodWithoutYieldingOpportunity_ =
std::chron... | [[maybe_unused]] jsinspector_modern::tracing::EventLoopTaskReporter
performanceReporter; | cpp | 2025-02-27T16:32:12 |
facebook/react-native | bf6852db2e46dc28eb6ae1a136ff6988e2bd7c9c | packages/react-native/ReactCommon/jsinspector-modern/InstanceAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <jsinspector-modern/InstanceAgent.h>
#include "CdpJson.h"
#include "RuntimeTarget.h"
namespace facebook::react::jsinspe... |
runtimeAgent_->enableSamplingProfiler();
}
}
void InstanceAgent::stopTracing() {
if (runtimeAgent_) {
runtimeAgent_->disableSamplingProfiler();
}
}
tracing::InstanceTracingProfile InstanceAgent::collectTracingProfile() {
tracing::RuntimeSamplingProfile runtimeSamplingProfile =
runtimeAgent_->co... | runtimeAgent_->registerForTracing(); | cpp | 2025-02-27T16:32:12 |
facebook/react-native | bf6852db2e46dc28eb6ae1a136ff6988e2bd7c9c | packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "RuntimeAgent.h"
#include "SessionState.h"
namespace facebook::react::jsinspector_modern {
RuntimeAgent::RuntimeAgent(... |
void RuntimeAgent::enableSamplingProfiler() {
targetController_.enableSamplingProfiler();
}
void RuntimeAgent::disableSamplingProfiler() {
targetController_.disableSamplingProfiler();
}
tracing::RuntimeSamplingProfile RuntimeAgent::collectSamplingProfile() {
return targetController_.collectSamplingProfile();
... | void RuntimeAgent::registerForTracing() {
targetController_.registerForTracing();
} | cpp | 2025-02-27T16:32:12 |
facebook/react-native | bf6852db2e46dc28eb6ae1a136ff6988e2bd7c9c | packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "SessionState.h"
#include <jsinspector-modern/RuntimeTarget.h>
#include <jsinspector-modern/tracing/PerformanceTracer.h... |
}
void RuntimeTarget::enableSamplingProfiler() {
delegate_.enableSamplingProfiler();
}
void RuntimeTarget::disableSamplingProfiler() {
delegate_.disableSamplingProfiler();
}
tracing::RuntimeSamplingProfile RuntimeTarget::collectSamplingProfile() {
return delegate_.collectSamplingProfile();
}
} // namespace f... | }
void RuntimeTarget::registerForTracing() {
jsExecutor_([](auto& /*runtime*/) {
PerformanceTracer::getInstance().reportJavaScriptThread();
}); | cpp | 2025-02-27T16:32:12 |
facebook/react-native | bf6852db2e46dc28eb6ae1a136ff6988e2bd7c9c | packages/react-native/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PerformanceTracer.h"
#include <oscompat/OSCompat.h>
#include <folly/json.h>
#include <mutex>
namespace facebook::re... |
void PerformanceTracer::reportThread(uint64_t id, const std::string& name) {
if (!tracing_) {
return;
}
std::lock_guard<std::mutex> lock(mutex_);
if (!tracing_) {
return;
}
buffer_.push_back(TraceEvent{
.name = "thread_name",
.cat = "__metadata",
.ph = 'M',
.ts = 0,
... | void PerformanceTracer::reportJavaScriptThread() {
reportThread(oscompat::getCurrentThreadId(), "JavaScript");
} | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <jsinspector-modern/RuntimeTarget.h>
#include "HermesRuntimeTargetDelegate.h"
// If HERMES_ENABLE_DEBUGGER isn't defin... |
}
#ifdef HERMES_ENABLE_DEBUGGER
CDPDebugAPI& HermesRuntimeTargetDelegate::getCDPDebugAPI() {
return impl_->getCDPDebugAPI();
}
#endif
} // namespace facebook::react::jsinspector_modern
| }
void HermesRuntimeTargetDelegate::enableSamplingProfiler() {
impl_->enableSamplingProfiler();
}
void HermesRuntimeTargetDelegate::disableSamplingProfiler() {
impl_->disableSamplingProfiler();
}
tracing::RuntimeSamplingProfile
HermesRuntimeTargetDelegate::collectSamplingProfile() {
return impl_->collectSampli... | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/jsinspector-modern/FallbackRuntimeTargetDelegate.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "FallbackRuntimeTargetDelegate.h"
#include "FallbackRuntimeAgentDelegate.h"
namespace facebook::react::jsinspector_mode... |
} // namespace facebook::react::jsinspector_modern
| void FallbackRuntimeTargetDelegate::enableSamplingProfiler() {
// no-op
};
void FallbackRuntimeTargetDelegate::disableSamplingProfiler() {
// no-op
};
tracing::RuntimeSamplingProfile
FallbackRuntimeTargetDelegate::collectSamplingProfile() {
throw std::logic_error(
"Sampling Profiler capabilities are not s... | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "CdpJson.h"
#include <folly/dynamic.h>
#include <folly/json.h>
#include <jsinspector-modern/HostAgent.h>
#include <jsin... |
auto previousInstanceAgent = std::move(instanceAgent_);
instanceAgent_ = std::move(instanceAgent);
if (!sessionState_.isRuntimeDomainEnabled) {
return;
}
if (previousInstanceAgent != nullptr) {
// TODO: Send Runtime.executionContextDestroyed here - at the moment we
// expect the runtime to do i... | tracingAgent_.setCurrentInstanceAgent(instanceAgent); | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/jsinspector-modern/InstanceAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <jsinspector-modern/InstanceAgent.h>
#include "CdpJson.h"
#include "RuntimeTarget.h"
namespace facebook::react::jsinspe... |
} // namespace facebook::react::jsinspector_modern
| void InstanceAgent::startTracing() {
if (runtimeAgent_) {
runtimeAgent_->enableSamplingProfiler();
}
}
void InstanceAgent::stopTracing() {
if (runtimeAgent_) {
runtimeAgent_->disableSamplingProfiler();
}
}
tracing::InstanceTracingProfile InstanceAgent::collectTracingProfile() {
tracing::RuntimeSampl... | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "RuntimeAgent.h"
#include "SessionState.h"
namespace facebook::react::jsinspector_modern {
RuntimeAgent::RuntimeAgent(... |
} // namespace facebook::react::jsinspector_modern
| void RuntimeAgent::enableSamplingProfiler() {
targetController_.enableSamplingProfiler();
}
void RuntimeAgent::disableSamplingProfiler() {
targetController_.disableSamplingProfiler();
}
tracing::RuntimeSamplingProfile RuntimeAgent::collectSamplingProfile() {
return targetController_.collectSamplingProfile();
} | cpp | 2025-02-27T16:32:12 |
facebook/react-native | 72e745fc15613bb5b6dc441825966edab479a430 | packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "SessionState.h"
#include <jsinspector-modern/RuntimeTarget.h>
using namespace facebook::jsi;
namespace facebook::rea... |
} // namespace facebook::react::jsinspector_modern
| void RuntimeTargetController::enableSamplingProfiler() {
target_.enableSamplingProfiler();
}
void RuntimeTargetController::disableSamplingProfiler() {
target_.disableSamplingProfiler();
}
tracing::RuntimeSamplingProfile
RuntimeTargetController::collectSamplingProfile() {
return target_.collectSamplingProfile();... | cpp | 2025-02-27T16:32:12 |
facebook/relay | 687e9964123f6835f55d55925fbbdc6135f6664c | compiler/crates/relay-transforms/src/errors.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use common::ArgumentName;
use common::DiagnosticDisplay;
use common::DirectiveName;
use common::InterfaceName;
use common::Object... |
#[error("Invalid directive combination. @alias may not be combined with other directives.")]
FragmentAliasIncompatibleDirective,
#[error(
"Unexpected `@alias` on spread of plural fragment. @alias may not be used on fragments marked as `@relay(plural: true)`."
)]
PluralFragmentAliasNotSupp... | #[error(
"Unexpected Relay Resolver returning plual edge to type defined on the server. Relay Resolvers do not curretly support returning plural edges to server types. As a work around, consider defining a plural edge to a client type which has a singular edge to the server type."
)]
ClientEdgeToServerO... | rust | 2025-02-27T18:23:06 |
facebookresearch/faiss | eab52af8ea541b0653648b13744e762f587dc0f2 | faiss/cppcontrib/factory_tools.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// -*- c++ -*-
#include <faiss/cppcontrib/factory_tools.h>
#include <map>
#include <faiss/IndexBinaryFlat.h>
#include <faiss/I... |
} else if (
const faiss::IndexRefine* refine_index =
dynamic_cast<const faiss::IndexRefine*>(index)) {
return reverse_index_factory(refine_index->base_index) + ",Refine(" +
reverse_index_factory(refine_index->refine_index) + ")";
} else if (
c... | } else if (
const faiss::IndexNSG* nsg_index =
dynamic_cast<const faiss::IndexNSG*>(index)) {
return "NSG" + std::to_string(nsg_index->nsg.R) + "," +
reverse_index_factory(nsg_index->storage); | cpp | 2025-02-28T23:13:56 |
facebookresearch/faiss | eab52af8ea541b0653648b13744e762f587dc0f2 | tests/test_factory_tools.cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <faiss/cppcontrib/factory_tools.h>
#include <faiss/index_factory.h>
#include <gtest/gtest.h>
namespace faiss {
TEST(Te... |
}) {
std::unique_ptr<Index> index{index_factory(64, src)};
ASSERT_TRUE(index);
EXPECT_EQ(dst, reverse_index_factory(index.get()));
}
}
} // namespace faiss
| Case{"NSG", "NSG32,Flat"},
Case{"NSG,PQ8", "NSG32,PQ8x8"}, | cpp | 2025-02-28T23:13:56 |
filamentphp/filament | dcd673b34b56e82cf7c086a98fc31f8861a8f88c | packages/panels/src/Navigation/NavigationManager.php | <?php
namespace Filament\Navigation;
use Filament\Facades\Filament;
use Filament\Panel;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
class NavigationManager
{
protected Panel $panel;
protected bool $isNavigationMounted = false;
/**
* @var array<string | int, NavigationGroup | str... |
if (blank($groupIndex)) {
return NavigationGroup::make()->items($items);
}
$registeredGroup = $groups
->first(function (NavigationGroup | string $registeredGroup, string | int $registeredGroupIndex) use ($groupIndex) {
... | $items = $items->filter(fn (NavigationItem $item): bool => filled($item->getChildItems() || $item->getUrl())); | php | 2025-02-27T12:22:20 |
filamentphp/filament | bf32a9171fe89ded23b0179060e441ec6958c545 | packages/tables/resources/views/components/summary/index.blade.php | @props([
'actions' => false,
'actionsPosition' => null,
'columns',
'extraHeadingColumn' => false,
'groupColumn' => null,
'groupsOnly' => false,
'placeholderColumns' => true,
'pluralModelLabel',
'recordCheckboxPosition' => null,
'records',
'selectionEnabled' => false,
])
@php... |
<x-filament-tables::summary.row
:actions="$actions"
:actions-position="$actionsPosition"
:columns="$columns"
:extra-heading-column="$extraHeadingColumn"
:heading="__('filament-tables::table.summary.subheadings.page', ['label' => $pluralModelLabel])"
:placeholder-col... | @php
$query = $this->getPageTableSummaryQuery();
$selectedState = $this->getTableSummarySelectedState($query)[0] ?? [];
@endphp | php | 2025-02-27T07:55:44 |
firecracker-microvm/firecracker | 51167e62fa0bf22526c0be8d66964e5ec647c801 | resources/overlay/usr/local/bin/fast_page_fault_helper.c | // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Helper program for triggering fast page faults after UFFD snapshot restore.
// Allocates a 128M memory area using mmap, touches every page in it using memset and then
// calls `sigwait` to wait for a SI... |
ptr = mmap(NULL, MEM_SIZE_MIB, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (MAP_FAILED == ptr) {
perror("mmap");
return 1;
}
memset(ptr, 1, MEM_SIZE_MIB);
sigwait(&set, &signal);
memset(ptr, 2, MEM_SIZE_MIB);
return 0;
} | if (sigprocmask(SIG_BLOCK, &set, NULL) == -1) {
perror("sigprocmask");
return 1;
} | cpp | 2025-02-27T11:40:58 |
forem/forem | 52fe81ef058e5f7045dddffbb06a42f8fd435ef2 | app/models/feed_event.rb | class FeedEvent < ApplicationRecord
# These are "optional" mostly so that we can perform validated bulk inserts
# without triggering article/user validation.
# Since there are database-level constraints, it's fine to skip the automatic
# Rails-side association validation (which causes an N+1 query).
belongs_t... |
end
end
private
def update_article_counters_and_scores
return unless article
self.class.update_single_article_counters(article_id, feed_config_id)
end
# @see AbExperiment::GoalConversionHandler
def record_field_test_event
return if FieldTest.config["experiments"].nil?
return if cate... | if feed_config_id
# We give a higher weight to clicks higher in the position rank when calculating for the success of feedconfig.
clicks_score = clicks.sum("POWER(2.0/3, article_position - 1)")
score = (clicks_score + pageviews_score + reactions_score + comments_score).to_f / distinct_impressio... | ruby | 2025-02-28T18:53:29 |
forem/forem | 52fe81ef058e5f7045dddffbb06a42f8fd435ef2 | app/services/articles/feeds/custom.rb | module Articles
module Feeds
TIME_AGO_MAX = Rails.env.production? ? 10.days.ago : 90.days.ago
class Custom
def initialize(user: nil, number_of_articles: Article::DEFAULT_FEED_PAGINATION_WINDOW_SIZE, page: 1, tag: nil, feed_config: nil)
@user = user
@number_of_articles = number_of_articl... |
.limit(@number_of_articles)
.offset((@page - 1) * @number_of_articles)
.limited_column_select
.includes(top_comments: :user)
.includes(:distinct_reaction_categories)
if @user
articles = articles.where.not(user_id: UserBlock.cached_blocked_ids_for_blo... | .select("articles.*, (#{@feed_config.score_sql(@user)}) as computed_score") # Keep parentheses here
.from("(#{Article.published.where("articles.published_at > ?", TIME_AGO_MAX).to_sql}) as articles") # Subquery!
.order(Arel.sql("computed_score DESC")) | ruby | 2025-02-28T18:53:29 |
forem/forem | d8a0db588e31ebdaaeaeca4eca38357da4f5e6b0 | app/controllers/stories/feeds_controller.rb | module Stories
class FeedsController < ApplicationController
respond_to :json
before_action :current_user_by_token, only: [:show]
def show
@page = (params[:page] || 1).to_i
# This most recent test has concluded with a winner. Preserved as a comment awaiting next test
# @comments_varian... |
else
Articles::Feeds.feed_for(
user: current_user,
controller: self,
page: @page,
tag: params[:tag],
number_of_articles: 35,
type_of: params[:type_of] || "discover",
)
... | elsif feed_strategy == "custom" && params[:type_of] != "following"
Articles::Feeds::Custom.new(user: current_user, page: @page, tag: params[:tag]) | ruby | 2025-02-27T18:49:23 |
github/docs | 348b46bf0d17df991e2a84da4b7cc7ab97377d94 | src/shielding/middleware/handle-invalid-query-strings.ts | import type { Response, NextFunction } from 'express'
import statsd from '@/observability/lib/statsd.js'
import { noCacheControl, defaultCacheControl } from '@/frame/middleware/cache-control.js'
import { ExtendedRequest } from '@/types'
const STATSD_KEY = 'middleware.handle_invalid_querystrings'
// Exported for the ... |
'/api/anchor-redirect': ['hash', 'path'],
'/api/webhooks': ['category', 'version'],
'/api/pageinfo': ['pathname'],
}
const RECOGNIZED_KEYS_BY_ANY = new Set([
// Learning track pages
'learn',
'learnProduct',
// Platform picker
'platform',
// Tool picker
'tool',
// When apiVersion isn't the only o... | '/api/combined-search': ['query', 'version', 'size', 'debug'], | typescript | 2025-02-28T22:54:34 |
github/docs | a61dedb09a9a8521a7fce7aa6e137cbbad3edcfe | src/events/components/experiments/experiment.ts | import murmur from 'imurmurhash'
import {
CONTROL_VARIATION,
EXPERIMENTS,
ExperimentNames,
TREATMENT_VARIATION,
getActiveExperiments,
} from './experiments'
import { getUserEventsId } from '../events'
import type { ParsedUrlQuery } from 'querystring'
let experimentsInitialized = false
export function should... |
return getExperimentControlGroupFromSession(
experiment.key,
experiment.percentOfUsersToGetExperiment,
)
}
}
// When no experiment has `includeVariationInContext: true`
return CONTROL_VARIATION
}
export function initializeExperiments(
locale: string,
currentVersion: string,
... | // If the user is using the URL param to view the experiment, include the variation in the context
if (
experiment.turnOnWithURLParam &&
window.location?.search
?.toLowerCase()
.includes(`feature=${experiment.turnOnWithURLParam.toLowerCase()}`)
) {
return TREATMEN... | typescript | 2025-02-28T22:44:16 |
github/docs | 1564ce8965876097f94ab7892169f8f5c36feab2 | src/shielding/middleware/rate-limit.ts | import type { Request } from 'express'
import rateLimit from 'express-rate-limit'
import statsd from '@/observability/lib/statsd.js'
import { noCacheControl } from '@/frame/middleware/cache-control.js'
import { isFastlyIP } from '@/shielding/lib/fastly-ips'
const EXPIRES_IN_AS_SECONDS = 60
const MAX = process.env.R... |
// IP is empty when we are in a non-production (not behind Fastly) environment
// In these environments, we don't want to rate limit (including tests)
// However, if you want to test rate limiting locally, you can manually set
// the `fastly-client-ip` header to your IP address to bypass this c... | if (await isFastlyIP(ip)) {
return true
} | typescript | 2025-02-28T19:52:12 |
github/docs | 1564ce8965876097f94ab7892169f8f5c36feab2 | src/shielding/tests/shielding.ts | import { describe, expect, test } from 'vitest'
import { SURROGATE_ENUMS } from '@/frame/middleware/set-fastly-surrogate-key.js'
import { get } from '@/tests/helpers/e2etest.js'
import { DEFAULT_FASTLY_IPS } from '@/shielding/lib/fastly-ips'
describe('honeypotting', () => {
test('any GET with survey-vote and survey... |
})
})
describe('404 pages and their content-type', () => {
const exampleNonLanguage404plain = ['/_next/image/foo']
test.each(exampleNonLanguage404plain)(
'non-language 404 response is plain text and cacheable: %s',
async (pathname) => {
const res = await get(pathname)
expect(res.statusCode).... | })
test('/api/cookies only allows 1 request per minute', async () => {
// Cookies only allows 1 request per minute
const res1 = await get('/api/cookies', {
headers: {
'fastly-client-ip': 'abc123',
},
})
expect(res1.statusCode).toBe(200)
expect(res1.headers['ratelimit-limit']).... | typescript | 2025-02-28T19:52:12 |
github/docs | 87e31ba77d88709d32a9e04b72f301e9ea9ee157 | src/events/lib/schema.ts | import { languageKeys } from '#src/languages/lib/languages.js'
import { allVersionKeys } from '#src/versions/lib/all-versions.js'
import { productIds } from '#src/products/lib/all-products.js'
import { allTools } from 'src/tools/lib/all-tools.js'
const versionPattern = '^\\d+(\\.\\d+)?(\\.\\d+)?$' // eslint-disable-li... |
pressed_key: {
type: 'string',
description: 'The key the user pressed.',
},
pressed_on: {
type: 'string',
description: 'The element/identifier the user pressed the key on.',
},
},
}
const link = {
type: 'object',
additionalProperties: false,
required: ['type', 'context'... | context,
type: {
type: 'string',
pattern: '^keyboard$',
}, | typescript | 2025-02-28T19:27:03 |
github/docs | 8bbb598c547996a23a4ecf8edc195359b66dba4d | src/events/components/experiments/experiment.ts | import murmur from 'imurmurhash'
import {
CONTROL_VARIATION,
EXPERIMENTS,
ExperimentNames,
TREATMENT_VARIATION,
getActiveExperiments,
} from './experiments'
import { getUserEventsId } from '../events'
import type { ParsedUrlQuery } from 'querystring'
let experimentsInitialized = false
export function should... |
return true
}
}
return (
getExperimentControlGroupFromSession(
experimentKey,
experiment.percentOfUsersToGetExperiment,
) === TREATMENT_VARIATION
)
}
}
}
return false
}
// Allow developers to override their experim... | controlGroupOverride[experimentKey] = TREATMENT_VARIATION | typescript | 2025-02-27T21:04:38 |
gitlabhq/gitlabhq | 76747b143eb5b2ff99033de53d680bcc5fb8a50b | spec/services/auth/dpop_authentication_service_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Auth::DpopAuthenticationService, feature_category: :system_access do
include Auth::DpopTokenHelper
let_it_be(:user, freeze: true) { create(:user) }
let_it_be(:personal_access_token, freeze: true) { create(:personal_access_token, user: user) }
... |
context 'when a valid DPoP header is provided' do
it 'succeeds' do
expect(service.execute).to be_success
end
end
end
end
end
| context 'when two DPoP headers are provided' do
it 'raises a DpopValidationError' do
# Rails concatenates duplicate headers with a comma
headers['dpop'] = "#{dpop_proof.proof}, #{dpop_proof.proof}"
expect do
service.execute
end.to raise_error(Gitlab::Auth::Dp... | ruby | 2025-02-28T18:09:29 |
gitlabhq/gitlabhq | 2b669a60cb822575a5d766e8dd37c9b3457d7c57 | qa/qa/page/sub_menus/main.rb | # frozen_string_literal: true
module QA
module Page
module SubMenus
module Main
extend QA::Page::PageConcern
def go_to_issues
click_element('nav-item-link', submenu_item: 'Issues')
end
|
def go_to_merge_requests
click_element('nav-item-link', submenu_item: 'Merge requests')
end
end
end
end
end
| def go_to_work_items
if has_element?('nav-item-link', submenu_item: 'Work items')
click_element('nav-item-link', submenu_item: 'Work items')
else
click_element('nav-item-link', submenu_item: 'Issues')
end
end | ruby | 2025-02-28T15:07:53 |
gitlabhq/gitlabhq | 2b669a60cb822575a5d766e8dd37c9b3457d7c57 | spec/lib/gitlab/search/abuse_detection_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Search::AbuseDetection, feature_category: :global_search do
subject { described_class.new(params) }
let(:params) { { query_string: 'foobar' } }
describe 'abusive scopes validation' do
it 'allows only approved scopes' do
descr... |
describe 'abusive type coercion from string validation' do
let(:test_data) { [[1, 2, 3], 123, 3.14, { foo: :bar }] }
it 'considers anything not a String invalid' do
[:query_string, :scope, :repository_ref, :project_ref].each do |param|
test_data.each do |dtype|
expect(described_clas... | describe '#abusive_pipes?' do
using ::RSpec::Parameterized::TableSyntax
subject(:instance) { described_class.new({ query_string: search }) }
where(:search, :errors, :result) do
(['apples'] * described_class::MAX_PIPE_SYNTAX_FILTERS).join('|') | {} | false
(['apples'] * (described_class::... | ruby | 2025-02-28T15:07:53 |
gitlabhq/gitlabhq | 2b669a60cb822575a5d766e8dd37c9b3457d7c57 | spec/requests/projects/work_items_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Work Items', feature_category: :team_planning do
include WorkhorseHelpers
include_context 'workhorse headers'
let_it_be(:work_item) { create(:work_item) }
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }... |
describe 'GET /:namespace/:project/work_items/:id' do
context 'when authenticated' do
before do
sign_in(current_user)
end
it 'renders show' do
get project_work_item_url(work_item.project, work_item.iid)
expect(response).to have_gitlab_http_status(:ok)
end
... | describe 'GET /:namespace/:project/-/work_items' do
context 'when the user can read the group' do
before do
sign_in(current_user)
end
it 'renders index' do
get project_work_items_url(work_item.project)
expect(response).to have_gitlab_http_status(:ok)
end
end
... | ruby | 2025-02-28T15:07:53 |
gitlabhq/gitlabhq | dadff26dbbcbb1a343574fb519c7208bbe48e4bb | spec/requests/api/ml/mlflow/model_versions_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Ml::Mlflow::ModelVersions, feature_category: :mlops do
let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user, developer_of: project) }
let_it_be(:another_project) { build(:project).tap { |p| p.add_developer(developer... |
end
it 'increments the version if a model version already exists' do
m = create(:ml_model_versions, model: model, version: '1.0.0')
is_expected.to have_gitlab_http_status(:ok)
expect(json_response["model_version"]["version"]).to eq((m.id + 1).to_s)
end
describe 'user assigned versi... | end
describe 'version from run id' do
context 'with wrong eid' do
let(:params) do
{
'name' => model_name,
'description' => 'description-text',
'run_id' => 'wrong eid'
}
end
it 'returns error', :aggregate_failures do
ex... | ruby | 2025-02-28T12:13:13 |
gitlabhq/gitlabhq | a9abb029027660299ea965c06f6193c67bed32cd | spec/controllers/projects/registry/tags_controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::Registry::TagsController do
let(:user) { create(:user) }
let(:project) { create(:project, :private) }
let(:repository) do
create(:container_repository, name: 'image', project: project)
end
let(:service) { double('service')... |
end
end
private
def destroy_tag(name)
post :destroy, params: {
namespace_id: project.namespace,
project_id: project,
repository_id: repository,
id: name
}, format: :json
end
end
describe 'POST bulk_destroy' do
context 'when user has access to... | end
end
context 'when user cannot destroy image tags' do
before do
project.add_developer(user)
allow(Ability).to receive(:allowed?).and_call_original
allow(Ability).to receive(:allowed?).with(user, :destroy_container_image_tag, project).and_return(false)
end
it 'retur... | ruby | 2025-02-28T09:09:45 |
gitlabhq/gitlabhq | 58c37fa91ffd0e60c935972f2942b30c517ddb92 | spec/graphql/resolvers/work_items_resolver_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Resolvers::WorkItemsResolver, feature_category: :team_planning do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:reporter) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) ... |
context 'when sorting by title' do
let_it_be(:project) { create(:project, :public) }
let_it_be(:item1) { create(:work_item, project: project, title: 'foo') }
let_it_be(:item2) { create(:work_item, project: project, title: 'bar') }
let_it_be(:item3) { create(:work_item, ... | %w[start_date due_date].each do |field|
context "when sorting by #{field}" do
let_it_be(:work_item_dates_source1) do
create(:work_items_dates_source, work_item: item1, start_date: 2.days.ago, due_date: 1.day.from_now)
end
let_it_be(:work_item_dates_source2) d... | ruby | 2025-02-28T03:07:20 |
godotengine/godot | 7fb37a088bc719b4a9722ca0ac4508311d270a2a | platform/android/game_menu_utils_jni.cpp | /**************************************************************************/
/* game_menu_utils_jni.cpp */
/**************************************************************************/
/* This file is part of: */
/* ... |
#endif
extern "C" {
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
g... | static GameViewPlugin *_get_game_view_plugin() {
ERR_FAIL_NULL_V(EditorNode::get_singleton(), nullptr);
ERR_FAIL_NULL_V(EditorNode::get_singleton()->get_editor_main_screen(), nullptr);
return Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
} | cpp | 2025-02-27T21:20:23 |
google/guava | 008e78e799cfe6ef47beab313a99d23fdf334b87 | guava-tests/test/com/google/common/collect/RangeTest.java | /*
* Copyright (C) 2008 The Guava 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 agre... |
}
public void testEquals() {
new EqualsTester()
.addEqualityGroup(Range.open(1, 5), Range.range(1, OPEN, 5, OPEN))
.addEqualityGroup(Range.greaterThan(2), Range.greaterThan(2))
.addEqualityGroup(Range.all(), Range.all())
.addEqualityGroup("Phil")
.testEquals();
}
@... | assertFalse(predicate.test(1));
assertTrue(predicate.test(2));
assertTrue(predicate.test(3));
assertFalse(predicate.test(4)); | java | 2025-02-28T02:10:52 |
google/guava | 008e78e799cfe6ef47beab313a99d23fdf334b87 | guava-tests/test/com/google/common/hash/BloomFilterTest.java | /*
* Copyright (C) 2011 The Guava 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 agre... |
for (int i = 0; i < 100; i++) {
Object o = new Object();
bf.put(o);
assertTrue(bf.mightContain(o));
assertTrue(bf.apply(o));
assertTrue(bf.test(o));
}
}
public void testCopy() {
BloomFilter<String> original = BloomFilter.create(Funnels.unencodedCharsFunnel(), 100);
Bl... | assertFalse(bf.test(new Object())); | java | 2025-02-28T02:10:52 |
gradio-app/gradio | 16d419b9f1f18ae4507d18a4739eb83ac4f3fae9 | client/js/src/types.ts | // API Data Types
import { hardware_types } from "./helpers/spaces";
import type { SvelteComponent } from "svelte";
import type { ComponentType } from "svelte";
export interface ApiData {
label: string;
parameter_name: string;
parameter_default?: any;
parameter_has_default?: boolean;
type: {
type: any;
descr... |
}
export interface DependencyTypes {
generator: boolean;
cancel: boolean;
}
export interface Payload {
fn_index: number;
data: unknown[];
time?: Date;
event_data?: unknown;
trigger_id?: number | null;
}
export interface PostResponse {
error?: string;
[x: string]: any;
}
export interface UploadResponse {
... | js_implementation: string | null; | typescript | 2025-02-28T20:45:20 |
gradio-app/gradio | 16d419b9f1f18ae4507d18a4739eb83ac4f3fae9 | js/core/src/types.ts | import type { ComponentType } from "svelte";
import type { SvelteComponent } from "svelte";
/** The props that are always present on a component */
interface SharedProps {
elem_id?: string;
elem_classes?: string[];
components?: string[];
server_fns?: string[];
interactive: boolean;
[key: string]: unknown;
}
/**... |
}
/** A dependency as received from the backend */
export interface Dependency {
id: number;
targets: [number, string][];
inputs: number[];
outputs: number[];
backend_fn: boolean;
js: string | null;
scroll_to_output: boolean;
show_progress: "full" | "minimal" | "hidden";
show_progress_on: number[] | null;
f... | js_implementation?: boolean | null; | typescript | 2025-02-28T20:45:20 |
grafana/grafana | 620d21385630b1c809889ee3116e688dcecf78c7 | pkg/services/apiserver/builder/helper.go | package builder
import (
"context"
"encoding/csv"
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"regexp"
"strings"
"time"
"github.com/prometheus/client_golang/prometheus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/ap... |
if err := AddPostStartHooks(serverConfig, builders); err != nil {
return err
}
return nil
}
type ServerLockService interface {
LockExecuteAndRelease(ctx context.Context, actionName string, maxInterval time.Duration, fn func(ctx context.Context)) error
}
func getRequestInfo(gr schema.GroupResource, namespaceM... | // set priority for aggregated discovery
for i, b := range builders {
gvs := GetGroupVersions(b)
if len(gvs) == 0 {
return fmt.Errorf("builder did not return any API group versions: %T", b)
}
pvs := scheme.PrioritizedVersionsForGroup(gvs[0].Group)
for j, gv := range pvs {
serverConfig.AggregatedDiscove... | go | 2025-02-28T15:39:41 |
grafana/grafana | 620d21385630b1c809889ee3116e688dcecf78c7 | pkg/services/apiserver/service.go | package apiserver
import (
"context"
"fmt"
"net/http"
"path"
"github.com/prometheus/client_golang/prometheus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
genericapifilters "k8s.io/apiser... |
if err := b.InstallSchema(Scheme); err != nil {
return err
}
pvs := Scheme.PrioritizedVersionsForGroup(gvs[0].Group)
for j, gv := range pvs {
if s.features.IsEnabledGlobally(featuremgmt.FlagKubernetesAggregator) {
// set the priority for the group+version
kubeaggregator.APIVersionPriorities[gv] ... | if len(gvs) == 0 {
return fmt.Errorf("no group versions found for builder %T", b)
} | go | 2025-02-28T15:39:41 |
grafana/grafana | 9eaaf95701e5236620b1773ca60c5d2bb4d5ceee | pkg/tsdb/graphite/graphite_test.go | package graphite
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"reflect"
"strings"
"testing"
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"... |
}
func TestConvertResponses(t *testing.T) {
service := &Service{}
t.Run("Converts response without tags to data frames", func(*testing.T) {
body := `
[
{
"target": "target A",
"datapoints": [[50, 1], [null, 2], [100, 3]]
}
]`
a := 50.0
b := 100.0
expectedFrame := data.NewFrame("A",
dat... | t.Run("QueryData with no queries returns an error", func(t *testing.T) {
service := &Service{}
rsp, err := service.QueryData(context.Background(), &backend.QueryDataRequest{})
assert.Nil(t, rsp)
assert.Error(t, err)
})
t.Run("QueryData happy path with service provider and plugin context", func(t *testing.T)... | go | 2025-02-28T14:11:11 |
grafana/grafana | ec29f6cb60204c6803d6354dc508ab91d01f72e2 | pkg/api/org_users.go | package api
import (
"context"
"errors"
"fmt"
"net/http"
"strconv"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/services/accesscontrol"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/g... |
// swagger:parameters getOrgUsersForCurrentOrgLookup
type LookupOrgUsersParams struct {
// in:query
// required:false
Query string `json:"query"`
// in:query
// required:false
Limit int `json:"limit"`
}
// swagger:parameters getOrgUsers
type GetOrgUsersParams struct {
// in:path
// required:true
OrgID int64... | // swagger:parameters getOrgUsersForCurrentOrg
type GetOrgUsersForCurrentOrgParams struct {
// in:query
// required:false
Query string `json:"query"`
// in:query
// required:false
Limit int `json:"limit"`
} | go | 2025-02-28T12:41:58 |
grafana/grafana | f5e5824babbc5cc51749c7f27ce042c4c65aaa41 | pkg/server/wire.go | //go:build wireinject
// +build wireinject
// This file should contain wire sets used by both OSS and Enterprise builds.
// Use wireext_oss.go and wireext_enterprise.go for sets that are specific to
// the respective builds.
package server
import (
"github.com/google/wire"
sdkhttpclient "github.com/grafana/grafana... |
// Kubernetes API server
grafanaapiserver.WireSet,
apiregistry.WireSet,
appregistry.WireSet,
)
var wireSet = wire.NewSet(
wireBasicSet,
metrics.WireSet,
sqlstore.ProvideService,
ngmetrics.ProvideService,
wire.Bind(new(notifications.Service), new(*notifications.NotificationService)),
wire.Bind(new(notificati... | // Unified storage
resource.ProvideStorageMetrics, | go | 2025-02-28T12:39:39 |
grafana/grafana | f5e5824babbc5cc51749c7f27ce042c4c65aaa41 | pkg/storage/unified/sql/notifier.go | package sql
import (
"context"
"sync"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/storage/unified/resource"
"github.com/grafana/grafana/pkg/storage/unified/sql/db"
"github.com/grafana/grafana/pkg/storage/unified/sql/dbutil"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqlt... |
historyPoll: func(ctx context.Context, grp string, res string, since int64) ([]*historyPollResponse, error) {
var records []*historyPollResponse
err := b.db.WithTx(ctx, ReadCommittedRO, func(ctx context.Context, tx db.Tx) error {
var err error
records, err = dbutil.Query(ctx, tx, sqlResourceHistor... | storageMetrics: b.storageMetrics, | go | 2025-02-28T12:39:39 |
grafana/grafana | e73b78a13439ba81047e938f07fc3cba28d34236 | public/app/features/alerting/unified/Analytics.ts | import { isEmpty } from 'lodash';
import { dateTime } from '@grafana/data';
import { createMonitoringLogger, getBackendSrv } from '@grafana/runtime';
import { config, reportInteraction } from '@grafana/runtime/src';
import { contextSrv } from 'app/core/core';
import { RuleNamespace } from '../../../types/unified-aler... |
};
interface RulesSearchInteractionPayload {
filter: string;
triggeredBy: 'typing' | 'component';
}
function trackRulesSearchInteraction(payload: RulesSearchInteractionPayload) {
reportInteraction('grafana_alerting_rules_search', { ...payload });
}
export function trackRulesSearchInputInteraction({ oldQuery, ... | };
export const trackRuleVersionsRestoreSuccess = async (payload: RuleVersionComparisonProps & { origin: Origin }) => {
reportInteraction('grafana_alerting_rule_versions_restore_success', { ...payload });
};
export const trackRuleVersionsRestoreFail = async (
payload: RuleVersionComparisonProps & { origin: Origin... | typescript | 2025-02-28T11:14:23 |
grafana/grafana | e73b78a13439ba81047e938f07fc3cba28d34236 | public/app/features/alerting/unified/hooks/useCombinedRule.ts | import { skipToken } from '@reduxjs/toolkit/query';
import { useEffect, useMemo } from 'react';
import { useAsync } from 'react-use';
import { isGrafanaRulesSource } from 'app/features/alerting/unified/utils/datasource';
import { CombinedRule, RuleIdentifier, RuleWithLocation, RulesSource } from 'app/types/unified-ale... |
const { isLoading, currentData, error, isUninitialized } = alertRuleApi.endpoints.getAlertRule.useQuery(
validIdentifier,
{
refetchOnMountOrArgChange: true,
}
);
return useMemo(() => {
if (isPrometheusRuleIdentifier(ruleIdentifier) || isCloudRuleIdentifier(ruleIdentifier)) {
return ... | const validIdentifier = (() => {
if (isGrafanaRuleIdentifier(ruleIdentifier) && ruleIdentifier.uid !== '') {
return { uid: ruleIdentifier.uid };
}
return skipToken;
})(); | typescript | 2025-02-28T11:14:23 |
grafana/grafana | ae2074ef55d20954f32b1662fe1778d833c6d332 | pkg/tests/api/alerting/api_convert_prometheus_test.go | package alerting
import (
"encoding/json"
"net/http"
"testing"
"time"
prommodel "github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/expr"
"github.com/grafana/grafana/pkg/services/datasources"
apimodels "github.com/grafana/grafana/pkg/services/ngalert/ap... |
func TestIntegrationConvertPrometheusEndpoints_Conflict(t *testing.T) {
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
// Setup Grafana and its Database
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAle... | func TestIntegrationConvertPrometheusEndpoints_UpdateRule(t *testing.T) {
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
// Setup Grafana and its Database
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAle... | go | 2025-02-28T11:11:49 |
grafana/grafana | 5652e0b835e74c63dd3bb1572653a4b91504c6f2 | pkg/registry/apis/dashboard/legacy/queries.go | package legacy
import (
"embed"
"fmt"
"text/template"
"github.com/grafana/grafana/pkg/storage/legacysql"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate"
)
// Templates setup.
var (
//go:embed *.sql
sqlTemplatesFS embed.FS
sqlTemplates = template.Must(template.New("sql").ParseFS(sqlTemplates... |
return nil // TODO
}
func newQueryReq(sql *legacysql.LegacyDatabaseHelper, query *DashboardQuery) sqlQuery {
if query.Order == "" {
query.Order = "DESC" // use version as RV
}
return sqlQuery{
SQLTemplate: sqltemplate.New(sql.DialectForDriver()),
Query: query,
DashboardTable: sql.Table("dashboar... | if r.Query.Order == "ASC" && r.Query.LastID > 0 {
return fmt.Errorf("ascending order does not support paging by last id")
} | go | 2025-02-28T08:34:09 |
grafana/grafana | 5652e0b835e74c63dd3bb1572653a4b91504c6f2 | pkg/registry/apis/dashboard/legacy/queries_test.go | package legacy
import (
"testing"
"text/template"
"github.com/grafana/grafana/pkg/storage/legacysql"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate/mocks"
)
func TestDashboardQueries(t *testing.T) {
// prefix tables with grafana
... |
},
sqlQueryPanels: {
{
Name: "list",
Data: getLibraryQuery(&LibraryPanelQuery{
OrgID: 1,
Limit: 5,
}),
},
{
Name: "list_page_two",
Data: getLibraryQuery(&LibraryPanelQuery{
OrgID: 1,
LastID: 4,
}),
},
{
Name: "get_uid",
Data: ge... | {
Name: "export_with_history",
Data: getQuery(&DashboardQuery{
OrgID: 1,
GetHistory: true,
Order: "ASC",
}),
}, | go | 2025-02-28T08:34:09 |
grafana/grafana | 5652e0b835e74c63dd3bb1572653a4b91504c6f2 | pkg/registry/apis/dashboard/legacy/types.go | package legacy
import (
"context"
dashboard "github.com/grafana/grafana/pkg/apis/dashboard"
"github.com/grafana/grafana/pkg/storage/unified/resource"
)
// This does not check if you have permissions!
type DashboardQuery struct {
OrgID int64
UID string // to select a single dashboard
Limit int
// Included ... |
}
func (r *DashboardQuery) UseHistoryTable() bool {
return r.GetHistory || r.Version > 0
}
type LibraryPanelQuery struct {
OrgID int64
UID string // to select a single dashboard
Limit int64
// Included in the continue token
// This is the ID from the last dashboard sent in the previous page
LastID int64
}
... | // DESC|ASC, how to order the IDs
Order string // asc required to use lastID, desc required for export with history | go | 2025-02-28T08:34:09 |
grafana/grafana | ccc1477c7dbcba57f10e0063b1316274552d6e52 | packages/grafana-data/src/types/pluginExtensions.ts | import * as React from 'react';
import { DataQuery, DataSourceJsonData } from '@grafana/schema';
import { ScopedVars } from './ScopedVars';
import { DataSourcePluginMeta, DataSourceSettings } from './datasource';
import { IconName } from './icon';
import { PanelData } from './panel';
import { RawTimeRange, TimeZone }... |
export type PluginExtensionFunction<Signature = () => void> = PluginExtensionBase & {
type: PluginExtensionTypes.function;
fn: Signature;
};
export type PluginExtension = PluginExtensionLink | PluginExtensionComponent | PluginExtensionFunction;
// Objects used for registering extensions (in app plugins)
// ----... | export type ComponentTypeWithExtensionMeta<Props = {}> = React.ComponentType<Props> & {
meta: PluginExtensionComponentMeta;
}; | typescript | 2025-02-28T06:28:01 |
kubernetes/kubernetes | e7c743b2ebfaed1e3132027c0369ac25b14b6f47 | staging/src/k8s.io/apimachinery/pkg/api/meta/help.go | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
list := make([]runtime.Object, items.Len())
if len(list) == 0 {
return list, nil
}
elemType := items.Type().Elem()
isRawExtension := elemType == rawExtensionObjectType
implementsObject := elemType.Implements(objectType)
for i := range list {
raw := items.Index(i)
switch {
case isRawExtension:
item :=... | if items.IsNil() {
return nil, nil
} | go | 2024-12-19T09:38:30 |
kubernetes/kubernetes | e7c743b2ebfaed1e3132027c0369ac25b14b6f47 | staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
}
}
// NewCodecFactory provides methods for retrieving serializers for the supported wire formats
// and conversion wrappers to define preferred internal and external versions. In the future,
// as the internal version is used less, callers may instead use a defaulting serializer and
// only convert objects which ar... | }
}
func WithStreamingCollectionEncodingToJSON() CodecFactoryOptionsMutator {
return func(options *CodecFactoryOptions) {
options.StreamingCollectionsEncodingToJSON = true | go | 2024-12-19T09:38:30 |
kubernetes/kubernetes | e7c743b2ebfaed1e3132027c0369ac25b14b6f47 | staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json/collections_test.go | /*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | type ListWithAdditionalFields struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []testapigroupv1.Carp `json:"items" protobuf:"bytes,2,rep,name=items"`
AdditionalField int
}
func (s *ListWithAdditionalFields) DeepCopyObject() r... | go | 2024-12-19T09:38:30 | |
kubernetes/kubernetes | e7c743b2ebfaed1e3132027c0369ac25b14b6f47 | staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
}
encoder := json.NewEncoder(w)
return encoder.Encode(obj)
}
// IsStrict indicates whether the serializer
// uses strict decoding or not
func (s *Serializer) IsStrict() bool {
return s.options.Strict
}
func (s *Serializer) unmarshal(into runtime.Object, data, originalData []byte) (strictErrs []error, err error) ... | }
if s.options.StreamingCollectionsEncoding {
ok, err := streamEncodeCollections(obj, w)
if err != nil {
return err
}
if ok {
return nil
} | go | 2024-12-19T09:38:30 |
kubernetes/kubernetes | e7c743b2ebfaed1e3132027c0369ac25b14b6f47 | staging/src/k8s.io/apiserver/pkg/features/kube_features.go | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
// owner: @aramase, @enj, @nabokihms
// kep: https://kep.k8s.io/3331
//
// Enables Structured Authentication Configuration
StructuredAuthenticationConfiguration featuregate.Feature = "StructuredAuthenticationConfiguration"
// owner: @palnabarun
// kep: https://kep.k8s.io/3221
//
// Enables Structured Author... | // owner: @serathius
// Allow API server to encode collections item by item, instead of all at once.
StreamingCollectionEncodingToJSON featuregate.Feature = "StreamingCollectionEncodingToJSON" | go | 2024-12-19T09:38:30 |
kubernetes/kubernetes | b7c80f7f1592356e796a64958bec9a05e0fe3ba1 | staging/src/k8s.io/apiserver/pkg/cel/library/cidr_test.go | /*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
expectResult: falseVal,
},
{
name: "contains CIDR ipv4 (string)",
expr: `cidr("192.168.0.0/24").containsCIDR("192.168.0.0/25")`,
expectResult: trueVal,
},
{
name: "does not contain CIDR ipv4 (string)",
expr: `cidr("192.168.0.0/24").containsCIDR("192.168.0.0/23"... | expectResult: falseVal,
},
{
name: "does not contain IP ipv4 (CIDR) (/32)",
expr: `cidr("192.168.0.0/24").containsCIDR(cidr("192.169.0.1/32"))`, | go | 2025-02-26T14:24:58 |
kubernetes/kubernetes | a91ed902fed786bbc27d454045f203de3e98edd4 | pkg/controller/job/pod_failure_policy_test.go | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.JobBackoffLimitPerIndex, tc.enableJobBackoffLimitPerIndex)
jobFailMessage, countFailed, action := matchPodFailurePolicy(tc.podFailurePolicy, tc.failedPod)
if diff := cmp.Diff(tc.wantJobFailureMessage, jobFailMessage); diff... | if !tc.enableJobBackoffLimitPerIndex {
// TODO: this will be removed in 1.36
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, utilversion.MustParse("1.32"))
} | go | 2025-02-10T16:25:58 |
langchain-ai/langchain | f8ed5007ea049f6bae2eaf142be5cd91f6e87676 | libs/partners/mistralai/tests/integration_tests/test_chat_models.py | """Test ChatMistral chat model."""
import json
from typing import Any, Optional
import pytest
from langchain_core.messages import (
AIMessage,
AIMessageChunk,
BaseMessageChunk,
HumanMessage,
)
from pydantic import BaseModel
from typing_extensions import TypedDict
from langchain_mistralai.chat_models ... |
def test_invoke() -> None:
"""Test invoke tokens from ChatMistralAI"""
llm = ChatMistralAI()
result = llm.invoke("I'm Pickle Rick", config=dict(tags=["foo"]))
assert isinstance(result.content, str)
def test_chat_mistralai_llm_output_contains_model_name() -> None:
"""Test llm_output contains mo... | assert "model_name" in result.response_metadata | python | 2025-02-28T18:56:05 |
lichess-org/lila | 735a7b17b10ef3e3a281c06af721a52a045e8791 | ui/nvui/src/chess.ts | import { h, type VNode, type VNodeChildren } from 'snabbdom';
import { type Pieces, files } from 'chessground/types';
import { type Setting, makeSetting } from './setting';
import { parseFen } from 'chessops/fen';
import { chessgroundDests, lichessRules } from 'chessops/compat';
import { COLORS, RANK_NAMES, ROLES, type... |
// if no move in box yet
if ($moveBox.val() === '') {
// if user selects another's piece first
if ($evBtn.attr('color') === opponentColor) return;
// as long as the user is selecting a piece and not a blank tile
if ($evBtn.text().match(/^[^\-+]+/g)) {
$moveBox.val(pos);
... | // user can select their own piece again if they change their mind
if ($moveBox.val() !== '' && $evBtn.attr('color') === opposite(opponentColor)) {
$moveBox.val('');
} | typescript | 2025-02-26T06:13:58 |
lichess-org/lila | cbdc7ae26ca4974414f140fee1a64bb022e218b4 | ui/analyse/src/plugins/analyse.nvui.ts | import { h, type VNode, type VNodeChildren } from 'snabbdom';
import { defined, prop, type Prop } from 'common';
import { text as xhrText } from 'common/xhr';
import type AnalyseController from '../ctrl';
import { makeConfig as makeCgConfig } from '../ground';
import type { AnalyseData, NvuiPlugin } from '../interfaces... |
},
];
const getCommand = (input: string) => {
const firstWordLowerCase = input.split(' ')[0].toLowerCase();
return inputCommands.find(
c => c.cmd === input || (firstWordLowerCase.length === 1 && c.cmd === firstWordLowerCase), // 'next line' should not be interpreted as 'next'
);
};
function sendMove(uciO... | },
{
cmd: 'pocket',
help: 'Read out pockets for white or black. Example: "pocket black"',
cb: (ctrl, notify, _, input) => {
const pockets = ctrl.node.crazy?.pockets;
const color = input.split(' ')?.[1]?.trim();
return notify(
pockets
? color
? pocketsStr(col... | typescript | 2025-02-26T06:12:19 |
lichess-org/lila | cbdc7ae26ca4974414f140fee1a64bb022e218b4 | ui/round/src/plugins/round.nvui.ts | import { type VNode, looseH as h, onInsert } from 'common/snabbdom';
import type RoundController from '../ctrl';
import { renderClock } from '../clock/clockView';
import { renderTableWatch, renderTablePlay, renderTableEnd } from '../view/table';
import { makeConfig as makeCgConfig } from '../ground';
import renderCorre... |
},
];
const isInputCommand = (input: string) => {
const firstWordLowerCase = input.split(' ')[0].toLowerCase();
return inputCommands.find(c => c.cmd === firstWordLowerCase || c?.alt === firstWordLowerCase);
};
const sendMove = (uciOrDrop: string | DropMove, ctrl: RoundController, premove: boolean): void =>
t... | },
{
cmd: 'pocket',
help: 'Read out pockets for white or black. Example: "pocket black"',
cb: (notify, ctrl, _, input) => {
const pockets = ctrl.data?.crazyhouse?.pockets;
const color = input.split(' ')?.[1]?.trim();
return notify(
pockets
? color
? pocketsS... | typescript | 2025-02-26T06:12:19 |
lichess-org/lila | 0d45863f6373d911ff73dfb85c22097e122a4e6d | ui/nvui/src/chess.ts | import { h, type VNode, type VNodeChildren } from 'snabbdom';
import { type Pieces, files } from 'chessground/types';
import { type Setting, makeSetting } from './setting';
import { parseFen } from 'chessops/fen';
import { chessgroundDests, lichessRules } from 'chessops/compat';
import { COLORS, RANK_NAMES, ROLES, type... |
// if no move in box yet
if ($moveBox.val() === '') {
// if user selects another's piece first
if ($evBtn.attr('color') === opponentColor) return;
// as long as the user is selecting a piece and not a blank tile
if ($evBtn.text().match(/^[^\-+]+/g)) {
$moveBox.val(pos);
... | // user can select their own piece again if they change their mind
if ($moveBox.val() !== '' && $evBtn.attr('color') === opposite(opponentColor)) {
$moveBox.val('');
} | typescript | 2025-02-25T09:23:40 |
mozilla/pdf.js | b5ac96da194e3fd67a78011e50e481c821ab3cb8 | web/genericcom.js | /* Copyright 2017 Mozilla Foundation
*
* 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... |
async isEnabledFor(_name) {
return false;
}
async deleteModel(_service) {
return null;
}
isReady(_name) {
return false;
}
guess(_data) {}
toggleService(_name, _enabled) {}
}
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
// eslint-disable-next-line no-var
var F... | static {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
this.getFakeMLManager = options => new FakeMLManager(options);
}
} | javascript | 2025-02-27T11:59:58 |
oracle/graal | b1d054d5e9165a631fb3e5f916d4ca59992c42bb | substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapConstant.java | /*
* Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free ... |
}
public JavaConstant getHostedObject() {
AnalysisError.guarantee(!CompressibleConstant.isCompressed(constantData.hostedObject), "References to hosted objects should never be compressed.");
return constantData.hostedObject;
}
public boolean isBackedByHostedObject() {
return co... | }
public void markWrittenInPreviousLayer() {
AnalysisError.guarantee(isInBaseLayer(), "Constant must be in base layer to be marked as written in the base layer.");
constantData.writtenInPreviousLayer = true;
}
public boolean isWrittenInPreviousLayer() {
return constantData.writtenI... | java | 2025-02-12T20:20:20 |
oracle/graal | 76a9c12701a742b8ec7b03f63c9d814c4869d660 | substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/CompactingOldGeneration.java | /*
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free ... |
}
@Uninterruptible(reason = "Avoid unnecessary safepoint checks in GC for performance.")
private void fixupUnalignedChunkReferences(ChunkReleaser chunkReleaser) {
UnalignedHeapChunk.UnalignedHeader uChunk = space.getFirstUnalignedHeapChunk();
while (uChunk.isNonNull()) {
Unalig... | }
@NeverInline("Split GC into reasonable compilation units: object walk is force-inlined.")
@Uninterruptible(reason = "Visitor requires uninterruptible walk.")
private void fixupImageHeapRoots(ImageHeapInfo info) {
// Note that cards have already been cleaned and roots re-marked during the initial ... | java | 2025-02-22T09:00:24 |
oracle/graal | 76a9c12701a742b8ec7b03f63c9d814c4869d660 | substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GreyToBlackObjectVisitor.java | /*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free ... |
public boolean visitObject(Object o) {
throw VMError.shouldNotReachHere("For performance reasons, this should not be called.");
}
@Override
@AlwaysInline("GC performance")
@Uninterruptible(reason = "Forced inlining (StoredContinuation objects must not move).", callerMustBe = true)
publ... | @Uninterruptible(reason = "Visitor requires uninterruptible walk.", callerMustBe = true) | java | 2025-02-22T09:00:24 |
ppy/osu | 4beac64bdb6c2dee8492ea8b113498b78ef5f36a | osu.Game/Screens/SelectV2/PanelBase.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics... |
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = CarouselItem.DEFAULT_HEIGHT;
InternalC... | [Resolved]
private BeatmapCarousel? carousel { get; set; } | csharp | 2025-02-28T08:19:30 |
ppy/osu | 8032b6893274a152a12226572e89a000262c5583 | osu.Game/Screens/SelectV2/PanelBase.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics... |
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = CarouselItem.DEFAULT_HEIGHT;
InternalC... | // content is offset by PanelXOffset, make sure we only handle input at the actual visible
// offset region.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
TopLevelContent.ReceivePositionalInputAt(screenSpacePos); | csharp | 2025-02-28T07:59:39 |
ppy/osu | a8fbac0f0dbf628ee284e9b3c27554d00697f1e8 | osu.Game/Screens/SelectV2/PanelBase.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics... |
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
},
activationFlash = new Box
{
Colour = Color4.White.Opacity(0.4f),
Blending = BlendingParame... | Colour = colours.Blue.Opacity(0.1f),
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
},
selectionLayer = new Box
{
Alpha = 0,
Colour = ColourI... | csharp | 2025-02-28T07:27:18 |
ppy/osu | 09131740992b15ca322054e5c8aee784c6eade79 | osu.Game/Overlays/SettingsOverlay.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
u... |
Show();
// wait for load of sections
if (!SectionsContainer.Any())
{
Scheduler.Add(ShowAtControl<T>);
return;
}
SectionsContainer.ScrollTo(SectionsContainer.ChildrenOfType<T>().Single());
}
priva... | // if search isn't cleared then the target control won't be visible if it doesn't match the query
SearchTextBox.Current.Value = ""; | csharp | 2025-02-27T18:20:58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.