WhereIsAI/github-issue-similarity huggingface dataset:
Issue 1:
Currently, TypeScript requires that the get and the set types of properties match. However, there are scenarios where, I think, it would be very useful to have a set that is more accepting than the get.

For example: imagine you have a property of Array<Array<string>> type. Today, this means that both the get and set would have to be of the same type, and so setting the property would always be done via the array notation.

It seems reasonable, however, to allow the "setter" to be more forgiving and let it coalesce a single string value into an array automatically. That way, when setting the property, you could either do cell.values = [[1]] or just cell.values = 1, and the class would accept either syntax. But for return values, it would always return an array type, and so the get of the values property should still be marked as Array<Array<string>> (that way you would get all the good IntelliSense of having .filter, .forEach, etc., on the return type).

class Cell {
private _values: Array<Array<string>>;
get values():Array<Array<string>>{
return this._values;
}
set values(values: Array<Array<string>>|string) {
if (values instanceof Array) {
this._values = <Array<Array<string>>>values;
} else {
this._values = [[<string>values]];
}
}
}

Today, this code would trigger an error that "get and set accessors must have the same type".

The only workarounds available today are both less than ideal:

Set the property of values -- both "set" and "get" -- to any. But in doing so, you lose all IntelliSense.

Mark the property -- both "set" and "get" -- as Array<Array<string>>|string. However, while this solves the "set" problem, the "get" property loses a lot of the IntelliSense (.filter, .forEach), and is actually no longer true to reality (the return value is always an array, not an "array or a string")

Would be great if the scenario of a "more inclusive set property" could be supported.

Issue 2:
Namespaces are objects that can hold types, but cannot be passed around because don't have a type themselves.

Objects are mostly namespaces which can be passed around because they are typed, but cannot hold types in them.

Looks like this difference is a made up thing.

Consider unifying objects and namespaces.

possible resolution of #8308
Issue 1:
Describe the bug

i have orbitcontroller.update() in the animate loop for damping

and

after doing orbitcontroller.enabled=false , i still cant tilt the camera,

my guess is , the update logic to prevent the camera from tilting /going upside down is still running

Expected behavior

maybe in the update function when orbitcontroller.enabled=false , return early ?

three.js/examples/jsm/controls/OrbitControls.js

Line 154
in
0d7fb8d

this.update = function () {

Platform:

Device: [Desktop, Mobile]

OS: [Windows]

Browser: [Chrome]

Three.js version: [dev]

Issue 2:
Description of the problem

I was trying to manually set camera to a position and lookat target and disable control. However the disable does not seem to really shut down control from meddleing with the camera, unless I also set the control's target to be the same as the new camera's lookat target, it will update the camera.

Sample code:

// Try set my camera, then disable orbit control
updateCamera(pos, target) {
this.camera.position.copy(pos);
this.camera.lookAt(target);
// This won't work
this.orbitControl.enabled = false;
}

Possible cause that I guess:

I have a mainloop calback that keeps calling orbitControls.update() for inertia animation, my guess is that the update function meddles with camera and does not respect that enabled=== false setting.

I found the cure is to add this:

this.orbitControls.target = pos; // I also noted that setting target would re-enable a disabled orbit controls.

I guess my main complaint is that I did not expect orbitControls to be able to change camera at all, after setting disabled. Including setting target, or calling update.

Three.js version

r118

Browser

All of them

OS

All of them
Issue 1:
Reproducing code example:

import numpy
numpy.unique(numpy.empty((0, 2)), axis=0)

Error message:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__array_function__ internals>", line 5, in unique
File "/opt/python/3.8.2.1/lib/python3.8/site-packages/numpy/lib/arraysetops.py", line 275, in unique
ar = ar.reshape(orig_shape[0], -1)
ValueError: cannot reshape array of size 0 into shape (0,newaxis)

NumPy/Python version information:

1.18.2 3.8.2 (default, May 13 2020, 11:50:46)
[GCC 8.1.0 20180502 (Cray Inc.)]

Issue 2:
Using np.unique with the axis argument on a multidimensional array with zero in one or more of the dimensions hits ValueError failures, seemingly due to sizes/reshaping.

When axis is one of the zero dimensions (that is, shape[axis] == 0), it throws ValueError: cannot reshape array of size 0 into shape (0,newaxis).

When axis is a non-zero dimension (shape[axis] == 1), it throws ValueError: When changing to a smaller dtype, its size must be a divisor of the size of original dtype.

Reproducing code example:

import numpy as np
arr = np.zeros(shape=(0, 10))

np.unique(arr, axis=0)
# ValueError: cannot reshape array of size 0 into shape (0,newaxis)

np.unique(arr, axis=1)
# ValueError: When changing to a smaller dtype, its size must be a divisor of the size of original dtype

# equivalent code with non-zero dimension works as expected:
arr = np.zeros(shape=(1, 10))
np.unique(arr, axis=0)
# array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]])
np.unique(arr, axis=1)
# array([[0.]])

Error message:

np.unique(arr, axis=0)

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__array_function__ internals>", line 6, in unique
File "~/.pyenv/versions/numpy-bug/lib/python3.6/site-packages/numpy/lib/arraysetops.py", line 275, in unique
ar = ar.reshape(orig_shape[0], -1)
ValueError: cannot reshape array of size 0 into shape (0,newaxis)

np.unique(arr, axis=1)

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__array_function__ internals>", line 6, in unique
File "~/.pyenv/versions/numpy-bug/lib/python3.6/site-packages/numpy/lib/arraysetops.py", line 280, in unique
consolidated = ar.view(dtype)
ValueError: When changing to a smaller dtype, its size must be a divisor of the size of original dtype

Numpy/Python version information:

Numpy: 1.18.1

Python: 3.6.9 (default, Jul 10 2019, 12:25:55) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]
Issue 1:
Migrated issue, originally created by Anonymous

I'm not sure about other DB backends, but postgres supports also unique/check constraints to be inspected on db. Any change to get this into SA?

Issue 2:
Migrated issue, originally created by Brendan Abel (@babel)

This is using sqlalchemy 0.9.8

Assuming a declarative class called "MyClass" with an association proxy field call "my_field"

>>> ap = MyClass.__mapper__.all_orm_descriptors['my_field']
>>> ap.owning_class
None

>>> ap = MyClass.my_field
>>> ap.owning_class
<class 'MyClass'>

>>> ap = MyClass.__mapper__.all_orm_descriptors['my_field']
>>> ap.owning_class
<class 'MyClass'>

Without the owning_class set, most of the other properties will raise exceptions when trying to access them. This can be problematic when using the mapper class to procedurally access fields via the mapper.

Attachments: rework_attribute_proxy_owner.patch | aptest.py
Issue 1:
rust-lang/rfcs#840

Issue 2:
Take this code:

trait Foo { type Value: 'static; }

fn require_static<T: 'static>() {}

fn takes_foo<F: Foo>() {
require_static::<F::Value>()
}

Since Foo::Value is bounded with 'static, we would expect this to compile, but instead we get this error message:

<anon>:6:3: 6:29 error: the associated type `<F as Foo>::Value` may not live long enough
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:6:3: 6:29 help: consider adding an explicit lifetime bound `<F as Foo>::Value: 'static`...
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:6:3: 6:29 note: ...so that the declared lifetime parameter bounds are satisfied
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

Which seems redundant, if not incorrect.

playpen: http://is.gd/UkEaDV

cc @nikomatsakis from IRC
Issue 1:
Documentation Link

https://matplotlib.org/devdocs/gallery/widgets/span_selector.html

Problem

I've noticed this in a couple instances, but was requested via twitter to report this one. I think a visitor would expect the spanselector example to be a dynamic, working version. When I go to the stable or dev link, it appears as a static image.

Suggested improvement

A working example would be helpful for users to know how spanselector actually works. This seems like a great feature that folks might like to embed in their websites.

Issue 2:
Problem

It can be hard to discern what a widget example does as for many of them there are no images that show up in the docs. For example the Lasso Selector Demo has no image and the Lasso Demo only has a static image.

Suggested Improvement

Manually generate GIFS of the usage and embed them onto the example pages. For example here is a GIF of me using the LassoSelector demo:

I'm not sure if sphinx-gallery supports this though? maybe embeding and html <img> tag into the comment at the top would work?

Also instead of .gifs I it would be better to keep files small by using .apng and running them https://tinypng.com/
Issue 1:
Bug

Input Code

REPL LINK

function delay(time) {
return new Promise((resolve, reject)=>{
setTimeout(()=>resolve(), time);
});
}

[1000,2000,3000,4000].forEach(async (time) => {
await delay(time);
console.log(time);
})

console.log([100000])

Expected Behavior

Output:

Array [100000] // at 0s
1000 // at 1s
2000 // at 2s
3000 // at 3s
4000 // at 4s

And the Chrome newest version just act like this.

Current Behavior

Output:

// at 0s
Array [100000]

// at 1s
Array [100000]
1000

// at 2s
Array [100000]
1000
2000

// at 3s
Array [100000]
1000
2000
3000

// at 4s
Array [100000]
1000
2000
3000
4000

I thought the problem is at the function _asyncToGenerator.

Issue 2:
Bug Report

Current Behavior

using decorators with stage-0 doesn't work as before; no mix of syntax-decorators and decoratorsBefore or legacy works;

throws mix of errors like legacy true and/or decoratorsBeforeExport true/false required

see duplicate code throughout babel handling decorators, all start with var decoratorsBeforeExport = followed by this bizarre throw sequence of checks:

var decoratorsBeforeExport = ....
if( ... null
throw ... Error
other cases...
throw Error(s)

Input Code

REPL or Repo link if applicable:

@Thing
export default class Stuff extends Extensible

Expected behavior/code

A clear and concise description of what you expected to happen (or code).

Babel Configuration (.babelrc, package.json, cli command)

various combinations of:
{
presets: ["stage-0","react"]
,plugins: [["syntax-decorators", {"legacy":true, "decoratorsBeforeExport":true}]]
}

Environment

Babel version 7.0.0

How you are using Babel: web browser

Possible Solution

handle decorators in one place, comment in code how to properly set the options so that the old stage-0 legacy behavior (sample above) works as before

Additional context/Screenshots

context: all the projects with this old approach
Issue 1:
I was wondering if something like the following is possible.

Given the data structure:

docs

doc1.json

doc2.json

And the following code:

function loadDoc(name, cb) {
require.ensure([], function (require) {
cb(require("./docs/" + name));
});
}

If I understand the current behaviour would be that doc1.json and doc2.json both end up in one chunk together (one external JS file that will be loaded dynamic). But is there any way to change the code so that doc1.json and doc2.json get there individual bundle without having to hardcode for each file a require.ensure?

Issue 2:
What is the current behavior?

When I use anything else besides an external source map file option as a value in the dev option (for example "source-map"), https://webpack.js.org/configuration/devtool/#development , when I modify a CSS property in my Chrome dev tools inspector, something weird happens: Chrome seems to add dynamically many copies of my rule/file which I modified (and naturally a broken layout.)

If the current behavior is a bug, please provide the steps to reproduce.

use webpack-dev-server

use cheap-module-eval-source-map

modify CSS properties from devtools (see gif above)

What is the expected behavior?

Layout should just update the properties modified.

Other relevant information:

webpack version: 2.x + 4.x

Node.js version: 8.x , 9.x

Operating System: macOS Sierra 10.12.6 (16G1212)

Additional tools: Chrome Version 66.0.3359.139 (Official Build) (64-bit)
Issue 1:
📝 Provide a description of the new feature

What is the expected behavior of the proposed feature? What is the scenario this would be used?

currently there's no shortcut that windows support to navigate between the open windows of same application. Like I might have opened two firefox windows. If I Have to go to other window I have to use Alt + Tab and that goes to the previous used and I need to search and go it. It will be good if there's a dedicated button like Win+` like mac.

If you'd like to see this feature implemented, add a 👍 reaction to this post.

Issue 2:
I couldn't find it in the documentation, so I guess this is a feature request:

I would like to be able to switch focus between windows on a specific desktop, by cycling the focus of each window.

This is a little different from ALT + TAB because in ALT + TAB the focus isn't switched until you leave the keys, and repeated presses change the cycle order (the focus is switched back to the window you came from). I'm asking for something like 'focus next window in desktop' and 'focus previous window in desktop'. This is a common feature in tiling window managers in linux (for example, AwesomeWM).

Does this feature exist in current PowerToys?
Issue 1:
By default, Ctrl + Alt + ] Keybinding is : fold_current_now.

With azerty (french keyboard) Ctrl + Alt (AltGr) + ] is used to write "]". So, it's impossible to write "]" char if you are inside a function.

Issue 2:
Original issue: atom/atom#1625

Use https://atom.io/packages/keyboard-localization until this issue gets fixed (should be in the Blink upstream).
Issue 1:
requests/setup.cfg

Lines 6 to 10
in
1e62a3e

requires-dist =

certifi>=2017.4.17

charset_normalizer>=2,<4

idna>=2.5,<4

urllib3>=1.21.1,<1.27

Issue 2:
Problem statement

Current documentation only specifies the most common case of post data - a dictionary. The code in fact supports other forms of post data which is not documented. Propose to enhance the quick start section that deals with post data to include examples of other uses.

Section of text in the current documentation: More complicated POST requests

Questions in the wild indicating the need for more documentation in this regard

On stockoverflow:

how to post multiple value with same key in python requests?

handling duplicate keys in HTTP post in order to specify multiple values

How to send multiple of the same key/parameter via POST?

How to send an array using requests.post (Python)? “Value Error: Too many values to unpack”

And there is this issue #1641: Cannot send Single Key, Multiple value data in post because of the use of pythons dict.

Proposed modification:

You can also pass a list of tuples to the ``data`` argument. This is particularly
useful when the form has multiple elements that use the same key::

>>> payload = (('key1', 'value1'), ('key1', 'value2'))
>>> r = requests.post('http://httpbin.org/post', data=payload)
>>> print(r.text)
{
...
"form": {
"key1": [
"value1",
"value2"
]
},
...
}

Value of each payload element can be a scalar or an iterable::

>>> payload = (('key1', ('value1', 1, (1, 2))), {'key2', ('value2', 2)})
>>> r = requests.post('http://httpbin.org/post', data=payload)
>>> print(r.text)
{
...
"form": {
"key1": [
"value1",
"1",
"1",
"2"
],
"key2": [
"value2",
"2"
]
},
...
}
Issue 1:
Bug report

Describe the bug

Received this error without creating any viewport meta tag.

And also no duplicate meta tag at client side.

Found conflicting amp tag "meta" with conflicting prop name="viewport". https://err.sh/next.js/conflicting-amp-tag

To Reproduce

start a new Next.js project

create ./pages/index.js as below

import { withAmp } from 'next/amp';

export default withAmp(() => {
return <div>withAmp test</div>
});

create ./pages/_document.js as below

import React from 'react';
import Document, { Html, Head, Main, NextScript } from 'next/document';

export default class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

yarn dev

received this error in the terminal

Found conflicting amp tag "meta" with conflicting prop name="viewport". https://err.sh/next.js/conflicting-amp-tag

Expected behavior

no error in the terminal

System information

OS: macOS

Browser: chrome

Version of Next.js: 8.1.0

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

There is about 47% desktop browsers and about 45% mobile browsers run ES2015 without any problem. By https://www.netmarketshare.com

There is new simplest solution yet how to deploy separate javascript to modern browsers and transpiled to older browsers. And it is use to <script type="module">

Exists two nice articles how to use it

https://philipwalton.com/articles/deploying-es2015-code-in-production-today/

https://www.contentful.com/blog/2017/04/04/es6-modules-support-lands-in-browsers-is-it-time-to-rethink-bundling/

Both articles explains how to do that with webpack and script tag.

This could be really nice feature, because half of all visitors don't need to transpile to older code.

What we need to make it work?

babel-plugin-transform-es2015-modules-commonjs no needed anymore

Replace UglifyJs with Babel Minify (Babili)

Create new webpack entry and common plugins

Set two different babelrc settings for ES2015 and for legacy

Create two different script tags explained in blog articles
Issue 1:
I created a self-signed certificate with OpenSSL and started a TLS server with Deno. I was able to start the server without problems, but when sending a request from the browser the server crashed. I received two different error messages from Firefox and Chrome. It is clear that a self-signed certificate is not suitable for production systems, but usually it can be temporarily bypassed in the browser by setting "Advanced" and "I'll take the risk".

I created the certificates with the following command:

openssl req -nodes -new -x509 -keyout server.key -out server.cert

Then created a minimal working example:

import { serveTLS } from "https://deno.land/x/std@0.52.0/http/server.ts";

const options = {
port: 3000,
hostname: "0.0.0.0",
certFile: "./server.cert",
keyFile: "./server.key"
};

const s = serveTLS(options);

for await (const req of s) {
req.respond({body: "Hello World"});
}

And ran it with the following command:

$ deno run --allow-all https://gist.githubusercontent.com/Caesar2011/eba3b46e944ef221100f6be79c0e3e7d/raw/15bd52963d6a27787ed9261f1b78d8a05bf5058e/deno_bad_certificate.ts

My version of Deno:

$ deno --version
deno 1.0.1
v8 8.4.300
typescript 3.9.2

In a browser, the server is then accessible at:

https://0.0.0.0:3000/

Server crash/shutdown after a call in Firefox (76.0.1, Ubuntu):

ERROR RS - rustls::session:514 - TLS alert received: Message {
typ: Alert,
version: TLSv1_3,
payload: Alert(
AlertMessagePayload {
level: Fatal,
description: BadCertificate,
},
),
}
error: Uncaught InvalidData: received fatal alert: BadCertificate
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
at async TLSListenerImpl.accept ($deno$/tls.ts:31:17)
at async Server.acceptConnAndIterateHttpRequests (https://deno.land/x/std@0.52.0/http/server.ts:221:14)
at async MuxAsyncIterator.callIteratorNext (https://deno.land/x/std@0.52.0/async/mux_async_iterator.ts:28:29)

Server crash/shutdown after a call in Chromium (81.0.4044.138, Ubuntu):

ERROR RS - rustls::session:514 - TLS alert received: Message {
typ: Alert,
version: TLSv1_3,
payload: Alert(
AlertMessagePayload {
level: Fatal,
description: CertificateUnknown,
},
),
}
error: Uncaught InvalidData: received fatal alert: CertificateUnknown
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
at async TLSListenerImpl.accept ($deno$/tls.ts:31:17)
at async Server.acceptConnAndIterateHttpRequests (https://deno.land/x/std@0.52.0/http/server.ts:221:14)
at async MuxAsyncIterator.callIteratorNext (https://deno.land/x/std@0.52.0/async/mux_async_iterator.ts:28:29)

Issue 2:
Here's a quick reproducer, given:

import ajv from "https://cdn.skypack.dev/ajv@v8.6.3?dts";

deno (eval, run, cache, etc.) will hang forever, with 100% CPU usage:

docker run -it --rm denoland/deno:1.15.3 deno eval 'import ajv from "https://cdn.skypack.dev/ajv@v8.6.3?dts"'

This used to work perfectly with 1.14.x and below:

docker run -it --rm denoland/deno:1.14.3 deno eval 'import ajv from "https://cdn.skypack.dev/ajv@v8.6.3?dts"'

This seemed to exhibit the behavior of an infinite loop or recursion.
Issue 1:
Hi, we are seeing this error

but the React Developer Tools is saying this

We use NODE_ENV=production to build our js file (using browserify) and I also tried out envify but no luck. The red warning doesn't disappear.

Issue 2:
Do you want to request a feature or report a bug?

bug (I think)

What is the current behavior?

Here's a codesandbox. Or just plop this in an index.html:

<body>
<div id="root"></div>
<script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
<script type="text/babel">
function makeRenderable(fn, valueGetter) {
const ITERATOR_SYMBOL =
(typeof Symbol === 'function' && Symbol.iterator) || '@@iterator'
function iterator() {
let timesCalled = 0
return {
next() {
const done = timesCalled++ > 0
return {done, value: done ? undefined : valueGetter()}
},
}
}
fn[ITERATOR_SYMBOL] = iterator
return fn
}

const renderableFunction = makeRenderable(function(a, b) {
// kinda irrelevant what goes on in here...
return a + b
}, () => 'I am the rendered version of the function')

function Working() {
return (
<div>
This works: <div>{renderableFunction}</div>
</div>
)
}

function NotWorking() {
return <div>This does not work: {renderableFunction}</div>
}

ReactDOM.render(
<div>
<Working />
<hr />
<NotWorking />
</div>,
document.getElementById('root'),
)
</script>
</body>

What is the expected behavior?

I expect that things will render the same regardless of whether they're an only child or a member of an array of children.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Yes, it worked in React@15.

Suggested Solution

I'm fairly confident that the issue is in the array of children case, the getIteratorFn call is within a typeof newChild === 'object' && newChild !== null if statement, whereas the original reconcileChildFibers puts the getIteratorFn call outside it.

If I'm not mistaken, a simple fix would be to move this curly brace a few lines up 😉

I'm happy to do so complete with a test given a little direction (like, where the test should go). Thanks!