sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: wiki: CodeReviewComments additions
Labels: Documentation,NeedsDecision

Propose adding a handful of sections to the CodeReviewComments page. The sections that follow provide advice given during Go readability reviews at Google.

## Import _

Packages that are imported only for their side effects (using the syntax `import _ "pkg"`) should only be imported in the main package of a program, or in tests that require them.

Avoid blank imports in library packages, even if the library indirectly depends on them. Containing side-effect imports in the main package helps control dependencies, and makes it possible to write tests that rely on a different side-effect without conflict.

If you create a library package that indirectly depends on a side-effect import, leave a comment reminding users to import that package in their main package.

## Switch Break

Avoid the use of redundant break statements without target labels at the ends of switch clauses. Unlike in C or Java, switch clauses in Go automatically break, and a fallthrough statement is needed to achieve the C-style behavior.

Use a comment if you want to clarify the purpose of an empty clause.

Prefer:

```go
switch x {
case "A", "B":
  buf.WriteString(x)
case "C":
  // Handled outside of the switch statement
default:
  return fmt.Errorf("unknown value: %q", x)
}
```

and not:

```go
switch x {
case "A", "B":
  buf.WriteString(x)
  break  // Redundant
case "C":
  break // Redundant
default:
  return fmt.Errorf("unknown value: %q", x)
}
```

## Type Aliases

Use a type definition (`type T1 T2`) to define a new type.

Use an alias declaration (`type T1 = T2`) to refer to an existing type without defining a new type.

Prefer type definitions over alias declarations.

## Use %q

Go's format functions (`fmt.Printf` and friends) have a %q verb which prints a string inside quotation marks. It should be used in preference to doing the equivalent manually.

Prefer:

```go
 fmt.Printf("value %q looks like English text", someText)
```
and not:

```go
 fmt.Printf("value '%s' looks like English text", someText)
```

Also, note that using %q is a good idea in output intended for humans where the input value could possibly be empty. It can be very hard to notice a silent empty string, but "" stands out clearly as such.
Repository: pytorch
Issue: Supporting "cdf" for Student-T distribution
Labels: module: distributions,low priority,triaged,enhancement

## 🚀 Feature
Adding support to `cdf` for `StudentT` distribution.

## Motivation

I need to calculate the (kind of) confidence intervals of a large vector (say, weight vector). This could be slow on CPU (not including the overhead of transferring). 

## Alternatives

I could convert a tensor into a numpy array, and perform the operation with scipy library, then convert it back.

cc @vincentqb @fritzo @neerajprad @alicanb @vishwakftw
Repository: flutter
Issue: Trailing space doesn't work with TextField with TextAlign.right 
Labels: a: text input,framework,f: material design,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-framework,triaged-framework

TextField  Widget Option textAlign Setting for [TextAlign.right] ,input  space key cursor fault


 `TextField(
            textAlign: TextAlign.right,
          )
`
Repository: vscode
Issue: SCM Input - Display current line length for source control commit message input
Labels: help wanted,feature-request,scm

<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->
HI! I care a lot for 50/72 commit message rule and I depend a lot on VSCode's source control's commit message input.
The problem is that I always start to write, and I wait for the warning to appear, then if I'm in title, (first line), I try to change what I intended to say to contain only 50 chars; and if I'm in description (lines after the break after the first line) I write as much as I get the warning, and then I go back to before the current word and insert a new line there (press enter). This pattern is becoming so annoying. I want to observe how much I'm writing on the current line. A screen shot of what I have in mind:

![Screenshot from 2019-09-17 11-14-52](https://user-images.githubusercontent.com/5755214/65018035-614a4300-d93d-11e9-9db9-7839d97c67d3.png)

(note the small number in bottom right corner of the screen)
Repository: pytorch
Issue: Behavior of F.dropout in eval mode
Labels: module: docs,low priority,triaged

## 📚 Documentation
The documentation for F.dropout should probably mention that putting the model in eval mode doesn't disable dropout.

A small example
```python
import torch
import torch.nn as nn
import torch.nn.functional as F

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()

    def forward(self, x):
        x = F.dropout(x)
        return x

net = Net()                                                             

a = torch.ones(10)                                                     

net(a)                                                                  
tensor([0., 0., 0., 2., 2., 2., 0., 0., 2., 2.]) 

net.eval()

net(a)
tensor([0., 0., 0., 2., 2., 2., 0., 0., 2., 2.])


```

If the model is set in eval mode, the dropout layer is not disabled.
is_training should take care of this.. But it may be better if this behavior is explicitly mentioned in the docs.
Repository: youtube-dl
Issue: Requesting support for onq.io videos
Labels: site-support-request

## Checklist

* [x]  I've checked that all provided URLs are alive and playable in a browser
* [x] I'm reporting a new site support request
* [x] I've verified that I'm running youtube-dl version **2019.09.12.1**
* [x] I've checked that all provided URLs are alive and playable in a browser
* [x] I've checked that none of provided URLs violate any copyrights
* [x] I've searched the bugtracker for similar site support requests including closed ones

## Example URLs

- Single video: https://embed.onq.io/player?id=aqw8oq2tajzsjktodljmlyhe0f68gdt9
- Single video: https://embed.onq.io/player?id=gbhpp2gcr7eoflmxl1hn7tqk3mpxuel1

## Description

The videos are uploaded through **https://www.engageonq.com/**
Repository: pytorch
Issue: CPU version of PyTorch on PyPI
Labels: module: build,feature,oncall: releng,module: cpu,triaged

## 🚀 Feature
Publish the CPU version of PyTorch on PyPI to make it installable in a more convenient way.

## Motivation
Using PyTorch in production does not require necessarily the (~700 MB big) GPU version, but installing the much smaller CPU version as suggested on the website:
```
pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
```
makes it hard to use tools like [Poetry](https://poetry.eustace.io/), which do not work with `pip` itself and therefore do not support an argument like `-f https://download.pytorch.org/whl/torch_stable.html`.

## Pitch

Publish the CPU version (e.g. as `torch-cpu`) on PyPI.
Repository: TypeScript
Issue: Use any instead of unknown for AsyncGenerator optional .next parameter
Labels: Needs Investigation

**TypeScript Version:**  3.6.2

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
async generator, AsyncGenerator, optional .next

**Code**

The following causes a type error:

```ts
async function* sequence(iterable: AsyncIterable<number>): AsyncGenerator<number> {
  yield 12;
  try {
    // Type error: Cannot delegate iteration to value because the 'next' method of its iterator expects type 'undefined', but the containing generator will always send 'unknown'.
    yield* iterable;
  } finally {
    console.log('Cleanup!');
  }
}
```

**Expected behavior:**

I would've expected it to be a non-type error.

**Problem:**

The primary annoyance with this is that I'd like to use `AsyncGenerator<T>` just for specifying that `.return()` can be used without non-null assertions (`.return!()`) for early cleanup but `AsyncGenerator<T>` results in `AsyncGenerator<T, any, unknown>` so `AsyncIterable<T>` can't be delegated to.

**Proposed solution:**

Change `interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown>` to `interface AsyncGenerator<T = unknown, TReturn = any, TNext = any`.

This won't break anything as `any` is assignable to anything, and I doubt it'll be problematic as those using `AsyncGenerator<T>` (or `AsyncGenerator<T, S>`) presumably do not care about the `.next` parameter.
Repository: go
Issue: x/website/tour: when build error occurs, had to manually kill program
Labels: NeedsInvestigation

In tour.golang.org, when the build failed, had to manually click the kill button to stop the process.
In play.golang.org the process automatically killed.

![image](https://user-images.githubusercontent.com/5708431/65026284-e04b7580-d955-11e9-8fad-8dd084c2198c.png)
Repository: TypeScript
Issue: document.createTreewalker and document.createNodeIterator have missing signature types that which are supported both in IE, Firefox and Chrome
Labels: Bug,Domain: lib.d.ts

**Introduction**

The third parameter `filter` in both functions needs to be a function in IE as described here https://stackoverflow.com/questions/45595349/ie9-ie-10-ie11-createnodeiterator-exception-occurred/45609439#45609439

Both Firefox and Chrome support this version as well as the object `{acceptNode: (node: Node) => number}` as third parameter.

In IE the fourth parameter `entityReferenceExpansion` is required.

A previous solution to `document.createNodeIterator` can be seen here https://github.com/microsoft/TypeScript/issues/27393

The described solution is to override `Document` interface; But TypeScript still complains.

Also `NodeIterator.referenceNode` is required in lib.dom.d.ts, but in IE it is always `undefined`

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.6.2

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**

createTreeWalker createNodeIterator IE Internet Explorer

**Code that fails**

```ts
const walker = document.createTreeWalker(
    wrapperElement,
    NodeFilter.SHOW_TEXT,
    function filter(node: Node): number {
        return NodeFilter.FILTER_ACCEPT;
    },
    false
);

const nodeIterator = document.createNodeIterator(
    wrapperElement,
    NodeFilter.SHOW_TEXT,
    function filter(node: Node): number {
        return NodeFilter.FILTER_ACCEPT;
    },
    false
);
```
**Workaround**

```ts
const walker = document.createTreeWalker(
    wrapperElement,
    NodeFilter.SHOW_TEXT,
    function filter(node: Node): number {
        return NodeFilter.FILTER_ACCEPT;
    } as any,
    false
);

function acceptNode(node: Node): number {
    return NodeFilter.FILTER_ACCEPT;
}
// "strictBindCallApply": false,
const nodeIterator
    = document.createNodeIterator.apply(document, [wrapperElement, NodeFilter.SHOW_ELEMENT, acceptNode, false]) as NodeIterator;
```

**Expected behavior:**
   lib.dom.d.ts has
```ts
createTreeWalker(root: Node, whatToShow: number, filter: (node: Node) => number | null, entityReferenceExpansion: boolean): TreeWalker;
createNodeIterator(root: Node, whatToShow: number, filter: (node: Node) => number | null, entityReferenceExpansion: boolean): NodeIterator;
```

**Actual behavior:**
   lib.dom.d.ts lacks the function signatures

**Related Issues:** 
https://github.com/microsoft/TypeScript/issues/27393
Repository: vue
Issue: test named "vdom patch: children" occasionally fails
Labels: contribution welcome

### Version
2.6.10

### Reproduction link
[https://circleci.com/gh/vuejs/vue/13744?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link](https://circleci.com/gh/vuejs/vue/13744?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)







### Steps to reproduce
Tests are flaky on CI and also sometimes locally. Re-running the tests seem to work

### What is expected?
Tests not to be flaky

### What is actually happening?
Tests are flaky

<!-- generated by vue-issues. DO NOT REMOVE -->
Repository: pytorch
Issue: How to get rid of zombie processes using torch.multiprocessing.Pool?
Labels: module: dependency bug,oncall: distributed,module: multiprocessing,triaged

I am using torch.multiprocessing.Pool to speed up my NN in inference, like this:

    import torch.multiprocessing as mp
    mp = mp.get_context('forkserver')

    def parallel_predict(predict_func, sequences, args):
        predicted_cluster_ids = []
        pool = mp.Pool(args.num_workers, maxtasksperchild=1)
        out = pool.imap(
            func=functools.partial(predict_func, args=args),
            iterable=sequences,
            chunksize=1)
        for item in tqdm(out, total=len(sequences), ncols=85):
           predicted_cluster_ids.append(item)
       pool.close()
       pool.terminate()
       pool.join()
       return predicted_cluster_ids

Note 1) I am using `imap` because I want to be able to show a progress bar with tqdm.
Note 2) I tried with both `forkserver` and spawn but no luck. I cannot use other methods because of how they interact (poorly) with CUDA.
Note 3) I am using `maxtasksperchild=1` and `chunksize=1` so for each sequence in sequences it spawns a new process.
Note 4) Adding or removing `pool.terminate()` and `pool.join()` makes no difference.
Note 5) `predict_func` is a method of a class I created. I could also pass the whole model to `parallel_predict` but it does not change anything.

Everything works fine except the fact that after a while I run out of memory on the CPU (while on the GPU everything works as expected). Using `htop` to monitor memory usage I notice that, for every process I spawn with pool I get a zombie that uses 0.4% of the memory. They don't get cleared, so they keep using space. Still, `parallel_predict` does return the correct result and the computation goes on. My script is structured in a way that id does validation multiple times so next time `parallel_predict` is called the zombies add up.

This is what I get in `htop`: 
![Screenshot from 2019-09-17 11-46-21](https://user-images.githubusercontent.com/19649581/65039556-cfe5cb80-d952-11e9-80e7-102e455f3874.png)

Usually, these zombies get cleared after ctrl-c but in some rare cases I need to killall.

Is there some way I can force the`Pool` to close them?

UPDATE:
I tried to kill the zombies using this:

    def kill(pool):
        import multiprocessing
        import signal
        # stop repopulating new child
        pool._state = multiprocessing.pool.TERMINATE
        pool._worker_handler._state = multiprocessing.pool.TERMINATE
        for p in pool._pool:
            os.kill(p.pid, signal.SIGKILL)
        # .is_alive() will reap dead process
        while any(p.is_alive() for p in pool._pool):
            pass
        pool.terminate()

But it does not work. It hangs in `pool.terminate()`

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen
Repository: flutter
Issue: Add `saveValidated()` method to FormState
Labels: a: text input,c: new feature,framework,c: proposal,P3,team-framework,triaged-framework


## Use case

When you have a Form e.g. in a  `TabView` where some of the Fields are valid but others are not you want to save only the validated fields when the user switches to another page, so that when he comes back you can fill the already valid fields with data.
 
Currently `save()` saves all Fields including the not validated.

## Proposal

Add a method 

`FormState.saveValidFields()`  

That will call the `save` method of all valid fields.
Repository: flutter
Issue: Add `bool validateOnLostFocus` to the `FormField` and `Form` class
Labels: a: text input,c: new feature,framework,c: proposal,P3,team-framework,triaged-framework

## Use case

`Forms` and `FormField`have an `autoValidate` property. But if set to true it will validate on every keystroke/change which is annoying if you start typing e.g. an email address and with the first press the message `Not a valid email address is displayed` 
It would be much more user friendly if an autoValidate option existed that waits with validation till the user(focus) leaves the field when he has finished editing.

## Proposal

add a new property 

`bool validateOnLostFocus`

to the `Form` and `FormField` classes that allows this functionality
Repository: rust
Issue: Lifetime bounds in auto trait impls prevent trait from being implemented on generators
Labels: A-trait-system,P-medium,T-compiler,C-bug,A-coroutines,A-async-await,AsyncAwait-Triaged,T-types

```rust
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;

fn needs_send<T: Send>(_val: T) {}
async fn async_fn_a(_num: u32) {}
async fn async_fn_b(map: Arc<BTreeMap<u32, &'static u32>>) {
    for (_i, v) in &*map {
        async_fn_a(**v).await;
    }
}
async fn async_fn_c(map: Arc<HashMap<u32, &'static u32>>) {
    for (_i, v) in &*map {
        async_fn_a(**v).await;
    }
}

fn main() {
    // this works...
    let map: Arc<HashMap<u32, &'static u32>> = Arc::new(HashMap::new());
    needs_send(async_fn_c(map.clone()));
    
    // but this doesn't
    let map: Arc<BTreeMap<u32, &'static u32>> = Arc::new(BTreeMap::new());
    needs_send(async_fn_b(map.clone()));
}
```
[(playground)](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=12ee6a660148c7ba94503fc301a443a0)

```
error: implementation of `std::marker::Send` is not general enough
  --> src/main.rs:24:5
   |
24 |     needs_send(async_fn_b(map.clone()));
   |     ^^^^^^^^^^
   |
   = note: `std::marker::Send` would have to be implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'0>, u32, &'1 u32, alloc::collections::btree::node::marker::Leaf>`, for any two lifetimes `'0` and `'1`
   = note: but `std::marker::Send` is actually implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'2>, u32, &u32, alloc::collections::btree::node::marker::Leaf>`, for some specific lifetime `'2`
```

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"csmoe"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->
Repository: create-react-app
Issue: Conflicting jest version with tsdx
Labels: issue: proposal,needs triage

### Is your proposal related to a problem?

tsdx is a package that bills itself as being the react-scripts equivalent for typescript package development. When using tsdx and react-scripts within separate packages in a monorepo, both tsdx and react-scripts depend on jest, and it's possible for versions to be mismatched. react-scripts will actually warn and fail if you have multiple versions of jest installed.

![image (7)](https://user-images.githubusercontent.com/5084492/65055720-51c6fc00-d935-11e9-9411-98cab3923ed1.png). It's possible currently to ensure that react-scripts ("24.8.0") and tsdx ("^24.8.0") resolve to the same version of jest by manually editing my yarn.lock file so only 24.8.0 is installed. This seems like it could be a cause of future headaches though when upgrading react-scripts or tsdx if the latest released react-scripts' jest version lies outside the range allowed by tsdx.

### Describe the solution you'd like

Perhaps unpinning jest would be reasonable? Then the only times tsdx and react-scripts are likely to conflict on jest versions would be when a major version of jest releases, which is pretty reasonable.

### Describe alternatives you've considered

I guess if it were possible for react-scripts and tsdx to use different versions of jest (perhaps a way to override the warning), that would work, but I'm guessing that's either not easy to do or generally undesirable (hence the warning react-scripts prints to explicitly prohibit multiple versions) In a multiple package setup, being on a single version of jest seems like a better idea anyways.
Repository: flutter
Issue: Spellcheck on Flutter Web
Labels: a: text input,c: new feature,framework,engine,customer: crowd,platform-web,P2,customer: chilli,team-web,triaged-web

Supporting spellcheck for text editing in Flutter Web Engine
Repository: TypeScript
Issue: Support Intellisense for string/number literals in a widened union
Labels: Suggestion,Experience Enhancement,Has Repro

## Search Terms

autocomplete union wide 

## Suggestion

In both https://github.com/microsoft/TypeScript/issues/28743 and https://github.com/microsoft/TypeScript/issues/28743 they were correctly closed for being correctly widened to a string.

## Use Cases

I'd like to pitch that this is useful only from the IDE experience, and that's purely where the value comes in from. The widening to a string makes sense, however allowing this lets you declare an API where you would like to allow any input, but there are preferred options.


## Examples

```ts repro
// @errors: 2345 2345
type ErrorStatus = 'not_found' | 'failed' | 'parse_error'

declare function fail(status: ErrorStatus): any

fail("not")
//       ^|

declare function failString(status: ErrorStatus | string): any

failString("not")
//             ^|
```

Would offer "not_found", "failed", "parse_error" in the completion list.


## Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
Repository: pytorch
Issue: torch.tensor / torch.as_tensor not working with list of tensors
Labels: module: error checking,triaged,module: numpy,module: tensor creation


## 🐛 Bug
```py
│In [6]: import torch

In [7]: torch.as_tensor([torch.randn(2), torch.randn(2)])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-d2efbad662f7> in <module>
----> 1 torch.as_tensor([torch.randn(2), torch.randn(2)])

ValueError: only one element tensors can be converted to Python scalars
```

```
Collecting environment information...
PyTorch version: 1.3.0a0+d7a1152
Is debug build: No
CUDA used to build PyTorch: 10.0.130

OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
CMake version: version 3.14.0

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration:
GPU 0: TITAN Xp
GPU 1: TITAN Xp

Nvidia driver version: 415.27
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.16.4
[pip3] torch==1.3.0a0+d7a1152
[pip3] torchfile==0.1.0
[pip3] torchreparam==0.0.1
[pip3] torchvision==0.2.1
[conda] blas                      1.0                         mkl    defaults
[conda] magma-cuda101             2.5.1                         1    pytorch
[conda] mkl                       2019.4                      243    defaults
[conda] mkl-include               2019.4                      243    defaults
[conda] mkl-service               2.0.2            py37h7b6447c_0    defaults
[conda] mkl_fft                   1.0.12           py37ha843d7b_0    defaults
[conda] mkl_random                1.0.2            py37hd81dba3_0    defaults
[conda] torch                     1.3.0a0+d7a1152           dev_0    <develop>
[conda] torchfile                 0.1.0                    pypi_0    pypi

```



cc @mruberry @rgommers @ezyang @gchanan @zou3519