ernie-research/MEnvData-SWE huggingface dataset:
Repository: open-telemetry/opentelemetry-python (Python)

Issue:
Get Tracer operation should use an empty string if the specified name is null
As per spec change: https://github.com/open-telemetry/opentelemetry-specification/pull/1654



Discussion:
I'd like to try this; would appreciate if anyone wants to help, too. 



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4fb4c5b200..485b6453caa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD)
 
+### Changed
+- Updated get_tracer to return an empty string when passed an invalid name
+  ([#1854](https://github.com/open-telemetry/opentelemetry-python/pull/1854))
+
 ## [1.2.0, 0.21b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.2.0-0.21b0) - 2021-05-11
 
 ### Added
diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
index ece7da6d225..ad1d8284cdf 100644
--- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
+++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
@@ -997,7 +997,7 @@ def get_tracer(
         instrumenting_library_version: str = "",
     ) -> "trace_api.Tracer":
         if not instrumenting_module_name:  # Reject empty strings too.
-            instrumenting_module_name = "ERROR:MISSING MODULE NAME"
+            instrumenting_module_name = ""
             logger.error("get_tracer called with missing module name.")
         return Tracer(
             self.sampler,


Test patch:
diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py
index f12dc7c75cf..50d8d2ae858 100644
--- a/opentelemetry-sdk/tests/trace/test_trace.py
+++ b/opentelemetry-sdk/tests/trace/test_trace.py
@@ -257,17 +257,25 @@ def test_invalid_instrumentation_info(self):
             tracer1 = tracer_provider.get_tracer("")
         with self.assertLogs(level=ERROR):
             tracer2 = tracer_provider.get_tracer(None)
-        self.assertEqual(
-            tracer1.instrumentation_info, tracer2.instrumentation_info
-        )
+
         self.assertIsInstance(
             tracer1.instrumentation_info, InstrumentationInfo
         )
         span1 = tracer1.start_span("foo")
         self.assertTrue(span1.is_recording())
         self.assertEqual(tracer1.instrumentation_info.version, "")
+        self.assertEqual(tracer1.instrumentation_info.name, "")
+
+        self.assertIsInstance(
+            tracer2.instrumentation_info, InstrumentationInfo
+        )
+        span2 = tracer2.start_span("bar")
+        self.assertTrue(span2.is_recording())
+        self.assertEqual(tracer2.instrumentation_info.version, "")
+        self.assertEqual(tracer2.instrumentation_info.name, "")
+
         self.assertEqual(
-            tracer1.instrumentation_info.name, "ERROR:MISSING MODULE NAME"
+            tracer1.instrumentation_info, tracer2.instrumentation_info
         )
 
     def test_span_processor_for_source(self):
Repository: jax-ml/jax (Python)

Issue:
jax.block_until_ready() for blocking until pytrees leaves are ready
It is sometimes useful (e.g., in benchmarking) to disable JAX's asynchronous dispatch: https://jax.readthedocs.io/en/latest/async_dispatch.html

The easy way to compute an array is to call `.block_until_ready()`, but this doesn't work on pytrees.

I propose adding a function `jax.block_until_ready()` for mapping block_until_ready() over the leaves of a pytree:
```python
def block_until_ready(pytree):
  return tree_util.tree_map(lambda x: x.block_until_ready(), pytree)
```
I've written versions of this helper function quite a few times and it would be nice not to have to do so again.

This version requires that all leaves are JAX arrays. Alternatively, we could skip calling `.block_until_ready()` on non-JAX arrays, which don't have the method defined. This might be more generally useful.


Discussion:
@mattjj or perhaps we should have a typeclass for things you can block on? 😄 



Patch:
diff --git a/jax/__init__.py b/jax/__init__.py
index 7efc39f09f72..83de09d0003d 100644
--- a/jax/__init__.py
+++ b/jax/__init__.py
@@ -52,6 +52,7 @@
 )
 from jax._src.api import (
   ad,  # TODO(phawkins): update users to avoid this.
+  block_until_ready,
   checkpoint as checkpoint,
   checkpoint_policies as checkpoint_policies,
   closure_convert as closure_convert,
diff --git a/jax/_src/api.py b/jax/_src/api.py
index 7ec4453d9af2..4a0e1093b0eb 100644
--- a/jax/_src/api.py
+++ b/jax/_src/api.py
@@ -3138,3 +3138,22 @@ def invertible(fun: Callable) -> Callable:
     fun: The function assumed to be invertible.
   """
   return iad.invertible(fun)
+
+
+def block_until_ready(x):
+  """
+  Tries to call a ``block_until_ready`` method on pytree leaves.
+
+  Args:
+    x: a pytree, usually with at least some JAX array instances at its leaves.
+
+  Returns:
+    A pytree with the same structure and values of the input, where the values
+    of all JAX array leaves are ready.
+  """
+  def try_to_block(x):
+    try:
+      return x.block_until_ready()
+    except AttributeError:
+      return x
+  return jax.tree_util.tree_map(try_to_block, x)


Test patch:
diff --git a/tests/api_test.py b/tests/api_test.py
index 33c23f0e38d0..3898241a331b 100644
--- a/tests/api_test.py
+++ b/tests/api_test.py
@@ -1517,6 +1517,13 @@ def test_devicearray_block_until_ready(self):
     # Tests mostly that block_until_ready() does not produce an error.
     self.assertTrue(y is x)
 
+  def test_block_until_ready_function(self):
+    # Just tests that we don't error...
+    pytree = (device_put(1.), np.ones(3))
+    pytree = jax.block_until_ready(pytree)
+    self.assertAllClose(pytree[0], jnp.array(1.), check_dtypes=False)
+    self.assertAllClose(pytree[1], np.ones(3), check_dtypes=False)
+
   def test_devicearray_weakref_friendly(self):
     x = device_put(1.)
     y = weakref.ref(x)
Repository: jax-ml/jax (Python)

Issue:
two-operand cond conflicts with per-branch-operand cond
#8467 introduces multi-operand `lax.cond`. When given two operands, as in:

```python
def f(x):
  return lax.cond(x == 0, lax.add, lax.mul, x, y)
```

`cond` detects five total arguments and falls back to behavior that is backwards-compatible with the deprecated per-branch-operand `cond`. The latter accepts, in order: a predicate, true operand, true branch, false operand, and false branch. This results in an error:

```
TypeError: Value <function add ...> with type <class 'function'> is not a valid JAX type
```

One option is to rollback (or disallow) multi-operand cond for now, complete the deprecation of the previous cond, and roll forward (or re-enable) multi-operand cond.


Discussion:
Having the same issue here! For now, I have to strictly use single operand `cond` calls.
Thanks for letting us know! #8488 will fix. (Please let us know if it doesn't!)



Patch:
diff --git a/jax/_src/lax/control_flow.py b/jax/_src/lax/control_flow.py
index 2f8c92981b7e..1d75f4a972ae 100644
--- a/jax/_src/lax/control_flow.py
+++ b/jax/_src/lax/control_flow.py
@@ -788,7 +788,10 @@ def cond(*args, **kwargs):
   except TypeError:
     pass
   else:
-    return _cond_with_per_branch_args(*ba.args)
+    assert not ba.kwargs  # no catch-all **kwargs in _cond_with_per_branch
+    _, _, maybe_true_fun, _, maybe_false_fun = ba.args
+    if callable(maybe_true_fun) and callable(maybe_false_fun):
+      return _cond_with_per_branch_args(*ba.args)
 
   return _cond(*args, **kwargs)
 


Test patch:
diff --git a/tests/lax_control_flow_test.py b/tests/lax_control_flow_test.py
index 5a703d77431d..3a79710f81a6 100644
--- a/tests/lax_control_flow_test.py
+++ b/tests/lax_control_flow_test.py
@@ -599,8 +599,6 @@ def false_fun(x):
 
   def testCondTwoOperands(self):
     # see https://github.com/google/jax/issues/8469
-    self.skipTest("two-operand cond behavior is ambiguous (#8469)")
-
     add, mul = lax.add, lax.mul
 
     def fun(x):
Repository: nltk/nltk (Python)

Issue:
Wrong default value in aline.py
I believe the value of `C_skip` in https://github.com/nltk/nltk/blob/develop/nltk/metrics/aline.py#L51 should be negative. In particular, the value in the original paper seems to be `-10`, not `10` (see https://webdocs.cs.ualberta.ca/~kondrak/papers/thesis.pdf, p. 54).


Discussion:
Opened pull request #2712 
Not sure why but simply changing C_skip to -10 causes issues.
\>\>\> aline.align('tuwθ', 'dentis')
returns
[[('t', 't'), ('u', 'i'), ('w', '-'), ('θ', 's')]]  # Unmatched phonemes of "dentis" should still appear
instead of the expected
[[('t', 'd'), ('u', 'e'), ('w', '-'), ('-', 'n'), ('-', 't'), ('-', 'i'), ('θ', 's')]]
> Not sure why but simply changing C_skip to -10 causes issues.
> \>\>\> aline.align('tuwθ', 'dentis')
> returns
> [[('t', 't'), ('u', 'i'), ('w', '-'), ('θ', 's')]] # Unmatched phonemes of "dentis" should still appear
> instead of the expected
> [[('t', 'd'), ('u', 'e'), ('w', '-'), ('-', 'n'), ('-', 't'), ('-', 'i'), ('θ', 's')]]

The unit test after #2713 still does not reflect the correct output. Opened #2714 to reflect this issue.



Patch:
diff --git a/nltk/metrics/aline.py b/nltk/metrics/aline.py
index 5e0b4f3b43..4be2b92de4 100644
--- a/nltk/metrics/aline.py
+++ b/nltk/metrics/aline.py
@@ -47,7 +47,7 @@
 inf = float("inf")
 
 # Default values for maximum similarity scores (Kondrak 2002: 54)
-C_skip = 10  # Indels
+C_skip = -10  # Indels
 C_sub = 35  # Substitutions
 C_exp = 45  # Expansions/compressions
 C_vwl = 5  # Vowel/consonant relative weight (decreased from 10)
@@ -1084,7 +1084,7 @@ def align(str1, str2, epsilon=0):
     :type epsilon: float (0.0 to 1.0)
     :param epsilon: Adjusts threshold similarity score for near-optimal alignments
 
-    :rtpye: list(list(tuple(str, str)))
+    :rtype: list(list(tuple(str, str)))
     :return: Alignment(s) of str1 and str2
 
     (Kondrak 2002: 51)


Test patch:
diff --git a/nltk/test/unit/test_aline.py b/nltk/test/unit/test_aline.py
index cf73f8fc8c..564dd2a0d1 100644
--- a/nltk/test/unit/test_aline.py
+++ b/nltk/test/unit/test_aline.py
@@ -6,9 +6,7 @@
 
 def test_aline():
     result = aline.align("θin", "tenwis")
-    expected = [
-        [("θ", "t"), ("i", "e"), ("n", "n"), ("-", "w"), ("-", "i"), ("-", "s")]
-    ]
+    expected = [[("θ", "t"), ("i", "e"), ("n", "n")]]
 
     assert result == expected
 
@@ -31,24 +29,13 @@ def test_aline():
             ("w", "w"),
             ("e", "e"),
             ("n", "n"),
-            ("i", "-"),
         ]
     ]
 
     assert result == expected
 
     result = aline.align("tuwθ", "dentis")
-    expected = [
-        [
-            ("t", "d"),
-            ("u", "e"),
-            ("w", "-"),
-            ("-", "n"),
-            ("-", "t"),
-            ("-", "i"),
-            ("θ", "s"),
-        ]
-    ]
+    expected = [[("t", "t"), ("u", "i"), ("w", "-"), ("θ", "s")]]
 
     assert result == expected
Repository: pyro-ppl/pyro (Python)

Issue:
[bug] Samples from LKJCorrCholesky have the wrong shape
### Issue Description
The batch and sample shapes for `LKJCorrCholesky` are swapped when sampling.

### Environment
OS: Ubuntu 16.04
Python: 3.7.2
Torch version: 1.6.0
Pyro version: 1.4.0

### Code Snippet
Minimal example:

```python
>>> dist = pyro.distributions.LKJCorrCholesky(d=3, eta=torch.ones(())).expand(12)
>>> # batch shape and event shape are as you'd expect
>>> dist.batch_shape
torch.Size([12])
>>> dist.event_shape
torch.Size([3, 3])
>>> # samples have correct shape when sample_shape=()
>>> dist.shape(())
torch.Size([12, 3, 3])
>>> dist.sample().shape
torch.Size([12, 3, 3])
>>> # samples have the wrong shape when sample_shape is non-unit
>>> dist.shape((4,))  # as expected
torch.Size([4, 12, 3, 3])
>>> dist.sample((4,)).shape
torch.Size([12, 4, 3, 3])
```

I think this line is the culprit: https://github.com/pyro-ppl/pyro/blob/7c2c22c10dffda8a33ffbd593cc8d58819959e40/pyro/distributions/lkj.py#L67

```python
    def sample(self, sample_shape=torch.Size()):
        y = self._gen.sample(sample_shape=self.batch_shape + sample_shape).detach()
        z = y.mul(2).add(-1.0)
        return _vector_to_l_cholesky(z)
```

should be 

```python
    def sample(self, sample_shape=torch.Size()):
        y = self._gen.sample(sample_shape=sample_shape + self.batch_shape).detach()
        z = y.mul(2).add(-1.0)
        return _vector_to_l_cholesky(z)
```



Discussion:

Patch:
diff --git a/pyro/distributions/lkj.py b/pyro/distributions/lkj.py
index 6db82c068e..7f1305d3c7 100644
--- a/pyro/distributions/lkj.py
+++ b/pyro/distributions/lkj.py
@@ -64,7 +64,8 @@ def __init__(self, d, eta, validate_args=None):
         super().__init__(torch.Size(), torch.Size((d, d)), validate_args=validate_args)
 
     def sample(self, sample_shape=torch.Size()):
-        y = self._gen.sample(sample_shape=self.batch_shape + sample_shape).detach()
+        with torch.no_grad():
+            y = self._gen.sample(sample_shape=sample_shape + self.batch_shape)
         z = y.mul(2).add(-1.0)
         return _vector_to_l_cholesky(z)
 


Test patch:
diff --git a/tests/distributions/test_lkj.py b/tests/distributions/test_lkj.py
index 683a750f7e..36e59283c8 100644
--- a/tests/distributions/test_lkj.py
+++ b/tests/distributions/test_lkj.py
@@ -109,3 +109,17 @@ def test_log_prob_d2(eta):
     tst = test_dist.log_prob(x)
 
     assert_tensors_equal(lp, tst, prec=1e-6)
+
+
+def test_sample_batch():
+    # Regression test for https://github.com/pyro-ppl/pyro/issues/2615
+    dist = LKJCorrCholesky(d=3, eta=torch.ones(())).expand([12])
+    # batch shape and event shape are as you'd expect
+    assert dist.batch_shape == torch.Size([12])
+    assert dist.event_shape == torch.Size([3, 3])
+    # samples have correct shape when sample_shape=()
+    assert dist.shape(()) == torch.Size([12, 3, 3])
+    assert dist.sample().shape == torch.Size([12, 3, 3])
+    # samples had the wrong shape when sample_shape is non-unit
+    assert dist.shape((4,)) == torch.Size([4, 12, 3, 3])
+    assert dist.sample((4,)).shape == torch.Size([4, 12, 3, 3])
Repository: pvlib/pvlib-python (Python)

Issue:
pvlib.irradiance.reindl() model generates NaNs when GHI = 0
**Describe the bug**
The reindl function should give zero sky diffuse when GHI is zero. Instead it generates NaN or Inf values due to "term3" having a quotient that divides by GHI.  

**Expected behavior**
The reindl function should result in zero sky diffuse when GHI is zero.




Discussion:
Verified. Looks like an easy fix.



Patch:
diff --git a/docs/sphinx/source/whatsnew/v0.9.0.rst b/docs/sphinx/source/whatsnew/v0.9.0.rst
index 605898cf61..e7907efc7d 100644
--- a/docs/sphinx/source/whatsnew/v0.9.0.rst
+++ b/docs/sphinx/source/whatsnew/v0.9.0.rst
@@ -100,7 +100,8 @@ Bug fixes
 * Pass weather data to solar position calculations in
   :ref:meth:`~pvlib.modelchain.ModelChain.prepare_inputs_from_poa`.
   (:issue:`1065`, :pull:`1140`)
-
+* Reindl model fixed to generate sky_diffuse=0 when GHI=0.
+  (:issue:`1153`, :pull:`1154`)
 Testing
 ~~~~~~~
 
diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py
index 65800300b9..3ec6b213f9 100644
--- a/pvlib/irradiance.py
+++ b/pvlib/irradiance.py
@@ -886,8 +886,9 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
     # these are the () and [] sub-terms of the second term of eqn 8
     term1 = 1 - AI
     term2 = 0.5 * (1 + tools.cosd(surface_tilt))
-    term3 = 1 + np.sqrt(HB / ghi) * (tools.sind(0.5 * surface_tilt) ** 3)
-
+    with np.errstate(invalid='ignore', divide='ignore'):
+        hb_to_ghi = np.where(ghi == 0, 0, np.divide(HB, ghi))
+    term3 = 1 + np.sqrt(hb_to_ghi) * (tools.sind(0.5 * surface_tilt)**3)
     sky_diffuse = dhi * (AI * Rb + term1 * term2 * term3)
     sky_diffuse = np.maximum(sky_diffuse, 0)
 


Test patch:
diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py
index dd914eba34..ba5821f750 100644
--- a/pvlib/tests/test_irradiance.py
+++ b/pvlib/tests/test_irradiance.py
@@ -203,7 +203,7 @@ def test_reindl(irrad_data, ephem_data, dni_et):
         40, 180, irrad_data['dhi'], irrad_data['dni'], irrad_data['ghi'],
         dni_et, ephem_data['apparent_zenith'], ephem_data['azimuth'])
     # values from matlab 1.4 code
-    assert_allclose(result, [np.nan, 27.9412, 104.1317, 34.1663], atol=1e-4)
+    assert_allclose(result, [0., 27.9412, 104.1317, 34.1663], atol=1e-4)
 
 
 def test_king(irrad_data, ephem_data):
Repository: python-telegram-bot/python-telegram-bot (Python)

Issue:
Fix Filters.text (docs)
As a legacy `filters.text` has a check that the message does not start with `/`. In order to not conflict with `Commandhandler`
https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/ext/filters.py#L246
This is no longer needed because Commandhandler now uses entities to check for a command. In any case this bahavior is not documented.
A user can well be confused by `MessageHandler(Filters.text, callback)` will not respond to a message that starts with a `/`. At least the docs should be fixed, but I prefer it to remove the check and just pass any message with text to the user.


Discussion:

Patch:
diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py
index 8e4eac8012a..98a04681550 100644
--- a/telegram/ext/filters.py
+++ b/telegram/ext/filters.py
@@ -243,7 +243,7 @@ def __init__(self, iterable):
                 self.name = 'Filters.text({})'.format(iterable)
 
             def filter(self, message):
-                if message.text and not message.text.startswith('/'):
+                if message.text:
                     return message.text in self.iterable
                 return False
 
@@ -257,7 +257,7 @@ def __call__(self, update):
                 return self._TextIterable(update)
 
         def filter(self, message):
-            return bool(message.text and not message.text.startswith('/'))
+            return bool(message.text)
 
     text = _Text()
     """Text Messages. If an iterable of strings is passed, it filters messages to only allow those


Test patch:
diff --git a/tests/test_filters.py b/tests/test_filters.py
index b1525b87e4a..bba1eda9a37 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -45,11 +45,11 @@ def test_filters_text(self, update):
         update.message.text = 'test'
         assert (Filters.text)(update)
         update.message.text = '/test'
-        assert not (Filters.text)(update)
+        assert (Filters.text)(update)
 
     def test_filters_text_iterable(self, update):
-        update.message.text = 'test'
-        assert Filters.text({'test', 'test1'})(update)
+        update.message.text = '/test'
+        assert Filters.text({'/test', 'test1'})(update)
         assert not Filters.text(['test1', 'test2'])(update)
 
     def test_filters_caption(self, update):
@@ -625,7 +625,7 @@ def test_and_filters(self, update):
         update.message.forward_date = datetime.datetime.utcnow()
         assert (Filters.text & Filters.forwarded)(update)
         update.message.text = '/test'
-        assert not (Filters.text & Filters.forwarded)(update)
+        assert (Filters.text & Filters.forwarded)(update)
         update.message.text = 'test'
         update.message.forward_date = None
         assert not (Filters.text & Filters.forwarded)(update)
Repository: python-gitlab/python-gitlab (Python)

Issue:
PyPI package contains "docs" and "tests" modules
## Description of the problem, including code/CLI snippet

One of the last releases introduced a packaging problem.


## Expected Behavior

Only the package `gitlab` is installed into site-packages.

## Actual Behavior

The packages `docs`, `gitlab`, and `tests` get installed into site-packages

## Specifications

  - python-gitlab version: 2.10.1
  - API version you are using (v3/v4):
  - Gitlab server version (or gitlab.com):



Discussion:
This was partially solved with https://github.com/python-gitlab/python-gitlab/pull/1587, but we still need to clean up the docs. Thanks for the report, missed that!



Patch:
diff --git a/setup.py b/setup.py
index c809142f4..95d60c87c 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@ def get_version():
     author_email="gauvain@pocentek.net",
     license="LGPLv3",
     url="https://github.com/python-gitlab/python-gitlab",
-    packages=find_packages(exclude=["tests*"]),
+    packages=find_packages(exclude=["docs*", "tests*"]),
     install_requires=["requests>=2.25.0", "requests-toolbelt>=0.9.1"],
     package_data={
         "gitlab": ["py.typed"],


Test patch:
diff --git a/tests/smoke/test_dists.py b/tests/smoke/test_dists.py
index 6f38ff704..4324ebec2 100644
--- a/tests/smoke/test_dists.py
+++ b/tests/smoke/test_dists.py
@@ -9,6 +9,7 @@
 from gitlab import __title__, __version__
 
 DIST_DIR = Path("dist")
+DOCS_DIR = "docs"
 TEST_DIR = "tests"
 SDIST_FILE = f"{__title__}-{__version__}.tar.gz"
 WHEEL_FILE = (
@@ -18,8 +19,8 @@
 
 @pytest.fixture(scope="function")
 def build():
-    sandbox.run_setup("setup.py", ["clean", "--all"])
-    return sandbox.run_setup("setup.py", ["sdist", "bdist_wheel"])
+    sandbox.run_setup("setup.py", ["--quiet", "clean", "--all"])
+    return sandbox.run_setup("setup.py", ["--quiet", "sdist", "bdist_wheel"])
 
 
 def test_sdist_includes_tests(build):
@@ -28,6 +29,6 @@ def test_sdist_includes_tests(build):
     assert test_dir.isdir()
 
 
-def test_wheel_excludes_tests(build):
+def test_wheel_excludes_docs_and_tests(build):
     wheel = zipfile.ZipFile(DIST_DIR / WHEEL_FILE)
-    assert [not file.startswith(TEST_DIR) for file in wheel.namelist()]
+    assert not any([file.startswith((DOCS_DIR, TEST_DIR)) for file in wheel.namelist()])
Repository: palantir/python-language-server (Python)

Issue:
It would be better to keep output from the flake8 linter to be consistent with that of pycodestyle.
Currently, the return message the flake8 linter [here](https://github.com/palantir/python-language-server/blob/develop/pyls/plugins/flake8_lint.py) does not contain the error code, while that of pycodestyle also include the error code.

It would be better to include the error code as well, something like the following:

> E303 too many blank lines (2)

It is a fairly simple fix.  Should I open a pull request for this?



Discussion:
Yes, please do. And thanks for your help @jdhao!



Patch:
diff --git a/pyls/plugins/flake8_lint.py b/pyls/plugins/flake8_lint.py
index 1a658518..4f2e054e 100644
--- a/pyls/plugins/flake8_lint.py
+++ b/pyls/plugins/flake8_lint.py
@@ -144,6 +144,8 @@ def parse_stdout(document, stdout):
         _, line, character, code, msg = parsed_line
         line = int(line) - 1
         character = int(character) - 1
+        # show also the code in message
+        msg = code + ' ' + msg
         diagnostics.append(
             {
                 'source': 'flake8',


Test patch:
diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py
index acc770b2..75adf4ea 100644
--- a/test/plugins/test_flake8_lint.py
+++ b/test/plugins/test_flake8_lint.py
@@ -31,7 +31,7 @@ def temp_document(doc_text, workspace):
 def test_flake8_unsaved(workspace):
     doc = Document('', workspace, DOC)
     diags = flake8_lint.pyls_lint(workspace, doc)
-    msg = 'local variable \'a\' is assigned to but never used'
+    msg = 'F841 local variable \'a\' is assigned to but never used'
     unused_var = [d for d in diags if d['message'] == msg][0]
 
     assert unused_var['source'] == 'flake8'
@@ -45,7 +45,7 @@ def test_flake8_lint(workspace):
     try:
         name, doc = temp_document(DOC, workspace)
         diags = flake8_lint.pyls_lint(workspace, doc)
-        msg = 'local variable \'a\' is assigned to but never used'
+        msg = 'F841 local variable \'a\' is assigned to but never used'
         unused_var = [d for d in diags if d['message'] == msg][0]
 
         assert unused_var['source'] == 'flake8'
Repository: python-gitlab/python-gitlab (Python)

Issue:
Support deleting package files
The GitLab API now supports deleting package files (as of v13.12), docs located here:
https://docs.gitlab.com/ee/api/packages.html#delete-a-package-file

As far as I can tell, this library doesn't support this API call yet.


Discussion:

Patch:
diff --git a/docs/gl_objects/packages.rst b/docs/gl_objects/packages.rst
index cc64e076c..cdb7d3094 100644
--- a/docs/gl_objects/packages.rst
+++ b/docs/gl_objects/packages.rst
@@ -89,6 +89,13 @@ List package files for package in project::
     package = project.packages.get(1)
     package_files = package.package_files.list()
 
+Delete a package file in a project::
+
+    package = project.packages.get(1)
+    file = package.package_files.list()[0]
+    package.package_files.delete(file.id)
+
+
 Generic Packages
 ================
 
diff --git a/gitlab/v4/objects/packages.py b/gitlab/v4/objects/packages.py
index e76a5c66f..d049d2897 100644
--- a/gitlab/v4/objects/packages.py
+++ b/gitlab/v4/objects/packages.py
@@ -162,7 +162,7 @@ class ProjectPackageFile(RESTObject):
     pass
 
 
-class ProjectPackageFileManager(ListMixin, RESTManager):
+class ProjectPackageFileManager(DeleteMixin, ListMixin, RESTManager):
     _path = "/projects/%(project_id)s/packages/%(package_id)s/package_files"
     _obj_cls = ProjectPackageFile
     _from_parent_attrs = {"project_id": "project_id", "package_id": "id"}


Test patch:
diff --git a/tests/unit/objects/test_packages.py b/tests/unit/objects/test_packages.py
index 687054f27..68224ceac 100644
--- a/tests/unit/objects/test_packages.py
+++ b/tests/unit/objects/test_packages.py
@@ -155,6 +155,19 @@ def resp_delete_package(no_content):
         yield rsps
 
 
+@pytest.fixture
+def resp_delete_package_file(no_content):
+    with responses.RequestsMock() as rsps:
+        rsps.add(
+            method=responses.DELETE,
+            url="http://localhost/api/v4/projects/1/packages/1/package_files/1",
+            json=no_content,
+            content_type="application/json",
+            status=204,
+        )
+        yield rsps
+
+
 @pytest.fixture
 def resp_list_package_files():
     with responses.RequestsMock() as rsps:
@@ -229,6 +242,11 @@ def test_list_project_package_files(project, resp_list_package_files):
     assert package_files[0].id == 25
 
 
+def test_delete_project_package_file(project, resp_delete_package_file):
+    package = project.packages.get(1, lazy=True)
+    package.package_files.delete(1)
+
+
 def test_upload_generic_package(tmp_path, project, resp_upload_generic_package):
     path = tmp_path / file_name
     path.write_text(file_content)
Repository: PyCQA/pycodestyle (Python)

Issue:
Regression, false negative E302
### sample code

```python
def f():
    pass

# wat
@hi
def g():
    pass
```

### 2.5.0 behaviour

```console
$ ./venv/bin/pycodestyle --version
2.5.0
$ ./venv/bin/pycodestyle  t.py
$ echo $?
0
```

### 2.4.0 behaviour

```console
$ ./venv/bin/pycodestyle --version
2.4.0
$ ./venv/bin/pycodestyle  t.py 
t.py:5:1: E302 expected 2 blank lines, found 1
```

### git bisection

```console
$ git bisect start
$ git bisect good 2.4.0
$ git bisect bad 2.5.0
$ git bisect run bash -c '! python3 pycodestyle.py ../t.py'
...
running bash -c ! python3 pycodestyle.py ../t.py
0138bb106403241564a0c5af67886c05a2f4f690 is the first bad commit
commit 0138bb106403241564a0c5af67886c05a2f4f690
Author: Antony Lee <anntzer.lee@gmail.com>
Date:   Wed Nov 28 00:43:17 2018 +0100

    Allow omitting blank lines around one-liner definitions.

:100755 100755 c9e1667150d1a78fd236f8272906f3862425b3d5 27009c648ff090847cf78ec26c83fbd79be11d5a M	pycodestyle.py
:040000 040000 c138e2e23b06e384dfc052ffdfaaf372d203c480 817cc37bedea6034c3cf06468c42811b0111de27 M	testsuite
bisect run success
```

0138bb106403241564a0c5af67886c05a2f4f690

CC @anntzer 


Discussion:

Patch:
diff --git a/pycodestyle.py b/pycodestyle.py
index 03696b7a..ec6b894d 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -358,14 +358,15 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
           ):
         yield 0, "E303 too many blank lines (%d)" % blank_lines
     elif STARTSWITH_TOP_LEVEL_REGEX.match(logical_line):
-        # If this is a one-liner (i.e. the next line is not more
-        # indented), and the previous line is also not deeper
-        # (it would be better to check if the previous line is part
-        # of another def/class at the same level), don't require blank
-        # lines around this.
+        # If this is a one-liner (i.e. this is not a decorator and the
+        # next line is not more indented), and the previous line is also
+        # not deeper (it would be better to check if the previous line
+        # is part of another def/class at the same level), don't require
+        # blank lines around this.
         prev_line = lines[line_number - 2] if line_number >= 2 else ''
         next_line = lines[line_number] if line_number < len(lines) else ''
-        if (expand_indent(prev_line) <= indent_level and
+        if (not logical_line.startswith("@") and
+                expand_indent(prev_line) <= indent_level and
                 expand_indent(next_line) <= indent_level):
             return
         if indent_level:


Test patch:
diff --git a/testsuite/E30.py b/testsuite/E30.py
index 320b2a1b..15fbdf31 100644
--- a/testsuite/E30.py
+++ b/testsuite/E30.py
@@ -181,3 +181,11 @@ def foo():
     def bar(): pass
     def baz():
         pass
+#: E302:5:1
+def f():
+    pass
+
+# wat
+@hi
+def g():
+    pass
Repository: pgmpy/pgmpy (Python)

Issue:
ContinuousFactor normalize bug by typo
### Subject of the issue

This line of `ContinuousFactor.normalize()` is wrong because of the typo.

https://github.com/pgmpy/pgmpy/blob/b2ea305e19779891f0d6543d1cbb3a1532a58c03/pgmpy/factors/continuous/ContinuousFactor.py#L303

Also, I don't know why it calls `phi.distribution.normalize()` with `inplace=False`. I think it would be better to call with `inplace=inplace`.

### Your environment
* pgmpy version: Last commit: b2ea305
* Python version: It does not matter
* Operating System: It does not matter




Discussion:
@davenza Yes, you are right. Would you like to open a Pull Request fixing this?



Patch:
diff --git a/pgmpy/factors/continuous/ContinuousFactor.py b/pgmpy/factors/continuous/ContinuousFactor.py
index 053cc3254..c9643a6e2 100644
--- a/pgmpy/factors/continuous/ContinuousFactor.py
+++ b/pgmpy/factors/continuous/ContinuousFactor.py
@@ -300,7 +300,7 @@ def normalize(self, inplace=True):
 
         """
         phi = self if inplace else self.copy()
-        phi.distriution = phi.distribution.normalize(inplace=False)
+        phi.distribution.normalize(inplace=True)
 
         if not inplace:
             return phi


Test patch:
diff --git a/pgmpy/tests/test_factors/test_continuous/test_ContinuousFactor.py b/pgmpy/tests/test_factors/test_continuous/test_ContinuousFactor.py
index 9fb24ac23..87a4c0e63 100644
--- a/pgmpy/tests/test_factors/test_continuous/test_ContinuousFactor.py
+++ b/pgmpy/tests/test_factors/test_continuous/test_ContinuousFactor.py
@@ -259,7 +259,7 @@ def pdf2(x1, x2):
         self.assertEqual(phi4.scope(), phi2.scope())
         for inp in np.random.rand(1, 2):
             np_test.assert_almost_equal(
-                phi4.pdf(inp[0], inp[1]), 2 * self.pdf2(inp[0], inp[1])
+                phi4.pdf(inp[0], inp[1]), self.pdf2(inp[0], inp[1])
             )
 
         phi2.normalize()
Repository: pre-commit/pre-commit (Python)

Issue:
Handle when `core.hooksPath` is set?
As we found in https://github.com/pre-commit/pre-commit-hooks/issues/250, pre-commit (despite being installed) will be silently skipped if `core.hooksPath` is set.

A few options:
- during `pre-commit install`, check this variable and warn
- "" but error
- install into the directory at `core.hooksPath` (but it may be outside the working dir? probably not the best idea to write to it)


Discussion:
Or a prompt when running `pre-commit install` along the lines of:

> We noticed that you have set a different directory for the git hooks via the `core.hooksPath` config. Do you want us to remove it so `pre-commit` will work or install it in the specified directory?
This has been released as part of [v1.7.0](https://github.com/pre-commit/pre-commit/releases/tag/v1.7.0)!
Awesome 👍



Patch:
diff --git a/pre_commit/commands/install_uninstall.py b/pre_commit/commands/install_uninstall.py
index 83b97cb1e..919122265 100644
--- a/pre_commit/commands/install_uninstall.py
+++ b/pre_commit/commands/install_uninstall.py
@@ -2,15 +2,19 @@
 from __future__ import unicode_literals
 
 import io
+import logging
 import os.path
 import sys
 
 from pre_commit import output
+from pre_commit.util import cmd_output
 from pre_commit.util import make_executable
 from pre_commit.util import mkdirp
 from pre_commit.util import resource_filename
 
 
+logger = logging.getLogger(__name__)
+
 # This is used to identify the hook file we install
 PRIOR_HASHES = (
     '4d9958c90bc262f47553e2c073f14cfe',
@@ -36,6 +40,13 @@ def install(
         skip_on_missing_conf=False,
 ):
     """Install the pre-commit hooks."""
+    if cmd_output('git', 'config', 'core.hooksPath', retcode=None)[1].strip():
+        logger.error(
+            'Cowardly refusing to install hooks with `core.hooksPath` set.\n'
+            'hint: `git config --unset-all core.hooksPath`',
+        )
+        return 1
+
     hook_path = runner.get_hook_path(hook_type)
     legacy_path = hook_path + '.legacy'
 


Test patch:
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py
index a49a3e4f3..f83708ea8 100644
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -66,6 +66,14 @@ def test_install_hooks_directory_not_present(tempdir_factory):
     assert os.path.exists(runner.pre_commit_path)
 
 
+def test_install_refuses_core_hookspath(tempdir_factory):
+    path = git_dir(tempdir_factory)
+    with cwd(path):
+        cmd_output('git', 'config', '--local', 'core.hooksPath', 'hooks')
+        runner = Runner(path, C.CONFIG_FILE)
+        assert install(runner)
+
+
 @xfailif_no_symlink
 def test_install_hooks_dead_symlink(
         tempdir_factory,
Repository: python-poetry/poetry (Python)

Issue:
The option of displaying environment path shows the output of the path without a new line
<!--
  Hi there! Thank you for discovering and submitting an issue.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [ ] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

<!--
  Once those are done, if you're able to fill in the following list with your information,
  it'd be very helpful to whoever handles the issue.
-->

- **OS version and name**: elementary OS 5.1.2 Hera
- **Poetry version**: 1.0.5

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
Poetry environment info option gives the current path value without a new line.

`$ poetry env info --path`

![Screenshot from 2020-03-18 14 59 19](https://user-images.githubusercontent.com/1765494/76974436-1c718a00-6929-11ea-9dac-64d67fb95a33.png)

I think that changing just a line within the `EnvInfoCommand` class would be fine.

Because the function writes the output with `self.write(str(env.path))` It might have to be `self.line(str(env.path))`. I think changing the value in this way can give the expected output.

https://github.com/python-poetry/poetry/blob/master/poetry/console/commands/env/info.py#L13-L26



Discussion:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.



Patch:
diff --git a/poetry/console/commands/env/info.py b/poetry/console/commands/env/info.py
index d66baa56408..301d88f9520 100644
--- a/poetry/console/commands/env/info.py
+++ b/poetry/console/commands/env/info.py
@@ -19,7 +19,7 @@ def handle(self):
             if not env.is_venv():
                 return 1
 
-            self.write(str(env.path))
+            self.line(str(env.path))
 
             return
 


Test patch:
diff --git a/tests/console/commands/env/test_info.py b/tests/console/commands/env/test_info.py
index 77001ead3c3..775680f13dc 100644
--- a/tests/console/commands/env/test_info.py
+++ b/tests/console/commands/env/test_info.py
@@ -48,4 +48,4 @@ def test_env_info_displays_path_only(app):
 
     expected = str(Path("/prefix"))
 
-    assert expected == tester.io.fetch_output()
+    assert expected + "\n" == tester.io.fetch_output()
Repository: sympy/sympy (Python)

Issue:
TypeError: 'ConditionSet' object is not iterable when calculating definite integral
```
>>> from sympy import *
>>> from sympy.abc import x,y
>>> f = (4 * (1/y - 1) * exp(-2 * (1/y - 1))) / (y**2)
>>> integrate(f,(y,0,1))
...
    for s in singularities:
TypeError: 'ConditionSet' object is not iterable
```

A similar issue happened in issue #13433, though this was fixed inadvertently by the changes in #14097. In this instance, the singularities of the function are defined by the ConditionSet

```
ConditionSet(y, Eq(y*exp(2/y), 0), Interval(0, 1))
```

and so when trying to iterate over this, python throws an error. I think an easy fix would be to catch the exception and pass, but there could be a better solution.


Discussion:
Agree it should just catch it and pass. 



Patch:
diff --git a/sympy/core/expr.py b/sympy/core/expr.py
index 8a70473455ef..f4b621a6f511 100644
--- a/sympy/core/expr.py
+++ b/sympy/core/expr.py
@@ -871,21 +871,25 @@ def _eval_interval(self, x, a, b):
             else:
                 domain = Interval(b, a)
             # check the singularities of self within the interval
+            # if singularities is a ConditionSet (not iterable), catch the exception and pass
             singularities = solveset(self.cancel().as_numer_denom()[1], x,
                 domain=domain)
             for logterm in self.atoms(log):
                 singularities = singularities | solveset(logterm.args[0], x,
                     domain=domain)
-            for s in singularities:
-                if value is S.NaN:
-                    # no need to keep adding, it will stay NaN
-                    break
-                if not s.is_comparable:
-                    continue
-                if (a < s) == (s < b) == True:
-                    value += -limit(self, x, s, "+") + limit(self, x, s, "-")
-                elif (b < s) == (s < a) == True:
-                    value += limit(self, x, s, "+") - limit(self, x, s, "-")
+            try:
+                for s in singularities:
+                    if value is S.NaN:
+                        # no need to keep adding, it will stay NaN
+                        break
+                    if not s.is_comparable:
+                        continue
+                    if (a < s) == (s < b) == True:
+                        value += -limit(self, x, s, "+") + limit(self, x, s, "-")
+                    elif (b < s) == (s < a) == True:
+                        value += limit(self, x, s, "+") - limit(self, x, s, "-")
+            except TypeError:
+                pass
 
         return value
 


Test patch:
diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py
index f23de08bcf37..a45f4044dff8 100644
--- a/sympy/integrals/tests/test_integrals.py
+++ b/sympy/integrals/tests/test_integrals.py
@@ -1388,3 +1388,9 @@ def test_issue_14782():
 def test_issue_12081():
     f = x**(-S(3)/2)*exp(-x)
     assert integrate(f, [x, 0, oo]) == oo
+
+
+def test_issue_15285():
+    y = 1/x - 1
+    f = 4*y*exp(-2*y)/x**2
+    assert integrate(f, [x, 0, 1]) == 1
Repository: sympy/sympy (Python)

Issue:
binomial(n,k) is not known to be nonnegative for nonnegative integers n,k
In the same spirit as in #13616:
```py
>>> n = Symbol('n', integer=True, nonnegative=True)
>>> k = Symbol('k', integer=True, nonnegative=True)
>>> binomial(n, k).is_nonnegative  # Should return True
```



Discussion:
I am taking this up.
Just wanted to know if this is really needed because if n and k are just symbols even if they are nonnegative , its not necessary that binomial(n,k) is necessarily nonnegative. The current behaviour is to ouput None which i think is acceptable. Please let me know regarding your idea.
I want to take this up, since there hasn't been any updates. Which file would be related to binomials?
Try:
```
git grep "class binomial"
```



Patch:
diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py
index 482ee77d6969..cb573b188942 100644
--- a/sympy/functions/combinatorial/factorials.py
+++ b/sympy/functions/combinatorial/factorials.py
@@ -907,3 +907,8 @@ def _eval_is_integer(self):
             return True
         elif k.is_integer is False:
             return False
+
+    def _eval_is_nonnegative(self):
+        if self.args[0].is_integer and self.args[1].is_integer:
+            if self.args[0].is_nonnegative and self.args[1].is_nonnegative:
+                return True


Test patch:
diff --git a/sympy/functions/combinatorial/tests/test_comb_factorials.py b/sympy/functions/combinatorial/tests/test_comb_factorials.py
index 617d41540857..739d1a64e8ab 100644
--- a/sympy/functions/combinatorial/tests/test_comb_factorials.py
+++ b/sympy/functions/combinatorial/tests/test_comb_factorials.py
@@ -281,6 +281,8 @@ def test_binomial():
     p = Symbol('p', positive=True)
     z = Symbol('z', zero=True)
     nt = Symbol('nt', integer=False)
+    a = Symbol('a', integer=True, nonnegative=True)
+    b = Symbol('b', integer=True, nonnegative=True)
 
     assert binomial(0, 0) == 1
     assert binomial(1, 1) == 1
@@ -321,6 +323,8 @@ def test_binomial():
 
     assert binomial(gamma(25), 6) == 79232165267303928292058750056084441948572511312165380965440075720159859792344339983120618959044048198214221915637090855535036339620413440000
 
+    assert binomial(a, b).is_nonnegative is True
+
 def test_binomial_diff():
     n = Symbol('n', integer=True)
     k = Symbol('k', integer=True)
Repository: andialbrecht/sqlparse (Python)

Issue:
strip_comments causing syntax error
If there is no space between comments and keyword, the output causes a syntax error. Here's an example:

```python
import sqlparse

sql='''select * from table1--this is a comment
inner join table2 on table1.id = table2.id--this is a comment
where table1.a=1'''

sqlparse.format(sql,strip_comments=True)
```
This gives the following as output:
`select * from table1inner join table2 on table1.id = table2.idwhere table1.a=1`


Discussion:
+1
Any update on this? Would be really nice to have....



Patch:
diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py
index df4d8615..b0bb8983 100644
--- a/sqlparse/filters/others.py
+++ b/sqlparse/filters/others.py
@@ -26,6 +26,13 @@ def get_next_comment():
             if (prev_ is None or next_ is None or
                     prev_.is_whitespace or prev_.match(T.Punctuation, '(') or
                     next_.is_whitespace or next_.match(T.Punctuation, ')')):
+                # Insert a whitespace to ensure the following SQL produces
+                # a valid SQL. For example:
+                #
+                # Before: select a--comment\nfrom foo
+                # After: select a from foo
+                if prev_ is not None and next_ is None:
+                    tlist.tokens.insert(tidx, sql.Token(T.Whitespace, ' '))
                 tlist.tokens.remove(token)
             else:
                 tlist.tokens[tidx] = sql.Token(T.Whitespace, ' ')


Test patch:
diff --git a/tests/test_format.py b/tests/test_format.py
index 72af62ee..aff07c17 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -50,6 +50,19 @@ def test_strip_comments_single(self):
         sql = 'select-- foo\nfrom -- bar\nwhere'
         res = sqlparse.format(sql, strip_comments=True)
         assert res == 'select from where'
+        sql = 'select *-- statement starts here\n\nfrom foo'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select * from foo'
+        sql = 'select * from foo-- statement starts here\nwhere'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select * from foo where'
+        sql = 'select a-- statement starts here\nfrom foo'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select a from foo'
+        sql = '--comment\nselect a-- statement starts here\n' \
+              'from foo--comment\nf'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select a from foo f'
 
     def test_strip_comments_invalid_option(self):
         sql = 'select-- foo\nfrom -- bar\nwhere'
Repository: sympy/sympy (Python)

Issue:
pprint(x*DiracDelta(x, 1)) gives TypeError: unorderable types: NoneType() > int()
```pytb
>>> pprint(x*DiracDelta(x, 1))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./sympy/printing/pretty/pretty.py", line 2101, in pretty_print
    print(pretty(expr, **settings))
  File "./sympy/printing/pretty/pretty.py", line 2068, in pretty
    return pp.doprint(expr)
  File "./sympy/printing/pretty/pretty.py", line 59, in doprint
    return self._print(expr).render(**self._settings)
  File "./sympy/printing/printer.py", line 257, in _print
    return getattr(self, printmethod)(expr, *args, **kwargs)
  File "./sympy/printing/pretty/pretty.py", line 1378, in _print_Mul
    return prettyForm.__mul__(*a)
  File "./sympy/printing/pretty/stringpict.py", line 443, in __mul__
    if arg.binding > prettyForm.MUL:
TypeError: unorderable types: NoneType() > int()
```

I bisected it to commit 5302444cbd0cb167f41f76e795d411784dce13a8:

```
commit 5302444cbd0cb167f41f76e795d411784dce13a8
Author: Sampad Kumar Saha <sampadsaha5@gmail.com>
Date:   Fri Jun 3 14:34:31 2016 +0530

    Diracdelta
    (x, 1) printing same as latex
```

CC @sampadsaha5 


Discussion:

Patch:
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index addcf27c50cf..a85a58ad4a16 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -1309,8 +1309,8 @@ def _print_DiracDelta(self, e):
                 c = self._print(e.args[0])
                 c = prettyForm(*c.parens())
                 pform = a**b
-                pform = stringPict(*pform.right(' '))
-                pform = stringPict(*pform.right(c))
+                pform = prettyForm(*pform.right(' '))
+                pform = prettyForm(*pform.right(c))
                 return pform
             pform = self._print(e.args[0])
             pform = prettyForm(*pform.parens())


Test patch:
diff --git a/sympy/printing/pretty/tests/test_pretty.py b/sympy/printing/pretty/tests/test_pretty.py
index 2faa38205877..1924715ea456 100644
--- a/sympy/printing/pretty/tests/test_pretty.py
+++ b/sympy/printing/pretty/tests/test_pretty.py
@@ -4869,6 +4869,11 @@ def test_deltas():
 u("""\
  (1)    \n\
 δ    (x)\
+""")
+    assert xpretty(x*DiracDelta(x, 1), use_unicode=True) == \
+u("""\
+   (1)    \n\
+x⋅δ    (x)\
 """)