sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: opencv
Issue: An error occurred while calling the setVocabulary()
Labels: bug,category: python bindings,category: t-api

**System information (version)**

- OpenCV => 3.1.0
- Operating System / Platform => Windows 10 64 Bit
- Compiler => python 3.5

**Detailed description**

The var that i pass to the function is a numpy.array var and I am sure it is a correct type.An error occurred while calling the setVocabulary() as follow.

```
OpenCV Error: Assertion failed (The data should normally be NULL!) in NumpyAllocator::allocate, file ..\..\..\modules\python\src2\cv2.cpp, line 163
Traceback (most recent call last):
  File "E:/Documents/Documents/python/Traffic/main.py", line 15, in <module>
    c = sd.detect(img)
  File "E:\Documents\Documents\python\Traffic\src\SlideDetect.py", line 93, in detect
    svm, extractor = self.detector.create_detector()
  File "E:\Documents\Documents\python\Traffic\src\Detector.py", line 126, in create_detector
    extract_bow.setVocabulary(vocabulary)
cv2.error: ..\..\..\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate
```

**part of code**

```
    @staticmethod
    def _get_flann_matcher():
        flann_params = dict(algorithm=1, trees=5)
        flann = cv2.FlannBasedMatcher(flann_params, {})
        return flann

    @staticmethod
    def _get_extract_detect():
        sift = cv2.xfeatures2d.SIFT_create()
        return sift

    @staticmethod
    def _extract_sift(image, extractor, detector):
        im = cv2.imread(image, 0)
        features = extractor.compute(im, detector.detect(im))[1]
        return features

    def create_detector(self):
        detect = self._get_extract_detect()
        extract = self._get_extract_detect()
        matcher = self._get_flann_matcher()
        car_list, neg_list = self._get_train_data_address()

        bow_kmeans_trainer = cv2.BOWKMeansTrainer(12)
        extract_bow = cv2.BOWImgDescriptorExtractor(extract, matcher)

        for i in range(self.sample):
            features = self._extract_sift(car_list[i], extract, detect)
            bow_kmeans_trainer.add(features)

        vocabulary = bow_kmeans_trainer.cluster()
        extract_bow.setVocabulary(vocabulary)
```
Repository: TypeScript
Issue: Support for ECMAScript 'do'-expressions
Labels: Suggestion,ES Next,Waiting for TC39

Sorry if this has been discussed but it is hard to search for such a generic combination of words. 

Is there any plan to implement support for https://github.com/tc39/proposal-do-expressions ~~http://wiki.ecmascript.org/doku.php?id=strawman:do_expressions~~

It would be awesome to be able to avoid the extra code required when wrapping an if statement in a function to get a dynamic return value. 

Thanks!
Repository: youtube-dl
Issue: Make sleep interval log display more readable
Labels: request

## Please follow the guide below

- You will be asked some questions and requested to provide some information, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *issue* (like that [x])
- Use *Preview* tab to see how your issue will actually look like

---

### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2016.12.22*. If it's not read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
- [x] I've **verified** and **I assure** that I'm running youtube-dl **2016.12.22**

### Before submitting an *issue* make sure you have:
- [x] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones

### What is the purpose of your *issue*?
- [ ] Bug report (encountered problems with youtube-dl)
- [ ] Site support request (request for adding support for a new site)
- [ ] Feature request (request for a new functionality)
- [ ] Question
- [x] Other

---

### Make sleep interval log more readable

As of now, the log is like - 
```
[download] Sleeping 14.393324791937204 seconds...
```
It would become more readable if its something like
```
[download] Sleeping 14.39 seconds...
```

I have fixed it [here](https://github.com/singhpratyush/youtube-dl/commit/d338d71123761f2ad266667c59b1057bd2d12d8e). If valid, shall I create a PR?
Repository: TypeScript
Issue: Compiler API: no Symbol for Node
Labels: Bug

**TypeScript Version:**  2.1.1

**Code**

I'm trying to implement function detecting is identifier internal (can be renamed) or external but sometimes TS Compiler API returns me no symbols for identifiers:
```ts
private isIdentExternal(node: ts.Node): boolean {
    // node here is only ts.Node with kind=65 (Identifier), and already checked not to be reserved word
    let symbol = this.program.getTypeChecker().getSymbolAtLocation(node);
    if (!symbol) {
        // why?
    }
    for (const decl of symbol.declarations)
      if (decl.getSourceFile().fileName.endsWith(".d.ts"))
        return true;
    return false;
  }
```

There are two known cases when I get this problem.

Case 1: no symbol for internal abstract function:
```ts
abstract class Cls {
    private abstract func();// no symbol is here
    // Tough I can get symbols from cls.func() code in other place, the problem is for declaration only
}
```

Case 2: no symbol for external properties:
```ts
let el: HTMLElement = document.createElement("div");
el.className = "x"; // no symbol for "className", tough I have symbol for "createElement" (problem is only for properties)
```

**Expected behavior:**

Every identifier (function/variable/method/property/class definition) has symbol.

**Actual behavior:**

Sometimes symbol is missing (TypeChecker does not return it).
Repository: TypeScript
Issue: Are there jsdoc supported in salsa to polyfill ?
Labels: Suggestion,Awaiting More Feedback,Domain: JavaScript

Suppose I was implement

```js
Array.prototype.last = function() {
    return this[this.length - 1];
};
```

And wish it present in the intellisense. How should I do?

If it not exist, should we have this feature?
Repository: rust
Issue: memset not being optimized out when initializing array contents
Labels: A-LLVM,I-slow,C-enhancement,T-compiler,A-mir-opt,C-optimization

Apologies as there's most likely already a tracking issue for this, but I wasn't able to find it. When initializing an array's contents, it seems that the initial memset is not optimized out:

https://godbolt.org/g/pbgnlq

```
let mut arr = [0; 1000];
  for i in 0..arr.len() {
    arr[i] = i;
  }
  
  println!("{}", arr[5])
```

Clang has the same issue actually, except there memset would have to be called explicitly.
Repository: go
Issue: x/crypto/acme/autocert: Persistent cache results in stuck configuration if TOS is not always accepted
Labels: NeedsInvestigation

Please answer these questions before submitting your issue. Thanks!

### What version of Go are you using (`go version`)?
1.6

### What operating system and processor architecture are you using (`go env`)?
amd64

### What did you do?
Create a Manager that will not accept the TOS, but that does have a persistent Cache. Then re-use the cache with a Manager that does accept the TOS.

### What did you expect to see?
First Manager fails to register, second Manager succeeds.

### What did you see instead?
Seconds Manager also fails because acme.UpdateReg is never called.
See #18379 for the acme side of this.
Repository: rust
Issue: Error about "does not live long enough" could be more helpful
Labels: C-enhancement,A-diagnostics,T-compiler

When we receive a "`(var)` does not live long enough" error message, the compiler doesn't always tell you which line is actually causing the problem. For example (extracted from a larger program):

```
use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};

fn main() {
    let args: Vec<String> = env::args().collect();
    match args.len() {
        3 => {
            let in_name = &args[1];
            let out_name = &args[2];
            assemble(in_name, out_name).unwrap();
        }
        _ => {
            println!("Usage: hack-asm input_file output_file");
        }
    }
}

fn assemble(in_name: &str, out_name: &str) -> io::Result<()> {
    let in_file = try!(File::open(in_name));
    let out_file = try!(File::create(out_name));

    let mut reader = BufReader::new(in_file);
    let mut writer = BufWriter::new(out_file);

    // First, build up all labels
    let mut label_map = HashMap::new();
    let mut instruction_address = 0;

    for line in reader.by_ref().lines() {
        let line = line.unwrap();
        let mut line = line.trim();     

        // Strip any comments
        if let Some(idx_comment) = line.find("//") {
            line = &line[0..idx_comment].trim();
        }

        if line.is_empty() {
            // Not an instruction, skip.
        } else if line.starts_with('(') && line.ends_with(')') {
            let label = &line[1..line.len() - 1];

            if label.is_empty() {
                panic!("Empty label");
            } else if let Some(label) = label_map.insert(label, instruction_address) {
                panic!("Label {:?} was already defined.", label);
            }
        } else {
            // Assume it's an instruction. If it's not, validation will fail further below anyways.
            instruction_address += 1;
        }
    }

    Ok(())
}
```

Compiling this will give the following error:

```
error: `line` does not live long enough
  --> main.rs:57:5
   |
36 |         let mut line = line.trim();     
   |                        ---- borrow occurs here
...
57 |     }
   |     ^ `line` dropped here while still borrowed
...
60 | }
   | - borrowed value needs to live until here

error: aborting due to previous error
```

Neither of the shown lines are that close to where the problem actually is, on line 50:

`} else if let Some(label) = label_map.insert(label, instruction_address) {`

Changing `label` to `label.to_string()` fixes the error and allows the borrow check to pass.

It would definitely be an improvement (particularly for beginners to the language) if the compiler could tell you which line is holding onto the value, preventing the borrow check from passing.
Repository: rust
Issue: rustc: assertion failiure in llvm when defining __CxxFrameHandler3
Labels: A-runtime,O-windows,C-bug

I'm building a 64k demo on windows so i'm building without std and without libc. When writing some code a reference to `__CxxFrameHandler3` is emitted even though i'm building with `panic=abort`. I suspect this is because libcore is built with unwinding. In release builds the symbol `__CxxFrameHandler3`  is optimized away so the program links successfully. If i try to define `__CxxFrameHandler3` i get an assertion failure in llvm.

I tried this code:

Build with ```rustc --crate-type bin -C panic=abort main.rs```

```Rust
#![feature(lang_items)]
#![feature(link_args)]

#![no_std]
#![no_main]

#[link_args = "/SUBSYSTEM:WINDOWS"]
extern "C" {}

#[no_mangle]
pub extern "system" fn __CxxFrameHandler3(_: *mut u8, _: *mut u8, _: *mut u8, _: *mut u8) -> i32 { 0 }

#[no_mangle]
pub extern "system" fn WinMainCRTStartup() {

    for _ in 0..1 {}
}

#[lang = "panic_fmt"]
#[no_mangle]
pub extern "C" fn rust_begin_panic(_: core::fmt::Arguments, _: &'static str, _: u32) -> ! { loop {} }
```

I expected to see this happen:
Preferably the symbol `__CxxFrameHandler3` would not be emitted. But being able to define it without a crash is ok as well.

Instead, this happened:
The symbol `__CxxFrameHandler3` is emitted and when i try to define it i get a crash. 

Current workaround is to pass `/FORCE` to the linker to ignore the unresolved symbol.

## Meta
`rustc --version --verbose`:
```
rustc 1.15.0-nightly (71c06a56a 2016-12-18)
binary: rustc
commit-hash: 71c06a56a120a0d5e3b224105ee3e6754f83e5fa
commit-date: 2016-12-18
host: x86_64-pc-windows-msvc
release: 1.15.0-nightly
LLVM version: 3.9
```

## Output from rustc
`Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\llvm\include\llvm/Support/Casting.h, line 237`

## Backtrace
```msvcr120.dll!abort() Line 88
msvcr120.dll!_wassert(const wchar_t * expr, const wchar_t * filename, unsigned int lineno) Line 142
rustc_llvm-039c192262ead9ec.dll!00007ff969b9b87c()
rustc_trans-ba0c504011b26d52.dll!00007ff970296ccb()
rustc_trans-ba0c504011b26d52.dll!00007ff97026d1b4()
rustc_trans-ba0c504011b26d52.dll!00007ff9702b673b()
rustc_trans-ba0c504011b26d52.dll!00007ff9702debd2()
rustc_trans-ba0c504011b26d52.dll!00007ff97023b9fd()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff9754b8383()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff97548a519()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff9754b5580()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff975404ec9()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff975486553()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff9754d6f77()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff9753bd69f()
std-efe4996faa4fd772.dll!00007ff974114612()
rustc_driver-9b39ebb875ea3d3d.dll!00007ff9753e6bc5()
std-efe4996faa4fd772.dll!00007ff97410c2ff()
```
Repository: go
Issue: proposal: x/tools/cmd/goimports: support searching for Go packages within a Bazel WORKSPACE
Labels: Thinking,Proposal,Proposal-Hold

This feature request affects the functionality of [golang/tools/cmd/goimports](https://github.com/golang/tools/tree/master/cmd/goimports). 

### What version of Go are you using (`go version`)?

go version go1.7.3

### What operating system and processor architecture are you using (`go env`)?

linux/amd64

### Background
1. This is not a bug report, but a feature request.
2. I would like to contribute and implement this feature.
3. The purpose of filing this issue is to indicate that I would like to work on this and to agree on the implementation.

### The feature
Google released [Bazel](https://www.bazel.io/). Bazel's supports for Go is via the Skylark [go_rules](https://github.com/bazelbuild/rules_go).

Bazel organizes all source code under a WORKSPACE directory, say **/some/path/to/workspace** further referred to as the **bazel_workspace**. The go_rules require the user to set a WORPSKACE-wide variable **go_prefix** which is the global prefix used to fully qualify all Go import targets. This may be **yourcompany** further referred to as the **bazel_go_prefix**.

With this setup a package named **foo** located in file **/some/path/to/workspace/subdir/foo/foo.go** should be imported as:

```
<bazel_go_prefix>/subdir/foo
```

With the above mentioned bazel_go_prefix becomes:
```
"yourcompany/subdir/foo"
```

The desired feature is to enable goimports to find packages under a Bazel WORKSPACE and to add correct import paths for these packages.

### Proposed implementation

I would add two new flags into the goimports main:
1. **-bazel_workspace** for setting the absolute path to the Bazel's WORKSPACE .
2. **-bazel_go_prefix** for setting the go prefix.

The code in [golang/tools/imports/fix.go](https://github.com/golang/tools/blob/master/imports/fix.go) would be modified as follows:
1. Two new global vars will be added to hold the values of the new flags.
2. A new function scanBazelWorkspace() will be added, that when called would scan the Bazel WORKSPACE similarly to how the Go directories are scanned today, but with Bazel specific path manipulation.
3. The scanBazelWorkspace() function would be called from findImportGoPath() if both of the new flags were set.
4. The scanBazelWorkspace() function would be called concurrently with scanGoRoot() and scanGoPath().
5. Sorting of the discovered candidates would be modified, if the two new flags were specified, the import paths within the Bazel WORKSPACE would be preferred, the rest of the candidates would be sorted as today - based on the length, preferring the shortest.

I have a prototype that I tested this locally. Please let me know if you agree with the proposal above, in which case I will start the code review process.

Alternatively feedback or suggestions are welcome.
Repository: TypeScript
Issue: Add refactoring action to annotate a variable or a function signature component with its inferred type
Labels: Suggestion,Awaiting More Feedback,Domain: Refactorings

Hi, I'm using latest stable VSCode / latest nightly TS and I'm not sure if codefixes and refactorings have been implemented there yet, in any case, having a refactoring option to take any variable which receives an implicit inferred type, say, through a function call:

```ts
function test(): number[] {
  // ...
}

let x = test(); 
```
And being able to right-click `x` and invoke an action like `Annotate with inferred type` (or `Extract inferred type`), such that the resulting statement would look like:

```ts
let x: number[] = test();
```

could be very useful!
Repository: nvm
Issue: Everytime when run nvm command, it shows warning message
Labels: needs followup,shell: zsh: oh-my-zsh

<!-- Thank you for being interested in nvm! Please help us by filling out the following form if you‘re having trouble. If you have a feature request, or some other question, please feel free to clear out the form. Thanks! -->

- Operating system and version:
macOS 10.12.2
- `nvm debug` output:
<details>
<!-- do not delete the following blank line -->

```sh
nvm --version: v0.32.1
$SHELL: /bin/zsh
$HOME: /Users/jiehuang
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: system
which node: /usr/local/bin/node
which iojs: iojs not found
which npm: /usr/local/bin/npm
npm config get prefix: $HOME/.npm-global
npm root -g: $HOME/.npm-global/lib/node_modules
```
</details>

- `nvm ls` output:
<details>
<!-- do not delete the following blank line -->

```sh
         v4.7.0
->       system
default -> v4.7.0
node -> stable (-> v4.7.0) (default)
stable -> 4.7 (-> v4.7.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.7.0
lts/boron -> v6.9.2 (-> N/A)
```
</details>

- How did you install `nvm`? (e.g. install script in readme, homebrew):
zsh-nvm
https://github.com/lukechilds/zsh-nvm

- What steps did you perform?

- What happened?
everytime when I run nvm command , it shows warning message:

```sh
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/jiehuang/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.7.0` to unset it.
```
- What did you expect to happen?

- Is there anything in any of your profile files (`.bashrc`, `.bash_profile`, `.zshrc`, etc) that modifies the `PATH`?
Repository: go
Issue: runtime/pprof: document custom profiles
Labels: Documentation,NeedsFix,compiler/runtime

Custom profiles are under-documented.

The most important missing piece of documentation is the mental model for the API. Based on reading the code, the intended use is something like:

When an event that you are interested in starts, call Add with some unique identifier for the event. When an event stops, call Remove with the unique identifier. Calling WriteTo dumps all currently active events.

An example and perhaps a blog post showing a real life solved use case would be very helpful.

I also think that there are useful profiling-y use cases not well served by the current API/implementation. I will file a separate issue about that.

cc @matloob
Repository: go
Issue: runtime/pprof: support efficient accumulation of custom event count profiles
Labels: Proposal-Accepted,NeedsFix

I want to be able to gather pprof-esque information about instantaneous events that have occurred over the lifetime of my program, possibly with sampling for performance reasons.

This is similar to what the heap profile does, at least when used with alloc_space and alloc_objects--it tracks memory allocations over a long period.

The existing runtime/pprof custom profile API seems ill-suited to this. (Insofar as I understand it. See #18453.) One could accomplish it by inventing a unique key for Add and never Remove anything. However, this will result in a giant, ever-growing map. It would be far more efficient to just keep a counter per pc, as many of the runtime-provided profiles do. It might be worth considering adding a different kind of custom profile geared more towards this use case.

I don't have a concrete proposal, since I haven't thought about this deeply. This issue is just intended to open discussion, particularly since pprof labels are coming for 1.9, and it might be worth considering how they interact with custom profiles--hopefully productively.

cc @matloob
Repository: TypeScript
Issue: incorrect formatting on javascript
Labels: Bug,Help Wanted,Domain: Formatter,VS Code Tracked

_From @calidion on December 28, 2016 22:5_

- VSCode Version: Code 1.8.1 (ee428b0eead68bf0fb99ab5fdc4439be227b6281, 2016-12-19T14:42:49.304Z)
- OS Version: Darwin x64 16.3.0
- Extensions:

|Extension|Author|Version|
|---|---|---|
|tslint|eg2|0.7.1|
|code-beautifier|michelemelluso|1.6.2|
|vscode-icons|robertohuertasm|4.1.0|

---

Steps to Reproduce:

1.  for code:
```
return MessageFriend.update({
            id: found.id
          }, 
 {
              processed: true
})
```

expected:
```
return MessageFriend.update({
  id: found.id
}, {
  processed: true
});
```
got:
```
return MessageFriend.update({
  id: found.id
}, 
  {
    processed: true
  });
```

_Copied from original issue: Microsoft/vscode#17887_
Repository: TypeScript
Issue: Make Javascript intellisense detect inheritance
Labels: Suggestion,Committed,Domain: JavaScript

_From @benjaminmillhouse on December 21, 2016 17:33_

- VSCode Version: Code 1.8.0 (38746938a4ab94f2f57d9e1309c51fd6fb37553d, 2016-12-13T17:38:28.425Z)
- OS Version: Darwin x64 16.3.0
- Extensions:

|Extension|Author|Version|
|---|---|---|
|JSDocTagComplete|HookyQR|0.0.2|
|html-css-class-completion|Zignd|1.0.3|
|theme-atom-one-dark|andischerer|0.0.1|
|vscode-eslint|dbaeumer|1.1.0|
|docthis|joelday|0.3.5|
|Angular1|johnpapa|0.1.16|
|Angular2|johnpapa|1.0.2|
|csharp|ms-vscode|1.5.3|
|js-atom-grammar|ms-vscode|0.1.10|
|vscode-icons|robertohuertasm|4.0.2|
|bootstrap-3-snippets|wcwhitehead|0.0.8|

---

Hello,
I would love it if VS Code's Javascript intellisense was able to detect inheritance.  Please let me know if there is a way to accomplish this today through jsdoc comments or anything like that.  I have tried all kinds of different ways to get VS Code to detect it (definitions like below, @augments, @extends jsdoc comments, etc) and have not gotten anything to work.

```
As an example, when inheriting like this:
function BaseClass() {
  this.foo = 'bar';
}
BaseClass.prototype.baz = function () { }

function InheritedClass() {
  BaseClass.call(this);
}
InheritedClass.prototype = Object.create(BaseClass.prototype);
InheritedClass.prototype.constructor = InheritedClass;
```
Would like the intellisense for new InheritedClass(). to show 'foo' and 'baz' as properties/methods for InheritedClass in Intellisense.


_Copied from original issue: Microsoft/vscode#17690_