WhereIsAI/github-issue-similarity huggingface dataset:
Issue 1:
Currently, the sum function use the element type (except for the boolean case) of the input array as result type. This is sometimes not a desirable choice:

function mysum(R, x)
s = zero(R)
for v in x; s += v; end
return s
end

julia> x = uint8(rand(1:10, 50));

julia> sum(x)
0x0000000000000122

# to prevent overflow
julia> mysum(Int, x)
290

julia> a = rand(Float32, 10^6);

julia> sum(float64(a)) - sum(a)
-0.018809685949236155

# to get higher accuracy
julia> sum(float64(a)) - mysum(0.0, a)
1.1641532182693481e-10

My proposal is to add a method like sum(R, x) where R is the user-specifed type. This won't break any existing codes, but provide the user additional choices.

Issue 2:
Both the spec for Github Flavoured Markdown and CommonMark state:

A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a hard line break (rendered in HTML as a
tag):

But if you write such code in Julia, that new line is just replaced with a space; as if it were not preceded by two spaces in the source.

julia> md"foo
bar".content
1-element Vector{Any}:
Markdown.Paragraph(Any["foo bar"])

The correct output would be

1-element Vector{Any}:
Markdown.Paragraph(Any["foo\nbar"])

This forces extra line breaks in #39093 as there is no way to have a linebreak without inserting a full blank line (i.e. making two Markdown.Paragraphs)
Issue 1:
Challenge Waypoint: Add Borders Around your Elements has an issue.

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36.

Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.smaller-image {
width: 100px;
}
.thick-green-border {border: 10px solid green;}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Issue 2:
Challenge http://freecodecamp.com/challenges/waypoint-add-borders-around-your-elements has an issue. "Give your image a border width of 10px doesn't work.
Issue 1:
Here is a very simple program which employs trait objects:

c.rc:

#[crate_id = "c#0.1"];
#[crate_type = "bin"];

mod m1;
mod m2;

m1.rs:

use std::io;

pub struct Container<'a> {
priv reader: &'a mut Reader
}

impl<'a> Container<'a> {
pub fn wrap<'s>(reader: &'s mut Reader) -> Container<'s> {
Container { reader: reader }
}

pub fn read_to(&self, vec: &mut [u8]) {
self.reader.read(vec);
}
}

pub fn for_stdin<'a>() -> Container<'a> {
let mut r = io::stdin();
Container::wrap(&mut r as &mut Reader)
}

m2.rs:

use std::vec;

use m1;

#[main]
fn main() {
let c = m1::for_stdin();
let mut v = vec::from_elem(10, 0u8);
c.read_to(v.as_mut_slice());
}

When this program is compiled and run, it fails with segmentation fault:

% rustc c.rc
% ./c
zsh: segmentation fault (core dumped) ./c

This program is not correct. You can see that m1::for_stdin() function produces a Container<'a, ...> for arbitrary lifetime 'a, but the local variable r is valid only for for_stdin() body. A pointer to r, however, is saved to the Container, and when it is accessed inside m2::main(), a segmentation fault occurs. However, Rust still compiles it. I thought that borrowing checker should prevent this kind of errors.

BTW, I can write &mut r or &mut r as &mut Reader and it will compile either way, but I thought that when going from plain pointers to trait objects I should always specify exact kind of trait object. Not sure that I'm right here thought.

Issue 2:
Currently obj constructors capture type parameters, but binds don't. Fix this.

(Possibly share more code with obj constructors? They're doing quite a bit of the same work, seems a shame to have so much duplication)
Issue 1:
Hi,

I am in the process of migrating our codebase to React 0.14.x. During this I encountered a problem, because of the fact that our client side uses React.renderToStaticMarkup to render React components and passing the results around as strings (I know, not ideal, but given what our codebase was previously, this is sadly needed for us in some cases).

However, given my understanding of the structural changes with react and react-dom packages, as I can tell, I am not supposed to simply call React.renderToStaticMarkup any more, and the API is not accessible from the react-dom package. I do not use webpack (yet!), so at the moment using react-dom/server is not appropriate for me.

What is the supported way (if any?) of calling React.renderToStaticMarkup in the browser, using the pre-built packages?

Issue 2:
We have some corner cases within our client-side application which requires React.renderToString functionality. In 0.14, this has been deprecated in favor of ReactDOMServer.renderToString. Unfortunately, the bower distribution does not include a way to reference ReactDOMServer.
Issue 1:
interface Promise<T> {
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
}

// Consider both orderings of the following overloads
declare function testFunction(n: number): Promise<number>;
declare function testFunction(s: string): Promise<string>;

var numPromise: Promise<number>;
var newPromise = numPromise.then(testFunction);

In the old compiler, with either ordering of the overloads, newPromise had type Promise<{}>.

In the new compiler, if the number signature comes first, we get an error. If the string signature comes first, newPromise is of type Promise<number>! This is very inconsistent.

We have based this on the notion that the last overload will always be more general than the preceding overloads. However, with disjoint overloads, we are essentially giving the last one undue priority. The rule of thumb is that in a call, the first overload has priority, so giving the last one priority when passing a callback seems really unintuitive.

Issue 2:
interface Opts { url: string; }

declare function doit(url: string): number;
declare function doit(opts: Opts): boolean;

declare function call<T, U>(fn: (arg: T) => U, arg: T): U;

var n: number = call(doit, 'here');
var b: boolean = call(doit, { url: 'here' });

In 1.4.1.0 this snippet errors out with

test.ts(8,17): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Opts' is not a valid type argument because it is not a supertype of candidate 'string'.

changing line 8 to ... = call<string, number>(doit, 'here'); successfully compiles as expected.

While playing around with this I noticed that while 1.3.0.0 would allow the call(doit, 'here') invocation it was still choosing the second overload of doit resulting in a return type of boolean and causing a compile error on the assignment. I'm glad 1.4.1.0 is now catching this error case, but it seems like inference of the type parameters should be entirely possible here.
Issue 1:
I tried using the @types/xxxx package and had problems.

I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript

I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).

Mention the authors (see Definitions by: in index.d.ts) so they can respond.

Authors: @puneetar

The recent update of the Express types break all my apps because express.Response obviously no longer has any accessible properties. Example: https://circleci.com/gh/manuelbieh/react-ssr-setup/104

Not sure if I might be using it incorrectly but since I also only see one tiny test with a very specific testcase (sending json() as response) I think there's a chance that this is a bug.

Issue 2:
If you know how to fix the issue, make a pull request instead.

I tried using the @types/express package and had problems.

I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript

I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).

Mention the authors (see Definitions by: in index.d.ts) so they can respond.

Authors: @borisyankov, @CMUH, @rockwyc992, @OliverJAsh

My builds are throwing the following errors after upgrades to latest version of the @types/express package:

Property 'headers' does not exist on type 'Request<any>'

Property 'query' does not exist on type 'Request<any>'

Property 'body' does not exist on type 'Request<any>'

We have changed nothing on our end. I also noticed that my TS environment, when I open up the index.d.ts of @types/express shows the following errors:

`express-serve-static-core` has no exported member 'ParamsDictionary'

`express-serve-static-core` has no exported member 'Params'

`express-serve-static-core` has no exported member 'Params'

Some kind of breaking change seems to have been introduced, and I cannot seem to find any guidelines on how to address.
Issue 1:
When doing some math works in pandas, the rolling function is very useful, such as pd.rolling().mean() or

pd.rolling().max().

Here is my problem: when I want to get a time-series rank in a Series or a column in DataFrame, there is no function like pd.rolling().rank(). Is there any function can work as pd.rolling().rank() ?

Issue 2:
xref SO issue here

Im looking to set the rolling rank on a dataframe. Having posted, discussed and analysed the code it looks like the suggested way would be to use the pandas Series.rank function as an argument in rolling_apply. However on large datasets the performance is particularly poor. I have tried different implementations and using bottlenecks rank method orders of magnitude faster, but that only offers the average option for ties. It is also still some way off the performance of rolling_mean. I have previously implemented a rolling rank function which monitors changes on a moving window (in a similar way to algos.roll_mean I believe) rather that recalculating the rank from scratch on each window. Below is an example to highlight the performance, it should be possible to implement a rolling rank with comparable performance to rolling_mean.

python: 2.7.3

pandas: 0.15.2

scipy: 0.10.1

bottleneck: 0.7.0

rollWindow = 240
df = pd.DataFrame(np.random.randn(100000,4), columns=list('ABCD'), index=pd.date_range('1/1/2000', periods=100000, freq='1H'))
df.iloc[-3:-1]['A'] = 7.5
df.iloc[-1]['A'] = 5.5

df["SER_RK"] = pd.rolling_apply(df["A"], rollWindow, rollingRankOnSeries)
#28.9secs (allows competition/min ranking for ties)

df["SCIPY_RK"] = pd.rolling_apply(df["A"], rollWindow, rollingRankSciPy)
#70.89secs (allows competition/min ranking for ties)

df["BNECK_RK"] = pd.rolling_apply(df["A"], rollWindow, rollingRankBottleneck)
#3.64secs (only provides average ranking for ties)

df["ASRT_RK"] = pd.rolling_apply(df["A"], rollWindow, rollingRankArgSort)
#3.56secs (only provides competition/min ranking for ties, not necessarily correct result)

df["MEAN"] = pd.rolling_mean(df['A'], window=rollWindow)
#0.008secs

def rollingRankOnSeries (array):
s = pd.Series(array)
return s.rank(method='min', ascending=False)[len(s)-1]

def rollingRankSciPy (array):
return array.size + 1 - sc.rankdata(array)[-1]

def rollingRankBottleneck (array):
return array.size + 1 - bd.rankdata(array)[-1]

def rollingRankArgSort (array):
return array.size - array.argsort().argsort()[-1]
```python

I think this is likely to be a common request for users looking to use pandas for analysis on large datasets and thought it would be a useful addition to the pandas moving statistics/moments suite?
Issue 1:
While testing the class_weight parameter in several estimators to investigate #1411, I noticed that the parameter doesn't work as I would expect in RidgeClassifier either.

Maybe this is some misunderstanding on my part or some regularization issue, but if I have noisy labels, I would have expected to be be able to move the decision boundary.

This is not the case as illustrated in this notebook

Any input would be appreciated.

Issue 2:
When using the sklearn.decomposition.PCA class with n_components='mle' when svd_solver='auto' the following line will attempt to evaluate n_components as a numeric type. An additional safety check is necessary.

Error

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-22-26ffe206b6e0> in <module>()
----> 1 model = PCA(n_components='mle').fit(X_tr)

~/.conda/envs/Science3/lib/python3.6/site-packages/sklearn/decomposition/pca.py in fit(self, X, y)
327 Returns the instance itself.
328 """
--> 329 self._fit(X)
330 return self
331

~/.conda/envs/Science3/lib/python3.6/site-packages/sklearn/decomposition/pca.py in _fit(self, X)
382 if max(X.shape) <= 500:
383 svd_solver = 'full'
--> 384 elif n_components >= 1 and n_components < .8 * min(X.shape):
385 svd_solver = 'randomized'
386 # This is also the case of n_components in (0,1)

TypeError: '>=' not supported between instances of 'str' and 'int'

Solution

# Handle svd_solver
if n_components == 'mle':
self.svd_solver = 'full'
svd_solver = self.svd_solver
if svd_solver == 'auto':
# Small problem, just call full PCA
if max(X.shape) <= 500:
svd_solver = 'full'
elif n_components >= 1 and n_components < .8 * min(X.shape):
svd_solver = 'randomized'
# This is also the case of n_components in (0,1)
else:
svd_solver = 'full'

scikit-learn/sklearn/decomposition/pca.py

Line 384
in
a24c8b4

elif n_components >= 1 and n_components < .8 * min(X.shape):
Issue 1:
Version

2.4.2

Reproduction link

https://jsfiddle.net/1madr5ze/

Although putting it into data works: https://jsfiddle.net/t1t4teeo/

Steps to reproduce

Declare a prop for the root application instance.

Pass the prop to the <div> that represents the root of the app.

What is expected?

The root app should have the props data.

What is actually happening?

The props data isn't showing up.

Issue 2:
Version

2.5.17

Reproduction link

https://jsfiddle.net/eywraw8t/319255/

Steps to reproduce

generate an input field with a dynamic type

open project in IE10

open console

What is expected?

Working radio / checkboxes

What is actually happening?

JS error in IE10

SCRIPT1046: Multiple definitions of a property not allowed in strict mode

domProps:{value:e.value,value:t.model}
Issue 1:
To help us understand and resolve your issue please check that you have provided

the information below.

Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)

osx, linux. Matloplib version 1.5.3. Python version 3.5.2

How did you install Matplotlib and Python (pip, anaconda, from source ...)

anaconda (osx/linux), macports (osx)

If possible please supply a Short, Self Contained, Correct, Example

that demonstrates the issue i.e a small piece of code which reproduces the issue

and can be run with out any other (or as few as possible) external dependencies.

Enclosed

If this is an image generation bug attach a screenshot demonstrating the issue.

Attached

If this is a regression (Used to work in an earlier version of Matplotlib), please

note where it used to work.

N/A

==

When plotting numpy's maskedarray with plot(), I could not see some data points.

A simple code follows. If I savefig() to png file, it works. If I savefig() to pdf (or eps) file, it does not.

import matplotlib.pyplot as plt
import numpy as np
arr = np.array([1, 5, -3, -3, 5, -3, -3, 2, -3, -3, 7, -3, -3, 2])
arrm = np.ma.masked_less(arr, 0)
plt.figure()
plt.plot(arrm, 'o')
plt.savefig('a.png')
plt.savefig('a.pdf')

a.pdf

Issue 2:
Dear developers,

when plotting single points surrounded by np.nan values, points are shown in a regular plot, but are omitted when saved via pdf backend. Minimal example:

import numpy as np
import matplotlib.pyplot as plt

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

plt.plot(a, marker='o')
plt.show()

generates a perfect plot with the 5 points shown:

but directly saving it via pdf backend omitts the values isolated by np.nans:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf as pdf

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

fig1 = plt.figure()
sub = fig1.add_subplot(1,1,1)
sub.plot(a,marker='o')
pp1 = pdf.PdfPages('foo.pdf')
fig1.savefig(pp1, format='pdf')
pp1.close()

like so:

I would be glad for any help.

System:

Ubuntu 14.02

Python 2.7.6

Numpy 1.11.2

Matplotlib 1.5.3
Issue 1:
From 2020.20.04 9pm msi

Description: A .NET Core application failed.

Application: PowerLauncher.exe

Path: C:\Program Files\PowerToys\modules\launcher\PowerLauncher.exe

Message: Error:

An assembly specified in the application dependencies manifest (PowerLauncher.deps.json) was not found:

package: 'PropertyChanged.Fody', version: '3.2.7'

path: 'lib/netstandard1.0/PropertyChanged.dll'

Issue 2:
From 2020.20.04 9pm msi

Description: A .NET Core application failed.

Application: PowerLauncher.exe

Path: C:\Program Files\PowerToys\modules\launcher\PowerLauncher.exe

Message: Error:

An assembly specified in the application dependencies manifest (PowerLauncher.deps.json) was not found:

package: 'PropertyChanged.Fody', version: '3.2.7'

path: 'lib/netstandard1.0/PropertyChanged.dll'
Issue 1:
Code Sample

df = Dataframe(numpy.zeros(10000,10000))
random_fill_df(df, num_elements=20)
df = df.to_sparse(fill_value=0)
timeit.timeit('df.loc[[23, 45, 65, 67],:]', globals=globals(), number=10)

Problem description

The reason why row slicing takes so long is because a sparse dataframe a bunch of sparse series. Column slicing is several order of magnitude faster but row slicing is very poor. The sparse dataframe doesn't take advantage of the scipy sparse matrix library which is even faster (both column and row).

Expected Output

In case data is stored as a scipy sparse matrix (as well) inside dataframe object, the slicing operations can be improved, by several orders of magnitude.

I propose that data be stored as a sparse matrix as well in the dataframe object.

Output of pd.show_versions()

pandas: 0.20.3

pytest: None

pip: 9.0.1

setuptools: 36.2.0

Cython: None

numpy: 1.13.1

scipy: 0.19.1

xarray: None

IPython: None

sphinx: None

patsy: None

dateutil: 2.6.1

pytz: 2017.2

blosc: None

bottleneck: 1.2.1

tables: None

numexpr: 2.6.2

feather: None

matplotlib: 2.0.2

openpyxl: None

xlrd: None

xlwt: None

xlsxwriter: None

lxml: None

bs4: 4.6.0

html5lib: 0.999999999

sqlalchemy: None

pymysql: None

psycopg2: None

jinja2: None

s3fs: None

pandas_gbq: None

pandas_datareader: None

Issue 2:
In [1]: import pandas as pd

In [2]: df = pd.DataFrame([[1, 0, 0],[0,0,0]])

# non sparse
In [19]: %time df.loc[0]
CPU times: user 367 µs, sys: 14 µs, total: 381 µs
Wall time: 374 µs
Out[19]:
0 1
1 0
2 0
Name: 0, dtype: int64

In [20]: %time df.loc[[0]]
CPU times: user 808 µs, sys: 57 µs, total: 865 µs
Wall time: 827 µs
Out[20]:
0 1 2
0 1 0 0

In [3]: df = df.to_sparse()

# sparse
In [5]: %time df.loc[0]
CPU times: user 429 µs, sys: 14 µs, total: 443 µs
Wall time: 436 µs
Out[5]:
0 1.0
1 0.0
2 0.0
Name: 0, dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([3], dtype=int32)

In [6]: %time df.loc[[0]]
CPU times: user 4.07 ms, sys: 406 µs, total: 4.48 ms
Wall time: 6.16 ms
Out[6]:
0 1 2
0 1.0 0.0 0.0

It seems in SparseDataFrame, selecting as dataframe, the time increased much more than it does in DataFrame, I would expect it runs faster(on my 1m x 500 SparseDataFrame it takes seconds for the loc operation)

## INSTALLED VERSIONS

commit: None

python: 3.5.1.final.0

python-bits: 64

OS: Darwin

OS-release: 15.6.0

machine: x86_64

processor: i386

byteorder: little

LC_ALL: en_GB.UTF-8

LANG: en_GB.UTF-8

pandas: 0.18.1

nose: None

pip: 8.1.2

setuptools: 24.0.2

Cython: None

numpy: 1.11.0

scipy: 0.17.1

statsmodels: None

xarray: None

IPython: 5.0.0

sphinx: None

patsy: None

dateutil: 2.5.3

pytz: 2016.4

blosc: None

bottleneck: None

tables: None

numexpr: 2.6.1

matplotlib: 1.5.1

openpyxl: None

xlrd: None

xlwt: None

xlsxwriter: None

lxml: None

bs4: None

html5lib: None

httplib2: None

apiclient: None

sqlalchemy: 1.0.13

pymysql: None

psycopg2: 2.6.1 (dt dec pq3 ext lo64)

jinja2: None

boto: None

pandas_datareader: None
Issue 1:
Issue Type:

“Docs Pull Request”.

Ansible Version:

1.7

Environment:

Centos 6.5

Summary:

Running module mysql_db with state of import and with a missing database name on mysql return connection error message.

Steps To Reproduce:

The following test

- name: test state import for a database name with target and missing database
mysql_db: name=datadump state=import target=/tmp/datadump.sql.bz2
register: result
ignore_errors: true

Expected Results:

Perhaps tell the user that the database name does not exist on mysql

result return the following message: msg: database name that you are trying to import does not exist

Actual Results:

result return the following message: msg: unable to connect, check login_user and login_password are correct, or alternatively check ~/.my.cnf contains credentials

Issue 2:
From @velotraveler on 2016-11-11T01:14:16Z

ISSUE TYPE

Bug Report

COMPONENT NAME

iptables

ANSIBLE VERSION

ansible 2.2.0.0

CONFIGURATION

OS / ENVIRONMENT

from OS: Red Hat Enterprise Linux Server release 6.6 (Santiago) / iptables 1.4.7

managed OS (2 hosts):

Red Hat Enterprise Linux Server release 5.8 (Tikanga) / iptables 1.3.5

Red Hat Enterprise Linux Server release 6.6 (Santiago) / iptables 1.4.7

SUMMARY

iptables module installs duplicate rules with every run. It looks like module uses "iptables -C" to check whether rule already exists, but that option does not exist in older versions of iptables (such as 1.3.5) and although it exists in iptables 1.4.7 it does not seem to be working. Suggest switching to a different method of verification, such as parsing the output of "iptables-save" or "iptables -L" (although that might introduce difficulties as module inputs might not match command-line output, such as with symbolic ICMP types or IPs/ports specified by name vs. by number).

STEPS TO REPRODUCE

Create an iptables rule on a host where iptables does not support the -C option, or where it isn't supported the way this module expects it, such as iptables 1.4.7.

Then run the playbook again, the module will not recognize the old rules exist and it will install duplicate copies of all rules.

iptables: table=filter chain=OUTPUT jump=DROP action=insert protocol=icmp icmp_type=destination-unreachable

EXPECTED RESULTS

only one copy of rule no matter how many times I run the playbook

ACTUAL RESULTS

multiple copies of rules, one for each time I ran the playbook

# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP icmp -- anywhere anywhere icmp destination-unreachable
DROP icmp -- anywhere anywhere icmp destination-unreachable

Copied from original issue: ansible/ansible-modules-extras#3428