sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Type Cast or Assertions on the FunctionDeclaration
Labels: Suggestion,Awaiting More Feedback

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ

-->

## Search Terms

function declaration type cast assertions

<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->

## Suggestion

A new syntax to cast or assert function declaration as a type T.

```ts
function MyFunction() {} as React.ComponentType
// same as
const MyFunction = (function MyFunction() {}) as React.ComponentType

function F2() {} asserts FunctionWithAdditionalProperty
// same as
function F2() {}
function _assert_(f: FunctionWithAdditionalProperty) {}
_assert_(F2)
```

<!-- A summary of what you'd like to see added or changed -->

## Use Cases

In some cases, we want to type-check a function to obey a type constraint but it is not easy to do on the FunctionDeclaration statement.

<!--
What do you want to use this for?
What shortcomings exist with current approaches?
-->

## Examples

<!-- Show how this would be used and what the behavior would be -->

## 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: rust
Issue: Tracking Issue for atomic_from_mut
Labels: A-concurrency,T-libs-api,C-tracking-issue,Libs-Tracked,A-atomic

Feature gate: `#![feature(atomic_from_mut)]`

### Public API

```rust
impl AtomicU32 {
    pub fn from_mut(v: &mut u32) -> &mut Self;
    pub fn from_mut_slice(v: &mut [u32]) -> &mut [Self];
    pub fn get_mut_slice(this: &mut [Self]) -> &mut [u32];
}

// And same for AtomicBool, AtomicU8, AtomicU16, AtomicU64, AtomicI8, AtomicI16, AtomicI32, AtomicI64, and AtomicPtr
```

Each one is gated on `#[cfg(target_has_atomic_equal_alignment = "..")]` and is only available on platforms where `Atomic<size>` has the same alignment as `u<size>`.

### Steps / History

- [x] Implementation: #74532
- [x] #92671
- [x] #94384
- [x] https://github.com/rust-lang/rust/pull/94816
- [ ] Final commenting period (FCP)
- [ ] Stabilization PR

### Unresolved Questions

- ~Should these return `&mut Self` instead, such that it's the exact inverse of `get_mut`?~ &mdash; **yes:** #92671
- ~Also add `from_mut_slice`?~ &mdash; **yes:** #94384
Repository: flutter
Issue: OK/Select on IR Remotes causing Exception
Labels: a: text input,c: crash,platform-android,framework,P2,team-android,triaged-android

I am receiving this exception when pressing the OK/DPAD_CENTER button.
This is happening on two separate systems, on running Android 4.4 and the other Android 9.0.

```
Attempted to send a key down event when no keys are in keysPressed. This state can occur if the key event being sent doesn't properly set its modifier flags. This was the event: RawKeyDownEvent#065c6(logicalKey: LogicalKeyboardKey#70077(keyId: "0x100070077", keyLabel: "", debugName: "Select"), physicalKey: PhysicalKeyboardKey#700e4(usbHidUsage: "0x000700e4", debugName: "Control Right")) and its data: RawKeyEventDataAndroid(keyLabel:  flags: 8, codePoint: 0, keyCode: 23, scanCode: 97, metaState: 0, modifiers down: {})
'package:flutter/src/services/raw_keyboard.dart':
Failed assertion: line 601 pos 12: '<optimized out>'
```

This happens on stable through to master

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.22.0-10.0.pre.82, on Linux, locale en_AU.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] Connected device (3 available)

• No issues found!


Very simple test app

```
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({
    Key key,
  }) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.green,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          mainAxisSize: MainAxisSize.max,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [

            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
          ],
        ));
  }
}
```
Repository: pytorch
Issue: REINFORCEMENT LEARNING (DQN) TUTORIAL is not working anymore due to matplotlib.pyplot.imshow()
Labels: module: docs,triaged

## 📚 Documentation

Dear @apaszke,

I would like to kindly remind you of an matplotlib NameError exception due to matplotlib.pyplot.imshow(). To reproduce this error, you may run [reinforcement_q_learning.ipynb in google colab](https://colab.research.google.com/github/pytorch/tutorials/blob/gh-pages/_downloads/2b3f06b04b5e96e4772746c20fcb4dcc/reinforcement_q_learning.ipynb).

Cheers

cc @jlin27
Repository: pytorch
Issue: Support keep stride for neg with requires_grad=False
Labels: module: memory usage,triaged,enhancement,module: numpy

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Support that the output stride is identical to the input stride for `__neg__`, at least, when `requires_grad=False`.
Advantage: Less memory consumption and fewer computations.

The code
```python
import torch
print(torch.__version__)
x = torch.tensor([[1., 2, 3], [4., 5, 6]], device='cuda:0')
c = torch.as_strided(x, size=[2, 2, 2], stride=[3, 1, 1])
print(c.stride())
print((-c).stride())
```
produces
```
1.7.0.dev20200807
(3, 1, 1)
(4, 2, 1)
```
while I want
```
1.7.0.dev20200807
(3, 1, 1)
(3, 1, 1)
```

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->

I have a small tensor, but for the mathematical operation I have to use a large view of the tensor.
The mathematical operations, that I use, require a "conjugate" operation.
I want to realize this with taking the negative of the imaginary part (At the moment I use https://github.com/kamo-naoyuki/pytorch_complex).
But this is at the moment to expensive, because the real size of the tensor is a few GB.

My real motivation is to make https://github.com/fgnt/nara_wpe/pull/47 more memory efficient.
But that example is more complicated.

## Pitch

<!-- A clear and concise description of what you want to happen. -->

Keep the input stride when calling: `- tensor`

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->

Calculating the view two times.

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->


cc @mruberry @rgommers @heitorschueroff
Repository: pytorch
Issue: caffe2: Python 3 deprecation warnings about inspect.getargspec
Labels: caffe2,triaged

## 🐛 Bug

I work with a legacy code which uses caffe2. I've recently switched the code from Python 2 to Python 3. When I run *pytest*, it catches several deprecation warnings about `inspect.getargspec`. This function is not compatible with Python 3.

## To Reproduce

Steps to reproduce the behavior:

* This is the class `HelperWrapper` which is used.
* The legacy code is inspired from an old version of [detectron](https://github.com/facebookresearch/Detectron/)
* When I carry out a prediction with a faster_rcnn model, I've got the following message:

```
venv/python3.6/site-packages/caffe2/python/brew.py:97: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
    var_names, _, varkw, _= inspect.getargspec(func)  
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

Remove these deprecation warnings.

<!-- A clear and concise description of what you expected to happen. -->

## Environment

* PyTorch version: 1.4.0+cu92
* Is debug build: No
* CUDA used to build PyTorch: 9.2
* OS: Ubuntu 18.04.3 LTS
* GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
* CMake version: version 3.10.2
* Python version: 3.6
* Is CUDA available: Yes
* CUDA runtime version: Could not collect
* GPU models and configuration: GPU 0: GeForce GTX 1080 Ti
* Nvidia driver version: 410.104
* cuDNN version: Could not collect

Versions of relevant libraries:
* [pip3] numpy==1.16.5
* [pip3] torch==1.4.0+cu92
* [pip3] torchfile==0.1.0
* [pip3] torchvision==0.5.0+cu92
Repository: rust
Issue: [ER] Suggest usage of .try_into().unwrap() for desired slices => array 
Labels: C-enhancement,T-compiler,A-suggestion-diagnostics

This is an Enhancement Request. This wrong code:

```rust
fn foo1(a: [u32; 3]) -> [u32; 2] {
    &a[1 ..]
}

fn main() {}
```

With rustc (1.48.0-nightly 0d0f6b113 2020-09-03) gives:

```rust
error[E0308]: mismatched types
 --> ...\test.rs:4:5
  |
3 | fn foo1(a: [u32; 3]) -> [u32; 2] {
  |                         -------- expected `[u32; 2]` because of return type
4 |     &a[1 ..]
  |     ^^^^^^^^ expected array `[u32; 2]`, found `&[u32]`
```

To encourage the usage of arrays I suggest to add a note (similar to the one given for numbers) that suggests to use ".try_into().unwrap()" leading the programmer to write code like this:

```rust
use std::convert::TryInto;

fn foo(a: [u32; 3]) -> [u32; 2] {
    a[1 ..].try_into().unwrap()
}

fn main() {}
```

(There is also the possibility to write code as `<[u32; 2]>::try_from(&a[1 ..]).unwrap()` but I think this is less nice looking in this case).
Repository: go
Issue: x/sys/windows: GetLastError always returns nil
Labels: OS-Windows,NeedsDecision,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 version
go version go1.14.7 windows/amd64
</pre>

### Does this issue reproduce with the latest release?

Not tried, but I'm pretty sure it will.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Bupjae\AppData\Local\go-build
set GOENV=C:\Users\Bupjae\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Bupjae\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Bupjae\AppData\Local\Temp\go-build843644218=/tmp/go-build -gno-record-gcc-switches

</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

<pre>package main

import (
	"fmt"
	"golang.org/x/sys/windows"
)

func main() {
	var handle windows.Handle
	wrongName := windows.StringToUTF16Ptr("ADFADFASDFSDAFASFD")
	err := windows.GetModuleHandleEx(0, wrongName, &handle)
	if handle == 0 {
		fmt.Println(err)
		fmt.Println(windows.GetLastError())
	}
}
</pre>

### What did you expect to see?

Prints out error message describing 'module not found' twice.

### What did you see instead?
<pre>The specified module could not be found.
&lt;nil&gt;
</pre>


According to https://golang.org/src/runtime/sys_windows_amd64.s , before calling actual DLL routine (line 58), last error information is erased (line 22-23). This makes syscall.GetLastError (and windows.GetLastError) completely meaningless,
Repository: flutter
Issue: Support stylus input on Windows 10 devices
Labels: c: new feature,engine,platform-windows,c: proposal,a: desktop,P3,team-windows,triaged-windows

Flutter is currently unable to properly detect stylus events on Windows 10 (that requires information about pressure sensitivity and tilt). This feature is available on mobile platforms, but not on desktop platforms (the request for Linux can be found  [here](https://github.com/flutter/flutter/issues/63209)). Stylus input is a very common technology used in Windows laptops and 2in1 devices and it'd be great if Flutter appropriately supported this.
Repository: go
Issue: cmd/cover: //line directives frequently handled incorrectly
Labels: help wanted,NeedsInvestigation

(This combines #35781, #33690, #25280, and https://github.com/golang/vscode-go/issues/603)

Source files that contain //line directives confuse the coverage tool, prducing coverage output that is unhelpful or confusing to users.

For instance, a short main.go (import path `foo.gak`)  with first lines
```
//
package main
```
produces a coverage file:
```
mode: set
foo.gak/main.go:6.10,8.26 2 1
foo.gak/main.go:12.2,12.19 1 1
foo.gak/main.go:8.26,11.3 2 1
foo.gak/main.go:12.19,13.21 1 0
```
If the first line is changed to
```
//line con.go:8
```
the coverage file changes to:
```
mode: set
foo.gak/main.go:12.0,14.0 2 1
foo.gak/main.go:18.0,18.0 1 1
foo.gak/main.go:14.0,17.0 2 1
foo.gak/main.go:18.0,19.0 1 0
```
This file does not refer to `con.go`, and the ranges are wrong (or, at best, imprecise) for that file, and completely wrong for `main.go`.

A minimal improvement would be for the coverage tool to change user's `//line` directives to bare `//` comments, so that the coverage data corresponds to the file presented to the tool. [Getting results that point to files mentioned in `//line` directives would require changing the format of the tables in the generated code, at least. Even then the results might be peculiar, for instance if the generated file were run through go fmt.]
Repository: PowerToys
Issue: Template repository for new PowerToys
Labels: Help Wanted,Issue-Docs


A new public template repository with all files needed to code a new PowerToy would be awesome.

---

If you'd like to see this feature implemented, add a 👍 reaction to this post.
Repository: material-ui
Issue: [docs-infra] Have inline previews for most of the demos
Labels: priority: important,scope: docs-infra

<!-- Provide a general summary of the feature in the Title above -->

<!--
  Thank you very much for contributing to Material-UI by creating an issue! ❤️
  To avoid duplicate issues we ask you to check off the following list.
-->

<!-- Checked checkbox should look like this: [x] -->

- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.

## Summary 💡

Bring "inline previews" for as many demos as possible.

## Examples 🌈

<img width="792" alt="Capture d’écran 2020-09-04 à 16 12 19" src="https://user-images.githubusercontent.com/3165635/92248759-6e9f6b00-eec9-11ea-8c45-13bbfba83067.png">

https://next.material-ui.com/components/buttons/#contained-buttons

## Motivation 🔦

Inline previews were introduced in #17831 by @mbrookes. We have done a couple of iteration it increases their usage in the codebase. However, I believe we have never pushed it to its full potential. For instance: https://next.material-ui.com/components/accordion/.

This would match with the answers of the survey: [`docs - smaller demos`](https://material-ui.com/blog/2020-developer-survey-results/#5-how-can-we-improve-material-ui-for-you).

## Benchmark

- https://sancho-ui.com/components/breadcrumb/ Note that being able to edit the demos directly is even simpler than opening in CodeSandbox.
Repository: material-ui
Issue: Support a second design system
Labels: new feature,priority: important,design,design: joy

## Summary 💡

Provide a second theme the community would love. It has to gain traction on its own to make it a successful effort.

## Examples 🌈

One example of a component library that supports multiple themes:

<img width="500" alt="Capture d’écran 2020-09-04 à 16 39 02" src="https://user-images.githubusercontent.com/3165635/92251448-2b46fb80-eecd-11ea-89c5-bed295f9f94e.png">

https://seek-oss.github.io/braid-design-system/components/Button

## Motivation 🔦

Material Design [doesn't have a monopoly](https://medium.com/google-design/state-of-design-systems-2019-ff5f26ada71) on the design systems used by developers and designers. During our last survey, we had [28 feedback](https://material-ui.com/blog/2020-developer-survey-results/#5-how-can-we-improve-material-ui-for-you) to improve custom themes and provide a new theme.

The issues with Material Design:

- Feels a lot like Google. Moving away from this brand can require more overrides than is desirable.
- Community love/hate relationship with Material Design. It's polarising.
- I suspect that making a good looking UI could be made easier, too many shadows.

## Proposed solution

We bring on board a designer/developer (somebody with both skills, but has to be **a really great designer**, no need to have strong development skills) to build a theme using a limited set of constraints:

- Create a new repository under a different name in the `mui-org` organization. 
- Use the unstyled components we are working on #6218. This should save a lot of time in the process. This would create a healthy constraint to make sure that the unstyled components truly deliver (hopefully it will force us to improve them). It would also give the unstyled components credibility.
- Use the tooling infrastructure. Our CI infrastructure is pretty solid at this point. We can make it work across repositories [as we do it with material-ui-x](https://github.com/mui-org/material-ui-x/blob/945f0a02dc8f44ab572fb9540a0a5a65e146d3a6/prettier.config.js).

A few elements that we could consider setting as constraints but we are not fully convinced, it could actually harm:

- Use the same documentation infrastructure
- Use the same styling solution

## Related issues

- #18908: Material Design studies x4 themes
- #21911: iOS theme
- #23519: true dark theme
- #21113: document the themes of the community

## Benchmark

https://trello.com/c/02I7LL5D/2491-introduce-a-second-theme
Repository: material-ui
Issue: Add NProgress component
Labels: new feature,component: nprogress

- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.

## Summary 💡

Provide a component to display a progress bar with Next.js, Gatsby, etc.

## Examples 🌈

```jsx
import * as React from 'react';
import NProgressBar from '@material-ui/core/NProgressBar';

Router.onRouteChangeStart = () => {
  NProgress.start();
};

Router.onRouteChangeComplete = () => {
  NProgress.done();
};

Router.onRouteChangeError = () => {
  NProgress.done();
};

function AppFrame(props) {
  return (
    <NProgressBar />
  )
}
```

![Sep-04-2020 17-49-59](https://user-images.githubusercontent.com/3165635/92258428-1ff8cd80-eed7-11ea-96b7-794024bcf332.gif)

## Motivation 🔦

On Chrome mobile, a progress bar is displayed by default.
On Chrome desktop, no progress bars are displayed. However, a number of popular websites are using an approach similar to Next.js and Gatsby. You can find YouTube 32B sessions/month, Facebook 25B sessions/month.

As it turns out, we already have this component available under `@material-ui/docs/NProgressBar` and use it for our documentation. We could introduce this component in the lab, with a couple of improvements, and kill the docs npm package. The improvements we could bring:

- Remove the dependency on nprogress, the logic is short and simple
- To account for the difference of behavior between mobile (chrome) and desktop: we could only display the progress bar on desktop after an initial 300ms? delay, to avoid [unnecessary distractions](https://material-ui.com/components/progress/#delaying-appearance) for pages that load fast. It would also better match the expected experience of end-users on desktop. https://nextjs.org/ has a very similar behavior.

## Benchmark

- https://github.com/mui-org/material-ui/blob/next/packages/material-ui-docs/src/NProgressBar/NProgressBar.js
- https://github.com/vercel/next.js/tree/canary/examples/with-loading
- https://github.com/connor-baer/bamboo-ui/blob/e45c96fe3d4dd9276b60d30eea9be935c2b66cd7/src/components/LoadingBar/LoadingBar.js
- https://mantine.dev/others/nprogress/