Hash
stringlengths 40
40
| Date
stringlengths 19
20
⌀ | Author
stringlengths 2
30
| commit_message
stringlengths 3
28.8k
| IsMerge
bool 1
class | Additions
int64 0
55.2k
| Deletions
int64 0
991
| Total Changes
int64 -3
55.2k
| git_diff
stringlengths 23
47.3k
| Repository Name
stringclasses 159
values | Owner
stringclasses 85
values | Primary Language
stringclasses 20
values | Language
stringclasses 19
values | Stars
float64 218
411k
⌀ | Forks
float64 8
79k
⌀ | Description
stringclasses 96
values | Repository
stringclasses 161
values | type
stringclasses 6
values | Comment
stringlengths 7
156
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
70468c07ede58d5fed76a0c12f478097bf18d125
|
2022-12-16 03:31:22
|
Vinicius Souza
|
remove index
| false
| 0
| 159
| 159
|
--- README.md
@@ -8,6 +8,165 @@
<a href="https://ko-fi.com/M4M3WPRD"><img width="110" alt="Buy Me a Coffee" src="buy_me_a_coffee.png" /></a>
</p>
+### Content
+- [Courses](#courses)
+- [Accessibility](#accessibility)
+- [Alexa](#alexa)
+- [Analytics](#analytics)
+- [App Routing](#app-routing)
+- [Apple TV](#apple-tv)
+- [Architecture Patterns](#architecture-patterns)
+- [ARKit](#arkit)
+- [Authentication](#authentication)
+- [Blockchain](#blockchain)
+- [Bridging](#bridging)
+- [Cache](#cache)
+- [Charts](#charts)
+- [Code Quality](#code-quality)
+ - [Linter](#linter)
+- [Color](#color)
+- [Command Line](#command-line)
+- [Concurrency](#concurrency)
+- [Core Data](#core-data)
+- [Database](#database)
+- [Data Structures / Algorithms](#data-structures--algorithms)
+- [Date & Time](#date--time)
+- [Debugging](#debugging)
+- [EventBus](#eventbus)
+- [Files](#files)
+- [Functional Programming](#functional-programming)
+- [Games](#games)
+- [GCD](#gcd)
+- [Gesture](#gesture)
+- [Graphics](#graphics)
+- [Hardware](#hardware)
+ - [Bluetooth](#bluetooth)
+ - [Camera](#camera)
+ - [Force Touch](#force-touch)
+ - [iBeacon](#ibeacon)
+ - [Location](#location)
+ - [Other Hardware](#other-hardware)
+- [Layout](#layout)
+- [Logging](#logging)
+- [Localization](#localization)
+- [Machine Learning](#machine-learning)
+- [Maps](#maps)
+- [Math](#math)
+- [Media](#media)
+ - [Audio](#audio)
+ - [GIF](#gif)
+ - [Image](#image)
+ - [Media Processing](#media-processing)
+ - [PDF](#pdf)
+ - [Streaming](#streaming)
+ - [Video](#video)
+- [Messaging](#messaging)
+- [Networking](#networking)
+- [Notifications](#notifications)
+ - [Push Notifications](#push-notifications)
+ - [Push Notification Providers](#push-notification-providers)
+ - [Local Notifications](#local-notifications)
+- [Objective-C Runtime](#objective-c-runtime)
+- [Optimization](#optimization)
+- [Parsing](#parsing)
+ - [CSV](#csv)
+ - [JSON](#json)
+ - [XML & HTML](#xml--html)
+ - [Other Parsing](#other-parsing)
+- [Passbook](#passbook)
+- [Payments](#payments)
+- [Permissions](#permissions)
+- [Products](#products)
+- [Reactive Programming](#reactive-programming)
+ - [React-Like](#react-like)
+- [Reflection](#reflection)
+- [Regex](#regex)
+- [SDK](#sdk)
+ - [Official](#official)
+ - [Unofficial](#unofficial)
+- [Security](#security)
+ - [Encryption](#encryption)
+ - [Keychain](#keychain)
+- [Server](#server)
+- [Testing](#testing)
+ - [TDD / BDD](#tdd--bdd)
+ - [A/B Testing](#ab-testing)
+ - [UI Testing](#ui-testing)
+ - [Other Testing](#other-testing)
+- [Text](#text)
+ - [Font](#font)
+- [UI](#ui)
+ - [Activity Indicator](#activity-indicator)
+ - [Alert & Action Sheet](#alert--action-sheet)
+ - [Animation](#animation)
+ - [Transition](#transition)
+ - [Badge](#badge)
+ - [Button](#button)
+ - [Calendar](#calendar)
+ - [Cards](#cards)
+ - [Form & Settings](#form--settings)
+ - [Keyboard](#keyboard)
+ - [Label](#label)
+ - [Login](#login)
+ - [Menu](#menu)
+ - [Navigation Bar](#navigation-bar)
+ - [PickerView](#pickerview)
+ - [Popup](#popup)
+ - [Pull to Refresh](#pull-to-refresh)
+ - [Rating Stars](#rating-stars)
+ - [ScrollView](#scrollview)
+ - [Segmented Control](#segmented-control)
+ - [Slider](#slider)
+ - [Splash View](#splash-view)
+ - [Status Bar](#status-bar)
+ - [Stepper](#stepper)
+ - [Switch](#switch)
+ - [Tab Bar](#tab-bar)
+ - [Table View / Collection View](#table-view--collection-view)
+ - [Table View](#table-view)
+ - [Collection View](#collection-view)
+ - [Expandable Cell](#expandable-cell)
+ - [Header](#header)
+ - [Placeholder](#placeholder)
+ - [Collection View Layout](#collection-view-layout)
+ - [Tag](#tag)
+ - [TextField & TextView](#textfield--textview)
+ - [UIPageControl](#uipagecontrol)
+ - [Web View](#web-view)
+- [Utility](#utility)
+- [User Consent](#user-consent)
+- [VR](#vr)
+- [Walkthrough / Intro / Tutorial](#walkthrough--intro--tutorial)
+- [Websocket](#websocket)
+- [Project setup](#project-setup)
+- [Dependency / Package Manager](#dependency--package-manager)
+- [Tools](#tools)
+- [Rapid Development](#rapid-development)
+ - [Injection](#injection)
+- [Deployment / Distribution](#deployment--distribution)
+- [App Store](#app-store)
+- [Xcode](#xcode)
+ - [Extensions (Xcode 8+)](#extensions-xcode-8)
+ - [Themes](#themes)
+ - [Other Xcode](#other-xcode)
+- [Reference](#reference)
+- [Style Guides](#style-guides)
+- [Good Websites](#good-websites)
+ - [News, Blogs and more](#news-blogs-and-more)
+ - [UIKit references](#uikit-references)
+ - [Forums and discuss lists](#forums-and-discuss-lists)
+ - [Tutorials and Keynotes](#tutorials-and-keynotes)
+ - [Prototyping](#prototyping)
+ - [Newsletters](#newsletters)
+ - [Medium](#medium)
+- [Social Media](#social-media)
+ - [Twitter](#twitter)
+ - [Facebook Groups](#facebook-groups)
+- [Podcasts](#podcasts)
+- [Books](#books)
+- [Other Awesome Lists](#other-awesome-lists)
+- [Contributing](#contributing-and-license)
+
## Courses
|
awesome-ios
|
vsouza
|
Swift
|
Swift
| 48,363
| 6,877
|
A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects
|
vsouza_awesome-ios
|
DOC_CHANGE
|
changes in readme
|
e5becd01c848fedc1a10ea3a7afb476385674b02
|
2025-02-27 12:34:07
|
Monokaix
|
correct ResyncPeriod comments Signed-off-by: Monokaix <[email protected]>
| false
| 2
| 4
| 6
|
--- cmd/kube-controller-manager/app/controllermanager.go
@@ -169,7 +169,8 @@ controller, and serviceaccounts controller.`,
}
// ResyncPeriod returns a function which generates a duration each time it is
-// invoked; this is because that multiple controllers don't get into lock-step.
+// invoked; this is so that multiple controllers don't get into lock-step and all
+// hammer the apiserver with list requests simultaneously.
func ResyncPeriod(c *config.CompletedConfig) func() time.Duration {
return func() time.Duration {
factor := rand.Float64() + 1
--- staging/src/k8s.io/cloud-provider/app/controllermanager.go
@@ -499,7 +499,8 @@ func CreateControllerContext(s *cloudcontrollerconfig.CompletedConfig, clientBui
}
// ResyncPeriod returns a function which generates a duration each time it is
-// invoked; this is because that multiple controllers don't get into lock-step.
+// invoked; this is so that multiple controllers don't get into lock-step and all
+// hammer the apiserver with list requests simultaneously.
func ResyncPeriod(c *cloudcontrollerconfig.CompletedConfig) func() time.Duration {
return func() time.Duration {
factor := rand.Float64() + 1
|
kubernetes
|
kubernetes
|
Go
|
Go
| 113,460
| 40,344
|
Production-Grade Container Scheduling and Management
|
nan_kubernetes
|
CODE_IMPROVEMENT
|
changes in the comments
|
7fb37a088bc719b4a9722ca0ac4508311d270a2a
|
2025-02-28 02:50:23
|
Fredia Huya-Kouadio
|
Add checks to prevent crashes when accessing the GameMenu api This should address crashes reported on the Play store. Note that those crashes lack debug symbols which reduces our ability to narrow down the exact cause of the crash. We aim to resolve that in Godot 4.5.
| false
| 19
| 10
| 29
|
--- platform/android/game_menu_utils_jni.cpp
@@ -34,20 +34,13 @@
#include "editor/editor_interface.h"
#include "editor/editor_node.h"
#include "editor/plugins/game_view_plugin.h"
-
-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"));
-}
-
#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();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_suspend(enabled);
}
@@ -56,7 +49,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSuspend
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->next_frame();
}
@@ -65,7 +58,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_nextFrame(
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_node_type(type);
}
@@ -74,7 +67,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setNodeTyp
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_select_mode(mode);
}
@@ -83,7 +76,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectM
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_selection_visible(visible);
}
@@ -92,7 +85,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelecti
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_camera_override(enabled);
}
@@ -101,7 +94,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraO
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_camera_manipulate_mode(static_cast<EditorDebuggerNode::CameraOverride>(mode));
}
@@ -110,7 +103,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraM
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->reset_camera_2d_position();
}
@@ -119,7 +112,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamer
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
- GameViewPlugin *game_view_plugin = _get_game_view_plugin();
+ GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->reset_camera_3d_position();
}
@@ -128,9 +121,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamer
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
- if (EditorInterface::get_singleton()) {
- EditorInterface::get_singleton()->play_main_scene();
- }
+ EditorInterface::get_singleton()->play_main_scene();
#endif
}
}
|
godot
|
godotengine
|
C++
|
C++
| 94,776
| 21,828
|
Godot Engine – Multi-platform 2D and 3D game engine
|
godotengine_godot
|
CODE_IMPROVEMENT
|
Obvious
|
0f4dba58ad060984d4c5ead82dc970ce02dec5fd
|
2025-03-22 00:00:41
|
Haibo Huang
|
Add `ExecuteSharded` and `ExecutePortable` methods in `TfrtGpuExecutable` PiperOrigin-RevId: 739241227
| false
| 82
| 7
| 89
|
--- third_party/xla/xla/pjrt/gpu/tfrt/BUILD
@@ -25,7 +25,6 @@ cc_library(
":host_memory_allocator",
":stream_pool",
":tracked_tfrt_gpu_device_buffer",
- "//xla:debug_options_flags",
"//xla:executable_run_options",
"//xla:literal",
"//xla:shape_layout",
@@ -48,7 +47,6 @@ cc_library(
"//xla/pjrt:semaphore",
"//xla/pjrt:transpose",
"//xla/pjrt:utils",
- "//xla/pjrt/distributed:key_value_store_interface",
"//xla/pjrt/gpu:gpu_helpers",
"//xla/pjrt/gpu:gpu_topology",
"//xla/pjrt/gpu:gpu_topology_proto_cc",
--- third_party/xla/xla/pjrt/gpu/tfrt/tfrt_gpu_client.cc
@@ -1374,6 +1374,7 @@ absl::StatusOr<PjRtLoadedExecutable::Result> TfrtGpuExecutable::ExecuteHelper(
std::vector<std::unique_ptr<PjRtBuffer>> outputs;
Executable* executable = executables_[0]->executable();
const Shape& result_shape = executable->result_shape();
+ LOG(INFO) << "[hhb-test] " << result_shape.ToString();
bool untuple_result = options.untuple_result;
bool result_is_tuple = result_shape.IsTuple();
if (options.untuple_result && result_shape.IsTuple()) {
@@ -1785,76 +1786,6 @@ TfrtGpuExecutable::Execute(
return wrapped_results;
}
-absl::StatusOr<std::vector<std::unique_ptr<PjRtBuffer>>>
-TfrtGpuExecutable::ExecuteSharded(
- absl::Span<PjRtBuffer* const> argument_handles, PjRtDevice* device,
- const ExecuteOptions& options, std::optional<PjRtFuture<>>& returned_future,
- bool fill_future) {
- RunId run_id(options.launch_id);
- tsl::profiler::TraceMeProducer activity("TfrtGpuExecutable::ExecuteSharded",
- tsl::profiler::ContextType::kPjRt,
- run_id.ToInt());
- if (device_assignment_ == nullptr) {
- return InvalidArgument("ExecuteShard expects a non-null device_assignment");
- }
- for (int i = 0; i < addressable_devices_.size(); ++i) {
- if (addressable_devices_[i] == device) {
- VLOG(1) << "ExecuteShard executes computation " << name()
- << " on assigned replica/partition on device "
- << device->DebugString();
- TF_ASSIGN_OR_RETURN(
- auto result,
- ExecuteHelper(
- argument_handles, addressable_device_logical_ids_[i].replica,
- addressable_device_logical_ids_[i].partition, run_id, options,
- tsl::down_cast<TfrtGpuDevice*>(device)
- ->GetLastCollectiveLaunchEvent(),
- fill_future));
- returned_future = std::move(result.future);
- return std::move(result.buffers);
- }
- }
- return InvalidArgument(
- "ExecuteShard attempted to execute on device id %d which is not "
- "addressable by this client",
- device->global_device_id().value());
-}
-
-absl::StatusOr<std::vector<std::unique_ptr<PjRtBuffer>>>
-TfrtGpuExecutable::ExecutePortable(
- absl::Span<PjRtBuffer* const> argument_handles, PjRtDevice* device,
- const ExecuteOptions& options, std::optional<PjRtFuture<>>& returned_future,
- bool fill_future) {
- RunId run_id(options.launch_id);
- tsl::profiler::TraceMeProducer activity("TfrtGpuExecutable::ExecutePortable",
- tsl::profiler::ContextType::kPjRt,
- run_id.ToInt());
- if (device_assignment_ != nullptr) {
- return InvalidArgument("ExecutePortable gets a non-portable executable");
- }
- if (num_replicas() != 1 || num_partitions() != 1) {
- return InvalidArgument(
- "ExecutePortable expects a single-core executable but gets "
- "one with %d replica %d partition",
- num_replicas(), num_partitions());
- }
- if (device == nullptr) {
- return InvalidArgument("ExecutePortable expects a device to be specified");
- }
- VLOG(1) << "ExecutePortable executes single-core portable executable "
- << name();
- TF_ASSIGN_OR_RETURN(
- auto result,
- ExecuteHelper(
- argument_handles,
- /*replica=*/0,
- /*partition=*/0, run_id, options,
- /*last_collective_launch_event=*/tsl::AsyncValueRef<GpuEvent>(),
- fill_future, tsl::down_cast<TfrtGpuDevice*>(device)));
- returned_future = std::move(result.future);
- return std::move(result.buffers);
-}
-
absl::string_view TfrtGpuExecutable::name() const {
Executable* executable = executables_[0]->executable();
if (executable->has_module()) {
--- third_party/xla/xla/pjrt/gpu/tfrt/tfrt_gpu_client.h
@@ -229,14 +229,6 @@ class TfrtGpuDevice final : public PjRtDevice {
std::random_device prng_seed_device_ ABSL_GUARDED_BY(mu_);
std::mt19937 prng_seed_generator_ ABSL_GUARDED_BY(mu_);
std::uniform_int_distribution<> prng_seed_distribution_ ABSL_GUARDED_BY(mu_);
- // Launching collectives are prone to deadlock when we use fixed-sized
- // thread pools and stream pools, since ExecuteHelper will block until all
- // replicas reach the barrier. We ensure that
- // 1. Thread pool size is at least as large as device_count so one collective
- // launch over all devices can succeed.
- // 2. Gang-schedule each collective by conservatively ensuring a total order
- // of collectives and launching only one collective at a time to avoid
- // having no active threads to make progress
tsl::AsyncValueRef<GpuEvent> last_collective_launch_event_
ABSL_GUARDED_BY(mu_);
@@ -645,13 +637,17 @@ class TfrtGpuExecutable final : public PjRtLoadedExecutable {
absl::StatusOr<std::vector<std::unique_ptr<PjRtBuffer>>> ExecuteSharded(
absl::Span<PjRtBuffer* const> argument_handles, PjRtDevice* device,
const ExecuteOptions& options,
- std::optional<PjRtFuture<>>& returned_future, bool fill_future) override;
+ std::optional<PjRtFuture<>>& returned_future, bool fill_future) override {
+ return Unimplemented("Not implemented");
+ }
using PjRtLoadedExecutable::ExecutePortable;
absl::StatusOr<std::vector<std::unique_ptr<PjRtBuffer>>> ExecutePortable(
absl::Span<PjRtBuffer* const> argument_handles, PjRtDevice* device,
const ExecuteOptions& options,
- std::optional<PjRtFuture<>>& returned_future, bool fill_future) override;
+ std::optional<PjRtFuture<>>& returned_future, bool fill_future) override {
+ return Unimplemented("Not implemented");
+ }
void Delete() override { executables_.clear(); }
|
tensorflow
|
tensorflow
|
C++
|
C++
| 188,388
| 74,565
|
An Open Source Machine Learning Framework for Everyone
|
tensorflow_tensorflow
|
CONFIG_CHANGE
|
Obvious
|
09f043b9876a34205b46ec2de015ab93f81d8b2a
|
2025-01-10 19:17:02
|
Costa Tsaousis
|
fix for PGC wanted_cache_size getting to zero (#19370) fix for wanted_cache_size getting to zero
| false
| 4
| 0
| 4
|
--- src/database/engine/cache.c
@@ -428,10 +428,6 @@ static inline size_t cache_usage_per1000(PGC *cache, size_t *size_to_evict) {
if(unlikely(wanted_cache_size < min_cache_size))
wanted_cache_size = min_cache_size;
- // protection for the case the cache is totally empty
- if(unlikely(wanted_cache_size < 65536))
- wanted_cache_size = 65536;
-
const size_t per1000 = (size_t)(current_cache_size * 1000ULL / wanted_cache_size);
__atomic_store_n(&cache->usage.per1000, per1000, __ATOMIC_RELAXED);
__atomic_store_n(&cache->stats.wanted_cache_size, wanted_cache_size, __ATOMIC_RELAXED);
|
netdata
|
netdata
|
C
|
C
| 73,681
| 6,023
|
X-Ray Vision for your infrastructure!
|
netdata_netdata
|
BUG_FIX
|
simplify decoder draining logic
|
f5db38452477cc697a86cf0d3e7ecba4fa9cfe78
| null |
Mikle Kolyada
|
dev-java/xpp2: stable for all wrt bug #558016 Package-Manager: portage-2.2.20.1
| false
| 1
| 1
| 0
|
--- xpp2-2.1.10-r2.ebuild
@@ -16,7 +16,7 @@ SRC_URI="http://www.extreme.indiana.edu/xgws/xsoap/xpp/download/${MY_PN}2/${MY_P
LICENSE="Apache-1.1 IBM"
SLOT="0"
-KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="amd64 ~arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="test"
# Some failures, partly because we haven't patched Xerces but probably
|
gentoo_gentoo.json
| null | null | null | null | null | null |
gentoo_gentoo.json
|
BUG_FIX
|
5, obvious
|
36d2f81e8916cb18431f36a3d9ea5cfa8300a71e
|
2024-06-07 21:24:24
|
PesBandi
|
[QuickAccent]Fix character description not being visually centered (#33227)
| false
| 1
| 1
| 2
|
--- src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs
@@ -150,7 +150,7 @@ public class PowerAccent : IDisposable
{
var unicode = unicodeList.First();
var charUnicodeNumber = unicode.CodePoint.ToString("X4", CultureInfo.InvariantCulture);
- description.AppendFormat(CultureInfo.InvariantCulture, "(U+{0}) {1}", charUnicodeNumber, unicode.Name);
+ description.AppendFormat(CultureInfo.InvariantCulture, "(U+{0}) {1} ", charUnicodeNumber, unicode.Name);
return description.ToString();
}
|
powertoys
|
microsoft
|
C#
|
C#
| 115,301
| 6,789
|
Windows system utilities to maximize productivity
|
microsoft_powertoys
|
PERF_IMPROVEMENT
|
Obvious
|
293a6c5c91619a86b70e9d23e26412a1095db569
|
2025-02-19 18:11:24
|
Thomas Morin
|
fix typo: optimitically -> optimistically Signed-off-by: Thomas Morin <[email protected]>
| false
| 1
| 1
| 2
|
--- staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go
@@ -339,7 +339,7 @@ func (le *LeaderElector) tryAcquireOrRenew(ctx context.Context) bool {
le.setObservedRecord(&leaderElectionRecord)
return true
}
- klog.Errorf("Failed to update lock optimistically: %v, falling back to slow path", err)
+ klog.Errorf("Failed to update lock optimitically: %v, falling back to slow path", err)
}
// 2. obtain or create the ElectionRecord
|
kubernetes
|
kubernetes
|
Go
|
Go
| 113,460
| 40,344
|
Production-Grade Container Scheduling and Management
|
nan_kubernetes
|
CODE_IMPROVEMENT
|
typo fixed in the code, non-functional code change
|
486d40670e7578e96803222fb7cd3e701b77a651
|
2022-08-01 20:59:33
|
Serhiy Mytrovtsiy
|
feat: added blurred background to the popup view (only when dark mode is enable) (#964)
| false
| 21
| 4
| 25
|
--- Kit/module/popup.swift
@@ -118,9 +118,6 @@ internal class PopupViewController: NSViewController {
internal class PopupView: NSView {
private var title: String? = nil
- private var foreground: NSVisualEffectView
- private var background: NSView
-
private let header: HeaderView
private let body: NSScrollView
@@ -146,19 +143,10 @@ internal class PopupView: NSView {
self.windowHeight = NSScreen.main?.visibleFrame.height
self.containerHeight = self.body.documentView?.frame.height
- self.foreground = NSVisualEffectView(frame: frame)
- self.foreground.material = .titlebar
- self.foreground.blendingMode = .behindWindow
- self.foreground.state = .active
- self.foreground.wantsLayer = true
- self.foreground.layer?.backgroundColor = NSColor.red.cgColor
- self.foreground.layer?.cornerRadius = 6
-
- self.background = NSView(frame: frame)
- self.background.wantsLayer = true
- self.foreground.addSubview(self.background)
+ super.init(frame: CGRect(x: frame.origin.x, y: frame.origin.y, width: frame.width, height: frame.height))
- super.init(frame: frame)
+ self.wantsLayer = true
+ self.layer?.cornerRadius = 3
self.body.drawsBackground = false
self.body.translatesAutoresizingMaskIntoConstraints = true
@@ -168,7 +156,6 @@ internal class PopupView: NSView {
self.body.autohidesScrollers = true
self.body.horizontalScrollElasticity = .none
- self.addSubview(self.foreground, positioned: .below, relativeTo: .none)
self.addSubview(self.header)
self.addSubview(self.body)
}
@@ -178,7 +165,7 @@ internal class PopupView: NSView {
}
override func updateLayer() {
- self.background.layer?.backgroundColor = self.isDarkMode ? .clear : NSColor.white.cgColor
+ self.layer!.backgroundColor = self.isDarkMode ? NSColor.windowBackgroundColor.cgColor : NSColor.white.cgColor
}
public func setView(_ view: Popup_p?) {
@@ -186,8 +173,6 @@ internal class PopupView: NSView {
let height: CGFloat = (view?.frame.height ?? 0) + Constants.Popup.headerHeight + (Constants.Popup.margins*2)
self.setFrameSize(NSSize(width: width, height: height))
- self.foreground.setFrameSize(NSSize(width: width, height: height))
- self.background.setFrameSize(NSSize(width: width, height: height))
self.header.setFrameOrigin(NSPoint(x: 0, y: height - Constants.Popup.headerHeight))
self.body.setFrameSize(NSSize(width: (view?.frame.width ?? Constants.Popup.width), height: (view?.frame.height ?? 0)))
@@ -245,8 +230,6 @@ internal class PopupView: NSView {
}
self.window?.setContentSize(windowSize)
- self.foreground.setFrameSize(windowSize)
- self.background.setFrameSize(windowSize)
self.body.setFrameSize(NSSize(
width: windowSize.width - (Constants.Popup.margins*2) + (isScrollVisible ? 20 : 0),
height: windowSize.height - Constants.Popup.headerHeight - (Constants.Popup.margins*2)
|
stats
|
exelban
|
Swift
|
Swift
| 29,655
| 950
|
macOS system monitor in your menu bar
|
exelban_stats
|
NEW_FEAT
|
Common words: ['feat', 'added', 'blurred']
|
6f1b238322598913c98321f84b2e6faf724bffd9
|
2024-07-19 07:25:38
|
Liang Liu
|
Fix mdbook-epub command
| false
| 2
| 2
| 4
|
--- README.md
@@ -30,7 +30,7 @@
## 电子书
-- 可使用 mdbook-epub 工具自行编译:`mdbook-epub --standalone` 然后 epub 在 book 目录下
+- 可使用 mdbook-epub 工具自行编译:`mdbook-epub --standalone true` 然后 epub 在 book 目录下
- 扫码订阅《方法论》更新频道后下载: [进入](https://subdeer.cn/channel/landing/11)
## 在线阅读
@@ -59,4 +59,4 @@
- [内容池和自动化能力](https://ft07.com/content-pool-and-automation-capability?mtm_campaign=github&mtm_kwd=opbmv2)
- [产品池和支付能力](https://ft07.com/product-pool-and-payment-capability?mtm_campaign=github&mtm_kwd=opbmv2)
- [众包能力](https://ft07.com/crowdsourcing-capability?mtm_campaign=github&mtm_kwd=opbmv2)
- - [搭建一人企业基础设施](https://ft07.com/setup-a-one-person-business-infrastructure?mtm_campaign=github&mtm_kwd=opbmv2)
+ - [搭建一人企业基础设施](https://ft07.com/setup-a-one-person-business-infrastructure?mtm_campaign=github&mtm_kwd=opbmv2)
\ No newline at end of file
|
one-person-businesses-methodology-v2.0
|
easychen
|
PHP
|
PHP
| 5,272
| 464
|
《一人企业方法论》第二版,也适合做其他副业(比如自媒体、电商、数字商品)的非技术人群。
|
easychen_one-person-businesses-methodology-v2.0
|
DOC_CHANGE
|
changes in readme
|
6ac63dc0fc4ba0016c238a6b5fd97044da20b6c9
|
2025-02-20 01:32:57
|
Paul Sturm
|
Hot Restart should dispose all previous Platform Views (macOS) (#163439) <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> When using Platform Views on macOS, performing a Hot Restart throws an exception with message "trying to create an already created view". This is because the old Platform Views are not cleaned up. So, here we dispose of the old Platform Views as part of the Hot Restart process. Fixes issue: https://github.com/flutter/flutter/issues/110381 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
| false
| 67
| 0
| 67
|
--- engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterEngine.mm
@@ -1124,7 +1124,6 @@ - (void)engineCallbackOnPreEngineRestart {
while ((nextViewController = [viewControllerEnumerator nextObject])) {
[nextViewController onPreEngineRestart];
}
- [_platformViewController reset];
}
- (void)onVSync:(uintptr_t)baton {
--- engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.h
@@ -58,11 +58,6 @@
*/
- (void)disposePlatformViews;
-/**
- * Removes all platform views.
- */
-- (void)reset;
-
@end
#endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWCONTROLLER_H_
--- engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm
@@ -170,11 +170,4 @@ - (void)disposePlatformViews {
_platformViewsToDispose.clear();
}
-- (void)reset {
- for (const auto& pair : _platformViews) {
- _platformViewsToDispose.insert(pair.first);
- }
- [self disposePlatformViews];
-}
-
@end
--- engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewControllerTest.mm
@@ -141,60 +141,6 @@
EXPECT_TRUE(disposed);
}
-TEST(FlutterPlatformViewController, TestReset) {
- // Use id so we can access handleMethodCall method.
- id platformViewController = [[FlutterPlatformViewController alloc] init];
- TestFlutterPlatformViewFactory* factory = [TestFlutterPlatformViewFactory alloc];
-
- [platformViewController registerViewFactory:factory withId:@"MockPlatformView"];
-
- __block bool created = false;
- FlutterResult resultOnCreate = ^(id result) {
- // If a platform view is successfully created, the result is nil.
- if (result == nil) {
- created = true;
- } else {
- created = false;
- }
- };
-
- // Create 2 views.
- FlutterMethodCall* methodCallOnCreate0 =
- [FlutterMethodCall methodCallWithMethodName:@"create"
- arguments:@{
- @"id" : @0,
- @"viewType" : @"MockPlatformView"
- }];
-
- [platformViewController handleMethodCall:methodCallOnCreate0 result:resultOnCreate];
- EXPECT_TRUE(created);
-
- FlutterMethodCall* methodCallOnCreate1 =
- [FlutterMethodCall methodCallWithMethodName:@"create"
- arguments:@{
- @"id" : @1,
- @"viewType" : @"MockPlatformView"
- }];
- [platformViewController handleMethodCall:methodCallOnCreate1 result:resultOnCreate];
- EXPECT_TRUE(created);
-
- TestFlutterPlatformView* view = nil;
-
- // Before the reset, the views exist.
- view = (TestFlutterPlatformView*)[platformViewController platformViewWithID:0];
- EXPECT_TRUE(view != nil);
- view = (TestFlutterPlatformView*)[platformViewController platformViewWithID:1];
- EXPECT_TRUE(view != nil);
-
- // After a reset, the views should no longer exist.
- [platformViewController reset];
-
- view = (TestFlutterPlatformView*)[platformViewController platformViewWithID:0];
- EXPECT_TRUE(view == nil);
- view = (TestFlutterPlatformView*)[platformViewController platformViewWithID:1];
- EXPECT_TRUE(view == nil);
-}
-
TEST(FlutterPlatformViewController, TestDisposeOnMissingViewId) {
// Use id so we can access handleMethodCall method.
id platformViewController = [[FlutterPlatformViewController alloc] init];
|
flutter
|
flutter
|
Dart
|
Dart
| 168,965
| 28,132
|
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
|
flutter_flutter
|
BUG_FIX
|
obvious
|
e3f4593e76210a5afe6f52318d3f240318ededbd
| null |
Dominik
|
Fix regex error when only subtitled video is available on arte.
| false
| 1
| 1
| 0
|
--- arte.py
@@ -98,7 +98,7 @@ class ArteTvIE(InfoExtractor):
l = 'F'
elif lang == 'de':
l = 'A'
- regexes = [r'VO?%s' % l, r'V%s-ST.' % l]
+ regexes = [r'VO?%s' % l, r'VO?.-ST%s' % l]
return any(re.match(r, f['versionCode']) for r in regexes)
# Some formats may not be in the same language as the url
formats = filter(_match_lang, formats)
|
ytdl-org_youtube-dl.json
| null | null | null | null | null | null |
ytdl-org_youtube-dl.json
|
BUG_FIX
|
5, fixed a regex error
|
c9a8b0a9eacc0d9255cacc742d0b8e3a91e98b03
|
2023-07-13 13:19:40
|
hpstory
|
feat(csharp): add csharp code for unbounded knapsack (#596)
| false
| 203
| 0
| 203
|
--- codes/csharp/chapter_dynamic_programming/coin_change.cs
@@ -1,71 +0,0 @@
-/**
-* File: coin_change.cs
-* Created Time: 2023-07-12
-* Author: hpstory ([email protected])
-*/
-
-namespace hello_algo.chapter_dynamic_programming;
-
-public class coin_change {
- /* 零钱兑换:动态规划 */
- public int coinChangeDP(int[] coins, int amt) {
- int n = coins.Length;
- int MAX = amt + 1;
- // 初始化 dp 表
- int[,] dp = new int[n + 1, amt + 1];
- // 状态转移:首行首列
- for (int a = 1; a <= amt; a++) {
- dp[0, a] = MAX;
- }
- // 状态转移:其余行列
- for (int i = 1; i <= n; i++) {
- for (int a = 1; a <= amt; a++) {
- if (coins[i - 1] > a) {
- // 若超过背包容量,则不选硬币 i
- dp[i, a] = dp[i - 1, a];
- } else {
- // 不选和选硬币 i 这两种方案的较小值
- dp[i, a] = Math.Min(dp[i - 1, a], dp[i, a - coins[i - 1]] + 1);
- }
- }
- }
- return dp[n, amt] != MAX ? dp[n, amt] : -1;
- }
-
- /* 零钱兑换:状态压缩后的动态规划 */
- public int coinChangeDPComp(int[] coins, int amt) {
- int n = coins.Length;
- int MAX = amt + 1;
- // 初始化 dp 表
- int[] dp = new int[amt + 1];
- Array.Fill(dp, MAX);
- dp[0] = 0;
- // 状态转移
- for (int i = 1; i <= n; i++) {
- for (int a = 1; a <= amt; a++) {
- if (coins[i - 1] > a) {
- // 若超过背包容量,则不选硬币 i
- dp[a] = dp[a];
- } else {
- // 不选和选硬币 i 这两种方案的较小值
- dp[a] = Math.Min(dp[a], dp[a - coins[i - 1]] + 1);
- }
- }
- }
- return dp[amt] != MAX ? dp[amt] : -1;
- }
-
- [Test]
- public void Test() {
- int[] coins = { 1, 2, 5 };
- int amt = 4;
-
- // 动态规划
- int res = coinChangeDP(coins, amt);
- Console.WriteLine("凑到目标金额所需的最少硬币数量为 " + res);
-
- // 状态压缩后的动态规划
- res = coinChangeDPComp(coins, amt);
- Console.WriteLine("凑到目标金额所需的最少硬币数量为 " + res);
- }
-}
--- codes/csharp/chapter_dynamic_programming/coin_change_ii.cs
@@ -1,68 +0,0 @@
-/**
-* File: coin_change_ii.cs
-* Created Time: 2023-07-12
-* Author: hpstory ([email protected])
-*/
-
-namespace hello_algo.chapter_dynamic_programming;
-
-public class coin_change_ii {
- /* 零钱兑换 II:动态规划 */
- public int coinChangeIIDP(int[] coins, int amt) {
- int n = coins.Length;
- // 初始化 dp 表
- int[,] dp = new int[n + 1, amt + 1];
- // 初始化首列
- for (int i = 0; i <= n; i++) {
- dp[i, 0] = 1;
- }
- // 状态转移
- for (int i = 1; i <= n; i++) {
- for (int a = 1; a <= amt; a++) {
- if (coins[i - 1] > a) {
- // 若超过背包容量,则不选硬币 i
- dp[i, a] = dp[i - 1, a];
- } else {
- // 不选和选硬币 i 这两种方案之和
- dp[i, a] = dp[i - 1, a] + dp[i, a - coins[i - 1]];
- }
- }
- }
- return dp[n, amt];
- }
-
- /* 零钱兑换 II:状态压缩后的动态规划 */
- public int coinChangeIIDPComp(int[] coins, int amt) {
- int n = coins.Length;
- // 初始化 dp 表
- int[] dp = new int[amt + 1];
- dp[0] = 1;
- // 状态转移
- for (int i = 1; i <= n; i++) {
- for (int a = 1; a <= amt; a++) {
- if (coins[i - 1] > a) {
- // 若超过背包容量,则不选硬币 i
- dp[a] = dp[a];
- } else {
- // 不选和选硬币 i 这两种方案之和
- dp[a] = dp[a] + dp[a - coins[i - 1]];
- }
- }
- }
- return dp[amt];
- }
-
- [Test]
- public void Test() {
- int[] coins = { 1, 2, 5 };
- int amt = 5;
-
- // 动态规划
- int res = coinChangeIIDP(coins, amt);
- Console.WriteLine("凑出目标金额的硬币组合数量为 " + res);
-
- // 状态压缩后的动态规划
- res = coinChangeIIDPComp(coins, amt);
- Console.WriteLine("凑出目标金额的硬币组合数量为 " + res);
- }
-}
--- codes/csharp/chapter_dynamic_programming/unbounded_knapsack.cs
@@ -1,64 +0,0 @@
-/**
-* File: unbounded_knapsack.cs
-* Created Time: 2023-07-12
-* Author: hpstory ([email protected])
-*/
-
-namespace hello_algo.chapter_dynamic_programming;
-
-public class unbounded_knapsack {
- /* 完全背包:动态规划 */
- public int unboundedKnapsackDP(int[] wgt, int[] val, int cap) {
- int n = wgt.Length;
- // 初始化 dp 表
- int[,] dp = new int[n + 1, cap + 1];
- // 状态转移
- for (int i = 1; i <= n; i++) {
- for (int c = 1; c <= cap; c++) {
- if (wgt[i - 1] > c) {
- // 若超过背包容量,则不选物品 i
- dp[i, c] = dp[i - 1, c];
- } else {
- // 不选和选物品 i 这两种方案的较大值
- dp[i, c] = Math.Max(dp[i - 1, c], dp[i, c - wgt[i - 1]] + val[i - 1]);
- }
- }
- }
- return dp[n, cap];
- }
-
- /* 完全背包:状态压缩后的动态规划 */
- public int unboundedKnapsackDPComp(int[] wgt, int[] val, int cap) {
- int n = wgt.Length;
- // 初始化 dp 表
- int[] dp = new int[cap + 1];
- // 状态转移
- for (int i = 1; i <= n; i++) {
- for (int c = 1; c <= cap; c++) {
- if (wgt[i - 1] > c) {
- // 若超过背包容量,则不选物品 i
- dp[c] = dp[c];
- } else {
- // 不选和选物品 i 这两种方案的较大值
- dp[c] = Math.Max(dp[c], dp[c - wgt[i - 1]] + val[i - 1]);
- }
- }
- }
- return dp[cap];
- }
-
- [Test]
- public void Test() {
- int[] wgt = { 1, 2, 3 };
- int[] val = { 5, 11, 15 };
- int cap = 4;
-
- // 动态规划
- int res = unboundedKnapsackDP(wgt, val, cap);
- Console.WriteLine("不超过背包容量的最大物品价值为 " + res);
-
- // 状态压缩后的动态规划
- res = unboundedKnapsackDPComp(wgt, val, cap);
- Console.WriteLine("不超过背包容量的最大物品价值为 " + res);
- }
-}
|
hello-algo
|
krahets
|
Java
|
Java
| 109,696
| 13,651
|
《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing
|
krahets_hello-algo
|
NEW_FEAT
|
Introduce a new functionality
|
5d712a083b7f564a777969356a8118696c91e2c5
|
2024-01-13 23:07:17
|
SwayStar123
|
Add `try_insert` to storage map (#5441) ## Description
Adds the `try_insert` function to the storage map in the standard
library. Allows users to only insert when no prior value exists.
Closes #5147
## Checklist
- [x] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
---------
Co-authored-by: Cameron Carstens <[email protected]>
Co-authored-by: K1-R1 <[email protected]>
| false
| 275
| 18
| 293
|
--- sway-lib-std/src/storage/storage_map.sw
@@ -1,17 +1,9 @@
library;
use ::hash::*;
-use ::option::Option;
-use ::result::Result;
use ::storage::storage_api::*;
use ::storage::storage_key::*;
-/// Errors pertaining to the `StorageMap` struct.
-pub enum StorageMapError<V> {
- /// Indicates that a value already exists for the key.
- OccupiedError: V,
-}
-
/// A persistent key-value pair mapping struct.
pub struct StorageMap<K, V>
where
@@ -133,66 +125,4 @@ where
let key = sha256((key, self.slot));
clear::<V>(key, 0)
}
-
- /// Inserts a key-value pair into the map if a value does not already exist for the key.
- ///
- /// # Arguments
- ///
- /// * `key`: [K] - The key to which the value is paired.
- /// * `value`: [V] - The value to be stored.
- ///
- /// # Returns
- ///
- /// * [Result<V, StorageMapError<V>>] - `Result::Ok(value)` if the value was inserted, or `Result::Err(StorageMapError::OccupiedError(pre_existing_value))` if a value already existed for the key.
- ///
- /// # Number of Storage Accesses
- ///
- /// * Reads: `1`
- /// * Writes: `1`
- ///
- /// # Examples
- ///
- /// ```sway
- /// use std::storage::storage_map::StorageMapError;
- ///
- /// storage {
- /// map: StorageMap<u64, bool> = StorageMap {}
- /// }
- ///
- /// fn foo() {
- /// let key = 5_u64;
- /// let value = true;
- /// storage.map.insert(key, value);
- ///
- /// let new_value = false;
- /// let result = storage.map.try_insert(key, new_value);
- /// assert(result == Result::Err(StorageMapError::OccupiedError(value))); // The old value is returned.
- ///
- /// let retrieved_value = storage.map.get(key).read();
- /// assert(value == retrieved_value); // New value was not inserted, as a value already existed.
- ///
- /// let key2 = 10_u64;
- /// let returned_value = storage.map.try_insert(key2, new_value);
- /// assert(returned_value == Result::Ok(new_value)); // New value is returned.
- /// }
- /// ```
- #[storage(read, write)]
- pub fn try_insert(self, key: K, value: V) -> Result<V, StorageMapError<V>>
- where
- K: Hash,
-{
- let key = sha256((key, self.field_id));
-
- let val = read::<V>(key, 0);
-
- match val {
- Option::Some(v) => {
- Result::Err(StorageMapError::OccupiedError(v))
- },
- Option::None => {
- write::<V>(key, 0, value);
- Result::Ok(value)
- }
- }
- }
}
--- test/src/sdk-harness/Cargo.lock
@@ -3400,7 +3400,6 @@ dependencies = [
"fuel-vm",
"fuels",
"hex",
- "paste",
"pretty_assertions",
"rand",
"sha2",
--- test/src/sdk-harness/Cargo.toml
@@ -20,7 +20,6 @@ fuel-vm = "0.43.1"
fuels = { version = "0.54.0", features = ["fuel-core-lib"] }
hex = "0.4.3"
-paste = "1.0.14"
pretty_assertions = "1.4.0"
rand = "0.8"
sha2 = "0.10"
--- test/src/sdk-harness/test_projects/storage_map/mod.rs
@@ -4,8 +4,6 @@ use fuels::{
types::{Bits256, SizedAsciiString},
};
-pub mod try_insert;
-
abigen!(Contract(
name = "TestStorageMapContract",
abi = "test_projects/storage_map/out/debug/storage_map-abi.json",
--- test/src/sdk-harness/test_projects/storage_map/src/main.sw
@@ -1,7 +1,6 @@
contract;
use std::hash::*;
-use std::storage::storage_map::StorageMapError;
pub struct Struct {
x: u32,
@@ -77,8 +76,6 @@ abi StorageMapTest {
fn get_from_u64_to_bool_map(key: u64) -> Option<bool>;
#[storage(write)]
fn remove_from_u64_to_bool_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_bool_map(key: u64, value: bool) -> Result<bool, StorageMapError<bool>>;
#[storage(read, write)]
fn insert_into_u64_to_u8_map(key: u64, value: u8);
@@ -86,8 +83,6 @@ abi StorageMapTest {
fn get_from_u64_to_u8_map(key: u64) -> Option<u8>;
#[storage(write)]
fn remove_from_u64_to_u8_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_u8_map(key: u64, value: u8) -> Result<u8, StorageMapError<u8>>;
#[storage(read, write)]
fn insert_into_u64_to_u16_map(key: u64, value: u16);
@@ -95,8 +90,6 @@ abi StorageMapTest {
fn get_from_u64_to_u16_map(key: u64) -> Option<u16>;
#[storage(write)]
fn remove_from_u64_to_u16_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_u16_map(key: u64, value: u16) -> Result<u16, StorageMapError<u16>>;
#[storage(read, write)]
fn insert_into_u64_to_u32_map(key: u64, value: u32);
@@ -104,8 +97,6 @@ abi StorageMapTest {
fn get_from_u64_to_u32_map(key: u64) -> Option<u32>;
#[storage(write)]
fn remove_from_u64_to_u32_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_u32_map(key: u64, value: u32) -> Result<u32, StorageMapError<u32>>;
#[storage(read, write)]
fn insert_into_u64_to_u64_map(key: u64, value: u64);
@@ -113,8 +104,6 @@ abi StorageMapTest {
fn get_from_u64_to_u64_map(key: u64) -> Option<u64>;
#[storage(write)]
fn remove_from_u64_to_u64_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_u64_map(key: u64, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_u64_to_tuple_map(key: u64, value: (b256, u8, bool));
@@ -122,8 +111,6 @@ abi StorageMapTest {
fn get_from_u64_to_tuple_map(key: u64) -> Option<(b256, u8, bool)>;
#[storage(write)]
fn remove_from_u64_to_tuple_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_tuple_map(key: u64, value: (b256, u8, bool)) -> Result<(b256, u8, bool), StorageMapError<(b256, u8, bool)>>;
#[storage(read, write)]
fn insert_into_u64_to_struct_map(key: u64, value: Struct);
@@ -131,8 +118,6 @@ abi StorageMapTest {
fn get_from_u64_to_struct_map(key: u64) -> Option<Struct>;
#[storage(write)]
fn remove_from_u64_to_struct_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_struct_map(key: u64, value: Struct) -> Result<Struct, StorageMapError<Struct>>;
#[storage(read, write)]
fn insert_into_u64_to_enum_map(key: u64, value: Enum);
@@ -140,8 +125,6 @@ abi StorageMapTest {
fn get_from_u64_to_enum_map(key: u64) -> Option<Enum>;
#[storage(write)]
fn remove_from_u64_to_enum_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_enum_map(key: u64, value: Enum) -> Result<Enum, StorageMapError<Enum>>;
#[storage(read, write)]
fn insert_into_u64_to_str_map(key: u64, value: str[33]);
@@ -149,8 +132,6 @@ abi StorageMapTest {
fn get_from_u64_to_str_map(key: u64) -> Option<str[33]>;
#[storage(write)]
fn remove_from_u64_to_str_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_str_map(key: u64, value: str[33]) -> Result<str[33], StorageMapError<str[33]>>;
#[storage(read, write)]
fn insert_into_u64_to_array_map(key: u64, value: [b256; 3]);
@@ -158,8 +139,6 @@ abi StorageMapTest {
fn get_from_u64_to_array_map(key: u64) -> Option<[b256; 3]>;
#[storage(write)]
fn remove_from_u64_to_array_map(key: u64) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u64_to_array_map(key: u64, value: [b256; 3]) -> Result<[b256; 3], StorageMapError<[b256; 3]>>;
#[storage(read, write)]
fn insert_into_bool_to_u64_map(key: bool, value: u64);
@@ -167,8 +146,6 @@ abi StorageMapTest {
fn get_from_bool_to_u64_map(key: bool) -> Option<u64>;
#[storage(write)]
fn remove_from_bool_to_u64_map(key: bool) -> bool;
- #[storage(read, write)]
- fn try_insert_into_bool_to_u64_map(key: bool, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_u8_to_u64_map(key: u8, value: u64);
@@ -176,8 +153,6 @@ abi StorageMapTest {
fn get_from_u8_to_u64_map(key: u8) -> Option<u64>;
#[storage(write)]
fn remove_from_u8_to_u64_map(key: u8) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u8_to_u64_map(key: u8, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_u16_to_u64_map(key: u16, value: u64);
@@ -185,8 +160,6 @@ abi StorageMapTest {
fn get_from_u16_to_u64_map(key: u16) -> Option<u64>;
#[storage(write)]
fn remove_from_u16_to_u64_map(key: u16) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u16_to_u64_map(key: u16, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_u32_to_u64_map(key: u32, value: u64);
@@ -194,8 +167,6 @@ abi StorageMapTest {
fn get_from_u32_to_u64_map(key: u32) -> Option<u64>;
#[storage(write)]
fn remove_from_u32_to_u64_map(key: u32) -> bool;
- #[storage(read, write)]
- fn try_insert_into_u32_to_u64_map(key: u32, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_tuple_to_u64_map(key: (b256, u8, bool), value: u64);
@@ -203,8 +174,6 @@ abi StorageMapTest {
fn get_from_tuple_to_u64_map(key: (b256, u8, bool)) -> Option<u64>;
#[storage(write)]
fn remove_from_tuple_to_u64_map(key: (b256, u8, bool)) -> bool;
- #[storage(read, write)]
- fn try_insert_into_tuple_to_u64_map(key: (b256, u8, bool), value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_struct_to_u64_map(key: Struct, value: u64);
@@ -212,8 +181,6 @@ abi StorageMapTest {
fn get_from_struct_to_u64_map(key: Struct) -> Option<u64>;
#[storage(write)]
fn remove_from_struct_to_u64_map(key: Struct) -> bool;
- #[storage(read, write)]
- fn try_insert_into_struct_to_u64_map(key: Struct, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_enum_to_u64_map(key: Enum, value: u64);
@@ -221,8 +188,6 @@ abi StorageMapTest {
fn get_from_enum_to_u64_map(key: Enum) -> Option<u64>;
#[storage(write)]
fn remove_from_enum_to_u64_map(key: Enum) -> bool;
- #[storage(read, write)]
- fn try_insert_into_enum_to_u64_map(key: Enum, value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_str_to_u64_map(key: str[33], value: u64);
@@ -230,8 +195,6 @@ abi StorageMapTest {
fn get_from_str_to_u64_map(key: str[33]) -> Option<u64>;
#[storage(write)]
fn remove_from_str_to_u64_map(key: str[33]) -> bool;
- #[storage(read, write)]
- fn try_insert_into_str_to_u64_map(key: str[33], value: u64) -> Result<u64, StorageMapError<u64>>;
#[storage(read, write)]
fn insert_into_array_to_u64_map(key: [b256; 3], value: u64);
@@ -239,29 +202,37 @@ abi StorageMapTest {
fn get_from_array_to_u64_map(key: [b256; 3]) -> Option<u64>;
#[storage(write)]
fn remove_from_array_to_u64_map(key: [b256; 3]) -> bool;
- #[storage(read, write)]
- fn try_insert_into_array_to_u64_map(key: [b256; 3], value: u64) -> Result<u64, StorageMapError<u64>>;
+}
+
+#[storage(read, write)]
+fn _insert_into_u64_to_bool_map_inner(key: u64, value: bool) {
+ storage.map1.insert(key, value);
+}
+
+#[storage(read)]
+fn _get_from_u64_to_bool_map_inner(key: u64) -> Option<bool> {
+ storage.map1.get(key).try_read()
+}
+
+#[storage(write)]
+fn _remove_from_u64_to_bool_map_inner(key: u64) -> bool {
+ storage.map1.remove(key)
}
impl StorageMapTest for Contract {
#[storage(read, write)]
fn insert_into_u64_to_bool_map(key: u64, value: bool) {
- storage.map1.insert(key, value);
+ _insert_into_u64_to_bool_map_inner(key, value)
}
#[storage(read)]
fn get_from_u64_to_bool_map(key: u64) -> Option<bool> {
- storage.map1.get(key).try_read()
+ _get_from_u64_to_bool_map_inner(key)
}
#[storage(write)]
fn remove_from_u64_to_bool_map(key: u64) -> bool {
- storage.map1.remove(key)
- }
-
- #[storage(read, write)]
- fn try_insert_into_u64_to_bool_map(key: u64, value: bool) -> Result<bool, StorageMapError<bool>> {
- storage.map1.try_insert(key, value)
+ _remove_from_u64_to_bool_map_inner(key)
}
#[storage(read, write)]
@@ -279,11 +250,6 @@ impl StorageMapTest for Contract {
storage.map2.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_u8_map(key: u64, value: u8) -> Result<u8, StorageMapError<u8>> {
- storage.map2.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_u16_map(key: u64, value: u16) {
storage.map3.insert(key, value);
@@ -299,11 +265,6 @@ impl StorageMapTest for Contract {
storage.map3.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_u16_map(key: u64, value: u16) -> Result<u16, StorageMapError<u16>> {
- storage.map3.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_u32_map(key: u64, value: u32) {
storage.map4.insert(key, value);
@@ -319,11 +280,6 @@ impl StorageMapTest for Contract {
storage.map4.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_u32_map(key: u64, value: u32) -> Result<u32, StorageMapError<u32>> {
- storage.map4.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_u64_map(key: u64, value: u64) {
storage.map5.insert(key, value);
@@ -339,11 +295,6 @@ impl StorageMapTest for Contract {
storage.map5.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_u64_map(key: u64, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map5.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_tuple_map(key: u64, value: (b256, u8, bool)) {
storage.map6.insert(key, value);
@@ -359,11 +310,6 @@ impl StorageMapTest for Contract {
storage.map6.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_tuple_map(key: u64, value: (b256, u8, bool)) -> Result<(b256, u8, bool), StorageMapError<(b256, u8, bool)>> {
- storage.map6.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_struct_map(key: u64, value: Struct) {
storage.map7.insert(key, value);
@@ -379,11 +325,6 @@ impl StorageMapTest for Contract {
storage.map7.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_struct_map(key: u64, value: Struct) -> Result<Struct, StorageMapError<Struct>> {
- storage.map7.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_enum_map(key: u64, value: Enum) {
storage.map8.insert(key, value);
@@ -399,11 +340,6 @@ impl StorageMapTest for Contract {
storage.map8.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_enum_map(key: u64, value: Enum) -> Result<Enum, StorageMapError<Enum>> {
- storage.map8.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_str_map(key: u64, value: str[33]) {
storage.map9.insert(key, value);
@@ -419,11 +355,6 @@ impl StorageMapTest for Contract {
storage.map9.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_str_map(key: u64, value: str[33]) -> Result<str[33], StorageMapError<str[33]>> {
- storage.map9.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u64_to_array_map(key: u64, value: [b256; 3]) {
storage.map10.insert(key, value);
@@ -439,11 +370,6 @@ impl StorageMapTest for Contract {
storage.map10.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u64_to_array_map(key: u64, value: [b256; 3]) -> Result<[b256; 3], StorageMapError<[b256; 3]>> {
- storage.map10.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_bool_to_u64_map(key: bool, value: u64) {
storage.map11.insert(key, value);
@@ -459,11 +385,6 @@ impl StorageMapTest for Contract {
storage.map11.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_bool_to_u64_map(key: bool, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map11.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u8_to_u64_map(key: u8, value: u64) {
storage.map12.insert(key, value);
@@ -479,11 +400,6 @@ impl StorageMapTest for Contract {
storage.map12.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u8_to_u64_map(key: u8, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map12.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u16_to_u64_map(key: u16, value: u64) {
storage.map13.insert(key, value);
@@ -499,11 +415,6 @@ impl StorageMapTest for Contract {
storage.map13.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u16_to_u64_map(key: u16, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map13.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_u32_to_u64_map(key: u32, value: u64) {
storage.map14.insert(key, value);
@@ -519,11 +430,6 @@ impl StorageMapTest for Contract {
storage.map14.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_u32_to_u64_map(key: u32, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map14.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_tuple_to_u64_map(key: (b256, u8, bool), value: u64) {
storage.map15.insert(key, value);
@@ -539,11 +445,6 @@ impl StorageMapTest for Contract {
storage.map15.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_tuple_to_u64_map(key: (b256, u8, bool), value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map15.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_struct_to_u64_map(key: Struct, value: u64) {
storage.map16.insert(key, value);
@@ -559,11 +460,6 @@ impl StorageMapTest for Contract {
storage.map16.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_struct_to_u64_map(key: Struct, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map16.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_enum_to_u64_map(key: Enum, value: u64) {
storage.map17.insert(key, value);
@@ -579,11 +475,6 @@ impl StorageMapTest for Contract {
storage.map17.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_enum_to_u64_map(key: Enum, value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map17.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_str_to_u64_map(key: str[33], value: u64) {
storage.map18.insert(key, value);
@@ -599,11 +490,6 @@ impl StorageMapTest for Contract {
storage.map18.remove(key)
}
- #[storage(read, write)]
- fn try_insert_into_str_to_u64_map(key: str[33], value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map18.try_insert(key, value)
- }
-
#[storage(read, write)]
fn insert_into_array_to_u64_map(key: [b256; 3], value: u64) {
storage.map19.insert(key, value)
@@ -618,9 +504,4 @@ impl StorageMapTest for Contract {
fn remove_from_array_to_u64_map(key: [b256; 3]) -> bool {
storage.map19.remove(key)
}
-
- #[storage(read, write)]
- fn try_insert_into_array_to_u64_map(key: [b256; 3], value: u64) -> Result<u64, StorageMapError<u64>> {
- storage.map19.try_insert(key, value)
- }
}
--- test/src/sdk-harness/test_projects/storage_map/try_insert.rs
@@ -1,64 +0,0 @@
-use super::*;
-
-#[macro_export]
-macro_rules! generate_try_insert_tests {
- ($input_string:expr, $key:expr, $value1:expr, $value2:expr) => {
- paste::paste! {
- #[tokio::test]
- async fn [<try_insert_ $input_string _exists>]() {
- let instance = test_storage_map_instance().await;
-
- instance.methods().[<insert_into_ $input_string _map>]($key, $value1).call().await.unwrap();
-
- let prev = instance.methods().[<get_from_ $input_string _map>]($key).call().await.unwrap().value;
-
- assert_eq!(prev, Some($value1));
-
- let result = instance.methods().[<try_insert_into_ $input_string _map>]($key, $value2).call().await.unwrap().value;
-
- assert_eq!(result, Err(StorageMapError::OccupiedError($value1)));
-
- let after = instance.methods().[<get_from_ $input_string _map>]($key).call().await.unwrap().value;
-
- assert_eq!(after, Some($value1));
- }
-
- #[tokio::test]
- async fn [<try_insert_ $input_string _does_not_exist>]() {
- let instance = test_storage_map_instance().await;
-
- let prev = instance.methods().[<get_from_ $input_string _map>]($key).call().await.unwrap().value;
-
- assert_eq!(prev, None);
-
- let result = instance.methods().[<try_insert_into_ $input_string _map>]($key, $value2).call().await.unwrap().value;
-
- assert_eq!(result, Ok($value2));
-
- let after = instance.methods().[<get_from_ $input_string _map>]($key).call().await.unwrap().value;
-
- assert_eq!(after, Some($value2));
- }
- }
- };
-}
-
-generate_try_insert_tests!(u64_to_bool, 1, true, false);
-generate_try_insert_tests!(u64_to_u8, 1, 1, 2);
-generate_try_insert_tests!(u64_to_u16, 1, 1, 2);
-generate_try_insert_tests!(u64_to_u32, 1, 1, 2);
-generate_try_insert_tests!(u64_to_u64, 1, 1, 2);
-generate_try_insert_tests!(u64_to_tuple, 1, (Bits256([1; 32]), 1, true), (Bits256([2; 32]), 2, false));
-generate_try_insert_tests!(u64_to_struct, 1, Struct { x: 1, y: Bits256([1; 32]), z: Bits256([2; 32]) }, Struct { x: 2, y: Bits256([3; 32]), z: Bits256([4; 32]) });
-generate_try_insert_tests!(u64_to_enum, 1, Enum::V1(Bits256([1; 32])), Enum::V2(2));
-generate_try_insert_tests!(u64_to_str, 1, SizedAsciiString::try_from("fastest_modular_execution_layer_A").unwrap(), SizedAsciiString::try_from("fastest_modular_execution_layer_B").unwrap());
-generate_try_insert_tests!(u64_to_array, 1, [Bits256([1; 32]); 3], [Bits256([2; 32]); 3]);
-generate_try_insert_tests!(bool_to_u64, true, 1, 2);
-generate_try_insert_tests!(u8_to_u64, 1, 1, 2);
-generate_try_insert_tests!(u16_to_u64, 1, 1, 2);
-generate_try_insert_tests!(u32_to_u64, 1, 1, 2);
-generate_try_insert_tests!(tuple_to_u64, (Bits256([1; 32]), 1, true), 1, 2);
-generate_try_insert_tests!(struct_to_u64, Struct { x: 1, y: Bits256([1; 32]), z: Bits256([2; 32]) }, 1, 2);
-generate_try_insert_tests!(enum_to_u64, Enum::V1(Bits256([1; 32])), 1, 2);
-generate_try_insert_tests!(str_to_u64, SizedAsciiString::try_from("fastest_modular_execution_layer_A").unwrap(), 1, 2);
-generate_try_insert_tests!(array_to_u64, [Bits256([1; 32]); 3], 1, 2);
|
sway
|
fuellabs
|
Rust
|
Rust
| 62,435
| 5,382
|
🌴 Empowering everyone to build reliable and efficient smart contracts.
|
fuellabs_sway
|
NEW_FEAT
|
obvious
|
88def9ddcd1088f5c9431e8ea45820128572c74a
|
2024-02-27 01:57:57
|
Mike Griese
|
Add support for actions in fragments (#16185) Surprisingly easier than I thought this would be. ActionMap already
supports layering (from defaults.json), so this basically re-uses a lot
of that for fun and profit.
The trickiest bits:
* In `SettingsLoader::_parseFragment`, I'm constructing a fake, empty
JSON object, and taking _only_ the actions out from the fragment, and
stuffing them into this temp json. Then, I parse that as a globals
object, and set _that_ as the parent to the user settings file. That
results in _only_ the actions from the fragment being parsed before the
user's actions.
* In that same method, I'm also explicitly preventing the ActionMap (et
al.) from parsing `keys` from these actions. We don't want fragments to
be able to say "ctrl+f is clear buffer" or something like that. This
required a bit of annoying plumbing.
Closes #16063
Tests added.
Docs need to be updated.
| false
| 246
| 36
| 282
|
--- src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp
@@ -74,13 +74,6 @@ namespace SettingsModelLocalTests
TEST_METHOD(TestInheritedCommand);
TEST_METHOD(LoadFragmentsWithMultipleUpdates);
- TEST_METHOD(FragmentActionSimple);
- TEST_METHOD(FragmentActionNoKeys);
- TEST_METHOD(FragmentActionNested);
- TEST_METHOD(FragmentActionNestedNoName);
- TEST_METHOD(FragmentActionIterable);
- TEST_METHOD(FragmentActionRoundtrip);
-
TEST_METHOD(MigrateReloadEnvVars);
private:
@@ -2030,189 +2023,6 @@ namespace SettingsModelLocalTests
VERIFY_ARE_EQUAL(L"NewName", loader.userSettings.profiles[0]->Name());
}
- void DeserializationTests::FragmentActionSimple()
- {
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "command": { "action": "addMark" },
- "name": "Test Action"
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto settings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
-
- const auto actionMap = winrt::get_self<implementation::ActionMap>(settings->GlobalSettings().ActionMap());
- const auto actionsByName = actionMap->NameMap();
- VERIFY_IS_NOT_NULL(actionsByName.TryLookup(L"Test Action"));
- }
-
- void DeserializationTests::FragmentActionNoKeys()
- {
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "command": { "action": "addMark" },
- "keys": "ctrl+f",
- "name": "Test Action"
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto settings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
-
- const auto actionMap = winrt::get_self<implementation::ActionMap>(settings->GlobalSettings().ActionMap());
- const auto actionsByName = actionMap->NameMap();
- VERIFY_IS_NOT_NULL(actionsByName.TryLookup(L"Test Action"));
- VERIFY_IS_NULL(actionMap->GetActionByKeyChord({ VirtualKeyModifiers::Control, static_cast<int32_t>('F'), 0 }));
- }
-
- void DeserializationTests::FragmentActionNested()
- {
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "name": "nested command",
- "commands": [
- {
- "name": "child1",
- "command": { "action": "newTab", "commandline": "ssh [email protected]" }
- },
- {
- "name": "child2",
- "command": { "action": "newTab", "commandline": "ssh [email protected]" }
- }
- ]
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto settings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
-
- const auto actionMap = winrt::get_self<implementation::ActionMap>(settings->GlobalSettings().ActionMap());
- const auto actionsByName = actionMap->NameMap();
- const auto& nested{ actionsByName.TryLookup(L"nested command") };
- VERIFY_IS_NOT_NULL(nested);
- VERIFY_IS_TRUE(nested.HasNestedCommands());
- }
-
- void DeserializationTests::FragmentActionNestedNoName()
- {
- // Basically the same as TestNestedCommandWithoutName
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "commands": [
- {
- "name": "child1",
- "command": { "action": "newTab", "commandline": "ssh [email protected]" }
- },
- {
- "name": "child2",
- "command": { "action": "newTab", "commandline": "ssh [email protected]" }
- }
- ]
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto settings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
- VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
- }
- void DeserializationTests::FragmentActionIterable()
- {
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "name": "nested",
- "commands": [
- {
- "iterateOn": "schemes",
- "name": "${scheme.name}",
- "command": { "action": "setColorScheme", "colorScheme": "${scheme.name}" }
- }
- ]
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto settings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
-
- const auto actionMap = winrt::get_self<implementation::ActionMap>(settings->GlobalSettings().ActionMap());
- const auto actionsByName = actionMap->NameMap();
- const auto& nested{ actionsByName.TryLookup(L"nested") };
- VERIFY_IS_NOT_NULL(nested);
- VERIFY_IS_TRUE(nested.HasNestedCommands());
- VERIFY_ARE_EQUAL(settings->GlobalSettings().ColorSchemes().Size(), nested.NestedCommands().Size());
- }
- void DeserializationTests::FragmentActionRoundtrip()
- {
- static constexpr std::wstring_view fragmentSource{ L"fragment" };
- static constexpr std::string_view fragmentJson{ R"({
- "actions": [
- {
- "command": { "action": "addMark" },
- "name": "Test Action"
- },
- ]
- })" };
-
- implementation::SettingsLoader loader{ std::string_view{}, DefaultJson };
- loader.MergeInboxIntoUserSettings();
- loader.MergeFragmentIntoUserSettings(winrt::hstring{ fragmentSource }, fragmentJson);
- loader.FinalizeLayering();
-
- const auto oldSettings = winrt::make_self<implementation::CascadiaSettings>(std::move(loader));
-
- const auto actionMap = winrt::get_self<implementation::ActionMap>(oldSettings->GlobalSettings().ActionMap());
- const auto actionsByName = actionMap->NameMap();
- VERIFY_IS_NOT_NULL(actionsByName.TryLookup(L"Test Action"));
-
- const auto oldResult{ oldSettings->ToJson() };
-
- Log::Comment(L"Now, create a _new_ settings object from the re-serialization of the first");
- implementation::SettingsLoader newLoader{ toString(oldResult), DefaultJson };
- // NOTABLY! Don't load the fragment here.
- newLoader.MergeInboxIntoUserSettings();
- newLoader.FinalizeLayering();
- const auto newSettings = winrt::make_self<implementation::CascadiaSettings>(std::move(newLoader));
-
- const auto& newActionMap = winrt::get_self<implementation::ActionMap>(newSettings->GlobalSettings().ActionMap());
- const auto newActionsByName = newActionMap->NameMap();
- VERIFY_IS_NULL(newActionsByName.TryLookup(L"Test Action"));
- }
-
void DeserializationTests::MigrateReloadEnvVars()
{
static constexpr std::string_view settings1Json{ R"(
--- src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp
@@ -68,19 +68,6 @@ namespace SettingsModelLocalTests
// written alphabetically.
VERIFY_ARE_EQUAL(toString(json), toString(result));
}
-
- // Helper to remove the `$schema` property from a json object. We
- // populate that based off the local path to the settings file. Of
- // course, that's entirely unpredictable in tests. So cut it out before
- // we do any sort of roundtrip testing.
- static Json::Value removeSchema(Json::Value json)
- {
- if (json.isMember("$schema"))
- {
- json.removeMember("$schema");
- }
- return json;
- }
};
void SerializationTests::GlobalSettings()
@@ -275,6 +262,15 @@ namespace SettingsModelLocalTests
{ "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+c" },
{ "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+d" }
])" };
+ // GH#13323 - these can be fragile. In the past, the order these get
+ // re-serialized as has been not entirely stable. We don't really care
+ // about the order they get re-serialized in, but the tests aren't
+ // clever enough to compare the structure, only the literal string
+ // itself. Feel free to change as needed.
+ static constexpr std::string_view actionsString4B{ R"([
+ { "command": { "action": "findMatch", "direction": "prev" }, "keys": "ctrl+shift+r" },
+ { "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+d" }
+ ])" };
// command with name and icon and multiple key chords
static constexpr std::string_view actionsString5{ R"([
@@ -388,6 +384,7 @@ namespace SettingsModelLocalTests
Log::Comment(L"complex commands with key chords");
RoundtripTest<implementation::ActionMap>(actionsString4A);
+ RoundtripTest<implementation::ActionMap>(actionsString4B);
Log::Comment(L"command with name and icon and multiple key chords");
RoundtripTest<implementation::ActionMap>(actionsString5);
@@ -486,8 +483,7 @@ namespace SettingsModelLocalTests
const auto settings{ winrt::make_self<implementation::CascadiaSettings>(settingsString) };
const auto result{ settings->ToJson() };
- VERIFY_ARE_EQUAL(toString(removeSchema(VerifyParseSucceeded(settingsString))),
- toString(removeSchema(result)));
+ VERIFY_ARE_EQUAL(toString(VerifyParseSucceeded(settingsString)), toString(result));
}
void SerializationTests::LegacyFontSettings()
--- src/cascadia/TerminalSettingsModel/ActionMap.h
@@ -67,7 +67,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// JSON
static com_ptr<ActionMap> FromJson(const Json::Value& json);
- std::vector<SettingsLoadWarnings> LayerJson(const Json::Value& json, const bool withKeybindings = true);
+ std::vector<SettingsLoadWarnings> LayerJson(const Json::Value& json);
Json::Value ToJson() const;
// modification
--- src/cascadia/TerminalSettingsModel/ActionMapSerialization.cpp
@@ -35,7 +35,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// - json: an array of Json::Value's to deserialize into our ActionMap.
// Return value:
// - a list of warnings encountered while deserializing the json
- std::vector<SettingsLoadWarnings> ActionMap::LayerJson(const Json::Value& json, const bool withKeybindings)
+ std::vector<SettingsLoadWarnings> ActionMap::LayerJson(const Json::Value& json)
{
// It's possible that the user provided keybindings have some warnings in
// them - problems that we should alert the user to, but we can recover
@@ -50,7 +50,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
continue;
}
- AddAction(*Command::FromJson(cmdJson, warnings, withKeybindings));
+ AddAction(*Command::FromJson(cmdJson, warnings));
}
return warnings;
--- src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
@@ -629,7 +629,7 @@ void SettingsLoader::_parse(const OriginTag origin, const winrt::hstring& source
// schemes and profiles. Additionally this function supports profiles which specify an "updates" key.
void SettingsLoader::_parseFragment(const winrt::hstring& source, const std::string_view& content, ParsedSettings& settings)
{
- auto json = _parseJson(content);
+ const auto json = _parseJson(content);
settings.clear();
@@ -647,11 +647,6 @@ void SettingsLoader::_parseFragment(const winrt::hstring& source, const std::str
}
CATCH_LOG()
}
-
- // Parse out actions from the fragment. Manually opt-out of keybinding
- // parsing - fragments shouldn't be allowed to bind actions to keys
- // directly. We may want to revisit circa GH#2205
- settings.globals->LayerActionsFrom(json.root, false);
}
{
@@ -693,10 +688,10 @@ void SettingsLoader::_parseFragment(const winrt::hstring& source, const std::str
}
}
- // Add the parsed fragment globals as a parent of the user's settings.
- // Later, in FinalizeInheritance, this will result in the action map from
- // the fragments being applied before the user's own settings.
- userSettings.globals->AddLeastImportantParent(settings.globals);
+ for (const auto& kv : settings.globals->ColorSchemes())
+ {
+ userSettings.globals->AddColorScheme(kv.Value());
+ }
}
SettingsLoader::JsonSettings SettingsLoader::_parseJson(const std::string_view& content)
--- src/cascadia/TerminalSettingsModel/Command.cpp
@@ -258,8 +258,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Return Value:
// - the newly constructed Command object.
winrt::com_ptr<Command> Command::FromJson(const Json::Value& json,
- std::vector<SettingsLoadWarnings>& warnings,
- const bool parseKeys)
+ std::vector<SettingsLoadWarnings>& warnings)
{
auto result = winrt::make_self<Command>();
@@ -314,23 +313,20 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
result->_ActionAndArgs = make<implementation::ActionAndArgs>();
}
- if (parseKeys)
+ // GH#4239 - If the user provided more than one key
+ // chord to a "keys" array, warn the user here.
+ // TODO: GH#1334 - remove this check.
+ const auto keysJson{ json[JsonKey(KeysKey)] };
+ if (keysJson.isArray() && keysJson.size() > 1)
{
- // GH#4239 - If the user provided more than one key
- // chord to a "keys" array, warn the user here.
- // TODO: GH#1334 - remove this check.
- const auto keysJson{ json[JsonKey(KeysKey)] };
- if (keysJson.isArray() && keysJson.size() > 1)
- {
- warnings.push_back(SettingsLoadWarnings::TooManyKeysForChord);
- }
- else
+ warnings.push_back(SettingsLoadWarnings::TooManyKeysForChord);
+ }
+ else
+ {
+ Control::KeyChord keys{ nullptr };
+ if (JsonUtils::GetValueForKey(json, KeysKey, keys))
{
- Control::KeyChord keys{ nullptr };
- if (JsonUtils::GetValueForKey(json, KeysKey, keys))
- {
- result->RegisterKey(keys);
- }
+ result->RegisterKey(keys);
}
}
}
--- src/cascadia/TerminalSettingsModel/Command.h
@@ -39,8 +39,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
com_ptr<Command> Copy() const;
static winrt::com_ptr<Command> FromJson(const Json::Value& json,
- std::vector<SettingsLoadWarnings>& warnings,
- const bool parseKeys = true);
+ std::vector<SettingsLoadWarnings>& warnings);
static void ExpandCommands(Windows::Foundation::Collections::IMap<winrt::hstring, Model::Command>& commands,
Windows::Foundation::Collections::IVectorView<Model::Profile> profiles,
--- src/cascadia/TerminalSettingsModel/GlobalAppSettings.cpp
@@ -142,19 +142,12 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)
MTSM_GLOBAL_SETTINGS(GLOBAL_SETTINGS_LAYER_JSON)
#undef GLOBAL_SETTINGS_LAYER_JSON
- LayerActionsFrom(json, true);
-
- JsonUtils::GetValueForKey(json, LegacyReloadEnvironmentVariablesKey, _legacyReloadEnvironmentVariables);
-}
-
-void GlobalAppSettings::LayerActionsFrom(const Json::Value& json, const bool withKeybindings)
-{
static constexpr std::array bindingsKeys{ LegacyKeybindingsKey, ActionsKey };
for (const auto& jsonKey : bindingsKeys)
{
if (auto bindings{ json[JsonKey(jsonKey)] })
{
- auto warnings = _actionMap->LayerJson(bindings, withKeybindings);
+ auto warnings = _actionMap->LayerJson(bindings);
// It's possible that the user provided keybindings have some warnings
// in them - problems that we should alert the user to, but we can
@@ -165,6 +158,8 @@ void GlobalAppSettings::LayerActionsFrom(const Json::Value& json, const bool wit
_keybindingsWarnings.insert(_keybindingsWarnings.end(), warnings.begin(), warnings.end());
}
}
+
+ JsonUtils::GetValueForKey(json, LegacyReloadEnvironmentVariablesKey, _legacyReloadEnvironmentVariables);
}
// Method Description:
--- src/cascadia/TerminalSettingsModel/GlobalAppSettings.h
@@ -49,7 +49,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static com_ptr<GlobalAppSettings> FromJson(const Json::Value& json);
void LayerJson(const Json::Value& json);
- void LayerActionsFrom(const Json::Value& json, const bool withKeybindings = true);
Json::Value ToJson() const;
|
terminal
|
microsoft
|
C++
|
C++
| 97,273
| 8,477
|
The new Windows Terminal and the original Windows console host, all in the same place!
|
microsoft_terminal
|
NEW_FEAT
|
probably a new feature to add support for actions
|
292c622507391dabd0434adcc6437edb193ac5be
|
2025-03-17 16:42:10
|
Gary Guo
|
Stabilize asm_goto
| false
| 36
| 80
| 116
|
--- compiler/rustc_ast_lowering/messages.ftl
@@ -185,6 +185,8 @@ ast_lowering_underscore_expr_lhs_assign =
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
ast_lowering_unstable_inline_assembly_label_operand_with_outputs =
using both label and output operands for inline assembly is unstable
+ast_lowering_unstable_inline_assembly_label_operands =
+ label operands for inline assembly are unstable
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
ast_lowering_use_angle_brackets = use angle brackets instead
--- compiler/rustc_ast_lowering/src/asm.rs
@@ -470,11 +470,22 @@ pub(crate) fn lower_inline_asm(
}
}
- // Feature gate checking for `asm_goto_with_outputs`.
+ // Feature gate checking for asm goto.
if let Some((_, op_sp)) =
operands.iter().find(|(op, _)| matches!(op, hir::InlineAsmOperand::Label { .. }))
{
- // Check if an output operand is used.
+ if !self.tcx.features().asm_goto() {
+ feature_err(
+ sess,
+ sym::asm_goto,
+ *op_sp,
+ fluent::ast_lowering_unstable_inline_assembly_label_operands,
+ )
+ .emit();
+ }
+
+ // In addition, check if an output operand is used.
+ // This is gated behind an additional feature.
let output_operand_used = operands.iter().any(|(op, _)| {
matches!(
op,
--- compiler/rustc_feature/src/accepted.rs
@@ -62,8 +62,6 @@ macro_rules! declare_features {
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
/// Allows using `const` operands in inline assembly.
(accepted, asm_const, "1.82.0", Some(93332)),
- /// Allows using `label` operands in inline assembly.
- (accepted, asm_goto, "CURRENT_RUSTC_VERSION", Some(119364)),
/// Allows using `sym` operands in inline assembly.
(accepted, asm_sym, "1.66.0", Some(93333)),
/// Allows the definition of associated constants in `trait` or `impl` blocks.
--- compiler/rustc_feature/src/unstable.rs
@@ -372,6 +372,8 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
/// Enables experimental register support in inline assembly.
(unstable, asm_experimental_reg, "1.85.0", Some(133416)),
+ /// Allows using `label` operands in inline assembly.
+ (unstable, asm_goto, "1.78.0", Some(119364)),
/// Allows using `label` operands in inline assembly together with output operands.
(unstable, asm_goto_with_outputs, "1.85.0", Some(119364)),
/// Allows the `may_unwind` option in inline assembly.
--- src/doc/unstable-book/src/language-features/asm-goto-with-outputs.md
@@ -1,27 +0,0 @@
-# `asm_goto_with_outputs`
-
-The tracking issue for this feature is: [#119364]
-
-[#119364]: https://github.com/rust-lang/rust/issues/119364
-
-------------------------
-
-This feature allows label operands to be used together with output operands.
-
-Example:
-```rust,ignore (partial-example, x86-only)
-
-unsafe {
- let a: usize;
- asm!(
- "mov {}, 1"
- "jmp {}",
- out(reg) a,
- label {
- println!("Jumped from asm {}!", a);
- }
- );
-}
-```
-
-The output operands are assigned before the label blocks are executed.
--- src/doc/unstable-book/src/language-features/asm-goto.md
@@ -0,0 +1,32 @@
+# `asm_goto`
+
+The tracking issue for this feature is: [#119364]
+
+[#119364]: https://github.com/rust-lang/rust/issues/119364
+
+------------------------
+
+This feature adds a `label <block>` operand type to `asm!`.
+
+Example:
+```rust,ignore (partial-example, x86-only)
+
+unsafe {
+ asm!(
+ "jmp {}",
+ label {
+ println!("Jumped from asm!");
+ }
+ );
+}
+```
+
+The block must have unit type or diverge. The block starts a new safety context,
+so despite outer `unsafe`, you need extra unsafe to perform unsafe operations
+within `label <block>`.
+
+When `label <block>` is used together with `noreturn` option, it means that the
+assembly will not fallthrough. It's allowed to jump to a label within the
+assembly. In this case, the entire `asm!` expression will have an unit type as
+opposed to diverging, if not all label blocks diverge. The `asm!` expression
+still diverges if `noreturn` option is used and all label blocks diverge.
--- tests/codegen/asm/goto.rs
@@ -2,7 +2,7 @@
//@ only-x86_64
#![crate_type = "rlib"]
-#![feature(asm_goto_with_outputs)]
+#![feature(asm_goto, asm_goto_with_outputs)]
use std::arch::asm;
--- tests/ui/asm/x86_64/bad-options.rs
@@ -1,6 +1,6 @@
//@ only-x86_64
-#![feature(asm_unwind)]
+#![feature(asm_unwind, asm_goto)]
use std::arch::{asm, global_asm};
--- tests/ui/asm/x86_64/goto-block-safe.rs
@@ -2,6 +2,7 @@
//@ needs-asm-support
#![deny(unreachable_code)]
+#![feature(asm_goto)]
use std::arch::asm;
--- tests/ui/asm/x86_64/goto-block-safe.stderr
@@ -1,5 +1,5 @@
error[E0133]: call to unsafe function `unreachable_unchecked` is unsafe and requires unsafe function or block
- --> $DIR/goto-block-safe.rs:13:17
+ --> $DIR/goto-block-safe.rs:14:17
|
LL | unsafe {
| ------ items do not inherit unsafety from separate enclosing items
--- tests/ui/asm/x86_64/goto.rs
@@ -3,7 +3,7 @@
//@ needs-asm-support
#![deny(unreachable_code)]
-#![feature(asm_goto_with_outputs)]
+#![feature(asm_goto, asm_goto_with_outputs)]
use std::arch::asm;
--- tests/ui/feature-gates/feature-gate-asm_goto.rs
@@ -0,0 +1,10 @@
+//@ only-x86_64
+
+use std::arch::asm;
+
+fn main() {
+ unsafe {
+ asm!("jmp {}", label {});
+ //~^ ERROR label operands for inline assembly are unstable
+ }
+}
--- tests/ui/feature-gates/feature-gate-asm_goto.stderr
@@ -0,0 +1,13 @@
+error[E0658]: label operands for inline assembly are unstable
+ --> $DIR/feature-gate-asm_goto.rs:7:24
+ |
+LL | asm!("jmp {}", label {});
+ | ^^^^^^^^
+ |
+ = note: see issue #119364 <https://github.com/rust-lang/rust/issues/119364> for more information
+ = help: add `#![feature(asm_goto)]` to the crate attributes to enable
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
--- tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs
@@ -1,5 +1,7 @@
//@ only-x86_64
+#![feature(asm_goto)]
+
use std::arch::asm;
fn main() {
--- tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr
@@ -1,5 +1,5 @@
error[E0658]: using both label and output operands for inline assembly is unstable
- --> $DIR/feature-gate-asm_goto_with_outputs.rs:8:52
+ --> $DIR/feature-gate-asm_goto_with_outputs.rs:10:52
|
LL | asm!("mov {}, 1", "jmp {}", out(reg) _out, label {});
| ^^^^^^^^
|
rust
|
rust-lang
|
Rust
|
Rust
| 101,693
| 13,172
|
Empowering everyone to build reliable and efficient software.
|
rust-lang_rust
|
BUG_FIX
|
asm_goto stabilized
|
5c06cff5933ee0e91e2a8c1e138af6646ce1c6ec
|
2023-03-20 20:51:50
|
Toshiaki Takeuchi
|
Add images folder
| false
| 0
| 0
| 0
|
--- images/MatGPT.png
Binary files a/images/MatGPT.png and /dev/null differ
--- images/MatGPTlogo.png
Binary files a/images/MatGPTlogo.png and /dev/null differ
|
matgpt
|
toshiakit
|
MATLAB
|
MATLAB
| 218
| 33
|
MATLAB app to access ChatGPT API from OpenAI
|
toshiakit_matgpt
|
CODE_IMPROVEMENT
|
Obvious
|
1dc35f1f5550ef37df1da684d8f35b8c23132ad0
|
2024-07-15 21:04:56
|
Constantin Graf
|
Removed option to update billable rate without updating time entries
| false
| 22
| 58
| 80
|
--- app/Http/Controllers/Api/V1/MemberController.php
@@ -71,10 +71,8 @@ public function update(Organization $organization, Member $member, MemberUpdateR
{
$this->checkPermission($organization, 'members:update', $member);
- if ($request->has('billable_rate') && $member->billable_rate !== $request->getBillableRate()) {
+ if ($request->has('billable_rate')) {
$member->billable_rate = $request->getBillableRate();
-
- $billableRateService->updateTimeEntriesBillableRateForMember($member);
}
if ($request->has('role') && $member->role !== $request->getRole()->value) {
$newRole = $request->getRole();
@@ -97,6 +95,10 @@ public function update(Organization $organization, Member $member, MemberUpdateR
}
$member->save();
+ if ($request->getBillableRateUpdateTimeEntries()) {
+ $billableRateService->updateTimeEntriesBillableRateForMember($member);
+ }
+
return new MemberResource($member);
}
--- app/Http/Controllers/Api/V1/OrganizationController.php
@@ -38,11 +38,10 @@ public function update(Organization $organization, OrganizationUpdateRequest $re
$this->checkPermission($organization, 'organizations:update');
$organization->name = $request->input('name');
- $oldBillableRate = $organization->billable_rate;
$organization->billable_rate = $request->getBillableRate();
$organization->save();
- if ($oldBillableRate !== $request->getBillableRate()) {
+ if ($request->getBillableRateUpdateTimeEntries()) {
$billableRateService->updateTimeEntriesBillableRateForOrganization($organization);
}
--- app/Http/Controllers/Api/V1/ProjectController.php
@@ -117,12 +117,11 @@ public function update(Organization $organization, Project $project, ProjectUpda
if ($request->has('is_archived')) {
$project->archived_at = $request->getIsArchived() ? Carbon::now() : null;
}
- $oldBillableRate = $project->billable_rate;
$project->billable_rate = $request->getBillableRate();
$project->client_id = $request->input('client_id');
$project->save();
- if ($oldBillableRate !== $request->getBillableRate()) {
+ if ($request->getBillableRateUpdateTimeEntries()) {
$billableRateService->updateTimeEntriesBillableRateForProject($project);
}
--- app/Http/Controllers/Api/V1/ProjectMemberController.php
@@ -91,11 +91,10 @@ public function store(Organization $organization, Project $project, ProjectMembe
public function update(Organization $organization, ProjectMember $projectMember, ProjectMemberUpdateRequest $request, BillableRateService $billableRateService): JsonResource
{
$this->checkPermission($organization, 'project-members:update', projectMember: $projectMember);
- $oldBillableRate = $projectMember->billable_rate;
$projectMember->billable_rate = $request->getBillableRate();
$projectMember->save();
- if ($oldBillableRate !== $request->getBillableRate()) {
+ if ($request->getBillableRateUpdateTimeEntries()) {
$billableRateService->updateTimeEntriesBillableRateForProjectMember($projectMember);
}
--- app/Http/Controllers/Api/V1/TimeEntryController.php
@@ -257,7 +257,6 @@ public function update(Organization $organization, TimeEntry $timeEntry, TimeEnt
$timeEntry->fill($request->validated());
$timeEntry->description = $request->input('description', $timeEntry->description) ?? '';
- $timeEntry->setComputedAttributeValue('billable_rate');
$timeEntry->save();
return new TimeEntryResource($timeEntry);
--- app/Http/Requests/V1/Member/MemberUpdateRequest.php
@@ -32,6 +32,9 @@ public function rules(): array
'integer',
'min:0',
],
+ 'billable_rate_update_time_entries' => [
+ 'boolean',
+ ],
];
}
@@ -42,6 +45,12 @@ public function getBillableRate(): ?int
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
+ public function getBillableRateUpdateTimeEntries(): bool
+ {
+ return $this->has('billable_rate_update_time_entries') &&
+ $this->boolean('billable_rate_update_time_entries');
+ }
+
public function getRole(): Role
{
return Role::from($this->input('role'));
--- app/Http/Requests/V1/Organization/OrganizationUpdateRequest.php
@@ -31,6 +31,9 @@ public function rules(): array
'integer',
'min:0',
],
+ 'billable_rate_update_time_entries' => [
+ 'boolean',
+ ],
];
}
@@ -40,4 +43,10 @@ public function getBillableRate(): ?int
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
+
+ public function getBillableRateUpdateTimeEntries(): bool
+ {
+ return $this->has('billable_rate_update_time_entries') &&
+ $this->boolean('billable_rate_update_time_entries');
+ }
}
--- app/Http/Requests/V1/Project/ProjectUpdateRequest.php
@@ -62,6 +62,9 @@ public function rules(): array
'integer',
'min:0',
],
+ 'billable_rate_update_time_entries' => [
+ 'boolean',
+ ],
];
}
@@ -78,4 +81,10 @@ public function getBillableRate(): ?int
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
+
+ public function getBillableRateUpdateTimeEntries(): bool
+ {
+ return $this->has('billable_rate_update_time_entries') &&
+ $this->boolean('billable_rate_update_time_entries');
+ }
}
--- app/Http/Requests/V1/ProjectMember/ProjectMemberUpdateRequest.php
@@ -26,6 +26,9 @@ public function rules(): array
'integer',
'min:0',
],
+ 'billable_rate_update_time_entries' => [
+ 'boolean',
+ ],
];
}
@@ -35,4 +38,10 @@ public function getBillableRate(): ?int
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
+
+ public function getBillableRateUpdateTimeEntries(): bool
+ {
+ return $this->has('billable_rate_update_time_entries') &&
+ $this->boolean('billable_rate_update_time_entries');
+ }
}
--- app/Jobs/Test/TestJob.php
@@ -23,7 +23,6 @@ class TestJob implements ShouldQueue
private User $user;
private string $message;
-
private bool $fail;
/**
@@ -38,7 +37,6 @@ public function __construct(User $user, string $message, bool $fail = false)
/**
* Execute the job.
- *
* @throws Exception
*/
public function handle(): void
--- tests/Unit/Endpoint/Api/V1/MemberEndpointTest.php
@@ -91,21 +91,20 @@ public function test_update_member_succeeds_if_data_is_valid(): void
$data = $this->createUserWithPermission([
'members:update',
]);
- $member = Member::factory()->forOrganization($data->organization)->withBillableRate()->role(Role::Admin)->create();
+ $member = Member::factory()->forOrganization($data->organization)->role(Role::Admin)->create();
$this->assertBillableRateServiceIsUnused();
Passport::actingAs($data->user);
// Act
$response = $this->putJson(route('api.v1.members.update', [$data->organization->id, $member]), [
- 'billable_rate' => $member->billable_rate,
+ 'billable_rate' => 10001,
'role' => Role::Employee->value,
]);
// Assert
$response->assertStatus(200);
- $oldBillableRate = $member->billable_rate;
$member->refresh();
- $this->assertSame($oldBillableRate, $member->billable_rate);
+ $this->assertSame(10001, $member->billable_rate);
$this->assertSame(Role::Employee->value, $member->role);
}
@@ -125,6 +124,7 @@ public function test_update_member_can_update_billable_rate_of_member_and_update
// Act
$response = $this->putJson(route('api.v1.members.update', [$data->organization->getKey(), $data->member]), [
'billable_rate' => 10001,
+ 'billable_rate_update_time_entries' => true,
]);
// Assert
--- tests/Unit/Endpoint/Api/V1/OrganizationEndpointTest.php
@@ -142,6 +142,7 @@ public function test_update_endpoint_can_update_billable_rate_of_organization_an
$response = $this->withoutExceptionHandling()->putJson(route('api.v1.organizations.update', [$data->organization->getKey()]), [
'name' => $organizationFake->name,
'billable_rate' => $organizationFake->billable_rate,
+ 'billable_rate_update_time_entries' => true,
]);
// Assert
--- tests/Unit/Endpoint/Api/V1/ProjectEndpointTest.php
@@ -507,7 +507,7 @@ public function test_update_endpoint_updates_project(): void
$this->assertFalse($project->is_archived);
}
- public function test_update_endpoint_does_not_update_billable_rates_of_time_entries_if_billable_rate_is_unchanged(): void
+ public function test_update_endpoint_can_update_projects_billable_rate(): void
{
// Arrange
$data = $this->createUserWithPermission([
@@ -523,7 +523,7 @@ public function test_update_endpoint_does_not_update_billable_rates_of_time_entr
'name' => $projectFake->name,
'color' => $projectFake->color,
'is_billable' => $projectFake->is_billable,
- 'billable_rate' => $project->billable_rate,
+ 'billable_rate' => 10002,
]);
// Assert
@@ -531,7 +531,7 @@ public function test_update_endpoint_does_not_update_billable_rates_of_time_entr
$this->assertDatabaseHas(Project::class, [
'name' => $projectFake->name,
'color' => $projectFake->color,
- 'billable_rate' => $project->billable_rate,
+ 'billable_rate' => 10002,
]);
}
@@ -556,6 +556,7 @@ public function test_update_endpoint_can_update_projects_billable_rate_and_updat
'color' => $projectFake->color,
'is_billable' => $projectFake->is_billable,
'billable_rate' => 10003,
+ 'billable_rate_update_time_entries' => true,
]);
// Assert
--- tests/Unit/Endpoint/Api/V1/ProjectMemberEndpointTest.php
@@ -281,27 +281,28 @@ public function test_update_endpoint_fails_if_user_has_no_permission_to_update_p
$response->assertForbidden();
}
- public function test_update_endpoint_updates_project_member_with_unchanged_billable_rate(): void
+ public function test_update_endpoint_updates_project_member(): void
{
// Arrange
$data = $this->createUserWithPermission([
'project-members:update',
]);
$project = Project::factory()->forOrganization($data->organization)->create();
+ $billableRate = 1001;
$projectMember = ProjectMember::factory()->forProject($project)->create();
$this->assertBillableRateServiceIsUnused();
Passport::actingAs($data->user);
// Act
$response = $this->putJson(route('api.v1.project-members.update', [$data->organization->getKey(), $projectMember->getKey()]), [
- 'billable_rate' => $projectMember->billable_rate,
+ 'billable_rate' => $billableRate,
]);
// Assert
$response->assertStatus(200);
$this->assertDatabaseHas(ProjectMember::class, [
'id' => $projectMember->getKey(),
- 'billable_rate' => $projectMember->billable_rate,
+ 'billable_rate' => $billableRate,
'member_id' => $projectMember->member_id,
]);
}
@@ -325,6 +326,7 @@ public function test_update_endpoints_can_update_billable_rate_and_update_time_e
// Act
$response = $this->putJson(route('api.v1.project-members.update', [$data->organization->getKey(), $projectMember->getKey()]), [
'billable_rate' => $billableRate,
+ 'billable_rate_update_time_entries' => true,
]);
// Assert
|
solidtime
|
solidtime-io
|
PHP
|
PHP
| 5,267
| 278
|
Modern open-source time-tracking app
|
solidtime-io_solidtime
|
CODE_IMPROVEMENT
|
seem like redundant code improved
|
7945499021cd217ca25d0a50c603e6bda22fd3ee
| null |
Sam Hocevar
|
. autoconf
| false
| 1
| 1
| 0
|
--- configure
@@ -592,7 +592,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
-VLC_VERSION=0.1.99
+VLC_VERSION=0.1.99a
VLC_CODENAME=Onatopp
|
videolan_vlc.json
| null | null | null | null | null | null |
videolan_vlc.json
|
CONFIG_CHANGE
|
5, obvious
|
4e4c6b6b276f5a5a8c1193fb2db8ff04b518ad1d
|
2023-03-28 00:50:21
|
schochastics
|
added suggestions in (#45) and fixed error of (#43)
| false
| 3
| 1
| 4
|
--- README.md
@@ -53,7 +53,7 @@ chronologically.
- [Research Exposed: How Empirical Social Science Gets Done in the Digital Age](https://cup.columbia.edu/book/research-exposed/9780231188777) edited by Eszter Hargittai (2020)
- [Retooling Politics: How Digital Media Are Shaping Democracy](https://doi.org/10.1017/9781108297820) by Andreas Jungherr, Gonzalo Rivero, and Daniel Gayo-Avello (2020)
- [Sociologia Digital: uma breve introdução](https://repositorio.ufba.br/bitstream/ri/32746/5/SociologiaDigitalPDF.pdf) by Leonardo Nascimento (2020)
-- [A First Course in Network Science](https://cambridgeuniversitypress.github.io/FirstCourseNetworkScience/) by Filippo Menczer, Santo Fortunato, Clayton A. Davis (2020)
+- [A First Course in Network Science](https://cambridgeuniversitypress.github.io/FirstCourseNetworkScience/) by Filippo Menczer, Santo Fortunato, Clayton A. David (2020)
- [How Humans Judge Machines](https://www.judgingmachines.com/), by Cesar A. Hidalgo, Diana Orghian, Jordi Albo Canals, Filipa De Almeida, Natalia Martin (2021)
- [The Science of Science](https://www.dashunwang.com/book/the-science-of-science), by Dashun Wang and Albert-László Barabási (2021)
- [Doing Computational Social Science - A Practical Introduction](https://uk.sagepub.com/en-gb/eur/doing-computational-social-science/book266031) by John McLevey (2021)
@@ -123,7 +123,6 @@ chronologically.
- [The Summer Institutes in Computational Social Science](https://sicss.io/)
- [Topics in Digital and Computational Demography](https://www.demogr.mpg.de/en/career_6122/international_advanced_studies_in_demography_6682/courses_6931/), PhD level, one week course.
- [NLP + CSS](https://sites.google.com/site/nlpandcss/): a series of workshops on natural language processing (NLP) and computational social science (CSS).
-- [Mediterranean School of Complex Networks](https://mediterraneanschoolcomplex.net/index.html)
### University Course Programs
@@ -216,7 +215,6 @@ Koç University, TUR
- [Soda (Social Data and AI) Lab](https://soda-labo.github.io/), Indiana University, Bloomington, USA
- [Lazerlab](https://lazerlab.net/), Northeastern University, Boston, USA
- [Laboratory for the Modeling of Biological and Socio-Technical Systems (MOBS Lab)](https://www.mobs-lab.org/), Northeastern University, Boston, USA
-- [Network Science Institute (NetSI)](https://www.networkscienceinstitute.org/), Northeastern University, Boston, USA
- [Social data science center](https://socialdatascience.umd.edu/), University of Maryland, College Park, USA
- [Computational Social Science Institute at UMass](https://www.cssi.umass.edu), Massachusetts Amherst, USA
- [Working Group on Computational Social Science](https://datascience.columbia.edu/research/groups/computational-social-science/), Columbia University, New York, USA
|
awesome-computational-social-science
|
gesiscss
|
R
|
R
| 648
| 83
|
A list of awesome resources for Computational Social Science
|
gesiscss_awesome-computational-social-science
|
DOC_CHANGE
|
changes in readme
|
e218e1d1f2db2314f2468d303e1cfe9138d870a7
|
2023-04-11 14:25:10
|
Christian Alexander
|
docs(openapi): match tenant update implementation (#65) update PUT /api/tenants/{external_id} to align with the implementation
| false
| 37
| 1
| 38
|
--- lib/supavisor_web/open_api_schemas.ex
@@ -58,43 +58,7 @@ defmodule SupavisorWeb.OpenApiSchemas do
defmodule TenantCreate do
@moduledoc false
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- type: :object,
- properties: %{
- tenant: %Schema{
- type: :object,
- properties: %{
- db_host: %Schema{type: :string, description: "Database host"},
- db_port: %Schema{type: :integer, description: "Database port"},
- db_user: %Schema{type: :string, description: "Database user"},
- db_database: %Schema{type: :string, description: "Database name"},
- db_password: %Schema{type: :string, description: "Database password"},
- pool_size: %Schema{type: :integer, description: "Pool size"}
- },
- required: [
- :db_host,
- :db_port,
- :db_user,
- :db_database,
- :db_password,
- :pool_size
- ],
- example: %{
- db_host: "localhost",
- db_port: 5432,
- db_user: "db_user",
- db_database: "my_database",
- db_password: "db_password",
- pool_size: 10
- }
- }
- },
- required: [:tenant]
- })
-
- def params(), do: {"Tenant Create Params", "application/json", __MODULE__}
+ def params(), do: {"Tenant Create Params", "application/json", Tenant}
end
defmodule Created do
|
supavisor
|
supabase
|
Elixir
|
Elixir
| 1,869
| 64
|
A cloud-native, multi-tenant Postgres connection pooler.
|
supabase_supavisor
|
NEW_FEAT
|
Obvious
|
4413116cc2f674fb2e1257dabddcf68f30f346d7
|
2023-08-18 23:42:22
|
Jon Shier
|
Apply Latest Formatting (#3760) ### Goals :soccer:
This PR applies the latest SwiftFormat.
| false
| 5
| 5
| 10
|
--- Example/Source/AppDelegate.swift
@@ -24,7 +24,7 @@
import UIKit
-@main
+@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
// MARK: - Properties
--- Source/ServerTrustEvaluation.swift
@@ -1,5 +1,5 @@
//
-// ServerTrustEvaluation.swift
+// ServerTrustPolicy.swift
//
// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
//
--- Tests/AuthenticationInterceptorTests.swift
@@ -288,7 +288,7 @@ final class AuthenticationInterceptorTestCase: BaseTestCase {
}
// MARK: - Tests - Retry
-
+
// If we not using swift-corelibs-foundation where URLRequest to /invalid/path is a fatal error.
#if !canImport(FoundationNetworking)
func testThatInterceptorDoesNotRetryWithoutResponse() {
--- Tests/ServerTrustEvaluatorTests.swift
@@ -1,5 +1,5 @@
//
-// ServerTrustEvaluatorTests.swift
+// ServerTrustPolicyTests.swift
//
// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)
//
--- Tests/TestHelpers.swift
@@ -1,5 +1,5 @@
//
-// TestHelpers.swift
+// HTTPBin.swift
//
// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)
//
|
alamofire
|
alamofire
|
Swift
|
Swift
| 41,720
| 7,598
|
Elegant HTTP Networking in Swift
|
alamofire_alamofire
|
PERF_IMPROVEMENT
|
Alamofire to require Swift 5.7.1. Project structure to break apart large Request.swift file and consolidate various Request subclasses into their own files.
|
ed884703f9d7f6850aaf2ccec877c084ba13ae9e
|
2023-01-13 04:40:22
|
Chase Granberry
|
Init README.md
| false
| 70
| 0
| 70
|
--- README.md
@@ -1,70 +0,0 @@
-# pg_edge
-
-## Overview
-
-pg_edge (name tbd) is a scalable cloud-native Postgres connection pooler capable of supporting millions of Postgres end-client connections into a stateful pool of native Postgres database connections.
-
-For Postgres clients, goal is to provide Postgres connection pools as a service such that clients don't have to worry about connection limits of their Postgres database.
-
-For managers of Postgres databases, pg_edge should make managing Postgres clusters easy by handling Postgres high-availability cluster configuration and state.
-
-## Postgres Features
-
-**Features not listed in priority**
-
-- Fast
- - Within 90% throughput as compared to `pgbouncer` running `pgbench` locally
-- Scalable
- - 1 million Postgres connections on a cluster
- - 250_000 idle connections on a single 16 core node with 64GB of ram
-- Multi-tenant
- - Connect to multiple different Postgres instances/clusters
-- Load balancing
- - Queries can be load balanced across read-replicas
- - Load balancing is independant of Postgres high-availability management (see below)
-- Query caching
- - Query results are optionally cached in the pool cluster and returned before hitting the tenant database
-- Transaction pooling
- - Like pgbouncer
-- Session pooling
- - Like pgbouncer
-- Multi-protocol Postgres query interface
- - Postgres binary
- - HTTPS
- - Websocket
-- Connection buffering
- - Supports a fast (minutes) tenant Postgres database restart without interupting clients (aside from query latency)
-- High-availability
- - When deployed as a pg_edge cluster and a pg_edge node dies connection pools should be quickly spun up or already available on other nodes when clients reconnect
-- Postgres high-availability management
- - Primary database election on primary failure
- - Health checks
- - Push button read-replica configuration
- - What else?
-
-## General Features
-
-- Cloud-native
- - Cluster-able
- - Cluster should handle dynamic resizing
- - Support rolling and blue/green deployment strategies
- - Self-heal if instances come and go
- - NOT run in a serverless environment
- - NOT dependant on Kubernetes
-- Observability
- - Easily understand throughput by tenant, tenant database or individual connection
- - Prometheus `/metrics` endpoint
- - Admin UI to add tenants, view metrics, sort tenants by throughput, ban tenants, etc
-- Config as code
- - Not noly for the pg_edge cluster but tenant databases and tenant database clusters as well
- - Pulumi / terraform support
-
-## Inspiration
-
-- pgbouncer
-- stolon
-- pgcat
-
-## Installation
-
-tbd
|
supavisor
|
supabase
|
Elixir
|
Elixir
| 1,869
| 64
|
A cloud-native, multi-tenant Postgres connection pooler.
|
supabase_supavisor
|
DOC_CHANGE
|
changes in readme
|
d5bac12f6073f98128e048dbc45ebd8f9f60111d
|
2023-09-13 00:30:39
|
keshida
|
fix: modify a function name in array_stack.js(ts) and array_queue.js(ts) (#739) * Update array_stack.js
判空函数名称有歧义
* Update array_stack.js
* Update array_queue.js
* Update array_stack.ts
* Update array_queue.ts
---------
Co-authored-by: Yudong Jin <[email protected]>
| false
| 18
| 18
| 36
|
--- codes/javascript/chapter_stack_and_queue/array_queue.js
@@ -25,7 +25,7 @@ class ArrayQueue {
}
/* 判断队列是否为空 */
- isEmpty() {
+ empty() {
return this.#queSize === 0;
}
@@ -54,7 +54,7 @@ class ArrayQueue {
/* 访问队首元素 */
peek() {
- if (this.isEmpty()) throw new Error('队列为空');
+ if (this.empty()) throw new Error('队列为空');
return this.#nums[this.#front];
}
@@ -95,8 +95,8 @@ const size = queue.size;
console.log('队列长度 size = ' + size);
/* 判断队列是否为空 */
-const isEmpty = queue.isEmpty();
-console.log('队列是否为空 = ' + isEmpty);
+const empty = queue.empty();
+console.log('队列是否为空 = ' + empty);
/* 测试环形数组 */
for (let i = 0; i < 10; i++) {
--- codes/javascript/chapter_stack_and_queue/array_stack.js
@@ -17,7 +17,7 @@ class ArrayStack {
}
/* 判断栈是否为空 */
- isEmpty() {
+ empty() {
return this.#stack.length === 0;
}
@@ -28,13 +28,13 @@ class ArrayStack {
/* 出栈 */
pop() {
- if (this.isEmpty()) throw new Error('栈为空');
+ if (this.empty()) throw new Error('栈为空');
return this.#stack.pop();
}
/* 访问栈顶元素 */
top() {
- if (this.isEmpty()) throw new Error('栈为空');
+ if (this.empty()) throw new Error('栈为空');
return this.#stack[this.#stack.length - 1];
}
@@ -71,5 +71,5 @@ const size = stack.size;
console.log('栈的长度 size = ' + size);
/* 判断是否为空 */
-const isEmpty = stack.isEmpty();
-console.log('栈是否为空 = ' + isEmpty);
+const empty = stack.empty();
+console.log('栈是否为空 = ' + empty);
--- codes/typescript/chapter_stack_and_queue/array_queue.ts
@@ -26,7 +26,7 @@ class ArrayQueue {
}
/* 判断队列是否为空 */
- isEmpty(): boolean {
+ empty(): boolean {
return this.queSize === 0;
}
@@ -55,7 +55,7 @@ class ArrayQueue {
/* 访问队首元素 */
peek(): number {
- if (this.isEmpty()) throw new Error('队列为空');
+ if (this.empty()) throw new Error('队列为空');
return this.nums[this.front];
}
@@ -96,8 +96,8 @@ const size = queue.size;
console.log('队列长度 size = ' + size);
/* 判断队列是否为空 */
-const isEmpty = queue.isEmpty();
-console.log('队列是否为空 = ' + isEmpty);
+const empty = queue.empty();
+console.log('队列是否为空 = ' + empty);
/* 测试环形数组 */
for (let i = 0; i < 10; i++) {
--- codes/typescript/chapter_stack_and_queue/array_stack.ts
@@ -17,7 +17,7 @@ class ArrayStack {
}
/* 判断栈是否为空 */
- isEmpty(): boolean {
+ empty(): boolean {
return this.stack.length === 0;
}
@@ -28,13 +28,13 @@ class ArrayStack {
/* 出栈 */
pop(): number | undefined {
- if (this.isEmpty()) throw new Error('栈为空');
+ if (this.empty()) throw new Error('栈为空');
return this.stack.pop();
}
/* 访问栈顶元素 */
top(): number | undefined {
- if (this.isEmpty()) throw new Error('栈为空');
+ if (this.empty()) throw new Error('栈为空');
return this.stack[this.stack.length - 1];
}
@@ -71,7 +71,7 @@ const size = stack.size;
console.log('栈的长度 size = ' + size);
/* 判断是否为空 */
-const isEmpty = stack.isEmpty();
-console.log('栈是否为空 = ' + isEmpty);
+const empty = stack.empty();
+console.log('栈是否为空 = ' + empty);
export {};
|
hello-algo
|
krahets
|
Java
|
Java
| 109,696
| 13,651
|
《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing
|
krahets_hello-algo
|
BUG_FIX
|
obvious
|
24130a4e6361fa72f7d1062b5a2fef8ea3e31e17
|
2023-03-10 22:49:21
|
Julien Déramond
|
Fix typo in `utilities/colors.md` (#38194)
| false
| 1
| 1
| 2
|
--- site/content/docs/5.3/utilities/colors.md
@@ -42,7 +42,7 @@ Color utilities like `.text-*` that generated from our original `$theme-colors`
{{< /callout >}}
{{< callout warning >}}
-**Deprecation:** With the addition of the expanded theme colors and variables, the `.text-muted` utility has been deprecated as of v5.3.0. Its default value has also been reassigned to the new `--bs-secondary-color` CSS variable to better support color modes. It will be removed in v6.0.0.
+**Deprecation:** With the addition of the expanded theme colors and variables, the `.text-muted` utility has been deprecated as of v5.3.0. Its default value has also has been reassigned to the new `--bs-secondary-color` CSS variable to better support color modes. It will be removed in v6.0.0.
{{< /callout >}}
## Opacity
|
bootstrap
|
twbs
|
JavaScript
|
JavaScript
| 171,693
| 79,045
|
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
|
twbs_bootstrap
|
DOC_CHANGE
|
Obvious
|
71a1a97a9aa7b23a0c0f21b2f9e437b051cb5238
|
2023-11-08 21:58:07
|
Leonard Hecker
|
Fix deadlocks due to holding locks across WriteFile calls (#16224) This fixes a number of bugs introduced in 4370da9, all of which are of
the same kind: Holding the terminal lock across `WriteFile` calls into
the ConPTY pipe. This is problematic, because the pipe has a tiny buffer
size of just 4KiB and ConPTY may respond on its output pipe, before the
entire buffer given to `WriteFile` has been emptied. When the ConPTY
output thread then tries to acquire the terminal lock to begin parsing
the VT output, we get ourselves a proper deadlock (cross process too!).
The solution is to tease `Terminal` further apart into code that is
thread-safe and code that isn't. Functions like `SendKeyEvent` so far
have mixed them into one, because when they get called by `ControlCore`
they both, processed the data (not thread-safe as it accesses VT state)
and also sent that data back into `ControlCore` through a callback
which then indirectly called into the `ConptyConnection` which calls
`WriteFile`. Instead, we now return the data that needs to be sent from
these functions, and `ControlCore` is free to release the lock and
then call into the connection, which may then block indefinitely.
## Validation Steps Performed
* Start nvim in WSL
* Press `i` to enter the regular Insert mode
* Paste 1MB of text
* Doesn't deadlock ✅
| false
| 270
| 205
| 475
|
--- src/cascadia/TerminalControl/ControlCore.cpp
@@ -10,11 +10,11 @@
#include <DefaultSettings.h>
#include <unicode.hpp>
-#include <utils.hpp>
#include <WinUser.h>
#include <LibraryResources.h>
#include "EventArgs.h"
+#include "../../types/inc/GlyphWidth.hpp"
#include "../../buffer/out/search.h"
#include "../../renderer/atlas/AtlasEngine.h"
#include "../../renderer/dx/DxRenderer.hpp"
@@ -443,15 +443,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - <none>
void ControlCore::_sendInputToConnection(std::wstring_view wstr)
{
- if (wstr.empty())
- {
- return;
- }
-
- // The connection may call functions like WriteFile() which may block indefinitely.
- // It's important we don't hold any mutexes across such calls.
- _terminal->_assertUnlocked();
-
if (_isReadOnly)
{
_raiseReadOnlyWarning();
@@ -501,17 +492,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_handleControlC();
}
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForReading();
- out = _terminal->SendCharEvent(ch, scanCode, modifiers);
- }
- if (out)
- {
- _sendInputToConnection(*out);
- return true;
- }
- return false;
+ const auto lock = _terminal->LockForWriting();
+ return _terminal->SendCharEvent(ch, scanCode, modifiers);
}
void ControlCore::_handleControlC()
@@ -620,56 +602,46 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const ControlKeyStates modifiers,
const bool keyDown)
{
- if (!vkey)
- {
- return true;
- }
+ const auto lock = _terminal->LockForWriting();
- TerminalInput::OutputType out;
+ // Update the selection, if it's present
+ // GH#8522, GH#3758 - Only modify the selection on key _down_. If we
+ // modify on key up, then there's chance that we'll immediately dismiss
+ // a selection created by an action bound to a keydown.
+ if (_shouldTryUpdateSelection(vkey) && keyDown)
{
- const auto lock = _terminal->LockForWriting();
-
- // Update the selection, if it's present
- // GH#8522, GH#3758 - Only modify the selection on key _down_. If we
- // modify on key up, then there's chance that we'll immediately dismiss
- // a selection created by an action bound to a keydown.
- if (_shouldTryUpdateSelection(vkey) && keyDown)
+ // try to update the selection
+ if (const auto updateSlnParams{ _terminal->ConvertKeyEventToUpdateSelectionParams(modifiers, vkey) })
{
- // try to update the selection
- if (const auto updateSlnParams{ _terminal->ConvertKeyEventToUpdateSelectionParams(modifiers, vkey) })
- {
- _terminal->UpdateSelection(updateSlnParams->first, updateSlnParams->second, modifiers);
- _updateSelectionUI();
- return true;
- }
-
- // GH#8791 - don't dismiss selection if Windows key was also pressed as a key-combination.
- if (!modifiers.IsWinPressed())
- {
- _terminal->ClearSelection();
- _updateSelectionUI();
- }
+ _terminal->UpdateSelection(updateSlnParams->first, updateSlnParams->second, modifiers);
+ _updateSelectionUI();
+ return true;
+ }
- // When there is a selection active, escape should clear it and NOT flow through
- // to the terminal. With any other keypress, it should clear the selection AND
- // flow through to the terminal.
- if (vkey == VK_ESCAPE)
- {
- return true;
- }
+ // GH#8791 - don't dismiss selection if Windows key was also pressed as a key-combination.
+ if (!modifiers.IsWinPressed())
+ {
+ _terminal->ClearSelection();
+ _updateSelectionUI();
}
- // If the terminal translated the key, mark the event as handled.
- // This will prevent the system from trying to get the character out
- // of it and sending us a CharacterReceived event.
- out = _terminal->SendKeyEvent(vkey, scanCode, modifiers, keyDown);
- }
- if (out)
- {
- _sendInputToConnection(*out);
- return true;
+ // When there is a selection active, escape should clear it and NOT flow through
+ // to the terminal. With any other keypress, it should clear the selection AND
+ // flow through to the terminal.
+ if (vkey == VK_ESCAPE)
+ {
+ return true;
+ }
}
- return false;
+
+ // If the terminal translated the key, mark the event as handled.
+ // This will prevent the system from trying to get the character out
+ // of it and sending us a CharacterReceived event.
+ return vkey ? _terminal->SendKeyEvent(vkey,
+ scanCode,
+ modifiers,
+ keyDown) :
+ true;
}
bool ControlCore::SendMouseEvent(const til::point viewportPos,
@@ -678,17 +650,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const short wheelDelta,
const TerminalInput::MouseButtonState state)
{
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForReading();
- out = _terminal->SendMouseEvent(viewportPos, uiButton, states, wheelDelta, state);
- }
- if (out)
- {
- _sendInputToConnection(*out);
- return true;
- }
- return false;
+ const auto lock = _terminal->LockForWriting();
+ return _terminal->SendMouseEvent(viewportPos, uiButton, states, wheelDelta, state);
}
void ControlCore::UserScrollViewport(const int viewTop)
@@ -1361,19 +1324,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// before sending it over the terminal's connection.
void ControlCore::PasteText(const winrt::hstring& hstr)
{
- using namespace ::Microsoft::Console::Utils;
-
- auto filtered = FilterStringForPaste(hstr, CarriageReturnNewline | ControlCodes);
- if (BracketedPasteEnabled())
- {
- filtered.insert(0, L"\x1b[200~");
- filtered.append(L"\x1b[201~");
- }
-
- // It's important to not hold the terminal lock while calling this function as sending the data may take a long time.
- _sendInputToConnection(filtered);
-
const auto lock = _terminal->LockForWriting();
+ _terminal->WritePastedText(hstr);
_terminal->ClearSelection();
_updateSelectionUI();
_terminal->TrySnapOnInput();
@@ -1942,27 +1894,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto endPoint = goRight ? clampedClick : cursorPos;
const auto delta = _terminal->GetTextBuffer().GetCellDistance(startPoint, endPoint);
- const WORD key = goRight ? VK_RIGHT : VK_LEFT;
-
- std::wstring buffer;
- const auto append = [&](TerminalInput::OutputType&& out) {
- if (out)
- {
- buffer.append(std::move(*out));
- }
- };
+ const WORD key = goRight ? VK_RIGHT : VK_LEFT;
// Send an up and a down once per cell. This won't
// accurately handle wide characters, or continuation
// prompts, or cases where a single escape character in the
// command (e.g. ^[) takes up two cells.
for (size_t i = 0u; i < delta; i++)
{
- append(_terminal->SendKeyEvent(key, 0, {}, true));
- append(_terminal->SendKeyEvent(key, 0, {}, false));
+ _terminal->SendKeyEvent(key, 0, {}, true);
+ _terminal->SendKeyEvent(key, 0, {}, false);
}
-
- _sendInputToConnection(buffer);
}
}
}
@@ -1973,6 +1915,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - Updates the renderer's representation of the selection as well as the selection marker overlay in TermControl
void ControlCore::_updateSelectionUI()
{
+ const auto lock = _terminal->LockForWriting();
_renderer->TriggerSelection();
// only show the markers if we're doing a keyboard selection or in mark mode
const bool showMarkers{ _terminal->SelectionMode() >= ::Microsoft::Terminal::Core::Terminal::SelectionInteractionMode::Keyboard };
@@ -2304,17 +2247,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ControlCore::_focusChanged(bool focused)
{
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForReading();
- out = _terminal->FocusChanged(focused);
- }
- if (out && !out->empty())
- {
- // _sendInputToConnection() asserts that we aren't in focus mode,
- // but window focus events are always fine to send.
- _connection.WriteInput(*out);
- }
+ // GH#13461 - temporarily turn off read-only mode, send the focus event,
+ // then turn it back on. Even in focus mode, focus events are fine to
+ // send. We don't want to pop a warning every time the control is
+ // focused.
+ const auto previous = std::exchange(_isReadOnly, false);
+ const auto restore = wil::scope_exit([&]() { _isReadOnly = previous; });
+ const auto lock = _terminal->LockForWriting();
+ _terminal->FocusChanged(focused);
}
bool ControlCore::_isBackgroundTransparent()
--- src/cascadia/TerminalControl/HwndTerminal.cpp
@@ -272,7 +272,7 @@ void HwndTerminal::RegisterScrollCallback(std::function<void(int, int, int)> cal
void HwndTerminal::_WriteTextToConnection(const std::wstring_view input) noexcept
{
- if (input.empty() || !_pfnWriteCallback)
+ if (!_pfnWriteCallback)
{
return;
}
@@ -758,17 +758,8 @@ try
WI_IsFlagSet(GetKeyState(VK_RBUTTON), KeyPressed)
};
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForReading();
- out = _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta, state);
- }
- if (out)
- {
- _WriteTextToConnection(*out);
- return true;
- }
- return false;
+ const auto lock = _terminal->LockForWriting();
+ return _terminal->SendMouseEvent(cursorPosition / fontSize, uMsg, getControlKeyState(), wheelDelta, state);
}
catch (...)
{
@@ -793,16 +784,8 @@ try
{
_uiaProvider->RecordKeyEvent(vkey);
}
-
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForReading();
- out = _terminal->SendKeyEvent(vkey, scanCode, modifiers, keyDown);
- }
- if (out)
- {
- _WriteTextToConnection(*out);
- }
+ const auto lock = _terminal->LockForWriting();
+ _terminal->SendKeyEvent(vkey, scanCode, modifiers, keyDown);
}
CATCH_LOG();
@@ -814,39 +797,31 @@ try
return;
}
- TerminalInput::OutputType out;
- {
- const auto lock = _terminal->LockForWriting();
-
- if (_terminal->IsSelectionActive())
- {
- _ClearSelection();
- if (ch == UNICODE_ESC)
- {
- // ESC should clear any selection before it triggers input.
- // Other characters pass through.
- return;
- }
- }
+ const auto lock = _terminal->LockForWriting();
- if (ch == UNICODE_TAB)
+ if (_terminal->IsSelectionActive())
+ {
+ _ClearSelection();
+ if (ch == UNICODE_ESC)
{
- // TAB was handled as a keydown event (cf. Terminal::SendKeyEvent)
+ // ESC should clear any selection before it triggers input.
+ // Other characters pass through.
return;
}
+ }
- auto modifiers = getControlKeyState();
- if (WI_IsFlagSet(flags, ENHANCED_KEY))
- {
- modifiers |= ControlKeyStates::EnhancedKey;
- }
-
- out = _terminal->SendCharEvent(ch, scanCode, modifiers);
+ if (ch == UNICODE_TAB)
+ {
+ // TAB was handled as a keydown event (cf. Terminal::SendKeyEvent)
+ return;
}
- if (out)
+
+ auto modifiers = getControlKeyState();
+ if (WI_IsFlagSet(flags, ENHANCED_KEY))
{
- _WriteTextToConnection(*out);
+ modifiers |= ControlKeyStates::EnhancedKey;
}
+ _terminal->SendCharEvent(ch, scanCode, modifiers);
}
CATCH_LOG();
--- src/cascadia/TerminalCore/ITerminalInput.hpp
@@ -16,10 +16,9 @@ namespace Microsoft::Terminal::Core
ITerminalInput& operator=(const ITerminalInput&) = default;
ITerminalInput& operator=(ITerminalInput&&) = default;
- virtual [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendKeyEvent(const WORD vkey, const WORD scanCode, const ControlKeyStates states, const bool keyDown) = 0;
- virtual [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendMouseEvent(const til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) = 0;
- virtual [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) = 0;
- virtual [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType FocusChanged(const bool focused) = 0;
+ virtual bool SendKeyEvent(const WORD vkey, const WORD scanCode, const ControlKeyStates states, const bool keyDown) = 0;
+ virtual bool SendMouseEvent(const til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) = 0;
+ virtual bool SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) = 0;
[[nodiscard]] virtual HRESULT UserResize(const til::size size) noexcept = 0;
virtual void UserScrollViewport(const int viewTop) = 0;
@@ -27,6 +26,8 @@ namespace Microsoft::Terminal::Core
virtual void TrySnapOnInput() = 0;
+ virtual void FocusChanged(const bool focused) = 0;
+
protected:
ITerminalInput() = default;
};
--- src/cascadia/TerminalCore/Terminal.cpp
@@ -30,15 +30,6 @@ Terminal::Terminal()
_renderSettings.SetColorAlias(ColorAlias::DefaultBackground, TextColor::DEFAULT_BACKGROUND, RGB(0, 0, 0));
}
-#pragma warning(suppress : 26455) // default constructor is throwing, too much effort to rearrange at this time.
-Terminal::Terminal(TestDummyMarker) :
- Terminal{}
-{
-#ifndef NDEBUG
- _suppressLockChecks = true;
-#endif
-}
-
void Terminal::Create(til::size viewportSize, til::CoordType scrollbackLines, Renderer& renderer)
{
_mutableViewport = Viewport::FromDimensions({ 0, 0 }, viewportSize);
@@ -434,6 +425,24 @@ void Terminal::Write(std::wstring_view stringView)
}
}
+void Terminal::WritePastedText(std::wstring_view stringView)
+{
+ const auto option = ::Microsoft::Console::Utils::FilterOption::CarriageReturnNewline |
+ ::Microsoft::Console::Utils::FilterOption::ControlCodes;
+
+ auto filtered = ::Microsoft::Console::Utils::FilterStringForPaste(stringView, option);
+ if (IsXtermBracketedPasteModeEnabled())
+ {
+ filtered.insert(0, L"\x1b[200~");
+ filtered.append(L"\x1b[201~");
+ }
+
+ if (_pfnWriteInput)
+ {
+ _pfnWriteInput(filtered);
+ }
+}
+
// Method Description:
// - Attempts to snap to the bottom of the buffer, if SnapOnInput is true. Does
// nothing if SnapOnInput is set to false, or we're already at the bottom of
@@ -597,10 +606,10 @@ std::optional<PointTree::interval> Terminal::GetHyperlinkIntervalFromViewportPos
// Return Value:
// - true if we translated the key event, and it should not be processed any further.
// - false if we did not translate the key, and it should be processed into a character.
-TerminalInput::OutputType Terminal::SendKeyEvent(const WORD vkey,
- const WORD scanCode,
- const ControlKeyStates states,
- const bool keyDown)
+bool Terminal::SendKeyEvent(const WORD vkey,
+ const WORD scanCode,
+ const ControlKeyStates states,
+ const bool keyDown)
{
// GH#6423 - don't snap on this key if the key that was pressed was a
// modifier key. We'll wait for a real keystroke to snap to the bottom.
@@ -618,7 +627,7 @@ TerminalInput::OutputType Terminal::SendKeyEvent(const WORD vkey,
// GH#7064
if (vkey == 0 || vkey >= 0xff)
{
- return {};
+ return false;
}
// While not explicitly permitted, a wide range of software, including Windows' own touch keyboard,
@@ -628,7 +637,7 @@ TerminalInput::OutputType Terminal::SendKeyEvent(const WORD vkey,
const auto sc = scanCode ? scanCode : _ScanCodeFromVirtualKey(vkey);
if (sc == 0)
{
- return {};
+ return false;
}
const auto isAltOnlyPressed = states.IsAltPressed() && !states.IsCtrlPressed();
@@ -656,11 +665,11 @@ TerminalInput::OutputType Terminal::SendKeyEvent(const WORD vkey,
// See the method description for more information.
if (keyDown && !isAltOnlyPressed && vkey != VK_TAB && ch != UNICODE_NULL)
{
- return {};
+ return false;
}
const auto keyEv = SynthesizeKeyEvent(keyDown, 1, vkey, sc, ch, states.Value());
- return _getTerminalInput().HandleKey(keyEv);
+ return _handleTerminalInputResult(_getTerminalInput().HandleKey(keyEv));
}
// Method Description:
@@ -677,14 +686,14 @@ TerminalInput::OutputType Terminal::SendKeyEvent(const WORD vkey,
// Return Value:
// - true if we translated the key event, and it should not be processed any further.
// - false if we did not translate the key, and it should be processed into a character.
-TerminalInput::OutputType Terminal::SendMouseEvent(til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const TerminalInput::MouseButtonState state)
+bool Terminal::SendMouseEvent(til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const TerminalInput::MouseButtonState state)
{
// GH#6401: VT applications should be able to receive mouse events from outside the
// terminal buffer. This is likely to happen when the user drags the cursor offscreen.
// We shouldn't throw away perfectly good events when they're offscreen, so we just
// clamp them to be within the range [(0, 0), (W, H)].
_GetMutableViewport().ToOrigin().Clamp(viewportPos);
- return _getTerminalInput().HandleMouse(viewportPos, uiButton, GET_KEYSTATE_WPARAM(states.Value()), wheelDelta, state);
+ return _handleTerminalInputResult(_getTerminalInput().HandleMouse(viewportPos, uiButton, GET_KEYSTATE_WPARAM(states.Value()), wheelDelta, state));
}
// Method Description:
@@ -699,7 +708,7 @@ TerminalInput::OutputType Terminal::SendMouseEvent(til::point viewportPos, const
// Return Value:
// - true if we translated the character event, and it should not be processed any further.
// - false otherwise.
-TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states)
+bool Terminal::SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states)
{
auto vkey = _TakeVirtualKeyFromLastKeyEvent(scanCode);
if (vkey == 0 && scanCode != 0)
@@ -737,7 +746,7 @@ TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD s
}
const auto keyDown = SynthesizeKeyEvent(true, 1, vkey, scanCode, ch, states.Value());
- return _getTerminalInput().HandleKey(keyDown);
+ return _handleTerminalInputResult(_getTerminalInput().HandleKey(keyDown));
}
// Method Description:
@@ -748,9 +757,9 @@ TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD s
// - focused: true if we're focused, false otherwise.
// Return Value:
// - none
-TerminalInput::OutputType Terminal::FocusChanged(const bool focused)
+void Terminal::FocusChanged(const bool focused)
{
- return _getTerminalInput().HandleFocus(focused);
+ _handleTerminalInputResult(_getTerminalInput().HandleFocus(focused));
}
// Method Description:
@@ -873,6 +882,20 @@ catch (...)
return UNICODE_INVALID;
}
+[[maybe_unused]] bool Terminal::_handleTerminalInputResult(TerminalInput::OutputType&& out) const
+{
+ if (out)
+ {
+ const auto& str = *out;
+ if (_pfnWriteInput && !str.empty())
+ {
+ _pfnWriteInput(str);
+ }
+ return true;
+ }
+ return false;
+}
+
// Method Description:
// - It's possible for a single scan code on a keyboard to
// produce different key codes depending on the keyboard state.
@@ -910,7 +933,7 @@ WORD Terminal::_TakeVirtualKeyFromLastKeyEvent(const WORD scanCode) noexcept
void Terminal::_assertLocked() const noexcept
{
#ifndef NDEBUG
- if (!_suppressLockChecks && !_readWriteLock.is_locked())
+ if (!_readWriteLock.is_locked())
{
// __debugbreak() has the benefit over assert() that the debugger jumps right here to this line.
// That way there's no need to first click any dialogues, etc. The disadvantage of course is that the
@@ -920,16 +943,6 @@ void Terminal::_assertLocked() const noexcept
#endif
}
-void Terminal::_assertUnlocked() const noexcept
-{
-#ifndef NDEBUG
- if (!_suppressLockChecks && _readWriteLock.is_locked())
- {
- __debugbreak();
- }
-#endif
-}
-
// Method Description:
// - Acquire a read lock on the terminal.
// Return Value:
--- src/cascadia/TerminalCore/Terminal.hpp
@@ -60,10 +60,6 @@ class Microsoft::Terminal::Core::Terminal final :
using RenderSettings = Microsoft::Console::Render::RenderSettings;
public:
- struct TestDummyMarker
- {
- };
-
static constexpr bool IsInputKey(WORD vkey)
{
return vkey != VK_CONTROL &&
@@ -81,7 +77,6 @@ public:
}
Terminal();
- Terminal(TestDummyMarker);
void Create(til::size viewportSize,
til::CoordType scrollbackLines,
@@ -103,8 +98,9 @@ public:
// Write comes from the PTY and goes to our parser to be stored in the output buffer
void Write(std::wstring_view stringView);
- void _assertLocked() const noexcept;
- void _assertUnlocked() const noexcept;
+ // WritePastedText comes from our input and goes back to the PTY's input channel
+ void WritePastedText(std::wstring_view stringView);
+
[[nodiscard]] std::unique_lock<til::recursive_ticket_lock> LockForReading() const noexcept;
[[nodiscard]] std::unique_lock<til::recursive_ticket_lock> LockForWriting() noexcept;
til::recursive_ticket_lock_suspension SuspendLock() noexcept;
@@ -171,10 +167,9 @@ public:
#pragma region ITerminalInput
// These methods are defined in Terminal.cpp
- [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendKeyEvent(const WORD vkey, const WORD scanCode, const Microsoft::Terminal::Core::ControlKeyStates states, const bool keyDown) override;
- [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendMouseEvent(const til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) override;
- [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) override;
- [[nodiscard]] ::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType FocusChanged(const bool focused) override;
+ bool SendKeyEvent(const WORD vkey, const WORD scanCode, const Microsoft::Terminal::Core::ControlKeyStates states, const bool keyDown) override;
+ bool SendMouseEvent(const til::point viewportPos, const unsigned int uiButton, const ControlKeyStates states, const short wheelDelta, const Microsoft::Console::VirtualTerminal::TerminalInput::MouseButtonState state) override;
+ bool SendCharEvent(const wchar_t ch, const WORD scanCode, const ControlKeyStates states) override;
[[nodiscard]] HRESULT UserResize(const til::size viewportSize) noexcept override;
void UserScrollViewport(const int viewTop) override;
@@ -184,6 +179,8 @@ public:
bool IsTrackingMouseInput() const noexcept;
bool ShouldSendAlternateScroll(const unsigned int uiButton, const int32_t delta) const noexcept;
+ void FocusChanged(const bool focused) override;
+
std::wstring GetHyperlinkAtViewportPosition(const til::point viewportPos);
std::wstring GetHyperlinkAtBufferPosition(const til::point bufferPos);
uint16_t GetHyperlinkIdAtViewportPosition(const til::point viewportPos);
@@ -312,10 +309,6 @@ public:
const TextBuffer::TextAndColor RetrieveSelectedTextFromBuffer(bool trimTrailingWhitespace);
#pragma endregion
-#ifndef NDEBUG
- bool _suppressLockChecks = false;
-#endif
-
private:
std::function<void(std::wstring_view)> _pfnWriteInput;
std::function<void()> _pfnWarningBell;
@@ -438,9 +431,11 @@ private:
static WORD _VirtualKeyFromCharacter(const wchar_t ch) noexcept;
static wchar_t _CharacterFromKeyEvent(const WORD vkey, const WORD scanCode, const ControlKeyStates states) noexcept;
+ [[maybe_unused]] bool _handleTerminalInputResult(::Microsoft::Console::VirtualTerminal::TerminalInput::OutputType&& out) const;
void _StoreKeyEvent(const WORD vkey, const WORD scanCode) noexcept;
WORD _TakeVirtualKeyFromLastKeyEvent(const WORD scanCode) noexcept;
+ void _assertLocked() const noexcept;
Console::VirtualTerminal::TerminalInput& _getTerminalInput() noexcept;
const Console::VirtualTerminal::TerminalInput& _getTerminalInput() const noexcept;
--- src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
@@ -87,7 +87,7 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final
TEST_METHOD_SETUP(MethodSetup)
{
// STEP 1: Set up the Terminal
- term = std::make_unique<Terminal>(Terminal::TestDummyMarker{});
+ term = std::make_unique<Terminal>();
emptyRenderer = std::make_unique<DummyRenderer>(term.get());
term->Create({ TerminalViewWidth, TerminalViewHeight }, 100, *emptyRenderer);
--- src/cascadia/UnitTests_TerminalCore/InputTest.cpp
@@ -5,33 +5,40 @@
#include <WexTestClass.h>
#include "../cascadia/TerminalCore/Terminal.hpp"
+#include "../renderer/inc/DummyRenderer.hpp"
+#include "consoletaeftemplates.hpp"
using namespace WEX::Logging;
using namespace WEX::TestExecution;
using namespace Microsoft::Terminal::Core;
-
-constexpr Microsoft::Console::VirtualTerminal::TerminalInput::OutputType unhandled()
-{
- return {};
-}
-
-constexpr Microsoft::Console::VirtualTerminal::TerminalInput::OutputType escChar(const wchar_t wch)
-{
- const wchar_t buffer[2]{ L'\x1b', wch };
- return { { &buffer[0], 2 } };
-}
+using namespace Microsoft::Console::Render;
namespace TerminalCoreUnitTests
{
class InputTest
{
TEST_CLASS(InputTest);
+ TEST_CLASS_SETUP(ClassSetup)
+ {
+ DummyRenderer renderer;
+ term.Create({ 100, 100 }, 0, renderer);
+ auto inputFn = std::bind(&InputTest::_VerifyExpectedInput, this, std::placeholders::_1);
+ term.SetWriteInputCallback(inputFn);
+ return true;
+ };
TEST_METHOD(AltShiftKey);
TEST_METHOD(InvalidKeyEvent);
- Terminal term{ Terminal::TestDummyMarker{} };
+ void _VerifyExpectedInput(std::wstring_view actualInput)
+ {
+ VERIFY_ARE_EQUAL(expectedinput.size(), actualInput.size());
+ VERIFY_ARE_EQUAL(expectedinput, actualInput);
+ };
+
+ Terminal term{};
+ std::wstring expectedinput{};
};
void InputTest::AltShiftKey()
@@ -39,17 +46,21 @@ namespace TerminalCoreUnitTests
// Tests GH:637
// Verify that Alt+a generates a lowercase a on the input
- VERIFY_ARE_EQUAL(escChar(L'a'), term.SendCharEvent(L'a', 0, ControlKeyStates::LeftAltPressed));
+ expectedinput = L"\x1b"
+ "a";
+ VERIFY_IS_TRUE(term.SendCharEvent(L'a', 0, ControlKeyStates::LeftAltPressed));
// Verify that Alt+shift+a generates a uppercase a on the input
- VERIFY_ARE_EQUAL(escChar(L'A'), term.SendCharEvent(L'A', 0, ControlKeyStates::LeftAltPressed | ControlKeyStates::ShiftPressed));
+ expectedinput = L"\x1b"
+ "A";
+ VERIFY_IS_TRUE(term.SendCharEvent(L'A', 0, ControlKeyStates::LeftAltPressed | ControlKeyStates::ShiftPressed));
}
void InputTest::InvalidKeyEvent()
{
// Certain applications like AutoHotKey and its keyboard remapping feature,
// send us key events using SendInput() whose values are outside of the valid range.
- VERIFY_ARE_EQUAL(unhandled(), term.SendKeyEvent(0, 123, {}, true));
- VERIFY_ARE_EQUAL(unhandled(), term.SendKeyEvent(255, 123, {}, true));
+ VERIFY_IS_FALSE(term.SendKeyEvent(0, 123, {}, true));
+ VERIFY_IS_FALSE(term.SendKeyEvent(255, 123, {}, true));
}
}
--- src/cascadia/UnitTests_TerminalCore/ScreenSizeLimitsTest.cpp
@@ -38,7 +38,7 @@ void ScreenSizeLimitsTest::ScreenWidthAndHeightAreClampedToBounds()
// Negative values for initial visible row count or column count
// are clamped to 1. Too-large positive values are clamped to SHRT_MAX.
auto negativeColumnsSettings = winrt::make<MockTermSettings>(10000, 9999999, -1234);
- Terminal negativeColumnsTerminal{ Terminal::TestDummyMarker{} };
+ Terminal negativeColumnsTerminal;
DummyRenderer renderer{ &negativeColumnsTerminal };
negativeColumnsTerminal.CreateFromSettings(negativeColumnsSettings, renderer);
auto actualDimensions = negativeColumnsTerminal.GetViewport().Dimensions();
@@ -47,7 +47,7 @@ void ScreenSizeLimitsTest::ScreenWidthAndHeightAreClampedToBounds()
// Zero values are clamped to 1 as well.
auto zeroRowsSettings = winrt::make<MockTermSettings>(10000, 0, 9999999);
- Terminal zeroRowsTerminal{ Terminal::TestDummyMarker{} };
+ Terminal zeroRowsTerminal;
zeroRowsTerminal.CreateFromSettings(zeroRowsSettings, renderer);
actualDimensions = zeroRowsTerminal.GetViewport().Dimensions();
VERIFY_ARE_EQUAL(actualDimensions.height, 1, L"Row count clamped to 1");
@@ -64,32 +64,32 @@ void ScreenSizeLimitsTest::ScrollbackHistorySizeIsClampedToBounds()
// Zero history size is acceptable.
auto noHistorySettings = winrt::make<MockTermSettings>(0, visibleRowCount, 100);
- Terminal noHistoryTerminal{ Terminal::TestDummyMarker{} };
+ Terminal noHistoryTerminal;
DummyRenderer renderer{ &noHistoryTerminal };
noHistoryTerminal.CreateFromSettings(noHistorySettings, renderer);
VERIFY_ARE_EQUAL(noHistoryTerminal.GetTextBuffer().TotalRowCount(), visibleRowCount, L"History size of 0 is accepted");
// Negative history sizes are clamped to zero.
auto negativeHistorySizeSettings = winrt::make<MockTermSettings>(-100, visibleRowCount, 100);
- Terminal negativeHistorySizeTerminal{ Terminal::TestDummyMarker{} };
+ Terminal negativeHistorySizeTerminal;
negativeHistorySizeTerminal.CreateFromSettings(negativeHistorySizeSettings, renderer);
VERIFY_ARE_EQUAL(negativeHistorySizeTerminal.GetTextBuffer().TotalRowCount(), visibleRowCount, L"Negative history size is clamped to 0");
// History size + initial visible rows == SHRT_MAX is acceptable.
auto maxHistorySizeSettings = winrt::make<MockTermSettings>(SHRT_MAX - visibleRowCount, visibleRowCount, 100);
- Terminal maxHistorySizeTerminal{ Terminal::TestDummyMarker{} };
+ Terminal maxHistorySizeTerminal;
maxHistorySizeTerminal.CreateFromSettings(maxHistorySizeSettings, renderer);
VERIFY_ARE_EQUAL(maxHistorySizeTerminal.GetTextBuffer().TotalRowCount(), SHRT_MAX, L"History size == SHRT_MAX - initial row count is accepted");
// History size + initial visible rows == SHRT_MAX + 1 will be clamped slightly.
auto justTooBigHistorySizeSettings = winrt::make<MockTermSettings>(SHRT_MAX - visibleRowCount + 1, visibleRowCount, 100);
- Terminal justTooBigHistorySizeTerminal{ Terminal::TestDummyMarker{} };
+ Terminal justTooBigHistorySizeTerminal;
justTooBigHistorySizeTerminal.CreateFromSettings(justTooBigHistorySizeSettings, renderer);
VERIFY_ARE_EQUAL(justTooBigHistorySizeTerminal.GetTextBuffer().TotalRowCount(), SHRT_MAX, L"History size == 1 + SHRT_MAX - initial row count is clamped to SHRT_MAX - initial row count");
// Ridiculously large history sizes are also clamped.
auto farTooBigHistorySizeSettings = winrt::make<MockTermSettings>(99999999, visibleRowCount, 100);
- Terminal farTooBigHistorySizeTerminal{ Terminal::TestDummyMarker{} };
+ Terminal farTooBigHistorySizeTerminal;
farTooBigHistorySizeTerminal.CreateFromSettings(farTooBigHistorySizeSettings, renderer);
VERIFY_ARE_EQUAL(farTooBigHistorySizeTerminal.GetTextBuffer().TotalRowCount(), SHRT_MAX, L"History size that is far too large is clamped to SHRT_MAX - initial row count");
}
@@ -111,7 +111,7 @@ void ScreenSizeLimitsTest::ResizeIsClampedToBounds()
auto settings = winrt::make<MockTermSettings>(historySize, initialVisibleRowCount, initialVisibleColCount);
Log::Comment(L"First create a terminal with fewer than SHRT_MAX lines");
- Terminal terminal{ Terminal::TestDummyMarker{} };
+ Terminal terminal;
DummyRenderer renderer{ &terminal };
terminal.CreateFromSettings(settings, renderer);
VERIFY_ARE_EQUAL(terminal.GetTextBuffer().TotalRowCount(), historySize + initialVisibleRowCount);
--- src/cascadia/UnitTests_TerminalCore/ScrollTest.cpp
@@ -107,7 +107,7 @@ class TerminalCoreUnitTests::ScrollTest final
TEST_METHOD_SETUP(MethodSetup)
{
- _term = std::make_unique<::Microsoft::Terminal::Core::Terminal>(Terminal::TestDummyMarker{});
+ _term = std::make_unique<::Microsoft::Terminal::Core::Terminal>();
_scrollBarNotification = std::make_shared<std::optional<ScrollBarNotification>>();
_term->SetScrollPositionChangedCallback([scrollBarNotification = _scrollBarNotification](const int top, const int height, const int bottom) {
--- src/cascadia/UnitTests_TerminalCore/SelectionTest.cpp
@@ -46,7 +46,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectUnit)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -59,7 +59,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectArea)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -113,7 +113,7 @@ namespace TerminalCoreUnitTests
// Test SetSelectionAnchor(til::point) and SetSelectionEnd(til::point)
// Behavior: clamp coord to viewport.
auto ValidateSingleClickSelection = [&](til::CoordType scrollback, const til::inclusive_rect& expected) {
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 10, 10 }, scrollback, renderer);
@@ -126,7 +126,7 @@ namespace TerminalCoreUnitTests
// Behavior: clamp coord to viewport.
// Then, do double click selection.
auto ValidateDoubleClickSelection = [&](til::CoordType scrollback, const til::inclusive_rect& expected) {
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 10, 10 }, scrollback, renderer);
@@ -138,7 +138,7 @@ namespace TerminalCoreUnitTests
// Behavior: clamp coord to viewport.
// Then, do triple click selection.
auto ValidateTripleClickSelection = [&](til::CoordType scrollback, const til::inclusive_rect& expected) {
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 10, 10 }, scrollback, renderer);
@@ -171,7 +171,7 @@ namespace TerminalCoreUnitTests
- All selection expansion functions will operate as if they were performed at the boundary
*/
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 10, 10 }, 0, renderer);
@@ -213,7 +213,7 @@ namespace TerminalCoreUnitTests
- All selection expansion functions will operate as if they were performed at the boundary
*/
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 10, 10 }, 0, renderer);
@@ -299,7 +299,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectBoxArea)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -335,7 +335,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectAreaAfterScroll)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
til::CoordType scrollbackLines = 5;
term.Create({ 100, 100 }, scrollbackLines, renderer);
@@ -385,7 +385,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectWideGlyph_Trailing)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -408,7 +408,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectWideGlyph_Leading)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -431,7 +431,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectWideGlyphsInBoxSelection)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -486,7 +486,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(DoubleClick_GeneralCase)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -509,7 +509,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(DoubleClick_Delimiter)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -530,7 +530,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(DoubleClick_DelimiterClass)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -558,7 +558,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(DoubleClickDrag_Right)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -587,7 +587,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(DoubleClickDrag_Left)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -616,7 +616,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(TripleClick_GeneralCase)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -630,7 +630,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(TripleClickDrag_Horizontal)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -647,7 +647,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(TripleClickDrag_Vertical)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -675,7 +675,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(ShiftClick)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -792,7 +792,7 @@ namespace TerminalCoreUnitTests
TEST_METHOD(Pivot)
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
--- src/cascadia/UnitTests_TerminalCore/TerminalApiTest.cpp
@@ -48,7 +48,7 @@ using namespace TerminalCoreUnitTests;
void TerminalApiTest::SetColorTableEntry()
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -67,7 +67,7 @@ void TerminalApiTest::SetColorTableEntry()
// PrintString() is called with more code units than the buffer width.
void TerminalApiTest::PrintStringOfSurrogatePairs()
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 3, renderer);
@@ -134,7 +134,7 @@ void TerminalApiTest::PrintStringOfSurrogatePairs()
void TerminalApiTest::CursorVisibility()
{
// GH#3093 - Cursor Visibility and On states shouldn't affect each other
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -166,7 +166,7 @@ void TerminalApiTest::CursorVisibility()
void TerminalApiTest::CursorVisibilityViaStateMachine()
{
// This is a nearly literal copy-paste of ScreenBufferTests::TestCursorIsOn, adapted for the Terminal
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -218,7 +218,7 @@ void TerminalApiTest::CursorVisibilityViaStateMachine()
void TerminalApiTest::CheckDoubleWidthCursor()
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -262,7 +262,7 @@ void TerminalCoreUnitTests::TerminalApiTest::AddHyperlink()
{
// This is a nearly literal copy-paste of ScreenBufferTests::TestAddHyperlink, adapted for the Terminal
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -288,7 +288,7 @@ void TerminalCoreUnitTests::TerminalApiTest::AddHyperlinkCustomId()
{
// This is a nearly literal copy-paste of ScreenBufferTests::TestAddHyperlinkCustomId, adapted for the Terminal
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -316,7 +316,7 @@ void TerminalCoreUnitTests::TerminalApiTest::AddHyperlinkCustomIdDifferentUri()
{
// This is a nearly literal copy-paste of ScreenBufferTests::TestAddHyperlinkCustomId, adapted for the Terminal
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -344,7 +344,7 @@ void TerminalCoreUnitTests::TerminalApiTest::AddHyperlinkCustomIdDifferentUri()
void TerminalCoreUnitTests::TerminalApiTest::SetTaskbarProgress()
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
@@ -415,7 +415,7 @@ void TerminalCoreUnitTests::TerminalApiTest::SetTaskbarProgress()
void TerminalCoreUnitTests::TerminalApiTest::SetWorkingDirectory()
{
- Terminal term{ Terminal::TestDummyMarker{} };
+ Terminal term;
DummyRenderer renderer{ &term };
term.Create({ 100, 100 }, 0, renderer);
--- src/cascadia/UnitTests_TerminalCore/TerminalBufferTests.cpp
@@ -56,7 +56,7 @@ class TerminalCoreUnitTests::TerminalBufferTests final
TEST_METHOD_SETUP(MethodSetup)
{
// STEP 1: Set up the Terminal
- term = std::make_unique<Terminal>(Terminal::TestDummyMarker{});
+ term = std::make_unique<Terminal>();
emptyRenderer = std::make_unique<DummyRenderer>(term.get());
term->Create({ TerminalViewWidth, TerminalViewHeight }, TerminalHistoryLength, *emptyRenderer);
return true;
|
terminal
|
microsoft
|
C++
|
C++
| 97,273
| 8,477
|
The new Windows Terminal and the original Windows console host, all in the same place!
|
microsoft_terminal
|
BUG_FIX
|
obvious
|
b1a6a6a81f3a2737c4218414a1547ef8f752c994
|
2024-05-16 06:02:56
|
Kieran
|
[Bugfix] Fix yt-dlp illegal write issue that causes failure to fetch source details (#247) * Bandaid fix for yt-dlp write issue
* Ensured tempfile directory on app boot
| false
| 39
| 1
| 40
|
--- lib/pinchflat/boot/pre_job_startup_tasks.ex
@@ -31,7 +31,6 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
"""
@impl true
def init(state) do
- ensure_tmpfile_directory()
reset_executing_jobs()
create_blank_yt_dlp_files()
create_blank_user_script_file()
@@ -40,14 +39,6 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
{:ok, state}
end
- defp ensure_tmpfile_directory do
- tmpfile_dir = Application.get_env(:pinchflat, :tmpfile_directory)
-
- if !File.exists?(tmpfile_dir) do
- File.mkdir_p!(tmpfile_dir)
- end
- end
-
# If a node cannot gracefully shut down, the currently executing jobs get stuck
# in the "executing" state. This is a problem because the job runner will not
# pick them up again
--- lib/pinchflat/utils/cli_utils.ex
@@ -24,12 +24,11 @@ defmodule Pinchflat.Utils.CliUtils do
def wrap_cmd(command, args, passthrough_opts \\ [], opts \\ []) do
wrapper_command = Path.join(:code.priv_dir(:pinchflat), "cmd_wrapper.sh")
actual_command = [command] ++ args
- command_opts = set_command_opts() ++ passthrough_opts
logging_arg_override = Keyword.get(opts, :logging_arg_override, Enum.join(args, " "))
Logger.info("[command_wrapper]: #{command} called with: #{logging_arg_override}")
- {output, status} = System.cmd(wrapper_command, actual_command, command_opts)
+ {output, status} = System.cmd(wrapper_command, actual_command, passthrough_opts)
log_cmd_result(command, logging_arg_override, status, output)
{output, status}
@@ -82,13 +81,4 @@ defmodule Pinchflat.Utils.CliUtils do
Logger.log(log_level, log_message)
end
-
- defp set_command_opts do
- # This resolves an issue where yt-dlp would attempt to write to a read-only directory
- # if you scanned a new video with `--windows-filenames` enabled. Hopefully can be removed
- # in the future.
- [
- cd: Application.get_env(:pinchflat, :tmpfile_directory)
- ]
- end
end
--- test/pinchflat/boot/pre_job_startup_tasks_test.exs
@@ -13,19 +13,6 @@ defmodule Pinchflat.Boot.PreJobStartupTasksTest do
:ok
end
- describe "ensure_tmpfile_directory" do
- test "creates the tmpfile directory if it doesn't exist" do
- tmpfile_dir = Application.get_env(:pinchflat, :tmpfile_directory)
- File.rm_rf!(tmpfile_dir)
-
- refute File.exists?(tmpfile_dir)
-
- PreJobStartupTasks.init(%{})
-
- assert File.exists?(tmpfile_dir)
- end
- end
-
describe "reset_executing_jobs" do
test "resets executing jobs" do
job = job_fixture()
@@ -91,7 +78,6 @@ defmodule Pinchflat.Boot.PreJobStartupTasksTest do
describe "apply_default_settings" do
test "sets yt_dlp version" do
- File.rm_rf!(Application.get_env(:pinchflat, :tmpfile_directory))
Settings.set(yt_dlp_version: nil)
refute Settings.get!(:yt_dlp_version)
@@ -102,7 +88,6 @@ defmodule Pinchflat.Boot.PreJobStartupTasksTest do
end
test "sets apprise version" do
- File.rm_rf!(Application.get_env(:pinchflat, :tmpfile_directory))
Settings.set(apprise_version: nil)
refute Settings.get!(:apprise_version)
--- test/pinchflat/utils/cli_utils_test.exs
@@ -7,10 +7,6 @@ defmodule Pinchflat.Utils.CliUtilsTest do
test "delegates to System.cmd/3" do
assert {"output\n", 0} = CliUtils.wrap_cmd("echo", ["output"])
end
-
- test "sets the current directory to the tmp dir" do
- assert {"/tmp/test/tmpfiles\n", 0} = CliUtils.wrap_cmd("pwd", [])
- end
end
describe "parse_options/1" do
|
pinchflat
|
kieraneglin
|
Elixir
|
Elixir
| 2,779
| 59
|
Your next YouTube media manager
|
kieraneglin_pinchflat
|
BUG_FIX
|
Obvious
|
58ba2241e9db836c96cb75f1848c31c71c7b9fac
| null |
Thiago de Arruda
|
runtime: Change external plugin directory to "external-plugin"
| false
| 1
| 1
| 0
|
--- host.vim
@@ -119,7 +119,7 @@ function! s:RegistrationCommands(host)
let host_id = a:host.'-registration-clone'
call rpc#host#RegisterClone(host_id, a:host)
let pattern = s:plugin_patterns[a:host]
- let paths = globpath(&rtp, 'plugin/external/'.a:host.'/'.pattern, 0, 1)
+ let paths = globpath(&rtp, 'external-plugin/'.a:host.'/'.pattern, 0, 1)
for path in paths
call rpc#host#RegisterPlugin(host_id, path, [])
endfor
|
neovim_neovim.json
| null | null | null | null | null | null |
neovim_neovim.json
|
CONFIG_CHANGE
|
5, obvious
|
c220f26f966c5a1b418d52c29d79d3c5ea74f50f
|
2025-02-27 21:24:37
|
Jiachi Liu
|
refactor: remove unused variable in externals handling (#76599) ### What
`_optOutBundlingPackages` was not used as there's already a optOutBundlingPackagesRegex, removing it from the `handleExternals`
| false
| 0
| 12
| 12
|
--- packages/next/src/build/handle-externals.ts
@@ -48,6 +48,7 @@ export async function resolveExternal(
context: string,
request: string,
isEsmRequested: boolean,
+ _optOutBundlingPackages: string[],
getResolve: (
options: ResolveOptions
) => (
@@ -132,11 +133,13 @@ export async function resolveExternal(
export function makeExternalHandler({
config,
+ optOutBundlingPackages,
optOutBundlingPackageRegex,
transpiledPackages,
dir,
}: {
config: NextConfigComplete
+ optOutBundlingPackages: string[]
optOutBundlingPackageRegex: RegExp
transpiledPackages: string[]
dir: string
@@ -263,6 +266,7 @@ export function makeExternalHandler({
context,
request,
isEsmRequested,
+ optOutBundlingPackages,
getResolve,
isLocal ? resolveNextExternal : undefined
)
@@ -330,6 +334,7 @@ export function makeExternalHandler({
context,
pkg + '/package.json',
isEsmRequested,
+ optOutBundlingPackages,
getResolve,
isLocal ? resolveNextExternal : undefined
)
--- packages/next/src/build/webpack-config.ts
@@ -863,6 +863,7 @@ export default async function getBaseWebpackConfig(
const handleExternals = makeExternalHandler({
config,
+ optOutBundlingPackages,
optOutBundlingPackageRegex,
transpiledPackages: finalTranspilePackages,
dir,
@@ -1926,6 +1927,7 @@ export default async function getBaseWebpackConfig(
esmExternals: config.experimental.esmExternals,
outputFileTracingRoot: config.outputFileTracingRoot,
appDirEnabled: hasAppDir,
+ optOutBundlingPackages,
traceIgnores: [],
compilerType,
}
--- packages/next/src/build/webpack/plugins/next-trace-entrypoints-plugin.ts
@@ -131,6 +131,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
private rootDir: string
private appDir: string | undefined
private pagesDir: string | undefined
+ private optOutBundlingPackages: string[]
private appDirEnabled?: boolean
private tracingRoot: string
private entryTraces: Map<string, Map<string, { bundled: boolean }>>
@@ -143,6 +144,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
appDir,
pagesDir,
compilerType,
+ optOutBundlingPackages,
appDirEnabled,
traceIgnores,
esmExternals,
@@ -152,6 +154,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
compilerType: CompilerNameValues
appDir: string | undefined
pagesDir: string | undefined
+ optOutBundlingPackages: string[]
appDirEnabled?: boolean
traceIgnores?: string[]
outputFileTracingRoot?: string
@@ -165,6 +168,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
this.appDirEnabled = appDirEnabled
this.traceIgnores = traceIgnores || []
this.tracingRoot = outputFileTracingRoot || rootDir
+ this.optOutBundlingPackages = optOutBundlingPackages
this.compilerType = compilerType
}
@@ -782,6 +786,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
context,
request,
isEsmRequested,
+ this.optOutBundlingPackages,
(options) => (_: string, resRequest: string) => {
return getResolve(options)(parent, resRequest, job)
},
|
next.js
|
vercel
|
JavaScript
|
JavaScript
| 129,891
| 27,821
|
The React Framework
|
vercel_next.js
|
CODE_IMPROVEMENT
|
unused variables removed
|
6d78b0501a2377f44fb19d24e32b1a5a6bbb58a3
| null |
Adam Barth
|
Remove reference to oblique We removed this value from the engine because it's not useful.
| false
| 0
| 1
| -1
|
--- text_style.dart
@@ -183,7 +183,6 @@ class TextStyle {
cssStyle['font-style'] = const {
FontStyle.normal: 'normal',
FontStyle.italic: 'italic',
- FontStyle.oblique: 'oblique',
}[fontStyle];
}
if (decoration != null) {
|
flutter_flutter.json
| null | null | null | null | null | null |
flutter_flutter.json
|
CODE_IMPROVEMENT
|
4, removed redundant value
|
8f91c4e6a2200e3eda7569971a090bee1c92208f
|
2024-07-12 21:23:26
|
Kieran
|
[Enhancement] Improve flow for adding many sources at once (#306) * Added mechamism for using existing sources as a reference for adding new sources
* Added test
| false
| 53
| 9
| 62
|
--- lib/pinchflat_web/controllers/sources/source_controller.ex
@@ -41,30 +41,13 @@ defmodule PinchflatWeb.Sources.SourceController do
render(conn, :index, sources: Repo.all(source_query))
end
- def new(conn, params) do
- # This lets me preload the settings from another source for more efficient creation
- cs_struct =
- case to_string(params["template_id"]) do
- "" -> %Source{}
- template_id -> Repo.get(Source, template_id) || %Source{}
- end
+ def new(conn, _params) do
+ changeset = Sources.change_source(%Source{})
render(conn, :new,
+ changeset: changeset,
media_profiles: media_profiles(),
- layout: get_onboarding_layout(),
- # Most of these don't actually _need_ to be nullified at this point,
- # but if I don't do it now I know it'll bite me
- changeset:
- Sources.change_source(%Source{
- cs_struct
- | id: nil,
- uuid: nil,
- custom_name: nil,
- collection_name: nil,
- collection_id: nil,
- collection_type: nil,
- original_url: nil
- })
+ layout: get_onboarding_layout()
)
end
--- lib/pinchflat_web/controllers/sources/source_html.ex
@@ -9,7 +9,6 @@ defmodule PinchflatWeb.Sources.SourceHTML do
attr :changeset, Ecto.Changeset, required: true
attr :action, :string, required: true
attr :media_profiles, :list, required: true
- attr :method, :string, required: true
def source_form(assigns)
--- lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex
@@ -26,11 +26,6 @@
<span x-show="copied" x-transition.duration.150ms><.icon name="hero-check" class="ml-2 h-4 w-4" /></span>
</span>
</:option>
- <:option>
- <.link href={~p"/sources/new?template_id=#{@source}"} method="get">
- Use as Template
- </.link>
- </:option>
<:option>
<div class="h-px w-full bg-bodydark2"></div>
</:option>
--- lib/pinchflat_web/controllers/sources/source_html/edit.html.heex
@@ -10,12 +10,7 @@
<div class="rounded-sm border border-stroke bg-white px-5 pb-2.5 pt-6 shadow-default dark:border-strokedark dark:bg-boxdark sm:px-7.5 xl:pb-1">
<div class="max-w-full">
<div class="flex flex-col gap-10">
- <.source_form
- changeset={@changeset}
- media_profiles={@media_profiles}
- action={~p"/sources/#{@source}"}
- method="patch"
- />
+ <.source_form changeset={@changeset} media_profiles={@media_profiles} action={~p"/sources/#{@source}"} />
</div>
</div>
</div>
--- lib/pinchflat_web/controllers/sources/source_html/new.html.heex
@@ -8,7 +8,7 @@
<div class="rounded-sm border border-stroke bg-white px-5 pb-2.5 pt-6 shadow-default dark:border-strokedark dark:bg-boxdark sm:px-7.5 xl:pb-1">
<div class="max-w-full">
<div class="flex flex-col gap-10">
- <.source_form changeset={@changeset} media_profiles={@media_profiles} action={~p"/sources"} method="post" />
+ <.source_form changeset={@changeset} media_profiles={@media_profiles} action={~p"/sources"} />
</div>
</div>
</div>
--- lib/pinchflat_web/controllers/sources/source_html/source_form.html.heex
@@ -2,7 +2,6 @@
:let={f}
for={@changeset}
action={@action}
- method={@method}
x-data="{ advancedMode: !!JSON.parse(localStorage.getItem('advancedMode')) }"
x-init="$watch('advancedMode', value => localStorage.setItem('advancedMode', JSON.stringify(value)))"
>
@@ -11,7 +10,7 @@
</.error>
<section x-data="{ mediaProfileId: null }">
- <section class="flex justify-between items-center mt-4">
+ <section class="flex justify-between items-center mt-8">
<h3 class=" text-2xl text-black dark:text-white">
General Options
</h3>
@@ -20,14 +19,6 @@
</span>
</section>
- <.input
- field={f[:original_url]}
- type="text"
- label="Source URL"
- help="URL of a channel or playlist (required)"
- x-init="$el.focus()"
- />
-
<.input
field={f[:custom_name]}
type="text"
@@ -35,6 +26,8 @@
help="Does not impact indexing or downloading. Will be inferred from the source if left blank"
/>
+ <.input field={f[:original_url]} type="text" label="Source URL" help="URL of a channel or playlist (required)" />
+
<.input
field={f[:media_profile_id]}
options={Enum.map(@media_profiles, &{&1.name, &1.id})}
--- test/pinchflat_web/controllers/source_controller_test.exs
@@ -50,15 +50,6 @@ defmodule PinchflatWeb.SourceControllerTest do
refute html_response(conn, 200) =~ "MENU"
end
-
- test "preloads some attributes when using a template", %{conn: conn} do
- source = source_fixture(custom_name: "My first source", download_cutoff_date: "2021-01-01")
-
- conn = get(conn, ~p"/sources/new", %{"template_id" => source.id})
- assert html_response(conn, 200) =~ "New Source"
- assert html_response(conn, 200) =~ "2021-01-01"
- refute html_response(conn, 200) =~ source.custom_name
- end
end
describe "create source" do
|
pinchflat
|
kieraneglin
|
Elixir
|
Elixir
| 2,779
| 59
|
Your next YouTube media manager
|
kieraneglin_pinchflat
|
CODE_IMPROVEMENT
|
probably refactoring to improve flow for adding sources
|
147e4aece0cfa6ca5d584b57785dc99f31d1e4eb
| null |
Philipp Hagemeister
|
[vbox7] New video checksum
| false
| 1
| 1
| 0
|
--- vbox7.py
@@ -15,7 +15,7 @@ class Vbox7IE(InfoExtractor):
_TEST = {
u'url': u'http://vbox7.com/play:249bb972c2',
u'file': u'249bb972c2.flv',
- u'md5': u'9c70d6d956f888bdc08c124acc120cfe',
+ u'md5': u'99f65c0c9ef9b682b97313e052734c3f',
u'info_dict': {
u"title": u"\u0421\u043c\u044f\u0445! \u0427\u0443\u0434\u043e - \u0447\u0438\u0441\u0442 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0438 - \u0421\u043a\u0440\u0438\u0442\u0430 \u043a\u0430\u043c\u0435\u0440\u0430"
}
|
ytdl-org_youtube-dl.json
| null | null | null | null | null | null |
ytdl-org_youtube-dl.json
|
NEW_FEAT
|
5, obvious
|
5a1f4b9aec4b6351b6102a2d2057a319ead9d76a
|
2023-11-19 16:14:48
|
Wen Hui
|
Adding missing SWAPDB related test cases. (#12769) We have some test cases of swapdb with watchkey but missing seperate
basic swapdb test cases, unhappy path and flushdb after swapdb. So added
the test cases in keyspace.tcl.
| false
| 40
| 0
| 40
|
--- tests/unit/keyspace.tcl
@@ -499,44 +499,4 @@ foreach {type large} [array get largevalue] {
r SET aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
r KEYS "a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*b"
} {}
-
- test {Coverage: basic SWAPDB test and unhappy path} {
- r flushall
- r select 0
- r set swapkey v1
- r select 1
- assert_match 0 [r dbsize] ;#verify DB[1] has 0 keys
- r swapdb 0 1
- assert_match 1 [r dbsize]
- r select 0
- assert_match 0 [r dbsize] ;#verify DB[0] has 0 keys
- r flushall
- assert_error "ERR DB index is out of range*" {r swapdb 44 55}
- assert_error "ERR invalid second DB index*" {r swapdb 44 a}
- assert_error "ERR invalid first DB index*" {r swapdb a 55}
- assert_error "ERR invalid first DB index*" {r swapdb a b}
- assert_match "OK" [r swapdb 0 0]
- } {} {singledb:skip}
-
- test {Coverage: SWAPDB and FLUSHDB} {
- # set a key in each db and swapdb one of 2 with different db
- # and flushdb on swapped db.
- r flushall
- r select 0
- r set swapkey v1
- r select 1
- r set swapkey1 v1
- assert_no_match "*db2:keys=*" [r info keyspace]
- r swapdb 0 2
- r select 0
- assert_match 0 [r dbsize]
- assert_no_match "*db0:keys=*" [r info keyspace]
- r select 2
- r flushdb
- assert_match 0 [r dbsize]
- assert_match "*db1:keys=*" [r info keyspace]
- assert_no_match "*db0:keys=*" [r info keyspace]
- assert_no_match "*db2:keys=*" [r info keyspace]
- r flushall
- } {OK} {singledb:skip}
}
|
redis
|
redis
|
C
|
C
| 68,201
| 23,916
|
Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.
|
redis_redis
|
BUG_FIX
|
added missing test cases
|
b4338820844cb7cfc321ae1a9b2a3b8abf0a9e22
|
2023-03-23 16:23:06
|
jianchenggu
|
Update university course programs Add more master's programs, Remove duplicates
| false
| 3
| 2
| 5
|
--- README.md
@@ -149,10 +149,9 @@ Koç University, Turkey
- [M.S. in Computational Analysis & Public Policy](https://capp.uchicago.edu/), University of Chicago, United States
- [Master of Science in Data Analytics & Computational Social Science](https://www.umass.edu/social-sciences/academics/data-analytics-computational-social-science/ms-dacss), University of Massachusetts Amherst, United States
- [Master of Science in Data Science for Public Policy](https://mccourt.georgetown.edu/master-of-science-in-data-science-for-public-policy/), Georgetown University, United States
-- [Master of Science in Public Policy and Data Science](https://priceschool.usc.edu/mppds/), University of Southern California, United States
- [Master's Degree Applied Urban Science and Informatics](https://cusp.nyu.edu/masters-degree/), New York University, United States
-- [Master of Science in Social Policy + Data Analytics for Social Policy Certificate](https://www.sp2.upenn.edu/program/master-of-science-in-social-policy-data-analytics-for-social-policy-certificate/), University of Pennsylvania, United States
-- [Master of Science in Survey and Data Science](https://surveydatascience.isr.umich.edu/survey-and-data-science-masters-degree-program), University of Michigan, United States
+- [Master of Science in Social Policy + Data Analytics for Social Policy Certificate](https://www.sp2.upenn.edu/program/master-of-science-in-social-policy-data-analytics-for-social-policy-certificate/), University of Pennsylvania, United States
+- [Master of Science in Public Policy and Data Science](https://priceschool.usc.edu/mppds/), University of Southern California, United States
- [DPhil Social Data Science](https://www.oii.ox.ac.uk/study/dphil-in-social-data-science/), University of Oxford, United Kingdom
|
awesome-computational-social-science
|
gesiscss
|
R
|
R
| 648
| 83
|
A list of awesome resources for Computational Social Science
|
gesiscss_awesome-computational-social-science
|
DOC_CHANGE
|
Obvious
|
10f1aeb144b253d5a5436b3235defb1d68b19fdc
| null |
Eli Frigo
|
fixed broken link (#1097)
| false
| 1
| 1
| 0
|
--- transformer.py
@@ -6,7 +6,7 @@ from tinygrad.nn.optim import Adam, get_parameters
from extra.training import train, evaluate
from models.transformer import Transformer
-# dataset idea from https://github.com/karpathy/minGPT/blob/master/play_math.ipynb
+# dataset idea from https://github.com/karpathy/minGPT/blob/master/projects/adder/adder.py
def make_dataset():
ds = []
for i in range(100):
|
tinygrad_tinygrad.json
| null | null | null | null | null | null |
tinygrad_tinygrad.json
|
BUG_FIX
|
5, fixed a broken link
|
52656db328c7141b0ab26a5871510e0d360b741f
|
2023-02-10 01:42:37
|
dependabot[bot]
|
Build(deps-dev): Bump sass from 1.57.1 to 1.58.0 (#38017) Bumps [sass](https://github.com/sass/dart-sass) from 1.57.1 to 1.58.0.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.57.1...1.58.0)
---
updated-dependencies:
- dependency-name: sass
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
| false
| 8
| 8
| 16
|
--- package-lock.json
@@ -61,7 +61,7 @@
"rollup": "^3.10.1",
"rollup-plugin-istanbul": "^4.0.0",
"rtlcss": "^4.0.0",
- "sass": "^1.58.0",
+ "sass": "^1.57.1",
"sass-true": "^7.0.0",
"shelljs": "^0.8.5",
"stylelint": "^14.16.1",
@@ -9316,9 +9316,9 @@
"dev": true
},
"node_modules/sass": {
- "version": "1.58.0",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.58.0.tgz",
- "integrity": "sha512-PiMJcP33DdKtZ/1jSjjqVIKihoDc6yWmYr9K/4r3fVVIEDAluD0q7XZiRKrNJcPK3qkLRF/79DND1H5q1LBjgg==",
+ "version": "1.57.1",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz",
+ "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
@@ -17683,9 +17683,9 @@
"dev": true
},
"sass": {
- "version": "1.58.0",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.58.0.tgz",
- "integrity": "sha512-PiMJcP33DdKtZ/1jSjjqVIKihoDc6yWmYr9K/4r3fVVIEDAluD0q7XZiRKrNJcPK3qkLRF/79DND1H5q1LBjgg==",
+ "version": "1.57.1",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz",
+ "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
"dev": true,
"requires": {
"chokidar": ">=3.0.0 <4.0.0",
--- package.json
@@ -145,7 +145,7 @@
"rollup": "^3.10.1",
"rollup-plugin-istanbul": "^4.0.0",
"rtlcss": "^4.0.0",
- "sass": "^1.58.0",
+ "sass": "^1.57.1",
"sass-true": "^7.0.0",
"shelljs": "^0.8.5",
"stylelint": "^14.16.1",
|
bootstrap
|
twbs
|
JavaScript
|
JavaScript
| 171,693
| 79,045
|
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
|
twbs_bootstrap
|
CONFIG_CHANGE
|
Obvious
|
30054b03f432d005a3322428566d5f26ea7e1196
|
2023-08-10 21:04:07
|
Stas
|
feat: metric endpoint per tenant (#147)
| false
| 92
| 3
| 95
|
--- VERSION
@@ -1 +1 @@
-0.2.28
+0.2.27
--- lib/supavisor.ex
@@ -107,7 +107,6 @@ defmodule Supavisor do
@spec del_all_cache(String.t(), String.t()) :: map()
def del_all_cache(tenant, user) do
%{secrets: Cachex.del(Supavisor.Cache, {:secrets, tenant, user})}
- %{metrics: Cachex.del(Supavisor.Cache, {:metrics, tenant})}
end
@spec get_local_pool(String.t(), String.t()) :: pid() | nil
--- lib/supavisor/application.ex
@@ -73,7 +73,6 @@ defmodule Supavisor.Application do
},
Supavisor.Vault,
{Cachex, name: Supavisor.Cache},
- Supavisor.TenantsMetrics,
# Start the Endpoint (http/https)
SupavisorWeb.Endpoint
]
--- lib/supavisor/monitoring/prom_ex.ex
@@ -69,6 +69,8 @@ defmodule Supavisor.Monitoring.PromEx do
Application.fetch_env!(:supavisor, :metrics_tags)
|> Enum.map_join(",", fn {k, v} -> "#{k}=\"#{v}\"" end)
+ Logger.debug("Default prom tags: #{def_tags}")
+
metrics =
PromEx.get_metrics(__MODULE__)
|> String.split("\n")
@@ -80,31 +82,6 @@ defmodule Supavisor.Monitoring.PromEx do
metrics
end
- @spec do_cache_tenants_metrics() :: :ok
- def do_cache_tenants_metrics() do
- metrics = get_metrics() |> String.split("\n")
-
- Registry.select(Supavisor.Registry.TenantSups, [{{:"$1", :_, :_}, [], [:"$1"]}])
- |> Enum.uniq()
- |> Enum.reduce(metrics, fn tenant, acc ->
- {matched, rest} = Enum.split_with(acc, &String.contains?(&1, "tenant=\"#{tenant}\""))
-
- if matched != [] do
- Cachex.put(Supavisor.Cache, {:metrics, tenant}, Enum.join(matched, "\n"))
- end
-
- rest
- end)
- end
-
- @spec get_tenant_metrics(String.t()) :: String.t()
- def get_tenant_metrics(tenant) do
- case Cachex.get(Supavisor.Cache, {:metrics, tenant}) do
- {_, metrics} when is_binary(metrics) -> metrics
- _ -> ""
- end
- end
-
@spec parse_and_add_tags(String.t(), String.t()) :: String.t()
defp parse_and_add_tags(line, def_tags) do
case Regex.run(~r/(?!\#)^(\w+)(?:{(.*?)})?\s*(.+)$/, line) do
--- lib/supavisor/syn_handler.ex
@@ -16,7 +16,6 @@ defmodule Supavisor.SynHandler do
# remove all Prometheus metrics for the specified tenant
PromEx.remove_metrics(tenant, user_alias)
- Supavisor.del_all_cache(tenant, user_alias)
end
def resolve_registry_conflict(
--- lib/supavisor/tenants_metrics.ex
@@ -1,40 +0,0 @@
-defmodule Supavisor.TenantsMetrics do
- @moduledoc false
- use GenServer, restart: :transient
- require Logger
-
- alias Supavisor.Monitoring.PromEx
-
- @check_timeout 10_000
-
- def start_link(args) do
- GenServer.start_link(__MODULE__, args, name: __MODULE__)
- end
-
- ## Callbacks
-
- @impl true
- def init(_args) do
- send(self(), :check_metrics)
- {:ok, %{check_ref: make_ref()}}
- end
-
- @impl true
- def handle_info(:check_metrics, state) do
- Process.cancel_timer(state.check_ref)
-
- PromEx.do_cache_tenants_metrics()
-
- {:noreply, %{state | check_ref: check_metrics()}}
- end
-
- ## Internal functions
-
- defp check_metrics() do
- Process.send_after(
- self(),
- :check_metrics,
- @check_timeout
- )
- end
-end
--- lib/supavisor_web/controllers/metrics_controller.ex
@@ -17,16 +17,6 @@ defmodule SupavisorWeb.MetricsController do
|> send_resp(200, cluster_metrics)
end
- def tenant(conn, %{"external_id" => ext_id}) do
- cluster_metrics = fetch_cluster_metrics(ext_id)
-
- code = if cluster_metrics == "", do: 404, else: 200
-
- conn
- |> put_resp_content_type("text/plain")
- |> send_resp(code, cluster_metrics)
- end
-
@spec fetch_cluster_metrics() :: String.t()
defp fetch_cluster_metrics() do
Node.list()
@@ -39,18 +29,6 @@ defmodule SupavisorWeb.MetricsController do
{node, :rpc.call(node, PromEx, :get_metrics, [], 10_000)}
end
- @spec fetch_cluster_metrics(String.t()) :: String.t()
- defp fetch_cluster_metrics(tenant) do
- Node.list()
- |> Task.async_stream(&fetch_node_metrics(&1, tenant), timeout: :infinity)
- |> Enum.reduce(PromEx.get_tenant_metrics(tenant), &merge_node_metrics/2)
- end
-
- @spec fetch_node_metrics(atom(), String.t()) :: {atom(), term()}
- defp fetch_node_metrics(node, tenant) do
- {node, :rpc.call(node, PromEx, :get_tenant_metrics, [tenant], 10_000)}
- end
-
defp merge_node_metrics({_, {node, {:badrpc, reason}}}, acc) do
Logger.error("Cannot fetch metrics from the node #{inspect(node)} because #{inspect(reason)}")
acc
--- lib/supavisor_web/router.ex
@@ -52,7 +52,6 @@ defmodule SupavisorWeb.Router do
pipe_through(:metrics)
get("/", MetricsController, :index)
- get("/:external_id", MetricsController, :tenant)
end
# Other scopes may use custom stacks.
|
supavisor
|
supabase
|
Elixir
|
Elixir
| 1,869
| 64
|
A cloud-native, multi-tenant Postgres connection pooler.
|
supabase_supavisor
|
NEW_FEAT
|
Obvious
|
39e53b4ae7b958b227535dde7e8284f5d92a96fd
| null |
Lipis
|
feat: Allow letters in IDs for storing files in backend (#4224)
| false
| 1
| 1
| 0
|
--- index.tsx
@@ -163,7 +163,7 @@ const initializeScene = async (opts: {
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get("id");
const jsonBackendMatch = window.location.hash.match(
- /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/,
+ /^#json=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/,
);
const externalUrlMatch = window.location.hash.match(/^#url=(.*)$/);
|
excalidraw_excalidraw.json
| null | null | null | null | null | null |
excalidraw_excalidraw.json
|
NEW_FEAT
|
5, allowed letters in IDs
|
8ba98bc9f09d0abd69044a20f5505f485096ae6e
|
2022-12-25 16:11:54
|
XhmikosR
|
CI: test CSS after build (#37714)
| false
| 3
| 3
| 6
|
--- .github/workflows/css.yml
@@ -33,8 +33,8 @@ jobs:
- name: Install npm dependencies
run: npm ci
- - name: Build CSS
- run: npm run css
-
- name: Run CSS tests
run: npm run css-test
+
+ - name: Build CSS
+ run: npm run css
|
bootstrap
|
twbs
|
JavaScript
|
JavaScript
| 171,693
| 79,045
|
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
|
twbs_bootstrap
|
CODE_IMPROVEMENT
|
Code change: type annotation added
|
60d0439d5f8e69aa5b6c3135573859c0c75a798a
|
2025-04-06T11:02:32Z
|
Chromium WPT Sync
|
Update `TestExpectations` with bugs filed for crrev.com/c/6433257 [email protected] Bug: 408539325, 408571502 Change-Id: I2fda494bdc989758fc226862063f4f894136c94b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433416 Auto-Submit: WPT Autoroller <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Commit-Queue: Rubber Stamper <[email protected]> Cr-Commit-Position: refs/heads/main@{#1443190}
| false
| 3
| 3
| 6
|
--- third_party/blink/web_tests/TestExpectations
@@ -2607,9 +2607,9 @@ crbug.com/383880384 [ Win ] external/wpt/css/css-properties-values-api/registere
[ Linux ] external/wpt/webdriver/tests/bidi/network/continue_response/cookies.py [ Pass Timeout ]
# ====== New tests from wpt-importer added here ======
-[ Mac14 ] external/wpt/html/cross-origin-opener-policy/iframe-popup-unsafe-none-to-unsafe-none.https.html?7-8 [ Crash ]
-[ Mac12 ] external/wpt/html/semantics/popovers/popover-focus-2.html [ Skip Timeout ]
-[ Mac12 ] virtual/html-anchor-attribute-disabled/external/wpt/html/semantics/popovers/popover-focus-2.html [ Skip Timeout ]
+crbug.com/408539325 [ Mac14 ] external/wpt/html/cross-origin-opener-policy/iframe-popup-unsafe-none-to-unsafe-none.https.html?7-8 [ Crash ]
+crbug.com/408571502 [ Mac12 ] external/wpt/html/semantics/popovers/popover-focus-2.html [ Skip Timeout ]
+crbug.com/408571502 [ Mac12 ] virtual/html-anchor-attribute-disabled/external/wpt/html/semantics/popovers/popover-focus-2.html [ Skip Timeout ]
crbug.com/408039461 [ Win11-arm64 ] external/wpt/css/css-text/white-space/control-chars-01D.html [ Failure ]
crbug.com/408034113 [ Win11-arm64 ] external/wpt/service-workers/service-worker/fetch-mixed-content-to-inscope.https.html [ Crash ]
crbug.com/408039452 [ Win11-arm64 ] external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html [ Timeout ]
|
chromium
| null |
C
|
C
| null | null |
Browser
|
_chromium
|
BUG_FIX
|
Code change: bug removal
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.