WhereIsAI/github-issue-similarity huggingface dataset:
Issue 1:
When using allow_redirect=True, user can set a callback on each 'response' (via the hook parameter) but not on 'request'.

This is a problem when using the redirect capability because user loose the ability to interact with the request before it is being sent.

This would allow a user to do things such as: Log all incoming requests (and all redirect) in real time / modify the header between redirected calls / modify argument or payload between calls / or change http method between redirects / ...

Locally I can fix this by changing:

hook.py:

Adding a 'request' to the HOOK list at line 14:

HOOKS = ['response', 'request'])

Session.py

move line 637 to 633:

hook = request.hooks

add a callback line 634:

dispatch_hook('request', hooks, request, **kwargs)

But I don't want to have a frankenversion of "requests.py" on my system. And I'm not familiar enough to have a good "proposed change" from GitHub (without potentially causing unintended side effects).

Expected Result

The 'response' hook should be triggered just before making the adapter.send (initially and more importantly for all subsequent redirects).

The default_hook (hook.py) should have an entry for 'request' along with 'response'

Actual Result

When redirect happen, mulitple 'response' callback are triggered but no 'request' callback.

What happened instead.

Reproduction Steps

import requests

LOG = logging.getLogger(__name__)

# ( in real scenario, there would be something more interesting than logging here - but good enough for repro steps).
def _log_request(self, prepared_request):
LOG.info("HTTP Request")
LOG.info("-> %s %s" % (prepared_request.method.upper(), prepared_request.url))
if prepared_request.body:
LOG.info("-> (Payload) %s" % prepared_request.body)
for key,value in prepared_request.headers.items():
LOG.info("-> %s: %s" % (key,value))

def _log_response(self, resp):
LOG.info("HTTP Response for '%s'" % resp.url)
LOG.info("<- Status Code = %s" % resp.status_code)
for (key,value) in resp.headers.items():
LOG.info("<- %s: %s" % (key,value) )

session = requests.Session()
session.get(url, headers=_headers, hooks={"response":_log_response, "request":_log_request}, allow_redirects=True)

System Information

$ python -m requests.help

{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": ""
},
"idna": {
"version": "2.7"
},
"implementation": {
"name": "CPython",
"version": "3.6.5"
},
"platform": {
"release": "17.7.0",
"system": "Darwin"
},
"pyOpenSSL": {
"openssl_version": "",
"version": null
},
"requests": {
"version": "2.19.1"
},
"system_ssl": {
"version": "100020ef"
},
"urllib3": {
"version": "1.23"
},
"using_pyopenssl": false
}

This command is only available on Requests v2.16.4 and greater. Otherwise,

please provide some basic information about your system (Python version,

operating system, &c).

Issue 2:
There was a scenario where I need to intercept the request and was searching for if there is some way can that be done, then I found the event hook but only response event hook is supported.

I hope adding request hook can be useful, if yes I would like to implement that.

Any pointers or suggestion appreciated.

Thanks
Issue 1:
System information (version)

OpenCV => 3.4.2, 3.4.5 and 4.1.0

Operating System / Platform => Windows and Linux x64

Compiler => gcc and python bindings

Detailed description

There is a large difference in calculations after the first batch normalization layer when I use a convolutional model with the opencv dnn module. The model is made with Keras/Tensorflow 1.14. The graph is frozen and then saved in binary .pb format.

Steps to reproduce

Here is the model up to the batch norm layer in text format

https://www.dropbox.com/s/tujdf3uvd7heyn1/test_batchnorm.pbtxt?dl=0

Here is the model up to the batch norm layer in binary format

https://www.dropbox.com/s/eyndn1xh42x3qr3/test_batchnorm.pb?dl=0

Here is a test image ( grayscale, should be rescaled in range 0..1, before passing as input)

https://www.dropbox.com/s/gtghtp06k8jk5vy/00001.png?dl=0

And the outputs generated with the python binding

Here is the output of the batch norm in Tensorflow

https://www.dropbox.com/sh/xwkdjwbsoarxqna/AADrZ9BmWK5UUGRBN9t1I6moa?dl=0

Here is the output of the batch norm in OpenCV

https://www.dropbox.com/sh/520m2w74045tlqc/AAAUl3CAzE0r498go7BsMxRea?dl=0

Issue 2:
System information (version)

OpenCV => 3.2.0

Operating System / Platform => Ubuntu 18.04

Compiler => c++

Detailed description

When I create a binary image with few pixels and call findContours, it seems to me that some points are skipped. Code example:

#include <opencv2/opencv.hpp>

int main()
{
uchar img_data[] = {255, 255, 255, 0, 0, 0, 255, 0, 255, 0, 255, 0, 255, 0, 0};
cv::Mat img(cv::Size(5, 3), CV_8UC1, img_data);

cv::imshow("img", img);
cv::waitKey();

std::vector<std::vector<cv::Point>> contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(img, contours, hierarchy, cv::RETR_TREE,
cv::CHAIN_APPROX_NONE);

for (std::vector<cv::Point> contour : contours)
{
for (cv::Point p : contour)
{
std::cout << p << std::endl;
}
}
}

I expect the points [0,0], [0,1], [1,1], [1,2], [0,2], [0,3], [1,2], [1,2], [2,2], [2,3], [3,3], [3,2], [4,2], [4,1] and [3,0] to show up. Instead the output is:

[0, 0]
[1, 1]
[0, 2]
[1, 1]
[2, 2]
[3, 1]
[2, 0]
[1, 0]
[1, 1]
[2, 0]
[3, 1]
[2, 2]

The problem gets clearer if the image is scaled by a positive value. Then, most of the structures are recognizable, but in the corners there are diagonals instead of harsh 90 degree angles. The diagonal neighboring pixels seems to be replaced with a diagonal line. So it seems to me that 8-connectivity is used as default. For my case, I'd like to use 4-connectivity. Is there any way to do this? Thanks-

Steps to reproduce

Use above code.
Issue 1:
Taking example 2 from the original issue (#5039):

projectRoot
├── folder1
│ ├── file1.ts
│ └── file2.ts
├── generated
│ ├── folder1
│ └── folder2
│ └── file3.ts (Contains: import 'folder1/file2';)
└── tsconfig.json (with "baseUrl": ".")

When doing...

import 'folder1/file2';

...in file3.ts it current compiles to the same thing as above. Would it be possible if we could add a compiler option or some way that would convert this to the relative path? So it would transpile it to:

import './../../folder1/file2';

That way the paths don't have to be managed in two places. I couldn't find this discussed anywhere and didn't want to clutter the original issue so I'm opening this here.

Issue 2:
In TypeScript 1.9.0-dev.20160426 I tried:

import * as Promise from 'bluebird';

async function test() {
await Promise.delay(1000);
}

test();

The compiler reports:

error TS2529: Duplicate identifier 'Promise'. Compiler reserves name 'Promise' in top level scope of a module containing async functions.

Especially since this is purely for Node.js, I'd like to use Bluebird promises for their debuggability and import them as Promise instead of some other name.

Could I provide my own __awaiter or could the default one use the imported Promise?
Issue 1:
The current exception is mess and lots of duplicated usage.

It is necessary to refine and clear them.

Issue 2:
Question

（default-data-source-name）table join （broadcast-table） error

Content

<sharding:standard-strategy id="databaseStrategy" sharding-column="buss_num" precise-algorithm-ref="dbShardingRule" />

<sharding:data-source id="shadingDataSource">
<sharding:props>
<prop key="sql.show">true</prop>
</sharding:props>
<sharding:sharding-rule data-source-names="ds0,ds1" default-data-source-name="ds0">
<sharding:table-rules>
<sharding:table-rule logic-table="user" actual-data-nodes="ds$->{0..1}.user"
database-strategy-ref="databaseStrategy" />
<sharding:table-rule logic-table="classes" actual-data-nodes="ds$->{0..1}.classes"
database-strategy-ref="databaseStrategy" />
<sharding:table-rule logic-table="mark" actual-data-nodes="ds$->{0..1}.mark"
database-strategy-ref="databaseStrategy" />
</sharding:table-rules>
<sharding:binding-table-rules>
<sharding:binding-table-rule logic-tables="user,classes,mark" />
</sharding:binding-table-rules>
<sharding:broadcast-table-rules >
<sharding:broadcast-table-rule table="school_config"/>
</sharding:broadcast-table-rules>
</sharding:sharding-rule>
</sharding:data-source>

exception:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error updating database. Cause: org.apache.shardingsphere.core.exception.ShardingException: Cannot find table rule and default data source with logic tables: '[inter_user , school_config]'
### The error may involve com.inter_user .deleteImportData-Inline
### The error occurred while setting parameters
### SQL: delete from inter_user where date = ? and school IN (SELECT SLAVE_ID FROM school_config WHERE PARENT_ID = ?)
### Cause: org.apache.shardingsphere.core.exception.ShardingException: Cannot find table rule and default data source with logic tables: '[inter_user , school_config ]'
version：

org.apache.shardingsphere
sharding-jdbc-core
4.0.0-RC2

how to configure？can you tell me the question?thank you!
Issue 1:
System information

I am using the stock DNNClassifier in contrib/learn. The warning is present in every instance where DNNClassifier is called.

Present in OSX (Mac OS 10.12.5) and Linux (Ubuntu 16.04)

TensorFlow installed from (source or binary): Present both on binary and when compiled from source

TensorFlow version (use command below): v1.2.0 (release) and v1.2.0-1371-g97af82d53 1.2.0

Bazel version (if compiling from source): 0.5.1

CUDA/cuDNN version: N/A

GPU model and memory: N/A

Exact command to reproduce: Call the DNN classifier as indicated in https://www.tensorflow.org/api_docs/python/tf/contrib/learn/DNNClassifier

Describe the problem

A warning for a deprecated feature is cluttering the logs when using the DNNClassifier. It is due to the use of the deprecated feature scalar_summary while logging. While this has been deprecated in 2016-11-30, it is still used in tensorflow/contrib/learn/python/learn/estimators/head.py:642

This bug report request for updating the the current tf.summary.scalar, as indicated. The usability of the product is much improved as a consequence.

Logs

WARNING:tensorflow:From /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:642: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.

Source code

tensorflow/contrib/learn/python/learn/estimators/head.py:642

# Uses the deprecated API to set the tag explicitly.
# Without it, training and eval losses will show up in different graphs.
logging_ops.scalar_summary(
_summary_key(head_name, mkey.LOSS), weighted_average_loss)

Issue 2:
In the Updates section of the new TensorFlow website, two news have the same text:
Issue 1:
Hi, I am observing that deno bundle does not bundle imports that have the @deno-types annotation. This may be related to #5665.

// @deno-types="https://unpkg.com/rollup@2.16.0/dist/rollup.d.ts"
import { rollup } from 'https://unpkg.com/rollup@2.16.0/dist/es/rollup.browser.js'
console.log(rollup)

deno bundle test.js > out.js && deno run out.js

error: Uncaught TypeError: Cannot read property 'rollup' of undefined
console.log(rollup_browser_js_1.rollup);

If I omit the @deno-types annotation, the out.js file is significantly larger and it works fine.

Issue 2:
Steps to reproduce

Run deno bundle https://deno.land/x/once/index.js

Expected behavior

It prints a bundled JavaScript code

Actual behavior

error TS5012: Cannot read file 'https://deno.land/x/once/index.js': Error: assert.

►
error TS6053: File 'https://deno.land/x/once/index.js' not found.

►

Found 2 errors.

I didn't try to bundle remote URL at first, instead, I tried bundling a local file (deps.ts) that import remote JS file. No compile errors occur, but a runtime error (cannot read property of undefined) was thrown when attempting to run it in the browser and in Node.js.
Issue 1:
by hyperbolic.tom:

See here:

http://golang.org/ref/spec#Method_values

"As with method calls, a reference to a non-interface method with a pointer
receiver using an addressable value will automatically take the address of that value:
t.Mv is equivalent to (&t).Mv."

I'm pretty sure that should say t.Mp is equivalent to (&t).Mp.

Issue 2:
by michael.tautschnig:

Hi,

While building your package using our research compiler infrastructure we noticed that
there are two definitions of "p9main" available while bootstrapping addr2line
(and likely also all other subsequently compiled tools).

This is caused by fmt/test.c being included in lib9.a (src/cmd/dist/build.c picks all of
fmt/*).

Best,
Michael
Issue 1:
Consider this .gitignore:

/lib/*
!/lib/foo/

Here, we are instructing git to ignore everything under /lib, except for things under /lib/foo. However, tree-view does not parse this correctly, and instead matches everything under /lib, regardless of whether it's under /lib/foo or not. Thus, if I have "Hide VCS Ignored Files" unchecked, everything under /lib and lib/foo will be ghosted out. If I have "Hide CVS Ignored Files" check, everything under /lib and /lib/foo will be hidden. It appears that it's using the first rule that matches, and not the most-specific rule that matches.

Issue 2:
Let's say I add the following rules to my .gitignore to ignore everything in the root except the wp-content directory:

/*
!.gitignore
!wp-content/

So far this works correctly (only .gitignore and wp-content/ are shown in the tree view). Now I add the following rules to ignore everything in the wp-content directory, except the plugins and themes directories

wp-content/*
!wp-content/plugins/
!wp-content/themes/

Before Atom 0.116.0, the plugins and themes directories were shown correctly in the tree view, but now the wp-content directory disappears completely. My machine's git (v2.0.0) parses the .gitignore correctly and sees changes in plugins and themes.

I see that 0.116.0 moved to libgit2 0.21.0. If this is what's causing this behavior I'll open an issue with them.
Issue 1:
There are three impls in int-template.rs and uint-template.rs that apply to all numeric types. Until recently, if you tried to do this:

import int::num;
import i8::num;

you'd receive "error: duplicate definition of type num". d14d415 fixed this for the particular case of the num impl, but trying to duplicate the process for the eq and ord impls gives weird errors in libstd/sort.rs that I'm hoping the resolve rewrite will, er, resolve. It won't be possible to automatically export the eq and ord impls on numeric types until this is fixed.

Issue 2:
I attempted to compile this code:

pub fn set_game_state<T: GameState>(&mut self, state: ~T) {
self.state = state;
}

It gave me the error:

src/game_window.rs:37:18: 37:23 error: mismatched types: expected `~game_state::GameState:Send` but found `~T` (expected trait game_state::GameState but found ~-ptr)
src/game_window.rs:37 self.state = state;

The following code did compile:

pub fn set_game_state(&mut self, state: ~GameState) {
self.state = state;
}

I was made aware on the IRC Chat that both of these snippets of code should have worked.

Rust Version: master (0.10-pre)

OS: Mac OSX 10.9

Architecture: x86_64
Issue 1:
Version

2.6.10

Reproduction link

https://codesandbox.io/s/vue-template-bs7uj

Steps to reproduce

Create a render function that uses dynamic imports (like sliceZone.vue in the sandbox)

then use it anywhere in your app (tested in a Nuxt project and a Vue Codesandbox).

You should notice an infinite loop that crashes your app.

What is expected?

Dynamic import should work without the parent component to be re-rendered

What is actually happening?

Component calling a dynamic import should not re-render indefinitely

The problem probably comes from my lack of understanding of Vuejs / dynamic imports.

Any working example would be greatly appreciated!

Issue 2:
Version

2.6.10

Reproduction link

https://jsfiddle.net/gupvmj5x/

Steps to reproduce

Create <div id="app">{{ info }}</div> in the HTML, Create a new Vue instance by attaching the div. Add info as a data entry with a value, say 'Hello'. Run the app. To see the problem in action, pause the debugger at line 5873 in the Vue source file which is nodeOps.removeChild(parent, el);. In the Elements tab, there will be two divs with the same id.

What is expected?

The first div with the curly braces is replaced with the new div containing the info data.

What is actually happening?

The new div with the data is appended to the parent of the first div with the curly braces. Later the first div is removed which happens at line 5873.

There should a new function in nodeOps called replaceChild and should be used to perform the action which is expected. replaceChild is not present in IE8 but since Vue does not target IE8 we don't care.
Issue 1:
Apache Airflow version

Other Airflow 2 version

What happened

We noticed that tasks using the dynamic task mapping api crashes the scheduler with the error

psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "task_instance_pkey"
80
DETAIL: Key (dag_id, task_id, run_id, map_index)=(ingestion-scheduler, check_for_success_flag, manual__2022-10-03T15:56:03.241451+00:00, 0) already exists.

We have 2 schedulers so my guess is that both try to schedule the dynamically mapped task

What you think should happen instead

it should be not crash the scheduler

How to reproduce

run a large dynamically mapped task in multi-scheduler environment

Operating System

linux

Versions of Apache Airflow Providers

No response

Deployment

Other Docker-based deployment

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

Yes I am willing to submit a PR!

Code of Conduct

I agree to follow this project's Code of Conduct

Issue 2:
Apache Airflow version

2.2.4 (latest released)

What happened

Documentation for airflow.providers.cncf.kubernetes.operators.kubernetes_pod suggests that template_fields are a list of string values. This is accordance with Airflow's custom operator guides, to create a class attribute with a list of string values. However, when consulting the source code, the values for template_fields are stored in a tuple:

template_fields: Sequence[str] = (
'image',
'cmds',
'arguments',
'env_vars',
'labels',
'config_file',
'pod_template_file',
'namespace',

)

This is problematic from a documentation standpoint, since it is unclear how to extend behaviors with ambiguous typing. For example, I will encounter a runtime error when extending template fields as such:

from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator

class CustomKubernetesPodOperator(KubernetesPodOperator):
# The following will fail
template_fields = KubernetesPodOperator.template_fields + ["name"]

def __init__(self):
super.__init__()

My solution is to wrap the template_fields in a list constructor as such:

template_fields = list(KubernetesPodOperator.template_fields) + ["name"]

But this is not an elegant solution. Plus, documentation was not helpful. A solution would be to either clarify the documentation (that this is stored as a tuple default), or convert to storing as a list. (As typical with other Airflow operators.)

What you expected to happen

No response

How to reproduce

No response

Operating System

NA

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

NA

Anything else

NA

Are you willing to submit PR?

Yes I am willing to submit a PR!

Code of Conduct

I agree to follow this project's Code of Conduct
Issue 1:
I am trying to solve a linear system as effeciently as possible, and one of the methods I have been trying is by reordering the matrix beforehand with reverse_cuthill_mckee.

This works well for small matrices, but when I move to a large size this breaks. (60000x60000)

The code to reproduce this is really simple:

perm = scipy.sparse.csgraph.reverse_cuthill_mckee(H, symmetric_mode=True)
I,J = np.ix_(perm,perm)
H_reordered = H[I,J]

Where H is a symmetric 60000x60000 sparse csc matrix with some nonzero elements. In my case it has about 7 million nonzero elements

When I run the above I get:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1\plugins\python-ce\helpers\pydev\pydevd.py", line 1438, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/Dropbox/ActiveLearning/Pytorch/Active-Learning/pcg.py", line 37, in <module>
H_ref = H[I,J]
File "D:\Dropbox\ActiveLearning\Pytorch\Active-Learning\venv\lib\site-packages\scipy\sparse\_index.py", line 75, in __getitem__
return self._get_arrayXarray(row, col)
File "D:\Dropbox\ActiveLearning\Pytorch\Active-Learning\venv\lib\site-packages\scipy\sparse\compressed.py", line 664, in _get_arrayXarray
csr_sample_values(M, N, self.indptr, self.indices, self.data,
ValueError: could not convert integer scalar

And the reason as far as I can see is that the reordering involves making a 60000x60000 ndarray, which has about 3.6*10^9 elements and hence is too big int32.

Does anyone know of a workaround for this problem? or a fix?

Issue 2:
A typical way to perform outer indexing can be unnecessarily and surprisingly super slow. It is illustrated in the in/out below.

I think the issue could be fixed by adding another fast path for input as in my In [8] to scipy._index.IndexMixin, in a similar manner to how it's done when using the method of In [10].

Reproducing code example:

In [1]: import scipy.sparse as ss, numpy as np

In [2]: matrix = ss.random(2000, 50000, format="csr")

In [3]: idx0 = np.arange(1000)[:, None]

In [4]: idx1 = np.arange(1000, 2000)

In [5]: imod = np.arange(25)[None, :]

In [6]: idx1 = (idx1[:, None] + 1000 * imod).T.reshape(-1, 1)

In [8]: # The 'easy' way to index: also really slow
...: %timeit out0 = matrix[idx0, idx1.T]
743 ms � 48 ms per loop (mean � std. dev. of 7 runs, 1 loop each)

In [9]: # Equivalent submatrix, but not so easy to write: Much faster
...: %timeit out1 = matrix[idx0.ravel(), :][:, idx1.ravel()]
3.57 ms � 89.6 �s per loop (mean � std. dev. of 7 runs, 100 loops each)

In [10]: # There is an existing fast path when the second index is 1D
...: %timeit out2 = matrix[idx0, idx1.ravel()]
3.47 ms � 113 �s per loop (mean � std. dev. of 7 runs, 100 loops each)

Scipy/Numpy/Python version information:

In [40]: import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)
1.3.0 1.16.4 sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)