helloadhavan/github_issues huggingface dataset:
Repository: electron/electron
Pull request: perf: improve temporaries in `WebWorkerObserver::WorkerScriptReadyForEvaluation()`

#### Description of Change

A couple of small cleanups to `WebWorkerObserver::WorkerScriptReadyForEvaluation()`:

- replace a runtime `std::vector<std::string>` local with compile-time `std::string_view`s
- remove `.c_str()` pessimizations when building v8 strings. When we give gin a `string_view` instead of a `char*`,  then it doesn't have to recalculate the string length.

I came across this change while looking for something else :slightly_smiling_face:. It's a small change but worthwhile to move these strings to compile-time.

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none.

Changed files:
filename: shell/renderer/web_worker_observer.cc
patch: @@ -4,9 +4,11 @@
 
 #include "shell/renderer/web_worker_observer.h"
 
+#include <string_view>
 #include <utility>
 
 #include "base/no_destructor.h"
+#include "base/strings/strcat.h"
 #include "base/threading/thread_local.h"
 #include "shell/common/api/electron_bindings.h"
 #include "shell/common/gin_helper/event_emitter_caller.h"
@@ -71,15 +73,14 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
   // is loaded. See corresponding change in node/init.ts.
   v8::Local<v8::Object> global = worker_context->Global();
 
-  std::vector<std::string> keys = {"fetch",   "Response", "FormData",
-                                   "Request", "Headers",  "EventSource"};
-  for (const auto& key : keys) {
+  for (const std::string_view key :
+       {"fetch", "Response", "FormData", "Request", "Headers", "EventSource"}) {
     v8::MaybeLocal<v8::Value> value =
-        global->Get(worker_context, gin::StringToV8(isolate, key.c_str()));
+        global->Get(worker_context, gin::StringToV8(isolate, key));
     if (!value.IsEmpty()) {
-      std::string blink_key = "blink" + key;
+      std::string blink_key = base::StrCat({"blink", key});
       global
-          ->Set(worker_context, gin::StringToV8(isolate, blink_key.c_str()),
+          ->Set(worker_context, gin::StringToV8(isolate, blink_key),
                 value.ToLocalChecked())
           .Check();
     }
Repository: vercel/next.js
Pull request: Rename WebSocket file

Renaming the file in a separate commit to allow git to track the upcoming changes more easily.

Changed files:
filename: packages/next/src/client/dev/hot-reloader/app/hot-reloader-app.tsx
patch: @@ -18,9 +18,9 @@ import { RuntimeErrorHandler } from '../../runtime-error-handler'
 import {
   useSendMessage,
   useTurbopack,
-  useWebsocket,
-  useWebsocketPing,
-} from './use-websocket'
+  useWebSocket,
+  useWebSocketPing,
+} from './web-socket'
 import { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types'
 import type {
   HMR_ACTION_TYPES,
@@ -466,9 +466,9 @@ export default function HotReload({
 }) {
   useErrorHandler(dispatcher.onUnhandledError, dispatcher.onUnhandledRejection)
 
-  const webSocketRef = useWebsocket(assetPrefix)
+  const webSocketRef = useWebSocket(assetPrefix)
 
-  useWebsocketPing(webSocketRef)
+  useWebSocketPing(webSocketRef)
   const sendMessage = useSendMessage(webSocketRef)
   useForwardConsoleLog(webSocketRef)
   const processTurbopackMessage = useTurbopack(sendMessage, (err) =>

filename: packages/next/src/client/dev/hot-reloader/app/web-socket.ts
patch: @@ -3,7 +3,7 @@ import { GlobalLayoutRouterContext } from '../../../../shared/lib/app-router-con
 import { getSocketUrl } from '../get-socket-url'
 import type { TurbopackMsgToBrowser } from '../../../../server/dev/hot-reloader-types'
 
-export function useWebsocket(assetPrefix: string) {
+export function useWebSocket(assetPrefix: string) {
   const webSocketRef = useRef<WebSocket>(undefined)
 
   useEffect(() => {
@@ -19,7 +19,7 @@ export function useWebsocket(assetPrefix: string) {
   return webSocketRef
 }
 
-export function useSendMessage(webSocketRef: ReturnType<typeof useWebsocket>) {
+export function useSendMessage(webSocketRef: ReturnType<typeof useWebSocket>) {
   const sendMessage = useCallback(
     (data: string) => {
       const socket = webSocketRef.current
@@ -89,10 +89,10 @@ export function useTurbopack(
   return processTurbopackMessage
 }
 
-export function useWebsocketPing(
-  websocketRef: ReturnType<typeof useWebsocket>
+export function useWebSocketPing(
+  webSocketRef: ReturnType<typeof useWebSocket>
 ) {
-  const sendMessage = useSendMessage(websocketRef)
+  const sendMessage = useSendMessage(webSocketRef)
   const { tree } = useContext(GlobalLayoutRouterContext)
 
   useEffect(() => {

filename: packages/next/src/next-devtools/userspace/app/errors/use-forward-console-log.ts
patch: @@ -1,9 +1,9 @@
 import { useEffect } from 'react'
 import { isTerminalLoggingEnabled, logQueue } from '../forward-logs'
-import type { useWebsocket } from '../../../../client/dev/hot-reloader/app/use-websocket'
+import type { useWebSocket } from '../../../../client/dev/hot-reloader/app/web-socket'
 
 export const useForwardConsoleLog = (
-  socketRef: ReturnType<typeof useWebsocket>
+  socketRef: ReturnType<typeof useWebSocket>
 ) => {
   useEffect(() => {
     if (!isTerminalLoggingEnabled) {
Repository: ollama/ollama
Pull request: cleanup: command args

A number of subcommands incorrectly set `MinimumNArgs` instead of `ExactArgs` which leads to confusion.

Related #803 

Changed files:
filename: cmd/cmd.go
patch: @@ -932,7 +932,7 @@ func NewCLI() *cobra.Command {
 	createCmd := &cobra.Command{
 		Use:     "create MODEL",
 		Short:   "Create a model from a Modelfile",
-		Args:    cobra.MinimumNArgs(1),
+		Args:    cobra.ExactArgs(1),
 		PreRunE: checkServerHeartbeat,
 		RunE:    CreateHandler,
 	}
@@ -942,7 +942,7 @@ func NewCLI() *cobra.Command {
 	showCmd := &cobra.Command{
 		Use:     "show MODEL",
 		Short:   "Show information for a model",
-		Args:    cobra.MinimumNArgs(1),
+		Args:    cobra.ExactArgs(1),
 		PreRunE: checkServerHeartbeat,
 		RunE:    ShowHandler,
 	}
@@ -969,13 +969,14 @@ func NewCLI() *cobra.Command {
 		Use:     "serve",
 		Aliases: []string{"start"},
 		Short:   "Start ollama",
+		Args:    cobra.ExactArgs(0),
 		RunE:    RunServer,
 	}
 
 	pullCmd := &cobra.Command{
 		Use:     "pull MODEL",
 		Short:   "Pull a model from a registry",
-		Args:    cobra.MinimumNArgs(1),
+		Args:    cobra.ExactArgs(1),
 		PreRunE: checkServerHeartbeat,
 		RunE:    PullHandler,
 	}
@@ -985,7 +986,7 @@ func NewCLI() *cobra.Command {
 	pushCmd := &cobra.Command{
 		Use:     "push MODEL",
 		Short:   "Push a model to a registry",
-		Args:    cobra.MinimumNArgs(1),
+		Args:    cobra.ExactArgs(1),
 		PreRunE: checkServerHeartbeat,
 		RunE:    PushHandler,
 	}
@@ -1001,15 +1002,15 @@ func NewCLI() *cobra.Command {
 	}
 
 	copyCmd := &cobra.Command{
-		Use:     "cp",
+		Use:     "cp SOURCE TARGET",
 		Short:   "Copy a model",
-		Args:    cobra.MinimumNArgs(2),
+		Args:    cobra.ExactArgs(2),
 		PreRunE: checkServerHeartbeat,
 		RunE:    CopyHandler,
 	}
 
 	deleteCmd := &cobra.Command{
-		Use:     "rm",
+		Use:     "rm MODEL [MODEL...]",
 		Short:   "Remove a model",
 		Args:    cobra.MinimumNArgs(1),
 		PreRunE: checkServerHeartbeat,
Repository: ollama/ollama
Pull request: image: show parameters

map options back into an any slice so the template can do the work of stringify the values

Changed files:
filename: server/images.go
patch: @@ -896,51 +896,27 @@ func DeleteModel(name string) error {
 }
 
 func ShowModelfile(model *Model) (string, error) {
-	type modelTemplate struct {
+	var mt struct {
 		*Model
-		From   string
-		Params string
+		From       string
+		Parameters map[string][]any
 	}
 
-	var params []string
+	mt.Parameters = make(map[string][]any)
 	for k, v := range model.Options {
-		switch val := v.(type) {
-		case string:
-			params = append(params, fmt.Sprintf("PARAMETER %s %s", k, val))
-		case int:
-			params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.Itoa(val)))
-		case float64:
-			params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.FormatFloat(val, 'f', 0, 64)))
-		case bool:
-			params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.FormatBool(val)))
-		case []interface{}:
-			for _, nv := range val {
-				switch nval := nv.(type) {
-				case string:
-					params = append(params, fmt.Sprintf("PARAMETER %s %s", k, nval))
-				case int:
-					params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.Itoa(nval)))
-				case float64:
-					params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.FormatFloat(nval, 'f', 0, 64)))
-				case bool:
-					params = append(params, fmt.Sprintf("PARAMETER %s %s", k, strconv.FormatBool(nval)))
-				default:
-					log.Printf("unknown type: %s", reflect.TypeOf(nv).String())
-				}
-			}
-		default:
-			log.Printf("unknown type: %s", reflect.TypeOf(v).String())
+		if s, ok := v.([]any); ok {
+			mt.Parameters[k] = s
+			continue
 		}
-	}
 
-	mt := modelTemplate{
-		Model:  model,
-		From:   model.OriginalModel,
-		Params: strings.Join(params, "\n"),
+		mt.Parameters[k] = []any{v}
 	}
 
-	if mt.From == "" {
-		mt.From = model.ModelPath
+	mt.Model = model
+	mt.From = model.ModelPath
+
+	if model.OriginalModel != "" {
+		mt.From = model.OriginalModel
 	}
 
 	modelFile := `# Modelfile generated by "ollama show"
@@ -957,8 +933,12 @@ SYSTEM """{{ .System }}"""
 {{- range $adapter := .AdapterPaths }}
 ADAPTER {{ $adapter }}
 {{- end }}
-{{ .Params }}
-`
+
+{{- range $k, $v := .Parameters }}
+{{- range $parameter := $v }}
+PARAMETER {{ $k }} {{ printf "%#v" $parameter }}
+{{- end }}
+{{- end }}`
 
 	tmpl, err := template.New("").Parse(modelFile)
 	if err != nil {
Repository: facebook/react
Pull request: Fix nightly release job for real

Just going to claim the original PR was a test. This fixes the job for real. 

Changed files:
filename: scripts/release/publish-commands/publish-to-npm.js
patch: @@ -19,7 +19,7 @@ const run = async ({cwd, dry, tags, ci}, packageName, otp) => {
   // But for now the easiest way is just to ask if this is expected.
   const {status} = spawnSync('npm', ['view', `${packageName}@${version}`]);
   const packageExists = status === 0;
-  if (!packageExists) {
+  if (packageExists) {
     console.log(
       theme`{package ${packageName}} {version ${version}} has already been published.`
     );
Repository: denoland/deno
Pull request: fix(dts): update stream type declarations to use `Promise<void>`

This updates the type declarations for stream-related interfaces to use `Promise<void>` instead of `Promise<undefined>`, aligning with TypeScript's official type declarations.

### Background

TypeScript's official DOM type declarations have been updated to use `Promise<void>` instead of `Promise<undefined>` since around version 5.8:

- [lib.dom.d.ts in v5.8.2](https://github.com/microsoft/TypeScript/blob/v5.8.2/src/lib/dom.generated.d.ts#L27392)
- [lib.dom.d.ts in v5.7.3](https://github.com/microsoft/TypeScript/blob/v5.7.3/src/lib/dom.generated.d.ts#L26767)

This change causes type mismatch between Web streams converted from Node's stream and Deno's native ones.

### Changes

- Updated `ReadableStreamGenericReader.closed` from `Promise<undefined>` to `Promise<void>`
- Updated `WritableStreamDefaultWriter.closed` from `Promise<undefined>` to `Promise<void>`
- Updated `WritableStreamDefaultWriter.ready` from `Promise<undefined>` to `Promise<void>`
- Updated `WebTransport.ready` from `Promise<undefined>` to `Promise<void>`

### Testing

Confirmed that Deno v2.5.1 gives the type error for the following code while the deno binary with this patch applied doesn't.

```shell
$ cat main.ts
import type { WritableStream as NodeWebWritableStream } from "node:stream/web";

declare const nodeWebWritableStream: NodeWebWritableStream;

const _writableStream: WritableStream = nodeWebWritableStream;

$ /home/yusuke/Repo/github.com/magurotuna/deno/target/debug/deno check ./main.ts

$ echo $?
0
```

---

Fixes #30819


Changed files:
filename: cli/tsc/dts/lib.deno_web.d.ts
patch: @@ -737,7 +737,7 @@ type ReadableStreamController<T> =
 
 /** @category Streams */
 interface ReadableStreamGenericReader {
-  readonly closed: Promise<undefined>;
+  readonly closed: Promise<void>;
   cancel(reason?: any): Promise<void>;
 }
 
@@ -1079,9 +1079,9 @@ declare var WritableStreamDefaultController: {
  * @category Streams
  */
 interface WritableStreamDefaultWriter<W = any> {
-  readonly closed: Promise<undefined>;
+  readonly closed: Promise<void>;
   readonly desiredSize: number | null;
-  readonly ready: Promise<undefined>;
+  readonly ready: Promise<void>;
   abort(reason?: any): Promise<void>;
   close(): Promise<void>;
   releaseLock(): void;
@@ -1533,7 +1533,7 @@ interface WebTransport {
     WebTransportReceiveStream
   >;
   /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebTransport/ready) */
-  readonly ready: Promise<undefined>;
+  readonly ready: Promise<void>;
   /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebTransport/close) */
   close(closeInfo?: WebTransportCloseInfo): void;
   /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebTransport/createBidirectionalStream) */
Repository: ollama/ollama
Pull request: add error for `falcon` and `starcoder` vocab compatibility

A recent update to llama.cpp introduced a compatibility issue with `starcoder` and `falcon` model families, this adds a friendly error message hint when these models fail to load

Changed files:
filename: llm/llama.go
patch: @@ -18,6 +18,7 @@ import (
 	"path"
 	"path/filepath"
 	"runtime"
+	"slices"
 	"strconv"
 	"strings"
 	"sync"
@@ -285,7 +286,7 @@ func (w *StatusWriter) Write(b []byte) (int, error) {
 	return os.Stderr.Write(b)
 }
 
-func newLlama(model string, adapters []string, runners []ModelRunner, numLayers int64, opts api.Options) (*llama, error) {
+func newLlama(model string, adapters []string, runners []ModelRunner, ggml *GGML, opts api.Options) (*llama, error) {
 	fileInfo, err := os.Stat(model)
 	if err != nil {
 		return nil, err
@@ -295,7 +296,7 @@ func newLlama(model string, adapters []string, runners []ModelRunner, numLayers
 		return nil, errors.New("ollama supports only one lora adapter, but multiple were provided")
 	}
 
-	numGPU := NumGPU(numLayers, fileInfo.Size(), opts)
+	numGPU := NumGPU(ggml.NumLayers(), fileInfo.Size(), opts)
 	params := []string{
 		"--model", model,
 		"--ctx-size", fmt.Sprintf("%d", opts.NumCtx),
@@ -406,6 +407,13 @@ func newLlama(model string, adapters []string, runners []ModelRunner, numLayers
 
 	if runnerErr != nil {
 		// this is the error returned from the llama runner process that failed most recently
+
+		// falcon and starcoder model families are not compatible with older versions of llama.cpp
+		families := []string{"falcon", "starcoder"}
+		if strings.Contains(runnerErr.Error(), "failed to load model") && slices.Contains(families, ggml.ModelFamily()) {
+			return nil, fmt.Errorf("%v: %s", runnerErr, "this model may be incompatible with your version of Ollama. Please run `ollama pull` to get the latest version of this model.")
+		}
+
 		return nil, runnerErr
 	}
 

filename: llm/llm.go
patch: @@ -86,9 +86,9 @@ func New(workDir, model string, adapters []string, opts api.Options) (LLM, error
 	switch ggml.Name() {
 	case "gguf":
 		opts.NumGQA = 0 // TODO: remove this when llama.cpp runners differ enough to need separate newLlama functions
-		return newLlama(model, adapters, chooseRunners(workDir, "gguf"), ggml.NumLayers(), opts)
+		return newLlama(model, adapters, chooseRunners(workDir, "gguf"), ggml, opts)
 	case "ggml", "ggmf", "ggjt", "ggla":
-		return newLlama(model, adapters, chooseRunners(workDir, "ggml"), ggml.NumLayers(), opts)
+		return newLlama(model, adapters, chooseRunners(workDir, "ggml"), ggml, opts)
 	default:
 		return nil, fmt.Errorf("unknown ggml type: %s", ggml.ModelFamily())
 	}
Repository: electron/electron
Pull request: build: update codespaces config

#### Description of Change

Format on save has given me headaches for ages changing loads of unrelated code in files and i think it's probably best we remove it. Also add @dsanders11's extension!

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none

Changed files:
filename: .devcontainer/devcontainer.json
patch: @@ -1,4 +1,5 @@
 {
+	"name": "Electron Core Development Environment",
 	"dockerComposeFile": "docker-compose.yml",
 	"service": "buildtools",
 	"onCreateCommand": ".devcontainer/on-create-command.sh",
@@ -33,27 +34,15 @@
 				"surajbarkale.ninja",
 				"ms-vscode.cpptools",
 				"mutantdino.resourcemonitor",
+				"dsanders11.vscode-electron-build-tools",
 				"dbaeumer.vscode-eslint",
 				"shakram02.bash-beautify",
-				"marshallofsound.gnls-electron",
+				"marshallofsound.gnls-electron"
 			],
 			"settings": {
 				"editor.tabSize": 2,
 				"bashBeautify.tabSize": 2,
 				"typescript.tsdk": "node_modules/typescript/lib",
-				"[gn]": {
-					"editor.formatOnSave": true
-				},
-				"[javascript]": {
-					"editor.codeActionsOnSave": {
-						"source.fixAll.eslint": true
-					}
-				},
-				"[typescript]": {
-					"editor.codeActionsOnSave": {
-						"source.fixAll.eslint": true
-					}
-				},
 				"javascript.preferences.quoteStyle": "single",
 				"typescript.preferences.quoteStyle": "single"
 			}
Repository: ollama/ollama
Pull request: Fix Issue with Leading Whitespaces in Decoded Context

This Pull Request addresses a bug in the Decode function where leading whitespaces are not properly removed from the decoded context.

I have tested the behavior both before and after making this change:

- Before: The leading whitespaces were present when using the context.
- After: The leading whitespaces were properly removed.

Changed files:
filename: llm/llama.go
patch: @@ -479,6 +479,9 @@ func (llm *llama) Predict(ctx context.Context, prevContext []int, prompt string,
 		return err
 	}
 
+	// Remove leading spaces from prevConvo if present
+	prevConvo = strings.TrimPrefix(prevConvo, " ")
+
 	var nextContext strings.Builder
 	nextContext.WriteString(prevConvo)
 	nextContext.WriteString(prompt)
@@ -688,9 +691,6 @@ func (llm *llama) Decode(ctx context.Context, tokens []int) (string, error) {
 		return "", fmt.Errorf("unmarshal encode response: %w", err)
 	}
 
-	// decoded content contains a leading whitespace
-	decoded.Content, _ = strings.CutPrefix(decoded.Content, "")
-
 	return decoded.Content, nil
 }
Repository: facebook/react
Pull request: Fix nightly release job

## Summary

By upgrading Node.js in https://github.com/facebook/react/pull/28774, NPM was also upgraded. `npm view` of a non-existing version now exits non-zero so we need to adjust our implementation to detect if the package was already published.

Fixes 
> Command failed: npm view eslint-plugin-react-hooks@5.1.0-canary-bf09089f6-20240410

-- https://app.circleci.com/pipelines/github/facebook/react/52188/workflows/71bfe167-2a02-4924-98cf-824b7812614e

## How did you test this change?

```js
// main.js
const {spawnSync} = require('child_process');

function npmPackageExists(packageName, version) {
  const {status} = spawnSync('npm', ['view', `${packageName}@${version}`]);
  return status === 0;
}

function main() {
  console.log(npmPackageExists('react', '17.0.1'));
  console.log(npmPackageExists('react', '19.0.0-canary-bf09089f6-20240410'));
}

main();
```

```bash
$ node --version
v18.20.0
$ npm --version
10.5.0
$ node index.js 
true
false
```

Changed files:
filename: scripts/release/publish-commands/publish-to-npm.js
patch: @@ -2,10 +2,11 @@
 
 'use strict';
 
+const {spawnSync} = require('child_process');
 const {exec} = require('child-process-promise');
 const {readJsonSync} = require('fs-extra');
 const {join} = require('path');
-const {confirm, execRead} = require('../utils');
+const {confirm} = require('../utils');
 const theme = require('../theme');
 
 const run = async ({cwd, dry, tags, ci}, packageName, otp) => {
@@ -16,8 +17,9 @@ const run = async ({cwd, dry, tags, ci}, packageName, otp) => {
   // If so we might be resuming from a previous run.
   // We could infer this by comparing the build-info.json,
   // But for now the easiest way is just to ask if this is expected.
-  const info = await execRead(`npm view ${packageName}@${version}`);
-  if (info) {
+  const {status} = spawnSync('npm', ['view', `${packageName}@${version}`]);
+  const packageExists = status === 0;
+  if (!packageExists) {
     console.log(
       theme`{package ${packageName}} {version ${version}} has already been published.`
     );
Repository: ollama/ollama
Pull request: model: native gotemplate adapter template

Use gotemplate range instead of string concatenation 

Changed files:
filename: server/images.go
patch: @@ -955,11 +955,12 @@ TEMPLATE """{{ .Template }}"""
 {{- if .System }}
 SYSTEM """{{ .System }}"""
 {{- end }}
+
+{{- range $adapter := .AdapterPaths }}
+ADAPTER {{ $adapter }}
+{{- end }}
 {{ .Params }}
 `
-	for _, l := range mt.Model.AdapterPaths {
-		modelFile += fmt.Sprintf("ADAPTER %s\n", l)
-	}
 
 	tmpl, err := template.New("").Parse(modelFile)
 	if err != nil {
Repository: huggingface/transformers
Pull request: Fix collated reports model name entry


Changed files:
filename: utils/collated_reports.py
patch: @@ -172,7 +172,7 @@ def upload_collated_report(job: str, report_repo_id: str, filename: str):
             continue
 
         # Create a new entry for the model
-        model_name = model_dir.name.removeprefix(machine_type).removesuffix("_test_reports")
+        model_name = model_dir.name.split("models_")[-1].removesuffix("_test_reports")
         report = {"model": model_name, "results": []}
         results = []
Repository: electron/electron
Pull request: perf: avoid redundant map lookups in `GlobalShortcut`

#### Description of Change

Avoid redundant map lookups in `GlobalShortcut::OnKeyPressed()` and `GlobalShortcut::ExecuteComand()`.

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none.

Changed files:
filename: shell/browser/api/electron_api_global_shortcut.cc
patch: @@ -7,6 +7,7 @@
 #include <string>
 #include <vector>
 
+#include "base/containers/map_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/uuid.h"
 #include "components/prefs/pref_service.h"
@@ -57,22 +58,24 @@ GlobalShortcut::~GlobalShortcut() {
 }
 
 void GlobalShortcut::OnKeyPressed(const ui::Accelerator& accelerator) {
-  if (!accelerator_callback_map_.contains(accelerator)) {
+  if (auto* cb = base::FindOrNull(accelerator_callback_map_, accelerator)) {
+    cb->Run();
+  } else {
     // This should never occur, because if it does,
     // ui::GlobalAcceleratorListener notifies us with wrong accelerator.
     NOTREACHED();
   }
-  accelerator_callback_map_[accelerator].Run();
 }
 
 void GlobalShortcut::ExecuteCommand(const extensions::ExtensionId& extension_id,
                                     const std::string& command_id) {
-  if (!command_callback_map_.contains(command_id)) {
+  if (auto* cb = base::FindOrNull(command_callback_map_, command_id)) {
+    cb->Run();
+  } else {
     // This should never occur, because if it does, GlobalAcceleratorListener
     // notifies us with wrong command.
     NOTREACHED();
   }
-  command_callback_map_[command_id].Run();
 }
 
 bool GlobalShortcut::RegisterAll(