sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: next.js
Issue: WebWorkers - Worker is not defined when calling new Worker()
Labels: bug

### What version of Next.js are you using?

11.1.2

### What version of Node.js are you using?

14.0.0

### What browser are you using?

Chrome

### What operating system are you using?

macOS

### How are you deploying your application?

other platform

### Describe the Bug

I'm using next with typescript and trying to load a webworker.

For some reason - when I'm trying to initialize the webworker when I'm creating a hook - next tells me that Worker is not defined. 

I'm using comlink but I suspect it's an issue with Next since comlink isn't in the mix at the point of error.


You can find the problematic line in below code snippet `useWorker.hooks.ts` in the function `makeWorkerApiAndCleanup`

`  const worker = new Worker(url);`


useWorker.hooks.ts
```
import { wrap, releaseProxy } from "comlink";
import { useEffect, useState, useMemo } from "react";

function makeWorkerApiAndCleanup() {
  const url = new URL("./useWorker.worker", import.meta.url)
  const worker = new Worker(url);
  const workerApi = wrap<import("./useWorker.worker").WorkerType>(worker);

  const cleanup = () => {
    workerApi[releaseProxy]();
    worker.terminate();
  };

  const workerApiAndCleanup = { workerApi, cleanup };

  return workerApiAndCleanup;
}

function useWorker() {
  const workerApiAndCleanup = useMemo(() => makeWorkerApiAndCleanup(), []);

  useEffect(() => {
    const { cleanup } = workerApiAndCleanup;
    return () => {
      cleanup();
    };
  }, [workerApiAndCleanup]);

  return workerApiAndCleanup;
}

function useImplementation() {
  const [data, setData] = useState({});

  const { workerApi } = useWorker();

  useEffect(() => {
    workerApi.workerFunction();
    setData({});
  }, [workerApi]);

  return data;
}

export default useImplementation;

```

useWorker.worker.ts

```
import { expose } from 'comlink';
import { workerFunction } from './functions';

const worker = {
  workerFunction,
};

export type WorkerType = typeof worker;

expose(worker);
```

useWorker/index.ts

```
import useWorker from './useWorker.hooks';

export { useWorker };
```

### Expected Behavior

Well that the Window() constructor to be defined in any context.

### To Reproduce

Here's a minimal repo:

https://github.com/polisen/browser-file-bundler
Repository: godot
Issue: Crash when adding `AnimationTree` node to scene
Labels: bug,topic:editor,needs testing,crash,topic:animation

### Godot version

3.3.4

### System information

Linux

### Issue description

I opened a `.glb` as an inherited scene, pressed `shift+A` to open the "add node" menu, and selected `AnimationTree`. The editor crashed with this stacktrace:

```
#0  0x00007f652ba24d22 in raise () from /usr/lib/libc.so.6
#1  0x00007f652ba0e862 in abort () from /usr/lib/libc.so.6
#2  0x000000000075609b in handle_crash (sig=<optimized out>) at platform/x11/crash_handler_x11.cpp:50
#3  <signal handler called>
#4  0x0000000002d7723b in Object::get_class_name (this=0x16f5c8c0) at ./core/object.h:659
#5  ClassDB::get_property (p_object=p_object@entry=0x16f5c8c0, p_property=..., r_value=...) at core/class_db.cpp:1070
#6  0x0000000002e0179e in Object::get (this=this@entry=0x16f5c8c0, p_name=..., r_valid=r_valid@entry=0x0) at core/object.cpp:495
#7  0x00000000015874aa in EditorPropertyFloat::update_property (this=0x1fe9a680) at editor/editor_properties.cpp:925
#8  0x0000000001db617d in AnimationNodeBlendTreeEditor::_notification (this=0xfa5a700, p_what=<optimized out>) at ./core/cowdata.h:156
#9  0x0000000002e004e4 in Object::notification (this=0xfa5a700, p_notification=17, p_reversed=<optimized out>) at core/object.cpp:929
#10 0x0000000001e89372 in SceneTree::_notify_group_pause (this=<optimized out>, p_group=..., p_notification=17) at scene/main/scene_tree.cpp:993
#11 0x0000000001e94090 in SceneTree::idle (this=0xa1e7670, p_time=0.0119296657) at scene/main/scene_tree.cpp:530
#12 0x000000000078034e in Main::iteration () at main/main.cpp:2123
#13 0x00000000007645f1 in OS_X11::run (this=this@entry=0x7ffd3ece45c0) at platform/x11/os_x11.cpp:3642
#14 0x000000000074e8ef in main (argc=4, argv=0x7ffd3ece4ec8) at platform/x11/godot_x11.cpp:56
```

### Steps to reproduce

I opened a `.glb` as an inherited scene, pressed `shift+A` to open the "add node" menu, and selected `AnimationTree`. The editor crashed with this stacktrace:


### Minimal reproduction project

[example.zip](https://github.com/godotengine/godot/files/7396639/example.zip)

This does not seem to happen every time, but this is the project I reproed it on.
Repository: excalidraw
Issue: support importing images using `load` button
Labels: discussion,images

Since our load scene button allows you to pick image files because they can contain embedded scene, it may be confusing to users who don't know about this and they expect the image to be added on canvas.

![image](https://user-images.githubusercontent.com/5153846/138446237-79caedf4-a3b8-4592-bd3a-a1da0bc6089a.png)

So, maybe we should allow both, same as we currently do with drag-n-drop of image on scene: prefer scene data if embedded, otherwise paste the image (later we'll likely have a popup dialog where you can choose what action to do).

Originally proposed by @ad1992
Repository: go
Issue: cmd/compile: Get rid of redundant TEST instructions by using the ZF flag of DEC/INC
Labels: Performance,NeedsInvestigation,compiler/runtime

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
go tip
</pre>

### Does this issue reproduce with the latest release?

Yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOVCS=""
GOVERSION="devel go1.18-9ff91b9098 Fri Oct 22 00:57:18 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7d/d_44vx7920vfy_tmc_l6xgprjh03ym/T/go-build2772586434=/tmp/go-build -gno-record-gcc-switches -fno-common"

</pre></details>

### What did you do?
Dumped the Go assembly itself, but this happens for anything compiled with gc.

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->



### What did you expect to see?

The compiler making use of the ZF flag value when emitting DEC(Q|L) / INC(Q|L) instructions.

### What did you see instead?

Redundant TEST(Q|L) instructions for checking if the result is zero, for example:

```
 _math/big.nat.shl:
 
decq	%rdx
testq	%rdx, %rdx
 
 _cmd/go/internal/work.(*Builder).Do.func3:
 
decl	%esi
testl	%esi, %esi
 
 _go/token.(*FileSet).file:
 
incl	%edx
testl	%edx, %edx
 
 _cmd/go/internal/work.gcToolchain.gc:
 
incq	%r9
testq	%r9, %r9
```

We could get rid of testq and use the value of ZF set by INCQ/DECQ instead.

I have looked into this briefly and it seems that it might be better to move the INC/DEC implementation to AMD64.rules instead? Currently it's handled in a special way inside of cmd/cmpile/internal/amd64/ssa.go
Repository: pytorch
Issue: Feature Request: 1d grid sample
Labels: feature,module: nn,triaged,needs research

## 🚀 Feature
support grid sample 1d.

## Motivation
Currently pytorch only supports 2d&3d grid sample. However, sometimes we may want to do grid sample in 1d grids (e.g. for audio).

So I want to add a 1d version of grid sample. It is also expected on [Pytorch Forums](https://discuss.pytorch.org/t/is-there-anything-similar-to-grid-sample-for-1d-input/85517)

## Pitch

It can be used like grid sample 2d/3d

```python
import torch
from torch.nn.functional import grid_sample

N = 16
C = 256
L_in = 64
L_out = 128
input = torch.randn((N, C, L_in)).cuda()
grids = torch.randn((N, L_out)).cuda()
output = grid_sample(input, grids) # support 1d grid sample
```
## Alternatives

Though 1d grid sample can be regarded as a special case of 2d grid sample by assuming H=1 or W=1: 

```python
def grid_sample1d(input, grid):
    grid = grid.unsqueeze(1)  # batch_size * 1 * L_out
    grid = torch.stack([-torch.ones_like(grid), grid], dim=-1)
    z = F.grid_sample(input, grid)
    C = input.shape[1]
    out_shape = [shape[0], C, shape[1]]
    z = z.view(*out_shape)  # batch_size * C * L_out
    return z
```

But the above code will introduce extra memory and computation cost (from `torch.ones_like` and bilinear interpolation).

Besides, when `align_corners=False` and `padding_mode='zeros'`, the result of the above code will be half of the expected (W=1 or H=1 is a corner case for this group of options).

## Additional context

I have implemented CUDA extension of grid sample 1d [here](https://github.com/luo3300612/grid_sample1d).



cc @albanD @mruberry @jbschlosser @walterddr
Repository: kubernetes
Issue: Allowing mutating webhook to change pod spec for mirror pods is confusing. Consider making it clearer
Labels: sig/api-machinery,kind/feature,triage/accepted

### What happened?

Limits applied by LimitRanger to a static Pod are not in effect.

### What did you expect to happen?

Either do apply limits or to not show them in yaml/API and document such behavior (if not yet :smiley:)
First is preferable per my opinion.

### How can we reproduce it (as minimally and precisely as possible)?

1. Make sure you have a LimitRanger with enforced limits.
2. Create a static Pod without limits:
```
apiVersion: v1
kind: Pod
metadata:
  namespace: kube-system
  name: test
spec:
  containers:
  - image: nginx:latest
    name: test
    resources:
      request:
        cpu: 0.1
  dnsPolicy: ClusterFirst
  restartPolicy: Always
  ```
  3. Ensure limits are in Pod's yaml by getting it from API via kubectl:
  ```
      resources:
      limits:
        cpu: "1"
        memory: 2Gi
      requests:
        cpu: 100m
        memory: 256Mi
```

4. Ensure limits are not propagated to docker/cgroups:
```
# docker inspect b8648733a385 -f "{{.HostConfig.Memory}}"
0
```
and
```
# cat /sys/fs/cgroup/memory//kubepods/besteffort/podc5b07aadd2def35b173d5247ac61e619/b8648733a38542484091ed7ee5f123bf9b51d34f5595fa74ca4c8248000c6f92/memory.limit_in_bytes 
9223372036854771712
```

### Anything else we need to know?

If it's a bug and we want to fix it, I would like to try to work on in with support of someone from upstream : )

### Kubernetes version

<details>

```console
$ kubectl version
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:52:00Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.12", GitCommit:"2cb4598553d0a2ca5f3eb7980c99cd8236cc5011", GitTreeState:"clean", BuildDate:"2021-06-16T12:52:44Z", GoVersion:"go1.15.13", Compiler:"gc", Platform:"linux/amd64"}

```

</details>


### Cloud provider

<details>
on premise
</details>


### OS version

_No response_

### Install tools

_No response_

### Container runtime (CRI) and and version (if applicable)

_No response_

### Related plugins (CNI, CSI, ...) and versions (if applicable)

_No response_
Repository: go
Issue: x/text/transform: Document Chain buffer limit
Labels: Documentation,NeedsInvestigation

There is an undocumented buffer limit of 4kb for each link in a [transform.Chain](https://pkg.go.dev/golang.org/x/text/transform#Chain)

### What did you do?

Implemented a `transform.Transformer` which expects `transform.Chain` to buffer all `src` until EOF.

``` go
package main

import "golang.org/x/text/transform"

type Transformer struct {
	transform.NopResetter
}

func (t *Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
	if !atEOF {
		err = transform.ErrShortSrc
	} else {
		n := copy(dst, src)
		nDst = n
		nSrc = n
		if n < len(src) {
			err = transform.ErrShortDst
		}
	}
	return
}

func main() {
	data := make([]byte, 4096+1)
	tr := transform.Chain(
		transform.Nop,
		&Transformer{},
	)
	_, _, err := transform.Bytes(tr, data)
	if err != nil {
		panic(err)
	}
}
```
https://play.golang.org/p/kFLxWtfNwnF

### What did you expect to see?

Since the `transform.Transformer` implementation follows all the rules laid out by the docs, I expected it to work.

### What did you see instead?

The chain returns a "transform: short internal buffer" error if it's asked to buffer more than 4kb (while nothing is consumed).

https://cs.opensource.google/go/x/text/+/refs/tags/v0.3.7:transform/transform.go;l=454-461;drc=5bd84dd9b33bd2bdebd8a6a6477920a8e492d47f
Repository: flutter
Issue: [animations][proposal] Avoid publishing example demo_gifs to pub.dev
Labels: package,c: proposal,p: animations,team-ecosystem,P3,triaged-ecosystem

## Use case
Currently the demo_gifs folder is about 27 MB size and it's included in the package [animations](https://pub.dev/packages/animations) uploaded to pub.dev

## Proposal
Including demo_gifs into `.pubignore` should avoid publishing this unnecessary folder to pub.dev
Repository: TypeScript
Issue: Better contextual filtering for `typescript-basics` snippets
Labels: Suggestion,Domain: Completion Lists,Experience Enhancement

VS Code ships with an extension called `typescript-basics` which contains static snippet definitions for things like control flow constructs and basic declarations. When TS Server serves a request for completions, it includes a boolean switch that controls whether these snippets are added to the completion items in its response, but it can’t say which ones are relevant for the requesting location—it’s all or nothing. This leads to a pretty poor UX, like offering a for-loop in the body of a class:

<img width="556" alt="image" src="https://user-images.githubusercontent.com/3277153/138488483-967ece7b-b28d-4d00-afb8-0f0f07329b5c.png">

But we can’t disable that without disabling the useful method declaration snippet:

<img width="544" alt="image" src="https://user-images.githubusercontent.com/3277153/138488641-41e0cf53-c100-42bc-b2c7-cc72c8eb6647.png">

But equally embarrassingly, the method declaration snippets are offered outside of classes as well:

<img width="226" alt="image" src="https://user-images.githubusercontent.com/3277153/138488752-e74a2167-9eea-4b5e-9c18-800af43e2db6.png">

Now that TS Server has native support for generating snippets, we can easily do better. The simplest change would be to copy these snippets from `typescript-basics` into TS Server and let TS Server include only the relevant ones in a given response. (I say “copy” and not “move” so as not to change the behavior for JS/TS users who have completely disabled TS Server, or during times when TS Server is not available.) Another approach could be to let TS Server’s completions response include some sort of filtering information instead of an all-or-nothing switch to mix the snippets in from the typescript-basics source, but this sounds more complicated, more error-prone, and less backward compatible to me—but in general I’m open to other ways of solving the same problem.
Repository: node
Issue: doc: module.createRequire() not descriptive
Labels: doc,module

# 📗 API Reference Docs Problem

<!--

Thank you for wanting to make nodejs.org better!

This template is for issues with the Node.js API
reference documentation.

For problems with nodejs.org beyond the API
reference documentation, please open an issue
using the issue tracker for our site repository.

  https://github.com/nodejs/nodejs.org

For more general support, please open an issue
using the issue tracker for our help repository.

  https://github.com/nodejs/help

---

For the issue title, please enter a one-line
summary after “doc: ” (preferably 50 characters
or less and no more than 72).

The “✍️” are placeholders signifying requests for
input. Replace them with your responses.

If you are unsure of something, do your best.

-->

<!-- The output of “node --version”. -->

- **Version**: ✍️

Latest (and prior)

<!-- The output of “uname -a” (UNIX) or version
and 32-bit or 64-bit (Windows). -->

- **Platform**: ✍️

n/a

<!-- The name of affected core module. -->

- **Subsystem**: ✍️

'module'

## Location

_see below_


## Description

_Concise explanation of the problem_

<!-- If applicable, include any screenshots that
may help solve the problem. -->

✍️

for reference:
https://nodejs.org/dist/latest-v17.x/docs/api/module.html#modulecreaterequirefilename

the documentation for `createRequire` for the `filename parameter` states:

`Filename to be used to construct the require function. Must be a file URL object, file URL string, or absolute path string.`

which is not really descriptive about what is expected and how it influences the behavior.

from an older version of the [now removed] `createRequireFromPath` function the docs state:
https://nodejs.org/dist/v12.2.0/docs/api/modules.html#modules_module_createrequirefrompath_filename

`Filename to be used to construct the relative require function.`

I assume it puts the [created] require function in the relative path (directory) of the specified filename parameter. Not really sure how I would express this in a meaningful way. 🤔 

I think it would also make sense to add a little explainer why such a thing exists: `require` does not exist in an es module context vs. `commonjs` can also be imported with es module syntax, although the expectations and behavior in both are likely very different as well.

the docs could also state that `createRequire` is less useful in a commonjs context, e.g. `const { createRequire: _require = require('module')`

---

<!-- Use “[x]” to check the box below if you are
interested in contributing. -->

- [x] I would like to work on this issue and submit a pull request.
Repository: pytorch
Issue: JIT: inconsistency in LSTM.forward
Labels: oncall: jit

## 🐛 Bug

Either a wrong type signature in `torch.nn.modules.rnn.LSTM` or Unions are not handled correctly.

## To Reproduce

1.10 supports Unions with JIT :) but it seems there is some issue when using `torch.nn.modules.rnn.LSTM`:

```py
from typing import Union

import torch


class Test(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.rnn = torch.nn.modules.rnn.LSTM(input_size=1, hidden_size=1)

    def forward(
        self, x: Union[torch.nn.utils.rnn.PackedSequence, torch.Tensor]
    ) -> Union[torch.nn.utils.rnn.PackedSequence, torch.Tensor]:
        return self.rnn(x)


model = Test()
model = torch.jit.script(model)
model(torch.rand(1, 1, 1))  # works when not JITing
```
```
RuntimeError: 
Arguments for call are not valid.
The following variants are available:
  
  forward__0(__torch__.torch.nn.modules.rnn.LSTM self, Tensor input, (Tensor, Tensor)? hx=None) -> ((Tensor, (Tensor, Tensor))):
  Expected a value of type 'Tensor' for argument 'input' but instead found type 'Union[Tensor, __torch__.torch.nn.utils.rnn.PackedSequence]'.
  
  forward__1(__torch__.torch.nn.modules.rnn.LSTM self, __torch__.torch.nn.utils.rnn.PackedSequence input, (Tensor, Tensor)? hx=None) -> ((__torch__.torch.nn.utils.rnn.PackedSequence, (Tensor, Tensor))):
  Expected a value of type '__torch__.torch.nn.utils.rnn.PackedSequence' for argument 'input' but instead found type 'Union[Tensor, __torch__.torch.nn.utils.rnn.PackedSequence]'.

The original call is:
  File "/pool01/home/twoertwe/git/python-tools/python-tools/jit.py", line 21
        self, x: Union[torch.nn.utils.rnn.PackedSequence, torch.Tensor]
    ) -> Union[torch.nn.utils.rnn.PackedSequence, torch.Tensor]:
        return self.rnn(x)
               ~~~~~~~~ <--- HERE
```
Repository: create-react-app
Issue: Based on the screenshot, the file name is `Faceboook.js` and you are trying to import `Facebook.js`. May be that could the reason.
Labels: stale

Based on the screenshot, the file name is `Faceboook.js` and you are trying to import `Facebook.js`. May be that could the reason.

_Originally posted by @pratyushj in https://github.com/facebook/create-react-app/issues/7395#issuecomment-513374138_
Repository: go
Issue: net/url: unescape doesn't handle certain forms of double encoding
Labels: NeedsInvestigation

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.17 linux/amd64
</pre>

### Does this issue reproduce with the latest release?

Yes.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/anon/.cache/go-build"
GOENV="/home/anon/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/anon/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/anon/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build697905611=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

We ran into an issue where Go's [net/url unescape function](https://github.com/golang/go/blob/master/src/net/url/url.go#L199) threw an error on a variant of double encoding that doesn't happen in other programming languages. A specific example is using `%%32%65` as an alternative to `%252e`. Here's a demonstration of the error in Go playground:

https://play.golang.org/p/bfPg9f_oGxF

The docs are fairly clear about this and say:

> It returns an error if any % is not followed by two hexadecimal digits.

The issue however is that other languages use an algorithm similar to the one specified in [WHATWG's URL spec](https://url.spec.whatwg.org/#percent-decode).

An example from Python's urllib:
```
$ python3
Python 3.9.5 (default, May 11 2021, 08:20:37) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.parse
>>> urllib.parse.unquote("%%32%65")
'%2e'
>>> 
```

Another example using Rust servo percent-encoding crate:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a4fe1ba83872cb894ad56a85845abeba

### What did you expect to see?

I would expect it to be handled similar to the WHATWG URL spec for percent decoding. In this very specific example it would decode to `%2e`.

### What did you see instead?

A decoding error show here:

https://play.golang.org/p/bfPg9f_oGxF